Compare commits

...

1195 commits

Author SHA1 Message Date
Eric Liu
d1fbcb83ff build(docs): bump vite from 5.4.19 to 5.4.20 2025-09-15 12:38:06 -07:00
Eric Liu
0c214936a2 chore(examples): bump deps [ci skip] 2025-09-15 12:36:47 -07:00
dependabot[bot]
d1f6315eba
build(deps-dev): bump vite from 5.4.19 to 5.4.20 (#2203)
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: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-15 12:18:34 -07:00
Eric Liu
df45a89687 ci: upgrade action versions 2025-09-15 12:15:48 -07:00
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
Enrico Sacchetti
e2d7e04397
v0.75.1 2023-06-02 13:09:43 -04:00
Eric Liu
a369962fdf
fix(expandable-tile): set tile height using resize observer (#1738)
* fix(expandable-tile): set tile max height using Resize Observer

* docs(expandable-tile): update and re-work examples
2023-06-02 13:08:25 -04:00
Enrico Sacchetti
4460f5b5f8
v0.75.0 2023-05-21 14:09:58 -04:00
Sam
60a796ea48
feat(pagination-nav): add tooltipPosition prop (#1733)
* Add `tooltipPosition` to `PaginationNav` per #1656

* Rebuild test

* Update description in documentation

Co-authored-by: Enrico Sacchetti <esacchetti@gmail.com>

* chore: update docs

---------

Co-authored-by: Samuel Janda <hi@simpleprogramming.com.au>
Co-authored-by: Enrico Sacchetti <esacchetti@gmail.com>
Co-authored-by: Enrico Sacchetti <enrico@theetrain.ca>
2023-05-21 13:59:53 -04:00
Enrico Sacchetti
edcb14b3c9
v0.74.0 2023-05-18 21:31:41 -04:00
Eric Liu
c02b4738bc
fix: resolve a11y warnings from Svelte version 3.58 (#1732)
* chore(deps-dev): upgrade svelte to 3.58

* chore(a11y): ignore false positives

Referencing the upstream Carbon React implementation, these warnings can be ignored.

* fix(list-box-menu-item): set `tabindex` to `-1`

* chore: fix `tabindex` capitalization

The Svelte Language server does not detect `tabIndex` as a valid attribute.

Note, however, that `tabIndex` is correct when using it in JavaScript (e.g., `node.tabIndex`).
2023-05-18 14:53:17 -04:00
Pierre
b9aaa3adca
feat(ui-shell): make HeaderNavItem slottable (#1693) 2023-05-02 16:23:04 -07:00
metonym
8b57f235f2
docs(slider): add label text, value (#1716)
docs(slider): add label text
2023-04-08 15:21:24 -04:00
metonym
12bcefa38c
docs: remove Deploy to Render CTA (#1717) 2023-04-08 15:19:17 -04:00
metonym
50147439b5
ci: add job to automatically deploy docs (#1711)
* ci: add job to automatically deploy docs

* empty commit to re-trigger CI
2023-03-29 22:05:38 -04:00
Gregor Wassmann
24432fbed6
docs: remove redundant CSS (#1710) 2023-03-27 09:37:25 -07:00
Enrico Sacchetti
b4a2ea2758
v0.73.5 2023-03-26 15:31:02 -04:00
metonym
c00df40216
chore(a11y): silence new a11y warnings from svelte@3.57 (#1703)
* chore(deps-dev): upgrade svelte to 3.57

* chore(deps-dev): upgrade svelte-check

* chore(a11y): silence new a11y warnings from svelte@3.57

* Revert "chore(deps-dev): upgrade svelte-check"

This reverts commit 78106587a2.

* fix(progress-step): remove unnecessary `aria-disabled`

https://github.com/carbon-design-system/carbon-components-svelte/pull/1703#pullrequestreview-1357928713
2023-03-26 15:28:48 -04:00
Gregor Wassmann
9c1b0c1278
docs: fix layout for smaller screens (#1707)
Fixes #1649
2023-03-26 09:34:08 -07:00
Hyunseung
4c5d8cd1ed
docs(tag): fix typo (#1705) 2023-03-25 13:18:42 -07:00
Gregor Wassmann
aa2e97f110
docs(theme): use Theme component from library (#1700) 2023-03-24 16:10:50 -07:00
Gregor Wassmann
14f23962c3
chore: run yarn lint (#1701) 2023-03-24 15:48:00 -07:00
Enrico Sacchetti
4960504ace
v0.73.4 2023-03-20 21:29:25 -04:00
metonym
ca40dd18c2
fix(selectable-tile): include dispatched events in types (#1695)
Fixes #1694
2023-03-20 21:27:29 -04:00
Hyunseung
821233ab4f
fix(text-input): correctly set input padding for warning state (#1688)
Fixes #1687
2023-03-15 10:23:59 -07:00
Enrico Sacchetti
53899cf537
v0.73.3 2023-03-11 14:52:20 -05:00
gabrielleecredera
42349ebc61
fix(1684): hide helper text container in password input when not used (#1685) 2023-03-11 14:38:44 -05:00
Enrico Sacchetti
d2e471bbec
chore(github): provide contact links in issue template (#1669) 2023-02-26 19:49:32 -08:00
Enrico Sacchetti
185f1da7ef
v0.73.2 2023-02-26 20:53:43 -05:00
metonym
6386c33f93
fix: readonly should override error behavior in TextInput, NumberInput (#1666)
* fix(text-input): avoid overlapping readonly/invalid icons

* fix(number-input): avoid overlapping readonly/invalid icons

* fix: readonly inputs cannot be invalid

Addresses https://github.com/carbon-design-system/carbon-components-svelte/pull/1666#pullrequestreview-1314558645
2023-02-26 20:51:50 -05:00
Enrico Sacchetti
65a8bbf1f9
v0.73.1 2023-02-19 14:54:32 -05:00
Carson McCue
b435be4f12
fix(textinput/passwordinput): apply aria-describedby to hint text
* Aria-describedby

Resolves base aria-describedby attribute from #1633.

* Update PasswordInput.svelte
2023-02-19 14:53:00 -05:00
dependabot[bot]
eaa4af14d1
build(deps): bump minimatch from 3.0.4 to 3.1.2 (#1580)
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-19 12:55:59 -05:00
Enrico Sacchetti
420f8e8f24
docs: update release guide 2023-02-19 12:40:59 -05:00
Enrico Sacchetti
8f88a0f0b2
v0.73.0 2023-02-19 12:39:30 -05:00
Jonathan Quintin
7ddbf17cbb
feat(progress-bar): add status prop (#1560)
* ProgressBar status feature added

* ProgressBar: Removed the css variables and use carbon-css instead.
The way of assigning the ProgressBar value has change. It is now a style
variable and scale-x is calculated in the css. This way prevent the
override of carbon css.

* Removed an unessacery span.

* Removed an unnecessary span.

* Added the status for the ProgressBarUx

* Remove `style css` and update docs.

* - Fixed the `capped` variable for more readability
- Updated docs `label` and `helperText`
- Updated docs and css

* fix: finished/error states cannot be indeterminate

* Run "yarn build:css"

* Re-run "yarn build:docs"

* test(progress-bar): assert `status` prop

* chore: add aria-busy and set valuenow to 0 when not active

---------

Co-authored-by: Eric Liu <ericyl.us@gmail.com>
Co-authored-by: Enrico Sacchetti <enrico@theetrain.ca>
2023-02-19 12:34:41 -05:00
Francine Lucca
7cc92231b2
chore(platform): update tooltip definition in carbon.yml (#1640) 2023-02-13 11:32:06 -08:00
Taylor Jones
a3b37c4e62
docs(readme): add discord link to readme (#1659) 2023-02-13 13:16:35 -05:00
Enrico Sacchetti
7e4fd91bd3
v0.72.3 2023-02-11 13:51:13 -05:00
metonym
6450e8b0b1
fix(types): add missing $$restProps for Checkbox, Filename, FluidForm (#1655)
* fix(types): add missing `$$restProps` for `Checkbox`, `Filename`, `FluidForm`

* Run "yarn build:docs"

* test: assert `$$restProps` for `Checkbox`, `Form`
2023-02-11 13:50:01 -05:00
metonym
2a8fc00a09
docs(button): add example of disabled, icon-only button (#1651) 2023-02-06 22:26:24 -05:00
Enrico Sacchetti
09330552f9
v0.72.2 2023-02-04 20:33:10 -05:00
metonym
d897484abf
fix(dropdown): dispatch correct selectedItem in select event (#1646)
Fixes #1645
2023-02-04 20:31:31 -05:00
Enrico Sacchetti
57b6ea68b5
v0.72.1 2023-01-24 22:32:09 -05:00
ptrxyz
8cb5d538f7
fix(dropdown): fix ssr issue (#1639)
The `onDestroy` hook is also run during SSR, so returning destruction function from `onMount` should do the trick. For #1638
2023-01-24 22:28:36 -05:00
Enrico Sacchetti
afa692c9e0
docs: update release guide 2023-01-17 21:12:38 -05:00
Enrico Sacchetti
5bb2197371
v0.72.0 2023-01-17 21:02:23 -05:00
Jonathan Quintin
73aa6e216a
fix(dropdown): close when user clicks outside iframe (#1596)
* `Dropdown` click outside
Fixes #1595

* `onDestroy` we want to remove the event listener
to prevent listeners hanging
2023-01-17 20:57:50 -05:00
metonym
ec867c46ba
fix(tree-view)!: remove expanded property from TreeNode interface (#1631)
* fix(tree-view)!: remove `expanded` property from `TreeNode`

* fix(tree-view-node-list)!: remove unused `expanded` prop

* docs(tree-view): remove `expanded` as a property

#1630
2023-01-17 20:55:46 -05:00
metonym
7701c012a5
chore: remove .husky (#1632) 2023-01-16 18:11:16 -05:00
Enrico Sacchetti
6d2e21f027
chore: improve lint, release workflows (#1627)
* Add standard-version to automate releases

* Remove husky

* Add lint script; run lint in GitHub Actions

* Run lint script

* Add Enrico to contributors
2023-01-15 15:34:09 -08:00
Enrico Sacchetti
c1c8309443
docs(component-api): change details -> detail (#1610) 2023-01-01 09:04:17 -08:00
Enrico Sacchetti
2e5f3554c6
chore: fix changelog 2022-12-31 15:39:59 -05:00
Enrico Sacchetti
bdf0e109c8
v0.71.0 2022-12-31 15:31:06 -05:00
Enrico Sacchetti
50066966da
feat(notification)!: replace iconDescription prop with statusIconDescription, closeButtonDescription (#1591)
Fixes #672, fixes #1563

* breaking: remove `iconDescription` prop from `InlineNotification`, `ToastNotification`

* breaking: require `iconDescription` prop in `NotificationIcon`

* feat: add new `statusIconDescription` and `closeButtonDescription` to `InlineNotification`, `ToastNotification`
2022-12-18 15:28:23 -08:00
Gregor Wassmann
e258db0cae
docs(pagination-nav): add change event docs (#1592)
It seems that in #1518 some docs were not properly generated.

This is the change that results from running `yarn build:docs`.
2022-12-17 09:06:40 -05:00
Enrico Sacchetti
8d55752a18
fix(pagination-nav)!: use 1-indexing to be consistent with Pagination (#1518)
Fixes #1513
2022-12-13 10:23:04 -08:00
Enrico Sacchetti
9198ed5474
feat!: dispatch "change" event in Pagination, rename "change" to "update" in Select (#1497)
Closes #1491

* feat(pagination): dispatch "change" event when interacting with previous/next buttons, page/page size dropdowns

* breaking(select): rename dispatched "change" event to "update"

* breaking(select): forward `change` event to `Select`
2022-12-13 10:22:17 -08:00
metonym
724d90bd7b
chore(types)!: remove sveltekit: attributes from types (#1581)
* chore(deps-dev): upgrade sveld 0.17.2 -> 0.18.0

* Run "yarn build:docs"
2022-12-11 15:58:19 -05:00
metonym
27da2a0f8b
docs: link source code to folder for multiple components (#1582)
* docs: link source code to folder for multiple components

* chore(docs): remove unused `source` from frontmatter
2022-12-10 20:49:42 -05:00
Eric Liu
f7969c64e8 chore(examples): bump deps [ci skip] 2022-12-08 07:50:33 -08:00
Eric Liu
3ba5ba7ccb v0.70.13 2022-12-08 07:41:42 -08:00
metonym
fce92fb648
fix(dropdown): avoid runtime error if items is empty (#1578) 2022-12-07 20:38:22 -08:00
metonym
4b503c8c35
fix(multi-select): avoid runtime error if items is empty (#1577) 2022-12-07 20:34:46 -08:00
Bilux
09b3eed582
fix(combobox): avoid runtime error if items is empty (#1545) 2022-12-07 20:29:04 -08:00
DetachHead
948b5a1488 docs: fix link to carbon-components (#1571) 2022-12-07 20:25:47 -08:00
David Wolf
c823f5c03a docs: fix link to carbon-components in README (#1574) 2022-12-07 20:25:47 -08:00
metonym
837716ff8b fix(overflow-menu): dispatch "close" event when clicking outside (#1546)
Fixes #1541
2022-12-07 20:25:47 -08:00
David Wolf
ba62f45d34
fix(table-header): button should have explicit type="button" (#1573) 2022-12-07 20:14:47 -08:00
Eric Liu
a3204cc131 docs(popover): simplify external element example 2022-12-07 20:13:13 -08:00
Maxime Fafard
0f8a57b9d2
fix(popover): fire "click:outside" event when clicking sibling elements (#1570) 2022-12-07 20:10:45 -08:00
Enrico Sacchetti
fa5515ded0
fix(dropdown): only dispatch "select" on interaction, allow arrow keys to navigate menu (#1569)
Fixes #1475
2022-12-07 20:09:29 -08:00
Eric Liu
a0600e8bdb chore(number-input): ensure value is a number
Fast-follow to #1555. `ref.value` remains a string if not converted to a number.
2022-12-07 20:07:49 -08:00
Jonathan Quintin
e6f5766e46
fix(number-input): support floating point values (#1555)
Fixes #233, fixes #486, fixes #1554
2022-12-07 20:06:29 -08:00
Jonathan Quintin
e7fe8ca85b
fix(toggle): forward change, keyup events after toggled updates (#1559)
Fixes #1556
2022-12-07 20:05:20 -08:00
brunnerh
75a69bbfc2
fix(progress-step): fix label text if vertical is true (#1533)
Fixes #1532
2022-12-07 20:03:34 -08:00
brunnerh
7a98ec26eb
fix(progress-step): inherit unclickable styling if preventChangeOnClick is true (#1535)
Fixes #1534
2022-12-07 20:02:24 -08:00
Tadeáš Maršík
bf337c48ae
fix(progress-step): button should have explicit type="button" (#1551)
Fixes #1550
2022-12-07 20:01:29 -08:00
metonym
198e0da4c5
fix(tree-view): loosen TreeNode text property type to any (#1576)
* fix(tree-view): loosen `TreeNode` text property type to any

* Run "yarn build:docs"

* test(tree-view): assert updated property type value
2022-12-07 20:00:20 -08:00
DetachHead
21d841feeb
fix(tree-view): make TreeView children prop type work recursively (#1566) 2022-12-07 19:54:14 -08:00
Bilux
ae34451583
fix(data-table): remove unused import from "svelte/store" (#1529) 2022-10-20 10:21:12 -07:00
Eric Liu
43b3029d50 v0.70.12 2022-10-13 22:06:06 -07:00
metonym
1c4ee00142
fix(search): prop types should extend input attributes (#1523)
Fixes #1520
2022-10-13 22:04:32 -07:00
Eric Liu
c0188d16bb v0.70.11 2022-10-13 21:50:28 -07:00
metonym
c6373dc9b6
fix(a11y): ignore false positive a11y warnings (#1522)
Fixes #1517
2022-10-13 21:37:52 -07:00
Paweł Malinowski
5723ffef02
fix(number-input): allowEmpty should not be invalid if value is null (#1511)
Fixes #1510
2022-10-13 21:24:55 -07:00
metonym
b5b392963e
docs(pagination-nav): add more examples (#1514)
Adds "Reactive example," "Total," "Shown," and "Custom button text."
2022-10-08 13:38:11 -07:00
Eric Liu
d9255e7441 chore(examples): bump deps 2022-10-08 13:05:52 -07:00
Eric Liu
c238a9a2ba v0.70.10 2022-10-04 06:53:38 -07:00
Matt Rosno
4feba54820
docs: index getting started content (#1499) 2022-10-03 20:34:59 -07:00
metonym
59c02c9a92
docs: update README, links (#1509)
* docs: add note on using `optimizeImports` with `svelte-preprocess` (Closes #1500)

* docs: point link to SASS guide to v10 (#1489)

* docs: remove note on minimum Svelte version as it's been almost half a year since 3.48 was released
2022-10-03 20:32:48 -07:00
metonym
affeb2e2f4
fix(list-box-menu-item): avoid element reference error (#1507)
Fixes #1505
Fixes #1503
2022-10-03 19:08:07 -07:00
metonym
a657b6e334
fix(date-picker): display warn/invalid icons in input with calendar (#1508)
Fixes #1498
2022-10-03 19:07:48 -07:00
metonym
139e23fdcc
fix(header-search): fix layout regression (#1506)
Fixes #1504
2022-10-03 18:33:30 -07:00
Tee Ming
e900b47ff0
fix: localize HeaderAction, ImageLoader transitions (#1502) 2022-10-03 18:33:04 -07:00
Eric Liu
8dd9169a33 v0.70.9 2022-09-23 07:17:08 -07:00
metonym
1a65882973
fix(button): resolve visual regression in Pagination, PaginationNav (#1495) 2022-09-23 07:15:01 -07:00
metonym
17db8e25d3 v0.70.8 2022-09-21 08:27:56 -07:00
Ben Periton
bd8741e45b
fix(toolbar-search): forward keyup, keydown, paste events to Search (#1490) 2022-09-21 08:25:27 -07:00
blame2020
370ca28639
docs: SCSS instructions should link to v10 (#1489) 2022-09-19 09:39:53 -07:00
metonym
e1ec60dc09 docs: update number of available icons 2022-09-19 08:56:53 -07:00
Eric Liu
259b2cbdb9 v0.70.7 2022-09-17 10:59:09 -07:00
Tadeáš Maršík
ec039ba163
fix(modal): prevent submit event on Modal if primaryButtonDisabled is true (#1486)
Fixes #1485
2022-09-17 10:30:33 -07:00
metonym
bab5007807 build(docs): disable mdsvex smartypants 2022-09-09 10:08:43 -07:00
metonym
64ebcdb988 chore(examples): bump deps [ci skip] 2022-09-06 07:31:39 -07:00
Paweł Malinowski
88fe4292f3
chore(examples): upgrade SvelteKit to latest (#1481) 2022-09-06 07:29:11 -07:00
Eric Liu
bef9d9c704 v0.70.6 2022-09-05 08:25:48 -07:00
metonym
73385bf598
fix(a11y): resolve accessibility warnings in Svelte 3.50.0 (#1480)
Fixes #1479

* chore(deps-dev): upgrade svelte 3.47.0 -> 3.50.0

* fix(toggle): ignore `a11y-role-has-required-aria-props` warning

* fix(header-search): resolve a11y warnings
2022-09-05 08:22:58 -07:00
Eric Liu
dbf8283e35 v0.70.5 2022-09-02 08:38:56 -07:00
metonym
7c1ca3fa74
fix(button): avoid left margin style for icon-only buttons (#1477)
Fixes #1476
2022-09-02 08:36:39 -07:00
Eric Liu
c02663486b v0.70.4 2022-08-31 19:27:48 -07:00
metonym
edf33ca2d2
fix(list-box-menu-item): do not scroll entire page when using keyboard navigation (#1474) 2022-08-31 19:25:51 -07:00
Eric Liu
a0a7ccd823 v0.70.3 2022-08-31 19:04:30 -07:00
metonym
855ee06741
fix: pressing "Escape" should close Dropdown, MultiSelect menu (#1473)
* fix(dropdown): close the menu when pressing "Escape"

* fix(multi-select): close the menu when pressing "Escape"
2022-08-31 19:00:01 -07:00
metonym
1a7f750093
fix(combo-box): prevent default behavior when pressing Enter/ArrowUp/ArrowDown (#1472) 2022-08-31 18:54:08 -07:00
metonym
7030300186
fix(list-box-menu-item): scroll item into view when using keyboard navigation (#1471)
Fixes #1470
2022-08-31 18:52:06 -07:00
Matt Rosno
740c8e1596
docs: index compatible design kits (#1469) 2022-08-31 12:01:49 -07:00
Eric Liu
2cf2539472 v0.70.2 2022-08-29 08:13:42 -07:00
metonym
7bfa92d5c0
fix(ui-shell): allow $$restProps.style to be applied to Content (#1468)
Fixes #1467
2022-08-29 08:08:43 -07:00
metonym
6ec48312ff
docs(expandable-tile): add "With interactive content" example (#1465)
* style(docs): apply `code-01` styles to component api type, default value

* docs(expandable-tile): add "With interactive content" example (#1464)

* docs(overflow-menu): do not open flipped example by default
2022-08-27 11:30:02 -07:00
Matt Rosno
94ea06bfbc
fix: outline text in thumbnail svg, fix invalid path (#1457)
Closes https://github.com/carbon-design-system/carbon-platform/issues/986
2022-08-24 14:18:09 -07:00
metonym
c747b3f392 chore(docs): upgrade @sveltejs/vite-plugin-svelte, vite to latest [ci skip] 2022-08-23 10:43:12 -07:00
metonym
cba0a21f74 chore(deps-dev): bump deps 2022-08-23 08:23:43 -07:00
metonym
bdaf1c5ca0 v0.70.1 2022-08-23 08:00:48 -07:00
metonym
6b515b7589 docs(ui-shell): make SideNav in rail example a sibling to Content
Related #1459
2022-08-23 07:59:15 -07:00
metonym
5bafda10f9
fix(ui-shell): do not unset Content left margin for rail SideNav (#1462)
Fixes #1459
2022-08-23 07:57:56 -07:00
metonym
1e9a34808f
fix(date-picker): set role, aria-label attributes on calendar container (#1461)
Ref: 6b57099f46/packages/react/src/components/DatePicker/DatePicker.js (L385-L390)
2022-08-23 07:57:40 -07:00
metonym
18188c0c2e docs: update number of pictograms
`carbon-pictograms-svelte` now ships 900+ pictograms.
2022-08-19 15:12:50 -07:00
metonym
605044f5a7 v0.70.0 2022-08-18 07:12:40 -07:00
metonym
b6a62d2502
docs(data-table): extract "Sortable with pagination" example into iframe (#1456) 2022-08-18 07:08:35 -07:00
metonym
3f8bedd9f9 chore(changelog): fix typo 2022-08-18 07:07:34 -07:00
metonym
dbe33d5cbb
feat(toolbar-search): add filteredRowIds prop to support pagination (#1454)
Closes #1393

* feat(toolbar-search): add `filteredRowIds` prop

* Run "yarn build:docs"

* test(data-table): assert `filteredRowIds` prop

* docs(data-table): add pagination to default filterable examples
2022-08-18 06:59:14 -07:00
Eric Liu
2d99fe45c0 v0.69.0 2022-08-17 10:31:10 -07:00
metonym
f794cb5312
feat(data-table): dispatch on:click:header--select event (#1453)
* feat(data-table): dispatch `on:click:header--select` event

* Run "yarn build:docs"
2022-08-17 10:19:31 -07:00
metonym
e2a90005b9
docs: replace h3 with h2 headings (#1452) 2022-08-17 07:15:29 -07:00
metonym
b5c4501903
docs(data-table): improve example names and descriptions (#1451)
* docs(data-table): "Selectable" -> "Selectable rows (checkbox)"

* docs(data-table): "Selectable (radio)" -> "Selectable rows (radio)"

* docs(data-table): "Expandable" -> "Expandable rows"

* docs(data-table): update "Batch expansion" description

* docs(data-table): "Expandable and selectable" -> "Expandable and selectable rows"
2022-08-17 07:01:58 -07:00
naegelin
30487128b3
feat(data-table): dispatch on:click:row--select event (#1450) 2022-08-17 06:39:03 -07:00
metonym
60ce334859 v0.68.0 2022-08-15 07:28:36 -07:00
metonym
b42f9ba258
docs: add DataTable example "Batch selection with controlled toolbar" (#1447)
* docs(inline-notification): add `NotificationActionButton` to Component API

* docs(data-table): rename example "Selectable with batch actions"

* docs(data-table): add example "Batch selection with controlled toolbar"

* docs(notification): remove note on minimum Svelte version

This banner is redundant since the minimum Svelte version is displayed in the README and on the home page of the docs.
2022-08-15 06:29:58 -07:00
metonym
8fea168ffd
feat(toast-notification): add fullWidth prop (#1444)
* feat(toast-notification): add `fullWidth` prop

* Run "yarn build:docs"

* test(toast-notification): assert `fullWidth` prop

* docs(toast-notification): add "Full width" example
2022-08-14 14:56:02 -07:00
metonym
b04a281939
fix(toolbar-batch-actions): active prop should be reactive (#1445)
Follow-up to #1440
2022-08-14 14:55:38 -07:00
naegelin
06777ba803
feat(toolbar-batch-actions): dispatch cancelable on:cancel event (#1441)
Closes #1438
2022-08-14 12:09:40 -07:00
naegelin
bc58c7b029
feat(toolbar-batch-actions): add active prop to show toolbar (#1440)
Closes #1438
2022-08-12 08:01:58 -07:00
Eric Liu
14a8376a81 v0.67.9 2022-08-11 18:47:53 -07:00
Piper McCorkle
b6e4d133da
fix(notification-action-button): prop types should extend Button (#1442) 2022-08-11 18:45:41 -07:00
metonym
ab5eff5205 v0.67.8 2022-08-10 07:54:17 -07:00
metonym
4fd08cd25c
fix(inline-checkbox): remove aria-checked="mixed" if indeterminate (#1436)
Ref: https://github.com/carbon-design-system/carbon/pull/11908
2022-08-10 07:44:08 -07:00
metonym
b4ffed9044 fix(slider): add aria-labelledby to slider thumb (#1435)
Ref: https://github.com/carbon-design-system/carbon/pull/11798
2022-08-10 07:42:41 -07:00
Bert B
c95e2bcc80
fix(toggle): add role="switch" to input (#1434) 2022-08-10 07:05:54 -07:00
metonym
1c573e55b0 style(docs): increase max content width 56rem -> 66rem 2022-08-10 06:41:36 -07:00
Eric Liu
1494faaa65 chore(changelog): use full date [ci skip] 2022-08-07 10:19:54 -07:00
Eric Liu
21f2c7fb4c v0.67.7 2022-08-07 10:15:08 -07:00
Eric Liu
1fc719b738 style(docs): add scroll-margin-top to anchored headings [ci skip] 2022-08-07 06:21:43 -07:00
Eric Liu
0cd46712ca style(docs): side nav overlay should be clickable [ci skip] 2022-08-06 21:31:36 -07:00
Eric Liu
2532814801 style(docs): tighten up margins [ci skip] 2022-08-06 14:03:29 -07:00
Eric Liu
d4cf6577c9 docs: flatten table of contents hierarchy 2022-08-06 14:02:53 -07:00
Eric Liu
f1caf83103 docs: correctly render table of contents [ci skip] 2022-08-06 13:37:49 -07:00
metonym
e3978e883b
docs: flatten side nav hierarchy, remove recipes (#1430)
* style(docs): remove bottom margin in index route

* docs: flatten side nav hierarchy

* docs(accordion): move expandable accordion recipe

* docs(breadcrumb): move breadcrumb trail recipe

* docs: remove recipes
2022-08-06 13:27:02 -07:00
metonym
98974fba7e
style(docs): remove UI Shell overrides (#1429) 2022-08-06 12:20:40 -07:00
metonym
fd42cb3891
fix(ui-shell): remove Content left margin if SideNav is collapsed (#1428)
Fixes #1145
Alternative to #1406
2022-08-06 08:27:45 -07:00
metonym
df0e68a541 v0.67.6 2022-08-05 07:40:37 -07:00
metonym
45f14f160e
refactor: use class directive in TextInput, DatePickerInput (#1426)
Dynamically-formed class names should be avoided for easier static analysis. The Svelte `class:` directive should be used instead.
2022-08-05 05:21:49 -07:00
metonym
d2cc75d883
fix(notification): avoid dynamic class names in NotificationButton, NotificationIcon (#1425)
Fixes https://github.com/carbon-design-system/carbon-preprocess-svelte/issues/39
2022-08-05 05:20:21 -07:00
metonym
7fe9b39436
fix(number-input): forward keydown, keyup events (#1424)
Fixes #1421

`NumberInput` should forward the keydown and keyup events like other input components.
2022-08-05 04:50:40 -07:00
metonym
cae4629b98
chore(examples): remove Sapper, Snowpack examples (#1423)
* chore(examples): remove Sapper example

As of June 2022, Sapper is officially deprecated.

Ref: ef01df6f4e

* chore(examples): remove Snowpack example

As of April 2022, Snowpack is no longer maintained. Vite is the recommended alternative.

Ref: 45456aa149
2022-08-05 04:48:09 -07:00
metonym
6f9e023066 v0.67.5 2022-08-04 10:03:11 -07:00
István Pató
de81ef99af
fix(combo-box): correctly select item in a non-filterable ComboBox (#1419)
Fixes #1222

A non-filterable ComboBox will select the item that matches the typed value when pressing "Enter." An unknown (unmatched) value will select the first item.
2022-08-04 09:58:32 -07:00
dependabot[bot]
03d18ca27c
chore(deps): bump terser from 5.3.0 to 5.14.2 (#1408)
Bumps [terser](https://github.com/terser/terser) from 5.3.0 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-01 08:14:12 -07:00
dependabot[bot]
b571821397
chore(deps): bump glob-parent from 5.1.1 to 5.1.2 (#1410)
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-01 08:12:34 -07:00
dependabot[bot]
6f7bd9f2dd
chore(deps-dev): bump svelte from 3.46.6 to 3.49.0 (#1394)
Bumps [svelte](https://github.com/sveltejs/svelte) from 3.46.6 to 3.49.0.
- [Release notes](https://github.com/sveltejs/svelte/releases)
- [Changelog](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/svelte/compare/v3.46.6...v3.49.0)

---
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>
2022-08-01 08:11:58 -07:00
dependabot[bot]
99d108c123
chore(deps-dev): bump svelte from 3.48.0 to 3.49.0 in /docs (#1401)
Bumps [svelte](https://github.com/sveltejs/svelte) from 3.48.0 to 3.49.0.
- [Release notes](https://github.com/sveltejs/svelte/releases)
- [Changelog](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/svelte/compare/v3.48.0...v3.49.0)

---
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>
2022-08-01 08:11:52 -07:00
metonym
c87196c16b v0.67.4 2022-07-26 08:20:39 -07:00
metonym
8a40191c76
fix(toggle): override margin top if hideLabel is true (#1417)
Fixes #1413
2022-07-26 08:19:49 -07:00
metonym
de5b482b0c v0.67.3 2022-07-26 08:04:06 -07:00
metonym
ef904567cb Run "yarn build:docs" 2022-07-26 08:02:24 -07:00
metonym
7f7bf51f56
fix(pagination): correctly pluralize default item text (#1416)
Fixes #1412
2022-07-26 07:59:40 -07:00
metonym
a3264bd667
fix(toggle): labelText should not be selectable (#1415)
This adds a `user-select: none` rule to avoid selecting the `Toggle` label text when rapidly clicking it.
2022-07-26 07:21:19 -07:00
metonym
f4d12b805a
fix(toggle): add missing hideLabel prop (#1414)
* fix(toggle): add missing hideLabel prop

* Run "yarn build:docs"

* test(toggle): assert hideLabel prop

* docs(toggle): add "Hidden label text" example
2022-07-26 07:12:57 -07:00
Eric Liu
614e6eb087 v0.67.2 2022-07-23 06:17:56 -07:00
Johannes
8bd615b250
fix(combobox): value should call itemToString with filtered item (#1411)
Fixes #1405

When using the `shouldFilterItem` prop, the `ComboBox` does not display the custom label set with `itemToString` in the input after a selection.
2022-07-23 06:15:11 -07:00
Eric Liu
e3f98cde4b chore(examples): bump deps [ci skip] 2022-07-19 19:43:49 -07:00
Andrea N. Cardona
035c563a26
chore(carbon.yml): update library name (#1407) 2022-07-19 07:48:18 -07:00
Eric Liu
f8e400f2ed v0.67.1 2022-07-12 19:45:53 -07:00
metonym
638a43714f
fix(side-nav): set high z-index on open overlay (#1388)
Fixes #786

The UI Shell `SideNav` overlay can sometimes be superseded by other elements. This applies a `z-index` value of `6000` to the overlay when open.
2022-07-12 19:43:45 -07:00
metonym
2fedd6343f v0.67.0 2022-06-29 11:50:25 -07:00
metonym
f59daa20a2 docs: specify minimum Svelte version requirement 2022-06-29 11:49:23 -07:00
metonym
aee7f3ba76
Revert "Revert "fix(notification): on:close should be cancellable (#1379)" (#1381)" (#1382)
This reverts commit 052acfc2ce.
2022-06-29 11:11:33 -07:00
metonym
f08175b6b3 v0.66.3 2022-06-29 10:59:45 -07:00
metonym
052acfc2ce
Revert "fix(notification): on:close should be cancellable (#1379)" (#1381)
This reverts commit 924b6d352e.
2022-06-29 10:57:37 -07:00
metonym
5fa07ab44b v0.66.2 2022-06-29 10:18:24 -07:00
metonym
04f18ae5e9
docs(notification): add examples "Prevent default close behavior" (#1380)
Follow-up to #1379
2022-06-29 10:14:22 -07:00
tlkh40
924b6d352e
fix(notification): on:close should be cancellable (#1379)
Fixes #927
2022-06-29 07:08:51 -07:00
Eric Liu
3b3a9c9a29 v0.66.1 2022-06-27 05:51:31 -07:00
metonym
5a8bd9ca57
chore(code-snippet): preserve custom copy event type (#1375) 2022-06-27 05:44:05 -07:00
metonym
45627aad1f
docs: rename ComboBox example, do not open modal in DatePicker by default (#1374)
* docs(combo-box): "Selected id" -> " Initial selected id"

* docs(date-picker): do not open modal by default to prevent stealing focusing
2022-06-26 16:43:34 -07:00
metonym
c346b8edc0
fix(side-nav-menu): remove title attribute from menu icon (#1373) 2022-06-26 13:56:08 -07:00
metonym
d5d6294b02
refactor(code-snippet): pass required text prop to CopyButton (#1372)
This also passes the `copy` prop to `CopyButton` instead of wrapping it in another function.
2022-06-25 16:26:27 -07:00
metonym
6a3614bf55
fix(password-input): support invalid state when used in a FluidForm (#1371)
* fix(password-input): support invalid state when used in a `FluidForm`

* docs(fluid-form): add example "Invalid state"
2022-06-25 08:17:19 -07:00
metonym
83c11fd460
fix(side-nav-menu): chevron icon should not be focusable (#1369) 2022-06-23 05:55:01 -07:00
metonym
388a05c290
fix(side-nav-menu): expanded SideNavMenu should not have a max-height (#1368)
* fix(side-nav-menu): expanded `SideNavMenu` should not have a max-height (fixes #1361)

* chore(docs): remove max-height override
2022-06-23 05:52:02 -07:00
dependabot[bot]
f2a9ae4638
chore(deps): bump jsdom from 16.4.0 to 16.7.0 in /docs (#1367)
Bumps [jsdom](https://github.com/jsdom/jsdom) from 16.4.0 to 16.7.0.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
- [Commits](https://github.com/jsdom/jsdom/compare/16.4.0...16.7.0)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-22 22:37:08 -07:00
dependabot[bot]
87391022df
chore(deps): bump got from 11.8.3 to 11.8.5 in /examples/snowpack (#1366)
Bumps [got](https://github.com/sindresorhus/got) from 11.8.3 to 11.8.5.
- [Release notes](https://github.com/sindresorhus/got/releases)
- [Commits](https://github.com/sindresorhus/got/compare/v11.8.3...v11.8.5)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-22 22:36:50 -07:00
dependabot[bot]
510629b511
chore(deps): bump shell-quote from 1.7.2 to 1.7.3 in /docs (#1365)
Bumps [shell-quote](https://github.com/substack/node-shell-quote) from 1.7.2 to 1.7.3.
- [Release notes](https://github.com/substack/node-shell-quote/releases)
- [Changelog](https://github.com/substack/node-shell-quote/blob/master/CHANGELOG.md)
- [Commits](https://github.com/substack/node-shell-quote/compare/v1.7.2...1.7.3)

---
updated-dependencies:
- dependency-name: shell-quote
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-22 22:20:25 -07:00
metonym
9fcf9855e6
fix(composed-modal): node to focus is possibly null (#1364)
Fixes #1360
2022-06-22 06:24:02 -07:00
Eric Liu
c7be47cefb chore(changelog): include Slider example "Full width" [ci skip] 2022-06-18 13:11:28 -07:00
Eric Liu
d417eea82c v0.66.0 2022-06-18 13:05:39 -07:00
Eric Liu
87bf6e9aaf chore(docs): bump deps [ci skip] 2022-06-18 12:55:21 -07:00
metonym
1ccdf64504
feat(slider): add fullWidth prop (#1354)
The `bx--slider` class in the `Slider` component has max-width of `40rem`. Because `$$restProps` is spread to the top-level `div` element in `Slider`, the only way to override the style is to do so globally:

```css
:global(.bx--slider-container) {
  width: 100%;
}

:global(.bx--slider) {
  max-width: none;
}
```

This adds a `fullWidth` prop that sets a full width style using inline style attributes.
2022-06-18 12:47:10 -07:00
metonym
a86aa5d363
docs(select): adjust default example to demo usage without selected prop (#1358) 2022-06-18 12:45:39 -07:00
metonym
511d7c24e6
fix(select): do not dispatch "change" event on initial load (#1356)
Follow-up to #1353

If `selected` is `undefined` or not provided, the "change" event will be dispatched since the first `SelectItem` value will be set as the default.

The "change" event should only be dispatched when the value is actually changed.
2022-06-18 12:27:27 -07:00
metonym
b4d0205080
chore(select): update dispatched change event type (#1357)
Follow-up to #1355
2022-06-18 12:26:46 -07:00
metonym
78d3f1328a
feat(select): support selected prop number type (#1355)
* feat(select): support number type

* Run "yarn build:docs"

* refactor(pagination): do not coerce `pageSize`, `page` to be numbers

* test(select): assert selected prop number type
2022-06-18 11:09:41 -07:00
metonym
f8b1c8a23a
fix(select): use first SelectItem value as default if selected is undefined (#1353)
Fixes #570
2022-06-18 10:13:42 -07:00
Eric Liu
35031e800c v0.65.3 2022-06-15 07:15:27 -07:00
metonym
eb381190c9
fix(tree-view): fix type error when keyboard navigating an expanded node (#1350)
Fixes #1349
2022-06-15 07:14:09 -07:00
Eric Liu
624abe88fe v0.65.2 2022-06-12 18:12:40 -07:00
jorgebv
0f060ea035
fix(data-table): table header keys should be reactive (#1346)
Fixes #1345

Co-authored-by: Jorge Vergara <jbvergara@bethel.jw.org>
2022-06-12 18:09:33 -07:00
metonym
b21718ccfd
fix(time-picker): use native binding for value prop (#1344) 2022-06-12 08:09:43 -07:00
metonym
8e52e13ee9
fix: use native binding for value prop in ComboBox, MultiSelect (#1343)
* fix(combo-box): use native binding for value prop (fixes #1262)

* fix(multi-select): use native binding for value prop
2022-06-12 07:12:11 -07:00
Eric Liu
2c05f35c48 v0.65.1 2022-06-09 11:20:30 -07:00
metonym
e56ee83dc4
hotfix(data-table): column sort direction order should be independent (#1342)
Fixes #1341
2022-06-09 11:14:14 -07:00
Eric Liu
566d64c970 v0.65.0 2022-06-07 08:03:16 -07:00
brunnerh
37aa207c85
refactor(modal): simply nested modals logic (#1339)
Cleans up #1331 to reuse shared logic between `Modal`, `ComposedModal`.
2022-06-07 07:43:02 -07:00
metonym
95b32937d6
perf(data-table): save rows reference when reducing (#1338)
d2cdb8eb0f (r75383503)
2022-06-05 14:24:37 -07:00
metonym
72c24b83b2
feat(data-table): support programmatic sorting (#1337)
* refactor(data-table): pass down sortable props instead of using context

* feat(data-table): support programmatic sorting

* test(data-table): assert new props

* docs(data-table): add "Programmatic sorting" example

* refactor(data-table): remove unused tableSortable store

* refactor(data-table): remove unused indices
2022-06-05 13:37:50 -07:00
metonym
d2cdb8eb0f
fix(data-table): do not overwrite row.cells property (#1336)
* refactor(data-table): remove unneeded third argument from resolvePath call

* fix(data-table): do not overwrite `cells` property (#667)

* perf(data-table): early return if path in object when resolving path
2022-06-05 13:29:58 -07:00
metonym
260bf4e040
breaking(types): type arrays as read-only (#1335)
Closes #1259

* breaking(types): type arrays as read-only

* Run "yarn build:docs"

* test: assert read-only arrays
2022-06-05 13:25:43 -07:00
metonym
1a904dda36
docs(modal): add "Has scrolling content," "Custom focus" examples (#1334)
* docs(modal): add example "Has scrolling content"

* docs(modal): add "Custom focus" example

* docs: do not open modals initially
2022-06-02 19:26:26 -07:00
metonym
e62bea38aa
refactor(modal): set alert dialog attributes in markup (#1333) 2022-06-02 18:41:18 -07:00
metonym
e230db8115
feat: forward paste event to input/textarea elements (#1332)
* chore(deps-dev): upgrade sveld, svelte-check

* feat: forward paste event to input/textarea elements

* Run "yarn build:docs"

* test: assert paste event
2022-06-02 18:39:49 -07:00
metonym
f25a10c9c4
feat: support item.disabled key for Dropdown, MultiSelect, ComboBox (#1328)
Closes #1326

* feat: support item.disabled key for `Dropdown`, `MultiSelect`, `ComboBox`

* Run "yarn build:docs"

* test: assert disabled property

* docs: add "Disabled items" examples
2022-06-02 17:56:30 -07:00
metonym
22f93ee675
fix(modal): nested modals should correctly toggle the body class (#1331)
Fixes #1324
2022-06-02 17:56:07 -07:00
metonym
0063c01beb
breaking(dropdown): remove useless inline prop (#1329)
* breaking(dropdown): remove useless `inline` prop

* Run "yarn build:docs"
2022-06-02 17:36:46 -07:00
metonym
66c96612bf
fix(dropdown): remove redundant role/id (#1327)
* fix(list-box): list box item should have a role and `aria-selected` attribute

* fix(dropdown): remove redundant role/id
2022-06-01 18:55:27 -07:00
Eric Liu
068e4913e0 chore(examples): bump deps [ci skip] 2022-05-29 11:26:14 -07:00
Eric Liu
b271aa5c67 v0.64.3 2022-05-29 10:47:52 -07:00
metonym
c90594002a
fix(checkbox): do not set title attribute if already provided (#1323)
* fix(checkbox): do not set title attribute if already provided

* Run "yarn build:docs"
2022-05-29 10:42:36 -07:00
metonym
f431104057
docs(tabs): add example "Disabled tabs" (#1322) 2022-05-29 10:32:22 -07:00
Eric Liu
fa5d1df3b4 docs: make install commands more concise 2022-05-29 10:15:52 -07:00
metonym
0f621c2545
fix(tabs): selected tab should not steal focus if updated programmatically (#1320)
Fixes #572
2022-05-29 10:12:55 -07:00
metonym
0801e1d078
refactor: prefer class directive over class attribute (#1318) 2022-05-29 08:16:27 -07:00
metonym
40e18fbc88
feat: set title attribute in CheckBox, MultiSelect, Dropdown, ComboBox if label is truncated (#1317)
* feat(checkbox): set title attribute if label is truncated

* feat(list-box-menu-item): set title attribute if label is truncated
2022-05-29 08:16:17 -07:00
Eric Liu
90477c4d0e v0.64.2 2022-05-25 18:53:14 -07:00
metonym
31dacd53ab
fix(data-table): apply custom widths to empty columns (#1314)
Fixes #1313
2022-05-25 18:50:55 -07:00
Eric Liu
9137238be0 v0.64.1 2022-05-24 07:37:40 -07:00
metonym
04d758f869
fix: CopyButton text prop and Dropdown selectedId prop should be required (#1311)
* chore(deps-dev): upgrade sveld to v0.17.0

* fix(copy-button): text prop is required

* fix(dropdown): selectedId prop is required

* Run "yarn build:docs"

* docs: display "Required" tag for required props
2022-05-22 12:39:53 -07:00
Andrea N. Cardona
e70f925902
chore: update thumbnails (#1307) 2022-05-20 10:33:12 -07:00
metonym
003ab653eb
fix(theme): use @see tag for link in tokens prop description (#1309)
* fix(theme): use `@see` tag for link in tokens prop description

* Run "yarn build:docs"
2022-05-18 19:28:38 -07:00
metonym
cae1f1939e
fix(modal): remove close button title attribute, add aria-hidden to icons (#1308)
* fix(modal): close button should not have a title

* fix(modal): close icon should not have aria-label

* fix(modal): close button icons should have `aria-hidden="true"
2022-05-18 19:00:21 -07:00
metonym
e1451324cc
docs: update Theme, DataTable docs (#1305)
* docs(theme): add note that `Theme` must be used with `all.css`

* docs(data-table): add note that custom widths do not work with `stickyHeader`
2022-05-17 06:24:23 -07:00
Eric Liu
d5a3557530 v0.64.0 2022-05-14 13:57:32 -07:00
metonym
4a052afcb5
chore(date-picker): also set static: true in exported prop (#1300)
* chore(date-picker): also set `static: true` in exported prop

* Run "yarn build:docs"
2022-05-14 12:49:06 -07:00
metonym
37b40d640b
fix(types): use @see tag for flatpickr options link (#1299)
* chore(deps-dev): upgrade sveld to v0.15.3

* Run "yarn build:docs"

* fix(types): use `@see` tag for flatpickr options link
2022-05-14 12:43:12 -07:00
metonym
a958825d19
breaking(date-picker): default flatpickrProps.static to true (#1298)
Closes #985

* breaking(date-picker): default `flatpickrProps.static` to true

* docs(date-picker): update docs on `flatpickrProps.static`

* docs(date-picker): feature single/range examples first
2022-05-14 11:46:38 -07:00
István Pató
20a8a647f1
fix(date-picker): pressing "Enter" in date picker should update the value (#1280) 2022-05-14 10:00:33 -07:00
metonym
c6f210899b
feat(data-table): allow custom column widths (#1265)
* feat(data-table): allow header column `width`, `minWidth` values

* Run "yarn build:docs"

* test(data-table): assert width, minWidth properties

* docs(data-table): add "Custom column widths" example
2022-05-14 09:24:24 -07:00
metonym
6239c11024
breaking(data-table): use data attribute instead of id for table header/row (#1297)
Fixes #1294
2022-05-13 20:18:32 -07:00
metonym
7c4842f506
docs(code-snippet): add "Reactive example" (#1296)
* docs(code-snippet): add description to "Hidden copy button"

* docs(code-snippet): add "Reactive example"
2022-05-13 19:18:14 -07:00
metonym
88d5152343
fix(types): narrow dispatched events without detail to use null instead of any (#1295)
* chore(deps-dev): upgrade sveld to v0.15.2

* Run "yarn build:docs"
2022-05-13 09:56:21 -07:00
metonym
5576c7ce84
fix(header-action): type missing "open" event (#1293)
* fix(header-action): type missing "open" event

* Run "yarn build:docs"

* test(header-utilities): assert "open" and "close" events
2022-05-12 20:23:16 -07:00
metonym
1454eeae19
feat(code-snippet): dispatch "expand" and "collapse" events (#1291)
* test(code-snippet): simply assertions

* feat(code-snippet): dispatch "expand," "collapse" events

* Run "yarn build:docs"

* test(code-snippet): assert events
2022-05-12 19:52:31 -07:00
metonym
e3f72e6412
fix(code-snippet): use "small" size for expand/collapse button (#1292)
Ref: https://github.com/carbon-design-system/carbon/pull/11353
2022-05-12 19:52:17 -07:00
Eric Liu
12ffe3d70f v0.63.8 2022-05-07 12:22:53 -07:00
metonym
a2715f3df4
fix(toolbar): elevate toolbar z-index above table (#1289)
Fixes #652
2022-05-07 11:53:32 -07:00
Andrea N. Cardona
b531bd19b6
chore: index svelte components (#1266)
Add `carbon.yml` that indexes the Svelte component library.

Co-authored-by: Francine Lucca <40550942+francinelucca@users.noreply.github.com>
2022-05-04 11:12:40 -07:00
Eric Liu
5da320f33c v0.63.7 2022-05-04 07:53:46 -07:00
metonym
d242849780
fix(dropdown): strongly type translateWithId (#1286) 2022-05-04 07:52:42 -07:00
Eric Liu
0e88a24a55 v0.63.6 2022-05-04 07:43:29 -07:00
metonym
f7146b61dc
fix: remove translateWithIdMenu, use translateWithId instead, rename translateWithIdInput (#1285)
* fix: remove translateWithIdMenu, use translateWithId instead

* chore: rename translateWithIdInput to translateWithIdSelection
2022-05-04 07:40:10 -07:00
metonym
0c39506dcb
fix(types): strongly type translateWithId parameters (#1284) 2022-05-04 07:31:51 -07:00
metonym
ff2e6276db
fix: ComboBox, MultiSelect should have multiple translateWithId functions (#1283)
* fix(combo-box): ListBoxField and ListBoxSelection have different `translateWithId` props

* fix(multi-select): ListBoxField and ListBoxSelection have different `translateWithId` props

* Run "yarn build docs"

* test: assert translateWithIdMenu, translateWIthIdInput props
2022-05-04 07:17:35 -07:00
metonym
877173df59
fix: use default values if translateWithId is falsy (#1282)
* fix(list-box-menu-icon): use default translations if `translateWithId` is undefined

* fix(list-box-selection): use default translations if `translateWithId` is undefined
2022-05-03 19:43:07 -07:00
Eric Liu
39e3424b6f v0.63.5 2022-05-02 20:50:24 -07:00
metonym
9911764df1
fix(tabs): dispatch "change" event only if index has changed (#1279)
Fixes #1278
2022-05-02 20:48:59 -07:00
Eric Liu
2cc54c1a53 docs(aspect-ratio): update aspect ratio values [ci skip] 2022-04-30 13:09:19 -07:00
Eric Liu
9ec97c7517 chore(examples): bump deps [ci skip] 2022-04-30 10:59:58 -07:00
Eric Liu
ff9027be99 v0.63.4 2022-04-30 10:44:53 -07:00
metonym
52eff3c5a8
docs(data-table): add "Expandable and selectable" example (#1277)
* docs(data-table): add "Expandable and selectable" example

* docs(data-table): add "Batch selection" example

* docs(data-table): rework "Batch selection with initial selected rows" example

* docs(data-table): rework selectable examples to include selectedRowIds

* docs: remove extra space from pre tags
2022-04-30 09:58:14 -07:00
metonym
410ac0c32f
fix(aspect-ratio): add missing "2x3" ratio value (#1276)
* fix(aspect-ratio): add missing "2x3" ratio value

* Run "yarn buld:docs"

* docs(aspect-ratio): add "Ratio 2x3" example
2022-04-30 09:14:18 -07:00
metonym
30b81f9877
chore: fix typos in type annotations (#1275)
* chore: fix typos in type annotations

* Run "yarn build:docs"
2022-04-30 08:52:47 -07:00
metonym
77b6e4f831
docs(action): generate action imports (#1274) 2022-04-30 08:47:21 -07:00
metonym
3f466bc9bc
docs(icons): correctly render icon imports in examples (#1273)
Fixes #1272
2022-04-29 07:12:32 -07:00
metonym
3950496b7e
docs(tooltip): remove unnecessary tooltipBodyId in examples (#1271)
Fixes #1270
2022-04-28 15:06:10 -07:00
Eric Liu
020b2e07b6 v0.63.3 2022-04-28 07:42:15 -07:00
metonym
d40d238de5
docs(file-uploader): improve FileUploaderItem examples (#1269) 2022-04-28 07:39:58 -07:00
metonym
564f25d087
fix(file-uploader-item): fix "delete" event regression (#1268)
Fixes #1267
2022-04-28 07:30:28 -07:00
Eric Liu
6bb767f8d2 v0.63.2 2022-04-23 10:18:06 -07:00
metonym
1f18c86f4f
fix(dropdown): button type attribute should be "button" (#1264)
Fixes #739
2022-04-23 10:02:33 -07:00
metonym
49a852b1f3
fix(toolbar-search): clearing value should re-focus search bar (#1263)
Fixes #1258
2022-04-21 08:04:14 -07:00
Eric Liu
099fcbcda8 chore: update docs [ci skip] 2022-04-18 18:33:52 -07:00
Eric Liu
601c5be260 v0.63.1 2022-04-18 18:31:24 -07:00
metonym
1041c6e9f8
fix(header-global-action): icon slot should have a default size of 20 (#1257)
Fixes #1240
2022-04-18 17:57:28 -07:00
Nicolas Peugnet
43e2986434
fix(data-table): rows should be reactive (#1255) 2022-04-18 17:50:19 -07:00
Eric Liu
c2568ec5d4 docs(grid): fix typo in padded grid example [ci skip] 2022-04-17 13:04:27 -07:00
Eric Liu
6e1f9d49c4 docs(button): update "Link button" description [ci skip] 2022-04-17 12:57:29 -07:00
Eric Liu
f820f001c0 chore(examples): bump deps [ci skip] 2022-04-17 11:06:48 -07:00
Eric Liu
65bf22e3b1 chore: update COMPONENT_INDEX.md 2022-04-17 09:21:40 -07:00
Eric Liu
503de8533c v0.63.0 2022-04-17 09:20:19 -07:00
Eric Liu
63b610d01b Run "yarn build:css" 2022-04-17 09:20:13 -07:00
metonym
e19ace4135
docs(data-table): add "Sticky header" example (#1241)
* docs(data-table): add "Sticky header" example

* docs(link): add note on disabled link
2022-04-17 09:03:05 -07:00
metonym
2d26ce115d
chore(deps-dev): upgrade sveld to v0.15.0 (#1247)
* chore(deps-dev): upgrade sveld to v0.15.0

* Run "yarn build:docs"
2022-04-15 08:28:00 -07:00
metonym
7f9f45e54f
fix(tag): add type="button" on interactive, filter tag variants (#1246)
Fixes #1243
2022-04-14 20:17:23 -07:00
metonym
4c0d6ea5a2
chore: upgrade husky, lint-staged (#1239)
* chore: add husky auto-setup

* chore: update husky, lint-staged
2022-04-10 10:53:14 -07:00
Eric Liu
26e5ce5572 refactor(scripts): remove carbon-components-10.47 2022-04-10 08:47:21 -07:00
dependabot[bot]
c84bf427ce
build(deps): bump minimist from 1.2.5 to 1.2.6 (#1236)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-09 14:18:47 -07:00
metonym
35f4a5cb84
refactor(link): make a precede p element for restProps (#1237) 2022-04-09 14:17:36 -07:00
dependabot[bot]
bc1f7b728c
build(deps): bump minimist from 1.2.5 to 1.2.6 in /docs (#1235)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-09 14:16:31 -07:00
metonym
ea38cd2568
feat(types): support sveltekit:prefetch, sveltekit:noscroll attributes in type definitions (#1234)
* chore(deps-dev): upgrade sveld to 0.14.0

* Run "yarn build:docs"
2022-04-09 14:13:56 -07:00
metonym
45c272642f
fix(link): $$restProps should extend p, a HTML attributes (#1233)
* fix(link): restProps should extend `p` or `a` tag attributes

* Run "yarn build:docs"

* test(link): assert anchor link rest attributes
2022-04-09 11:24:25 -07:00
metonym
e8da9d7e9b
fix(data-table): prevent selectable datatable with sticky header from jumping (#1230)
Fixes #1228
2022-04-04 19:37:54 -07:00
Eric Liu
845225ffeb fix: use correct View icon [ci skip] 2022-04-03 12:15:56 -07:00
Eric Liu
9c0a75f052 docs: fix icons [ci skip] 2022-04-03 12:05:33 -07:00
metonym
ba58ba8f00
refactor: use icons from carbon-icons-svelte@11 (#1227)
* chore: update ignore rules, remove unused files

* refactor(icons): use icons from carbon-icons-svelte@11

* docs(time-picker): fix default value

* chore: upgrade carbon-icons-svelte to v11

* docs: update examples to use icons from carbon-icons-svelte@11

* docs: update number of icons [ci skip]
2022-04-03 11:57:28 -07:00
Eric Liu
755a8aa5bc chore(deps-dev): bump deps 2022-04-02 16:53:37 -07:00
Eric Liu
de13557477 chore: remove build:css from prepack command 2022-04-02 16:51:01 -07:00
metonym
61cf82e2b5
chore(css): check css/*.css files into source control (#1225) 2022-04-02 12:47:00 -07:00
metonym
9143e50244
breaking(actions): move truncate action to src/Truncate (#1224)
* breaking: move truncate action to src/Truncate

* docs: update truncate docs
2022-04-02 12:04:33 -07:00
metonym
62735d6275
breaking(ui-shell): remove GlobalHeader, SideNav folders (#1223)
* breaking(ui-shell): remove GlobalHeader/SideNav folders

* Run "yarn build:docs"
2022-04-02 11:46:55 -07:00
metonym
d34f571150
docs: use all.css for prefixed styles (#1221)
* docs: remove .bx--content override

* docs(ui-shell): add note on UI Shell theming

* docs(grid): touch up grid examples

* docs(theme): wrap localStorage in try catch

So that the site still works in Safari with all cookies blocked.

* docs: use prefixed all.css

Without vendor prefixes, some styles are lost in Safari.

* docs: remove svelte-preprocess from svelte.config.js
2022-04-02 11:45:29 -07:00
metonym
5209f329bd
build(types): copy .d.ts files from src to types (#1218) 2022-03-27 13:26:13 -07:00
metonym
4d955900ad
feat(breakpoint): export breakpointObserver, breakpoints (#1216) 2022-03-27 09:30:32 -07:00
metonym
6986aac1be
breaking: remove legacy optimizeCarbonImports preprocessor (#1217) 2022-03-27 09:30:15 -07:00
metonym
ade0557448
feat: upgrade carbon-components to v10.56.0 (#1213)
* chore(deps-dev): upgrade carbon-components to v10.56.0

* feat(progress-bar): add kind prop

* Run "yarn build:docs"

* test(progress-bar): assert kind prop
2022-03-27 08:27:23 -07:00
metonym
21714d0e3a
breaking: remove deprecated props and components (#1191) 2022-03-27 08:21:58 -07:00
Eric Liu
ea7c0d446e v0.62.3 2022-03-26 11:44:17 -07:00
metonym
0e370dd575
fix(tree-view): fix filter logic in expandNodes/collapseNodes (#1215)
Fixes #1214
2022-03-26 11:20:47 -07:00
metonym
5e67c707d6
fix(number-input): slotted label should render correctly (#1212)
Fixes #1208
2022-03-25 06:50:26 -07:00
metonym
051a8702e3
perf(data-table): only render table row content when expanded (#1211)
Closes #1209
2022-03-25 06:49:58 -07:00
metonym
b4e7e735b3 chore(examples): rebuild lock files [ci skip] 2022-03-23 13:26:40 -07:00
dependabot[bot]
95366bb6fd
build(deps): bump node-forge from 1.2.1 to 1.3.0 in /examples/webpack (#1201)
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](https://github.com/digitalbazaar/forge/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-23 09:50:35 -07:00
Eric Liu
b7a01fada7 v0.62.2 2022-03-23 08:44:50 -07:00
metonym
53fdbdf991
fix(data-table): expandable rows should work with zebra styles (#1200)
Fixes #1199
2022-03-23 08:04:08 -07:00
Floris Bernard
9c45c74d8d
fix(date-picker): allow flatpickrProps to override default flatpickr options (#1198)
Fixes #1197
2022-03-23 08:02:44 -07:00
metonym
912d3796f0
chore(license): add copyright metadata (#1195) 2022-03-21 18:37:58 -07:00
Eric Liu
16ac1ede6e v0.62.1 2022-03-20 07:32:04 -07:00
metonym
254bd848b4
fix(toolbar-search): context can be undefined (#1190)
Fixes #1189
2022-03-20 07:26:27 -07:00
Eric Liu
346d9b5ed0 chore(examples): bump deps [ci skip] 2022-03-19 13:41:03 -07:00
Eric Liu
f4b53369ff docs(form): evaluate code in "Prevent default behavior" example [ci skip] 2022-03-19 13:24:40 -07:00
Eric Liu
123bb91f7b chore(changelog): update v0.62.0 notes [ci skip] 2022-03-19 13:06:22 -07:00
Eric Liu
e04d6fa33a v0.62.0 2022-03-19 13:00:33 -07:00
metonym
e4800d9627
breaking: delete Copy component (#1174)
Closes #1156
2022-03-19 12:26:01 -07:00
metonym
2df7b92269
feat(toolbar-search): support auto-filterable rows (#1179)
Closes #591
2022-03-19 12:01:03 -07:00
metonym
1462b2ee9c
feat(ui-shell): make SideNavLink text slottable (#1187) 2022-03-19 11:58:47 -07:00
metonym
e23b121143
feat: make icons slottable (#1186) 2022-03-19 11:37:20 -07:00
metonym
d9ee8cb2d9
fix(header-action): stop propagation on button click event (#1185) 2022-03-19 10:44:05 -07:00
metonym
233edf3358
docs: add ClickableTile example, notes on keyed props (#1184)
* docs(clickable-tile): add "Prevent default behavior" example

* docs: add note that `items` object requires a unique `id`

* docs: remove note on selectedId

* docs(data-table): explain how header keys work
2022-03-19 10:20:34 -07:00
metonym
1017e80198
feat(multi-select): make MultiSelect slottable (#1183) 2022-03-19 09:15:58 -07:00
metonym
f5594daba6
feat(dropdown): make Dropdown slottable (#1182) 2022-03-19 09:15:52 -07:00
metonym
2858776367
feat(combo-box): make ComboBox slottable (#1181)
Closes #1176
2022-03-19 09:15:41 -07:00
metonym
ceb7abf2e9
docs: fix formatting, broken link (#1177) 2022-03-16 07:33:59 -07:00
metonym
f8aecdbef1
refactor: inline Copy component (#1175) 2022-03-14 08:17:20 -07:00
metonym
ef46f350be
breaking(form): do not prevent default behavior on submit event (#1170)
* breaking(form): do not prevent default behavior on submit event

* docs(form): add "Prevent default behavior" example
2022-03-13 19:04:10 -07:00
metonym
2657ce71c2
docs: fix formatting, broken link (#1172)
* chore: remove extra space in description comment

* docs(data-table): fix formatting

* docs(checkbox): fix broken link

* chore(deps-dev): bump deps

* Run "yarn build:docs"
2022-03-13 19:03:15 -07:00
metonym
ba0abe8e34
refactor(search): use native binding for value prop (#1173)
* refactor(search): use native binding for value prop

* feat(search): type the value prop as any
2022-03-13 19:02:46 -07:00
metonym
59ecc53a89
refactor(text-area): use native binding for value prop (#1169) 2022-03-13 19:02:02 -07:00
Eric Liu
bc8903a67b chore(changelog): update v0.61.0 notes [ci skip] 2022-03-13 11:43:05 -07:00
Eric Liu
f231375ea6 v0.61.1 2022-03-13 07:28:29 -07:00
metonym
a9e26445ac
fix(css): do not generate CSS file from _popover.scss (#1168) 2022-03-13 07:24:47 -07:00
Eric Liu
87c35b1c40 v0.61.0 2022-03-13 07:07:44 -07:00
metonym
5bf16e42f7
docs: hide deprecated components, add "Disabled items" OverflowMenu example (#1167) 2022-03-13 06:14:30 -07:00
metonym
95a1dfa1af
feat(data-table): support non-selectable rows (#1166)
Closes #1148
2022-03-12 19:36:02 -08:00
metonym
47866b1d51
breaking(header-action): use SlideParams to type transition prop (#1163) 2022-03-12 14:35:59 -08:00
metonym
53853cf64b
fix(header-action): audit HeaderAction text styles (#1162) 2022-03-12 14:28:44 -08:00
metonym
5d153601b3
fix(header-action-link): align icon with HeaderAction (#1161) 2022-03-12 14:14:22 -08:00
metonym
e2c980e23a
refactor: remove usage of deprecated Icon component (#1160) 2022-03-12 13:52:59 -08:00
metonym
cb014219fd
chore(deps-dev): upgrade svelte-check to v2.4.5 (#1159) 2022-03-12 13:50:47 -08:00
metonym
48348df43d
perf: use direct imports where possible (#1158) 2022-03-12 13:50:40 -08:00
Dominik G
9215e3b106
feat(multi-select): expose highlightedId and fix highlighting for filterable variant (#1153) 2022-03-12 13:49:10 -08:00
Daniel Power
853942f998
fix(types): correctly type validateFiles in FileUploaderDropContainer (#1149) 2022-03-08 08:40:20 -08:00
metonym
cc7b30a620
fix(scss): inline Popover styles from carbon-components v10.47 (#1139) 2022-03-08 08:39:19 -08:00
brunnerh
5de0d9a357
breaking(breakpoint): add breakpointObserver store (#1092)
* breaking: re-name event "on:match" to "on:change" in `Breakpoint.svelte`

* feat: add `breakpointObserver` read-only store

* refactor: export breakpoint constants from `breakpoints.js`
2022-03-08 08:38:58 -08:00
Eric Liu
bbd2cbe62c v0.60.0 2022-02-26 11:30:03 -08:00
metonym
a3d116215d
Align v10.54 (#1133)
* chore(deps-dev): bump carbon-components to v10.54.0

* feat(progress-bar): add size prop

* docs(progress-bar): add "Small size" example

* docs(progress-bar): add descriptions

* refactor(structured-list): remove monkey patch

* feat(radio-button-group): add hideLegend prop

* docs(radio-button): add "Hidden legend" example
2022-02-26 11:26:31 -08:00
metonym
faeee2b1a1
fix(date-picker): update calendar if options change (#1128)
Fixes #1127
2022-02-26 11:24:44 -08:00
dependabot[bot]
4eca1cc73c
build(deps-dev): bump prismjs from 1.21.0 to 1.27.0 in /docs (#1131)
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.21.0 to 1.27.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.21.0...v1.27.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>
2022-02-25 18:14:31 -08:00
Eric Liu
d90965c575 v0.59.0 2022-02-21 14:27:12 -08:00
metonym
44d848c60d
docs(file-uploader): improve FileUploader documentation (#1126)
- add `FileUploader` "Clear files" example
- document `validateFiles` prop for `FileUploaderDropContainer`
- add descriptions for `FileUploaderButton`, `FileUploader` examples
2022-02-21 14:26:02 -08:00
metonym
78072a1c66
Align v10.53 (#1109)
* chore(deps): upgrade carbon-components to v10.53.0

* feat(text-area): add maxCount prop

* docs(text-area): add maximum character count

* feat(file-uploader): add disabled prop

* docs(file-uploader): add disabled state example
2022-02-21 13:40:57 -08:00
metonym
8d3ac75170
feat(file-uploader-drop-container): rework FileUploaderDropContainer (#1125)
- convert `FileList` to `File[]` to be consistent with `FileUploader` and `FileUploaderButton`
- add `files` prop for two-way binding
- dispatch instead of forward the `change` event (detail signature: `File[]`)
2022-02-21 13:33:11 -08:00
metonym
7586b2a10f
feat(file-uploader-button): support files prop (#1120)
Closes #1116
2022-02-21 13:32:05 -08:00
Eric Liu
826b7096c8 v0.58.4 2022-02-21 09:53:17 -08:00
metonym
714f47a635
fix(types): dispatched events without a detail value should be null (#1124)
Currently, dispatched events without `e.detail` have a type of `any`.

We can be more specific as a `CustomEvent` detail value is `null`.
2022-02-21 09:42:42 -08:00
metonym
2f3cff2942
fix(file-uploader): update clearFiles accessor description (#1122)
The `clearFiles` prop description currently reads "Override the default behavior of clearing the array of uploaded files."

This is misleading as `clearFiles` is a component accessor, not a `let` prop.
2022-02-21 09:24:50 -08:00
metonym
cd687f0e1b
refactor(types): remove unnecessary JSDoc default type [ci skip] (#1123) 2022-02-21 09:24:37 -08:00
metonym
6a13ca1c0d
fix(file-uploader): correctly fire add/remove events (#1121)
Fixes #1119
2022-02-21 09:18:29 -08:00
metonym
25d28a9c4d
fix(file-uploader): FileUploader files should not be keyed (#1118)
Fixes #1115
2022-02-21 08:36:58 -08:00
metonym
7602731b0b
fix(file-uploader): FileUploader change detail should be File[] instead of FileList (#1117)
Fixes #1112
2022-02-21 08:34:03 -08:00
metonym
dce0309bab
fix(data-table): pass header key to TableHeader (#1114)
The id is needed to update the sort icon direction accordingly.

Fixes #1113
2022-02-21 08:33:41 -08:00
Eric Liu
fe8fd65893 v0.58.3 2022-02-20 07:32:55 -08:00
metonym
df4ed9d75a
fix(types): use @component comments for deprecation notices (#1111)
The Svelte Language Server allows component-level comments through `<!-- @component ... -->` syntax.

Deprecation notices for components should be moved from the script block to the markup template.
2022-02-19 18:50:25 -08:00
metonym
7c0086d00c
fix: slottable labelText should correctly render (#1110) 2022-02-19 18:24:26 -08:00
Malte Heinzelmann
33c1543bd0
fix(password-input): do not render label if labelText is not provided (#1108) 2022-02-19 18:01:49 -08:00
metonym
6dc17dd8b3
fix(structured-list): override overfow-y to be visible (#1107)
Fixes #1106
2022-02-18 15:54:23 -08:00
metonym
73b105660c
fix(multi-select): ListBoxField should not prevent default keyboard behavior (#1101)
Fixes #938
2022-02-18 15:54:00 -08:00
Eric Liu
3baa105d63 chore(examples): bump deps [ci skip] 2022-02-18 07:07:35 -08:00
metonym
1ad2ca404a
fix(content-switcher): Switch should have type="button" (#1104)
Fixes #1103
2022-02-18 06:12:28 -08:00
Ricky de Laveaga
2f8d80f9f7
chore(examples): remove config.kit.target from sveltekit (#1105) 2022-02-17 19:20:04 -08:00
dependabot[bot]
e827fe0a23
build(deps): bump vm2 from 3.9.5 to 3.9.7 in /examples/snowpack (#1098)
Bumps [vm2](https://github.com/patriksimek/vm2) from 3.9.5 to 3.9.7.
- [Release notes](https://github.com/patriksimek/vm2/releases)
- [Changelog](https://github.com/patriksimek/vm2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/patriksimek/vm2/compare/3.9.5...3.9.7)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-14 17:13:15 -08:00
Eric Liu
67a89a1a1d v0.58.2 2022-02-12 15:50:26 -08:00
metonym
c32df50689
fix(tooltip): aria-label should use iconDescription if triggerText is falsy (#1095) 2022-02-12 15:43:58 -08:00
metonym
c7de897b89
fix(overflow-menu): keyboard navigation should skip disabled items (#1096) 2022-02-12 15:43:45 -08:00
metonym
16790daaa9
fix(ui-shell): use semantic hr in HeaderPanelDivider to render dividers (#1093) 2022-02-12 08:07:21 -08:00
brunnerh
05e4c282b0
fix(button): not set aria-pressed on link buttons (#1091) 2022-02-12 06:47:53 -08:00
dependabot[bot]
acf8a26290
build(deps): bump follow-redirects in /examples/webpack (#1089)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8)

---
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>
2022-02-11 17:04:49 -08:00
Eric Liu
c2b87d987e v0.58.1 2022-02-11 16:59:00 -08:00
metonym
2f556cdda3
fix(code-snippet): remove whitespace from pre tag (#1088)
Svelte v3.46.4 preserves whitespace inside `pre` tags by default; this removes whitespace from inside the `pre` tag in `CodeSnippet`.
2022-02-11 16:56:46 -08:00
Eric Liu
933cf845c8 v0.58.0 2022-02-11 07:34:06 -08:00
metonym
3b70a35df6
feat(data-table): pass row index, cell index to "cell" slot (#1086) 2022-02-11 07:13:55 -08:00
metonym
34affd851a
fix(data-table): batch selection checkbox should be reactive (#1085) 2022-02-10 19:51:26 -08:00
metonym
a3c329a2e8
fix(ui-shell): prevent default behavior when pressing Space (#1084) 2022-02-10 19:27:59 -08:00
metonym
2148e1c7b6
feat(multi-select): add itemToProp to customize name, title, labelText values passed to input (#1074)
Currently, the input `name` for each item uses the same value as `itemToString(item)`.

This adds an `itemToInput` prop to allow the consumer to customize the name/title/labelText values passed to the `Checkbox` input.

The name attribute now defaults to use the `item.id` instead of `item.text`.
2022-02-10 08:32:24 -08:00
metonym
4a197fdb7f
ci: adjust run rules, use cache actions (#1081)
- adjust run rules to run on any pull request or a push to `master`
- use action to cache install folder to speed up builds
- run `build:api` and `build:lib` in parallel
2022-02-10 08:28:07 -08:00
metonym
63f52b4683
fix(multi-select): non-filterable MultiSelect should dispatch a blur event (#1080)
The non-filterable `MultiSelect` is missing a `blur` event.

Implementation-wise, we have to dispatch it and include the event as the `detail`. Otherwise, the filterable variant will dispatch "blur" twice because it has both a button and input.

The filterable `MultiSelect` continues to forward the blur event to the input.
2022-02-10 08:27:09 -08:00
metonym
1939e4328d
fix(ui-shell): fix HeaderNavMenu accessibility, undefined context (#1079)
Fixes:

* hotfix: remove toggle accessor from HeaderNavMenu

* hotfix(ui-shell): HeaderNavMenu context is possibly undefined

* fix: apply a11y navigation menubar attributes
2022-02-10 08:11:56 -08:00
metonym
5103e13321
feat(css): upgrade carbon-components to v10.52.0 (#1078)
Fixes:

- move `FileUploaderDropContainer` input outside of label to fix a11y error
- prevent inadvertent text selection when clicking through flatpickr months
2022-02-10 06:47:36 -08:00
metonym
18eb1e2649
fix(ui-shell): HeaderNavMenu should close when pressing Enter (#1073)
Fixes:

- pressing "Enter" on a `HeaderNavMenuItem` should close the menu
- tab blurring the last item in an open menu should close the menu
- remove "role" to fix a11y warning
2022-02-10 06:46:11 -08:00
metonym
20e61724c1
feat(tooltip-definition): export open prop, dispatch open/close events (#1057) 2022-02-09 20:00:38 -08:00
metonym
8b39ccae89
fix(multi-select): MultiSelect should correctly lose focus (#1077)
Currently, opening a MultiSelect and then clicking an interactive target will cause the MultiSelect to retain focus. This removes the logic that interferes with native blurring behavior.
2022-02-09 19:53:07 -08:00
metonym
989e0f4c65
breaking(text-input): use native bind:value, dispatch instead of forward change, input events (#1065)
Use the native `bind:value` to fix two-way reactivity. As a result, "type" is read through `$$restProps` because it cannot be dynamic when using `bind:value`.

Extend value type to include `null` for the "number" type. This is similar to how `NumberInput` works; `null` represents "no value."
2022-02-09 19:52:10 -08:00
metonym
30a5f2c201
fix(multi-select): resolve a11y violations (#1072)
- role="listbox" children require the role="option" attribute
- add a "aria-multiselectable" attribute to the listbox menu
- move "aria-label" attribute from listbox to listbox menu
- listbox field should not have a "combobox" role when expanded (the non-filterable variant serves as a button)
2022-02-09 19:49:30 -08:00
metonym
a5f5550aa0
fix(data-table): headers should be reactive (#1075)
If `headers` is dynamically updated, clicking a sortable table header will sort the incorrect column. Instead of randomly generating an id and keeping track of it through context, we can simply use the required key in `headers` as the id.
2022-02-09 19:48:20 -08:00
canerakdas
cbecfd41e2
docs(skeleton-text: remove duplicate "Heading variant" example (#1070) 2022-02-07 09:25:50 -08:00
Eric Liu
4c1277d920 v0.57.1 2022-02-01 07:28:17 -08:00
metonym
504cf09dc8
fix(tooltip): type Tooltip open, close events (#1058) 2022-02-01 07:20:43 -08:00
metonym
5358cf66ea
fix(tooltip-definition): button should have type "button" (#1056)
Fixes #1055
2022-02-01 07:05:20 -08:00
Eric Liu
d1a85915fe v0.57.0 2022-01-30 19:11:20 -08:00
brunnerh
099efedef1
breaking(number-input): align change, input events with native input behavior (#1053)
* Closes #1052

* Closes #1050
2022-01-30 09:01:51 -08:00
Gregor Wassmann
a8039a4d1e
feat(modal): support primaryButtonIcon prop (#1047) 2022-01-29 09:35:08 -08:00
Eric Liu
f53b5472e5 v0.56.1 2022-01-27 08:01:44 -08:00
metonym
402de56029
fix(number-input): value 0 should not be converted to null (#1046) 2022-01-27 08:00:32 -08:00
Eric Liu
6154e8ba05 v0.56.0 2022-01-27 07:31:48 -08:00
metonym
4e3415a4e9
docs: Checkbox, Tabs, NumberInput (#1045)
* add `Checkbox` reactive example for `bind:checked` (#967)

* update `Checkbox` reactive example for `bind:group` to demo two-way binding

* simplify `Tabs` reactive example

* add `NumberInput` "No value" example
2022-01-27 07:27:10 -08:00
metonym
9e915cf90a
breaking(number-input): type value as null | number (#1044)
Fixes #1039
2022-01-27 06:57:32 -08:00
metonym
3018c2b207
fix(text-area): export readonly prop (#1043)
Fixes #1009
2022-01-26 19:19:49 -08:00
metonym
048ebc7b81
fix(checkbox): fix two-way binding (#1042)
Fixes #967
2022-01-26 19:04:32 -08:00
Eric Liu
e37b632fef
build: decouple typegen/docgen from yarn build:lib (#1038)
* chore(deps-dev): upgrade sveld to v0.13.1

* build: separate sveld into a separate build script

* docs(contributing): update guideline on re-building docs
2022-01-24 14:16:31 -08:00
metonym
fd040b3b66 docs(clickable-tile): fix formatting 2022-01-24 13:17:35 -08:00
Eric Liu
ced7a25880 v0.55.0 2022-01-22 09:16:05 -08:00
brunnerh
25ce57fd5a
Add required prop to RadioButton. (#1035)
Fixes #1034.
2022-01-22 09:05:41 -08:00
Eric Liu
493568f08d
feat(number-input): forward focus, blur events to input (#1033) 2022-01-22 08:58:59 -08:00
Eric Liu
222d5a90e4
fix(number-input): empty input should not be coerced to 0 (#1032)
Fixes #1031
2022-01-22 08:58:48 -08:00
Eric Liu
4d51250173
Align 10.51 (#1021)
* chore(deps-dev): upgrade carbon-components to v10.51.0

* fix(slider): input should also be labelled

* refactor(date-picker): remove hotfix logic to prevent disabled icon from being clickable

Ref: https://github.com/carbon-design-system/carbon-components-svelte/pull/860

* feat(progress-step): update icons for current, incomplete steps
2022-01-22 08:02:24 -08:00
brunnerh
201e03757b
Add required prop to Checkbox. (#1030)
Fixes #1029.
2022-01-22 07:43:53 -08:00
dependabot[bot]
e3902fe724
build(deps): bump nanoid from 3.1.30 to 3.2.0 in /examples/webpack (#1027)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.30 to 3.2.0.
- [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.1.30...3.2.0)

---
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>
2022-01-21 19:06:00 -08:00
dependabot[bot]
e951c9425d
build(deps): bump nanoid from 3.1.30 to 3.2.0 in /docs (#1022)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.30 to 3.2.0.
- [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.1.30...3.2.0)

---
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>
2022-01-21 19:04:44 -08:00
dependabot[bot]
a238032b58
build(deps): bump nanoid from 3.1.23 to 3.2.0 in /examples/rollup (#1026)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.23 to 3.2.0.
- [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.1.23...3.2.0)

---
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>
2022-01-21 19:02:31 -08:00
dependabot[bot]
b31b176c09
build(deps): bump nanoid from 3.1.23 to 3.2.0 in /examples/sapper (#1024)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.23 to 3.2.0.
- [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.1.23...3.2.0)

---
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>
2022-01-21 18:51:55 -08:00
dependabot[bot]
37c54e0a14
build(deps): bump nanoid from 3.1.30 to 3.2.0 in /examples/snowpack (#1025)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.30 to 3.2.0.
- [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.1.30...3.2.0)

---
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>
2022-01-21 18:43:13 -08:00
dependabot[bot]
8094fd4fef
build(deps): bump nanoid from 3.1.30 to 3.2.0 (#1023)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.1.30 to 3.2.0.
- [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.1.30...3.2.0)

---
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>
2022-01-21 18:31:07 -08:00
Eric Liu
0d78c30b9d
fix(types): include @default annotations for props that are undefined by default (#1020)
* chore(deps-dev): upgrade sveld to v0.12.1

* Run "yarn build:lib"

* Re-run "yarn build:lib"
2022-01-20 19:29:06 -08:00
Eric Liu
1f7b5560a8
Type id as any in ComboBox, Dropdown, MultiSelect (#1019)
Loosen the prop type for `id`, `selectedId` to be `any` instead of a `string`.
2022-01-20 18:50:36 -08:00
metonym
144eba1747 chore(examples): bump deps [ci skip] 2022-01-20 09:55:18 -08:00
Eric Liu
533e7d6a1c v0.54.0 2022-01-19 07:59:04 -08:00
kwieszalka-maystreet
5da83ec869
feat(data-table): support paginated data table (#880)
Closes #702
2022-01-19 07:51:42 -08:00
Eric Liu
915f976dc0 v0.53.0 2022-01-18 19:36:15 -08:00
Eric Liu
52705bae03
docs: add breaking change notice to ComboBox, Dropdown docs (#1018) 2022-01-18 19:33:33 -08:00
István Pató
cfa036d7a6
fix(dropdown): prevent icon from being clickable in disabled state (#1017)
* fix(Dropdown): list icon was clickable in disabled state

* fix(Dropdown): the ListBox element was selectable in disabled state if extended Dropdown
2022-01-18 06:38:21 -08:00
Koichi Kiyokawa
cde8a79fa8
feat(ComboBox): selectedIndex -> selectedId (#1016)
* feat(breaking): selectedIndex -> selectedId in ComboBox

* docs: update ComboBox
2022-01-18 06:37:55 -08:00
Koichi Kiyokawa
e11a893bee
feat(Dropdown): selectedIndex -> selectedId (#1004)
* feat(breaking): selectedIndex -> selectedId in Dropdown

* feat: omit `selectedIndex` from the `select` event
2022-01-18 06:37:32 -08:00
Eric Liu
37f10ad1a2 chore(changelog): fix formatting 2022-01-17 15:14:47 -08:00
Eric Liu
c02b84edb2 v0.52.0 2022-01-17 14:12:36 -08:00
Eric Liu
b13bb8e09f
fix(tooltip): pressing "Escape" should break out of trap focus (#1015)
Fixes #924
2022-01-17 13:40:10 -08:00
Eric Liu
a60bc73fea
fix(combo-box): name should be passed to input (#1014)
Fixes #797
2022-01-17 13:07:42 -08:00
Alexis Reigel
9b32fe90f5
Emit Checkbox change event after modifying internal state (#1013)
The checkbox's internal state doesn't match the visual checked /
unchecked state. The behaviour is visible when using 1-way binding on
the checkbox and using the on:change event. The internal state is always
the opposite of the visual state.
2022-01-17 12:50:08 -08:00
Eric Liu
58de79d66b
docs(radio-button): simplify reactive example (#1012)
* docs(radio-button): simplify reactive radio button example

* docs(radio-button): rename to "Reactive example"
2022-01-16 15:06:29 -08:00
Eric Liu
e5f77aa614
docs(select): add reactive example (#1011) 2022-01-16 14:53:22 -08:00
Eric Liu
653a601f9b
Revert "Refactor prop types to omit redundant null for null | HTMLElement types" (#1008)
#996
2022-01-14 11:29:37 -10:00
Eric Liu
49a94b0ee4
fix(modal): shouldSubmitOnEnter should also dispatch "click:button--primary" (#1007)
* fix(modal): shouldSubmitOnEnter should also dispatch "click:button--primary"

Fixes #1005

* yarn build:lib
2022-01-14 08:51:48 -10:00
metonym
84d6778036 docs: add pnpm install command for carbon-preprocess-svelte 2022-01-14 06:53:22 -10:00
Eric Liu
32edfa59dd
Make Toggle labels slottable (#1002)
* feat(toggle): support slottable labels

* yarn build:lib

* docs(toggle): add "Slottable labels" example
2022-01-12 16:43:27 -10:00
Eric Liu
37f19d2171
Add option to not re-focus ComboBox when invoking clear() (#1000)
* feat(combo-box): add option to clear accessor to not re-focus input

Closes #994

* yarn build:lib

* test(combo-box): validate clear accessor params

* docs(combo-box): add clear without focus to "Clear selection" example
2022-01-12 16:12:43 -10:00
Eric Liu
d4dd33e28c
Update docs (#1001)
* docs(tree-view): avoid redundant copy

* docs(search): "clear" is dispatched when pressing "Escape"

* docs(search): refactor "Expandable variant" to demonstrate reactivity
2022-01-12 16:12:14 -10:00
dependabot[bot]
1a470cb331
build(deps): bump follow-redirects in /examples/webpack (#999)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.6 to 1.14.7.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.6...v1.14.7)

---
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>
2022-01-12 13:49:49 -10:00
metonym
e6f905228f v0.51.3 2022-01-12 13:44:50 -10:00
Eric Liu
6de73f86fb
Refactor prop types to omit redundant null for null | HTMLElement types (#998)
* refactor: omit redundant `null` prop type for HTMLElements

* yarn build:lib

* test: assert updated element prop types
2022-01-12 13:36:47 -10:00
István Pató
d31e529ca9
fix(ComboBox): programmatically set selected index (#995)
* fix(ComboBox): programmatically set selected index

* refactor(ComboBox): renaming example to Reactive example
2022-01-12 13:36:37 -10:00
metonym
8936b9b5fa chore: re-generate api docs 2022-01-10 13:58:38 -10:00
metonym
6a6713d068 v0.51.2 2022-01-10 13:41:02 -10:00
Eric Liu
f6eb958732
fix(combo-box): reset values when manually clearing input field (#992) 2022-01-10 13:05:32 -10:00
István Pató
a2a5159a59
fix(combobox): filtered ComboBox handling with keyboard (#926)
* fix(combobox): filtered ComboBox handling with keyboard

* fix: dispatching filteredItems

* fix: default value settings (init) on inputValue

* fix: multiple event dispatch, and item selection bug

* fix(ComboBox): programmatically setting selectedIndex has no effect

* fix(ComboBox): selectedIndex prog. setting on filtered items

* fix(ComboBox): removed unnecessary blur code fragment, fix mouse selection after keyboard editing
2022-01-10 12:45:37 -10:00
metonym
483eff6c9b docs: prefer <strong> over <code> 2022-01-10 12:32:01 -10:00
metonym
6731f944ab docs: do not use backticks in inline notifications 2022-01-10 12:24:11 -10:00
Eric Liu
01a548fee0
Document DatePicker usage with a Rollup set-up (#990)
* chore(example): add inlineDynamicImports: true

* docs(date-picker): add note for using DatePicker with Rollup

Closes #986
2022-01-10 12:03:14 -10:00
Eric Liu
502f9379fa
Fix a11y warnings emitted by Svelte v3.45 (#989)
* chore(deps-dev): bump svelte to version 3.45

* fix: resolve a11y violations

Fixes #988
2022-01-10 11:57:52 -10:00
Eric Liu
e4a4f136fa chore(examples): bump deps 2022-01-08 10:00:33 -08:00
dependabot[bot]
93571eb5b7
build(deps-dev): bump postcss from 8.2.4 to 8.2.13 in /docs (#984)
Bumps [postcss](https://github.com/postcss/postcss) from 8.2.4 to 8.2.13.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.2.4...8.2.13)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-08 09:48:35 -08:00
dependabot[bot]
5aeba4567b
build(deps): bump lodash from 4.17.20 to 4.17.21 in /docs (#983)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-08 09:47:53 -08:00
dependabot[bot]
74785feddf
build(deps): bump lodash from 4.17.20 to 4.17.21 (#982)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-08 09:47:45 -08:00
dependabot[bot]
9494bb9892
build(deps-dev): bump postcss from 8.2.4 to 8.2.13 (#981)
Bumps [postcss](https://github.com/postcss/postcss) from 8.2.4 to 8.2.13.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.2.4...8.2.13)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-08 09:47:36 -08:00
Eric Liu
3ca0297b5e
docs(modal): add multiple modals example (#980)
Refs: #975
2022-01-08 09:41:00 -08:00
Eric Liu
75dcf24ae5 ci: only trigger workflow on pull requests 2022-01-08 09:40:31 -08:00
Eric Liu
d4db64e2d1
docs(radio-tile): add reactive examples (#979)
Enabled by #971
2022-01-08 09:37:53 -08:00
brunnerh
e8be9280c7
Update TileGroup on programmatic selection change. (#971)
Only fire `select` event for user interaction (from RadioTile).

Uses `set` function instead of `$` to prevent cyclic dependency error.
2022-01-08 09:24:33 -08:00
metonym
31a11e6800 v0.51.1 2022-01-03 11:06:53 -08:00
brunnerh
6458c97c1a
Add required prop to Select. (#968)
Upgrade sveld to set paths correctly on Windows.
Make Prettier script compatible with Windows and run it.
2022-01-03 10:46:12 -08:00
Eric Liu
26db657868
fix(css): set global theme variable first (#969)
Fixes #966
2022-01-03 10:43:14 -08:00
Eric Liu
f8b69d23c4 chore(prettier): remove deprecated svelteBracketNewLine option [ci skip] 2022-01-01 11:05:19 -08:00
Eric Liu
dce2dda72a
Update docs (#965)
* chore(docs): run "npx browserslist@latest --update-db"

* chore(docs): upgrade carbon-icons-svelte to latest

* refactor(docs): re-use styles from css/all.scss

* chore(docs): add pnpm install command

* chore(docs): upgrade prettier, prettier-plugin-svelte

* docs(date-picker): improve "DatePicker in a modal" example

* fix(docs): restore "scripts-markup-styles" svelte sort order

* chore(docs): upgrade mdsvex

* chore(deps-dev): bump prettier, prettier-plugin-svelte, svelte

* refactor(docs): use svelte:fragment where applicable

* fix(docs): include missing "options" in svelteSortOrder prettier config
2022-01-01 10:58:42 -08:00
brunnerh
1bc04c5b42
Switch from svite to vite + vite-plugin-svelte. (#962)
Use cross-env to set environment variables platform independently in scripts.
2021-12-31 10:11:48 -08:00
Eric Liu
406d8dca25 v0.51.0 2021-12-30 14:24:42 -08:00
Gregor Wassmann
f0cf4e7ba5
Enhance Checkbox to use bind:group (#947)
* Enhance Checkbox to use bind:group

* Use custom logic

* Move multiple checkboxes above skeleton

* Incorprate PR feedback

* Any instead of string
2021-12-30 13:31:33 -08:00
Eric Liu
8443b2d7c1 v0.50.5 2021-12-30 13:15:21 -08:00
Eric Liu
66150609aa chore: rebuild docs/types 2021-12-30 13:14:22 -08:00
Eric Liu
997eeb7b48
Fix filterable MultiSelect keydown behavior (#961)
* fix(multi-select): blur input when tabbing away

Fixes #938

* fix(multi-select): close a filterable menu on "Escape"

* fix(multi-select): open filterable menu on [Space]
2021-12-30 13:00:21 -08:00
Eric Liu
f955b09c09
fix(date-picker): input should not lose focus when pressing "Enter" (#958)
Fixes #876
2021-12-30 13:00:11 -08:00
Eric Liu
9698625b15
fix(toolbar-search): input should expand if value is programmatically set (#956)
Fixes #673
2021-12-30 13:00:03 -08:00
Eric Liu
001d62c001 v0.50.4 2021-12-30 07:21:51 -08:00
Eric Liu
a522a55596
fix(date-picker): stop "Escape" from closing modal (#955)
Fixes #952
2021-12-29 06:02:55 -08:00
Eric Liu
3277527929
hotfix(multi-select): prevent double trigger in a filterable multiseelct (#954)
Fixes #940
2021-12-29 06:01:31 -08:00
Eric Liu
0214e30edf chore: update COMPONENT_INDEX.md [ci skip] 2021-12-28 14:15:53 -08:00
Eric Liu
f4512027a5 v0.50.3 2021-12-28 14:04:22 -08:00
Eric Liu
ae96fdf3d9
fix(data-table): forgo "click", "click:row" events if target is a checkbox, radio button (#951)
Fixes #933
2021-12-28 13:26:09 -08:00
Eric Liu
a32bcbccd7
fix(label-text): correctly render "labelText" slots (#949)
Fixes #944
2021-12-28 12:59:33 -08:00
brunnerh
d5a6b5873b
Modify click events to prevent navigation. (#946)
Without preventDefault the link will navigate the page instead of opening the dropdown when the tabs are in the compact mode.
Because the parent element also toggles on click, there is an additional stopPropagation to not toggle twice which in a no-op.
2021-12-28 12:59:26 -08:00
István Pató
a1377f07de
fix(textinput): displaying empty input value if value is undefined or null (#936)
#935
2021-12-28 12:59:20 -08:00
Eric Liu
3cadf2c001 v0.50.2 2021-11-27 10:06:03 -08:00
Eric Liu
4de0fab859
Fix filterable multiselect keyboard selection behavior (#923)
* fix(multi-select): correctly select correct item in filterable multiselect

Fixes #922

* fix(multiselect): do not mutate sortedItems
2021-11-27 10:04:22 -08:00
metonym
96930a4065 v0.50.1 2021-11-19 08:33:07 -08:00
Eric Liu
4f83b2d1e1
fix(data-table): forgo "click", "click:row" events if target is an OverflowMenu (#918)
#917
2021-11-19 08:29:16 -08:00
metonym
6ba20fdd65 v0.50.0 2021-11-18 13:48:14 -08:00
Eric Liu
ccc733f3f7
Support custom target(s) for ContextMenu (#916)
* feat(context-menu): add target prop to selectively trigger context menu

* feat(context-menu): include clicked element in "open" event detail

* docs(context-menu): add target, multiple target examples
2021-11-18 13:32:13 -08:00
metonym
d8f8ac2b73 v0.49.2 2021-11-18 07:49:42 -08:00
Daniel Miedzik
9bbc7698a9
Fix: Tabs dispatch change event on init (#882)
* fix tabs on change problem

* fix(tabs): dispatch change event in update/change context methods

Co-authored-by: metonym <ericyl.us@gmail.com>
2021-11-18 07:45:47 -08:00
Bilux
1aad3153b5
Correct page number when dispatching update (#911)
* Correct page number when dispatching update

When in last page of data and the page size get changed to a bigger size the current page number will be out of range of total pages.
This code will set the page number in range of total pages.

* fix(pagination): page value should not exceed totalPages

Co-authored-by: metonym <ericyl.us@gmail.com>
2021-11-18 07:41:33 -08:00
Eric Liu
914f9af3be
hotfix(popover): manually apply relative style if relative is true (#915) 2021-11-18 07:28:40 -08:00
Eric Liu
dfd53ce09b
Refactor onDestroy to use onMount return function (#914)
* refactor(select-item): replace onDestroy with onMount return function

* refactor(date-picker): replace onDestroy with onMount return function

* refactor(switch): replace onDestroy with onMount return function

* refactor(composed-modal): replace onDestroy with onMount return function
2021-11-17 13:20:26 -08:00
metonym
a160ef3b40 v0.49.1 2021-11-17 09:28:05 -08:00
Eric Liu
1a0e990bdf
hotfix(popover): include missing Popover styles from carbon-components version 10.47 (#913)
* chore(deps-dev): install carbon-components@10.47 for Popover styles

* hotfix(popover): import popover styles from carbon-components@10.47
2021-11-17 09:17:24 -08:00
metonym
62b71305d6 v0.49.0 2021-11-12 16:27:46 -08:00
Eric Liu
27ba4350cf
Align v10.48 (#907)
* chore(deps-dev): upgrade carbon-components to v10.48.0

* feat(ui-shell): support HeaderNavMenu with current item

* refactor(tile): remove unnecessary "position: relative" style

* refactor(tile): remove unused ref

* feat(inline-notification): make title/subtitle slottable

Closes #883

* feat(toast-notification): make title/subtitle/caption slottable

* chore(notification): deprecate NotificationTextDetails
2021-11-12 16:25:02 -08:00
metonym
aaf60485f0 v0.48.1 2021-11-12 14:40:14 -08:00
Eric Liu
a308c89e42
fix(date-picker): type locale prop using flatpickr types (#906)
Fixes #855
2021-11-12 14:36:46 -08:00
Eric Liu
36f6a327b2
hotfix: fix remaining imports from carbon-icons-svelte (#905) 2021-11-12 13:09:43 -08:00
Eric Liu
f2493c083d v0.48.0 2021-11-11 09:10:27 -08:00
Eric Liu
040e3d3372
Inline carbon icons, remove carbon-icons-svelte from dependencies (#904)
* feat(icons): inline carbon icons used by components

* feat(icons): update svelte components to use inlined carbon icons

* breaking(deps): remove carbon-icons-svelte

* chore(deps-dev): install carbon-icons-svelte as a devDependency
2021-11-11 08:54:45 -08:00
Eric Liu
4df812bc3f
fix(date-picker): set calendar to null (#903)
Fixes #878
2021-11-11 08:04:06 -08:00
Eric Liu
ea6757d020
Add autoWidth prop to Tabs (#901)
* feat(tabs): support auto width tabs

Closes #899

* docs(tabs): add auto width example
2021-11-10 19:46:20 -08:00
Eric Liu
08402e54bf
feat(form): add ref prop (#900)
Closes #877
2021-11-10 19:46:14 -08:00
Eric Liu
186d2863d3 v0.47.6 2021-11-10 19:38:13 -08:00
Eric Liu
32beeac85b
fix(text-input): coerce TextInput value to number if type is numerical (#902)
Fixes #898
2021-11-10 14:45:13 -08:00
Paweł Malinowski
7e76cbc8a9
fix(Tooltip): fix two way binding in cases where icon is in focus (#895) 2021-11-09 14:52:40 -08:00
Eric Liu
81daaab1ff v0.47.5 2021-11-07 12:14:44 -08:00
Eric Liu
b22058f54e hotfix(expandable-tile): set relative position in tile 2021-11-07 12:09:51 -08:00
Eric Liu
0383a2fe40 Merge branch 'master' of https://github.com/carbon-design-system/carbon-components-svelte 2021-11-07 12:04:11 -08:00
Eric Liu
a298a1bf15 Revert "docs(tooltip): hotfix reactive example #872 [ci skip]"
This reverts commit 3a0e2e92b8.
2021-11-07 12:04:06 -08:00
Paweł Malinowski
f32f8fb9dc
fix(ToolTip): better toggling logic (#885)
* fix(ToolTip): better toggling logic

* fix(ToolTip): remove redundant click handler

* fix(ToolTip): ensure at most one ToolTip is open at the same time

- a click event closes the tooltip if the target is not the tooltip or
  the tooltip icon.
- the event is registered in the capture phase and a `setTimeout` is used to
  deal with edge cases in which a button is used to toggle the tooltip
  on or off.
2021-11-07 12:03:32 -08:00
Eric Liu
0e460cdd91 v0.47.4 2021-11-06 10:46:47 -07:00
Eric Liu
b3a73cf80c
fix(data-table): avoid triggering click:row when clicking expandable row chevron (#890)
Fixes #889
2021-11-06 10:33:33 -07:00
Nicco
a317c7ed52
document static property on datepicker modal (#879)
* document static property on datepicker modal

* move to frame

* docs(date-picker): add missing props to DatePickerModal.svelte

Co-authored-by: metonym <ericyl.us@gmail.com>
2021-11-05 10:02:56 -07:00
metonym
07655aed3e docs: fix typo in button code path [ci skip] 2021-10-26 11:13:42 -07:00
metonym
af9b9a1d92 v0.47.3 2021-10-22 07:21:07 -07:00
Eric Liu
fb7ebb93cb
fix(data-table): expand batch expansion chevron if all rows are expanded #867 (#873)
Fixes #867
2021-10-22 07:18:03 -07:00
metonym
3a0e2e92b8 docs(tooltip): hotfix reactive example #872 [ci skip] 2021-10-21 09:49:16 -07:00
metonym
f4281b82e4 chore(changelog): fix typo [ci skip] 2021-10-21 08:49:22 -07:00
metonym
4cdf4a9b24 v0.47.2 2021-10-21 08:47:55 -07:00
Daniel Miedzik
51cd4ec342
fix #869 (#870) 2021-10-21 08:26:47 -07:00
Eric Liu
2aeeb728a2
fix(data-table): collapse batch expansion button if one or more rows collapsed #867 (#868) 2021-10-20 17:45:53 -07:00
Eric Liu
7b65a15345
Omit explicit "from carbon-icons-svelte" from icon prop definitions (#866)
* fix(types): update description for icon props #865

* docs(component-api): remove hardcoded Carbon Svelte icon description
2021-10-20 13:48:52 -07:00
metonym
0509e8f640 v0.47.1 2021-10-20 10:46:25 -07:00
Eric Liu
c64075acbe
fix(data-table): include border style for non-expandable rows (#864)
* fix(data-table): include border style for non-expandable rows

Fixes #861

* docs(data-table): use batchExpansion for non-expandable rows example [ci skip]
2021-10-20 10:02:10 -07:00
dependabot[bot]
ed873324e5
build(deps): bump vm2 from 3.9.3 to 3.9.5 in /examples/snowpack (#863)
Bumps [vm2](https://github.com/patriksimek/vm2) from 3.9.3 to 3.9.5.
- [Release notes](https://github.com/patriksimek/vm2/releases)
- [Changelog](https://github.com/patriksimek/vm2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/patriksimek/vm2/compare/3.9.3...3.9.5)

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

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-19 08:40:37 -07:00
metonym
7af2732f83 v0.47.0 2021-10-19 07:28:04 -07:00
Eric Liu
96d848e9ef
feat(data-table): add nonExpandableRowIds prop (#862)
* feat(data-table): add nonExpandableRowIds prop #861

* test(data-table): validate nonExpandableRowIds prop

* docs(data-table): add Non-expandable rows example
2021-10-19 07:25:22 -07:00
Eric Liu
f64b021a94 v0.46.0 2021-10-17 13:06:10 -07:00
Eric Liu
2cc8953eb5 docs: omit explicit treeview scss import 2021-10-17 12:58:44 -07:00
Eric Liu
b616243b7f
fix(date-picker-input): avoid opening calendar if input is descendant of disabled fieldset #857 (#860) 2021-10-17 12:50:21 -07:00
Eric Liu
5a96f3f49d docs: fix sidenav overlay z-index 2021-10-16 14:54:54 -07:00
Eric Liu
3203e7a61f
Upgrade sveld to v0.10 (#856)
* chore(deps-dev): upgrade sveld to v0.10.2

* feat(types): regenerate types using sveld@0.10.2

* fix(types): update @extends to use .svelte extension
2021-10-16 12:34:29 -07:00
Eric Liu
c6fc8548d3
Align v10.46 (#854)
* chore(deps-dev): upgrade carbon-components to v10.46.0

* feat(tag): support outline type

* feat(multi-select): add hideLabel prop

* chore: delete unused publish-examples.js

* chore(deps-dev): remove gh-pages

* chore: remove publish-examples script

* chore(deps-dev): upgrade carbon-components to v10.46.0

* feat(tag): support outline type

* feat(multi-select): add hideLabel prop

* chore: delete unused publish-examples.js

* chore(deps-dev): remove gh-pages

* chore: remove publish-examples script

* chore: rebuild component index
2021-10-15 17:03:45 -07:00
Eric Liu
b21600c9d6
feat(types): loosen icon prop type to allow any Svelte component #806 (#853)
* feat(types): loosen type for Carbon icons #806

* Add closeIcon option and remove stopPropagation on:click in HeaderAction (#840)

* Remove stopPropagation on:click

Remove stopPropagation on:click helps when you have more then one acction to switch between actions tabs

* fix bug for default icon

* add closeIcon attribute to HeaderAction

* feat(types): loosen type for Carbon icons #806

* chore: update TreeView, HeaderAction icon types

Co-authored-by: Daniel Miedzik <daniel.miedzik@gmail.com>
2021-10-15 16:40:23 -07:00
Daniel Miedzik
1581bc0122
Add closeIcon option and remove stopPropagation on:click in HeaderAction (#840)
* Remove stopPropagation on:click

Remove stopPropagation on:click helps when you have more then one acction to switch between actions tabs

* fix bug for default icon

* add closeIcon attribute to HeaderAction
2021-10-15 16:23:34 -07:00
metonym
e7322acaae v0.45.1 2021-10-15 07:24:19 -07:00
Eric Liu
6759d3e8a0
fix(progress-indicator): prevent keyboard navigation for incomplete steps #851 (#852) 2021-10-15 07:21:47 -07:00
metonym
a9fe4e328b v0.45.0 2021-10-13 09:01:18 -07:00
Eric Liu
c4413636a4
Programmatically expand/collapse TreeView nodes (#850)
* feat(tree-view): add accessors to programmatically expand/collapse nodes

* feat(tree-view): update docs/types

* test(tree-view): test updated TreeView accessors

* docs(tree-view): document TreeView accessors
2021-10-13 08:54:37 -07:00
metonym
e14f9f7252 v0.44.7 2021-10-13 07:40:53 -07:00
KoichiKiyokawa
fed34e40ed
fix: add a value prop to Checkbox (#849) 2021-10-13 07:38:51 -07:00
Eric Liu
e0d5e6133e docs: fix link to source [ci skip]
TODO: refactor to use exact file path from component API
2021-10-11 18:33:24 -07:00
Eric Liu
0b96614b52 v0.44.6 2021-10-11 10:16:50 -07:00
Paweł Malinowski
d3eb146fb5
fix(DataTable): handle null/undefined values when sorting (#846) 2021-10-11 10:11:59 -07:00
Alexander Mart
16c377945c
docs: how to install from pnpm (#614)
Co-authored-by: Eric Liu <ericyl.us@gmail.com>
2021-10-08 10:56:48 -07:00
metonym
12f3784bb9 chore: update links [ci skip] 2021-10-05 15:25:40 -07:00
metonym
c1306b36a2 chore: update permalinks to new doc site [ci skip] 2021-10-05 15:23:32 -07:00
metonym
bf39b268c5 chore: delete vercel.json [ci skip] 2021-10-05 15:22:48 -07:00
metonym
66033e588d v0.44.5 2021-10-04 09:20:29 -07:00
KoichiKiyokawa
05f9d2afb3
fix: menuOptionsClass in OverflowMenu (#836) 2021-10-04 09:18:48 -07:00
metonym
8a56859110 ci: update test run name [ci skip] 2021-09-29 11:51:28 -07:00
metonym
9acb7fd297 chore: remove Travis CI badge [ci skip] 2021-09-29 11:48:02 -07:00
metonym
afbbd3983b ci: remove .travis.yml [ci skip] 2021-09-29 11:46:52 -07:00
metonym
5aa8a0f8de ci: add workflow 2021-09-29 11:46:11 -07:00
Eric Liu
b2623a0695
docs: remove vercel, add Deploy to Render button (#832)
* chore: remove vercel

* docs: add Deploy to Render button
2021-09-29 09:49:15 -07:00
metonym
01637e6ae6 build: add render.yaml 2021-09-28 09:10:56 -07:00
metonym
b4f12490bc v0.44.4 2021-09-28 08:57:31 -07:00
Eric Liu
ee9bb22768
fix(clickable-tile): explicitly type restProps (#831) 2021-09-28 08:55:16 -07:00
metonym
007796f881 v0.44.3 2021-09-23 09:03:56 -07:00
Florian-Schoenherr
dbf1f225dc
fix(DataTable): useStaticWidth fix for title/description (#824)
* fix(DataTable): useStaticWidth title/description

Signed-off-by: Florian-Schoenherr <florian.schoenherr99@gmail.com>

* docs(DataTable): useStaticWidth title/description

Signed-off-by: Florian-Schoenherr <florian.schoenherr99@gmail.com>

* chore(deps-dev): upgrade carbon-components, sass

Co-authored-by: metonym <ericyl.us@gmail.com>
2021-09-23 08:55:06 -07:00
metonym
7e0b8af685 v0.44.2 2021-09-14 10:01:30 -07:00
Eric Liu
70163b36f8
fix(combo-box): remove redundant clear events #817 (#818)
Fixes #817
2021-09-14 09:56:32 -07:00
Eric Liu
60ff25c2af v0.44.1 2021-09-11 12:38:21 -07:00
Eric Liu
e4e75e5859
Fixes (#814)
* fix(combo-box): clicking chevron should not open the combo box if disabled

Fixes #776

* fix(toolbar-batch-actions): cancel text should be slottable

Fixes #782
2021-09-11 12:29:26 -07:00
metonym
36efee358f chore(changelog): fix typo 2021-09-07 08:42:20 -07:00
metonym
80dec85985 v0.44.0 2021-09-07 08:39:58 -07:00
metonym
f2a445cb7e feat(date-picker): type flatpickrProps 2021-09-07 08:39:46 -07:00
stilet
bc0b048e30
added the staticProp property for the DatePicker component to work correctly (#794)
* added the staticProp property for the Modal component to work correctly

* Update src/DatePicker/DatePicker.svelte

Co-authored-by: Eric Liu <ericyl.us@gmail.com>

* Update src/DatePicker/DatePicker.svelte

Co-authored-by: Eric Liu <ericyl.us@gmail.com>

Co-authored-by: Leonid <leo@garantum.ru>
Co-authored-by: Eric Liu <ericyl.us@gmail.com>
2021-09-07 08:18:46 -07:00
Eric Liu
fec53820aa chore: update version in component index 2021-09-06 09:57:34 -07:00
Eric Liu
05fae5093a v0.43.0 2021-09-06 09:54:20 -07:00
Eric Liu
e39efc5668 feat: rebuild types, component api 2021-09-06 09:52:00 -07:00
Rafael Dessotti
dfc00f6668
Clear ComboBox Programaticaly (#804)
* Added clear function

* Dispatching clear event

* Exporting function clear

* Added example
2021-09-06 09:47:48 -07:00
Eric Liu
18e8430646 chore: change all ibm org references to carbon-design-system 2021-09-05 15:54:37 -07:00
Eric Liu
a560584f7a chore: update version in component index 2021-09-05 15:47:08 -07:00
Eric Liu
3b7fa22fe3 v0.42.3 2021-09-05 15:41:34 -07:00
airedwin
c1bf34964d
fix: radiobutton slot not working (#799) (#808)
Co-authored-by: Edwin Leong <leong_edwin@bah.com>
2021-09-05 15:34:10 -07:00
Bilux
892c19a8dd
Set a condition for showing legend in FormGroup (#785)
We shouldn't add a <legend> If the the legend text specified.
2021-09-05 13:25:32 -07:00
Eric Y Liu
abfc472c82 v0.42.2 2021-07-29 16:03:32 -07:00
Eric
bd7c4756f7
chore: remove self from MAINTAINERS (#773) 2021-07-29 15:55:15 -07:00
Eric
0315a17d4a
Update examples, update README documentation (#772)
* chore(examples): update example set-ups

* chore: update readme docs
2021-07-29 15:51:34 -07:00
Eric
d24c60856f
fix(combo-box): fix reactivity regression #768 (#769)
* fix(combo-box): fix reactivity regression #768

Fixes #768

* fix(combo-box): if selectedItem is not defined, default selectedIndex to 0

* fix(combo-box): do not reset selectedIndex to 0, fallback to empty string

* fix(combo-box): reset selectedIndex
2021-07-29 10:09:55 -07:00
Eric Y Liu
59dce3ce65 v0.42.1 2021-07-26 08:51:18 -07:00
Eric
6db4112b40
Fix a11y-mouse-events warning, update docs (#765)
* docs: update number of available Carbon icons

* docs: add svelte:head example for loading CDN styles

* chore(deps-dev): upgrade svelte to 3.40.1

* fix(a11y): disable a11y-mouse-events-have-key-events warning #760

* fix(deps): upgrade carbon-icons-svelte to v10.36.0 to avoid a11y warnings #760

* refactor(overflow-menu): remove formatStyle utility

* docs: links in paragraphs should be inline

* docs: add note on using all styles for dynamic theming
2021-07-26 08:40:05 -07:00
Eric Y Liu
fa11c2e9c4 fix(changelog): fix typo [ci skip] 2021-07-22 17:08:11 -07:00
Eric Y Liu
87fbcf6de4 v0.42.0 2021-07-22 17:06:41 -07:00
Eric Liu
9114298f76
Align 10.40 (#763)
* docs: fix typo [ci skip]

* docs(tree-view): update expanded nodes guidance

* chore(deps-dev): upgrade carbon-components to v10.40.0

* build(css): omit treeview SCSS import

treeview.scss is included in global styles.css by default in v10.40.0

* feat(date-picker): add helperText prop

Ref: 4b5b5fdf8
2021-07-22 16:56:51 -07:00
Phil Mayer
af26bdb10a
fix: close overlays on window click (#761) 2021-07-22 09:44:23 -07:00
Eric Y Liu
7e3b0bc1cd v0.41.0 2021-07-18 06:12:26 -07:00
Eric Liu
793ecd8dc2
fix(button): only set disabled attribute if true #755 (#757)
* fix(button): only set disabled attribute if true #755

Fixes #755

* Improve docs (#756)

* docs: remove Theme from new components

* docs: add styling instructions

* docs: add styling instructions

* docs: update copy

* fix(button): only set disabled attribute if true #755

Fixes #755

* docs(button): use inline notification for note [ci skip]
2021-07-18 05:53:56 -07:00
Eric Liu
13bd64e5c9
Improve docs (#756)
* docs: remove Theme from new components

* docs: add styling instructions

* docs: add styling instructions

* docs: update copy
2021-07-18 05:39:35 -07:00
Eric Liu
d01995e11e
feat(tree-view): add expandedIds #750 (#751) 2021-07-15 07:49:25 -07:00
Nguyễn Trường Minh
89513fb4cb
fix(DataTable): undefined cell value fallback (#745)
* fix(DataTable): undefined cell value fallback

* Update DataTable.svelte

* fix(data-table): remove "" as the default value for table cells

Co-authored-by: Eric Y Liu <ericyl.us@gmail.com>
2021-07-15 06:37:42 -07:00
Eric Y Liu
51ebf185b5 v0.40.1 2021-07-14 13:53:23 -07:00
Eric Liu
a1e56bd135
Fixes (#749)
* fix(data-table): type DataTableRowId as "any" #530

Fixes #530

* fix(tree-view): make first node focusable if activeId does not match selected

* fix(overflow-menu): set type="button" to prevent default submit behavior #554

Fixes #554

* fix(overflow-menu): update semantic attributes in OverflowMenuItem

* fix(number-input): do not dispatch change event on initialization #561

Fixes #561

* fix(tree-view): make first focusable node tabbable regardless of active/selected states

* fix(date-picker): load rangePlugin dynamically

* build(rollup): enable inlineDynamicImports

* build(rollup): remove "clipboard-copy" global

* fix(overflow-menu): do not render title if using a slot #537

Fixes #537

* fix(select): forward missing focus, input events #501

Fixes #501
2021-07-14 13:48:23 -07:00
Eric Liu
ed395e42b7
fix(tree-view): TreeView should be tab focusable if no active id is provided #747 (#748)
Fixes #747
2021-07-14 08:47:08 -07:00
Eric Y Liu
3968287084 v0.40.0 2021-07-11 17:17:09 -07:00
Eric Liu
54e1e07872
fix(types): upgrade sveld and type constant props as accessors (#742) 2021-07-11 07:21:50 -07:00
Eric Liu
fac78ee4aa
feat(theme): add Theme (#741)
* feat(theme): add Theme

* fix(theme): fix broken type test

* docs(theme): add examples

* docs(theme): add description, update carbon theme link [ci skip]

* docs: pre-wrap type code snippet [ci skip]
2021-07-10 16:00:03 -07:00
Eric Liu
18c6f03224
Fix TypeScript definitions; function declarations should be typed as accessors, not props (#740)
* chore(deps-dev): upgrade svelte to v0.8.1

* chore: regenerate types to correctly type function declarations

* test: fix svelte-check warnings
2021-07-10 09:00:57 -07:00
Eric Liu
b6fa25c3e7
Align v10.39 (#738)
* chore(deps-dev): upgrade carbon-components to v10.39.0

* fix(data-table): deprecate Table shouldShowBorder prop

Ref: 0f7324156

* fix(form-group): add legendId

Ref: 4fc56c30b

* feat(number-input): support readonly variant

Ref: d0bd8eddb

* feat(multi-select): export multiSelectRef, fieldRef, selectionRef

* feat(local-storage): add clearItem, clearAll instance methods

* docs(local-storage): simplify clear example

* docs(local-storage): add instructions [ci skip]

* chore(local-storage): reset value on clear [ci skip]

* chore(local-storage): revert value clear [ci skip]
2021-07-09 13:40:25 -07:00
Eric Liu
edefd6429b
DatePicker rework (#737)
* fix(date-picker): append calendar to date picker element #345

Fixes #345

* fix(date-picker): do not import rangePlugin from esm folder

* fix(date-picker): correctly type change event for single/range types

* feat(date-picker): add valueFrom, valueTo for range datepicker

* docs(date-picker): add range type example

* docs(date-picker): extract range example to iframe

* docs(date-picker): extract single type to iframe
2021-07-08 16:33:03 -07:00
Eric Liu
569d7021cb
Improve documentation (#730)
* docs: fix "no-op" typo

* docs: add carbon-preprocess-svelte

* docs: use lg size for outbound link to source code

* docs: update copy

* docs: default to white theme

* docs(recursive-list): simplify copy

* docs(recursive-list): simplify copy

* docs: apply noGutter to installation code snippets
2021-07-08 16:30:53 -07:00
Eric Liu
19dbad1f76
fix(data-table-skeleton): every row should animate text #734 (#736)
* fix(data-table-skeleton): every row should animate text #734

Fixes #734

* fix(data-table-skeleton): revert unkeyed each
2021-07-08 07:58:26 -07:00
Eric Liu
f31ab25e0a
Breakpoint (#733)
* feat(breakpoint): add Breakpoint

* docs(breakpoint): update docs

* refactor(breakpoint): add prop descriptions, type slot

* docs: add missing semicolon to last typedef

* docs: decrease margin bottom for inline snippet

* docs: add Breakpoint to new components [ci skip]

* docs(config): use "scripts-markup-styles" for svelteSortOrder [ci skip]

* docs(breakpoint): label on:match event [ci skip]
2021-07-07 12:40:06 -07:00
Eric Liu
2d47bcaf1f
Export id in ProgressBar, add UX animated progress bar example (#732)
* fix(progress-bar): export id prop #731

Fixes #731

* docs(progress-bar): add UX example
2021-07-07 10:08:03 -07:00
Eric Y Liu
0aa52fe154 v0.39.0 2021-07-05 13:33:57 -07:00
Eric Liu
0a69f8ec74
Various features/fixes (#727)
* fix(data-table): export useStaticWidth prop

* docs(data-table): add static width example

* fix(data-table): do not render table header if title/description not provided

* feat(modal): dispatch "click:button--primary" as an alias to "submit"

* test: update DataTable types test

* test(modal): update modal type tests

* docs(data-table): add clear reminder to key headers/rows
2021-07-05 13:22:56 -07:00
Eric Liu
921c3e121a
Remove clipboard-copy dependency from CodeSnippet, CopyButton (#726)
* chore(deps): remove clipboard-copy

* feat: add copy prop, use navigator.clipboard API

* docs: add clipboard-copy back to docsite for more browser support

* docs(component-api): use outbound link

* docs: add override/prevent copy examples
2021-07-05 12:12:28 -07:00
Eric Liu
6ed4aaa86e
TreeView (#725)
* feat(tree-view): add TreeView

* fix(tree-view): select initial active node, correct typedefs

* docs(tree-view): update examples

* chore(tree-view): add test for types

* docs(tree-view): rename example

* docs(tree-view): improve docs

* docs(tree-view): refine examples

* docs: fix invalid syntax

* chore: rebuild component index/api

* docs(layout): increase height of sidenav menu [ci skip]
2021-07-05 09:11:15 -07:00
Eric Liu
f4a3646cb4
feat(modal): support 3-button Modal, ComposedModal (#724)
* feat(modal): support 3-button modal #528, #472

* fix(modal): "supercede" --> "supersede"

* test(modal): test secondaryButtons prop, updated click:button--secondary custom event

* docs(modal): add multiple secondary button example for ComposedModal

* docs(modal): rename example

* fix(modal): do not render secondary button if secondaryButtonText is falsy

* docs(composed-modal): add button to re-open modal
2021-07-05 08:44:51 -07:00
Eric Liu
a62e9c0c3c
feat(ui-shell): export expansionBreakpoint as a prop in Header, SideNav #715 (#723)
Closes #715
2021-07-05 08:44:21 -07:00
Eric Liu
5fee13b2eb
feat(data-table): make title, description slottable #720 (#722)
Closes #720
2021-07-05 08:44:07 -07:00
Eric Liu
ae27bedf4c
RecursiveList (#717)
* feat(recursive-list): add RecursiveList

* feat(recursive-list): rename items prop to children

* docs(recursive-list): add full examples

* test(recursive-list): add types test

* refactor(recursive-list): remove superfluous nested prop

* docs(recursive-list): update docs

* fix(recursive-list): remove nested prop from type test

* fix(recursive-list): explicitly type restProps
2021-07-05 08:43:48 -07:00
Eric Liu
870c2c2ae8
docs: render component API typedefs (#721)
* style(component-api): use flush, condensed structured list for prop table

* style(component-api): use small tag variant for reactive props

* docs(component-api): render component typedefs
2021-07-03 15:29:26 -07:00
Eric Y Liu
c647cb27a7 v0.38.2 2021-07-03 13:46:21 -07:00
Eric Liu
f9183d343b
fix(text-area): omit prop if readonly={false} #710 (#719)
Fixes #710
2021-07-03 13:42:24 -07:00
Eric Y Liu
776639495f fix(overflow-menu): add guard to prevent focus on falsy ref #714
Fixes #714
2021-07-03 13:34:38 -07:00
Eric Liu
9763bf5cab
docs: add g80 to valid themes (#718) 2021-07-03 05:11:52 -07:00
dqzx
ab04bb7564
Fix: trap tab focus within modal (#716)
* Fix: trap tab focus within modal

* Fix: trap tab focus within ComposedModal

* change selector criteria for tabbable elements based on react component logic
2021-07-03 03:42:35 -07:00
1143 changed files with 68166 additions and 43305 deletions

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

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

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Ask a question
url: https://github.com/carbon-design-system/carbon-components-svelte/discussions
about: Please ask and answer questions here.
- name: Carbon Design System Discord
url: https://discord.gg/J7JEUEkTRX
about: Chat with us on Discord.

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@v5
- uses: actions/setup-node@v5
with:
node-version: 22
cache: "npm"
- run: npm ci
- run: npm run lint
test:
runs-on: macos-15-xlarge
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 22
cache: "npm"
- run: npm ci
- run: npm run test
types:
runs-on: macos-15-xlarge
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 22
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"

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@v5
- uses: actions/setup-node@v5
with:
node-version: 22
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

10
.gitignore vendored
View file

@ -1,10 +1,4 @@
/coverage
/lib
/node_modules
/css/*.css
node_modules
.DS_Store
yarn-debug.log*
yarn-error.log*
*.tgz
.vscode
.idea
.idea

View file

@ -1,9 +1,9 @@
/coverage
/lib
/css
/**/__sapper__
/**/.routify
/**/dist
/**/client
/**/build
*.svx
/types
.svelte-kit
.routify
dist
client
build
*.svx
COMPONENT_API.json

View file

@ -1,6 +0,0 @@
language: node_js
node_js: 12
cache: yarn
script:
- yarn prepack
- yarn test

File diff suppressed because it is too large Load diff

View file

@ -1,2 +0,0 @@
* @metonym
* @josefaidt

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,11 @@
# Contributing
Before submitting a pull request (PR), consider [filing an issue](https://github.com/IBM/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
- [Node.js](https://nodejs.org/en/download/package-manager/) (version >=12)
- [Yarn](https://classic.yarnpkg.com/en/docs/install)
- [Node.js](https://nodejs.org/en/download/package-manager/) (version >=20)
- [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm#using-a-node-installer-to-install-nodejs-and-npm)
## Project set-up
@ -19,42 +19,35 @@ cd carbon-components-svelte
Set the original repository as the upstream:
```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
git remote -v
```
### Install
Install the project dependencies:
Install the project dependencies.
```sh
# carbon-components-svelte/
yarn install
npm install
```
## 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.
First, create a symbolic link at the root of the project folder:
First, create a symbolic link at the root of the project:
```sh
# carbon-components-svelte/
yarn link
npm link
```
Go into the `docs` folder:
Then, go into `docs` and link the package.
```sh
cd docs
```
Link `"carbon-components-svelte"`:
```sh
yarn link "carbon-components-svelte"
yarn install
npm link "carbon-components-svelte"
npm install
```
If linked correctly, any change to a component in the `src` folder should be reflected in the `docs` site.
@ -74,10 +67,10 @@ Preview changes to components from the `src` folder in the documentation website
In the `docs` folder, run:
```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
@ -105,7 +98,7 @@ export let size = "default";
### Creating a component
First, [submit an issue](https://github.com/IBM/carbon-components-svelte/issues).
First, [submit an issue](https://github.com/carbon-design-system/carbon-components-svelte/issues).
If creating a new component, don't forget it from `src/index.js`:
@ -121,23 +114,14 @@ export {
} from "./ComposedModal";
```
### Build
### Run `npm run build:docs`
Verify that you can build the library by running the following command at the project root:
Run the following command to re-generate TypeScript definitions and documentation.
```sh
# carbon-components-svelte/
yarn prepack
npm run build:docs
```
This does several things:
- uses `node-sass` to pre-compile CSS StyleSheets in the `css` folder
- uses Rollup to bundle the Svelte components in `src` in ESM/UMD formats; emitted to `lib`
- uses a Rollup plugin to:
- generate component documentation in Markdown format (`COMPONENT_INDEX.md`)
- generate TypeScript definitions (`types/index.d.ts`)
## Submit a Pull Request
### Sync Your Fork
@ -153,3 +137,51 @@ git merge upstream/master
### Submit a PR
After you've pushed your changes to remote, submit your PR. Make sure you are comparing `<YOUR_USER_ID>/feature` to `origin/master`.
## Maintainer guide
The following items only apply to project maintainers.
### Release
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).
The workflow is automatically triggered when pushing a tag that begins with `v` (e.g., `v0.81.1`).
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:
```sh
# 1. Commit the changes using the new version as the commit message.
git commit -am "v0.81.1"
# 2. Create a tag.
git tag v0.81.1
# 3. Push the tag to the remote.
# This will trigger the `release.yml` workflow to publish a new package to NPM (with provenance).
git push origin v0.81.1
```
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.
### 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).
```

View file

@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Copyright 2019 IBM
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View file

@ -1,5 +0,0 @@
# Maintainers
[Eric Liu](https://github.com/metonym) - eric.young.liu@ibm.com
[Josef Aidt](https://github.com/josefaidt) - josef.aidt@gmail.com

374
README.md
View file

@ -1,9 +1,11 @@
# carbon-components-svelte
[![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)
[![Build][build]][build-badge]
<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">
</a>
Carbon Components Svelte is a [Svelte](https://github.com/sveltejs/svelte) component library that implements the [Carbon Design System](https://github.com/carbon-design-system), an open source design system by IBM.
@ -11,62 +13,119 @@ Design systems facilitate design and development through reuse, consistency, and
The Carbon Svelte portfolio also includes:
- **[Carbon Icons Svelte](https://github.com/IBM/carbon-icons-svelte)**: 6000+ Carbon icons as Svelte components
- **[Carbon Pictograms Svelte](https://github.com/IBM/carbon-pictograms-svelte)**: 700+ Carbon pictograms as Svelte components
- **[Carbon Charts Svelte](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/svelte)**: 20 chart types, powered by d3
- **[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)**: 1,300+ Carbon pictograms as Svelte components
- **[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
## [Documentation](http://ibm.biz/carbon-svelte)
<a href="https://www.vercel.com?utm_source=carbon-components-svelte&utm_campaign=oss" target="_blank"><img height="34px" src="./docs/public/powered-by-vercel.svg" alt="Deploys by Vercel" /></a>
The [documentation website](http://ibm.biz/carbon-svelte) contains live demos and examples.
## [Documentation](https://svelte.carbondesignsystem.com)
Other forms of documentation are auto-generated:
- **[TypeScript definitions](types)**: Component TypeScript definitions
- **[Component Index](COMPONENT_INDEX.md)**: Markdown file documenting component props, slots, and events
- **[Component API](docs/src/COMPONENT_API.json)**: Component API metadata in JSON format
- **[Component Index](COMPONENT_INDEX.md)**: Component API in Markdown format
- **[Component API](docs/src/COMPONENT_API.json)**: Component API in JSON format
## Getting started
Install `carbon-components-svelte` as a development dependency.
## Installation
```sh
yarn add -D carbon-components-svelte
# OR
npm i -D carbon-components-svelte
# npm
npm i carbon-components-svelte
# pnpm
pnpm i carbon-components-svelte
# Yarn
yarn add carbon-components-svelte
# Bun
bun add carbon-components-svelte
```
## Usage
The quickest way to get started is to customize a template from the [examples](examples/) folder.
### Styling
Example set-ups demonstrate usage with popular application bundlers and frameworks. They include a mix of client-side rendering (CSR) and server-side rendering (SSR) approaches.
Before importing components, you will need to first apply Carbon component styles. The Carbon Design System supports five themes (2 light, 3 dark).
- **[examples/rollup](examples/rollup/)**: SPA bundled using [Rollup](https://github.com/rollup/rollup)
- **[examples/rollup-typescript](examples/rollup-typescript/)**: SPA bundled using [Rollup](https://github.com/rollup/rollup) with TypeScript support
- **[examples/routify](examples/routify/)**: SPA + static export using [Routify](https://github.com/roxiness/routify)
- **[examples/sapper](examples/sapper/)**: SSR + static export using [Sapper](https://github.com/sveltejs/sapper)
- **[examples/svite](examples/svite/)**: SPA developed with Svite, bundled with [Rollup](https://github.com/rollup/rollup)
- **[examples/webpack](examples/webpack/)**: SPA bundled with [webpack](https://github.com/webpack/webpack)
- **white.css**: Default Carbon theme (light)
- **g10.css**: Gray 10 theme (light)
- **g80.css**: Gray 80 theme (dark)
- **g90.css**: Gray 90 theme (dark)
- **g100.css**: Gray 100 theme (dark)
- **all.css**: All themes (White, Gray 10, Gray 90, Gray 100) using [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)
### Scaffolding
Each StyleSheet is [generated](scripts/build-css.js) from the flagship [carbon-components](https://github.com/carbon-design-system/carbon/tree/main/packages/carbon-components) library.
Each example is published in a dedicated branch of the same name.
The compiled CSS is generated from the following `.scss` files:
Use [degit](https://github.com/Rich-Harris/degit) to scaffold a new project:
- [css/white.scss](css/white.scss)
- [css/g10.scss](css/g10.scss)
- [css/g80.scss](css/g80.scss)
- [css/g90.scss](css/g90.scss)
- [css/g100.scss](css/g100.scss)
- [css/all.scss](css/all.scss)
For example, to use the `svite` template, run the following commands:
#### CSS StyleSheet
```sh
npx degit ibm/carbon-components-svelte#svite svelte-app
cd svelte-app
yarn install
```js
// White theme
import "carbon-components-svelte/css/white.css";
// Gray 10 theme
import "carbon-components-svelte/css/g10.css";
// Gray 80 theme
import "carbon-components-svelte/css/g80.css";
// Gray 90 theme
import "carbon-components-svelte/css/g90.css";
// Gray 100 theme
import "carbon-components-svelte/css/g100.css";
// All themes
import "carbon-components-svelte/css/all.css";
```
### 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.
Refer to the [official Carbon guide on SASS](https://github.com/carbon-design-system/carbon/blob/v10/docs/guides/sass.md) for documentation.
### Dynamic theming
Use the "all.css" StyleSheet for dynamic, client-side theming.
```js
import "carbon-components-svelte/css/all.css";
```
Update the theme by setting the `theme` attribute on the `html` element. The default `theme` is `"white"`.
```html
<!doctype html>
<html lang="en" theme="g10">
<body>
...
</body>
</html>
```
Programmatically switch between each of the five Carbon themes by setting the "theme" attribute on the HTML element.
```html
<script>
let theme = "white"; // "white" | "g10" | "g80" | "g90" | "g100"
$: document.documentElement.setAttribute("theme", theme);
</script>
```
### Importing components
Import components from `carbon-components-svelte` in the `script` tag of your Svelte file.
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
<!-- App.svelte -->
@ -83,165 +142,126 @@ 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.**
### Pre-compiled CSS StyleSheets
## Preprocessors & Plugins
`carbon-components-svelte` includes pre-compiled CSS StyleSheets for each Carbon theme:
[carbon-preprocess-svelte](https://github.com/carbon-design-system/carbon-preprocess-svelte) is a collection of Svelte preprocessors for Carbon.
- **white.css**: Default Carbon theme (light)
- **g10.css**: Gray 10 theme (light)
- **g80.css**: Gray 80 theme (dark)
- **g90.css**: Gray 90 theme (dark)
- **g100.css**: Gray 100 theme (dark)
- **all.css**: All themes (White, Gray 10, Gray 90, Gray 100) using [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)
> [!NOTE]
> Using `carbon-preprocess-svelte` is optional and not a prerequisite for this library. It should be installed as a development dependency.
Each StyleSheet is [generated](scripts/build-css.js) from the flagship [carbon-components](https://github.com/carbon-design-system/carbon/tree/master/packages/components) library.
```sh
# npm
npm i -D carbon-preprocess-svelte
The compiled CSS is generated from the following `.scss` files:
# pnpm
pnpm i -D carbon-preprocess-svelte
- [css/white.scss](css/white.scss)
- [css/g10.scss](css/g10.scss)
- [css/g80.scss](css/g80.scss)
- [css/g90.scss](css/g90.scss)
- [css/g100.scss](css/g100.scss)
- [css/all.scss](css/all.scss)
# Yarn
yarn add -D carbon-preprocess-svelte
# Bun
bun add -D carbon-preprocess-svelte
```
### `optimizeImports`
`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:
- [carbon-components-svelte](https://github.com/carbon-design-system/carbon-components-svelte)
- [carbon-icons-svelte](https://github.com/carbon-design-system/carbon-icons-svelte)
- [carbon-pictograms-svelte](https://github.com/carbon-design-system/carbon-pictograms-svelte)
**Before & After**
```diff
- import { Button } from "carbon-components-svelte";
+ import Button from "carbon-components-svelte/src/Button/Button.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";
```
#### Usage
##### `svelte-preprocess`
The easiest way to import a StyleSheet is with [svelte-preprocess](https://github.com/sveltejs/svelte-preprocess).
```js
const svelteOptions = {
preprocess: require("svelte-preprocess")(),
};
```
```html
<!-- App.svelte -->
<style lang="scss" global>
/** Gray 10 theme **/
@import "carbon-components-svelte/css/g10";
</style>
```
##### JavaScript import
Importing a CSS file in a JavaScript file will require the appropriate file loader(s).
```js
import "carbon-components-svelte/css/all.css";
import App from "./App.svelte";
const app = new App({ target: document.body });
export default app;
```
See [webpack.config.js](examples/webpack/webpack.config.js) in [examples/webpack](examples/webpack).
#### Dynamic theming
Use `carbon-components-svelte/css/all.css` for dynamic, client-side styling.
Update the theme by setting the `theme` attribute on the `html` element. The default `theme` is `"white"`.
```html
<!DOCTYPE html>
<html lang="en" theme="g10">
<body>
...
</body>
</html>
```
Using JavaScript:
```svelte
<script>
/** @type {"white" | "g10" | "g80" | "g90" | "g100"} */
let theme = "white";
$: document.documentElement.setAttribute("theme", theme);
</script>
<button on:click="{() => (theme = 'g90')}">Update theme</button>
```
## Preprocessors
### optimizeCarbonImports
`optimizeCarbonImports` is a Svelte preprocessor that optimizes base imports inside the `script` block of a Svelte file from the following libraries:
- carbon-components-svelte
- carbon-icons-svelte
- carbon-pictograms-svelte
The preprocessor rewrites base imports to directly import the source Svelte file. This may lead to faster complile times **during development**.
Example:
**Before**
```js
import { Button, Header } from "carbon-components-svelte";
import { Notification20 } from "carbon-icons-svelte";
import { Airplane } from "carbon-pictograms-svelte";
```
**After**
```js
import Button from "carbon-components-svelte/Button/Button.svelte";
import Header from "carbon-components-svelte/UIShell/GlobalHeader/Header.svelte";
import Notification20 from "carbon-icons-svelte/lib/Notification20/Notification20.svelte";
import Airplane from "carbon-pictograms-svelte/lib/Airplane/Airplane.svelte";
```
#### svelte.config.js
See [examples](examples) for full configurations.
```js
// svelte.config.js
const {
optimizeCarbonImports,
} = require("carbon-components-svelte/preprocess");
import { optimizeImports } from "carbon-preprocess-svelte";
module.exports = {
preprocess: [optimizeCarbonImports()],
export default {
preprocess: [optimizeImports()],
};
```
#### svelte-loader
Any other preprocessors that transpile code in the `script` block should be invoked before `optimizeImports`.
For example, `vitePreprocess` should precede `optimizeImports`.
```diff
// svelte.config.js
+ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
import { optimizeImports } from "carbon-preprocess-svelte";
export default {
preprocess: [
+ vitePreprocess(),
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
// webpack.config.js
const {
optimizeCarbonImports,
} = require("carbon-components-svelte/preprocess");
// vite.config.js
import { sveltekit } from "@sveltejs/kit/vite";
import { optimizeCss } from "carbon-preprocess-svelte";
import { defineConfig } from "vite";
module.exports = {
// ...
module: {
rules: [
{
test: /\.svelte$/,
use: {
loader: "svelte-loader",
options: {
hotReload: true,
preprocess: [optimizeCarbonImports()],
},
},
},
],
},
};
export default defineConfig({
plugins: [sveltekit(), optimizeCss()],
});
```
## Examples
- [examples/rollup](examples/rollup/)
- [examples/sveltekit](examples/sveltekit/)
- [examples/vite](examples/vite/)
- [examples/webpack](examples/webpack/)
## TypeScript support
[TypeScript definitions](types) are generated by [sveld](https://github.com/IBM/sveld).
[TypeScript definitions](types) are generated by [sveld](https://github.com/carbon-design-system/sveld).
## Contributing
@ -255,5 +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-url]: https://npmjs.com/package/carbon-components-svelte
[build]: https://img.shields.io/travis/com/ibm/carbon-components-svelte?color=24a148&style=for-the-badge
[build-badge]: https://travis-ci.com/ibm/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

@ -1 +0,0 @@
export { truncate } from "./truncate";

737
carbon.yml Normal file
View file

@ -0,0 +1,737 @@
# yaml-language-server: $schema=https://unpkg.com/@carbon-platform/schemas@v1/carbon-resources.schema.json
library:
id: carbon-components-svelte
name: Carbon Svelte
description: Build user interfaces with Carbon's core components.
externalDocsUrl: https://svelte.carbondesignsystem.com
inherits: carbon-styles
navData:
- title: Get started
path: "https://github.com/carbon-design-system/carbon-website/blob/carbon-platform/src/pages/developing/frameworks/svelte.mdx"
designKits:
carbon-white-sketch:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-white-sketch
carbon-g10-sketch:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-g10-sketch
carbon-g90-sketch:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-g90-sketch
carbon-g100-sketch:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-g100-sketch
carbon-shell-sketch:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-shell-sketch
carbon-white-adobe-xd:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-white-adobe-xd
carbon-g10-adobe-xd:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-g10-adobe-xd
carbon-g90-adobe-xd:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-g90-adobe-xd
carbon-g100-adobe-xd:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-g100-adobe-xd
axure-widget-library:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/axure-widget-library
text-toolbar-sketch:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/text-toolbar-sketch
carbon-mid-fi-sketch:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-mid-fi-sketch
carbon-wireframe-invision-freehand:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-wireframe-invision-freehand
carbon-white-figma:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-white-figma
carbon-g10-figma:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-g10-figma
carbon-g90-figma:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-g90-figma
carbon-g100-figma:
$ref: https://unpkg.com/@carbon-platform/resources/carbon.yml#/designKits/carbon-g100-figma
assets:
accordion:
status: stable
externalDocsUrl: https://www.carbondesignsystem.com/components/accordion/usage
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Accordion
aspect-ratio:
status: stable
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/AspectRatio
breadcrumb:
status: stable
externalDocsUrl: https://www.carbondesignsystem.com/components/breadcrumb/usage
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Breadcrumb
breakpoint:
name: Breakpoint
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/breakpoint.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Breakpoint
tags:
- shell
button:
status: stable
externalDocsUrl: https://www.carbondesignsystem.com/components/button/usage
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Button
button-set:
name: Button set
description: Buttons in a button set are juxtaposed by default.
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/button-set.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/ButtonSet
tags:
- input-control
checkbox:
status: stable
externalDocsUrl: https://www.carbondesignsystem.com/components/checkbox/usage
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Checkbox
clickable-tile:
name: Clickable tile
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/clickable-tile.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/ClickableTile
tags:
- contextual-navigation
code-snippet:
status: stable
externalDocsUrl: https://www.carbondesignsystem.com/components/code-snippet/usage
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/CodeSnippet
combo-box:
status: stable
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/ComboBox
composed-modal:
name: Composed modal
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/composed-modal.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/ComposedModal
tags:
- input-control
content-switcher:
status: stable
externalDocsUrl: https://www.carbondesignsystem.com/components/content-switcher/usage
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/ContentSwitcher
context-menu:
name: Context menu
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/context-menu.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/ContextMenu
tags:
- input-control
- contextual-navigation
copy-button:
status: stable
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/CopyButton
data-table:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/data-table/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/DataTable
date-picker:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/date-picker/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/DatePicker
definition-tooltip:
status: stable
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/TooltipDefinition
dropdown:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/dropdown/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Dropdown
expandable-tile:
name: Expandable tile
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/expandable-tile.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/ExpandableTile
tags:
- data-display
- content-element
file-uploader:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/file-uploader/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/FileUploader
fluid-form:
name: Fluid form
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/fluid-form.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/FluidForm
tags:
- form
form:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/form/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Form
grid:
status: stable
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Grid
image-loader:
name: Image loader
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/image-loader.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/ImageLoader
tags:
- shell
- media
- media
inline-loading:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/inline-loading/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/InlineLoading
inline-notification:
name: Inline notification
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/inline-notification.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/InlineNotification
tags:
- system-feedback
link:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/link/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Link
loading:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/loading/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Loading
local-storage:
name: Local storage
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/local-storage.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/LocalStorage
tags:
- input-control
modal:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/modal/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Modal
multiselect:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/dropdown/usage/#multiselect
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/MultiSelect
number-input:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/number-input/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/NumberInput
ordered-list:
name: Ordered list
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/ordered-list.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/OrderedList
tags:
- data-display
overflow-menu:
name: Overflow menu
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: ''
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/OverflowMenu
tags:
- input-control
pagination:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/pagination/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Pagination
pagination-nav:
status: stable
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/PaginationNav
password-input:
name: Password input
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/password-input.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/PasswordInput
tags:
- form
- contextual-navigation
popover:
status: stable
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Popover
progress-bar:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/progress-bar/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/ProgressBar
progress-indicator:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/progress-indicator/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/ProgressIndicator
radio-button:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/radio-button/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/RadioButton
radio-tile:
name: Radio tile
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/radio-tile.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/RadioTile
tags:
- input-control
recursive-list:
name: Recursive list
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/recursive-list.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/RecursiveList
tags:
- data-display
search:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/search/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Search
select:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/select/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Select
selectable-tile:
name: Selectable tile
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/selectable-tile.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/SelectableTile
tags:
- input-control
skeleton-placeholder:
name: Skeleton placeholder
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/skeleton-placeholder.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/SkeletonPlaceholder
tags:
- system-feedback
skeleton-text:
name: Skeleton text
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/skeleton-text.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/SkeletonText
tags:
- shell
slider:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/slider/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Slider
structured-list:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/structured-list/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/StructuredList
tabs:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/tabs/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Tabs
tag:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/tag/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Tag
text-area:
status: stable
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/TextArea
text-input:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/text-input/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/TextInput
theme:
status: stable
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Theme
tile:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/tile/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Tile
time-picker:
status: stable
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/TimePicker
toast-notification:
name: Toast notification
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/toast-notification.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/ToastNotification
tags:
- input-control
toggle:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/toggle/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Toggle
tooltip:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/tooltip/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Tooltip
tooltip-icon:
name: Tootlip icon
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/tooltip-icon.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/TooltipIcon
tags:
- content-element
tree-view:
status: stable
framework: svelte
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/TreeView
truncate:
name: Truncate
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/truncate.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/Truncate
tags:
- data-display
ui-shell-header:
status: stable
framework: svelte
externalDocsUrl: https://www.carbondesignsystem.com/components/UI-shell-header/usage
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/UIShell
unordered-list:
name: Unordered list
status: stable
type: component
platform: web
framework: svelte
thumbnailPath: './thumbnails/unordered-list.svg'
demoLinks:
- type: storybook
name: Storybook
action: link
url: https://svelte.carbondesignsystem.com/components/UnorderedList
tags:
- data-display

325
css/_popover.scss Normal file
View file

@ -0,0 +1,325 @@
// This file is inlined from `carbon-components@10.47` as
// Popover styles were removed since version 10.48.
//
// Copyright IBM Corp. 2016, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//
@import 'carbon-components/scss/globals/scss/vars';
@import 'carbon-components/scss/globals/scss/helper-mixins';
@import 'carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/import-once/import-once';
/// Popover component
/// @access private
/// @group components
@mixin popover {
$popover-text-color: $text-01;
$popover-caret-offset: 1rem;
$popover-offset: 8px;
.#{$prefix}--popover {
// Specify the distance between the popover and the trigger. This value must
// have a unit otherwise the `calc()` expression will not work
// stylelint-disable-next-line length-zero-no-unit
--cds-popover-offset: 0rem;
// Specify the distance that the caret should be offset from the side of the
// popover when not centered
--cds-popover-caret-offset: 1rem;
position: absolute;
z-index: z('floating');
display: none;
}
// We use a pseudo element inside of the popover to create a space between the
// target and the popover. This helps in situations like tooltips where you do
// not want the tooltip to disappear when the user moves from the target to
// the popover.
.#{$prefix}--popover::before {
position: absolute;
display: block;
content: '';
}
.#{$prefix}--popover--open {
display: block;
}
.#{$prefix}--popover-contents {
@include box-shadow;
position: relative;
width: max-content;
max-width: rem(368px);
background-color: $ui-01;
border-radius: 2px;
color: $popover-text-color;
}
.#{$prefix}--popover--light .#{$prefix}--popover-contents {
background-color: $ui-background;
}
.#{$prefix}--popover--high-contrast .#{$prefix}--popover-contents {
background-color: $inverse-02;
color: $inverse-01;
}
.#{$prefix}--popover--caret {
--cds-popover-offset: 0.5rem;
}
.#{$prefix}--popover--caret .#{$prefix}--popover-contents::before,
.#{$prefix}--popover--caret .#{$prefix}--popover-contents::after {
position: absolute;
display: inline-block;
width: rem(8px);
height: rem(8px);
background-color: inherit;
content: '';
}
.#{$prefix}--popover--caret .#{$prefix}--popover-contents::before {
z-index: -1;
box-shadow: 2px 2px 6px 0 rgba(0, 0, 0, 0.2);
}
// The popover's tooltip is created by drawing two 8px x 8px boxes, one for
// rendering the box-shadow that the popover content uses and another for
// layering on top of this box to create an effect of a popover caret with a
// box-shadow. The layer with the box-shadow is rendered behind the popover
// content, while the other is rendered above of the popover content.
//-----------------------------------------------------------------------------
// Bottom
//-----------------------------------------------------------------------------
.#{$prefix}--popover--bottom {
bottom: 0;
left: 50%;
transform: translate(-50%, calc(100% + var(--cds-popover-offset)));
}
@include place-caret(bottom) {
top: 0;
left: 50%;
transform: translate(-50%, -50%) rotate(45deg);
}
// Bottom left
.#{$prefix}--popover--bottom-left {
bottom: 0;
left: 0;
transform: translateY(calc(100% + var(--cds-popover-offset)));
}
@include place-caret(bottom-left) {
top: 0;
left: 0;
transform: translate(var(--cds-popover-caret-offset), -50%) rotate(45deg);
}
// Bottom right
.#{$prefix}--popover--bottom-right {
right: 0;
bottom: 0;
transform: translateY(calc(100% + var(--cds-popover-offset)));
}
@include place-caret(bottom-right) {
top: 0;
right: 0;
transform: translate(calc(-1 * var(--cds-popover-caret-offset)), -50%)
rotate(45deg);
}
// Hover area
.#{$prefix}--popover--bottom.#{$prefix}--popover::before,
.#{$prefix}--popover--bottom-left.#{$prefix}--popover::before,
.#{$prefix}--popover--bottom-right.#{$prefix}--popover::before {
top: 0;
right: 0;
left: 0;
height: var(--cds-popover-offset);
transform: translateY(-100%);
}
//-----------------------------------------------------------------------------
// TOP
//-----------------------------------------------------------------------------
.#{$prefix}--popover--top {
bottom: 100%;
left: 50%;
transform: translate(-50%, calc(-1 * var(--cds-popover-offset)));
}
@include place-caret(top) {
bottom: 0;
left: 50%;
transform: translate(-50%, 50%) rotate(45deg);
}
// Top left
.#{$prefix}--popover--top-left {
bottom: 100%;
left: 0;
transform: translateY(calc(-1 * var(--cds-popover-offset)));
}
@include place-caret(top-left) {
bottom: 0;
left: 0;
transform: translate(var(--cds-popover-caret-offset), 50%) rotate(45deg);
}
// Top right
.#{$prefix}--popover--top-right {
right: 0;
bottom: 100%;
transform: translateY(calc(-1 * var(--cds-popover-offset)));
}
@include place-caret(top-right) {
right: 0;
bottom: 0;
transform: translate(calc(-1 * var(--cds-popover-caret-offset)), 50%)
rotate(45deg);
}
// Hover area
.#{$prefix}--popover--top.#{$prefix}--popover::before,
.#{$prefix}--popover--top-left.#{$prefix}--popover::before,
.#{$prefix}--popover--top-right.#{$prefix}--popover::before {
right: 0;
bottom: 0;
left: 0;
height: var(--cds-popover-offset);
transform: translateY(100%);
}
//-----------------------------------------------------------------------------
// Right
//-----------------------------------------------------------------------------
.#{$prefix}--popover--right {
top: 50%;
left: 100%;
transform: translate(var(--cds-popover-offset), -50%);
}
@include place-caret(right) {
top: 50%;
left: 0;
transform: translate(-50%, -50%) rotate(45deg);
}
// Right top
.#{$prefix}--popover--right-top {
top: 0;
left: 100%;
transform: translateX($popover-offset);
}
@include place-caret(right-top) {
top: 0;
left: 0;
transform: translate(-50%, var(--cds-popover-caret-offset)) rotate(45deg);
}
// Right bottom
.#{$prefix}--popover--right-bottom {
bottom: 0;
left: 100%;
transform: translateX(var(--cds-popover-offset));
}
@include place-caret(right-bottom) {
bottom: 0;
left: 0;
transform: translate(-50%, calc(-1 * var(--cds-popover-caret-offset)))
rotate(45deg);
}
// Hover area
.#{$prefix}--popover--right.#{$prefix}--popover::before,
.#{$prefix}--popover--right-top.#{$prefix}--popover::before,
.#{$prefix}--popover--right-bottom.#{$prefix}--popover::before {
top: 0;
bottom: 0;
left: 0;
width: var(--cds-popover-offset);
transform: translateX(-100%);
}
//-----------------------------------------------------------------------------
// Left
//-----------------------------------------------------------------------------
.#{$prefix}--popover--left {
top: 50%;
right: 100%;
transform: translate(calc(-1 * var(--cds-popover-offset)), -50%);
}
@include place-caret(left) {
top: 50%;
right: 0;
transform: translate(50%, -50%) rotate(45deg);
}
// Left top
.#{$prefix}--popover--left-top {
top: 0;
right: 100%;
transform: translateX(calc(-1 * var(--cds-popover-offset)));
}
@include place-caret(left-top) {
top: 0;
right: 0;
transform: translate(50%, var(--cds-popover-caret-offset)) rotate(45deg);
}
// Left bottom
.#{$prefix}--popover--left-bottom {
right: 100%;
bottom: 0;
transform: translateX(calc(-1 * var(--cds-popover-offset)));
}
@include place-caret(left-bottom) {
right: 0;
bottom: 0;
transform: translate(50%, calc(-1 * var(--cds-popover-caret-offset)))
rotate(45deg);
}
// Hover area
.#{$prefix}--popover--left.#{$prefix}--popover::before,
.#{$prefix}--popover--left-top.#{$prefix}--popover::before,
.#{$prefix}--popover--left-bottom.#{$prefix}--popover::before {
top: 0;
right: 0;
bottom: 0;
width: var(--cds-popover-offset);
transform: translateX(100%);
}
}
/// Helper for placing the caret inside a popover. The selectors here can get
/// distracting in the main stylesheet, but ultimately they target the ::before
/// and ::after pseudo-elements for the given direction. The @content block
/// passed in should appropriately position the caret for the given direction.
@mixin place-caret($direction) {
.#{$prefix}--popover--caret.#{$prefix}--popover--#{$direction}
.#{$prefix}--popover-contents::before,
.#{$prefix}--popover--caret.#{$prefix}--popover--#{$direction}
.#{$prefix}--popover-contents::after {
@content;
}
}
@include exports('popover') {
@include popover;
}

1
css/all.css Normal file

File diff suppressed because one or more lines are too long

View file

@ -22,6 +22,7 @@ $css--plex: true;
@import "carbon-components/src/components/tag/tag";
@import "carbon-components/src/components/notification/inline-notification";
@import "carbon-components/src/components/notification/toast-notification";
@import "./popover";
// The default theme is "white" (White)
:root {

1
css/g10.css Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,9 @@
// Use the "g10" (Gray 10) Carbon theme
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
$carbon--theme: $carbon--theme--g10;
@include carbon--theme();
$feature-flags: (
ui-shell: true,
grid-columns-16: true
@ -11,15 +17,11 @@ $css--reset: true;
$css--default-type: true;
$css--plex: true;
// Use the "g10" (Gray 10) Carbon theme
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
@import "carbon-components/scss/globals/scss/component-tokens";
@import "carbon-components/src/components/tag/tag";
@import "carbon-components/src/components/notification/inline-notification";
@import "carbon-components/src/components/notification/toast-notification";
$carbon--theme: $carbon--theme--g10;
@include carbon--theme();
@import "./popover";
@import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/scss/_css--font-face";

1
css/g100.css Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,9 @@
// Use the "g100" (Gray 100) Carbon theme
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
$carbon--theme: $carbon--theme--g100;
@include carbon--theme();
$feature-flags: (
ui-shell: true,
grid-columns-16: true
@ -11,15 +17,11 @@ $css--reset: true;
$css--default-type: true;
$css--plex: true;
// Use the "g100" (Gray 100) Carbon theme
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
@import "carbon-components/scss/globals/scss/component-tokens";
@import "carbon-components/src/components/tag/tag";
@import "carbon-components/src/components/notification/inline-notification";
@import "carbon-components/src/components/notification/toast-notification";
$carbon--theme: $carbon--theme--g100;
@include carbon--theme();
@import "./popover";
@import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/scss/_css--font-face";

1
css/g80.css Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,9 @@
// Use the "g80" (Gray 80) Carbon theme
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
$carbon--theme: $carbon--theme--g80;
@include carbon--theme();
$feature-flags: (
ui-shell: true,
grid-columns-16: true
@ -11,15 +17,11 @@ $css--reset: true;
$css--default-type: true;
$css--plex: true;
// Use the "g80" (Gray 80) Carbon theme
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
@import "carbon-components/scss/globals/scss/component-tokens";
@import "carbon-components/src/components/tag/tag";
@import "carbon-components/src/components/notification/inline-notification";
@import "carbon-components/src/components/notification/toast-notification";
$carbon--theme: $carbon--theme--g80;
@include carbon--theme();
@import "./popover";
@import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/scss/_css--font-face";

1
css/g90.css Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,9 @@
// Use the "g90" (Gray 90) Carbon theme
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
$carbon--theme: $carbon--theme--g90;
@include carbon--theme();
$feature-flags: (
ui-shell: true,
grid-columns-16: true
@ -11,15 +17,11 @@ $css--reset: true;
$css--default-type: true;
$css--plex: true;
// Use the "g90" (Gray 90) Carbon theme
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
@import "carbon-components/scss/globals/scss/component-tokens";
@import "carbon-components/src/components/tag/tag";
@import "carbon-components/src/components/notification/inline-notification";
@import "carbon-components/src/components/notification/toast-notification";
$carbon--theme: $carbon--theme--g90;
@include carbon--theme();
@import "./popover";
@import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/scss/_css--font-face";

1
css/white.css Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,9 @@
// Use the "white" (White) Carbon theme
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
$carbon--theme: $carbon--theme--white;
@include carbon--theme();
$feature-flags: (
ui-shell: true,
grid-columns-16: true
@ -11,15 +17,11 @@ $css--reset: true;
$css--default-type: true;
$css--plex: true;
// Use the "white" (White) Carbon theme
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
@import "carbon-components/scss/globals/scss/component-tokens";
@import "carbon-components/src/components/tag/tag";
@import "carbon-components/src/components/notification/inline-notification";
@import "carbon-components/src/components/notification/toast-notification";
$carbon--theme: $carbon--theme--white;
@include carbon--theme();
@import "./popover";
@import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/scss/_css--font-face";

1
docs/.gitignore vendored
View file

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

View file

@ -1,10 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" theme="white">
<head>
<meta charset="utf-8" />
<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="description" content="Svelte implementation of the Carbon Design System" />
<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>
<body>
<script type="module" src="/src/index.js"></script>

4002
docs/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,31 +1,31 @@
{
"private": true,
"scripts": {
"dev": "run-p dev:*",
"dev:routify": "NODE_ENV=development routify run",
"dev:svite": "svite",
"dev": "npm run build:index-docs && run-p dev:*",
"dev:routify": "cross-env NODE_ENV=development routify run",
"dev:svite": "vite dev",
"build": "run-s build:*",
"build:index-docs": "node scripts/index-docs.js",
"build:routify": "routify run -b",
"build:svite": "svite build"
"build:svite": "vite build"
},
"devDependencies": {
"@sveltech/routify": "^1.9.9",
"autoprefixer": "^10.2.3",
"carbon-components": "10.38.0",
"carbon-components-svelte": "../",
"mdsvex": "^0.8.8",
"@sveltech/routify": "^1.9.10",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"carbon-components-svelte": "file:..",
"carbon-icons-svelte": "^13.3.0",
"clipboard-copy": "^4.0.1",
"cross-env": "^7.0.3",
"mdsvex": "^0.12.3",
"minisearch": "^7.1.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.2.4",
"prettier": "^2.1.2",
"prettier-plugin-svelte": "^1.4.1",
"prism-svelte": "^0.4.7",
"prismjs": "^1.21.0",
"remark-slug": "^6.0.0",
"sass": "^1.32.5",
"svelte": "3.29.0",
"svelte-hmr": "0.11.1",
"svelte-preprocess": "^4.3.2",
"svite": "0.7.2"
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"prism-svelte": "^0.5.0",
"prismjs": "^1.30.0",
"remark-slug": "^6.1.0",
"svelte": "^4.2.19",
"vite": "^5.4.20"
},
"routify": {
"routifyDir": ".routify",
@ -34,5 +34,6 @@
"svelte",
"svx"
]
}
},
"type": "module"
}

View file

@ -1 +0,0 @@
<svg width="212" height="44" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="212" height="44" rx="8" fill="#000"/><path d="M60.438 15.227V26.5h1.406v-4.023h2.836c2.117 0 3.625-1.493 3.625-3.602 0-2.148-1.477-3.648-3.61-3.648h-4.257zm1.406 1.25h2.484c1.633 0 2.531.851 2.531 2.398 0 1.492-.93 2.352-2.53 2.352h-2.485v-4.75zm11.5 10.171c2.399 0 3.883-1.656 3.883-4.359 0-2.71-1.484-4.36-3.883-4.36-2.398 0-3.883 1.65-3.883 4.36 0 2.703 1.485 4.36 3.883 4.36zm0-1.21c-1.594 0-2.492-1.157-2.492-3.149 0-2 .898-3.148 2.492-3.148 1.594 0 2.492 1.148 2.492 3.148 0 1.992-.898 3.148-2.492 3.148zm15.954-7.36h-1.352l-1.656 6.735h-.125l-1.883-6.735h-1.29l-1.882 6.735h-.125l-1.656-6.735h-1.36l2.36 8.422h1.36l1.874-6.516h.125l1.883 6.516h1.367l2.36-8.422zm4.523 1.04c1.336 0 2.227.984 2.258 2.476h-4.64c.101-1.492 1.039-2.477 2.382-2.477zm2.219 5.202c-.352.742-1.086 1.14-2.172 1.14-1.43 0-2.36-1.054-2.43-2.718v-.062h6.055v-.516c0-2.617-1.383-4.234-3.656-4.234-2.313 0-3.797 1.718-3.797 4.367 0 2.664 1.46 4.351 3.797 4.351 1.844 0 3.156-.89 3.547-2.328H96.04zm3.242 2.18h1.344v-5.219c0-1.187.93-2.047 2.211-2.047.266 0 .75.047.86.078V17.97a5.77 5.77 0 00-.672-.04c-1.117 0-2.086.579-2.336 1.4h-.125v-1.25h-1.281V26.5zm8.899-7.383c1.336 0 2.227.985 2.258 2.477h-4.641c.102-1.492 1.04-2.477 2.383-2.477zm2.219 5.203c-.352.742-1.086 1.14-2.172 1.14-1.43 0-2.359-1.054-2.43-2.718v-.062h6.055v-.516c0-2.617-1.383-4.234-3.656-4.234-2.313 0-3.797 1.718-3.797 4.367 0 2.664 1.461 4.351 3.797 4.351 1.844 0 3.156-.89 3.547-2.328H110.4zm6.36 2.328c1.164 0 2.164-.554 2.695-1.492h.125V26.5h1.281V14.734h-1.343v4.672h-.118c-.476-.922-1.468-1.476-2.64-1.476-2.141 0-3.539 1.718-3.539 4.36 0 2.648 1.382 4.358 3.539 4.358zm.312-7.507c1.524 0 2.477 1.218 2.477 3.148 0 1.945-.946 3.148-2.477 3.148-1.539 0-2.461-1.18-2.461-3.148 0-1.96.93-3.148 2.461-3.148zm14.462 7.507c2.133 0 3.531-1.726 3.531-4.359 0-2.648-1.391-4.36-3.531-4.36-1.156 0-2.18.571-2.641 1.477h-.125v-4.672h-1.344V26.5h1.282v-1.344h.125c.531.938 1.531 1.492 2.703 1.492zm-.313-7.507c1.539 0 2.453 1.18 2.453 3.148 0 1.969-.914 3.148-2.453 3.148-1.531 0-2.484-1.203-2.484-3.148s.953-3.148 2.484-3.148zm6.04 10.406c1.492 0 2.164-.578 2.882-2.531l3.29-8.938h-1.43l-2.305 6.93h-.125l-2.312-6.93h-1.453l3.117 8.43-.157.5c-.351 1.015-.773 1.383-1.546 1.383-.188 0-.399-.008-.563-.04V29.5c.188.031.422.047.602.047zm17.391-3.047l3.898-11.273h-2.148l-2.813 8.921h-.132l-2.836-8.921h-2.227l3.938 11.273h2.32zm8.016-7.18c1.164 0 1.93.813 1.969 2.078h-4.024c.086-1.25.899-2.078 2.055-2.078zm1.984 4.828c-.281.633-.945.985-1.906.985-1.273 0-2.094-.89-2.141-2.313v-.101h5.969v-.625c0-2.696-1.461-4.313-3.898-4.313-2.477 0-4.016 1.727-4.016 4.477s1.516 4.414 4.031 4.414c2.016 0 3.446-.969 3.797-2.524h-1.836zm3.547 2.352h1.938v-4.938c0-1.195.875-1.976 2.133-1.976.328 0 .843.055.992.11v-1.798c-.18-.054-.524-.085-.805-.085-1.101 0-2.023.625-2.258 1.468h-.132v-1.328h-1.868V26.5zm13.501-5.672c-.203-1.797-1.532-3.047-3.727-3.047-2.57 0-4.078 1.649-4.078 4.422 0 2.813 1.516 4.469 4.086 4.469 2.164 0 3.508-1.203 3.719-2.992h-1.844c-.203.89-.875 1.367-1.883 1.367-1.32 0-2.117-1.047-2.117-2.844 0-1.773.789-2.797 2.117-2.797 1.063 0 1.703.594 1.883 1.422h1.844zm5.117-1.508c1.164 0 1.93.813 1.969 2.078h-4.024c.086-1.25.899-2.078 2.055-2.078zm1.985 4.828c-.282.633-.946.985-1.907.985-1.273 0-2.093-.89-2.14-2.313v-.101h5.968v-.625c0-2.696-1.461-4.313-3.898-4.313-2.477 0-4.016 1.727-4.016 4.477s1.516 4.414 4.032 4.414c2.015 0 3.445-.969 3.796-2.524h-1.835zm3.625 2.352h1.937V14.648h-1.937V26.5zM23.325 13l9.325 16H14l9.325-16z" fill="#fff"/><path stroke="#5E5E5E" d="M43.5 0v44"/></svg>

Before

Width:  |  Height:  |  Size: 3.5 KiB

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,87 +3,4 @@
import { routes } from "../.routify/routes";
</script>
<Router routes="{routes}" />
<style lang="scss" global>
// This is a recipe for dynamic, client-side theming
// All Carbon themes are included (White, Gray 10, Gray 90, Gray 100)
$feature-flags: (
// Custom CSS properties must be enabled to dynamically switch themes
enable-css-custom-properties: true,
ui-shell: true,
grid-columns-16: true
);
$css--font-face: true;
$css--helpers: true;
$css--body: true;
$css--use-layer: true;
$css--reset: true;
$css--default-type: true;
$css--plex: true;
// Use all Carbon themes
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
@import "carbon-components/scss/globals/scss/component-tokens";
@import "carbon-components/src/components/tag/tag";
@import "carbon-components/src/components/notification/inline-notification";
@import "carbon-components/src/components/notification/toast-notification";
// The default theme is "white" (White)
:root {
@include carbon--theme($carbon--theme--white, true) {
@include emit-component-tokens($tag-colors);
@include emit-component-tokens($notification-colors);
}
}
// Set the <html> theme attribute to "g10" to use the Gray 10 theme
// <html theme="g10">
:root[theme="g10"] {
@include carbon--theme($carbon--theme--g10, true) {
@include emit-component-tokens($tag-colors);
@include emit-component-tokens($notification-colors);
}
}
// Set the <html> theme attribute to "g80" to use the Gray 90 theme
// <html theme="g80">
:root[theme="g80"] {
@include carbon--theme($carbon--theme--g80, true) {
@include emit-component-tokens($tag-colors);
@include emit-component-tokens($notification-colors);
}
}
// Set the <html> theme attribute to "g90" to use the Gray 90 theme
// <html theme="g90">
:root[theme="g90"] {
@include carbon--theme($carbon--theme--g90, true) {
@include emit-component-tokens($tag-colors);
@include emit-component-tokens($notification-colors);
}
}
// Set the <html> theme attribute to "g100" to use the Gray 100 theme
// <html theme="g100">
:root[theme="g100"] {
@include carbon--theme($carbon--theme--g100, true) {
@include emit-component-tokens($tag-colors);
@include emit-component-tokens($notification-colors);
}
}
// Programmatically update the theme in JavaScript:
// document.documentElement.setAttribute("theme", "g90");
@import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/scss/_css--font-face";
@import "carbon-components/scss/globals/scss/_css--helpers";
@import "carbon-components/scss/globals/scss/_css--body";
@import "carbon-components/scss/globals/grid/grid";
// Import all component styles
@import "carbon-components/scss/globals/scss/styles";
</style>
<Router {routes} />

File diff suppressed because it is too large Load diff

View file

@ -4,22 +4,29 @@
slots: [],
events: [],
rest_props: undefined,
typedefs: [],
};
import { onMount } from "svelte";
import {
Link,
OutboundLink,
StructuredList,
StructuredListHead,
StructuredListRow,
StructuredListCell,
StructuredListBody,
TooltipDefinition,
UnorderedList,
ListItem,
Tag,
} from "carbon-components-svelte";
import InlineSnippet from "./InlineSnippet.svelte";
import Launch16 from "carbon-icons-svelte/lib/Launch16";
let AsyncPreviewTypeScript;
onMount(async () => {
AsyncPreviewTypeScript = (await import("./PreviewTypeScript.svelte"))
.default;
});
const mdn_api = "https://developer.mozilla.org/en-US/docs/Web/API/";
const typeMap = {
@ -30,52 +37,65 @@
Date: "JavaScript Date",
};
$: source = `https://github.com/IBM/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(
(event) => event.type === "forwarded"
(event) => event.type === "forwarded",
);
$: dispatched_events = component.events.filter(
(event) => event.type === "dispatched"
(event) => event.type === "dispatched",
);
</script>
<p style="margin-bottom: var(--cds-layout-02)">
Component source code:
<Link inline size="lg" href="{source}" target="_blank">
Source code:
<OutboundLink size="lg" inline href={source}>
{component.filePath}
<Launch16 />
</Link>
</OutboundLink>
</p>
<h3 id="props">Props</h3>
<h2 id="props">Props</h2>
{#if component.props.length > 0}
<div class="overflow">
<StructuredList
style="margin-left: calc(-1 * var(--cds-spacing-05)); margin-right: calc(-1 * var(--cds-spacing-05))"
>
<StructuredList flush condensed>
<StructuredListHead>
<StructuredListRow head>
<StructuredListCell head>Prop name</StructuredListCell>
<StructuredListCell head>Type</StructuredListCell>
<StructuredListCell head noWrap>Default value</StructuredListCell>
<StructuredListCell head>Description</StructuredListCell>
</StructuredListRow>
</StructuredListHead>
<StructuredListBody>
{#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)}
<StructuredListRow>
<StructuredListCell noWrap>
<InlineSnippet code="{prop.name}" />
<InlineSnippet code={prop.name} />
{#if prop.reactive}
<div
style="white-space: nowrap; margin-top: var(--cds-spacing-03)"
style="white-space: nowrap; margin-top: var(--cds-spacing-03); margin-bottom: var(--cds-spacing-{prop.isRequired
? '01'
: '03'})"
>
<Tag type="cyan">Reactive</Tag>
<Tag style="margin-left: 0" size="sm" type="cyan">
Reactive
</Tag>
</div>
{/if}
{#if prop.isRequired}
<Tag size="sm" type="magenta">Required</Tag>
{/if}
</StructuredListCell>
<StructuredListCell>
{#each (prop.type || "").split(" | ") as type, i (type)}
@ -83,34 +103,37 @@
class="cell"
style="z-index: {(prop.type || '').split(' | ').length - i}"
>
{#if type.startsWith("typeof")}
<TooltipDefinition
direction="top"
align="start"
tooltipText="{`From "carbon-icons-svelte"`}"
>
Carbon Svelte icon
</TooltipDefinition>
{:else if type.startsWith("HTML")}
<Link
{#if type.startsWith("HTML")}
<OutboundLink
href="{mdn_api}{type}"
target="_blank"
style="white-space: nowrap"
>
{type}
<Launch16 />
</Link>
</OutboundLink>
{:else if type in typeMap}
<code>{typeMap[type]}</code>
{:else if type.startsWith("(")}
<code>{type}</code>
<div
style="display: inline-flex; max-width: 220px; word-break: break-word;"
>
<svelte:component
this={AsyncPreviewTypeScript}
type="inline"
code={typeMap[type]}
/>
</div>
{: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}
</div>
{/each}
</StructuredListCell>
<StructuredListCell><code>{prop.value}</code></StructuredListCell>
<StructuredListCell>
{#if prop.description}
{#each prop.description.split("\n") as line}
@ -121,9 +144,27 @@
.replace(/`(.*?)`/g, "<code>$1</code>")}.
</div>
{/each}
{:else}
<div class="description">No description available.</div>
{/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>
</StructuredListRow>
{/each}
@ -133,18 +174,51 @@
{:else}
<p class="my-layout-01-03">No props.</p>
{/if}
<h3 id="slots">Slots</h3>
<h2 id="typedefs">Typedefs</h2>
{#if component.typedefs.length > 0}
<div class="my-layout-01-03">
<svelte:component
this={AsyncPreviewTypeScript}
code={component.typedefs.map((t) => t.ts).join("\n")}
/>
</div>
{:else}
<p class="my-layout-01-03">No typedefs.</p>
{/if}
<h2 id="slots">Slots</h2>
{#if component.slots.length > 0}
<UnorderedList class="my-layout-01-03">
{#each component.slots as slot (slot.name)}
<ListItem>{slot.default ? "default" : slot.name}</ListItem>
{/each}
</UnorderedList>
<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)}
<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}
</StructuredListBody>
</StructuredList>
{:else}
<p class="my-layout-01-03">No slots.</p>
{/if}
<h3 id="forwarded-events">Forwarded events</h3>
<h2 id="forwarded-events">Forwarded events</h2>
{#if forwarded_events.length > 0}
<UnorderedList class="my-layout-01-03">
{#each forwarded_events as event (event.name)}
@ -155,19 +229,45 @@
<p class="my-layout-01-03">No forwarded events.</p>
{/if}
<h3 id="dispatched-events">Dispatched events</h3>
<h2 id="dispatched-events">Dispatched events</h2>
{#if dispatched_events.length > 0}
<UnorderedList class="my-layout-01-03">
{#each dispatched_events as event (event.name)}
<ListItem>on:{event.name}</ListItem>
{/each}
</UnorderedList>
{@const hasDescription = dispatched_events.find((el) => el.description)}
<StructuredList flush>
<StructuredListHead>
<StructuredListRow>
<StructuredListCell>Event name</StructuredListCell>
<StructuredListCell>Event detail</StructuredListCell>
{#if hasDescription}
<StructuredListCell>Description</StructuredListCell>
{/if}
</StructuredListRow>
</StructuredListHead>
<StructuredListBody>
{#each dispatched_events as event (event.name)}
<StructuredListRow>
<StructuredListCell>
<strong>on:{event.name}</strong>
</StructuredListCell>
<StructuredListCell>
<svelte:component
this={AsyncPreviewTypeScript}
type={/\n/.test(event.detail) ? "multi" : "inline"}
code={event.detail}
/>
</StructuredListCell>
<StructuredListCell>
{event.description ?? ""}
</StructuredListCell>
</StructuredListRow>
{/each}
</StructuredListBody>
</StructuredList>
{:else}
<p class="my-layout-01-03">No dispatched events.</p>
{/if}
<h3 id="rest-props">$$restProps</h3>
<h2 id="rest-props">$$restProps</h2>
<div class="my-layout-01-03">
{#if component.rest_props}
@ -185,6 +285,7 @@
<style>
.description {
margin-bottom: var(--cds-spacing-04);
width: 80%;
}
.cell {
@ -198,7 +299,11 @@
overflow-x: auto;
}
:global(.my-layout-01-03),
:global(.my-layout-01-03) {
margin-top: var(--cds-layout-01);
margin-bottom: var(--cds-layout-03);
}
:global(.overflow .bx--structured-list) {
margin-top: var(--cds-layout-01);
margin-bottom: var(--cds-layout-04);
@ -207,4 +312,12 @@
code {
word-break: break-word;
}
:global(
.cell .bx--snippet--inline code,
.cell .bx--snippet--single pre,
.bx--snippet--inline code
) {
white-space: pre-wrap !important;
}
</style>

View file

@ -1,28 +0,0 @@
<script>
import { Content, Grid, Row, Column, Link } from "carbon-components-svelte";
</script>
<footer class="bx--content">
<Grid>
<Row>
<Column>
<Link
href="https://www.vercel.com?utm_source=carbon-components-svelte&utm_campaign=oss"
target="_blank"
>
<img
height="36px"
src="/powered-by-vercel.svg"
alt="Deploys by Vercel"
/>
</Link>
</Column>
</Row>
</Grid>
</footer>
<style>
footer {
background: var(--cds-ui-01);
}
</style>

View file

@ -1,15 +1,16 @@
<script>
export let code = "";
import copy from "clipboard-copy";
import { CodeSnippet } from "carbon-components-svelte";
</script>
<div>
<CodeSnippet code="{code}" type="inline" />
<CodeSnippet {code} type="inline" copy={(text) => copy(text)} />
</div>
<style>
div {
margin-bottom: var(--cds-spacing-04);
margin-bottom: var(--cds-spacing-03);
}
</style>

View file

@ -4,8 +4,9 @@
export let src = "";
export let framed = false;
import copy from "clipboard-copy";
import { CodeSnippet, Button } from "carbon-components-svelte";
import Launch16 from "carbon-icons-svelte/lib/Launch16";
import Launch from "carbon-icons-svelte/lib/Launch.svelte";
import { url } from "@sveltech/routify";
import { theme } from "../store";
@ -25,8 +26,8 @@
kind="ghost"
target="_blank"
size="field"
href="{themedSrcUrl}"
icon="{Launch16}"
href={themedSrcUrl}
icon={Launch}
>
Open in new tab
</Button>
@ -34,111 +35,31 @@
{/if}
<div class="preview-viewer" class:framed>
{#if framed}
<iframe title="{src.split('/').pop()}" src="{themedSrcUrl}"></iframe>
<iframe loading="lazy" title={src.split("/").pop()} src={themedSrcUrl}
></iframe>
{:else}
<slot />
{/if}
</div>
<div class="code-override">
<CodeSnippet type="multi" code="{codeRaw}">
<CodeSnippet type="multi" code={codeRaw} copy={(text) => copy(text)}>
{@html code}
</CodeSnippet>
</div>
</div>
<style global>
<style>
.preview {
margin-bottom: var(--cds-layout-04);
margin-left: -1rem;
margin-right: -1rem;
max-width: 56rem;
}
.code-override .bx--snippet {
max-width: none;
}
.code-override .bx--copy-btn,
.code-override .bx--snippet,
.code-override button.bx--btn.bx--snippet-btn--expand {
background-color: #262626;
color: #f4f4f4;
}
.code-override .bx--copy-btn:hover,
.code-override button.bx--btn.bx--snippet-btn--expand:hover {
background-color: #393939;
}
.code-override .bx--snippet__icon {
fill: #f4f4f4;
}
.code-override .bx--snippet-container pre {
font-size: var(--cds-code-02-font-size);
line-height: var(--cds-code-02-line-height);
letter-spacing: var(--cds-code-02-letter-spacing);
cursor: text;
}
.code-override .bx--snippet--multi .bx--snippet-container pre {
overflow-x: auto;
}
.token.tag,
.token.operator {
color: #6ea6ff;
}
.token.attr-name {
color: #3ddbd9; /* teal 30 */
}
.token.function {
color: #9ef0f0;
}
.token.token.language-javascript,
.token.attr-value {
color: #d4bbff; /* purple 30 */
}
.token.keyword {
color: #bb8eff;
}
.token.punctuation {
color: #a8a8a8; /* gray 40 */
}
.token.script .token.language-javascript {
color: #3ddbd9; /* teal 30 */
}
.token.string {
color: #fa75a6;
}
.token.boolean {
color: #bb8eff;
}
.token.number {
color: #a7f0ba;
}
.token.comment {
color: #bebebe;
max-width: 80rem;
}
.code-override {
border: 1px solid #262626;
}
html[theme="g90"] .code-override {
border: 1px solid var(--cds-ui-03);
}
.preview-viewer {
border: 1px solid var(--cds-ui-03);
border-bottom: 0;
@ -154,6 +75,12 @@
min-height: 20rem;
}
@media (min-width: 1920px) {
.preview-viewer.framed {
min-height: 32rem;
}
}
.framed-header {
display: flex;
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

@ -1,24 +0,0 @@
<script>
export let persist = false;
export let persistKey = "carbon-theme";
export const themes = ["white", "g10", "g80", "g90", "g100"];
import { onMount, afterUpdate } from "svelte";
import { theme } from "../store";
const isValidTheme = (value) => themes.includes(value);
onMount(() => {
const persisted_theme = localStorage.getItem(persistKey);
if (isValidTheme(persisted_theme)) theme.set(persisted_theme);
});
afterUpdate(() => {
if (isValidTheme($theme)) {
document.documentElement.setAttribute("theme", $theme);
if (persist) localStorage.setItem(persistKey, $theme);
}
});
</script>
<slot />

View file

@ -6,8 +6,8 @@
export let borderBottom = false;
import { AspectRatio, ClickableTile, Tile } from "carbon-components-svelte";
import LogoGithub32 from "carbon-icons-svelte/lib/LogoGithub32";
import Launch20 from "carbon-icons-svelte/lib/Launch20";
import LogoGithub from "carbon-icons-svelte/lib/LogoGithub.svelte";
import Launch from "carbon-icons-svelte/lib/Launch.svelte";
$: tileComponent = href ? ClickableTile : Tile;
</script>
@ -15,8 +15,8 @@
<div class="card-wrapper" class:borderRight class:borderBottom>
<AspectRatio>
<svelte:component
this="{tileComponent}"
href="{href}"
this={tileComponent}
{href}
{...$$restProps}
style="height: 100%;"
>
@ -29,10 +29,11 @@
</div>
<div class="card-footer">
<svelte:component
this="{LogoGithub32}"
this={LogoGithub}
size={32}
style="fill: var(--cds-icon-01)"
/>
<Launch20 style="fill: var(--cds-icon-01)" />
<Launch size={20} style="fill: var(--cds-icon-01)" />
</div>
</div>
</svelte:component>

278
docs/src/global.css Normal file
View file

@ -0,0 +1,278 @@
html[theme="g90"] .code-override {
border: 1px solid var(--cds-ui-03);
}
.prose > pre,
.code-override .bx--snippet {
/** Docs code snippet is always dark mode */
color-scheme: dark;
max-width: none;
}
.prose > pre {
padding: 1rem;
margin-bottom: 1rem;
}
.prose > pre,
.code-override .bx--copy-btn,
.code-override .bx--snippet,
.code-override button.bx--btn.bx--snippet-btn--expand {
background-color: #262626;
color: #f4f4f4;
}
.code-override .bx--copy-btn:hover,
.code-override button.bx--btn.bx--snippet-btn--expand:hover {
background-color: #393939;
}
.code-override .bx--snippet__icon {
fill: #f4f4f4;
}
.prose > pre,
.code-override .bx--snippet-container pre {
font-size: var(--cds-code-02-font-size);
line-height: var(--cds-code-02-line-height);
letter-spacing: var(--cds-code-02-letter-spacing);
cursor: text;
}
.code-override .bx--snippet--multi .bx--snippet-container pre {
overflow-x: auto;
}
/* Addig this to the layout grid fixes overstretching. */
.fix-overflow {
min-width: 0;
}
.token.tag,
.token.operator {
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 {
color: #3ddbd9; /* teal 30 */
}
.token.function {
color: #9ef0f0;
}
.token.token.language-javascript,
.token.attr-value {
color: #d4bbff; /* purple 30 */
}
.token.keyword {
color: #bb8eff;
}
.token.punctuation {
color: #a8a8a8; /* gray 40 */
}
.token.script .token.language-javascript {
color: #3ddbd9; /* teal 30 */
}
.token.string {
color: #fa75a6;
}
.token.boolean {
color: #bb8eff;
}
.token.number {
color: #a7f0ba;
}
.token.comment {
color: #bebebe;
}
.override-tabs a.bx--tabs__nav-link,
.override-tabs a.bx--tabs__nav-link:focus,
.override-tabs a.bx--tabs__nav-link:active {
width: auto !important;
}
#select-theme {
width: auto;
}
/*
* Main content needs to supersede z-index of SideNav but not that of the Header.
* UI Shell Header shares the same z-index.
*/
[aria-label="Navigation"] {
z-index: calc(8000 + 2);
}
[aria-label="Navigation"] ~ [data-components] {
z-index: calc(8000 + 1);
}
@media (max-width: 65.98rem) {
[aria-label="Navigation"] ~ [data-components] {
z-index: 1;
}
}
.prose > p > .bx--link {
font-size: inherit;
text-decoration: underline;
}
.prose .toc {
margin-bottom: var(--cds-layout-01);
}
.table {
position: sticky;
max-height: calc(100vh - 3rem);
top: 3rem;
margin-top: -3rem;
padding-top: var(--cds-spacing-05);
padding-bottom: var(--cds-spacing-05);
padding-left: var(--cds-spacing-08);
overflow-y: auto;
}
[data-components] {
position: relative;
display: flex;
}
[data-components] .bx--grid {
width: 100%;
}
@media (max-width: 1056px) {
.table {
display: none;
}
}
.preview-viewer > .bx--aspect-ratio,
.preview-viewer [data-outline] {
outline: 1px solid var(--cds-interactive-04);
}
[data-outline] {
position: relative;
}
[data-outline] ~ [data-outline] {
margin-top: var(--cds-spacing-08);
}
#select-theme {
width: auto;
}
.prose > p > .bx--link {
font-size: inherit;
}
.prose .toc {
margin-bottom: var(--cds-layout-01);
}
.code-01 {
font-size: var(--cds-code-01-font-size);
font-weight: var(--cds-code-01-font-weight);
letter-spacing: var(--cds-code-01-letter-spacing);
line-height: var(--cds-code-01-line-height);
}
.body-short-01 {
font-size: var(--cds-body-short-01-font-size);
font-weight: var(--cds-body-short-01-font-weight);
letter-spacing: var(--cds-body-short-01-letter-spacing);
line-height: var(--cds-body-short-01-line-height);
}
.bx--col > h1 {
font-size: var(--cds-expressive-heading-05-font-size);
font-weight: var(--cds-expressive-heading-05-font-weight);
letter-spacing: var(--cds-expressive-heading-05-letter-spacing);
line-height: var(--cds-expressive-heading-05-line-height);
margin-bottom: var(--cds-layout-01);
}
.big-paragraph {
font-size: var(--cds-expressive-heading-03-font-size);
font-weight: var(--cds-expressive-heading-03-font-weight);
letter-spacing: var(--cds-expressive-heading-03-letter-spacing);
line-height: var(--cds-expressive-heading-03-line-height);
margin-top: var(--cds-layout-03);
margin-bottom: var(--cds-layout-06);
}
.big-link,
.bx--col > .big-paragraph > code {
font-size: var(--cds-expressive-heading-03-font-size);
font-weight: var(--cds-expressive-heading-03-font-weight);
letter-spacing: var(--cds-expressive-heading-03-letter-spacing);
line-height: var(--cds-expressive-heading-03-line-height);
}
.bx--col > p {
max-width: 44rem;
}
.bx--col > p > code {
font-size: var(--cds-code-02-font-size);
font-weight: var(--cds-code-02-font-weight);
line-height: var(--cds-code-02-line-height);
letter-spacing: var(--cds-code-02-letter-spacing);
background-color: var(--cds-ui-03);
border-radius: 0.25rem;
padding: 0 var(--cds-spacing-02);
}
[class*="bx--col"] > h2,
.bx--tab-content > h2 {
font-size: var(--cds-expressive-heading-04-font-size);
font-weight: var(--cds-expressive-heading-04-font-weight);
letter-spacing: var(--cds-expressive-heading-04-letter-spacing);
line-height: var(--cds-expressive-heading-04-line-height);
padding-top: var(--cds-layout-03);
margin-bottom: var(--cds-layout-01);
}
.bx--col > h4 {
font-size: var(--cds-expressive-heading-02-font-size);
font-weight: var(--cds-expressive-heading-02-font-weight);
letter-spacing: var(--cds-expressive-heading-02-letter-spacing);
line-height: var(--cds-expressive-heading-02-line-height);
padding-top: var(--cds-layout-04);
margin-bottom: var(--cds-layout-01);
}
.bx--col > h2,
.bx--tab-content > h2,
.bx--col > h3,
.bx--col > h4 {
scroll-margin-top: 3rem;
}
.bx--col > p {
margin-bottom: var(--cds-layout-02);
}

View file

@ -1,4 +1,6 @@
import App from "./App.svelte";
import "../../css/all.css";
import "./global.css";
const app = new App({ target: document.body });

View file

@ -13,7 +13,7 @@
Tab,
TabContent,
} from "carbon-components-svelte";
import Code16 from "carbon-icons-svelte/lib/Code16";
import Code from "carbon-icons-svelte/lib/Code.svelte";
import { page, metatags } from "@sveltech/routify";
import { onMount } from "svelte";
import { theme } from "../store";
@ -22,7 +22,6 @@
export let component = $page.title;
export let components = [component];
export let source = "";
export let unreleased = false;
export let unstable = false;
@ -30,26 +29,52 @@
// TODO: `find` is not supported in IE
$: api_components = components.map((i) =>
COMPONENT_API.components.find((_) => _.moduleName === i)
COMPONENT_API.components.find((_) => _.moduleName === i),
);
$: multiple = api_components.length > 1;
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", "g90", "g100"].includes(currentTheme)) {
theme.set(currentTheme);
if (["white", "g10", "g80", "g90", "g100"].includes(current_theme)) {
theme.set(current_theme);
}
});
function formatSourceURL(multiple) {
const filePath = api_components[0]?.filePath ?? "";
if (multiple) {
/**
* Link to folder for doc with multiple components.
* @example "src/Breadcrumb"
*/
return filePath.split("/").slice(0, -1).join("/");
}
/**
* Else, link to the component source.
* @example "src/Tile/ClickableTile.svelte"
*/
return filePath;
}
// TODO: [refactor] read from package.json value
$: sourceCode = `https://github.com/IBM/carbon-components-svelte/tree/master/src/${
source || `${$page.title}/${$page.title}.svelte`
}`;
$: sourceCode = `https://github.com/carbon-design-system/carbon-components-svelte/tree/master/${formatSourceURL(
multiple,
)}`;
</script>
<svelte:head>
<link
rel="canonical"
href="https://svelte.carbondesignsystem.com/components/{component}"
/>
</svelte:head>
<Content data-components>
<Grid>
<Grid class="fix-overflow">
<Row>
<Column>
<h1>{component}</h1>
@ -58,7 +83,7 @@
id="select-theme"
inline
labelText="Theme"
bind:selected="{$theme}"
bind:selected={$theme}
>
<SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" />
@ -70,8 +95,8 @@
kind="ghost"
target="_blank"
size="field"
href="{sourceCode}"
icon="{Code16}"
href={sourceCode}
icon={Code}
>
Source code
</Button>
@ -100,15 +125,18 @@
<Row>
<Column class="prose">
<div class="toc mobile">
<h5>Table of Contents</h5>
<h5>Examples</h5>
<slot name="aside" />
</div>
<h2 id="usage">Usage</h2>
<slot />
<h2 id="component-api">Component API</h2>
<p>
API documentation is
<Link inline href="https://github.com/IBM/sveld" target="_blank">
<Link
inline
href="https://github.com/carbon-design-system/sveld"
target="_blank"
>
auto-generated by sveld.
</Link>
</p>
@ -116,64 +144,36 @@
</Row>
<Row>
<Column class="prose" noGutter="{multiple}">
<Column class="prose" noGutter={multiple}>
{#if multiple}
<Tabs class="override-tabs">
{#each api_components as component (component.moduleName)}
<Tab label="{component.moduleName}" />
<Tab label={component.moduleName} />
{/each}
<div slot="content" style="padding-top: var(--cds-spacing-06)">
{#each api_components as component (component.moduleName)}
<TabContent>
<ComponentApi component="{component}" />
<ComponentApi {component} />
</TabContent>
{/each}
</div>
</Tabs>
{:else}
<ComponentApi component="{api_components[0]}" />
<ComponentApi component={api_components[0]} />
{/if}
</Column>
</Row>
</Grid>
<Column class="table" xlg="{4}" lg="{5}">
<Column class="table" xlg={4} lg={5}>
<div class="toc">
<h5>Table of Contents</h5>
<h5>Examples</h5>
<slot name="aside" />
</div>
</Column>
</Content>
<style global>
.override-tabs a.bx--tabs__nav-link,
.override-tabs a.bx--tabs__nav-link:focus,
.override-tabs a.bx--tabs__nav-link:active {
width: auto !important;
}
#select-theme {
width: auto;
}
.prose > p > .bx--link {
font-size: inherit;
}
.prose .toc {
margin-bottom: var(--cds-layout-01);
}
.table {
position: sticky;
max-height: calc(100vh - 3rem);
top: 3rem;
padding-top: var(--cds-spacing-05);
padding-bottom: var(--cds-spacing-05);
padding-left: var(--cds-spacing-08);
overflow-y: auto;
}
<style>
.bar {
display: flex;
justify-content: space-between;
@ -181,17 +181,8 @@
border-bottom: 1px solid var(--cds-ui-03);
}
[data-components] {
z-index: 2;
position: relative;
display: flex;
}
[data-components] .bx--grid {
width: 100%;
}
.toc h5 {
:global(.toc h5) {
margin-top: var(--cds-spacing-06);
margin-bottom: var(--cds-spacing-03);
}
@ -200,25 +191,9 @@
}
@media (max-width: 1056px) {
.table {
display: none;
}
.toc.mobile {
display: block;
margin-bottom: var(--cds-spacing-09);
}
}
.preview-viewer > .bx--aspect-ratio,
.preview-viewer [data-outline] {
outline: 1px solid var(--cds-interactive-04);
}
[data-outline] {
position: relative;
}
[data-outline] ~ [data-outline] {
margin-top: var(--cds-spacing-08);
}
</style>

View file

@ -1,124 +0,0 @@
<script>
import {
Grid,
Row,
Column,
Content,
Select,
SelectItem,
} from "carbon-components-svelte";
import { page, metatags } from "@sveltech/routify";
import { onMount } from "svelte";
import { theme } from "../store";
export let component = $page.title;
metatags.title = $page.title;
onMount(() => {
const currentTheme = window.location.search.split("?theme=")[1];
if (["white", "g10", "g90", "g100"].includes(currentTheme)) {
theme.set(currentTheme);
}
});
</script>
<Content data-components>
<Grid>
<Row>
<Column>
<h1>{component}</h1>
<div class="bar">
<Select
id="select-theme"
inline
labelText="Theme"
bind:selected="{$theme}"
>
<SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" />
<SelectItem value="g90" text="Gray 90" />
<SelectItem value="g100" text="Gray 100" />
</Select>
</div>
</Column>
</Row>
<Row>
<Column class="prose">
<div class="toc mobile">
<h5>Table of Contents</h5>
<slot name="aside" />
</div>
<slot />
</Column>
</Row>
</Grid>
<Column class="table" xlg="{4}" lg="{5}">
<div class="toc">
<h5>Table of Contents</h5>
<slot name="aside" />
</div>
</Column>
</Content>
<style global>
#select-theme {
width: auto;
}
.prose > p > .bx--link {
font-size: inherit;
}
.prose .toc {
margin-bottom: var(--cds-layout-01);
}
.table {
position: sticky;
max-height: calc(100vh - 3rem);
top: 3rem;
padding-top: var(--cds-spacing-05);
padding-bottom: var(--cds-spacing-05);
padding-left: var(--cds-spacing-08);
overflow-y: auto;
}
.bar {
display: flex;
justify-content: space-between;
margin-bottom: var(--cds-layout-02);
border-bottom: 1px solid var(--cds-ui-03);
}
[data-components] {
z-index: 2;
position: relative;
display: flex;
}
[data-components] .bx--grid {
width: 100%;
}
.toc h5 {
margin-bottom: var(--cds-spacing-03);
}
.toc.mobile {
display: none;
}
@media (max-width: 1056px) {
.table {
display: none;
}
.toc.mobile {
display: block;
}
}
</style>

View file

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

View file

@ -1,5 +1,11 @@
<script>
import { isActive, url, layout, beforeUrlChange } from "@sveltech/routify";
import {
isActive,
url,
layout,
beforeUrlChange,
goto,
} from "@sveltech/routify";
import {
Header,
HeaderUtilities,
@ -8,19 +14,37 @@
HeaderPanelLinks,
HeaderPanelLink,
HeaderPanelDivider,
HeaderSearch,
SkipToContent,
SideNav,
SideNavItems,
SideNavMenu,
SideNavMenuItem,
Theme,
Tag,
} from "carbon-components-svelte";
import LogoGithub20 from "carbon-icons-svelte/lib/LogoGithub20";
import Theme from "../components/Theme.svelte";
import Footer from "../components/Footer.svelte";
import MiniSearch from "minisearch";
import LogoGithub from "carbon-icons-svelte/lib/LogoGithub.svelte";
import { theme } from "../store";
import SEARCH_INDEX from "../SEARCH_INDEX.json";
const deprecated = ["ToggleSmall", "Icon"];
const new_components = ["ProgressBar"];
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 new_components = [];
let value = "";
let active = false;
$: results = miniSearch.search(value).slice(0, 10);
let isOpen = false;
let isSideNavOpen = true;
@ -28,9 +52,8 @@
$: isMobile = innerWidth < 1056;
$: components = $layout.children.filter(
(child) => child.title === "components"
(child) => child.title === "components",
)[0];
$: recipes = $layout.children.filter((child) => child.title === "recipes")[0];
$beforeUrlChange(() => {
if (isMobile) isSideNavOpen = false;
@ -41,36 +64,115 @@
<!-- routify:options bundle=true -->
<svelte:window bind:innerWidth />
<Theme persist>
<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
aria-label="Navigation"
href="{$url('/')}"
expandedByDefault="{true}"
href={$url("/")}
expandedByDefault={true}
bind:isSideNavOpen
>
<div slot="skip-to-content">
<svelte:fragment slot="skip-to-content">
<SkipToContent />
</div>
</svelte:fragment>
<span slot="platform" class="platform-name">
Carbon Components Svelte
<code>v{process.env.VERSION || ""}</code>
<span slot="platform" class="platform-name" class:hidden={active}>
Carbon Components Svelte &nbsp;<code class="code-01"
>v{process.env.VERSION || ""}</code
>
</span>
<HeaderUtilities>
<HeaderSearch
bind:value
bind:active
placeholder="Search"
{results}
on:select={(e) => {
$goto(e.detail.selectedResult.href);
}}
/>
<HeaderActionLink
icon="{LogoGithub20}"
href="https://github.com/IBM/carbon-components-svelte"
icon={LogoGithub}
href="https://github.com/carbon-design-system/carbon-components-svelte"
target="_blank"
/>
<HeaderAction transition="{false}" bind:isOpen>
<HeaderAction transition={false} bind:isOpen>
<HeaderPanelLinks>
<HeaderPanelDivider>Carbon Svelte portfolio</HeaderPanelDivider>
<HeaderPanelLink href="https://github.com/IBM/carbon-icons-svelte">
<HeaderPanelLink
href="https://github.com/carbon-design-system/carbon-icons-svelte"
>
Carbon Icons Svelte
</HeaderPanelLink>
<HeaderPanelLink
href="https://github.com/IBM/carbon-pictograms-svelte"
href="https://github.com/carbon-design-system/carbon-pictograms-svelte"
>
Carbon Pictograms Svelte
</HeaderPanelLink>
@ -79,6 +181,11 @@
>
Carbon Charts Svelte
</HeaderPanelLink>
<HeaderPanelLink
href="https://github.com/carbon-design-system/carbon-preprocess-svelte"
>
Carbon Preprocess Svelte
</HeaderPanelLink>
<HeaderPanelDivider>Resources</HeaderPanelDivider>
<HeaderPanelLink href="https://www.carbondesignsystem.com/">
Carbon Design System
@ -91,149 +198,45 @@
</HeaderUtilities>
</Header>
<SideNav bind:isOpen="{isSideNavOpen}">
<SideNav bind:isOpen={isSideNavOpen}>
<SideNavItems>
<SideNavMenu
expanded="{$isActive($url('')) || $isActive($url('/components'))}"
text="Components"
>
{#each components.children as child, i (child.path)}
<SideNavMenuItem
text="{child.title}"
href="{$url(child.path)}"
isSelected="{$isActive($url(child.path))}"
>
{child.title}
{#if deprecated.includes(child.title)}
<Tag
size="sm"
type="red"
style="margin-top: 0; margin-bottom: 0; cursor: inherit"
>
Deprecated
</Tag>
{/if}
{#if new_components.includes(child.title)}
<Tag
size="sm"
type="green"
style="margin-top: 0; margin-bottom: 0; cursor: inherit"
>
New
</Tag>
{/if}
</SideNavMenuItem>
{/each}
</SideNavMenu>
<SideNavMenu expanded="{$isActive($url('/recipes'))}" text="Recipes">
{#each recipes.children as child, i (child.path)}
<SideNavMenuItem
href="{$url(child.path)}"
isSelected="{$isActive($url(child.path))}"
>
{child.title}
</SideNavMenuItem>
{/each}
</SideNavMenu>
{#each components.children.filter((child) => !deprecated.includes(child.title)) as child (child.path)}
<SideNavMenuItem
text={child.title}
href={$url(child.path)}
isSelected={$isActive($url(child.path))}
>
{child.title}
{#if deprecated.includes(child.title)}
<Tag
size="sm"
type="red"
style="margin-top: 0; margin-bottom: 0; cursor: inherit"
>
Deprecated
</Tag>
{/if}
{#if new_components.includes(child.title)}
<Tag
size="sm"
type="green"
style="margin-top: 0; margin-bottom: 0; cursor: inherit"
>
New
</Tag>
{/if}
</SideNavMenuItem>
{/each}
</SideNavItems>
</SideNav>
<slot />
<Footer />
</Theme>
<style global>
.body-short-01 {
font-size: var(--cds-body-short-01-font-size);
font-weight: var(--cds-body-short-01-font-weight);
letter-spacing: var(--cds-body-short-01-letter-spacing);
line-height: var(--cds-body-short-01-line-height);
}
.bx--col > h1 {
font-size: var(--cds-display-01-font-size);
font-weight: var(--cds-display-01-font-weight);
letter-spacing: var(--cds-display-01-letter-spacing);
line-height: var(--cds-display-01-line-height);
margin-bottom: var(--cds-layout-01);
}
.big-paragraph {
font-size: var(--cds-expressive-heading-03-font-size);
font-weight: var(--cds-expressive-heading-03-font-weight);
letter-spacing: var(--cds-expressive-heading-03-letter-spacing);
line-height: var(--cds-expressive-heading-03-line-height);
margin-top: var(--cds-layout-03);
margin-bottom: var(--cds-layout-06);
}
.big-link,
.bx--col > .big-paragraph > code {
font-size: var(--cds-expressive-heading-03-font-size);
font-weight: var(--cds-expressive-heading-03-font-weight);
letter-spacing: var(--cds-expressive-heading-03-letter-spacing);
line-height: var(--cds-expressive-heading-03-line-height);
}
.bx--col > p {
max-width: 44rem;
}
.bx--col > p > code {
font-size: var(--cds-code-02-font-size);
font-weight: var(--cds-code-02-font-weight);
line-height: var(--cds-code-02-line-height);
letter-spacing: var(--cds-code-02-letter-spacing);
background-color: var(--cds-ui-03);
border-radius: 0.25rem;
padding: 0 var(--cds-spacing-02);
}
.bx--col > h2 {
font-size: var(--cds-expressive-heading-05-font-size);
font-weight: var(--cds-expressive-heading-05-font-weight);
letter-spacing: var(--cds-expressive-heading-05-letter-spacing);
line-height: var(--cds-expressive-heading-05-line-height);
padding-top: var(--cds-layout-04);
margin-bottom: var(--cds-layout-01);
}
.bx--col > h3 {
font-size: var(--cds-expressive-heading-04-font-size);
font-weight: var(--cds-expressive-heading-04-font-weight);
letter-spacing: var(--cds-expressive-heading-04-letter-spacing);
line-height: var(--cds-expressive-heading-04-line-height);
padding-top: var(--cds-layout-04);
margin-bottom: var(--cds-layout-01);
}
.bx--col > h4 {
font-size: var(--cds-expressive-heading-02-font-size);
font-weight: var(--cds-expressive-heading-02-font-weight);
letter-spacing: var(--cds-expressive-heading-02-letter-spacing);
line-height: var(--cds-expressive-heading-02-line-height);
padding-top: var(--cds-layout-04);
margin-bottom: var(--cds-layout-01);
}
.bx--col > p {
margin-bottom: var(--cds-layout-02);
}
main.bx--content {
background: none;
min-height: calc(100vh - 3rem - 3rem);
}
<style>
/** Hide logo to make space for search bar on narrower screens. */
@media (max-width: 1056px) {
.bx--side-nav ~ .bx--content {
margin-left: 0;
padding-left: 1rem;
padding-right: 1rem;
}
.bx--side-nav--expanded ~ .bx--content {
white-space: nowrap;
min-width: 28rem;
.platform-name.hidden {
display: none;
}
}
@ -242,28 +245,9 @@
align-items: baseline;
}
.platform-name code {
margin-left: var(--cds-spacing-02);
font-size: var(--cds-code-01-font-size);
font-weight: var(--cds-code-01-font-weight);
letter-spacing: var(--cds-code-01-letter-spacing);
line-height: var(--cds-code-01-line-height);
color: #c6c6c6;
}
@media (max-width: 580px) {
.platform-name code {
display: none;
}
}
@media (min-width: 1057px) {
.bx--side-nav__navigation {
z-index: 1;
}
}
.bx--side-nav__submenu[aria-expanded="true"] + .bx--side-nav__menu {
max-height: 124rem;
}
</style>

View file

@ -10,9 +10,14 @@ components: ["Accordion", "AccordionItem", "AccordionSkeleton"]
import Preview from "../../components/Preview.svelte";
</script>
See the [ExpandableAccordion recipe](/recipes/ExpandableAccordion) for a toggleable accordion component.
`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>
<AccordionItem title="Natural Language Classifier">
@ -27,7 +32,11 @@ See the [ExpandableAccordion recipe](/recipes/ExpandableAccordion) for a togglea
</AccordionItem>
</Accordion>
### 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">
<AccordionItem title="Natural Language Classifier">
@ -42,34 +51,40 @@ See the [ExpandableAccordion recipe](/recipes/ExpandableAccordion) for a togglea
</AccordionItem>
</Accordion>
### 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>
<AccordionItem>
<div slot="title">
<svelte:fragment slot="title">
<h5>Natural Language Classifier</h5>
<div>AI / Machine Learning</div>
</div>
</svelte:fragment>
<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>
</AccordionItem>
<AccordionItem>
<div slot="title">
<svelte:fragment slot="title">
<h5>Natural Language Understanding</h5>
<div>AI / Machine Learning</div>
</div>
</svelte:fragment>
<p>Analyze text to extract meta-data from content such as concepts, entities, emotion, relations, sentiment and more.</p>
</AccordionItem>
<AccordionItem>
<div slot="title">
<svelte:fragment slot="title">
<h5>Language Translator</h5>
<div>AI / Machine Learning</div>
</div>
</svelte:fragment>
<p>Translate text, documents, and websites from one language to another. Create industry or region-specific translations via the service's customization capability.</p>
</AccordionItem>
</Accordion>
### 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>
<AccordionItem open title="Natural Language Classifier">
@ -84,7 +99,19 @@ See the [ExpandableAccordion recipe](/recipes/ExpandableAccordion) for a togglea
</AccordionItem>
</Accordion>
### Extra-large size
## Programmatic example
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" />
## 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">
<AccordionItem title="Natural Language Classifier">
@ -99,7 +126,11 @@ See the [ExpandableAccordion recipe](/recipes/ExpandableAccordion) for a togglea
</AccordionItem>
</Accordion>
### 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">
<AccordionItem title="Natural Language Classifier">
@ -114,7 +145,10 @@ See the [ExpandableAccordion recipe](/recipes/ExpandableAccordion) for a togglea
</AccordionItem>
</Accordion>
### 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>
<AccordionItem title="Natural Language Classifier">
@ -129,7 +163,11 @@ See the [ExpandableAccordion recipe](/recipes/ExpandableAccordion) for a togglea
</AccordionItem>
</Accordion>
### 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>
<AccordionItem disabled title="Natural Language Classifier">
@ -144,27 +182,47 @@ See the [ExpandableAccordion recipe](/recipes/ExpandableAccordion) for a togglea
</AccordionItem>
</Accordion>
### 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 />
### 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" />
### 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} />
### 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} />
### 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" />
### 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" />

View file

@ -3,59 +3,67 @@
import Preview from "../../components/Preview.svelte";
</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"`, `"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>
2x1
</AspectRatio>
### Ratio 16x9
## Ratio 2x3
<AspectRatio ratio="2x3">
2x3
</AspectRatio>
## Ratio 16x9
<AspectRatio ratio="16x9">
16x9
</AspectRatio>
### Ratio 4x3
## Ratio 4x3
<AspectRatio ratio="4x3">
4x3
</AspectRatio>
### Ratio 1x1
## Ratio 1x1
<AspectRatio ratio="1x1">
1x1
</AspectRatio>
### Ratio 3x4
## Ratio 3x4
<AspectRatio ratio="3x4">
3x4
</AspectRatio>
### Ratio 3x2
## Ratio 3x2
<AspectRatio ratio="3x2">
3x2
</AspectRatio>
### Ratio 9x16
## Ratio 9x16
<AspectRatio ratio="9x16">
9x16
</AspectRatio>
### Ratio 1x2
## Ratio 1x2
<AspectRatio ratio="1x2">
1x2
</AspectRatio>
### Tile (16x9)
## Tile (16x9)
<AspectRatio ratio="16x9">
<Tile style="height: 100%">Content</Tile>

View file

@ -12,9 +12,11 @@ components: ["Breadcrumb", "BreadcrumbItem"]
import Preview from "../../components/Preview.svelte";
</script>
See the [Breadcrumbs recipe](/recipes/Breadcrumbs) for a reusable breadcrumbs component.
`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>
<BreadcrumbItem href="/">Dashboard</BreadcrumbItem>
@ -22,14 +24,18 @@ See the [Breadcrumbs recipe](/recipes/Breadcrumbs) for a reusable breadcrumbs co
<BreadcrumbItem href="/reports/2019" isCurrentPage>2019</BreadcrumbItem>
</Breadcrumb>
### No trailing slash
## No trailing slash
Remove the trailing slash from the last breadcrumb item using `noTrailingSlash`.
<Breadcrumb noTrailingSlash>
<BreadcrumbItem href="/">Home</BreadcrumbItem>
<BreadcrumbItem href="/profile" isCurrentPage>Profile</BreadcrumbItem>
</Breadcrumb>
### Overflow menu
## Overflow menu
Add an `OverflowMenu` to handle long breadcrumb trails. Use `OverflowMenuItem` components for menu options.
<Breadcrumb>
<BreadcrumbItem href="/">Home</BreadcrumbItem>
@ -43,6 +49,12 @@ See the [Breadcrumbs recipe](/recipes/Breadcrumbs) for a reusable breadcrumbs co
<BreadcrumbItem href="/api/data/latest/usage" isCurrentPage>Usage</BreadcrumbItem>
</Breadcrumb>
### Skeleton
## Breadcrumb trail
<FileSource src="/framed/Breadcrumbs/Breadcrumbs" />
## Skeleton
Display a loading state with `skeleton` prop. Use `count` to specify the number of items.
<Breadcrumb noTrailingSlash skeleton count={3} />

View file

@ -0,0 +1,35 @@
<script>
import {
UnorderedList, ListItem
} from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
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)">
<ListItem><strong>Small</strong>: less than 672px</ListItem>
<ListItem><strong>Medium</strong>: 672 - 1056px</ListItem>
<ListItem><strong>Large</strong>: 1056 - 1312px</ListItem>
<ListItem><strong>X-Large</strong>: 1312 - 1584px</ListItem>
<ListItem><strong>Max</strong>: greater than 1584px</ListItem>
</UnorderedList>
This utility component uses the [Window.matchMedia API](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia) to declaratively determine the current Carbon breakpoint size.
## Default
Bind to the `size` prop to determine the current breakpoint size. Possible values include: `"sm" | "md" | "lg" | "xlg" | "max"`.
The `"on:change"` event will fire when the size is initially determined and when a breakpoint change event occurs (e.g., the browser width is resized).
<FileSource src="/framed/Breakpoint/Breakpoint" />
## Store and Breakpoint Values
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.
Access the `breakpoints` dictionary to map from `BreakpointSize` to `BreakpointValue`.
<FileSource src="/framed/Breakpoint/BreakpointObserver" />

View file

@ -1,84 +1,126 @@
<script>
import { Button } from "carbon-components-svelte";
import Add16 from "carbon-icons-svelte/lib/Add16";
import TrashCan16 from "carbon-icons-svelte/lib/TrashCan16";
import TextBold16 from "carbon-icons-svelte/lib/TextBold16";
import TextItalic16 from "carbon-icons-svelte/lib/TextItalic16";
import TextUnderline16 from "carbon-icons-svelte/lib/TextUnderline16";
import { InlineNotification, Button } from "carbon-components-svelte";
import Add from "carbon-icons-svelte/lib/Add.svelte";
import TrashCan from "carbon-icons-svelte/lib/TrashCan.svelte";
import Login from "carbon-icons-svelte/lib/Login.svelte";
import Preview from "../../components/Preview.svelte";
let index = 1;
</script>
### Primary button
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
The default button style is primary. This should be used for primary actions.
<Button>Primary button</Button>
### Secondary button
## Secondary button
Set `kind="secondary"` for secondary actions.
<Button kind="secondary">Secondary button</Button>
### Tertiary button
## Tertiary button
Set `kind="tertiary"` for tertiary actions.
<Button kind="tertiary">Tertiary button</Button>
### Ghost button
## Ghost button
Set `kind="ghost"` for ghost-style buttons.
<Button kind="ghost">Ghost button</Button>
### Danger button
## Danger button
Set `kind="danger"` for destructive actions.
<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>
### Danger tertiary, icon-only button
## Danger tertiary, icon-only button
**Note:** you must provide an `iconDescription` for the button tooltip.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">
Provide an <strong>iconDescription</strong> for accessibility. This text will be used as the button's tooltip and screen reader label.
</div>
</InlineNotification>
<Button kind="danger-tertiary"iconDescription="Delete" icon={TrashCan16} />
<Button kind="danger-tertiary" iconDescription="Delete" icon={TrashCan} />
### Danger ghost button
## Danger ghost button
Set `kind="danger-ghost"` for ghost-style destructive actions.
<Button kind="danger-ghost">Danger ghost button</Button>
### Button with icon
## Button with icon
<Button icon={Add16}>With icon</Button>
Add an icon to the button using the `icon` prop.
### Icon-only button
<Button icon={Add}>With icon</Button>
**Note:** you must provide an `iconDescription` for the button tooltip.
## Icon-only button
<Button iconDescription="Tooltip text" icon={Add16} />
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">
Provide an <strong>iconDescription</strong> for accessibility. This text will be used as the button's tooltip and screen reader label.
</div>
</InlineNotification>
### Icon-only button (custom tooltip position)
<Button iconDescription="Tooltip text" icon={Add} />
The tooltip position and alignment can be controlled by `tooltipPosition` and `tooltipAlignment`.
## Icon-only, link button
<Button tooltipPosition="right" tooltipAlignment="end" iconDescription="Tooltip text" icon={Add16} />
Set `href` to create an icon-only link button.
### Selected icon-only, ghost button
<Button iconDescription="Login" icon={Login} href="#" />
## Icon-only button (custom tooltip position)
Control the tooltip position and alignment with `tooltipPosition` and `tooltipAlignment`.
<Button tooltipPosition="right" tooltipAlignment="end" iconDescription="Tooltip text" icon={Add} />
## Selected icon-only, ghost button
Set `isSelected` to `true` to enable the selected state for an icon-only, ghost button.
<FileSource src="/framed/Button/SelectedIconOnlyButton" />
### 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) with a "button" role.
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>
### Custom element
## Link button with icon
Similarly, link buttons can have icons.
<Button href="#" icon={Add}>Link button with icon</Button>
## 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>
<p {...props}>Custom element</p>
</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" kind="secondary">Secondary</Button>
@ -86,7 +128,9 @@ If an `href` value is specified, the component will render an [anchor element](h
<Button size="field" kind="ghost">Ghost</Button>
<Button size="field" kind="danger">Danger</Button>
### Small size
## Small size
Set `size="small"` for small buttons.
<Button size="small">Primary</Button>
<Button size="small" kind="secondary">Secondary</Button>
@ -94,7 +138,9 @@ If an `href` value is specified, the component will render an [anchor element](h
<Button size="small" kind="ghost">Ghost</Button>
<Button size="small" kind="danger">Danger</Button>
### Large size
## Large size
Set `size="lg"` for large buttons.
<Button size="lg">Primary</Button>
<Button size="lg" kind="secondary">Secondary</Button>
@ -102,7 +148,9 @@ If an `href` value is specified, the component will render an [anchor element](h
<Button size="lg" kind="ghost">Ghost</Button>
<Button size="lg" kind="danger">Danger</Button>
### Extra-large size
## Extra-large size
Set `size="xl"` for extra-large buttons.
<Button size="xl">Primary</Button>
<Button size="xl" kind="secondary">Secondary</Button>
@ -110,15 +158,22 @@ If an `href` value is specified, the component will render an [anchor element](h
<Button size="xl" kind="ghost">Ghost</Button>
<Button size="xl" kind="danger">Danger</Button>
### Disabled button
## Disabled state
Set `disabled` to disable the button.
<Button disabled>Disabled button</Button>
<Button disabled iconDescription="Tooltip text" icon={Add} />
### Expressive styles
## Expressive styles
Set `expressive` to `true` to use Carbon's expressive typesetting.
Note: the expressive styles only apply to the default, `"lg"`, and `"xl"` button sizes.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">
Use expressive styles with default, "lg", or "xl" button sizes.
</div>
</InlineNotification>
<Button expressive size="xl">Primary</Button>
<Button expressive size="xl" kind="secondary">Secondary</Button>
@ -138,10 +193,18 @@ Note: the expressive styles only apply to the default, `"lg"`, and `"xl"` button
<Button expressive kind="ghost">Ghost</Button>
<Button expressive kind="danger">Danger</Button>
### Skeleton
## Skeleton
Set `skeleton` to show a loading state.
<Button size="xl" skeleton />
<Button size="lg" skeleton />
<Button skeleton />
<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

@ -1,27 +1,25 @@
---
source: Button/ButtonSet.svelte
---
<script>
import { Button, ButtonSet } from "carbon-components-svelte";
import Login16 from "carbon-icons-svelte/lib/Login16";
import Login from "carbon-icons-svelte/lib/Login.svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default
Group related buttons together in a set. Use this component to create consistent spacing and alignment between multiple buttons.
Buttons in a button set are juxtaposed by default.
## Default
Place buttons side by side in a horizontal layout.
<ButtonSet>
<Button kind="secondary">Cancel</Button>
<Button>Submit</Button>
</ButtonSet>
### Stacked
## Stacked
Set `stacked` to `true` to use the stacked variant.
Set `stacked` to `true` to arrange buttons vertically.
<ButtonSet stacked>
<Button icon={Login16}>Log in</Button>
<Button icon={Login}>Log in</Button>
<Button kind="ghost">Sign up</Button>
</ButtonSet>

View file

@ -1,28 +1,62 @@
<script>
import { Checkbox } from "carbon-components-svelte";
import { Checkbox, InlineNotification } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</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" />
### Checked
## Checked
Set `checked` to `true` to pre-select the checkbox.
<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 />
### 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 />
### Disabled
## Disabled state
Set `disabled` to `true` to prevent user interaction.
<Checkbox labelText="Label text" disabled />
### Skeleton
## Reactive example (bind:checked)
<Checkbox skeleton />
Use two-way binding with `bind:checked` to track the checkbox state.
<FileSource src="/framed/Checkbox/CheckboxReactive" />
## Reactive example (bind:group)
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>
<div class="body-short-01">
When using <strong>bind:group</strong>, <strong>bind:checked</strong> only supports one-way binding.
</div>
</InlineNotification>
<FileSource src="/framed/Checkbox/MultipleCheckboxes" />
## Skeleton
Set `skeleton` to `true` to show a loading state.
<Checkbox skeleton />

View file

@ -1,20 +1,44 @@
---
source: Tile/ClickableTile.svelte
---
<script>
import { ClickableTile } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default
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.
<ClickableTile href="https://www.carbondesignsystem.com/">Carbon Design System</ClickableTile>
## Default
### Light variant
Create a clickable tile with an `href` to link to another page.
<ClickableTile light href="https://www.carbondesignsystem.com/">Carbon Design System</ClickableTile>
<ClickableTile href="https://www.carbondesignsystem.com/">
Carbon Design System
</ClickableTile>
### Disabled state
## Prevent default behavior
<ClickableTile disabled href="https://www.carbondesignsystem.com/">Carbon Design System</ClickableTile>
Handle the `click` event to override the default link behavior. Use `e.preventDefault()` to stop navigation.
<ClickableTile
href="/"
on:click={(e) => {
e.preventDefault();
// custom behavior
}}
>
Carbon Design System
</ClickableTile>
## Light variant
Set `light` to `true` to use the light color scheme.
<ClickableTile light href="https://www.carbondesignsystem.com/">
Carbon Design System
</ClickableTile>
## Disabled state
Set `disabled` to `true` to prevent interaction.
<ClickableTile disabled href="https://www.carbondesignsystem.com/">
Carbon Design System
</ClickableTile>

View file

@ -1,5 +1,5 @@
<script>
import { CodeSnippet, InlineNotification, Link } from "carbon-components-svelte";
import { CodeSnippet } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
let code = `// helpers.js
@ -27,66 +27,124 @@ let comment = `
`
</script>
<InlineNotification svx-ignore title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">As of version 0.32, the CodeSnippet will copy the provided `code` text when clicking the copy button.</div>
</InlineNotification>
Code snippets display and copy code examples. They support single-line, multi-line, and inline formats with customizable copy and expand functionality.
### Default (single-line)
This component uses the native, asynchronous [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText) to copy text.
<CodeSnippet code="yarn add -D carbon-components-svelte" />
You can override the default copy functionality with your own implementation. See [Overriding copy functionality](#overriding-copy-functionality).
### Inline
## Default
Display a single-line code snippet by default.
<CodeSnippet code="npm i carbon-components-svelte" />
## Overriding copy functionality
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.
<FileSource src="/framed/CodeSnippet/CodeSnippetOverride" />
## Preventing copy functionality
Pass a no-op function to the `copy` prop to disable copying.
<CodeSnippet code="npm i carbon-components-svelte" copy={() => {}} />
## Inline
Set `type="inline"` to display code inline with text.
<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} />
### Custom copy feedback text
## Expanded by default
Use the `feedback` prop to override the default copy button feedback text.
Set `expanded` to `true` to show the full multi-line code snippet.
<CodeSnippet type="multi" {code} expanded />
## Reactive example
The multi-line code snippet dispatches "expand" and "collapse" events.
<FileSource src="/framed/CodeSnippet/CodeSnippetReactive" />
## Custom copy feedback text
Set `feedback` to customize the copy button feedback text.
<CodeSnippet type="multi" {code} feedback="Copied to clipboard" />
### Hidden copy button
## Hidden copy button
Set `hideCopyButton` to `true` to hide the copy button.
<CodeSnippet type="multi" {code} hideCopyButton />
### Disabled
## Hidden show more button
The `disabled` prop applies only to the `"single"` and `"multi"` code snippet types.
Set `showMoreLess` to `false` to hide the expand/collapse button on multi-line snippets.
<CodeSnippet disabled code="yarn add -D carbon-components-svelte" />
<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
Set `disabled` to `true` to disable interaction. This only applies to `"single"` and `"multi"` types.
<CodeSnippet disabled code="npm i carbon-components-svelte" />
<br />
<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}" />
### 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" />
### 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" />
### Skeleton
## Skeleton
The default skeleton type is `"single"`.
Set `skeleton` to `true` to show a loading state. Defaults to `"single"` type.
<CodeSnippet skeleton />
### Skeleton (multi-line)
## Skeleton (multi-line)
Set `type="multi"` with `skeleton` to show a multi-line loading state.
<CodeSnippet type="multi" skeleton />

View file

@ -1,9 +1,19 @@
<script>
import { ComboBox } from "carbon-components-svelte";
import { ComboBox, InlineNotification } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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.
<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>
</InlineNotification>
## 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"
items={[
@ -12,27 +22,70 @@ items={[
{id: "2", text: "Fax"}
]} />
### Selected index
## Custom slot
<ComboBox titleText="Contact" placeholder="Select contact method"
selectedIndex={1}
Override the default slot to customize how each item displays. Access the item and index through the `let:` directive.
<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"}
]} />
### Multiple combo boxes
## Initial selected id
Set `selectedId` to pre-select an item when the combobox loads.
<ComboBox titleText="Contact" placeholder="Select contact method"
selectedId="1"
items={[
{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}
]} />
## Reactive example
See how the combobox responds to user input and selection changes.
<FileSource src="/framed/ComboBox/ReactiveComboBox" />
## Clear selection
Use `bind:this` to access the component instance and call `ComboBox.clear()` to programmatically clear the selection.
Set `focus: false` in the method options to prevent re-focusing the input.
<FileSource src="/framed/ComboBox/ComboBoxClear" />
## Multiple combo boxes
See how to manage multiple comboboxes in a form.
<FileSource src="/framed/ComboBox/MultipleComboBox" />
### Filterable
## Filterable
Enable filtering to let users search through the options.
<FileSource src="/framed/ComboBox/FilterableComboBox" />
### Top direction
## Filterable with custom label
Set `direction` to `"top"` for the combobox dropdown menu to appear above the input.
Set `itemToString` to customize how items display in the filterable combobox.
<FileSource src="/framed/ComboBox/FilterableComboBoxCustomLabel" />
## Top direction
Set `direction` to `"top"` to make the dropdown menu appear above the input.
<ComboBox direction="top" titleText="Contact" placeholder="Select contact method"
items={[
@ -41,7 +94,9 @@ items={[
{id: "2", text: "Fax"}
]} />
### Light variant
## Light variant
Set `light` to `true` to use the light color scheme.
<ComboBox light titleText="Contact" placeholder="Select contact method"
items={[
@ -50,7 +105,9 @@ items={[
{id: "2", text: "Fax"}
]} />
### Extra-large size
## Extra-large size
Set `size` to `"xl"` for an extra-large combobox.
<ComboBox titleText="Contact" placeholder="Select contact method"
size="xl"
@ -60,7 +117,9 @@ items={[
{id: "2", text: "Fax"}
]} />
### Small size
## Small size
Set `size` to `"sm"` for a small combobox.
<ComboBox titleText="Contact" placeholder="Select contact method"
size="sm"
@ -70,7 +129,9 @@ items={[
{id: "2", text: "Fax"}
]} />
### 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"
items={[
@ -79,7 +140,9 @@ items={[
{id: "2", text: "Fax"}
]} />
### 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"
items={[
@ -88,11 +151,27 @@ items={[
{id: "2", text: "Fax"}
]} />
### Disabled
## Disabled state
Set `disabled` to `true` to prevent interaction with the combobox.
<ComboBox disabled titleText="Contact" placeholder="Select contact method"
items={[
{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}
]} />
]} />
## Disabled items
Set `disabled: true` in an item object to disable specific options.
<ComboBox
titleText="Contact"
placeholder="Select contact method"
items={[
{ id: "0", text: "Slack" },
{ id: "1", text: "Email", disabled: true },
{ id: "2", text: "Fax" },
]}
/>

View file

@ -6,6 +6,16 @@ components: ["ComposedModal", "ModalHeader", "ModalBody", "ModalFooter"]
import Preview from "../../components/Preview.svelte";
</script>
### Composed modal
`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
Create a modal with a header, body, and footer. Each section can be customized independently.
<FileSource src="/framed/Modal/ComposedModal" />
## Multiple secondary buttons
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" />

View file

@ -4,19 +4,25 @@ components: ["ContentSwitcher", "Switch"]
<script>
import { ContentSwitcher, Switch } from "carbon-components-svelte";
import Bullhorn16 from "carbon-icons-svelte/lib/Bullhorn16";
import Analytics16 from "carbon-icons-svelte/lib/Analytics16";
import Bullhorn from "carbon-icons-svelte/lib/Bullhorn.svelte";
import Analytics from "carbon-icons-svelte/lib/Analytics.svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default
`ContentSwitcher` lets users switch between different views or sections of content. Use it to organize related content into distinct categories or states.
## Default
Create a content switcher with `Switch` components. Each switch needs a `text` prop.
<ContentSwitcher>
<Switch text="Latest news" />
<Switch text="Trending" />
</ContentSwitcher>
### Initial selected index
## Initial selected index
Set `selectedIndex` to pre-select a switch when the content switcher loads.
<ContentSwitcher selectedIndex={1}>
<Switch text="Latest news" />
@ -24,40 +30,52 @@ components: ["ContentSwitcher", "Switch"]
<Switch text="Recommended" />
</ContentSwitcher>
### 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" />
### Custom switch slot
## Custom switch slot
Override the default slot in `Switch` to customize how each option displays.
<ContentSwitcher>
<Switch>
<div style="display: flex; align-items: center;">
<Bullhorn16 style="margin-right: 0.5rem;" /> Latest news
<Bullhorn style="margin-right: 0.5rem;" /> Latest news
</div>
</Switch>
<Switch>
<div style="display: flex; align-items: center;">
<Analytics16 style="margin-right: 0.5rem;" /> Trending
<Analytics style="margin-right: 0.5rem;" /> Trending
</div>
</Switch>
</ContentSwitcher>
### Extra-large size
## Extra-large size
Set `size` to `"xl"` for an extra-large content switcher.
<ContentSwitcher size="xl">
<Switch text="All" />
<Switch text="Archived" />
</ContentSwitcher>
### Small size
## Small size
Set `size` to `"sm"` for a small content switcher.
<ContentSwitcher size="sm">
<Switch text="All" />
<Switch text="Archived" />
</ContentSwitcher>
### Disabled
## Disabled
Set `disabled` to `true` on individual switches to prevent interaction.
<ContentSwitcher>
<Switch disabled text="All" />

View file

@ -6,12 +6,32 @@ components: ["ContextMenu", "ContextMenuGroup", "ContextMenuRadioGroup", "Contex
import Preview from "../../components/Preview.svelte";
</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.
### Default
## Default
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" />
### Radio groups
## Custom target
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" />
## Multiple targets
Set `target` to an array of elements to trigger the context menu from multiple sources.
<FileSource src="/framed/ContextMenu/ContextMenuTargets" />
## Radio groups
Use `ContextMenuGroup` and `ContextMenuRadioGroup` to organize related options and create radio button selections.
<FileSource src="/framed/ContextMenu/ContextMenuGroups" />

View file

@ -1,16 +1,34 @@
<script>
import { CopyButton, InlineNotification, Link } from "carbon-components-svelte";
import { CopyButton } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
<InlineNotification svx-ignore title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">As of version 0.32, this component will copy the provided `code` text when clicking the button.</div>
</InlineNotification>
`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.
### Default
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).
## Default
Create a copy button with the `text` prop to specify what to copy.
<CopyButton text="Carbon svelte" />
### Custom feedback text
## Custom feedback text
<CopyButton text="Carbon svelte" feedback="Copied to clipboard" />
Set `feedback` to customize the message shown after copying.
<CopyButton text="Carbon svelte" feedback="Copied to clipboard" />
## Overriding copy functionality
Pass a custom function to the `copy` prop to override the default copy behavior.
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" />
## Preventing copy functionality
Pass a no-op function to the `copy` prop to disable copying.
<CopyButton text="This text should not be copied" copy={() => {}} />

View file

@ -1,16 +1,27 @@
---
components: ["DataTable", "Toolbar", "ToolbarContent", "ToolbarSearch", "ToolbarMenu", "ToolbarMenuItem", "ToolbarBatchActions"]
components: ["DataTable", "Pagination","Toolbar", "ToolbarContent", "ToolbarSearch", "ToolbarMenu", "ToolbarMenuItem", "ToolbarBatchActions"]
---
<script>
import { DataTable, DataTableSkeleton, Toolbar, ToolbarContent, ToolbarSearch, ToolbarMenu, ToolbarMenuItem, Button, Link } from "carbon-components-svelte";
import Launch16 from "carbon-icons-svelte/lib/Launch16";
import { InlineNotification, DataTable, DataTableSkeleton, Pagination, Toolbar, ToolbarContent, ToolbarSearch, ToolbarMenu, ToolbarMenuItem, Button, Link } from "carbon-components-svelte";
import Launch from "carbon-icons-svelte/lib/Launch.svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default
`DataTable` displays structured data in a tabular format. Use it to present large datasets with features like sorting, filtering, pagination, and row selection.
The `DataTable` is keyed for both rendering and sorting. You must define a "key" value per object in the `headers` property and an "id" value in `rows`.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">
This component is keyed for performance.
Every <strong>headers</strong> object must have a unique "key" property.
<div class="body-short-01">Every <strong>rows</strong> object must have a unique "id" property.</div>
</div>
</InlineNotification>
## Default
Create a basic table by providing `headers` and `rows` data. Match the `key` in headers with the corresponding property in rows.
<DataTable
headers="{[
@ -65,11 +76,9 @@ The `DataTable` is keyed for both rendering and sorting. You must define a "key"
]}"
/>
### 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.
The slot name for the table header cells is `"cell-header"`.
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.
<DataTable
headers="{[
@ -123,23 +132,25 @@ The slot name for the table header cells is `"cell-header"`.
},
]}"
>
<span slot="cell-header" let:header>
<svelte:fragment slot="cell-header" let:header>
{#if header.key === 'port'}
{header.value} (network)
{:else}
{header.value}
{/if}
</span>
<span slot="cell" let:row let:cell>
</svelte:fragment>
<svelte:fragment slot="cell" let:row let:cell>
{#if cell.key === 'rule' && cell.value === 'Round robin'}
<Link icon={Launch16} href="https://en.wikipedia.org/wiki/Round-robin_DNS" target="_blank">{cell.value}</Link>
<Link icon={Launch} href="https://en.wikipedia.org/wiki/Round-robin_DNS" target="_blank">{cell.value}</Link>
{:else}
{cell.value}
{/if}
</span>
</svelte:fragment>
</DataTable>
### 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."
headers="{[
@ -194,7 +205,160 @@ The slot name for the table header cells is `"cell-header"`.
]}"
/>
### With toolbar
## Slottable title, description
Use slots to customize the title and description content.
<DataTable
headers="{[
{ key: "name", value: "Name" },
{ key: "protocol", value: "Protocol" },
{ key: "port", value: "Port" },
{ key: "rule", value: "Rule" }
]}"
rows="{[
{
id: "a",
name: "Load Balancer 3",
protocol: "HTTP",
port: 3000,
rule: "Round robin"
},
{
id: "b",
name: "Load Balancer 1",
protocol: "HTTP",
port: 443,
rule: "Round robin"
},
{
id: "c",
name: "Load Balancer 2",
protocol: "HTTP",
port: 80,
rule: "DNS delegation"
},
{
id: "d",
name: "Load Balancer 6",
protocol: "HTTP",
port: 3000,
rule: "Round robin"
},
{
id: "e",
name: "Load Balancer 4",
protocol: "HTTP",
port: 443,
rule: "Round robin"
},
{
id: "f",
name: "Load Balancer 5",
protocol: "HTTP",
port: 80,
rule: "DNS delegation"
},
]}"
>
<strong slot="title">Load balancers</strong>
<span slot="description" style="font-size: 1rem">
Your organization's active load balancers.
</span>
</DataTable>
## Static width
Set `useStaticWidth` to `true` to render the table with an auto width instead of 100%.
<DataTable useStaticWidth
title="Load balancers" description="Your organization's active load balancers."
headers="{[
{ key: "name", value: "Name" },
{ key: "protocol", value: "Protocol" },
{ key: "port", value: "Port" },
{ key: "rule", value: "Rule" }
]}"
rows="{[
{
id: "a",
name: "Load Balancer 3",
protocol: "HTTP",
port: 3000,
rule: "Round robin"
},
{
id: "b",
name: "Load Balancer 1",
protocol: "HTTP",
port: 443,
rule: "Round robin"
},
{
id: "c",
name: "Load Balancer 2",
protocol: "HTTP",
port: 80,
rule: "DNS delegation"
},
{
id: "d",
name: "Load Balancer 6",
protocol: "HTTP",
port: 3000,
rule: "Round robin"
},
{
id: "e",
name: "Load Balancer 4",
protocol: "HTTP",
port: 443,
rule: "Round robin"
},
{
id: "f",
name: "Load Balancer 5",
protocol: "HTTP",
port: 80,
rule: "DNS delegation"
},
]}"
/>
## Custom column widths
Specify `width` or `minWidth` in the `headers` object to set column dimensions. This applies a fixed table layout.
<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>
</InlineNotification>
<FileSource src="/framed/DataTable/DataTableHeaderWidth" />
## Sticky header
Set `stickyHeader` to `true` to fix the header in place. This adds a maximum height to force scrolling.
<DataTable
stickyHeader
headers={[
{ key: "name", value: "Name" },
{ key: "protocol", value: "Protocol" },
{ key: "port", value: "Port" },
{ key: "rule", value: "Rule" },
]}
rows={Array.from({ length: 20 }).map((_, i) => ({
id: i,
name: "Load Balancer " + (i + 1),
protocol: "HTTP",
port: i % 3 ? (i % 2 ? 3000 : 80) : 443,
rule: i % 3 ? "Round robin" : "DNS delegation",
}))}
/>
## With toolbar
Add a toolbar with search, menu, and actions above the table.
<DataTable title="Load balancers" description="Your organization's active load balancers."
headers="{[
@ -253,15 +417,19 @@ The slot name for the table header cells is `"cell-header"`.
<ToolbarSearch />
<ToolbarMenu>
<ToolbarMenuItem primaryFocus>Restart all</ToolbarMenuItem>
<ToolbarMenuItem href="https://cloud.ibm.com/docs/loadbalancer-service">API documentation</ToolbarMenuItem>
<ToolbarMenuItem danger>Stop all</ToolbarMenuItem>
<ToolbarMenuItem href="https://cloud.ibm.com/docs/loadbalancer-service">
API documentation
</ToolbarMenuItem>
<ToolbarMenuItem hasDivider danger>Stop all</ToolbarMenuItem>
</ToolbarMenu>
<Button>Create balancer</Button>
</ToolbarContent>
</Toolbar>
</DataTable>
### 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."
headers="{[
@ -321,14 +489,30 @@ The slot name for the table header cells is `"cell-header"`.
<ToolbarMenu>
<ToolbarMenuItem primaryFocus>Restart all</ToolbarMenuItem>
<ToolbarMenuItem href="https://cloud.ibm.com/docs/loadbalancer-service">API documentation</ToolbarMenuItem>
<ToolbarMenuItem danger>Stop all</ToolbarMenuItem>
<ToolbarMenuItem hasDivider danger>Stop all</ToolbarMenuItem>
</ToolbarMenu>
<Button>Create balancer</Button>
</ToolbarContent>
</Toolbar>
</DataTable>
### Zebra stripes
## Filterable
Set `shouldFilterRows` to `true` to enable client-side filtering. The default filter performs string comparisons on cell values.
For pagination with filtering, bind to `filteredRowIds` and pass its length to `Pagination`'s `totalItems`.
<FileSource src="/framed/DataTable/DataTableFilterable" />
## Filterable (custom)
Pass a function to `shouldFilterRows` to implement custom filtering logic.
<FileSource src="/framed/DataTable/DataTableFilterCustom" />
## Zebra stripes
Set `zebra` to `true` to add alternating row colors.
<DataTable zebra
headers="{[
@ -383,7 +567,9 @@ The slot name for the table header cells is `"cell-header"`.
]}"
/>
### Tall rows
## Tall rows
Set `size="tall"` for increased row height.
<DataTable size="tall"
headers="{[
@ -438,7 +624,9 @@ The slot name for the table header cells is `"cell-header"`.
]}"
/>
### Medium rows
## Medium rows
Set `size="medium"` for standard row height.
<DataTable size="medium"
headers="{[
@ -493,7 +681,9 @@ The slot name for the table header cells is `"cell-header"`.
]}"
/>
### Short rows
## Short rows
Set `size="short"` for compact row height.
<DataTable size="short"
headers="{[
@ -548,7 +738,9 @@ The slot name for the table header cells is `"cell-header"`.
]}"
/>
### Compact rows
## Compact rows
Set `size="compact"` for minimal row height.
<DataTable size="compact"
headers="{[
@ -603,13 +795,9 @@ The slot name for the table header cells is `"cell-header"`.
]}"
/>
### Sortable
## Sortable
Set `sortable` to `true` to enable table column sorting.
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.
Set `sortable` to `true` to enable column sorting. Disable sorting on specific columns by setting `sort: false` in the header object.
<DataTable sortable
headers="{[
@ -664,7 +852,15 @@ In the example below, the "Protocol" column is not sortable.
]}"
/>
### Sortable with custom display and sort methods
## Sortable with pagination
Bind to `pageSize` and `page` props of `Pagination` and pass them to `DataTable`.
<FileSource src="/framed/DataTable/DataTablePagination" />
## 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."
headers="{[
@ -731,7 +927,9 @@ In the example below, the "Protocol" column is not sortable.
]}"
/>
### 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."
headers="{[
@ -810,33 +1008,63 @@ In the example below, the "Protocol" column is not sortable.
]}"
/>
### Empty column with overflow menu
## Programmatic sorting
Some use cases require an empty column in the table body without a corresponding table header.
Use `sortKey` and `sortDirection` props to control sorting programmatically. Set `sortKey` to a valid header key and `sortDirection` to "none", "ascending", or "descending".
For an object in the `headers` array, set `empty` to `true` to render an empty column.
<FileSource src="/framed/DataTable/DataTableProgrammaticSorting" />
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.
## Empty column with overflow menu
Set `empty: true` in a header object to create an empty column. Use this for overflow menus without a header.
<FileSource src="/framed/DataTable/DataTableAppendColumns" />
### Selectable
## Selectable rows (checkbox)
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" />
### Initial selected rows
## 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" />
### Selectable with batch actions
## Batch selection with initial selected rows
Use `selectedRowIds` to specify initially selected rows.
<FileSource src="/framed/DataTable/DataTableBatchSelectionInitial" />
## Batch selection with batch actions toolbar
Add a toolbar for batch actions when rows are selected.
<FileSource src="/framed/DataTable/DataTableBatchSelectionToolbar" />
### Selectable (radio)
## Batch selection with controlled toolbar
Control the batch actions toolbar with the `active` prop. Prevent default cancel behavior in the `on:cancel` event.
<FileSource src="/framed/DataTable/DataTableBatchSelectionToolbarControlled" />
## Selectable rows (radio)
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" />
### Expandable
## Non-selectable rows
Use `nonSelectableRowIds` to prevent selection of specific rows.
<FileSource src="/framed/DataTable/DataTableNonSelectableRows" />
## Expandable rows
Set `expandable` to `true` to make rows expandable. Use the `expanded-row` slot to customize expanded content.
<DataTable expandable
headers="{[
@ -890,14 +1118,26 @@ In the following example, each row in the sortable data table has an overflow me
},
]}"
>
<div slot="expanded-row" let:row>
<pre>
{JSON.stringify(row, null, 2)}
</pre>
</div>
<svelte:fragment slot="expanded-row" let:row>
<pre>{JSON.stringify(row, null, 2)}</pre>
</svelte:fragment>
</DataTable>
### Expandable (compact size)
## Non-expandable rows
Use `nonExpandableRowIds` to prevent expansion of specific rows.
<FileSource src="/framed/DataTable/DataTableNonExpandableRows" />
## Expandable (zebra styles)
Combine expandable rows with zebra striping.
<FileSource src="/framed/DataTable/DataTableExpandableZebra" />
## Expandable (compact size)
Set `size="compact"` for expandable rows with minimal height.
<DataTable size="compact" expandable
headers="{[
@ -951,14 +1191,14 @@ In the following example, each row in the sortable data table has an overflow me
},
]}"
>
<div slot="expanded-row" let:row>
<pre>
{JSON.stringify(row, null, 2)}
</pre>
</div>
<svelte:fragment slot="expanded-row" let:row>
<pre>{JSON.stringify(row, null, 2)}</pre>
</svelte:fragment>
</DataTable>
### Expandable (short size)
## Expandable (short size)
Set `size="short"` for expandable rows with compact height.
<DataTable size="short" expandable
headers="{[
@ -1012,14 +1252,14 @@ In the following example, each row in the sortable data table has an overflow me
},
]}"
>
<div slot="expanded-row" let:row>
<pre>
{JSON.stringify(row, null, 2)}
</pre>
</div>
<svelte:fragment slot="expanded-row" let:row>
<pre>{JSON.stringify(row, null, 2)}</pre>
</svelte:fragment>
</DataTable>
### Expandable (tall size)
## Expandable (tall size)
Set `size="tall"` for expandable rows with increased height.
<DataTable size="tall" expandable
headers="{[
@ -1073,14 +1313,14 @@ In the following example, each row in the sortable data table has an overflow me
},
]}"
>
<div slot="expanded-row" let:row>
<pre>
{JSON.stringify(row, null, 2)}
</pre>
</div>
<svelte:fragment slot="expanded-row" let:row>
<pre>{JSON.stringify(row, null, 2)}</pre>
</svelte:fragment>
</DataTable>
### Batch expansion
## Batch expansion
Set `batchExpansion` to `true` to expand and collapse all rows at once.
<DataTable batchExpansion
headers="{[
@ -1134,45 +1374,61 @@ In the following example, each row in the sortable data table has an overflow me
},
]}"
>
<div slot="expanded-row" let:row>
<pre>
{JSON.stringify(row, null, 2)}
</pre>
</div>
<svelte:fragment slot="expanded-row" let:row>
<pre>{JSON.stringify(row, null, 2)}</pre>
</svelte:fragment>
</DataTable>
### Skeleton
## Expandable and selectable rows
Combine `batchExpansion` and `batchSelection` for tables with both expandable and selectable rows.
<FileSource src="/framed/DataTable/DataTableExpandableSelectable" />
## Skeleton
Use `DataTableSkeleton` to show a loading state.
<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} />
### 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} />
### 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} />
### Skeleton without header, toolbar
## Skeleton without header, toolbar
Hide the header and toolbar in the skeleton.
<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" />
### Skeleton (short size)
## Skeleton (short size)
Set `size="short"` for a shorter skeleton.
<DataTableSkeleton showHeader={false} showToolbar={false} size="short" />
### Skeleton (compact size)
## Skeleton (compact size)
<DataTableSkeleton showHeader={false} showToolbar={false} size="compact" />
Set `size="compact"` for a minimal skeleton.
<DataTableSkeleton showHeader={false} showToolbar={false} size="compact" />

View file

@ -3,64 +3,112 @@ components: ["DatePicker", "DatePickerInput", "DatePickerSkeleton"]
---
<script>
import { DatePicker, DatePickerSkeleton, DatePickerInput } from "carbon-components-svelte";
import { DatePicker, DatePickerSkeleton, DatePickerInput, InlineNotification } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default (simple)
`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.
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">
If using Rollup, specify <strong>inlineDynamicImports: true</strong> in your <strong>rollup.config.js</strong>.
</div>
</InlineNotification>
## Single
Set `datePickerType` to `"single"` for single date selection.
<FileSource src="/framed/DatePicker/DatePickerSingle" />
## Range
Set `datePickerType` to `"range"` to enable date range selection.
<FileSource src="/framed/DatePicker/DatePickerRange" />
## 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" />
## Simple
Create a simple date picker without a dropdown calendar.
<DatePicker>
<DatePickerInput labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker>
### Hidden label
## With helper text
Add helper text to provide additional context or formatting instructions.
<DatePicker>
<DatePickerInput labelText="Date of birth" helperText="Example: 01/12/1990" placeholder="mm/dd/yyyy" />
</DatePicker>
## Hidden label
Hide the label while maintaining accessibility.
<DatePicker>
<DatePickerInput hideLabel labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker>
### Light variant
## Light variant
Use the light variant for light backgrounds.
<DatePicker light>
<DatePickerInput labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker>
### Extra-large size
## Extra-large size
Use the extra-large size for more prominent date pickers.
<DatePicker>
<DatePickerInput size="xl" labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker>
### Small size
## Small size
Use the small size for compact date pickers.
<DatePicker>
<DatePickerInput size="sm" labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker>
### Invalid state
## Invalid state
Show an invalid state when the input value is not valid.
<DatePicker>
<DatePickerInput invalid invalidText="Invalid date" labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker>
### Warning state
## Warning state
Show a warning state to indicate potential issues with the input.
<DatePicker>
<DatePickerInput warn warnText="This info will not be stored" labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker>
### Disabled state
## Disabled state
Disable the date picker to prevent user interaction.
<DatePicker>
<DatePickerInput disabled labelText="Date of birth" placeholder="mm/dd/yyyy" />
</DatePicker>
### Single
## Skeleton
<DatePicker datePickerType="single">
<DatePickerInput labelText="Schedule a meeting" placeholder="mm/dd/yyyy" />
</DatePicker>
Show a loading state with the skeleton component.
### Skeleton
<DatePickerSkeleton />
<DatePickerSkeleton />

View file

@ -3,86 +3,152 @@ components: ["Dropdown", "DropdownSkeleton"]
---
<script>
import { Dropdown, DropdownSkeleton } from "carbon-components-svelte";
import { Dropdown, DropdownSkeleton, InlineNotification } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default
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.
<Dropdown titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
<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>
</InlineNotification>
## 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"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" />
### Hidden label
## Custom slot
<Dropdown hideLabel titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
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" />
## 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"},
{id: "1", text: "Email"},
{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 => {
return item.text + ' (' + item.id +')'
}} titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
}} titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" />
### 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" />
### 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" selectedIndex={0} items="{[{id: "0", text: "Slack"},
<Dropdown direction="top" titleText="Contact" selectedId="0" items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" />
### Light variant
## Light variant
<Dropdown light titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
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"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" />
### Inline variant
## Inline variant
<Dropdown type="inline" titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
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"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" />
### Extra-large size
## Extra-large size
<Dropdown size="xl" titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
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"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" />
### Small size
## Small size
<Dropdown size="sm" titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
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"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" />
### Invalid state
## Invalid state
<Dropdown invalid invalidText="Secondary contact method must be different from the primary contact" titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
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"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" />
### Warning state
## Warning state
<Dropdown warn warnText="This contact method is not associated with your account" titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
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"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" />
### Disabled state
## Disabled state
<Dropdown disabled titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
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"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" />
### Skeleton
## Disabled 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
selectedId="0"
titleText="Contact"
items={[
{ id: "0", text: "Slack" },
{ id: "1", text: "Email", disabled: true },
{ id: "2", text: "Fax" },
]}
/>
## Skeleton
Display a loading state using the `DropdownSkeleton` component. This provides
visual feedback while the dropdown content is being loaded.
<DropdownSkeleton />

View file

@ -1,36 +1,94 @@
---
source: Tile/ExpandableTile.svelte
---
<script>
import { ExpandableTile } from "carbon-components-svelte";
import { ExpandableTile, Button } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default (unexpanded)
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
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.
By default, the tile is collapsed. Use the `above` and `below` slots to define the
content that appears before and after expansion.
<ExpandableTile>
<div slot="above">
<div>
Above the fold content here
</div>
<br />
<br />
<div>
More above the fold content
</div>
</div>
<div slot="below">Below the fold content here</div>
</ExpandableTile>
## Custom tile heights
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>
<div slot="above" style="height: 10rem">Above the fold content here</div>
<div slot="below" style="height: 10rem">Below the fold content here</div>
</ExpandableTile>
### Expanded
## Expanded
Display the tile in its expanded state by default by setting the `expanded` prop to
`true`.
<ExpandableTile expanded>
<div slot="above" style="height: 10rem">Above the fold content here</div>
<div slot="below" style="height: 10rem">Below the fold content here</div>
<div slot="above">Above the fold content here</div>
<div slot="below">Below the fold content here</div>
</ExpandableTile>
### Light variant
## Light variant
Use the light variant for expandable tiles on dark backgrounds by setting the
`light` prop to `true`.
<ExpandableTile light>
<div slot="above" style="height: 10rem">Above the fold content here</div>
<div slot="below" style="height: 10rem">Below the fold content here</div>
<div slot="above">Above the fold content here</div>
<div slot="below">Below the fold content here</div>
</ExpandableTile>
### 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">
<div slot="above" style="height: 10rem">Above the fold content here</div>
<div slot="below" style="height: 10rem">Below the fold content here</div>
</ExpandableTile>
<div slot="above">Above the fold content here</div>
<div slot="below">Below the fold content here</div>
</ExpandableTile>
## With interactive content
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">
<div slot="above">
<a href="/" on:click|preventDefault|stopPropagation={() => console.log("Hello world")}>
Native element
</a>
<br /><br />
<Button on:click={e => {
e.stopPropagation();
console.log("Hello world");
}}>
Svelte component
</Button>
</div>
<div slot="below">Below the fold content here</div>
</ExpandableTile>

View file

@ -3,42 +3,142 @@ components: ["FileUploaderButton", "FileUploader", "FileUploaderDropContainer",
---
<script>
import { FileUploaderButton, FileUploader, FileUploaderDropContainer, FileUploaderItem, FileUploaderSkeleton } from "carbon-components-svelte";
import { FileUploaderButton, FileUploader, FileUploaderDropContainer, FileUploaderItem, FileUploaderSkeleton, UnorderedList, ListItem } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### File uploader (button-only)
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.
<FileUploaderButton labelText="Add files" />
## File uploader (button-only)
### File uploader
Create a simple file upload button using `FileUploaderButton`. By default, it
accepts a single file. Set `multiple` to `true` to allow multiple file selection.
<FileUploaderButton labelText="Add file" />
## 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
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.
This example accepts multiple JPEG files and displays them in a completed state.
<FileUploader multiple labelTitle="Upload files" buttonLabel="Add files" labelDescription="Only JPEG files are accepted." accept="{['.jpg', '.jpeg']}" status="complete" />
### Item (uploading)
## Clear files
Remove uploaded files from the `FileUploader` component in two ways:
<UnorderedList svx-ignore style="margin-bottom: var(--cds-spacing-08)">
<ListItem>programmatically using the <strong>clearFiles</strong> accessor</ListItem>
<ListItem>two-way binding by setting <strong>files</strong> to <strong>[]</strong></ListItem>
</UnorderedList>
<FileSource src="/framed/FileUploader/FileUploaderClearFiles" />
## 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" />
## 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" />
### 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" />
### Item (invalid)
## Item (edit)
<FileUploaderItem invalid name="README.md" status="edit" />
Enable file deletion by setting the status to `"edit"`. Clicking the close icon
dispatches a `delete` event with the item's ID.
### Item sizes
<FileUploaderItem id="readme" name="README.md" status="edit" on:delete={(e) => {
console.log(e.detail); // "readme"
}} />
The default `FileUploaderItem` size is "default".
## Item (edit status, 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 />
## Item (edit status, invalid state with subject, body)
Provide detailed error messages for invalid files using the `errorSubject` and
`errorBody` props. This helps users understand and resolve upload issues.
<FileUploaderItem
invalid
id="readme"
name="README.md"
errorSubject="File size exceeds 500kb limit"
errorBody="Please select a new file."
status="edit"
on:delete
/>
## Item sizes
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="field" name="README.md" status="uploading" />
<FileUploaderItem size="small" name="README.md" status="uploading" />
### Drop container
## Drop container
<FileUploaderDropContainer labelText="Drag and drop files here or click to upload" multiple />
Use `FileUploaderDropContainer` for drag-and-drop file uploads. It supports file
validation and multiple file selection.
### Skeleton
This example accepts files smaller than 1 kB and logs the selected files to the
console.
<FileUploaderDropContainer
multiple
labelText="Drag and drop files here or click to upload"
validateFiles={files => {
return files.filter(file => file.size < 1_024)
}}
on:change={e=> {
console.log("files", e.detail)
}}
/>
## Skeleton
Display a loading state using the `FileUploaderSkeleton` component. This provides
visual feedback while the file uploader content is being loaded.
<FileUploaderSkeleton />

View file

@ -1,19 +1,36 @@
<script>
import { FluidForm, FormGroup, TextInput, PasswordInput, Button,} from "carbon-components-svelte";
import {
FluidForm,
TextInput,
PasswordInput,
} from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Fluid form
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
Create a fluid-width form layout using the `FluidForm` component. This example
shows a basic login form with required fields.
<FluidForm>
<TextInput
labelText="User name"
placeholder="Enter user name..."
required />
<TextInput labelText="User name" placeholder="Enter user name..." required />
<PasswordInput
required
type="password"
labelText="Password"
placeholder="Enter password..."
/>
</FluidForm>
</FluidForm>
## 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" />

View file

@ -14,7 +14,14 @@ components: ["Form", "FormGroup"]
import Preview from "../../components/Preview.svelte";
</script>
### Form
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
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>
<FormGroup legendText="Checkboxes">
@ -46,7 +53,7 @@ components: ["Form", "FormGroup"]
</RadioButtonGroup>
</FormGroup>
<FormGroup>
<Select id="select-1" labelText="Select menu" value="placeholder-item">
<Select id="select-1" labelText="Select menu">
<SelectItem
disabled
hidden
@ -60,3 +67,17 @@ components: ["Form", "FormGroup"]
</FormGroup>
<Button type="submit">Submit</Button>
</Form>
## Prevent default 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 => {
e.preventDefault();
console.log("submit", e);
}}>
<Checkbox id="checkbox-0" labelText="Checkbox Label" checked />
<Button type="submit">Submit</Button>
</Form>

View file

@ -6,34 +6,62 @@ components: ["Grid", "Row", "Column"]
import Preview from "../../components/Preview.svelte";
</script>
### Default
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
Create a basic grid layout with equal-width columns. This example demonstrates the
default grid behavior.
<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" />
### Narrow
## Narrow
Create a more compact grid layout using the narrow variant. This reduces the
spacing between columns.
<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" />
### 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" />
### 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" />
### 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" />
### Padded columns
## Padded columns
Add padding to columns using the padded variant. This creates more breathing room
between content.
<FileSource src="/framed/Grid/PaddedGrid" />

View file

@ -1,28 +0,0 @@
<script>
import { Icon, InlineNotification, OutboundLink } from "carbon-components-svelte";
import Add16 from "carbon-icons-svelte/lib/Add16";
import Add20 from "carbon-icons-svelte/lib/Add20";
import Add24 from "carbon-icons-svelte/lib/Add24";
import Add32 from "carbon-icons-svelte/lib/Add32";
import Preview from "../../components/Preview.svelte";
</script>
<InlineNotification svx-ignore title="Deprecation warning" kind="warning" hideCloseButton>
<div>
This component will be removed in the next major release. Use icons from <OutboundLink href="https://github.com/IBM/carbon-icons-svelte">carbon-icons-svelte</OutboundLink> instead.
</div>
</InlineNotification>
### Default
<Icon render={Add16} />
<Icon render={Add20} />
<Icon render={Add24} />
<Icon render={Add32} />
### Skeleton
<Icon skeleton render={Add16} />
<Icon skeleton size={20} render={Add20} />
<Icon skeleton size={24} render={Add24} />
<Icon skeleton size={32} render={Add32} />

View file

@ -5,42 +5,60 @@
let key = 0;
</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.
### Default
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
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" />
### 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">
<div slot="loading">
<svelte:fragment slot="loading">
<InlineLoading />
</div>
<div slot="error">
</svelte:fragment>
<svelte:fragment slot="error">
An error occurred.
</div>
</svelte:fragment>
</ImageLoader>
### 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"`, `"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" />
### 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>
{#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,23 +1,44 @@
---
components: ["InlineLoading"]
---
<script>
import { InlineLoading } from "carbon-components-svelte";
import { InlineLoading, UnorderedList, ListItem } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default
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
Display a basic loading indicator with the default configuration.
<InlineLoading />
### With description
## With description
Add a descriptive text to provide context about the loading operation.
<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="inactive" description="Cancelling..." />
<InlineLoading status="finished" description="Success" />
<InlineLoading status="error" description="An error occurred" />
### UX example
## UX example
See how to integrate the loading indicator in a real-world scenario.
<FileSource src="/framed/InlineLoading/InlineLoadingUx" />

View file

@ -1,5 +1,5 @@
---
source: Notification/InlineNotification.svelte
components: ["InlineNotification", "NotificationActionButton"]
---
<script>
@ -7,23 +7,65 @@ source: Notification/InlineNotification.svelte
import Preview from "../../components/Preview.svelte";
</script>
### Default (error)
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 usage](https://carbondesignsystem.com/components/notification/usage).
See also: [ToastNotification](ToastNotification)
## Default
Display a basic error notification with title and subtitle by default.
<InlineNotification title="Error:" subtitle="An internal server error occurred." />
### Hidden close button
## Prevent default close behavior
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) => {
e.preventDefault();
// custom close logic (e.g., transitions)
}} />
## Slottable title and subtitle
Customize the notification content using slots for more flexibility.
<InlineNotification>
<strong slot="title">Error: </strong>
<strong slot="subtitle">An internal server error occurred.</strong>
</InlineNotification>
## Accessible icon descriptions
Make notifications more accessible by providing custom descriptions for icons.
<InlineNotification
title="错误"
subtitle="发生内部服务器错误"
statusIconDescription="错误图标"
closeButtonDescription="关闭通知"
/>
## 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." />
### 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.">
<div slot="actions">
<svelte:fragment slot="actions">
<NotificationActionButton>Learn more</NotificationActionButton>
</div>
</svelte:fragment>
</InlineNotification>
### Notification variants
## Notification variants
The component supports different notification types:
<InlineNotification kind="error" title="Error:" subtitle="An internal server error occurred." />
<InlineNotification kind="info" title="New updates:" subtitle="Restart to get the latest updates." />
@ -32,7 +74,9 @@ source: Notification/InlineNotification.svelte
<InlineNotification kind="warning" title="Scheduled maintenance:" subtitle="Maintenance will last 2-4 hours." />
<InlineNotification kind="warning-alt" title="Scheduled maintenance:" subtitle="Maintenance will last 2-4 hours." />
### 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="info" title="New updates:" subtitle="Restart to get the latest updates." />

View file

@ -4,56 +4,86 @@ components: ["Link", "OutboundLink"]
<script>
import { Link, OutboundLink } from "carbon-components-svelte";
import Carbon16 from "carbon-icons-svelte/lib/Carbon16"
import Carbon from "carbon-icons-svelte/lib/Carbon.svelte"
import Preview from "../../components/Preview.svelte";
</script>
### Default
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.
<Link href="https://www.carbondesignsystem.com/">Carbon Design System</Link>
## Default
### Target _blank
Create a basic link with the default styling.
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/).
<Link href="https://www.carbondesignsystem.com/">
Carbon Design System
</Link>
You can override the `rel` attribute with a custom value.
## Target _blank
<Link href="https://www.carbondesignsystem.com/" target="_blank">Carbon Design System</Link>
For external links, the component automatically adds security attributes. You can override the `rel` attribute if needed.
### Outbound link
<Link href="https://www.carbondesignsystem.com/" target="_blank">
Carbon Design System
</Link>
An alternative to manually setting `target` to `"_blank"` is to use the `OutboundLink`.
## Outbound link
<OutboundLink href="https://www.carbondesignsystem.com/">Carbon Design System</OutboundLink>
Use `OutboundLink` as a convenient alternative for external links.
### Inline variant
<OutboundLink href="https://www.carbondesignsystem.com/">
Carbon Design System
</OutboundLink>
## Inline variant
Create links that flow naturally with surrounding text.
<div>
Visit the
<Link inline href="https://www.carbondesignsystem.com/">Carbon Design System</Link>.
<Link inline href="https://www.carbondesignsystem.com/">
Carbon Design System
</Link>.
</div>
### 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>
Visit the
<Link href="https://www.carbondesignsystem.com/" icon={Carbon16}>Carbon Design System</Link>.
<Link href="https://www.carbondesignsystem.com/" icon={Carbon}>
Carbon Design System
</Link>.
</div>
### Large size
## Size variants
<Link size="lg" href="https://www.carbondesignsystem.com/">Carbon Design System</Link>
The component supports different sizes to match your design needs:
### Small size
<Link size="lg" href="https://www.carbondesignsystem.com/">
Large link
</Link>
<br />
<Link href="https://www.carbondesignsystem.com/">
Default link
</Link>
<br />
<Link size="sm" href="https://www.carbondesignsystem.com/">
Small link
</Link>
<Link size="sm" href="https://www.carbondesignsystem.com/">Carbon Design System</Link>
## Disabled state
### Disabled
Disabled links render as plain text while maintaining accessibility.
<Link disabled href="https://www.carbondesignsystem.com/">Carbon Design System</Link>
<Link disabled href="https://www.carbondesignsystem.com/">
Disabled link
</Link>
### Visited styles
## Visited styles
<Link visited href="https://www.carbondesignsystem.com/">Carbon Design System</Link>
Show visited state styling for links.
<Link visited href="https://www.carbondesignsystem.com/">
Visited link
</Link>

View file

@ -1,16 +1,28 @@
---
components: ["Loading"]
---
<script>
import { Loading } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</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" />
### No overlay
## No overlay
Show a loading indicator without the overlay, allowing interaction with the underlying content.
<Loading withOverlay={false} />
### Small size
## Small size
Display a more compact loading indicator.
<Loading withOverlay={false} small />

View file

@ -1,9 +1,26 @@
---
components: ["LocalStorage"]
---
<script>
import Preview from "../../components/Preview.svelte";
</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.
### Reactive example
<FileSource src="/framed/LocalStorage/LocalStorage" />
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
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" />
## Clear item, clear all
The component provides methods to manage stored data:
- `clearItem`: Remove a specific key-value pair
- `clearAll`: Remove all stored data
Use `bind:this` to access these methods. In this example, try toggling the switch, refreshing the page, then clearing the storage.
<FileSource src="/framed/LocalStorage/LocalStorageClear" />

View file

@ -2,33 +2,78 @@
import Preview from "../../components/Preview.svelte";
</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" />
### Danger modal
## Custom focus
Control which element receives focus when the modal opens. Use `selectorPrimaryFocus` to specify the target element using CSS selectors.
<FileSource src="/framed/Modal/ModalCustomFocus" />
## 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" />
### 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" />
### Extra-small size
## Has scrolling content
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" />
## Multiple modals
Stack multiple modals for complex workflows. Each modal maintains its own state and focus management.
<FileSource src="/framed/Modal/ModalMultiple" />
## Multiple secondary buttons
Add up to two secondary actions using the `secondaryButtons` prop. This provides more flexibility than the single `secondaryButtonText` option.
<FileSource src="/framed/Modal/3ButtonModal" />
## 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" />
### 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" />
### 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" />
### 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" />
## 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" />

View file

@ -1,11 +1,17 @@
<script>
import { MultiSelect } from "carbon-components-svelte";
import { MultiSelect, InlineNotification } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default
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.
By default, items will be ordered alphabetically based on the `item.text` value. To prevent this, see [#no-alphabetical-ordering](#no-alphabetical-ordering).
<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>
</InlineNotification>
## Default
Create a basic multi-select dropdown with three contact methods. By default, items are ordered alphabetically.
<MultiSelect titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"},
@ -13,44 +19,9 @@ By default, items will be ordered alphabetically based on the `item.text` value.
{id: "2", text: "Fax"}]}"
/>
### No alphabetical ordering
## Format item display text
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
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 => {
return item.text + ' (' + item.id +')'
@ -61,9 +32,83 @@ Use the `itemToString` prop to format the display of individual items.
sortItem="{() => {}}"
/>
### Top direction
## Custom slot
Set `direction` to `"top"` for the dropdown menu to appear above the input.
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
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..."
items="{[{id: "0", text: "Slack"},
@ -71,7 +116,19 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
{id: "2", text: "Fax"}]}"
/>
### Light variant
## 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
items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}"
/>
## 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..."
items="{[{id: "0", text: "Slack"},
@ -79,7 +136,9 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
{id: "2", text: "Fax"}]}"
/>
### 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..."
items="{[{id: "0", text: "Slack"},
@ -87,7 +146,9 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
{id: "2", text: "Fax"}]}"
/>
### 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..."
items="{[{id: "0", text: "Slack"},
@ -95,7 +156,9 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
{id: "2", text: "Fax"}]}"
/>
### 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..."
items="{[{id: "0", text: "Slack"},
@ -103,9 +166,9 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
{id: "2", text: "Fax"}]}"
/>
## 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..."
items="{[{id: "0", text: "Slack"},
@ -113,7 +176,9 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
{id: "2", text: "Fax"}]}"
/>
### 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..."
items="{[{id: "0", text: "Slack"},
@ -121,10 +186,26 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
{id: "2", text: "Fax"}]}"
/>
### 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..."
items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}"
/>
/>
## Disabled items
Disable specific items using the `disabled` property in the `items` prop. This example disables the Email option.
<MultiSelect
titleText="Contact"
label="Select contact methods..."
items={[
{ id: "0", text: "Slack" },
{ id: "1", text: "Email", disabled: true },
{ id: "2", text: "Fax" },
]}
/>

View file

@ -7,54 +7,100 @@ components: ["NumberInput", "NumberInputSkeleton"]
import Preview from "../../components/Preview.svelte";
</script>
### Default
The `NumberInput` component provides a controlled input for numerical values. It supports validation, step values, and various states to ensure accurate data entry.
<NumberInput label="Clusters" />
## Default
### With helper text
Create a basic number input with increment and decrement controls. The input accepts numerical values and provides visual feedback.
<NumberInput label="Clusters" helperText="Clusters provisioned in your region" />
<NumberInput label="Clusters" value={0} />
### Minimum and maximum values
## 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" />
## 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)" />
### Hidden label
## Step value
<NumberInput hideLabel label="Clusters" />
Control the increment/decrement step size using the `step` prop. This example uses a step of 0.1.
### Hidden steppers
<NumberInput value="{1}" helperText="Step of 0.1" step={0.1} label="Clusters" />
<NumberInput hideSteppers label="Clusters" />
## Hidden label
### Light variant
Hide the label visually while maintaining accessibility by setting `hideLabel` to `true`. The label is still available to screen readers.
<NumberInput light label="Clusters" />
<NumberInput hideLabel label="Clusters" value={0} />
### Extra-large size
## Extra-large size
<NumberInput size="xl" label="Clusters" />
Use the extra-large size for prominent inputs by setting `size` to `"xl"`. This provides more visual emphasis.
### Small size
<NumberInput size="xl" label="Clusters" value={0} />
<NumberInput size="sm" label="Clusters" />
## Small size
### Invalid state
Use the small size for compact layouts by setting `size` to `"sm"`. This is ideal for secondary inputs.
<NumberInput invalid invalidText="Invalid value" label="Clusters" />
<NumberInput size="sm" label="Clusters" value={0} />
### Warning state
## Light variant
<NumberInput warn warnText="A high number may impact initial rollout" label="Clusters" value="25" />
Use the light variant for dark backgrounds by setting `light` to `true`. This provides better contrast in dark themes.
### Disabled state
<NumberInput light label="Clusters" value={0} />
<NumberInput disabled label="Clusters" />
## Invalid state
### Skeleton
Indicate an invalid value by setting `invalid` to `true`. This example shows a validation error.
<NumberInput invalid invalidText="Invalid value" label="Clusters" value={0} />
## 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} />
## Disabled state
Disable the input by setting `disabled` to `true`. This prevents all user interaction.
<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
Show a loading state using the `NumberInputSkeleton` component. This is useful while data is being fetched.
<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 />

View file

@ -3,11 +3,21 @@ components: ["OrderedList", "ListItem"]
---
<script>
import { OrderedList, ListItem, Link } from "carbon-components-svelte";
import { InlineNotification, OrderedList, ListItem, Link } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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>
<div class="body-short-01">
Consider using the <Link href="/components/RecursiveList#ordered">RecursiveList</Link> component for rendering tree structured data.
</div>
</InlineNotification>
## Default
Create a basic ordered list by wrapping `ListItem` components within `OrderedList`.
<OrderedList>
<ListItem>Ordered list item</ListItem>
@ -15,7 +25,9 @@ components: ["OrderedList", "ListItem"]
<ListItem>Ordered list item</ListItem>
</OrderedList>
### With links
## With links
Add interactive elements like `Link` components within list items.
<OrderedList>
<ListItem>
@ -29,7 +41,9 @@ components: ["OrderedList", "ListItem"]
</ListItem>
</OrderedList>
### Nested
## Nested
Set the `nested` prop to `true` to create hierarchical lists with proper indentation and numbering.
<OrderedList>
<ListItem>
@ -49,9 +63,9 @@ components: ["OrderedList", "ListItem"]
<ListItem>Ordered list level 1</ListItem>
</OrderedList>
### 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>
<ListItem>
@ -71,9 +85,9 @@ Use the `native` attribute to enable default browser list styles. This is useful
<ListItem>Ordered list level 1</ListItem>
</OrderedList>
### 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>
<ListItem><Link size="lg" href="#">Ordered list item</Link></ListItem>

View file

@ -4,11 +4,15 @@ components: ["OverflowMenu", "OverflowMenuItem"]
<script>
import { OverflowMenu, OverflowMenuItem } from "carbon-components-svelte";
import Add16 from "carbon-icons-svelte/lib/Add16";
import Add from "carbon-icons-svelte/lib/Add.svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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
Create a basic overflow menu by wrapping `OverflowMenuItem` components within `OverflowMenu`.
<OverflowMenu>
<OverflowMenuItem text="Manage credentials" />
@ -16,15 +20,19 @@ components: ["OverflowMenu", "OverflowMenuItem"]
<OverflowMenuItem danger text="Delete service" />
</OverflowMenu>
### Flipped
## Flipped
<OverflowMenu open flipped>
Set `flipped` to `true` to position the menu to the left of the button.
<OverflowMenu flipped>
<OverflowMenuItem text="Manage credentials" />
<OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" />
<OverflowMenuItem danger text="Delete service" />
</OverflowMenu>
### Menu direction top
## Menu direction
Set `direction` to `"top"` to position the menu above the button.
<OverflowMenu flipped direction="top">
<OverflowMenuItem text="Manage credentials" />
@ -32,7 +40,9 @@ components: ["OverflowMenu", "OverflowMenuItem"]
<OverflowMenuItem danger text="Delete service" />
</OverflowMenu>
### Light variant
## Light variant
Enable the light variant by setting `light` to `true`.
<OverflowMenu light>
<OverflowMenuItem text="Manage credentials" />
@ -40,7 +50,9 @@ components: ["OverflowMenu", "OverflowMenuItem"]
<OverflowMenuItem danger text="Delete service" />
</OverflowMenu>
### Extra-large size
## Extra-large size
Set `size` to `"xl"` for an extra-large overflow menu.
<OverflowMenu size="xl">
<OverflowMenuItem text="Manage credentials" />
@ -48,7 +60,9 @@ components: ["OverflowMenu", "OverflowMenuItem"]
<OverflowMenuItem danger text="Delete service" />
</OverflowMenu>
### Small size
## Small size
Set `size` to `"sm"` for a small overflow menu.
<OverflowMenu size="sm">
<OverflowMenuItem text="Manage credentials" />
@ -56,9 +70,9 @@ components: ["OverflowMenu", "OverflowMenuItem"]
<OverflowMenuItem danger text="Delete service" />
</OverflowMenu>
### 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>
<OverflowMenuItem text="Manage credentials" />
@ -66,19 +80,40 @@ By default, the first overflow menu item is focused when opening the dropdown.
<OverflowMenuItem primaryFocus danger text="Delete service" />
</OverflowMenu>
### Custom trigger icon
## Custom trigger icon
<OverflowMenu icon={Add16}>
Replace the default vertical overflow menu icon with a custom icon.
<OverflowMenu icon={Add}>
<OverflowMenuItem text="Manage credentials" />
<OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" />
<OverflowMenuItem danger text="Delete service" />
</OverflowMenu>
### Custom trigger slot
## Custom trigger slot
Use the `menu` slot to customize the trigger button content.
<OverflowMenu style="width: auto;">
<div slot="menu" style="padding: 1rem; color: red;">Custom trigger</div>
<OverflowMenuItem text="Manage credentials" />
<OverflowMenuItem href="https://cloud.ibm.com/docs/api-gateway/" text="API documentation" />
<OverflowMenuItem danger text="Delete service" />
</OverflowMenu>
## Disabled items
Set `disabled` to `true` to disable menu items. Use `hasDivider` to add visual separation between items.
<OverflowMenu>
<OverflowMenuItem text="Create key" />
<OverflowMenuItem text="Import key" />
<OverflowMenuItem text="Revoke key" disabled />
<OverflowMenuItem text="Duplicate key" disabled />
<OverflowMenuItem
hasDivider
href="https://cloud.ibm.com/docs/api-gateway/"
text="API documentation"
/>
<OverflowMenuItem hasDivider danger text="Delete service" />
</OverflowMenu>

View file

@ -7,26 +7,52 @@ components: ["Pagination", "PaginationSkeleton"]
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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.
<Pagination totalItems={102} pageSizes="{[10, 15, 20]}" />
## Default
### Current page
Create a basic pagination component with default page size options.
<Pagination totalItems={102} pageSizes={[10, 15, 20]} />
## Current page
Set the current page using the `page` prop.
<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.
### Hidden page input
<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
Disable the page input by setting `pageInputDisabled` to `true`.
<Pagination totalItems={102} pageInputDisabled />
### Hidden page size
## Hidden page size
Disable the page size selector by setting `pageSizeInputDisabled` to `true`.
<Pagination totalItems={102} pageSizeInputDisabled />
### Skeleton
## Skeleton
Use `PaginationSkeleton` to show a loading state.
<PaginationSkeleton />

View file

@ -3,10 +3,49 @@
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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
Create a basic pagination navigation with default settings.
<PaginationNav />
### Loopable
## Reactive example
Use the `page` prop to bind to the current page number.
<FileSource src="/framed/PaginationNav/PaginationNavReactive" />
## Total pages
Specify the total number of pages using the `total` prop.
<PaginationNav total={3} />
## Loop navigation
Set `loop` to `true` to enable circular navigation between pages.
<PaginationNav total={3} loop />
## Visible pages
Control the number of visible page numbers with the `shown` prop.
<PaginationNav total={100} shown={5} />
## Custom button text
Customize the navigation button text using `forwardText` and `backwardText`.
<PaginationNav
forwardText="Next"
backwardText="Previous"
/>
## Tooltip position
Set the tooltip position relative to the navigation buttons using `tooltipPosition`.
<PaginationNav tooltipPosition="outside" total={3} loop />

View file

@ -3,50 +3,76 @@
import Preview from "../../components/Preview.svelte";
</script>
### Default
`PasswordInput` provides a secure text input field with a visibility toggle for password entry. It includes features for validation, warnings, and accessibility.
## Default
Create a basic password input with a label and placeholder.
<PasswordInput labelText="Password" placeholder="Enter password..." />
### Custom tooltip alignment
## Custom tooltip alignment
Customize the tooltip alignment and position of the visibility toggle through the `tooltipAlignment` and `tooltipPosition` props.
<PasswordInput tooltipAlignment="start" tooltipPosition="left" labelText="Password" placeholder="Enter password..." />
### Password is visible
## Password is visible
Set prop `type` to `"text"` to toggle password visibility.
<PasswordInput labelText="Password" type="text" placeholder="Enter password..." value="as_lta0890sdfpo__!9901" />
### Hidden label
## Hidden label
Visually hide the label while maintaining accessibility.
<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..." />
### Inline
## Inline
Display the input with an inline label layout.
<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..." />
### Small size
## Small size
Use the small size variant for compact layouts.
<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..." />
### Warning state
## Warning state
Show a warning message for non-critical issues.
<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..." />
## 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..." />

View file

@ -3,9 +3,11 @@
import Preview from "../../components/Preview.svelte";
</script>
### Default
`Popover` provides a floating container that displays content relative to a trigger element. It supports various alignments, caret indicators, and visual variants.
By default, the position of the popover component is absolute.
## Default
Create a basic popover with absolute positioning.
<div data-outline>
Parent
@ -14,9 +16,9 @@ By default, the position of the popover component is absolute.
</Popover>
</div>
### 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>
Parent
@ -25,9 +27,9 @@ Set `relative` to `true` to use a relative position.
</Popover>
</div>
### 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>
Parent
@ -36,7 +38,7 @@ Set `closeOnOutsideClick` to set `open` to `false` when clicking outside of the
</Popover>
</div>
### Popover alignment
## Popover alignment
Customize the popover alignment using the `align` prop. Valid values include: `"top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right" | "left" | "left-bottom" | "left-top" | "right" | "right-bottom" | "right-top"`.
@ -109,7 +111,9 @@ The default `align` value is `"top"`.
</Popover>
</div>
### With caret
## With caret
Add a caret indicator to the popover using the `caret` prop.
<div data-outline>
Parent
@ -118,11 +122,9 @@ The default `align` value is `"top"`.
</Popover>
</div>
### Custom caret alignment
## Custom caret alignment
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"`.
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"`.
<div data-outline>
Parent
@ -131,7 +133,9 @@ Possible `align` values include `"top"`, `"top-left"`, `"top-right"`, `"bottom"`
</Popover>
</div>
### Light variant
## Light variant
Enable the light variant for use on dark backgrounds.
<div data-outline>
Parent
@ -140,11 +144,19 @@ Possible `align` values include `"top"`, `"top-left"`, `"top-right"`, `"bottom"`
</Popover>
</div>
### High contrast variant
## High contrast variant
Enable the high contrast variant for improved visibility.
<div data-outline>
Parent
<Popover highContrast open>
<div style="padding: var(--cds-spacing-05)">Content</div>
</Popover>
</div>
</div>
## External element
Use the `open` prop to manage state with an external element, like a button.
<FileSource src="/framed/Popover/WithButton" />

View file

@ -3,22 +3,70 @@
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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.
Without a specified `value` prop, the progress bar is indeterminate.
## Default
Create an indeterminate progress bar that continuously animates.
<ProgressBar helperText="Loading..." />
### Percentage
## Small size
Use the small size variant for compact layouts.
<ProgressBar size="sm" helperText="Loading..." />
## Percentage
Display progress as a percentage using the `value` prop.
<ProgressBar value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
### Custom max value
## Finished status
The default `max` value is `100`.
Show completion status with a checkmark icon.
<ProgressBar value={100} status="finished" labelText="Upload file" helperText="Upload complete" />
## Error status
Indicate errors with an error icon and red styling.
<ProgressBar value={0} status="error" labelText="Upload file" helperText="Invalid file format" />
## Custom max value
Set a custom maximum value for the progress bar.
<ProgressBar value={40} max={200} labelText="Upload status" helperText="40 MB of 200 MB" />
### Hidden label
## Hidden label
<ProgressBar hideLabel value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
Visually hide the label while maintaining accessibility.
<ProgressBar hideLabel value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
## Inline variant
Use the inline variant to display progress without helper text.
<ProgressBar kind="inline" value={40} labelText="Upload status" helperText="40 MB of 100 MB" />
## 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" />
## Indented status variant
Combine the indented variant with status indicators.
<ProgressBar kind="indented" status="finished" value={40} labelText="Upload file" helperText="Upload complete" />
## UX example
Demonstrate a complete upload flow with start and end states.
<FileSource src="/framed/ProgressBar/ProgressBarUx" />

View file

@ -7,7 +7,11 @@ components: ["ProgressIndicator", "ProgressStep", "ProgressIndicatorSkeleton"]
import Preview from "../../components/Preview.svelte";
</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}>
<ProgressStep complete
@ -28,11 +32,9 @@ components: ["ProgressIndicator", "ProgressStep", "ProgressIndicatorSkeleton"]
/>
</ProgressIndicator>
### Prevent change on click
## Prevent change on click
By default, clicking any step that is complete will update the current step index.
Set `preventChangeOnClick` to `true` to prevent this behavior.
Disable automatic step selection when clicking completed steps.
<ProgressIndicator preventChangeOnClick currentIndex={2}>
<ProgressStep complete
@ -53,13 +55,15 @@ Set `preventChangeOnClick` to `true` to prevent this behavior.
/>
</ProgressIndicator>
### 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" />
### Invalid step
## Invalid step
Mark a step as invalid to indicate an error state.
<ProgressIndicator>
<ProgressStep complete
@ -76,7 +80,9 @@ When programmatically updating the `currentIndex`, keep in mind that only comple
/>
</ProgressIndicator>
### Disabled steps
## Disabled steps
Disable specific steps to prevent user interaction.
<ProgressIndicator>
<ProgressStep complete
@ -93,7 +99,9 @@ When programmatically updating the `currentIndex`, keep in mind that only comple
/>
</ProgressIndicator>
### Spaced-equally
## Spaced-equally
Distribute steps evenly across the available space.
<ProgressIndicator spaceEqually>
<ProgressStep
@ -110,7 +118,9 @@ When programmatically updating the `currentIndex`, keep in mind that only comple
/>
</ProgressIndicator>
### Vertical
## Vertical
Display steps in a vertical layout.
<ProgressIndicator vertical>
<ProgressStep
@ -127,12 +137,14 @@ When programmatically updating the `currentIndex`, keep in mind that only comple
/>
</ProgressIndicator>
### 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 />
### Skeleton (vertical)
## Skeleton (vertical)
Show a vertical loading state with the specified number of steps.
<ProgressIndicatorSkeleton vertical />

View file

@ -7,31 +7,37 @@ components: ["RadioButtonGroup", "RadioButton", "RadioButtonSkeleton"]
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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.
<RadioButtonGroup selected="standard">
## Default
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="Standard (10 GB)" value="standard" />
<RadioButton labelText="Pro (128 GB)" value="pro" />
</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="Standard (10 GB)" value="standard" />
<RadioButton labelText="Pro (128 GB)" value="pro" />
</RadioButtonGroup>
### 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">
<div slot="legendText" style="display: flex">
<RadioButtonGroup name="plan-legend-slot" selected="standard">
<div slot="legendText" style:display="flex">
Storage tier (disk)
<Tooltip tooltipBodyId="tooltip-body">
<p id="tooltip-body">
<Tooltip>
<p>
Storage tiers may vary based on geolocation.
</p>
</Tooltip>
@ -41,37 +47,45 @@ Use the named "legendText" slot to customize the legend text.
<RadioButton labelText="Pro (128 GB)" value="pro" />
</RadioButtonGroup>
### Programmatic usage
## Reactive example
Bind the selected value using the `selected` prop.
Bind and update the selected value programmatically.
<FileSource src="/framed/RadioButton/ProgrammaticRadioButton" />
<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="Standard (10 GB)" value="standard" />
<RadioButton labelText="Pro (128 GB)" value="pro" />
</RadioButtonGroup>
### 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 labelText="Standard (10 GB)" value="standard" />
<RadioButton disabled labelText="Pro (128 GB)" value="pro" />
</RadioButtonGroup>
### 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="Standard (10 GB)" value="standard" />
<RadioButton labelText="Pro (128 GB)" value="pro" />
</RadioButtonGroup>
### Skeleton
## Skeleton
Show a loading state for horizontal radio buttons.
<RadioButtonGroup legendText="Storage tier (disk)">
<RadioButtonSkeleton />
@ -79,7 +93,9 @@ Bind the selected value using the `selected` prop.
<RadioButtonSkeleton />
</RadioButtonGroup>
### Skeleton (vertical)
## Skeleton (vertical)
Show a loading state for vertical radio buttons.
<RadioButtonGroup orientation="vertical" legendText="Storage tier (disk)">
<RadioButtonSkeleton />

View file

@ -7,44 +7,64 @@ components: ["TileGroup", "RadioTile"]
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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.
<TileGroup legend="Service pricing tiers">
<RadioTile value="0" checked>
## Default
Create a group of radio tiles with a shared name and legend.
<TileGroup legend="Service pricing tiers" name="plan" selected="standard">
<RadioTile value="lite">
Lite plan
</RadioTile>
<RadioTile value="1">
<RadioTile value="standard">
Standard plan
</RadioTile>
<RadioTile value="2">
<RadioTile value="plus">
Plus plan
</RadioTile>
</TileGroup>
### Light variant
## Reactive (one-way binding)
<TileGroup legend="Service pricing tiers">
<RadioTile light value="0" checked>
Update the selected value using the `select` event.
<FileSource src="/framed/RadioTile/RadioTileReactiveOneWay" />
## Reactive (two-way binding)
Bind to the `selected` prop for simpler state management.
<FileSource src="/framed/RadioTile/RadioTileReactive" />
## Light variant
Use the light variant for light backgrounds.
<TileGroup legend="Service pricing tiers" name="plan-light" selected="standard">
<RadioTile light value="lite">
Lite plan
</RadioTile>
<RadioTile light value="1">
<RadioTile light value="standard">
Standard plan
</RadioTile>
<RadioTile light value="2">
<RadioTile light value="plus">
Plus plan
</RadioTile>
</TileGroup>
### Disabled state
## Disabled state
<TileGroup legend="Service pricing tiers">
<RadioTile value="0" checked>
Disable specific tiles to prevent selection.
<TileGroup legend="Service pricing tiers" name="plan-disabled" selected="standard">
<RadioTile value="lite" disabled>
Lite plan
</RadioTile>
<RadioTile value="1" disabled>
<RadioTile value="standard">
Standard plan
</RadioTile>
<RadioTile value="2" disabled>
<RadioTile value="plus" disabled>
Plus plan
</RadioTile>
</TileGroup>

View file

@ -0,0 +1,42 @@
<script>
import { InlineNotification, RecursiveList, Link } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
`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.
<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>
<div class="body-short-01">
HTML content provided via the <code>html</code> prop is not sanitized.
</div>
</InlineNotification>
## Default
Create a hierarchical list using the `nodes` prop. Each node can contain text, links, HTML content, and nested nodes.
<FileSource src="/framed/RecursiveList/RecursiveList" />
## Ordered
Set `type` to `"ordered"` to use numbered lists with proper indentation.
<FileSource src="/framed/RecursiveList/RecursiveListOrdered" />
## Ordered (native styles)
Set `type` to `"ordered-native"` to use browser-native numbering styles.
<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

@ -1,61 +1,81 @@
<script>
import Query16 from "carbon-icons-svelte/lib/Query16";
import Query from "carbon-icons-svelte/lib/Query.svelte";
import { Search } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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.
The `Search` component size is extra-large by default. There are [large](#large-size) and [small](#small-size) size variants.
## Default
The search component is extra-large by default. Use the `size` prop to choose between [large](#large-size) and [small](#small-size) variants.
<Search />
### Default value
## Default value
Set an initial value using the `value` prop.
<Search placeholder="Search catalog..." value="Cloud functions" />
### Reactive example
## Reactive example
Bind to the `value` prop for reactive updates.
<FileSource src="/framed/Search/SearchReactive" />
### on:clear
## Clear event
The "clear" event is dispatched when clicking the "X" button in the search input element.
The `clear` event is dispatched when clicking the clear button or pressing the Escape key.
<Search value="Cloud functions" on:clear={() => console.log('clear')}/>
### Expandable variant
## Expandable variant
<Search expandable on:expand on:collapse />
Enable the expandable variant to show a compact search icon that expands on focus.
### Light variant
<FileSource src="/framed/Search/SearchExpandableReactive" />
## Light variant
Use the light variant for light backgrounds.
<Search light />
### Large size
## Large size
Set `size` to `"lg"` for a large search input.
<Search size="lg" />
### Small size
## Small size
Set `size` to `"sm"` for a small search input.
<Search size="sm" />
### Disabled state
## Disabled state
Disable the search input using the `disabled` prop.
<Search disabled />
### Custom search icon
## Custom icon
<Search icon={Query16} />
Replace the default search icon with a custom one.
### Skeleton
<Search icon={Query} />
## Skeleton
Display a loading state using the skeleton variant.
<Search skeleton />
### Skeleton (large)
## Skeleton (large)
<Search size="lg" skeleton />
### Skeleton (small)
## Skeleton (small)
<Search size="sm" skeleton />

View file

@ -7,9 +7,25 @@ components: ["Select", "SelectItem", "SelectItemGroup", "SelectSkeleton"]
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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.
<Select labelText="Carbon theme" selected="g10" >
## Default
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)}>
<SelectItem value="white" />
<SelectItem value="g10" />
<SelectItem value="g80" />
<SelectItem value="g90" />
<SelectItem value="g100" />
</Select>
## Custom item text
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)}>
<SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" />
<SelectItem value="g80" text="Gray 80" />
@ -17,7 +33,27 @@ components: ["Select", "SelectItem", "SelectItemGroup", "SelectSkeleton"]
<SelectItem value="g100" text="Gray 100" />
</Select>
### Helper text
## Initial selected value
Set the initial selection using the `selected` prop.
<Select labelText="Carbon theme" selected="g10" on:change={e => console.log("value", e.target.value)}>
<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>
## Reactive example
The `selected` prop supports two-way binding for reactive updates.
<FileSource src="/framed/Select/SelectReactive" />
## Helper text
Add descriptive text below the select menu.
<Select helperText="Carbon offers 4 themes (2 light, 3 dark)" labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" />
@ -27,7 +63,9 @@ components: ["Select", "SelectItem", "SelectItemGroup", "SelectSkeleton"]
<SelectItem value="g100" text="Gray 100" />
</Select>
### Hidden label
## Hidden label
Visually hide the label while maintaining accessibility.
<Select hideLabel labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" />
@ -37,7 +75,9 @@ components: ["Select", "SelectItem", "SelectItemGroup", "SelectSkeleton"]
<SelectItem value="g100" text="Gray 100" />
</Select>
### Item groups
## Item groups
Group related options using `SelectItemGroup` components.
<Select labelText="Carbon theme" selected="0">
<SelectItem value="0" text="Select a theme" disabled hidden />
@ -52,37 +92,9 @@ components: ["Select", "SelectItem", "SelectItemGroup", "SelectSkeleton"]
</SelectItemGroup>
</Select>
### Light variant
## Small size
<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
Use the small size variant for compact layouts.
<Select size="sm" labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" />
@ -92,7 +104,45 @@ components: ["Select", "SelectItem", "SelectItemGroup", "SelectSkeleton"]
<SelectItem value="g100" text="Gray 100" />
</Select>
### Invalid state
## 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
Show validation errors using the invalid state.
<Select invalid invalidText="Theme must be a dark variant" labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" />
@ -102,7 +152,9 @@ components: ["Select", "SelectItem", "SelectItemGroup", "SelectSkeleton"]
<SelectItem value="g100" text="Gray 100" />
</Select>
### 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" >
<SelectItem value="white" text="White" />
@ -112,7 +164,9 @@ components: ["Select", "SelectItem", "SelectItemGroup", "SelectSkeleton"]
<SelectItem value="g100" text="Gray 100" />
</Select>
### Disabled state
## Disabled state
Disable the select menu to prevent interaction.
<Select disabled labelText="Carbon theme" selected="g10" >
<SelectItem value="white" text="White" />
@ -122,10 +176,12 @@ components: ["Select", "SelectItem", "SelectItemGroup", "SelectSkeleton"]
<SelectItem value="g100" text="Gray 100" />
</Select>
### Skeleton
## Skeleton
Display a loading state using the skeleton variant.
<SelectSkeleton />
### Skeleton (hidden label)
## Skeleton (hidden label)
<SelectSkeleton hideLabel />
<SelectSkeleton hideLabel />

View file

@ -7,7 +7,11 @@ components: ["SelectableTile"]
import Preview from "../../components/Preview.svelte";
</script>
### Multi-selectable tiles
`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
Group multiple selectable tiles together for multi-selection scenarios.
<div role="group" aria-label="selectable tiles">
<SelectableTile selected>
@ -21,7 +25,9 @@ components: ["SelectableTile"]
</SelectableTile>
</div>
### Light variant
## Light variant
Use the light variant for light backgrounds.
<div role="group" aria-label="selectable tiles">
<SelectableTile light selected>
@ -35,7 +41,9 @@ components: ["SelectableTile"]
</SelectableTile>
</div>
### Disabled state
## Disabled state
Disable tiles to prevent interaction.
<div role="group" aria-label="selectable tiles">
<SelectableTile selected>

View file

@ -3,10 +3,16 @@
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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
Create a basic skeleton placeholder with default styling.
<SkeletonPlaceholder />
### Custom size
## Custom size
Specify custom dimensions using the `style` prop.
<SkeletonPlaceholder style="height: 12rem; width: 12rem;" />

View file

@ -3,26 +3,34 @@
import Preview from "../../components/Preview.svelte";
</script>
### Default
`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
Create a basic skeleton text with default styling.
<SkeletonText />
### Heading variant
## Heading variant
Use the heading variant for larger text placeholders.
<SkeletonText heading />
### Heading variant
## Paragraph variant
<SkeletonText heading />
### Paragraph variant
Use the paragraph variant for multi-line text placeholders.
<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} />
### Paragraph with max width
## Paragraph with max width
Set a custom width for the text placeholder using the `width` prop.
<SkeletonText paragraph width="50%" />

View file

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

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