kanto-ds 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +15 -10
  2. package/dist/cdn/kanto.min.js +887 -234
  3. package/dist/chunks/{index-TWJzttLX.js → index-BEWmAE0T.js} +21 -7
  4. package/dist/chunks/index-BEWmAE0T.js.map +1 -0
  5. package/dist/chunks/{kt-calendar-CtwOby1R.js → kt-calendar-D72xa8qr.js} +3 -3
  6. package/dist/chunks/{kt-calendar-CtwOby1R.js.map → kt-calendar-D72xa8qr.js.map} +1 -1
  7. package/dist/chunks/{kt-element-T0VbIBNp.js → kt-element-COgh6Yr1.js} +2 -2
  8. package/dist/chunks/{kt-element-T0VbIBNp.js.map → kt-element-COgh6Yr1.js.map} +1 -1
  9. package/dist/chunks/numbers-QyecMiSJ.js +9 -0
  10. package/dist/chunks/numbers-QyecMiSJ.js.map +1 -0
  11. package/dist/chunks/{segmented-field-BBXR4XFL.js → segmented-field-BCjCGF4I.js} +2 -2
  12. package/dist/chunks/{segmented-field-BBXR4XFL.js.map → segmented-field-BCjCGF4I.js.map} +1 -1
  13. package/dist/chunks/{typed-date-CPAUNHzr.js → typed-date-Z3vcUJbb.js} +2 -2
  14. package/dist/chunks/{typed-date-CPAUNHzr.js.map → typed-date-Z3vcUJbb.js.map} +1 -1
  15. package/dist/components/core/kt-avatar/kt-avatar.js +2 -2
  16. package/dist/components/core/kt-badge/kt-badge.js +2 -2
  17. package/dist/components/core/kt-button/kt-button.js +1 -1
  18. package/dist/components/core/kt-card/kt-card.js +1 -1
  19. package/dist/components/core/kt-code/kt-code.js +2 -2
  20. package/dist/components/core/kt-icon/kt-icon.js +1 -1
  21. package/dist/components/core/kt-kbd/kt-kbd.js +1 -1
  22. package/dist/components/core/kt-split-button/kt-split-button.js +2 -2
  23. package/dist/components/data/kt-chart/kt-chart.js +2 -2
  24. package/dist/components/data/kt-meter/kt-meter.js +1 -1
  25. package/dist/components/data/kt-pagination/kt-pagination.js +2 -2
  26. package/dist/components/data/kt-stat/kt-stat.js +1 -1
  27. package/dist/components/data/kt-table/kt-table.js +2 -2
  28. package/dist/components/data/kt-timeline/kt-timeline.js +1 -1
  29. package/dist/components/feedback/kt-alert/kt-alert.js +2 -2
  30. package/dist/components/feedback/kt-empty-state/kt-empty-state.js +1 -1
  31. package/dist/components/feedback/kt-progress-bar/kt-progress-bar.js +1 -1
  32. package/dist/components/feedback/kt-skeleton/kt-skeleton.js +1 -1
  33. package/dist/components/feedback/kt-toast/kt-toast.js +2 -2
  34. package/dist/components/feedback/kt-toast-container/kt-toast-container.js +1 -1
  35. package/dist/components/feedback/kt-tooltip/kt-tooltip.js +1 -1
  36. package/dist/components/forms/kt-calendar/kt-calendar.js +3 -3
  37. package/dist/components/forms/kt-checkbox/kt-checkbox.js +2 -2
  38. package/dist/components/forms/kt-date-input/kt-date-input.js +5 -5
  39. package/dist/components/forms/kt-date-picker/kt-date-picker.js +4 -4
  40. package/dist/components/forms/kt-drag-drop/kt-drag-drop.js +2 -2
  41. package/dist/components/forms/kt-form/kt-form.js +2 -2
  42. package/dist/components/forms/kt-input/kt-input.js +2 -2
  43. package/dist/components/forms/kt-input-menu/kt-input-menu.js +2 -2
  44. package/dist/components/forms/kt-label-input/kt-label-input.js +1 -1
  45. package/dist/components/forms/kt-multi-select/kt-multi-select.js +2 -2
  46. package/dist/components/forms/kt-number-input/kt-number-input.d.ts +89 -0
  47. package/dist/components/forms/kt-number-input/kt-number-input.js +350 -0
  48. package/dist/components/forms/kt-number-input/kt-number-input.js.map +1 -0
  49. package/dist/components/forms/kt-radio-group/kt-radio-group.js +2 -2
  50. package/dist/components/forms/kt-select/kt-select.js +2 -2
  51. package/dist/components/forms/kt-slider/kt-slider.d.ts +69 -0
  52. package/dist/components/forms/kt-slider/kt-slider.js +252 -0
  53. package/dist/components/forms/kt-slider/kt-slider.js.map +1 -0
  54. package/dist/components/forms/kt-textarea/kt-textarea.js +2 -2
  55. package/dist/components/forms/kt-time-input/kt-time-input.js +3 -3
  56. package/dist/components/forms/kt-toggle/kt-toggle.js +1 -1
  57. package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js +2 -2
  58. package/dist/components/navigation/kt-header/kt-header.js +2 -2
  59. package/dist/components/navigation/kt-page-header/kt-page-header.js +1 -1
  60. package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js +2 -2
  61. package/dist/components/navigation/kt-steps/kt-steps.d.ts +65 -0
  62. package/dist/components/navigation/kt-steps/kt-steps.js +244 -0
  63. package/dist/components/navigation/kt-steps/kt-steps.js.map +1 -0
  64. package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js +2 -2
  65. package/dist/components/navigation/kt-tabs/kt-tabs.js +1 -1
  66. package/dist/components/navigation/kt-toggle-button/kt-toggle-button.js +1 -1
  67. package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js +2 -2
  68. package/dist/components/overlays/kt-collapsible/kt-collapsible.js +1 -1
  69. package/dist/components/overlays/kt-command-palette/kt-command-palette.d.ts +87 -0
  70. package/dist/components/overlays/kt-command-palette/kt-command-palette.js +370 -0
  71. package/dist/components/overlays/kt-command-palette/kt-command-palette.js.map +1 -0
  72. package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js +2 -2
  73. package/dist/components/overlays/kt-dropdown/kt-dropdown.js +2 -2
  74. package/dist/components/overlays/kt-modal/kt-modal.js +2 -2
  75. package/dist/components/overlays/kt-side-panel/kt-side-panel.js +2 -2
  76. package/dist/custom-elements.json +3279 -1754
  77. package/dist/docs/kt-command-palette.md +99 -0
  78. package/dist/docs/kt-number-input.md +77 -0
  79. package/dist/docs/kt-slider.md +76 -0
  80. package/dist/docs/kt-steps.md +79 -0
  81. package/dist/index.d.ts +6 -0
  82. package/dist/index.js +105 -97
  83. package/dist/index.js.map +1 -1
  84. package/dist/internal/command-search.d.ts +27 -0
  85. package/dist/internal/numbers.d.ts +2 -0
  86. package/dist/internal/strings.d.ts +14 -0
  87. package/dist/react/index.d.ts +31 -0
  88. package/dist/react/index.js +199 -164
  89. package/dist/react/index.js.map +1 -1
  90. package/dist/react/jsx.d.ts +27 -1
  91. package/dist/strings/index.js +1 -1
  92. package/dist/tokens/base.css +4 -0
  93. package/dist/vscode.css-custom-data.json +26 -2
  94. package/dist/vscode.html-custom-data.json +120 -12
  95. package/dist/vue/index.d.ts +8 -0
  96. package/dist/vue/index.js +12 -8
  97. package/dist/vue/index.js.map +1 -1
  98. package/dist/web-types.json +347 -39
  99. package/package.json +20 -3
  100. package/dist/chunks/index-TWJzttLX.js.map +0 -1
@@ -0,0 +1,99 @@
1
+ # `<kt-command-palette>`
2
+
3
+ The palette a product opens on Cmd+K: every action and page, a few keystrokes away.
4
+
5
+ ```html
6
+ <kt-command-palette></kt-command-palette>
7
+ ```
8
+
9
+ ```js
10
+ palette.commands = [
11
+ { id: 'new-invoice', label: 'New invoice', group: 'Create', shortcut: 'mod i' },
12
+ { id: 'new-customer', label: 'New customer', group: 'Create', keywords: ['client'] },
13
+ { id: 'settings', label: 'Open settings', group: 'Navigate', icon: 'settings' },
14
+ { id: 'export', label: 'Export as CSV', group: 'Actions', disabled: true },
15
+ ];
16
+ palette.addEventListener('kt-select', (e) => run(e.detail.id));
17
+ ```
18
+
19
+ ## Opening it
20
+
21
+ Cmd+K on a Mac, Ctrl+K elsewhere, opens and closes it from anywhere on the
22
+ page — inside a field too, as people expect. `hotkey` sets another letter;
23
+ `hotkey=""` turns the shortcut off, for a page that opens it from a button of
24
+ its own (`palette.open = true`). Each opening starts from an empty search.
25
+
26
+ ## Finding a command
27
+
28
+ Typing narrows the list. Every word typed must appear, in any order, in the
29
+ command's label, one of its `keywords` or its `group`, ignoring case and
30
+ accents — "client" finds New customer, "preferences" finds Préférences. What
31
+ remains ranks by how it matched:
32
+
33
+ 1. a label that starts with the search;
34
+ 2. a label in which each word starts a word;
35
+ 3. a label that holds the search anywhere;
36
+ 4. a match on a keyword or the group only.
37
+
38
+ Commands that tie keep the order you gave them, so the list reads the way you
39
+ wrote it. A disabled command stays listed — its absence would be a mystery —
40
+ and cannot be run.
41
+
42
+ ## Keyboard
43
+
44
+ | Key | Does |
45
+ | ------------ | -------------------------------------------------------------- |
46
+ | `↑` / `↓` | the previous or next command, skipping disabled ones, wrapping |
47
+ | `Home`/`End` | the first or last command |
48
+ | `Enter` | runs the active command, and closes |
49
+ | `Escape` | closes, and gives the focus back to where it was |
50
+
51
+ A click runs a command too; a click outside the panel closes it.
52
+
53
+ ## Commands
54
+
55
+ ```ts
56
+ interface KtCommand {
57
+ id: string;
58
+ label: string;
59
+ group?: string; // the heading it is listed under
60
+ icon?: string; // a Lucide name
61
+ keywords?: string[]; // other words it answers to
62
+ shortcut?: string; // keys shown beside it, as <kt-kbd keys> takes them
63
+ disabled?: boolean;
64
+ }
65
+ ```
66
+
67
+ Groups appear in the order their first command does. A shortcut is only shown:
68
+ binding it is the application's work.
69
+
70
+ ## API
71
+
72
+ | Property | Attribute | Type | Default |
73
+ | ------------- | ------------- | ------------- | ----------------- |
74
+ | `commands` | — | `KtCommand[]` | `[]` |
75
+ | `open` | `open` | `boolean` | `false` |
76
+ | `hotkey` | `hotkey` | `string` | `'k'` |
77
+ | `placeholder` | `placeholder` | `string` | from `setStrings` |
78
+
79
+ | Event | Detail |
80
+ | ----------- | ------------------------------------ |
81
+ | `kt-select` | `{ id: string, command: KtCommand }` |
82
+ | `kt-open` | — |
83
+ | `kt-close` | — |
84
+
85
+ | Part | Description |
86
+ | -------- | ------------------ |
87
+ | `dialog` | The `<dialog>` |
88
+ | `input` | The search field |
89
+ | `list` | The scrolling list |
90
+ | `footer` | The keyboard hints |
91
+
92
+ ## Accessibility
93
+
94
+ Built on the native `<dialog>`: the top layer, focus containment and the inert
95
+ page come from the platform. The field is a `combobox` over a `listbox`; the
96
+ active command is its `aria-activedescendant`, so a screen reader reads each
97
+ command as the arrows reach it, and each group is a `group` named by its
98
+ heading. The focus goes to the field on opening and back to where it was on
99
+ closing.
@@ -0,0 +1,77 @@
1
+ # `<kt-number-input>`
2
+
3
+ A number field with − and + beside it: a quantity, a seat count, an amount.
4
+
5
+ ```html
6
+ <kt-number-input label="Seats" min="1" max="50" value="5"></kt-number-input>
7
+ ```
8
+
9
+ ```js
10
+ amount.formatOptions = { style: 'currency', currency: 'EUR' };
11
+ ```
12
+
13
+ ## Typing and stepping
14
+
15
+ Type a number the way your language writes one — `1 234,5` in French,
16
+ `1,234.5` in English — or step it:
17
+
18
+ | Key | Does |
19
+ | -------------- | -------------------- |
20
+ | `↑` / `↓` | one step up or down |
21
+ | `Page Up/Down` | ten steps |
22
+ | `Home`/`End` | to `min` or `max` |
23
+ | `Enter` | reads what was typed |
24
+
25
+ The − and + buttons step too, and grey out at the bounds. They stay out of the
26
+ tab order: the arrows already do their work from the field.
27
+
28
+ What is typed is read when the field is left, or on Enter, and kept within
29
+ `min` and `max` and on `step`. Text that is no number puts back the value the
30
+ field had; an emptied field holds `null`.
31
+
32
+ ## Reading at rest
33
+
34
+ While the field has the focus it shows the plain number, easy to edit. At rest
35
+ it reads the way the locale writes it, through `formatOptions` — any
36
+ `Intl.NumberFormat` option: a currency, a percentage, a unit, a number of
37
+ decimals. A screen reader hears that text as the value.
38
+
39
+ ## In a form
40
+
41
+ A form control: it submits the number under `name`, and nothing while empty.
42
+ `required` blocks submission while it is empty, `error` shows a message, and
43
+ `form.reset()` puts back the first value.
44
+
45
+ ## API
46
+
47
+ | Property | Attribute | Type | Default |
48
+ | --------------- | ------------- | -------------------------------- | ------------------ |
49
+ | `value` | `value` | `number \| null` | `null` |
50
+ | `min` | `min` | `number` | none |
51
+ | `max` | `max` | `number` | none |
52
+ | `step` | `step` | `number` | `1` |
53
+ | `formatOptions` | — | `Intl.NumberFormatOptions` | `{}` |
54
+ | `locale` | `locale` | `string` | page, then browser |
55
+ | `name` | `name` | `string` | `''` |
56
+ | `label` | `label` | `string` | `''` |
57
+ | `placeholder` | `placeholder` | `string` | `''` |
58
+ | `size` | `size` | `'small' \| 'medium' \| 'large'` | `'medium'` |
59
+ | `disabled` | `disabled` | `boolean` | `false` |
60
+ | `required` | `required` | `boolean` | `false` |
61
+ | `error` | `error` | `string` | `''` |
62
+
63
+ | Event | Detail |
64
+ | ----------- | --------------------------- |
65
+ | `kt-change` | `{ value: number \| null }` |
66
+
67
+ | Part | Description |
68
+ | ---------- | -------------- |
69
+ | `field` | The field |
70
+ | `input` | The text field |
71
+ | `decrease` | The − button |
72
+ | `increase` | The + button |
73
+
74
+ ## Accessibility
75
+
76
+ The field is a `spinbutton` with its bounds, its value and the text it shows;
77
+ `error` is announced with it.
@@ -0,0 +1,76 @@
1
+ # `<kt-slider>`
2
+
3
+ A value picked by sliding along a range: a volume, a threshold, or with `range`, a price between two ends.
4
+
5
+ ```html
6
+ <kt-slider label="Volume" value="40" show-value></kt-slider>
7
+ <kt-slider label="Price" range min="0" max="500" step="10" value="50/300" show-value></kt-slider>
8
+ ```
9
+
10
+ ## Native underneath
11
+
12
+ Each thumb is a native `<input type="range">`, laid over a track Kanto draws.
13
+ The keyboard comes from the platform — arrows and Page Up/Down step, Home and
14
+ End go to the bounds — and so does what a screen reader announces. A `range`
15
+ lays two inputs over one track; each thumb catches its own pointer.
16
+
17
+ ## The value
18
+
19
+ The value is text, as a form field's is: `"40"`, or with `range`, `"20/80"` —
20
+ low, then high. It is kept within `min` and `max` and on `step`: `value="42"`
21
+ with `step="5"` reads `40`. Without a value, a slider starts at `min`, and a
22
+ range at its two bounds. The two thumbs of a range never cross: the low end
23
+ stops at the high one.
24
+
25
+ `kt-input` fires while sliding, `kt-change` once the thumb is let go — the one
26
+ to save on.
27
+
28
+ ## Showing the value
29
+
30
+ `show-value` puts the label and the current value above the slider. `format`
31
+ says how a number reads, there and to a screen reader:
32
+
33
+ ```js
34
+ slider.format = (n) => `$${n.toLocaleString('en-US')}`;
35
+ ```
36
+
37
+ ## In a form
38
+
39
+ A form control: it submits its value under `name` — `"20/80"` for a range —
40
+ and `form.reset()` puts back the first value. A disabled fieldset disables it.
41
+
42
+ ## API
43
+
44
+ | Property | Attribute | Type | Default |
45
+ | ----------- | ------------ | ----------------------- | ----------- |
46
+ | `value` | `value` | `string` | `min` |
47
+ | `min` | `min` | `number` | `0` |
48
+ | `max` | `max` | `number` | `100` |
49
+ | `step` | `step` | `number` | `1` |
50
+ | `range` | `range` | `boolean` | `false` |
51
+ | `label` | `label` | `string` | `''` |
52
+ | `name` | `name` | `string` | `''` |
53
+ | `showValue` | `show-value` | `boolean` | `false` |
54
+ | `format` | — | `(n: number) => string` | `String(n)` |
55
+ | `disabled` | `disabled` | `boolean` | `false` |
56
+
57
+ | Event | Detail |
58
+ | ----------- | ------------------- |
59
+ | `kt-input` | `{ value: string }` |
60
+ | `kt-change` | `{ value: string }` |
61
+
62
+ | Part | Description |
63
+ | ------- | ---------------------------------- |
64
+ | `track` | The rail |
65
+ | `fill` | The selected stretch of it |
66
+ | `value` | The shown value, with `show-value` |
67
+
68
+ | Property | Description | Default |
69
+ | ------------------- | -------------------- | ------- |
70
+ | `--kt-slider-thumb` | The thumb's diameter | `18px` |
71
+ | `--kt-slider-track` | The rail's thickness | `6px` |
72
+
73
+ ## Accessibility
74
+
75
+ Each thumb is a native slider named by `label` — "Price, minimum" and "Price,
76
+ maximum" for a range — announcing its value through `format`.
@@ -0,0 +1,79 @@
1
+ # `<kt-steps>`
2
+
3
+ The steps of a flow — sign-up, checkout, onboarding — and where the reader is in it.
4
+
5
+ ```html
6
+ <kt-steps label="Sign-up" current="billing"></kt-steps>
7
+ ```
8
+
9
+ ```js
10
+ steps.steps = [
11
+ { id: 'account', label: 'Account' },
12
+ { id: 'billing', label: 'Billing', description: 'Card or invoice' },
13
+ { id: 'team', label: 'Team' },
14
+ { id: 'done', label: 'Done' },
15
+ ];
16
+ ```
17
+
18
+ ## States
19
+
20
+ Steps before `current` are complete and show a tick; `current` is ringed; the
21
+ rest are to come, numbered. A step with `error: true` shows an alert in the
22
+ danger colour wherever it sits — a field it holds failed on submit — so the
23
+ reader knows where to go back to.
24
+
25
+ Each state is also said in words for a screen reader — "Completed", "Current
26
+ step", "Not started", "Needs attention" — from `setStrings`.
27
+
28
+ ## Going back
29
+
30
+ With `navigable`, every completed step is a button: picking one sets
31
+ `current` to it and fires `kt-change`. Steps ahead are never buttons: a flow
32
+ moves forward by its own Next button, once what the current step asks for is
33
+ done.
34
+
35
+ ```html
36
+ <kt-steps label="Checkout" current="payment" navigable></kt-steps>
37
+ ```
38
+
39
+ ## Orientation
40
+
41
+ Across by default, the steps sharing the width with a connector between them.
42
+ `orientation="vertical"` stacks them down a rail — for a side column, or for
43
+ steps with long descriptions.
44
+
45
+ ## API
46
+
47
+ | Property | Attribute | Type | Default |
48
+ | ------------- | ------------- | ---------------------------- | -------------- |
49
+ | `steps` | — | `KtStep[]` | `[]` |
50
+ | `current` | `current` | `string` | `''` |
51
+ | `label` | `label` | `string` | `''` |
52
+ | `orientation` | `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` |
53
+ | `navigable` | `navigable` | `boolean` | `false` |
54
+
55
+ ```ts
56
+ interface KtStep {
57
+ id: string;
58
+ label: string;
59
+ description?: string;
60
+ error?: boolean;
61
+ }
62
+ ```
63
+
64
+ | Event | Detail |
65
+ | ----------- | ---------------- |
66
+ | `kt-change` | `{ id: string }` |
67
+
68
+ | Part | Description |
69
+ | ----------- | -------------------------------- |
70
+ | `list` | The `<ol>` |
71
+ | `step` | A step |
72
+ | `marker` | A step's number, tick or alert |
73
+ | `connector` | The line from a step to the next |
74
+
75
+ ## Accessibility
76
+
77
+ An ordered list named by `label`: the number is each step's place.
78
+ `aria-current="step"` marks the current one, and each state is said in words,
79
+ not only shown in colour.
package/dist/index.d.ts CHANGED
@@ -38,6 +38,8 @@ export type { KtRadioGroupOrientation } from './components/forms/kt-radio-group/
38
38
  export { KtSelect } from './components/forms/kt-select/kt-select.js';
39
39
  export type { KtSelectSize } from './components/forms/kt-select/kt-select.js';
40
40
  export { KtTextarea } from './components/forms/kt-textarea/kt-textarea.js';
41
+ export { KtSlider } from './components/forms/kt-slider/kt-slider.js';
42
+ export { KtNumberInput } from './components/forms/kt-number-input/kt-number-input.js';
41
43
  export { KtTimeInput } from './components/forms/kt-time-input/kt-time-input.js';
42
44
  export type { KtHourCycle } from './components/forms/kt-time-input/kt-time-input.js';
43
45
  export { KtToggle } from './components/forms/kt-toggle/kt-toggle.js';
@@ -49,6 +51,8 @@ export { KtSegmentedControl } from './components/navigation/kt-segmented-control
49
51
  export type { KtSegmentedOption, KtSegmentedSize, } from './components/navigation/kt-segmented-control/kt-segmented-control.js';
50
52
  export { KtSubMenuNavigation } from './components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js';
51
53
  export { KtTabs } from './components/navigation/kt-tabs/kt-tabs.js';
54
+ export { KtSteps } from './components/navigation/kt-steps/kt-steps.js';
55
+ export type { KtStep, KtStepsOrientation } from './components/navigation/kt-steps/kt-steps.js';
52
56
  export type { KtTab } from './components/navigation/kt-tabs/kt-tabs.js';
53
57
  export { KtHeader } from './components/navigation/kt-header/kt-header.js';
54
58
  export type { KtNavItem, KtNavSection, } from './components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js';
@@ -75,6 +79,8 @@ export type { KtConfirmVariant } from './components/overlays/kt-confirm-dialog/k
75
79
  export { KtDropdown } from './components/overlays/kt-dropdown/kt-dropdown.js';
76
80
  export type { KtDropdownAlign, KtDropdownPlacement, } from './components/overlays/kt-dropdown/kt-dropdown.js';
77
81
  export { KtModal } from './components/overlays/kt-modal/kt-modal.js';
82
+ export { KtCommandPalette } from './components/overlays/kt-command-palette/kt-command-palette.js';
83
+ export type { KtCommand } from './components/overlays/kt-command-palette/kt-command-palette.js';
78
84
  export type { KtModalSize } from './components/overlays/kt-modal/kt-modal.js';
79
85
  export { KtSidePanel } from './components/overlays/kt-side-panel/kt-side-panel.js';
80
86
  export { KtChart } from './components/data/kt-chart/kt-chart.js';