From 5eab3474db49c50bfe8048ada7ac95e6f411e0a9 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 14 Oct 2020 14:42:45 -0700 Subject: [PATCH 1/9] docs: remove app hydration --- docs/index.html | 1 - docs/src/index.js | 5 +---- docs/svelte.config.js | 24 ++++++++++++------------ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/docs/index.html b/docs/index.html index 98e9585d..ce0d084b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -7,7 +7,6 @@ Carbon Components Svelte -
diff --git a/docs/src/index.js b/docs/src/index.js index 74ef981f..aba70f6a 100644 --- a/docs/src/index.js +++ b/docs/src/index.js @@ -1,8 +1,5 @@ import App from "./App.svelte"; -const app = new App({ - target: document.getElementById("app"), - hydrate: process.env.NODE_ENV === "production", -}); +const app = new App({ target: document.body }); export default app; diff --git a/docs/svelte.config.js b/docs/svelte.config.js index bc21505e..151b1167 100644 --- a/docs/svelte.config.js +++ b/docs/svelte.config.js @@ -7,7 +7,6 @@ const { format } = require("prettier"); const pkg = require("../package.json"); const fs = require("fs"); const Prism = require("prismjs"); -const { replace, postcss } = require("svelte-preprocess"); require("prism-svelte"); function createImports(source) { @@ -57,6 +56,7 @@ function createImports(source) { function plugin() { function visitor(node) { if ( + node.lang !== "svelte" && !node.value.startsWith("") && !node.value.match(/svx-ignore/g) @@ -125,19 +125,19 @@ const NODE_ENV = process.env.NODE_ENV || "production"; module.exports = { extensions: [".svelte", ".svx"], - hydratable: NODE_ENV === "production", preprocess: [ - require("svelte-preprocess")(), - replace([ - ["process.env.VERSION", JSON.stringify(pkg.version)], - ["process.env.NODE_ENV", JSON.stringify(NODE_ENV)], - ]), - postcss({ - plugins: [ - require("autoprefixer")({ - overrideBrowserslist: ["last 1 version", "ie >= 11"], - }), + require("svelte-preprocess")({ + replace: [ + ["process.env.VERSION", JSON.stringify(pkg.version)], + ["process.env.NODE_ENV", JSON.stringify(NODE_ENV)], ], + postcss: { + plugins: [ + require("autoprefixer")({ + overrideBrowserslist: ["last 1 version", "ie >= 11"], + }), + ], + }, }), mdsvex({ remarkPlugins: [plugin, slug, carbonify], From 9aee535a28ec6269040384bd2d3c45d680a61076 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 14 Oct 2020 14:43:16 -0700 Subject: [PATCH 2/9] docs(build): omit flatpickr l10n from vite optimizable deps --- docs/vite.config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/vite.config.js b/docs/vite.config.js index 1960f076..af675772 100644 --- a/docs/vite.config.js +++ b/docs/vite.config.js @@ -2,7 +2,6 @@ module.exports = { optimizeDeps: { include: [ "flatpickr", - "flatpickr/dist/l10n/index.js", "flatpickr/dist/plugins/rangePlugin", "clipboard-copy", ], From f86bd0710d2462f9b6d0a6e06d5f28f48230d526 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 14 Oct 2020 15:05:46 -0700 Subject: [PATCH 3/9] docs(pagination): add hidden page size example --- docs/src/pages/components/Pagination.svx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/src/pages/components/Pagination.svx b/docs/src/pages/components/Pagination.svx index 75973f9f..27cdc9e4 100644 --- a/docs/src/pages/components/Pagination.svx +++ b/docs/src/pages/components/Pagination.svx @@ -19,6 +19,10 @@ +### Hidden page size + + + ### Skeleton From 4b783e713332178e50c27df650c2a7e9892a8c9a Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 14 Oct 2020 15:06:02 -0700 Subject: [PATCH 4/9] docs(link): add target=_blank example --- docs/src/pages/components/Link.svx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/src/pages/components/Link.svx b/docs/src/pages/components/Link.svx index d6df7519..0241f069 100644 --- a/docs/src/pages/components/Link.svx +++ b/docs/src/pages/components/Link.svx @@ -7,6 +7,16 @@ Carbon Design System +### Target _blank + +Setting `target` to `"_blank"` opens the link in a new tab. + +If `target="_blank"`, the `Link` component will automatically set `rel="noopener noreferrer"` to guard against [potential cross-origin security exploits](https://web.dev/external-anchors-use-rel-noopener/). + +You can override the `rel` attribute with a custom value. + +Carbon Design System + ### Inline variant
From e221888565e9199aca1ea768aac78cf330fd88b0 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 14 Oct 2020 15:06:20 -0700 Subject: [PATCH 5/9] docs(combo-box): add light variant example --- docs/src/pages/components/ComboBox.svx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/src/pages/components/ComboBox.svx b/docs/src/pages/components/ComboBox.svx index edc4601c..8116ac6f 100644 --- a/docs/src/pages/components/ComboBox.svx +++ b/docs/src/pages/components/ComboBox.svx @@ -22,6 +22,15 @@ items={[ {id: "2", text: "Fax"} ]} /> +### Light variant + + + ### Extra-large size Date: Wed, 14 Oct 2020 15:14:54 -0700 Subject: [PATCH 6/9] docs(combo-box): add filterable example --- docs/src/pages/components/ComboBox.svx | 4 ++++ .../framed/ComboBox/FilterableComboBox.svelte | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 docs/src/pages/framed/ComboBox/FilterableComboBox.svelte diff --git a/docs/src/pages/components/ComboBox.svx b/docs/src/pages/components/ComboBox.svx index 8116ac6f..9670d341 100644 --- a/docs/src/pages/components/ComboBox.svx +++ b/docs/src/pages/components/ComboBox.svx @@ -22,6 +22,10 @@ items={[ {id: "2", text: "Fax"} ]} /> +### Filterable + + + ### Light variant + import { ComboBox } from "carbon-components-svelte"; + + function shouldFilterItem(item, value) { + if (!value) return true; + return item.text.toLowerCase().includes(value.toLowerCase()); + } + + + From 6bc47cb5fa1a24ddc53c125ed8a7d09e9d0b96b2 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 14 Oct 2020 15:24:03 -0700 Subject: [PATCH 7/9] docs(multi-select): add no sort example --- docs/src/pages/components/MultiSelect.svx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/src/pages/components/MultiSelect.svx b/docs/src/pages/components/MultiSelect.svx index 6a1c2ec1..691e4b4f 100644 --- a/docs/src/pages/components/MultiSelect.svx +++ b/docs/src/pages/components/MultiSelect.svx @@ -5,12 +5,25 @@ ### Default +By default, items will be ordered alphabetically based on the `item.text` value. To prevent this, see [#no-alphabetical-ordering](#no-alphabetical-ordering). + +### No alphabetical ordering + +To prevent alphabetical item ordering, pass an empty function to the `sortItem` prop. + + + ### Light variant Date: Wed, 14 Oct 2020 15:39:59 -0700 Subject: [PATCH 8/9] docs: remove prefetch behavior --- docs/src/pages/_layout.svelte | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/docs/src/pages/_layout.svelte b/docs/src/pages/_layout.svelte index cd7f73a6..4aa38814 100644 --- a/docs/src/pages/_layout.svelte +++ b/docs/src/pages/_layout.svelte @@ -1,7 +1,3 @@ - -