@brandsync/wc 1.9.0 → 1.10.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.
- package/custom-elements.json +4520 -3613
- package/dist/brandsync-wc/brandsync-wc.esm.js +1 -1
- package/dist/brandsync-wc/{p-c4de155c.entry.js → p-0132a2d1.entry.js} +1 -1
- package/dist/brandsync-wc/{p-051d3064.entry.js → p-041776c0.entry.js} +1 -1
- package/dist/brandsync-wc/{p-a09e157f.entry.js → p-08c99a60.entry.js} +1 -1
- package/dist/brandsync-wc/{p-70f64b25.entry.js → p-18c3c22c.entry.js} +1 -1
- package/dist/brandsync-wc/p-1c3a43c7.entry.js +1 -0
- package/dist/brandsync-wc/{p-fddc7bd1.entry.js → p-1c427ffb.entry.js} +1 -1
- package/dist/brandsync-wc/{p-29027559.entry.js → p-2e958566.entry.js} +1 -1
- package/dist/brandsync-wc/{p-235ae012.entry.js → p-301b2455.entry.js} +1 -1
- package/dist/brandsync-wc/{p-8ee0153b.entry.js → p-32cd69f1.entry.js} +1 -1
- package/dist/brandsync-wc/p-4f2c4929.entry.js +1 -0
- package/dist/brandsync-wc/{p-a0d5a620.entry.js → p-50a251a4.entry.js} +1 -1
- package/dist/brandsync-wc/{p-0e39b9cc.entry.js → p-5f3cd501.entry.js} +1 -1
- package/dist/brandsync-wc/{p-fc240aa0.entry.js → p-701ebf4a.entry.js} +1 -1
- package/dist/brandsync-wc/{p-0eed6813.entry.js → p-763876f5.entry.js} +1 -1
- package/dist/brandsync-wc/{p-f7d47c17.entry.js → p-76e1c295.entry.js} +1 -1
- package/dist/brandsync-wc/p-790db8b3.entry.js +1 -0
- package/dist/brandsync-wc/{p-4e5dcaff.entry.js → p-796a1860.entry.js} +1 -1
- package/dist/brandsync-wc/{p-36bf37d9.entry.js → p-806a5347.entry.js} +1 -1
- package/dist/brandsync-wc/{p-6331de9c.entry.js → p-8eba7f90.entry.js} +1 -1
- package/dist/brandsync-wc/{p-6fd7dd6a.entry.js → p-96ed9386.entry.js} +1 -1
- package/dist/brandsync-wc/{p-cfcf3f0a.entry.js → p-9e88f19c.entry.js} +1 -1
- package/dist/brandsync-wc/{p-de7c946d.entry.js → p-a71d2811.entry.js} +1 -1
- package/dist/brandsync-wc/{p-33e44094.entry.js → p-a8e2a829.entry.js} +1 -1
- package/dist/brandsync-wc/{p-3b64e3cd.entry.js → p-addfa0a0.entry.js} +1 -1
- package/dist/brandsync-wc/{p-4574a707.entry.js → p-af2bf957.entry.js} +1 -1
- package/dist/brandsync-wc/{p-6bf2f116.entry.js → p-b2074a32.entry.js} +1 -1
- package/dist/brandsync-wc/{p-7c94e6ae.entry.js → p-c99b6a66.entry.js} +1 -1
- package/dist/brandsync-wc/{p-2891d40b.entry.js → p-c9a72416.entry.js} +1 -1
- package/dist/brandsync-wc/{p-9f65f998.entry.js → p-d3f44cb7.entry.js} +1 -1
- package/dist/brandsync-wc/p-d42b1c2b.entry.js +1 -0
- package/dist/brandsync-wc/{p-3ec74d35.entry.js → p-daab6b22.entry.js} +1 -1
- package/dist/brandsync-wc/{p-107b1c5d.entry.js → p-dbcbe682.entry.js} +1 -1
- package/dist/brandsync-wc/{p-3176d1d3.entry.js → p-e8a5b8eb.entry.js} +1 -1
- package/dist/brandsync-wc/{p-062cfa34.entry.js → p-ea4e20ef.entry.js} +1 -1
- package/dist/brandsync-wc/{p-27bbed83.entry.js → p-f370b8fa.entry.js} +1 -1
- package/dist/brandsync-wc/{p-05c7de28.entry.js → p-f89de457.entry.js} +1 -1
- package/dist/brandsync-wc/{p-114d2fd8.entry.js → p-fd254972.entry.js} +1 -1
- package/dist/cjs/brandsync-wc.cjs.js +1 -1
- package/dist/cjs/bs-ai-disclaimer.cjs.entry.js +1 -1
- package/dist/cjs/bs-ai-greeting.cjs.entry.js +1 -1
- package/dist/cjs/bs-ai-thinking.cjs.entry.js +1 -1
- package/dist/cjs/bs-attachment-list.cjs.entry.js +1 -1
- package/dist/cjs/bs-breadcrumbs.cjs.entry.js +1 -1
- package/dist/cjs/bs-button-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/bs-chatbot-feedback.cjs.entry.js +1 -1
- package/dist/cjs/bs-chatbot-header.cjs.entry.js +1 -1
- package/dist/cjs/bs-chatbot-response-action.cjs.entry.js +1 -1
- package/dist/cjs/bs-chatbot-sources-drawer.cjs.entry.js +1 -1
- package/dist/cjs/bs-chatbot-suggestion-button.cjs.entry.js +1 -1
- package/dist/cjs/bs-checkbox-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/bs-datepicker.cjs.entry.js +410 -0
- package/dist/cjs/bs-file-upload-item.cjs.entry.js +1 -1
- package/dist/cjs/bs-file-upload.cjs.entry.js +1 -1
- package/dist/cjs/bs-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/bs-inline-tab.cjs.entry.js +1 -1
- package/dist/cjs/{bs-input.cjs.entry.js → bs-input_2.cjs.entry.js} +37 -4
- package/dist/cjs/bs-menu.cjs.entry.js +1 -1
- package/dist/cjs/bs-navigation-drawer-item.cjs.entry.js +1 -1
- package/dist/cjs/bs-navigation-drawer.cjs.entry.js +2 -2
- package/dist/cjs/bs-navigation-header.cjs.entry.js +1 -1
- package/dist/cjs/bs-pagination.cjs.entry.js +1 -1
- package/dist/cjs/bs-progress-linear.cjs.entry.js +2 -2
- package/dist/cjs/bs-progress.cjs.entry.js +2 -2
- package/dist/cjs/bs-radio.cjs.entry.js +1 -1
- package/dist/cjs/bs-slider.cjs.entry.js +1 -1
- package/dist/cjs/bs-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/bs-source-link.cjs.entry.js +2 -2
- package/dist/cjs/bs-stepper-step.cjs.entry.js +1 -1
- package/dist/cjs/bs-stepper.cjs.entry.js +1 -1
- package/dist/cjs/bs-switch.cjs.entry.js +1 -1
- package/dist/cjs/bs-tab.cjs.entry.js +1 -1
- package/dist/cjs/bs-tabs.cjs.entry.js +1 -1
- package/dist/cjs/bs-timepicker.cjs.entry.js +209 -0
- package/dist/cjs/bs-toast.cjs.entry.js +1 -1
- package/dist/cjs/bs-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/bs-a11y.cmp.test.js +4 -0
- package/dist/collection/components/bs-ai-disclaimer/bs-ai-disclaimer.js +1 -1
- package/dist/collection/components/bs-ai-greeting/bs-ai-greeting.js +1 -1
- package/dist/collection/components/bs-ai-thinking/bs-ai-thinking.js +1 -1
- package/dist/collection/components/bs-attachment-list/bs-attachment-list.js +1 -1
- package/dist/collection/components/bs-breadcrumb/bs-breadcrumbs/bs-breadcrumbs.js +1 -1
- package/dist/collection/components/bs-button/bs-icon-button/bs-icon-button.js +1 -1
- package/dist/collection/components/bs-button-skeleton/bs-button-skeleton.js +1 -1
- package/dist/collection/components/bs-chatbot-feedback/bs-chatbot-feedback.js +1 -1
- package/dist/collection/components/bs-chatbot-header/bs-chatbot-header.js +1 -1
- package/dist/collection/components/bs-chatbot-response-action/bs-chatbot-response-action.js +1 -1
- package/dist/collection/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.js +1 -1
- package/dist/collection/components/bs-chatbot-suggestion-button/bs-chatbot-suggestion-button.js +1 -1
- package/dist/collection/components/bs-checkbox/bs-checkbox-skeleton/bs-checkbox-skeleton.js +1 -1
- package/dist/collection/components/bs-datepicker/bs-datepicker.cmp.test.js +182 -0
- package/dist/collection/components/bs-datepicker/bs-datepicker.css +315 -0
- package/dist/collection/components/bs-datepicker/bs-datepicker.js +782 -0
- package/dist/collection/components/bs-datepicker/bs-datepicker.stories.js +63 -0
- package/dist/collection/components/bs-file-upload/bs-file-upload.js +1 -1
- package/dist/collection/components/bs-file-upload-item/bs-file-upload-item.js +1 -1
- package/dist/collection/components/bs-input/bs-input.js +7 -4
- package/dist/collection/components/bs-menu/bs-menu.js +1 -1
- package/dist/collection/components/bs-menu-item/bs-menu-item.js +1 -1
- package/dist/collection/components/bs-pagination/bs-pagination.js +1 -1
- package/dist/collection/components/bs-progress/bs-progress.js +2 -2
- package/dist/collection/components/bs-progress-linear/bs-progress-linear.js +2 -2
- package/dist/collection/components/bs-radio/bs-radio.js +1 -1
- package/dist/collection/components/bs-slider/bs-slider.js +1 -1
- package/dist/collection/components/bs-snackbar/bs-snackbar.js +1 -1
- package/dist/collection/components/bs-source-link/bs-source-link.js +2 -2
- package/dist/collection/components/bs-stepper/bs-stepper/bs-stepper.js +1 -1
- package/dist/collection/components/bs-stepper/bs-stepper-step/bs-stepper-step.js +1 -1
- package/dist/collection/components/bs-switch/bs-switch.js +1 -1
- package/dist/collection/components/bs-tab/bs-inline-tab/bs-inline-tab.js +1 -1
- package/dist/collection/components/bs-tab/bs-tab/bs-tab.js +1 -1
- package/dist/collection/components/bs-tab/bs-tabs/bs-tabs.js +1 -1
- package/dist/collection/components/bs-timepicker/bs-timepicker.cmp.test.js +141 -0
- package/dist/collection/components/bs-timepicker/bs-timepicker.css +200 -0
- package/dist/collection/components/bs-timepicker/bs-timepicker.js +509 -0
- package/dist/collection/components/bs-timepicker/bs-timepicker.stories.js +44 -0
- package/dist/collection/components/bs-toast/bs-toast.js +1 -1
- package/dist/collection/components/bs-tooltip/bs-tooltip.js +1 -1
- package/dist/collection/components/ui-shell/bs-navigation-drawer/bs-navigation-drawer/bs-navigation-drawer.js +2 -2
- package/dist/collection/components/ui-shell/bs-navigation-drawer/bs-navigation-drawer-item/bs-navigation-drawer-item.js +1 -1
- package/dist/collection/components/ui-shell/bs-navigation-header/bs-navigation-header/bs-navigation-header.js +1 -1
- package/dist/components/bs-ai-disclaimer.js +1 -1
- package/dist/components/bs-ai-greeting.js +1 -1
- package/dist/components/bs-ai-thinking.js +1 -1
- package/dist/components/bs-attachment-list.js +1 -1
- package/dist/components/bs-attachment.js +1 -1
- package/dist/components/bs-breadcrumb-overflow.js +1 -1
- package/dist/components/bs-breadcrumbs.js +1 -1
- package/dist/components/bs-button-skeleton.js +1 -1
- package/dist/components/bs-carousel.js +1 -1
- package/dist/components/bs-chatbot-feedback.js +1 -1
- package/dist/components/bs-chatbot-header.js +1 -1
- package/dist/components/bs-chatbot-response-action.js +1 -1
- package/dist/components/bs-chatbot-sources-drawer.js +1 -1
- package/dist/components/bs-chatbot-suggestion-button.js +1 -1
- package/dist/components/bs-checkbox-skeleton.js +1 -1
- package/dist/components/bs-datepicker.d.ts +11 -0
- package/dist/components/bs-datepicker.js +1 -0
- package/dist/components/bs-dialog.js +1 -1
- package/dist/components/bs-file-upload-item.js +1 -1
- package/dist/components/bs-file-upload.js +1 -1
- package/dist/components/bs-icon-button.js +1 -1
- package/dist/components/bs-inline-tab.js +1 -1
- package/dist/components/bs-input.js +1 -1
- package/dist/components/bs-menu-item.js +1 -1
- package/dist/components/bs-menu.js +1 -1
- package/dist/components/bs-navigation-drawer-item.js +1 -1
- package/dist/components/bs-navigation-drawer.js +1 -1
- package/dist/components/bs-navigation-header.js +1 -1
- package/dist/components/bs-pagination.js +1 -1
- package/dist/components/bs-progress-linear.js +1 -1
- package/dist/components/bs-progress.js +1 -1
- package/dist/components/bs-radio.js +1 -1
- package/dist/components/bs-slider.js +1 -1
- package/dist/components/bs-snackbar.js +1 -1
- package/dist/components/bs-source-link.js +1 -1
- package/dist/components/bs-stepper-step.js +1 -1
- package/dist/components/bs-stepper.js +1 -1
- package/dist/components/bs-switch.js +1 -1
- package/dist/components/bs-tab.js +1 -1
- package/dist/components/bs-tabs.js +1 -1
- package/dist/components/bs-timepicker.d.ts +11 -0
- package/dist/components/bs-timepicker.js +1 -0
- package/dist/components/bs-toast.js +1 -1
- package/dist/components/bs-tooltip.js +1 -1
- package/dist/components/{p-BA3c9Rom.js → p-B7Icv1ho.js} +1 -1
- package/dist/components/{p-wei0Ija2.js → p-BTvme8CE.js} +1 -1
- package/dist/components/{p-BoeorHNv.js → p-BYR_ZC8v.js} +1 -1
- package/dist/components/p-Ba860ej1.js +1 -0
- package/dist/components/p-CPvqZNO8.js +1 -0
- package/dist/components/{p-EtXc94lJ.js → p-DkIVyFOP.js} +1 -1
- package/dist/components/{p-BfEyD6Ku.js → p-ZK8p5zax.js} +1 -1
- package/dist/components/p-jDO25SfF.js +1 -0
- package/dist/esm/brandsync-wc.js +1 -1
- package/dist/esm/bs-ai-disclaimer.entry.js +1 -1
- package/dist/esm/bs-ai-greeting.entry.js +1 -1
- package/dist/esm/bs-ai-thinking.entry.js +1 -1
- package/dist/esm/bs-attachment-list.entry.js +1 -1
- package/dist/esm/bs-breadcrumbs.entry.js +1 -1
- package/dist/esm/bs-button-skeleton.entry.js +1 -1
- package/dist/esm/bs-chatbot-feedback.entry.js +1 -1
- package/dist/esm/bs-chatbot-header.entry.js +1 -1
- package/dist/esm/bs-chatbot-response-action.entry.js +1 -1
- package/dist/esm/bs-chatbot-sources-drawer.entry.js +1 -1
- package/dist/esm/bs-chatbot-suggestion-button.entry.js +1 -1
- package/dist/esm/bs-checkbox-skeleton.entry.js +1 -1
- package/dist/esm/bs-datepicker.entry.js +408 -0
- package/dist/esm/bs-file-upload-item.entry.js +1 -1
- package/dist/esm/bs-file-upload.entry.js +1 -1
- package/dist/esm/bs-icon-button.entry.js +1 -1
- package/dist/esm/bs-inline-tab.entry.js +1 -1
- package/dist/esm/{bs-input.entry.js → bs-input_2.entry.js} +37 -5
- package/dist/esm/bs-menu.entry.js +1 -1
- package/dist/esm/bs-navigation-drawer-item.entry.js +1 -1
- package/dist/esm/bs-navigation-drawer.entry.js +2 -2
- package/dist/esm/bs-navigation-header.entry.js +1 -1
- package/dist/esm/bs-pagination.entry.js +1 -1
- package/dist/esm/bs-progress-linear.entry.js +2 -2
- package/dist/esm/bs-progress.entry.js +2 -2
- package/dist/esm/bs-radio.entry.js +1 -1
- package/dist/esm/bs-slider.entry.js +1 -1
- package/dist/esm/bs-snackbar.entry.js +1 -1
- package/dist/esm/bs-source-link.entry.js +2 -2
- package/dist/esm/bs-stepper-step.entry.js +1 -1
- package/dist/esm/bs-stepper.entry.js +1 -1
- package/dist/esm/bs-switch.entry.js +1 -1
- package/dist/esm/bs-tab.entry.js +1 -1
- package/dist/esm/bs-tabs.entry.js +1 -1
- package/dist/esm/bs-timepicker.entry.js +207 -0
- package/dist/esm/bs-toast.entry.js +1 -1
- package/dist/esm/bs-tooltip.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/bs-datepicker/bs-datepicker.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-datepicker/bs-datepicker.d.ts +136 -0
- package/dist/types/components/bs-datepicker/bs-datepicker.stories.d.ts +20 -0
- package/dist/types/components/bs-timepicker/bs-timepicker.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-timepicker/bs-timepicker.d.ts +101 -0
- package/dist/types/components/bs-timepicker/bs-timepicker.stories.d.ts +14 -0
- package/dist/types/components.d.ts +515 -0
- package/package.json +1 -1
- package/dist/brandsync-wc/p-7b00dd36.entry.js +0 -1
- package/dist/brandsync-wc/p-ae978c9a.entry.js +0 -1
- package/dist/brandsync-wc/p-c10d2529.entry.js +0 -1
- package/dist/cjs/bs-menu-item.cjs.entry.js +0 -34
- package/dist/components/p-Buly0d5G.js +0 -1
- package/dist/esm/bs-menu-item.entry.js +0 -32
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* An inline time picker: hour and minute spinners (up/down carets, or the arrow keys on the value),
|
|
4
|
+
* an AM/PM dropdown in 12-hour mode, a 24h switch, and Cancel/Confirm buttons. Matches the Figma
|
|
5
|
+
* "Time picker" component's two formats (12h with AM/PM, and 24h).
|
|
6
|
+
*
|
|
7
|
+
* The picker works on a draft: nothing is committed until the user presses Confirm, which updates
|
|
8
|
+
* `value` and fires `bsChange`. Cancel discards the draft and fires `bsCancel`.
|
|
9
|
+
*
|
|
10
|
+
* `value` is always 24-hour `HH:mm` (e.g. `"14:30"`), regardless of the displayed `format`.
|
|
11
|
+
*
|
|
12
|
+
* The picker renders inline at a fixed width; to show it as a popover, put it in your own overlay
|
|
13
|
+
* and close that overlay from `bsChange`/`bsCancel`.
|
|
14
|
+
*
|
|
15
|
+
* ## When to use
|
|
16
|
+
* - Picking a time of day where the user steps through hours and minutes.
|
|
17
|
+
*
|
|
18
|
+
* ## When not to use
|
|
19
|
+
* - A time the user can type faster than step to -- a plain `bs-input` is quicker.
|
|
20
|
+
*
|
|
21
|
+
* ## Keyboard
|
|
22
|
+
* Tab to the hour or minute value, then ArrowUp/ArrowDown step it (wrapping), Home/End jump to the
|
|
23
|
+
* first/last value, and typing digits sets it directly.
|
|
24
|
+
*
|
|
25
|
+
* @part container - The outer card.
|
|
26
|
+
* @part header - The title row.
|
|
27
|
+
* @part title - The heading text.
|
|
28
|
+
* @part format-toggle - The 24h switch.
|
|
29
|
+
* @part selector - The row of spinners.
|
|
30
|
+
* @part spinner - Each hour/minute column.
|
|
31
|
+
* @part step - Each up/down caret button.
|
|
32
|
+
* @part value - Each hour/minute value (a `spinbutton`).
|
|
33
|
+
* @part separator - The colon between hours and minutes.
|
|
34
|
+
* @part period - The AM/PM dropdown (12h only).
|
|
35
|
+
* @part footer - The Cancel/Confirm row.
|
|
36
|
+
* @part cancel - The Cancel button.
|
|
37
|
+
* @part confirm - The Confirm button.
|
|
38
|
+
*/
|
|
39
|
+
export class BsTimepicker {
|
|
40
|
+
el;
|
|
41
|
+
internals;
|
|
42
|
+
initialValue = '';
|
|
43
|
+
typed = '';
|
|
44
|
+
/** The `name` the confirmed value is submitted under in a surrounding `<form>`. */
|
|
45
|
+
name;
|
|
46
|
+
/** The confirmed time, 24-hour `HH:mm`. Empty means no time chosen yet (the picker opens on
|
|
47
|
+
* 00:00). Mutable so Confirm updates it directly; `bsChange` still fires. */
|
|
48
|
+
value = '';
|
|
49
|
+
/** Display format: `12h` (with an AM/PM dropdown) or `24h`. The user can switch it with the
|
|
50
|
+
* 24h switch. Does not change `value`, which is always 24-hour. */
|
|
51
|
+
format = '12h';
|
|
52
|
+
/** Step, in minutes, of the minute spinner's carets and arrow keys. Typing is not constrained. */
|
|
53
|
+
minuteStep = 1;
|
|
54
|
+
/** Heading text. */
|
|
55
|
+
heading = 'Select Time';
|
|
56
|
+
/** Label of the 24h switch. */
|
|
57
|
+
formatLabel = '24h';
|
|
58
|
+
/** Label of the Confirm button. */
|
|
59
|
+
confirmLabel = 'Confirm';
|
|
60
|
+
/** Label of the Cancel button. */
|
|
61
|
+
cancelLabel = 'Cancel';
|
|
62
|
+
/** Accessible name of the hour spinner. */
|
|
63
|
+
hourLabel = 'Hour';
|
|
64
|
+
/** Accessible name of the minute spinner. */
|
|
65
|
+
minuteLabel = 'Minute';
|
|
66
|
+
/** Accessible name of the AM/PM dropdown. */
|
|
67
|
+
periodLabel = 'AM/PM';
|
|
68
|
+
/** Fires when the user presses Confirm: `{ value }` as 24-hour `HH:mm`. Not fired when `value` is
|
|
69
|
+
* set programmatically. */
|
|
70
|
+
bsChange;
|
|
71
|
+
/** Fires when the user presses Cancel. The draft is reset to `value`. */
|
|
72
|
+
bsCancel;
|
|
73
|
+
/** Draft hour, 0-23. */
|
|
74
|
+
hour = 0;
|
|
75
|
+
/** Draft minute, 0-59. */
|
|
76
|
+
minute = 0;
|
|
77
|
+
componentWillLoad() {
|
|
78
|
+
this.initialValue = this.value;
|
|
79
|
+
this.resetDraft();
|
|
80
|
+
this.syncFormValue();
|
|
81
|
+
}
|
|
82
|
+
onValueChange() {
|
|
83
|
+
this.resetDraft();
|
|
84
|
+
this.syncFormValue();
|
|
85
|
+
}
|
|
86
|
+
onNameChange() {
|
|
87
|
+
this.syncFormValue();
|
|
88
|
+
}
|
|
89
|
+
/** Called by the browser when the surrounding `<form>` is reset. */
|
|
90
|
+
formResetCallback() {
|
|
91
|
+
this.value = this.initialValue;
|
|
92
|
+
}
|
|
93
|
+
resetDraft() {
|
|
94
|
+
const t = parseTime(this.value);
|
|
95
|
+
this.hour = t ? t.hour : 0;
|
|
96
|
+
this.minute = t ? t.minute : 0;
|
|
97
|
+
}
|
|
98
|
+
syncFormValue() {
|
|
99
|
+
if (!this.internals?.setFormValue)
|
|
100
|
+
return;
|
|
101
|
+
this.internals.setFormValue(this.value ?? '');
|
|
102
|
+
}
|
|
103
|
+
get step() {
|
|
104
|
+
const n = Math.trunc(Number(this.minuteStep));
|
|
105
|
+
return Number.isFinite(n) && n >= 1 && n <= 59 ? n : 1;
|
|
106
|
+
}
|
|
107
|
+
get is12h() {
|
|
108
|
+
return this.format !== '24h';
|
|
109
|
+
}
|
|
110
|
+
get isPm() {
|
|
111
|
+
return this.hour >= 12;
|
|
112
|
+
}
|
|
113
|
+
// --- stepping ----------------------------------------------------------------------------
|
|
114
|
+
/** The number shown in a column. In 12h mode the hour reads 1-12. */
|
|
115
|
+
shown(col) {
|
|
116
|
+
if (col === 'minute')
|
|
117
|
+
return this.minute;
|
|
118
|
+
return this.is12h ? this.hour % 12 || 12 : this.hour;
|
|
119
|
+
}
|
|
120
|
+
bounds(col) {
|
|
121
|
+
if (col === 'minute')
|
|
122
|
+
return [0, 59];
|
|
123
|
+
return this.is12h ? [1, 12] : [0, 23];
|
|
124
|
+
}
|
|
125
|
+
setShown(col, n) {
|
|
126
|
+
if (col === 'minute') {
|
|
127
|
+
this.minute = n;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
// 12h keeps the current AM/PM; 12 AM is hour 0 and 12 PM is hour 12.
|
|
131
|
+
this.hour = this.is12h ? (n % 12) + (this.isPm ? 12 : 0) : n;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
stepBy(col, dir) {
|
|
135
|
+
const [min, max] = this.bounds(col);
|
|
136
|
+
const size = max - min + 1;
|
|
137
|
+
const by = col === 'minute' ? this.step : 1;
|
|
138
|
+
let next = this.shown(col) + dir * by;
|
|
139
|
+
if (col === 'minute') {
|
|
140
|
+
// Snap onto the step grid when leaving an off-grid value (e.g. typed 07 with step 15).
|
|
141
|
+
const cur = this.shown(col);
|
|
142
|
+
next = dir === 1 ? Math.floor(cur / by) * by + by : Math.ceil(cur / by) * by - by;
|
|
143
|
+
}
|
|
144
|
+
this.setShown(col, ((((next - min) % size) + size) % size) + min);
|
|
145
|
+
}
|
|
146
|
+
onKeyDown = (col) => (ev) => {
|
|
147
|
+
const [min, max] = this.bounds(col);
|
|
148
|
+
if (ev.key === 'ArrowUp')
|
|
149
|
+
this.stepBy(col, 1);
|
|
150
|
+
else if (ev.key === 'ArrowDown')
|
|
151
|
+
this.stepBy(col, -1);
|
|
152
|
+
else if (ev.key === 'Home')
|
|
153
|
+
this.setShown(col, min);
|
|
154
|
+
else if (ev.key === 'End')
|
|
155
|
+
this.setShown(col, max);
|
|
156
|
+
else if (/^\d$/.test(ev.key)) {
|
|
157
|
+
// Two digits make a value; a lone digit that can't start a valid two-digit value commits
|
|
158
|
+
// immediately.
|
|
159
|
+
const candidate = Number((this.typed + ev.key).slice(-2));
|
|
160
|
+
this.typed = (this.typed + ev.key).slice(-2);
|
|
161
|
+
if (candidate >= min && candidate <= max)
|
|
162
|
+
this.setShown(col, candidate);
|
|
163
|
+
else {
|
|
164
|
+
this.typed = ev.key;
|
|
165
|
+
const single = Number(ev.key);
|
|
166
|
+
if (single >= min && single <= max)
|
|
167
|
+
this.setShown(col, single);
|
|
168
|
+
}
|
|
169
|
+
if (this.typed.length === 2)
|
|
170
|
+
this.typed = '';
|
|
171
|
+
ev.preventDefault();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
else
|
|
175
|
+
return;
|
|
176
|
+
this.typed = '';
|
|
177
|
+
ev.preventDefault();
|
|
178
|
+
};
|
|
179
|
+
// --- actions -----------------------------------------------------------------------------
|
|
180
|
+
confirm = () => {
|
|
181
|
+
const value = `${pad(this.hour)}:${pad(this.minute)}`;
|
|
182
|
+
this.value = value;
|
|
183
|
+
this.bsChange.emit({ value });
|
|
184
|
+
};
|
|
185
|
+
cancel = () => {
|
|
186
|
+
this.resetDraft();
|
|
187
|
+
this.bsCancel.emit();
|
|
188
|
+
};
|
|
189
|
+
// --- rendering ---------------------------------------------------------------------------
|
|
190
|
+
renderColumn(col, label) {
|
|
191
|
+
const [min, max] = this.bounds(col);
|
|
192
|
+
const n = this.shown(col);
|
|
193
|
+
const stepLabel = (dir) => `${dir} ${label.toLowerCase()}`;
|
|
194
|
+
return (h("div", { part: "spinner", class: "bs-timepicker__spinner" }, h("button", { part: "step", type: "button", class: "bs-timepicker__step", "aria-label": stepLabel('Increase'), tabindex: -1, onClick: () => this.stepBy(col, 1) }, h("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true" }, h("path", { d: "M18 15L12 9L6 15", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }))), h("div", { part: "value", class: "bs-timepicker__value", role: "spinbutton", tabindex: 0, "aria-label": label, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": n, "aria-valuetext": pad(n), onKeyDown: this.onKeyDown(col), onBlur: () => (this.typed = '') }, pad(n)), h("button", { part: "step", type: "button", class: "bs-timepicker__step", "aria-label": stepLabel('Decrease'), tabindex: -1, onClick: () => this.stepBy(col, -1) }, h("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true" }, h("path", { d: "M6 9L12 15L18 9", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })))));
|
|
195
|
+
}
|
|
196
|
+
render() {
|
|
197
|
+
return (h("div", { key: 'a2e5fe098763d32468ffc0bdd3c2df153385dfd7', part: "container", class: "bs-timepicker" }, h("div", { key: 'd7a3bcdb9585480d2f58b27d8499f6ef9c8d21e0', part: "header", class: "bs-timepicker__header" }, h("div", { key: '6183e6243df377936ddc2d5a92238720efc7a671', part: "title", class: "bs-timepicker__title" }, this.heading), h("label", { key: '4e95425e9f67d6575ef9572a9c385b9a5c887359', class: "bs-timepicker__format" }, h("span", { key: '29771986229fd68af07078e3528a12d75f4a5794' }, this.formatLabel), h("bs-switch", { key: '946ea660ff659d71ca2c3e024bff8eb05afdcfe8', part: "format-toggle", size: "md", ariaLabel: this.formatLabel, checked: !this.is12h, onBsChange: (ev) => (this.format = ev.detail ? '24h' : '12h') }))), h("div", { key: 'e6367ea101ae0981224129bc6c70c7bf5d2b6db9', class: "bs-timepicker__divider" }), h("div", { key: '20ab9cfd9702dae8bf097de642e61439489f6fb5', part: "selector", class: "bs-timepicker__selector" }, this.renderColumn('hour', this.hourLabel), h("div", { key: '5780f3fb2eb6f5b2e6d29ed4cd1585190051e3fd', part: "separator", class: "bs-timepicker__separator", "aria-hidden": "true" }, h("svg", { key: 'd35956df0f6f18f1472cc720f4ab876bbc41e515', viewBox: "0 0 4 32", fill: "currentColor" }, h("circle", { key: '4e6083df833bc3bf6390c80d7911219e61a51d37', cx: "2", cy: "10", r: "2" }), h("circle", { key: 'e3dea9bb879e7b4b09b9d37a0becbfd54f803169', cx: "2", cy: "22", r: "2" }))), this.renderColumn('minute', this.minuteLabel), this.is12h && (h("bs-input", { key: 'a9fb9ef6ff16d5c3f4aa4e067e3795a7ddc7d1e7', part: "period", class: "bs-timepicker__period", type: "dropdown", label: this.periodLabel, value: this.isPm ? 'PM' : 'AM', options: [
|
|
198
|
+
{ label: 'AM', value: 'AM' },
|
|
199
|
+
{ label: 'PM', value: 'PM' },
|
|
200
|
+
], onBsChange: (ev) => {
|
|
201
|
+
const pm = ev.detail === 'PM';
|
|
202
|
+
if (pm !== this.isPm)
|
|
203
|
+
this.hour = (this.hour + 12) % 24;
|
|
204
|
+
} }))), h("div", { key: 'e4256dede407bec46c5da8e967001472ccd0f49b', class: "bs-timepicker__divider" }), h("div", { key: '9be6cade11a25c92c77f4313827f49ee8d89dfb4', part: "footer", class: "bs-timepicker__footer" }, h("bs-button", { key: '6ded59a284b389b5e4a259b1a238296ec83d6c27', part: "cancel", variant: "subtle", onClick: this.cancel }, this.cancelLabel), h("bs-button", { key: 'e1f566c9c34b3371783206910d91a9d49f8cdc41', part: "confirm", variant: "primary", onClick: this.confirm }, this.confirmLabel))));
|
|
205
|
+
}
|
|
206
|
+
static get is() { return "bs-timepicker"; }
|
|
207
|
+
static get encapsulation() { return "shadow"; }
|
|
208
|
+
static get formAssociated() { return true; }
|
|
209
|
+
static get originalStyleUrls() {
|
|
210
|
+
return {
|
|
211
|
+
"$": ["bs-timepicker.css"]
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
static get styleUrls() {
|
|
215
|
+
return {
|
|
216
|
+
"$": ["bs-timepicker.css"]
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
static get properties() {
|
|
220
|
+
return {
|
|
221
|
+
"name": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"mutable": false,
|
|
224
|
+
"complexType": {
|
|
225
|
+
"original": "string",
|
|
226
|
+
"resolved": "string",
|
|
227
|
+
"references": {}
|
|
228
|
+
},
|
|
229
|
+
"required": false,
|
|
230
|
+
"optional": true,
|
|
231
|
+
"docs": {
|
|
232
|
+
"tags": [],
|
|
233
|
+
"text": "The `name` the confirmed value is submitted under in a surrounding `<form>`."
|
|
234
|
+
},
|
|
235
|
+
"getter": false,
|
|
236
|
+
"setter": false,
|
|
237
|
+
"reflect": true,
|
|
238
|
+
"attribute": "name"
|
|
239
|
+
},
|
|
240
|
+
"value": {
|
|
241
|
+
"type": "string",
|
|
242
|
+
"mutable": true,
|
|
243
|
+
"complexType": {
|
|
244
|
+
"original": "string",
|
|
245
|
+
"resolved": "string",
|
|
246
|
+
"references": {}
|
|
247
|
+
},
|
|
248
|
+
"required": false,
|
|
249
|
+
"optional": false,
|
|
250
|
+
"docs": {
|
|
251
|
+
"tags": [],
|
|
252
|
+
"text": "The confirmed time, 24-hour `HH:mm`. Empty means no time chosen yet (the picker opens on\n00:00). Mutable so Confirm updates it directly; `bsChange` still fires."
|
|
253
|
+
},
|
|
254
|
+
"getter": false,
|
|
255
|
+
"setter": false,
|
|
256
|
+
"reflect": true,
|
|
257
|
+
"attribute": "value",
|
|
258
|
+
"defaultValue": "''"
|
|
259
|
+
},
|
|
260
|
+
"format": {
|
|
261
|
+
"type": "string",
|
|
262
|
+
"mutable": true,
|
|
263
|
+
"complexType": {
|
|
264
|
+
"original": "'12h' | '24h'",
|
|
265
|
+
"resolved": "\"12h\" | \"24h\"",
|
|
266
|
+
"references": {}
|
|
267
|
+
},
|
|
268
|
+
"required": false,
|
|
269
|
+
"optional": false,
|
|
270
|
+
"docs": {
|
|
271
|
+
"tags": [],
|
|
272
|
+
"text": "Display format: `12h` (with an AM/PM dropdown) or `24h`. The user can switch it with the\n24h switch. Does not change `value`, which is always 24-hour."
|
|
273
|
+
},
|
|
274
|
+
"getter": false,
|
|
275
|
+
"setter": false,
|
|
276
|
+
"reflect": true,
|
|
277
|
+
"attribute": "format",
|
|
278
|
+
"defaultValue": "'12h'"
|
|
279
|
+
},
|
|
280
|
+
"minuteStep": {
|
|
281
|
+
"type": "number",
|
|
282
|
+
"mutable": false,
|
|
283
|
+
"complexType": {
|
|
284
|
+
"original": "number",
|
|
285
|
+
"resolved": "number",
|
|
286
|
+
"references": {}
|
|
287
|
+
},
|
|
288
|
+
"required": false,
|
|
289
|
+
"optional": false,
|
|
290
|
+
"docs": {
|
|
291
|
+
"tags": [],
|
|
292
|
+
"text": "Step, in minutes, of the minute spinner's carets and arrow keys. Typing is not constrained."
|
|
293
|
+
},
|
|
294
|
+
"getter": false,
|
|
295
|
+
"setter": false,
|
|
296
|
+
"reflect": false,
|
|
297
|
+
"attribute": "minute-step",
|
|
298
|
+
"defaultValue": "1"
|
|
299
|
+
},
|
|
300
|
+
"heading": {
|
|
301
|
+
"type": "string",
|
|
302
|
+
"mutable": false,
|
|
303
|
+
"complexType": {
|
|
304
|
+
"original": "string",
|
|
305
|
+
"resolved": "string",
|
|
306
|
+
"references": {}
|
|
307
|
+
},
|
|
308
|
+
"required": false,
|
|
309
|
+
"optional": false,
|
|
310
|
+
"docs": {
|
|
311
|
+
"tags": [],
|
|
312
|
+
"text": "Heading text."
|
|
313
|
+
},
|
|
314
|
+
"getter": false,
|
|
315
|
+
"setter": false,
|
|
316
|
+
"reflect": false,
|
|
317
|
+
"attribute": "heading",
|
|
318
|
+
"defaultValue": "'Select Time'"
|
|
319
|
+
},
|
|
320
|
+
"formatLabel": {
|
|
321
|
+
"type": "string",
|
|
322
|
+
"mutable": false,
|
|
323
|
+
"complexType": {
|
|
324
|
+
"original": "string",
|
|
325
|
+
"resolved": "string",
|
|
326
|
+
"references": {}
|
|
327
|
+
},
|
|
328
|
+
"required": false,
|
|
329
|
+
"optional": false,
|
|
330
|
+
"docs": {
|
|
331
|
+
"tags": [],
|
|
332
|
+
"text": "Label of the 24h switch."
|
|
333
|
+
},
|
|
334
|
+
"getter": false,
|
|
335
|
+
"setter": false,
|
|
336
|
+
"reflect": false,
|
|
337
|
+
"attribute": "format-label",
|
|
338
|
+
"defaultValue": "'24h'"
|
|
339
|
+
},
|
|
340
|
+
"confirmLabel": {
|
|
341
|
+
"type": "string",
|
|
342
|
+
"mutable": false,
|
|
343
|
+
"complexType": {
|
|
344
|
+
"original": "string",
|
|
345
|
+
"resolved": "string",
|
|
346
|
+
"references": {}
|
|
347
|
+
},
|
|
348
|
+
"required": false,
|
|
349
|
+
"optional": false,
|
|
350
|
+
"docs": {
|
|
351
|
+
"tags": [],
|
|
352
|
+
"text": "Label of the Confirm button."
|
|
353
|
+
},
|
|
354
|
+
"getter": false,
|
|
355
|
+
"setter": false,
|
|
356
|
+
"reflect": false,
|
|
357
|
+
"attribute": "confirm-label",
|
|
358
|
+
"defaultValue": "'Confirm'"
|
|
359
|
+
},
|
|
360
|
+
"cancelLabel": {
|
|
361
|
+
"type": "string",
|
|
362
|
+
"mutable": false,
|
|
363
|
+
"complexType": {
|
|
364
|
+
"original": "string",
|
|
365
|
+
"resolved": "string",
|
|
366
|
+
"references": {}
|
|
367
|
+
},
|
|
368
|
+
"required": false,
|
|
369
|
+
"optional": false,
|
|
370
|
+
"docs": {
|
|
371
|
+
"tags": [],
|
|
372
|
+
"text": "Label of the Cancel button."
|
|
373
|
+
},
|
|
374
|
+
"getter": false,
|
|
375
|
+
"setter": false,
|
|
376
|
+
"reflect": false,
|
|
377
|
+
"attribute": "cancel-label",
|
|
378
|
+
"defaultValue": "'Cancel'"
|
|
379
|
+
},
|
|
380
|
+
"hourLabel": {
|
|
381
|
+
"type": "string",
|
|
382
|
+
"mutable": false,
|
|
383
|
+
"complexType": {
|
|
384
|
+
"original": "string",
|
|
385
|
+
"resolved": "string",
|
|
386
|
+
"references": {}
|
|
387
|
+
},
|
|
388
|
+
"required": false,
|
|
389
|
+
"optional": false,
|
|
390
|
+
"docs": {
|
|
391
|
+
"tags": [],
|
|
392
|
+
"text": "Accessible name of the hour spinner."
|
|
393
|
+
},
|
|
394
|
+
"getter": false,
|
|
395
|
+
"setter": false,
|
|
396
|
+
"reflect": false,
|
|
397
|
+
"attribute": "hour-label",
|
|
398
|
+
"defaultValue": "'Hour'"
|
|
399
|
+
},
|
|
400
|
+
"minuteLabel": {
|
|
401
|
+
"type": "string",
|
|
402
|
+
"mutable": false,
|
|
403
|
+
"complexType": {
|
|
404
|
+
"original": "string",
|
|
405
|
+
"resolved": "string",
|
|
406
|
+
"references": {}
|
|
407
|
+
},
|
|
408
|
+
"required": false,
|
|
409
|
+
"optional": false,
|
|
410
|
+
"docs": {
|
|
411
|
+
"tags": [],
|
|
412
|
+
"text": "Accessible name of the minute spinner."
|
|
413
|
+
},
|
|
414
|
+
"getter": false,
|
|
415
|
+
"setter": false,
|
|
416
|
+
"reflect": false,
|
|
417
|
+
"attribute": "minute-label",
|
|
418
|
+
"defaultValue": "'Minute'"
|
|
419
|
+
},
|
|
420
|
+
"periodLabel": {
|
|
421
|
+
"type": "string",
|
|
422
|
+
"mutable": false,
|
|
423
|
+
"complexType": {
|
|
424
|
+
"original": "string",
|
|
425
|
+
"resolved": "string",
|
|
426
|
+
"references": {}
|
|
427
|
+
},
|
|
428
|
+
"required": false,
|
|
429
|
+
"optional": false,
|
|
430
|
+
"docs": {
|
|
431
|
+
"tags": [],
|
|
432
|
+
"text": "Accessible name of the AM/PM dropdown."
|
|
433
|
+
},
|
|
434
|
+
"getter": false,
|
|
435
|
+
"setter": false,
|
|
436
|
+
"reflect": false,
|
|
437
|
+
"attribute": "period-label",
|
|
438
|
+
"defaultValue": "'AM/PM'"
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
static get states() {
|
|
443
|
+
return {
|
|
444
|
+
"hour": {},
|
|
445
|
+
"minute": {}
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
static get events() {
|
|
449
|
+
return [{
|
|
450
|
+
"method": "bsChange",
|
|
451
|
+
"name": "bsChange",
|
|
452
|
+
"bubbles": true,
|
|
453
|
+
"cancelable": true,
|
|
454
|
+
"composed": true,
|
|
455
|
+
"docs": {
|
|
456
|
+
"tags": [],
|
|
457
|
+
"text": "Fires when the user presses Confirm: `{ value }` as 24-hour `HH:mm`. Not fired when `value` is\nset programmatically."
|
|
458
|
+
},
|
|
459
|
+
"complexType": {
|
|
460
|
+
"original": "BsTimepickerChange",
|
|
461
|
+
"resolved": "BsTimepickerChange",
|
|
462
|
+
"references": {
|
|
463
|
+
"BsTimepickerChange": {
|
|
464
|
+
"location": "local",
|
|
465
|
+
"path": "/home/runner/work/eg-brandsync-storybook/eg-brandsync-storybook/packages/wc/src/components/bs-timepicker/bs-timepicker.tsx",
|
|
466
|
+
"id": "src/components/bs-timepicker/bs-timepicker.tsx::BsTimepickerChange"
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}, {
|
|
471
|
+
"method": "bsCancel",
|
|
472
|
+
"name": "bsCancel",
|
|
473
|
+
"bubbles": true,
|
|
474
|
+
"cancelable": true,
|
|
475
|
+
"composed": true,
|
|
476
|
+
"docs": {
|
|
477
|
+
"tags": [],
|
|
478
|
+
"text": "Fires when the user presses Cancel. The draft is reset to `value`."
|
|
479
|
+
},
|
|
480
|
+
"complexType": {
|
|
481
|
+
"original": "void",
|
|
482
|
+
"resolved": "void",
|
|
483
|
+
"references": {}
|
|
484
|
+
}
|
|
485
|
+
}];
|
|
486
|
+
}
|
|
487
|
+
static get elementRef() { return "el"; }
|
|
488
|
+
static get watchers() {
|
|
489
|
+
return [{
|
|
490
|
+
"propName": "value",
|
|
491
|
+
"methodName": "onValueChange"
|
|
492
|
+
}, {
|
|
493
|
+
"propName": "name",
|
|
494
|
+
"methodName": "onNameChange"
|
|
495
|
+
}];
|
|
496
|
+
}
|
|
497
|
+
static get attachInternalsMemberName() { return "internals"; }
|
|
498
|
+
}
|
|
499
|
+
function pad(n) {
|
|
500
|
+
return String(n).padStart(2, '0');
|
|
501
|
+
}
|
|
502
|
+
function parseTime(s) {
|
|
503
|
+
const m = /^(\d{1,2}):(\d{2})$/.exec((s ?? '').trim());
|
|
504
|
+
if (!m)
|
|
505
|
+
return undefined;
|
|
506
|
+
const hour = Number(m[1]);
|
|
507
|
+
const minute = Number(m[2]);
|
|
508
|
+
return hour <= 23 && minute <= 59 ? { hour, minute } : undefined;
|
|
509
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { componentDescription, propDescription } from "../../stories-utils";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Components/bs-timepicker',
|
|
5
|
+
parameters: { docs: { description: { component: componentDescription('bs-timepicker') } } },
|
|
6
|
+
render: args => html `
|
|
7
|
+
<bs-timepicker
|
|
8
|
+
value=${args.value}
|
|
9
|
+
format=${args.format}
|
|
10
|
+
minute-step=${args.minuteStep}
|
|
11
|
+
heading=${args.heading}
|
|
12
|
+
@bsChange=${(ev) => console.log('bsChange', ev.detail)}
|
|
13
|
+
@bsCancel=${() => console.log('bsCancel')}
|
|
14
|
+
></bs-timepicker>
|
|
15
|
+
`,
|
|
16
|
+
argTypes: {
|
|
17
|
+
value: { control: 'text', description: propDescription('bs-timepicker', 'value') },
|
|
18
|
+
format: { control: 'inline-radio', options: ['12h', '24h'], description: propDescription('bs-timepicker', 'format') },
|
|
19
|
+
minuteStep: { control: { type: 'number', min: 1, max: 59 }, description: propDescription('bs-timepicker', 'minuteStep') },
|
|
20
|
+
heading: { control: 'text', description: propDescription('bs-timepicker', 'heading') },
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
value: '',
|
|
24
|
+
format: '12h',
|
|
25
|
+
minuteStep: 1,
|
|
26
|
+
heading: 'Select Time',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export default meta;
|
|
30
|
+
// Figma "12h" format: hour and minute spinners plus an AM/PM dropdown.
|
|
31
|
+
export const Default = {};
|
|
32
|
+
// Figma "24h" format: the 24h switch on, no AM/PM.
|
|
33
|
+
export const TwentyFourHour = {
|
|
34
|
+
name: '24h',
|
|
35
|
+
args: { format: '24h' },
|
|
36
|
+
};
|
|
37
|
+
export const WithValue = {
|
|
38
|
+
name: 'With a value',
|
|
39
|
+
args: { value: '14:30' },
|
|
40
|
+
};
|
|
41
|
+
export const FifteenMinuteStep = {
|
|
42
|
+
name: '15-minute step',
|
|
43
|
+
args: { value: '09:00', minuteStep: 15 },
|
|
44
|
+
};
|
|
@@ -25,7 +25,7 @@ export class BsToast {
|
|
|
25
25
|
this.bsDismiss.emit();
|
|
26
26
|
};
|
|
27
27
|
render() {
|
|
28
|
-
return (h("div", { key: '
|
|
28
|
+
return (h("div", { key: 'e8da15f45d0491a0eb8568a8fc31e2b802cf30c3', part: "container", class: `bs-toast bs-toast--${this.state}`, role: "status", "aria-live": this.state === 'error' ? 'assertive' : 'polite' }, h("div", { key: '703099dfc85c56997a2cf6e5e86bd559d1a9d971', class: "bs-toast__content" }, h("span", { key: 'dacb887b5e7bdae27100399a80f9c2cc7a9970d6', part: "icon", class: "bs-toast__icon", "aria-hidden": "true" }, h(StateIcon, { key: '5d71c6abf0c68673c20de54162557a224cffd66b', state: this.state })), h("span", { key: '6587834edfbdf0188a8780ee0c5b93a572956da4', part: "message", class: "bs-toast__message" }, h("slot", { key: '559c2a397c140532185da397a7cab18f484fad19' }))), h("div", { key: '87f868f1b541432798de1f511f92091434c41e0f', class: "bs-toast__actions" }, h("button", { key: '6267c6dcc3114af0d9fecd250097416f80f661b1', part: "close", type: "button", class: "bs-toast__close", "aria-label": "Dismiss", onClick: this.onDismiss }, h(CloseIcon, { key: '8b6a5b9e2ce36d5cbbec7801df81fd125c7d0f27' })))));
|
|
29
29
|
}
|
|
30
30
|
static get is() { return "bs-toast"; }
|
|
31
31
|
static get encapsulation() { return "shadow"; }
|
|
@@ -42,7 +42,7 @@ export class BsTooltip {
|
|
|
42
42
|
*/
|
|
43
43
|
placement = 'top';
|
|
44
44
|
render() {
|
|
45
|
-
return (h("div", { key: '
|
|
45
|
+
return (h("div", { key: '6fdabb24080aa3e58a1054aa63f43878da2d0787', class: "bs-tooltip" }, h("span", { key: 'ec139068fd7714642215b47ffbd91318062cbb84', part: "arrow", class: "bs-tooltip__arrow" }), h("div", { key: 'c1e18985eeb5263b6faf9c14c1f6c93cfe6c1062', part: "bubble", class: "bs-tooltip__bubble" }, h("slot", { key: 'f521333b359cb1b30457753ee28379a064aeeae2' }))));
|
|
46
46
|
}
|
|
47
47
|
static get is() { return "bs-tooltip"; }
|
|
48
48
|
static get encapsulation() { return "shadow"; }
|
|
@@ -228,11 +228,11 @@ export class BsNavigationDrawer {
|
|
|
228
228
|
};
|
|
229
229
|
render() {
|
|
230
230
|
const classes = ['bs-navigation-drawer', this.mobile ? 'bs-navigation-drawer--overlay' : '', this.overlayOpen ? 'bs-navigation-drawer--open' : ''].filter(Boolean).join(' ');
|
|
231
|
-
return (h(Host, { key: '
|
|
231
|
+
return (h(Host, { key: 'c1e563e7b2a9474286671a3f6e1f2d3aed312620', "data-overlay": this.mobile ? '' : undefined }, this.mobile && h("div", { key: 'f6885e88df1607bb9e85a27c4e1cb616ce6b6c0d', part: "backdrop", class: "bs-navigation-drawer__backdrop", onClick: this.requestClose }), h("nav", { key: 'a3086b5203fd3724fce5fe82be394a77a6d9a1e1', ref: el => (this.navRef = el), class: classes, "aria-label": this.heading,
|
|
232
232
|
// Stays a plain <nav> landmark in every state: ARIA does not allow role="dialog" on <nav>
|
|
233
233
|
// (axe: aria-allowed-role). Modality is behavioral -- focus is held inside, the page behind is
|
|
234
234
|
// scrimmed, Escape closes -- rather than announced through aria-modal.
|
|
235
|
-
tabIndex: this.mobile ? -1 : undefined }, this.showLogo && (h("div", { key: '
|
|
235
|
+
tabIndex: this.mobile ? -1 : undefined }, this.showLogo && (h("div", { key: 'c1b8700d6936ae14acf900d3cc83c6a8a7d79a20', part: "logo", class: "bs-navigation-drawer__logo bs-navigation-drawer__logo--full" }, h("bs-logo", { key: '27f4205dcdd609c4709a09dbeb7d4d59a41340db', variant: "full", background: this.logoBackground }))), this.showLogo && (h("div", { key: 'b8474734a50dbd690a9a8d8febd6cda084498d02', part: "logo", class: "bs-navigation-drawer__logo bs-navigation-drawer__logo--mark" }, h("bs-logo", { key: 'c89909a16f7255d24ddaae54ddd2c6cfca361572', variant: "mark", background: this.logoBackground }))), h("div", { key: '83b7641c3c1f8b8307bf8006bbef147ccfdc917c', class: "bs-navigation-drawer__title-row" }, h("span", { key: '97075d0df805b02f3f520c42ef4eceaa377e7064', part: "title", class: "bs-navigation-drawer__title" }, this.heading), this.collapsible && (h("button", { key: '184f4f2f35f74f145621d2854a6a50e52006ebd1', type: "button", part: "collapse", class: "bs-navigation-drawer__collapse", "aria-label": this.collapsed ? 'Expand' : 'Collapse', "aria-pressed": this.collapsed ? 'true' : 'false', onClick: this.onCollapseClick }, h(CaretLeftIcon, { key: '168c4a4f30f9cf92afd5cffc63e989e0a3d4e45a' })))), h("div", { key: 'd93ec72e4f6ba6f01d4fdc8fc3d9e0c9f0649242', part: "search", class: "bs-navigation-drawer__search" }, h("slot", { key: '3441fb753d206b84e68bb777e60ec849185882b9', name: "search" })), h("button", { key: '98b3bf5e4807afb1ba5a91e2b5238d917f584ab8', type: "button", part: "search-trigger", class: "bs-navigation-drawer__search-trigger", "aria-label": "Search", onClick: this.onSearchTriggerClick }, h(SearchIcon, { key: 'c61c32465503084caab0b3741bc95e3f0f274214' })), h("div", { key: 'f75111a609795d6ed83e3e843a433440a932b730', part: "items", class: "bs-navigation-drawer__items" }, h("slot", { key: '50f7cee1ae4e352b56561740bfc6ff035d521354' })))));
|
|
236
236
|
}
|
|
237
237
|
static get is() { return "bs-navigation-drawer"; }
|
|
238
238
|
static get encapsulation() { return "shadow"; }
|
|
@@ -131,7 +131,7 @@ export class BsNavigationDrawerItem {
|
|
|
131
131
|
// incorrectly also toggle this parent row on every child click. Both are wrapped in a
|
|
132
132
|
// `display: contents` container so render() still returns a single root node (this codebase's
|
|
133
133
|
// convention, e.g. bs-input.tsx) without that wrapper affecting layout at all.
|
|
134
|
-
return (h("div", { key: '
|
|
134
|
+
return (h("div", { key: 'a62142391a3302dd6379135af11aa3215786df60', class: "bs-navigation-drawer-item__root" }, h("button", { key: '859f32bb1588ec661fea55d405a60a20e803b969', type: "button", part: "item", class: rowClasses, "aria-expanded": this.expandable ? String(this.expanded) : undefined, "aria-label": this.ariaLabel ?? undefined, onClick: this.onClick }, !this.nested && (h("span", { key: '0191eb506a8fa145732fb250d52d1ad650ea9a0f', part: "icon", class: `bs-navigation-drawer-item__icon ${this.hasIcon ? 'bs-navigation-drawer-item__icon--has-content' : ''}` }, h("slot", { key: '29bfc6b85d32172ac4f92ca482ffcbf71ed2158c', name: "icon", onSlotchange: this.onIconSlotchange }))), h("span", { key: 'd5e681c8dfc6b8517a01caea2daa49089ef73994', part: "label", class: "bs-navigation-drawer-item__label" }, h("slot", { key: '6f60e5831a064caae85747d6c6b735912abc9a3c' })), this.expandable && (h("span", { key: '37eebaa53518961ac10e37abe8a6f68e1066b173', part: "chevron", class: `bs-navigation-drawer-item__chevron ${this.expanded ? 'bs-navigation-drawer-item__chevron--expanded' : ''}` }, h(ChevronDownIcon, { key: '5c212defdf0226202d710f799dbf380aca087ff6' })))), this.expandable && (h("span", { key: 'abc9eb5ca2161706511b3691c71d5fedd33ee74f', part: "children", class: "bs-navigation-drawer-item__children" }, h("slot", { key: '9b501d624d2bd055e4a71848d08dfb7198e17ece', name: "children" })))));
|
|
135
135
|
}
|
|
136
136
|
static get is() { return "bs-navigation-drawer-item"; }
|
|
137
137
|
static get encapsulation() { return "shadow"; }
|
|
@@ -61,7 +61,7 @@ export class BsNavigationHeader {
|
|
|
61
61
|
render() {
|
|
62
62
|
const showLogo = this.alignment !== 'with-navigation-drawer';
|
|
63
63
|
const rootClasses = `bs-navigation-header bs-navigation-header--${this.alignment}`;
|
|
64
|
-
return (h("header", { key: '
|
|
64
|
+
return (h("header", { key: '8df6952f56af87f50c453d923d579a873565f340', class: rootClasses, "aria-label": this.ariaLabel ?? undefined }, this.skipToContentHref && (h("a", { key: 'fc18af20e2900ad6ae6c84e48bf34cbb1a5a256a', part: "skip-link", class: "bs-navigation-header__skip-link", href: this.skipToContentHref }, this.skipToContentLabel)), showLogo && (h("bs-logo", { key: '8b903db4bf61de487379378bf7ed241b7bfe588a', part: "logo", class: "bs-navigation-header__logo", variant: "full", background: this.logoBackground })), h("div", { key: '16db4c45690961fe6f362204f97969375a6fda7c', part: "left", class: "bs-navigation-header__left" }, h("slot", { key: '96b0d128230c694f104d1d0578d3dfb81cd3f3c1', name: "left" })), h("div", { key: 'e5250ad7e8ad58d0305ee5a41259704ec4a00a4a', part: "right", class: "bs-navigation-header__right" }, h("slot", { key: 'd2620bea8d01c0abc1751e44ed9bdd8e5ce36d6b', name: "right" }))));
|
|
65
65
|
}
|
|
66
66
|
static get is() { return "bs-navigation-header"; }
|
|
67
67
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as i,p as e,H as s,h as a}from"./p-JYlmcxBn.js";const t=e(class extends s{constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow()}render(){return a("div",{key:"
|
|
1
|
+
import{t as i,p as e,H as s,h as a}from"./p-JYlmcxBn.js";const t=e(class extends s{constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow()}render(){return a("div",{key:"94efc8f14ad853f5e04c5d0b1d7630138bb6a8f6",class:"bs-ai-disclaimer"},a("p",{key:"e19407ceb6f9dbf00f68eb120d1bb371683468c2",part:"text",class:"bs-ai-disclaimer__text"},a("slot",{key:"68148e0251aeb03d082c64315860a4a683bebad0"})))}static get style(){return":host{display:block;--bs-ai-disclaimer-padding-x:var(--bs-spacing-200);--bs-ai-disclaimer-text-color:var(--bs-text-secondary);--bs-ai-disclaimer-font-size:var(--bs-font-size-sm);--bs-ai-disclaimer-line-height:var(--bs-line-height-body-sm)}.bs-ai-disclaimer{box-sizing:border-box;display:flex;align-items:center;justify-content:center;padding:0 var(--bs-ai-disclaimer-padding-x);font-family:inherit}.bs-ai-disclaimer__text{margin:0;flex:1 0 0;min-width:0;color:var(--bs-ai-disclaimer-text-color);font-size:var(--bs-ai-disclaimer-font-size);line-height:calc(var(--bs-ai-disclaimer-line-height) * 1px);text-align:center;word-break:break-word}"}},[257,"bs-ai-disclaimer"]);function r(){"undefined"!=typeof customElements&&["bs-ai-disclaimer"].forEach((e=>{"bs-ai-disclaimer"===e&&(customElements.get(i(e))||customElements.define(i(e),t))}))}r();const c=t,d=r;export{c as BsAiDisclaimer,d as defineCustomElement}
|