Compare commits

...

541 commits

Author SHA1 Message Date
dependabot[bot]
12675f1b61
build(deps-dev): bump vite from 5.4.19 to 5.4.20 in /examples/sveltekit (#2202)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.19 to 5.4.20.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.20/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.20/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 5.4.20
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-11 08:32:01 -07:00
Eric Liu
9584029a25 test(tabs): add more unit tests (#2201) 2025-09-05 09:51:29 -07:00
Eric Liu
bb04824902 v0.89.7 2025-09-05 09:17:21 -07:00
Eric Liu
6d0d3b108b
fix(data-table): handle dynamic headers gracefully (#2195)
Fixes #2193
2025-09-05 09:01:36 -07:00
Eric Liu
f258548f3c
docs(data-table): set width on empty column with overflow menu (#2196) 2025-09-05 09:01:07 -07:00
Eric Liu
44a6cc0dfc
fix(pagination): on:change dispatches with correct value (#2194) 2025-09-05 09:00:51 -07:00
Eric Liu
28d15ffed8
test(overflow-menu): add more unit tests (#2199) 2025-09-05 09:00:02 -07:00
Eric Liu
14edf41e57
fix(overflow-menu): avoid dynamic style injection for performance (#2198)
Fixes #2197
2025-09-05 08:09:07 -07:00
Eric Liu
cf267b9ad5
[CI] Upgrade ubuntu-latest to macos-15-xlarge runner (#2192) 2025-08-24 12:24:23 -07:00
Eric Liu
2fc884caca
fix(combo-box): address accessibility issues (#2186)
Supports #2172
2025-08-19 10:35:18 -07:00
Eric Liu
211885bad7 test(combo-box): add keyboard navigation menu test 2025-08-17 14:08:56 -07:00
Eric Liu
be4f2f13a2 test(multi-select): reuse openMenu/closeMenu utilities 2025-08-17 14:08:56 -07:00
Eric Liu
1f0e9a91f9 v0.89.6 2025-08-16 11:51:36 -07:00
Eric Liu
378910086a test(toggle): add dispatch regression tests 2025-08-16 11:34:53 -07:00
Sergei Burtsev
0df727b704
fix(toggle): avoid dispatching toggle event on state change (#2184) 2025-08-16 11:34:21 -07:00
Eric Liu
94b4e30e26
test(toggle): add more tests (#2185) 2025-08-16 11:25:57 -07:00
Eric Liu
7b0e6f8b69
test(accordion): add more tests (#2182) 2025-08-11 09:00:17 -07:00
Eric Liu
8e934fbcc6 test(checkbox): test multiple checkbox reactivity for same object
Regression tests for #2177
2025-08-09 14:27:33 -07:00
Eric Liu
863c30f3c8 test(checkbox): test multiple checkbox reactivity 2025-08-09 14:27:33 -07:00
Eric Liu
558404118d ci: optimize checks.yaml (#2179) 2025-08-06 12:17:36 -07:00
Eric Liu
935a6a4bd4 v0.89.5 2025-08-05 09:21:13 -07:00
brunnerh
c7ad1ebdd3
fix(checkbox): prevent infinite effect loop when binding to same object (#2178)
Fixes #2177
2025-08-05 06:45:54 -07:00
Eric Liu
b4dcbf88d6 chore(examples): bump deps [ci skip] 2025-07-23 09:02:34 -07:00
Eric Liu
fd42e09929
docs: update number of carbon-icons-svelte to 2,500+ (#2176) 2025-07-23 09:01:12 -07:00
dependabot[bot]
52557179fb
build(deps-dev): bump form-data from 3.0.2 to 3.0.4 in /docs (#2175)
Bumps [form-data](https://github.com/form-data/form-data) from 3.0.2 to 3.0.4.
- [Release notes](https://github.com/form-data/form-data/releases)
- [Changelog](https://github.com/form-data/form-data/blob/v3.0.4/CHANGELOG.md)
- [Commits](https://github.com/form-data/form-data/compare/v3.0.2...v3.0.4)

---
updated-dependencies:
- dependency-name: form-data
  dependency-version: 3.0.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-22 07:15:49 -07:00
dependabot[bot]
ba2516ed3e
build(deps): bump on-headers and compression in /examples/webpack (#2174)
---
updated-dependencies:
- dependency-name: on-headers
  dependency-version: 1.1.0
  dependency-type: indirect
- dependency-name: compression
  dependency-version: 1.8.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-17 15:51:11 -07:00
Eric Liu
41cf0f4aed chore(examples): bump deps 2025-06-13 15:10:37 -07:00
Eric Liu
71de7fb158 chore(deps-dev): bump deps 2025-06-13 15:09:47 -07:00
Eric Liu
56d45bcfd0 v0.89.4 2025-06-10 15:35:27 -07:00
Nick Wing
aecc4e8eec
fix(multi-select): forward on:input for filterable variant (#2170) 2025-06-10 15:31:28 -07:00
Eric Liu
ecc818ff61 v0.89.3 2025-06-07 12:49:10 -07:00
Eric Liu
632320ae3b
fix(combo-box): "Escape" key clears input value (#2169)
Fixes #2167
2025-06-07 12:45:32 -07:00
Eric Liu
95c06a83b3
fix(combo-box): clear button supports "Space" key (#2168)
Fixes #2166
2025-06-07 12:33:59 -07:00
Eric Liu
0ea3d9351e test(multi-select): add more unit tests 2025-05-20 10:17:42 -07:00
Eric Liu
bfe86be11b test(combo-box): more unit tests 2025-05-20 09:04:58 -07:00
Eric Liu
50b4761791 test(combo-box): add keyboard navigation test 2025-05-20 08:59:14 -07:00
Eric Liu
5422a615bd build(docs): exclude carbon packages in optimizeDeps 2025-05-12 18:00:24 -07:00
dependabot[bot]
373e430a3a
build(deps-dev): bump vite from 5.4.18 to 5.4.19 in /docs (#2163)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.18 to 5.4.19.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.19/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.19/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 5.4.19
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-12 17:46:16 -07:00
Eric Liu
4e5b3899e5 chore(deps-dev): bump deps 2025-05-12 17:43:02 -07:00
Eric Liu
d37c879612 style(docs): ensure inline code blocks are styled 2025-05-03 11:27:58 -07:00
Eric Liu
729d5e50d8 docs(combo-box): revise component description 2025-05-03 11:27:58 -07:00
Eric Liu
f8daca914c docs(accordion): add component description 2025-05-03 11:27:58 -07:00
Eric Liu
bcf3d692fb docs(breadcrumb): improve docs 2025-05-03 11:27:58 -07:00
Eric Liu
0e04149219 docs: stylize "Default" subheadings 2025-05-03 11:27:58 -07:00
Eric Liu
b2f7a2274b docs(unordered-list): improve docs 2025-05-03 11:14:36 -07:00
Eric Liu
6a3306a91f docs(ui-shell): improve docs 2025-05-03 11:14:36 -07:00
Eric Liu
5da50e047d docs(truncate): improve docs 2025-05-03 11:14:36 -07:00
Eric Liu
0722076351 docs(tree-view): improve docs 2025-05-03 11:14:36 -07:00
Eric Liu
a86a1be7cc docs(tooltip-icon): improve docs 2025-05-03 11:14:36 -07:00
Eric Liu
137966e6f8 docs(tooltip-definition): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
022836872c docs(tooltip): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
b7f25a39c5 docs(toggle): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
25fb5cbdea docs(toast-notification): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
111b212538 docs(time-picker): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
a247dd2e06 docs(tile): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
c561dfc5e2 docs(theme): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
e86875b8ed docs(text-input): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
874bf43378 docs(text-area): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
303786dcd5 docs(tag): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
d8a6f2c436 docs(tabs): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
13ed961d86 docs(structured-list): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
b4cae35c52 docs(slider): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
e8ce5d5ebd docs(skeleton-text): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
1ebfad0dd6 docs(skeleton-placeholder): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
6f1c8c6b63 docs(selectable-tile): improve docs 2025-05-03 11:14:02 -07:00
Eric Liu
6823abb2e4 docs(select): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
eb2cb7dc60 docs(search): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
9fde47651b docs(recursive-list): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
42d6347dce docs(radio-tile): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
4b5580cb29 docs(radio-button): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
a6da4f1ef0 docs(progress-indicator): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
86e8aa8b00 docs(progress-bar): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
b6570f0b1b docs(popover): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
d105afc7fa docs(password-input): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
e214b17945 docs(pagination-nav): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
639626c1b3 docs(pagination): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
8abf9c48c9 docs(overflow-menu): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
297cb64182 docs(ordered-list): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
b60d0d4f12 docs(number-input): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
848c7ed3be docs(modal): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
314fbd56da docs(multi-select): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
12d09d5b0b docs(local-storage): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
7d8237a7a2 docs(loading): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
a92da8d9a4 docs(link): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
f08676e73d docs(inline-notification): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
9d111dcd91 docs(inline-loading): improve docs 2025-05-03 11:14:01 -07:00
Eric Liu
224a5dc3a4 docs(image-loader): improve docs 2025-05-03 09:18:28 -07:00
Eric Liu
8402e07019 docs(grid): improve docs 2025-05-03 09:18:19 -07:00
Eric Liu
90ea699848 docs(form): improve docs 2025-05-03 09:18:09 -07:00
Eric Liu
bb6f987b02 docs(fluid-form): improve docs 2025-05-03 09:16:56 -07:00
Eric Liu
85838625d2 docs(file-uploader): improve docs 2025-05-03 09:15:18 -07:00
Eric Liu
470d74cd72 docs(expandable-tile): improve docs 2025-05-03 09:12:58 -07:00
Eric Liu
69ff03508e docs(dropdown): improve docs 2025-05-03 09:12:45 -07:00
Eric Liu
e560915727 ci: set minimum read permissions 2025-04-28 14:42:56 -07:00
Eric Liu
b5b7b192ee v0.89.2 2025-04-28 14:36:30 -07:00
Eric Liu
2486ba4fc7 docs(pagination): document pagesUnknown 2025-04-26 13:47:48 -07:00
Eric Liu
cdf5659fa0
fix(pagination): use toLocaleString for default text formatting (#2161) 2025-04-26 13:39:26 -07:00
Eric Liu
ed3928bb01
fix(pagination): window totalItems for performance (#2160)
Fixes #2156
2025-04-26 13:25:52 -07:00
Eric Liu
024d77493c
fix(composed-modal): ignore a11y warning in Svelte 5 (#2159) 2025-04-25 08:46:16 -07:00
Eric Liu
96d37cc490
fix(to-hierarchy): revert to previous implementation 2025-04-25 08:40:09 -07:00
Eric Liu
56da2b408b test(date-picker): use await for range mode 2025-04-23 15:13:28 -07:00
Eric Liu
7b6487de2f docs: update number of pictograms 2025-04-23 15:09:25 -07:00
Eric Liu
5599d24d4a docs(date-picker): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
90b067ded3 docs(data-table): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
86aed30789 docs(copy-button): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
9f3cb09694 docs(context-menu): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
f66833c089 docs(content-switcher): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
ba29eeaddf docs(composed-modal): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
d907d000a6 docs(combo-box): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
caf83a7d8c docs(code-snippet): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
d9e45e9825 docs(clickable-tile): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
5e87bd8eb1 docs(checkbox): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
ecb8e621c8 docs(button-set): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
b5b102aff5 docs(button): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
a3a494f29f docs(breakpoint): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
fa7096bd78 docs(breadcrumb): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
29871c2eb1 docs(aspect-ratio): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
b592515ae4 docs(accordion): improve docs 2025-04-22 20:56:58 -07:00
Eric Liu
95dcaff8be docs: use consistent heading for "Disabled state" 2025-04-22 20:56:58 -07:00
Eric Liu
4798afa362 v0.89.1 2025-04-21 09:30:54 -07:00
Eric Liu
f8cb660c51 test(date-picker): add unit tests 2025-04-20 15:30:59 -07:00
Eric Liu
f09c2e2c31
fix(toolbar-search): re-filter rows if DataTable rows change (#2154)
Fixes #2143

Make `ToolbarSearch` filtering reactive to `DataTable` rows.

Previously, `ToolbarSearch` did not update when `DataTable` rows
changed. Now it subscribes to the context rows and re-runs
`filterRows` in `afterUpdate` to prevent infinite loops.
2025-04-19 13:33:07 -07:00
Eric Liu
b034378277 test(data-table): add tests for DataTableSearch 2025-04-19 13:21:51 -07:00
Eric Liu
b4b055270e test: use assert instead of casting HTMLElement 2025-04-19 12:51:58 -07:00
Eric Liu
3f09e3ff88 v0.89.0 2025-04-18 10:46:39 -07:00
Nick Wing
61ea8dd82c
fix(select): falsy item text should fallback to value (#2152) 2025-04-18 10:34:12 -07:00
Nick Wing
436dea47e8
feat(combo-box): add hideLabel prop (#2153) 2025-04-18 10:27:14 -07:00
Eric Liu
7754ea3691 chore: use import attributes instead of import assertions 2025-04-18 10:25:13 -07:00
Eric Liu
f85edef386 ci: use Node version 22.x [ci skip] 2025-04-18 08:46:32 -07:00
dependabot[bot]
896c16a6be build(deps-dev): bump @sveltejs/kit in /examples/sveltekit
Bumps [@sveltejs/kit](https://github.com/sveltejs/kit/tree/HEAD/packages/kit) from 2.20.5 to 2.20.6.
- [Release notes](https://github.com/sveltejs/kit/releases)
- [Changelog](https://github.com/sveltejs/kit/blob/main/packages/kit/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/kit/commits/@sveltejs/kit@2.20.6/packages/kit)

---
updated-dependencies:
- dependency-name: "@sveltejs/kit"
  dependency-version: 2.20.6
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-14 18:15:44 -07:00
Eric Liu
f755422f81 build(deps-dev): address vulns 2025-04-12 16:03:53 -07:00
dependabot[bot]
e4bfd9fe28 build(deps-dev): bump vite from 5.4.14 to 5.4.18
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.14 to 5.4.18.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.18/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.18/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 5.4.18
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-12 16:00:29 -07:00
Eric Liu
11246f6521 test(selectable-tile): add unit tests 2025-04-12 15:59:52 -07:00
Eric Liu
892f35aef3 test: delete old test files 2025-04-12 15:59:52 -07:00
Eric Liu
dd41c977ed perf(to-hierarchy): optimize to use single-pass approach 2025-04-12 15:59:16 -07:00
Eric Liu
a514f284e6 test(to-hierarchy): increase test coverage 2025-04-12 15:59:16 -07:00
Eric Liu
90b96a2fed test: enable clearMocks 2025-04-12 15:35:49 -07:00
Eric Liu
f0657b1dcd chore(deps-dev): upgrade vitest 2025-04-12 15:35:49 -07:00
Eric Liu
8ab77c99e2 test(multi-select): more unit tests 2025-04-12 14:34:11 -07:00
Eric Liu
5e8c8b983c test(local-storage): extract shared global mock 2025-04-12 14:34:11 -07:00
Eric Liu
823a8f69dc test(fluid-form): add unit tests 2025-04-12 14:34:11 -07:00
Eric Liu
37a1ab30cf test(form): add unit tests 2025-04-12 14:34:11 -07:00
Eric Liu
b9de4591be test(button-set): add unit tests 2025-04-12 14:34:11 -07:00
Eric Liu
5bff894ed7 test: delete old test files 2025-04-12 14:34:11 -07:00
Eric Liu
d4ca8b5c97
test(modal): add unit tests (#2145) 2025-04-12 12:55:39 -07:00
Eric Liu
da2a308d31
test(data-table): add unit tests (#2144) 2025-04-12 12:21:28 -07:00
Eric Liu
c57c0efb73 test(column): add unit tests 2025-04-01 08:47:29 -07:00
Eric Liu
03f3920383 test(dropdown): add more tests 2025-04-01 08:47:29 -07:00
Eric Liu
b3816606f6 test(context-menu): add unit tests 2025-04-01 08:47:29 -07:00
Eric Liu
7c916828f2 test: delete old files 2025-04-01 08:47:29 -07:00
Eric Liu
de0ff76c8f chore(scripts): fix lints 2025-03-30 09:08:20 -07:00
Eric Liu
5d02a13525 v0.88.4 2025-03-24 09:32:35 -07:00
Eric Liu
1a5f2d8e67
fix(list-box): correct button/description translations based on selection count (#2139)
The `ListBoxSelection` component now properly handles
translations for the clear button based on the selected items:

- Fix `buttonLabel` and `description` to use the same translation logic
- Add tests for custom translations in both `ComboBox` and `MultiSelect`
2025-03-23 11:28:06 -07:00
Eric Liu
9b61af0306
fix(list-box): set aria-disabled if disabled (#2125) (#2138)
Re-apply #2125 (reverted in #2130) to preserve `disabled` attribute.

Carbon styles depend on the `[disabled]` attribute. However, the `disabled`
attribute is not valid markup when applied to `div role="option"`. This PR
preserves the existing `disabled` attribute while also setting `aria-disabled`
to maintain accessibility.
2025-03-23 10:46:25 -07:00
Eric Liu
43511e09ec fix(text-area): allow visually hidden label (#2137)
This fixes an accessibility issue with `TextArea`.

Currently, if `hideLabel` is `true`, the label is not rendered at all.
The expected behavior is that it should be visually hidden while
still being available to screen readers.
2025-03-23 10:42:47 -07:00
Eric Liu
ca9beebaea
fix(radio-tile): allow standalone RadioTile usage (#2136)
Although `RadioTile` is meant to be used inside a `TileGroup`, it feels  
unpolished for standalone usage to crash due to a missing parent context.

This fixes `RadioTile` to fail open by providing a no-op `add: () => {}`  
when `TileGroup` context is not found.
2025-03-22 13:03:20 -07:00
Eric Liu
1462e300d6
fix(radio-button): forward focus, blur events (#2135)
As identified in #2131, `focus` and `blur` events should be
forwarded to the underlying `RadioButton` element.
2025-03-22 13:02:28 -07:00
Eric Liu
dd1338ffc4
fix(list-box-selection): fix aria-label for clear button (#2134)
`ListBoxSelection`, used by `MultiSelect` and `ComboBox`, currently  
applies the wrong `aria-label` for the clear selection button. It uses
the `translateId` (e.g., `"clearAll"`) instead of the user-friendly copy.
2025-03-22 12:59:16 -07:00
Eric Liu
c6c80d35a9 test: remove CSS import from set-up file 2025-03-20 17:34:20 -07:00
Eric Liu
95f6c97a57 test: remove old files 2025-03-20 17:34:20 -07:00
Eric Liu
d45409c7f3 test(grid): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
f7ac0e3f22 test(progress-indicator): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
1478486d8f test(password-input): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
f200dadb97 test(multi-select): more unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
0b799d64b7 test(dropdown): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
3607c70070 test(skeleton-placeholder): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
a4b10500a3 test(skeleton-text): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
f5342d4b96 test(structured-list): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
f89e9df8f0 test(expandable-tile): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
490d3b42ea test(radio-tile): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
6e62ce5416 test(time-picker): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
ec7d798783 test(radio-button): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
6dccd5cbe2 test(number-input): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
eb413a1fba test(text-input): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
e35a25de81 test(text-area): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
7c436bd747 test(toast-notification): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
7317192e90 test(inline-notification): add unit tests 2025-03-20 17:34:20 -07:00
Eric Liu
d67b3e0a84 docs(code-snippet): remove note on compatibility 2025-03-19 13:21:14 -07:00
Eric Liu
49d961bbb5 chore(changelog): add release notes for v0.88.3 [ci skip] 2025-03-19 13:08:24 -07:00
Eric Liu
0e082e4950 v0.88.3 2025-03-19 13:06:20 -07:00
Eric Liu
199bb0eb8e
Revert "fix(list-box): use aria-disabled instead of invalid disabled attribute" (#2130)
This reverts commit e1b3ef22c9.
2025-03-19 13:05:28 -07:00
Eric Liu
be9c13fbc6 v0.88.2 2025-03-19 12:52:48 -07:00
Eric Liu
86794dafe2 chore(examples): bump deps 2025-03-19 12:51:41 -07:00
Eric Liu
e7939ff0e2
fix(multi-select): fix keyboard navigation for disabled items (#2129)
Fixes #2128
2025-03-19 12:43:46 -07:00
Eric Liu
5987b61a55
fix(theme): remove invalid themes prop from markup (#2127) 2025-03-19 12:43:33 -07:00
Eric Liu
e85d7efc5e
fix(notification): remove invalid kind prop from markup (#2126) 2025-03-19 12:43:23 -07:00
Eric Liu
e1b3ef22c9
fix(list-box): use aria-disabled instead of invalid disabled attribute (#2125) 2025-03-19 12:43:05 -07:00
Eric Liu
c67e095eaf test(combo-box): more unit tests 2025-03-19 10:42:54 -07:00
Brian West
9e3d83031e
fix(combo-box): fix typing when refocusing input
Fixes a bug where the input `value` is immediately reset
when re-focusing the input. The `value` resetting is necessary
to support programmatically clearing the value, but it should
only execute if the input is not currently focused.
2025-03-19 10:29:13 -07:00
Eric Liu
0e1177f398 test(combo-box): add unit tests 2025-03-17 21:19:24 -07:00
Eric Liu
d25a85c825 test(popover): add unit tests 2025-03-17 19:27:40 -07:00
Eric Liu
8142c71307 test(slider): add unit tests 2025-03-17 19:27:40 -07:00
Eric Liu
a73000ffbe test(pagination): add unit tests 2025-03-17 19:27:40 -07:00
Eric Liu
6eda673aaf test(pagination-nav): add unit tests 2025-03-17 19:27:40 -07:00
Eric Liu
79d50b1a83 test(ordered-list): add unit tests 2025-03-17 19:27:40 -07:00
Eric Liu
b6b5579f67 test(unordered-list): add unit tests 2025-03-17 19:27:40 -07:00
Eric Liu
d64465e774 test(truncate): add unit tests 2025-03-17 19:27:40 -07:00
Eric Liu
19a6c65313 test(tooltip-icon): add unit tests 2025-03-17 19:27:40 -07:00
Eric Liu
5caa9c90b3 test(tooltip-definition): add unit tests 2025-03-17 19:27:40 -07:00
Eric Liu
023b49d050 docs(copy-button): remove note on compatability 2025-03-16 15:37:40 -07:00
Eric Liu
c118a5392e
ci: use macos-latest-xlarge (#2123) 2025-03-16 14:29:24 -07:00
Eric Liu
0c6a171a24 test(tabs): add unit tests 2025-03-16 14:19:44 -07:00
Eric Liu
150e03e1fd test(theme): add unit tests 2025-03-16 14:19:44 -07:00
Eric Liu
f28bfe307e test(local-storage): add unit tests 2025-03-16 14:19:44 -07:00
Eric Liu
f23e7282b5 test(link): add unit tests 2025-03-16 14:19:44 -07:00
Eric Liu
12a9b08f80 test(loading): add unit tests 2025-03-16 14:19:44 -07:00
Eric Liu
884f5e5966 test(inline-loading): add unit tests 2025-03-16 14:19:44 -07:00
Eric Liu
d685091447 test(image-loader): add unit tests 2025-03-16 14:19:44 -07:00
Eric Liu
481f121f77 test(toggle): add unit tests 2025-03-16 14:19:44 -07:00
Eric Liu
9b3f2e0919 test(copy-button): add unit tests 2025-03-16 14:19:44 -07:00
Eric Liu
e876553790 test(search): add unit tests 2025-03-16 14:19:44 -07:00
Eric Liu
942e6f670b v0.88.1 2025-03-11 17:18:18 -07:00
Eric Liu
7ff93ad2da
fix(ui-shell): HeaderAction uses dark color scheme (#2119) 2025-03-11 17:17:13 -07:00
Eric Liu
cbe0634f61 test(progress-bar): add unit tests 2025-03-11 12:52:52 -07:00
Eric Liu
fc04ad31f3 test(tile): add unit tests 2025-03-11 12:52:52 -07:00
Eric Liu
39cb29afba test(clickable-tile): add unit tests 2025-03-11 12:52:52 -07:00
Eric Liu
d8fbdabc70 test(button): add unit tests 2025-03-11 12:52:52 -07:00
Eric Liu
663b79ad05
fix(select): falsy item text should not override value (#2118)
Fixes #2117
2025-03-11 10:09:28 -07:00
dependabot[bot]
49f9cb00ed
build(deps-dev): bump prismjs from 1.29.0 to 1.30.0 in /docs (#2116)
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.29.0 to 1.30.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PrismJS/prism/compare/v1.29.0...v1.30.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-10 15:36:51 -07:00
Eric Liu
f386c53e64 chore: remove errant Bun lockfile [ci skip] [deploy skip] 2025-03-10 13:28:26 -07:00
Eric Liu
4466f7ec91 v0.88.0 2025-03-09 14:59:34 -07:00
Eric Liu
f385e2e379
chore(package): use docs site for homepage (#2114) 2025-03-09 14:29:03 -07:00
Eric Liu
a3d1d9f089
chore(deps-dev): upgrade dependencies (#2113) 2025-03-09 14:28:04 -07:00
Eric Liu
a4aefad0e4
docs(ui-shell): add "Header with multiple switchers" example (#2112) 2025-03-09 13:59:36 -07:00
Eric Liu
24b9cbc9c3
feat(ui-shell): HeaderAction supports tooltip (#2111)
Closes #2110
2025-03-09 13:47:34 -07:00
Eric Liu
7481b9a995
feat(data-table): allow custom inputName for radio/checkbox (#2087)
Closes #2085
2025-03-09 13:47:08 -07:00
Eric Liu
b4ae19e8e7 v0.87.7 2025-03-06 18:37:11 -08:00
Eric Liu
9b4bfa6f86
fix(select): avoid infinite update loop in Svelte 5 (#2108)
Fixes #2107
2025-03-06 18:36:22 -08:00
Eric Liu
5522c5b0b2
test(select): add unit tests (#2109) 2025-03-06 18:32:22 -08:00
Eric Liu
b15bf65f88 test(code-snippet): add unit tests 2025-03-02 14:41:57 -08:00
Eric Liu
936a681194 test(tooltip): add unit tests 2025-03-02 14:41:57 -08:00
Eric Liu
ca4a12164d test(checkbox): add unit tests 2025-03-02 14:41:57 -08:00
Eric Liu
1ba777ade8 test(breakpoint): add unit tests 2025-03-02 14:41:57 -08:00
Eric Liu
67df81eac9 test(content-switcher): add unit tests 2025-03-02 14:41:57 -08:00
Eric Liu
63fdb75664 test(breadcrumb): add unit tests 2025-03-02 14:41:57 -08:00
Eric Liu
4fb6a0be9f v0.87.6 2025-02-24 09:51:58 -08:00
Eric Liu
21f014d43f
chore(deps-dev): bump deps (#2101) 2025-02-24 09:42:54 -08:00
Eric Liu
b7297d452a
fix(overflow-menu): add aria-controls to trigger button (#2100) 2025-02-17 13:40:42 -08:00
Eric Liu
7256a7987c chore(deps-dev): upgrade vitest 2025-02-17 11:30:03 -08:00
Eric Liu
54a20c3432 chore(examples): bump deps [ci skip] 2025-02-15 10:30:55 -08:00
Eric Liu
dfa133d0b9
docs: update number of carbon-pictograms-svelte to 1,200+ (#2099) 2025-02-15 10:08:07 -08:00
dependabot[bot]
37b0ad1579
build(deps-dev): bump vitest from 2.1.5 to 2.1.9 (#2098)
Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 2.1.5 to 2.1.9.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.9/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-04 14:33:28 -08:00
Eric Liu
74933e976b v0.87.5 2025-02-04 14:29:51 -08:00
Eric Liu
6e65ef39e7
fix(tag): allow on:close to work with Svelte 5 (#2097)
Fixes #2096
2025-02-04 14:28:58 -08:00
Eric Liu
5f9a4156d6 v0.87.4 2025-02-02 19:51:09 -08:00
Eric Liu
6bf72d4602
fix(types): loosen icon prop type to any (#2095)
Fixes https://github.com/carbon-design-system/carbon-icons-svelte/issues/207

`carbon-icons-svelte@13` and `carbon-pictograms-svelte@13` now  
only support TypeScript for Svelte 4/5.

The new `Component` type is incompatible with the `icon` prop in  
`carbon-components-svelte`, causing a type error with Svelte 5, as  
`typeof SvelteComponent` doesn't match the new `Component` type.

Since `Component` isn't available in Svelte 3/4, this PR changes  
the `icon` prop type to `any` for compatibility across Svelte 3, 4, and 5.
2025-02-02 19:49:53 -08:00
Eric Liu
ece9e0362f chore(examples): bump deps [ci skip] 2025-02-01 11:51:42 -08:00
dependabot[bot]
008ca05591 build(deps-dev): bump vite from 5.4.11 to 5.4.14
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.11 to 5.4.14.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.14/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.14/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-30 09:10:08 -08:00
Eric Liu
bf792daa96 v0.87.3 2025-01-30 09:01:03 -08:00
Eric Liu
306e09961f test(overflow-menu): add unit tests 2025-01-30 08:56:52 -08:00
Eric Liu
88f4304d5a fix(overflow-menu): support Svelte 5
Fixes #2092
2025-01-30 08:56:52 -08:00
Eric Liu
f61e316788 v0.87.2 2025-01-22 11:59:22 -08:00
bartosjiri ⚡
76eec84c54
fix(text-area): counter supports null value (#2089) 2025-01-22 11:16:18 -08:00
dependabot[bot]
c1ace1c80a
build(deps-dev): bump vite from 5.4.11 to 5.4.14 in /examples/sveltekit (#2091)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.11 to 5.4.14.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.14/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.14/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-22 11:13:37 -08:00
dependabot[bot]
4021c562e9
build(deps-dev): bump vite from 5.4.9 to 5.4.14 in /docs (#2090)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.9 to 5.4.14.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.14/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.14/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-22 11:10:37 -08:00
Eric Liu
8b096444f0 v0.87.1 2025-01-19 18:50:29 -08:00
Eric Liu
21ec70ad9b chore(changelog): fix latest version 2025-01-19 18:48:05 -08:00
Eric Liu
fb6719b1ae fix(multi-select): avoid manual field blur
Fixes #2083
2025-01-19 17:38:25 -08:00
Eric Liu
c194c80e29 fix(dropdown): avoid manual field blur
Fixes #2083
2025-01-19 17:38:25 -08:00
Eric Liu
e874ac19d7 fix(data-table): improve expandable accessibility (#2086) 2025-01-19 17:38:25 -08:00
Eric Liu
dd6cbac3ee fix(data-table): prefix internal ID for radio button, checkbox (#2082)
Fixes #2081
2025-01-19 17:38:25 -08:00
Eric Liu
f3a8d9972c
test: add unit tests for AspectRatio, Tag 2024-12-29 13:49:29 -08:00
Eric Liu
cee676331a
test(accordion): add unit tests (#2079) 2024-12-29 12:51:06 -08:00
Eric Liu
107b77df6e chore(deps-dev): use culls to prune package.json (#2078) 2024-12-25 10:15:30 -08:00
dependabot[bot]
6817892575
build(deps-dev): bump nanoid from 3.3.7 to 3.3.8 in /examples/rollup (#2077)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.3.7...3.3.8)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-14 15:26:03 -08:00
dependabot[bot]
9e0731d41d
build(deps-dev): bump nanoid from 3.3.7 to 3.3.8 in /docs (#2076)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.3.7...3.3.8)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-14 11:03:07 -08:00
dependabot[bot]
cea3c02d60
build(deps-dev): bump nanoid from 3.3.7 to 3.3.8 (#2075)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.3.7...3.3.8)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-10 17:05:58 -08:00
Eric Liu
b5d5420094 v0.87.0 2024-12-09 12:36:49 -08:00
Eric Liu
2d407393b6 docs: bump number of charts from @carbon/charts-svelte [ci skip] 2024-12-09 12:27:38 -08:00
Eric Liu
48afd18e5e
feat: add toHierarchy utility for TreeView, RecursiveList (#2072)
Co-authored-by: Bram <bramhavers@gmail.com>
2024-12-09 12:22:36 -08:00
Eric Liu
f1a27ec855
test(tree-view): coverage for expandAll and expandNodes (#2063) 2024-12-08 11:09:23 -08:00
Eric Liu
18c964e579
fix(tooltip-icon): button should have explicit type (#2071) 2024-12-08 11:00:30 -08:00
Eric Liu
9bfddc5c62
test: silence output in CI (#2074) 2024-12-08 11:00:17 -08:00
Eric Liu
1d24da063f
chore(prettier): exclude auto-generated COMPONENT_API.json (#2073) 2024-12-08 10:58:41 -08:00
Eric Liu
c7f4b16bf3 v0.86.2 2024-11-30 10:48:32 -08:00
Eric Liu
09541657ef ci: run lint check 2024-11-30 10:47:11 -08:00
Eric Liu
765ffc88eb chore: run lint 2024-11-30 10:47:11 -08:00
Paweł Malinowski
c3a390f3fe fix(multi-select): fix sorting behavior
- Menu items are sorted when the component renders.
- With selectionFeedback: top, selected items are immediately pinned to
  the top.
- With selectionFeedback: top-after-reopen, selected items are pinned to the top only
  after the dropdown is closed.
- With selectionFeedback: fixed, selected items are never pinned to the
  top.

Fixes #2066
2024-11-30 10:38:33 -08:00
Paweł Malinowski
e165fa3a87 test(multi-select): add test suite 2024-11-30 10:38:33 -08:00
dependabot[bot]
1f7ec1b40a build(deps-dev): bump @sveltejs/kit in /examples/sveltekit
Bumps [@sveltejs/kit](https://github.com/sveltejs/kit/tree/HEAD/packages/kit) from 2.8.2 to 2.8.3.
- [Release notes](https://github.com/sveltejs/kit/releases)
- [Changelog](https://github.com/sveltejs/kit/blob/main/packages/kit/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/kit/commits/@sveltejs/kit@2.8.3/packages/kit)

---
updated-dependencies:
- dependency-name: "@sveltejs/kit"
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 08:58:29 -08:00
Eric Liu
e2342aa249 docs: move "Default value" below description 2024-11-24 14:10:01 -08:00
Eric Liu
3fe8da313d build(script): force new lines for API props 2024-11-24 14:10:01 -08:00
Eric Liu
69d51872a5 docs: omit Prettier from client JS 2024-11-24 13:32:50 -08:00
Eric Liu
0cc377eeb9 build(scripts): format COMPONENT_API.json 2024-11-24 13:32:50 -08:00
Eric Liu
8ad7d5967e
docs: set loading="lazy" on iframes (#2062) 2024-11-23 16:47:04 -08:00
Eric Liu
f752c96daf
docs: fix highlighting for lighter themes (#2061) 2024-11-23 16:23:14 -08:00
Eric Liu
5fe5db919a chore: use cache for formatting [ci skip] 2024-11-23 15:52:36 -08:00
Eric Liu
f795bb7abc docs(component-api): async load component 2024-11-23 15:49:46 -08:00
Eric Liu
c4b09101e6 docs(component-api): required props are sorted first 2024-11-23 15:27:48 -08:00
Eric Liu
dee74d3470 docs: add syntax highlighting for component API 2024-11-23 15:26:39 -08:00
Eric Liu
2a68b2947c chore(tree-view): remove inline comment breaking formatting 2024-11-23 15:26:39 -08:00
Eric Liu
186ea85cbc ci: add "Unit tests" step 2024-11-23 13:36:31 -08:00
Eric Liu
8b477b12f9 test: scaffold component testing with Vitest 2024-11-23 13:36:31 -08:00
Eric Liu
89387004a3 chore(examples): bump deps 2024-11-23 12:25:16 -08:00
Eric Liu
817482cc6b v0.86.1 2024-11-22 13:51:25 -08:00
Eric Liu
e488c88371
fix(tree-view): do not flatten original nodes (#2056)
`$: nodes = traverse(nodes);` is unexpectedly mutating the original `nodes` reference used to render `TreeView`.

As a result, a tail leaf node is appended to the top-level list.

Flattening is necessary to obtain a reference to all node IDs (to programmatically show/hide nodes). This fix creates a new reference `flattenedNodes` instead of overriding the original `nodes`.
2024-11-22 13:24:43 -08:00
Eric Liu
07d226cd87
docs(recursive-list): update mentions of renamed children prop (#2055) 2024-11-21 10:40:10 -08:00
Bram
b9b7bae24c
docs(tree-view): update mentions of renamed children prop (#2054) 2024-11-21 10:35:03 -08:00
Eric Liu
128da10475 v0.86.0 2024-11-19 18:51:41 -08:00
dependabot[bot]
4739aaf0dd
build(deps): bump cross-spawn in /docs (#2053)
Bumps  and [cross-spawn](https://github.com/moxystudio/node-cross-spawn). These dependencies needed to be updated together.

Updates `cross-spawn` from 7.0.3 to 7.0.6
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6)

Updates `cross-spawn` from 6.0.5 to 7.0.6
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 14:51:37 -08:00
Eric Liu
5f887f59e8
chore: re-run npm run build:docs (#2051) 2024-11-12 10:27:38 -08:00
Eric Liu
e23a4d1994 build(docs): use node: prefix [ci skip] 2024-11-12 09:52:20 -08:00
Eric Liu
cc03d3c75d chore: remove redundant format script [ci skip] 2024-11-11 21:35:48 -08:00
Eric Liu
8e996dc683 chore: format files with Prettier 3 2024-11-11 21:35:48 -08:00
Eric Liu
1dcd09bd98 chore(deps-dev): upgrade prettier to v3 2024-11-11 21:35:48 -08:00
Eric Liu
4881ff7ffd build(scripts): convert to ESM 2024-11-11 21:24:06 -08:00
Eric Liu
9234119d7b build(package)!: set type="module" 2024-11-11 21:24:06 -08:00
metonym
066fea5180 build!: remove bundled ESM/UMD support 2024-11-11 21:24:06 -08:00
Eric Liu
dd43224119
feat(data-table): support generics (#1954)
Co-authored-by: K.Kiyokawa <koichi20110068@gmail.com>
Co-authored-by: brunnerh <brunnerh@users.noreply.github.com>
2024-11-11 21:10:45 -08:00
Eric Liu
752c46b94c
docs(style): increase preview viewer for large screens (#2049) 2024-11-11 15:54:32 -08:00
Eric Liu
9f1b997765
chore(deps-dev): upgrade sveld to v0.22 (#2048) 2024-11-10 15:35:29 -08:00
Eric Liu
7e173943ac
fix(toolbar-menu): remove redundant menu offset for Svelte 5 compatibility (#2047)
Fixes #2040
2024-11-10 11:50:54 -08:00
Eric Liu
99ba6f3db9
fix(inline-checkbox): bind indeterminate for Svelte 5 compatibility (#2045)
Fixes #2039
2024-11-10 11:50:41 -08:00
Eric Liu
9d5e7e31ef
fix(checkbox): bind indeterminate for Svelte 5 compatibility (#2044)
Fixes #2039
2024-11-10 11:50:20 -08:00
Eric Liu
817c072872 docs: use defer instead of async for analytics script 2024-11-10 11:49:16 -08:00
Eric Liu
66dc602889 docs: move IBM analytics script to _layout.svelte 2024-11-10 11:49:16 -08:00
Eric Liu
8a67a5bbf1 docs: add canonical to base index.html 2024-11-10 11:07:43 -08:00
Eric Liu
fd9d7ee943 chore(deps-dev): upgrade svelte-check to v4 (#2043) 2024-11-10 10:53:02 -08:00
Eric Liu
c7529fe3f8 build(scripts): replace glob with tinyglobby (#2041) 2024-11-10 10:10:51 -08:00
Eric Liu
b0214ec956 docs(multi-select): items should not be reactive (#2042) 2024-11-10 10:10:41 -08:00
Eric Liu
3192824322
fix(data-table): handle ToolbarSearch filtering in DataTable (#2037) 2024-11-10 09:27:27 -08:00
Paweł Malinowski
1acd713537
fix(multi-select): avoid cyclic dependency for Svelte 5 compatibility (#2034) 2024-11-09 14:53:46 -08:00
Eric Liu
efddbbd3cc docs(treeview): update examples 2024-11-09 14:53:02 -08:00
Eric Liu
82905ac696 feat(treeview)!: rename children prop to nodes for Svelte 5 compatibility 2024-11-09 14:53:02 -08:00
Eric Liu
d655296fcf docs(recursive-list): update examples 2024-11-09 14:50:44 -08:00
Eric Liu
242e2fcbdf feat(recursive-list): rename children prop to nodes for Svelte 5 compatibility 2024-11-09 14:50:44 -08:00
metonym
44486080b8 ci: run test:src-types in workflow 2024-11-09 14:46:39 -08:00
metonym
1c64f4717d chore: add script to test generated types 2024-11-09 14:46:39 -08:00
metonym
6fbd8ae6a9 fix(types): use type alias instead of interface for $$restProps 2024-11-09 14:41:28 -08:00
Eric Liu
57e99f3a4c chore(deps-dev): upgrade sveld to 0.21.0 2024-11-09 14:41:28 -08:00
Eric Liu
d8b936dc0b v0.85.4 2024-11-09 14:36:21 -08:00
Eric Liu
37c8100d52 ci: add script to prune package.json for release 2024-11-09 14:30:39 -08:00
Eric Liu
b54fda9457 ci: rename ci.yml 2024-11-09 14:30:39 -08:00
Eric Liu
02d1a8b692 build(scripts): use node: prefix 2024-11-09 14:30:39 -08:00
Eric Liu
9ebf6963e0 docs(multi-select): improvements [ci skip] 2024-11-09 14:02:40 -08:00
Eric Liu
58e4655bad chore(examples): bump deps 2024-11-09 11:29:53 -08:00
Eric Liu
7923515279 chore(docs): add meta description 2024-11-09 11:26:59 -08:00
Eric Liu
da2d28a426 chore(docs): bump deps 2024-11-09 11:26:43 -08:00
Eric Liu
f25a23dd26 test: fix type errors 2024-11-09 10:07:46 -08:00
Eric Liu
f69b2f15b5 test: use carbon-components-svelte for type imports 2024-11-09 10:07:46 -08:00
Eric Liu
31efd1fa1a build: use compilerOptions.paths to alias types 2024-11-09 10:07:46 -08:00
Eric Liu
cec7ef00cf build: enforce noUnusedLocals and noUnusedParameters 2024-11-09 10:07:46 -08:00
Eric Liu
79ec465dbd chore(deps-dev): upgrade svelte-check 2024-11-09 10:07:46 -08:00
metonym
ac38e9d353 docs: support CTRL+K to trigger docs search 2024-11-08 09:50:52 -08:00
Eric Liu
c93be373ea style(docs): use autoWidth for <Tabs /> 2024-11-03 14:11:57 -08:00
Eric Liu
5be3da2722 docs: add Bun install command 2024-11-03 14:11:57 -08:00
Eric Liu
61eeb37a74 docs: replace yarn with npm as default 2024-11-03 14:11:57 -08:00
Eric Liu
67673d5161 docs: drop -D flag from install commands 2024-11-03 14:11:57 -08:00
Eric Liu
951d686042
fix(types): delete extraneous icons/Search.svelte.d.ts (#2025) 2024-10-25 16:27:19 -07:00
metonym
a324ea7ae9 build(tsconfig): use verbatimModuleSyntax 2024-10-25 15:53:36 -07:00
metonym
070a02127f chore(deps-dev): upgrade typescript 4.7.4 --> 5.6.3 2024-10-25 15:53:36 -07:00
Eric Liu
44daa775d5
fix(data-table): fix DataTableValue type reference in DataTable (#2023) 2024-10-25 15:49:35 -07:00
metonym
3167e449fd fix(types): fix types for on:paste event 2024-10-25 15:40:59 -07:00
metonym
e8237b2575 chore(deps-dev): patch sveld 0.20.2 --> 0.20.3 2024-10-25 15:40:59 -07:00
Eric Liu
58e6021b08
fix(toolbar-search): fix types for on:clear (#2022) 2024-10-25 15:38:31 -07:00
Eric Liu
0831e87135
fix(combo-box): fix types for on:clear (#2020) 2024-10-25 15:36:43 -07:00
Eric Liu
49b5def815
fix(theme): Theme correctly imports toggle, select props (#2019)
Fixes #2018
2024-10-25 14:56:59 -07:00
metonym
fc44ef42cd v0.85.3 2024-10-25 10:51:04 -07:00
Eric Liu
f86f593159
docs: update number of carbon-icons-svelte to 2,400+ (#2017) 2024-10-24 13:38:14 -07:00
Eric Liu
43fccac1c6
fix: address Svelte 5 warnings (#2011)
Co-authored-by: brunnerh <brunnerh@users.noreply.github.com>
2024-10-24 07:43:10 -07:00
Eric Liu
3511f09b2e chore(docs): bump deps 2024-10-20 11:00:29 -07:00
Eric Liu
72e7201449 chore(docs): run npm audit fix 2024-10-20 10:56:07 -07:00
Eric Liu
cdbe54a9bc chore(examples): bump deps 2024-10-20 10:55:41 -07:00
dependabot[bot]
b1b5f2e87c
build(deps-dev): bump rollup from 4.21.3 to 4.24.0 in /examples/sveltekit (#2009)
build(deps-dev): bump rollup in /examples/sveltekit

Bumps [rollup](https://github.com/rollup/rollup) from 4.21.3 to 4.24.0.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.21.3...v4.24.0)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-20 10:53:32 -07:00
dependabot[bot]
12b2ff99af
build(deps-dev): bump rollup from 4.21.3 to 4.22.4 in /examples/rollup (#2006)
Bumps [rollup](https://github.com/rollup/rollup) from 4.21.3 to 4.22.4.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.21.3...v4.22.4)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-20 10:49:25 -07:00
Eric Liu
4d0f0540a7 chore(audit): patch rollup 2024-10-20 10:49:15 -07:00
Ignacio Becerra
83a8f58f16
chore(telemetry): updated URL (#2008) 2024-10-17 16:55:11 -07:00
Ignacio Becerra
32a0c6c6db
chore(telemetry): update endpoint and README (#2007) 2024-10-16 10:58:34 -07:00
metonym
c3dd705539 chore(examples): bump deps [ci skip] 2024-09-17 13:00:26 -07:00
dependabot[bot]
64debccd08
build(deps-dev): bump vite from 5.4.1 to 5.4.6 in /docs (#2004)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.1 to 5.4.6.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.6/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.6/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-17 12:08:32 -07:00
metonym
a93c760f55 chore: add FUNDING.yml [ci skip] 2024-09-16 10:26:04 -07:00
metonym
45ba276a5a chore(examples): bump deps 2024-09-13 09:16:34 -07:00
metonym
c45c5cd72d chore(docs): patch svelte to 4.2.19 [ci skip] 2024-09-13 09:14:36 -07:00
Eric Liu
05b1095814
chore(deps-dev): upgrade sveld to 0.20.2 (#1999) 2024-09-13 09:13:32 -07:00
dependabot[bot]
2e4286cdad
build(deps-dev): bump svelte from 4.2.18 to 4.2.19 (#1997)
Bumps [svelte](https://github.com/sveltejs/svelte/tree/HEAD/packages/svelte) from 4.2.18 to 4.2.19.
- [Release notes](https://github.com/sveltejs/svelte/releases)
- [Changelog](https://github.com/sveltejs/svelte/blob/svelte@4.2.19/packages/svelte/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/svelte/commits/svelte@4.2.19/packages/svelte)

---
updated-dependencies:
- dependency-name: svelte
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-02 19:17:56 -07:00
Eric Liu
4e629ebb77 chore(examples): run npm audit fix 2024-09-02 14:49:09 -07:00
Eric Liu
d90526bd3a chore(docs): rebuild lockfile [ci skip] 2024-08-24 12:59:46 -07:00
Eric Liu
f0e597ae93 chore(deps-dev): run npm audit fix 2024-08-24 12:59:04 -07:00
Eric Liu
07c23af870
chore(deps-dev): upgrade sveld for generics support (#1996) 2024-08-23 11:50:57 -07:00
metonym
fd41c8a269 ci: split into steps, remove lint
The current lint script runs prettier on the codebase, but it does not error. Ideally, formatting should run in Git hooks and error in CI. For now, omit this step to speed up builds.
2024-08-20 07:33:35 -07:00
Eric Liu
96cfb4be44
build: replace Yarn with npm (#1993) 2024-08-20 07:00:23 -07:00
Eric Liu
3d67d26c70 chore(package): replace contributors with maintainers 2024-08-18 11:28:20 -07:00
metonym
a5178d518e v0.85.2 2024-08-14 09:26:13 -07:00
Eric Liu
61eceb0caa
fix(header-action): allow vertical scroll when expanded (#1992) 2024-08-13 09:57:31 -07:00
metonym
38fe6f8147 v0.85.1 2024-08-09 06:03:47 -07:00
Wolfgang Rathgeb
47860ce1d7
fix(text-area): type value prop as nullable (#1933) 2024-08-09 05:55:30 -07:00
metonym
d73fe168f2 chore(docs): bump deps 2024-08-08 12:47:51 -07:00
metonym
338f651178 chore(examples): use OptimizeCssPlugin in Webpack set-up 2024-08-08 12:44:34 -07:00
metonym
5fb86e1ac6 chore(examples): bump deps 2024-08-08 12:44:34 -07:00
dependabot[bot]
195195ed96
build(deps): bump ws from 8.16.0 to 8.17.1 in /examples/webpack (#1979)
Bumps [ws](https://github.com/websockets/ws) from 8.16.0 to 8.17.1.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/8.16.0...8.17.1)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-08 12:37:58 -07:00
dependabot[bot]
22463b0aec
build(deps): bump braces from 3.0.2 to 3.0.3 (#1976)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-08 12:37:43 -07:00
jmeurice
216d5a39b1
fix(search): collapse expandable search if value is falsy (#1987)
Fixes #1981
2024-08-08 12:36:28 -07:00
Eytan
6140c3c5a9
fix(multi-select): fix filterItem return type (#1972) 2024-08-08 12:34:58 -07:00
metonym
607a97cddb docs: remove CDN instructions from site 2024-08-08 12:33:31 -07:00
Ben McCann
27ca34170e
docs: remove CDN instructions (#1989) 2024-08-08 12:31:01 -07:00
Eric Liu
ee70fbfa80
chore(docs): add mandatory IBM instrumentation tags (#1988)
Co-authored-by: Jeff Chew <jeff.chew@gmail.com>
2024-08-07 08:58:45 -07:00
Eric Liu
ba27830b2f
docs: update number of icons (#1973) 2024-05-27 09:44:19 -07:00
Eric Liu
4fbcbb0b5f chore: rebuild yarn.lock
b4f9d8bb
2024-05-01 18:06:06 -07:00
Eric Liu
ccc83a85dd chore(examples): bump deps 2024-04-29 22:11:33 -07:00
Francine Lucca
b4f9d8bb26
feat: instrument telemetry JS scope (#1966) 2024-04-29 22:08:54 -07:00
Eric Liu
1b3907fc71 docs(style): always use dark mode for code snippet 2024-03-31 10:40:49 -07:00
dependabot[bot]
dbfe50685c
build(deps): bump express from 4.18.3 to 4.19.2 in /examples/webpack (#1946)
Bumps [express](https://github.com/expressjs/express) from 4.18.3 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.18.3...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-31 10:01:45 -07:00
Eric Liu
adc7baed63 docs: update guidance on carbon-preprocess-svelte 2024-03-25 11:23:41 -07:00
Eric Liu
8a7583e8fc chore(package): normalize repository.url [ci skip]
Run "npm pkg fix" to auto-fix the error.
2024-03-23 14:52:15 -07:00
Eric Liu
40c8ba4449 chore(examples): bump deps 2024-03-23 14:40:01 -07:00
Eric Liu
1fc8fff2d9 v0.85.0 2024-03-23 14:05:12 -07:00
metonym
d5a11489f8
refactor!: use :global() for custom styles (#1940)
* Prefix custom class selectors with `bx--` (primarily used in custom UI Shell components)
* Use `:global` scope so that selector names are not hashed
2024-03-23 13:11:44 -07:00
dependabot[bot]
c1e0d7a3b8
build(deps): bump webpack-dev-middleware from 7.0.0 to 7.1.1 in /examples/webpack (#1939)
build(deps): bump webpack-dev-middleware in /examples/webpack

Bumps [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) from 7.0.0 to 7.1.1.
- [Release notes](https://github.com/webpack/webpack-dev-middleware/releases)
- [Changelog](https://github.com/webpack/webpack-dev-middleware/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-middleware/compare/v7.0.0...v7.1.1)

---
updated-dependencies:
- dependency-name: webpack-dev-middleware
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-21 12:11:36 -07:00
Eric Liu
acd08cde5c docs(ui-shell): remove unused imports 2024-03-18 14:31:28 -07:00
dependabot[bot]
4f3a1227ed
build(deps): bump follow-redirects from 1.15.5 to 1.15.6 in /examples/webpack (#1938)
build(deps): bump follow-redirects in /examples/webpack

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-16 09:45:07 -07:00
Eric Liu
240a87a8e9 v0.84.1 2024-03-16 09:42:25 -07:00
Nick Wing
6364b23030
fix(checkbox): forward on:focus, on:blur to Checkbox and InlineCheckbox (#1937) 2024-03-16 09:31:30 -07:00
berndfuhrmann
9132bf8e5a
fix(data-table): loosen sort return type to be a number (#1935)
Fixes #1934

Loosen the `sort` return type from `0 | 1 | -1` to `number`.
2024-03-13 09:55:02 -07:00
Eric Liu
21b1d78d8e chore(examples): bump deps 2024-03-09 08:54:09 -08:00
Eric Liu
8ce0c6b66d v0.84.0 2024-03-07 21:18:33 -08:00
spburtsev
d8bc65163e
feat(ui-shell): support button tooltip in HeaderGlobalAction (#1894)
Closes #1893
2024-03-07 20:37:58 -08:00
metonym
0405edee7d
fix(exports): resolve imports with explicit *.js extension (#1927)
Fixes #1925

Importing using the explicit `.*js` extension will throw an error as these are not included in the package exports map. Normally, this would be acceptable if it's not part of the API.

However, the `optimizeImports` Carbon preprocessor rewrites certain imports (e.g., `breakpoints`) to the source `*.js` file.

```sh
Internal server error: Failed to resolve import "carbon-components-svelte/src/Breakpoint/breakpoints.js" from "src/App.svelte".
```
2024-03-07 20:35:08 -08:00
Enrico Sacchetti
0071990803
v0.83.0 2024-03-06 22:53:25 -05:00
metonym
6152b784c1 fix(search): hoist ignore a11y autofocus comment
In Svelte 5, the comment is ignored when it's above the input element. Setting the comment at the top-level resolves the issue.
2024-03-06 22:49:27 -05:00
metonym
8bffc17d65 fix(link)!: do not render p for disabled link
Closes #1924

Svelte 5 will not compile if `div` is nested inside `p` element. Refactor Link to render an `a` instead of `p` when disabled.
2024-03-06 22:49:27 -05:00
metonym
a0d5028540 fix: avoid using reserved $ for Svelte 5 compat
Co-Authored-By: Eric Fulton <5297269+Sahasrara@users.noreply.github.com>
2024-03-06 22:49:27 -05:00
Eric Liu
96aef1705c ci: upgrade Node to 20.x 2024-03-05 20:58:51 -08:00
Eric Liu
de9e71178b ci: upgrade actions/cache to v4 2024-03-05 20:58:51 -08:00
metonym
91c27d48bf
docs(tag): add "Tooltip in a tag" example (#1922) 2024-03-05 20:55:06 -08:00
Francine Lucca
44a2989dff
chore(deps): add @ibm/telemetry-js (#1912) 2024-02-29 15:09:13 -08:00
metonym
0ef0f9b593 v0.82.11 2024-02-26 07:58:47 -08:00
Eric Liu
15f0e03c43 docs(button): add description to "Custom element" 2024-02-25 14:11:51 -08:00
Eric Liu
e8d4ed0382 docs(button): add "Link button with icon" example 2024-02-25 14:11:51 -08:00
Eric Liu
9aabe3cbbb fix(toast-notification): fire on:clear from timeout correctly
Fixes #1914

Co-Authored-By: brunnerh <brunnerh@users.noreply.github.com>
2024-02-25 13:38:46 -08:00
Eric Liu
ced9673681 docs(toast-notification): add "Autoclose" example 2024-02-25 13:38:46 -08:00
Eric Fulton
2404244221
fix(overflow-menu): use offsetWidth, offsetHeight to compute menu dimensions (#1913) 2024-02-25 10:21:54 -08:00
Eric Liu
c6af8bdafe docs(image-loader): add "Dynamic image source" example 2024-02-24 13:40:02 -08:00
Eric Liu
0f318aac77 fix(image-loader): updated src should update the image
Fixes #1677

The `ImageLoader` image should correctly update if `src` changes.
2024-02-24 13:40:02 -08:00
metonym
4e6bfd0612
docs(code-snippet): add "Custom show more/less text" example (#1918) 2024-02-24 10:39:14 -08:00
Eric Liu
1901bcddb6 docs(code-snippet): add "Hidden copy, show more buttons" example 2024-02-24 10:24:59 -08:00
Eric Liu
79b0f8dbf0 docs(code-snippet): add "Hidden show more button" example
Related #1536
2024-02-24 10:24:59 -08:00
Eric Liu
4085536189 fix(code-snippet): showMoreLess={false} should hide button
Fixes #1536

If `showMoreLess` is explicitly `false` for multi-line code snippets, the button should not be shown at all.
2024-02-24 10:24:59 -08:00
metonym
17f4c49519 v0.82.10 2024-02-12 14:09:40 -08:00
mmamedel
90dbd1562b
fix(slider): dispatch on:input event (#1906)
Fixes #1643

The dispatched `on:change` event in `Slider` only fires when the slider thumb is released. `on:input` fires when actively dragging the thumb, and should fire on every increment (e.g., 1, 2, 3).
2024-02-10 20:44:39 -08:00
Eric Liu
5c95891079 chore(deps-dev): bump svelte, svelte-check 2024-02-10 20:33:42 -08:00
Eric Liu
c35036011e chore(examples): bump deps 2024-02-10 20:31:01 -08:00
metonym
5a758b5c60 v0.82.9 2024-02-07 14:40:41 -08:00
metonym
4ad522c197
fix(context-menu): prevent on:contextmenu default behavior only when opening menu (#1911)
Fixes #1909
2024-02-07 14:37:44 -08:00
metonym
6590457574
fix(types): improve e.detail type for dispatched events (#1907)
* fix(types): improve `e.detail` type for dispatched events

* Run "yarn build:docs"

* test: assert new types
2024-02-01 10:56:34 -05:00
Enrico Sacchetti
f1cafd4959
build: set up separate publish jobs (#1887) 2024-01-12 13:44:20 -05:00
Gregor Wassmann
3bd943d12c
chore: linting (#1885) 2024-01-11 06:55:39 -08:00
Eric Liu
6aa0ef61ad v0.82.8 2024-01-09 20:19:40 -08:00
Eric Liu
d3e5b3dd54 chore: re-install sveld and run yarn build:docs 2024-01-09 20:15:04 -08:00
Ryan Marx
59018728df
fix(button): forward on:focus event (#1878)
Fixes #1830
2024-01-09 20:09:11 -08:00
metonym
1600775968
style(docs): color-scheme reflects theme (#1874) 2023-12-30 10:35:44 -08:00
Eric Liu
fe0b0c2b18 v0.82.7 2023-12-17 09:45:39 -08:00
metonym
479225711a
fix(radio-button): allow value type to be a number (#1868) 2023-12-17 09:42:28 -08:00
Eric Liu
1d82eb67a0 v0.82.6 2023-12-16 17:43:52 -08:00
metonym
053beeef7c
fix(package): include types in exports map (#1865)
Fixes #1863
2023-12-16 17:42:57 -08:00
metonym
42519690b7 chore(docs): upgrade deps
Modernize the docs set-up to use Vite 5 so that the exports map works.
2023-12-16 14:06:46 -08:00
metonym
64b39be524 chore(examples): bump deps 2023-12-16 13:39:25 -08:00
Eric Liu
2dde45a831 v0.82.5 2023-12-16 09:24:44 -08:00
Hyunseung
7bef3fae62
chore: add exports field to package.json (#1864)
Add an `exports` field to resolve a Vite development warning. The `package.json#svelte` entry field is deprecated and will eventually no longer be used.
2023-12-16 09:19:57 -08:00
Eric Liu
292881dc3e chore: remove types/README.md [ci skip]
Avoid publishing this file as part of the package since this is not relevant to consumers of the library.
2023-12-07 19:08:00 -08:00
metonym
6c9cf9e043
fix(header-search): blur input when active is false (#1857) 2023-11-23 07:41:22 -08:00
Eric Liu
decf966dd7 v0.82.4 2023-11-21 11:59:20 -08:00
metonym
192f6a775c
fix(header-search): blur input when deactivating (#1855) 2023-11-21 11:55:32 -08:00
metonym
d4e590fb07
docs: rework keyboard shortcuts to focus search bar (#1854) 2023-11-21 11:48:22 -08:00
metonym
f630007220 v0.82.3 2023-11-21 10:18:02 -08:00
metonym
e667352329
fix(header-search): "Escape" should close empty search bar (#1853) 2023-11-21 10:17:19 -08:00
metonym
b0b51a818a
docs: "/" or "CMD+K" should focus search bar (#1852) 2023-11-21 10:16:21 -08:00
Eric Liu
5d8e9aceb4 v0.82.2 2023-11-20 13:44:58 -08:00
metonym
e5e13a9e78
docs: implement rudimentary full-text search (#1849) 2023-11-20 13:39:06 -08:00
metonym
6da4572c26
fix(header-search): "Escape" should clear search query (#1851) 2023-11-20 13:37:34 -08:00
metonym
d68dc18266
fix(header-search): vertically center button icons (#1850) 2023-11-20 13:36:59 -08:00
metonym
6b80f10a4c v0.82.1 2023-11-18 10:21:43 -08:00
metonym
bed073c2f7
fix(pagination-nav): set button type="button" to prevent form submission (#1846) 2023-11-18 10:18:42 -08:00
metonym
4a3c697d82 docs: bump number of icons/pictograms [ci skip] 2023-11-17 09:13:25 -08:00
metonym
116c7bf245 v0.82.0 2023-11-13 07:59:15 -08:00
metonym
7b46d9b059
docs: add link rel="canonical" to pages (#1845) 2023-11-12 14:48:38 -08:00
metonym
0fdb9aa9e2
docs: update CONTRIBUTING.md (#1842) 2023-11-12 14:25:37 -08:00
metonym
1ad4e3d385
feat(tree-view): add showNode accessor (#1844)
Closes #1377
2023-11-12 14:25:15 -08:00
metonym
6a55fef62e
feat(tree-view): make node slottable (#1843)
Closes #1660
2023-11-12 14:15:28 -08:00
Eric Liu
417102d01f v0.81.3 2023-11-07 19:27:07 -08:00
Eric Liu
c70c49a4f2 ci: use --force install and add build permissions 2023-11-07 19:27:07 -08:00
Eric Liu
30b325f81f ci: add workflow to publish to npm 2023-11-07 19:01:46 -08:00
Eric Liu
a9460e944d
fix(select-item): export class and style props (#1840)
Closes #1839
2023-11-07 18:58:45 -08:00
Eric Liu
8d5ef9c93e
chore: create SECURITY.md
#1837
2023-11-07 18:42:46 -08:00
Eric Liu
001d2afb78
docs(form): fix typo in "Form" example (#1841)
Closes #1813
2023-11-05 19:39:38 -08:00
Eric Liu
fee236194b
chore: update docs site link with new URL (#1838) 2023-11-03 18:18:34 -07:00
Eric Liu
a6231d4b99 ci: deploy should be a step, not a job 2023-10-29 10:22:09 -07:00
Eric Liu
f0c4728cb7 chore: delete render.yaml 2023-10-29 10:22:09 -07:00
Enrico Sacchetti
2780367f77 v0.81.2 2023-10-26 21:25:21 -04:00
Enrico Sacchetti
7ba52df3a1
fix(multi-select): render checkboxes for form data (#1835)
* chore: downgrade docs to svelte 3 for compatibility
* chore(multi-select): keep checkboxes rendered in DOM
* Display ListBox via CSS

See #1742
2023-10-26 21:21:37 -04:00
metonym
33214e02d1 v0.81.1 2023-10-23 10:26:46 -07:00
Eric Liu
a828625c66
docs(button): add "Programmatic focus" example (#1834)
Related #1830
2023-10-23 09:55:00 -07:00
Eric Liu
6855633aec
chore(deps-dev): patch carbon-components to 10.58.12 (#1833) 2023-10-23 08:01:36 -07:00
Keehun
e3ab471018
fix(multi-select): reset selectedIds when clearing selection (#1832)
Fixes #1831
2023-10-22 11:56:11 -07:00
metonym
7eef53d57c v0.81.0 2023-10-13 08:37:39 -07:00
Eric Liu
519bd8616a feat(deps-dev): upgrade carbon-components to 10.58 (#1828)
* feat(deps-dev): upgrade `carbon-components` to 10.58

* Run "yarn build:css"
2023-10-13 08:33:30 -07:00
Eric Liu
06d81ddbff
fix(radio-button-group): strongly type dispatched change/select events (#1819) 2023-10-03 11:23:17 -07:00
Eric Liu
836b360b9b
fix(tile-group): add name and required props (#1818) 2023-10-03 11:20:16 -07:00
Eric Liu
5ef4dc1a72
docs(radio-button): use name in examples (#1817) 2023-10-03 09:34:01 -04:00
Alex Rock
9456eaab3c
feat(data-table): pass row to display function (#1810) 2023-10-01 10:19:13 -07:00
brunnerh
24e2a8874f
fix(radio-button-group): add name and required props (#1037)
Fixes #1036
2023-10-01 10:14:53 -07:00
Julián Perelli
108eb5286c
fix(file-uploader-button): clear value by setting to "" instead of null (#1812) 2023-09-30 08:41:14 -07:00
Alex Rock
aae2dd42aa
chore: update Git org name in README and CONTRIBUTING (#1811) 2023-09-27 08:48:04 -07:00
Eric Liu
b00ccc1d92
chore(deps-dev): upgrade svelte to v4.2.0 (#1804) 2023-09-01 17:42:32 -07:00
Eric Liu
9beca838a1 v0.80.0 2023-08-26 10:32:19 -07:00
Eric Liu
bc97ce5e1b
fix(skeleton-text): fix reactivity in paragraph variant (#1794)
Fixes #1793
2023-08-26 10:19:37 -07:00
Michael Greminger
e5675eb203
feat(ui-shell): forward click event to HeaderActionLink (#1797)
Closes #1796
2023-08-26 10:17:05 -07:00
Eric Liu
a1c7d9bd7c
docs(pictograms): update number of pictograms (#1787) 2023-07-27 12:26:53 -07:00
metonym
540521f5eb v0.79.0 2023-07-24 09:39:44 -07:00
Eric Liu
51c281de4a
feat(file-uploader): add size prop to FileUploaderButton (#1786) 2023-07-24 06:33:53 -07:00
Eric Liu
709322c281
feat(file-uploader-button): support danger-tertiary, danger-ghost button variants (#1784) 2023-07-23 14:34:08 -07:00
Eric Liu
50e1577d98
ci(workflows): upgrade actions/* to v3 (#1782) 2023-07-23 14:08:03 -07:00
Eric Liu
d6804b44fe
fix(loading)!: remove redundant description label (#1783)
Fixes #1670
2023-07-23 14:07:55 -07:00
Eric Liu
a7443c2dca
fix(types): correctly type kind prop in FileUploader, FileUploaderButton (#1781) 2023-07-23 12:42:33 -07:00
dependabot[bot]
65dcd9c286
build(deps): bump word-wrap from 1.2.3 to 1.2.4 in /docs (#1772)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-23 12:26:53 -07:00
Eric Liu
bc7f5821b8
refactor: use style directive where applicable (#1760)
Closes #1604
2023-07-23 12:26:46 -07:00
Eric Liu
dfa83bec9a
chore(deps-dev): upgrade sveld to v19 (#1776) 2023-07-23 12:26:02 -07:00
Eric Liu
be763706ca
fix(types): improve formatting of prop comments (#1779) 2023-07-23 12:25:44 -07:00
Eric Liu
239f1b10e5
feat(file-uploader): make labelTitle, labelDescription slottable (#1780) 2023-07-23 12:25:31 -07:00
Eric Liu
7ef8b73252
fix(file-uploader): do not render empty element if labelTitle, labelDescription not provided (#1778)
Fixes #1775
2023-07-23 12:19:21 -07:00
Eric Liu
baff07e012
feat(slider): add hideLabel prop (#1777)
Closes #1682

Co-authored-by: siaikin <abc1310054026@outlook.com>
2023-07-23 12:04:39 -07:00
metonym
ad711cdb38 v0.78.0 2023-07-19 09:47:27 -07:00
Eric Liu
2f026f792a
feat(typescript)!: support svelte 4 (#1773)
Closes #1753 

The minimum Svelte version required for TypeScript users is now 3.55.
2023-07-19 09:44:56 -07:00
Eric Liu
778b2c357f v0.77.0 2023-07-13 10:59:25 -07:00
Eric Liu
7885e124b4 chore(types): fix formatting of prop comments in Header, SideNav 2023-07-13 10:52:52 -07:00
Eric Liu
2715ed9c38 chore(ui-shell): update company prop description in Header (#1770) 2023-07-13 10:50:51 -07:00
Eric Liu
b015d76f15 chore(a11y): ignore svelte@4 a11y warnings (#1769) 2023-07-13 10:50:51 -07:00
Eric Liu
79c6c05504
chore(examples): bump deps (#1768) 2023-07-13 08:21:32 -07:00
Nestor Orest Plysyuk
ea9b261b60
feat(ui-shell): add preventCloseOnClickOutside to HeaderAction (#1625)
Closes #1624
2023-07-13 07:37:21 -07:00
Janos Lengyel
9b3f014a0b
feat(ui-shell): make company in Header slottable (#1764) 2023-07-13 07:33:48 -07:00
dependabot[bot]
14d584da42
build(deps): bump semver from 7.3.8 to 7.5.4 in /examples/webpack (#1767)
Bumps [semver](https://github.com/npm/node-semver) from 7.3.8 to 7.5.4.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.3.8...v7.5.4)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 08:36:46 -07:00
dependabot[bot]
5ffab3d2e6
build(deps): bump semver from 5.7.1 to 5.7.2 in /docs (#1766)
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 08:13:46 -07:00
dependabot[bot]
cfddcc303f
build(deps): bump semver from 5.7.1 to 5.7.2 (#1765)
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 08:11:53 -07:00
dependabot[bot]
de973b4f94
build(deps): bump tough-cookie from 4.0.0 to 4.1.3 in /docs (#1763)
Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.0.0 to 4.1.3.
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](https://github.com/salesforce/tough-cookie/compare/v4.0.0...v4.1.3)

---
updated-dependencies:
- dependency-name: tough-cookie
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 08:11:45 -07:00
Eric Liu
d8259af657 v0.76.1 2023-07-08 16:45:08 -07:00
Eric Liu
7fdc2ef7f0
fix(types): allow data-* attributes for props forwarded to HTML elements (#1741)
* chore(deps-dev): upgrade `sveld` to v0.18.1

* Run "yarn build:docs"

* test: assert that `data-*` attributes are valid
2023-07-08 16:41:44 -07:00
Eric Liu
7579c032fa
fix(select): hide helperText if invalid or warning state (#1761) 2023-07-08 11:29:05 -07:00
Eric Liu
7381a03951
chore(deps-dev): upgrade svelte-check to version 3 (#1739)
* chore(deps-dev): upgrade svelte-check, @tsconfig/svelte

* chore(types): fix type error in `TreeView`

* chore: adjust `test:types` command to ignore folders
2023-07-04 14:00:24 -07:00
Superior
ab21c89ab9
fix(slider): disabled Slider should not submit a form (#1758)
A single disabled input should not submit a form. If there are other non-disabled inputs in the same form, the value of the disabled input should not be included upon form submission.
2023-07-04 09:02:50 -07:00
Ben Periton
d5a4a8b94a
fix(date-picker): hide helperText if invalid or warning state (#1759) 2023-07-03 12:14:23 -07:00
Enrico Sacchetti
d75dca98d9
v0.76.0 2023-06-21 16:05:19 -04:00
Sachin
0b4f19c87e
feat: make titleText slottable in MultiSelect, ComboBox (#1750)
Closes #1747
2023-06-11 18:45:55 -07:00
918 changed files with 48902 additions and 18699 deletions

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
github: metonym

60
.github/workflows/checks.yml vendored Normal file
View file

@ -0,0 +1,60 @@
on:
pull_request:
paths-ignore:
- "**.md"
- "docs/**"
- "examples/**"
push:
branches: [master]
paths-ignore:
- "**.md"
- "docs/**"
- "examples/**"
permissions:
contents: read
jobs:
lint:
runs-on: macos-15-xlarge
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
- run: npm ci
- run: npm run lint
test:
runs-on: macos-15-xlarge
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
- run: npm ci
- run: npm run test
types:
runs-on: macos-15-xlarge
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
- run: npm ci
- run: npm run test:src-types
- run: npm run test:types
deploy-docs:
if: github.ref == 'refs/heads/master'
needs: [lint, test, types]
runs-on: macos-15-xlarge
steps:
- name: Trigger deploy
env:
deploy_url: ${{ secrets.RENDER_DEPLOY_HOOK_URL }}
run: curl -f "$deploy_url"

View file

@ -1,35 +0,0 @@
name: CI
on:
pull_request:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: yarn-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies, build, test, and lint the codebase
run: |
yarn
yarn build:lib
yarn test:types
yarn lint
deploy-docs:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Trigger deploy
env:
deploy_url: ${{ secrets.RENDER_DEPLOY_HOOK_URL }}
run: |
curl -X GET "$deploy_url"

40
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,40 @@
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: macos-latest-xlarge
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22.x"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm install
- name: Build docs
run: npm run build:docs
- name: Prune package.json
run: npx culls --preserve=svelte
- name: Publish package (stable)
if: ${{ ! contains(github.ref, '-next') }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
npm publish --provenance --access public
- name: Publish package (next)
if: ${{ contains(github.ref, '-next') }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
npm publish --provenance --access public --tag next

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
lib
node_modules node_modules
.DS_Store .DS_Store
.vscode .vscode

View file

@ -1,4 +1,3 @@
/lib
/css /css
/types /types
.svelte-kit .svelte-kit
@ -7,3 +6,4 @@ dist
client client
build build
*.svx *.svx
COMPONENT_API.json

View file

@ -2,12 +2,438 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.75.1](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.75.0...v0.75.1) (2023-06-02) ### [0.89.7](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.89.6...v0.89.7) (2025-09-05)
### Bug Fixes ### Bug Fixes
* **expandable-tile:** set tile height using resize observer ([#1738](https://github.com/carbon-design-system/carbon-components-svelte/issues/1738)) ([a369962](https://github.com/carbon-design-system/carbon-components-svelte/commit/a369962fdf96f95bbdcc2f8f9f84c5d900ec4087)) - **combo-box:** address accessibility issues ([#2186](https://github.com/carbon-design-system/carbon-components-svelte/issues/2186)) ([2fc884c](https://github.com/carbon-design-system/carbon-components-svelte/commit/2fc884cacabfffcf7779d6ef9ba01dece0bf5d86)), closes [#2172](https://github.com/carbon-design-system/carbon-components-svelte/issues/2172)
- **data-table:** handle dynamic `headers` gracefully ([#2195](https://github.com/carbon-design-system/carbon-components-svelte/issues/2195)) ([6d0d3b1](https://github.com/carbon-design-system/carbon-components-svelte/commit/6d0d3b108bb4595d878fda20736c40b9656d14d7)), closes [#2193](https://github.com/carbon-design-system/carbon-components-svelte/issues/2193)
- **overflow-menu:** avoid dynamic style injection for performance ([#2198](https://github.com/carbon-design-system/carbon-components-svelte/issues/2198)) ([14edf41](https://github.com/carbon-design-system/carbon-components-svelte/commit/14edf41e57fea1ddbb2cf24c37e79475849bdea1)), closes [#2197](https://github.com/carbon-design-system/carbon-components-svelte/issues/2197)
- **pagination:** `on:change` dispatches with correct value ([#2194](https://github.com/carbon-design-system/carbon-components-svelte/issues/2194)) ([44a6cc0](https://github.com/carbon-design-system/carbon-components-svelte/commit/44a6cc0dfcbd3cdad1b442a760c9f604e58d56e6))
### [0.89.6](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.89.5...v0.89.6) (2025-08-16)
### Bug Fixes
- **toggle:** avoid dispatching `toggle` event on state change ([#2184](https://github.com/carbon-design-system/carbon-components-svelte/issues/2184)) ([0df727b](https://github.com/carbon-design-system/carbon-components-svelte/commit/0df727b704d6cc577681dc682269a6e224ddbb6e))
### [0.89.5](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.89.4...v0.89.5) (2025-08-05)
### Bug Fixes
- **checkbox:** prevent infinite effect loop when binding to same object ([#2178](https://github.com/carbon-design-system/carbon-components-svelte/issues/2178)) ([c7ad1eb](https://github.com/carbon-design-system/carbon-components-svelte/commit/c7ad1ebdd3764235f460abd95cdb7d1d389983d9)), closes [#2177](https://github.com/carbon-design-system/carbon-components-svelte/issues/2177)
### [0.89.4](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.89.3...v0.89.4) (2025-06-10)
### Bug Fixes
- **multi-select:** forward `on:input` for filterable variant ([#2170](https://github.com/carbon-design-system/carbon-components-svelte/issues/2170)) ([aecc4e8](https://github.com/carbon-design-system/carbon-components-svelte/commit/aecc4e8eec6571515233ec76ca06218814a279a7))
### [0.89.3](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.89.2...v0.89.3) (2025-06-07)
### Bug Fixes
- **combo-box:** "Escape" key clears input value ([#2169](https://github.com/carbon-design-system/carbon-components-svelte/issues/2169)) ([632320a](https://github.com/carbon-design-system/carbon-components-svelte/commit/632320ae3b8d9c602add0f4f7c708fc643cb7ffc)), closes [#2167](https://github.com/carbon-design-system/carbon-components-svelte/issues/2167)
- **combo-box:** clear button supports "Space" key ([#2168](https://github.com/carbon-design-system/carbon-components-svelte/issues/2168)) ([95c06a8](https://github.com/carbon-design-system/carbon-components-svelte/commit/95c06a83b3afcbb76acfc0a5efe2f178d333ff19)), closes [#2166](https://github.com/carbon-design-system/carbon-components-svelte/issues/2166)
### [0.89.2](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.89.1...v0.89.2) (2025-04-28)
### Bug Fixes
- **composed-modal:** ignore a11y warning in Svelte 5 ([#2159](https://github.com/carbon-design-system/carbon-components-svelte/issues/2159)) ([024d774](https://github.com/carbon-design-system/carbon-components-svelte/commit/024d77493c93e7823e4781a1a60aaf350d289d52))
- **pagination:** use `toLocaleString` for default text formatting ([#2161](https://github.com/carbon-design-system/carbon-components-svelte/issues/2161)) ([cdf5659](https://github.com/carbon-design-system/carbon-components-svelte/commit/cdf5659fa0177da77dc8ea1ccffdec54b746954b))
- **pagination:** window `totalItems` for performance ([#2160](https://github.com/carbon-design-system/carbon-components-svelte/issues/2160)) ([ed3928b](https://github.com/carbon-design-system/carbon-components-svelte/commit/ed3928bb01ecca2fa63f551938dbee1c1829a978)), closes [#2156](https://github.com/carbon-design-system/carbon-components-svelte/issues/2156)
- **to-hierarchy:** revert to previous implementation ([96d37cc](https://github.com/carbon-design-system/carbon-components-svelte/commit/96d37cc490f28830264c35c84447ee4526256314))
### [0.89.1](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.89.0...v0.89.1) (2025-04-21)
### Bug Fixes
- **toolbar-search:** re-filter rows if `DataTable` rows change ([#2154](https://github.com/carbon-design-system/carbon-components-svelte/issues/2154)) ([f09c2e2](https://github.com/carbon-design-system/carbon-components-svelte/commit/f09c2e2c311c15f633db8dc45930d8e58a4b362d)), closes [#2143](https://github.com/carbon-design-system/carbon-components-svelte/issues/2143)
### [0.89.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.88.4...v0.89.0) (2025-04-18)
### Features
- **combo-box:** add `hideLabel` prop ([#2153](https://github.com/carbon-design-system/carbon-components-svelte/issues/2153)) ([436dea4](https://github.com/carbon-design-system/carbon-components-svelte/commit/436dea47e8da35753a257c9b2bd6f33338e95ba5))
### Bug Fixes
- **select:** falsy item `text` should fallback to `value` ([#2152](https://github.com/carbon-design-system/carbon-components-svelte/issues/2152)) ([61ea8dd](https://github.com/carbon-design-system/carbon-components-svelte/commit/61ea8dd82c2f9863dfe5f8a882e73624b994d9e5))
### [0.88.4](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.88.3...v0.88.4) (2025-03-24)
### Bug Fixes
- **list-box-selection:** fix `aria-label` for clear button ([#2134](https://github.com/carbon-design-system/carbon-components-svelte/issues/2134)) ([dd1338f](https://github.com/carbon-design-system/carbon-components-svelte/commit/dd1338ffc47926a13e231d4a0f724e923f2219e2))
- **list-box:** correct button/description translations based on selection count ([#2139](https://github.com/carbon-design-system/carbon-components-svelte/issues/2139)) ([1a5f2d8](https://github.com/carbon-design-system/carbon-components-svelte/commit/1a5f2d8e67734bfda20272ae6a77d13b3837416d))
- **list-box:** set `aria-disabled` if `disabled` ([#2125](https://github.com/carbon-design-system/carbon-components-svelte/issues/2125)) ([#2138](https://github.com/carbon-design-system/carbon-components-svelte/issues/2138)) ([9b61af0](https://github.com/carbon-design-system/carbon-components-svelte/commit/9b61af0306b422acf1e7cdde278e517740f667c5)), closes [#2130](https://github.com/carbon-design-system/carbon-components-svelte/issues/2130)
- **radio-button:** forward `focus`, `blur` events ([#2135](https://github.com/carbon-design-system/carbon-components-svelte/issues/2135)) ([1462e30](https://github.com/carbon-design-system/carbon-components-svelte/commit/1462e300d69f0cd7ee5476dfe3a7ea892ac8f4ad)), closes [#2131](https://github.com/carbon-design-system/carbon-components-svelte/issues/2131)
- **radio-tile:** allow standalone `RadioTile` usage ([#2136](https://github.com/carbon-design-system/carbon-components-svelte/issues/2136)) ([ca9beeb](https://github.com/carbon-design-system/carbon-components-svelte/commit/ca9beebaeac7eaed8079c010a86a78926b00147f))
- **text-area:** allow visually hidden label ([#2137](https://github.com/carbon-design-system/carbon-components-svelte/issues/2137)) ([43511e0](https://github.com/carbon-design-system/carbon-components-svelte/commit/43511e09ecf312c1b8e9339856b9d7d0785036de))
### [0.88.3](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.88.2...v0.88.3) (2025-03-19)
### Bug Fixes
- Revert **list-box:** use `aria-disabled` instead of invalid `disabled` attribute ([#2125](https://github.com/carbon-design-system/carbon-components-svelte/issues/2125)) ([e1b3ef2](https://github.com/carbon-design-system/carbon-components-svelte/commit/e1b3ef22c9ee09474bacadbb0b22b41326566bab))
### [0.88.2](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.88.1...v0.88.2) (2025-03-19)
### Bug Fixes
- **combo-box:** fix typing when refocusing input ([9e3d830](https://github.com/carbon-design-system/carbon-components-svelte/commit/9e3d83031e69889472c4e84be256ea242854cf81))
- **list-box:** use `aria-disabled` instead of invalid `disabled` attribute ([#2125](https://github.com/carbon-design-system/carbon-components-svelte/issues/2125)) ([e1b3ef2](https://github.com/carbon-design-system/carbon-components-svelte/commit/e1b3ef22c9ee09474bacadbb0b22b41326566bab))
- **multi-select:** fix keyboard navigation for disabled items ([#2129](https://github.com/carbon-design-system/carbon-components-svelte/issues/2129)) ([e7939ff](https://github.com/carbon-design-system/carbon-components-svelte/commit/e7939ff0e21c3430c9eea74c503b7c35f6823445)), closes [#2128](https://github.com/carbon-design-system/carbon-components-svelte/issues/2128)
- **notification:** remove invalid `kind` prop from markup ([#2126](https://github.com/carbon-design-system/carbon-components-svelte/issues/2126)) ([e85d7ef](https://github.com/carbon-design-system/carbon-components-svelte/commit/e85d7efc5ed15f5236d074fd7981ae527d9e5ab5))
- **theme:** remove invalid `themes` prop from markup ([#2127](https://github.com/carbon-design-system/carbon-components-svelte/issues/2127)) ([5987b61](https://github.com/carbon-design-system/carbon-components-svelte/commit/5987b61a5522fff09468bddd586eed4a537edcc8))
### [0.88.1](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.88.0...v0.88.1) (2025-03-12)
### Bug Fixes
- **select:** falsy item `text` should not override `value` ([#2118](https://github.com/carbon-design-system/carbon-components-svelte/issues/2118)) ([663b79a](https://github.com/carbon-design-system/carbon-components-svelte/commit/663b79ad054d14a91a8bf700feb62dcf50976eb8)), closes [#2117](https://github.com/carbon-design-system/carbon-components-svelte/issues/2117)
- **ui-shell:** `HeaderAction` uses dark color scheme ([#2119](https://github.com/carbon-design-system/carbon-components-svelte/issues/2119)) ([7ff93ad](https://github.com/carbon-design-system/carbon-components-svelte/commit/7ff93ad2dac489859d5b4a83c1e359a6507718b4))
### [0.88.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.87.7...v0.88.0) (2025-03-09)
### Features
- **data-table:** allow custom `inputName` for radio/checkbox ([#2087](https://github.com/carbon-design-system/carbon-components-svelte/issues/2087)) ([7481b9a](https://github.com/carbon-design-system/carbon-components-svelte/commit/7481b9a995dfbc8c2fbaeaae143c8372cf5fce66)), closes [#2085](https://github.com/carbon-design-system/carbon-components-svelte/issues/2085)
- **ui-shell:** `HeaderAction` supports tooltip ([#2111](https://github.com/carbon-design-system/carbon-components-svelte/issues/2111)) ([24b9cbc](https://github.com/carbon-design-system/carbon-components-svelte/commit/24b9cbc9c343537e5e74799ef8289bd29396cf04)), closes [#2110](https://github.com/carbon-design-system/carbon-components-svelte/issues/2110)
### [0.87.7](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.87.6...v0.87.7) (2025-03-07)
### Bug Fixes
- **select:** avoid infinite update loop in Svelte 5 ([#2108](https://github.com/carbon-design-system/carbon-components-svelte/issues/2108)) ([9b4bfa6](https://github.com/carbon-design-system/carbon-components-svelte/commit/9b4bfa6f86e23155516db156cbe1c980f3c699e8)), closes [#2107](https://github.com/carbon-design-system/carbon-components-svelte/issues/2107)
### [0.87.6](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.87.5...v0.87.6) (2025-02-24)
### Bug Fixes
- **overflow-menu:** add `aria-controls` to trigger button ([#2100](https://github.com/carbon-design-system/carbon-components-svelte/issues/2100)) ([b7297d4](https://github.com/carbon-design-system/carbon-components-svelte/commit/b7297d452a7813c02f3c89280787292b1c46acec))
### [0.87.5](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.87.4...v0.87.5) (2025-02-04)
### Bug Fixes
- **tag:** allow `on:close` to work with Svelte 5 ([#2097](https://github.com/carbon-design-system/carbon-components-svelte/issues/2097)) ([6e65ef3](https://github.com/carbon-design-system/carbon-components-svelte/commit/6e65ef39e7ff9a3c0ee25b7945a62584e9b7441e)), closes [#2096](https://github.com/carbon-design-system/carbon-components-svelte/issues/2096)
### [0.87.4](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.87.3...v0.87.4) (2025-02-02)
### Bug Fixes
- **types:** loosen `icon` prop type to `any` ([#2095](https://github.com/carbon-design-system/carbon-components-svelte/issues/2095)) ([6bf72d4](https://github.com/carbon-design-system/carbon-components-svelte/commit/6bf72d46024ad2ce03651f28fc1a2a95ec03385d))
### [0.87.3](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.87.2...v0.87.3) (2025-01-30)
### Bug Fixes
- **overflow-menu:** support Svelte 5 ([88f4304](https://github.com/carbon-design-system/carbon-components-svelte/commit/88f4304d5a7c9b38b3cabda677233bef48fb9e3a)), closes [#2092](https://github.com/carbon-design-system/carbon-components-svelte/issues/2092)
### [0.87.2](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.87.1...v0.87.2) (2025-01-22)
### Bug Fixes
- **text-area:** counter supports null `value` ([#2089](https://github.com/carbon-design-system/carbon-components-svelte/issues/2089)) ([76eec84](https://github.com/carbon-design-system/carbon-components-svelte/commit/76eec84c5458d07d61d057d9ff06938e244dbb2c))
### [0.87.1](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.87.0...v0.87.1) (2025-01-19)
### Bug Fixes
- **data-table:** improve `expandable` accessibility ([#2086](https://github.com/carbon-design-system/carbon-components-svelte/issues/2086)) ([e874ac1](https://github.com/carbon-design-system/carbon-components-svelte/commit/e874ac19d778a00c0bba9be65d10be7e6c9104dd))
- **data-table:** prefix internal ID for radio button, checkbox ([#2082](https://github.com/carbon-design-system/carbon-components-svelte/issues/2082)) ([dd6cbac](https://github.com/carbon-design-system/carbon-components-svelte/commit/dd6cbac3ee1728dbcba5cd1d8faa43941e2a198e)), closes [#2081](https://github.com/carbon-design-system/carbon-components-svelte/issues/2081)
- **dropdown:** avoid manual field `blur` ([c194c80](https://github.com/carbon-design-system/carbon-components-svelte/commit/c194c80e29ab36935af71adb9e166e9a16b70910)), closes [#2083](https://github.com/carbon-design-system/carbon-components-svelte/issues/2083)
- **multi-select:** avoid manual field `blur` ([fb6719b](https://github.com/carbon-design-system/carbon-components-svelte/commit/fb6719b1aee35aa45004d82e3b923b4ad45dff5d)), closes [#2083](https://github.com/carbon-design-system/carbon-components-svelte/issues/2083)
### [0.87.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.86.2...v0.87.0) (2024-12-09)
### Features
- add `toHierarchy` utility to normalize flat data into `nodes` for `TreeView`, `RecursiveList` ([#2072](https://github.com/carbon-design-system/carbon-components-svelte/issues/2072)) ([48afd18](https://github.com/carbon-design-system/carbon-components-svelte/commit/48afd18e5e01c2839024b8ddb31038267bcedeb8))
### Bug Fixes
- **tooltip-icon:** `button` should have explicit `type` ([#2071](https://github.com/carbon-design-system/carbon-components-svelte/issues/2071)) ([18c964e](https://github.com/carbon-design-system/carbon-components-svelte/commit/18c964e579a3762b8022751bf0ed5313b78b22ba))
### [0.86.2](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.86.1...v0.86.2) (2024-11-30)
### Bug Fixes
- **multi-select:** fix sorting behavior ([c3a390f](https://github.com/carbon-design-system/carbon-components-svelte/commit/c3a390f3fef072c6b736e33a85a2ae772df12e52)), closes [#2066](https://github.com/carbon-design-system/carbon-components-svelte/issues/2066)
## [0.86.1](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.86.0...v0.86.1) (2024-11-22)
### Bug Fixes
- **tree-view:** do not flatten original `nodes` ([#2056](https://github.com/carbon-design-system/carbon-components-svelte/issues/2056)) ([e488c88](https://github.com/carbon-design-system/carbon-components-svelte/commit/e488c8837146432330ebbf2f9182a8a69eab6b70))
## [0.86.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.85.4...v0.86.0) (2024-11-20)
### ⚠ BREAKING CHANGES
- **package:** set `type="module"` in `package.json`
- **package:** remove bundled ESM/UMD support
- **treeview:** rename `children` prop to `nodes` for Svelte 5 compatibility
- **recursive-list:** rename `children` prop to `nodes` for Svelte 5 compatibility
- **types:** use type alias instead of interface for exported component props ([6fbd8ae](https://github.com/carbon-design-system/carbon-components-svelte/commit/6fbd8ae6a90eabde74fb5481c980716eba477c31))
### Features
- **data-table:** support TypeScript generics ([#1954](https://github.com/carbon-design-system/carbon-components-svelte/issues/1954)) ([dd43224](https://github.com/carbon-design-system/carbon-components-svelte/commit/dd43224119905c3a26a2369f836338c18fcbafba))
### Bug Fixes
- **data-table:** (Svelte 5 compatibility) handle `ToolbarSearch` filtering in `DataTable` ([#2037](https://github.com/carbon-design-system/carbon-components-svelte/issues/2037)) ([3192824](https://github.com/carbon-design-system/carbon-components-svelte/commit/3192824322faef7c0c012eb246bb6ef9da7f78dc))
- **multi-select:** (Svelte 5 compatibility) avoid cyclic dependency ([#2034](https://github.com/carbon-design-system/carbon-components-svelte/issues/2034)) ([1acd713](https://github.com/carbon-design-system/carbon-components-svelte/commit/1acd7135372eeabf002dacc80e39162989427140))
- **toolbar-menu:** (Svelte 5 compatibility) remove redundant menu offset ([#2047](https://github.com/carbon-design-system/carbon-components-svelte/issues/2047)) ([7e17394](https://github.com/carbon-design-system/carbon-components-svelte/commit/7e173943ac783756521c4957a1c24b5288ab45b7)), closes [#2040](https://github.com/carbon-design-system/carbon-components-svelte/issues/2040)
- **checkbox:** (Svelte 5 compatibility) bind `indeterminate` ([#2044](https://github.com/carbon-design-system/carbon-components-svelte/issues/2044)) ([9d5e7e3](https://github.com/carbon-design-system/carbon-components-svelte/commit/9d5e7e31efb2d439b18ba0bf350b712377e160a7)), closes [#2039](https://github.com/carbon-design-system/carbon-components-svelte/issues/2039)
### [0.85.4](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.85.3...v0.85.4) (2024-11-09)
### Bug Fixes
- **combo-box:** fix types for `on:clear` ([#2020](https://github.com/carbon-design-system/carbon-components-svelte/issues/2020)) ([0831e87](https://github.com/carbon-design-system/carbon-components-svelte/commit/0831e871358fe012e9907699f1423b7e36dba0da))
- **data-table:** fix `DataTableValue` type reference in `DataTable` ([#2023](https://github.com/carbon-design-system/carbon-components-svelte/issues/2023)) ([44daa77](https://github.com/carbon-design-system/carbon-components-svelte/commit/44daa775d5e4dc9aef66eae0e661f14fb5b41354))
- **theme:** `Theme` correctly imports `toggle`, `select` props ([#2019](https://github.com/carbon-design-system/carbon-components-svelte/issues/2019)) ([49b5def](https://github.com/carbon-design-system/carbon-components-svelte/commit/49b5def8153f5eec523d56e2a2c6d4cc3a36dcb5)), closes [#2018](https://github.com/carbon-design-system/carbon-components-svelte/issues/2018)
- **toolbar-search:** fix types for `on:clear` ([#2022](https://github.com/carbon-design-system/carbon-components-svelte/issues/2022)) ([58e6021](https://github.com/carbon-design-system/carbon-components-svelte/commit/58e6021b08f311a5bb3cc7c7f181443cc633c8e4))
- **types:** delete extraneous `icons/Search.svelte.d.ts` ([#2025](https://github.com/carbon-design-system/carbon-components-svelte/issues/2025)) ([951d686](https://github.com/carbon-design-system/carbon-components-svelte/commit/951d6860423fc05df9f46e29fb19916b89c48466))
- **types:** fix types for `on:paste` event ([3167e44](https://github.com/carbon-design-system/carbon-components-svelte/commit/3167e449fdaf19abb4cdf1e2bf3f5bec24865f89))
### [0.85.3](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.85.2...v0.85.3) (2024-10-25)
### Bug Fixes
- address Svelte 5 warnings ([#2011](https://github.com/carbon-design-system/carbon-components-svelte/issues/2011)) ([43fccac](https://github.com/carbon-design-system/carbon-components-svelte/commit/43fccac1c6273d9aa83b8c26a5f8cecec667db59))
### [0.85.2](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.85.1...v0.85.2) (2024-08-14)
### Bug Fixes
- **header-action:** allow vertical scroll when expanded ([#1992](https://github.com/carbon-design-system/carbon-components-svelte/issues/1992)) ([61eceb0](https://github.com/carbon-design-system/carbon-components-svelte/commit/61eceb0caac20d92ce58c23d26908530a7e32dbe))
### [0.85.1](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.85.0...v0.85.1) (2024-08-09)
### Bug Fixes
- **multi-select:** fix `filterItem` return type ([#1972](https://github.com/carbon-design-system/carbon-components-svelte/issues/1972)) ([6140c3c](https://github.com/carbon-design-system/carbon-components-svelte/commit/6140c3c5a91a879889be33080e1aa8b9183982d4))
- **search:** collapse expandable search if value is falsy ([#1987](https://github.com/carbon-design-system/carbon-components-svelte/issues/1987)) ([216d5a3](https://github.com/carbon-design-system/carbon-components-svelte/commit/216d5a39b14ddad600159c1159b6a2d38095cfaf)), closes [#1981](https://github.com/carbon-design-system/carbon-components-svelte/issues/1981)
- **text-area:** type `value` prop as nullable ([#1933](https://github.com/carbon-design-system/carbon-components-svelte/issues/1933)) ([47860ce](https://github.com/carbon-design-system/carbon-components-svelte/commit/47860ce1d7cc5f3b0363ab619dcfd74b3276eda7))
## [0.85.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.84.1...v0.85.0) (2024-03-23)
### ⚠ BREAKING CHANGES
- use `:global()` for custom UI Shell styles ([#1940](https://github.com/carbon-design-system/carbon-components-svelte/issues/1940)) ([d5a1148](https://github.com/carbon-design-system/carbon-components-svelte/commit/d5a11489f8ab9dc05751aa20c420ea4dc6249567))
### [0.84.1](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.84.0...v0.84.1) (2024-03-16)
### Bug Fixes
- **checkbox:** forward `on:focus`, `on:blur` to `Checkbox` and `InlineCheckbox` ([#1937](https://github.com/carbon-design-system/carbon-components-svelte/issues/1937)) ([6364b23](https://github.com/carbon-design-system/carbon-components-svelte/commit/6364b23030cc0761aa6a0561a1673e89dde47868))
- **data-table:** loosen `sort` return type to be a `number` ([#1935](https://github.com/carbon-design-system/carbon-components-svelte/issues/1935)) ([9132bf8](https://github.com/carbon-design-system/carbon-components-svelte/commit/9132bf8e5a2d6ba70d17a0b4fcdea29d0785492c)), closes [#1934](https://github.com/carbon-design-system/carbon-components-svelte/issues/1934)
### [0.84.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.83.0...v0.84.0) (2024-03-08)
### Features
- **ui-shell:** support button tooltip in `HeaderGlobalAction` ([#1894](https://github.com/carbon-design-system/carbon-components-svelte/issues/1894)) ([d8bc651](https://github.com/carbon-design-system/carbon-components-svelte/commit/d8bc65163eabacfee348d6248e90f683ac488aef)), closes [#1893](https://github.com/carbon-design-system/carbon-components-svelte/issues/1893)
### Bug Fixes
- **exports:** resolve imports with explicit \*.js extension ([#1927](https://github.com/carbon-design-system/carbon-components-svelte/issues/1927)) ([0405ede](https://github.com/carbon-design-system/carbon-components-svelte/commit/0405edee7d1696a157acab941488f8d3a750187f)), closes [#1925](https://github.com/carbon-design-system/carbon-components-svelte/issues/1925)
## [0.83.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.11...v0.83.0) (2024-03-07)
### ⚠ BREAKING CHANGES
- **link:** do not render `p` for disabled link
### Bug Fixes
- avoid using reserved `$` for Svelte 5 compat ([a0d5028](https://github.com/carbon-design-system/carbon-components-svelte/commit/a0d5028540e1bcbb3b37bf488c11ea94f97b5fa7))
- **link:** do not render `p` for disabled link ([8bffc17](https://github.com/carbon-design-system/carbon-components-svelte/commit/8bffc17d650144ed0d5b778766f79c33334f0275)), closes [#1924](https://github.com/carbon-design-system/carbon-components-svelte/issues/1924)
- **search:** hoist ignore `a11y autofocus` comment ([6152b78](https://github.com/carbon-design-system/carbon-components-svelte/commit/6152b784c1e6b19ff242524e6b0c8c98b0107788))
### [0.82.11](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.10...v0.82.11) (2024-02-26)
### Bug Fixes
- **code-snippet:** `showMoreLess={false}` should hide button ([4085536](https://github.com/carbon-design-system/carbon-components-svelte/commit/40855361891c2388c2b775803bcac937fbd6c1d6)), closes [#1536](https://github.com/carbon-design-system/carbon-components-svelte/issues/1536)
- **image-loader:** updated `src` should update the image ([0f318aa](https://github.com/carbon-design-system/carbon-components-svelte/commit/0f318aac7732c2b94ec0729d54416611fbd0d493)), closes [#1677](https://github.com/carbon-design-system/carbon-components-svelte/issues/1677)
- **overflow-menu:** use `offsetWidth`, `offsetHeight` to compute menu dimensions ([#1913](https://github.com/carbon-design-system/carbon-components-svelte/issues/1913)) ([2404244](https://github.com/carbon-design-system/carbon-components-svelte/commit/24042442213ca9daa0cf663aabf37b3544e9c364))
- **toast-notification:** fire `on:clear` from timeout correctly ([9aabe3c](https://github.com/carbon-design-system/carbon-components-svelte/commit/9aabe3cbbb05712b71f5cad7c571b170c1f3a439)), closes [#1914](https://github.com/carbon-design-system/carbon-components-svelte/issues/1914)
### [0.82.10](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.9...v0.82.10) (2024-02-12)
### Bug Fixes
- **slider:** dispatch `on:input` event ([#1906](https://github.com/carbon-design-system/carbon-components-svelte/issues/1906)) ([90dbd15](https://github.com/carbon-design-system/carbon-components-svelte/commit/90dbd1562b04df3cf4de28874b6e790ddca1db81)), closes [#1643](https://github.com/carbon-design-system/carbon-components-svelte/issues/1643)
### [0.82.9](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.8...v0.82.9) (2024-02-07)
### Bug Fixes
- **context-menu:** prevent `on:contextmenu` default behavior only when opening menu ([#1911](https://github.com/carbon-design-system/carbon-components-svelte/issues/1911)) ([4ad522c](https://github.com/carbon-design-system/carbon-components-svelte/commit/4ad522c197d4a389a6187a499e9e54d5d8b3994a)), closes [#1909](https://github.com/carbon-design-system/carbon-components-svelte/issues/1909)
- **types:** improve `e.detail` type for dispatched events ([#1907](https://github.com/carbon-design-system/carbon-components-svelte/issues/1907)) ([6590457](https://github.com/carbon-design-system/carbon-components-svelte/commit/65904575743ba06344fb75e14685e42494c13cde))
### [0.82.8](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.7...v0.82.8) (2024-01-10)
### Bug Fixes
- **button:** forward `on:focus` event ([#1878](https://github.com/carbon-design-system/carbon-components-svelte/issues/1878)) ([5901872](https://github.com/carbon-design-system/carbon-components-svelte/commit/59018728df08db18ba85609e6db1c6dd8701d8bb)), closes [#1830](https://github.com/carbon-design-system/carbon-components-svelte/issues/1830)
### [0.82.7](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.6...v0.82.7) (2023-12-17)
### Bug Fixes
- **radio-button:** allow `value` type to be a number ([#1868](https://github.com/carbon-design-system/carbon-components-svelte/issues/1868)) ([4792257](https://github.com/carbon-design-system/carbon-components-svelte/commit/479225711a1e304df74f0cfc585e32b5454afd66))
### [0.82.6](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.5...v0.82.6) (2023-12-17)
### Bug Fixes
- **package:** include types in exports map ([#1865](https://github.com/carbon-design-system/carbon-components-svelte/issues/1865)) ([053beee](https://github.com/carbon-design-system/carbon-components-svelte/commit/053beeef7cbb1031f09798ffc360f8c87d17e3e1)), closes [#1863](https://github.com/carbon-design-system/carbon-components-svelte/issues/1863)
### [0.82.5](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.4...v0.82.5) (2023-12-16)
### Bug Fixes
- **header-search:** blur input when `active` is false ([#1857](https://github.com/carbon-design-system/carbon-components-svelte/issues/1857)) ([6c9cf9e](https://github.com/carbon-design-system/carbon-components-svelte/commit/6c9cf9e043b3c963a257a28fa8dd29c8acd4b2ce))
- **package.json:** add `exports` field to package.json to address Vite development warnings ([#1864](https://github.com/carbon-design-system/carbon-components-svelte/issues/1864)) ([7bef3fa](https://github.com/carbon-design-system/carbon-components-svelte/commit/7bef3fae6250607337306e95440b8a472638476f))
### [0.82.4](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.3...v0.82.4) (2023-11-21)
### Bug Fixes
- **header-search:** blur input when deactivating ([#1855](https://github.com/carbon-design-system/carbon-components-svelte/issues/1855)) ([192f6a7](https://github.com/carbon-design-system/carbon-components-svelte/commit/192f6a775c2a7da25e7fc4893efdc5a80b83928c))
### [0.82.3](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.2...v0.82.3) (2023-11-21)
### Bug Fixes
- **header-search:** "Escape" should close empty search bar ([#1853](https://github.com/carbon-design-system/carbon-components-svelte/issues/1853)) ([e667352](https://github.com/carbon-design-system/carbon-components-svelte/commit/e667352329651c25dc2d283eaa6cc8ca872040f6))
### [0.82.2](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.1...v0.82.2) (2023-11-20)
### Bug Fixes
- **header-search:** "Escape" should clear search query ([#1851](https://github.com/carbon-design-system/carbon-components-svelte/issues/1851)) ([6da4572](https://github.com/carbon-design-system/carbon-components-svelte/commit/6da4572c2672e02a6463ee8374fd341868512034))
- **header-search:** vertically center button icons ([#1850](https://github.com/carbon-design-system/carbon-components-svelte/issues/1850)) ([d68dc18](https://github.com/carbon-design-system/carbon-components-svelte/commit/d68dc182668dc0b56481d4646d672591cd7fc3e3))
### [0.82.1](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.82.0...v0.82.1) (2023-11-18)
### Bug Fixes
- **pagination-nav:** set `button type="button"` to prevent form submission ([#1846](https://github.com/carbon-design-system/carbon-components-svelte/issues/1846)) ([bed073c](https://github.com/carbon-design-system/carbon-components-svelte/commit/bed073c2f707392d3fe7d75fbf4550e723b93605))
### [0.82.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.81.3...v0.82.0) (2023-11-13)
### Features
- **tree-view:** add `showNode` accessor ([#1844](https://github.com/carbon-design-system/carbon-components-svelte/issues/1844)) ([1ad4e3d](https://github.com/carbon-design-system/carbon-components-svelte/commit/1ad4e3d3856e07fb1808f34b8c48dfc6a8a5e7d8)), closes [#1377](https://github.com/carbon-design-system/carbon-components-svelte/issues/1377)
- **tree-view:** make `node` slottable ([#1843](https://github.com/carbon-design-system/carbon-components-svelte/issues/1843)) ([6a55fef](https://github.com/carbon-design-system/carbon-components-svelte/commit/6a55fef62e095114a1782d1079501e9e940cca94)), closes [#1660](https://github.com/carbon-design-system/carbon-components-svelte/issues/1660)
### [0.81.3](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.81.2...v0.81.3) (2023-11-08)
### Bug Fixes
- **select-item:** export `class` and `style` props ([#1840](https://github.com/carbon-design-system/carbon-components-svelte/issues/1840)) ([a9460e9](https://github.com/carbon-design-system/carbon-components-svelte/commit/a9460e944de9ae967664a75df842f4bdc909067f)), closes [#1839](https://github.com/carbon-design-system/carbon-components-svelte/issues/1839)
### [0.81.2](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.81.1...v0.81.2) (2023-10-27)
### Bug Fixes
- **multi-select:** render checkboxes for form data ([#1835](https://github.com/carbon-design-system/carbon-components-svelte/issues/1835)) ([7ba52df](https://github.com/carbon-design-system/carbon-components-svelte/commit/7ba52df3a1ee89b06377a0b4888cce27cc89196f)), closes [#1742](https://github.com/carbon-design-system/carbon-components-svelte/issues/1742)
### [0.81.1](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.81.0...v0.81.1) (2023-10-23)
### Bug Fixes
- **multi-select:** reset `selectedIds` when clearing selection ([#1832](https://github.com/carbon-design-system/carbon-components-svelte/issues/1832)) ([e3ab471](https://github.com/carbon-design-system/carbon-components-svelte/commit/e3ab471018b9ac94ff9de2284284dc61ba69c881)), closes [#1831](https://github.com/carbon-design-system/carbon-components-svelte/issues/1831)
### [0.81.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.80.0...v0.81.0) (2023-10-13)
### Features
- **data-table:** pass `row` to `display` function ([#1810](https://github.com/carbon-design-system/carbon-components-svelte/issues/1810)) ([9456eaa](https://github.com/carbon-design-system/carbon-components-svelte/commit/9456eaab3ce5259d8f6dcaa7b3db9058d3555aa6))
- **deps-dev:** upgrade `carbon-components` to 10.58 ([#1828](https://github.com/carbon-design-system/carbon-components-svelte/issues/1828)) ([519bd86](https://github.com/carbon-design-system/carbon-components-svelte/commit/519bd8616a4fe16af4befb6a1159e62f42d9651c))
### Bug Fixes
- **file-uploader-button:** clear value by setting to `""` instead of `null` ([#1812](https://github.com/carbon-design-system/carbon-components-svelte/issues/1812)) ([108eb52](https://github.com/carbon-design-system/carbon-components-svelte/commit/108eb5286c46bd17a54ccbda31ee95f16a16763e))
- **radio-button-group:** add `name` and `required` props ([#1037](https://github.com/carbon-design-system/carbon-components-svelte/issues/1037)) ([24e2a88](https://github.com/carbon-design-system/carbon-components-svelte/commit/24e2a8874f5d0c39f88761c3f118ba71aab27c1d)), closes [#1036](https://github.com/carbon-design-system/carbon-components-svelte/issues/1036)
- **radio-button-group:** strongly type dispatched change/select events ([#1819](https://github.com/carbon-design-system/carbon-components-svelte/issues/1819)) ([06d81dd](https://github.com/carbon-design-system/carbon-components-svelte/commit/06d81ddbff8a6170d34ca1e94a41c16d318ec7ca))
- **tile-group:** add `name` and `required` props ([#1818](https://github.com/carbon-design-system/carbon-components-svelte/issues/1818)) ([836b360](https://github.com/carbon-design-system/carbon-components-svelte/commit/836b360b9b7402cb3cd44489fd5f14b8c901f9f2))
### [0.80.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.79.0...v0.80.0) (2023-08-26)
### Features
- **ui-shell:** forward `click` event to `HeaderActionLink` ([#1797](https://github.com/carbon-design-system/carbon-components-svelte/issues/1797)) ([e5675eb](https://github.com/carbon-design-system/carbon-components-svelte/commit/e5675eb203db51de736b24f41694f5b020f9aafc)), closes [#1796](https://github.com/carbon-design-system/carbon-components-svelte/issues/1796)
### Bug Fixes
- **skeleton-text:** fix reactivity in `paragraph` variant ([#1794](https://github.com/carbon-design-system/carbon-components-svelte/issues/1794)) ([bc97ce5](https://github.com/carbon-design-system/carbon-components-svelte/commit/bc97ce5e1b69669d17f3ad13aaeb774b05c09c80)), closes [#1793](https://github.com/carbon-design-system/carbon-components-svelte/issues/1793)
## [0.79.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.78.0...v0.79.0) (2023-07-24)
### ⚠ BREAKING CHANGES
- **loading:** remove `id` prop from `Loading` (#1783)
### Features
- **file-uploader-button:** support `danger-tertiary`, `danger-ghost` button variants ([#1784](https://github.com/carbon-design-system/carbon-components-svelte/issues/1784)) ([709322c](https://github.com/carbon-design-system/carbon-components-svelte/commit/709322c2819e3123ade4a13e3fd7d05035154d6b))
- **file-uploader:** add `size` prop to `FileUploaderButton` ([#1786](https://github.com/carbon-design-system/carbon-components-svelte/issues/1786)) ([51c281d](https://github.com/carbon-design-system/carbon-components-svelte/commit/51c281de4a29b99e61952959a8cbfdba0b49e786))
- **file-uploader:** make `labelTitle`, `labelDescription` slottable ([#1780](https://github.com/carbon-design-system/carbon-components-svelte/issues/1780)) ([239f1b1](https://github.com/carbon-design-system/carbon-components-svelte/commit/239f1b10e562507f66e3cd318084ed1de30f0c25))
- **slider:** add `hideLabel` prop ([#1777](https://github.com/carbon-design-system/carbon-components-svelte/issues/1777)) ([baff07e](https://github.com/carbon-design-system/carbon-components-svelte/commit/baff07e012b43e1a24b2e574a57509f711a463f6)), closes [#1682](https://github.com/carbon-design-system/carbon-components-svelte/issues/1682)
### Bug Fixes
- **file-uploader:** do not render empty element if `labelTitle`, `labelDescription` not provided ([#1778](https://github.com/carbon-design-system/carbon-components-svelte/issues/1778)) ([7ef8b73](https://github.com/carbon-design-system/carbon-components-svelte/commit/7ef8b73252709130c8e269b83b2936e1631c96fa)), closes [#1775](https://github.com/carbon-design-system/carbon-components-svelte/issues/1775)
- **loading:** remove redundant `description` label ([#1783](https://github.com/carbon-design-system/carbon-components-svelte/issues/1783)) ([d6804b4](https://github.com/carbon-design-system/carbon-components-svelte/commit/d6804b44fea0d4fc23574e63e7d4c64fa18e8f42)), closes [#1670](https://github.com/carbon-design-system/carbon-components-svelte/issues/1670)
- **types:** correctly type `kind` prop in `FileUploader`, `FileUploaderButton` ([#1781](https://github.com/carbon-design-system/carbon-components-svelte/issues/1781)) ([a7443c2](https://github.com/carbon-design-system/carbon-components-svelte/commit/a7443c2dca396f79e06fed695374c0a15bda14ed))
- **types:** improve formatting of prop comments ([#1779](https://github.com/carbon-design-system/carbon-components-svelte/issues/1779)) ([be76370](https://github.com/carbon-design-system/carbon-components-svelte/commit/be763706ca7ab0182bc0f8171e74043ccbadf461))
## [0.78.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.77.0...v0.78.0) (2023-07-19)
### ⚠ BREAKING CHANGES
- **typescript:** minimum Svelte version for TypeScript users is 3.55
### Features
- **typescript:** support svelte 4 ([#1773](https://github.com/carbon-design-system/carbon-components-svelte/issues/1773)) ([2f026f7](https://github.com/carbon-design-system/carbon-components-svelte/commit/2f026f792ad94f468b890a6d5ab36cc2642dacf2)), closes [#1753](https://github.com/carbon-design-system/carbon-components-svelte/issues/1753)
## [0.77.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.76.1...v0.77.0) (2023-07-13)
### Features
- **ui-shell:** add `preventCloseOnClickOutside` to `HeaderAction` ([#1625](https://github.com/carbon-design-system/carbon-components-svelte/issues/1625)) ([ea9b261](https://github.com/carbon-design-system/carbon-components-svelte/commit/ea9b261b60698f9314e0aae4d61025bae215cccf)), closes [#1624](https://github.com/carbon-design-system/carbon-components-svelte/issues/1624)
- **ui-shell:** make `company` in `Header` slottable ([#1764](https://github.com/carbon-design-system/carbon-components-svelte/issues/1764)) ([9b3f014](https://github.com/carbon-design-system/carbon-components-svelte/commit/9b3f014a0ba43abb5a36be4a6156910b5d7644d7))
### [0.76.1](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.76.0...v0.76.1) (2023-07-08)
### Bug Fixes
- **date-picker:** hide `helperText` if invalid or warning state ([#1759](https://github.com/carbon-design-system/carbon-components-svelte/issues/1759)) ([d5a4a8b](https://github.com/carbon-design-system/carbon-components-svelte/commit/d5a4a8b94a8753545a54f7e43f1773e49a1ff208))
- **select:** hide `helperText` if invalid or warning state ([#1761](https://github.com/carbon-design-system/carbon-components-svelte/issues/1761)) ([7579c03](https://github.com/carbon-design-system/carbon-components-svelte/commit/7579c032faa3f1b9ad9d42f76da876f38725141e))
- **slider:** `disabled` Slider should not submit a form ([#1758](https://github.com/carbon-design-system/carbon-components-svelte/issues/1758)) ([ab21c89](https://github.com/carbon-design-system/carbon-components-svelte/commit/ab21c89ab9240f61bd15d8c20bad65b3b469a29c))
- **types:** allow `data-*` attributes for props forwarded to HTML elements ([#1741](https://github.com/carbon-design-system/carbon-components-svelte/issues/1741)) ([7fdc2ef](https://github.com/carbon-design-system/carbon-components-svelte/commit/7fdc2ef7f072382842cbb6bfc8e12e083aef1a1e))
### [0.76.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.75.1...v0.75.2) (2023-06-21)
### Features
- make `titleText` slottable in `MultiSelect`, `ComboBox` ([#1750](https://github.com/carbon-design-system/carbon-components-svelte/issues/1750)) ([0b4f19c](https://github.com/carbon-design-system/carbon-components-svelte/commit/0b4f19c87e8479f0649fa2c5dc84beb4c1a1e302)), closes [#1747](https://github.com/carbon-design-system/carbon-components-svelte/issues/1747)
### [0.75.1](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.75.0...v0.75.1) (2023-06-02)
### Bug Fixes
- **expandable-tile:** set tile height using resize observer ([#1738](https://github.com/carbon-design-system/carbon-components-svelte/issues/1738)) ([a369962](https://github.com/carbon-design-system/carbon-components-svelte/commit/a369962fdf96f95bbdcc2f8f9f84c5d900ec4087))
### [0.75.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.74.0...v0.74.1) (2023-05-21) ### [0.75.0](https://github.com/carbon-design-system/carbon-components-svelte/compare/v0.74.0...v0.74.1) (2023-05-21)
@ -1514,9 +1940,9 @@ Svelte version >=3.48.0 is required.
**Documentation** **Documentation**
- add DataTable example ["Sortable with nested object values"](https://carbon-components-svelte.onrender.com/components/DataTable#sortable-with-nested-object-values) - add DataTable example ["Sortable with nested object values"](https://svelte.carbondesignsystem.com/components/DataTable#sortable-with-nested-object-values)
- add ClickableTile example ["Disabled state"](https://carbon-components-svelte.onrender.com/components/ClickableTile#disabled-state) - add ClickableTile example ["Disabled state"](https://svelte.carbondesignsystem.com/components/ClickableTile#disabled-state)
- add Link example ["Link with icon"](https://carbon-components-svelte.onrender.com/components/Link#link-with-icon) - add Link example ["Link with icon"](https://svelte.carbondesignsystem.com/components/Link#link-with-icon)
**Housekeeping** **Housekeeping**
@ -1862,9 +2288,9 @@ Svelte version >=3.48.0 is required.
**Documentation** **Documentation**
- add ["Padded columns"](https://carbon-components-svelte.onrender.com/components/Grid#padded-columns) example to Grid docs - add ["Padded columns"](https://svelte.carbondesignsystem.com/components/Grid#padded-columns) example to Grid docs
- demo different transitions in ["Header with app switcher"](https://carbon-components-svelte.onrender.com/components/UIShell#header-with-app-switcher) example in UI Shell - demo different transitions in ["Header with app switcher"](https://svelte.carbondesignsystem.com/components/UIShell#header-with-app-switcher) example in UI Shell
- describe use case for [using native styles in OrderedList](https://carbon-components-svelte.onrender.com/components/OrderedList#native-list-styles) - describe use case for [using native styles in OrderedList](https://svelte.carbondesignsystem.com/components/OrderedList#native-list-styles)
**Housekeeping** **Housekeeping**
@ -1890,8 +2316,8 @@ Svelte version >=3.48.0 is required.
**Documentation** **Documentation**
- Add example ["Skeleton with object headers"](https://carbon-components-svelte.onrender.com/components/DataTable#skeleton-with-object-headers) to the DataTable docs - Add example ["Skeleton with object headers"](https://svelte.carbondesignsystem.com/components/DataTable#skeleton-with-object-headers) to the DataTable docs
- Add example ["Header with global search"](https://carbon-components-svelte.onrender.com/components/UIShell#header-with-global-search) to the UI Shell docs - Add example ["Header with global search"](https://svelte.carbondesignsystem.com/components/UIShell#header-with-global-search) to the UI Shell docs
- deprecate HeaderActionSearch in favor of HeaderSearch - deprecate HeaderActionSearch in favor of HeaderSearch
## [0.23.2](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.23.2) - 2020-11-25 ## [0.23.2](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.23.2) - 2020-11-25
@ -1910,17 +2336,17 @@ Svelte version >=3.48.0 is required.
**Documentation** **Documentation**
- Add [programmatic RadioButton example](https://carbon-components-svelte.onrender.com/components/RadioButton#programmatic-usage) - Add [programmatic RadioButton example](https://svelte.carbondesignsystem.com/components/RadioButton#programmatic-usage)
- Add [multiple ComboBox example](https://carbon-components-svelte.onrender.com/components/ComboBox#multiple-combo-boxes) - Add [multiple ComboBox example](https://svelte.carbondesignsystem.com/components/ComboBox#multiple-combo-boxes)
- Add [multiple Dropdown example](https://carbon-components-svelte.onrender.com/components/Dropdown#multiple-dropdowns) - Add [multiple Dropdown example](https://svelte.carbondesignsystem.com/components/Dropdown#multiple-dropdowns)
- Add [multiple MultiSelect example](https://carbon-components-svelte.onrender.com/components/MultiSelect#multiple-multi-select-dropdowns) - Add [multiple MultiSelect example](https://svelte.carbondesignsystem.com/components/MultiSelect#multiple-multi-select-dropdowns)
- Add [ExpandableAccordion recipe](https://carbon-components-svelte.onrender.com/recipes/ExpandableAccordion#expandable-accordion) - Add [ExpandableAccordion recipe](https://svelte.carbondesignsystem.com/recipes/ExpandableAccordion#expandable-accordion)
## [0.23.0](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.23.0) - 2020-11-20 ## [0.23.0](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.23.0) - 2020-11-20
**Features** **Features**
- Persist UI Shell Header hamburger menu if `persistentHamburgerMenu` is `true` ([PR #396](https://github.com/carbon-design-system/carbon-components-svelte/pull/396), [issue #374](https://github.com/carbon-design-system/carbon-components-svelte/issues/374), [rendered example](https://carbon-components-svelte.onrender.com/framed/UIShell/PersistedHamburgerMenu)) - Persist UI Shell Header hamburger menu if `persistentHamburgerMenu` is `true` ([PR #396](https://github.com/carbon-design-system/carbon-components-svelte/pull/396), [issue #374](https://github.com/carbon-design-system/carbon-components-svelte/issues/374), [rendered example](https://svelte.carbondesignsystem.com/framed/UIShell/PersistedHamburgerMenu))
- Disable auto focus in ComposedModal if `selectorPrimaryFocus` is `null` ([PR #393](https://github.com/carbon-design-system/carbon-components-svelte/pull/393)) - Disable auto focus in ComposedModal if `selectorPrimaryFocus` is `null` ([PR #393](https://github.com/carbon-design-system/carbon-components-svelte/pull/393))
- Use small size Toggle variant if `size` is `"sm"`; deprecate ToggleSmall which will be removed in the next major release ([PR #401](https://github.com/carbon-design-system/carbon-components-svelte/pull/401)) - Use small size Toggle variant if `size` is `"sm"`; deprecate ToggleSmall which will be removed in the next major release ([PR #401](https://github.com/carbon-design-system/carbon-components-svelte/pull/401))
@ -1938,9 +2364,9 @@ Svelte version >=3.48.0 is required.
- Update auto-generated Component API documentation with output from [sveld](https://github.com/carbon-design-system/sveld) - Update auto-generated Component API documentation with output from [sveld](https://github.com/carbon-design-system/sveld)
- Label reactive component props and list them first - Label reactive component props and list them first
- Replace back ticks in Component API prop descriptions with a `code` tag ([PR #392](https://github.com/carbon-design-system/carbon-components-svelte/pull/392), [issue #390](https://github.com/carbon-design-system/carbon-components-svelte/issues/390)) - Replace back ticks in Component API prop descriptions with a `code` tag ([PR #392](https://github.com/carbon-design-system/carbon-components-svelte/pull/392), [issue #390](https://github.com/carbon-design-system/carbon-components-svelte/issues/390))
- Simplify date sort method in ["Sortable with custom display and sort methods"](https://carbon-components-svelte.onrender.com/components/DataTable#sortable-with-custom-display-and-sort-methods) DataTable example ([PR #382](https://github.com/carbon-design-system/carbon-components-svelte/pull/382)) - Simplify date sort method in ["Sortable with custom display and sort methods"](https://svelte.carbondesignsystem.com/components/DataTable#sortable-with-custom-display-and-sort-methods) DataTable example ([PR #382](https://github.com/carbon-design-system/carbon-components-svelte/pull/382))
- Add [programmatic ProgressIndicator](https://carbon-components-svelte.onrender.com/components/ProgressIndicator#programmatic-usage) example - Add [programmatic ProgressIndicator](https://svelte.carbondesignsystem.com/components/ProgressIndicator#programmatic-usage) example
- Add [vertical ProgressIndicatorSkeleton](https://carbon-components-svelte.onrender.com/components/ProgressIndicator#skeleton-vertical) example - Add [vertical ProgressIndicatorSkeleton](https://svelte.carbondesignsystem.com/components/ProgressIndicator#skeleton-vertical) example
- Add deprecation warning to the ToggleSmall component - Add deprecation warning to the ToggleSmall component
**Housekeeping** **Housekeeping**
@ -1998,7 +2424,7 @@ Svelte version >=3.48.0 is required.
**Documentation** **Documentation**
- DataTable: add example ["Empty column with overflow menu"](https://carbon-components-svelte.onrender.com/components/DataTable#empty-column-with-overflow-menu) - DataTable: add example ["Empty column with overflow menu"](https://svelte.carbondesignsystem.com/components/DataTable#empty-column-with-overflow-menu)
- hand off current theme for examples opened in a new tab - hand off current theme for examples opened in a new tab
- add field size examples for `Dropdown`, `MultiSelect`, `Select` - add field size examples for `Dropdown`, `MultiSelect`, `Select`
@ -2024,13 +2450,13 @@ Svelte version >=3.48.0 is required.
**Documentation** **Documentation**
- new DataTable examples: - new DataTable examples:
- [With custom display and sort methods](https://carbon-components-svelte.onrender.com/components/DataTable#with-custom-display-and-sort-methods) - [With custom display and sort methods](https://svelte.carbondesignsystem.com/components/DataTable#with-custom-display-and-sort-methods)
- [With toolbar](https://carbon-components-svelte.onrender.com/components/DataTable#with-toolbar) - [With toolbar](https://svelte.carbondesignsystem.com/components/DataTable#with-toolbar)
- [With toolbar (small size)](https://carbon-components-svelte.onrender.com/components/DataTable#with-toolbar-small-size) - [With toolbar (small size)](https://svelte.carbondesignsystem.com/components/DataTable#with-toolbar-small-size)
- [Selectable](https://carbon-components-svelte.onrender.com/components/DataTable#selectable) - [Selectable](https://svelte.carbondesignsystem.com/components/DataTable#selectable)
- [Initial selected rows](https://carbon-components-svelte.onrender.com/components/DataTable#initial-selected-rows) - [Initial selected rows](https://svelte.carbondesignsystem.com/components/DataTable#initial-selected-rows)
- [Selectable with batch actions](https://carbon-components-svelte.onrender.com/components/DataTable#selectable-with-batch-actions) - [Selectable with batch actions](https://svelte.carbondesignsystem.com/components/DataTable#selectable-with-batch-actions)
- [Selectable (radio)](https://carbon-components-svelte.onrender.com/components/DataTable#selectable-radio) - [Selectable (radio)](https://svelte.carbondesignsystem.com/components/DataTable#selectable-radio)
- fix(docgen): list both default and named slots in `COMPONENT_INDEX.md` - fix(docgen): list both default and named slots in `COMPONENT_INDEX.md`
## [0.19.0](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.19.0) - 2020-10-23 ## [0.19.0](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.19.0) - 2020-10-23
@ -2162,7 +2588,7 @@ Svelte version >=3.48.0 is required.
**Documentation** **Documentation**
- Redesign component [documentation website](https://carbon-components-svelte.onrender.com/) - Redesign component [documentation website](https://svelte.carbondesignsystem.com/)
- Update development workflow in `CONTRIBUTING.md` - Update development workflow in `CONTRIBUTING.md`
- Typo fixes in `README.md` ([PR #324](https://github.com/carbon-design-system/carbon-components-svelte/pull/324), [PR #325](https://github.com/carbon-design-system/carbon-components-svelte/pull/325)) - Typo fixes in `README.md` ([PR #324](https://github.com/carbon-design-system/carbon-components-svelte/pull/324), [PR #325](https://github.com/carbon-design-system/carbon-components-svelte/pull/325))

File diff suppressed because it is too large Load diff

View file

@ -2,23 +2,10 @@
Before submitting a pull request (PR), consider [filing an issue](https://github.com/carbon-design-system/carbon-components-svelte/issues) to gain clarity and direction. Before submitting a pull request (PR), consider [filing an issue](https://github.com/carbon-design-system/carbon-components-svelte/issues) to gain clarity and direction.
- [Prerequisites](#prerequisites)
- [Project set-up](#project-set-up)
- [Install](#install)
- [Documentation set-up](#documentation-set-up)
- [Development workflow](#development-workflow)
- [Component Format](#component-format)
- [Editing a component](#editing-a-component)
- [Creating a component](#creating-a-component)
- [Run `yarn build:docs`](#run-yarn-builddocs)
- [Submit a Pull Request](#submit-a-pull-request)
- [Sync Your Fork](#sync-your-fork)
- [Submit a PR](#submit-a-pr)
## Prerequisites ## Prerequisites
- [Node.js](https://nodejs.org/en/download/package-manager/) (version >=12) - [Node.js](https://nodejs.org/en/download/package-manager/) (version >=20)
- [Yarn](https://classic.yarnpkg.com/en/docs/install) - [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm#using-a-node-installer-to-install-nodejs-and-npm)
## Project set-up ## Project set-up
@ -32,42 +19,35 @@ cd carbon-components-svelte
Set the original repository as the upstream: Set the original repository as the upstream:
```sh ```sh
git remote add upstream git@github.com:IBM/carbon-components-svelte.git git remote add upstream git@github.com:carbon-design-system/carbon-components-svelte.git
# verify that the upstream is added # verify that the upstream is added
git remote -v git remote -v
``` ```
### Install ### Install
Install the project dependencies: Install the project dependencies.
```sh ```sh
# carbon-components-svelte/ npm install
yarn install
``` ```
## Documentation set-up ## Documentation set-up
Component documentation is located in the `docs` folder. The website is built using svite, routify, and MDsveX. You will need to create a symbolic project link in order to see live changes reflected when developing locally. Component documentation is located in the `docs` folder. The website is built using svite, routify, and MDsveX. You will need to create a symbolic project link in order to see live changes reflected when developing locally.
First, create a symbolic link at the root of the project folder: First, create a symbolic link at the root of the project:
```sh ```sh
# carbon-components-svelte/ npm link
yarn link
``` ```
Go into the `docs` folder: Then, go into `docs` and link the package.
```sh ```sh
cd docs cd docs
``` npm link "carbon-components-svelte"
npm install
Link `"carbon-components-svelte"`:
```sh
yarn link "carbon-components-svelte"
yarn install
``` ```
If linked correctly, any change to a component in the `src` folder should be reflected in the `docs` site. If linked correctly, any change to a component in the `src` folder should be reflected in the `docs` site.
@ -87,10 +67,10 @@ Preview changes to components from the `src` folder in the documentation website
In the `docs` folder, run: In the `docs` folder, run:
```sh ```sh
yarn dev npm run dev
``` ```
The site should be served at `http://localhost:3000/` (or the next available port). The site should be served at http://localhost:5173/ (or the next available port).
### Component Format ### Component Format
@ -134,13 +114,12 @@ export {
} from "./ComposedModal"; } from "./ComposedModal";
``` ```
### Run `yarn build:docs` ### Run `npm run build:docs`
Run the following command to re-generate TypeScript definitions and documentation. Run the following command to re-generate TypeScript definitions and documentation.
```sh ```sh
# carbon-components-svelte/ npm run build:docs
yarn build:docs
``` ```
## Submit a Pull Request ## Submit a Pull Request
@ -165,27 +144,44 @@ The following items only apply to project maintainers.
### Release ### Release
Locally, while on `master` and the branch is clean, run `yarn release`. This command will: This library is published to NPM with [provenance](https://docs.npmjs.com/generating-provenance-statements) via a [GitHub workflow](https://github.com/carbon-design-system/carbon-components-svelte/blob/master/.github/workflows/release.yml).
- Build library and docs The workflow is automatically triggered when pushing a tag that begins with `v` (e.g., `v0.81.1`).
- Bump package.json version
- Add notes to Changelog However, maintainers must perform a few things in preparation for a release.
Locally, while on `master` and the branch is clean, run `npm run release`. This command will:
- Bump the semantic version in `package.json`
- Generate notes in `CHANGELOG.md`
- Run `npm run build:docs` to update the generated documentation
This command will not create a commit nor tag. Afterwards, perform the following manually: This command will not create a commit nor tag. Afterwards, perform the following manually:
```sh ```sh
# 1. Stage prepared files for a commit # 1. Commit the changes using the new version as the commit message.
git add . git commit -am "v0.81.1"
# 2. Commit based on the current version, either manually or with jq # 2. Create a tag.
git commit -m "v$(jq -r '.version' package.json)" git tag v0.81.1
# 3. Create a tag based on the current version, either manually or with `jq`: # 3. Push the tag to the remote.
git tag "v$(jq -r '.version' package.json)" # This will trigger the `release.yml` workflow to publish a new package to NPM (with provenance).
git push origin v0.81.1
# 4. Push branch and tag, then publish ```
git push origin master [tag]
yarn publish If all goes as expected, the [`release.yml` workflow](https://github.com/carbon-design-system/carbon-components-svelte/actions/workflows/release.yml) should trigger a new run and publish the new version to NPM.
# 5. Generate release notes on GitHub, and comment on issues and pull requests ### Post-release checklist
After confirming that the new release is published to NPM, perform the following:
1. Create a [new release](https://github.com/carbon-design-system/carbon-components-svelte/releases/new) on GitHub. Click "Generate release notes" to automatically list changes by commit with the relevant Pull Request and author metadata. You may manually remove notes that are not relevant to the release (e.g., CI changes).
2. Publish the release as the latest release.
3. As good practice, visit the Pull Request and/or issue for each commit and manually confirm that it's been released. This is helpful for future readers to understand what version includes the new feature or fix.
```md
Released in [v0.81.1](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.81.1).
``` ```

138
README.md
View file

@ -1,7 +1,7 @@
# carbon-components-svelte # carbon-components-svelte
[![NPM][npm]][npm-url] [![NPM][npm]][npm-url]
![GitHub](https://img.shields.io/github/license/ibm/carbon-components-svelte?color=262626&style=for-the-badge) ![GitHub](https://img.shields.io/github/license/carbon-design-system/carbon-components-svelte?color=262626&style=for-the-badge)
![npm downloads to date](https://img.shields.io/npm/dt/carbon-components-svelte?color=262626&style=for-the-badge) ![npm downloads to date](https://img.shields.io/npm/dt/carbon-components-svelte?color=262626&style=for-the-badge)
<a href="https://discord.gg/J7JEUEkTRX"> <a href="https://discord.gg/J7JEUEkTRX">
<img src="https://img.shields.io/discord/689212587170201628?color=5865F2&style=for-the-badge" alt="Chat with us on Discord"> <img src="https://img.shields.io/discord/689212587170201628?color=5865F2&style=for-the-badge" alt="Chat with us on Discord">
@ -13,12 +13,12 @@ Design systems facilitate design and development through reuse, consistency, and
The Carbon Svelte portfolio also includes: The Carbon Svelte portfolio also includes:
- **[Carbon Icons Svelte](https://github.com/carbon-design-system/carbon-icons-svelte)**: 2,000+ Carbon icons as Svelte components - **[Carbon Icons Svelte](https://github.com/carbon-design-system/carbon-icons-svelte)**: 2,500+ Carbon icons as Svelte components
- **[Carbon Pictograms Svelte](https://github.com/carbon-design-system/carbon-pictograms-svelte)**: 900+ Carbon pictograms as Svelte components - **[Carbon Pictograms Svelte](https://github.com/carbon-design-system/carbon-pictograms-svelte)**: 1,300+ Carbon pictograms as Svelte components
- **[Carbon Charts Svelte](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/svelte)**: 20+ charts, powered by d3 - **[Carbon Charts Svelte](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/svelte)**: 25+ charts, powered by d3
- **[Carbon Preprocess Svelte](https://github.com/carbon-design-system/carbon-preprocess-svelte)**: Collection of Svelte preprocessors for Carbon - **[Carbon Preprocess Svelte](https://github.com/carbon-design-system/carbon-preprocess-svelte)**: Collection of Svelte preprocessors for Carbon
## [Documentation](https://carbon-components-svelte.onrender.com) ## [Documentation](https://svelte.carbondesignsystem.com)
Other forms of documentation are auto-generated: Other forms of documentation are auto-generated:
@ -28,17 +28,18 @@ Other forms of documentation are auto-generated:
## Installation ## Installation
Install `carbon-components-svelte` as a development dependency.
```sh ```sh
# Yarn
yarn add -D carbon-components-svelte
# npm # npm
npm i -D carbon-components-svelte npm i carbon-components-svelte
# pnpm # pnpm
pnpm i -D carbon-components-svelte pnpm i carbon-components-svelte
# Yarn
yarn add carbon-components-svelte
# Bun
bun add carbon-components-svelte
``` ```
## Usage ## Usage
@ -87,37 +88,6 @@ import "carbon-components-svelte/css/g100.css";
import "carbon-components-svelte/css/all.css"; import "carbon-components-svelte/css/all.css";
``` ```
#### CDN
An alternative to loading styles is to link an external StyleSheet from a Content Delivery Network (CDN) like [unpkg.com](https://unpkg.com/).
This is best suited for rapid prototyping.
##### HTML
```html
<!DOCTYPE html>
<html>
<head>
<link
rel="stylesheet"
href="https://unpkg.com/carbon-components-svelte/css/white.css"
/>
</head>
</html>
```
##### `svelte:head`
```html
<svelte:head>
<link
rel="stylesheet"
href="https://unpkg.com/carbon-components-svelte/css/white.css"
/>
</svelte:head>
```
### SCSS ### SCSS
The most performant method to load styles is to import SCSS directly from carbon-components. Although it requires more set up, you can reduce the size of the bundle CSS by importing individual component styles instead of a pre-compiled CSS StyleSheet. The most performant method to load styles is to import SCSS directly from carbon-components. Although it requires more set up, you can reduce the size of the bundle CSS by importing individual component styles instead of a pre-compiled CSS StyleSheet.
@ -135,7 +105,7 @@ import "carbon-components-svelte/css/all.css";
Update the theme by setting the `theme` attribute on the `html` element. The default `theme` is `"white"`. Update the theme by setting the `theme` attribute on the `html` element. The default `theme` is `"white"`.
```html ```html
<!DOCTYPE html> <!doctype html>
<html lang="en" theme="g10"> <html lang="en" theme="g10">
<body> <body>
... ...
@ -155,7 +125,7 @@ Programmatically switch between each of the five Carbon themes by setting the "t
### Importing components ### Importing components
Import components from `carbon-components-svelte` in the `script` tag of your Svelte file. Visit the [documentation site](https://carbon-components-svelte.onrender.com) for examples. Import components from `carbon-components-svelte` in the `script` tag of your Svelte file. Visit the [documentation site](https://svelte.carbondesignsystem.com) for examples.
```html ```html
<!-- App.svelte --> <!-- App.svelte -->
@ -172,24 +142,30 @@ Import components from `carbon-components-svelte` in the `script` tag of your Sv
**Refer to [COMPONENT_INDEX.md](COMPONENT_INDEX.md) for component API documentation.** **Refer to [COMPONENT_INDEX.md](COMPONENT_INDEX.md) for component API documentation.**
## Preprocessors ## Preprocessors & Plugins
[carbon-preprocess-svelte](https://github.com/carbon-design-system/carbon-preprocess-svelte) is a collection of Svelte preprocessors for Carbon. [carbon-preprocess-svelte](https://github.com/carbon-design-system/carbon-preprocess-svelte) is a collection of Svelte preprocessors for Carbon.
```sh > [!NOTE]
# Yarn > Using `carbon-preprocess-svelte` is optional and not a prerequisite for this library. It should be installed as a development dependency.
yarn add -D carbon-preprocess-svelte
```sh
# npm # npm
npm i -D carbon-preprocess-svelte npm i -D carbon-preprocess-svelte
# pnpm # pnpm
pnpm i -D carbon-preprocess-svelte pnpm i -D carbon-preprocess-svelte
# Yarn
yarn add -D carbon-preprocess-svelte
# Bun
bun add -D carbon-preprocess-svelte
``` ```
### `optimizeImports` ### `optimizeImports`
`optimizeImports` is a script preprocessor that rewrites base imports from Carbon components/icons/pictograms packages to their source Svelte code paths. This can greatly speed up compile times during development while preserving typeahead and autocompletion hinting offered by integrated development environments (IDE) like VSCode. `optimizeImports` is a Svelte preprocessor that rewrites barrel imports from Carbon components/icons/pictograms packages to their source Svelte code paths. This can significantly speed up development and production build compile times while preserving typeahead and autocompletion offered by integrated development environments (IDE) like VS Code.
The preprocessor optimizes imports from the following packages: The preprocessor optimizes imports from the following packages:
@ -201,15 +177,19 @@ The preprocessor optimizes imports from the following packages:
```diff ```diff
- import { Button } from "carbon-components-svelte"; - import { Button } from "carbon-components-svelte";
- import { Add16 } from "carbon-icons-svelte";
- import { Airplane } from "carbon-pictograms-svelte";
+ import Button from "carbon-components-svelte/src/Button/Button.svelte"; + import Button from "carbon-components-svelte/src/Button/Button.svelte";
+ import Add16 from "carbon-icons-svelte/lib/Add16.svelte";
- import { Add } from "carbon-icons-svelte";
+ import Add from "carbon-icons-svelte/lib/Add.svelte";
- import { Airplane } from "carbon-pictograms-svelte";
+ import Airplane from "carbon-pictograms-svelte/lib/Airplane.svelte"; + import Airplane from "carbon-pictograms-svelte/lib/Airplane.svelte";
``` ```
#### Usage #### Usage
See [examples](examples) for full configurations.
```js ```js
// svelte.config.js // svelte.config.js
import { optimizeImports } from "carbon-preprocess-svelte"; import { optimizeImports } from "carbon-preprocess-svelte";
@ -219,21 +199,59 @@ export default {
}; };
``` ```
`svelte-preprocess` should be invoked before any preprocessor from `carbon-preprocess-svelte`. Any other preprocessors that transpile code in the `script` block should be invoked before `optimizeImports`.
For example, `vitePreprocess` should precede `optimizeImports`.
```diff ```diff
// svelte.config.js // svelte.config.js
+ import sveltePreprocess from "svelte-preprocess"; + import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
import { optimizeImports } from "carbon-preprocess-svelte"; import { optimizeImports } from "carbon-preprocess-svelte";
export default { export default {
preprocess: [ preprocess: [
+ sveltePreprocess(), + vitePreprocess(),
optimizeImports() optimizeImports()
], ],
}; };
``` ```
### `optimizeCss`
`optimizeCss` is a Vite plugin that removes unused Carbon styles at build time. The plugin is compatible with Rollup ([Vite](https://vitejs.dev/guide/api-plugin) extends the Rollup plugin API).
`carbon-components-svelte@0.85.0` or greater is required.
```diff
$ vite build
Optimized index-CU4gbKFa.css
- Before: 606.26 kB
+ After: 53.22 kB (-91.22%)
dist/index.html 0.34 kB │ gzip: 0.24 kB
dist/assets/index-CU4gbKFa.css 53.22 kB │ gzip: 6.91 kB
dist/assets/index-Ceijs3eO.js 53.65 kB │ gzip: 15.88 kB
```
> [!NOTE]
> This is a plugin and not a Svelte preprocessor. It should be added to the list of `vite.plugins`. For Vite set-ups, this plugin is only run when building the app. For Rollup and Webpack, you should conditionally apply the plugin to only execute when building for production.
#### Usage
See [examples](examples) for full configurations.
```js
// vite.config.js
import { sveltekit } from "@sveltejs/kit/vite";
import { optimizeCss } from "carbon-preprocess-svelte";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [sveltekit(), optimizeCss()],
});
```
## Examples ## Examples
- [examples/rollup](examples/rollup/) - [examples/rollup](examples/rollup/)
@ -257,3 +275,11 @@ Refer to the [Contributing guidelines](CONTRIBUTING.md).
[npm]: https://img.shields.io/npm/v/carbon-components-svelte.svg?color=262626&style=for-the-badge [npm]: https://img.shields.io/npm/v/carbon-components-svelte.svg?color=262626&style=for-the-badge
[npm-url]: https://npmjs.com/package/carbon-components-svelte [npm-url]: https://npmjs.com/package/carbon-components-svelte
## <picture><source height="20" width="20" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-dark.svg"><source height="20" width="20" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"><img height="20" width="20" alt="IBM Telemetry" src="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"></picture> IBM Telemetry
This package uses IBM Telemetry to collect de-identified and anonymized metrics data in CI environments. By installing
this package as a dependency you are agreeing to telemetry collection. To opt out, see
[Opting out of IBM Telemetry data collection](https://github.com/ibm-telemetry/telemetry-js/tree/main#opting-out-of-ibm-telemetry-data-collection).
For more information on the data being collected, please see the
[IBM Telemetry documentation](https://github.com/ibm-telemetry/telemetry-js/tree/main#ibm-telemetry-collection-basics).

32
SECURITY.md Normal file
View file

@ -0,0 +1,32 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| 0.x | :white_check_mark: |
## Reporting a Vulnerability
_Please do not report security vulnerabilities through public GitHub issues._
Instead, report a vulnerability through GitHub's security advisory feature at
https://github.com/carbon-design-system/carbon-components-svelte/security/advisories/new
Please include a description of the issue, the steps you took to create the
issue, affected versions, and, if known, mitigations for the issue. Our team
aims to respond to all new vulnerability reports within 7 business days.
Additional information on reporting vulnerabilities to IBM is available at
https://www.ibm.com/trust/security-psirt
## Preferred languages
We prefer all communications to be in English.
## Comments on this policy
If you have suggestions on how this process could be improved please
[submit a pull request](https://github.com/carbon-design-system/carbon-components-svelte/compare)
or [file an issue](https://github.com/carbon-design-system/carbon-components-svelte/issues/new) to
discuss.

View file

@ -3,7 +3,7 @@ library:
id: carbon-components-svelte id: carbon-components-svelte
name: Carbon Svelte name: Carbon Svelte
description: Build user interfaces with Carbon's core components. description: Build user interfaces with Carbon's core components.
externalDocsUrl: https://carbon-components-svelte.onrender.com externalDocsUrl: https://svelte.carbondesignsystem.com
inherits: carbon-styles inherits: carbon-styles
navData: navData:
- title: Get started - title: Get started
@ -52,7 +52,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Accordion url: https://svelte.carbondesignsystem.com/components/Accordion
aspect-ratio: aspect-ratio:
status: stable status: stable
framework: svelte framework: svelte
@ -60,7 +60,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/AspectRatio url: https://svelte.carbondesignsystem.com/components/AspectRatio
breadcrumb: breadcrumb:
status: stable status: stable
externalDocsUrl: https://www.carbondesignsystem.com/components/breadcrumb/usage externalDocsUrl: https://www.carbondesignsystem.com/components/breadcrumb/usage
@ -69,7 +69,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Breadcrumb url: https://svelte.carbondesignsystem.com/components/Breadcrumb
breakpoint: breakpoint:
name: Breakpoint name: Breakpoint
status: stable status: stable
@ -81,7 +81,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Breakpoint url: https://svelte.carbondesignsystem.com/components/Breakpoint
tags: tags:
- shell - shell
button: button:
@ -92,7 +92,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Button url: https://svelte.carbondesignsystem.com/components/Button
button-set: button-set:
name: Button set name: Button set
description: Buttons in a button set are juxtaposed by default. description: Buttons in a button set are juxtaposed by default.
@ -105,7 +105,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/ButtonSet url: https://svelte.carbondesignsystem.com/components/ButtonSet
tags: tags:
- input-control - input-control
checkbox: checkbox:
@ -116,7 +116,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Checkbox url: https://svelte.carbondesignsystem.com/components/Checkbox
clickable-tile: clickable-tile:
name: Clickable tile name: Clickable tile
status: stable status: stable
@ -128,7 +128,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/ClickableTile url: https://svelte.carbondesignsystem.com/components/ClickableTile
tags: tags:
- contextual-navigation - contextual-navigation
code-snippet: code-snippet:
@ -139,7 +139,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/CodeSnippet url: https://svelte.carbondesignsystem.com/components/CodeSnippet
combo-box: combo-box:
status: stable status: stable
framework: svelte framework: svelte
@ -147,7 +147,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/ComboBox url: https://svelte.carbondesignsystem.com/components/ComboBox
composed-modal: composed-modal:
name: Composed modal name: Composed modal
status: stable status: stable
@ -159,7 +159,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/ComposedModal url: https://svelte.carbondesignsystem.com/components/ComposedModal
tags: tags:
- input-control - input-control
content-switcher: content-switcher:
@ -170,7 +170,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/ContentSwitcher url: https://svelte.carbondesignsystem.com/components/ContentSwitcher
context-menu: context-menu:
name: Context menu name: Context menu
status: stable status: stable
@ -182,7 +182,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/ContextMenu url: https://svelte.carbondesignsystem.com/components/ContextMenu
tags: tags:
- input-control - input-control
- contextual-navigation - contextual-navigation
@ -193,7 +193,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/CopyButton url: https://svelte.carbondesignsystem.com/components/CopyButton
data-table: data-table:
status: stable status: stable
framework: svelte framework: svelte
@ -202,7 +202,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/DataTable url: https://svelte.carbondesignsystem.com/components/DataTable
date-picker: date-picker:
status: stable status: stable
framework: svelte framework: svelte
@ -211,7 +211,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/DatePicker url: https://svelte.carbondesignsystem.com/components/DatePicker
definition-tooltip: definition-tooltip:
status: stable status: stable
framework: svelte framework: svelte
@ -219,7 +219,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/TooltipDefinition url: https://svelte.carbondesignsystem.com/components/TooltipDefinition
dropdown: dropdown:
status: stable status: stable
framework: svelte framework: svelte
@ -228,7 +228,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Dropdown url: https://svelte.carbondesignsystem.com/components/Dropdown
expandable-tile: expandable-tile:
name: Expandable tile name: Expandable tile
status: stable status: stable
@ -240,7 +240,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/ExpandableTile url: https://svelte.carbondesignsystem.com/components/ExpandableTile
tags: tags:
- data-display - data-display
- content-element - content-element
@ -252,7 +252,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/FileUploader url: https://svelte.carbondesignsystem.com/components/FileUploader
fluid-form: fluid-form:
name: Fluid form name: Fluid form
status: stable status: stable
@ -264,7 +264,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/FluidForm url: https://svelte.carbondesignsystem.com/components/FluidForm
tags: tags:
- form - form
form: form:
@ -275,7 +275,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Form url: https://svelte.carbondesignsystem.com/components/Form
grid: grid:
status: stable status: stable
framework: svelte framework: svelte
@ -283,7 +283,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Grid url: https://svelte.carbondesignsystem.com/components/Grid
image-loader: image-loader:
name: Image loader name: Image loader
status: stable status: stable
@ -295,7 +295,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/ImageLoader url: https://svelte.carbondesignsystem.com/components/ImageLoader
tags: tags:
- shell - shell
- media - media
@ -308,7 +308,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/InlineLoading url: https://svelte.carbondesignsystem.com/components/InlineLoading
inline-notification: inline-notification:
name: Inline notification name: Inline notification
status: stable status: stable
@ -320,7 +320,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/InlineNotification url: https://svelte.carbondesignsystem.com/components/InlineNotification
tags: tags:
- system-feedback - system-feedback
link: link:
@ -331,7 +331,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Link url: https://svelte.carbondesignsystem.com/components/Link
loading: loading:
status: stable status: stable
framework: svelte framework: svelte
@ -340,7 +340,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Loading url: https://svelte.carbondesignsystem.com/components/Loading
local-storage: local-storage:
name: Local storage name: Local storage
status: stable status: stable
@ -352,7 +352,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/LocalStorage url: https://svelte.carbondesignsystem.com/components/LocalStorage
tags: tags:
- input-control - input-control
modal: modal:
@ -363,7 +363,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Modal url: https://svelte.carbondesignsystem.com/components/Modal
multiselect: multiselect:
status: stable status: stable
framework: svelte framework: svelte
@ -372,7 +372,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/MultiSelect url: https://svelte.carbondesignsystem.com/components/MultiSelect
number-input: number-input:
status: stable status: stable
framework: svelte framework: svelte
@ -381,7 +381,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/NumberInput url: https://svelte.carbondesignsystem.com/components/NumberInput
ordered-list: ordered-list:
name: Ordered list name: Ordered list
status: stable status: stable
@ -393,7 +393,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/OrderedList url: https://svelte.carbondesignsystem.com/components/OrderedList
tags: tags:
- data-display - data-display
overflow-menu: overflow-menu:
@ -407,7 +407,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/OverflowMenu url: https://svelte.carbondesignsystem.com/components/OverflowMenu
tags: tags:
- input-control - input-control
pagination: pagination:
@ -418,7 +418,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Pagination url: https://svelte.carbondesignsystem.com/components/Pagination
pagination-nav: pagination-nav:
status: stable status: stable
framework: svelte framework: svelte
@ -426,7 +426,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/PaginationNav url: https://svelte.carbondesignsystem.com/components/PaginationNav
password-input: password-input:
name: Password input name: Password input
status: stable status: stable
@ -438,7 +438,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/PasswordInput url: https://svelte.carbondesignsystem.com/components/PasswordInput
tags: tags:
- form - form
- contextual-navigation - contextual-navigation
@ -449,7 +449,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Popover url: https://svelte.carbondesignsystem.com/components/Popover
progress-bar: progress-bar:
status: stable status: stable
framework: svelte framework: svelte
@ -458,7 +458,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/ProgressBar url: https://svelte.carbondesignsystem.com/components/ProgressBar
progress-indicator: progress-indicator:
status: stable status: stable
framework: svelte framework: svelte
@ -467,7 +467,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/ProgressIndicator url: https://svelte.carbondesignsystem.com/components/ProgressIndicator
radio-button: radio-button:
status: stable status: stable
framework: svelte framework: svelte
@ -476,7 +476,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/RadioButton url: https://svelte.carbondesignsystem.com/components/RadioButton
radio-tile: radio-tile:
name: Radio tile name: Radio tile
status: stable status: stable
@ -488,7 +488,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/RadioTile url: https://svelte.carbondesignsystem.com/components/RadioTile
tags: tags:
- input-control - input-control
recursive-list: recursive-list:
@ -502,7 +502,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/RecursiveList url: https://svelte.carbondesignsystem.com/components/RecursiveList
tags: tags:
- data-display - data-display
search: search:
@ -513,7 +513,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Search url: https://svelte.carbondesignsystem.com/components/Search
select: select:
status: stable status: stable
framework: svelte framework: svelte
@ -522,7 +522,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Select url: https://svelte.carbondesignsystem.com/components/Select
selectable-tile: selectable-tile:
name: Selectable tile name: Selectable tile
status: stable status: stable
@ -534,7 +534,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/SelectableTile url: https://svelte.carbondesignsystem.com/components/SelectableTile
tags: tags:
- input-control - input-control
skeleton-placeholder: skeleton-placeholder:
@ -548,7 +548,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/SkeletonPlaceholder url: https://svelte.carbondesignsystem.com/components/SkeletonPlaceholder
tags: tags:
- system-feedback - system-feedback
skeleton-text: skeleton-text:
@ -562,7 +562,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/SkeletonText url: https://svelte.carbondesignsystem.com/components/SkeletonText
tags: tags:
- shell - shell
slider: slider:
@ -573,7 +573,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Slider url: https://svelte.carbondesignsystem.com/components/Slider
structured-list: structured-list:
status: stable status: stable
framework: svelte framework: svelte
@ -582,7 +582,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/StructuredList url: https://svelte.carbondesignsystem.com/components/StructuredList
tabs: tabs:
status: stable status: stable
framework: svelte framework: svelte
@ -591,7 +591,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Tabs url: https://svelte.carbondesignsystem.com/components/Tabs
tag: tag:
status: stable status: stable
framework: svelte framework: svelte
@ -600,7 +600,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Tag url: https://svelte.carbondesignsystem.com/components/Tag
text-area: text-area:
status: stable status: stable
framework: svelte framework: svelte
@ -608,7 +608,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/TextArea url: https://svelte.carbondesignsystem.com/components/TextArea
text-input: text-input:
status: stable status: stable
framework: svelte framework: svelte
@ -617,7 +617,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/TextInput url: https://svelte.carbondesignsystem.com/components/TextInput
theme: theme:
status: stable status: stable
framework: svelte framework: svelte
@ -625,7 +625,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Theme url: https://svelte.carbondesignsystem.com/components/Theme
tile: tile:
status: stable status: stable
framework: svelte framework: svelte
@ -634,7 +634,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Tile url: https://svelte.carbondesignsystem.com/components/Tile
time-picker: time-picker:
status: stable status: stable
framework: svelte framework: svelte
@ -642,7 +642,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/TimePicker url: https://svelte.carbondesignsystem.com/components/TimePicker
toast-notification: toast-notification:
name: Toast notification name: Toast notification
status: stable status: stable
@ -654,7 +654,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/ToastNotification url: https://svelte.carbondesignsystem.com/components/ToastNotification
tags: tags:
- input-control - input-control
toggle: toggle:
@ -665,7 +665,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Toggle url: https://svelte.carbondesignsystem.com/components/Toggle
tooltip: tooltip:
status: stable status: stable
framework: svelte framework: svelte
@ -674,7 +674,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Tooltip url: https://svelte.carbondesignsystem.com/components/Tooltip
tooltip-icon: tooltip-icon:
name: Tootlip icon name: Tootlip icon
status: stable status: stable
@ -686,7 +686,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/TooltipIcon url: https://svelte.carbondesignsystem.com/components/TooltipIcon
tags: tags:
- content-element - content-element
tree-view: tree-view:
@ -696,7 +696,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/TreeView url: https://svelte.carbondesignsystem.com/components/TreeView
truncate: truncate:
name: Truncate name: Truncate
status: stable status: stable
@ -708,7 +708,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/Truncate url: https://svelte.carbondesignsystem.com/components/Truncate
tags: tags:
- data-display - data-display
ui-shell-header: ui-shell-header:
@ -719,7 +719,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/UIShell url: https://svelte.carbondesignsystem.com/components/UIShell
unordered-list: unordered-list:
name: Unordered list name: Unordered list
status: stable status: stable
@ -731,7 +731,7 @@ assets:
- type: storybook - type: storybook
name: Storybook name: Storybook
action: link action: link
url: https://carbon-components-svelte.onrender.com/components/UnorderedList url: https://svelte.carbondesignsystem.com/components/UnorderedList
tags: tags:
- data-display - data-display

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
docs/.gitignore vendored
View file

@ -1,3 +1,4 @@
/node_modules /node_modules
/dist /dist
/.routify /.routify
src/SEARCH_INDEX.json

View file

@ -3,8 +3,23 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
<link rel="canonical" href="https://svelte.carbondesignsystem.com/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Svelte implementation of the Carbon Design System" />
<title>Carbon Components Svelte</title> <title>Carbon Components Svelte</title>
<script>
try {
const theme = localStorage.getItem("theme");
if (["white", "g10", "g80", "g90", "g100"].includes(theme)) {
document.documentElement.setAttribute("theme", theme);
document.documentElement.style.setProperty(
"color-scheme",
["white", "g10"].includes(theme) ? "light" : "dark"
);
}
} catch (e) {}
</script>
</head> </head>
<body> <body>
<script type="module" src="/src/index.js"></script> <script type="module" src="/src/index.js"></script>

4003
docs/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,29 +1,31 @@
{ {
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "run-p dev:*", "dev": "npm run build:index-docs && run-p dev:*",
"dev:routify": "cross-env NODE_ENV=development routify run", "dev:routify": "cross-env NODE_ENV=development routify run",
"dev:svite": "vite dev", "dev:svite": "vite dev",
"build": "run-s build:*", "build": "run-s build:*",
"build:index-docs": "node scripts/index-docs.js",
"build:routify": "routify run -b", "build:routify": "routify run -b",
"build:svite": "vite build" "build:svite": "vite build"
}, },
"devDependencies": { "devDependencies": {
"@sveltech/routify": "^1.9.10", "@sveltech/routify": "^1.9.10",
"@sveltejs/vite-plugin-svelte": "^1.0.2", "@sveltejs/vite-plugin-svelte": "^3.1.2",
"carbon-components-svelte": "../", "carbon-components-svelte": "file:..",
"carbon-icons-svelte": "^11.1.0", "carbon-icons-svelte": "^13.3.0",
"clipboard-copy": "^4.0.1", "clipboard-copy": "^4.0.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"mdsvex": "^0.10.6", "mdsvex": "^0.12.3",
"minisearch": "^7.1.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^2.7.1", "prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.7.0", "prettier-plugin-svelte": "^2.10.1",
"prism-svelte": "^0.4.7", "prism-svelte": "^0.5.0",
"prismjs": "^1.28.0", "prismjs": "^1.30.0",
"remark-slug": "^6.0.0", "remark-slug": "^6.1.0",
"svelte": "^3.58.0", "svelte": "^4.2.19",
"vite": "^3.0.9" "vite": "^5.4.19"
}, },
"routify": { "routify": {
"routifyDir": ".routify", "routifyDir": ".routify",
@ -32,5 +34,6 @@
"svelte", "svelte",
"svx" "svx"
] ]
} },
"type": "module"
} }

View file

@ -0,0 +1,45 @@
// @ts-check
import fs from "node:fs";
import path from "node:path";
import githubSlugger from "github-slugger";
const { slug } = githubSlugger;
const COMPONENTS_PATH = "./src/pages/components";
const SEARCH_INDEX_PATH = "./src/SEARCH_INDEX.json";
const H2_DELMIMITER = "## ";
const files = fs.readdirSync(COMPONENTS_PATH);
/**
* @typedef {Object} Document
* @property {string} id
* @property {string} text
* @property {string} description
* @property {string} href
*/
/** @type {Document[]} */
const documents = [];
for (const file of files) {
const [component_name] = file.split(".");
const file_path = path.join(COMPONENTS_PATH, file);
const file_content = fs.readFileSync(file_path, "utf8");
file_content.split("\n").forEach((line) => {
if (line.startsWith(H2_DELMIMITER)) {
const [, h2] = line.split(H2_DELMIMITER);
const hash = slug(h2);
documents.push({
id: component_name + hash,
text: component_name,
description: h2,
href: `/components/${component_name}#${hash}`,
});
}
});
}
fs.writeFileSync(SEARCH_INDEX_PATH, JSON.stringify(documents, null, 2));

View file

@ -3,4 +3,4 @@
import { routes } from "../.routify/routes"; import { routes } from "../.routify/routes";
</script> </script>
<Router routes="{routes}" /> <Router {routes} />

File diff suppressed because it is too large Load diff

View file

@ -7,6 +7,7 @@
typedefs: [], typedefs: [],
}; };
import { onMount } from "svelte";
import { import {
OutboundLink, OutboundLink,
StructuredList, StructuredList,
@ -17,10 +18,16 @@
UnorderedList, UnorderedList,
ListItem, ListItem,
Tag, Tag,
CodeSnippet,
} from "carbon-components-svelte"; } from "carbon-components-svelte";
import InlineSnippet from "./InlineSnippet.svelte"; import InlineSnippet from "./InlineSnippet.svelte";
let AsyncPreviewTypeScript;
onMount(async () => {
AsyncPreviewTypeScript = (await import("./PreviewTypeScript.svelte"))
.default;
});
const mdn_api = "https://developer.mozilla.org/en-US/docs/Web/API/"; const mdn_api = "https://developer.mozilla.org/en-US/docs/Web/API/";
const typeMap = { const typeMap = {
string: "string", string: "string",
@ -32,16 +39,16 @@
$: source = `https://github.com/carbon-design-system/carbon-components-svelte/tree/master/${component.filePath}`; $: source = `https://github.com/carbon-design-system/carbon-components-svelte/tree/master/${component.filePath}`;
$: forwarded_events = component.events.filter( $: forwarded_events = component.events.filter(
(event) => event.type === "forwarded" (event) => event.type === "forwarded",
); );
$: dispatched_events = component.events.filter( $: dispatched_events = component.events.filter(
(event) => event.type === "dispatched" (event) => event.type === "dispatched",
); );
</script> </script>
<p style="margin-bottom: var(--cds-layout-02)"> <p style="margin-bottom: var(--cds-layout-02)">
Source code: Source code:
<OutboundLink size="lg" inline href="{source}"> <OutboundLink size="lg" inline href={source}>
{component.filePath} {component.filePath}
</OutboundLink> </OutboundLink>
</p> </p>
@ -55,17 +62,26 @@
<StructuredListRow head> <StructuredListRow head>
<StructuredListCell head>Prop name</StructuredListCell> <StructuredListCell head>Prop name</StructuredListCell>
<StructuredListCell head>Type</StructuredListCell> <StructuredListCell head>Type</StructuredListCell>
<StructuredListCell head noWrap>Default value</StructuredListCell>
<StructuredListCell head>Description</StructuredListCell> <StructuredListCell head>Description</StructuredListCell>
</StructuredListRow> </StructuredListRow>
</StructuredListHead> </StructuredListHead>
<StructuredListBody> <StructuredListBody>
{#each component.props.sort((a, b) => { {#each component.props.sort((a, b) => {
if (a.reactive > b.reactive) return -1; // Sort props so required props are listed first, then reactive props.
if (a.isRequired !== b.isRequired) {
return b.isRequired ? 1 : -1;
}
if (a.reactive !== b.reactive) {
return b.reactive ? 1 : -1;
}
return 0;
}) as prop (prop.name)} }) as prop (prop.name)}
<StructuredListRow> <StructuredListRow>
<StructuredListCell noWrap> <StructuredListCell noWrap>
<InlineSnippet code="{prop.name}" /> <InlineSnippet code={prop.name} />
{#if prop.reactive} {#if prop.reactive}
<div <div
style="white-space: nowrap; margin-top: var(--cds-spacing-03); margin-bottom: var(--cds-spacing-{prop.isRequired style="white-space: nowrap; margin-top: var(--cds-spacing-03); margin-bottom: var(--cds-spacing-{prop.isRequired
@ -95,18 +111,29 @@
{type} {type}
</OutboundLink> </OutboundLink>
{:else if type in typeMap} {:else if type in typeMap}
<code class="code-01">{typeMap[type]}</code> <div
{:else if type.startsWith("(")} style="display: inline-flex; max-width: 220px; word-break: break-word;"
<code class="code-01">{type}</code> >
<svelte:component
this={AsyncPreviewTypeScript}
type="inline"
code={typeMap[type]}
/>
</div>
{:else} {:else}
<InlineSnippet code="{type}" /> <div
style="display: inline-flex; max-width: 220px; word-break: break-word;"
>
<svelte:component
this={AsyncPreviewTypeScript}
type="inline"
code={type}
/>
</div>
{/if} {/if}
</div> </div>
{/each} {/each}
</StructuredListCell> </StructuredListCell>
<StructuredListCell
><code class="code-01">{prop.value}</code></StructuredListCell
>
<StructuredListCell> <StructuredListCell>
{#if prop.description} {#if prop.description}
{#each prop.description.split("\n") as line} {#each prop.description.split("\n") as line}
@ -117,9 +144,27 @@
.replace(/`(.*?)`/g, "<code>$1</code>")}. .replace(/`(.*?)`/g, "<code>$1</code>")}.
</div> </div>
{/each} {/each}
{:else}
<div class="description">No description available.</div>
{/if} {/if}
<div
style:margin-top="var(--cds-layout-02)"
style:margin-bottom="var(--cds-spacing-03)"
>
<strong>Default value</strong>
</div>
<div
style:margin-bottom="var(--cds-layout-01)"
style:max-width="85%"
>
{#if prop.value === undefined}
<em>undefined</em>
{:else}
<svelte:component
this={AsyncPreviewTypeScript}
type={/\n/.test(prop.value) ? "multi" : "inline"}
code={prop.value}
/>
{/if}
</div>
</StructuredListCell> </StructuredListCell>
</StructuredListRow> </StructuredListRow>
{/each} {/each}
@ -133,23 +178,42 @@
<h2 id="typedefs">Typedefs</h2> <h2 id="typedefs">Typedefs</h2>
{#if component.typedefs.length > 0} {#if component.typedefs.length > 0}
<CodeSnippet <div class="my-layout-01-03">
style="margin-top: var(--cds-spacing-08)" <svelte:component
class="my-layout-01-03" this={AsyncPreviewTypeScript}
type="multi" code={component.typedefs.map((t) => t.ts).join("\n")}
code="{component.typedefs.map((t) => t.ts).join(';\n\n')};"
/> />
</div>
{:else} {:else}
<p class="my-layout-01-03">No typedefs.</p> <p class="my-layout-01-03">No typedefs.</p>
{/if} {/if}
<h2 id="slots">Slots</h2> <h2 id="slots">Slots</h2>
{#if component.slots.length > 0} {#if component.slots.length > 0}
<UnorderedList class="my-layout-01-03"> <StructuredList class="my-layout-01-03">
<StructuredListHead>
<StructuredListRow>
<StructuredListCell>Slot name</StructuredListCell>
<StructuredListCell>Slot detail</StructuredListCell>
</StructuredListRow>
</StructuredListHead>
<StructuredListBody>
{#each component.slots as slot (slot.name)} {#each component.slots as slot (slot.name)}
<ListItem>{slot.default ? "default" : slot.name}</ListItem> <StructuredListRow>
<StructuredListCell>
<strong>{slot.default ? "default" : slot.name}</strong>
</StructuredListCell>
<StructuredListCell>
<svelte:component
this={AsyncPreviewTypeScript}
type={/\n/.test(slot.slot_props) ? "multi" : "inline"}
code={slot.slot_props}
/>
</StructuredListCell>
</StructuredListRow>
{/each} {/each}
</UnorderedList> </StructuredListBody>
</StructuredList>
{:else} {:else}
<p class="my-layout-01-03">No slots.</p> <p class="my-layout-01-03">No slots.</p>
{/if} {/if}
@ -173,7 +237,7 @@
<StructuredListHead> <StructuredListHead>
<StructuredListRow> <StructuredListRow>
<StructuredListCell>Event name</StructuredListCell> <StructuredListCell>Event name</StructuredListCell>
<StructuredListCell><code>event.detail</code> type</StructuredListCell> <StructuredListCell>Event detail</StructuredListCell>
{#if hasDescription} {#if hasDescription}
<StructuredListCell>Description</StructuredListCell> <StructuredListCell>Description</StructuredListCell>
{/if} {/if}
@ -186,7 +250,11 @@
<strong>on:{event.name}</strong> <strong>on:{event.name}</strong>
</StructuredListCell> </StructuredListCell>
<StructuredListCell> <StructuredListCell>
<code>{event.detail}</code> <svelte:component
this={AsyncPreviewTypeScript}
type={/\n/.test(event.detail) ? "multi" : "inline"}
code={event.detail}
/>
</StructuredListCell> </StructuredListCell>
<StructuredListCell> <StructuredListCell>
{event.description ?? ""} {event.description ?? ""}
@ -217,6 +285,7 @@
<style> <style>
.description { .description {
margin-bottom: var(--cds-spacing-04); margin-bottom: var(--cds-spacing-04);
width: 80%;
} }
.cell { .cell {
@ -244,7 +313,11 @@
word-break: break-word; word-break: break-word;
} }
:global(.cell .bx--snippet--inline code, .bx--snippet--single pre) { :global(
.cell .bx--snippet--inline code,
.cell .bx--snippet--single pre,
.bx--snippet--inline code
) {
white-space: pre-wrap !important; white-space: pre-wrap !important;
} }
</style> </style>

View file

@ -6,7 +6,7 @@
</script> </script>
<div> <div>
<CodeSnippet code="{code}" type="inline" copy="{(text) => copy(text)}" /> <CodeSnippet {code} type="inline" copy={(text) => copy(text)} />
</div> </div>
<style> <style>

View file

@ -26,8 +26,8 @@
kind="ghost" kind="ghost"
target="_blank" target="_blank"
size="field" size="field"
href="{themedSrcUrl}" href={themedSrcUrl}
icon="{Launch}" icon={Launch}
> >
Open in new tab Open in new tab
</Button> </Button>
@ -35,13 +35,14 @@
{/if} {/if}
<div class="preview-viewer" class:framed> <div class="preview-viewer" class:framed>
{#if framed} {#if framed}
<iframe title="{src.split('/').pop()}" src="{themedSrcUrl}"></iframe> <iframe loading="lazy" title={src.split("/").pop()} src={themedSrcUrl}
></iframe>
{:else} {:else}
<slot /> <slot />
{/if} {/if}
</div> </div>
<div class="code-override"> <div class="code-override">
<CodeSnippet type="multi" code="{codeRaw}" copy="{(text) => copy(text)}"> <CodeSnippet type="multi" code={codeRaw} copy={(text) => copy(text)}>
{@html code} {@html code}
</CodeSnippet> </CodeSnippet>
</div> </div>
@ -52,7 +53,7 @@
margin-bottom: var(--cds-layout-04); margin-bottom: var(--cds-layout-04);
margin-left: -1rem; margin-left: -1rem;
margin-right: -1rem; margin-right: -1rem;
max-width: 66rem; max-width: 80rem;
} }
.code-override { .code-override {
@ -74,6 +75,12 @@
min-height: 20rem; min-height: 20rem;
} }
@media (min-width: 1920px) {
.preview-viewer.framed {
min-height: 32rem;
}
}
.framed-header { .framed-header {
display: flex; display: flex;
align-items: center; align-items: center;

View file

@ -0,0 +1,29 @@
<script>
export let code = "";
export let type = "multi";
import { CodeSnippet } from "carbon-components-svelte";
import { highlight } from "prismjs";
import "prismjs/components/prism-typescript";
import copy from "clipboard-copy";
$: highlightedCode = highlight(
code,
Prism.languages.typescript,
"typescript",
);
</script>
{#if type === "multi"}
<div class="code-override">
<CodeSnippet type="multi" {code} {copy}>
{@html highlightedCode}
</CodeSnippet>
</div>
{/if}
{#if type === "inline"}
<CodeSnippet type="inline" class="code-override-inline" {code} {copy}>
{@html highlightedCode}
</CodeSnippet>
{/if}

View file

@ -15,8 +15,8 @@
<div class="card-wrapper" class:borderRight class:borderBottom> <div class="card-wrapper" class:borderRight class:borderBottom>
<AspectRatio> <AspectRatio>
<svelte:component <svelte:component
this="{tileComponent}" this={tileComponent}
href="{href}" {href}
{...$$restProps} {...$$restProps}
style="height: 100%;" style="height: 100%;"
> >
@ -29,11 +29,11 @@
</div> </div>
<div class="card-footer"> <div class="card-footer">
<svelte:component <svelte:component
this="{LogoGithub}" this={LogoGithub}
size="{32}" size={32}
style="fill: var(--cds-icon-01)" style="fill: var(--cds-icon-01)"
/> />
<Launch size="{20}" style="fill: var(--cds-icon-01)" /> <Launch size={20} style="fill: var(--cds-icon-01)" />
</div> </div>
</div> </div>
</svelte:component> </svelte:component>

View file

@ -2,10 +2,19 @@ html[theme="g90"] .code-override {
border: 1px solid var(--cds-ui-03); border: 1px solid var(--cds-ui-03);
} }
.prose > pre,
.code-override .bx--snippet { .code-override .bx--snippet {
/** Docs code snippet is always dark mode */
color-scheme: dark;
max-width: none; max-width: none;
} }
.prose > pre {
padding: 1rem;
margin-bottom: 1rem;
}
.prose > pre,
.code-override .bx--copy-btn, .code-override .bx--copy-btn,
.code-override .bx--snippet, .code-override .bx--snippet,
.code-override button.bx--btn.bx--snippet-btn--expand { .code-override button.bx--btn.bx--snippet-btn--expand {
@ -22,6 +31,7 @@ html[theme="g90"] .code-override {
fill: #f4f4f4; fill: #f4f4f4;
} }
.prose > pre,
.code-override .bx--snippet-container pre { .code-override .bx--snippet-container pre {
font-size: var(--cds-code-02-font-size); font-size: var(--cds-code-02-font-size);
line-height: var(--cds-code-02-line-height); line-height: var(--cds-code-02-line-height);
@ -43,6 +53,18 @@ html[theme="g90"] .code-override {
color: #6ea6ff; color: #6ea6ff;
} }
/* Override syntax highlighting for light theme inline code .*/
[theme="white"] .code-override-inline .token,
[theme="g10"] .code-override-inline .token {
color: var(--cds-text-01, #161616);
}
/** Gray 80 is the "lighted" dark theme. Ensure the background is dark. */
[theme="g80"] .code-override-inline {
background-color: #262626;
}
.token.builtin,
.token.attr-name { .token.attr-name {
color: #3ddbd9; /* teal 30 */ color: #3ddbd9; /* teal 30 */
} }

View file

@ -29,15 +29,16 @@
// TODO: `find` is not supported in IE // TODO: `find` is not supported in IE
$: api_components = components.map((i) => $: api_components = components.map((i) =>
COMPONENT_API.components.find((_) => _.moduleName === i) COMPONENT_API.components.find((_) => _.moduleName === i),
); );
$: multiple = api_components.length > 1; $: multiple = api_components.length > 1;
onMount(() => { onMount(() => {
const currentTheme = window.location.search.split("?theme=")[1]; const searchParams = new URLSearchParams(window.location.search);
const current_theme = searchParams.get("theme");
if (["white", "g10", "g80", "g90", "g100"].includes(currentTheme)) { if (["white", "g10", "g80", "g90", "g100"].includes(current_theme)) {
theme.set(currentTheme); theme.set(current_theme);
} }
}); });
@ -61,10 +62,17 @@
// TODO: [refactor] read from package.json value // TODO: [refactor] read from package.json value
$: sourceCode = `https://github.com/carbon-design-system/carbon-components-svelte/tree/master/${formatSourceURL( $: sourceCode = `https://github.com/carbon-design-system/carbon-components-svelte/tree/master/${formatSourceURL(
multiple multiple,
)}`; )}`;
</script> </script>
<svelte:head>
<link
rel="canonical"
href="https://svelte.carbondesignsystem.com/components/{component}"
/>
</svelte:head>
<Content data-components> <Content data-components>
<Grid class="fix-overflow"> <Grid class="fix-overflow">
<Row> <Row>
@ -75,7 +83,7 @@
id="select-theme" id="select-theme"
inline inline
labelText="Theme" labelText="Theme"
bind:selected="{$theme}" bind:selected={$theme}
> >
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
@ -87,8 +95,8 @@
kind="ghost" kind="ghost"
target="_blank" target="_blank"
size="field" size="field"
href="{sourceCode}" href={sourceCode}
icon="{Code}" icon={Code}
> >
Source code Source code
</Button> </Button>
@ -136,28 +144,28 @@
</Row> </Row>
<Row> <Row>
<Column class="prose" noGutter="{multiple}"> <Column class="prose" noGutter={multiple}>
{#if multiple} {#if multiple}
<Tabs class="override-tabs"> <Tabs class="override-tabs">
{#each api_components as component (component.moduleName)} {#each api_components as component (component.moduleName)}
<Tab label="{component.moduleName}" /> <Tab label={component.moduleName} />
{/each} {/each}
<div slot="content" style="padding-top: var(--cds-spacing-06)"> <div slot="content" style="padding-top: var(--cds-spacing-06)">
{#each api_components as component (component.moduleName)} {#each api_components as component (component.moduleName)}
<TabContent> <TabContent>
<ComponentApi component="{component}" /> <ComponentApi {component} />
</TabContent> </TabContent>
{/each} {/each}
</div> </div>
</Tabs> </Tabs>
{:else} {:else}
<ComponentApi component="{api_components[0]}" /> <ComponentApi component={api_components[0]} />
{/if} {/if}
</Column> </Column>
</Row> </Row>
</Grid> </Grid>
<Column class="table" xlg="{4}" lg="{5}"> <Column class="table" xlg={4} lg={5}>
<div class="toc"> <div class="toc">
<h5>Examples</h5> <h5>Examples</h5>
<slot name="aside" /> <slot name="aside" />

View file

@ -12,7 +12,7 @@
<h1>404</h1> <h1>404</h1>
<div> <div>
Page not found. Page not found.
<Link href="{$url('/')}">Return home</Link> <Link href={$url("/")}>Return home</Link>
</div> </div>
</Column> </Column>
</Row> </Row>

View file

@ -1,5 +1,11 @@
<script> <script>
import { isActive, url, layout, beforeUrlChange } from "@sveltech/routify"; import {
isActive,
url,
layout,
beforeUrlChange,
goto,
} from "@sveltech/routify";
import { import {
Header, Header,
HeaderUtilities, HeaderUtilities,
@ -8,6 +14,7 @@
HeaderPanelLinks, HeaderPanelLinks,
HeaderPanelLink, HeaderPanelLink,
HeaderPanelDivider, HeaderPanelDivider,
HeaderSearch,
SkipToContent, SkipToContent,
SideNav, SideNav,
SideNavItems, SideNavItems,
@ -15,19 +22,37 @@
Theme, Theme,
Tag, Tag,
} from "carbon-components-svelte"; } from "carbon-components-svelte";
import MiniSearch from "minisearch";
import LogoGithub from "carbon-icons-svelte/lib/LogoGithub.svelte"; import LogoGithub from "carbon-icons-svelte/lib/LogoGithub.svelte";
import { theme } from "../store"; import { theme } from "../store";
import SEARCH_INDEX from "../SEARCH_INDEX.json";
const miniSearch = new MiniSearch({
fields: ["text", "description"],
storeFields: ["text", "description", "href"],
searchOptions: {
prefix: true,
boost: { description: 2 },
fuzzy: 0.1,
},
});
miniSearch.addAll(SEARCH_INDEX);
const deprecated = []; const deprecated = [];
const new_components = []; const new_components = [];
let value = "";
let active = false;
$: results = miniSearch.search(value).slice(0, 10);
let isOpen = false; let isOpen = false;
let isSideNavOpen = true; let isSideNavOpen = true;
let innerWidth = 2048; let innerWidth = 2048;
$: isMobile = innerWidth < 1056; $: isMobile = innerWidth < 1056;
$: components = $layout.children.filter( $: components = $layout.children.filter(
(child) => child.title === "components" (child) => child.title === "components",
)[0]; )[0];
$beforeUrlChange(() => { $beforeUrlChange(() => {
@ -39,30 +64,106 @@
<!-- routify:options bundle=true --> <!-- routify:options bundle=true -->
<svelte:window bind:innerWidth /> <svelte:window bind:innerWidth />
<Theme persist bind:theme="{$theme}"> <svelte:body
on:keydown={(e) => {
if (active) return;
if (
document.activeElement instanceof HTMLInputElement ||
document.activeElement instanceof HTMLTextAreaElement
) {
// Exit early if an inputtable element is already focused.
return;
}
const isCommandOrControl = e.metaKey || e.ctrlKey;
const isCmdK = isCommandOrControl && e.key.toLowerCase() === "k";
const isSlash = e.key === "/";
if (isCmdK || isSlash) {
e.preventDefault();
active = true;
}
}}
/>
<svelte:head>
<!-- Tealium/GA Set up -->
<script type="text/javascript">
window._ibmAnalytics = {
settings: {
name: "CarbonSvelte",
isSpa: true,
tealiumProfileName: "ibm-web-app",
},
onLoad: [["ibmStats.pageview", []]],
};
digitalData = {
page: {
pageInfo: {
ibm: {
siteId: "IBM_" + _ibmAnalytics.settings.name,
},
},
category: {
primaryCategory: "PC100",
},
},
};
</script>
<script
type="module"
defer
src="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/footer.min.js"
></script>
<script
src="//1.www.s81c.com/common/stats/ibm-common.js"
type="text/javascript"
defer
></script>
</svelte:head>
<Theme
persist
bind:theme={$theme}
on:update={(e) => {
const theme = e.detail.theme;
document.documentElement.style.setProperty(
"color-scheme",
["white", "g10"].includes(theme) ? "light" : "dark",
);
}}
>
<Header <Header
aria-label="Navigation" aria-label="Navigation"
href="{$url('/')}" href={$url("/")}
expandedByDefault="{true}" expandedByDefault={true}
bind:isSideNavOpen bind:isSideNavOpen
> >
<svelte:fragment slot="skip-to-content"> <svelte:fragment slot="skip-to-content">
<SkipToContent /> <SkipToContent />
</svelte:fragment> </svelte:fragment>
<span slot="platform" class="platform-name"> <span slot="platform" class="platform-name" class:hidden={active}>
Carbon Components Svelte &nbsp;<code class="code-01" Carbon Components Svelte &nbsp;<code class="code-01"
>v{process.env.VERSION || ""}</code >v{process.env.VERSION || ""}</code
> >
</span> </span>
<HeaderUtilities> <HeaderUtilities>
<HeaderSearch
bind:value
bind:active
placeholder="Search"
{results}
on:select={(e) => {
$goto(e.detail.selectedResult.href);
}}
/>
<HeaderActionLink <HeaderActionLink
icon="{LogoGithub}" icon={LogoGithub}
href="https://github.com/carbon-design-system/carbon-components-svelte" href="https://github.com/carbon-design-system/carbon-components-svelte"
target="_blank" target="_blank"
/> />
<HeaderAction transition="{false}" bind:isOpen> <HeaderAction transition={false} bind:isOpen>
<HeaderPanelLinks> <HeaderPanelLinks>
<HeaderPanelDivider>Carbon Svelte portfolio</HeaderPanelDivider> <HeaderPanelDivider>Carbon Svelte portfolio</HeaderPanelDivider>
<HeaderPanelLink <HeaderPanelLink
@ -97,13 +198,13 @@
</HeaderUtilities> </HeaderUtilities>
</Header> </Header>
<SideNav bind:isOpen="{isSideNavOpen}"> <SideNav bind:isOpen={isSideNavOpen}>
<SideNavItems> <SideNavItems>
{#each components.children.filter((child) => !deprecated.includes(child.title)) as child (child.path)} {#each components.children.filter((child) => !deprecated.includes(child.title)) as child (child.path)}
<SideNavMenuItem <SideNavMenuItem
text="{child.title}" text={child.title}
href="{$url(child.path)}" href={$url(child.path)}
isSelected="{$isActive($url(child.path))}" isSelected={$isActive($url(child.path))}
> >
{child.title} {child.title}
{#if deprecated.includes(child.title)} {#if deprecated.includes(child.title)}
@ -132,6 +233,13 @@
</Theme> </Theme>
<style> <style>
/** Hide logo to make space for search bar on narrower screens. */
@media (max-width: 1056px) {
.platform-name.hidden {
display: none;
}
}
.platform-name { .platform-name {
display: flex; display: flex;
align-items: baseline; align-items: baseline;

View file

@ -10,8 +10,15 @@ components: ["Accordion", "AccordionItem", "AccordionSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Accordion` creates a vertically stacked list of expandable sections that show or hide content. It supports custom titles, different sizes, and various states including disabled and skeleton loading.
## Default ## Default
Use the `Accordion` and `AccordionItem` components to compose a collapsible list of
items.
By default, the chevron icon is on the right side of the accordion item.
<Accordion> <Accordion>
<AccordionItem title="Natural Language Classifier"> <AccordionItem title="Natural Language Classifier">
<p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text. <p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text.
@ -27,6 +34,10 @@ components: ["Accordion", "AccordionItem", "AccordionSkeleton"]
## Left-aligned chevron ## Left-aligned chevron
The chevron icon can be aligned to the left side of the accordion item by setting
the `align` prop to "start". This provides an alternative visual style while
maintaining the same functionality.
<Accordion align="start"> <Accordion align="start">
<AccordionItem title="Natural Language Classifier"> <AccordionItem title="Natural Language Classifier">
<p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text. <p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text.
@ -42,6 +53,9 @@ components: ["Accordion", "AccordionItem", "AccordionSkeleton"]
## Custom title slot ## Custom title slot
Customize the title content by using the `title` slot instead of the `title` prop.
This allows for more complex title layouts with multiple elements.
<Accordion> <Accordion>
<AccordionItem> <AccordionItem>
<svelte:fragment slot="title"> <svelte:fragment slot="title">
@ -69,6 +83,9 @@ components: ["Accordion", "AccordionItem", "AccordionSkeleton"]
## First item open ## First item open
Set the `open` prop on an `AccordionItem` to have it expanded by default when the
accordion is first rendered.
<Accordion> <Accordion>
<AccordionItem open title="Natural Language Classifier"> <AccordionItem open title="Natural Language Classifier">
<p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text. <p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text.
@ -84,12 +101,18 @@ components: ["Accordion", "AccordionItem", "AccordionSkeleton"]
## Programmatic example ## Programmatic example
This example demonstrates how a list of items can be programmatically expanded and collapsed. This example demonstrates how to programmatically control the accordion items using
the `bind:open` directive. Expand and collapse items based on user
interactions or application state.
<FileSource src="/framed/Accordion/ExpandableAccordion" /> <FileSource src="/framed/Accordion/ExpandableAccordion" />
## Extra-large size ## Extra-large size
The accordion can be displayed in an extra-large size by setting the `size` prop to
"xl". This provides more visual emphasis and is suitable for prominent content
sections.
<Accordion size="xl"> <Accordion size="xl">
<AccordionItem title="Natural Language Classifier"> <AccordionItem title="Natural Language Classifier">
<p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text. <p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text.
@ -105,6 +128,10 @@ This example demonstrates how a list of items can be programmatically expanded a
## Small size ## Small size
For more compact layouts, set the `size` prop to "sm" to display the accordion in a
smaller size. This is useful when space is limited or when the accordion is used as
a secondary UI element.
<Accordion size="sm"> <Accordion size="sm">
<AccordionItem title="Natural Language Classifier"> <AccordionItem title="Natural Language Classifier">
<p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text. <p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text.
@ -120,6 +147,9 @@ This example demonstrates how a list of items can be programmatically expanded a
## Disabled ## Disabled
Set the `disabled` prop on the `Accordion` component to disable all items at once.
This prevents users from expanding or collapsing any items in the accordion.
<Accordion disabled> <Accordion disabled>
<AccordionItem title="Natural Language Classifier"> <AccordionItem title="Natural Language Classifier">
<p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text. <p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text.
@ -135,6 +165,10 @@ This example demonstrates how a list of items can be programmatically expanded a
## Disabled (item) ## Disabled (item)
Individual accordion items can be disabled by setting the `disabled` prop on
specific `AccordionItem` components. This allows for more granular control over
which items are interactive.
<Accordion> <Accordion>
<AccordionItem disabled title="Natural Language Classifier"> <AccordionItem disabled title="Natural Language Classifier">
<p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text. <p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text.
@ -150,25 +184,45 @@ This example demonstrates how a list of items can be programmatically expanded a
## Skeleton ## Skeleton
The skeleton state provides a loading placeholder for the accordion. It displays a
simplified version of the component while content is being loaded.
<Accordion skeleton /> <Accordion skeleton />
## Skeleton (left-aligned chevron) ## Skeleton (left-aligned chevron)
The skeleton state can be combined with the left-aligned chevron style by setting
both the `skeleton` and `align="start"` props.
<Accordion skeleton align="start" /> <Accordion skeleton align="start" />
## Skeleton (custom count) ## Skeleton (custom count)
By default, the skeleton state displays 4 items.
Specify the number of skeleton items to display using the `count` prop. This is
useful when you know the exact number of items that will be loaded.
<Accordion skeleton count={3} /> <Accordion skeleton count={3} />
## Skeleton (closed) ## Skeleton (closed)
By default, the first skeleton item is open. The skeleton state can be displayed
in a collapsed state by setting `open={false}`.
<Accordion skeleton open={false} /> <Accordion skeleton open={false} />
## Skeleton (extra-large) ## Skeleton (extra-large)
The skeleton state supports the extra-large size variant, maintaining visual
consistency with the active component states.
<Accordion skeleton size="xl" /> <Accordion skeleton size="xl" />
## Skeleton (small) ## Skeleton (small)
The skeleton state also supports the small size variant, providing a compact
loading placeholder for space-constrained layouts.
<Accordion skeleton size="sm" /> <Accordion skeleton size="sm" />

View file

@ -3,11 +3,13 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
The `AspectRatio` component is useful for constraining fluid content within an aspect ratio. To demo this, resize your browser for the examples below. The `AspectRatio` component maintains consistent proportions for content across different screen sizes. It's particularly useful for images, videos, and other media that need to preserve their aspect ratio when resizing.
Supported aspect ratios include `"2x1"`, `"2x3"`, `"16x9"`, `"4x3"`, `"1x1"`, `"3x4"`, `"3x2"`, `"9x16"` and `"1x2"`. Supported aspect ratios include `"2x1"`, `"2x3"`, `"16x9"`, `"4x3"`, `"1x1"`, `"3x4"`, `"3x2"`, `"9x16"` and `"1x2"`.
## Default (2x1) ## Default
Display a 2:1 aspect ratio container by default.
<AspectRatio> <AspectRatio>
2x1 2x1

View file

@ -12,8 +12,12 @@ components: ["Breadcrumb", "BreadcrumbItem"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Breadcrumb` displays a hierarchical navigation trail that shows users their current location within an application. It supports current page indication, trailing slash customization, and overflow handling for long navigation paths.
## Default ## Default
Display a hierarchical navigation trail with slashes between items. Mark the current page with `isCurrentPage`.
<Breadcrumb> <Breadcrumb>
<BreadcrumbItem href="/">Dashboard</BreadcrumbItem> <BreadcrumbItem href="/">Dashboard</BreadcrumbItem>
<BreadcrumbItem href="/reports">Annual reports</BreadcrumbItem> <BreadcrumbItem href="/reports">Annual reports</BreadcrumbItem>
@ -22,6 +26,8 @@ components: ["Breadcrumb", "BreadcrumbItem"]
## No trailing slash ## No trailing slash
Remove the trailing slash from the last breadcrumb item using `noTrailingSlash`.
<Breadcrumb noTrailingSlash> <Breadcrumb noTrailingSlash>
<BreadcrumbItem href="/">Home</BreadcrumbItem> <BreadcrumbItem href="/">Home</BreadcrumbItem>
<BreadcrumbItem href="/profile" isCurrentPage>Profile</BreadcrumbItem> <BreadcrumbItem href="/profile" isCurrentPage>Profile</BreadcrumbItem>
@ -29,6 +35,8 @@ components: ["Breadcrumb", "BreadcrumbItem"]
## Overflow menu ## Overflow menu
Add an `OverflowMenu` to handle long breadcrumb trails. Use `OverflowMenuItem` components for menu options.
<Breadcrumb> <Breadcrumb>
<BreadcrumbItem href="/">Home</BreadcrumbItem> <BreadcrumbItem href="/">Home</BreadcrumbItem>
<BreadcrumbItem href="/api">API documentation</BreadcrumbItem> <BreadcrumbItem href="/api">API documentation</BreadcrumbItem>
@ -47,4 +55,6 @@ components: ["Breadcrumb", "BreadcrumbItem"]
## Skeleton ## Skeleton
Display a loading state with `skeleton` prop. Use `count` to specify the number of items.
<Breadcrumb noTrailingSlash skeleton count={3} /> <Breadcrumb noTrailingSlash skeleton count={3} />

View file

@ -1,12 +1,12 @@
<script> <script>
import { import {
Breakpoint, UnorderedList, ListItem UnorderedList, ListItem
} from "carbon-components-svelte"; } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
The [Carbon Design System grid implementation](https://carbondesignsystem.com/guidelines/2x-grid/implementation#responsive-options) defines five responsive breakpoints: The Carbon Design System [grid implementation](https://carbondesignsystem.com/guidelines/2x-grid/implementation#responsive-options) defines five responsive breakpoints:
<UnorderedList svx-ignore style="margin-bottom: var(--cds-spacing-08)"> <UnorderedList svx-ignore style="margin-bottom: var(--cds-spacing-08)">
<ListItem><strong>Small</strong>: less than 672px</ListItem> <ListItem><strong>Small</strong>: less than 672px</ListItem>
@ -28,8 +28,8 @@ The `"on:change"` event will fire when the size is initially determined and when
## Store and Breakpoint Values ## Store and Breakpoint Values
As an alternative to the component, `breakpointObserver` can be used to get the current size as a Svelte store. The store has two additional functions which create derived stores that return a `boolean` indicating whether the size is smaller/larger than a certain breakpoint. Use `breakpointObserver` as an alternative to the component to get the current size as a Svelte store. The store provides two additional functions that create derived stores returning a `boolean` indicating whether the size is smaller/larger than a certain breakpoint.
There also exists a `breakpoints` dictionary mapping from `BreakpointSize` to `BreakpointValue`. Access the `breakpoints` dictionary to map from `BreakpointSize` to `BreakpointValue`.
<FileSource src="/framed/Breakpoint/BreakpointObserver" /> <FileSource src="/framed/Breakpoint/BreakpointObserver" />

View file

@ -4,39 +4,51 @@
import TrashCan from "carbon-icons-svelte/lib/TrashCan.svelte"; import TrashCan from "carbon-icons-svelte/lib/TrashCan.svelte";
import Login from "carbon-icons-svelte/lib/Login.svelte"; import Login from "carbon-icons-svelte/lib/Login.svelte";
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
let index = 1;
</script> </script>
Buttons trigger actions in the interface. Use them to submit forms, navigate between pages, or perform specific tasks. Choose from different styles and sizes to match the importance and context of each action.
## Primary button ## Primary button
The default button style is primary. This should be used for primary actions.
<Button>Primary button</Button> <Button>Primary button</Button>
## Secondary button ## Secondary button
Set `kind="secondary"` for secondary actions.
<Button kind="secondary">Secondary button</Button> <Button kind="secondary">Secondary button</Button>
## Tertiary button ## Tertiary button
Set `kind="tertiary"` for tertiary actions.
<Button kind="tertiary">Tertiary button</Button> <Button kind="tertiary">Tertiary button</Button>
## Ghost button ## Ghost button
Set `kind="ghost"` for ghost-style buttons.
<Button kind="ghost">Ghost button</Button> <Button kind="ghost">Ghost button</Button>
## Danger button ## Danger button
Set `kind="danger"` for destructive actions.
<Button kind="danger">Danger button</Button> <Button kind="danger">Danger button</Button>
## Danger tertiary button ## Danger tertiary button
Set `kind="danger-tertiary"` for less prominent destructive actions.
<Button kind="danger-tertiary">Danger tertiary button</Button> <Button kind="danger-tertiary">Danger tertiary button</Button>
## Danger tertiary, icon-only button ## Danger tertiary, icon-only button
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01"> <div class="body-short-01">
You must provide an <strong>iconDescription</strong> for the button tooltip. Provide an <strong>iconDescription</strong> for accessibility. This text will be used as the button's tooltip and screen reader label.
</div> </div>
</InlineNotification> </InlineNotification>
@ -44,17 +56,21 @@
## Danger ghost button ## Danger ghost button
Set `kind="danger-ghost"` for ghost-style destructive actions.
<Button kind="danger-ghost">Danger ghost button</Button> <Button kind="danger-ghost">Danger ghost button</Button>
## Button with icon ## Button with icon
Add an icon to the button using the `icon` prop.
<Button icon={Add}>With icon</Button> <Button icon={Add}>With icon</Button>
## Icon-only button ## Icon-only button
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01"> <div class="body-short-01">
You must provide an <strong>iconDescription</strong> for the button tooltip. Provide an <strong>iconDescription</strong> for accessibility. This text will be used as the button's tooltip and screen reader label.
</div> </div>
</InlineNotification> </InlineNotification>
@ -62,11 +78,13 @@
## Icon-only, link button ## Icon-only, link button
Set `href` to create an icon-only link button.
<Button iconDescription="Login" icon={Login} href="#" /> <Button iconDescription="Login" icon={Login} href="#" />
## Icon-only button (custom tooltip position) ## Icon-only button (custom tooltip position)
The tooltip position and alignment can be controlled by `tooltipPosition` and `tooltipAlignment`. Control the tooltip position and alignment with `tooltipPosition` and `tooltipAlignment`.
<Button tooltipPosition="right" tooltipAlignment="end" iconDescription="Tooltip text" icon={Add} /> <Button tooltipPosition="right" tooltipAlignment="end" iconDescription="Tooltip text" icon={Add} />
@ -78,18 +96,32 @@ Set `isSelected` to `true` to enable the selected state for an icon-only, ghost
## Link button ## Link button
If an `href` value is specified, the component will render an [anchor element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) instead of a `button` element. Set `href` to render an [anchor element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) instead of a `button` element.
<Button href="#">Link button</Button> <Button href="#">Link button</Button>
## Link button with icon
Similarly, link buttons can have icons.
<Button href="#" icon={Add}>Link button with icon</Button>
## Custom element ## Custom element
By default, the `Button` will render either a `button` or `a` element.
To render a different element, set `as` to `true` and spread `let:props` to the element.
<Button as let:props> <Button as let:props>
<p {...props}>Custom element</p> <p {...props}>Custom element</p>
</Button> </Button>
## Field size ## Field size
The default size is "default".
Set `size="field"` for field-sized buttons.
<Button size="field">Primary</Button> <Button size="field">Primary</Button>
<Button size="field" kind="secondary">Secondary</Button> <Button size="field" kind="secondary">Secondary</Button>
<Button size="field" kind="tertiary">Tertiary</Button> <Button size="field" kind="tertiary">Tertiary</Button>
@ -98,6 +130,8 @@ If an `href` value is specified, the component will render an [anchor element](h
## Small size ## Small size
Set `size="small"` for small buttons.
<Button size="small">Primary</Button> <Button size="small">Primary</Button>
<Button size="small" kind="secondary">Secondary</Button> <Button size="small" kind="secondary">Secondary</Button>
<Button size="small" kind="tertiary">Tertiary</Button> <Button size="small" kind="tertiary">Tertiary</Button>
@ -106,6 +140,8 @@ If an `href` value is specified, the component will render an [anchor element](h
## Large size ## Large size
Set `size="lg"` for large buttons.
<Button size="lg">Primary</Button> <Button size="lg">Primary</Button>
<Button size="lg" kind="secondary">Secondary</Button> <Button size="lg" kind="secondary">Secondary</Button>
<Button size="lg" kind="tertiary">Tertiary</Button> <Button size="lg" kind="tertiary">Tertiary</Button>
@ -114,6 +150,8 @@ If an `href` value is specified, the component will render an [anchor element](h
## Extra-large size ## Extra-large size
Set `size="xl"` for extra-large buttons.
<Button size="xl">Primary</Button> <Button size="xl">Primary</Button>
<Button size="xl" kind="secondary">Secondary</Button> <Button size="xl" kind="secondary">Secondary</Button>
<Button size="xl" kind="tertiary">Tertiary</Button> <Button size="xl" kind="tertiary">Tertiary</Button>
@ -122,6 +160,8 @@ If an `href` value is specified, the component will render an [anchor element](h
## Disabled state ## Disabled state
Set `disabled` to disable the button.
<Button disabled>Disabled button</Button> <Button disabled>Disabled button</Button>
<Button disabled iconDescription="Tooltip text" icon={Add} /> <Button disabled iconDescription="Tooltip text" icon={Add} />
@ -131,7 +171,7 @@ Set `expressive` to `true` to use Carbon's expressive typesetting.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01"> <div class="body-short-01">
Expressive styles only work with the default, "lg", and "xl" button sizes. Use expressive styles with default, "lg", or "xl" button sizes.
</div> </div>
</InlineNotification> </InlineNotification>
@ -155,8 +195,16 @@ Set `expressive` to `true` to use Carbon's expressive typesetting.
## Skeleton ## Skeleton
Set `skeleton` to show a loading state.
<Button size="xl" skeleton /> <Button size="xl" skeleton />
<Button size="lg" skeleton /> <Button size="lg" skeleton />
<Button skeleton /> <Button skeleton />
<Button skeleton size="field" /> <Button skeleton size="field" />
<Button skeleton size="small" /> <Button skeleton size="small" />
## Programmatic focus
Bind to the `ref` prop to access the button element for programmatic focus.
<FileSource src="/framed/Button/ProgrammaticFocus" />

View file

@ -4,9 +4,11 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
Group related buttons together in a set. Use this component to create consistent spacing and alignment between multiple buttons.
## Default ## Default
Buttons in a button set are juxtaposed by default. Place buttons side by side in a horizontal layout.
<ButtonSet> <ButtonSet>
<Button kind="secondary">Cancel</Button> <Button kind="secondary">Cancel</Button>
@ -15,7 +17,7 @@ Buttons in a button set are juxtaposed by default.
## Stacked ## Stacked
Set `stacked` to `true` to use the stacked variant. Set `stacked` to `true` to arrange buttons vertically.
<ButtonSet stacked> <ButtonSet stacked>
<Button icon={Login}>Log in</Button> <Button icon={Login}>Log in</Button>

View file

@ -3,39 +3,53 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
## Default (unchecked) Checkboxes let users select one or more options from a list. Use them for multiple-choice questions, settings, or to confirm actions.
## Default
Create a checkbox with a label using `labelText`.
By default, the checkbox is unchecked.
<Checkbox labelText="Label text" /> <Checkbox labelText="Label text" />
## Checked ## Checked
Set `checked` to `true` to pre-select the checkbox.
<Checkbox labelText="Label text" checked /> <Checkbox labelText="Label text" checked />
## Indeterminate ## Indeterminate
Set `indeterminate` to `true` to show a mixed state, typically used in parent checkboxes with some children selected.
<Checkbox labelText="Label text" indeterminate /> <Checkbox labelText="Label text" indeterminate />
## Hidden label ## Hidden label
Set `hideLabel` to `true` to visually hide the label while keeping it accessible to screen readers.
<Checkbox labelText="Label text" hideLabel /> <Checkbox labelText="Label text" hideLabel />
## Disabled ## Disabled state
Set `disabled` to `true` to prevent user interaction.
<Checkbox labelText="Label text" disabled /> <Checkbox labelText="Label text" disabled />
## Reactive example (bind:checked) ## Reactive example (bind:checked)
The `checked` prop supports two-way binding. Use two-way binding with `bind:checked` to track the checkbox state.
<FileSource src="/framed/Checkbox/CheckboxReactive" /> <FileSource src="/framed/Checkbox/CheckboxReactive" />
## Reactive example (bind:group) ## Reactive example (bind:group)
An alternative to `checked` is binding an array of values using `group`. This API in inspired by Svelte [group inputs](https://svelte.dev/tutorial/group-inputs). Bind an array of values using `group` to manage multiple checkboxes. This API is inspired by Svelte [group inputs](https://svelte.dev/tutorial/group-inputs).
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01"> <div class="body-short-01">
If using <strong>bind:group</strong>, <strong>bind:checked</strong> will only support one-way binding. When using <strong>bind:group</strong>, <strong>bind:checked</strong> only supports one-way binding.
</div> </div>
</InlineNotification> </InlineNotification>
@ -43,4 +57,6 @@ An alternative to `checked` is binding an array of values using `group`. This AP
## Skeleton ## Skeleton
Set `skeleton` to `true` to show a loading state.
<Checkbox skeleton /> <Checkbox skeleton />

View file

@ -3,15 +3,19 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
Clickable tiles create interactive content areas that link to other pages or trigger actions. Use them to group related content and provide clear navigation targets.
## Default ## Default
Create a clickable tile with an `href` to link to another page.
<ClickableTile href="https://www.carbondesignsystem.com/"> <ClickableTile href="https://www.carbondesignsystem.com/">
Carbon Design System Carbon Design System
</ClickableTile> </ClickableTile>
## Prevent default behavior ## Prevent default behavior
Use the forwarded `click` event and invoke `e.preventDefault()` to prevent the native link behavior. Handle the `click` event to override the default link behavior. Use `e.preventDefault()` to stop navigation.
<ClickableTile <ClickableTile
href="/" href="/"
@ -25,12 +29,16 @@ Use the forwarded `click` event and invoke `e.preventDefault()` to prevent the n
## Light variant ## Light variant
Set `light` to `true` to use the light color scheme.
<ClickableTile light href="https://www.carbondesignsystem.com/"> <ClickableTile light href="https://www.carbondesignsystem.com/">
Carbon Design System Carbon Design System
</ClickableTile> </ClickableTile>
## Disabled state ## Disabled state
Set `disabled` to `true` to prevent interaction.
<ClickableTile disabled href="https://www.carbondesignsystem.com/"> <ClickableTile disabled href="https://www.carbondesignsystem.com/">
Carbon Design System Carbon Design System
</ClickableTile> </ClickableTile>

View file

@ -27,20 +27,21 @@ let comment = `
` `
</script> </script>
This component uses the native, asynchronous [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText) to copy text. Code snippets display and copy code examples. They support single-line, multi-line, and inline formats with customizable copy and expand functionality.
Please note that the `clipboard.writeText` API is not supported in [IE 11 nor Safari iOS version 13.3 or lower](https://caniuse.com/mdn-api_clipboard_writetext). This component uses the native, asynchronous [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText) to copy text.
You can override the default copy functionality with your own implementation. See [Overriding copy functionality](#overriding-copy-functionality). You can override the default copy functionality with your own implementation. See [Overriding copy functionality](#overriding-copy-functionality).
## Default
## Default (single-line) Display a single-line code snippet by default.
<CodeSnippet code="yarn add -D carbon-components-svelte" /> <CodeSnippet code="npm i carbon-components-svelte" />
## Overriding copy functionality ## Overriding copy functionality
To override the default copy behavior, pass a custom function to the `copy` prop. Pass a custom function to the `copy` prop to override the default copy behavior.
In this example, we use the open source module [clipboard-copy](https://github.com/feross/clipboard-copy) to copy the text instead of the default Clipboard API. In this example, we use the open source module [clipboard-copy](https://github.com/feross/clipboard-copy) to copy the text instead of the default Clipboard API.
@ -48,33 +49,37 @@ In this example, we use the open source module [clipboard-copy](https://github.c
## Preventing copy functionality ## Preventing copy functionality
To prevent text from being copied entirely, pass a no-op function to the `copy` prop. Pass a no-op function to the `copy` prop to disable copying.
<CodeSnippet code="yarn add -D carbon-components-svelte" copy={() => {}} /> <CodeSnippet code="npm i carbon-components-svelte" copy={() => {}} />
## Inline ## Inline
Set `type="inline"` to display code inline with text.
<CodeSnippet type="inline" code="rm -rf node_modules/" /> <CodeSnippet type="inline" code="rm -rf node_modules/" />
## Multi-line ## Multi-line
Set `type="multi"` to display multiple lines of code with expand/collapse functionality.
<CodeSnippet type="multi" {code} /> <CodeSnippet type="multi" {code} />
## Expanded by default ## Expanded by default
Use the `expanded` prop to control whether the multi-line code snippet is expanded or not. Set `expanded` to `true` to show the full multi-line code snippet.
<CodeSnippet type="multi" {code} expanded /> <CodeSnippet type="multi" {code} expanded />
## Reactive example ## Reactive example
The multi-line code snippet also dispatches "expand" and "collapse" events. The multi-line code snippet dispatches "expand" and "collapse" events.
<FileSource src="/framed/CodeSnippet/CodeSnippetReactive" /> <FileSource src="/framed/CodeSnippet/CodeSnippetReactive" />
## Custom copy feedback text ## Custom copy feedback text
Use the `feedback` prop to override the default copy button feedback text. Set `feedback` to customize the copy button feedback text.
<CodeSnippet type="multi" {code} feedback="Copied to clipboard" /> <CodeSnippet type="multi" {code} feedback="Copied to clipboard" />
@ -84,40 +89,62 @@ Set `hideCopyButton` to `true` to hide the copy button.
<CodeSnippet type="multi" {code} hideCopyButton /> <CodeSnippet type="multi" {code} hideCopyButton />
## Hidden show more button
Set `showMoreLess` to `false` to hide the expand/collapse button on multi-line snippets.
<CodeSnippet type="multi" {code} showMoreLess={false} />
## Hidden copy, show more buttons
Hide both the copy and expand/collapse buttons.
<CodeSnippet type="multi" {code} hideCopyButton showMoreLess={false} />
## Custom show more/less text
Set `showMoreText` and `showLessText` to customize the expand/collapse button text.
<CodeSnippet type="multi" {code} showMoreText="Expand" showLessText="Collapse" />
## Disabled ## Disabled
The `disabled` prop applies only to the `"single"` and `"multi"` code snippet types. Set `disabled` to `true` to disable interaction. This only applies to `"single"` and `"multi"` types.
<CodeSnippet disabled code="yarn add -D carbon-components-svelte" /> <CodeSnippet disabled code="npm i carbon-components-svelte" />
<br /> <br />
<CodeSnippet disabled type="multi" code="{comment}" /> <CodeSnippet disabled type="multi" code="{comment}" />
## Wrapped text ## Wrapped text
`wrapText` only applies to the `"multi"` type. By default, the code snippet preserves text formatting and does not wrap text.
Set `wrapText` to `true` to wrap long lines in multi-line snippets.
<CodeSnippet wrapText type="multi" code="{comment}" /> <CodeSnippet wrapText type="multi" code="{comment}" />
## Dynamic multi-line code ## Dynamic multi-line code
For dynamically updated code, you must use the `code` prop instead of the default slot. Use the `code` prop instead of the default slot for dynamically updated code.
<FileSource src="/framed/CodeSnippet/DynamicCodeSnippet" /> <FileSource src="/framed/CodeSnippet/DynamicCodeSnippet" />
## Hidden multi-line code ## Hidden multi-line code
There may be cases where your code snippet is hidden in the DOM. The logic to render the "Show more" button relies on the element's computed height. For hidden content, the button will not appear because the computed height is `0`. The "Show more" button relies on the element's computed height. For hidden content, the button won't appear because the height is `0`.
The recommended workaround is to re-render the component. See the example below. Re-render the component to fix this issue.
<FileSource src="/framed/CodeSnippet/HiddenCodeSnippet" /> <FileSource src="/framed/CodeSnippet/HiddenCodeSnippet" />
## Skeleton ## Skeleton
The default skeleton type is `"single"`. Set `skeleton` to `true` to show a loading state. Defaults to `"single"` type.
<CodeSnippet skeleton /> <CodeSnippet skeleton />
## Skeleton (multi-line) ## Skeleton (multi-line)
Set `type="multi"` with `skeleton` to show a multi-line loading state.
<CodeSnippet type="multi" skeleton /> <CodeSnippet type="multi" skeleton />

View file

@ -3,6 +3,8 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`ComboBox` combines a text input with a dropdown menu to let users select from predefined options or enter custom values. It supports filtering, custom item rendering, and various states.
`ComboBox` is keyed for performance reasons. `ComboBox` is keyed for performance reasons.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
@ -11,6 +13,8 @@
## Default ## Default
Create a combobox with a title and placeholder text. Each item requires a unique `id` and `text`.
<ComboBox titleText="Contact" placeholder="Select contact method" <ComboBox titleText="Contact" placeholder="Select contact method"
items={[ items={[
{id: "0", text: "Slack"}, {id: "0", text: "Slack"},
@ -20,12 +24,25 @@ items={[
## Custom slot ## Custom slot
Override the default slot to customize the display of each item. Access the item and index through the `let:` directive. Override the default slot to customize how each item displays. Access the item and index through the `let:` directive.
<FileSource src="/framed/ComboBox/ComboBoxSlot" /> <FileSource src="/framed/ComboBox/ComboBoxSlot" />
## Hidden label
Set `hideLabel` to `true` to visually hide the label while keeping it accessible to screen readers.
<ComboBox hideLabel titleText="Hidden Label" placeholder="Select contact method"
items={[
{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}
]} />
## Initial selected id ## Initial selected id
Set `selectedId` to pre-select an item when the combobox loads.
<ComboBox titleText="Contact" placeholder="Select contact method" <ComboBox titleText="Contact" placeholder="Select contact method"
selectedId="1" selectedId="1"
items={[ items={[
@ -36,33 +53,39 @@ items={[
## Reactive example ## Reactive example
See how the combobox responds to user input and selection changes.
<FileSource src="/framed/ComboBox/ReactiveComboBox" /> <FileSource src="/framed/ComboBox/ReactiveComboBox" />
## Clear selection ## Clear selection
To programmatically clear the selection, access the component instance using the [bind:this](https://svelte.dev/docs#bind_element) directive and invoke the `ComboBox.clear()` accessor. Use `bind:this` to access the component instance and call `ComboBox.clear()` to programmatically clear the selection.
Specify `focus: false` in the method options to avoid re-focusing the input. Set `focus: false` in the method options to prevent re-focusing the input.
<FileSource src="/framed/ComboBox/ComboBoxClear" /> <FileSource src="/framed/ComboBox/ComboBoxClear" />
## Multiple combo boxes ## Multiple combo boxes
See how to manage multiple comboboxes in a form.
<FileSource src="/framed/ComboBox/MultipleComboBox" /> <FileSource src="/framed/ComboBox/MultipleComboBox" />
## Filterable ## Filterable
Enable filtering to let users search through the options.
<FileSource src="/framed/ComboBox/FilterableComboBox" /> <FileSource src="/framed/ComboBox/FilterableComboBox" />
## Filterable with custom label ## Filterable with custom label
Combine a custom label `itemToString` with the filterable option (e.g., internationalization). Set `itemToString` to customize how items display in the filterable combobox.
<FileSource src="/framed/ComboBox/FilterableComboBoxCustomLabel" /> <FileSource src="/framed/ComboBox/FilterableComboBoxCustomLabel" />
## Top direction ## Top direction
Set `direction` to `"top"` for the combobox dropdown menu to appear above the input. Set `direction` to `"top"` to make the dropdown menu appear above the input.
<ComboBox direction="top" titleText="Contact" placeholder="Select contact method" <ComboBox direction="top" titleText="Contact" placeholder="Select contact method"
items={[ items={[
@ -73,6 +96,8 @@ items={[
## Light variant ## Light variant
Set `light` to `true` to use the light color scheme.
<ComboBox light titleText="Contact" placeholder="Select contact method" <ComboBox light titleText="Contact" placeholder="Select contact method"
items={[ items={[
{id: "0", text: "Slack"}, {id: "0", text: "Slack"},
@ -82,6 +107,8 @@ items={[
## Extra-large size ## Extra-large size
Set `size` to `"xl"` for an extra-large combobox.
<ComboBox titleText="Contact" placeholder="Select contact method" <ComboBox titleText="Contact" placeholder="Select contact method"
size="xl" size="xl"
items={[ items={[
@ -92,6 +119,8 @@ items={[
## Small size ## Small size
Set `size` to `"sm"` for a small combobox.
<ComboBox titleText="Contact" placeholder="Select contact method" <ComboBox titleText="Contact" placeholder="Select contact method"
size="sm" size="sm"
items={[ items={[
@ -102,6 +131,8 @@ items={[
## Invalid state ## Invalid state
Set `invalid` to `true` and provide `invalidText` to show an error message.
<ComboBox invalid invalidText="Secondary contact method must be different from the primary contact" titleText="Contact" placeholder="Select contact method" <ComboBox invalid invalidText="Secondary contact method must be different from the primary contact" titleText="Contact" placeholder="Select contact method"
items={[ items={[
{id: "0", text: "Slack"}, {id: "0", text: "Slack"},
@ -111,6 +142,8 @@ items={[
## Warning state ## Warning state
Set `warn` to `true` and provide `warnText` to show a warning message.
<ComboBox warn warnText="This contact method is not associated with your account" titleText="Contact" placeholder="Select contact method" <ComboBox warn warnText="This contact method is not associated with your account" titleText="Contact" placeholder="Select contact method"
items={[ items={[
{id: "0", text: "Slack"}, {id: "0", text: "Slack"},
@ -120,6 +153,8 @@ items={[
## Disabled state ## Disabled state
Set `disabled` to `true` to prevent interaction with the combobox.
<ComboBox disabled titleText="Contact" placeholder="Select contact method" <ComboBox disabled titleText="Contact" placeholder="Select contact method"
items={[ items={[
{id: "0", text: "Slack"}, {id: "0", text: "Slack"},
@ -129,7 +164,7 @@ items={[
## Disabled items ## Disabled items
Use the `disabled` property in the `items` prop to disable specific items. Set `disabled: true` in an item object to disable specific options.
<ComboBox <ComboBox
titleText="Contact" titleText="Contact"

View file

@ -6,12 +6,16 @@ components: ["ComposedModal", "ModalHeader", "ModalBody", "ModalFooter"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`ComposedModal` lets you build custom modals by combining `ModalHeader`, `ModalBody`, and `ModalFooter` components. Use it to create focused interactions that require user attention or input.
## Composed modal ## Composed modal
Create a modal with a header, body, and footer. Each section can be customized independently.
<FileSource src="/framed/Modal/ComposedModal" /> <FileSource src="/framed/Modal/ComposedModal" />
## Multiple secondary buttons ## Multiple secondary buttons
Use the `secondaryButtons` prop in `ModalFooter` to render two secondary buttons for a "3-button modal". The prop is a 2-tuple type that supersedes `secondaryButtonText`. Set `secondaryButtons` in `ModalFooter` to create a 3-button modal. This prop replaces `secondaryButtonText` and takes a tuple of two button configurations.
<FileSource src="/framed/Modal/3ButtonComposedModal" /> <FileSource src="/framed/Modal/3ButtonComposedModal" />

View file

@ -9,8 +9,12 @@ components: ["ContentSwitcher", "Switch"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`ContentSwitcher` lets users switch between different views or sections of content. Use it to organize related content into distinct categories or states.
## Default ## Default
Create a content switcher with `Switch` components. Each switch needs a `text` prop.
<ContentSwitcher> <ContentSwitcher>
<Switch text="Latest news" /> <Switch text="Latest news" />
<Switch text="Trending" /> <Switch text="Trending" />
@ -18,6 +22,8 @@ components: ["ContentSwitcher", "Switch"]
## Initial selected index ## Initial selected index
Set `selectedIndex` to pre-select a switch when the content switcher loads.
<ContentSwitcher selectedIndex={1}> <ContentSwitcher selectedIndex={1}>
<Switch text="Latest news" /> <Switch text="Latest news" />
<Switch text="Trending" /> <Switch text="Trending" />
@ -26,10 +32,16 @@ components: ["ContentSwitcher", "Switch"]
## Reactive example ## Reactive example
This example demonstrates how to programmatically control the content switcher using
the `bind:selectedIndex` directive. Update the selected index based on user
interactions or application state.
<FileSource src="/framed/ContentSwitcher/ContentSwitcherReactive" /> <FileSource src="/framed/ContentSwitcher/ContentSwitcherReactive" />
## Custom switch slot ## Custom switch slot
Override the default slot in `Switch` to customize how each option displays.
<ContentSwitcher> <ContentSwitcher>
<Switch> <Switch>
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center;">
@ -45,6 +57,8 @@ components: ["ContentSwitcher", "Switch"]
## Extra-large size ## Extra-large size
Set `size` to `"xl"` for an extra-large content switcher.
<ContentSwitcher size="xl"> <ContentSwitcher size="xl">
<Switch text="All" /> <Switch text="All" />
<Switch text="Archived" /> <Switch text="Archived" />
@ -52,6 +66,8 @@ components: ["ContentSwitcher", "Switch"]
## Small size ## Small size
Set `size` to `"sm"` for a small content switcher.
<ContentSwitcher size="sm"> <ContentSwitcher size="sm">
<Switch text="All" /> <Switch text="All" />
<Switch text="Archived" /> <Switch text="Archived" />
@ -59,6 +75,8 @@ components: ["ContentSwitcher", "Switch"]
## Disabled ## Disabled
Set `disabled` to `true` on individual switches to prevent interaction.
<ContentSwitcher> <ContentSwitcher>
<Switch disabled text="All" /> <Switch disabled text="All" />
<Switch disabled text="Archived" /> <Switch disabled text="Archived" />

View file

@ -6,26 +6,32 @@ components: ["ContextMenu", "ContextMenuGroup", "ContextMenuRadioGroup", "Contex
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`ContextMenu` displays a menu when users right-click. Use it to provide quick access to contextual actions or options.
In the examples, right click anywhere within the iframe. In the examples, right click anywhere within the iframe.
## Default ## Default
By default, the context menu will trigger when right clicking anywhere in the `window`. The context menu appears when right-clicking anywhere in the window. Use `ContextMenuOption` for menu items and `ContextMenuDivider` for visual separation.
<FileSource src="/framed/ContextMenu/ContextMenu" /> <FileSource src="/framed/ContextMenu/ContextMenu" />
## Custom target ## Custom target
Specify a custom `HTMLElement` using the `target` prop. By default, the context menu will trigger when right clicking anywhere in the `window`.
Set `target` to specify which element triggers the context menu.
<FileSource src="/framed/ContextMenu/ContextMenuTarget" /> <FileSource src="/framed/ContextMenu/ContextMenuTarget" />
## Multiple targets ## Multiple targets
The `target` prop also accepts an array of elements. Set `target` to an array of elements to trigger the context menu from multiple sources.
<FileSource src="/framed/ContextMenu/ContextMenuTargets" /> <FileSource src="/framed/ContextMenu/ContextMenuTargets" />
## Radio groups ## Radio groups
Use `ContextMenuGroup` and `ContextMenuRadioGroup` to organize related options and create radio button selections.
<FileSource src="/framed/ContextMenu/ContextMenuGroups" /> <FileSource src="/framed/ContextMenu/ContextMenuGroups" />

View file

@ -3,30 +3,32 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
This component uses the native, asynchronous [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText) to copy text. `CopyButton` lets users copy text to their clipboard with a single click. Use it to provide quick access to code snippets, links, or other text content.
Please note that the `clipboard.writeText` API is not supported in [IE 11 nor Safari iOS version 13.3 or lower](https://caniuse.com/mdn-api_clipboard_writetext). This component uses the native [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText) to copy text. Override the default copy functionality with your own implementation. See [Overriding copy functionality](#overriding-copy-functionality).
You can override the default copy functionality with your own implementation. See [Overriding copy functionality](#overriding-copy-functionality).
## Default ## Default
Create a copy button with the `text` prop to specify what to copy.
<CopyButton text="Carbon svelte" /> <CopyButton text="Carbon svelte" />
## Custom feedback text ## Custom feedback text
Set `feedback` to customize the message shown after copying.
<CopyButton text="Carbon svelte" feedback="Copied to clipboard" /> <CopyButton text="Carbon svelte" feedback="Copied to clipboard" />
## Overriding copy functionality ## Overriding copy functionality
To override the default copy behavior, pass a custom function to the `copy` prop. Pass a custom function to the `copy` prop to override the default copy behavior.
In this example, we use the open source module [clipboard-copy](https://github.com/feross/clipboard-copy) to copy the text instead of the default Clipboard API. This example uses the NPM package [clipboard-copy](https://github.com/feross/clipboard-copy) to copy the text instead of the default Clipboard API.
<FileSource src="/framed/CopyButton/CopyButtonOverride" /> <FileSource src="/framed/CopyButton/CopyButtonOverride" />
## Preventing copy functionality ## Preventing copy functionality
To prevent text from being copied entirely, pass a no-op function to the `copy` prop. Pass a no-op function to the `copy` prop to disable copying.
<CopyButton text="This text should not be copied" copy={() => {}} /> <CopyButton text="This text should not be copied" copy={() => {}} />

View file

@ -8,21 +8,20 @@ components: ["DataTable", "Pagination","Toolbar", "ToolbarContent", "ToolbarSear
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`DataTable` is keyed for performance reasons. `DataTable` displays structured data in a tabular format. Use it to present large datasets with features like sorting, filtering, pagination, and row selection.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">Every <code>headers</code> object must have a unique "key" property.</div> <div class="body-short-01">
</InlineNotification> This component is keyed for performance.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> Every <strong>headers</strong> object must have a unique "key" property.
<div class="body-short-01">Every <code>rows</code> object must have a unique "id" property.</div> <div class="body-short-01">Every <strong>rows</strong> object must have a unique "id" property.</div>
</div>
</InlineNotification> </InlineNotification>
## Default ## Default
The key value in `headers` corresponds to the key value defined in `rows`. Create a basic table by providing `headers` and `rows` data. Match the `key` in headers with the corresponding property in rows.
For example, the header key `"name"` will use the value of `rows[index].name`.
<DataTable <DataTable
headers="{[ headers="{[
@ -79,9 +78,7 @@ For example, the header key `"name"` will use the value of `rows[index].name`.
## Slotted cells ## Slotted cells
Use the `"cell"` slot to control the display value per table cell. Individual row and cell data are provided through the `let:row` and `let:cell` directives. Use the `"cell"` slot to customize cell content. Access row and cell data through `let:row` and `let:cell` directives. Use `"cell-header"` slot for header cells.
The slot name for the table header cells is `"cell-header"`.
<DataTable <DataTable
headers="{[ headers="{[
@ -153,6 +150,8 @@ The slot name for the table header cells is `"cell-header"`.
## With title, description ## With title, description
Add a title and description to provide context for the table data.
<DataTable title="Load balancers" description="Your organization's active load balancers." <DataTable title="Load balancers" description="Your organization's active load balancers."
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -208,7 +207,7 @@ The slot name for the table header cells is `"cell-header"`.
## Slottable title, description ## Slottable title, description
The `title` and `description` props are slottable. Use slots to customize the title and description content.
<DataTable <DataTable
headers="{[ headers="{[
@ -270,7 +269,7 @@ The `title` and `description` props are slottable.
## Static width ## Static width
Set `useStaticWidth` to `true` to render the table with a width of "auto" instead of "100%". Set `useStaticWidth` to `true` to render the table with an auto width instead of 100%.
<DataTable useStaticWidth <DataTable useStaticWidth
title="Load balancers" description="Your organization's active load balancers." title="Load balancers" description="Your organization's active load balancers."
@ -328,9 +327,7 @@ title="Load balancers" description="Your organization's active load balancers."
## Custom column widths ## Custom column widths
Specify a `width` or `minWidth` property in the `headers` object to customize the width of each column. Specify `width` or `minWidth` in the `headers` object to set column dimensions. This applies a fixed table layout.
A [table-layout: fixed](https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout#values) rule will be applied to the `table` element when using custom widths.
<InlineNotification svx-ignore lowContrast kind="warning" title="Note:" hideCloseButton> <InlineNotification svx-ignore lowContrast kind="warning" title="Note:" hideCloseButton>
<div class="body-short-01">Custom column widths do not work with a <a class="bx--link" href="#sticky-header">sticky header</a>.</div> <div class="body-short-01">Custom column widths do not work with a <a class="bx--link" href="#sticky-header">sticky header</a>.</div>
@ -340,9 +337,7 @@ A [table-layout: fixed](https://developer.mozilla.org/en-US/docs/Web/CSS/table-l
## Sticky header ## Sticky header
Set `stickyHeader` to `true` for the header to be fixed in place. Set `stickyHeader` to `true` to fix the header in place. This adds a maximum height to force scrolling.
A maximum height will applied to the datatable to force a scrollbar.
<DataTable <DataTable
stickyHeader stickyHeader
@ -363,6 +358,8 @@ A maximum height will applied to the datatable to force a scrollbar.
## With toolbar ## With toolbar
Add a toolbar with search, menu, and actions above the table.
<DataTable title="Load balancers" description="Your organization's active load balancers." <DataTable title="Load balancers" description="Your organization's active load balancers."
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -432,6 +429,8 @@ A maximum height will applied to the datatable to force a scrollbar.
## With toolbar (small size) ## With toolbar (small size)
Use `size="short"` to create a more compact table with a small toolbar.
<DataTable size="short" title="Load balancers" description="Your organization's active load balancers." <DataTable size="short" title="Load balancers" description="Your organization's active load balancers."
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -499,24 +498,22 @@ A maximum height will applied to the datatable to force a scrollbar.
## Filterable ## Filterable
By default, `ToolbarSearch` will not filter `DataTable` rows. Set `shouldFilterRows` to `true` to enable client-side filtering. The default filter performs string comparisons on cell values.
Set `shouldFilterRows` to `true` to enable client-side filtering. The default filtering performs a basic string comparison on cell values that are of a string or a number type. For pagination with filtering, bind to `filteredRowIds` and pass its length to `Pagination`'s `totalItems`.
To use filtering with pagination, bind to the `filteredRowIds` prop and pass its length to `totalItems` in `Pagination`.
Note that in-memory filtering is not optimal for large data sets, where you might consider using server-side search.
<FileSource src="/framed/DataTable/DataTableFilterable" /> <FileSource src="/framed/DataTable/DataTableFilterable" />
## Filterable (custom) ## Filterable (custom)
`shouldFilterRows` also accepts a function and passes it the current row and search value. It expects the function to return a boolean. Pass a function to `shouldFilterRows` to implement custom filtering logic.
<FileSource src="/framed/DataTable/DataTableFilterCustom" /> <FileSource src="/framed/DataTable/DataTableFilterCustom" />
## Zebra stripes ## Zebra stripes
Set `zebra` to `true` to add alternating row colors.
<DataTable zebra <DataTable zebra
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -572,6 +569,8 @@ Note that in-memory filtering is not optimal for large data sets, where you migh
## Tall rows ## Tall rows
Set `size="tall"` for increased row height.
<DataTable size="tall" <DataTable size="tall"
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -627,6 +626,8 @@ Note that in-memory filtering is not optimal for large data sets, where you migh
## Medium rows ## Medium rows
Set `size="medium"` for standard row height.
<DataTable size="medium" <DataTable size="medium"
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -682,6 +683,8 @@ Note that in-memory filtering is not optimal for large data sets, where you migh
## Short rows ## Short rows
Set `size="short"` for compact row height.
<DataTable size="short" <DataTable size="short"
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -737,6 +740,8 @@ Note that in-memory filtering is not optimal for large data sets, where you migh
## Compact rows ## Compact rows
Set `size="compact"` for minimal row height.
<DataTable size="compact" <DataTable size="compact"
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -792,11 +797,7 @@ Note that in-memory filtering is not optimal for large data sets, where you migh
## Sortable ## Sortable
Set `sortable` to `true` to enable table column sorting. Set `sortable` to `true` to enable column sorting. Disable sorting on specific columns by setting `sort: false` in the header object.
To disable sorting on a specific column, set `sort` to `false` in the header object passed to the `headers` prop.
In the example below, the "Protocol" column is not sortable.
<DataTable sortable <DataTable sortable
headers="{[ headers="{[
@ -853,12 +854,14 @@ In the example below, the "Protocol" column is not sortable.
## Sortable with pagination ## Sortable with pagination
For pagination, bind to the `pageSize` and `page` props of `Pagination` and pass their values to `DataTable`. Bind to `pageSize` and `page` props of `Pagination` and pass them to `DataTable`.
<FileSource src="/framed/DataTable/DataTablePagination" /> <FileSource src="/framed/DataTable/DataTablePagination" />
## Sortable with custom display and sort methods ## Sortable with custom display and sort methods
Use `display` and `sort` functions in header objects to customize cell rendering and sorting.
<DataTable sortable title="Load balancers" description="Your organization's active load balancers." <DataTable sortable title="Load balancers" description="Your organization's active load balancers."
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -926,6 +929,8 @@ For pagination, bind to the `pageSize` and `page` props of `Pagination` and pass
## Sortable with nested object values ## Sortable with nested object values
Access nested object properties using dot notation in the header key.
<DataTable sortable title="Load balancers" description="Your organization's active load balancers." <DataTable sortable title="Load balancers" description="Your organization's active load balancers."
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -1005,71 +1010,61 @@ For pagination, bind to the `pageSize` and `page` props of `Pagination` and pass
## Programmatic sorting ## Programmatic sorting
Use the reactive `sortKey` and `sortDirection` props for programmatic sorting. Use `sortKey` and `sortDirection` props to control sorting programmatically. Set `sortKey` to a valid header key and `sortDirection` to "none", "ascending", or "descending".
By default, the table is not sorted by a specific key. The `sortKey` value must be a valid `key` specified in the `headers` object.
Possible values for `sortDirection` include `"none"` or `"ascending"` or `"descending"`.
Setting `sortKey` to `null` and `sortDirection` to `"none"` should reset the table rows to their initial order.
<FileSource src="/framed/DataTable/DataTableProgrammaticSorting" /> <FileSource src="/framed/DataTable/DataTableProgrammaticSorting" />
## Empty column with overflow menu ## Empty column with overflow menu
Some use cases require an empty column in the table body without a corresponding table header. Set `empty: true` in a header object to create an empty column. Use this for overflow menus without a header.
For an object in the `headers` array, set `empty` to `true` to render an empty column.
In the following example, each row in the sortable data table has an overflow menu. There isn't a separate, useless table header column for the overflow menu.
<FileSource src="/framed/DataTable/DataTableAppendColumns" /> <FileSource src="/framed/DataTable/DataTableAppendColumns" />
## Selectable rows (checkbox) ## Selectable rows (checkbox)
Set `selectable` to `true` for rows to be multi-selectable. Set `selectable` to `true` for multi-select functionality. Bind to `selectedRowIds` to track selections. Use `inputName` to customize checkbox names.
<FileSource src="/framed/DataTable/SelectableDataTable" /> <FileSource src="/framed/DataTable/SelectableDataTable" />
## Batch selection ## Batch selection
Set `batchSelection` to `true` to add a checkbox for selecting all rows. The checkbox shows an indeterminate state when some rows are selected.
<FileSource src="/framed/DataTable/DataTableBatchSelection" /> <FileSource src="/framed/DataTable/DataTableBatchSelection" />
## Batch selection with initial selected rows ## Batch selection with initial selected rows
Use the `selectedRowIds` prop to specify which rows should be selected. Use `selectedRowIds` to specify initially selected rows.
<FileSource src="/framed/DataTable/DataTableBatchSelectionInitial" /> <FileSource src="/framed/DataTable/DataTableBatchSelectionInitial" />
## Batch selection with batch actions toolbar ## Batch selection with batch actions toolbar
Add a toolbar for batch actions when rows are selected.
<FileSource src="/framed/DataTable/DataTableBatchSelectionToolbar" /> <FileSource src="/framed/DataTable/DataTableBatchSelectionToolbar" />
## Batch selection with controlled toolbar ## Batch selection with controlled toolbar
By default, `ToolbarBatchActions` is activated if one or more rows is selected. Clicking "Cancel" will deactivate it. Control the batch actions toolbar with the `active` prop. Prevent default cancel behavior in the `on:cancel` event.
Use the `active` prop to control the toolbar. Note that it will still activate if one or more rows are selected.
You can also prevent the default "Cancel" behavior in the dispatched `on:cancel` event.
<FileSource src="/framed/DataTable/DataTableBatchSelectionToolbarControlled" /> <FileSource src="/framed/DataTable/DataTableBatchSelectionToolbarControlled" />
## Selectable rows (radio) ## Selectable rows (radio)
Set `radio` to `true` for only one row to be selected at a time. Set `radio` to `true` for single-row selection. Bind to `selectedRowIds` to track the selected row. Use `inputName` to customize radio button names.
<FileSource src="/framed/DataTable/RadioSelectableDataTable" /> <FileSource src="/framed/DataTable/RadioSelectableDataTable" />
## Non-selectable rows ## Non-selectable rows
Use `nonSelectableRowIds` to specify the ids for rows that should not be selectable. Use `nonSelectableRowIds` to prevent selection of specific rows.
<FileSource src="/framed/DataTable/DataTableNonSelectableRows" /> <FileSource src="/framed/DataTable/DataTableNonSelectableRows" />
## Expandable rows ## Expandable rows
Set `expandable` to `true` for rows to be expandable. Set `expandable` to `true` to make rows expandable. Use the `expanded-row` slot to customize expanded content.
<DataTable expandable <DataTable expandable
headers="{[ headers="{[
@ -1130,16 +1125,20 @@ Set `expandable` to `true` for rows to be expandable.
## Non-expandable rows ## Non-expandable rows
Use `nonExpandableRowIds` to specify the ids for rows that should not be expandable. Use `nonExpandableRowIds` to prevent expansion of specific rows.
<FileSource src="/framed/DataTable/DataTableNonExpandableRows" /> <FileSource src="/framed/DataTable/DataTableNonExpandableRows" />
## Expandable (zebra styles) ## Expandable (zebra styles)
Combine expandable rows with zebra striping.
<FileSource src="/framed/DataTable/DataTableExpandableZebra" /> <FileSource src="/framed/DataTable/DataTableExpandableZebra" />
## Expandable (compact size) ## Expandable (compact size)
Set `size="compact"` for expandable rows with minimal height.
<DataTable size="compact" expandable <DataTable size="compact" expandable
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -1199,6 +1198,8 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
## Expandable (short size) ## Expandable (short size)
Set `size="short"` for expandable rows with compact height.
<DataTable size="short" expandable <DataTable size="short" expandable
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -1258,6 +1259,8 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
## Expandable (tall size) ## Expandable (tall size)
Set `size="tall"` for expandable rows with increased height.
<DataTable size="tall" expandable <DataTable size="tall" expandable
headers="{[ headers="{[
{ key: "name", value: "Name" }, { key: "name", value: "Name" },
@ -1317,7 +1320,7 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
## Batch expansion ## Batch expansion
Set `batchExpansion` to `true` for the ability to expand and collapse all rows at once. Set `batchExpansion` to `true` to expand and collapse all rows at once.
<DataTable batchExpansion <DataTable batchExpansion
headers="{[ headers="{[
@ -1378,42 +1381,54 @@ Set `batchExpansion` to `true` for the ability to expand and collapse all rows a
## Expandable and selectable rows ## Expandable and selectable rows
The `batchExpansion` and `batchSelection` props can be used together. Combine `batchExpansion` and `batchSelection` for tables with both expandable and selectable rows.
<FileSource src="/framed/DataTable/DataTableExpandableSelectable" /> <FileSource src="/framed/DataTable/DataTableExpandableSelectable" />
## Skeleton ## Skeleton
Use `DataTableSkeleton` to show a loading state.
<DataTableSkeleton /> <DataTableSkeleton />
## Skeleton with headers, row count ## Skeleton with headers, row count
Specify headers and row count for the skeleton.
<DataTableSkeleton headers={["Name", "Protocol", "Port", "Rule"]} rows={10} /> <DataTableSkeleton headers={["Name", "Protocol", "Port", "Rule"]} rows={10} />
## Skeleton with object headers ## Skeleton with object headers
`headers` can also be an array of objects. The type is the same as the `headers` prop type used in `DataTable`. Pass header objects to customize the skeleton.
<DataTableSkeleton headers={[{ value: "Name" }, {value: "Protocol"}, {value:"Port"}, { value: "Rule"}]} rows={10} /> <DataTableSkeleton headers={[{ value: "Name" }, {value: "Protocol"}, {value:"Port"}, { value: "Rule"}]} rows={10} />
## Skeleton with empty header ## Skeleton with empty header
Pass an object with `"empty"` set to `true` to render an empty table header column. Add an empty header column with `empty: true`.
<DataTableSkeleton headers={[{ value: "Name" }, {value: "Protocol"}, {value:"Port"}, { value: "Rule"}, { empty: true }]} rows={10} /> <DataTableSkeleton headers={[{ value: "Name" }, {value: "Protocol"}, {value:"Port"}, { value: "Rule"}, { empty: true }]} rows={10} />
## Skeleton without header, toolbar ## Skeleton without header, toolbar
Hide the header and toolbar in the skeleton.
<DataTableSkeleton showHeader={false} showToolbar={false} /> <DataTableSkeleton showHeader={false} showToolbar={false} />
## Skeleton (tall size) ## Skeleton (tall size)
Set `size="tall"` for a taller skeleton.
<DataTableSkeleton showHeader={false} showToolbar={false} size="tall" /> <DataTableSkeleton showHeader={false} showToolbar={false} size="tall" />
## Skeleton (short size) ## Skeleton (short size)
Set `size="short"` for a shorter skeleton.
<DataTableSkeleton showHeader={false} showToolbar={false} size="short" /> <DataTableSkeleton showHeader={false} showToolbar={false} size="short" />
## Skeleton (compact size) ## Skeleton (compact size)
Set `size="compact"` for a minimal skeleton.
<DataTableSkeleton showHeader={false} showToolbar={false} size="compact" /> <DataTableSkeleton showHeader={false} showToolbar={false} size="compact" />

View file

@ -7,11 +7,7 @@ components: ["DatePicker", "DatePickerInput", "DatePickerSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
Carbon uses the zero dependency [flatpickr](https://github.com/flatpickr/flatpickr) library for its underlying calendar implementation. `DatePicker` lets users select a date or date range using a calendar interface. It uses the [flatpickr](https://github.com/flatpickr/flatpickr) library for its calendar implementation.
Set `datePickerType` to `"single"` or `"range"` for the calendar functionality.
Specify [flatpickr options](https://flatpickr.js.org/options/) through the `flatpickrProps` prop.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01"> <div class="body-short-01">
@ -21,25 +17,27 @@ Specify [flatpickr options](https://flatpickr.js.org/options/) through the `flat
## Single ## Single
By default, the `flatpickr` option `static` is set to `true` so that the calendar is positioned inside the wrapper and next to the input element. This is required for the calendar position to work inside a [Modal](/components/Modal). Set `datePickerType` to `"single"` for single date selection.
Set `flatpickrProps.static` to `false` to opt out of this behavior.
<FileSource src="/framed/DatePicker/DatePickerSingle" /> <FileSource src="/framed/DatePicker/DatePickerSingle" />
## Range ## Range
Set `datePickerType` to `"range"` for the range variant. Set `datePickerType` to `"range"` to enable date range selection.
<FileSource src="/framed/DatePicker/DatePickerRange" /> <FileSource src="/framed/DatePicker/DatePickerRange" />
## DatePicker in a modal ## DatePicker in a modal
The calendar is positioned inside the wrapper by default (`flatpickrProps.static: true`). This ensures proper positioning within a [Modal](/components/Modal).
Set `flatpickrProps.static` to `false` to position the calendar outside the wrapper.
<FileSource src="/framed/DatePicker/DatePickerModal" /> <FileSource src="/framed/DatePicker/DatePickerModal" />
## Simple ## Simple
By default, the "simple" date picker does not have a dropdown calendar. Create a simple date picker without a dropdown calendar.
<DatePicker> <DatePicker>
<DatePickerInput labelText="Date of birth" placeholder="mm/dd/yyyy" /> <DatePickerInput labelText="Date of birth" placeholder="mm/dd/yyyy" />
@ -47,52 +45,70 @@ By default, the "simple" date picker does not have a dropdown calendar.
## With helper text ## With helper text
Add helper text to provide additional context or formatting instructions.
<DatePicker> <DatePicker>
<DatePickerInput labelText="Date of birth" helperText="Example: 01/12/1990" placeholder="mm/dd/yyyy" /> <DatePickerInput labelText="Date of birth" helperText="Example: 01/12/1990" placeholder="mm/dd/yyyy" />
</DatePicker> </DatePicker>
## Hidden label ## Hidden label
Hide the label while maintaining accessibility.
<DatePicker> <DatePicker>
<DatePickerInput hideLabel labelText="Date of birth" placeholder="mm/dd/yyyy" /> <DatePickerInput hideLabel labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker> </DatePicker>
## Light variant ## Light variant
Use the light variant for light backgrounds.
<DatePicker light> <DatePicker light>
<DatePickerInput labelText="Date of birth" placeholder="mm/dd/yyyy" /> <DatePickerInput labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker> </DatePicker>
## Extra-large size ## Extra-large size
Use the extra-large size for more prominent date pickers.
<DatePicker> <DatePicker>
<DatePickerInput size="xl" labelText="Date of birth" placeholder="mm/dd/yyyy" /> <DatePickerInput size="xl" labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker> </DatePicker>
## Small size ## Small size
Use the small size for compact date pickers.
<DatePicker> <DatePicker>
<DatePickerInput size="sm" labelText="Date of birth" placeholder="mm/dd/yyyy" /> <DatePickerInput size="sm" labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker> </DatePicker>
## Invalid state ## Invalid state
Show an invalid state when the input value is not valid.
<DatePicker> <DatePicker>
<DatePickerInput invalid invalidText="Invalid date" labelText="Date of birth" placeholder="mm/dd/yyyy" /> <DatePickerInput invalid invalidText="Invalid date" labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker> </DatePicker>
## Warning state ## Warning state
Show a warning state to indicate potential issues with the input.
<DatePicker> <DatePicker>
<DatePickerInput warn warnText="This info will not be stored" labelText="Date of birth" placeholder="mm/dd/yyyy" /> <DatePickerInput warn warnText="This info will not be stored" labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker> </DatePicker>
## Disabled state ## Disabled state
Disable the date picker to prevent user interaction.
<DatePicker> <DatePicker>
<DatePickerInput disabled labelText="Date of birth" placeholder="mm/dd/yyyy" /> <DatePickerInput disabled labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker> </DatePicker>
## Skeleton ## Skeleton
Show a loading state with the skeleton component.
<DatePickerSkeleton /> <DatePickerSkeleton />

View file

@ -7,7 +7,9 @@ components: ["Dropdown", "DropdownSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Dropdown` is keyed for performance reasons. The `Dropdown` component provides a select input with a dropdown menu. It supports
various states, sizes, and customization options. Each item in the dropdown must
have a unique `id` property for proper functionality.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">Every <code>items</code> object must have a unique "id" property.</div> <div class="body-short-01">Every <code>items</code> object must have a unique "id" property.</div>
@ -15,25 +17,33 @@ components: ["Dropdown", "DropdownSkeleton"]
## Default ## Default
Use the `Dropdown` component to create a select input with a dropdown menu. Each item
must have a unique `id` property.
<Dropdown titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"}, <Dropdown titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" /> {id: "2", text: "Fax"}]}" />
## Custom slot ## Custom slot
Override the default slot to customize the display of each item. Access the item and index through the `let:` directive. Override the default slot to customize the display of each item. Access the item and
index through the `let:` directive.
<FileSource src="/framed/Dropdown/DropdownSlot" /> <FileSource src="/framed/Dropdown/DropdownSlot" />
## Hidden label ## Hidden label
Hide the label while maintaining accessibility by setting the `hideLabel` prop to
`true`. The label will still be available to screen readers.
<Dropdown hideLabel titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"}, <Dropdown hideLabel titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" /> {id: "2", text: "Fax"}]}" />
## Format item display text ## Format item display text
Use the `itemToString` prop to format the display of individual items. Format the display text of items using the `itemToString` prop. This function
receives the item object and returns the formatted string.
<Dropdown itemToString={item => { <Dropdown itemToString={item => {
return item.text + ' (' + item.id +')' return item.text + ' (' + item.id +')'
@ -43,11 +53,15 @@ Use the `itemToString` prop to format the display of individual items.
## Multiple dropdowns ## Multiple dropdowns
Create multiple dropdowns that work together. This example demonstrates how to
manage the state of multiple dropdowns.
<FileSource src="/framed/Dropdown/MultipleDropdown" /> <FileSource src="/framed/Dropdown/MultipleDropdown" />
## Top direction ## Top direction
Set `direction` to `"top"` for the dropdown menu to appear above the input. Display the dropdown menu above the input by setting the `direction` prop to
`"top"`. This is useful when there's limited space below the input.
<Dropdown direction="top" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"}, <Dropdown direction="top" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
@ -55,49 +69,72 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
## Light variant ## Light variant
Use the light variant for dropdowns on dark backgrounds by setting the `light` prop
to `true`.
<Dropdown light titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"}, <Dropdown light titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" /> {id: "2", text: "Fax"}]}" />
## Inline variant ## Inline variant
Display the dropdown inline with other content by setting the `type` prop to
`"inline"`. This variant removes the background and border.
<Dropdown type="inline" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"}, <Dropdown type="inline" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" /> {id: "2", text: "Fax"}]}" />
## Extra-large size ## Extra-large size
Increase the size of the dropdown by setting the `size` prop to `"xl"`. This
provides more visual emphasis for important selections.
<Dropdown size="xl" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"}, <Dropdown size="xl" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" /> {id: "2", text: "Fax"}]}" />
## Small size ## Small size
Decrease the size of the dropdown by setting the `size` prop to `"sm"`. This is
useful for compact layouts or secondary selections.
<Dropdown size="sm" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"}, <Dropdown size="sm" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" /> {id: "2", text: "Fax"}]}" />
## Invalid state ## Invalid state
Indicate an invalid selection by setting the `invalid` prop to `true`. Provide
feedback to users with the `invalidText` prop.
<Dropdown invalid invalidText="Secondary contact method must be different from the primary contact" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"}, <Dropdown invalid invalidText="Secondary contact method must be different from the primary contact" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" /> {id: "2", text: "Fax"}]}" />
## Warning state ## Warning state
Indicate a warning state by setting the `warn` prop to `true`. Provide additional
context with the `warnText` prop.
<Dropdown warn warnText="This contact method is not associated with your account" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"}, <Dropdown warn warnText="This contact method is not associated with your account" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" /> {id: "2", text: "Fax"}]}" />
## Disabled state ## Disabled state
Disable the entire dropdown by setting the `disabled` prop to `true`. This prevents
user interaction with the component.
<Dropdown disabled titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"}, <Dropdown disabled titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" /> {id: "2", text: "Fax"}]}" />
## Disabled items ## Disabled items
Use the `disabled` property in the `items` prop to disable specific items. Disable specific items in the dropdown by setting the `disabled` property to
`true` in the item object. This allows for more granular control over available
selections.
<Dropdown <Dropdown
selectedId="0" selectedId="0"
@ -111,4 +148,7 @@ Use the `disabled` property in the `items` prop to disable specific items.
## Skeleton ## Skeleton
Display a loading state using the `DropdownSkeleton` component. This provides
visual feedback while the dropdown content is being loaded.
<DropdownSkeleton /> <DropdownSkeleton />

View file

@ -3,11 +3,19 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
The `ExpandableTile` component creates a collapsible content container that can
show and hide content with a smooth animation. It's ideal for managing content
overflow and progressive disclosure of information. The component automatically
measures content height using a resize observer.
## Default ## Default
This component uses a [resize observer](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) to determine the height of the above-the-fold content. Create an expandable tile that shows and hides content. The component uses a
[resize observer](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver)
to determine the height of the above-the-fold content.
It's unexpanded by default. By default, the tile is collapsed. Use the `above` and `below` slots to define the
content that appears before and after expansion.
<ExpandableTile> <ExpandableTile>
<div slot="above"> <div slot="above">
@ -25,7 +33,8 @@ It's unexpanded by default.
## Custom tile heights ## Custom tile heights
Set a custom height for the tiles on the "above" and "below" slots. Set custom heights for the tile content using CSS. This is useful when you need to
control the exact dimensions of the visible and hidden content.
<ExpandableTile> <ExpandableTile>
<div slot="above" style="height: 10rem">Above the fold content here</div> <div slot="above" style="height: 10rem">Above the fold content here</div>
@ -34,6 +43,9 @@ Set a custom height for the tiles on the "above" and "below" slots.
## Expanded ## Expanded
Display the tile in its expanded state by default by setting the `expanded` prop to
`true`.
<ExpandableTile expanded> <ExpandableTile expanded>
<div slot="above">Above the fold content here</div> <div slot="above">Above the fold content here</div>
<div slot="below">Below the fold content here</div> <div slot="below">Below the fold content here</div>
@ -41,6 +53,9 @@ Set a custom height for the tiles on the "above" and "below" slots.
## Light variant ## Light variant
Use the light variant for expandable tiles on dark backgrounds by setting the
`light` prop to `true`.
<ExpandableTile light> <ExpandableTile light>
<div slot="above">Above the fold content here</div> <div slot="above">Above the fold content here</div>
<div slot="below">Below the fold content here</div> <div slot="below">Below the fold content here</div>
@ -48,6 +63,9 @@ Set a custom height for the tiles on the "above" and "below" slots.
## With icon labels ## With icon labels
Customize the expand/collapse button labels using the `tileExpandedLabel` and
`tileCollapsedLabel` props.
<ExpandableTile tileExpandedLabel="View less" tileCollapsedLabel="View more"> <ExpandableTile tileExpandedLabel="View less" tileCollapsedLabel="View more">
<div slot="above">Above the fold content here</div> <div slot="above">Above the fold content here</div>
<div slot="below">Below the fold content here</div> <div slot="below">Below the fold content here</div>
@ -55,7 +73,9 @@ Set a custom height for the tiles on the "above" and "below" slots.
## With interactive content ## With interactive content
For tiles containing interactive content, use `stopPropagation` to prevent the tile from toggling. Handle interactive content within the tile by preventing event propagation. This
ensures that clicks on interactive elements don't trigger the tile's expand/collapse
behavior.
<ExpandableTile tileExpandedLabel="View less" tileCollapsedLabel="View more"> <ExpandableTile tileExpandedLabel="View less" tileCollapsedLabel="View more">
<div slot="above"> <div slot="above">

View file

@ -7,27 +7,47 @@ components: ["FileUploaderButton", "FileUploader", "FileUploaderDropContainer",
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
The `FileUploader` components provide a complete solution for file uploads, including
a button trigger, drag-and-drop container, and file list display. The components
support various states, file validation, and customization options.
## File uploader (button-only) ## File uploader (button-only)
By default, the file uploader only accepts one file. Create a simple file upload button using `FileUploaderButton`. By default, it
accepts a single file. Set `multiple` to `true` to allow multiple file selection.
Set `multiple` to `true` for multiple files to be uploaded. <FileUploaderButton labelText="Add file" />
<FileUploaderButton labelText="Add files" /> ## Multiple files
Enable multiple file selection by setting the `multiple` prop to `true`. This
allows users to select multiple files at once.
<FileUploaderButton multiple labelText="Add files" />
## Custom button kind, size
Customize the button appearance using the `kind` and `size` props. The default is
a small primary button.
<FileUploaderButton kind="secondary" size="field" />
<FileUploaderButton kind="tertiary" size="default" />
<FileUploaderButton kind="danger" size="lg" />
<FileUploaderButton kind="danger-tertiary" size="xl" />
## File uploader ## File uploader
The `FileUploader` wraps `FileUploaderButton` and lists out uploaded files. The `FileUploader` component combines a button trigger with a list of uploaded
files. It supports file type restrictions, multiple file selection, and various
upload states.
The example below accepts multiple files with an extension of `.jpg` or `.jpeg`. It sets the status to `"complete"`; by default, the status is `"loading"`. This example accepts multiple JPEG files and displays them in a completed state.
See the [item examples below](#item-uploading) for different statuses.
<FileUploader multiple labelTitle="Upload files" buttonLabel="Add files" labelDescription="Only JPEG files are accepted." accept="{['.jpg', '.jpeg']}" status="complete" /> <FileUploader multiple labelTitle="Upload files" buttonLabel="Add files" labelDescription="Only JPEG files are accepted." accept="{['.jpg', '.jpeg']}" status="complete" />
## Clear files ## Clear files
There are two ways to clear files in `FileUploader`: Remove uploaded files from the `FileUploader` component in two ways:
<UnorderedList svx-ignore style="margin-bottom: var(--cds-spacing-08)"> <UnorderedList svx-ignore style="margin-bottom: var(--cds-spacing-08)">
<ListItem>programmatically using the <strong>clearFiles</strong> accessor</ListItem> <ListItem>programmatically using the <strong>clearFiles</strong> accessor</ListItem>
@ -38,21 +58,29 @@ There are two ways to clear files in `FileUploader`:
## File uploader (disabled state) ## File uploader (disabled state)
Disable the file uploader by setting the `disabled` prop to `true`. This prevents
user interaction with the component.
<FileUploader disabled multiple labelTitle="Upload files" buttonLabel="Add files" labelDescription="Only JPEG files are accepted." accept="{['.jpg', '.jpeg']}" status="complete" /> <FileUploader disabled multiple labelTitle="Upload files" buttonLabel="Add files" labelDescription="Only JPEG files are accepted." accept="{['.jpg', '.jpeg']}" status="complete" />
## Item (uploading) ## Item (uploading)
Display a file upload in progress using the `uploading` status. This shows a
loading indicator and the file name.
<FileUploaderItem name="README.md" status="uploading" /> <FileUploaderItem name="README.md" status="uploading" />
## Item (complete) ## Item (complete)
Show a successfully uploaded file using the `complete` status. This displays a
checkmark icon next to the file name.
<FileUploaderItem name="README.md" status="complete" /> <FileUploaderItem name="README.md" status="complete" />
## Item (edit) ## Item (edit)
If the `status` is `"edit"`, clicking the close icon will dispatch a `delete` event. Enable file deletion by setting the status to `"edit"`. Clicking the close icon
dispatches a `delete` event with the item's ID.
The event detail contains the item `id`.
<FileUploaderItem id="readme" name="README.md" status="edit" on:delete={(e) => { <FileUploaderItem id="readme" name="README.md" status="edit" on:delete={(e) => {
console.log(e.detail); // "readme" console.log(e.detail); // "readme"
@ -60,13 +88,15 @@ The event detail contains the item `id`.
## Item (edit status, invalid state) ## Item (edit status, invalid state)
An item can also have an edit status with an invalid state. Mark a file as invalid while keeping it editable. This shows an error icon and
allows the user to remove the file.
<FileUploaderItem invalid id="readme" name="README.md" status="edit" on:delete /> <FileUploaderItem invalid id="readme" name="README.md" status="edit" on:delete />
## Item (edit status, invalid state with subject, body) ## Item (edit status, invalid state with subject, body)
Use the `errorSubject` and `errorBody` props to customize the error message. Provide detailed error messages for invalid files using the `errorSubject` and
`errorBody` props. This helps users understand and resolve upload issues.
<FileUploaderItem <FileUploaderItem
invalid invalid
@ -80,7 +110,8 @@ Use the `errorSubject` and `errorBody` props to customize the error message.
## Item sizes ## Item sizes
The default `FileUploaderItem` size is "default". Customize the size of file uploader items using the `size` prop. The default size
is "default".
<FileUploaderItem size="default" name="README.md" status="uploading" /> <FileUploaderItem size="default" name="README.md" status="uploading" />
<FileUploaderItem size="field" name="README.md" status="uploading" /> <FileUploaderItem size="field" name="README.md" status="uploading" />
@ -88,11 +119,11 @@ The default `FileUploaderItem` size is "default".
## Drop container ## Drop container
The `FileUploaderDropContainer` accepts files through click and drop events. Use `FileUploaderDropContainer` for drag-and-drop file uploads. It supports file
validation and multiple file selection.
Use the `validateFiles` prop to filter out files before they are set. This example accepts files smaller than 1 kB and logs the selected files to the
console.
The following example accepts files smaller than 1 kB.
<FileUploaderDropContainer <FileUploaderDropContainer
multiple multiple
@ -107,4 +138,7 @@ The following example accepts files smaller than 1 kB.
## Skeleton ## Skeleton
Display a loading state using the `FileUploaderSkeleton` component. This provides
visual feedback while the file uploader content is being loaded.
<FileUploaderSkeleton /> <FileUploaderSkeleton />

View file

@ -7,9 +7,15 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
The `FluidForm` component provides a fluid-width form layout that adapts to its
container. It's designed for full-width form layouts and works with most Carbon
input components. Note that inline input variants cannot be used within a
`FluidForm`.
## Fluid form ## Fluid form
Note that the `inline` input variants cannot be used within a `FluidForm`. Create a fluid-width form layout using the `FluidForm` component. This example
shows a basic login form with required fields.
<FluidForm> <FluidForm>
<TextInput labelText="User name" placeholder="Enter user name..." required /> <TextInput labelText="User name" placeholder="Enter user name..." required />
@ -23,4 +29,8 @@ Note that the `inline` input variants cannot be used within a `FluidForm`.
## Invalid state ## Invalid state
Handle form validation and display error states using the `invalid` and
`invalidText` props on form inputs. This example demonstrates how to show
validation errors in a fluid form.
<FileSource src="/framed/FluidForm/FluidFormInvalid" /> <FileSource src="/framed/FluidForm/FluidFormInvalid" />

View file

@ -14,8 +14,15 @@ components: ["Form", "FormGroup"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
The `Form` component provides a structured way to collect user input. It works with
various form controls like checkboxes, radio buttons, and select menus. The
`FormGroup` component helps organize related form controls with a legend.
## Form ## Form
Create a form with grouped controls using `Form` and `FormGroup`. This example
shows a form with checkboxes, radio buttons, and a select menu.
<Form on:submit> <Form on:submit>
<FormGroup legendText="Checkboxes"> <FormGroup legendText="Checkboxes">
<Checkbox id="checkbox-0" labelText="Checkbox Label" checked /> <Checkbox id="checkbox-0" labelText="Checkbox Label" checked />
@ -46,7 +53,7 @@ components: ["Form", "FormGroup"]
</RadioButtonGroup> </RadioButtonGroup>
</FormGroup> </FormGroup>
<FormGroup> <FormGroup>
<Select id="select-1" labelText="Select menu" value="placeholder-item"> <Select id="select-1" labelText="Select menu">
<SelectItem <SelectItem
disabled disabled
hidden hidden
@ -63,7 +70,9 @@ components: ["Form", "FormGroup"]
## Prevent default behavior ## Prevent default behavior
The forwarded `submit` event is not modified. Use `e.preventDefault()` to prevent the native form submission behavior. Handle form submission by preventing the default browser behavior. Use
`e.preventDefault()` to stop the native form submission and handle the event
programmatically.
<Form on:submit={e => { <Form on:submit={e => {
e.preventDefault(); e.preventDefault();

View file

@ -6,34 +6,62 @@ components: ["Grid", "Row", "Column"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
The `Grid` system provides a responsive, 12-column layout structure. Use `Row` and
`Column` components to create flexible layouts that adapt to different screen
sizes. The grid supports various spacing options and column configurations.
## Default ## Default
Create a basic grid layout with equal-width columns. This example demonstrates the
default grid behavior.
<FileSource src="/framed/Grid/Grid" /> <FileSource src="/framed/Grid/Grid" />
## Full width ## Full width
Use the full-width grid variant for layouts that span the entire viewport width.
This removes the default max-width constraint.
<FileSource src="/framed/Grid/FullWidthGrid" /> <FileSource src="/framed/Grid/FullWidthGrid" />
## Narrow ## Narrow
Create a more compact grid layout using the narrow variant. This reduces the
spacing between columns.
<FileSource src="/framed/Grid/NarrowGrid" /> <FileSource src="/framed/Grid/NarrowGrid" />
## Condensed ## Condensed
Use the condensed variant for even tighter spacing between columns. This is ideal
for dense data displays.
<FileSource src="/framed/Grid/CondensedGrid" /> <FileSource src="/framed/Grid/CondensedGrid" />
## Responsive ## Responsive
Build responsive layouts by specifying different column widths for different
breakpoints. The grid automatically adjusts based on screen size.
<FileSource src="/framed/Grid/ResponsiveGrid" /> <FileSource src="/framed/Grid/ResponsiveGrid" />
## Offset columns ## Offset columns
Create space between columns using the offset feature. This allows for more
flexible layouts without empty columns.
<FileSource src="/framed/Grid/OffsetColumns" /> <FileSource src="/framed/Grid/OffsetColumns" />
## Aspect ratio columns ## Aspect ratio columns
Maintain consistent column heights using aspect ratio columns. This ensures
content alignment across different column widths.
<FileSource src="/framed/Grid/AspectRatioColumns" /> <FileSource src="/framed/Grid/AspectRatioColumns" />
## Padded columns ## Padded columns
Add padding to columns using the padded variant. This creates more breathing room
between content.
<FileSource src="/framed/Grid/PaddedGrid" /> <FileSource src="/framed/Grid/PaddedGrid" />

View file

@ -5,15 +5,22 @@
let key = 0; let key = 0;
</script> </script>
This utility component uses the [Image API](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image) to programmatically load an image with slottable loading and error states. The `ImageLoader` component provides a robust way to load images with built-in
loading and error states. It uses the [Image API](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image)
to handle image loading programmatically. The component supports aspect ratios,
fade-in animations, and custom loading/error states.
## Default ## Default
Load an image with the default configuration. The component handles the loading
process automatically.
<ImageLoader src="https://upload.wikimedia.org/wikipedia/commons/5/51/IBM_logo.svg" /> <ImageLoader src="https://upload.wikimedia.org/wikipedia/commons/5/51/IBM_logo.svg" />
## Slots ## Slots
Use the "loading" and "error" named slots to render an element when the image is loading or has an error. Customize the loading and error states using named slots. This example shows how
to display a loading indicator and error message.
<ImageLoader src="https://upload.wikimedia.org/wikipedia/commons/5/51/IBM_logo.svg"> <ImageLoader src="https://upload.wikimedia.org/wikipedia/commons/5/51/IBM_logo.svg">
<svelte:fragment slot="loading"> <svelte:fragment slot="loading">
@ -26,21 +33,32 @@ Use the "loading" and "error" named slots to render an element when the image is
## With aspect ratio ## With aspect ratio
If `ratio` is set, this component uses the [AspectRatio](/components/AspectRatio) to constrain the image. Maintain consistent image dimensions using aspect ratios. The component uses
[AspectRatio](/components/AspectRatio) to constrain the image.
Supported aspect ratios include `"2x1"`, `"2x3"`, `"16x9"`, `"4x3"`, `"1x1"`, `"3x4"`, `"3x2"`, `"9x16"` and `"1x2"`. Supported aspect ratios include `"2x1"`, `"2x3"`, `"16x9"`, `"4x3"`, `"1x1"`,
`"3x4"`, `"3x2"`, `"9x16"` and `"1x2"`.
<ImageLoader ratio="16x9" src="https://upload.wikimedia.org/wikipedia/commons/5/51/IBM_logo.svg" /> <ImageLoader ratio="16x9" src="https://upload.wikimedia.org/wikipedia/commons/5/51/IBM_logo.svg" />
## Fade in ## Fade in
Set `fadeIn` to `true` to fade in the image if successfully loaded. Enable a smooth fade-in animation when the image loads successfully. This provides
a better user experience for image loading.
<Button kind="ghost" on:click="{() => { key++;}}">Reload image</Button> <Button kind="ghost" on:click="{() => { key++;}}">Reload image</Button>
{#key key}<ImageLoader fadeIn ratio="16x9" src="https://upload.wikimedia.org/wikipedia/commons/5/51/IBM_logo.svg" />{/key} {#key key}<ImageLoader fadeIn ratio="16x9" src="https://upload.wikimedia.org/wikipedia/commons/5/51/IBM_logo.svg" />{/key}
## Programmatic usage ## Programmatic usage
In this example, a component reference is obtained to programmatically trigger the `loadImage` method. Control image loading programmatically using component references. This example
demonstrates how to trigger image loading manually.
<FileSource src="/framed/ImageLoader/ProgrammaticImageLoader" /> <FileSource src="/framed/ImageLoader/ProgrammaticImageLoader" />
## Dynamic image source
Update the image source dynamically using the same `ImageLoader` instance. This
allows for smooth transitions between different images.
<FileSource src="/framed/ImageLoader/DynamicImageLoader" />

View file

@ -1,18 +1,37 @@
---
components: ["InlineLoading"]
---
<script> <script>
import { InlineLoading } from "carbon-components-svelte"; import { InlineLoading, UnorderedList, ListItem } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
The `InlineLoading` component provides a compact loading indicator that can be embedded within content. It's ideal for showing progress during inline operations like form submissions or data updates.
## Default ## Default
Display a basic loading indicator with the default configuration.
<InlineLoading /> <InlineLoading />
## With description ## With description
Add a descriptive text to provide context about the loading operation.
<InlineLoading description="Loading metrics..." /> <InlineLoading description="Loading metrics..." />
## Status states ## Status states
The component supports different status states to indicate progress:
<UnorderedList svx-ignore style="margin-bottom: var(--cds-spacing-08)">
<ListItem><strong>active</strong>: Shows an animated loading indicator</ListItem>
<ListItem><strong>inactive</strong>: Displays a static state</ListItem>
<ListItem><strong>finished</strong>: Shows a success state</ListItem>
<ListItem><strong>error</strong>: Displays an error state</ListItem>
</UnorderedList>
<InlineLoading status="active" description="Submitting..." /> <InlineLoading status="active" description="Submitting..." />
<InlineLoading status="inactive" description="Cancelling..." /> <InlineLoading status="inactive" description="Cancelling..." />
<InlineLoading status="finished" description="Success" /> <InlineLoading status="finished" description="Success" />
@ -20,4 +39,6 @@
## UX example ## UX example
See how to integrate the loading indicator in a real-world scenario.
<FileSource src="/framed/InlineLoading/InlineLoadingUx" /> <FileSource src="/framed/InlineLoading/InlineLoadingUx" />

View file

@ -7,26 +7,29 @@ components: ["InlineNotification", "NotificationActionButton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
Notification that appears inline. The `InlineNotification` component displays contextual messages inline with content. It supports various types of notifications (error, warning, success, info) and can include actions. Use it to provide feedback or important information to users.
See [detailed See [detailed usage](https://carbondesignsystem.com/components/notification/usage).
usage](https://carbondesignsystem.com/components/notification/usage).
See also: [ToastNotification](ToastNotification) See also: [ToastNotification](ToastNotification)
## Default (error) ## Default
Display a basic error notification with title and subtitle by default.
<InlineNotification title="Error:" subtitle="An internal server error occurred." /> <InlineNotification title="Error:" subtitle="An internal server error occurred." />
## Prevent default close behavior ## Prevent default close behavior
`InlineNotification` is a controlled component. Prevent the default close behavior using the `e.preventDefault()` method in the dispatched `on:close` event. The component is controlled, allowing you to prevent the default close behavior using `e.preventDefault()`.
<InlineNotification title="Error" subtitle="An internal server error occurred." on:close={(e) => { <InlineNotification title="Error" subtitle="An internal server error occurred." on:close={(e) => {
e.preventDefault(); e.preventDefault();
// custom close logic (e.g., transitions) // custom close logic (e.g., transitions)
}} /> }} />
## Slottable title, subtitle ## Slottable title and subtitle
Customize the notification content using slots for more flexibility.
<InlineNotification> <InlineNotification>
<strong slot="title">Error: </strong> <strong slot="title">Error: </strong>
@ -35,9 +38,7 @@ See also: [ToastNotification](ToastNotification)
## Accessible icon descriptions ## Accessible icon descriptions
The status icon and close button icon descriptions appear on cursor hover and are read Make notifications more accessible by providing custom descriptions for icons.
by assistive technology. Default descriptions are provided in English and can be
overridden via `statusIconDescription` and `closeButtonDescription`.
<InlineNotification <InlineNotification
title="错误" title="错误"
@ -48,10 +49,14 @@ overridden via `statusIconDescription` and `closeButtonDescription`.
## Hidden close button ## Hidden close button
Create a persistent notification by hiding the close button.
<InlineNotification hideCloseButton kind="warning" title="Scheduled maintenance:" subtitle="Maintenance will last 2-4 hours." /> <InlineNotification hideCloseButton kind="warning" title="Scheduled maintenance:" subtitle="Maintenance will last 2-4 hours." />
## With actions ## With actions
Add interactive elements to notifications using the actions slot.
<InlineNotification kind="warning" title="Scheduled maintenance:" subtitle="Maintenance will last 2-4 hours."> <InlineNotification kind="warning" title="Scheduled maintenance:" subtitle="Maintenance will last 2-4 hours.">
<svelte:fragment slot="actions"> <svelte:fragment slot="actions">
<NotificationActionButton>Learn more</NotificationActionButton> <NotificationActionButton>Learn more</NotificationActionButton>
@ -60,6 +65,8 @@ overridden via `statusIconDescription` and `closeButtonDescription`.
## Notification variants ## Notification variants
The component supports different notification types:
<InlineNotification kind="error" title="Error:" subtitle="An internal server error occurred." /> <InlineNotification kind="error" title="Error:" subtitle="An internal server error occurred." />
<InlineNotification kind="info" title="New updates:" subtitle="Restart to get the latest updates." /> <InlineNotification kind="info" title="New updates:" subtitle="Restart to get the latest updates." />
<InlineNotification kind="info-square" title="New updates:" subtitle="Restart to get the latest updates." /> <InlineNotification kind="info-square" title="New updates:" subtitle="Restart to get the latest updates." />
@ -69,6 +76,8 @@ overridden via `statusIconDescription` and `closeButtonDescription`.
## Low contrast ## Low contrast
Use low contrast variants for less prominent notifications.
<InlineNotification lowContrast kind="error" title="Error:" subtitle="An internal server error occurred." /> <InlineNotification lowContrast kind="error" title="Error:" subtitle="An internal server error occurred." />
<InlineNotification lowContrast kind="info" title="New updates:" subtitle="Restart to get the latest updates." /> <InlineNotification lowContrast kind="info" title="New updates:" subtitle="Restart to get the latest updates." />
<InlineNotification lowContrast kind="info-square" title="New updates:" subtitle="Restart to get the latest updates." /> <InlineNotification lowContrast kind="info-square" title="New updates:" subtitle="Restart to get the latest updates." />

View file

@ -8,17 +8,19 @@ components: ["Link", "OutboundLink"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
The `Link` component provides styled hyperlinks with various customization options. It supports different sizes, states, and can include icons. The `OutboundLink` variant automatically handles external links with proper security attributes.
## Default ## Default
Create a basic link with the default styling.
<Link href="https://www.carbondesignsystem.com/"> <Link href="https://www.carbondesignsystem.com/">
Carbon Design System Carbon Design System
</Link> </Link>
## Target _blank ## Target _blank
If setting `target` to `"_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/). For external links, the component automatically adds security attributes. You can override the `rel` attribute if needed.
You can override the `rel` attribute with a custom value.
<Link href="https://www.carbondesignsystem.com/" target="_blank"> <Link href="https://www.carbondesignsystem.com/" target="_blank">
Carbon Design System Carbon Design System
@ -26,7 +28,7 @@ You can override the `rel` attribute with a custom value.
## Outbound link ## Outbound link
An alternative to manually setting `target` to `"_blank"` is to use the `OutboundLink`. Use `OutboundLink` as a convenient alternative for external links.
<OutboundLink href="https://www.carbondesignsystem.com/"> <OutboundLink href="https://www.carbondesignsystem.com/">
Carbon Design System Carbon Design System
@ -34,6 +36,8 @@ An alternative to manually setting `target` to `"_blank"` is to use the `Outboun
## Inline variant ## Inline variant
Create links that flow naturally with surrounding text.
<div> <div>
Visit the Visit the
<Link inline href="https://www.carbondesignsystem.com/"> <Link inline href="https://www.carbondesignsystem.com/">
@ -43,7 +47,7 @@ An alternative to manually setting `target` to `"_blank"` is to use the `Outboun
## Link with icon ## Link with icon
Note that `inline` must be `false` when rendering a link with an icon. Add icons to links for better visual context. Note that `inline` must be `false` when using icons.
<div> <div>
Visit the Visit the
@ -52,28 +56,34 @@ Note that `inline` must be `false` when rendering a link with an icon.
</Link>. </Link>.
</div> </div>
## Large size ## Size variants
The component supports different sizes to match your design needs:
<Link size="lg" href="https://www.carbondesignsystem.com/"> <Link size="lg" href="https://www.carbondesignsystem.com/">
Carbon Design System Large link
</Link> </Link>
<br />
## Small size <Link href="https://www.carbondesignsystem.com/">
Default link
</Link>
<br />
<Link size="sm" href="https://www.carbondesignsystem.com/"> <Link size="sm" href="https://www.carbondesignsystem.com/">
Carbon Design System Small link
</Link> </Link>
## Disabled ## Disabled state
A `disabled` link will render a `p` tag instead of an anchor element. Disabled links render as plain text while maintaining accessibility.
<Link disabled href="https://www.carbondesignsystem.com/"> <Link disabled href="https://www.carbondesignsystem.com/">
Carbon Design System Disabled link
</Link> </Link>
## Visited styles ## Visited styles
Show visited state styling for links.
<Link visited href="https://www.carbondesignsystem.com/"> <Link visited href="https://www.carbondesignsystem.com/">
Carbon Design System Visited link
</Link> </Link>

View file

@ -1,16 +1,28 @@
---
components: ["Loading"]
---
<script> <script>
import { Loading } from "carbon-components-svelte"; import { Loading } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
## Default (with overlay) The `Loading` component provides a full-screen or inline loading indicator. It's ideal for showing progress during page loads or data fetching operations.
## Default
Display a loading indicator with a semi-transparent overlay that covers the entire viewport.
<FileSource src="/framed/Loading/Loading" /> <FileSource src="/framed/Loading/Loading" />
## No overlay ## No overlay
Show a loading indicator without the overlay, allowing interaction with the underlying content.
<Loading withOverlay={false} /> <Loading withOverlay={false} />
## Small size ## Small size
Display a more compact loading indicator.
<Loading withOverlay={false} small /> <Loading withOverlay={false} small />

View file

@ -1,23 +1,26 @@
---
components: ["LocalStorage"]
---
<script> <script>
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
This utility component wraps the [Window.localStorage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and is useful for persisting ephemeral data (e.g., color theme) at the browser level. The `LocalStorage` component provides a reactive wrapper around the [Window.localStorage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). It's useful for persisting user preferences and application state across page reloads.
## Reactive example ## Reactive example
In the example below, toggle the switch and reload the page. The updated theme should be persisted locally. See how the component maintains state across page reloads. Toggle the switch and refresh the page to see the persisted state.
<FileSource src="/framed/LocalStorage/LocalStorage" /> <FileSource src="/framed/LocalStorage/LocalStorage" />
## Clear item, clear all ## Clear item, clear all
Use the `bind:this` directive to access the `clearItem` and `clearAll` methods. The component provides methods to manage stored data:
Invoking `clearItem` will remove the persisted key value from the browser's local storage. - `clearItem`: Remove a specific key-value pair
- `clearAll`: Remove all stored data
Invoking `clearAll` will remove all key values. Use `bind:this` to access these methods. In this example, try toggling the switch, refreshing the page, then clearing the storage.
In the following example, toggle the switch and reload the page. Then, click the "Clear storage" button. Refresh the page; the theme should be reset to the untoggled state.
<FileSource src="/framed/LocalStorage/LocalStorageClear" /> <FileSource src="/framed/LocalStorage/LocalStorageClear" />

View file

@ -2,60 +2,78 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
## Default (transactional) The `Modal` component provides a focused dialog for user interactions, confirmations, or data entry. It supports various sizes, states, and customization options to create accessible and user-friendly modal experiences.
## Default
Display a modal dialog with a header, content area, and footer by default.
Create a basic modal dialog with primary and secondary actions. This variant is ideal for confirming user actions or gathering input.
<FileSource src="/framed/Modal/Modal" /> <FileSource src="/framed/Modal/Modal" />
## Custom focus ## Custom focus
By default, the modal close button will be focused when opened. Control which element receives focus when the modal opens. Use `selectorPrimaryFocus` to specify the target element using CSS selectors.
Use the `selectorPrimaryFocus` to specify the element that should be focused when the modal is opened (e.g., `#id`, `.class`, `[data-attribute]`).
<FileSource src="/framed/Modal/ModalCustomFocus" /> <FileSource src="/framed/Modal/ModalCustomFocus" />
## Danger modal ## Danger modal
Display critical actions or destructive operations with the danger variant. This style emphasizes the severity of the action.
<FileSource src="/framed/Modal/DangerModal" /> <FileSource src="/framed/Modal/DangerModal" />
## Passive modal ## Passive modal
Create a non-interactive modal for displaying information. This variant lacks action buttons and focuses on content presentation.
<FileSource src="/framed/Modal/PassiveModal" /> <FileSource src="/framed/Modal/PassiveModal" />
## Has scrolling content ## Has scrolling content
Setting `hasScrollingContent` to `true` increases the vertical space within the modal. Enable vertical scrolling for modals with lengthy content. This ensures all content remains accessible while maintaining a reasonable modal height.
<FileSource src="/framed/Modal/ModalScrollingContent" /> <FileSource src="/framed/Modal/ModalScrollingContent" />
## Multiple modals ## Multiple modals
Stack multiple modals for complex workflows. Each modal maintains its own state and focus management.
<FileSource src="/framed/Modal/ModalMultiple" /> <FileSource src="/framed/Modal/ModalMultiple" />
## Multiple secondary buttons ## Multiple secondary buttons
Use the `secondaryButtons` prop to render two secondary buttons. The prop is a 2-tuple type that supersedes `secondaryButtonText`. Add up to two secondary actions using the `secondaryButtons` prop. This provides more flexibility than the single `secondaryButtonText` option.
<FileSource src="/framed/Modal/3ButtonModal" /> <FileSource src="/framed/Modal/3ButtonModal" />
## Extra-small size ## Extra-small size
Use the extra-small size for compact notifications by setting `size` to `"xs"`. This is ideal for simple confirmations.
<FileSource src="/framed/Modal/ModalExtraSmall" /> <FileSource src="/framed/Modal/ModalExtraSmall" />
## Small size ## Small size
Use the small size for simple confirmations by setting `size` to `"sm"`. This provides a more focused dialog.
<FileSource src="/framed/Modal/ModalSmall" /> <FileSource src="/framed/Modal/ModalSmall" />
## Large size ## Large size
Use the large size for complex content by setting `size` to `"lg"`. This provides more space for detailed information.
<FileSource src="/framed/Modal/ModalLarge" /> <FileSource src="/framed/Modal/ModalLarge" />
## Prevent close on outside click ## Prevent close on outside click
`preventCloseOnClickOutside` prevents the modal from being closed when clicking outside of an open modal. This prop is intended to be used for transactional modals. Disable closing the modal when clicking outside by setting `preventCloseOnClickOutside` to `true`. This is useful for transactional modals where explicit user action is required.
<FileSource src="/framed/Modal/ModalPreventOutsideClick" /> <FileSource src="/framed/Modal/ModalPreventOutsideClick" />
## Button with icon ## Button with icon
Enhance modal buttons with icons for better visual context and clarity. This example shows how to add icons to modal actions.
<FileSource src="/framed/Modal/ModalButtonWithIcon" /> <FileSource src="/framed/Modal/ModalButtonWithIcon" />

View file

@ -3,7 +3,7 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`MultiSelect` is keyed for performance reasons. The `MultiSelect` component provides a dropdown interface for selecting multiple options using checkboxes. It supports filtering, custom formatting, and various states. Each item must have a unique `id` property for proper functionality.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">Every <code>items</code> object must have a unique "id" property.</div> <div class="body-short-01">Every <code>items</code> object must have a unique "id" property.</div>
@ -11,7 +11,7 @@
## Default ## Default
By default, items will be ordered alphabetically based on the `item.text` value. To prevent this, see [#no-alphabetical-ordering](#no-alphabetical-ordering). Create a basic multi-select dropdown with three contact methods. By default, items are ordered alphabetically.
<MultiSelect titleText="Contact" label="Select contact methods..." <MultiSelect titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"}, items="{[{id: "0", text: "Slack"},
@ -19,50 +19,9 @@ By default, items will be ordered alphabetically based on the `item.text` value.
{id: "2", text: "Fax"}]}" {id: "2", text: "Fax"}]}"
/> />
## Custom slot
Override the default slot to customize the display of each item. Access the item and index through the `let:` directive.
<FileSource src="/framed/MultiSelect/MultiSelectSlot" />
## No alphabetical ordering
To prevent alphabetical item ordering, pass an empty function to the `sortItem` prop.
<MultiSelect titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}"
sortItem="{() => {}}"
/>
## Filterable
`$$restProps` are spread to the underlying input element.
<MultiSelect spellcheck="false" filterable titleText="Contact" placeholder="Filter contact methods..."
items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}"
/>
## Initial selected items
To select (or bind) items, pass an array of item ids to `selectedIds`.
<MultiSelect selectedIds="{["0", "1"]}" titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}"
/>
## Multiple multi-select dropdowns
<FileSource src="/framed/MultiSelect/MultipleMultiSelect" />
## Format item display text ## Format item display text
Use the `itemToString` prop to format the display of individual items. Format the display text of items using the `itemToString` prop. This example appends the item ID in parentheses.
<MultiSelect itemToString={item => { <MultiSelect itemToString={item => {
return item.text + ' (' + item.id +')' return item.text + ' (' + item.id +')'
@ -73,9 +32,83 @@ Use the `itemToString` prop to format the display of individual items.
sortItem="{() => {}}" sortItem="{() => {}}"
/> />
## Custom slot
Override the default slot to customize item rendering. This example shows how to access and use the item and index values.
<FileSource src="/framed/MultiSelect/MultiSelectSlot" />
## No alphabetical ordering
Prevent automatic alphabetical ordering by passing a no-op function to `sortItem`. This maintains the original order of items.
<MultiSelect titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}"
sortItem="{() => {}}"
/>
## Filterable
Enable filtering by setting `filterable` to `true`. This example includes a placeholder text for the filter input.
<MultiSelect spellcheck="false" filterable titleText="Contact" placeholder="Filter contact methods..."
items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}"
/>
## Initial selected items
Pre-select items by passing an array of item IDs to `selectedIds`. This example pre-selects Slack and Email.
<MultiSelect selectedIds="{["0", "1"]}" titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}"
/>
## Multiple multi-select dropdowns
This example demonstrates how to manage multiple dropdowns in a form with coordinated state.
<FileSource src="/framed/MultiSelect/MultipleMultiSelect" />
## Format checkbox values
Customize checkbox attributes using the `itemToInput` prop. This example sets a consistent name for all checkboxes.
Use the `itemToInput` prop to customize the user-selectable checkbox values.
This will also override the underlying hidden inputs used for form submission.
```js
itemToInput={(item) => {
return {
name: `Contact_${item.id}`,
value: item.id
}
}}
```
The above function sets the `name` attribute to
`Contact_0` (respective to each item's `id`) for every hidden input that
renders, along with each respective item's `id` set to the `value` attribute.
<MultiSelect
itemToInput={(item) => ({name: 'contact', value: item.id})}
titleText="Contact"
label="Select contact methods..."
items="{[
{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}
]}"
/>
## Top direction ## Top direction
Set `direction` to `"top"` for the dropdown menu to appear above the input. Display the dropdown menu above the input by setting `direction` to `"top"`. This is useful when space below is limited.
<MultiSelect direction="top" titleText="Contact" label="Select contact methods..." <MultiSelect direction="top" titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"}, items="{[{id: "0", text: "Slack"},
@ -85,6 +118,8 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
## Hidden label ## Hidden label
Hide the label visually while maintaining accessibility by setting `hideLabel` to `true`. The label is still available to screen readers.
<MultiSelect titleText="Contact" label="Select contact methods..." hideLabel <MultiSelect titleText="Contact" label="Select contact methods..." hideLabel
items="{[{id: "0", text: "Slack"}, items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
@ -93,6 +128,8 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
## Light variant ## Light variant
Use the light variant for dark backgrounds by setting `light` to `true`. This provides better contrast in dark themes.
<MultiSelect light titleText="Contact" label="Select contact methods..." <MultiSelect light titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"}, items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
@ -101,6 +138,8 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
## Inline variant ## Inline variant
Display the dropdown inline with other content by setting `type` to `"inline"`. This removes the background and border.
<MultiSelect type="inline" titleText="Contact" label="Select contact methods..." <MultiSelect type="inline" titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"}, items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
@ -109,6 +148,8 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
## Extra-large size ## Extra-large size
Use the extra-large size for prominent selections by setting `size` to `"xl"`. This provides more visual emphasis.
<MultiSelect size="xl" titleText="Contact" label="Select contact methods..." <MultiSelect size="xl" titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"}, items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
@ -117,6 +158,8 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
## Small size ## Small size
Use the small size for compact layouts by setting `size` to `"sm"`. This is ideal for secondary selections.
<MultiSelect size="sm" titleText="Contact" label="Select contact methods..." <MultiSelect size="sm" titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"}, items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
@ -125,6 +168,8 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
## Invalid state ## Invalid state
Indicate an invalid selection by setting `invalid` to `true`. This example shows a required field error.
<MultiSelect invalid invalidText="A contact method is required" titleText="Contact" label="Select contact methods..." <MultiSelect invalid invalidText="A contact method is required" titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"}, items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
@ -133,6 +178,8 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
## Warning state ## Warning state
Indicate a warning state by setting `warn` to `true`. This example shows a warning about unassociated accounts.
<MultiSelect warn warnText="One or more contact methods are not associated with your account" titleText="Contact" label="Select contact methods..." <MultiSelect warn warnText="One or more contact methods are not associated with your account" titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"}, items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
@ -141,6 +188,8 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
## Disabled state ## Disabled state
Disable the entire dropdown by setting `disabled` to `true`. This prevents all user interaction.
<MultiSelect disabled titleText="Contact" label="Select contact methods..." <MultiSelect disabled titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"}, items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"}, {id: "1", text: "Email"},
@ -149,7 +198,7 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
## Disabled items ## Disabled items
Use the `disabled` property in the `items` prop to disable specific items. Disable specific items using the `disabled` property in the `items` prop. This example disables the Email option.
<MultiSelect <MultiSelect
titleText="Contact" titleText="Contact"

View file

@ -7,74 +7,100 @@ components: ["NumberInput", "NumberInputSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
The `NumberInput` component provides a controlled input for numerical values. It supports validation, step values, and various states to ensure accurate data entry.
## Default ## Default
This component requires a numerical value for `value`. Create a basic number input with increment and decrement controls. The input accepts numerical values and provides visual feedback.
See [#no-value](#no-value) to allow for an empty value.
<NumberInput label="Clusters" value={0} /> <NumberInput label="Clusters" value={0} />
## With helper text ## No value
Allow empty values by setting both `allowEmpty` to `true` and `value` to `null`. The `allowEmpty` prop enables the empty state, while `value={null}` represents no value.
<FileSource src="/framed/NumberInput/NumberInputEmpty" />
## Helper text
Add descriptive text below the input using the `helperText` prop. This helps users understand the expected input.
<NumberInput label="Clusters" value={0} helperText="Clusters provisioned in your region" /> <NumberInput label="Clusters" value={0} helperText="Clusters provisioned in your region" />
## Minimum and maximum values ## Minimum and maximum values
Constrain input values using `min` and `max` props. This example limits values between 4 and 20.
<NumberInput min="{4}" max="{20}" value="{4}" invalidText="Number must be between 4 and 20." helperText="Clusters provisioned in your region" label="Clusters (4 min, 20 max)" /> <NumberInput min="{4}" max="{20}" value="{4}" invalidText="Number must be between 4 and 20." helperText="Clusters provisioned in your region" label="Clusters (4 min, 20 max)" />
## With step value ## Step value
Control the increment/decrement step size using the `step` prop. This example uses a step of 0.1.
<NumberInput value="{1}" helperText="Step of 0.1" step={0.1} label="Clusters" /> <NumberInput value="{1}" helperText="Step of 0.1" step={0.1} label="Clusters" />
## No value
Set `allowEmpty` to `true` to allow for no value.
Set `value` to `null` to denote "no value."
<FileSource src="/framed/NumberInput/NumberInputEmpty" />
## Hidden label ## Hidden label
Hide the label visually while maintaining accessibility by setting `hideLabel` to `true`. The label is still available to screen readers.
<NumberInput hideLabel label="Clusters" value={0} /> <NumberInput hideLabel label="Clusters" value={0} />
## Hidden steppers
<NumberInput hideSteppers label="Clusters" value={0} />
## Light variant
<NumberInput light label="Clusters" value={0} />
## Read-only variant
<NumberInput readonly label="Clusters" value={0} />
## Extra-large size ## Extra-large size
Use the extra-large size for prominent inputs by setting `size` to `"xl"`. This provides more visual emphasis.
<NumberInput size="xl" label="Clusters" value={0} /> <NumberInput size="xl" label="Clusters" value={0} />
## Small size ## Small size
Use the small size for compact layouts by setting `size` to `"sm"`. This is ideal for secondary inputs.
<NumberInput size="sm" label="Clusters" value={0} /> <NumberInput size="sm" label="Clusters" value={0} />
## Light variant
Use the light variant for dark backgrounds by setting `light` to `true`. This provides better contrast in dark themes.
<NumberInput light label="Clusters" value={0} />
## Invalid state ## Invalid state
Indicate an invalid value by setting `invalid` to `true`. This example shows a validation error.
<NumberInput invalid invalidText="Invalid value" label="Clusters" value={0} /> <NumberInput invalid invalidText="Invalid value" label="Clusters" value={0} />
## Warning state ## Warning state
Indicate a warning state by setting `warn` to `true`. This example shows a warning about the input value.
<NumberInput warn warnText="A high number may impact initial rollout" label="Clusters" value={25} /> <NumberInput warn warnText="A high number may impact initial rollout" label="Clusters" value={25} />
## Disabled state ## Disabled state
Disable the input by setting `disabled` to `true`. This prevents all user interaction.
<NumberInput disabled label="Clusters" value={0} /> <NumberInput disabled label="Clusters" value={0} />
## Read-only state
Make the input read-only by setting `readonly` to `true`. This allows viewing but prevents editing.
<NumberInput readonly label="Clusters" value={0} />
## Hidden steppers
Hide the increment/decrement controls by setting `hideSteppers` to `true`. This provides a simpler input interface.
<NumberInput hideSteppers label="Clusters" value={0} />
## Skeleton ## Skeleton
Show a loading state using the `NumberInputSkeleton` component. This is useful while data is being fetched.
<NumberInputSkeleton /> <NumberInputSkeleton />
## Skeleton without label ## Skeleton without label
Show a loading state without a label by setting `hideLabel` to `true`. This maintains layout consistency.
<NumberInputSkeleton hideLabel /> <NumberInputSkeleton hideLabel />

View file

@ -7,6 +7,8 @@ components: ["OrderedList", "ListItem"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`OrderedList` provides a structured way to display numbered lists of items. It supports nested lists, native browser styles, and expressive typography for enhanced visual hierarchy.
<InlineNotification svx-ignore lowContrast title="Tip:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Tip:" kind="info" hideCloseButton>
<div class="body-short-01"> <div class="body-short-01">
Consider using the <Link href="/components/RecursiveList#ordered">RecursiveList</Link> component for rendering tree structured data. Consider using the <Link href="/components/RecursiveList#ordered">RecursiveList</Link> component for rendering tree structured data.
@ -15,6 +17,8 @@ components: ["OrderedList", "ListItem"]
## Default ## Default
Create a basic ordered list by wrapping `ListItem` components within `OrderedList`.
<OrderedList> <OrderedList>
<ListItem>Ordered list item</ListItem> <ListItem>Ordered list item</ListItem>
<ListItem>Ordered list item</ListItem> <ListItem>Ordered list item</ListItem>
@ -23,6 +27,8 @@ components: ["OrderedList", "ListItem"]
## With links ## With links
Add interactive elements like `Link` components within list items.
<OrderedList> <OrderedList>
<ListItem> <ListItem>
<Link href="#">Ordered list item</Link> <Link href="#">Ordered list item</Link>
@ -37,6 +43,8 @@ components: ["OrderedList", "ListItem"]
## Nested ## Nested
Set the `nested` prop to `true` to create hierarchical lists with proper indentation and numbering.
<OrderedList> <OrderedList>
<ListItem> <ListItem>
Ordered list level 1 Ordered list level 1
@ -57,7 +65,7 @@ components: ["OrderedList", "ListItem"]
## Native list styles ## Native list styles
Use the `native` attribute to enable default browser list styles. This is useful for large lists (i.e., 1000 or more items) where the list number may overlap with the list item text. Enable native browser list styles by setting the `native` prop to `true`. This is useful for large lists where the list number may overlap with the list item text.
<OrderedList native> <OrderedList native>
<ListItem> <ListItem>
@ -79,7 +87,7 @@ Use the `native` attribute to enable default browser list styles. This is useful
## Expressive styles ## Expressive styles
Set `expressive` to `true` to use Carbon's expressive typesetting. Use Carbon's expressive typesetting by setting the `expressive` prop to `true`.
<OrderedList expressive> <OrderedList expressive>
<ListItem><Link size="lg" href="#">Ordered list item</Link></ListItem> <ListItem><Link size="lg" href="#">Ordered list item</Link></ListItem>

View file

@ -8,8 +8,12 @@ components: ["OverflowMenu", "OverflowMenuItem"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`OverflowMenu` provides a compact way to display a list of actions or options. It renders as a button that opens a dropdown menu when clicked, making it ideal for secondary actions or overflow content.
## Default ## Default
Create a basic overflow menu by wrapping `OverflowMenuItem` components within `OverflowMenu`.
<OverflowMenu> <OverflowMenu>
<OverflowMenuItem text="Manage credentials" /> <OverflowMenuItem text="Manage credentials" />
<OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" /> <OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" />
@ -18,7 +22,7 @@ components: ["OverflowMenu", "OverflowMenuItem"]
## Flipped ## Flipped
Set `flipped` to `true` for the menu to be positioned to the left of the button. Set `flipped` to `true` to position the menu to the left of the button.
<OverflowMenu flipped> <OverflowMenu flipped>
<OverflowMenuItem text="Manage credentials" /> <OverflowMenuItem text="Manage credentials" />
@ -26,7 +30,9 @@ Set `flipped` to `true` for the menu to be positioned to the left of the button.
<OverflowMenuItem danger text="Delete service" /> <OverflowMenuItem danger text="Delete service" />
</OverflowMenu> </OverflowMenu>
## Menu direction top ## Menu direction
Set `direction` to `"top"` to position the menu above the button.
<OverflowMenu flipped direction="top"> <OverflowMenu flipped direction="top">
<OverflowMenuItem text="Manage credentials" /> <OverflowMenuItem text="Manage credentials" />
@ -36,6 +42,8 @@ Set `flipped` to `true` for the menu to be positioned to the left of the button.
## Light variant ## Light variant
Enable the light variant by setting `light` to `true`.
<OverflowMenu light> <OverflowMenu light>
<OverflowMenuItem text="Manage credentials" /> <OverflowMenuItem text="Manage credentials" />
<OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" /> <OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" />
@ -44,6 +52,8 @@ Set `flipped` to `true` for the menu to be positioned to the left of the button.
## Extra-large size ## Extra-large size
Set `size` to `"xl"` for an extra-large overflow menu.
<OverflowMenu size="xl"> <OverflowMenu size="xl">
<OverflowMenuItem text="Manage credentials" /> <OverflowMenuItem text="Manage credentials" />
<OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" /> <OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" />
@ -52,6 +62,8 @@ Set `flipped` to `true` for the menu to be positioned to the left of the button.
## Small size ## Small size
Set `size` to `"sm"` for a small overflow menu.
<OverflowMenu size="sm"> <OverflowMenu size="sm">
<OverflowMenuItem text="Manage credentials" /> <OverflowMenuItem text="Manage credentials" />
<OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" /> <OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" />
@ -60,7 +72,7 @@ Set `flipped` to `true` for the menu to be positioned to the left of the button.
## Custom primary focus ## Custom primary focus
By default, the first overflow menu item is focused when opening the dropdown. Set `primaryFocus` to `true` on a menu item to focus it when opening the dropdown.
<OverflowMenu> <OverflowMenu>
<OverflowMenuItem text="Manage credentials" /> <OverflowMenuItem text="Manage credentials" />
@ -70,6 +82,8 @@ By default, the first overflow menu item is focused when opening the dropdown.
## Custom trigger icon ## Custom trigger icon
Replace the default vertical overflow menu icon with a custom icon.
<OverflowMenu icon={Add}> <OverflowMenu icon={Add}>
<OverflowMenuItem text="Manage credentials" /> <OverflowMenuItem text="Manage credentials" />
<OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" /> <OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" />
@ -78,6 +92,8 @@ By default, the first overflow menu item is focused when opening the dropdown.
## Custom trigger slot ## Custom trigger slot
Use the `menu` slot to customize the trigger button content.
<OverflowMenu style="width: auto;"> <OverflowMenu style="width: auto;">
<div slot="menu" style="padding: 1rem; color: red;">Custom trigger</div> <div slot="menu" style="padding: 1rem; color: red;">Custom trigger</div>
<OverflowMenuItem text="Manage credentials" /> <OverflowMenuItem text="Manage credentials" />
@ -87,7 +103,7 @@ By default, the first overflow menu item is focused when opening the dropdown.
## Disabled items ## Disabled items
Disable menu items by setting `disabled` to `true`. Set `disabled` to `true` to disable menu items. Use `hasDivider` to add visual separation between items.
<OverflowMenu> <OverflowMenu>
<OverflowMenuItem text="Create key" /> <OverflowMenuItem text="Create key" />

View file

@ -7,26 +7,52 @@ components: ["Pagination", "PaginationSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Pagination` provides navigation controls for large data sets. It displays the current page, total items, and allows users to change page size and navigate between pages.
## Default ## Default
<Pagination totalItems={102} pageSizes="{[10, 15, 20]}" /> Create a basic pagination component with default page size options.
<Pagination totalItems={102} pageSizes={[10, 15, 20]} />
## Current page ## Current page
Set the current page using the `page` prop.
<Pagination totalItems={102} page={4} /> <Pagination totalItems={102} page={4} />
## Custom page sizes ## Custom page sizes
<Pagination totalItems={102} pageSizes="{[16, 36, 99]}" pageSize="{36}" /> Specify custom page sizes and set a default page size.
<Pagination totalItems={102} pageSizes={[16, 36, 99]} pageSize={36} />
## Unknown pages
Set `pagesUnknown` to `true` when the total number of pages is unknown. This renders the item range text without factoring in the total number of pages.
<Pagination pagesUnknown />
## Page window
The number of native select items rendered is derived from `totalItems`. For large datasets, this can impact performance. Use `pageWindow` to control the number of rendered items.
<Pagination totalItems={100_000} pageSizes={[10, 15, 20]} />
## Hidden page input ## Hidden page input
Disable the page input by setting `pageInputDisabled` to `true`.
<Pagination totalItems={102} pageInputDisabled /> <Pagination totalItems={102} pageInputDisabled />
## Hidden page size ## Hidden page size
Disable the page size selector by setting `pageSizeInputDisabled` to `true`.
<Pagination totalItems={102} pageSizeInputDisabled /> <Pagination totalItems={102} pageSizeInputDisabled />
## Skeleton ## Skeleton
Use `PaginationSkeleton` to show a loading state.
<PaginationSkeleton /> <PaginationSkeleton />

View file

@ -3,9 +3,11 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`PaginationNav` provides a compact navigation interface for paginated content. It displays page numbers and navigation buttons, with support for overflow menus when there are many pages.
## Default ## Default
`PaginationNav` renders `10` items and does not loop by default. Create a basic pagination navigation with default settings.
<PaginationNav /> <PaginationNav />
@ -15,37 +17,35 @@ Use the `page` prop to bind to the current page number.
<FileSource src="/framed/PaginationNav/PaginationNavReactive" /> <FileSource src="/framed/PaginationNav/PaginationNavReactive" />
## Total ## Total pages
Use the `total` prop to specify the number of pages. Specify the total number of pages using the `total` prop.
<PaginationNav total={3} /> <PaginationNav total={3} />
## Loopable ## Loop navigation
Set `loop` to `true` for navigation to be looped. Set `loop` to `true` to enable circular navigation between pages.
<PaginationNav total={3} loop /> <PaginationNav total={3} loop />
## Shown ## Visible pages
If `total` is greater than `10`, the number of items shown will be truncated to `10`. Control the number of visible page numbers with the `shown` prop.
Use `shown` to override the number of items shown.
<PaginationNav total={100} shown={5} /> <PaginationNav total={100} shown={5} />
## Custom button text ## Custom button text
Use the `forwardText` and `backwardText` props to customize the button text. Customize the navigation button text using `forwardText` and `backwardText`.
<PaginationNav <PaginationNav
forwardText="Next" forwardText="Next"
backwardText="Previous" backwardText="Previous"
/> />
## Tooltip Position ## Tooltip position
Use the `tooltipPosition` prop to change the alignment of the tooltip. Set the tooltip position relative to the navigation buttons using `tooltipPosition`.
<PaginationNav tooltipPosition="outside" total={3} loop /> <PaginationNav tooltipPosition="outside" total={3} loop />

View file

@ -3,8 +3,12 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`PasswordInput` provides a secure text input field with a visibility toggle for password entry. It includes features for validation, warnings, and accessibility.
## Default ## Default
Create a basic password input with a label and placeholder.
<PasswordInput labelText="Password" placeholder="Enter password..." /> <PasswordInput labelText="Password" placeholder="Enter password..." />
## Custom tooltip alignment ## Custom tooltip alignment
@ -21,36 +25,54 @@ Set prop `type` to `"text"` to toggle password visibility.
## Hidden label ## Hidden label
Visually hide the label while maintaining accessibility.
<PasswordInput hideLabel labelText="Password" placeholder="Enter password..." /> <PasswordInput hideLabel labelText="Password" placeholder="Enter password..." />
## Light variant ## Light variant
Enable the light variant for use on dark backgrounds.
<PasswordInput light labelText="Password" placeholder="Enter password..." /> <PasswordInput light labelText="Password" placeholder="Enter password..." />
## Inline ## Inline
Display the input with an inline label layout.
<PasswordInput inline labelText="Password" placeholder="Enter password..." /> <PasswordInput inline labelText="Password" placeholder="Enter password..." />
## Extra-large size ## Extra-large size
Use the extra-large size variant for increased visibility.
<PasswordInput size="xl" labelText="Password" placeholder="Enter password..." /> <PasswordInput size="xl" labelText="Password" placeholder="Enter password..." />
## Small size ## Small size
Use the small size variant for compact layouts.
<PasswordInput size="sm" labelText="Password" placeholder="Enter password..." /> <PasswordInput size="sm" labelText="Password" placeholder="Enter password..." />
## Invalid state ## Invalid state
Display an error message when the input is invalid.
<PasswordInput invalid invalidText="Incorrect user name or password." labelText="Password" placeholder="Enter password..." /> <PasswordInput invalid invalidText="Incorrect user name or password." labelText="Password" placeholder="Enter password..." />
## Warning state ## Warning state
Show a warning message for non-critical issues.
<PasswordInput warn warnText="Password has been reset." labelText="Password" placeholder="Enter password..." /> <PasswordInput warn warnText="Password has been reset." labelText="Password" placeholder="Enter password..." />
## Disabled state ## Disabled state
Disable the input to prevent user interaction.
<PasswordInput disabled labelText="Password" placeholder="Enter password..." /> <PasswordInput disabled labelText="Password" placeholder="Enter password..." />
## With helper text ## With helper text
Add helper text to provide additional context or instructions.
<PasswordInput helperText="Your password should be hard to guess" labelText="Password" placeholder="Enter password..." /> <PasswordInput helperText="Your password should be hard to guess" labelText="Password" placeholder="Enter password..." />

View file

@ -3,9 +3,11 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Popover` provides a floating container that displays content relative to a trigger element. It supports various alignments, caret indicators, and visual variants.
## Default ## Default
By default, the position of the popover component is absolute. Create a basic popover with absolute positioning.
<div data-outline> <div data-outline>
Parent Parent
@ -16,7 +18,7 @@ By default, the position of the popover component is absolute.
## Relative position ## Relative position
Set `relative` to `true` to use a relative position. Set `relative` to `true` to position the popover relative to its parent element.
<div data-outline> <div data-outline>
Parent Parent
@ -27,7 +29,7 @@ Set `relative` to `true` to use a relative position.
## Close on outside click ## Close on outside click
Set `closeOnOutsideClick` to set `open` to `false` when clicking outside of the popover. Enable automatic closing when clicking outside the popover using `closeOnOutsideClick`.
<div data-outline> <div data-outline>
Parent Parent
@ -111,6 +113,8 @@ The default `align` value is `"top"`.
## With caret ## With caret
Add a caret indicator to the popover using the `caret` prop.
<div data-outline> <div data-outline>
Parent Parent
<Popover caret open> <Popover caret open>
@ -120,9 +124,7 @@ The default `align` value is `"top"`.
## Custom caret alignment ## Custom caret alignment
By default, the caret is aligned "top". By default, the caret is aligned "top". Possible `align` values include `"top"`, `"top-left"`, `"top-right"`, `"bottom"`, `"bottom-left"`, `"bottom-right"`, `"left"`, `"left-bottom"`, `"left-top"`, `"right"`, `"right-bottom"` or `"right-top"`.
Possible `align` values include `"top"`, `"top-left"`, `"top-right"`, `"bottom"`, `"bottom-left"`, `"bottom-right"`, `"left"`, `"left-bottom"`, `"left-top"`, `"right"`, `"right-bottom"` or `"right-top"`.
<div data-outline> <div data-outline>
Parent Parent
@ -133,6 +135,8 @@ Possible `align` values include `"top"`, `"top-left"`, `"top-right"`, `"bottom"`
## Light variant ## Light variant
Enable the light variant for use on dark backgrounds.
<div data-outline> <div data-outline>
Parent Parent
<Popover light open> <Popover light open>
@ -142,6 +146,8 @@ Possible `align` values include `"top"`, `"top-left"`, `"top-right"`, `"bottom"`
## High contrast variant ## High contrast variant
Enable the high contrast variant for improved visibility.
<div data-outline> <div data-outline>
Parent Parent
<Popover highContrast open> <Popover highContrast open>

View file

@ -3,66 +3,70 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`ProgressBar` provides a visual indicator of progress for operations such as file uploads or data processing. It supports determinate and indeterminate states, various sizes, and status indicators.
## Default ## Default
Without a specified `value` prop, the progress bar is indeterminate. Create an indeterminate progress bar that continuously animates.
<ProgressBar helperText="Loading..." /> <ProgressBar helperText="Loading..." />
## Small size ## Small size
Specify `size="sm"` to use the small variant. Use the small size variant for compact layouts.
<ProgressBar size="sm" helperText="Loading..." /> <ProgressBar size="sm" helperText="Loading..." />
## Percentage ## Percentage
Specify a `value` for the progress bar to be determinate. Display progress as a percentage using the `value` prop.
<ProgressBar value={40} labelText="Upload status" helperText="40 MB of 100 MB" /> <ProgressBar value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
## Finished status ## Finished status
Specify `status="finished"` for the progress bar. Show completion status with a checkmark icon.
<ProgressBar value={100} status="finished" labelText="Upload file" helperText="Upload complete" /> <ProgressBar value={100} status="finished" labelText="Upload file" helperText="Upload complete" />
## Error status ## Error status
Specify `status="error"` for the progress bar. Indicate errors with an error icon and red styling.
<ProgressBar value={0} status="error" labelText="Upload file" helperText="Invalid file format" /> <ProgressBar value={0} status="error" labelText="Upload file" helperText="Invalid file format" />
## Custom max value ## Custom max value
The default `max` value is `100`. Set a custom maximum value for the progress bar.
<ProgressBar value={40} max={200} labelText="Upload status" helperText="40 MB of 200 MB" /> <ProgressBar value={40} max={200} labelText="Upload status" helperText="40 MB of 200 MB" />
## Hidden label ## Hidden label
It's recommended that you provide a `labelText` for accessibility. Visually hide the label while maintaining accessibility.
Use `hideLabel` to visually hide the label text.
<ProgressBar hideLabel value={40} labelText="Upload status" helperText="40 MB of 100 MB" /> <ProgressBar hideLabel value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
## Inline variant ## Inline variant
The inline variant visually hides the `helperText`. Use the inline variant to display progress without helper text.
<ProgressBar kind="inline" value={40} labelText="Upload status" helperText="40 MB of 100 MB" /> <ProgressBar kind="inline" value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
## Indented variant ## Indented variant
Use the indented variant for a more compact layout.
<ProgressBar kind="indented" value={40} labelText="Upload status" helperText="40 MB of 100 MB" /> <ProgressBar kind="indented" value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
## Indented status variant ## Indented status variant
Combine the indented variant with status indicators.
<ProgressBar kind="indented" status="finished" value={40} labelText="Upload file" helperText="Upload complete" /> <ProgressBar kind="indented" status="finished" value={40} labelText="Upload file" helperText="Upload complete" />
## UX example ## UX example
This example shows how to animate the progress bar from 0 to 100% with start and end states. Demonstrate a complete upload flow with start and end states.
<FileSource src="/framed/ProgressBar/ProgressBarUx" /> <FileSource src="/framed/ProgressBar/ProgressBarUx" />

View file

@ -7,7 +7,11 @@ components: ["ProgressIndicator", "ProgressStep", "ProgressIndicatorSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
## Default (horizontal) `ProgressIndicator` provides a visual representation of progress through a sequence of steps. It supports horizontal and vertical layouts, step completion states, and interactive navigation.
## Default
Create a horizontal progress indicator with four steps.
<ProgressIndicator currentIndex={2}> <ProgressIndicator currentIndex={2}>
<ProgressStep complete <ProgressStep complete
@ -30,9 +34,7 @@ components: ["ProgressIndicator", "ProgressStep", "ProgressIndicatorSkeleton"]
## Prevent change on click ## Prevent change on click
By default, clicking any step that is complete will update the current step index. Disable automatic step selection when clicking completed steps.
Set `preventChangeOnClick` to `true` to prevent this behavior.
<ProgressIndicator preventChangeOnClick currentIndex={2}> <ProgressIndicator preventChangeOnClick currentIndex={2}>
<ProgressStep complete <ProgressStep complete
@ -55,12 +57,14 @@ Set `preventChangeOnClick` to `true` to prevent this behavior.
## Programmatic usage ## Programmatic usage
When programmatically updating the `currentIndex`, keep in mind that only completed steps should be selectable. Update the current step programmatically while maintaining step completion rules.
<FileSource src="/framed/ProgressIndicator/ProgrammaticProgressIndicator" /> <FileSource src="/framed/ProgressIndicator/ProgrammaticProgressIndicator" />
## Invalid step ## Invalid step
Mark a step as invalid to indicate an error state.
<ProgressIndicator> <ProgressIndicator>
<ProgressStep complete <ProgressStep complete
label="Step 1" label="Step 1"
@ -78,6 +82,8 @@ When programmatically updating the `currentIndex`, keep in mind that only comple
## Disabled steps ## Disabled steps
Disable specific steps to prevent user interaction.
<ProgressIndicator> <ProgressIndicator>
<ProgressStep complete <ProgressStep complete
label="Step 1" label="Step 1"
@ -95,6 +101,8 @@ When programmatically updating the `currentIndex`, keep in mind that only comple
## Spaced-equally ## Spaced-equally
Distribute steps evenly across the available space.
<ProgressIndicator spaceEqually> <ProgressIndicator spaceEqually>
<ProgressStep <ProgressStep
label="Really long label" label="Really long label"
@ -112,6 +120,8 @@ When programmatically updating the `currentIndex`, keep in mind that only comple
## Vertical ## Vertical
Display steps in a vertical layout.
<ProgressIndicator vertical> <ProgressIndicator vertical>
<ProgressStep <ProgressStep
label="Really long label" label="Really long label"
@ -129,10 +139,12 @@ When programmatically updating the `currentIndex`, keep in mind that only comple
## Skeleton ## Skeleton
Use the `count` prop to specify the number of progress steps to render. Show a loading state with the specified number of steps.
<ProgressIndicatorSkeleton /> <ProgressIndicatorSkeleton />
## Skeleton (vertical) ## Skeleton (vertical)
Show a vertical loading state with the specified number of steps.
<ProgressIndicatorSkeleton vertical /> <ProgressIndicatorSkeleton vertical />

View file

@ -7,17 +7,23 @@ components: ["RadioButtonGroup", "RadioButton", "RadioButtonSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`RadioButton` provides a selection control that allows users to choose a single option from a set. It supports both individual and grouped usage, with options for horizontal and vertical layouts.
## Default ## Default
<RadioButtonGroup selected="standard"> Create a group of radio buttons with a shared name and legend.
<RadioButtonGroup legendText="Storage tier (disk)" name="plan" selected="standard">
<RadioButton labelText="Free (1 GB)" value="free" /> <RadioButton labelText="Free (1 GB)" value="free" />
<RadioButton labelText="Standard (10 GB)" value="standard" /> <RadioButton labelText="Standard (10 GB)" value="standard" />
<RadioButton labelText="Pro (128 GB)" value="pro" /> <RadioButton labelText="Pro (128 GB)" value="pro" />
</RadioButtonGroup> </RadioButtonGroup>
## With legend text ## Hidden legend
<RadioButtonGroup legendText="Storage tier (disk)" selected="standard"> Visually hide the legend while maintaining accessibility.
<RadioButtonGroup hideLegend legendText="Storage tier (disk)" name="plan-legend" selected="standard">
<RadioButton labelText="Free (1 GB)" value="free" /> <RadioButton labelText="Free (1 GB)" value="free" />
<RadioButton labelText="Standard (10 GB)" value="standard" /> <RadioButton labelText="Standard (10 GB)" value="standard" />
<RadioButton labelText="Pro (128 GB)" value="pro" /> <RadioButton labelText="Pro (128 GB)" value="pro" />
@ -25,10 +31,10 @@ components: ["RadioButtonGroup", "RadioButton", "RadioButtonSkeleton"]
## Legend text slot ## Legend text slot
Use the named "legendText" slot to customize the legend text. Customize the legend text with additional content.
<RadioButtonGroup selected="standard"> <RadioButtonGroup name="plan-legend-slot" selected="standard">
<div slot="legendText" style="display: flex"> <div slot="legendText" style:display="flex">
Storage tier (disk) Storage tier (disk)
<Tooltip> <Tooltip>
<p> <p>
@ -41,27 +47,17 @@ Use the named "legendText" slot to customize the legend text.
<RadioButton labelText="Pro (128 GB)" value="pro" /> <RadioButton labelText="Pro (128 GB)" value="pro" />
</RadioButtonGroup> </RadioButtonGroup>
## Hidden legend
It's recommended that you provide a legend for accessibility.
Use `hideLegend` to visually hide the legend text.
<RadioButtonGroup hideLegend legendText="Storage tier (disk)" selected="standard">
<RadioButton labelText="Free (1 GB)" value="free" />
<RadioButton labelText="Standard (10 GB)" value="standard" />
<RadioButton labelText="Pro (128 GB)" value="pro" />
</RadioButtonGroup>
## Reactive example ## Reactive example
Use the `selected` prop to bind and update the selected value. Bind and update the selected value programmatically.
<FileSource src="/framed/RadioButton/RadioButtonReactive" /> <FileSource src="/framed/RadioButton/RadioButtonReactive" />
## Left-aligned label text ## Left-aligned label text
<RadioButtonGroup labelPosition="left" legendText="Storage tier (disk)" selected="standard"> Position labels to the left of the radio buttons.
<RadioButtonGroup labelPosition="left" legendText="Storage tier (disk)" name="plan-left-aligned" selected="standard">
<RadioButton labelText="Free (1 GB)" value="free" /> <RadioButton labelText="Free (1 GB)" value="free" />
<RadioButton labelText="Standard (10 GB)" value="standard" /> <RadioButton labelText="Standard (10 GB)" value="standard" />
<RadioButton labelText="Pro (128 GB)" value="pro" /> <RadioButton labelText="Pro (128 GB)" value="pro" />
@ -69,7 +65,9 @@ Use the `selected` prop to bind and update the selected value.
## Disabled buttons ## Disabled buttons
<RadioButtonGroup labelPosition="left" legendText="Storage tier (disk)" selected="standard"> Disable specific radio buttons to prevent selection.
<RadioButtonGroup labelPosition="left" legendText="Storage tier (disk)" name="plan-disabled" selected="standard">
<RadioButton disabled labelText="Free (1 GB)" value="free" /> <RadioButton disabled labelText="Free (1 GB)" value="free" />
<RadioButton labelText="Standard (10 GB)" value="standard" /> <RadioButton labelText="Standard (10 GB)" value="standard" />
<RadioButton disabled labelText="Pro (128 GB)" value="pro" /> <RadioButton disabled labelText="Pro (128 GB)" value="pro" />
@ -77,7 +75,9 @@ Use the `selected` prop to bind and update the selected value.
## Vertical orientation ## Vertical orientation
<RadioButtonGroup orientation="vertical" legendText="Storage tier (disk)" selected="standard"> Display radio buttons in a vertical layout.
<RadioButtonGroup orientation="vertical" legendText="Storage tier (disk)" name="plan-vertical" selected="standard">
<RadioButton labelText="Free (1 GB)" value="free" /> <RadioButton labelText="Free (1 GB)" value="free" />
<RadioButton labelText="Standard (10 GB)" value="standard" /> <RadioButton labelText="Standard (10 GB)" value="standard" />
<RadioButton labelText="Pro (128 GB)" value="pro" /> <RadioButton labelText="Pro (128 GB)" value="pro" />
@ -85,6 +85,8 @@ Use the `selected` prop to bind and update the selected value.
## Skeleton ## Skeleton
Show a loading state for horizontal radio buttons.
<RadioButtonGroup legendText="Storage tier (disk)"> <RadioButtonGroup legendText="Storage tier (disk)">
<RadioButtonSkeleton /> <RadioButtonSkeleton />
<RadioButtonSkeleton /> <RadioButtonSkeleton />
@ -93,6 +95,8 @@ Use the `selected` prop to bind and update the selected value.
## Skeleton (vertical) ## Skeleton (vertical)
Show a loading state for vertical radio buttons.
<RadioButtonGroup orientation="vertical" legendText="Storage tier (disk)"> <RadioButtonGroup orientation="vertical" legendText="Storage tier (disk)">
<RadioButtonSkeleton /> <RadioButtonSkeleton />
<RadioButtonSkeleton /> <RadioButtonSkeleton />

View file

@ -7,54 +7,64 @@ components: ["TileGroup", "RadioTile"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`RadioTile` provides a selectable tile interface for choosing a single option from a set. It supports both individual and grouped usage, with options for light and disabled states.
## Default ## Default
<TileGroup legend="Service pricing tiers"> Create a group of radio tiles with a shared name and legend.
<RadioTile value="0" checked>
<TileGroup legend="Service pricing tiers" name="plan" selected="standard">
<RadioTile value="lite">
Lite plan Lite plan
</RadioTile> </RadioTile>
<RadioTile value="1"> <RadioTile value="standard">
Standard plan Standard plan
</RadioTile> </RadioTile>
<RadioTile value="2"> <RadioTile value="plus">
Plus plan Plus plan
</RadioTile> </RadioTile>
</TileGroup> </TileGroup>
## Reactive (one-way binding) ## Reactive (one-way binding)
Update the selected value using the `select` event.
<FileSource src="/framed/RadioTile/RadioTileReactiveOneWay" /> <FileSource src="/framed/RadioTile/RadioTileReactiveOneWay" />
## Reactive (two-way binding) ## Reactive (two-way binding)
Binding to the `selected` prop is a more concise approach to managing state. Bind to the `selected` prop for simpler state management.
<FileSource src="/framed/RadioTile/RadioTileReactive" /> <FileSource src="/framed/RadioTile/RadioTileReactive" />
## Light variant ## Light variant
<TileGroup legend="Service pricing tiers"> Use the light variant for light backgrounds.
<RadioTile light value="0" checked>
<TileGroup legend="Service pricing tiers" name="plan-light" selected="standard">
<RadioTile light value="lite">
Lite plan Lite plan
</RadioTile> </RadioTile>
<RadioTile light value="1"> <RadioTile light value="standard">
Standard plan Standard plan
</RadioTile> </RadioTile>
<RadioTile light value="2"> <RadioTile light value="plus">
Plus plan Plus plan
</RadioTile> </RadioTile>
</TileGroup> </TileGroup>
## Disabled state ## Disabled state
<TileGroup legend="Service pricing tiers"> Disable specific tiles to prevent selection.
<RadioTile value="0" checked>
<TileGroup legend="Service pricing tiers" name="plan-disabled" selected="standard">
<RadioTile value="lite" disabled>
Lite plan Lite plan
</RadioTile> </RadioTile>
<RadioTile value="1" disabled> <RadioTile value="standard">
Standard plan Standard plan
</RadioTile> </RadioTile>
<RadioTile value="2" disabled> <RadioTile value="plus" disabled>
Plus plan Plus plan
</RadioTile> </RadioTile>
</TileGroup> </TileGroup>

View file

@ -1,11 +1,15 @@
<script> <script>
import { InlineNotification, RecursiveList } from "carbon-components-svelte"; import { InlineNotification, RecursiveList, Link } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
This component uses the [svelte:self API](https://svelte.dev/docs#svelte_self) to render the [UnorderedList](/components/UnorderedList) and [OrderedList](/components/OrderedList) components with tree structured data. `RecursiveList` provides a flexible way to render hierarchical data structures using either unordered or ordered lists. It supports nested nodes, links, and HTML content, making it ideal for displaying complex data hierarchies.
A child node can render text, a link, HTML content, and other children. <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">
In version 0.86.0, the <strong>children</strong> prop was renamed to <strong>nodes</strong> for <Link target="_blank" href="https://svelte.dev/docs/svelte/v5-migration-guide#The-children-prop-is-reserved">Svelte 5 compatibility</Link>.
</div>
</InlineNotification>
<InlineNotification svx-ignore lowContrast title="Warning:" kind="warning" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Warning:" kind="warning" hideCloseButton>
<div class="body-short-01"> <div class="body-short-01">
@ -13,22 +17,26 @@ A child node can render text, a link, HTML content, and other children.
</div> </div>
</InlineNotification> </InlineNotification>
## Unordered ## Default
The `children` prop accepts an array of child nodes. Create a hierarchical list using the `nodes` prop. Each node can contain text, links, HTML content, and nested nodes.
By default, the list type is unordered.
<FileSource src="/framed/RecursiveList/RecursiveList" /> <FileSource src="/framed/RecursiveList/RecursiveList" />
## Ordered ## Ordered
Set `type` to `"ordered"` to use the ordered list variant. Set `type` to `"ordered"` to use numbered lists with proper indentation.
<FileSource src="/framed/RecursiveList/RecursiveListOrdered" /> <FileSource src="/framed/RecursiveList/RecursiveListOrdered" />
## Ordered (native styles) ## Ordered (native styles)
Set `type` to `"ordered-native"` to use the native styles for an ordered list. Set `type` to `"ordered-native"` to use browser-native numbering styles.
<FileSource src="/framed/RecursiveList/RecursiveListOrderedNative" /> <FileSource src="/framed/RecursiveList/RecursiveListOrderedNative" />
## Flat data structure
Convert flat data structures to hierarchical arrays using the `toHierarchy` utility function.
<FileSource src="/framed/RecursiveList/RecursiveListFlatArray" />

View file

@ -4,54 +4,72 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Search` provides a flexible search input component with support for expandable variants, different sizes, and custom icons. It includes built-in functionality for clearing input and handling keyboard events.
## Default ## Default
The `Search` component size is extra-large by default. There are [large](#large-size) and [small](#small-size) size variants. The search component is extra-large by default. Use the `size` prop to choose between [large](#large-size) and [small](#small-size) variants.
<Search /> <Search />
## Default value ## Default value
Set an initial value using the `value` prop.
<Search placeholder="Search catalog..." value="Cloud functions" /> <Search placeholder="Search catalog..." value="Cloud functions" />
## Reactive example ## Reactive example
Bind to the `value` prop for reactive updates.
<FileSource src="/framed/Search/SearchReactive" /> <FileSource src="/framed/Search/SearchReactive" />
## on:clear ## Clear event
The "clear" event is dispatched when clicking the "X" button or when pressing the "Escape" key. The `clear` event is dispatched when clicking the clear button or pressing the Escape key.
<Search value="Cloud functions" on:clear={() => console.log('clear')}/> <Search value="Cloud functions" on:clear={() => console.log('clear')}/>
## Expandable variant ## Expandable variant
Set `expandable` to `true` to use the expandable variant. Enable the expandable variant to show a compact search icon that expands on focus.
<FileSource src="/framed/Search/SearchExpandableReactive" /> <FileSource src="/framed/Search/SearchExpandableReactive" />
## Light variant ## Light variant
Use the light variant for light backgrounds.
<Search light /> <Search light />
## Large size ## Large size
Set `size` to `"lg"` for a large search input.
<Search size="lg" /> <Search size="lg" />
## Small size ## Small size
Set `size` to `"sm"` for a small search input.
<Search size="sm" /> <Search size="sm" />
## Disabled state ## Disabled state
Disable the search input using the `disabled` prop.
<Search disabled /> <Search disabled />
## Custom search icon ## Custom icon
Replace the default search icon with a custom one.
<Search icon={Query} /> <Search icon={Query} />
## Skeleton ## Skeleton
Display a loading state using the skeleton variant.
<Search skeleton /> <Search skeleton />
## Skeleton (large) ## Skeleton (large)

View file

@ -7,9 +7,11 @@ components: ["Select", "SelectItem", "SelectItemGroup", "SelectSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Select` provides a dropdown menu for selecting a single option from a list. It supports various states, sizes, and includes built-in validation and helper text.
## Default ## Default
If the `selected` prop is not set, the value of the first `SelectItem` will be used as the default value. Create a basic select menu with `SelectItem` components. The first item's value is used as the default if `selected` is not set.
<Select labelText="Carbon theme" on:change={e => console.log("value", e.target.value)}> <Select labelText="Carbon theme" on:change={e => console.log("value", e.target.value)}>
<SelectItem value="white" /> <SelectItem value="white" />
@ -21,7 +23,7 @@ If the `selected` prop is not set, the value of the first `SelectItem` will be u
## Custom item text ## Custom item text
Use the `text` prop on `SelectItem` to customize the display value. Use the `text` prop to customize the display text of each option.
<Select labelText="Carbon theme" on:change={e => console.log("value", e.target.value)}> <Select labelText="Carbon theme" on:change={e => console.log("value", e.target.value)}>
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
@ -33,7 +35,7 @@ Use the `text` prop on `SelectItem` to customize the display value.
## Initial selected value ## Initial selected value
Use the `selected` prop to specify an initial value. Set the initial selection using the `selected` prop.
<Select labelText="Carbon theme" selected="g10" on:change={e => console.log("value", e.target.value)}> <Select labelText="Carbon theme" selected="g10" on:change={e => console.log("value", e.target.value)}>
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
@ -45,12 +47,14 @@ Use the `selected` prop to specify an initial value.
## Reactive example ## Reactive example
The `selected` prop is reactive and supports two-way binding. The `selected` prop supports two-way binding for reactive updates.
<FileSource src="/framed/Select/SelectReactive" /> <FileSource src="/framed/Select/SelectReactive" />
## Helper text ## Helper text
Add descriptive text below the select menu.
<Select helperText="Carbon offers 4 themes (2 light, 3 dark)" labelText="Carbon theme" selected="g10" > <Select helperText="Carbon offers 4 themes (2 light, 3 dark)" labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
@ -61,6 +65,8 @@ The `selected` prop is reactive and supports two-way binding.
## Hidden label ## Hidden label
Visually hide the label while maintaining accessibility.
<Select hideLabel labelText="Carbon theme" selected="g10" > <Select hideLabel labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
@ -71,6 +77,8 @@ The `selected` prop is reactive and supports two-way binding.
## Item groups ## Item groups
Group related options using `SelectItemGroup` components.
<Select labelText="Carbon theme" selected="0"> <Select labelText="Carbon theme" selected="0">
<SelectItem value="0" text="Select a theme" disabled hidden /> <SelectItem value="0" text="Select a theme" disabled hidden />
<SelectItemGroup label="Light theme"> <SelectItemGroup label="Light theme">
@ -84,38 +92,10 @@ The `selected` prop is reactive and supports two-way binding.
</SelectItemGroup> </SelectItemGroup>
</Select> </Select>
## Light variant
<Select light labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" />
<SelectItem value="g80" text="Gray 80" />
<SelectItem value="g90" text="Gray 90" />
<SelectItem value="g100" text="Gray 100" />
</Select>
## Inline variant
<Select inline labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" />
<SelectItem value="g80" text="Gray 80" />
<SelectItem value="g90" text="Gray 90" />
<SelectItem value="g100" text="Gray 100" />
</Select>
## Extra-large size
<Select size="xl" labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" />
<SelectItem value="g80" text="Gray 80" />
<SelectItem value="g90" text="Gray 90" />
<SelectItem value="g100" text="Gray 100" />
</Select>
## Small size ## Small size
Use the small size variant for compact layouts.
<Select size="sm" labelText="Carbon theme" selected="g10" > <Select size="sm" labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
@ -124,8 +104,46 @@ The `selected` prop is reactive and supports two-way binding.
<SelectItem value="g100" text="Gray 100" /> <SelectItem value="g100" text="Gray 100" />
</Select> </Select>
## Extra-large size
Use the extra-large size variant for prominent selections.
<Select size="xl" labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" />
<SelectItem value="g80" text="Gray 80" />
<SelectItem value="g90" text="Gray 90" />
<SelectItem value="g100" text="Gray 100" />
</Select>
## Inline variant
Use the inline variant for horizontal layouts.
<Select inline labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" />
<SelectItem value="g80" text="Gray 80" />
<SelectItem value="g90" text="Gray 90" />
<SelectItem value="g100" text="Gray 100" />
</Select>
## Light variant
Use the light variant for light backgrounds.
<Select light labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" />
<SelectItem value="g80" text="Gray 80" />
<SelectItem value="g90" text="Gray 90" />
<SelectItem value="g100" text="Gray 100" />
</Select>
## Invalid state ## Invalid state
Show validation errors using the invalid state.
<Select invalid invalidText="Theme must be a dark variant" labelText="Carbon theme" selected="g10" > <Select invalid invalidText="Theme must be a dark variant" labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
@ -136,6 +154,8 @@ The `selected` prop is reactive and supports two-way binding.
## Warning state ## Warning state
Show warnings using the warning state.
<Select warn warnText="The selected theme will not be persisted" labelText="Carbon theme" selected="g10" > <Select warn warnText="The selected theme will not be persisted" labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
@ -146,6 +166,8 @@ The `selected` prop is reactive and supports two-way binding.
## Disabled state ## Disabled state
Disable the select menu to prevent interaction.
<Select disabled labelText="Carbon theme" selected="g10" > <Select disabled labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
@ -156,6 +178,8 @@ The `selected` prop is reactive and supports two-way binding.
## Skeleton ## Skeleton
Display a loading state using the skeleton variant.
<SelectSkeleton /> <SelectSkeleton />
## Skeleton (hidden label) ## Skeleton (hidden label)

View file

@ -7,8 +7,12 @@ components: ["SelectableTile"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`SelectableTile` provides a tile-based selection interface that allows users to select multiple options. It supports various states and includes built-in keyboard navigation and accessibility features.
## Multi-selectable tiles ## Multi-selectable tiles
Group multiple selectable tiles together for multi-selection scenarios.
<div role="group" aria-label="selectable tiles"> <div role="group" aria-label="selectable tiles">
<SelectableTile selected> <SelectableTile selected>
Multi-select Tile Multi-select Tile
@ -23,6 +27,8 @@ components: ["SelectableTile"]
## Light variant ## Light variant
Use the light variant for light backgrounds.
<div role="group" aria-label="selectable tiles"> <div role="group" aria-label="selectable tiles">
<SelectableTile light selected> <SelectableTile light selected>
Multi-select Tile Multi-select Tile
@ -37,6 +43,8 @@ components: ["SelectableTile"]
## Disabled state ## Disabled state
Disable tiles to prevent interaction.
<div role="group" aria-label="selectable tiles"> <div role="group" aria-label="selectable tiles">
<SelectableTile selected> <SelectableTile selected>
Multi-select Tile Multi-select Tile

View file

@ -3,10 +3,16 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`SkeletonPlaceholder` provides a loading state placeholder that can be used to indicate content is being loaded. It supports custom sizing and forwards mouse events for interactive loading states.
## Default ## Default
Create a basic skeleton placeholder with default styling.
<SkeletonPlaceholder /> <SkeletonPlaceholder />
## Custom size ## Custom size
Specify custom dimensions using the `style` prop.
<SkeletonPlaceholder style="height: 12rem; width: 12rem;" /> <SkeletonPlaceholder style="height: 12rem; width: 12rem;" />

View file

@ -3,22 +3,34 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`SkeletonText` provides a loading state for text content with support for different sizes and line counts. It's commonly used to indicate that text content is being loaded.
## Default ## Default
Create a basic skeleton text with default styling.
<SkeletonText /> <SkeletonText />
## Heading variant ## Heading variant
Use the heading variant for larger text placeholders.
<SkeletonText heading /> <SkeletonText heading />
## Paragraph variant ## Paragraph variant
Use the paragraph variant for multi-line text placeholders.
<SkeletonText paragraph /> <SkeletonText paragraph />
## Paragraph with custom line count ## Paragraph with custom line count
Specify the number of lines to render using the `lines` prop.
<SkeletonText paragraph lines={8} /> <SkeletonText paragraph lines={8} />
## Paragraph with max width ## Paragraph with max width
Set a custom width for the text placeholder using the `width` prop.
<SkeletonText paragraph width="50%" /> <SkeletonText paragraph width="50%" />

View file

@ -7,8 +7,12 @@ components: ["Slider", "SliderSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Slider` provides a visual way to select a value from a range. It supports keyboard navigation, custom ranges, step values, and various states.
## Default ## Default
Create a basic slider with a label and default range (0-100).
<Slider labelText="Instances" value={0} /> <Slider labelText="Instances" value={0} />
## Full width ## Full width
@ -17,34 +21,56 @@ Set `fullWidth` to `true` for the slider to span the full width of its containin
<Slider labelText="Instances" fullWidth value={0} /> <Slider labelText="Instances" fullWidth value={0} />
## Hidden label
Visually hide the label while maintaining accessibility.
<Slider labelText="Instances" hideLabel value={0} />
## Hidden text input ## Hidden text input
Hide the text input while keeping the slider functionality.
<Slider labelText="Instances" hideTextInput value={0} /> <Slider labelText="Instances" hideTextInput value={0} />
## Custom minimum, maximum values ## Custom minimum, maximum values
Set custom range values and labels.
<Slider labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} /> <Slider labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} />
## Custom step value ## Custom step value
Specify the step value for more precise control.
<Slider labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} /> <Slider labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} />
## Light variant ## Light variant
Use the light variant for light backgrounds.
<Slider light labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} /> <Slider light labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} />
## Invalid state ## Invalid state
Indicate an invalid state with the `invalid` prop.
<Slider invalid labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} /> <Slider invalid labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} />
## Disabled state ## Disabled state
Disable the slider to prevent interaction.
<Slider disabled labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} /> <Slider disabled labelText="Runtime memory (MB)" min={10} max={990} maxLabel="990 MB" value={100} step={10} />
## Skeleton ## Skeleton
Show a loading state with the skeleton variant.
<SliderSkeleton /> <SliderSkeleton />
## Skeleton (hidden label) ## Skeleton (hidden label)
Show a loading state without a label.
<SliderSkeleton hideLabel /> <SliderSkeleton hideLabel />

View file

@ -8,7 +8,11 @@ components: ["StructuredList", "StructuredListSkeleton", "StructuredListBody", "
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
## Default (read-only) `StructuredList` provides a semantic way to display tabular data with support for selection, keyboard navigation, and various layout options.
## Default
Display a basic structured list with headers and rows by default.
<StructuredList> <StructuredList>
<StructuredListHead> <StructuredListHead>
@ -20,40 +24,27 @@ components: ["StructuredList", "StructuredListSkeleton", "StructuredListBody", "
</StructuredListHead> </StructuredListHead>
<StructuredListBody> <StructuredListBody>
<StructuredListRow> <StructuredListRow>
<StructuredListCell noWrap>Row 1</StructuredListCell>
<StructuredListCell>Row 1</StructuredListCell> <StructuredListCell>Row 1</StructuredListCell>
<StructuredListCell> <StructuredListCell>Row 1</StructuredListCell>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dui <StructuredListCell>Row 1</StructuredListCell>
magna, finibus id tortor sed, aliquet bibendum augue. Aenean posuere
sem vel euismod dignissim. Nulla ut cursus dolor. Pellentesque
vulputate nisl a porttitor interdum.
</StructuredListCell>
</StructuredListRow> </StructuredListRow>
<StructuredListRow> <StructuredListRow>
<StructuredListCell noWrap>Row 2</StructuredListCell>
<StructuredListCell>Row 2</StructuredListCell> <StructuredListCell>Row 2</StructuredListCell>
<StructuredListCell> <StructuredListCell>Row 2</StructuredListCell>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dui <StructuredListCell>Row 2</StructuredListCell>
magna, finibus id tortor sed, aliquet bibendum augue. Aenean posuere
sem vel euismod dignissim. Nulla ut cursus dolor. Pellentesque
vulputate nisl a porttitor interdum.
</StructuredListCell>
</StructuredListRow> </StructuredListRow>
<StructuredListRow> <StructuredListRow>
<StructuredListCell noWrap>Row 3</StructuredListCell>
<StructuredListCell>Row 3</StructuredListCell> <StructuredListCell>Row 3</StructuredListCell>
<StructuredListCell> <StructuredListCell>Row 3</StructuredListCell>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dui <StructuredListCell>Row 3</StructuredListCell>
magna, finibus id tortor sed, aliquet bibendum augue. Aenean posuere
sem vel euismod dignissim. Nulla ut cursus dolor. Pellentesque
vulputate nisl a porttitor interdum.
</StructuredListCell>
</StructuredListRow> </StructuredListRow>
</StructuredListBody> </StructuredListBody>
</StructuredList> </StructuredList>
## Condensed variant ## Condensed variant
Use the condensed variant for more compact rows.
<StructuredList condensed> <StructuredList condensed>
<StructuredListHead> <StructuredListHead>
<StructuredListRow head> <StructuredListRow head>
@ -64,39 +55,26 @@ components: ["StructuredList", "StructuredListSkeleton", "StructuredListBody", "
</StructuredListHead> </StructuredListHead>
<StructuredListBody> <StructuredListBody>
<StructuredListRow> <StructuredListRow>
<StructuredListCell noWrap>Row 1</StructuredListCell>
<StructuredListCell>Row 1</StructuredListCell> <StructuredListCell>Row 1</StructuredListCell>
<StructuredListCell> <StructuredListCell>Row 1</StructuredListCell>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dui <StructuredListCell>Row 1</StructuredListCell>
magna, finibus id tortor sed, aliquet bibendum augue. Aenean posuere
sem vel euismod dignissim. Nulla ut cursus dolor. Pellentesque
vulputate nisl a porttitor interdum.
</StructuredListCell>
</StructuredListRow> </StructuredListRow>
<StructuredListRow> <StructuredListRow>
<StructuredListCell noWrap>Row 2</StructuredListCell>
<StructuredListCell>Row 2</StructuredListCell> <StructuredListCell>Row 2</StructuredListCell>
<StructuredListCell> <StructuredListCell>Row 2</StructuredListCell>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dui <StructuredListCell>Row 2</StructuredListCell>
magna, finibus id tortor sed, aliquet bibendum augue. Aenean posuere
sem vel euismod dignissim. Nulla ut cursus dolor. Pellentesque
vulputate nisl a porttitor interdum.
</StructuredListCell>
</StructuredListRow> </StructuredListRow>
<StructuredListRow> <StructuredListRow>
<StructuredListCell noWrap>Row 3</StructuredListCell>
<StructuredListCell>Row 3</StructuredListCell> <StructuredListCell>Row 3</StructuredListCell>
<StructuredListCell> <StructuredListCell>Row 3</StructuredListCell>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dui <StructuredListCell>Row 3</StructuredListCell>
magna, finibus id tortor sed, aliquet bibendum augue. Aenean posuere
sem vel euismod dignissim. Nulla ut cursus dolor. Pellentesque
vulputate nisl a porttitor interdum.
</StructuredListCell>
</StructuredListRow> </StructuredListRow>
</StructuredListBody> </StructuredListBody>
</StructuredList> </StructuredList>
## Flush ## Flush variant
Use the flush variant to remove padding from the list.
<StructuredList flush> <StructuredList flush>
<StructuredListHead> <StructuredListHead>
@ -142,6 +120,8 @@ components: ["StructuredList", "StructuredListSkeleton", "StructuredListBody", "
## Selectable rows ## Selectable rows
Enable row selection with the `selection` prop and `StructuredListInput` components.
<StructuredList selection selected="row-1-value"> <StructuredList selection selected="row-1-value">
<StructuredListHead> <StructuredListHead>
<StructuredListRow head> <StructuredListRow head>
@ -182,4 +162,6 @@ components: ["StructuredList", "StructuredListSkeleton", "StructuredListBody", "
## Skeleton ## Skeleton
Show a loading state with the skeleton variant.
<StructuredListSkeleton rows={3} /> <StructuredListSkeleton rows={3} />

View file

@ -7,8 +7,12 @@ components: ["Tabs", "Tab", "TabContent", "TabsSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Tabs` provides a way to organize content into separate views that can be switched between. It supports keyboard navigation, disabled states, and various layout options.
## Default ## Default
Create a basic tab interface with labels and content.
<Tabs> <Tabs>
<Tab label="Tab label 1" /> <Tab label="Tab label 1" />
<Tab label="Tab label 2" /> <Tab label="Tab label 2" />
@ -22,9 +26,7 @@ components: ["Tabs", "Tab", "TabContent", "TabsSkeleton"]
## Auto width ## Auto width
By default, the width of each tab is set to `10rem`. By default, each tab has a fixed width of `10rem`. Set `autoWidth` to `true` for tabs to automatically adjust their width based on content.
Set `autoWidth` to `true` for tabs to have an automatically set width.
<Tabs autoWidth> <Tabs autoWidth>
<Tab label="Tab label 1" /> <Tab label="Tab label 1" />
@ -39,13 +41,13 @@ Set `autoWidth` to `true` for tabs to have an automatically set width.
## Reactive example ## Reactive example
Use `bind:selected` to create a two-way binding with the selected tab index. This allows you to programmatically control the selected tab and react to tab changes.
<FileSource src="/framed/Tabs/TabsReactive" /> <FileSource src="/framed/Tabs/TabsReactive" />
## Disabled tabs ## Disabled tabs
Setting `disabled` to `true` on the `Tab` component will prevent it from being clickable. Set `disabled` to `true` on a `Tab` component to prevent interaction. Keyboard navigation will skip disabled tabs.
Using keyboard navigation (left and right arrow keys) will skip to the next non-disabled tab.
<Tabs> <Tabs>
<Tab label="Tab label 1" /> <Tab label="Tab label 1" />
@ -62,6 +64,8 @@ Using keyboard navigation (left and right arrow keys) will skip to the next non-
## Container type ## Container type
Use the container type for a more prominent tab interface.
<Tabs type="container"> <Tabs type="container">
<Tab label="Tab label 1" /> <Tab label="Tab label 1" />
<Tab label="Tab label 2" /> <Tab label="Tab label 2" />
@ -75,8 +79,12 @@ Using keyboard navigation (left and right arrow keys) will skip to the next non-
## Skeleton (default) ## Skeleton (default)
Show a loading state with the default skeleton variant.
<TabsSkeleton count={3} /> <TabsSkeleton count={3} />
## Skeleton (container) ## Skeleton (container)
Show a loading state with the container skeleton variant.
<TabsSkeleton type="container" count={3} /> <TabsSkeleton type="container" count={3} />

View file

@ -1,19 +1,31 @@
---
components: ["Tag", "TagSkeleton"]
---
<script> <script>
import { Tag } from "carbon-components-svelte"; import { Tag, TooltipDefinition } from "carbon-components-svelte";
import IbmCloud from "carbon-icons-svelte/lib/IbmCloud.svelte"; import IbmCloud from "carbon-icons-svelte/lib/IbmCloud.svelte";
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Tag` provides a way to categorize content with a keyword or label. It supports various styles, sizes, and interactive states, including filterable and interactive variants.
## Default ## Default
Create a basic tag with text content.
<Tag>IBM Cloud</Tag> <Tag>IBM Cloud</Tag>
## Small size ## Small size
Use the small size variant for more compact layouts.
<Tag size="sm">IBM Cloud</Tag> <Tag size="sm">IBM Cloud</Tag>
## Tag types ## Tag types
Choose from a variety of color types to match your design system.
<Tag type="red">red</Tag> <Tag type="red">red</Tag>
<Tag type="magenta">magenta</Tag> <Tag type="magenta">magenta</Tag>
<Tag type="purple">purple</Tag> <Tag type="purple">purple</Tag>
@ -29,39 +41,59 @@
## Filterable ## Filterable
Create a filterable tag with a close button that dispatches a `close` event when clicked.
<Tag filter on:close>carbon-components</Tag> <Tag filter on:close>carbon-components</Tag>
## Filterable (disabled) ## Filterable (disabled)
Disable a filterable tag to prevent interaction.
<Tag filter disabled on:close>carbon-components</Tag> <Tag filter disabled on:close>carbon-components</Tag>
## Filterable (small) ## Filterable (small)
Combine the filterable variant with the small size.
<Tag size="sm" filter on:close>carbon-components</Tag> <Tag size="sm" filter on:close>carbon-components</Tag>
## Custom icon ## Custom icon
Note: rendering a custom icon cannot be used with the filterable variant. Add a custom icon to the tag. Note: custom icons cannot be used with the filterable variant.
<Tag icon={IbmCloud}>IBM Cloud</Tag> <Tag icon={IbmCloud}>IBM Cloud</Tag>
## Interactive variant ## Interactive variant
Set `interactive` to `true` to render a `button` element instead of a `div`. Set `interactive` to `true` to render a `button` element instead of a `div`. This is useful for clickable tags.
<Tag interactive>Machine learning</Tag> <Tag interactive>Machine learning</Tag>
## Disabled ## Disabled
The filterable and interactive tag variants have a disabled state. Both filterable and interactive tag variants support a disabled state.
<Tag filter disabled>Machine learning</Tag> <Tag filter disabled>Machine learning</Tag>
<Tag interactive disabled>Machine learning</Tag> <Tag interactive disabled>Machine learning</Tag>
## Tooltip in a tag
Embed a tooltip within a tag to provide additional context.
<Tag>
<TooltipDefinition tooltipText="IBM Corporate Headquarters is based in Armonk, New York.">
Armonk
</TooltipDefinition>
</Tag>
## Skeleton ## Skeleton
Show a loading state with the default skeleton variant.
<Tag skeleton /> <Tag skeleton />
## Skeleton (small) ## Skeleton (small)
Show a loading state with the small skeleton variant.
<Tag size="sm" skeleton /> <Tag size="sm" skeleton />

View file

@ -7,46 +7,64 @@ components: ["TextArea", "TextAreaSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`TextArea` provides a multi-line text input field with support for various states, character counting, and accessibility features. It's ideal for longer text input like descriptions, comments, or messages.
## Default ## Default
Create a basic textarea with a label and placeholder text.
<TextArea labelText="App description" placeholder="Enter a description..." /> <TextArea labelText="App description" placeholder="Enter a description..." />
## Maximum character count ## Maximum character count
Specify the max character count using the `maxCount` prop. A character counter will be displayed to the right of the label. Specify the max character count using the `maxCount` prop. A character counter will be displayed to the right of the label. You can also use the native `maxlength` attribute if you prefer not to show a counter.
You can always use the native `maxlength` attribute if you'd prefer that a counter not be shown.
<TextArea labelText="App description" placeholder="Enter a description..." maxCount={100} /> <TextArea labelText="App description" placeholder="Enter a description..." maxCount={100} />
## With helper text ## With helper text
Add helper text below the textarea to provide additional context or instructions.
<TextArea labelText="App description" helperText="A rich description helps us better recommend related products and services" placeholder="Enter a description..." /> <TextArea labelText="App description" helperText="A rich description helps us better recommend related products and services" placeholder="Enter a description..." />
## Hidden label ## Hidden label
Visually hide the label while maintaining accessibility by setting `hideLabel` to `true`.
<TextArea hideLabel labelText="App description" placeholder="Enter a description..." /> <TextArea hideLabel labelText="App description" placeholder="Enter a description..." />
## Light variant ## Light variant
Use the light variant for light-themed backgrounds by setting `light` to `true`.
<TextArea light labelText="App description" placeholder="Enter a description..." /> <TextArea light labelText="App description" placeholder="Enter a description..." />
## Custom rows ## Custom rows
Adjust the number of visible rows using the `rows` prop. The default is 4 rows.
<TextArea rows={10} labelText="App description" placeholder="Enter a description..." /> <TextArea rows={10} labelText="App description" placeholder="Enter a description..." />
## Invalid state ## Invalid state
Indicate an invalid state with an error message by setting `invalid` to `true` and providing `invalidText`.
<TextArea invalid invalidText="Only plain text characters are allowed" labelText="App description" placeholder="Enter a description..." /> <TextArea invalid invalidText="Only plain text characters are allowed" labelText="App description" placeholder="Enter a description..." />
## Disabled state ## Disabled state
Disable the textarea to prevent user interaction by setting `disabled` to `true`.
<TextArea disabled labelText="App description" placeholder="Enter a description..." /> <TextArea disabled labelText="App description" placeholder="Enter a description..." />
## Skeleton ## Skeleton
Show a loading state with the default skeleton variant.
<TextAreaSkeleton /> <TextAreaSkeleton />
## Skeleton without label ## Skeleton without label
Show a loading state without a label by setting `hideLabel` to `true`.
<TextAreaSkeleton hideLabel /> <TextAreaSkeleton hideLabel />

View file

@ -7,54 +7,82 @@ components: ["TextInput", "TextInputSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`TextInput` provides a single-line text input field with support for various states, sizes, and accessibility features. It's ideal for short text input like usernames, search terms, or form fields.
## Default ## Default
Create a basic text input with a label and placeholder text.
<TextInput labelText="User name" placeholder="Enter user name..." /> <TextInput labelText="User name" placeholder="Enter user name..." />
## With helper text ## With helper text
Add helper text below the input to provide additional context or instructions.
<TextInput labelText="User name" helperText="Your user name is associated with your email" placeholder="Enter user name..." /> <TextInput labelText="User name" helperText="Your user name is associated with your email" placeholder="Enter user name..." />
## Hidden label ## Hidden label
Visually hide the label while maintaining accessibility by setting `hideLabel` to `true`.
<TextInput hideLabel labelText="User name" placeholder="Enter user name..." /> <TextInput hideLabel labelText="User name" placeholder="Enter user name..." />
## Light variant ## Light variant
Use the light variant for light-themed backgrounds by setting `light` to `true`.
<TextInput light labelText="User name" placeholder="Enter user name..." /> <TextInput light labelText="User name" placeholder="Enter user name..." />
## Inline variant ## Inline variant
Use the inline variant to display the label and input on the same line by setting `inline` to `true`.
<TextInput inline labelText="User name" placeholder="Enter user name..." /> <TextInput inline labelText="User name" placeholder="Enter user name..." />
## Read-only variant ## Read-only variant
Display a non-editable value by setting `readonly` to `true`.
<TextInput readonly labelText="User name" value="IBM" /> <TextInput readonly labelText="User name" value="IBM" />
## Extra-large size ## Extra-large size
Use the extra-large size for more prominent inputs by setting `size` to `"xl"`.
<TextInput size="xl" labelText="User name" placeholder="Enter user name..." /> <TextInput size="xl" labelText="User name" placeholder="Enter user name..." />
## Small size ## Small size
Use the small size for more compact inputs by setting `size` to `"sm"`.
<TextInput size="sm" labelText="User name" placeholder="Enter user name..." /> <TextInput size="sm" labelText="User name" placeholder="Enter user name..." />
## Invalid state ## Invalid state
Indicate an invalid state with an error message by setting `invalid` to `true` and providing `invalidText`.
<TextInput invalid invalidText="User name is already taken. Please try another." labelText="User name" placeholder="Enter user name..." /> <TextInput invalid invalidText="User name is already taken. Please try another." labelText="User name" placeholder="Enter user name..." />
## Warning state ## Warning state
Indicate a warning state with a message by setting `warn` to `true` and providing `warnText`.
<TextInput warn warnText="Your user name is different from your log in ID." labelText="User name" placeholder="Enter user name..." /> <TextInput warn warnText="Your user name is different from your log in ID." labelText="User name" placeholder="Enter user name..." />
## Disabled state ## Disabled state
Disable the input to prevent user interaction by setting `disabled` to `true`.
<TextInput disabled labelText="User name" placeholder="Enter user name..." /> <TextInput disabled labelText="User name" placeholder="Enter user name..." />
## Skeleton ## Skeleton
Show a loading state with the default skeleton variant.
<TextInputSkeleton /> <TextInputSkeleton />
## Skeleton without label ## Skeleton without label
Show a loading state without a label by setting `hideLabel` to `true`.
<TextInputSkeleton hideLabel /> <TextInputSkeleton hideLabel />

View file

@ -1,3 +1,7 @@
---
components: ["Theme"]
---
<script> <script>
import { InlineNotification, CodeSnippet } from "carbon-components-svelte"; import { InlineNotification, CodeSnippet } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
@ -5,7 +9,7 @@
let code = `import "carbon-components-svelte/css/all.css";`; let code = `import "carbon-components-svelte/css/all.css";`;
</script> </script>
The `Theme` component can dyanmically update the Carbon theme on the client-side. It can persist the theme locally using [window.localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). The `Theme` component provides dynamic client-side theming using CSS variables. It supports five Carbon themes: white, g10, g80, g90, and g100, and allows for custom theme token overrides. The component can persist theme preferences using [window.localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) and provides built-in toggle and select controls for theme switching.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">You must use the "all.css" StyleSheet with the <code>Theme</code> component.</div> <div class="body-short-01">You must use the "all.css" StyleSheet with the <code>Theme</code> component.</div>
@ -17,40 +21,42 @@ The `all.css` StyleSheet uses [CSS variables](https://developer.mozilla.org/en-U
## Default ## Default
Create a basic theme component that can be controlled programmatically.
<FileSource src="/framed/Theme/Theme" /> <FileSource src="/framed/Theme/Theme" />
## Persist locally ## Persist locally
Set `persist` to `true` to persist the theme locally using the [Window.localStorage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). Set `persist` to `true` to save the theme preference in [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage). Use `persistKey` to specify a custom storage key.
<FileSource src="/framed/Theme/ThemePersist" /> <FileSource src="/framed/Theme/ThemePersist" />
## Custom theme ## Custom theme
Define keys and values in the `tokens` prop that override default Carbon theme tokens. Refer to the [Carbon website](https://carbondesignsystem.com/guidelines/themes/overview#customizing-a-theme) for guidance on customizing a theme using token values. Override default Carbon theme tokens by providing custom key-value pairs in the `tokens` prop. Refer to the [Carbon website](https://carbondesignsystem.com/guidelines/themes/overview#customizing-a-theme) for guidance on customizing themes.
<FileSource src="/framed/Theme/ThemeTokens" /> <FileSource src="/framed/Theme/ThemeTokens" />
## Theme toggle ## Theme toggle
Set `render` to `"toggle"` to render a toggle switch to control the theme. Set `render` to `"toggle"` to display a toggle switch for switching between two themes. By default, it toggles between "white" and "g100" themes.
<FileSource src="/framed/Theme/ThemeToggle" /> <FileSource src="/framed/Theme/ThemeToggle" />
## Theme toggle (custom) ## Theme toggle (custom)
Customize the toggle using the `toggle` prop. Customize the toggle appearance and behavior using the `toggle` prop. You can specify custom themes, labels, and other toggle properties.
<FileSource src="/framed/Theme/ThemeToggleCustom" /> <FileSource src="/framed/Theme/ThemeToggleCustom" />
## Theme select ## Theme select
Set `render` to `"select"` to render a select dropdown to control the theme. Set `render` to `"select"` to display a dropdown menu for selecting from all available themes.
<FileSource src="/framed/Theme/ThemeSelect" /> <FileSource src="/framed/Theme/ThemeSelect" />
## Theme select (custom) ## Theme select (custom)
Customize the select using the `select` prop. Customize the select dropdown using the `select` prop. You can specify which themes to include, customize labels, and adjust other select properties.
<FileSource src="/framed/Theme/ThemeSelectCustom" /> <FileSource src="/framed/Theme/ThemeSelectCustom" />

View file

@ -3,10 +3,16 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Tile` provides a container for displaying content in a structured, card-like format. It supports light and dark variants and can be used to create consistent, visually distinct content sections.
## Default ## Default
Create a basic tile container for your content.
<Tile>Content</Tile> <Tile>Content</Tile>
## Light variant ## Light variant
Use the light variant for light-themed backgrounds by setting `light` to `true`.
<Tile light>Content</Tile> <Tile light>Content</Tile>

View file

@ -7,6 +7,8 @@ components: ["TimePicker", "TimePickerSelect", "SelectItem"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`TimePicker` provides a time input field with optional period (AM/PM) and timezone selectors. It supports various sizes, states, and themes to match your application's design system.
## Default ## Default
<TimePicker labelText="Cron job" placeholder="hh:mm"> <TimePicker labelText="Cron job" placeholder="hh:mm">
@ -22,6 +24,8 @@ components: ["TimePicker", "TimePickerSelect", "SelectItem"]
## Light variant ## Light variant
Use the light variant for light-themed backgrounds by setting `light` to `true`.
<TimePicker light labelText="Cron job" placeholder="hh:mm"> <TimePicker light labelText="Cron job" placeholder="hh:mm">
<TimePickerSelect value="pm"> <TimePickerSelect value="pm">
<SelectItem value="am" text="AM" /> <SelectItem value="am" text="AM" />
@ -35,6 +39,8 @@ components: ["TimePicker", "TimePickerSelect", "SelectItem"]
## Extra-large size ## Extra-large size
Use the extra-large size for more prominent time pickers by setting `size` to `"xl"`.
<TimePicker size="xl" labelText="Cron job" placeholder="hh:mm"> <TimePicker size="xl" labelText="Cron job" placeholder="hh:mm">
<TimePickerSelect value="pm"> <TimePickerSelect value="pm">
<SelectItem value="am" text="AM" /> <SelectItem value="am" text="AM" />
@ -48,6 +54,8 @@ components: ["TimePicker", "TimePickerSelect", "SelectItem"]
## Small size ## Small size
Use the small size for more compact time pickers by setting `size` to `"sm"`.
<TimePicker size="sm" labelText="Cron job" placeholder="hh:mm"> <TimePicker size="sm" labelText="Cron job" placeholder="hh:mm">
<TimePickerSelect value="pm"> <TimePickerSelect value="pm">
<SelectItem value="am" text="AM" /> <SelectItem value="am" text="AM" />
@ -61,6 +69,8 @@ components: ["TimePicker", "TimePickerSelect", "SelectItem"]
## Invalid state ## Invalid state
Indicate an invalid state with an error message by setting `invalid` to `true` and providing `invalidText`.
<TimePicker invalid invalidText="A valid value is required" labelText="Cron job" placeholder="hh:mm"> <TimePicker invalid invalidText="A valid value is required" labelText="Cron job" placeholder="hh:mm">
<TimePickerSelect value="pm"> <TimePickerSelect value="pm">
<SelectItem value="am" text="AM" /> <SelectItem value="am" text="AM" />
@ -72,9 +82,10 @@ components: ["TimePicker", "TimePickerSelect", "SelectItem"]
</TimePickerSelect> </TimePickerSelect>
</TimePicker> </TimePicker>
## Disabled state ## Disabled state
Disable the time picker to prevent user interaction by setting `disabled` to `true`.
<TimePicker labelText="Cron job" placeholder="hh:mm" disabled> <TimePicker labelText="Cron job" placeholder="hh:mm" disabled>
<TimePickerSelect value="pm" disabled> <TimePickerSelect value="pm" disabled>
<SelectItem value="am" text="AM" /> <SelectItem value="am" text="AM" />

View file

@ -1,22 +1,32 @@
---
components: ["ToastNotification"]
---
<script> <script>
import { ToastNotification } from "carbon-components-svelte"; import { ToastNotification } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
Toasts are non-modal, time-based window elements used to display short messages; `ToastNotification` displays non-modal, time-based messages that appear at the top of the screen and automatically disappear. It supports various notification types, custom content, and accessibility features.
they usually appear at the top of the screen and disappear after a few seconds.
See [detailed See [detailed usage](https://carbondesignsystem.com/components/notification/usage).
usage](https://carbondesignsystem.com/components/notification/usage).
See also: [InlineNotification](InlineNotification) See also: [InlineNotification](InlineNotification)
## Default (error) ## Default
Display a basic error notification with title, subtitle, and timestamp by default.
<ToastNotification title="Error" subtitle="An internal server error occurred." caption="{new Date().toLocaleString()}" /> <ToastNotification title="Error" subtitle="An internal server error occurred." caption="{new Date().toLocaleString()}" />
## Autoclose
Specify the `timeout` prop to automatically close the notification after a specified duration (in milliseconds).
<FileSource src="/framed/ToastNotification/ToastNotificationTimeout" />
## Prevent default close behavior ## Prevent default close behavior
`ToastNotification` is a controlled component. Prevent the default close behavior using the `e.preventDefault()` method in the dispatched `on:close` event. Prevent the default close behavior using `e.preventDefault()` in the `on:close` event handler.
<ToastNotification title="Error" subtitle="An internal server error occurred." caption="{new Date().toLocaleString()}" on:close={(e) => { <ToastNotification title="Error" subtitle="An internal server error occurred." caption="{new Date().toLocaleString()}" on:close={(e) => {
e.preventDefault(); e.preventDefault();
@ -25,12 +35,14 @@ See also: [InlineNotification](InlineNotification)
## Full width ## Full width
Set `fullWidth` to `true` for the notification to span the full width of its containing element. Set `fullWidth` to `true` for the notification to span the full width of its container.
<ToastNotification fullWidth title="Error" subtitle="An internal server error occurred." caption="{new Date().toLocaleString()}" /> <ToastNotification fullWidth title="Error" subtitle="An internal server error occurred." caption="{new Date().toLocaleString()}" />
## Slottable title, subtitle, caption ## Slottable title, subtitle, caption
Customize the notification content using slots for more flexibility.
<ToastNotification> <ToastNotification>
<strong slot="title">Error: </strong> <strong slot="title">Error: </strong>
<strong slot="subtitle">An internal server error occurred.</strong> <strong slot="subtitle">An internal server error occurred.</strong>
@ -39,9 +51,7 @@ Set `fullWidth` to `true` for the notification to span the full width of its con
## Accessible icon descriptions ## Accessible icon descriptions
The status icon and close button icon descriptions appear on cursor hover and are read Provide custom descriptions for icons to improve accessibility.
by assistive technology. Default descriptions are provided in English and can be
overridden via `statusIconDescription` and `closeButtonDescription`.
<ToastNotification <ToastNotification
title="错误" title="错误"
@ -52,10 +62,14 @@ overridden via `statusIconDescription` and `closeButtonDescription`.
## Hidden close button ## Hidden close button
Create a persistent notification by hiding the close button.
<ToastNotification hideCloseButton kind="warning" title="Scheduled maintenance" subtitle="Maintenance will last 2-4 hours." caption="{new Date().toLocaleString()}" /> <ToastNotification hideCloseButton kind="warning" title="Scheduled maintenance" subtitle="Maintenance will last 2-4 hours." caption="{new Date().toLocaleString()}" />
## Notification variants ## Notification variants
The component supports different notification types:
<ToastNotification kind="error" title="Error" subtitle="An internal server error occurred." caption="{new Date().toLocaleString()}" /> <ToastNotification kind="error" title="Error" subtitle="An internal server error occurred." caption="{new Date().toLocaleString()}" />
<ToastNotification kind="info" title="New updates" subtitle="Restart to get the latest updates." caption="{new Date().toLocaleString()}" /> <ToastNotification kind="info" title="New updates" subtitle="Restart to get the latest updates." caption="{new Date().toLocaleString()}" />
<ToastNotification kind="info-square" title="New updates" subtitle="Restart to get the latest updates." caption="{new Date().toLocaleString()}" /> <ToastNotification kind="info-square" title="New updates" subtitle="Restart to get the latest updates." caption="{new Date().toLocaleString()}" />
@ -65,6 +79,8 @@ overridden via `statusIconDescription` and `closeButtonDescription`.
## Low contrast ## Low contrast
Use low contrast variants for less prominent notifications.
<ToastNotification lowContrast kind="error" title="Error" subtitle="An internal server error occurred." caption="{new Date().toLocaleString()}" /> <ToastNotification lowContrast kind="error" title="Error" subtitle="An internal server error occurred." caption="{new Date().toLocaleString()}" />
<ToastNotification lowContrast kind="info" title="New updates" subtitle="Restart to get the latest updates." caption="{new Date().toLocaleString()}" /> <ToastNotification lowContrast kind="info" title="New updates" subtitle="Restart to get the latest updates." caption="{new Date().toLocaleString()}" />
<ToastNotification lowContrast kind="info-square" title="New updates" subtitle="Restart to get the latest updates." caption="{new Date().toLocaleString()}" /> <ToastNotification lowContrast kind="info-square" title="New updates" subtitle="Restart to get the latest updates." caption="{new Date().toLocaleString()}" />

View file

@ -7,53 +7,73 @@ components: ["Toggle", "ToggleSkeleton"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
## Default (untoggled) `Toggle` provides a switch-like control that allows users to turn options on or off. It supports custom labels, different sizes, and various states to match your application's needs.
## Default
Display a basic toggle in its untoggled state by default.
<Toggle labelText="Push notifications" /> <Toggle labelText="Push notifications" />
## Toggled ## Toggled
Set `toggled` to `true` to display the toggle in its on state.
<Toggle labelText="Push notifications" toggled /> <Toggle labelText="Push notifications" toggled />
## Reactive example ## Reactive example
Use two-way binding to control the toggle state programmatically.
<FileSource src="/framed/Toggle/ToggleReactive" /> <FileSource src="/framed/Toggle/ToggleReactive" />
## on:toggle event ## on:toggle event
Listen for toggle state changes using the `on:toggle` event.
<Toggle labelText="Push notifications" on:toggle={e => console.log(e.detail)} /> <Toggle labelText="Push notifications" on:toggle={e => console.log(e.detail)} />
## Hidden label text ## Hidden label text
Set `hideLabel` to `true` to visually hide the label text. It's recommended to still specify `labelText` for screen reader accessibility. Set `hideLabel` to `true` to visually hide the label while maintaining accessibility.
<Toggle labelText="Push notifications" hideLabel /> <Toggle labelText="Push notifications" hideLabel />
## Custom labels ## Custom labels
Customize the toggle labels using `labelA` and `labelB` props.
<Toggle labelText="Push notifications" labelA="No" labelB="Yes" /> <Toggle labelText="Push notifications" labelA="No" labelB="Yes" />
## Slottable labels ## Slottable labels
An alternative to the "labelA" and "labelB" props is to use the corresponding named slots. Use slots to customize the toggle labels with additional styling or content.
<Toggle labelText="Push notifications"> <Toggle labelText="Push notifications">
<span slot="labelA" style="color: red">No</span> <span slot="labelA" style="color: red">No</span>
<span slot="labelB" style="color: green">Yes</span> <span slot="labelB" style="color: green">Yes</span>
</Toggle> </Toggle>
## Disabled ## Disabled state
Set `disabled` to `true` to prevent user interaction.
<Toggle labelText="Push notifications" disabled /> <Toggle labelText="Push notifications" disabled />
## Small size ## Small size
Use the small size variant by setting `size` to `"sm"`.
<Toggle size="sm" labelText="Push notifications" /> <Toggle size="sm" labelText="Push notifications" />
## Skeleton ## Skeleton
Display a loading state using the skeleton component.
<ToggleSkeleton /> <ToggleSkeleton />
## Skeleton (small) ## Skeleton (small)
Use the small size variant for the skeleton component.
<ToggleSkeleton size="sm" /> <ToggleSkeleton size="sm" />

View file

@ -8,9 +8,11 @@ components: ["Tooltip", "TooltipFooter"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`Tooltip` displays contextual information when users hover over or focus on an element. It supports various directions, alignments, and interactive content to provide additional context or guidance.
## Default ## Default
By default, the tooltip is triggered by an information icon. Display a tooltip triggered by the default information icon.
<Tooltip> <Tooltip>
<p> <p>
@ -20,6 +22,8 @@ By default, the tooltip is triggered by an information icon.
## With trigger text ## With trigger text
Use custom trigger text instead of the default icon.
<Tooltip triggerText="Resource list"> <Tooltip triggerText="Resource list">
<p> <p>
Resources are provisioned based on your account's organization. Resources are provisioned based on your account's organization.
@ -28,10 +32,14 @@ By default, the tooltip is triggered by an information icon.
## Reactive example ## Reactive example
Control the tooltip state programmatically.
<FileSource src="/framed/Tooltip/TooltipReactive" /> <FileSource src="/framed/Tooltip/TooltipReactive" />
## Directions ## Directions
Position the tooltip in different directions using the `direction` prop.
<Tooltip triggerText="Top" direction="top"><p>Top</p></Tooltip> <Tooltip triggerText="Top" direction="top"><p>Top</p></Tooltip>
<Tooltip triggerText="Right" direction="right"><p>Right</p></Tooltip> <Tooltip triggerText="Right" direction="right"><p>Right</p></Tooltip>
<Tooltip triggerText="Bottom" direction="bottom"><p>Bottom</p></Tooltip> <Tooltip triggerText="Bottom" direction="bottom"><p>Bottom</p></Tooltip>
@ -39,12 +47,16 @@ By default, the tooltip is triggered by an information icon.
## Alignment ## Alignment
Align the tooltip content using the `align` prop.
<Tooltip triggerText="Start" align="start"><p>Start</p></Tooltip> <Tooltip triggerText="Start" align="start"><p>Start</p></Tooltip>
<Tooltip triggerText="End" align="end"><p>End</p></Tooltip> <Tooltip triggerText="End" align="end"><p>End</p></Tooltip>
<Tooltip triggerText="Center" align="center"><p>Center</p></Tooltip> <Tooltip triggerText="Center" align="center"><p>Center</p></Tooltip>
## Interactive ## Interactive
Add interactive elements like links and buttons using `TooltipFooter`.
<Tooltip triggerText="Resource list"> <Tooltip triggerText="Resource list">
<p> <p>
Resources are provisioned based on your account's organization. Resources are provisioned based on your account's organization.
@ -57,6 +69,8 @@ By default, the tooltip is triggered by an information icon.
## Custom icon (component) ## Custom icon (component)
Use a custom icon component with the `icon` prop.
<Tooltip triggerText="Resource list" icon={Catalog}> <Tooltip triggerText="Resource list" icon={Catalog}>
<p> <p>
Resources are provisioned based on your account's organization. Resources are provisioned based on your account's organization.
@ -65,6 +79,8 @@ By default, the tooltip is triggered by an information icon.
## Custom icon (slot) ## Custom icon (slot)
Customize the icon using the `icon` slot for more flexibility.
<Tooltip triggerText="Resource list"> <Tooltip triggerText="Resource list">
<div slot="icon" style="width: 1rem; height: 1rem; outline: 1px solid red;"></div> <div slot="icon" style="width: 1rem; height: 1rem; outline: 1px solid red;"></div>
<p> <p>
@ -74,6 +90,8 @@ By default, the tooltip is triggered by an information icon.
## Hidden icon ## Hidden icon
Hide the icon while keeping the tooltip functionality using `hideIcon`.
<Tooltip hideIcon triggerText="Resource list"> <Tooltip hideIcon triggerText="Resource list">
<p> <p>
Resources are provisioned based on your account's organization. Resources are provisioned based on your account's organization.

View file

@ -3,17 +3,19 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`TooltipDefinition` provides inline definitions for terms or concepts. It displays a tooltip when users hover over or focus on the defined term, making it ideal for providing additional context without cluttering the interface.
## Default ## Default
Display a basic definition tooltip with the default bottom-center alignment.
<TooltipDefinition tooltipText="IBM Corporate Headquarters is based in Armonk, New York."> <TooltipDefinition tooltipText="IBM Corporate Headquarters is based in Armonk, New York.">
Armonk Armonk
</TooltipDefinition> </TooltipDefinition>
## Custom tooltip direction and alignment ## Custom tooltip direction and alignment
Customize the tooltip menu direction and alignment through the `direction` and `align` props. Customize the tooltip position using the `direction` and `align` props. The default direction is `"bottom"` and alignment is `"center"`.
By default, `direction` is `"bottom"` and `align` is `"center"`.
<TooltipDefinition direction="top" align="start" tooltipText="IBM Corporate Headquarters is based in Armonk, New York."> <TooltipDefinition direction="top" align="start" tooltipText="IBM Corporate Headquarters is based in Armonk, New York.">
Armonk Armonk
@ -21,6 +23,8 @@ By default, `direction` is `"bottom"` and `align` is `"center"`.
## Custom tooltip slot ## Custom tooltip slot
Use the `tooltip` slot to customize the tooltip content with additional styling or structure.
<TooltipDefinition> <TooltipDefinition>
Armonk Armonk
<span slot="tooltip" style="color: red"> <span slot="tooltip" style="color: red">

View file

@ -5,12 +5,18 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
## Default ("bottom" direction, "center" aligned) `TooltipIcon` displays contextual information when users hover over or focus on an icon. It's ideal for providing additional context about icons or actions in your interface.
## Default
Display a tooltip with the default bottom-center alignment.
<TooltipIcon tooltipText="Carbon is an open source design system by IBM." icon={Carbon} /> <TooltipIcon tooltipText="Carbon is an open source design system by IBM." icon={Carbon} />
## Directions ## Directions
Position the tooltip in different directions and alignments using the `direction` and `align` props.
<TooltipIcon tooltipText="Top start" direction="top" align="start" icon={Filter} /> <TooltipIcon tooltipText="Top start" direction="top" align="start" icon={Filter} />
<TooltipIcon tooltipText="Right end" direction="right" align="end" icon={Filter} /> <TooltipIcon tooltipText="Right end" direction="right" align="end" icon={Filter} />
<TooltipIcon tooltipText="Bottom start" direction="bottom" align="start" icon={Filter} /> <TooltipIcon tooltipText="Bottom start" direction="bottom" align="start" icon={Filter} />
@ -18,12 +24,14 @@
## Custom tooltip text ## Custom tooltip text
Use the "text" slot to customize the tooltip text. Use the `tooltipText` slot to customize the tooltip content with additional styling.
<TooltipIcon icon={Carbon}> <TooltipIcon icon={Carbon}>
<span slot="tooltipText" style="color: red">Carbon is an open source design system by IBM.</span> <span slot="tooltipText" style="color: red">Carbon is an open source design system by IBM.</span>
</TooltipIcon> </TooltipIcon>
## Disabled ## Disabled state
Set `disabled` to `true` to prevent user interaction with the tooltip.
<TooltipIcon disabled tooltipText="Carbon is an open source design system by IBM." icon={Carbon} /> <TooltipIcon disabled tooltipText="Carbon is an open source design system by IBM." icon={Carbon} />

View file

@ -1,15 +1,19 @@
<script> <script>
import { InlineNotification } from "carbon-components-svelte"; import { InlineNotification, UnorderedList, ListItem, Link } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`TreeView` displays hierarchical data in a collapsible tree structure. It supports node selection, expansion, icons, and programmatic control of the tree state.
## Default ## Default
The `children` prop accepts an array of child nodes. Each node should contain `id` and `text` properties. Create a basic tree view using the `nodes` prop. Each node requires an `id` and `text`, with optional properties for `disabled`, `icon`, and child `nodes`.
Optional properties include `disabled`, `icon`, and `children`. <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">
A parent node contains `children` while a leaf node does not. In version 0.86.0, the <strong>children</strong> prop was renamed to <strong>nodes</strong> for <Link target="_blank" href="https://svelte.dev/docs/svelte/v5-migration-guide#The-children-prop-is-reserved">Svelte 5 compatibility</Link>.
</div>
</InlineNotification>
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">Every node must have a unique id.</div> <div class="body-short-01">Every node must have a unique id.</div>
@ -17,62 +21,83 @@ A parent node contains `children` while a leaf node does not.
<FileSource src="/framed/TreeView/TreeView" /> <FileSource src="/framed/TreeView/TreeView" />
## Slottable node
Customize node rendering using the default slot with the `let:node` directive. The node object provides:
<UnorderedList svx-ignore style="margin-bottom: var(--cds-spacing-08)">
<ListItem><strong>id</strong>: the node id</ListItem>
<ListItem><strong>text</strong>: the node text</ListItem>
<ListItem><strong>expanded</strong>: true if the node is expanded</ListItem>
<ListItem><strong>leaf</strong>: true if the node does not have child nodes</ListItem>
<ListItem><strong>disabled</strong>: true if the node is disabled</ListItem>
<ListItem><strong>selected</strong>: true if the node is selected</ListItem>
</UnorderedList>
<FileSource src="/framed/TreeView/TreeViewSlot" />
## Initial active node ## Initial active node
The active node can be set through `activeId`. Set the initial active node using the `activeId` prop.
<FileSource src="/framed/TreeView/TreeViewActive" /> <FileSource src="/framed/TreeView/TreeViewActive" />
## Compact size ## Compact size
Set `size` to `"compact"` to use the compact variant. Use the compact variant by setting `size` to `"compact"`.
<FileSource src="/framed/TreeView/TreeViewCompact" /> <FileSource src="/framed/TreeView/TreeViewCompact" />
## With icons ## With icons
To render a node with an icon, define an `icon` property with a Carbon Svelte icon as its value. Add icons to nodes by defining an `icon` property with a Carbon Svelte icon component.
<FileSource src="/framed/TreeView/TreeViewIcons" /> <FileSource src="/framed/TreeView/TreeViewIcons" />
## Initial expanded nodes ## Initial expanded nodes
Expanded nodes can be set using `expandedIds`. Set initially expanded nodes using the `expandedIds` prop.
<FileSource src="/framed/TreeView/TreeViewExpanded" /> <FileSource src="/framed/TreeView/TreeViewExpanded" />
## Initial multiple selected nodes ## Initial multiple selected nodes
Initial multiple selected nodes can be set using `selectedIds`. Set multiple initially selected nodes using the `selectedIds` prop.
<FileSource src="/framed/TreeView/TreeViewMultiselect" /> <FileSource src="/framed/TreeView/TreeViewMultiselect" />
## Expand all nodes ## Expand all nodes
To programmatically expand all nodes, access the component instance using the [bind:this](https://svelte.dev/docs#bind_element) directive and invoke the `TreeView.expandAll()` accessor. Programmatically expand all nodes using the `TreeView.expandAll()` method.
<FileSource src="/framed/TreeView/TreeViewExpandAll" /> <FileSource src="/framed/TreeView/TreeViewExpandAll" />
## Collapse all nodes ## Collapse all nodes
Similarly, invoke `TreeView.collapseAll()` to collapse all nodes. Programmatically collapse all nodes using the `TreeView.collapseAll()` method.
<FileSource src="/framed/TreeView/TreeViewCollapseAll" /> <FileSource src="/framed/TreeView/TreeViewCollapseAll" />
## Expand a subset of nodes ## Expand a subset of nodes
Use the `TreeView.expandNodes` method to expand only a subset of nodes. Use `TreeView.expandNodes` to expand specific nodes based on a condition.
The method accepts an argument that takes a node and returns a boolean.
If no argument is provided, all nodes will be expanded.
<FileSource src="/framed/TreeView/TreeViewExpandNodes" /> <FileSource src="/framed/TreeView/TreeViewExpandNodes" />
## Collapse a subset of nodes ## Collapse a subset of nodes
Use the `TreeView.collapseNodes` method to collapse a subset of nodes. Use `TreeView.collapseNodes` to collapse specific nodes based on a condition.
If no argument is provided, all nodes will be collapsed.
<FileSource src="/framed/TreeView/TreeViewCollapseNodes" /> <FileSource src="/framed/TreeView/TreeViewCollapseNodes" />
## Show a specific node
Use `TreeView.showNode` to expand, select, and focus a specific node.
<FileSource src="/framed/TreeView/TreeViewShowNode" />
## Flat data structure
Convert flat data to a hierarchical structure using the `toHierarchy` utility.
<FileSource src="/framed/TreeView/TreeViewFlatArray" />

View file

@ -1,14 +1,13 @@
<script> <script>
import { Truncate, truncate } from "carbon-components-svelte"; import { Truncate, truncate } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
This utility component wraps the `.bx--text-truncate--*` CSS selectors from [carbon-components](https://github.com/carbon-design-system/carbon/blob/master/packages/components/src/globals/scss/_helper-classes.scss#L11) for single-line text truncation. `Truncate` provides text truncation functionality for single-line content. It implements Carbon's text truncation CSS classes and can be used as either a component or an action.
## Default ## Default
By default, text will be clamped at the end of the line. Text is wrapped with a paragraph (`p`) element. Use the [truncate action](#usetruncate) to truncate text in other elements. Display truncated text using the default component. Text is wrapped in a paragraph element and truncated at the end of the line.
<Truncate> <Truncate>
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM. Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.
@ -16,7 +15,7 @@ By default, text will be clamped at the end of the line. Text is wrapped with a
## Clamp front ## Clamp front
Set `clamp` to `"front"` to clamp the text from the front. Truncate text from the beginning by setting `clamp` to `"front"`.
<Truncate clamp="front"> <Truncate clamp="front">
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM. Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.
@ -24,7 +23,7 @@ Set `clamp` to `"front"` to clamp the text from the front.
## use:truncate ## use:truncate
The `truncate` action can be used on plain HTML elements. Apply truncation to any HTML element using the `truncate` action.
<h4 use:truncate> <h4 use:truncate>
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM. Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.

View file

@ -1,5 +1,3 @@
--- ---
components: ["Header", components: ["Header",
"HeaderAction", "HeaderAction",
@ -27,6 +25,8 @@ components: ["Header",
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`UIShell` provides a collection of components for building application shells and navigation structures. It includes header, side navigation, and content components that work together to create a cohesive user interface.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01"> <div class="body-short-01">
Currently, the UI Shell is not themable and only supports dark mode. Currently, the UI Shell is not themable and only supports dark mode.
@ -37,6 +37,8 @@ Open the following examples in a new tab to experience them in full.
## Header ## Header
Create a basic header with the `Header` component.
<FileSource src="/framed/UIShell/Header" /> <FileSource src="/framed/UIShell/Header" />
## Header with side navigation ## Header with side navigation
@ -59,14 +61,30 @@ You can disable the `transition` by setting it to `false`.
<FileSource src="/framed/UIShell/HeaderSwitcher" /> <FileSource src="/framed/UIShell/HeaderSwitcher" />
## Header with multiple switchers
Multiple switchers can be used, and the switcher button can be customized. For example, display a tooltip using `iconDescription`.
Control the tooltip alignment using `tooltipAlignment`.
Note that providing `text` overrides the tooltip.
<FileSource src="/framed/UIShell/HeaderMultipleSwitcher" />
## Header with global search ## Header with global search
Add a global search component to the header.
<FileSource src="/framed/UIShell/HeaderSearch" /> <FileSource src="/framed/UIShell/HeaderSearch" />
## Header with utilities ## Header with utilities
Include utility components in the header using `HeaderUtilities`.
<FileSource src="/framed/UIShell/HeaderUtilities" /> <FileSource src="/framed/UIShell/HeaderUtilities" />
## Header with persisted hamburger menu ## Header with persisted hamburger menu
Create a header with a persistent hamburger menu state.
<FileSource src="/framed/UIShell/PersistedHamburgerMenu" /> <FileSource src="/framed/UIShell/PersistedHamburgerMenu" />

View file

@ -7,6 +7,8 @@ components: ["UnorderedList", "ListItem"]
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
`UnorderedList` provides a styled unordered list component that supports nested lists, links, and expressive typography. It's ideal for displaying bulleted content in your interface.
<InlineNotification svx-ignore lowContrast title="Tip:" kind="info" hideCloseButton> <InlineNotification svx-ignore lowContrast title="Tip:" kind="info" hideCloseButton>
<div class="body-short-01"> <div class="body-short-01">
Consider using the <Link href="/components/RecursiveList#unordered">RecursiveList</Link> component for rendering tree structured data. Consider using the <Link href="/components/RecursiveList#unordered">RecursiveList</Link> component for rendering tree structured data.
@ -15,6 +17,8 @@ components: ["UnorderedList", "ListItem"]
## Default ## Default
Create a basic unordered list with `ListItem` components.
<UnorderedList> <UnorderedList>
<ListItem>Unordered list item</ListItem> <ListItem>Unordered list item</ListItem>
<ListItem>Unordered list item</ListItem> <ListItem>Unordered list item</ListItem>
@ -23,6 +27,8 @@ components: ["UnorderedList", "ListItem"]
## With links ## With links
Add links to list items by wrapping them in `Link` components.
<UnorderedList> <UnorderedList>
<ListItem> <ListItem>
<Link href="#">Unordered list item</Link> <Link href="#">Unordered list item</Link>
@ -37,6 +43,8 @@ components: ["UnorderedList", "ListItem"]
## Nested ## Nested
Create nested lists by setting `nested` to `true` on child `UnorderedList` components.
<UnorderedList> <UnorderedList>
<ListItem> <ListItem>
Unordered list level 1 Unordered list level 1
@ -57,7 +65,7 @@ components: ["UnorderedList", "ListItem"]
## Expressive styles ## Expressive styles
Set `expressive` to `true` to use Carbon's expressive typesetting. Use Carbon's expressive typesetting by setting `expressive` to `true`.
<UnorderedList expressive> <UnorderedList expressive>
<ListItem><Link size="lg" href="#">Unordered list item</Link></ListItem> <ListItem><Link size="lg" href="#">Unordered list item</Link></ListItem>

View file

@ -22,14 +22,14 @@
let open = false; let open = false;
</script> </script>
<Button kind="ghost" size="field" on:click="{() => (open = !open)}"> <Button kind="ghost" size="field" on:click={() => (open = !open)}>
{open ? "Collapse" : "Expand"} {open ? "Collapse" : "Expand"}
all all
</Button> </Button>
<Accordion> <Accordion>
{#each items as item} {#each items as item}
<AccordionItem title="{item.title}" open="{open}"> <AccordionItem title={item.title} {open}>
<p>{item.description}</p> <p>{item.description}</p>
</AccordionItem> </AccordionItem>
{/each} {/each}

Some files were not shown because too many files have changed in this diff Show more