diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 98a9d2f5..555720d5 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -192,12 +192,12 @@ ### Props -| Prop name | Kind | Reactive | Type | Default value | Description | -| :-------------- | :--------------- | :------- | :------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| disabled | let | Yes | boolean | false | Set to `true` to disable the accordion item | -| open | let | Yes | boolean | false | Set to `true` to open the first accordion item | -| title | let | No | string | "title" | Specify the title of the accordion item heading
Alternatively, use the named slot "title" (e.g., <div slot="title">...</div>) | -| iconDescription | let | No | string | "Expand/Collapse" | Specify the ARIA label for the accordion item chevron icon | +| Prop name | Kind | Reactive | Type | Default value | Description | +| :-------------- | :--------------- | :------- | :------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- | +| disabled | let | Yes | boolean | false | Set to `true` to disable the accordion item | +| open | let | Yes | boolean | false | Set to `true` to open the first accordion item | +| title | let | No | string | "title" | Specify the title of the accordion item heading
Alternatively, use the "title" slot (e.g., <div slot="title">...</div>) | +| iconDescription | let | No | string | "Expand/Collapse" | Specify the ARIA label for the accordion item chevron icon | ### Slots @@ -294,9 +294,9 @@ None. ### Slots -| Slot name | Default | Props | Fallback | -| :-------- | :------ | :---- | :------- | -| -- | Yes | -- | -- | +| Slot name | Default | Props | Fallback | +| :-------- | :------ | :------------------------------------------------------------------------ | :------- | +| -- | Yes | {props?: { ["aria-current"]?: string; class: "bx--link"; }} | -- | ### Events @@ -387,11 +387,11 @@ None. ### Props -| Prop name | Kind | Reactive | Type | Default value | Description | -| :-------- | :--------------- | :------- | :--------------------------------------------------- | ---------------------- | -------------------------------------- | -| href | let | No | string | -- | Set the `href` to use an anchor link | -| size | let | No | "default" | "field" | "small" | "default" | Specify the size of button skeleton | -| small | let | No | boolean | false | Set to `true` to use the small variant | +| Prop name | Kind | Reactive | Type | Default value | Description | +| :-------- | :--------------- | :------- | :--------------------------------------------------- | ---------------------- | ------------------------------------ | +| href | let | No | string | -- | Set the `href` to use an anchor link | +| size | let | No | "default" | "field" | "small" | "default" | Specify the size of button skeleton | +| small | let | No | boolean | false | -- | ### Slots @@ -527,9 +527,9 @@ None. ### Props -| Prop name | Kind | Reactive | Type | Default value | Description | -| :-------- | :--------------- | :------- | :--------------------------------------------------- | --------------------- | ---------------------------- | -| type | let | No | "single" | "inline" | "multi" | "single" | Set the type of code snippet | +| Prop name | Kind | Reactive | Type | Default value | Description | +| :-------- | :--------------- | :------- | :----------------------------------- | --------------------- | ---------------------------- | +| type | let | No | "single" | "multi" | "single" | Set the type of code snippet | ### Slots @@ -2295,14 +2295,14 @@ export type NumberInputTranslationId = "increment" | "decrement"; ### Events -| Event name | Type | Detail | -| :--------- | :--------- | :----- | -| click | forwarded | -- | -| mouseover | forwarded | -- | -| mouseenter | forwarded | -- | -| mouseleave | forwarded | -- | -| input | forwarded | -- | -| change | dispatched | -- | +| Event name | Type | Detail | +| :--------- | :--------- | :------------------ | +| change | dispatched | number | +| click | forwarded | -- | +| mouseover | forwarded | -- | +| mouseenter | forwarded | -- | +| mouseleave | forwarded | -- | +| input | forwarded | -- | ## `NumberInputSkeleton` @@ -2377,14 +2377,14 @@ None. ### Events -| Event name | Type | Detail | -| :--------- | :--------- | :----- | -| click | forwarded | -- | -| mouseover | forwarded | -- | -| mouseenter | forwarded | -- | -| mouseleave | forwarded | -- | -| keydown | forwarded | -- | -| close | dispatched | -- | +| Event name | Type | Detail | +| :--------- | :--------- | :-------------------------------------------- | +| close | dispatched | { index: number; text: string; } | +| click | forwarded | -- | +| mouseover | forwarded | -- | +| mouseenter | forwarded | -- | +| mouseleave | forwarded | -- | +| keydown | forwarded | -- | ## `OverflowMenuItem` @@ -2444,9 +2444,9 @@ None. ### Events -| Event name | Type | Detail | -| :--------- | :--------- | :----- | -| update | dispatched | -- | +| Event name | Type | Detail | +| :--------- | :--------- | :----------------------------------------------- | +| update | dispatched | { pageSize: number; page: number; } | ## `PaginationNav` @@ -2467,11 +2467,11 @@ None. ### Events -| Event name | Type | Detail | -| :--------------------- | :--------- | :----- | -| click:button--previous | dispatched | -- | -| click:button--next | dispatched | -- | -| change | dispatched | -- | +| Event name | Type | Detail | +| :--------------------- | :--------- | :----------------------------- | +| change | dispatched | { page: number; } | +| click:button--previous | dispatched | { page: number; } | +| click:button--next | dispatched | { page: number; } | ## `PaginationSkeleton` @@ -2834,10 +2834,10 @@ None. ### Events -| Event name | Type | Detail | -| :--------- | :--------- | :----- | -| blur | forwarded | -- | -| change | dispatched | -- | +| Event name | Type | Detail | +| :--------- | :--------- | :------------------ | +| change | dispatched | string | +| blur | forwarded | -- | ## `SelectItem` @@ -3320,13 +3320,13 @@ None. ### Props -| Prop name | Kind | Reactive | Type | Default value | Description | -| :-------- | :--------------- | :------- | :----------------------------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | -| ref | let | Yes | null | HTMLButtonElement | null | Obtain a reference to the button HTML element | -| selected | let | Yes | boolean | false | Set to `true` for the switch to be selected | -| text | let | No | string | "Provide text" | Specify the switch text
Alternatively, use the named slot "text" (e.g., <span slot="text">...</span>) | -| disabled | let | No | boolean | false | Set to `true` to disable the switch | -| id | let | No | string | "ccs-" + Math.random().toString(36) | Set an id for the button element | +| Prop name | Kind | Reactive | Type | Default value | Description | +| :-------- | :--------------- | :------- | :----------------------------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- | +| ref | let | Yes | null | HTMLButtonElement | null | Obtain a reference to the button HTML element | +| selected | let | Yes | boolean | false | Set to `true` for the switch to be selected | +| text | let | No | string | "Provide text" | Specify the switch text
Alternatively, use the "text" slot (e.g., <span slot="text">...</span>) | +| disabled | let | No | boolean | false | Set to `true` to disable the switch | +| id | let | No | string | "ccs-" + Math.random().toString(36) | Set an id for the button element | ### Slots diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index 10988ed2..001f522a 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -191,7 +191,7 @@ { "name": "title", "kind": "let", - "description": "Specify the title of the accordion item heading\nAlternatively, use the named slot \"title\" (e.g.,
...
)", + "description": "Specify the title of the accordion item heading\nAlternatively, use the \"title\" slot (e.g.,
...
)", "type": "string", "value": "\"title\"", "isFunction": false, @@ -456,7 +456,13 @@ "reactive": false } ], - "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }], + "slots": [ + { + "name": "__default__", + "default": true, + "slot_props": "{props?: { [\"aria-current\"]?: string; class: \"bx--link\"; }}" + } + ], "events": [ { "type": "forwarded", "name": "click", "element": "li" }, { "type": "forwarded", "name": "mouseover", "element": "li" }, @@ -492,7 +498,6 @@ { "name": "small", "kind": "let", - "description": "Set to `true` to use the small variant", "type": "boolean", "value": "false", "isFunction": false, @@ -906,7 +911,7 @@ { "name": "text", "kind": "let", - "description": "Specify the switch text\nAlternatively, use the named slot \"text\" (e.g., ...)", + "description": "Specify the switch text\nAlternatively, use the \"text\" slot (e.g., ...)", "type": "string", "value": "\"Provide text\"", "isFunction": false, @@ -1884,7 +1889,7 @@ "name": "type", "kind": "let", "description": "Set the type of code snippet", - "type": "\"single\" | \"inline\" | \"multi\"", + "type": "\"single\" | \"multi\"", "value": "\"single\"", "isFunction": false, "constant": false, @@ -3122,12 +3127,16 @@ } ], "events": [ + { + "type": "dispatched", + "name": "close", + "detail": "{ index: number; text: string; }" + }, { "type": "forwarded", "name": "click", "element": "button" }, { "type": "forwarded", "name": "mouseover", "element": "button" }, { "type": "forwarded", "name": "mouseenter", "element": "button" }, { "type": "forwarded", "name": "mouseleave", "element": "button" }, - { "type": "forwarded", "name": "keydown", "element": "button" }, - { "type": "dispatched", "name": "close" } + { "type": "forwarded", "name": "keydown", "element": "button" } ], "typedefs": [], "rest_props": { "type": "Element", "name": "button" } @@ -6125,12 +6134,12 @@ } ], "events": [ + { "type": "dispatched", "name": "change", "detail": "number" }, { "type": "forwarded", "name": "click", "element": "div" }, { "type": "forwarded", "name": "mouseover", "element": "div" }, { "type": "forwarded", "name": "mouseenter", "element": "div" }, { "type": "forwarded", "name": "mouseleave", "element": "div" }, - { "type": "forwarded", "name": "input", "element": "input" }, - { "type": "dispatched", "name": "change" } + { "type": "forwarded", "name": "input", "element": "input" } ], "typedefs": [ { @@ -6345,33 +6354,8 @@ ], "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }], "events": [ - { "type": "forwarded", "name": "blur", "element": "select" }, - { "type": "dispatched", "name": "change" } - ], - "typedefs": [], - "rest_props": { "type": "Element", "name": "div" } - }, - { - "moduleName": "SelectSkeleton", - "filePath": "/src/Select/SelectSkeleton.svelte", - "props": [ - { - "name": "hideLabel", - "kind": "let", - "description": "Set to `true` to hide the label text", - "type": "boolean", - "value": "false", - "isFunction": false, - "constant": false, - "reactive": false - } - ], - "slots": [], - "events": [ - { "type": "forwarded", "name": "click", "element": "div" }, - { "type": "forwarded", "name": "mouseover", "element": "div" }, - { "type": "forwarded", "name": "mouseenter", "element": "div" }, - { "type": "forwarded", "name": "mouseleave", "element": "div" } + { "type": "dispatched", "name": "change", "detail": "string" }, + { "type": "forwarded", "name": "blur", "element": "select" } ], "typedefs": [], "rest_props": { "type": "Element", "name": "div" } @@ -6423,37 +6407,8 @@ ], "slots": [], "events": [], - "typedefs": [] - }, - { - "moduleName": "SelectItemGroup", - "filePath": "/src/Select/SelectItemGroup.svelte", - "props": [ - { - "name": "disabled", - "kind": "let", - "description": "Set to `true` to disable the optgroup element", - "type": "boolean", - "value": "false", - "isFunction": false, - "constant": false, - "reactive": false - }, - { - "name": "label", - "kind": "let", - "description": "Specify the label attribute of the optgroup element", - "type": "string", - "value": "\"Provide label\"", - "isFunction": false, - "constant": false, - "reactive": false - } - ], - "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }], - "events": [], "typedefs": [], - "rest_props": { "type": "Element", "name": "optgroup" } + "rest_props": { "type": "Element", "name": "option" } }, { "moduleName": "Pagination", @@ -6621,7 +6576,13 @@ } ], "slots": [], - "events": [{ "type": "dispatched", "name": "update" }], + "events": [ + { + "type": "dispatched", + "name": "update", + "detail": "{ pageSize: number; page: number; }" + } + ], "typedefs": [], "rest_props": { "type": "Element", "name": "div" } }, @@ -6706,9 +6667,21 @@ ], "slots": [], "events": [ - { "type": "dispatched", "name": "click:button--previous" }, - { "type": "dispatched", "name": "click:button--next" }, - { "type": "dispatched", "name": "change" } + { + "type": "dispatched", + "name": "change", + "detail": "{ page: number; }" + }, + { + "type": "dispatched", + "name": "click:button--previous", + "detail": "{ page: number; }" + }, + { + "type": "dispatched", + "name": "click:button--next", + "detail": "{ page: number; }" + } ], "typedefs": [], "rest_props": { "type": "Element", "name": "nav" } @@ -6971,6 +6944,61 @@ "typedefs": [], "rest_props": { "type": "Element", "name": "div" } }, + { + "moduleName": "SelectSkeleton", + "filePath": "/src/Select/SelectSkeleton.svelte", + "props": [ + { + "name": "hideLabel", + "kind": "let", + "description": "Set to `true` to hide the label text", + "type": "boolean", + "value": "false", + "isFunction": false, + "constant": false, + "reactive": false + } + ], + "slots": [], + "events": [ + { "type": "forwarded", "name": "click", "element": "div" }, + { "type": "forwarded", "name": "mouseover", "element": "div" }, + { "type": "forwarded", "name": "mouseenter", "element": "div" }, + { "type": "forwarded", "name": "mouseleave", "element": "div" } + ], + "typedefs": [], + "rest_props": { "type": "Element", "name": "div" } + }, + { + "moduleName": "SelectItemGroup", + "filePath": "/src/Select/SelectItemGroup.svelte", + "props": [ + { + "name": "disabled", + "kind": "let", + "description": "Set to `true` to disable the optgroup element", + "type": "boolean", + "value": "false", + "isFunction": false, + "constant": false, + "reactive": false + }, + { + "name": "label", + "kind": "let", + "description": "Specify the label attribute of the optgroup element", + "type": "string", + "value": "\"Provide label\"", + "isFunction": false, + "constant": false, + "reactive": false + } + ], + "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }], + "events": [], + "typedefs": [], + "rest_props": { "type": "Element", "name": "optgroup" } + }, { "moduleName": "SkeletonPlaceholder", "filePath": "/src/SkeletonPlaceholder/SkeletonPlaceholder.svelte", diff --git a/docs/src/pages/components/ContentSwitcher.svx b/docs/src/pages/components/ContentSwitcher.svx index 3dc212f8..ca8f14f3 100644 --- a/docs/src/pages/components/ContentSwitcher.svx +++ b/docs/src/pages/components/ContentSwitcher.svx @@ -24,6 +24,10 @@ components: ["ContentSwitcher", "Switch"] +### Reactive example + + + ### Light variant diff --git a/docs/src/pages/components/Search.svx b/docs/src/pages/components/Search.svx index f795a083..08009c0e 100644 --- a/docs/src/pages/components/Search.svx +++ b/docs/src/pages/components/Search.svx @@ -13,6 +13,10 @@ The `Search` component size is extra-large by default. There are [large](#large- +### Reactive example + + + ### Light variant diff --git a/docs/src/pages/components/Toggle.svx b/docs/src/pages/components/Toggle.svx index 9a74efcd..727cc63c 100644 --- a/docs/src/pages/components/Toggle.svx +++ b/docs/src/pages/components/Toggle.svx @@ -15,6 +15,10 @@ components: ["Toggle", "ToggleSkeleton"] +### Reactive example + + + ### Custom labels diff --git a/docs/src/pages/framed/ContentSwitcher/ContentSwitcherReactive.svelte b/docs/src/pages/framed/ContentSwitcher/ContentSwitcherReactive.svelte new file mode 100644 index 00000000..3b33900e --- /dev/null +++ b/docs/src/pages/framed/ContentSwitcher/ContentSwitcherReactive.svelte @@ -0,0 +1,29 @@ + + + + + + + + + + +
+ +
+ +
Selected index: {selectedIndex}
diff --git a/docs/src/pages/framed/Search/SearchReactive.svelte b/docs/src/pages/framed/Search/SearchReactive.svelte new file mode 100644 index 00000000..08fb1cc1 --- /dev/null +++ b/docs/src/pages/framed/Search/SearchReactive.svelte @@ -0,0 +1,35 @@ + + + + + + +
+ + + + +
+ +
Value: {value}
diff --git a/docs/src/pages/framed/Toggle/ToggleReactive.svelte b/docs/src/pages/framed/Toggle/ToggleReactive.svelte new file mode 100644 index 00000000..e1f5549f --- /dev/null +++ b/docs/src/pages/framed/Toggle/ToggleReactive.svelte @@ -0,0 +1,22 @@ + + + + + + +
+ +
+ +
Toggled: {toggled}
diff --git a/src/Accordion/Accordion.svelte b/src/Accordion/Accordion.svelte index ac6059a2..2cf3d63b 100644 --- a/src/Accordion/Accordion.svelte +++ b/src/Accordion/Accordion.svelte @@ -43,10 +43,11 @@ {:else}
    /** * Specify the title of the accordion item heading - * Alternatively, use the named slot "title" (e.g.,
    ...
    ) + * Alternatively, use the "title" slot (e.g.,
    ...
    ) */ export let title = "title"; @@ -15,7 +15,7 @@ export let iconDescription = "Expand/Collapse"; import { onMount, getContext } from "svelte"; - import ChevronRight16 from "carbon-icons-svelte/lib/ChevronRight16"; + import ChevronRight16 from "carbon-icons-svelte/lib/ChevronRight16/ChevronRight16.svelte"; let initialDisabled = disabled; @@ -38,8 +38,9 @@ class:bx--accordion__item="{true}" class:bx--accordion__item--active="{open}" class:bx--accordion__item--disabled="{disabled}" + class:bx--accordion__item--expanding="{animation === 'expanding'}" + class:bx--accordion__item--collapsing="{animation === 'collapsing'}" {...$$restProps} - class="bx--accordion__item--{animation} {$$restProps.class}" on:animationend on:animationend="{() => { animation = undefined; @@ -70,11 +71,11 @@ class="bx--accordion__arrow" aria-label="{iconDescription}" /> -
    +
    {title}
    -
    +
    diff --git a/src/Accordion/AccordionSkeleton.svelte b/src/Accordion/AccordionSkeleton.svelte index cefcbaed..4de40493 100644 --- a/src/Accordion/AccordionSkeleton.svelte +++ b/src/Accordion/AccordionSkeleton.svelte @@ -17,17 +17,18 @@ /** Set to `false` to close the first accordion item */ export let open = true; - import ChevronRight16 from "carbon-icons-svelte/lib/ChevronRight16"; - import { SkeletonText } from "../SkeletonText"; + import ChevronRight16 from "carbon-icons-svelte/lib/ChevronRight16/ChevronRight16.svelte"; + import SkeletonText from "../SkeletonText/SkeletonText.svelte";
      {/if} - {#each Array.from({ length: open ? count - 1 : count }, (_, i) => i) as item, i (item)} + {#each Array.from({ length: open ? count - 1 : count }, (_, i) => i) as item (item)}
    • diff --git a/src/AspectRatio/AspectRatio.svelte b/src/AspectRatio/AspectRatio.svelte index b22edc82..a4cb0577 100644 --- a/src/AspectRatio/AspectRatio.svelte +++ b/src/AspectRatio/AspectRatio.svelte @@ -7,9 +7,15 @@
      diff --git a/src/Breadcrumb/BreadcrumbItem.svelte b/src/Breadcrumb/BreadcrumbItem.svelte index b5df750b..1f884af5 100644 --- a/src/Breadcrumb/BreadcrumbItem.svelte +++ b/src/Breadcrumb/BreadcrumbItem.svelte @@ -1,4 +1,8 @@
    • - {#each Array.from({ length: count }, (_, i) => i) as item, i (item)} + {#each Array.from({ length: count }, (_, i) => i) as item (item)}
       
      diff --git a/src/Button/ButtonSkeleton.svelte b/src/Button/ButtonSkeleton.svelte index 8ff4e495..976c9ad3 100644 --- a/src/Button/ButtonSkeleton.svelte +++ b/src/Button/ButtonSkeleton.svelte @@ -11,7 +11,10 @@ */ export let size = "default"; - /** Set to `true` to use the small variant */ + /** + * @deprecated this prop will be removed in the next major release + * Use size="small" instead + */ export let small = false; diff --git a/src/CodeSnippet/CodeSnippet.svelte b/src/CodeSnippet/CodeSnippet.svelte index 5e6fd1a8..53b5a66c 100644 --- a/src/CodeSnippet/CodeSnippet.svelte +++ b/src/CodeSnippet/CodeSnippet.svelte @@ -70,10 +70,10 @@ export let ref = null; import { tick } from "svelte"; - import ChevronDown16 from "carbon-icons-svelte/lib/ChevronDown16"; - import { Button } from "../Button"; - import { Copy } from "../Copy"; - import { CopyButton } from "../CopyButton"; + import ChevronDown16 from "carbon-icons-svelte/lib/ChevronDown16/ChevronDown16.svelte"; + import Button from "../Button/Button.svelte"; + import Copy from "../Copy/Copy.svelte"; + import CopyButton from "../CopyButton/CopyButton.svelte"; import CodeSnippetSkeleton from "./CodeSnippetSkeleton.svelte"; function setShowMoreLess() { @@ -101,12 +101,14 @@ {#if type === 'inline'} {#if hideCopyButton} @@ -144,8 +146,10 @@ class:bx--snippet--light="{light}" class:bx--snippet--no-copy="{hideCopyButton}" class:bx--snippet--wraptext="{wrapText}" + class:bx--snippet--single="{type === 'single'}" + class:bx--snippet--inline="{type === 'inline'}" + class:bx--snippet--multi="{type === 'multi'}" {...$$restProps} - class="{type && `bx--snippet--${type}`} {$$restProps.class}" on:mouseover on:mouseenter on:mouseleave @@ -153,8 +157,8 @@
      diff --git a/src/CodeSnippet/CodeSnippetSkeleton.svelte b/src/CodeSnippet/CodeSnippetSkeleton.svelte
      index 5e10dbb1..70d550bb 100644
      --- a/src/CodeSnippet/CodeSnippetSkeleton.svelte
      +++ b/src/CodeSnippet/CodeSnippetSkeleton.svelte
      @@ -1,14 +1,14 @@
       
       
       
      { @@ -116,7 +114,10 @@
      diff --git a/src/ComposedModal/ModalHeader.svelte b/src/ComposedModal/ModalHeader.svelte index b83df927..432685e0 100644 --- a/src/ComposedModal/ModalHeader.svelte +++ b/src/ComposedModal/ModalHeader.svelte @@ -21,7 +21,7 @@ export let iconDescription = "Close"; import { getContext } from "svelte"; - import Close20 from "carbon-icons-svelte/lib/Close20"; + import Close20 from "carbon-icons-svelte/lib/Close20/Close20.svelte"; const { closeModal } = getContext("ComposedModal"); diff --git a/src/ContentSwitcher/ContentSwitcher.svelte b/src/ContentSwitcher/ContentSwitcher.svelte index ed13d4e2..cb85c7fa 100644 --- a/src/ContentSwitcher/ContentSwitcher.svelte +++ b/src/ContentSwitcher/ContentSwitcher.svelte @@ -64,8 +64,9 @@ role="tablist" class:bx--content-switcher="{true}" class:bx--content-switcher--light="{light}" + class:bx--content-switcher--sm="{size === 'sm'}" + class:bx--content-switcher--xl="{size === 'xl'}" {...$$restProps} - class="{size && `bx--content-switcher--${size}`} {$$restProps.class}" on:click on:mouseover on:mouseenter diff --git a/src/ContentSwitcher/Switch.svelte b/src/ContentSwitcher/Switch.svelte index e695b7c6..d3d75396 100644 --- a/src/ContentSwitcher/Switch.svelte +++ b/src/ContentSwitcher/Switch.svelte @@ -1,7 +1,7 @@ -
      + diff --git a/src/InlineLoading/InlineLoading.svelte b/src/InlineLoading/InlineLoading.svelte index 081d05e8..d3a64489 100644 --- a/src/InlineLoading/InlineLoading.svelte +++ b/src/InlineLoading/InlineLoading.svelte @@ -21,9 +21,9 @@ export let successDelay = 1500; import { createEventDispatcher, afterUpdate, onMount } from "svelte"; - import CheckmarkFilled16 from "carbon-icons-svelte/lib/CheckmarkFilled16"; - import Error20 from "carbon-icons-svelte/lib/Error20"; - import { Loading } from "../Loading"; + import CheckmarkFilled16 from "carbon-icons-svelte/lib/CheckmarkFilled16/CheckmarkFilled16.svelte"; + import Error20 from "carbon-icons-svelte/lib/Error20/Error20.svelte"; + import Loading from "../Loading/Loading.svelte"; const dispatch = createEventDispatcher(); diff --git a/src/Modal/Modal.svelte b/src/Modal/Modal.svelte index 305fdb4d..3bc66644 100644 --- a/src/Modal/Modal.svelte +++ b/src/Modal/Modal.svelte @@ -69,8 +69,8 @@ export let ref = null; import { createEventDispatcher, onMount, afterUpdate } from "svelte"; - import Close20 from "carbon-icons-svelte/lib/Close20"; - import { Button } from "../Button"; + import Close20 from "carbon-icons-svelte/lib/Close20/Close20.svelte"; + import Button from "../Button/Button.svelte"; const dispatch = createEventDispatcher(); @@ -160,7 +160,9 @@ aria-modal="true" aria-label="{ariaLabel}" class:bx--modal-container="{true}" - class="{size && `bx--modal-container--${size}`}" + class:bx--modal-container--xs="{size === 'xs'}" + class:bx--modal-container--sm="{size === 'sm'}" + class:bx--modal-container--lg="{size === 'lg'}" on:click="{() => { didClickInnerModal = true; }}" diff --git a/src/NumberInput/NumberInput.svelte b/src/NumberInput/NumberInput.svelte index 46df8b86..73e516a9 100644 --- a/src/NumberInput/NumberInput.svelte +++ b/src/NumberInput/NumberInput.svelte @@ -1,6 +1,7 @@
      + /** + * @event {{ page: number; }} change + * @event {{ page: number; }} click:button--previous + * @event {{ page: number; }} click:button--next + */ + /** Specify the current page index */ export let page = 0; @@ -18,11 +24,11 @@ export let backwardText = "Previous page"; import { afterUpdate, createEventDispatcher } from "svelte"; - import CaretLeft16 from "carbon-icons-svelte/lib/CaretLeft16"; - import CaretRight16 from "carbon-icons-svelte/lib/CaretRight16"; + import CaretLeft16 from "carbon-icons-svelte/lib/CaretLeft16/CaretLeft16.svelte"; + import CaretRight16 from "carbon-icons-svelte/lib/CaretRight16/CaretRight16.svelte"; import PaginationItem from "./PaginationItem.svelte"; import PaginationOverflow from "./PaginationOverflow.svelte"; - import { Button } from "../Button"; + import Button from "../Button/Button.svelte"; const dispatch = createEventDispatcher(); const MIN = 4; diff --git a/src/PaginationNav/PaginationOverflow.svelte b/src/PaginationNav/PaginationOverflow.svelte index e142866e..7f4ccb5c 100644 --- a/src/PaginationNav/PaginationOverflow.svelte +++ b/src/PaginationNav/PaginationOverflow.svelte @@ -1,4 +1,8 @@ @@ -44,8 +42,17 @@ class:bx--tag="{true}" class:bx--tag--disabled="{disabled}" class:bx--tag--filter="{filter}" - {...$$restProps} - class="{type && `bx--tag--${type}`} {$$restProps.class}" + class:bx--tag--red="{type === 'red'}" + class:bx--tag--magenta="{type === 'magenta'}" + class:bx--tag--purple="{type === 'purple'}" + class:bx--tag--blue="{type === 'blue'}" + class:bx--tag--cyan="{type === 'cyan'}" + class:bx--tag--teal="{type === 'teal'}" + class:bx--tag--green="{type === 'green'}" + class:bx--tag--gray="{type === 'gray'}" + class:bx--tag--cool-gray="{type === 'cool-gray'}" + class:bx--tag--warm-gray="{type === 'warm-gray'}" + class:bx--tag--high-contrast="{type === 'high-contrast'}" > {type} @@ -67,8 +74,17 @@ - + - + - + diff --git a/tests/PaginationNav.test.svelte b/tests/PaginationNav.test.svelte index a67c8552..d7e65fdb 100644 --- a/tests/PaginationNav.test.svelte +++ b/tests/PaginationNav.test.svelte @@ -4,4 +4,16 @@ - + diff --git a/types/Accordion/AccordionItem.d.ts b/types/Accordion/AccordionItem.d.ts index db8b3311..89597c94 100644 --- a/types/Accordion/AccordionItem.d.ts +++ b/types/Accordion/AccordionItem.d.ts @@ -3,7 +3,7 @@ export interface AccordionItemProps extends svelte.JSX.HTMLAttributes { /** * Specify the title of the accordion item heading - * Alternatively, use the named slot "title" (e.g.,
      ...
      ) + * Alternatively, use the "title" slot (e.g.,
      ...
      ) * @default "title" */ title?: string; diff --git a/types/Breadcrumb/BreadcrumbItem.d.ts b/types/Breadcrumb/BreadcrumbItem.d.ts index 6e0914e9..7574d6c8 100644 --- a/types/Breadcrumb/BreadcrumbItem.d.ts +++ b/types/Breadcrumb/BreadcrumbItem.d.ts @@ -16,7 +16,7 @@ export interface BreadcrumbItemProps extends svelte.JSX.HTMLAttributes void): () => void; diff --git a/types/Button/ButtonSkeleton.d.ts b/types/Button/ButtonSkeleton.d.ts index 57ca1bd3..450edfb5 100644 --- a/types/Button/ButtonSkeleton.d.ts +++ b/types/Button/ButtonSkeleton.d.ts @@ -13,7 +13,6 @@ export interface ButtonSkeletonProps extends svelte.JSX.HTMLAttributes { /** * Specify the switch text - * Alternatively, use the named slot "text" (e.g., ...) + * Alternatively, use the "text" slot (e.g., ...) * @default "Provide text" */ text?: string; diff --git a/types/NumberInput/NumberInput.d.ts b/types/NumberInput/NumberInput.d.ts index 5b0c5c91..715560b9 100644 --- a/types/NumberInput/NumberInput.d.ts +++ b/types/NumberInput/NumberInput.d.ts @@ -133,11 +133,11 @@ export default class NumberInput { label: {}; }; + $on(eventname: "change", cb: (event: CustomEvent) => void): () => void; $on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void; $on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void; $on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void; $on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void; $on(eventname: "input", cb: (event: WindowEventMap["input"]) => void): () => void; - $on(eventname: "change", cb: (event: CustomEvent) => void): () => void; $on(eventname: string, cb: (event: Event) => void): () => void; } diff --git a/types/OverflowMenu/OverflowMenu.d.ts b/types/OverflowMenu/OverflowMenu.d.ts index 6c6fa72f..9a75274a 100644 --- a/types/OverflowMenu/OverflowMenu.d.ts +++ b/types/OverflowMenu/OverflowMenu.d.ts @@ -77,11 +77,11 @@ export default class OverflowMenu { menu: {}; }; + $on(eventname: "close", cb: (event: CustomEvent<{ index: number; text: string }>) => void): () => void; $on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void; $on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void; $on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void; $on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void; $on(eventname: "keydown", cb: (event: WindowEventMap["keydown"]) => void): () => void; - $on(eventname: "close", cb: (event: CustomEvent) => void): () => void; $on(eventname: string, cb: (event: Event) => void): () => void; } diff --git a/types/Pagination/Pagination.d.ts b/types/Pagination/Pagination.d.ts index e0356a35..d255a3dc 100644 --- a/types/Pagination/Pagination.d.ts +++ b/types/Pagination/Pagination.d.ts @@ -102,6 +102,6 @@ export default class Pagination { $$prop_def: PaginationProps; $$slot_def: {}; - $on(eventname: "update", cb: (event: CustomEvent) => void): () => void; + $on(eventname: "update", cb: (event: CustomEvent<{ pageSize: number; page: number }>) => void): () => void; $on(eventname: string, cb: (event: Event) => void): () => void; } diff --git a/types/PaginationNav/PaginationNav.d.ts b/types/PaginationNav/PaginationNav.d.ts index faaa7180..be771e8f 100644 --- a/types/PaginationNav/PaginationNav.d.ts +++ b/types/PaginationNav/PaginationNav.d.ts @@ -42,8 +42,8 @@ export default class PaginationNav { $$prop_def: PaginationNavProps; $$slot_def: {}; - $on(eventname: "click:button--previous", cb: (event: CustomEvent) => void): () => void; - $on(eventname: "click:button--next", cb: (event: CustomEvent) => void): () => void; - $on(eventname: "change", cb: (event: CustomEvent) => void): () => void; + $on(eventname: "change", cb: (event: CustomEvent<{ page: number }>) => void): () => void; + $on(eventname: "click:button--previous", cb: (event: CustomEvent<{ page: number }>) => void): () => void; + $on(eventname: "click:button--next", cb: (event: CustomEvent<{ page: number }>) => void): () => void; $on(eventname: string, cb: (event: Event) => void): () => void; } diff --git a/types/Select/Select.d.ts b/types/Select/Select.d.ts index c484d7bc..3af69bac 100644 --- a/types/Select/Select.d.ts +++ b/types/Select/Select.d.ts @@ -89,7 +89,7 @@ export default class Select { default: {}; }; + $on(eventname: "change", cb: (event: CustomEvent) => void): () => void; $on(eventname: "blur", cb: (event: WindowEventMap["blur"]) => void): () => void; - $on(eventname: "change", cb: (event: CustomEvent) => void): () => void; $on(eventname: string, cb: (event: Event) => void): () => void; } diff --git a/types/Select/SelectItem.d.ts b/types/Select/SelectItem.d.ts index b08ba976..59fe939b 100644 --- a/types/Select/SelectItem.d.ts +++ b/types/Select/SelectItem.d.ts @@ -1,6 +1,6 @@ /// -export interface SelectItemProps { +export interface SelectItemProps extends svelte.JSX.HTMLAttributes { /** * Specify the option value * @default "" diff --git a/types/index.d.ts b/types/index.d.ts index c1862c40..087e3347 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -86,9 +86,7 @@ export { default as NumberInput } from "./NumberInput/NumberInput"; export { default as NumberInputSkeleton } from "./NumberInput/NumberInputSkeleton"; export { default as OrderedList } from "./OrderedList/OrderedList"; export { default as Select } from "./Select/Select"; -export { default as SelectSkeleton } from "./Select/SelectSkeleton"; export { default as SelectItem } from "./Select/SelectItem"; -export { default as SelectItemGroup } from "./Select/SelectItemGroup"; export { default as Pagination } from "./Pagination/Pagination"; export { default as PaginationSkeleton } from "./Pagination/PaginationSkeleton"; export { default as PaginationNav } from "./PaginationNav/PaginationNav"; @@ -96,6 +94,8 @@ export { default as ProgressIndicator } from "./ProgressIndicator/ProgressIndica export { default as ProgressIndicatorSkeleton } from "./ProgressIndicator/ProgressIndicatorSkeleton"; export { default as ProgressStep } from "./ProgressIndicator/ProgressStep"; export { default as RadioButtonGroup } from "./RadioButtonGroup/RadioButtonGroup"; +export { default as SelectSkeleton } from "./Select/SelectSkeleton"; +export { default as SelectItemGroup } from "./Select/SelectItemGroup"; export { default as SkeletonPlaceholder } from "./SkeletonPlaceholder/SkeletonPlaceholder"; export { default as Slider } from "./Slider/Slider"; export { default as SliderSkeleton } from "./Slider/SliderSkeleton";