@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,25 @@
|
|
|
1
|
+
export type Direction = "horizontal" | "vertical" | "either";
|
|
2
|
+
/**
|
|
3
|
+
* Get practical parent element, with consideration for slots and shadow roots.
|
|
4
|
+
*
|
|
5
|
+
* @param element element
|
|
6
|
+
* @returns The parent element (if any)
|
|
7
|
+
*/
|
|
8
|
+
export declare function getEffectiveParentElement(element: HTMLElement): HTMLElement | null;
|
|
9
|
+
/**
|
|
10
|
+
* Get the first scrollable ancestor element.
|
|
11
|
+
*
|
|
12
|
+
* @param element element
|
|
13
|
+
* @param direction scroll direction
|
|
14
|
+
* @returns the first scrollable ancestor element (if any)
|
|
15
|
+
*/
|
|
16
|
+
export declare function getFirstScrollableAncestor(element: HTMLElement, direction: Direction): HTMLElement | null;
|
|
17
|
+
export declare function calcScrollIntoViewOffset(target: HTMLElement, container: HTMLElement): [x: number, y: number];
|
|
18
|
+
/**
|
|
19
|
+
* An alternative `.scrollIntoView()` function which only scrolls the first scrollable ancestor element.
|
|
20
|
+
*
|
|
21
|
+
* @param target target element
|
|
22
|
+
* @param direction direction
|
|
23
|
+
* @returns `true` if success, `false` if scrollable parent not found
|
|
24
|
+
*/
|
|
25
|
+
export declare function scrollIntoViewOnlyParent(target: HTMLElement, direction: Direction): boolean;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
function getEffectiveParentElement(element) {
|
|
2
|
+
var _a;
|
|
3
|
+
return element.assignedSlot || element.parentElement || ((_a = element.parentNode) == null ? void 0 : _a.host);
|
|
4
|
+
}
|
|
5
|
+
function getBooleanForDirection(horizontal, vertical, direction) {
|
|
6
|
+
return horizontal;
|
|
7
|
+
}
|
|
8
|
+
function isScrollableOverflowValue(overflow) {
|
|
9
|
+
return overflow !== "visible" && overflow !== "hidden" && overflow !== "clip";
|
|
10
|
+
}
|
|
11
|
+
function getFirstScrollableAncestor(element, direction) {
|
|
12
|
+
const parent = getEffectiveParentElement(element);
|
|
13
|
+
if (!parent) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const overflow = getBooleanForDirection(
|
|
17
|
+
parent.scrollWidth > parent.clientWidth,
|
|
18
|
+
parent.scrollHeight > parent.clientHeight
|
|
19
|
+
);
|
|
20
|
+
if (overflow) {
|
|
21
|
+
const computedStyle = getComputedStyle(parent);
|
|
22
|
+
const scrollableOverflow = getBooleanForDirection(
|
|
23
|
+
isScrollableOverflowValue(computedStyle.overflowX),
|
|
24
|
+
isScrollableOverflowValue(computedStyle.overflowY)
|
|
25
|
+
);
|
|
26
|
+
if (scrollableOverflow) {
|
|
27
|
+
return parent;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return getFirstScrollableAncestor(parent);
|
|
31
|
+
}
|
|
32
|
+
function calcScrollIntoViewOffset(target, container) {
|
|
33
|
+
const bBoxContainer = container.getBoundingClientRect();
|
|
34
|
+
const bBoxTarget = target.getBoundingClientRect();
|
|
35
|
+
const scrollByX = (
|
|
36
|
+
// If the left end of the target is to the left of the container, align the left end of the target so that it is in the viewport.
|
|
37
|
+
Math.min(bBoxTarget.left - bBoxContainer.left, 0) || // If the right end of the target is to the right of the container, align the right end of the target so that it is in the viewport.
|
|
38
|
+
Math.max(bBoxTarget.right - bBoxContainer.right, 0)
|
|
39
|
+
);
|
|
40
|
+
const scrollByY = Math.min(bBoxTarget.top - bBoxContainer.top, 0) || Math.max(bBoxTarget.bottom - bBoxContainer.bottom, 0);
|
|
41
|
+
return [scrollByX, scrollByY];
|
|
42
|
+
}
|
|
43
|
+
function scrollIntoViewOnlyParent(target, direction) {
|
|
44
|
+
const scrollableParent = getFirstScrollableAncestor(target);
|
|
45
|
+
if (!scrollableParent) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
let [scrollByX, scrollByY] = calcScrollIntoViewOffset(
|
|
49
|
+
target,
|
|
50
|
+
scrollableParent
|
|
51
|
+
);
|
|
52
|
+
{
|
|
53
|
+
scrollByY = 0;
|
|
54
|
+
}
|
|
55
|
+
if (scrollByX || scrollByY) {
|
|
56
|
+
scrollableParent.scrollBy(scrollByX, scrollByY);
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
calcScrollIntoViewOffset,
|
|
62
|
+
getEffectiveParentElement,
|
|
63
|
+
getFirstScrollableAncestor,
|
|
64
|
+
scrollIntoViewOnlyParent
|
|
65
|
+
};
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* The text input component is a UI element that allows users to input single-line text data.
|
|
4
|
+
* It functions similarly to the HTML `<input type="text">` tag, providing a simple and efficient way for users to enter and edit short pieces of texts, such as names, email addresses, or search queries.
|
|
5
|
+
* Can be used within `daikin-input-group` component.
|
|
6
|
+
*
|
|
7
|
+
* Hierarchies:
|
|
8
|
+
* - `daikin-text-input` (can be used solely)
|
|
9
|
+
* - `daikin-input-group` > `daikin-text-input`
|
|
10
|
+
*
|
|
11
|
+
* @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>` element.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* ```html
|
|
16
|
+
* <!-- See `daikin-input-group` component for complete example. -->
|
|
17
|
+
* <daikin-text-input name="name"></daikin-text-input>
|
|
18
|
+
* ```
|
|
5
19
|
*/
|
|
6
20
|
export declare class DaikinTextInput extends LitElement {
|
|
7
21
|
static readonly styles: import('lit').CSSResult;
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* The textarea component is designed for multiline text input, similar to the HTML `<textarea>` tag.
|
|
4
|
+
* It is ideal for situations where users need to enter longer pieces of text, such as comments, descriptions, or messages.
|
|
5
|
+
* Can be used within `daikin-input-group` component.
|
|
6
|
+
*
|
|
7
|
+
* Hierarchies:
|
|
8
|
+
* - `daikin-textarea` (can be used solely)
|
|
9
|
+
* - `daikin-input-group` > `daikin-textarea`
|
|
10
|
+
*
|
|
11
|
+
* @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 `<textarea>` element.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* ```html
|
|
16
|
+
* <!-- See `daikin-input-group` component for complete example. -->
|
|
17
|
+
* <daikin-textarea name="name"></daikin-textarea>
|
|
18
|
+
* ```
|
|
5
19
|
*/
|
|
6
20
|
export declare class DaikinTextarea extends LitElement {
|
|
7
21
|
static readonly styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import { MergeVariantProps } from '../../type-utils';
|
|
3
|
+
declare const cvaToggle: (props?: ({
|
|
4
|
+
size?: "default" | "small" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
type ToggleVariantProps = MergeVariantProps<typeof cvaToggle>;
|
|
7
|
+
/**
|
|
8
|
+
* The toggle switch component is a UI element that allows users to switch between two states, typically "on" and "off".
|
|
9
|
+
* It functions similarly to a `daikin-checkbox` component but provides a more visually intuitive way to represent binary options.
|
|
10
|
+
* This component is ideal for scenarios where the binary choice has a significant or immediate effect, such as enabling or disabling a feature or setting.
|
|
11
|
+
* Unlike `daikin-checkbox`, this component doesn't have a label and a "indeterminate" state.
|
|
12
|
+
*
|
|
13
|
+
* @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="checkbox">` element.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
*
|
|
17
|
+
* ```html
|
|
18
|
+
* <daikin-toggle name="name" value="value"></daikin-toggle>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class DaikinToggle extends LitElement {
|
|
22
|
+
static readonly styles: import('lit').CSSResult;
|
|
23
|
+
static readonly formAssociated = true;
|
|
24
|
+
private _internals;
|
|
25
|
+
private _updateFormValue;
|
|
26
|
+
private _input;
|
|
27
|
+
private _handleChange;
|
|
28
|
+
/**
|
|
29
|
+
* Specify the component size
|
|
30
|
+
*/
|
|
31
|
+
size: ToggleVariantProps["size"];
|
|
32
|
+
/**
|
|
33
|
+
* Specify whether the Toggle should be disabled
|
|
34
|
+
*/
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Specify whether the control is checked
|
|
38
|
+
*/
|
|
39
|
+
checked: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The form name.
|
|
42
|
+
*/
|
|
43
|
+
name: string;
|
|
44
|
+
/**
|
|
45
|
+
* The value.
|
|
46
|
+
*/
|
|
47
|
+
value: string;
|
|
48
|
+
/**
|
|
49
|
+
* Specify whether the Toggle is in a error state
|
|
50
|
+
*/
|
|
51
|
+
error: boolean;
|
|
52
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
53
|
+
updated(changedProperties: PropertyValues<this>): void;
|
|
54
|
+
}
|
|
55
|
+
declare global {
|
|
56
|
+
interface HTMLElementTagNameMap {
|
|
57
|
+
"daikin-toggle": DaikinToggle;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
import { css, unsafeCSS, LitElement, html } from "lit";
|
|
3
|
+
import { query, 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 cvaToggle = cva(
|
|
16
|
+
[
|
|
17
|
+
"appearance-none",
|
|
18
|
+
"cursor-pointer",
|
|
19
|
+
"relative",
|
|
20
|
+
"bg-daikinNeutral-200",
|
|
21
|
+
"rounded-3xl",
|
|
22
|
+
"transition-color",
|
|
23
|
+
"duration-300",
|
|
24
|
+
"disabled:bg-daikinNeutral-200",
|
|
25
|
+
"before:content-['']",
|
|
26
|
+
"before:absolute",
|
|
27
|
+
"before:rounded-full",
|
|
28
|
+
"before:transition",
|
|
29
|
+
"before:disabled:bg-daikinNeutral-400"
|
|
30
|
+
],
|
|
31
|
+
{
|
|
32
|
+
variants: {
|
|
33
|
+
size: {
|
|
34
|
+
default: [
|
|
35
|
+
"w-[51px]",
|
|
36
|
+
"h-[31px]",
|
|
37
|
+
"checked:bg-daikinBlue-500",
|
|
38
|
+
"before:h-[27px]",
|
|
39
|
+
"before:w-[27px]",
|
|
40
|
+
"before:bg-white",
|
|
41
|
+
"before:top-[2px]",
|
|
42
|
+
"before:left-[2px]",
|
|
43
|
+
"before:checked:translate-x-5"
|
|
44
|
+
],
|
|
45
|
+
small: [
|
|
46
|
+
"w-8",
|
|
47
|
+
"h-[14px]",
|
|
48
|
+
"checked:bg-daikinBlue-50",
|
|
49
|
+
"before:h-5",
|
|
50
|
+
"before:w-5",
|
|
51
|
+
"before:top-[-3px]",
|
|
52
|
+
"before:bg-daikinNeutral-600",
|
|
53
|
+
"before:checked:bg-daikinBlue-500",
|
|
54
|
+
"before:checked:translate-x-3"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
let DaikinToggle = class extends LitElement {
|
|
61
|
+
constructor() {
|
|
62
|
+
super(...arguments);
|
|
63
|
+
this._internals = this.attachInternals();
|
|
64
|
+
this.size = "default";
|
|
65
|
+
this.disabled = false;
|
|
66
|
+
this.checked = false;
|
|
67
|
+
this.name = "";
|
|
68
|
+
this.value = "";
|
|
69
|
+
this.error = false;
|
|
70
|
+
}
|
|
71
|
+
_updateFormValue() {
|
|
72
|
+
this._internals.setFormValue(this.checked ? this.value : null);
|
|
73
|
+
}
|
|
74
|
+
_handleChange(event) {
|
|
75
|
+
if (!this._input) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this._updateFormValue();
|
|
79
|
+
this.dispatchEvent(new Event("change", event));
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
const toggleClassName = cvaToggle({ size: this.size });
|
|
83
|
+
return html`<input
|
|
84
|
+
class=${toggleClassName}
|
|
85
|
+
type="checkbox"
|
|
86
|
+
name=${this.name}
|
|
87
|
+
value=${this.value}
|
|
88
|
+
.checked=${this.checked}
|
|
89
|
+
?disabled=${this.disabled}
|
|
90
|
+
@change=${this._handleChange}
|
|
91
|
+
/>`;
|
|
92
|
+
}
|
|
93
|
+
updated(changedProperties) {
|
|
94
|
+
if (changedProperties.has("checked")) {
|
|
95
|
+
this._updateFormValue();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
DaikinToggle.styles = css`
|
|
100
|
+
${unsafeCSS(tailwindStyles)}
|
|
101
|
+
|
|
102
|
+
:host {
|
|
103
|
+
display: inline-flex;
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
DaikinToggle.formAssociated = true;
|
|
107
|
+
__decorateClass([
|
|
108
|
+
query("input")
|
|
109
|
+
], DaikinToggle.prototype, "_input", 2);
|
|
110
|
+
__decorateClass([
|
|
111
|
+
property({ type: String })
|
|
112
|
+
], DaikinToggle.prototype, "size", 2);
|
|
113
|
+
__decorateClass([
|
|
114
|
+
property({ type: Boolean, reflect: true })
|
|
115
|
+
], DaikinToggle.prototype, "disabled", 2);
|
|
116
|
+
__decorateClass([
|
|
117
|
+
property({ type: Boolean, reflect: true })
|
|
118
|
+
], DaikinToggle.prototype, "checked", 2);
|
|
119
|
+
__decorateClass([
|
|
120
|
+
property({ type: String, reflect: true })
|
|
121
|
+
], DaikinToggle.prototype, "name", 2);
|
|
122
|
+
__decorateClass([
|
|
123
|
+
property({ type: String, reflect: true })
|
|
124
|
+
], DaikinToggle.prototype, "value", 2);
|
|
125
|
+
__decorateClass([
|
|
126
|
+
property({ type: Boolean, reflect: true })
|
|
127
|
+
], DaikinToggle.prototype, "error", 2);
|
|
128
|
+
DaikinToggle = __decorateClass([
|
|
129
|
+
customElement("daikin-toggle")
|
|
130
|
+
], DaikinToggle);
|
|
131
|
+
export {
|
|
132
|
+
DaikinToggle
|
|
133
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './daikin-toggle';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* A tooltip component is used to show brief information when a user interacts with an element.
|
|
4
|
+
*
|
|
5
|
+
* @fires beforetoggle - _Cancellable._ A custom event emitted when the tooltip is about to be opened or closed by user interaction.
|
|
6
|
+
* @fires toggle - A custom event emitted when the tooltip is opened or closed.
|
|
7
|
+
*
|
|
8
|
+
* @slot - A slot for the element to which the tooltip is attached (the trigger element).
|
|
9
|
+
* @slot tooltip - A slot for the tooltip content.
|
|
10
|
+
*
|
|
11
|
+
* @cssprop [--dds-tooltip-spacing=20px] - Spacing between the tooltip and the trigger
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* ```html
|
|
16
|
+
* </daikin-tooltip>
|
|
17
|
+
* <span slot="tooltip">This is a message</span>
|
|
18
|
+
* <span>hover me</span>
|
|
19
|
+
* </daikin-tooltip>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* ```html
|
|
23
|
+
* </daikin-tooltip description="This is a message">
|
|
24
|
+
* <span>hover me</span>
|
|
25
|
+
* </daikin-tooltip>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class DaikinTooltip extends LitElement {
|
|
29
|
+
static registerCSSCustomProperties(): void;
|
|
30
|
+
static readonly styles: import('lit').CSSResult;
|
|
31
|
+
/**
|
|
32
|
+
* Specifies the position of the tooltip relative to the trigger.
|
|
33
|
+
*/
|
|
34
|
+
placement: "top" | "bottom" | "left" | "right";
|
|
35
|
+
/**
|
|
36
|
+
* Specifies the tooltip theme.
|
|
37
|
+
*/
|
|
38
|
+
variant: "light" | "dark";
|
|
39
|
+
/**
|
|
40
|
+
* Whether the tooltip is open.
|
|
41
|
+
*/
|
|
42
|
+
open: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the content of the tooltip.
|
|
45
|
+
* Ignored if the `tooltip` slot exists.
|
|
46
|
+
*/
|
|
47
|
+
description: string;
|
|
48
|
+
/**
|
|
49
|
+
* if true, the tooltip will hide on click.
|
|
50
|
+
*/
|
|
51
|
+
closeOnClick: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* How the tooltip is controlled.
|
|
54
|
+
* - "hover": The tooltip is displayed when the mouse hovers over the trigger element, and hidden when the mouse is no longer hovering. (default)
|
|
55
|
+
* - "manual": The tooltip does not respond to user interaction. Use this to control the tooltip programmatically.
|
|
56
|
+
*/
|
|
57
|
+
trigger: "hover" | "manual";
|
|
58
|
+
private _tooltipRef;
|
|
59
|
+
private _triggerRef;
|
|
60
|
+
private _autoUpdateCleanup;
|
|
61
|
+
private _hostStyles;
|
|
62
|
+
private _startAutoUpdate;
|
|
63
|
+
private _uninstallAutoUpdate;
|
|
64
|
+
private _changeOpenState;
|
|
65
|
+
private _handleClick;
|
|
66
|
+
private _handleMouseLeave;
|
|
67
|
+
private _handleMouseEnter;
|
|
68
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
69
|
+
protected updated(changedProperties: PropertyValues<this>): void;
|
|
70
|
+
disconnectedCallback(): void;
|
|
71
|
+
}
|
|
72
|
+
declare global {
|
|
73
|
+
interface HTMLElementTagNameMap {
|
|
74
|
+
"daikin-tooltip": DaikinTooltip;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { autoUpdate, computePosition, offset, flip, shift } from "@floating-ui/dom";
|
|
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 { createRef, ref } from "lit/directives/ref.js";
|
|
6
|
+
import { isClient } from "../../is-client.js";
|
|
7
|
+
import tailwindStyles from "../../tailwind.css.js";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
12
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
+
if (decorator = decorators[i])
|
|
14
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
15
|
+
if (kind && result) __defProp(target, key, result);
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
const cvaTooltip = cva(
|
|
19
|
+
[
|
|
20
|
+
"absolute",
|
|
21
|
+
"p-3",
|
|
22
|
+
"justify-center",
|
|
23
|
+
"items-center",
|
|
24
|
+
"rounded",
|
|
25
|
+
"w-max",
|
|
26
|
+
"top-0",
|
|
27
|
+
"left-0",
|
|
28
|
+
"max-w-[312px]",
|
|
29
|
+
"text-sm",
|
|
30
|
+
"font-daikinSerif",
|
|
31
|
+
"font-normal",
|
|
32
|
+
"not-italic",
|
|
33
|
+
"leading-5"
|
|
34
|
+
],
|
|
35
|
+
{
|
|
36
|
+
variants: {
|
|
37
|
+
variant: {
|
|
38
|
+
light: [
|
|
39
|
+
"border",
|
|
40
|
+
"border-solid",
|
|
41
|
+
"border-daikinNeutral-800",
|
|
42
|
+
"bg-white/90",
|
|
43
|
+
"text-black"
|
|
44
|
+
],
|
|
45
|
+
dark: ["bg-daikinNeutral-800/90", "text-white"]
|
|
46
|
+
},
|
|
47
|
+
open: {
|
|
48
|
+
true: ["visible", "opacity-100"],
|
|
49
|
+
false: ["invisible", "opacity-0"]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
const DEFAULT_TOOLTIP_SPACING = "20px";
|
|
55
|
+
let DaikinTooltip = class extends LitElement {
|
|
56
|
+
constructor() {
|
|
57
|
+
super(...arguments);
|
|
58
|
+
this.placement = "bottom";
|
|
59
|
+
this.variant = "light";
|
|
60
|
+
this.open = false;
|
|
61
|
+
this.description = "";
|
|
62
|
+
this.closeOnClick = false;
|
|
63
|
+
this.trigger = "hover";
|
|
64
|
+
this._tooltipRef = createRef();
|
|
65
|
+
this._triggerRef = createRef();
|
|
66
|
+
this._autoUpdateCleanup = null;
|
|
67
|
+
this._hostStyles = isClient ? window.getComputedStyle(this) : null;
|
|
68
|
+
}
|
|
69
|
+
static registerCSSCustomProperties() {
|
|
70
|
+
if (!isClient) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
window.CSS.registerProperty({
|
|
74
|
+
name: "--dds-tooltip-spacing",
|
|
75
|
+
syntax: "<length>",
|
|
76
|
+
inherits: true,
|
|
77
|
+
initialValue: "0px"
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
_startAutoUpdate() {
|
|
81
|
+
var _a;
|
|
82
|
+
if (!isClient) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const reference = this._triggerRef.value;
|
|
86
|
+
const float = this._tooltipRef.value;
|
|
87
|
+
if (!reference || !float) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
(_a = this._autoUpdateCleanup) == null ? void 0 : _a.call(this);
|
|
91
|
+
this._autoUpdateCleanup = autoUpdate(reference, float, () => {
|
|
92
|
+
var _a2;
|
|
93
|
+
const spacing = parseInt(
|
|
94
|
+
((_a2 = this._hostStyles) == null ? void 0 : _a2.getPropertyValue("--dds-tooltip-spacing")) || DEFAULT_TOOLTIP_SPACING,
|
|
95
|
+
10
|
|
96
|
+
);
|
|
97
|
+
computePosition(reference, float, {
|
|
98
|
+
placement: this.placement,
|
|
99
|
+
middleware: [offset({ mainAxis: spacing }), flip(), shift()]
|
|
100
|
+
}).then(({ x, y }) => {
|
|
101
|
+
Object.assign(float.style, {
|
|
102
|
+
left: `${x}px`,
|
|
103
|
+
top: `${y}px`
|
|
104
|
+
});
|
|
105
|
+
}).catch((e) => console.error(e));
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
_uninstallAutoUpdate() {
|
|
109
|
+
var _a;
|
|
110
|
+
this.open = false;
|
|
111
|
+
(_a = this._autoUpdateCleanup) == null ? void 0 : _a.call(this);
|
|
112
|
+
this._autoUpdateCleanup = null;
|
|
113
|
+
}
|
|
114
|
+
_changeOpenState(state) {
|
|
115
|
+
if (this.open === state) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (!this.dispatchEvent(
|
|
119
|
+
new CustomEvent("beforetoggle", {
|
|
120
|
+
detail: { open: this.open },
|
|
121
|
+
bubbles: true,
|
|
122
|
+
composed: true,
|
|
123
|
+
cancelable: true
|
|
124
|
+
})
|
|
125
|
+
)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.open = state;
|
|
129
|
+
}
|
|
130
|
+
_handleClick() {
|
|
131
|
+
if (this.closeOnClick) {
|
|
132
|
+
this._changeOpenState(false);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
_handleMouseLeave() {
|
|
136
|
+
if (this.trigger === "hover") {
|
|
137
|
+
this._changeOpenState(false);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
_handleMouseEnter() {
|
|
141
|
+
if (this.trigger === "hover") {
|
|
142
|
+
this._changeOpenState(true);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
render() {
|
|
146
|
+
const tooltipClassName = cvaTooltip({
|
|
147
|
+
variant: this.variant,
|
|
148
|
+
open: this.open
|
|
149
|
+
});
|
|
150
|
+
return html`<div class="relative inline-block">
|
|
151
|
+
<div
|
|
152
|
+
${ref(this._triggerRef)}
|
|
153
|
+
part="trigger"
|
|
154
|
+
@click=${this._handleClick}
|
|
155
|
+
@keydown=${this._handleClick}
|
|
156
|
+
@mouseleave=${this._handleMouseLeave}
|
|
157
|
+
@mouseenter=${this._handleMouseEnter}
|
|
158
|
+
>
|
|
159
|
+
<slot></slot>
|
|
160
|
+
</div>
|
|
161
|
+
<span ${ref(this._tooltipRef)} part="tooltip" class=${tooltipClassName}>
|
|
162
|
+
<slot name="tooltip">
|
|
163
|
+
<span class="whitespace-pre-line">${this.description}</span>
|
|
164
|
+
</slot>
|
|
165
|
+
</span>
|
|
166
|
+
</div>`;
|
|
167
|
+
}
|
|
168
|
+
updated(changedProperties) {
|
|
169
|
+
var _a;
|
|
170
|
+
if (changedProperties.has("open")) {
|
|
171
|
+
if (this.open) {
|
|
172
|
+
this._startAutoUpdate();
|
|
173
|
+
} else {
|
|
174
|
+
(_a = this._autoUpdateCleanup) == null ? void 0 : _a.call(this);
|
|
175
|
+
this._autoUpdateCleanup = null;
|
|
176
|
+
}
|
|
177
|
+
this.dispatchEvent(
|
|
178
|
+
new CustomEvent("toggle", {
|
|
179
|
+
detail: { open: this.open },
|
|
180
|
+
bubbles: true,
|
|
181
|
+
composed: true,
|
|
182
|
+
cancelable: false
|
|
183
|
+
})
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
disconnectedCallback() {
|
|
188
|
+
this._uninstallAutoUpdate();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
DaikinTooltip.styles = css`
|
|
192
|
+
${unsafeCSS(tailwindStyles)}
|
|
193
|
+
|
|
194
|
+
:host {
|
|
195
|
+
display: inline-block;
|
|
196
|
+
|
|
197
|
+
--dds-tooltip-spacing: ${unsafeCSS(DEFAULT_TOOLTIP_SPACING)};
|
|
198
|
+
}
|
|
199
|
+
`;
|
|
200
|
+
__decorateClass([
|
|
201
|
+
property({ reflect: true, type: String })
|
|
202
|
+
], DaikinTooltip.prototype, "placement", 2);
|
|
203
|
+
__decorateClass([
|
|
204
|
+
property({ reflect: true, type: String })
|
|
205
|
+
], DaikinTooltip.prototype, "variant", 2);
|
|
206
|
+
__decorateClass([
|
|
207
|
+
property({ reflect: true, type: Boolean })
|
|
208
|
+
], DaikinTooltip.prototype, "open", 2);
|
|
209
|
+
__decorateClass([
|
|
210
|
+
property({ type: String })
|
|
211
|
+
], DaikinTooltip.prototype, "description", 2);
|
|
212
|
+
__decorateClass([
|
|
213
|
+
property({ reflect: true, type: Boolean })
|
|
214
|
+
], DaikinTooltip.prototype, "closeOnClick", 2);
|
|
215
|
+
__decorateClass([
|
|
216
|
+
property({ reflect: true, type: String })
|
|
217
|
+
], DaikinTooltip.prototype, "trigger", 2);
|
|
218
|
+
DaikinTooltip = __decorateClass([
|
|
219
|
+
customElement("daikin-tooltip")
|
|
220
|
+
], DaikinTooltip);
|
|
221
|
+
DaikinTooltip.registerCSSCustomProperties();
|
|
222
|
+
export {
|
|
223
|
+
DaikinTooltip
|
|
224
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './daikin-tooltip';
|