@daikin-oss/design-system-web-components 0.2.0 → 0.3.2
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/CHANGELOG.md +44 -0
- package/README.md +47 -7
- package/dist/cjs/components/accordion/daikin-accordion.cjs +37 -0
- package/dist/cjs/components/accordion/daikin-accordion.d.ts +39 -0
- package/dist/cjs/components/accordion/index.cjs +7 -0
- package/dist/cjs/components/accordion/index.d.ts +1 -0
- package/dist/cjs/components/accordion-item/daikin-accordion-item.cjs +177 -0
- package/dist/cjs/components/accordion-item/daikin-accordion-item.d.ts +55 -0
- package/dist/cjs/components/accordion-item/index.cjs +7 -0
- package/dist/cjs/components/accordion-item/index.d.ts +1 -0
- package/dist/cjs/components/breadcrumb/daikin-breadcrumb.cjs +124 -0
- package/dist/cjs/components/breadcrumb/daikin-breadcrumb.d.ts +52 -0
- package/dist/cjs/components/breadcrumb/index.cjs +7 -0
- package/dist/cjs/components/breadcrumb/index.d.ts +1 -0
- package/dist/cjs/components/breadcrumb-item/daikin-breadcrumb-item.cjs +116 -0
- package/dist/cjs/components/breadcrumb-item/daikin-breadcrumb-item.d.ts +62 -0
- package/dist/cjs/components/breadcrumb-item/index.cjs +7 -0
- package/dist/cjs/components/breadcrumb-item/index.d.ts +1 -0
- package/dist/cjs/components/button/daikin-button.cjs +25 -7
- package/dist/cjs/components/button/daikin-button.d.ts +21 -4
- package/dist/cjs/components/button/index.cjs +7 -0
- package/dist/cjs/components/checkbox/daikin-checkbox.d.ts +11 -2
- package/dist/cjs/components/checkbox/index.cjs +7 -0
- package/dist/cjs/components/icon/daikin-icon.cjs +87 -0
- package/dist/cjs/components/icon/daikin-icon.d.ts +48 -0
- package/dist/cjs/components/icon/icons.json.cjs +29 -0
- package/dist/cjs/components/icon/icons.json.d.ts +31 -0
- package/dist/cjs/components/icon/index.cjs +8 -0
- package/dist/cjs/components/icon/index.d.ts +1 -0
- package/dist/cjs/components/index.cjs +93 -0
- package/dist/cjs/components/index.d.ts +11 -0
- package/dist/cjs/components/input-group/daikin-input-group.cjs +1 -1
- package/dist/cjs/components/input-group/daikin-input-group.d.ts +27 -2
- package/dist/cjs/components/input-group/index.cjs +7 -0
- package/dist/cjs/components/notification/daikin-notification.cjs +15 -33
- package/dist/cjs/components/notification/daikin-notification.d.ts +21 -8
- package/dist/cjs/components/notification/index.cjs +7 -0
- package/dist/cjs/components/panel-switcher/daikin-panel-switcher.cjs +55 -0
- package/dist/cjs/components/panel-switcher/daikin-panel-switcher.d.ts +50 -0
- package/dist/cjs/components/panel-switcher/index.cjs +7 -0
- package/dist/cjs/components/panel-switcher/index.d.ts +1 -0
- package/dist/cjs/components/progress-bar/daikin-progress-bar.cjs +137 -0
- package/dist/cjs/components/progress-bar/daikin-progress-bar.d.ts +47 -0
- package/dist/cjs/components/progress-bar/index.cjs +7 -0
- package/dist/cjs/components/progress-bar/index.d.ts +1 -0
- package/dist/cjs/components/radio/daikin-radio.d.ts +11 -2
- package/dist/cjs/components/radio/index.cjs +7 -0
- package/dist/cjs/components/tab/daikin-tab.cjs +126 -0
- package/dist/cjs/components/tab/daikin-tab.d.ts +54 -0
- package/dist/cjs/components/tab/index.cjs +7 -0
- package/dist/cjs/components/tab/index.d.ts +1 -0
- package/dist/cjs/components/tab-group/daikin-tab-group.cjs +211 -0
- package/dist/cjs/components/tab-group/daikin-tab-group.d.ts +104 -0
- package/dist/cjs/components/tab-group/index.cjs +7 -0
- package/dist/cjs/components/tab-group/index.d.ts +1 -0
- package/dist/cjs/components/tab-group/scroller.cjs +65 -0
- package/dist/cjs/components/tab-group/scroller.d.ts +25 -0
- package/dist/cjs/components/text-input/daikin-text-input.d.ts +16 -2
- package/dist/cjs/components/text-input/index.cjs +7 -0
- package/dist/cjs/components/textarea/daikin-textarea.d.ts +16 -2
- package/dist/cjs/components/textarea/index.cjs +7 -0
- package/dist/cjs/components/toggle/daikin-toggle.cjs +132 -0
- package/dist/cjs/components/toggle/daikin-toggle.d.ts +60 -0
- package/dist/cjs/components/toggle/index.cjs +7 -0
- package/dist/cjs/components/toggle/index.d.ts +1 -0
- package/dist/cjs/components/tooltip/daikin-tooltip.cjs +223 -0
- package/dist/cjs/components/tooltip/daikin-tooltip.d.ts +76 -0
- package/dist/cjs/components/tooltip/index.cjs +7 -0
- package/dist/cjs/components/tooltip/index.d.ts +1 -0
- package/dist/cjs/index.cjs +56 -0
- package/dist/cjs/is-client.cjs +5 -0
- package/dist/cjs/is-client.d.ts +1 -0
- package/dist/cjs/tailwind.css.cjs +2 -2
- package/dist/cjs/type-utils.d.ts +0 -1
- package/dist/cjs-dev/colors.cjs +80 -0
- package/dist/cjs-dev/colors.d.ts +69 -0
- package/dist/cjs-dev/components/accordion/daikin-accordion.cjs +37 -0
- package/dist/cjs-dev/components/accordion/daikin-accordion.d.ts +39 -0
- package/dist/cjs-dev/components/accordion/index.cjs +7 -0
- package/dist/cjs-dev/components/accordion/index.d.ts +1 -0
- package/dist/cjs-dev/components/accordion-item/daikin-accordion-item.cjs +177 -0
- package/dist/cjs-dev/components/accordion-item/daikin-accordion-item.d.ts +55 -0
- package/dist/cjs-dev/components/accordion-item/index.cjs +7 -0
- package/dist/cjs-dev/components/accordion-item/index.d.ts +1 -0
- package/dist/cjs-dev/components/breadcrumb/daikin-breadcrumb.cjs +124 -0
- package/dist/cjs-dev/components/breadcrumb/daikin-breadcrumb.d.ts +52 -0
- package/dist/cjs-dev/components/breadcrumb/index.cjs +7 -0
- package/dist/cjs-dev/components/breadcrumb/index.d.ts +1 -0
- package/dist/cjs-dev/components/breadcrumb-item/daikin-breadcrumb-item.cjs +116 -0
- package/dist/cjs-dev/components/breadcrumb-item/daikin-breadcrumb-item.d.ts +62 -0
- package/dist/cjs-dev/components/breadcrumb-item/index.cjs +7 -0
- package/dist/cjs-dev/components/breadcrumb-item/index.d.ts +1 -0
- package/dist/cjs-dev/components/button/daikin-button.cjs +215 -0
- package/dist/cjs-dev/components/button/daikin-button.d.ts +76 -0
- package/dist/cjs-dev/components/button/index.cjs +7 -0
- package/dist/cjs-dev/components/button/index.d.ts +1 -0
- package/dist/cjs-dev/components/checkbox/daikin-checkbox.cjs +183 -0
- package/dist/cjs-dev/components/checkbox/daikin-checkbox.d.ts +77 -0
- package/dist/cjs-dev/components/checkbox/index.cjs +7 -0
- package/dist/cjs-dev/components/checkbox/index.d.ts +1 -0
- package/dist/cjs-dev/components/icon/daikin-icon.cjs +96 -0
- package/dist/cjs-dev/components/icon/daikin-icon.d.ts +48 -0
- package/dist/cjs-dev/components/icon/icons.json.cjs +29 -0
- package/dist/cjs-dev/components/icon/icons.json.d.ts +31 -0
- package/dist/cjs-dev/components/icon/index.cjs +8 -0
- package/dist/cjs-dev/components/icon/index.d.ts +1 -0
- package/dist/cjs-dev/components/index.cjs +93 -0
- package/dist/cjs-dev/components/index.d.ts +18 -0
- package/dist/cjs-dev/components/input-group/daikin-input-group.cjs +119 -0
- package/dist/cjs-dev/components/input-group/daikin-input-group.d.ts +72 -0
- package/dist/cjs-dev/components/input-group/index.cjs +7 -0
- package/dist/cjs-dev/components/input-group/index.d.ts +1 -0
- package/dist/cjs-dev/components/notification/daikin-notification.cjs +191 -0
- package/dist/cjs-dev/components/notification/daikin-notification.d.ts +75 -0
- package/dist/cjs-dev/components/notification/index.cjs +7 -0
- package/dist/cjs-dev/components/notification/index.d.ts +1 -0
- package/dist/cjs-dev/components/panel-switcher/daikin-panel-switcher.cjs +62 -0
- package/dist/cjs-dev/components/panel-switcher/daikin-panel-switcher.d.ts +50 -0
- package/dist/cjs-dev/components/panel-switcher/index.cjs +7 -0
- package/dist/cjs-dev/components/panel-switcher/index.d.ts +1 -0
- package/dist/cjs-dev/components/progress-bar/daikin-progress-bar.cjs +152 -0
- package/dist/cjs-dev/components/progress-bar/daikin-progress-bar.d.ts +47 -0
- package/dist/cjs-dev/components/progress-bar/index.cjs +7 -0
- package/dist/cjs-dev/components/progress-bar/index.d.ts +1 -0
- package/dist/cjs-dev/components/radio/daikin-radio.cjs +150 -0
- package/dist/cjs-dev/components/radio/daikin-radio.d.ts +75 -0
- package/dist/cjs-dev/components/radio/index.cjs +7 -0
- package/dist/cjs-dev/components/radio/index.d.ts +1 -0
- package/dist/cjs-dev/components/tab/daikin-tab.cjs +126 -0
- package/dist/cjs-dev/components/tab/daikin-tab.d.ts +54 -0
- package/dist/cjs-dev/components/tab/index.cjs +7 -0
- package/dist/cjs-dev/components/tab/index.d.ts +1 -0
- package/dist/cjs-dev/components/tab-group/daikin-tab-group.cjs +221 -0
- package/dist/cjs-dev/components/tab-group/daikin-tab-group.d.ts +104 -0
- package/dist/cjs-dev/components/tab-group/index.cjs +7 -0
- package/dist/cjs-dev/components/tab-group/index.d.ts +1 -0
- package/dist/cjs-dev/components/tab-group/scroller.cjs +65 -0
- package/dist/cjs-dev/components/tab-group/scroller.d.ts +25 -0
- package/dist/cjs-dev/components/text-input/daikin-text-input.cjs +137 -0
- package/dist/cjs-dev/components/text-input/daikin-text-input.d.ts +68 -0
- package/dist/cjs-dev/components/text-input/index.cjs +7 -0
- package/dist/cjs-dev/components/text-input/index.d.ts +1 -0
- package/dist/cjs-dev/components/textarea/daikin-textarea.cjs +168 -0
- package/dist/cjs-dev/components/textarea/daikin-textarea.d.ts +70 -0
- package/dist/cjs-dev/components/textarea/index.cjs +7 -0
- package/dist/cjs-dev/components/textarea/index.d.ts +1 -0
- package/dist/cjs-dev/components/toggle/daikin-toggle.cjs +132 -0
- package/dist/cjs-dev/components/toggle/daikin-toggle.d.ts +60 -0
- package/dist/cjs-dev/components/toggle/index.cjs +7 -0
- package/dist/cjs-dev/components/toggle/index.d.ts +1 -0
- package/dist/cjs-dev/components/tooltip/daikin-tooltip.cjs +223 -0
- package/dist/cjs-dev/components/tooltip/daikin-tooltip.d.ts +76 -0
- package/dist/cjs-dev/components/tooltip/index.cjs +7 -0
- package/dist/cjs-dev/components/tooltip/index.d.ts +1 -0
- package/dist/cjs-dev/constants/events.cjs +4 -0
- package/dist/cjs-dev/constants/events.d.ts +1 -0
- package/dist/cjs-dev/index.cjs +95 -0
- package/dist/cjs-dev/index.d.ts +3 -0
- package/dist/cjs-dev/is-client.cjs +5 -0
- package/dist/cjs-dev/is-client.d.ts +1 -0
- package/dist/cjs-dev/lit-analyzer-types.d.ts +112 -0
- package/dist/cjs-dev/tailwind.css.cjs +6 -0
- package/dist/cjs-dev/type-utils.d.ts +24 -0
- package/dist/es/components/accordion/daikin-accordion.d.ts +39 -0
- package/dist/es/components/accordion/daikin-accordion.js +38 -0
- package/dist/es/components/accordion/index.d.ts +1 -0
- package/dist/es/components/accordion/index.js +4 -0
- package/dist/es/components/accordion-item/daikin-accordion-item.d.ts +55 -0
- package/dist/es/components/accordion-item/daikin-accordion-item.js +178 -0
- package/dist/es/components/accordion-item/index.d.ts +1 -0
- package/dist/es/components/accordion-item/index.js +4 -0
- package/dist/es/components/breadcrumb/daikin-breadcrumb.d.ts +52 -0
- package/dist/es/components/breadcrumb/daikin-breadcrumb.js +125 -0
- package/dist/es/components/breadcrumb/index.d.ts +1 -0
- package/dist/es/components/breadcrumb/index.js +4 -0
- package/dist/es/components/breadcrumb-item/daikin-breadcrumb-item.d.ts +62 -0
- package/dist/es/components/breadcrumb-item/daikin-breadcrumb-item.js +117 -0
- package/dist/es/components/breadcrumb-item/index.d.ts +1 -0
- package/dist/es/components/breadcrumb-item/index.js +4 -0
- package/dist/es/components/button/daikin-button.d.ts +21 -4
- package/dist/es/components/button/daikin-button.js +25 -7
- package/dist/es/components/button/index.js +4 -0
- package/dist/es/components/checkbox/daikin-checkbox.d.ts +11 -2
- package/dist/es/components/checkbox/index.js +4 -0
- package/dist/es/components/icon/daikin-icon.d.ts +48 -0
- package/dist/es/components/icon/daikin-icon.js +88 -0
- package/dist/es/components/icon/icons.json.d.ts +31 -0
- package/dist/es/components/icon/icons.json.js +29 -0
- package/dist/es/components/icon/index.d.ts +1 -0
- package/dist/es/components/icon/index.js +5 -0
- package/dist/es/components/index.d.ts +11 -0
- package/dist/es/components/index.js +39 -0
- package/dist/es/components/input-group/daikin-input-group.d.ts +27 -2
- package/dist/es/components/input-group/daikin-input-group.js +1 -1
- package/dist/es/components/input-group/index.js +4 -0
- package/dist/es/components/notification/daikin-notification.d.ts +21 -8
- package/dist/es/components/notification/daikin-notification.js +15 -33
- package/dist/es/components/notification/index.js +4 -0
- package/dist/es/components/panel-switcher/daikin-panel-switcher.d.ts +50 -0
- package/dist/es/components/panel-switcher/daikin-panel-switcher.js +56 -0
- package/dist/es/components/panel-switcher/index.d.ts +1 -0
- package/dist/es/components/panel-switcher/index.js +4 -0
- package/dist/es/components/progress-bar/daikin-progress-bar.d.ts +47 -0
- package/dist/es/components/progress-bar/daikin-progress-bar.js +138 -0
- package/dist/es/components/progress-bar/index.d.ts +1 -0
- package/dist/es/components/progress-bar/index.js +4 -0
- package/dist/es/components/radio/daikin-radio.d.ts +11 -2
- package/dist/es/components/radio/index.js +4 -0
- package/dist/es/components/tab/daikin-tab.d.ts +54 -0
- package/dist/es/components/tab/daikin-tab.js +127 -0
- package/dist/es/components/tab/index.d.ts +1 -0
- package/dist/es/components/tab/index.js +4 -0
- package/dist/es/components/tab-group/daikin-tab-group.d.ts +104 -0
- package/dist/es/components/tab-group/daikin-tab-group.js +212 -0
- package/dist/es/components/tab-group/index.d.ts +1 -0
- package/dist/es/components/tab-group/index.js +4 -0
- package/dist/es/components/tab-group/scroller.d.ts +25 -0
- package/dist/es/components/tab-group/scroller.js +65 -0
- package/dist/es/components/text-input/daikin-text-input.d.ts +16 -2
- package/dist/es/components/text-input/index.js +4 -0
- package/dist/es/components/textarea/daikin-textarea.d.ts +16 -2
- package/dist/es/components/textarea/index.js +4 -0
- package/dist/es/components/toggle/daikin-toggle.d.ts +60 -0
- package/dist/es/components/toggle/daikin-toggle.js +133 -0
- package/dist/es/components/toggle/index.d.ts +1 -0
- package/dist/es/components/toggle/index.js +4 -0
- package/dist/es/components/tooltip/daikin-tooltip.d.ts +76 -0
- package/dist/es/components/tooltip/daikin-tooltip.js +224 -0
- package/dist/es/components/tooltip/index.d.ts +1 -0
- package/dist/es/components/tooltip/index.js +4 -0
- package/dist/es/index.js +24 -1
- package/dist/es/is-client.d.ts +1 -0
- package/dist/es/is-client.js +5 -0
- package/dist/es/tailwind.css.js +2 -2
- package/dist/es/type-utils.d.ts +0 -1
- package/dist/es-dev/colors.d.ts +69 -0
- package/dist/es-dev/colors.js +80 -0
- package/dist/es-dev/components/accordion/daikin-accordion.d.ts +39 -0
- package/dist/es-dev/components/accordion/daikin-accordion.js +38 -0
- package/dist/es-dev/components/accordion/index.d.ts +1 -0
- package/dist/es-dev/components/accordion/index.js +4 -0
- package/dist/es-dev/components/accordion-item/daikin-accordion-item.d.ts +55 -0
- package/dist/es-dev/components/accordion-item/daikin-accordion-item.js +178 -0
- package/dist/es-dev/components/accordion-item/index.d.ts +1 -0
- package/dist/es-dev/components/accordion-item/index.js +4 -0
- package/dist/es-dev/components/breadcrumb/daikin-breadcrumb.d.ts +52 -0
- package/dist/es-dev/components/breadcrumb/daikin-breadcrumb.js +125 -0
- package/dist/es-dev/components/breadcrumb/index.d.ts +1 -0
- package/dist/es-dev/components/breadcrumb/index.js +4 -0
- package/dist/es-dev/components/breadcrumb-item/daikin-breadcrumb-item.d.ts +62 -0
- package/dist/es-dev/components/breadcrumb-item/daikin-breadcrumb-item.js +117 -0
- package/dist/es-dev/components/breadcrumb-item/index.d.ts +1 -0
- package/dist/es-dev/components/breadcrumb-item/index.js +4 -0
- package/dist/es-dev/components/button/daikin-button.d.ts +76 -0
- package/dist/es-dev/components/button/daikin-button.js +216 -0
- package/dist/es-dev/components/button/index.d.ts +1 -0
- package/dist/es-dev/components/button/index.js +4 -0
- package/dist/es-dev/components/checkbox/daikin-checkbox.d.ts +77 -0
- package/dist/es-dev/components/checkbox/daikin-checkbox.js +184 -0
- package/dist/es-dev/components/checkbox/index.d.ts +1 -0
- package/dist/es-dev/components/checkbox/index.js +4 -0
- package/dist/es-dev/components/icon/daikin-icon.d.ts +48 -0
- package/dist/es-dev/components/icon/daikin-icon.js +97 -0
- package/dist/es-dev/components/icon/icons.json.d.ts +31 -0
- package/dist/es-dev/components/icon/icons.json.js +29 -0
- package/dist/es-dev/components/icon/index.d.ts +1 -0
- package/dist/es-dev/components/icon/index.js +5 -0
- package/dist/es-dev/components/index.d.ts +18 -0
- package/dist/es-dev/components/index.js +39 -0
- package/dist/es-dev/components/input-group/daikin-input-group.d.ts +72 -0
- package/dist/es-dev/components/input-group/daikin-input-group.js +120 -0
- package/dist/es-dev/components/input-group/index.d.ts +1 -0
- package/dist/es-dev/components/input-group/index.js +4 -0
- package/dist/es-dev/components/notification/daikin-notification.d.ts +75 -0
- package/dist/es-dev/components/notification/daikin-notification.js +192 -0
- package/dist/es-dev/components/notification/index.d.ts +1 -0
- package/dist/es-dev/components/notification/index.js +4 -0
- package/dist/es-dev/components/panel-switcher/daikin-panel-switcher.d.ts +50 -0
- package/dist/es-dev/components/panel-switcher/daikin-panel-switcher.js +63 -0
- package/dist/es-dev/components/panel-switcher/index.d.ts +1 -0
- package/dist/es-dev/components/panel-switcher/index.js +4 -0
- package/dist/es-dev/components/progress-bar/daikin-progress-bar.d.ts +47 -0
- package/dist/es-dev/components/progress-bar/daikin-progress-bar.js +153 -0
- package/dist/es-dev/components/progress-bar/index.d.ts +1 -0
- package/dist/es-dev/components/progress-bar/index.js +4 -0
- package/dist/es-dev/components/radio/daikin-radio.d.ts +75 -0
- package/dist/es-dev/components/radio/daikin-radio.js +151 -0
- package/dist/es-dev/components/radio/index.d.ts +1 -0
- package/dist/es-dev/components/radio/index.js +4 -0
- package/dist/es-dev/components/tab/daikin-tab.d.ts +54 -0
- package/dist/es-dev/components/tab/daikin-tab.js +127 -0
- package/dist/es-dev/components/tab/index.d.ts +1 -0
- package/dist/es-dev/components/tab/index.js +4 -0
- package/dist/es-dev/components/tab-group/daikin-tab-group.d.ts +104 -0
- package/dist/es-dev/components/tab-group/daikin-tab-group.js +222 -0
- package/dist/es-dev/components/tab-group/index.d.ts +1 -0
- package/dist/es-dev/components/tab-group/index.js +4 -0
- package/dist/es-dev/components/tab-group/scroller.d.ts +25 -0
- package/dist/es-dev/components/tab-group/scroller.js +65 -0
- package/dist/es-dev/components/text-input/daikin-text-input.d.ts +68 -0
- package/dist/es-dev/components/text-input/daikin-text-input.js +138 -0
- package/dist/es-dev/components/text-input/index.d.ts +1 -0
- package/dist/es-dev/components/text-input/index.js +4 -0
- package/dist/es-dev/components/textarea/daikin-textarea.d.ts +70 -0
- package/dist/es-dev/components/textarea/daikin-textarea.js +169 -0
- package/dist/es-dev/components/textarea/index.d.ts +1 -0
- package/dist/es-dev/components/textarea/index.js +4 -0
- package/dist/es-dev/components/toggle/daikin-toggle.d.ts +60 -0
- package/dist/es-dev/components/toggle/daikin-toggle.js +133 -0
- package/dist/es-dev/components/toggle/index.d.ts +1 -0
- package/dist/es-dev/components/toggle/index.js +4 -0
- package/dist/es-dev/components/tooltip/daikin-tooltip.d.ts +76 -0
- package/dist/es-dev/components/tooltip/daikin-tooltip.js +224 -0
- package/dist/es-dev/components/tooltip/index.d.ts +1 -0
- package/dist/es-dev/components/tooltip/index.js +4 -0
- package/dist/es-dev/constants/events.d.ts +1 -0
- package/dist/es-dev/constants/events.js +4 -0
- package/dist/es-dev/index.d.ts +3 -0
- package/dist/es-dev/index.js +41 -0
- package/dist/es-dev/is-client.d.ts +1 -0
- package/dist/es-dev/is-client.js +5 -0
- package/dist/es-dev/lit-analyzer-types.d.ts +112 -0
- package/dist/es-dev/tailwind.css.js +6 -0
- package/dist/es-dev/type-utils.d.ts +24 -0
- package/icons/accordion-chevron-up.svg +3 -0
- package/icons/status-positive.svg +15 -0
- package/package.json +83 -50
- /package/icons/{input-group-error.svg → status-negative.svg} +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { colorFeedbackPositive, colorFeedbackNegative } from "@daikin-oss/dds-tokens/js/daikin/Light/variables.js";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { css, unsafeCSS, LitElement, html } from "lit";
|
|
4
|
+
import { property, customElement } from "lit/decorators.js";
|
|
5
|
+
import tailwindStyles from "../../tailwind.css.js";
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
+
if (decorator = decorators[i])
|
|
12
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
13
|
+
if (kind && result) __defProp(target, key, result);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
const cvaBar = cva(
|
|
17
|
+
[
|
|
18
|
+
"w-full",
|
|
19
|
+
"h-1",
|
|
20
|
+
"bg-daikinNeutral-200",
|
|
21
|
+
"overflow-hidden",
|
|
22
|
+
"relative",
|
|
23
|
+
"after:block",
|
|
24
|
+
"after:h-full",
|
|
25
|
+
"after:absolute",
|
|
26
|
+
"after:left-0"
|
|
27
|
+
],
|
|
28
|
+
{
|
|
29
|
+
variants: {
|
|
30
|
+
variant: {
|
|
31
|
+
inprogress: ["after:w-[--bar-width]", "after:bg-daikinBlue-500"],
|
|
32
|
+
completed: ["after:w-full", "after:bg-[--colorFeedbackPositive]"],
|
|
33
|
+
indeterminate: [
|
|
34
|
+
"after:w-1/2",
|
|
35
|
+
"after:bg-daikinBlue-500",
|
|
36
|
+
"after:animate-[progress-bar-indeterminate_1200ms_linear_infinite]"
|
|
37
|
+
],
|
|
38
|
+
error: ["after:w-full", "after:bg-[--colorFeedbackNegative]"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
const cvaIcon = cva(["size-4"], {
|
|
44
|
+
variants: {
|
|
45
|
+
variant: {
|
|
46
|
+
inprogress: ["none"],
|
|
47
|
+
completed: ["i-daikin-status-positive"],
|
|
48
|
+
indeterminate: [],
|
|
49
|
+
error: ["i-daikin-status-negative"]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const cvaHelper = cva(["text-xs", "mt-2"], {
|
|
54
|
+
variants: {
|
|
55
|
+
variant: {
|
|
56
|
+
inprogress: [],
|
|
57
|
+
completed: [],
|
|
58
|
+
indeterminate: [],
|
|
59
|
+
error: ["text-[--colorFeedbackNegative]"]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
let DaikinProgressBar = class extends LitElement {
|
|
64
|
+
constructor() {
|
|
65
|
+
super(...arguments);
|
|
66
|
+
this.value = 0;
|
|
67
|
+
this.variant = "inprogress";
|
|
68
|
+
this.max = 100;
|
|
69
|
+
this.helper = "";
|
|
70
|
+
}
|
|
71
|
+
// Validate the 'value' and 'max' properties to ensure they are valid
|
|
72
|
+
_validateProperties() {
|
|
73
|
+
if (typeof this.value !== "number" || this.value < 0) {
|
|
74
|
+
this.value = 0;
|
|
75
|
+
}
|
|
76
|
+
if (typeof this.max !== "number" || this.max <= 0) {
|
|
77
|
+
this.max = 100;
|
|
78
|
+
}
|
|
79
|
+
if (this.value > this.max) {
|
|
80
|
+
this.value = this.max;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
const progressRatio = Math.min(Math.max(this.value / this.max, 0), 1);
|
|
85
|
+
return html`<div class="flex flex-col w-full font-daikinSerif">
|
|
86
|
+
<div class="flex justify-between items-center mb-2.5">
|
|
87
|
+
<span class="text-sm leading-[22px] font-medium"><slot></slot></span>
|
|
88
|
+
<span class=${cvaIcon({ variant: this.variant })}></span>
|
|
89
|
+
</div>
|
|
90
|
+
<div
|
|
91
|
+
class=${cvaBar({ variant: this.variant })}
|
|
92
|
+
role="progressbar"
|
|
93
|
+
aria-label=${this.textContent ?? ""}
|
|
94
|
+
aria-valuenow=${this.value}
|
|
95
|
+
aria-valuemin="0"
|
|
96
|
+
aria-valuemax=${this.max}
|
|
97
|
+
style=${`--bar-width:${progressRatio * 100}%`}
|
|
98
|
+
></div>
|
|
99
|
+
${this.helper ? html`<span class=${cvaHelper({ variant: this.variant })}
|
|
100
|
+
>${this.helper}</span
|
|
101
|
+
>` : null}
|
|
102
|
+
</div>`;
|
|
103
|
+
}
|
|
104
|
+
updated(changedProperties) {
|
|
105
|
+
if (changedProperties.has("value") || changedProperties.has("max")) {
|
|
106
|
+
this._validateProperties();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
DaikinProgressBar.styles = css`
|
|
111
|
+
${unsafeCSS(tailwindStyles)}
|
|
112
|
+
|
|
113
|
+
:host {
|
|
114
|
+
--colorFeedbackPositive: ${unsafeCSS(colorFeedbackPositive)};
|
|
115
|
+
--colorFeedbackNegative: ${unsafeCSS(colorFeedbackNegative)};
|
|
116
|
+
|
|
117
|
+
display: block;
|
|
118
|
+
width: 100%;
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
__decorateClass([
|
|
122
|
+
property({ type: Number })
|
|
123
|
+
], DaikinProgressBar.prototype, "value", 2);
|
|
124
|
+
__decorateClass([
|
|
125
|
+
property({ type: String })
|
|
126
|
+
], DaikinProgressBar.prototype, "variant", 2);
|
|
127
|
+
__decorateClass([
|
|
128
|
+
property({ type: Number })
|
|
129
|
+
], DaikinProgressBar.prototype, "max", 2);
|
|
130
|
+
__decorateClass([
|
|
131
|
+
property({ type: String })
|
|
132
|
+
], DaikinProgressBar.prototype, "helper", 2);
|
|
133
|
+
DaikinProgressBar = __decorateClass([
|
|
134
|
+
customElement("daikin-progress-bar")
|
|
135
|
+
], DaikinProgressBar);
|
|
136
|
+
export {
|
|
137
|
+
DaikinProgressBar
|
|
138
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './daikin-progress-bar';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import { MergeVariantProps } from '../../type-utils';
|
|
3
|
-
|
|
4
3
|
declare const cvaRadio: (props?: ({
|
|
5
4
|
size?: "small" | "large" | null | undefined;
|
|
6
5
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -9,7 +8,17 @@ declare const cvaLabel: (props?: ({
|
|
|
9
8
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
9
|
type RadioVariantProps = MergeVariantProps<typeof cvaRadio | typeof cvaLabel>;
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
11
|
+
* The radio button component is a UI element that allows users to select one options from a set of choices.
|
|
12
|
+
* It functions similarly to the HTML `<input type="radio">` tag. \
|
|
13
|
+
* Please note that **a radio group component is not yet available**, so you'll need to manually group radio buttons when using multiple instances.
|
|
14
|
+
*
|
|
15
|
+
* @fires change - A cloned event of a [change event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event) emitted from the inner `<input type="radio">` element.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* ```html
|
|
20
|
+
* <daikin-radio name="name" value="value" label="Radio button label"></daikin-radio>
|
|
21
|
+
* ```
|
|
13
22
|
*/
|
|
14
23
|
export declare class DaikinRadio extends LitElement {
|
|
15
24
|
static readonly styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* The tab component is a child element within the `daikin-tab-group` component, representing a clickable button or label that users interact with to switch between different panels of content.
|
|
4
|
+
* Each tab corresponds to a specific panel and is typically labeled to indicate the content it reveals.
|
|
5
|
+
*
|
|
6
|
+
* Hierarchy:
|
|
7
|
+
* - `daikin-tab-group` > `daikin-tab`
|
|
8
|
+
*
|
|
9
|
+
* @fires click - A retargeted event of a [click event](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event) emitted from the inner `<button>` element. Suppressed if `disabled` is true,
|
|
10
|
+
*
|
|
11
|
+
* @slot - A slot for the tab button content.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* ```html
|
|
16
|
+
* <!-- See `daikin-tab-group` component for complete example. -->
|
|
17
|
+
* <daikin-tab value="foo">Foo tab</daikin-tab>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class DaikinTab extends LitElement {
|
|
21
|
+
static readonly styles: import('lit').CSSResult;
|
|
22
|
+
/**
|
|
23
|
+
* A unique string that identifies a tab.
|
|
24
|
+
* Must be unique within the `daikin-tab-group` component.
|
|
25
|
+
*/
|
|
26
|
+
value: string;
|
|
27
|
+
/**
|
|
28
|
+
* Size of tab
|
|
29
|
+
*/
|
|
30
|
+
size: "default" | "condensed";
|
|
31
|
+
/**
|
|
32
|
+
* Whether to show the disabled state.
|
|
33
|
+
*/
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether to show the active (selected) state.
|
|
37
|
+
* Ignored if `disabled` is `true`.
|
|
38
|
+
* Set automatically by `daikin-tab-group` component.
|
|
39
|
+
*/
|
|
40
|
+
active: boolean;
|
|
41
|
+
private _handleClick;
|
|
42
|
+
constructor();
|
|
43
|
+
/**
|
|
44
|
+
* Focuses on the inner button.
|
|
45
|
+
* @param options focus options
|
|
46
|
+
*/
|
|
47
|
+
focus(options?: FocusOptions | undefined): void;
|
|
48
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
49
|
+
}
|
|
50
|
+
declare global {
|
|
51
|
+
interface HTMLElementTagNameMap {
|
|
52
|
+
"daikin-tab": DaikinTab;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
import { css, unsafeCSS, LitElement, html } from "lit";
|
|
3
|
+
import { property, customElement } from "lit/decorators.js";
|
|
4
|
+
import tailwindStyles from "../../tailwind.css.js";
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
9
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
+
if (decorator = decorators[i])
|
|
11
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
12
|
+
if (kind && result) __defProp(target, key, result);
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
const cvaTab = cva(
|
|
16
|
+
[
|
|
17
|
+
"flex",
|
|
18
|
+
"w-full",
|
|
19
|
+
"h-full",
|
|
20
|
+
"items-center",
|
|
21
|
+
"justify-center",
|
|
22
|
+
"text-center",
|
|
23
|
+
"relative",
|
|
24
|
+
"font-daikinSerif",
|
|
25
|
+
"text-base",
|
|
26
|
+
"tracking-wide",
|
|
27
|
+
"whitespace-nowrap",
|
|
28
|
+
"contain-paint",
|
|
29
|
+
"disabled:cursor-default",
|
|
30
|
+
"after:content-['']",
|
|
31
|
+
"after:z-1",
|
|
32
|
+
"after:absolute",
|
|
33
|
+
"after:bottom-0",
|
|
34
|
+
"after:left-0",
|
|
35
|
+
"after:right-0",
|
|
36
|
+
"after:w-full",
|
|
37
|
+
"text-daikinBlue-500",
|
|
38
|
+
"hover:text-daikinBlue-400",
|
|
39
|
+
"active:text-daikinBlue-600",
|
|
40
|
+
"focus-visible:text-daikinBlue-700",
|
|
41
|
+
"disabled:text-daikinNeutral-300",
|
|
42
|
+
"aria-selected:after:h-1",
|
|
43
|
+
"aria-selected:after:bg-daikinBlue-500",
|
|
44
|
+
"hover:aria-selected:after:bg-daikinBlue-400",
|
|
45
|
+
"active:aria-selected:after:bg-daikinBlue-600",
|
|
46
|
+
"focus-visible:aria-selected:after:bg-daikinBlue-700",
|
|
47
|
+
"disabled:after:bg-daikinNeutral-300"
|
|
48
|
+
],
|
|
49
|
+
{
|
|
50
|
+
variants: {
|
|
51
|
+
size: {
|
|
52
|
+
default: ["px-4"],
|
|
53
|
+
condensed: ["px-[10px]"]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
let DaikinTab = class extends LitElement {
|
|
59
|
+
constructor() {
|
|
60
|
+
super();
|
|
61
|
+
this.value = "";
|
|
62
|
+
this.size = "default";
|
|
63
|
+
this.disabled = false;
|
|
64
|
+
this.active = false;
|
|
65
|
+
this.addEventListener("click", this._handleClick);
|
|
66
|
+
}
|
|
67
|
+
_handleClick(event) {
|
|
68
|
+
if (this.disabled) {
|
|
69
|
+
event.stopImmediatePropagation();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Focuses on the inner button.
|
|
74
|
+
* @param options focus options
|
|
75
|
+
*/
|
|
76
|
+
focus(options) {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
(_b = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("button")) == null ? void 0 : _b.focus(options);
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
const cn = cvaTab({
|
|
82
|
+
size: this.size
|
|
83
|
+
});
|
|
84
|
+
return html`
|
|
85
|
+
<button
|
|
86
|
+
class=${cn}
|
|
87
|
+
?disabled=${this.disabled}
|
|
88
|
+
role="tab"
|
|
89
|
+
aria-selected=${!this.disabled && this.active}
|
|
90
|
+
tabindex=${this.active ? 0 : -1}
|
|
91
|
+
>
|
|
92
|
+
<slot></slot>
|
|
93
|
+
</button>
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
DaikinTab.styles = css`
|
|
98
|
+
${unsafeCSS(tailwindStyles)}
|
|
99
|
+
|
|
100
|
+
:host {
|
|
101
|
+
display: inline-block;
|
|
102
|
+
width: fit-content;
|
|
103
|
+
height: 48px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:host([size="condensed"]) {
|
|
107
|
+
height: 40px;
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
__decorateClass([
|
|
111
|
+
property({ type: String, reflect: true })
|
|
112
|
+
], DaikinTab.prototype, "value", 2);
|
|
113
|
+
__decorateClass([
|
|
114
|
+
property({ type: String, reflect: true })
|
|
115
|
+
], DaikinTab.prototype, "size", 2);
|
|
116
|
+
__decorateClass([
|
|
117
|
+
property({ type: Boolean, reflect: true })
|
|
118
|
+
], DaikinTab.prototype, "disabled", 2);
|
|
119
|
+
__decorateClass([
|
|
120
|
+
property({ type: Boolean, reflect: true })
|
|
121
|
+
], DaikinTab.prototype, "active", 2);
|
|
122
|
+
DaikinTab = __decorateClass([
|
|
123
|
+
customElement("daikin-tab")
|
|
124
|
+
], DaikinTab);
|
|
125
|
+
export {
|
|
126
|
+
DaikinTab
|
|
127
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './daikin-tab';
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* The tab group component manages a group of tabs and switches the content displayed using the panel switcher component.
|
|
4
|
+
* It allows users to navigate between different sections of content by clicking on individual tabs.
|
|
5
|
+
* Tab groups do not provide styles; developers must apply styles to the wrapper of the tabs (`tablist` part) and to the panel switcher(s).
|
|
6
|
+
*
|
|
7
|
+
* > [!WARNING]
|
|
8
|
+
* > At least one tab must be available (that means, the tab must be present and enabled).
|
|
9
|
+
* > Otherwise, unexpected behavior may be encountered.
|
|
10
|
+
*
|
|
11
|
+
* Hierarchies:
|
|
12
|
+
* - `daikin-tab-group` > `daikin-tab`
|
|
13
|
+
* - `daikin-tab-group` > `daikin-panel-switcher` ("panels" slot)
|
|
14
|
+
*
|
|
15
|
+
* @fires beforechange - _Cancellable._ A custom event emitted when the current tab is about to be changed by user interaction.
|
|
16
|
+
* @fires change - A custom event emitted when the current tab is changed.
|
|
17
|
+
*
|
|
18
|
+
* @slot - A slot for tab buttons. Place `daikin-tab` elements here.
|
|
19
|
+
* @slot panels - A slot for a panel switcher component. Place `daikin-panel-switcher` element(s) here.
|
|
20
|
+
*
|
|
21
|
+
* @csspart tablist - The container element for the default (tab list) slot. Has "tablist" role.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
*
|
|
25
|
+
* ```html
|
|
26
|
+
* <!-- See storybook for styling tab group. You'll need `::part(tablist)` to style the tab container. -->
|
|
27
|
+
* <daikin-tab-group value="foo">
|
|
28
|
+
* <daikin-tab value="foo">Foo tab</daikin-tab>
|
|
29
|
+
* <daikin-tab value="bar">Bar tab</daikin-tab>
|
|
30
|
+
* <!-- At least one "daikin-panel-switcher" is needed to switch the content. -->
|
|
31
|
+
* <daikin-panel-switcher slot="panels">
|
|
32
|
+
* <!-- Mind the "panel:" prefix. -->
|
|
33
|
+
* <p slot="panel:foo">Foo tab content.</p>
|
|
34
|
+
* <p slot="panel:bar">Bar tab content.</p>
|
|
35
|
+
* </daikin-panel-switcher>
|
|
36
|
+
* </daikin-tab-group>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class DaikinTabGroup extends LitElement {
|
|
40
|
+
static readonly styles: import('lit').CSSResult;
|
|
41
|
+
/**
|
|
42
|
+
* `value` of the currently selected tab (`daikin-tab`).
|
|
43
|
+
*/
|
|
44
|
+
value: string;
|
|
45
|
+
/**
|
|
46
|
+
* Tab(s) in the default slot.
|
|
47
|
+
*/
|
|
48
|
+
private _tabs;
|
|
49
|
+
/**
|
|
50
|
+
* Panel switcher(s) in the `panels` slot.
|
|
51
|
+
*/
|
|
52
|
+
private _panelSwitchers;
|
|
53
|
+
/**
|
|
54
|
+
* Emits `beforechange` event if necessary and returns whether we should proceed.
|
|
55
|
+
*
|
|
56
|
+
* 1. Check if `newValue` is different from `value`.
|
|
57
|
+
* 2. Emit "beforechange" event.
|
|
58
|
+
* 3. Check if the event is canceled.
|
|
59
|
+
*
|
|
60
|
+
* @param newValue The `value` of the newly active tab.
|
|
61
|
+
* @returns `true` if we should proceed (event is emitted and not canceled). `false` otherwise.
|
|
62
|
+
*/
|
|
63
|
+
private _emitBeforeChange;
|
|
64
|
+
/**
|
|
65
|
+
* Updates `this.value` and emit "change" event.
|
|
66
|
+
*
|
|
67
|
+
* @param newValue The `value` of the newly active tab.
|
|
68
|
+
*/
|
|
69
|
+
private _updateValue;
|
|
70
|
+
/**
|
|
71
|
+
* Updates `daikin-tab` component(s)' properties in the slot.
|
|
72
|
+
*
|
|
73
|
+
* Invoke when:
|
|
74
|
+
* - `this.value` is changed.
|
|
75
|
+
* - the default slot's content is changed.
|
|
76
|
+
*/
|
|
77
|
+
private _updateTabs;
|
|
78
|
+
/**
|
|
79
|
+
* Updates `daikin-panel-switcher` component(s)' properties in the slot.
|
|
80
|
+
*
|
|
81
|
+
* Invoke when:
|
|
82
|
+
* - `this.value` is changed.
|
|
83
|
+
* - the default slot's content is changed.
|
|
84
|
+
* - the panel slot's content is changed.
|
|
85
|
+
*/
|
|
86
|
+
private _updatePanelSwitcher;
|
|
87
|
+
/**
|
|
88
|
+
* Handles "click" event emitted by `daikin-tab` component.
|
|
89
|
+
*/
|
|
90
|
+
private _handleTabClick;
|
|
91
|
+
/**
|
|
92
|
+
* Handles keyboard interactions in the tab list.
|
|
93
|
+
*/
|
|
94
|
+
private _handleKeyDown;
|
|
95
|
+
private _handleSlotChange;
|
|
96
|
+
private _handlePanelSwitcherSlotChange;
|
|
97
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
98
|
+
updated(changedProperties: PropertyValues<this>): void;
|
|
99
|
+
}
|
|
100
|
+
declare global {
|
|
101
|
+
interface HTMLElementTagNameMap {
|
|
102
|
+
"daikin-tab-group": DaikinTabGroup;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { css, unsafeCSS, LitElement, html } from "lit";
|
|
2
|
+
import { property, queryAssignedElements, customElement } from "lit/decorators.js";
|
|
3
|
+
import tailwindStyles from "../../tailwind.css.js";
|
|
4
|
+
import { scrollIntoViewOnlyParent } from "./scroller.js";
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
9
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
+
if (decorator = decorators[i])
|
|
11
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
12
|
+
if (kind && result) __defProp(target, key, result);
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
let DaikinTabGroup = class extends LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.value = "";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Emits `beforechange` event if necessary and returns whether we should proceed.
|
|
22
|
+
*
|
|
23
|
+
* 1. Check if `newValue` is different from `value`.
|
|
24
|
+
* 2. Emit "beforechange" event.
|
|
25
|
+
* 3. Check if the event is canceled.
|
|
26
|
+
*
|
|
27
|
+
* @param newValue The `value` of the newly active tab.
|
|
28
|
+
* @returns `true` if we should proceed (event is emitted and not canceled). `false` otherwise.
|
|
29
|
+
*/
|
|
30
|
+
_emitBeforeChange(newValue) {
|
|
31
|
+
if (this.value === newValue) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (!this.dispatchEvent(
|
|
35
|
+
new CustomEvent("beforechange", {
|
|
36
|
+
detail: { oldValue: this.value, newValue },
|
|
37
|
+
bubbles: true,
|
|
38
|
+
composed: true,
|
|
39
|
+
cancelable: true
|
|
40
|
+
})
|
|
41
|
+
)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Updates `this.value` and emit "change" event.
|
|
48
|
+
*
|
|
49
|
+
* @param newValue The `value` of the newly active tab.
|
|
50
|
+
*/
|
|
51
|
+
_updateValue(newValue) {
|
|
52
|
+
this.dispatchEvent(
|
|
53
|
+
new CustomEvent("change", {
|
|
54
|
+
detail: { oldValue: this.value, newValue },
|
|
55
|
+
bubbles: true,
|
|
56
|
+
composed: true,
|
|
57
|
+
cancelable: false
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
this.value = newValue;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Updates `daikin-tab` component(s)' properties in the slot.
|
|
64
|
+
*
|
|
65
|
+
* Invoke when:
|
|
66
|
+
* - `this.value` is changed.
|
|
67
|
+
* - the default slot's content is changed.
|
|
68
|
+
*/
|
|
69
|
+
_updateTabs() {
|
|
70
|
+
const tabs = this._tabs;
|
|
71
|
+
let selectedTab;
|
|
72
|
+
for (const tab of tabs) {
|
|
73
|
+
const isActive = !selectedTab && !tab.disabled && tab.value === this.value;
|
|
74
|
+
tab.active = isActive;
|
|
75
|
+
if (isActive) {
|
|
76
|
+
selectedTab = tab;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!selectedTab) {
|
|
80
|
+
selectedTab = tabs.find((tab) => !tab.disabled);
|
|
81
|
+
if (selectedTab) {
|
|
82
|
+
selectedTab.active = true;
|
|
83
|
+
this._updateValue(selectedTab.value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!selectedTab) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
scrollIntoViewOnlyParent(selectedTab);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Updates `daikin-panel-switcher` component(s)' properties in the slot.
|
|
93
|
+
*
|
|
94
|
+
* Invoke when:
|
|
95
|
+
* - `this.value` is changed.
|
|
96
|
+
* - the default slot's content is changed.
|
|
97
|
+
* - the panel slot's content is changed.
|
|
98
|
+
*/
|
|
99
|
+
_updatePanelSwitcher() {
|
|
100
|
+
const panelSwitchers = this._panelSwitchers;
|
|
101
|
+
const tabs = this._tabs;
|
|
102
|
+
const panels = Array.from(new Set(tabs.map((tab) => tab.value)));
|
|
103
|
+
for (const panelSwitcher of panelSwitchers) {
|
|
104
|
+
panelSwitcher.panelRole = "tabpanel";
|
|
105
|
+
panelSwitcher.panels = panels;
|
|
106
|
+
panelSwitcher.value = this.value;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Handles "click" event emitted by `daikin-tab` component.
|
|
111
|
+
*/
|
|
112
|
+
_handleTabClick(event) {
|
|
113
|
+
const tabs = this._tabs;
|
|
114
|
+
const tab = event.target;
|
|
115
|
+
if (!tab || !tabs.includes(tab)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
event.stopImmediatePropagation();
|
|
119
|
+
if (this.value === tab.value) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (!this._emitBeforeChange(tab.value)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
for (const element of tabs) {
|
|
126
|
+
element.active = element === tab;
|
|
127
|
+
}
|
|
128
|
+
this._updateValue(tab.value);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Handles keyboard interactions in the tab list.
|
|
132
|
+
*/
|
|
133
|
+
_handleKeyDown(event) {
|
|
134
|
+
const moveOffset = {
|
|
135
|
+
ArrowRight: 1,
|
|
136
|
+
ArrowLeft: -1
|
|
137
|
+
}[event.key];
|
|
138
|
+
if (!moveOffset) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const tabs = this._tabs;
|
|
142
|
+
if (!tabs.some((tab) => !tab.disabled)) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const activeElement = document.activeElement;
|
|
146
|
+
const focusedTabIndex = activeElement ? tabs.findIndex((tab) => tab.contains(activeElement)) : -1;
|
|
147
|
+
if (focusedTabIndex < 0) {
|
|
148
|
+
const activeTab = tabs.find((tab) => !tab.disabled && tab.active);
|
|
149
|
+
activeTab == null ? void 0 : activeTab.focus();
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
for (let i = 1; i <= tabs.length; i++) {
|
|
154
|
+
const index = (focusedTabIndex + moveOffset * i + tabs.length * i) % tabs.length;
|
|
155
|
+
const candidate = tabs[index];
|
|
156
|
+
if (candidate.disabled) {
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
candidate.focus();
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
_handleSlotChange() {
|
|
165
|
+
this._updateTabs();
|
|
166
|
+
this._updatePanelSwitcher();
|
|
167
|
+
}
|
|
168
|
+
_handlePanelSwitcherSlotChange() {
|
|
169
|
+
this._updatePanelSwitcher();
|
|
170
|
+
}
|
|
171
|
+
render() {
|
|
172
|
+
return html`
|
|
173
|
+
<div
|
|
174
|
+
part="tablist"
|
|
175
|
+
role="tablist"
|
|
176
|
+
@click=${this._handleTabClick}
|
|
177
|
+
@keydown=${this._handleKeyDown}
|
|
178
|
+
>
|
|
179
|
+
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
180
|
+
</div>
|
|
181
|
+
<slot
|
|
182
|
+
name="panels"
|
|
183
|
+
@slotchange=${this._handlePanelSwitcherSlotChange}
|
|
184
|
+
></slot>
|
|
185
|
+
`;
|
|
186
|
+
}
|
|
187
|
+
updated(changedProperties) {
|
|
188
|
+
if (!changedProperties.has("value")) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
this._updateTabs();
|
|
192
|
+
this._updatePanelSwitcher();
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
DaikinTabGroup.styles = css`
|
|
196
|
+
${unsafeCSS(tailwindStyles)}
|
|
197
|
+
`;
|
|
198
|
+
__decorateClass([
|
|
199
|
+
property({ type: String, reflect: true })
|
|
200
|
+
], DaikinTabGroup.prototype, "value", 2);
|
|
201
|
+
__decorateClass([
|
|
202
|
+
queryAssignedElements({ selector: "daikin-tab" })
|
|
203
|
+
], DaikinTabGroup.prototype, "_tabs", 2);
|
|
204
|
+
__decorateClass([
|
|
205
|
+
queryAssignedElements({ slot: "panels", selector: "daikin-panel-switcher" })
|
|
206
|
+
], DaikinTabGroup.prototype, "_panelSwitchers", 2);
|
|
207
|
+
DaikinTabGroup = __decorateClass([
|
|
208
|
+
customElement("daikin-tab-group")
|
|
209
|
+
], DaikinTabGroup);
|
|
210
|
+
export {
|
|
211
|
+
DaikinTabGroup
|
|
212
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './daikin-tab-group';
|