kanto-ds 1.5.2 → 1.6.1
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.
- package/README.md +13 -11
- package/dist/chunks/defaults-Cpeg13O5.js +68 -0
- package/dist/chunks/defaults-Cpeg13O5.js.map +1 -0
- package/dist/chunks/floating-B33g-M_1.js +63 -0
- package/dist/chunks/floating-B33g-M_1.js.map +1 -0
- package/dist/chunks/{index-STEEvEP7.js → index-TWJzttLX.js} +38 -15
- package/dist/chunks/index-TWJzttLX.js.map +1 -0
- package/dist/chunks/kt-calendar-CtwOby1R.js +780 -0
- package/dist/chunks/kt-calendar-CtwOby1R.js.map +1 -0
- package/dist/chunks/{kt-element-Djx2JcGl.js → kt-element-T0VbIBNp.js} +2 -2
- package/dist/chunks/{kt-element-Djx2JcGl.js.map → kt-element-T0VbIBNp.js.map} +1 -1
- package/dist/chunks/{listbox-llcUu_V-.js → listbox-LsUEyGhQ.js} +2 -2
- package/dist/chunks/{listbox-llcUu_V-.js.map → listbox-LsUEyGhQ.js.map} +1 -1
- package/dist/chunks/segmented-field-BBXR4XFL.js +384 -0
- package/dist/chunks/segmented-field-BBXR4XFL.js.map +1 -0
- package/dist/chunks/typed-date-CPAUNHzr.js +103 -0
- package/dist/chunks/typed-date-CPAUNHzr.js.map +1 -0
- package/dist/components/core/kt-avatar/kt-avatar.js +2 -2
- package/dist/components/core/kt-badge/kt-badge.js +2 -2
- package/dist/components/core/kt-button/kt-button.js +1 -1
- package/dist/components/core/kt-card/kt-card.js +1 -1
- package/dist/components/core/kt-code/kt-code.js +13 -13
- package/dist/components/core/kt-code/kt-code.js.map +1 -1
- package/dist/components/core/kt-icon/kt-icon.js +2 -2
- package/dist/components/core/kt-kbd/kt-kbd.js +5 -5
- package/dist/components/core/kt-kbd/kt-kbd.js.map +1 -1
- package/dist/components/core/kt-split-button/kt-split-button.js +3 -3
- package/dist/components/data/kt-chart/kt-chart.js +3 -3
- package/dist/components/data/kt-chart/kt-chart.js.map +1 -1
- package/dist/components/data/kt-meter/kt-meter.js +1 -1
- package/dist/components/data/kt-pagination/kt-pagination.js +2 -2
- package/dist/components/data/kt-stat/kt-stat.js +1 -1
- package/dist/components/data/kt-table/kt-table.js +85 -85
- package/dist/components/data/kt-table/kt-table.js.map +1 -1
- package/dist/components/data/kt-timeline/kt-timeline.js +1 -1
- package/dist/components/feedback/kt-alert/kt-alert.js +15 -15
- package/dist/components/feedback/kt-alert/kt-alert.js.map +1 -1
- package/dist/components/feedback/kt-empty-state/kt-empty-state.js +1 -1
- package/dist/components/feedback/kt-progress-bar/kt-progress-bar.js +1 -1
- package/dist/components/feedback/kt-skeleton/kt-skeleton.js +13 -13
- package/dist/components/feedback/kt-skeleton/kt-skeleton.js.map +1 -1
- package/dist/components/feedback/kt-toast/kt-toast.js +3 -3
- package/dist/components/feedback/kt-toast/kt-toast.js.map +1 -1
- package/dist/components/feedback/kt-toast-container/kt-toast-container.js +1 -1
- package/dist/components/feedback/kt-tooltip/kt-tooltip.js +1 -1
- package/dist/components/forms/kt-calendar/kt-calendar.d.ts +35 -9
- package/dist/components/forms/kt-calendar/kt-calendar.js +3 -3
- package/dist/components/forms/kt-checkbox/kt-checkbox.js +2 -2
- package/dist/components/forms/kt-date-input/kt-date-input.d.ts +65 -0
- package/dist/components/forms/kt-date-input/kt-date-input.js +241 -0
- package/dist/components/forms/kt-date-input/kt-date-input.js.map +1 -0
- package/dist/components/forms/kt-date-picker/kt-date-picker.d.ts +47 -3
- package/dist/components/forms/kt-date-picker/kt-date-picker.js +430 -199
- package/dist/components/forms/kt-date-picker/kt-date-picker.js.map +1 -1
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.js +3 -3
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.js.map +1 -1
- package/dist/components/forms/kt-form/kt-form.js +2 -2
- package/dist/components/forms/kt-input/kt-input.js +10 -10
- package/dist/components/forms/kt-input/kt-input.js.map +1 -1
- package/dist/components/forms/kt-input-menu/kt-input-menu.js +4 -4
- package/dist/components/forms/kt-label-input/kt-label-input.js +1 -1
- package/dist/components/forms/kt-multi-select/kt-multi-select.d.ts +113 -0
- package/dist/components/forms/kt-multi-select/kt-multi-select.js +532 -0
- package/dist/components/forms/kt-multi-select/kt-multi-select.js.map +1 -0
- package/dist/components/forms/kt-radio-group/kt-radio-group.js +56 -51
- package/dist/components/forms/kt-radio-group/kt-radio-group.js.map +1 -1
- package/dist/components/forms/kt-select/kt-select.js +4 -4
- package/dist/components/forms/kt-textarea/kt-textarea.js +2 -2
- package/dist/components/forms/kt-time-input/kt-time-input.d.ts +48 -0
- package/dist/components/forms/kt-time-input/kt-time-input.js +114 -0
- package/dist/components/forms/kt-time-input/kt-time-input.js.map +1 -0
- package/dist/components/forms/kt-toggle/kt-toggle.js +1 -1
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js +6 -6
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js.map +1 -1
- package/dist/components/navigation/kt-header/kt-header.js +2 -2
- package/dist/components/navigation/kt-page-header/kt-page-header.js +1 -1
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js +2 -2
- package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js +2 -2
- package/dist/components/navigation/kt-tabs/kt-tabs.js +2 -2
- package/dist/components/navigation/kt-tabs/kt-tabs.js.map +1 -1
- package/dist/components/navigation/kt-toggle-button/kt-toggle-button.js +1 -1
- package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js +2 -2
- package/dist/components/overlays/kt-collapsible/kt-collapsible.js +3 -3
- package/dist/components/overlays/kt-collapsible/kt-collapsible.js.map +1 -1
- package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js +2 -2
- package/dist/components/overlays/kt-dropdown/kt-dropdown.js +24 -24
- package/dist/components/overlays/kt-dropdown/kt-dropdown.js.map +1 -1
- package/dist/components/overlays/kt-modal/kt-modal.js +2 -2
- package/dist/components/overlays/kt-side-panel/kt-side-panel.js +2 -2
- package/dist/custom-elements.json +2230 -842
- package/dist/icons/defaults.d.ts +9 -0
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +316 -109
- package/dist/index.js.map +1 -1
- package/dist/internal/floating.d.ts +3 -0
- package/dist/internal/segmented-field.d.ts +114 -0
- package/dist/internal/segments.d.ts +30 -0
- package/dist/internal/strings.d.ts +30 -0
- package/dist/internal/typed-date.d.ts +33 -0
- package/dist/react/index.d.ts +23 -0
- package/dist/react/index.js +193 -169
- package/dist/react/index.js.map +1 -1
- package/dist/react/jsx.d.ts +20 -1
- package/dist/strings/index.js +1 -1
- package/dist/theme/accent.d.ts +51 -0
- package/dist/theme/appearance.d.ts +37 -0
- package/dist/tokens/README.md +100 -1
- package/dist/tokens/accents.css +80 -0
- package/dist/tokens/appearance.css +65 -0
- package/dist/tokens/base.css +3 -0
- package/dist/tokens/colors.css +78 -25
- package/dist/tokens/index.css +2 -0
- package/dist/tokens/responsive.css +160 -75
- package/dist/tokens/spacing.css +47 -28
- package/dist/tokens/theme-light.css +124 -38
- package/dist/tokens/typography.css +20 -13
- package/dist/vscode.css-custom-data.json +36 -1
- package/dist/vscode.html-custom-data.json +67 -2
- package/dist/vue/index.d.ts +6 -0
- package/dist/vue/index.js +11 -8
- package/dist/vue/index.js.map +1 -1
- package/dist/web-types.json +190 -3
- package/package.json +19 -2
- package/dist/chunks/defaults-CFrjqae2.js +0 -59
- package/dist/chunks/defaults-CFrjqae2.js.map +0 -1
- package/dist/chunks/floating-B7_Dahpn.js +0 -54
- package/dist/chunks/floating-B7_Dahpn.js.map +0 -1
- package/dist/chunks/index-STEEvEP7.js.map +0 -1
- package/dist/chunks/kt-calendar-B_hFdD9V.js +0 -640
- package/dist/chunks/kt-calendar-B_hFdD9V.js.map +0 -1
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "kanto-ds",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -1715,7 +1715,7 @@
|
|
|
1715
1715
|
},
|
|
1716
1716
|
{
|
|
1717
1717
|
"name": "kt-calendar",
|
|
1718
|
-
"description": "A month calendar to pick a day or a period from, shown in the page.\n\nThe same calendar `<kt-date-picker>` opens in its popup, for when the\ncalendar is the interface rather than a way to fill a field: a booking\npage, a dashboard's date filter, a planning view.\n\nThe
|
|
1718
|
+
"description": "A month calendar to pick a day or a period from, shown in the page.\n\nThe same calendar `<kt-date-picker>` opens in its popup, for when the\ncalendar is the interface rather than a way to fill a field: a booking\npage, a dashboard's date filter, a planning view.\n\nThe title — \"September 2026\" — opens one panel: a scrolling list of years\nbeside the twelve months of the one chosen. A year is a click or four typed\ndigits away, then its month a second click, whatever the distance.\n\nKeyboard, in the day grid (the WAI-ARIA date grid pattern): arrows by day\nand week, Home/End to the week's ends, Page Up/Down by month and with Shift\nby year, Enter to choose. In the year list: arrows, Page Up/Down by ten,\nHome/End, or type the year; Enter or Tab on to the months. In the months:\narrows, Enter to choose. Escape returns to the days.\n\n---\n\n\n### **Events:**\n - **kt-change** - A day, or a whole period, was chosen. `detail: { value }`.\n\n### **Methods:**\n - **focus(): _void_** - Focuses the grid's current cell — the chosen day, or today.\n\n### **CSS Parts:**\n - **base** - The calendar.\n- **day** - A day cell.",
|
|
1719
1719
|
"doc-url": "",
|
|
1720
1720
|
"attributes": [
|
|
1721
1721
|
{
|
|
@@ -1743,6 +1743,11 @@
|
|
|
1743
1743
|
"description": "BCP 47 language tag for names and the first day of the week. Empty: the\npage's `lang`, then the browser's language.",
|
|
1744
1744
|
"value": { "type": "string", "default": "''" }
|
|
1745
1745
|
},
|
|
1746
|
+
{
|
|
1747
|
+
"name": "months",
|
|
1748
|
+
"description": "How many months the day view shows side by side: 1, or 2 for a period.",
|
|
1749
|
+
"value": { "type": "1 | 2", "default": "1" }
|
|
1750
|
+
},
|
|
1746
1751
|
{
|
|
1747
1752
|
"name": "label",
|
|
1748
1753
|
"description": "Accessible name of the calendar. Defaults to the strings registry.",
|
|
@@ -1782,6 +1787,11 @@
|
|
|
1782
1787
|
"description": "BCP 47 language tag for names and the first day of the week. Empty: the\npage's `lang`, then the browser's language.",
|
|
1783
1788
|
"type": "string"
|
|
1784
1789
|
},
|
|
1790
|
+
{
|
|
1791
|
+
"name": "months",
|
|
1792
|
+
"description": "How many months the day view shows side by side: 1, or 2 for a period.",
|
|
1793
|
+
"type": "1 | 2"
|
|
1794
|
+
},
|
|
1785
1795
|
{
|
|
1786
1796
|
"name": "label",
|
|
1787
1797
|
"description": "Accessible name of the calendar. Defaults to the strings registry.",
|
|
@@ -1882,9 +1892,42 @@
|
|
|
1882
1892
|
]
|
|
1883
1893
|
}
|
|
1884
1894
|
},
|
|
1895
|
+
{
|
|
1896
|
+
"name": "kt-date-input",
|
|
1897
|
+
"description": "A date typed into its parts: day, month and year, each its own segment.\n\nThe segments come in the order the reader's language writes a date —\n`25/09/2026` in London, `09/25/2026` in New York, `25.09.2026` in Berlin —\nand the focus moves on as each fills, so a date is eight keystrokes. The\narrows step a segment, a day never past its month's end. The value is ISO\n8601, `2026-09-25`, and `null` until the date is complete.\n\nWith `calendar`, a button at the end opens a `<kt-calendar>` to pick from.\n\n---\n\n\n### **Events:**\n - **kt-change** - The date became complete, changed, or stopped being one. `detail: { value }` — the ISO date or `null`.\n\n### **Methods:**\n \n\n### **CSS Parts:**\n - **field** - The field.\n- **segment** - A day, month or year segment.\n- **trigger** - The calendar button, with `calendar`.\n- **panel** - The calendar popup, with `calendar`.",
|
|
1898
|
+
"doc-url": "",
|
|
1899
|
+
"attributes": [
|
|
1900
|
+
{
|
|
1901
|
+
"name": "calendar",
|
|
1902
|
+
"description": "Adds a button that opens a calendar to pick the date from.",
|
|
1903
|
+
"value": { "type": "boolean", "default": "false" }
|
|
1904
|
+
}
|
|
1905
|
+
],
|
|
1906
|
+
"events": [
|
|
1907
|
+
{
|
|
1908
|
+
"name": "kt-change",
|
|
1909
|
+
"description": "The date became complete, changed, or stopped being one. `detail: { value }` — the ISO date or `null`."
|
|
1910
|
+
}
|
|
1911
|
+
],
|
|
1912
|
+
"js": {
|
|
1913
|
+
"properties": [
|
|
1914
|
+
{
|
|
1915
|
+
"name": "calendar",
|
|
1916
|
+
"description": "Adds a button that opens a calendar to pick the date from.",
|
|
1917
|
+
"type": "boolean"
|
|
1918
|
+
}
|
|
1919
|
+
],
|
|
1920
|
+
"events": [
|
|
1921
|
+
{
|
|
1922
|
+
"name": "kt-change",
|
|
1923
|
+
"description": "The date became complete, changed, or stopped being one. `detail: { value }` — the ISO date or `null`."
|
|
1924
|
+
}
|
|
1925
|
+
]
|
|
1926
|
+
}
|
|
1927
|
+
},
|
|
1885
1928
|
{
|
|
1886
1929
|
"name": "kt-date-picker",
|
|
1887
|
-
"description": "A date field with a calendar, for one day or a period.\n\nThe value is ISO 8601 text, the format a server and a `<input type=\"date\">`\nalready speak: `2026-09-25`, or `2026-09-01/2026-09-25` for a period. What\nthe field shows is the same date formatted for the reader's language, and\nthe calendar starts its weeks on the day their region does.\n\nThe popup is a `<kt-calendar>`, with its keyboard model and its month and\nyear views: the WAI-ARIA date picker dialog pattern, where Escape closes the\ndialog and hands focus back to the field, and tabbing out closes it too.\n\n---\n\n\n### **Events:**\n - **kt-change** - A date or a whole period was chosen, or the value cleared. `detail: { value }` — the ISO date or interval, or `null`.\n\n### **Methods:**\n - **formDisabledCallback(disabled: _boolean_): _void_** - Called by the platform when the control's disabled state changes — its\nown `disabled`, or an ancestor `<fieldset disabled>` it cannot see.\n\n### **CSS Parts:**\n - **
|
|
1930
|
+
"description": "A date field with a calendar, for one day or a period.\n\nThe value is ISO 8601 text, the format a server and a `<input type=\"date\">`\nalready speak: `2026-09-25`, or `2026-09-01/2026-09-25` for a period. What\nthe field shows is the same date formatted for the reader's language, and\nthe calendar starts its weeks on the day their region does.\n\nThe field takes a date typed the way the reader writes it — `25/09/2026` in\nLondon, `9/25/2026` in New York, `25 sept.` in Paris, ISO anywhere — on Enter\nor when it is left. What does not read as a date is flagged, and the value\nit had is kept.\n\nThe popup is a `<kt-calendar>`, with its keyboard model and its month and\nyear views: the WAI-ARIA date picker dialog pattern, where Escape closes the\ndialog and hands focus back to the field, and tabbing out closes it too.\n\n---\n\n\n### **Events:**\n - **kt-change** - A date or a whole period was chosen, or the value cleared. `detail: { value }` — the ISO date or interval, or `null`.\n\n### **Methods:**\n - **formDisabledCallback(disabled: _boolean_): _void_** - Called by the platform when the control's disabled state changes — its\nown `disabled`, or an ancestor `<fieldset disabled>` it cannot see.\n\n### **CSS Parts:**\n - **field** - The field.\n- **input** - The text the date is typed into.\n- **trigger** - The button that opens the calendar.\n- **panel** - The calendar popup.\n- **presets** - The column of ready-made periods, with `range`.\n- **calendar** - The `<kt-calendar>` inside it.",
|
|
1888
1931
|
"doc-url": "",
|
|
1889
1932
|
"attributes": [
|
|
1890
1933
|
{
|
|
@@ -1998,6 +2041,11 @@
|
|
|
1998
2041
|
"description": "Shows a button that empties the field once it holds a value.",
|
|
1999
2042
|
"type": "boolean"
|
|
2000
2043
|
},
|
|
2044
|
+
{
|
|
2045
|
+
"name": "presets",
|
|
2046
|
+
"description": "Ready-made periods offered beside the calendar, with `range`. Unset: the\nperiods a dashboard asks for most — today, the last 7 and 30 days, this\nmonth and last, this year. An empty list hides the column.",
|
|
2047
|
+
"type": "readonly KtDatePreset[] | undefined"
|
|
2048
|
+
},
|
|
2001
2049
|
{
|
|
2002
2050
|
"name": "error",
|
|
2003
2051
|
"description": "Error message. A non-empty value puts the field in its error state.",
|
|
@@ -2445,6 +2493,92 @@
|
|
|
2445
2493
|
"events": []
|
|
2446
2494
|
}
|
|
2447
2495
|
},
|
|
2496
|
+
{
|
|
2497
|
+
"name": "kt-multi-select",
|
|
2498
|
+
"description": "Several choices from a list: type to narrow it, pick as many as you need.\n\nEach choice shows in the field as a removable chip. The field keeps to one\nline — the chips that do not fit collapse into a \"+3\" — so it sits in a row\nof filters without changing its height; the open list shows everything,\nchosen or not.\n\n---\n\n\n### **Events:**\n - **kt-change** - The choice changed. `detail: { value, options }`.\n- **kt-filter** - The query changed. `detail: { query }`.\n\n### **Methods:**\n - **formDisabledCallback(disabled: _boolean_): _void_** - Called by the platform when the control's disabled state changes — its\nown `disabled`, or an ancestor `<fieldset disabled>` it cannot see.\n- **formStateRestoreCallback(state: _string | FormData | null_): _void_** - Called by the platform when the browser restores a session.\n\n### **CSS Parts:**\n - **control** - The field.\n- **chips** - The row of chips.\n- **input** - The native `<input>`.\n- **popup** - The option list.\n- **option** - An option row.",
|
|
2499
|
+
"doc-url": "",
|
|
2500
|
+
"attributes": [
|
|
2501
|
+
{
|
|
2502
|
+
"name": "placeholder",
|
|
2503
|
+
"value": { "type": "string", "default": "''" }
|
|
2504
|
+
},
|
|
2505
|
+
{ "name": "name", "value": { "type": "string", "default": "''" } },
|
|
2506
|
+
{
|
|
2507
|
+
"name": "disabled",
|
|
2508
|
+
"value": { "type": "boolean", "default": "false" }
|
|
2509
|
+
},
|
|
2510
|
+
{
|
|
2511
|
+
"name": "required",
|
|
2512
|
+
"description": "At least one value must be chosen.",
|
|
2513
|
+
"value": { "type": "boolean", "default": "false" }
|
|
2514
|
+
},
|
|
2515
|
+
{ "name": "error", "value": { "type": "string", "default": "''" } },
|
|
2516
|
+
{
|
|
2517
|
+
"name": "label",
|
|
2518
|
+
"description": "Accessible name, when no `<kt-label-input>` wraps the field.",
|
|
2519
|
+
"value": { "type": "string", "default": "''" }
|
|
2520
|
+
},
|
|
2521
|
+
{
|
|
2522
|
+
"name": "empty-text",
|
|
2523
|
+
"description": "Shown in the list when no option matches.",
|
|
2524
|
+
"value": { "type": "string | undefined", "default": "undefined" }
|
|
2525
|
+
}
|
|
2526
|
+
],
|
|
2527
|
+
"events": [
|
|
2528
|
+
{
|
|
2529
|
+
"name": "kt-change",
|
|
2530
|
+
"description": "The choice changed. `detail: { value, options }`."
|
|
2531
|
+
},
|
|
2532
|
+
{
|
|
2533
|
+
"name": "kt-filter",
|
|
2534
|
+
"description": "The query changed. `detail: { query }`."
|
|
2535
|
+
}
|
|
2536
|
+
],
|
|
2537
|
+
"js": {
|
|
2538
|
+
"properties": [
|
|
2539
|
+
{ "name": "options", "type": "readonly KtOption[]" },
|
|
2540
|
+
{
|
|
2541
|
+
"name": "value",
|
|
2542
|
+
"description": "The ids of the chosen options, in the order they were chosen.",
|
|
2543
|
+
"type": "KtMultiSelectValue"
|
|
2544
|
+
},
|
|
2545
|
+
{ "name": "placeholder", "type": "string" },
|
|
2546
|
+
{ "name": "name", "type": "string" },
|
|
2547
|
+
{ "name": "disabled", "type": "boolean" },
|
|
2548
|
+
{
|
|
2549
|
+
"name": "required",
|
|
2550
|
+
"description": "At least one value must be chosen.",
|
|
2551
|
+
"type": "boolean"
|
|
2552
|
+
},
|
|
2553
|
+
{ "name": "error", "type": "string" },
|
|
2554
|
+
{
|
|
2555
|
+
"name": "label",
|
|
2556
|
+
"description": "Accessible name, when no `<kt-label-input>` wraps the field.",
|
|
2557
|
+
"type": "string"
|
|
2558
|
+
},
|
|
2559
|
+
{
|
|
2560
|
+
"name": "emptyText",
|
|
2561
|
+
"description": "Shown in the list when no option matches.",
|
|
2562
|
+
"type": "string | undefined"
|
|
2563
|
+
},
|
|
2564
|
+
{
|
|
2565
|
+
"name": "selectedOptions",
|
|
2566
|
+
"description": "The chosen options, in the order chosen.",
|
|
2567
|
+
"type": "readonly KtOption[]"
|
|
2568
|
+
}
|
|
2569
|
+
],
|
|
2570
|
+
"events": [
|
|
2571
|
+
{
|
|
2572
|
+
"name": "kt-change",
|
|
2573
|
+
"description": "The choice changed. `detail: { value, options }`."
|
|
2574
|
+
},
|
|
2575
|
+
{
|
|
2576
|
+
"name": "kt-filter",
|
|
2577
|
+
"description": "The query changed. `detail: { query }`."
|
|
2578
|
+
}
|
|
2579
|
+
]
|
|
2580
|
+
}
|
|
2581
|
+
},
|
|
2448
2582
|
{
|
|
2449
2583
|
"name": "kt-radio",
|
|
2450
2584
|
"description": "One option of a `<kt-radio-group>`.\n\nIt draws itself and carries `role=\"radio\"`; the group owns the selection,\nthe tab stop and the keyboard. A `<kt-radio>` outside a group does nothing\nuseful.\n\n---\n\n\n### **Slots:**\n - _default_ - The label.\n\n### **CSS Parts:**\n - **base** - The `role=\"radio\"` row.\n- **circle** - The drawn circle.",
|
|
@@ -2777,6 +2911,59 @@
|
|
|
2777
2911
|
]
|
|
2778
2912
|
}
|
|
2779
2913
|
},
|
|
2914
|
+
{
|
|
2915
|
+
"name": "kt-time-input",
|
|
2916
|
+
"description": "A time of day typed into its parts: hours, minutes and, if asked, seconds.\n\nThe clock is the reader's — `14:30` in London, `2:30 PM` in New York — or\nthe one `hour-cycle` names. Whatever the clock shows, the value is the\n24-hour time HTML uses, `14:30` or `14:30:00`, and `null` until complete.\nThe arrows step a segment, the minutes by `step`.\n\n---\n\n\n### **Events:**\n - **kt-change** - The time became complete, changed, or stopped being one. `detail: { value }` — `HH:MM`, `HH:MM:SS` or `null`.\n\n### **Methods:**\n \n\n### **CSS Parts:**\n - **field** - The field.\n- **segment** - An hour, minute, second or AM/PM segment.",
|
|
2917
|
+
"doc-url": "",
|
|
2918
|
+
"attributes": [
|
|
2919
|
+
{
|
|
2920
|
+
"name": "seconds",
|
|
2921
|
+
"description": "Shows a seconds segment, and puts seconds in the value.",
|
|
2922
|
+
"value": { "type": "boolean", "default": "false" }
|
|
2923
|
+
},
|
|
2924
|
+
{
|
|
2925
|
+
"name": "hour-cycle",
|
|
2926
|
+
"description": "The clock to show: `h12` with AM/PM, `h23` without. Empty: the language's.",
|
|
2927
|
+
"value": { "type": "KtHourCycle | ''", "default": "''" }
|
|
2928
|
+
},
|
|
2929
|
+
{
|
|
2930
|
+
"name": "step",
|
|
2931
|
+
"description": "How many minutes the arrows step by.",
|
|
2932
|
+
"value": { "type": "number", "default": "1" }
|
|
2933
|
+
}
|
|
2934
|
+
],
|
|
2935
|
+
"events": [
|
|
2936
|
+
{
|
|
2937
|
+
"name": "kt-change",
|
|
2938
|
+
"description": "The time became complete, changed, or stopped being one. `detail: { value }` — `HH:MM`, `HH:MM:SS` or `null`."
|
|
2939
|
+
}
|
|
2940
|
+
],
|
|
2941
|
+
"js": {
|
|
2942
|
+
"properties": [
|
|
2943
|
+
{
|
|
2944
|
+
"name": "seconds",
|
|
2945
|
+
"description": "Shows a seconds segment, and puts seconds in the value.",
|
|
2946
|
+
"type": "boolean"
|
|
2947
|
+
},
|
|
2948
|
+
{
|
|
2949
|
+
"name": "hourCycle",
|
|
2950
|
+
"description": "The clock to show: `h12` with AM/PM, `h23` without. Empty: the language's.",
|
|
2951
|
+
"type": "KtHourCycle | ''"
|
|
2952
|
+
},
|
|
2953
|
+
{
|
|
2954
|
+
"name": "step",
|
|
2955
|
+
"description": "How many minutes the arrows step by.",
|
|
2956
|
+
"type": "number"
|
|
2957
|
+
}
|
|
2958
|
+
],
|
|
2959
|
+
"events": [
|
|
2960
|
+
{
|
|
2961
|
+
"name": "kt-change",
|
|
2962
|
+
"description": "The time became complete, changed, or stopped being one. `detail: { value }` — `HH:MM`, `HH:MM:SS` or `null`."
|
|
2963
|
+
}
|
|
2964
|
+
]
|
|
2965
|
+
}
|
|
2966
|
+
},
|
|
2780
2967
|
{
|
|
2781
2968
|
"name": "kt-toggle",
|
|
2782
2969
|
"description": "An on/off switch.\n\nSized off the button heights so a toggle lines up with the controls beside\nit: the track is 1.8× the field height, the thumb is inset by 12% of it.\nChange `--button-height` and the switch follows.\n\n---\n\n\n### **Events:**\n - **kt-change** - The state changed. `detail: { checked }`.\n\n### **Methods:**\n - **formDisabledCallback(disabled: _boolean_): _void_** - Called by the platform when the control's disabled state changes — its\nown `disabled`, or an ancestor `<fieldset disabled>` it cannot see.\n\n### **Slots:**\n - _default_ - Optional label, rendered beside the switch and clickable.\n\n### **CSS Parts:**\n - **base** - The button carrying `role=\"switch\"`.\n- **track** - The track.\n- **thumb** - The sliding thumb.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kanto-ds",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Framework-agnostic design system for data-dense product interfaces.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"sideEffects": [
|
|
25
25
|
"*.css",
|
|
26
|
+
"./dist/index.js",
|
|
27
|
+
"./dist/vue/index.js",
|
|
28
|
+
"./src/index.ts",
|
|
29
|
+
"./src/vue/index.ts",
|
|
26
30
|
"./dist/components/**",
|
|
27
31
|
"./dist/icons/defaults.js",
|
|
28
32
|
"./src/components/**",
|
|
@@ -161,6 +165,10 @@
|
|
|
161
165
|
"types": "./dist/components/forms/kt-checkbox/kt-checkbox.d.ts",
|
|
162
166
|
"default": "./dist/components/forms/kt-checkbox/kt-checkbox.js"
|
|
163
167
|
},
|
|
168
|
+
"./components/forms/kt-date-input": {
|
|
169
|
+
"types": "./dist/components/forms/kt-date-input/kt-date-input.d.ts",
|
|
170
|
+
"default": "./dist/components/forms/kt-date-input/kt-date-input.js"
|
|
171
|
+
},
|
|
164
172
|
"./components/forms/kt-date-picker": {
|
|
165
173
|
"types": "./dist/components/forms/kt-date-picker/kt-date-picker.d.ts",
|
|
166
174
|
"default": "./dist/components/forms/kt-date-picker/kt-date-picker.js"
|
|
@@ -181,6 +189,10 @@
|
|
|
181
189
|
"types": "./dist/components/forms/kt-input-menu/kt-input-menu.d.ts",
|
|
182
190
|
"default": "./dist/components/forms/kt-input-menu/kt-input-menu.js"
|
|
183
191
|
},
|
|
192
|
+
"./components/forms/kt-multi-select": {
|
|
193
|
+
"types": "./dist/components/forms/kt-multi-select/kt-multi-select.d.ts",
|
|
194
|
+
"default": "./dist/components/forms/kt-multi-select/kt-multi-select.js"
|
|
195
|
+
},
|
|
184
196
|
"./components/forms/kt-label-input": {
|
|
185
197
|
"types": "./dist/components/forms/kt-label-input/kt-label-input.d.ts",
|
|
186
198
|
"default": "./dist/components/forms/kt-label-input/kt-label-input.js"
|
|
@@ -197,6 +209,10 @@
|
|
|
197
209
|
"types": "./dist/components/forms/kt-textarea/kt-textarea.d.ts",
|
|
198
210
|
"default": "./dist/components/forms/kt-textarea/kt-textarea.js"
|
|
199
211
|
},
|
|
212
|
+
"./components/forms/kt-time-input": {
|
|
213
|
+
"types": "./dist/components/forms/kt-time-input/kt-time-input.d.ts",
|
|
214
|
+
"default": "./dist/components/forms/kt-time-input/kt-time-input.js"
|
|
215
|
+
},
|
|
200
216
|
"./components/forms/kt-toggle": {
|
|
201
217
|
"types": "./dist/components/forms/kt-toggle/kt-toggle.d.ts",
|
|
202
218
|
"default": "./dist/components/forms/kt-toggle/kt-toggle.js"
|
|
@@ -286,8 +302,9 @@
|
|
|
286
302
|
"format:check": "prettier --check .",
|
|
287
303
|
"clean": "node -e \"fs.rmSync(dist,{recursive:true,force:true})\"",
|
|
288
304
|
"check:exports": "node scripts/check-exports.js",
|
|
305
|
+
"check:consumer": "node scripts/check-consumer.js",
|
|
289
306
|
"check:size": "node scripts/check-size.js",
|
|
290
|
-
"verify": "npm run format:check && npm run lint && npm run typecheck && npm run test && npm run build && npm run check:exports && npm run check:size && npm run build:demo",
|
|
307
|
+
"verify": "npm run format:check && npm run lint && npm run typecheck && npm run test && npm run build && npm run check:exports && npm run check:consumer && npm run check:size && npm run build:demo",
|
|
291
308
|
"release": "node scripts/release.js",
|
|
292
309
|
"release:dry": "node scripts/release.js --dry-run",
|
|
293
310
|
"prepublishOnly": "npm run verify"
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { X as s, User as a, TriangleAlert as c, Trash2 as i, Search as f, Minus as g, Menu as p, LoaderCircle as u, Info as C, FileUp as l, File as y, EyeOff as A, Eye as I, Copy as h, CircleCheck as w, CircleAlert as $, ChevronUp as b, ChevronRight as d, ChevronLeft as v, ChevronDown as U, Check as Z, Calendar as k, ArrowUp as m, ArrowDown as z } from "lucide";
|
|
2
|
-
const n = /* @__PURE__ */ new Map();
|
|
3
|
-
function t(e) {
|
|
4
|
-
return e.replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-zA-Z])(\d)/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
5
|
-
}
|
|
6
|
-
function L(e, r) {
|
|
7
|
-
n.set(t(e), r);
|
|
8
|
-
}
|
|
9
|
-
function M(e) {
|
|
10
|
-
for (const [r, o] of Object.entries(e))
|
|
11
|
-
j(o) && L(r, o);
|
|
12
|
-
}
|
|
13
|
-
function F(e) {
|
|
14
|
-
return n.get(t(e));
|
|
15
|
-
}
|
|
16
|
-
function O() {
|
|
17
|
-
return [...n.keys()].sort();
|
|
18
|
-
}
|
|
19
|
-
function j(e) {
|
|
20
|
-
return Array.isArray(e) && e.every(
|
|
21
|
-
(r) => Array.isArray(r) && typeof r[0] == "string" && typeof r[1] == "object" && r[1] !== null
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
const D = {
|
|
25
|
-
ArrowDown: z,
|
|
26
|
-
ArrowUp: m,
|
|
27
|
-
Calendar: k,
|
|
28
|
-
Check: Z,
|
|
29
|
-
ChevronDown: U,
|
|
30
|
-
ChevronLeft: v,
|
|
31
|
-
ChevronRight: d,
|
|
32
|
-
ChevronUp: b,
|
|
33
|
-
CircleAlert: $,
|
|
34
|
-
CircleCheck: w,
|
|
35
|
-
Copy: h,
|
|
36
|
-
Eye: I,
|
|
37
|
-
EyeOff: A,
|
|
38
|
-
File: y,
|
|
39
|
-
FileUp: l,
|
|
40
|
-
Info: C,
|
|
41
|
-
LoaderCircle: u,
|
|
42
|
-
Menu: p,
|
|
43
|
-
Minus: g,
|
|
44
|
-
Search: f,
|
|
45
|
-
Trash2: i,
|
|
46
|
-
TriangleAlert: c,
|
|
47
|
-
User: a,
|
|
48
|
-
X: s
|
|
49
|
-
};
|
|
50
|
-
M(D);
|
|
51
|
-
export {
|
|
52
|
-
M as a,
|
|
53
|
-
O as b,
|
|
54
|
-
D as d,
|
|
55
|
-
F as g,
|
|
56
|
-
L as r,
|
|
57
|
-
t
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=defaults-CFrjqae2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults-CFrjqae2.js","sources":["../../src/icons/registry.ts","../../src/icons/defaults.ts"],"sourcesContent":["/**\n * The icon registry.\n *\n * `<kt-icon>` looks icons up by name at render time, which means the set of\n * icons cannot be statically analysed and a bundler cannot tree-shake it. So\n * Kanto does not bundle all two thousand Lucide icons: the elements register\n * the handful they need themselves, and an application registers whatever else\n * it uses.\n *\n * import { Rocket, Wallet } from 'lucide';\n * import { registerIcons } from 'kanto-ds/icons';\n *\n * registerIcons({ Rocket, Wallet });\n *\n * Names are normalised to kebab-case, so `Rocket`, `rocket` and\n * `ChevronDown` / `chevron-down` all resolve.\n */\n\n/** A Lucide icon: a flat list of SVG children, each `[tag, attributes]`. */\nexport type IconNode = [tag: string, attrs: Record<string, string | number | undefined>][];\n\nconst registry = new Map<string, IconNode>();\n\n/**\n * `ChevronDown` → `chevron-down`, `Trash2` → `trash-2`, `AArrowDown` →\n * `a-arrow-down`.\n *\n * The digit boundary matters: Lucide names that icon `trash-2`, so a rule that\n * only splits on case produces `trash2` and the lookup quietly misses.\n */\nexport function toKebabCase(name: string): string {\n return name\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2') // acronym run before a word\n .replace(/([a-zA-Z])(\\d)/g, '$1-$2') // letter before a digit\n .replace(/([a-z])([A-Z])/g, '$1-$2') // ordinary camel boundary\n .replace(/[\\s_]+/g, '-')\n .toLowerCase();\n}\n\n/** Registers a single icon under `name`. */\nexport function registerIcon(name: string, node: IconNode): void {\n registry.set(toKebabCase(name), node);\n}\n\n/**\n * Registers a map of icons. Accepts a Lucide namespace import directly:\n * every non-icon export (`createElement`, `createIcons`, …) is skipped.\n */\nexport function registerIcons(icons: Record<string, unknown>): void {\n for (const [name, node] of Object.entries(icons)) {\n if (isIconNode(node)) registerIcon(name, node);\n }\n}\n\n/** Returns the icon registered under `name`, or `undefined`. */\nexport function getIcon(name: string): IconNode | undefined {\n return registry.get(toKebabCase(name));\n}\n\n/** Every registered name, kebab-cased and sorted. Useful for docs and tests. */\nexport function registeredIcons(): string[] {\n return [...registry.keys()].sort();\n}\n\nfunction isIconNode(value: unknown): value is IconNode {\n return (\n Array.isArray(value) &&\n value.every(\n (child) =>\n Array.isArray(child) &&\n typeof child[0] === 'string' &&\n typeof child[1] === 'object' &&\n child[1] !== null,\n )\n );\n}\n","/**\n * The icons the design system uses in its own elements.\n *\n * Importing any Kanto element pulls this set in — roughly 2 kB of path data,\n * the price of `<kt-select>` being able to draw its own chevron. Application\n * icons are registered separately through `registerIcons`.\n */\nimport {\n ArrowDown,\n ArrowUp,\n Calendar,\n Check,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n ChevronUp,\n CircleAlert,\n CircleCheck,\n Copy,\n Eye,\n EyeOff,\n File,\n FileUp,\n Info,\n LoaderCircle,\n Menu,\n Minus,\n Search,\n Trash2,\n TriangleAlert,\n User,\n X,\n} from 'lucide';\n// The sibling registry, not the `kanto-ds` barrel: the barrel pulls in every\n// element, and one of them pulls in this file — a cycle that leaves\n// `registerIcons` undefined by the time the call below runs.\nimport { registerIcons } from './registry.js';\n\n/** Icons referenced by Kanto elements, keyed by their Lucide name. */\nexport const defaultIcons = {\n ArrowDown,\n ArrowUp,\n Calendar,\n Check,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n ChevronUp,\n CircleAlert,\n CircleCheck,\n Copy,\n Eye,\n EyeOff,\n File,\n FileUp,\n Info,\n LoaderCircle,\n Menu,\n Minus,\n Search,\n Trash2,\n TriangleAlert,\n User,\n X,\n};\n\nregisterIcons(defaultIcons);\n"],"names":["registry","toKebabCase","name","registerIcon","node","registerIcons","icons","isIconNode","getIcon","registeredIcons","value","child","defaultIcons","ArrowDown","ArrowUp","Calendar","Check","ChevronDown","ChevronLeft","ChevronRight","ChevronUp","CircleAlert","CircleCheck","Copy","Eye","EyeOff","File","FileUp","Info","LoaderCircle","Menu","Minus","Search","Trash2","TriangleAlert","User","X"],"mappings":";AAqBA,MAAMA,wBAAe,IAAA;AASd,SAASC,EAAYC,GAAsB;AAChD,SAAOA,EACJ,QAAQ,yBAAyB,OAAO,EACxC,QAAQ,mBAAmB,OAAO,EAClC,QAAQ,mBAAmB,OAAO,EAClC,QAAQ,WAAW,GAAG,EACtB,YAAA;AACL;AAGO,SAASC,EAAaD,GAAcE,GAAsB;AAC/D,EAAAJ,EAAS,IAAIC,EAAYC,CAAI,GAAGE,CAAI;AACtC;AAMO,SAASC,EAAcC,GAAsC;AAClE,aAAW,CAACJ,GAAME,CAAI,KAAK,OAAO,QAAQE,CAAK;AAC7C,IAAIC,EAAWH,CAAI,KAAGD,EAAaD,GAAME,CAAI;AAEjD;AAGO,SAASI,EAAQN,GAAoC;AAC1D,SAAOF,EAAS,IAAIC,EAAYC,CAAI,CAAC;AACvC;AAGO,SAASO,IAA4B;AAC1C,SAAO,CAAC,GAAGT,EAAS,KAAA,CAAM,EAAE,KAAA;AAC9B;AAEA,SAASO,EAAWG,GAAmC;AACrD,SACE,MAAM,QAAQA,CAAK,KACnBA,EAAM;AAAA,IACJ,CAACC,MACC,MAAM,QAAQA,CAAK,KACnB,OAAOA,EAAM,CAAC,KAAM,YACpB,OAAOA,EAAM,CAAC,KAAM,YACpBA,EAAM,CAAC,MAAM;AAAA,EAAA;AAGrB;ACpCO,MAAMC,IAAe;AAAA,EAC1B,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,KAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,eAAAC;AAAA,EACA,MAAAC;AAAA,EACA,GAAAC;AACF;AAEA/B,EAAcO,CAAY;"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { css as n } from "lit";
|
|
2
|
-
import { p as a } from "./position-Cx_ZH5zh.js";
|
|
3
|
-
const p = n`
|
|
4
|
-
.floating {
|
|
5
|
-
position: fixed;
|
|
6
|
-
inset: auto;
|
|
7
|
-
display: block;
|
|
8
|
-
margin: 0;
|
|
9
|
-
color: inherit;
|
|
10
|
-
border: none;
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
class c {
|
|
14
|
-
constructor(t, o) {
|
|
15
|
-
this.options = o, this.open = !1, this.frame = 0, this.follow = () => {
|
|
16
|
-
cancelAnimationFrame(this.frame), this.frame = requestAnimationFrame(() => this.place());
|
|
17
|
-
}, t.addController(this);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Call from the host's `updated()` with whether the panel is open. While it
|
|
21
|
-
* is, every update re-places it: its content — a filtered list — can change
|
|
22
|
-
* its size.
|
|
23
|
-
*/
|
|
24
|
-
sync(t) {
|
|
25
|
-
if (t !== this.open) {
|
|
26
|
-
this.open = t;
|
|
27
|
-
const i = t ? "addEventListener" : "removeEventListener";
|
|
28
|
-
window[i]("scroll", this.follow, { capture: !0, passive: !0 }), window[i]("resize", this.follow);
|
|
29
|
-
}
|
|
30
|
-
const o = this.options.panel();
|
|
31
|
-
!o || typeof o.showPopover != "function" || (t ? (o.matches(":popover-open") || o.showPopover(), this.place()) : o.matches(":popover-open") && o.hidePopover());
|
|
32
|
-
}
|
|
33
|
-
hostDisconnected() {
|
|
34
|
-
this.sync(!1), cancelAnimationFrame(this.frame);
|
|
35
|
-
}
|
|
36
|
-
place() {
|
|
37
|
-
const t = this.options.panel(), o = this.options.anchor()?.getBoundingClientRect();
|
|
38
|
-
if (!t || !o) return;
|
|
39
|
-
this.options.matchWidth && (t.style.width = `${o.width}px`);
|
|
40
|
-
const { x: i, y: e, placement: s } = a(
|
|
41
|
-
o,
|
|
42
|
-
{ width: t.offsetWidth, height: t.offsetHeight },
|
|
43
|
-
{ width: window.innerWidth, height: window.innerHeight },
|
|
44
|
-
this.options.side?.() ?? "bottom",
|
|
45
|
-
this.options.align?.() ?? "start"
|
|
46
|
-
);
|
|
47
|
-
t.style.left = `${i}px`, t.style.top = `${e}px`, this.options.onPlace?.(s);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export {
|
|
51
|
-
c as F,
|
|
52
|
-
p as f
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=floating-B7_Dahpn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"floating-B7_Dahpn.js","sources":["../../src/internal/floating.ts"],"sourcesContent":["import { css, type ReactiveController, type ReactiveControllerHost } from 'lit';\nimport { placeFloating, type Align, type Side } from './position.js';\n\n/**\n * A panel that opens from a trigger — a select's list, a date picker's\n * calendar, a menu — drawn in the top layer and placed from the trigger.\n *\n * A panel positioned inside its element was cut off by any ancestor with\n * `overflow: hidden`: a table cell, a side panel, an app's scrolling main\n * area. In the top layer, nothing clips it. It opens on the side asked for, or\n * the other one when that has no room, and follows the trigger as the page\n * scrolls.\n */\n\nexport interface FloatingOptions {\n /** The panel, which carries `popover=\"manual\"` and the `floating` class. */\n readonly panel: () => HTMLElement | null | undefined;\n /** What the panel opens from. */\n readonly anchor: () => Element | null | undefined;\n /** The side it prefers. */\n readonly side?: () => Side;\n /** Which edge of the anchor it lines up with; its start by default. */\n readonly align?: () => Align;\n /** Sizes the panel to the anchor's width — a list under its field. */\n readonly matchWidth?: boolean;\n /** Told the side it opened on, for the direction of its entrance. */\n readonly onPlace?: (side: Side) => void;\n}\n\n/**\n * The panel's own styles. Closed, it keeps the display and the hidden,\n * animatable state its element gives it, so it can fade out after it leaves\n * the top layer: `display` here only undoes the popover's `display: none`, and\n * a panel's own `display` still wins.\n */\nexport const floatingStyles = css`\n .floating {\n position: fixed;\n inset: auto;\n display: block;\n margin: 0;\n color: inherit;\n border: none;\n }\n`;\n\nexport class FloatingController implements ReactiveController {\n private open = false;\n private frame = 0;\n\n constructor(\n host: ReactiveControllerHost,\n private readonly options: FloatingOptions,\n ) {\n host.addController(this);\n }\n\n /**\n * Call from the host's `updated()` with whether the panel is open. While it\n * is, every update re-places it: its content — a filtered list — can change\n * its size.\n */\n sync(open: boolean): void {\n // First, and whatever the panel: one rendered only while open is already\n // gone when it closes, and its listeners must go with it.\n if (open !== this.open) {\n this.open = open;\n const method = open ? 'addEventListener' : 'removeEventListener';\n window[method]('scroll', this.follow, { capture: true, passive: true });\n window[method]('resize', this.follow);\n }\n\n const panel = this.options.panel();\n // Where popovers are missing — a test DOM — the panel stays where it is.\n if (!panel || typeof panel.showPopover !== 'function') return;\n\n if (open) {\n if (!panel.matches(':popover-open')) panel.showPopover();\n this.place();\n } else if (panel.matches(':popover-open')) {\n panel.hidePopover();\n }\n }\n\n hostDisconnected(): void {\n this.sync(false);\n cancelAnimationFrame(this.frame);\n }\n\n private follow = (): void => {\n cancelAnimationFrame(this.frame);\n this.frame = requestAnimationFrame(() => this.place());\n };\n\n private place(): void {\n const panel = this.options.panel();\n const anchor = this.options.anchor()?.getBoundingClientRect();\n if (!panel || !anchor) return;\n\n if (this.options.matchWidth) panel.style.width = `${anchor.width}px`;\n // Untransformed size: the entrance animation scales and slides the panel.\n const { x, y, placement } = placeFloating(\n anchor,\n { width: panel.offsetWidth, height: panel.offsetHeight },\n { width: window.innerWidth, height: window.innerHeight },\n this.options.side?.() ?? 'bottom',\n this.options.align?.() ?? 'start',\n );\n panel.style.left = `${x}px`;\n panel.style.top = `${y}px`;\n this.options.onPlace?.(placement);\n }\n}\n"],"names":["floatingStyles","css","FloatingController","host","options","open","method","panel","anchor","x","y","placement","placeFloating"],"mappings":";;AAmCO,MAAMA,IAAiBC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWvB,MAAMC,EAAiD;AAAA,EAI5D,YACEC,GACiBC,GACjB;AADiB,SAAA,UAAAA,GALnB,KAAQ,OAAO,IACf,KAAQ,QAAQ,GAyChB,KAAQ,SAAS,MAAY;AAC3B,2BAAqB,KAAK,KAAK,GAC/B,KAAK,QAAQ,sBAAsB,MAAM,KAAK,OAAO;AAAA,IACvD,GAtCED,EAAK,cAAc,IAAI;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,KAAKE,GAAqB;AAGxB,QAAIA,MAAS,KAAK,MAAM;AACtB,WAAK,OAAOA;AACZ,YAAMC,IAASD,IAAO,qBAAqB;AAC3C,aAAOC,CAAM,EAAE,UAAU,KAAK,QAAQ,EAAE,SAAS,IAAM,SAAS,IAAM,GACtE,OAAOA,CAAM,EAAE,UAAU,KAAK,MAAM;AAAA,IACtC;AAEA,UAAMC,IAAQ,KAAK,QAAQ,MAAA;AAE3B,IAAI,CAACA,KAAS,OAAOA,EAAM,eAAgB,eAEvCF,KACGE,EAAM,QAAQ,eAAe,OAAS,YAAA,GAC3C,KAAK,MAAA,KACIA,EAAM,QAAQ,eAAe,KACtCA,EAAM,YAAA;AAAA,EAEV;AAAA,EAEA,mBAAyB;AACvB,SAAK,KAAK,EAAK,GACf,qBAAqB,KAAK,KAAK;AAAA,EACjC;AAAA,EAOQ,QAAc;AACpB,UAAMA,IAAQ,KAAK,QAAQ,MAAA,GACrBC,IAAS,KAAK,QAAQ,OAAA,GAAU,sBAAA;AACtC,QAAI,CAACD,KAAS,CAACC,EAAQ;AAEvB,IAAI,KAAK,QAAQ,eAAYD,EAAM,MAAM,QAAQ,GAAGC,EAAO,KAAK;AAEhE,UAAM,EAAE,GAAAC,GAAG,GAAAC,GAAG,WAAAC,EAAA,IAAcC;AAAA,MAC1BJ;AAAA,MACA,EAAE,OAAOD,EAAM,aAAa,QAAQA,EAAM,aAAA;AAAA,MAC1C,EAAE,OAAO,OAAO,YAAY,QAAQ,OAAO,YAAA;AAAA,MAC3C,KAAK,QAAQ,OAAA,KAAY;AAAA,MACzB,KAAK,QAAQ,aAAa;AAAA,IAAA;AAE5B,IAAAA,EAAM,MAAM,OAAO,GAAGE,CAAC,MACvBF,EAAM,MAAM,MAAM,GAAGG,CAAC,MACtB,KAAK,QAAQ,UAAUC,CAAS;AAAA,EAClC;AACF;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-STEEvEP7.js","sources":["../../src/internal/strings.ts"],"sourcesContent":["/**\n * Every piece of copy the elements write themselves — empty states, button\n * labels, validation messages, and the accessible names a screen reader\n * announces but nobody sees.\n *\n * English by default. An application in another language replaces them once,\n * at start-up, and every element follows:\n *\n * import { setStrings } from 'kanto-ds/strings';\n *\n * setStrings({\n * clear: 'Effacer',\n * pageOf: (page, total) => `Page ${page} sur ${total}`,\n * });\n *\n * Anything left out keeps its English default. A string an element also takes\n * as a property — `emptyText`, `placeholder`, `confirmLabel` — still wins when\n * it is set, so one screen can say something different from the rest.\n *\n * Copy that carries a value is a function, not a template with placeholders:\n * the translation owns the word order, and \"Remove {name}\" does not survive\n * languages that put the object first.\n */\n\nexport interface KtStrings {\n // --- Shared actions ---\n /** Clear button in fields. */\n clear: string;\n /** Close button on toasts, alerts' dismiss button. */\n close: string;\n dismiss: string;\n /** Copy button on `kt-code`, and its state once copied. */\n copy: string;\n copied: string;\n copyCode: string;\n /** The countdown bar on a toast that closes itself. */\n timeRemaining: string;\n /** Remove button on a badge or a dropped file. */\n remove: (name: string) => string;\n\n // --- Empty and loading states ---\n noOptions: string;\n noResults: string;\n noActions: string;\n noData: string;\n loading: string;\n\n // --- Fields ---\n /** `kt-select` with nothing chosen. */\n select: string;\n openList: string;\n closeList: string;\n showPassword: string;\n hidePassword: string;\n searchCountry: string;\n noCountry: string;\n countryCode: (country: string | undefined) => string;\n dragAndDrop: string;\n browseFiles: string;\n recommendedSize: (size: string) => string;\n selectedFiles: string;\n /** `kt-date-picker` with nothing chosen, and its calendar's name. */\n selectDate: string;\n selectPeriod: string;\n previousMonth: string;\n nextMonth: string;\n previousYear: string;\n nextYear: string;\n previousYears: string;\n nextYears: string;\n /** The calendar header's month and year buttons, which open those views. */\n chooseMonth: string;\n chooseYear: string;\n\n // --- Validation messages, shown by the browser on submit ---\n required: string;\n selectOption: string;\n selectFile: string;\n /** A required checkbox left unchecked. */\n checkRequired: string;\n dateRequired: string;\n /** A phone number typed with the prefix only dialled from inside the country. */\n phoneTrunkPrefix: (prefix: string) => string;\n\n // --- Navigation ---\n openMenu: string;\n closeMenu: string;\n breadcrumb: string;\n secondaryNavigation: string;\n pagination: string;\n previous: string;\n next: string;\n pageOf: (page: number, total: number) => string;\n moreActions: string;\n\n // --- Groups and sections ---\n /** A button or choice group with no label of its own. */\n options: string;\n /** A `kt-form` section with no heading. */\n formSection: string;\n\n // --- Data ---\n selectRow: string;\n selectAll: string;\n total: string;\n /** Column headers of the data table every chart renders for assistive tech. */\n chartSeries: string;\n chartPoint: string;\n chartSlice: string;\n chartShare: string;\n /** Caption of a chart's data table when the chart has no label. */\n chartData: string;\n /** Value column of a single-series chart's data table when the series has no name. */\n chartValue: string;\n\n // --- Overlays ---\n confirmHeading: string;\n confirm: string;\n cancel: string;\n details: string;\n\n // --- Identity ---\n avatar: string;\n}\n\nexport const defaultStrings: Readonly<KtStrings> = Object.freeze({\n clear: 'Clear',\n close: 'Close',\n dismiss: 'Dismiss',\n copy: 'Copy',\n copied: 'Copied',\n copyCode: 'Copy code',\n timeRemaining: 'Time remaining',\n remove: (name: string) => (name ? `Remove ${name}` : 'Remove'),\n\n noOptions: 'No options available',\n noResults: 'No results',\n noActions: 'No actions',\n noData: 'No data to display',\n loading: 'Loading…',\n\n select: 'Select',\n openList: 'Open list',\n closeList: 'Close list',\n showPassword: 'Show password',\n hidePassword: 'Hide password',\n searchCountry: 'Search country or dial code',\n noCountry: 'No country found',\n countryCode: (country: string | undefined) => `Country code: ${country ?? 'none'}`,\n dragAndDrop: 'Drag and drop or',\n browseFiles: 'browse your files',\n recommendedSize: (size: string) => `Recommended image size: ${size}`,\n selectedFiles: 'Selected files',\n selectDate: 'Select a date',\n selectPeriod: 'Select a period',\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n previousYear: 'Previous year',\n nextYear: 'Next year',\n previousYears: 'Previous years',\n nextYears: 'Next years',\n chooseMonth: 'Choose month',\n chooseYear: 'Choose year',\n\n required: 'This field is required.',\n selectOption: 'Select an option.',\n selectFile: 'Select a file.',\n checkRequired: 'Check this box to continue.',\n dateRequired: 'Select a date.',\n phoneTrunkPrefix: (prefix: string) => `Enter the number without the leading ${prefix}.`,\n\n openMenu: 'Open menu',\n closeMenu: 'Close menu',\n breadcrumb: 'Breadcrumb',\n secondaryNavigation: 'Secondary navigation',\n pagination: 'Pagination',\n previous: 'Previous',\n next: 'Next',\n pageOf: (page: number, total: number) => `Page ${page} / ${total}`,\n moreActions: 'More actions',\n\n options: 'Options',\n formSection: 'Form section',\n\n selectRow: 'Select row',\n selectAll: 'Select all',\n total: 'Total',\n chartSeries: 'Series',\n chartPoint: 'Point',\n chartSlice: 'Slice',\n chartShare: 'Share',\n chartData: 'Chart data',\n chartValue: 'Value',\n\n confirmHeading: 'Are you sure?',\n confirm: 'Confirm',\n cancel: 'Cancel',\n details: 'Details',\n\n avatar: 'Avatar',\n});\n\nlet current: KtStrings = { ...defaultStrings };\nconst listeners = new Set<() => void>();\n\n/** The strings in effect. Elements read them at render time. */\nexport function strings(): Readonly<KtStrings> {\n return current;\n}\n\n/**\n * Replaces some or all of the strings, and re-renders every connected element\n * so the change shows at once — switching language at runtime works.\n */\nexport function setStrings(overrides: Partial<KtStrings>): void {\n current = { ...current, ...overrides };\n for (const listener of listeners) listener();\n}\n\n/** Back to the English defaults. */\nexport function resetStrings(): void {\n setStrings(defaultStrings);\n}\n\n/** Calls `listener` after every `setStrings`. Returns the unsubscribe function. */\nexport function onStringsChange(listener: () => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n"],"names":["defaultStrings","name","country","size","prefix","page","total","current","listeners","strings","setStrings","overrides","listener","resetStrings","onStringsChange"],"mappings":"AA6HO,MAAMA,IAAsC,OAAO,OAAO;AAAA,EAC/D,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,eAAe;AAAA,EACf,QAAQ,CAACC,MAAkBA,IAAO,UAAUA,CAAI,KAAK;AAAA,EAErD,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EAET,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,cAAc;AAAA,EACd,eAAe;AAAA,EACf,WAAW;AAAA,EACX,aAAa,CAACC,MAAgC,iBAAiBA,KAAW,MAAM;AAAA,EAChF,aAAa;AAAA,EACb,aAAa;AAAA,EACb,iBAAiB,CAACC,MAAiB,2BAA2BA,CAAI;AAAA,EAClE,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,eAAe;AAAA,EACf,WAAW;AAAA,EACX,cAAc;AAAA,EACd,UAAU;AAAA,EACV,eAAe;AAAA,EACf,WAAW;AAAA,EACX,aAAa;AAAA,EACb,YAAY;AAAA,EAEZ,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,cAAc;AAAA,EACd,kBAAkB,CAACC,MAAmB,wCAAwCA,CAAM;AAAA,EAEpF,UAAU;AAAA,EACV,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,qBAAqB;AAAA,EACrB,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ,CAACC,GAAcC,MAAkB,QAAQD,CAAI,MAAMC,CAAK;AAAA,EAChE,aAAa;AAAA,EAEb,SAAS;AAAA,EACT,aAAa;AAAA,EAEb,WAAW;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAAA,EAEZ,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EAET,QAAQ;AACV,CAAC;AAED,IAAIC,IAAqB,EAAE,GAAGP,EAAA;AAC9B,MAAMQ,wBAAgB,IAAA;AAGf,SAASC,IAA+B;AAC7C,SAAOF;AACT;AAMO,SAASG,EAAWC,GAAqC;AAC9D,EAAAJ,IAAU,EAAE,GAAGA,GAAS,GAAGI,EAAA;AAC3B,aAAWC,KAAYJ,EAAW,CAAAI,EAAA;AACpC;AAGO,SAASC,IAAqB;AACnC,EAAAH,EAAWV,CAAc;AAC3B;AAGO,SAASc,EAAgBF,GAAkC;AAChE,SAAAJ,EAAU,IAAII,CAAQ,GACf,MAAMJ,EAAU,OAAOI,CAAQ;AACxC;"}
|