@daikin-oss/design-system-web-components 0.6.0 → 0.7.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/CHANGELOG.md +58 -0
- package/README.md +40 -23
- package/dist/cjs/components/accordion-item/daikin-accordion-item.cjs +8 -8
- package/dist/cjs/components/breadcrumb/daikin-breadcrumb.cjs +19 -80
- package/dist/cjs/components/breadcrumb/daikin-breadcrumb.d.cts +11 -23
- package/dist/cjs/components/breadcrumb-item/daikin-breadcrumb-item.cjs +25 -77
- package/dist/cjs/components/breadcrumb-item/daikin-breadcrumb-item.d.cts +14 -23
- package/dist/cjs/components/button/daikin-button.cjs +16 -15
- package/dist/cjs/components/button/daikin-button.d.cts +2 -2
- package/dist/cjs/components/card/daikin-card.cjs +63 -0
- package/dist/cjs/components/card/daikin-card.d.cts +42 -0
- package/dist/cjs/components/card/index.cjs +7 -0
- package/dist/cjs/components/card/index.d.cts +1 -0
- package/dist/cjs/components/card-footer/daikin-card-footer.cjs +33 -0
- package/dist/cjs/components/card-footer/daikin-card-footer.d.cts +29 -0
- package/dist/cjs/components/card-footer/index.cjs +7 -0
- package/dist/cjs/components/card-footer/index.d.cts +1 -0
- package/dist/cjs/components/card-header/daikin-card-header.cjs +59 -0
- package/dist/cjs/components/card-header/daikin-card-header.d.cts +31 -0
- package/dist/cjs/components/card-header/index.cjs +7 -0
- package/dist/cjs/components/card-header/index.d.cts +1 -0
- package/dist/cjs/components/checkbox/daikin-checkbox.cjs +29 -29
- package/dist/cjs/components/dropdown/daikin-dropdown.cjs +14 -14
- package/dist/cjs/components/dropdown-item/daikin-dropdown-item.cjs +9 -9
- package/dist/cjs/components/icon/daikin-icon.cjs +8 -8
- package/dist/cjs/components/icon/daikin-icon.d.cts +3 -3
- package/dist/cjs/components/icon-button/daikin-icon-button.cjs +21 -20
- package/dist/cjs/components/index.cjs +31 -0
- package/dist/cjs/components/index.d.cts +6 -0
- package/dist/cjs/components/input-group/daikin-input-group.cjs +61 -45
- package/dist/cjs/components/input-group/daikin-input-group.d.cts +10 -1
- package/dist/cjs/components/link/daikin-link.cjs +32 -50
- package/dist/cjs/components/list-item/daikin-list-item.cjs +8 -8
- package/dist/cjs/components/notification/daikin-notification.cjs +18 -19
- package/dist/cjs/components/pagination/daikin-pagination.cjs +22 -24
- package/dist/cjs/components/progress-bar/daikin-progress-bar.cjs +22 -12
- package/dist/cjs/components/progress-indicator/daikin-progress-indicator.cjs +1 -6
- package/dist/cjs/components/progress-indicator-item/daikin-progress-indicator-item.cjs +12 -12
- package/dist/cjs/components/radio/daikin-radio.cjs +12 -10
- package/dist/cjs/components/select/daikin-select.cjs +11 -11
- package/dist/cjs/components/tab/daikin-tab.cjs +13 -13
- package/dist/cjs/components/table/daikin-table.cjs +6 -6
- package/dist/cjs/components/table-cell/daikin-table-cell.cjs +2 -2
- package/dist/cjs/components/table-header-cell/daikin-table-header-cell.cjs +4 -5
- package/dist/cjs/components/tabs/daikin-tabs.cjs +1 -1
- package/dist/cjs/components/text-area/daikin-text-area.cjs +16 -14
- package/dist/cjs/components/text-field/daikin-text-field.cjs +14 -13
- package/dist/cjs/components/toggle/daikin-toggle.cjs +10 -10
- package/dist/cjs/components/tooltip/daikin-tooltip.cjs +3 -3
- package/dist/cjs/components/tooltip/daikin-tooltip.d.cts +1 -1
- package/dist/cjs/components/tree/common.cjs +90 -0
- package/dist/cjs/components/tree/common.d.cts +32 -0
- package/dist/cjs/components/tree/daikin-tree.cjs +109 -0
- package/dist/cjs/components/tree/daikin-tree.d.cts +74 -0
- package/dist/cjs/components/tree/index.cjs +7 -0
- package/dist/cjs/components/tree/index.d.cts +1 -0
- package/dist/cjs/components/tree-item/daikin-tree-item.cjs +197 -0
- package/dist/cjs/components/tree-item/daikin-tree-item.d.cts +95 -0
- package/dist/cjs/components/tree-item/index.cjs +8 -0
- package/dist/cjs/components/tree-item/index.d.cts +1 -0
- package/dist/cjs/components/tree-section/daikin-tree-section.cjs +245 -0
- package/dist/cjs/components/tree-section/daikin-tree-section.d.cts +119 -0
- package/dist/cjs/components/tree-section/index.cjs +7 -0
- package/dist/cjs/components/tree-section/index.d.cts +1 -0
- package/dist/cjs/index.cjs +31 -2
- package/dist/cjs/index.d.cts +0 -1
- package/dist/cjs/tailwind.css.cjs +1 -1
- package/dist/cjs/utils/is-simple-key.cjs +6 -0
- package/dist/cjs/utils/is-simple-key.d.cts +7 -0
- package/dist/cjs-dev/components/accordion-item/daikin-accordion-item.cjs +8 -8
- package/dist/cjs-dev/components/breadcrumb/daikin-breadcrumb.cjs +19 -80
- package/dist/cjs-dev/components/breadcrumb/daikin-breadcrumb.d.cts +11 -23
- package/dist/cjs-dev/components/breadcrumb-item/daikin-breadcrumb-item.cjs +25 -77
- package/dist/cjs-dev/components/breadcrumb-item/daikin-breadcrumb-item.d.cts +14 -23
- package/dist/cjs-dev/components/button/daikin-button.cjs +16 -15
- package/dist/cjs-dev/components/button/daikin-button.d.cts +2 -2
- package/dist/cjs-dev/components/card/daikin-card.cjs +63 -0
- package/dist/cjs-dev/components/card/daikin-card.d.cts +42 -0
- package/dist/cjs-dev/components/card/index.cjs +7 -0
- package/dist/cjs-dev/components/card/index.d.cts +1 -0
- package/dist/cjs-dev/components/card-footer/daikin-card-footer.cjs +33 -0
- package/dist/cjs-dev/components/card-footer/daikin-card-footer.d.cts +29 -0
- package/dist/cjs-dev/components/card-footer/index.cjs +7 -0
- package/dist/cjs-dev/components/card-footer/index.d.cts +1 -0
- package/dist/cjs-dev/components/card-header/daikin-card-header.cjs +59 -0
- package/dist/cjs-dev/components/card-header/daikin-card-header.d.cts +31 -0
- package/dist/cjs-dev/components/card-header/index.cjs +7 -0
- package/dist/cjs-dev/components/card-header/index.d.cts +1 -0
- package/dist/cjs-dev/components/checkbox/daikin-checkbox.cjs +29 -29
- package/dist/cjs-dev/components/dropdown/daikin-dropdown.cjs +14 -14
- package/dist/cjs-dev/components/dropdown-item/daikin-dropdown-item.cjs +9 -9
- package/dist/cjs-dev/components/icon/daikin-icon.cjs +8 -8
- package/dist/cjs-dev/components/icon/daikin-icon.d.cts +3 -3
- package/dist/cjs-dev/components/icon-button/daikin-icon-button.cjs +21 -20
- package/dist/cjs-dev/components/index.cjs +31 -0
- package/dist/cjs-dev/components/index.d.cts +6 -0
- package/dist/cjs-dev/components/input-group/daikin-input-group.cjs +61 -45
- package/dist/cjs-dev/components/input-group/daikin-input-group.d.cts +10 -1
- package/dist/cjs-dev/components/link/daikin-link.cjs +32 -50
- package/dist/cjs-dev/components/list-item/daikin-list-item.cjs +8 -8
- package/dist/cjs-dev/components/notification/daikin-notification.cjs +18 -19
- package/dist/cjs-dev/components/pagination/daikin-pagination.cjs +22 -24
- package/dist/cjs-dev/components/progress-bar/daikin-progress-bar.cjs +22 -12
- package/dist/cjs-dev/components/progress-indicator/daikin-progress-indicator.cjs +1 -6
- package/dist/cjs-dev/components/progress-indicator-item/daikin-progress-indicator-item.cjs +12 -12
- package/dist/cjs-dev/components/radio/daikin-radio.cjs +12 -10
- package/dist/cjs-dev/components/select/daikin-select.cjs +11 -11
- package/dist/cjs-dev/components/tab/daikin-tab.cjs +13 -13
- package/dist/cjs-dev/components/table/daikin-table.cjs +6 -6
- package/dist/cjs-dev/components/table-cell/daikin-table-cell.cjs +2 -2
- package/dist/cjs-dev/components/table-header-cell/daikin-table-header-cell.cjs +4 -5
- package/dist/cjs-dev/components/tabs/daikin-tabs.cjs +1 -1
- package/dist/cjs-dev/components/text-area/daikin-text-area.cjs +16 -14
- package/dist/cjs-dev/components/text-field/daikin-text-field.cjs +14 -13
- package/dist/cjs-dev/components/toggle/daikin-toggle.cjs +10 -10
- package/dist/cjs-dev/components/tooltip/daikin-tooltip.cjs +3 -3
- package/dist/cjs-dev/components/tooltip/daikin-tooltip.d.cts +1 -1
- package/dist/cjs-dev/components/tree/common.cjs +90 -0
- package/dist/cjs-dev/components/tree/common.d.cts +32 -0
- package/dist/cjs-dev/components/tree/daikin-tree.cjs +109 -0
- package/dist/cjs-dev/components/tree/daikin-tree.d.cts +74 -0
- package/dist/cjs-dev/components/tree/index.cjs +7 -0
- package/dist/cjs-dev/components/tree/index.d.cts +1 -0
- package/dist/cjs-dev/components/tree-item/daikin-tree-item.cjs +197 -0
- package/dist/cjs-dev/components/tree-item/daikin-tree-item.d.cts +95 -0
- package/dist/cjs-dev/components/tree-item/index.cjs +8 -0
- package/dist/cjs-dev/components/tree-item/index.d.cts +1 -0
- package/dist/cjs-dev/components/tree-section/daikin-tree-section.cjs +245 -0
- package/dist/cjs-dev/components/tree-section/daikin-tree-section.d.cts +119 -0
- package/dist/cjs-dev/components/tree-section/index.cjs +7 -0
- package/dist/cjs-dev/components/tree-section/index.d.cts +1 -0
- package/dist/cjs-dev/index.cjs +31 -2
- package/dist/cjs-dev/index.d.cts +0 -1
- package/dist/cjs-dev/tailwind.css.cjs +1 -1
- package/dist/cjs-dev/utils/is-simple-key.cjs +6 -0
- package/dist/cjs-dev/utils/is-simple-key.d.cts +7 -0
- package/dist/es/components/accordion-item/daikin-accordion-item.js +8 -8
- package/dist/es/components/breadcrumb/daikin-breadcrumb.d.ts +11 -23
- package/dist/es/components/breadcrumb/daikin-breadcrumb.js +20 -81
- package/dist/es/components/breadcrumb-item/daikin-breadcrumb-item.d.ts +14 -23
- package/dist/es/components/breadcrumb-item/daikin-breadcrumb-item.js +26 -78
- package/dist/es/components/button/daikin-button.d.ts +2 -2
- package/dist/es/components/button/daikin-button.js +16 -15
- package/dist/es/components/card/daikin-card.d.ts +42 -0
- package/dist/es/components/card/daikin-card.js +64 -0
- package/dist/es/components/card/index.d.ts +1 -0
- package/dist/es/components/card/index.js +4 -0
- package/dist/es/components/card-footer/daikin-card-footer.d.ts +29 -0
- package/dist/es/components/card-footer/daikin-card-footer.js +34 -0
- package/dist/es/components/card-footer/index.d.ts +1 -0
- package/dist/es/components/card-footer/index.js +4 -0
- package/dist/es/components/card-header/daikin-card-header.d.ts +31 -0
- package/dist/es/components/card-header/daikin-card-header.js +60 -0
- package/dist/es/components/card-header/index.d.ts +1 -0
- package/dist/es/components/card-header/index.js +4 -0
- package/dist/es/components/checkbox/daikin-checkbox.js +29 -29
- package/dist/es/components/dropdown/daikin-dropdown.js +14 -14
- package/dist/es/components/dropdown-item/daikin-dropdown-item.js +9 -9
- package/dist/es/components/icon/daikin-icon.d.ts +3 -3
- package/dist/es/components/icon/daikin-icon.js +8 -8
- package/dist/es/components/icon-button/daikin-icon-button.js +21 -20
- package/dist/es/components/index.d.ts +6 -0
- package/dist/es/components/index.js +13 -0
- package/dist/es/components/input-group/daikin-input-group.d.ts +10 -1
- package/dist/es/components/input-group/daikin-input-group.js +61 -45
- package/dist/es/components/link/daikin-link.js +32 -50
- package/dist/es/components/list-item/daikin-list-item.js +8 -8
- package/dist/es/components/notification/daikin-notification.js +18 -19
- package/dist/es/components/pagination/daikin-pagination.js +22 -24
- package/dist/es/components/progress-bar/daikin-progress-bar.js +22 -12
- package/dist/es/components/progress-indicator/daikin-progress-indicator.js +1 -6
- package/dist/es/components/progress-indicator-item/daikin-progress-indicator-item.js +12 -12
- package/dist/es/components/radio/daikin-radio.js +12 -10
- package/dist/es/components/select/daikin-select.js +11 -11
- package/dist/es/components/tab/daikin-tab.js +13 -13
- package/dist/es/components/table/daikin-table.js +6 -6
- package/dist/es/components/table-cell/daikin-table-cell.js +2 -2
- package/dist/es/components/table-header-cell/daikin-table-header-cell.js +4 -5
- package/dist/es/components/tabs/daikin-tabs.js +1 -1
- package/dist/es/components/text-area/daikin-text-area.js +16 -14
- package/dist/es/components/text-field/daikin-text-field.js +14 -13
- package/dist/es/components/toggle/daikin-toggle.js +10 -10
- package/dist/es/components/tooltip/daikin-tooltip.d.ts +1 -1
- package/dist/es/components/tooltip/daikin-tooltip.js +3 -3
- package/dist/es/components/tree/common.d.ts +32 -0
- package/dist/es/components/tree/common.js +90 -0
- package/dist/es/components/tree/daikin-tree.d.ts +74 -0
- package/dist/es/components/tree/daikin-tree.js +110 -0
- package/dist/es/components/tree/index.d.ts +1 -0
- package/dist/es/components/tree/index.js +4 -0
- package/dist/es/components/tree-item/daikin-tree-item.d.ts +95 -0
- package/dist/es/components/tree-item/daikin-tree-item.js +198 -0
- package/dist/es/components/tree-item/index.d.ts +1 -0
- package/dist/es/components/tree-item/index.js +5 -0
- package/dist/es/components/tree-section/daikin-tree-section.d.ts +119 -0
- package/dist/es/components/tree-section/daikin-tree-section.js +246 -0
- package/dist/es/components/tree-section/index.d.ts +1 -0
- package/dist/es/components/tree-section/index.js +4 -0
- package/dist/es/index.d.ts +0 -1
- package/dist/es/index.js +13 -2
- package/dist/es/tailwind.css.js +1 -1
- package/dist/es/utils/is-simple-key.d.ts +7 -0
- package/dist/es/utils/is-simple-key.js +6 -0
- package/dist/es-dev/components/accordion-item/daikin-accordion-item.js +8 -8
- package/dist/es-dev/components/breadcrumb/daikin-breadcrumb.d.ts +11 -23
- package/dist/es-dev/components/breadcrumb/daikin-breadcrumb.js +20 -81
- package/dist/es-dev/components/breadcrumb-item/daikin-breadcrumb-item.d.ts +14 -23
- package/dist/es-dev/components/breadcrumb-item/daikin-breadcrumb-item.js +26 -78
- package/dist/es-dev/components/button/daikin-button.d.ts +2 -2
- package/dist/es-dev/components/button/daikin-button.js +16 -15
- package/dist/es-dev/components/card/daikin-card.d.ts +42 -0
- package/dist/es-dev/components/card/daikin-card.js +64 -0
- package/dist/es-dev/components/card/index.d.ts +1 -0
- package/dist/es-dev/components/card/index.js +4 -0
- package/dist/es-dev/components/card-footer/daikin-card-footer.d.ts +29 -0
- package/dist/es-dev/components/card-footer/daikin-card-footer.js +34 -0
- package/dist/es-dev/components/card-footer/index.d.ts +1 -0
- package/dist/es-dev/components/card-footer/index.js +4 -0
- package/dist/es-dev/components/card-header/daikin-card-header.d.ts +31 -0
- package/dist/es-dev/components/card-header/daikin-card-header.js +60 -0
- package/dist/es-dev/components/card-header/index.d.ts +1 -0
- package/dist/es-dev/components/card-header/index.js +4 -0
- package/dist/es-dev/components/checkbox/daikin-checkbox.js +29 -29
- package/dist/es-dev/components/dropdown/daikin-dropdown.js +14 -14
- package/dist/es-dev/components/dropdown-item/daikin-dropdown-item.js +9 -9
- package/dist/es-dev/components/icon/daikin-icon.d.ts +3 -3
- package/dist/es-dev/components/icon/daikin-icon.js +8 -8
- package/dist/es-dev/components/icon-button/daikin-icon-button.js +21 -20
- package/dist/es-dev/components/index.d.ts +6 -0
- package/dist/es-dev/components/index.js +13 -0
- package/dist/es-dev/components/input-group/daikin-input-group.d.ts +10 -1
- package/dist/es-dev/components/input-group/daikin-input-group.js +61 -45
- package/dist/es-dev/components/link/daikin-link.js +32 -50
- package/dist/es-dev/components/list-item/daikin-list-item.js +8 -8
- package/dist/es-dev/components/notification/daikin-notification.js +18 -19
- package/dist/es-dev/components/pagination/daikin-pagination.js +22 -24
- package/dist/es-dev/components/progress-bar/daikin-progress-bar.js +22 -12
- package/dist/es-dev/components/progress-indicator/daikin-progress-indicator.js +1 -6
- package/dist/es-dev/components/progress-indicator-item/daikin-progress-indicator-item.js +12 -12
- package/dist/es-dev/components/radio/daikin-radio.js +12 -10
- package/dist/es-dev/components/select/daikin-select.js +11 -11
- package/dist/es-dev/components/tab/daikin-tab.js +13 -13
- package/dist/es-dev/components/table/daikin-table.js +6 -6
- package/dist/es-dev/components/table-cell/daikin-table-cell.js +2 -2
- package/dist/es-dev/components/table-header-cell/daikin-table-header-cell.js +4 -5
- package/dist/es-dev/components/tabs/daikin-tabs.js +1 -1
- package/dist/es-dev/components/text-area/daikin-text-area.js +16 -14
- package/dist/es-dev/components/text-field/daikin-text-field.js +14 -13
- package/dist/es-dev/components/toggle/daikin-toggle.js +10 -10
- package/dist/es-dev/components/tooltip/daikin-tooltip.d.ts +1 -1
- package/dist/es-dev/components/tooltip/daikin-tooltip.js +3 -3
- package/dist/es-dev/components/tree/common.d.ts +32 -0
- package/dist/es-dev/components/tree/common.js +90 -0
- package/dist/es-dev/components/tree/daikin-tree.d.ts +74 -0
- package/dist/es-dev/components/tree/daikin-tree.js +110 -0
- package/dist/es-dev/components/tree/index.d.ts +1 -0
- package/dist/es-dev/components/tree/index.js +4 -0
- package/dist/es-dev/components/tree-item/daikin-tree-item.d.ts +95 -0
- package/dist/es-dev/components/tree-item/daikin-tree-item.js +198 -0
- package/dist/es-dev/components/tree-item/index.d.ts +1 -0
- package/dist/es-dev/components/tree-item/index.js +5 -0
- package/dist/es-dev/components/tree-section/daikin-tree-section.d.ts +119 -0
- package/dist/es-dev/components/tree-section/daikin-tree-section.js +246 -0
- package/dist/es-dev/components/tree-section/index.d.ts +1 -0
- package/dist/es-dev/components/tree-section/index.js +4 -0
- package/dist/es-dev/index.d.ts +0 -1
- package/dist/es-dev/index.js +13 -2
- package/dist/es-dev/tailwind.css.js +1 -1
- package/dist/es-dev/utils/is-simple-key.d.ts +7 -0
- package/dist/es-dev/utils/is-simple-key.js +6 -0
- package/icons/sort.svg +1 -1
- package/icons/status-error.svg +1 -1
- package/package.json +8 -3
- package/dist/cjs/colors.cjs +0 -80
- package/dist/cjs/colors.d.cts +0 -69
- package/dist/cjs-dev/colors.cjs +0 -80
- package/dist/cjs-dev/colors.d.cts +0 -69
- package/dist/es/colors.d.ts +0 -69
- package/dist/es/colors.js +0 -80
- package/dist/es-dev/colors.d.ts +0 -69
- package/dist/es-dev/colors.js +0 -80
|
@@ -65,7 +65,7 @@ exports.DaikinTooltip = class DaikinTooltip extends lit.LitElement {
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
window.CSS.registerProperty({
|
|
68
|
-
name: "--
|
|
68
|
+
name: "--ddc-tooltip-spacing",
|
|
69
69
|
syntax: "<length>",
|
|
70
70
|
inherits: true,
|
|
71
71
|
initialValue: "0px"
|
|
@@ -101,7 +101,7 @@ exports.DaikinTooltip = class DaikinTooltip extends lit.LitElement {
|
|
|
101
101
|
render() {
|
|
102
102
|
var _a;
|
|
103
103
|
const spacing = parseInt(
|
|
104
|
-
((_a = this._hostStyles) == null ? void 0 : _a.getPropertyValue("--
|
|
104
|
+
((_a = this._hostStyles) == null ? void 0 : _a.getPropertyValue("--ddc-tooltip-spacing")) || DEFAULT_TOOLTIP_SPACING,
|
|
105
105
|
10
|
|
106
106
|
);
|
|
107
107
|
return lit.html`<div class="relative inline-block">
|
|
@@ -160,7 +160,7 @@ exports.DaikinTooltip.styles = lit.css`
|
|
|
160
160
|
:host {
|
|
161
161
|
display: inline-block;
|
|
162
162
|
|
|
163
|
-
--
|
|
163
|
+
--ddc-tooltip-spacing: ${lit.unsafeCSS(DEFAULT_TOOLTIP_SPACING)};
|
|
164
164
|
}
|
|
165
165
|
`;
|
|
166
166
|
__decorateClass([
|
|
@@ -8,7 +8,7 @@ import { LitElement, PropertyValues } from 'lit';
|
|
|
8
8
|
* @slot - A slot for the element to which the tooltip is attached (the trigger element).
|
|
9
9
|
* @slot description - A slot for the tooltip description content.
|
|
10
10
|
*
|
|
11
|
-
* @cssprop [--
|
|
11
|
+
* @cssprop [--ddc-tooltip-spacing=20px] - Spacing between the tooltip and the trigger
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
*
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function getDirectionFromKey(key) {
|
|
4
|
+
return {
|
|
5
|
+
ArrowUp: "up",
|
|
6
|
+
ArrowDown: "down",
|
|
7
|
+
ArrowLeft: "left",
|
|
8
|
+
ArrowRight: "right"
|
|
9
|
+
}[key];
|
|
10
|
+
}
|
|
11
|
+
function handleTreeMoveFocusCommon(event, children) {
|
|
12
|
+
const moveOffset = {
|
|
13
|
+
up: -1,
|
|
14
|
+
down: 1,
|
|
15
|
+
left: 0
|
|
16
|
+
}[event.detail.direction];
|
|
17
|
+
if (!moveOffset) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const target = event.target;
|
|
21
|
+
const enabledChildren = children.filter(({ disabled }) => !disabled);
|
|
22
|
+
const focusedItemIndex = enabledChildren.findIndex((item) => item === target);
|
|
23
|
+
if (focusedItemIndex < 0) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
event.stopPropagation();
|
|
27
|
+
const child = enabledChildren[focusedItemIndex + moveOffset];
|
|
28
|
+
if (!child) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
if (moveOffset > 0) {
|
|
32
|
+
child.focus();
|
|
33
|
+
} else {
|
|
34
|
+
child.focusLastItem();
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
function handleTreeMoveFocusSection(section, event, children) {
|
|
39
|
+
const { direction } = event.detail;
|
|
40
|
+
if (direction === "left") {
|
|
41
|
+
event.stopPropagation();
|
|
42
|
+
section.focus();
|
|
43
|
+
} else {
|
|
44
|
+
const result = handleTreeMoveFocusCommon(event, children);
|
|
45
|
+
if (result === false) {
|
|
46
|
+
if (direction === "up") {
|
|
47
|
+
section.focus();
|
|
48
|
+
} else {
|
|
49
|
+
emitTreeMoveFocus(section, "down");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function handleTreeMoveFocusRoot(event, children) {
|
|
55
|
+
event.stopPropagation();
|
|
56
|
+
handleTreeMoveFocusCommon(event, children);
|
|
57
|
+
}
|
|
58
|
+
function emitTreeMoveFocus(target, direction) {
|
|
59
|
+
target.dispatchEvent(
|
|
60
|
+
new CustomEvent("tree-move-focus", {
|
|
61
|
+
detail: {
|
|
62
|
+
direction
|
|
63
|
+
},
|
|
64
|
+
composed: true,
|
|
65
|
+
bubbles: true
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
function emitTreeSelect(target) {
|
|
70
|
+
target.dispatchEvent(
|
|
71
|
+
new Event("tree-select", {
|
|
72
|
+
composed: true,
|
|
73
|
+
bubbles: true
|
|
74
|
+
})
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function emitTreeUnselect(target) {
|
|
78
|
+
target.dispatchEvent(
|
|
79
|
+
new Event("tree-unselect", {
|
|
80
|
+
composed: true,
|
|
81
|
+
bubbles: true
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
exports.emitTreeMoveFocus = emitTreeMoveFocus;
|
|
86
|
+
exports.emitTreeSelect = emitTreeSelect;
|
|
87
|
+
exports.emitTreeUnselect = emitTreeUnselect;
|
|
88
|
+
exports.getDirectionFromKey = getDirectionFromKey;
|
|
89
|
+
exports.handleTreeMoveFocusRoot = handleTreeMoveFocusRoot;
|
|
90
|
+
exports.handleTreeMoveFocusSection = handleTreeMoveFocusSection;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DaikinTreeItem } from "../tree-item/index.cjs";
|
|
2
|
+
import { DaikinTreeSection } from "../tree-section/index.cjs";
|
|
3
|
+
export type Direction = "up" | "down" | "left" | "right";
|
|
4
|
+
export type DirectionDispatched = Exclude<Direction, "right">;
|
|
5
|
+
export type TreeMoveFocusEventDetail = {
|
|
6
|
+
direction: DirectionDispatched;
|
|
7
|
+
};
|
|
8
|
+
export type TreeMoveFocusEvent = CustomEvent<TreeMoveFocusEventDetail>;
|
|
9
|
+
/**
|
|
10
|
+
* Get direction from key name.
|
|
11
|
+
* @param key `event.key` where `event` is `KeyboardEvent`
|
|
12
|
+
* @returns direction
|
|
13
|
+
*/
|
|
14
|
+
export declare function getDirectionFromKey(key: string): Direction | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* `tree-move-focus` event handler for `daikin-tree-section`.
|
|
17
|
+
*
|
|
18
|
+
* @param section `daikin-tree-section`
|
|
19
|
+
* @param event `TreeMoveFocusEvent`
|
|
20
|
+
* @param children Children in the slot.
|
|
21
|
+
*/
|
|
22
|
+
export declare function handleTreeMoveFocusSection(section: DaikinTreeSection, event: TreeMoveFocusEvent, children: readonly (DaikinTreeSection | DaikinTreeItem)[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* `tree-move-focus` event handler for `daikin-tree`.
|
|
25
|
+
*
|
|
26
|
+
* @param event `TreeMoveFocusEvent`
|
|
27
|
+
* @param children Children in the slot.
|
|
28
|
+
*/
|
|
29
|
+
export declare function handleTreeMoveFocusRoot(event: TreeMoveFocusEvent, children: readonly (DaikinTreeSection | DaikinTreeItem)[]): void;
|
|
30
|
+
export declare function emitTreeMoveFocus(target: HTMLElement, direction: DirectionDispatched): void;
|
|
31
|
+
export declare function emitTreeSelect(target: HTMLElement): void;
|
|
32
|
+
export declare function emitTreeUnselect(target: HTMLElement): void;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const lit = require("lit");
|
|
4
|
+
const decorators_js = require("lit/decorators.js");
|
|
5
|
+
const tailwind = require("../../tailwind.css.cjs");
|
|
6
|
+
const common = require("./common.cjs");
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
14
|
+
if (kind && result) __defProp(target, key, result);
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
exports.DaikinTree = class DaikinTree extends lit.LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.selectable = false;
|
|
21
|
+
this.selected = null;
|
|
22
|
+
}
|
|
23
|
+
_updateChildrenLevel() {
|
|
24
|
+
this._children.forEach((child) => child.level = 0);
|
|
25
|
+
}
|
|
26
|
+
_updateSections() {
|
|
27
|
+
this._sections.forEach((section) => {
|
|
28
|
+
section.selectable = this.selectable;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
_handleSlotChange() {
|
|
32
|
+
this._updateChildrenLevel();
|
|
33
|
+
this._updateSections();
|
|
34
|
+
}
|
|
35
|
+
_handleTreeMoveFocus(event) {
|
|
36
|
+
common.handleTreeMoveFocusRoot(event, this._children);
|
|
37
|
+
}
|
|
38
|
+
_handleTreeSelect(event) {
|
|
39
|
+
event.stopPropagation();
|
|
40
|
+
if (!this.selectable) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const target = event.target;
|
|
44
|
+
this.selected = target.value;
|
|
45
|
+
}
|
|
46
|
+
_handleTreeUnselect(event) {
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
this.selected = this.getSelectedItem();
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
return lit.html`<div role="tree">
|
|
52
|
+
<slot
|
|
53
|
+
@slotchange=${this._handleSlotChange}
|
|
54
|
+
@tree-move-focus=${this._handleTreeMoveFocus}
|
|
55
|
+
@tree-select=${this._handleTreeSelect}
|
|
56
|
+
@tree-unselect=${this._handleTreeUnselect}
|
|
57
|
+
></slot>
|
|
58
|
+
</div>`;
|
|
59
|
+
}
|
|
60
|
+
updated(changedProperties) {
|
|
61
|
+
if (changedProperties.has("selectable")) {
|
|
62
|
+
this._updateSections();
|
|
63
|
+
}
|
|
64
|
+
if (changedProperties.has("selected") && this.selectable) {
|
|
65
|
+
this.selectItem(this.selected);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Calls `selectItem` for the tree sections and tree items of the child elements in the slot.
|
|
70
|
+
*
|
|
71
|
+
* @param value Tree item value.
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
selectItem(value) {
|
|
75
|
+
this._children.forEach((child) => child.selectItem(value));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Returns the `value` of the currently selected section or item.
|
|
79
|
+
* If nothing is selected, returns `null`.
|
|
80
|
+
*
|
|
81
|
+
* @returns The `value` of the selected section or item (if any). `null` if there is none.
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
getSelectedItem() {
|
|
85
|
+
return this._children.map((child) => child.getSelectedItem()).find((item) => !!item) ?? null;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
exports.DaikinTree.styles = lit.css`
|
|
89
|
+
${lit.unsafeCSS(tailwind.default)}
|
|
90
|
+
|
|
91
|
+
:host {
|
|
92
|
+
display: block;
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
__decorateClass([
|
|
96
|
+
decorators_js.property({ type: Boolean, reflect: true })
|
|
97
|
+
], exports.DaikinTree.prototype, "selectable", 2);
|
|
98
|
+
__decorateClass([
|
|
99
|
+
decorators_js.property({ type: String, reflect: true })
|
|
100
|
+
], exports.DaikinTree.prototype, "selected", 2);
|
|
101
|
+
__decorateClass([
|
|
102
|
+
decorators_js.queryAssignedElements({ selector: "daikin-tree-section,daikin-tree-item" })
|
|
103
|
+
], exports.DaikinTree.prototype, "_children", 2);
|
|
104
|
+
__decorateClass([
|
|
105
|
+
decorators_js.queryAssignedElements({ selector: "daikin-tree-section" })
|
|
106
|
+
], exports.DaikinTree.prototype, "_sections", 2);
|
|
107
|
+
exports.DaikinTree = __decorateClass([
|
|
108
|
+
decorators_js.customElement("daikin-tree")
|
|
109
|
+
], exports.DaikinTree);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* The tree component is a component that creates a hierarchical list. You can create a hierarchical structure by placing tree section components and tree item components under the parent tree component.
|
|
4
|
+
*
|
|
5
|
+
* Hierarchy:
|
|
6
|
+
* - `daikin-tree` > `daikin-tree-section` > `daikin-tree-item`
|
|
7
|
+
* - `daikin-tree` > `daikin-tree-section` > `daikin-tree-section` ...
|
|
8
|
+
* - `daikin-tree` > `daikin-tree-item`
|
|
9
|
+
*
|
|
10
|
+
* @slot - A slot for tree sections and tree items. Place `daikin-tree-section` or `daikin-tree-item` elements here.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* ```js
|
|
15
|
+
* import "@daikin-oss/design-system-web-components/components/tree/index.js";
|
|
16
|
+
* import "@daikin-oss/design-system-web-components/components/tree-item/index.js";
|
|
17
|
+
* import "@daikin-oss/design-system-web-components/components/tree-section/index.js";
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* ```html
|
|
21
|
+
* <daikin-tree>
|
|
22
|
+
* <daikin-tree-section>
|
|
23
|
+
* <span slot="label">Tree section 1</span>
|
|
24
|
+
* <daikin-tree-item>Tree item 1-1</daikin-tree-item>
|
|
25
|
+
* <daikin-tree-item>Tree item 1-2</daikin-tree-item>
|
|
26
|
+
* <daikin-tree-item>Tree item 1-3</daikin-tree-item>
|
|
27
|
+
* </daikin-tree-section>
|
|
28
|
+
* </daikin-tree>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare class DaikinTree extends LitElement {
|
|
32
|
+
static readonly styles: import('lit').CSSResult;
|
|
33
|
+
/**
|
|
34
|
+
* Whether or not to enable tree selection.
|
|
35
|
+
* When enabled, tree sections and items can be selected by click, and the `selected` property of the `daikin-tree` and its descendants will be automatically controlled.
|
|
36
|
+
* Even if this is disabled, you can still set the `selected` property of sections and items yourself.
|
|
37
|
+
*/
|
|
38
|
+
selectable: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The value of the currently selected tree section or tree item.
|
|
41
|
+
* Only used if `selectable` is `true`.
|
|
42
|
+
*/
|
|
43
|
+
selected: string | null;
|
|
44
|
+
private readonly _children;
|
|
45
|
+
private readonly _sections;
|
|
46
|
+
private _updateChildrenLevel;
|
|
47
|
+
private _updateSections;
|
|
48
|
+
private _handleSlotChange;
|
|
49
|
+
private _handleTreeMoveFocus;
|
|
50
|
+
private _handleTreeSelect;
|
|
51
|
+
private _handleTreeUnselect;
|
|
52
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
53
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
54
|
+
/**
|
|
55
|
+
* Calls `selectItem` for the tree sections and tree items of the child elements in the slot.
|
|
56
|
+
*
|
|
57
|
+
* @param value Tree item value.
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
selectItem(value: string | null): void;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the `value` of the currently selected section or item.
|
|
63
|
+
* If nothing is selected, returns `null`.
|
|
64
|
+
*
|
|
65
|
+
* @returns The `value` of the selected section or item (if any). `null` if there is none.
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
getSelectedItem(): string | null;
|
|
69
|
+
}
|
|
70
|
+
declare global {
|
|
71
|
+
interface HTMLElementTagNameMap {
|
|
72
|
+
"daikin-tree": DaikinTree;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./daikin-tree.cjs";
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const classVarianceAuthority = require("class-variance-authority");
|
|
4
|
+
const lit = require("lit");
|
|
5
|
+
const decorators_js = require("lit/decorators.js");
|
|
6
|
+
const ifDefined_js = require("lit/directives/if-defined.js");
|
|
7
|
+
const ref_js = require("lit/directives/ref.js");
|
|
8
|
+
const tailwind = require("../../tailwind.css.cjs");
|
|
9
|
+
const isSimpleKey = require("../../utils/is-simple-key.cjs");
|
|
10
|
+
const common = require("../tree/common.cjs");
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
14
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
15
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16
|
+
if (decorator = decorators[i])
|
|
17
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
18
|
+
if (kind && result) __defProp(target, key, result);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
const cvaTreeChildren = classVarianceAuthority.cva(
|
|
22
|
+
[
|
|
23
|
+
"flex",
|
|
24
|
+
"items-center",
|
|
25
|
+
"w-full",
|
|
26
|
+
"min-h-12",
|
|
27
|
+
"py-3",
|
|
28
|
+
"pr-4",
|
|
29
|
+
"pl-[calc((var(--level)+1)*1rem)]",
|
|
30
|
+
"focus-visible:outline",
|
|
31
|
+
"focus-visible:outline-2",
|
|
32
|
+
"focus-visible:-outline-offset-2",
|
|
33
|
+
"focus-visible:outline-ddt-color-common-border-focus"
|
|
34
|
+
],
|
|
35
|
+
{
|
|
36
|
+
variants: {
|
|
37
|
+
disabled: {
|
|
38
|
+
false: [
|
|
39
|
+
"text-ddt-color-common-text-primary",
|
|
40
|
+
"bg-[--color-base]",
|
|
41
|
+
"cursor-pointer"
|
|
42
|
+
],
|
|
43
|
+
true: ["text-ddt-color-common-disabled"]
|
|
44
|
+
},
|
|
45
|
+
selected: {
|
|
46
|
+
false: [
|
|
47
|
+
"var-color-transparent/color-base",
|
|
48
|
+
"hover:var-color-ddt-color-common-surface-hover/color-base",
|
|
49
|
+
"active:var-color-ddt-color-common-surface-press/color-base"
|
|
50
|
+
],
|
|
51
|
+
true: [
|
|
52
|
+
"var-color-ddt-color-common-surface-selected-default/color-base",
|
|
53
|
+
"hover:var-color-ddt-color-common-surface-selected-hover/color-base",
|
|
54
|
+
"active:var-color-ddt-color-common-surface-selected-press/color-base"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
icon: {
|
|
58
|
+
false: ["before:size-6"],
|
|
59
|
+
true: [
|
|
60
|
+
"before:i-daikin-chevron-right",
|
|
61
|
+
"before:size-5",
|
|
62
|
+
"before:m-0.5",
|
|
63
|
+
"before:transition-all"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
open: {
|
|
67
|
+
false: [],
|
|
68
|
+
true: ["before:rotate-90"]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
exports.DaikinTreeItem = class DaikinTreeItem extends lit.LitElement {
|
|
74
|
+
constructor() {
|
|
75
|
+
super();
|
|
76
|
+
this.value = "";
|
|
77
|
+
this.disabled = false;
|
|
78
|
+
this.selected = false;
|
|
79
|
+
this.level = 0;
|
|
80
|
+
this._focusableRef = ref_js.createRef();
|
|
81
|
+
this.addEventListener("click", (event) => {
|
|
82
|
+
if (this.disabled) {
|
|
83
|
+
event.stopImmediatePropagation();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
_handleKeyDown(event) {
|
|
88
|
+
if (!isSimpleKey.isSimpleKeyEvent(event)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (!this.disabled && ["Enter", " "].includes(event.key)) {
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
common.emitTreeSelect(this);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const direction = common.getDirectionFromKey(event.key);
|
|
97
|
+
if (!direction) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
if (direction !== "right") {
|
|
102
|
+
common.emitTreeMoveFocus(this, direction);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
render() {
|
|
106
|
+
return lit.html`<div
|
|
107
|
+
${ref_js.ref(this._focusableRef)}
|
|
108
|
+
class=${cvaTreeChildren({
|
|
109
|
+
disabled: this.disabled,
|
|
110
|
+
selected: this.selected && !this.disabled,
|
|
111
|
+
icon: false,
|
|
112
|
+
open: false
|
|
113
|
+
})}
|
|
114
|
+
role="treeitem"
|
|
115
|
+
aria-disabled=${this.disabled}
|
|
116
|
+
aria-selected=${this.selected && !this.disabled}
|
|
117
|
+
tabindex=${ifDefined_js.ifDefined(!this.disabled ? 0 : void 0)}
|
|
118
|
+
style=${`--level:${this.level}`}
|
|
119
|
+
@click=${() => common.emitTreeSelect(this)}
|
|
120
|
+
@keydown=${this._handleKeyDown}
|
|
121
|
+
>
|
|
122
|
+
<slot></slot>
|
|
123
|
+
</div>`;
|
|
124
|
+
}
|
|
125
|
+
updated(changedProperties) {
|
|
126
|
+
if (changedProperties.has("disabled")) {
|
|
127
|
+
if (this.disabled) {
|
|
128
|
+
this.selectItem(null);
|
|
129
|
+
common.emitTreeUnselect(this);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Focuses on the inner button.
|
|
135
|
+
*
|
|
136
|
+
* @param options focus options
|
|
137
|
+
*/
|
|
138
|
+
focus(options) {
|
|
139
|
+
var _a;
|
|
140
|
+
(_a = this._focusableRef.value) == null ? void 0 : _a.focus(options);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Focuses on the inner button.
|
|
144
|
+
* This is provided to ensure consistency of the interface.
|
|
145
|
+
*
|
|
146
|
+
* @param options focus options
|
|
147
|
+
* @private
|
|
148
|
+
*/
|
|
149
|
+
focusLastItem(options) {
|
|
150
|
+
var _a;
|
|
151
|
+
(_a = this._focusableRef.value) == null ? void 0 : _a.focus(options);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Updates the selection state (`this.selected`) to true if the argument `value` matches `this.value`. Otherwise, sets it to false.
|
|
155
|
+
*
|
|
156
|
+
* @param value Tree item value.
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
selectItem(value) {
|
|
160
|
+
if (this.disabled && value != null) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
this.selected = this.value === value;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns `this.value` if selected, or `null` if not selected.
|
|
167
|
+
*
|
|
168
|
+
* @returns `this.value` if selected. `null` if not selected.
|
|
169
|
+
* @private
|
|
170
|
+
*/
|
|
171
|
+
getSelectedItem() {
|
|
172
|
+
return !this.disabled && this.selected ? this.value : null;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
exports.DaikinTreeItem.styles = lit.css`
|
|
176
|
+
${lit.unsafeCSS(tailwind.default)}
|
|
177
|
+
|
|
178
|
+
:host {
|
|
179
|
+
display: block;
|
|
180
|
+
}
|
|
181
|
+
`;
|
|
182
|
+
__decorateClass([
|
|
183
|
+
decorators_js.property({ type: String })
|
|
184
|
+
], exports.DaikinTreeItem.prototype, "value", 2);
|
|
185
|
+
__decorateClass([
|
|
186
|
+
decorators_js.property({ type: Boolean, reflect: true })
|
|
187
|
+
], exports.DaikinTreeItem.prototype, "disabled", 2);
|
|
188
|
+
__decorateClass([
|
|
189
|
+
decorators_js.property({ type: Boolean, reflect: true })
|
|
190
|
+
], exports.DaikinTreeItem.prototype, "selected", 2);
|
|
191
|
+
__decorateClass([
|
|
192
|
+
decorators_js.property({ type: Number, attribute: false })
|
|
193
|
+
], exports.DaikinTreeItem.prototype, "level", 2);
|
|
194
|
+
exports.DaikinTreeItem = __decorateClass([
|
|
195
|
+
decorators_js.customElement("daikin-tree-item")
|
|
196
|
+
], exports.DaikinTreeItem);
|
|
197
|
+
exports.cvaTreeChildren = cvaTreeChildren;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
export declare const cvaTreeChildren: (props?: ({
|
|
3
|
+
disabled?: boolean | null | undefined;
|
|
4
|
+
selected?: boolean | null | undefined;
|
|
5
|
+
icon?: boolean | null | undefined;
|
|
6
|
+
open?: boolean | null | undefined;
|
|
7
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
|
+
/**
|
|
9
|
+
* The tree item component that can be used within `daikin-tree` and `daikin-tree-section` component.
|
|
10
|
+
*
|
|
11
|
+
* This can be placed either under the tree section or directly under the tree. Elements cannot be placed any deeper than tree item.
|
|
12
|
+
*
|
|
13
|
+
* Hierarchy:
|
|
14
|
+
* - `daikin-tree` > `daikin-tree-section` > `daikin-tree-item`
|
|
15
|
+
* - `daikin-tree` > `daikin-tree-item`
|
|
16
|
+
*
|
|
17
|
+
* @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 `<a>` or `<button>` element. Suppressed if `disabled` is true,
|
|
18
|
+
* @fires tree-move-focus - _Internal use._ A custom event used to move the focus within a tree.
|
|
19
|
+
*
|
|
20
|
+
* @slot - A slot for the tree item content.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
*
|
|
24
|
+
* ```js
|
|
25
|
+
* import "@daikin-oss/design-system-web-components/components/tree-item/index.js";
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* ```html
|
|
29
|
+
* <daikin-tree-item>Tree item</daikin-tree-item>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class DaikinTreeItem extends LitElement {
|
|
33
|
+
static readonly styles: import('lit').CSSResult;
|
|
34
|
+
/**
|
|
35
|
+
* Value of the tree item.
|
|
36
|
+
*/
|
|
37
|
+
value: string;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the tree item is disabled.
|
|
40
|
+
*/
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the tree item is selected.
|
|
44
|
+
* Ignored if disabled.
|
|
45
|
+
* Controlled by `daikin-tree` if its `selectable` is true.
|
|
46
|
+
* If the tree's `selected` is false, you can manually set this property to control the display of the selected state.
|
|
47
|
+
*/
|
|
48
|
+
selected: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* _Internal use._
|
|
51
|
+
* The current nesting depth when the root's children are 0.
|
|
52
|
+
* Automatically set by the parent.
|
|
53
|
+
*
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
level: number;
|
|
57
|
+
private readonly _focusableRef;
|
|
58
|
+
private _handleKeyDown;
|
|
59
|
+
constructor();
|
|
60
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
61
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
62
|
+
/**
|
|
63
|
+
* Focuses on the inner button.
|
|
64
|
+
*
|
|
65
|
+
* @param options focus options
|
|
66
|
+
*/
|
|
67
|
+
focus(options?: FocusOptions): void;
|
|
68
|
+
/**
|
|
69
|
+
* Focuses on the inner button.
|
|
70
|
+
* This is provided to ensure consistency of the interface.
|
|
71
|
+
*
|
|
72
|
+
* @param options focus options
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
focusLastItem(options?: FocusOptions): void;
|
|
76
|
+
/**
|
|
77
|
+
* Updates the selection state (`this.selected`) to true if the argument `value` matches `this.value`. Otherwise, sets it to false.
|
|
78
|
+
*
|
|
79
|
+
* @param value Tree item value.
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
selectItem(value: string | null): void;
|
|
83
|
+
/**
|
|
84
|
+
* Returns `this.value` if selected, or `null` if not selected.
|
|
85
|
+
*
|
|
86
|
+
* @returns `this.value` if selected. `null` if not selected.
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
getSelectedItem(): string | null;
|
|
90
|
+
}
|
|
91
|
+
declare global {
|
|
92
|
+
interface HTMLElementTagNameMap {
|
|
93
|
+
"daikin-tree-item": DaikinTreeItem;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const daikinTreeItem = require("./daikin-tree-item.cjs");
|
|
4
|
+
Object.defineProperty(exports, "DaikinTreeItem", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: () => daikinTreeItem.DaikinTreeItem
|
|
7
|
+
});
|
|
8
|
+
exports.cvaTreeChildren = daikinTreeItem.cvaTreeChildren;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./daikin-tree-item.cjs";
|