@threadlabs/looma 0.1.23 → 0.1.25
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/dist/chunk-HNFCGIBP.js +8 -0
- package/dist/chunk-NB6DBRXQ.js +323 -0
- package/dist/{chunk-GDMQKT5F.js → chunk-UY423IKN.js} +33 -30
- package/dist/cjs/controlled-state-BFya8rAX.js +9 -0
- package/dist/cjs/icons-BAdjrnhS.js +680 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/looma.cjs.js +1 -1
- package/dist/cjs/ui-affordance-scope.cjs.entry.js +1 -1
- package/dist/cjs/ui-avatar-group.cjs.entry.js +9 -17
- package/dist/cjs/ui-avatar.cjs.entry.js +2 -2
- package/dist/cjs/ui-badge.cjs.entry.js +2 -2
- package/dist/cjs/ui-button.cjs.entry.js +1 -1
- package/dist/cjs/ui-callout.cjs.entry.js +27 -0
- package/dist/cjs/ui-checkbox.cjs.entry.js +13 -7
- package/dist/cjs/{ui-combobox.cjs.entry.js → ui-chip_2.cjs.entry.js} +29 -4
- package/dist/cjs/ui-context-menu.cjs.entry.js +1 -1
- package/dist/cjs/ui-dialog.cjs.entry.js +44 -8
- package/dist/cjs/ui-disclosure.cjs.entry.js +9 -6
- package/dist/cjs/ui-editable.cjs.entry.js +100 -0
- package/dist/cjs/ui-floating-action-button.cjs.entry.js +1 -1
- package/dist/cjs/ui-form-field.cjs.entry.js +59 -4
- package/dist/cjs/ui-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/ui-input.cjs.entry.js +1 -1
- package/dist/cjs/ui-menu-item.cjs.entry.js +2 -2
- package/dist/cjs/ui-menu.cjs.entry.js +14 -9
- package/dist/cjs/ui-multi-combobox.cjs.entry.js +158 -0
- package/dist/cjs/ui-popover.cjs.entry.js +10 -7
- package/dist/cjs/ui-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/ui-radio.cjs.entry.js +16 -7
- package/dist/cjs/ui-search-result-row.cjs.entry.js +1 -1
- package/dist/cjs/ui-search-shell.cjs.entry.js +1 -1
- package/dist/cjs/ui-select.cjs.entry.js +1 -1
- package/dist/cjs/ui-switch.cjs.entry.js +19 -10
- package/dist/cjs/ui-tabs.cjs.entry.js +10 -9
- package/dist/cjs/ui-textarea.cjs.entry.js +1 -1
- package/dist/cjs/ui-toast-region.cjs.entry.js +30 -19
- package/dist/cjs/ui-tooltip.cjs.entry.js +12 -8
- package/dist/cjs/ui-top-bar.cjs.entry.js +1 -1
- package/dist/cjs/ui-tree-item.cjs.entry.js +54 -617
- package/dist/cjs/ui-tree.cjs.entry.js +123 -11
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/ui-affordance-scope/ui-affordance-scope.js +1 -1
- package/dist/collection/components/ui-avatar/ui-avatar.css +4 -4
- package/dist/collection/components/ui-avatar/ui-avatar.js +1 -1
- package/dist/collection/components/ui-avatar-group/ui-avatar-group.css +2 -2
- package/dist/collection/components/ui-avatar-group/ui-avatar-group.js +8 -16
- package/dist/collection/components/ui-badge/ui-badge.css +64 -48
- package/dist/collection/components/ui-badge/ui-badge.js +1 -1
- package/dist/collection/components/ui-button/ui-button.js +1 -1
- package/dist/collection/components/ui-callout/ui-callout.css +74 -0
- package/dist/collection/components/ui-callout/ui-callout.js +59 -0
- package/dist/collection/components/ui-checkbox/ui-checkbox.js +16 -11
- package/dist/collection/components/ui-chip/ui-chip.css +47 -0
- package/dist/collection/components/ui-chip/ui-chip.js +67 -0
- package/dist/collection/components/ui-combobox/ui-combobox.js +49 -4
- package/dist/collection/components/ui-context-menu/ui-context-menu.js +1 -1
- package/dist/collection/components/ui-dialog/ui-dialog.js +49 -13
- package/dist/collection/components/ui-disclosure/ui-disclosure.js +12 -10
- package/dist/collection/components/ui-editable/ui-editable.css +2 -0
- package/dist/collection/components/ui-editable/ui-editable.js +196 -0
- package/dist/collection/components/ui-floating-action-button/ui-floating-action-button.js +1 -1
- package/dist/collection/components/ui-form-field/ui-form-field.js +59 -4
- package/dist/collection/components/ui-icon-button/ui-icon-button.js +1 -1
- package/dist/collection/components/ui-input/ui-input.js +1 -1
- package/dist/collection/components/ui-menu/ui-menu.css +12 -23
- package/dist/collection/components/ui-menu/ui-menu.js +16 -12
- package/dist/collection/components/ui-menu-item/ui-menu-item.css +9 -3
- package/dist/collection/components/ui-menu-item/ui-menu-item.js +1 -1
- package/dist/collection/components/ui-multi-combobox/ui-multi-combobox.css +29 -0
- package/dist/collection/components/ui-multi-combobox/ui-multi-combobox.js +503 -0
- package/dist/collection/components/ui-popover/ui-popover.css +14 -5
- package/dist/collection/components/ui-popover/ui-popover.js +12 -10
- package/dist/collection/components/ui-radio/ui-radio.js +24 -11
- package/dist/collection/components/ui-radio-group/ui-radio-group.js +1 -1
- package/dist/collection/components/ui-search-result-row/ui-search-result-row.js +1 -1
- package/dist/collection/components/ui-search-shell/ui-search-shell.js +1 -1
- package/dist/collection/components/ui-select/ui-select.js +1 -1
- package/dist/collection/components/ui-switch/ui-switch.js +22 -14
- package/dist/collection/components/ui-tabs/ui-tabs.js +13 -13
- package/dist/collection/components/ui-textarea/ui-textarea.js +1 -1
- package/dist/collection/components/ui-toast-region/ui-toast-region.js +30 -19
- package/dist/collection/components/ui-tooltip/ui-tooltip.css +16 -7
- package/dist/collection/components/ui-tooltip/ui-tooltip.js +14 -11
- package/dist/collection/components/ui-top-bar/ui-top-bar.js +1 -1
- package/dist/collection/components/ui-tree/ui-tree.css +2 -1
- package/dist/collection/components/ui-tree/ui-tree.js +122 -10
- package/dist/collection/components/ui-tree-item/ui-tree-item.js +61 -44
- package/dist/collection/field/editable.js +1 -0
- package/dist/collection/field/multi-combobox.js +1 -0
- package/dist/collection/icons.js +6 -1
- package/dist/collection/utils/controlled-state.js +4 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-B9CzOHvE.js +1 -0
- package/dist/components/p-BMgIcOh-.js +1 -0
- package/dist/components/p-BVteuP_d.js +1 -0
- package/dist/components/p-BnGhGgTH.js +1 -0
- package/dist/components/p-C6p-ygxq.js +1 -0
- package/dist/components/p-CoFximGM.js +13 -0
- package/dist/components/ui-affordance-scope.js +1 -1
- package/dist/components/ui-avatar-group.js +1 -1
- package/dist/components/ui-avatar.js +1 -1
- package/dist/components/ui-badge.js +1 -1
- package/dist/components/ui-button.js +1 -1
- package/dist/components/ui-callout.d.ts +11 -0
- package/dist/components/ui-callout.js +1 -0
- package/dist/components/ui-checkbox.js +1 -1
- package/dist/components/ui-chip.d.ts +11 -0
- package/dist/components/ui-chip.js +1 -0
- package/dist/components/ui-combobox.js +1 -1
- package/dist/components/ui-context-menu.js +1 -1
- package/dist/components/ui-dialog.js +1 -1
- package/dist/components/ui-disclosure.js +1 -1
- package/dist/components/ui-editable.d.ts +11 -0
- package/dist/components/ui-editable.js +1 -0
- package/dist/components/ui-floating-action-button.js +1 -1
- package/dist/components/ui-form-field.js +1 -1
- package/dist/components/ui-icon-button.js +1 -1
- package/dist/components/ui-input.js +1 -1
- package/dist/components/ui-menu-item.js +1 -1
- package/dist/components/ui-menu.js +1 -1
- package/dist/components/ui-multi-combobox.d.ts +11 -0
- package/dist/components/ui-multi-combobox.js +1 -0
- package/dist/components/ui-popover.js +1 -1
- package/dist/components/ui-radio-group.js +1 -1
- package/dist/components/ui-radio.js +1 -1
- package/dist/components/ui-search-result-row.js +1 -1
- package/dist/components/ui-search-shell.js +1 -1
- package/dist/components/ui-select.js +1 -1
- package/dist/components/ui-switch.js +1 -1
- package/dist/components/ui-tabs.js +1 -1
- package/dist/components/ui-textarea.js +1 -1
- package/dist/components/ui-toast-region.js +1 -1
- package/dist/components/ui-tooltip.js +1 -1
- package/dist/components/ui-top-bar.js +1 -1
- package/dist/components/ui-tree-item.js +1 -13
- package/dist/components/ui-tree.js +1 -1
- package/dist/esm/controlled-state-BnGhGgTH.js +6 -0
- package/dist/esm/icons-CoFximGM.js +678 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/looma.js +1 -1
- package/dist/esm/ui-affordance-scope.entry.js +1 -1
- package/dist/esm/ui-avatar-group.entry.js +9 -17
- package/dist/esm/ui-avatar.entry.js +2 -2
- package/dist/esm/ui-badge.entry.js +2 -2
- package/dist/esm/ui-button.entry.js +1 -1
- package/dist/esm/ui-callout.entry.js +25 -0
- package/dist/esm/ui-checkbox.entry.js +13 -7
- package/dist/esm/{ui-combobox.entry.js → ui-chip_2.entry.js} +30 -6
- package/dist/esm/ui-context-menu.entry.js +1 -1
- package/dist/esm/ui-dialog.entry.js +44 -8
- package/dist/esm/ui-disclosure.entry.js +9 -6
- package/dist/esm/ui-editable.entry.js +98 -0
- package/dist/esm/ui-floating-action-button.entry.js +1 -1
- package/dist/esm/ui-form-field.entry.js +59 -4
- package/dist/esm/ui-icon-button.entry.js +1 -1
- package/dist/esm/ui-input.entry.js +1 -1
- package/dist/esm/ui-menu-item.entry.js +2 -2
- package/dist/esm/ui-menu.entry.js +14 -9
- package/dist/esm/ui-multi-combobox.entry.js +156 -0
- package/dist/esm/ui-popover.entry.js +10 -7
- package/dist/esm/ui-radio-group.entry.js +1 -1
- package/dist/esm/ui-radio.entry.js +16 -7
- package/dist/esm/ui-search-result-row.entry.js +1 -1
- package/dist/esm/ui-search-shell.entry.js +1 -1
- package/dist/esm/ui-select.entry.js +1 -1
- package/dist/esm/ui-switch.entry.js +19 -10
- package/dist/esm/ui-tabs.entry.js +10 -9
- package/dist/esm/ui-textarea.entry.js +1 -1
- package/dist/esm/ui-toast-region.entry.js +30 -19
- package/dist/esm/ui-tooltip.entry.js +12 -8
- package/dist/esm/ui-top-bar.entry.js +1 -1
- package/dist/esm/ui-tree-item.entry.js +54 -617
- package/dist/esm/ui-tree.entry.js +123 -11
- package/dist/index.cjs +1552 -894
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +12 -2
- package/dist/looma/looma.esm.js +1 -1
- package/dist/looma/p-08f80207.entry.js +1 -0
- package/dist/looma/{p-ed368426.entry.js → p-0e1741cb.entry.js} +1 -1
- package/dist/looma/p-0ef4bf13.entry.js +1 -0
- package/dist/looma/{p-7e0bb7f6.entry.js → p-166f8593.entry.js} +1 -1
- package/dist/looma/p-262a542c.entry.js +1 -0
- package/dist/looma/{p-13347631.entry.js → p-26d357ae.entry.js} +1 -1
- package/dist/looma/p-30f01909.entry.js +1 -0
- package/dist/looma/p-393e3e02.entry.js +1 -0
- package/dist/looma/p-3a44b9f9.entry.js +1 -0
- package/dist/looma/p-558d4f5b.entry.js +1 -0
- package/dist/looma/{p-5a87b59d.entry.js → p-5780cefa.entry.js} +1 -1
- package/dist/looma/p-5a7261e1.entry.js +1 -0
- package/dist/looma/p-5fdcee1d.entry.js +1 -0
- package/dist/looma/{p-add36e74.entry.js → p-72338f53.entry.js} +1 -1
- package/dist/looma/p-7319c147.entry.js +1 -0
- package/dist/looma/p-78b7e466.entry.js +1 -0
- package/dist/looma/{p-a90d2821.entry.js → p-7ab661ec.entry.js} +1 -1
- package/dist/looma/p-7eb04f09.entry.js +1 -0
- package/dist/looma/{p-69a5557b.entry.js → p-81c533f5.entry.js} +1 -1
- package/dist/looma/p-87f501cf.entry.js +1 -0
- package/dist/looma/p-89e71bbb.entry.js +1 -0
- package/dist/looma/{p-8b8840b8.entry.js → p-92cd1841.entry.js} +1 -1
- package/dist/looma/{p-f0487ff3.entry.js → p-95eb3b58.entry.js} +1 -1
- package/dist/looma/p-96ec4d7a.entry.js +1 -0
- package/dist/looma/p-9d2662ca.entry.js +1 -0
- package/dist/looma/p-BnGhGgTH.js +1 -0
- package/dist/looma/p-CoFximGM.js +13 -0
- package/dist/looma/p-add67e4c.entry.js +1 -0
- package/dist/looma/p-b6c776fb.entry.js +1 -0
- package/dist/looma/p-bcb1b47b.entry.js +1 -0
- package/dist/looma/p-d56571a2.entry.js +1 -0
- package/dist/looma/{p-582973b5.entry.js → p-d62da01d.entry.js} +1 -1
- package/dist/looma/{p-f74e5546.entry.js → p-dbcb479c.entry.js} +1 -1
- package/dist/looma/p-e14024bf.entry.js +1 -0
- package/dist/looma/{p-5da09f47.entry.js → p-fc180770.entry.js} +1 -1
- package/dist/types/components/ui-avatar-group/ui-avatar-group.d.ts +1 -2
- package/dist/types/components/ui-callout/ui-callout.d.ts +6 -0
- package/dist/types/components/ui-checkbox/ui-checkbox.d.ts +2 -1
- package/dist/types/components/ui-chip/ui-chip.d.ts +8 -0
- package/dist/types/components/ui-combobox/ui-combobox.d.ts +4 -0
- package/dist/types/components/ui-dialog/ui-dialog.d.ts +7 -1
- package/dist/types/components/ui-disclosure/ui-disclosure.d.ts +2 -1
- package/dist/types/components/ui-editable/ui-editable.d.ts +24 -0
- package/dist/types/components/ui-form-field/ui-form-field.d.ts +8 -0
- package/dist/types/components/ui-menu/ui-menu.d.ts +2 -1
- package/dist/types/components/ui-multi-combobox/ui-multi-combobox.d.ts +47 -0
- package/dist/types/components/ui-popover/ui-popover.d.ts +2 -1
- package/dist/types/components/ui-radio/ui-radio.d.ts +4 -1
- package/dist/types/components/ui-switch/ui-switch.d.ts +2 -1
- package/dist/types/components/ui-tabs/ui-tabs.d.ts +2 -1
- package/dist/types/components/ui-toast-region/ui-toast-region.d.ts +3 -1
- package/dist/types/components/ui-tooltip/ui-tooltip.d.ts +2 -1
- package/dist/types/components/ui-tree/ui-tree.d.ts +12 -0
- package/dist/types/components/ui-tree-item/ui-tree-item.d.ts +11 -7
- package/dist/types/components.d.ts +343 -46
- package/dist/types/field/editable.d.ts +5 -0
- package/dist/types/field/multi-combobox.d.ts +11 -0
- package/dist/types/icons.d.ts +5 -0
- package/dist/types/utils/controlled-state.d.ts +4 -0
- package/dist/{ui-affordance-scope.entry-VO4C2MZX.js → ui-affordance-scope.entry-VSSP52ZP.js} +2 -2
- package/dist/ui-avatar-group.entry-JMCLL6FW.js +51 -0
- package/dist/{ui-avatar.entry-T6FU6ZYM.js → ui-avatar.entry-X2YQ3QPG.js} +3 -3
- package/dist/ui-badge.entry-OJ6FJJKL.js +22 -0
- package/dist/{ui-button.entry-7UXMUGHN.js → ui-button.entry-ZN6JLND7.js} +2 -2
- package/dist/ui-callout.entry-7K6NXQ7U.js +32 -0
- package/dist/{ui-checkbox.entry-DMZJB3RE.js → ui-checkbox.entry-GUYRVU6O.js} +17 -8
- package/dist/{ui-combobox.entry-ZCTPXEES.js → ui-chip_2.entry-M2DOTIGY.js} +32 -7
- package/dist/{ui-context-menu.entry-2WMCBGCP.js → ui-context-menu.entry-BM7FHOUJ.js} +5 -5
- package/dist/{ui-dialog.entry-WO23XOSW.js → ui-dialog.entry-AZAD37CG.js} +50 -12
- package/dist/{ui-disclosure.entry-USX7OUEW.js → ui-disclosure.entry-XDPGKMBK.js} +13 -7
- package/dist/ui-editable.entry-S3TE6KFT.js +110 -0
- package/dist/{ui-floating-action-button.entry-MXDIN7MV.js → ui-floating-action-button.entry-U7HGA3CS.js} +2 -2
- package/dist/ui-form-field.entry-C2ZSP3TM.js +120 -0
- package/dist/{ui-icon-button.entry-MJUNXHBU.js → ui-icon-button.entry-P6H2LY7D.js} +2 -2
- package/dist/{ui-input.entry-AWG63YIG.js → ui-input.entry-GTNQJCQ2.js} +2 -2
- package/dist/ui-menu-item.entry-2HWOGUO5.js +22 -0
- package/dist/{ui-menu.entry-IT3GW5TL.js → ui-menu.entry-NZ7ER54K.js} +22 -14
- package/dist/ui-multi-combobox.entry-DZ5LLSVQ.js +167 -0
- package/dist/{ui-popover.entry-ZQQB4N6E.js → ui-popover.entry-ZOEQMUWG.js} +17 -11
- package/dist/{ui-radio-group.entry-V7PCTS7I.js → ui-radio-group.entry-QCQ46EK5.js} +2 -2
- package/dist/{ui-radio.entry-JYH6TQBI.js → ui-radio.entry-QAATWUYT.js} +20 -8
- package/dist/{ui-search-result-row.entry-JBNYXXUN.js → ui-search-result-row.entry-2I3DH2OT.js} +2 -2
- package/dist/{ui-search-shell.entry-TEAWE76O.js → ui-search-shell.entry-7RS55ORF.js} +2 -2
- package/dist/{ui-select.entry-F3A6TE2U.js → ui-select.entry-6O4KD4G7.js} +2 -2
- package/dist/{ui-switch.entry-MJIICMP2.js → ui-switch.entry-DY5PSHCQ.js} +23 -11
- package/dist/{ui-tabs.entry-6REFIUHV.js → ui-tabs.entry-6X56UOUE.js} +14 -10
- package/dist/{ui-textarea.entry-OJTXCED7.js → ui-textarea.entry-RDYP6O77.js} +2 -2
- package/dist/{ui-toast-region.entry-NOFXLKPS.js → ui-toast-region.entry-EBY42KS5.js} +32 -23
- package/dist/{ui-tooltip.entry-COWTWVHX.js → ui-tooltip.entry-PLXMPOKV.js} +19 -12
- package/dist/{ui-top-bar.entry-PIAWXJNV.js → ui-top-bar.entry-QKE2DLVD.js} +2 -2
- package/dist/ui-tree-item.entry-TC6YWIC6.js +145 -0
- package/dist/{ui-tree.entry-XYI3ZFAZ.js → ui-tree.entry-UL6UHCUT.js} +114 -12
- package/editor/{chunk-QCOYOVQL.js → chunk-B5WVJOPV.js} +113 -97
- package/editor/extensions/index.d.ts +14 -6
- package/editor/extensions/index.js +1 -1
- package/editor/index.js +1 -1
- package/editor.css +37 -20
- package/package.json +1 -1
- package/styles.css +10 -0
- package/tokens.css +3 -0
- package/vue/{chunk-JLW23USW.js → chunk-GXQY27K2.js} +112 -17
- package/vue/editor/index.d.ts +5 -15
- package/vue/editor/index.js +1 -1
- package/vue/index.d.ts +442 -116
- package/vue/index.js +9 -1
- package/dist/components/p-CaietZcq.js +0 -1
- package/dist/components/p-DHd18bK7.js +0 -1
- package/dist/looma/p-14c081cf.entry.js +0 -1
- package/dist/looma/p-25366205.entry.js +0 -1
- package/dist/looma/p-2e3aa869.entry.js +0 -1
- package/dist/looma/p-40fe7fee.entry.js +0 -1
- package/dist/looma/p-446cda76.entry.js +0 -1
- package/dist/looma/p-4fc1b005.entry.js +0 -13
- package/dist/looma/p-6a8a4736.entry.js +0 -1
- package/dist/looma/p-6bf4038b.entry.js +0 -1
- package/dist/looma/p-8204fee6.entry.js +0 -1
- package/dist/looma/p-8238e0dc.entry.js +0 -1
- package/dist/looma/p-99d88efb.entry.js +0 -1
- package/dist/looma/p-a27669b1.entry.js +0 -1
- package/dist/looma/p-a6ee76b7.entry.js +0 -1
- package/dist/looma/p-b6398a6b.entry.js +0 -1
- package/dist/looma/p-d50faaff.entry.js +0 -1
- package/dist/looma/p-d77278ce.entry.js +0 -1
- package/dist/looma/p-d9ec13b7.entry.js +0 -1
- package/dist/looma/p-ecf8005f.entry.js +0 -1
- package/dist/ui-avatar-group.entry-TAXJRIIU.js +0 -59
- package/dist/ui-badge.entry-MZFYNBMJ.js +0 -22
- package/dist/ui-form-field.entry-7ZCMEHPY.js +0 -67
- package/dist/ui-menu-item.entry-HFTWG62N.js +0 -22
- package/dist/ui-tree-item.entry-BSEWNL2O.js +0 -389
|
@@ -14,6 +14,8 @@ export class UITree {
|
|
|
14
14
|
rejectedPosition = null;
|
|
15
15
|
rejection = null;
|
|
16
16
|
hoverIntent = null;
|
|
17
|
+
structureObserver = null;
|
|
18
|
+
tabStop = null;
|
|
17
19
|
componentDidLoad() {
|
|
18
20
|
this.hoverIntent = createHoverIntent(this.hoverExpandDelay, this.expandTarget);
|
|
19
21
|
this.host.addEventListener('dragstart', this.onDragStart);
|
|
@@ -24,6 +26,11 @@ export class UITree {
|
|
|
24
26
|
this.host.addEventListener('drop', this.onDrop);
|
|
25
27
|
this.host.addEventListener('dragend', this.onDragEnd);
|
|
26
28
|
this.host.addEventListener('keydown', this.onKeyDown);
|
|
29
|
+
this.host.addEventListener('focusin', this.onFocusIn);
|
|
30
|
+
this.host.addEventListener('ui-tree-expansion-change', this.onExpansionChange);
|
|
31
|
+
this.syncStructuralLevels();
|
|
32
|
+
this.structureObserver = new MutationObserver(this.syncStructuralLevels);
|
|
33
|
+
this.structureObserver.observe(this.host, { childList: true, subtree: true });
|
|
27
34
|
}
|
|
28
35
|
disconnectedCallback() {
|
|
29
36
|
this.hoverIntent?.destroy();
|
|
@@ -35,10 +42,44 @@ export class UITree {
|
|
|
35
42
|
this.host.removeEventListener('drop', this.onDrop);
|
|
36
43
|
this.host.removeEventListener('dragend', this.onDragEnd);
|
|
37
44
|
this.host.removeEventListener('keydown', this.onKeyDown);
|
|
45
|
+
this.host.removeEventListener('focusin', this.onFocusIn);
|
|
46
|
+
this.host.removeEventListener('ui-tree-expansion-change', this.onExpansionChange);
|
|
47
|
+
this.structureObserver?.disconnect();
|
|
48
|
+
this.structureObserver = null;
|
|
49
|
+
}
|
|
50
|
+
syncStructuralLevels = () => {
|
|
51
|
+
for (const item of Array.from(this.host.querySelectorAll('ui-tree-item'))) {
|
|
52
|
+
item.dispatchEvent(new CustomEvent('ui-tree-structure-sync'));
|
|
53
|
+
}
|
|
54
|
+
this.syncTabStop();
|
|
55
|
+
};
|
|
56
|
+
syncTabStop(preferred) {
|
|
57
|
+
const items = this.visibleItems();
|
|
58
|
+
const next = preferred && items.includes(preferred)
|
|
59
|
+
? preferred
|
|
60
|
+
: this.tabStop && items.includes(this.tabStop)
|
|
61
|
+
? this.tabStop
|
|
62
|
+
: items[0] ?? null;
|
|
63
|
+
this.tabStop = next;
|
|
64
|
+
for (const item of items) {
|
|
65
|
+
item.dispatchEvent(new CustomEvent('ui-tree-roving-tab-stop', {
|
|
66
|
+
detail: { active: item === next },
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
38
69
|
}
|
|
39
70
|
itemFromEvent(event) {
|
|
40
71
|
return event.composedPath().find(node => (node instanceof HTMLElement && node.localName === 'ui-tree-item')) ?? null;
|
|
41
72
|
}
|
|
73
|
+
eventTargetsInteractiveContent(event) {
|
|
74
|
+
for (const node of event.composedPath()) {
|
|
75
|
+
if (node instanceof HTMLElement && node.localName === 'ui-tree-item')
|
|
76
|
+
break;
|
|
77
|
+
if (node instanceof HTMLElement && node.matches('a, button, input, select, textarea, [role="button"], [role="link"]')) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
42
83
|
itemId(item) {
|
|
43
84
|
return item.itemId || item.getAttribute('item-id') || '';
|
|
44
85
|
}
|
|
@@ -86,9 +127,23 @@ export class UITree {
|
|
|
86
127
|
const dropDepth = item.getAttribute('drop-depth');
|
|
87
128
|
if (dropDepth !== null)
|
|
88
129
|
return Number(dropDepth);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
130
|
+
return Number(item.getAttribute('aria-level')) || 1;
|
|
131
|
+
}
|
|
132
|
+
subtreeDepth(item) {
|
|
133
|
+
if (item.subtreeDepth !== undefined)
|
|
134
|
+
return Math.max(0, Math.floor(item.subtreeDepth));
|
|
135
|
+
const override = item.getAttribute('subtree-depth');
|
|
136
|
+
if (override !== null)
|
|
137
|
+
return Math.max(0, Math.floor(Number(override)));
|
|
138
|
+
return Array.from(item.querySelectorAll('ui-tree-item')).reduce((deepest, descendant) => {
|
|
139
|
+
let nesting = 0;
|
|
140
|
+
let ancestor = descendant.parentElement?.closest('ui-tree-item') ?? null;
|
|
141
|
+
while (ancestor && ancestor !== item) {
|
|
142
|
+
nesting += 1;
|
|
143
|
+
ancestor = ancestor.parentElement?.closest('ui-tree-item') ?? null;
|
|
144
|
+
}
|
|
145
|
+
return ancestor === item ? Math.max(deepest, nesting + 1) : deepest;
|
|
146
|
+
}, 0);
|
|
92
147
|
}
|
|
93
148
|
dropRejection(source, target, position) {
|
|
94
149
|
// A tree item can never move into (or beside) one of its own descendants.
|
|
@@ -108,9 +163,9 @@ export class UITree {
|
|
|
108
163
|
return { reason: 'incompatible' };
|
|
109
164
|
}
|
|
110
165
|
const maxDepth = Math.max(0, Math.floor(this.maxDepth));
|
|
111
|
-
if (maxDepth > 0
|
|
166
|
+
if (maxDepth > 0) {
|
|
112
167
|
const targetDepth = Math.max(0, Math.floor(this.constraintDepth(target)));
|
|
113
|
-
const subtreeDepth =
|
|
168
|
+
const subtreeDepth = this.subtreeDepth(source);
|
|
114
169
|
const resultingDepth = targetDepth + (position === 'inside' ? 1 : 0) + subtreeDepth;
|
|
115
170
|
if (resultingDepth > maxDepth)
|
|
116
171
|
return { reason: 'max-depth', maxDepth, resultingDepth };
|
|
@@ -306,7 +361,35 @@ export class UITree {
|
|
|
306
361
|
return Array.from(this.host.querySelectorAll('ui-tree-item'))
|
|
307
362
|
.filter(item => item.getClientRects().length > 0 && !item.hasAttribute('disabled'));
|
|
308
363
|
}
|
|
364
|
+
parentItem(item) {
|
|
365
|
+
const parent = item.parentElement?.closest('ui-tree-item') ?? null;
|
|
366
|
+
return parent && this.host.contains(parent) ? parent : null;
|
|
367
|
+
}
|
|
368
|
+
firstVisibleChild(item, items) {
|
|
369
|
+
return items.find(candidate => this.parentItem(candidate) === item) ?? null;
|
|
370
|
+
}
|
|
371
|
+
focusItem(item) {
|
|
372
|
+
this.syncTabStop(item);
|
|
373
|
+
item.focus();
|
|
374
|
+
}
|
|
375
|
+
requestExpansion(item, expanded) {
|
|
376
|
+
item.dispatchEvent(new CustomEvent('ui-tree-request-expanded', {
|
|
377
|
+
detail: { expanded, trigger: 'keyboard' },
|
|
378
|
+
}));
|
|
379
|
+
}
|
|
380
|
+
onFocusIn = (event) => {
|
|
381
|
+
if (this.eventTargetsInteractiveContent(event))
|
|
382
|
+
return;
|
|
383
|
+
const item = this.itemFromEvent(event);
|
|
384
|
+
if (item)
|
|
385
|
+
this.syncTabStop(item);
|
|
386
|
+
};
|
|
387
|
+
onExpansionChange = () => {
|
|
388
|
+
requestAnimationFrame(() => this.syncTabStop());
|
|
389
|
+
};
|
|
309
390
|
onKeyDown = (event) => {
|
|
391
|
+
if (this.eventTargetsInteractiveContent(event))
|
|
392
|
+
return;
|
|
310
393
|
const current = this.itemFromEvent(event);
|
|
311
394
|
if (!current)
|
|
312
395
|
return;
|
|
@@ -314,14 +397,43 @@ export class UITree {
|
|
|
314
397
|
const index = items.indexOf(current);
|
|
315
398
|
if (index < 0)
|
|
316
399
|
return;
|
|
317
|
-
const next = event.key === 'ArrowDown' ? items[index + 1]
|
|
318
|
-
|
|
400
|
+
const next = event.key === 'ArrowDown' ? items[index + 1]
|
|
401
|
+
: event.key === 'ArrowUp' ? items[index - 1]
|
|
402
|
+
: event.key === 'Home' ? items[0]
|
|
403
|
+
: event.key === 'End' ? items.at(-1)
|
|
404
|
+
: null;
|
|
405
|
+
if (next) {
|
|
406
|
+
event.preventDefault();
|
|
407
|
+
this.focusItem(next);
|
|
319
408
|
return;
|
|
320
|
-
|
|
321
|
-
|
|
409
|
+
}
|
|
410
|
+
if (event.key === 'ArrowLeft') {
|
|
411
|
+
if (current.getAttribute('aria-expanded') === 'true') {
|
|
412
|
+
event.preventDefault();
|
|
413
|
+
this.requestExpansion(current, false);
|
|
414
|
+
}
|
|
415
|
+
else if (this.parentItem(current)) {
|
|
416
|
+
event.preventDefault();
|
|
417
|
+
this.focusItem(this.parentItem(current));
|
|
418
|
+
}
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
if (event.key === 'ArrowRight') {
|
|
422
|
+
if (current.getAttribute('aria-expanded') === 'false') {
|
|
423
|
+
event.preventDefault();
|
|
424
|
+
this.requestExpansion(current, true);
|
|
425
|
+
}
|
|
426
|
+
else if (current.getAttribute('aria-expanded') === 'true') {
|
|
427
|
+
const child = this.firstVisibleChild(current, items);
|
|
428
|
+
if (child) {
|
|
429
|
+
event.preventDefault();
|
|
430
|
+
this.focusItem(child);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
322
434
|
};
|
|
323
435
|
render() {
|
|
324
|
-
return (h(Host, { key: '
|
|
436
|
+
return (h(Host, { key: '7efbf793fe63471006df57f0045a5fe995c81440', role: "tree", "aria-label": this.label || 'Tree' }, h("slot", { key: '1804e391796e7451c93cb58258e0e23ec3ad98c7' })));
|
|
325
437
|
}
|
|
326
438
|
static get is() { return "ui-tree"; }
|
|
327
439
|
static get encapsulation() { return "shadow"; }
|
|
@@ -7,11 +7,9 @@ export class UITreeItem {
|
|
|
7
7
|
itemId = '';
|
|
8
8
|
/** Accessible name used by the disclosure and drag handle. */
|
|
9
9
|
label = '';
|
|
10
|
-
/**
|
|
11
|
-
depth = 1;
|
|
12
|
-
/** Application hierarchy depth used for drop constraints. Defaults to visual depth. */
|
|
10
|
+
/** Application hierarchy depth override used for drop constraints. Defaults to structural nesting. */
|
|
13
11
|
dropDepth;
|
|
14
|
-
/**
|
|
12
|
+
/** Virtualized-tree descendant-depth override for the tree's max-depth drop constraint. */
|
|
15
13
|
subtreeDepth;
|
|
16
14
|
/** Whether this item accepts children and exposes disclosure behavior. */
|
|
17
15
|
container = false;
|
|
@@ -23,37 +21,74 @@ export class UITreeItem {
|
|
|
23
21
|
dropScope = '';
|
|
24
22
|
/** Comma-separated drag kinds accepted as children. Empty accepts every kind. */
|
|
25
23
|
accepts = '';
|
|
26
|
-
/**
|
|
27
|
-
expanded
|
|
24
|
+
/** Controlled expansion value. When omitted, `default-expanded` initializes uncontrolled state. */
|
|
25
|
+
expanded;
|
|
28
26
|
/** Initial uncontrolled expansion value. */
|
|
29
27
|
defaultExpanded = false;
|
|
30
28
|
selected = false;
|
|
31
29
|
disabled = false;
|
|
32
30
|
internalExpanded = false;
|
|
31
|
+
structuralLevel = 1;
|
|
32
|
+
tabStop = false;
|
|
33
33
|
syncExpandedFromProp() {
|
|
34
|
-
|
|
34
|
+
// A defined prop owns the rendered state; clearing it resumes the current
|
|
35
|
+
// uncontrolled state instead of replaying the initial default.
|
|
36
|
+
if (this.expanded !== undefined)
|
|
37
|
+
this.internalExpanded = this.expanded;
|
|
35
38
|
}
|
|
36
39
|
componentWillLoad() {
|
|
37
|
-
this.internalExpanded = this.expanded
|
|
40
|
+
this.internalExpanded = this.expanded ?? this.defaultExpanded;
|
|
41
|
+
this.updateStructuralLevel();
|
|
38
42
|
}
|
|
39
|
-
|
|
43
|
+
connectedCallback() {
|
|
40
44
|
this.host.addEventListener('ui-tree-auto-expand', this.onAutoExpand);
|
|
45
|
+
this.host.addEventListener('ui-tree-structure-sync', this.updateStructuralLevel);
|
|
46
|
+
this.host.addEventListener('ui-tree-roving-tab-stop', this.onRovingTabStop);
|
|
47
|
+
this.host.addEventListener('ui-tree-request-expanded', this.onExpansionRequest);
|
|
41
48
|
}
|
|
42
49
|
disconnectedCallback() {
|
|
43
50
|
this.host.removeEventListener('ui-tree-auto-expand', this.onAutoExpand);
|
|
51
|
+
this.host.removeEventListener('ui-tree-structure-sync', this.updateStructuralLevel);
|
|
52
|
+
this.host.removeEventListener('ui-tree-roving-tab-stop', this.onRovingTabStop);
|
|
53
|
+
this.host.removeEventListener('ui-tree-request-expanded', this.onExpansionRequest);
|
|
44
54
|
}
|
|
55
|
+
updateStructuralLevel = () => {
|
|
56
|
+
const tree = this.host.closest('ui-tree');
|
|
57
|
+
let ancestor = this.host.parentElement?.closest('ui-tree-item') ?? null;
|
|
58
|
+
let level = 1;
|
|
59
|
+
while (ancestor && tree?.contains(ancestor)) {
|
|
60
|
+
level += 1;
|
|
61
|
+
ancestor = ancestor.parentElement?.closest('ui-tree-item') ?? null;
|
|
62
|
+
}
|
|
63
|
+
if (this.structuralLevel !== level)
|
|
64
|
+
this.structuralLevel = level;
|
|
65
|
+
};
|
|
45
66
|
setExpanded(expanded, trigger) {
|
|
46
|
-
|
|
67
|
+
const current = this.isExpanded();
|
|
68
|
+
if (!this.container || this.disabled || current === expanded)
|
|
47
69
|
return;
|
|
48
|
-
this.
|
|
70
|
+
if (this.expanded === undefined)
|
|
71
|
+
this.internalExpanded = expanded;
|
|
49
72
|
dispatchDetail(this.host, 'expand', { id: this.itemId, expanded, trigger });
|
|
73
|
+
this.host.dispatchEvent(new CustomEvent('ui-tree-expansion-change'));
|
|
74
|
+
}
|
|
75
|
+
isExpanded() {
|
|
76
|
+
return this.expanded ?? this.internalExpanded;
|
|
50
77
|
}
|
|
51
78
|
onAutoExpand = () => {
|
|
52
79
|
this.setExpanded(true, 'pointer');
|
|
53
80
|
};
|
|
81
|
+
onRovingTabStop = (event) => {
|
|
82
|
+
this.tabStop = Boolean(event.detail?.active) && !this.disabled;
|
|
83
|
+
};
|
|
84
|
+
onExpansionRequest = (event) => {
|
|
85
|
+
const detail = event.detail;
|
|
86
|
+
if (typeof detail?.expanded === 'boolean')
|
|
87
|
+
this.setExpanded(detail.expanded, detail.trigger ?? 'keyboard');
|
|
88
|
+
};
|
|
54
89
|
onDisclosureClick = (event) => {
|
|
55
90
|
event.stopPropagation();
|
|
56
|
-
this.setExpanded(!this.
|
|
91
|
+
this.setExpanded(!this.isExpanded(), eventToTrigger(event));
|
|
57
92
|
};
|
|
58
93
|
onDisclosureKeydown = (event) => {
|
|
59
94
|
if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft')
|
|
@@ -69,16 +104,17 @@ export class UITreeItem {
|
|
|
69
104
|
const interactive = path.some((node) => node instanceof HTMLElement && (node.matches('a, button, input, select, textarea, [role="button"], [role="link"]')
|
|
70
105
|
|| node.getAttribute('slot') === 'actions'));
|
|
71
106
|
if (!interactive)
|
|
72
|
-
this.setExpanded(!this.
|
|
107
|
+
this.setExpanded(!this.isExpanded(), eventToTrigger(event));
|
|
73
108
|
};
|
|
74
109
|
render() {
|
|
75
|
-
const level =
|
|
76
|
-
const
|
|
110
|
+
const level = this.structuralLevel;
|
|
111
|
+
const expanded = this.isExpanded();
|
|
112
|
+
const disclosureLabel = `${expanded ? 'Collapse' : 'Expand'} ${this.label || 'item'}`;
|
|
77
113
|
const dragLabel = `Drag ${this.label || 'item'} to reorder`;
|
|
78
|
-
return (h(Host, { key: '
|
|
114
|
+
return (h(Host, { key: 'f092fa9586a39aba1a9629ba42e52f8fbc10de05', role: "treeitem", "aria-label": this.label || undefined, "aria-level": String(level), "aria-expanded": this.container ? String(expanded) : undefined, "aria-selected": String(this.selected), "aria-disabled": this.disabled ? 'true' : undefined, "data-container": this.container ? '' : undefined, "data-selected": this.selected ? '' : undefined, "data-disabled": this.disabled ? '' : undefined, "data-drag-type": this.dragType || 'item', "data-drop-scope": this.dropScope || undefined, "data-accepts": this.accepts || undefined, tabIndex: this.disabled || !this.tabStop ? -1 : 0, style: {
|
|
79
115
|
'--ui-tree-item-depth': String(level - 1),
|
|
80
116
|
'margin-inline-start': level > 1 ? 'var(--ui-tree-indent, 16px)' : '0px',
|
|
81
|
-
} }, h("div", { key: '
|
|
117
|
+
} }, h("div", { key: '2f16d97219ba9ec9e37688d97ad9144508aa1ed5', class: "row", part: "row", onClick: this.onRowClick }, this.sortable && !this.disabled ? (h("button", { class: "drag-handle", part: "drag-handle", type: "button", draggable: true, "aria-label": dragLabel, title: dragLabel }, h("span", { innerHTML: loomaIconMarkup('grip-vertical') }))) : null, this.container ? (h("button", { class: "disclosure", part: "disclosure", type: "button", "aria-label": disclosureLabel, "aria-expanded": String(expanded), disabled: this.disabled, onClick: this.onDisclosureClick, onKeyDown: this.onDisclosureKeydown }, h("span", { class: { 'disclosure-icon': true, 'disclosure-icon--expanded': expanded }, innerHTML: loomaIconMarkup('chevron-down') }))) : h("span", { class: "disclosure-spacer", "aria-hidden": "true" }), h("span", { key: 'd984631c891df304edb3e1dc5bcd19af3ad8e20d', class: "leading", part: "leading" }, h("slot", { key: '81a0e055859df5d4daaa6dac39013b23dcc2831b', name: "leading" })), h("span", { key: '3ae295523d5a3b9feaa9bfaa16d807349e37d78b', class: "label", part: "label" }, h("slot", { key: 'db8503a41d087d283074a41e76fa872ff4b2a707' })), h("span", { key: 'ac5b5db7128b31a9263b912bd64cd90ac640eaeb', class: "actions", part: "actions" }, h("slot", { key: 'c8842a5d80215ec297688c86f6bfe9b4d9bed333', name: "actions" })), h("span", { key: 'b7f239bc16867678291850ad61a5cd752d6a7425', class: "drop-indicator row-drop-indicator", part: "drop-indicator", "aria-hidden": "true" })), this.container ? (h("div", { class: "children", part: "children", role: "group", hidden: !expanded }, h("slot", { name: "children" }))) : null, h("span", { key: '2a5f448db2f4f363a34a1a950785e0ee12cc9938', class: "drop-indicator subtree-drop-indicator", part: "drop-indicator", "aria-hidden": "true" })));
|
|
82
118
|
}
|
|
83
119
|
static get is() { return "ui-tree-item"; }
|
|
84
120
|
static get encapsulation() { return "shadow"; }
|
|
@@ -134,26 +170,6 @@ export class UITreeItem {
|
|
|
134
170
|
"attribute": "label",
|
|
135
171
|
"defaultValue": "''"
|
|
136
172
|
},
|
|
137
|
-
"depth": {
|
|
138
|
-
"type": "number",
|
|
139
|
-
"mutable": false,
|
|
140
|
-
"complexType": {
|
|
141
|
-
"original": "number",
|
|
142
|
-
"resolved": "number",
|
|
143
|
-
"references": {}
|
|
144
|
-
},
|
|
145
|
-
"required": false,
|
|
146
|
-
"optional": false,
|
|
147
|
-
"docs": {
|
|
148
|
-
"tags": [],
|
|
149
|
-
"text": "One-based visual and semantic nesting level."
|
|
150
|
-
},
|
|
151
|
-
"getter": false,
|
|
152
|
-
"setter": false,
|
|
153
|
-
"reflect": false,
|
|
154
|
-
"attribute": "depth",
|
|
155
|
-
"defaultValue": "1"
|
|
156
|
-
},
|
|
157
173
|
"dropDepth": {
|
|
158
174
|
"type": "number",
|
|
159
175
|
"mutable": false,
|
|
@@ -166,7 +182,7 @@ export class UITreeItem {
|
|
|
166
182
|
"optional": true,
|
|
167
183
|
"docs": {
|
|
168
184
|
"tags": [],
|
|
169
|
-
"text": "Application hierarchy depth used for drop constraints. Defaults to
|
|
185
|
+
"text": "Application hierarchy depth override used for drop constraints. Defaults to structural nesting."
|
|
170
186
|
},
|
|
171
187
|
"getter": false,
|
|
172
188
|
"setter": false,
|
|
@@ -185,7 +201,7 @@ export class UITreeItem {
|
|
|
185
201
|
"optional": true,
|
|
186
202
|
"docs": {
|
|
187
203
|
"tags": [],
|
|
188
|
-
"text": "
|
|
204
|
+
"text": "Virtualized-tree descendant-depth override for the tree's max-depth drop constraint."
|
|
189
205
|
},
|
|
190
206
|
"getter": false,
|
|
191
207
|
"setter": false,
|
|
@@ -301,16 +317,15 @@ export class UITreeItem {
|
|
|
301
317
|
"references": {}
|
|
302
318
|
},
|
|
303
319
|
"required": false,
|
|
304
|
-
"optional":
|
|
320
|
+
"optional": true,
|
|
305
321
|
"docs": {
|
|
306
322
|
"tags": [],
|
|
307
|
-
"text": "
|
|
323
|
+
"text": "Controlled expansion value. When omitted, `default-expanded` initializes uncontrolled state."
|
|
308
324
|
},
|
|
309
325
|
"getter": false,
|
|
310
326
|
"setter": false,
|
|
311
327
|
"reflect": false,
|
|
312
|
-
"attribute": "expanded"
|
|
313
|
-
"defaultValue": "false"
|
|
328
|
+
"attribute": "expanded"
|
|
314
329
|
},
|
|
315
330
|
"defaultExpanded": {
|
|
316
331
|
"type": "boolean",
|
|
@@ -376,7 +391,9 @@ export class UITreeItem {
|
|
|
376
391
|
}
|
|
377
392
|
static get states() {
|
|
378
393
|
return {
|
|
379
|
-
"internalExpanded": {}
|
|
394
|
+
"internalExpanded": {},
|
|
395
|
+
"structuralLevel": {},
|
|
396
|
+
"tabStop": {}
|
|
380
397
|
};
|
|
381
398
|
}
|
|
382
399
|
static get elementRef() { return "host"; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/collection/icons.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlignCenter, AlignLeft, AlignRight, Bold, Braces, ChevronDown, ChevronLeft, CodeXml, Columns3, Ellipsis, Eraser, GripHorizontal, GripVertical, Heading1, Heading2, Heading3, Highlighter, Image, Italic, List, ListOrdered, ListTodo, Merge, Minus, PaintBucket, PanelBottom, PanelLeft, PanelRight, PanelTop, Pilcrow, Plus, Quote, Redo2, Rows3, Split, Strikethrough, Table2, Trash2, Underline, Undo2, } from "lucide";
|
|
1
|
+
import { AlignCenter, AlignLeft, AlignRight, Bold, Braces, ChevronDown, ChevronLeft, CodeXml, CircleCheck, CircleX, Columns3, Ellipsis, Eraser, GripHorizontal, GripVertical, Heading1, Heading2, Heading3, Highlighter, Image, Info, Italic, List, ListOrdered, ListTodo, Merge, NotebookPen, Minus, PaintBucket, PanelBottom, PanelLeft, PanelRight, PanelTop, Pilcrow, Plus, Quote, Redo2, Rows3, Split, Strikethrough, Table2, Trash2, TriangleAlert, Underline, Undo2, } from "lucide";
|
|
2
2
|
/** The opinionated Lucide set used by Looma's shipped interaction surfaces. */
|
|
3
3
|
export const LOOMA_ICONS = {
|
|
4
4
|
'align-center': AlignCenter,
|
|
@@ -6,6 +6,8 @@ export const LOOMA_ICONS = {
|
|
|
6
6
|
'align-right': AlignRight,
|
|
7
7
|
bold: Bold,
|
|
8
8
|
braces: Braces,
|
|
9
|
+
'circle-check': CircleCheck,
|
|
10
|
+
'circle-x': CircleX,
|
|
9
11
|
'chevron-down': ChevronDown,
|
|
10
12
|
'chevron-left': ChevronLeft,
|
|
11
13
|
'code-xml': CodeXml,
|
|
@@ -19,11 +21,13 @@ export const LOOMA_ICONS = {
|
|
|
19
21
|
'heading-3': Heading3,
|
|
20
22
|
highlighter: Highlighter,
|
|
21
23
|
image: Image,
|
|
24
|
+
info: Info,
|
|
22
25
|
italic: Italic,
|
|
23
26
|
list: List,
|
|
24
27
|
'list-ordered': ListOrdered,
|
|
25
28
|
'list-todo': ListTodo,
|
|
26
29
|
merge: Merge,
|
|
30
|
+
'notebook-pen': NotebookPen,
|
|
27
31
|
minus: Minus,
|
|
28
32
|
'paint-bucket': PaintBucket,
|
|
29
33
|
'panel-bottom': PanelBottom,
|
|
@@ -39,6 +43,7 @@ export const LOOMA_ICONS = {
|
|
|
39
43
|
strikethrough: Strikethrough,
|
|
40
44
|
table: Table2,
|
|
41
45
|
trash: Trash2,
|
|
46
|
+
'triangle-alert': TriangleAlert,
|
|
42
47
|
underline: Underline,
|
|
43
48
|
undo: Undo2,
|
|
44
49
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** A state prop is controlled only when the consumer supplies a value. */
|
|
2
|
+
export const isControlled = (value) => value !== undefined;
|
|
3
|
+
/** Defaults apply only when a corresponding controlled prop is omitted. */
|
|
4
|
+
export const controlledOrDefault = (value, defaultValue) => value === undefined ? defaultValue : value;
|
|
@@ -9,8 +9,12 @@ export { UIBadge as UiBadge } from '../types/components/ui-badge/ui-badge';
|
|
|
9
9
|
export { defineCustomElement as defineCustomElementUiBadge } from './ui-badge';
|
|
10
10
|
export { UIButton as UiButton } from '../types/components/ui-button/ui-button';
|
|
11
11
|
export { defineCustomElement as defineCustomElementUiButton } from './ui-button';
|
|
12
|
+
export { UICallout as UiCallout } from '../types/components/ui-callout/ui-callout';
|
|
13
|
+
export { defineCustomElement as defineCustomElementUiCallout } from './ui-callout';
|
|
12
14
|
export { UICheckbox as UiCheckbox } from '../types/components/ui-checkbox/ui-checkbox';
|
|
13
15
|
export { defineCustomElement as defineCustomElementUiCheckbox } from './ui-checkbox';
|
|
16
|
+
export { UIChip as UiChip } from '../types/components/ui-chip/ui-chip';
|
|
17
|
+
export { defineCustomElement as defineCustomElementUiChip } from './ui-chip';
|
|
14
18
|
export { UICombobox as UiCombobox } from '../types/components/ui-combobox/ui-combobox';
|
|
15
19
|
export { defineCustomElement as defineCustomElementUiCombobox } from './ui-combobox';
|
|
16
20
|
export { UIContextMenu as UiContextMenu } from '../types/components/ui-context-menu/ui-context-menu';
|
|
@@ -19,6 +23,8 @@ export { UIDialog as UiDialog } from '../types/components/ui-dialog/ui-dialog';
|
|
|
19
23
|
export { defineCustomElement as defineCustomElementUiDialog } from './ui-dialog';
|
|
20
24
|
export { UIDisclosure as UiDisclosure } from '../types/components/ui-disclosure/ui-disclosure';
|
|
21
25
|
export { defineCustomElement as defineCustomElementUiDisclosure } from './ui-disclosure';
|
|
26
|
+
export { UIEditable as UiEditable } from '../types/components/ui-editable/ui-editable';
|
|
27
|
+
export { defineCustomElement as defineCustomElementUiEditable } from './ui-editable';
|
|
22
28
|
export { UIFloatingActionButton as UiFloatingActionButton } from '../types/components/ui-floating-action-button/ui-floating-action-button';
|
|
23
29
|
export { defineCustomElement as defineCustomElementUiFloatingActionButton } from './ui-floating-action-button';
|
|
24
30
|
export { UIFormField as UiFormField } from '../types/components/ui-form-field/ui-form-field';
|
|
@@ -31,6 +37,8 @@ export { UIMenu as UiMenu } from '../types/components/ui-menu/ui-menu';
|
|
|
31
37
|
export { defineCustomElement as defineCustomElementUiMenu } from './ui-menu';
|
|
32
38
|
export { UIMenuItem as UiMenuItem } from '../types/components/ui-menu-item/ui-menu-item';
|
|
33
39
|
export { defineCustomElement as defineCustomElementUiMenuItem } from './ui-menu-item';
|
|
40
|
+
export { UIMultiCombobox as UiMultiCombobox } from '../types/components/ui-multi-combobox/ui-multi-combobox';
|
|
41
|
+
export { defineCustomElement as defineCustomElementUiMultiCombobox } from './ui-multi-combobox';
|
|
34
42
|
export { UIPopover as UiPopover } from '../types/components/ui-popover/ui-popover';
|
|
35
43
|
export { defineCustomElement as defineCustomElementUiPopover } from './ui-popover';
|
|
36
44
|
export { UIRadio as UiRadio } from '../types/components/ui-radio/ui-radio';
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-Bh_1GxOD.js";export{UiAffordanceScope,defineCustomElement as defineCustomElementUiAffordanceScope}from"./ui-affordance-scope.js";export{UiAvatar,defineCustomElement as defineCustomElementUiAvatar}from"./ui-avatar.js";export{UiAvatarGroup,defineCustomElement as defineCustomElementUiAvatarGroup}from"./ui-avatar-group.js";export{UiBadge,defineCustomElement as defineCustomElementUiBadge}from"./ui-badge.js";export{UiButton,defineCustomElement as defineCustomElementUiButton}from"./ui-button.js";export{UiCheckbox,defineCustomElement as defineCustomElementUiCheckbox}from"./ui-checkbox.js";export{UiCombobox,defineCustomElement as defineCustomElementUiCombobox}from"./ui-combobox.js";export{UiContextMenu,defineCustomElement as defineCustomElementUiContextMenu}from"./ui-context-menu.js";export{UiDialog,defineCustomElement as defineCustomElementUiDialog}from"./ui-dialog.js";export{UiDisclosure,defineCustomElement as defineCustomElementUiDisclosure}from"./ui-disclosure.js";export{UiFloatingActionButton,defineCustomElement as defineCustomElementUiFloatingActionButton}from"./ui-floating-action-button.js";export{UiFormField,defineCustomElement as defineCustomElementUiFormField}from"./ui-form-field.js";export{UiIconButton,defineCustomElement as defineCustomElementUiIconButton}from"./ui-icon-button.js";export{UiInput,defineCustomElement as defineCustomElementUiInput}from"./ui-input.js";export{UiMenu,defineCustomElement as defineCustomElementUiMenu}from"./ui-menu.js";export{UiMenuItem,defineCustomElement as defineCustomElementUiMenuItem}from"./ui-menu-item.js";export{UiPopover,defineCustomElement as defineCustomElementUiPopover}from"./ui-popover.js";export{UiRadio,defineCustomElement as defineCustomElementUiRadio}from"./ui-radio.js";export{UiRadioGroup,defineCustomElement as defineCustomElementUiRadioGroup}from"./ui-radio-group.js";export{UiSearchResultRow,defineCustomElement as defineCustomElementUiSearchResultRow}from"./ui-search-result-row.js";export{UiSearchShell,defineCustomElement as defineCustomElementUiSearchShell}from"./ui-search-shell.js";export{UiSelect,defineCustomElement as defineCustomElementUiSelect}from"./ui-select.js";export{UiSwitch,defineCustomElement as defineCustomElementUiSwitch}from"./ui-switch.js";export{UiTabs,defineCustomElement as defineCustomElementUiTabs}from"./ui-tabs.js";export{UiTextarea,defineCustomElement as defineCustomElementUiTextarea}from"./ui-textarea.js";export{UiToastRegion,defineCustomElement as defineCustomElementUiToastRegion}from"./ui-toast-region.js";export{UiTooltip,defineCustomElement as defineCustomElementUiTooltip}from"./ui-tooltip.js";export{UiTopBar,defineCustomElement as defineCustomElementUiTopBar}from"./ui-top-bar.js";export{UiTree,defineCustomElement as defineCustomElementUiTree}from"./ui-tree.js";export{UiTreeItem,defineCustomElement as defineCustomElementUiTreeItem}from"./ui-tree-item.js";
|
|
1
|
+
export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-Bh_1GxOD.js";export{UiAffordanceScope,defineCustomElement as defineCustomElementUiAffordanceScope}from"./ui-affordance-scope.js";export{UiAvatar,defineCustomElement as defineCustomElementUiAvatar}from"./ui-avatar.js";export{UiAvatarGroup,defineCustomElement as defineCustomElementUiAvatarGroup}from"./ui-avatar-group.js";export{UiBadge,defineCustomElement as defineCustomElementUiBadge}from"./ui-badge.js";export{UiButton,defineCustomElement as defineCustomElementUiButton}from"./ui-button.js";export{UiCallout,defineCustomElement as defineCustomElementUiCallout}from"./ui-callout.js";export{UiCheckbox,defineCustomElement as defineCustomElementUiCheckbox}from"./ui-checkbox.js";export{UiChip,defineCustomElement as defineCustomElementUiChip}from"./ui-chip.js";export{UiCombobox,defineCustomElement as defineCustomElementUiCombobox}from"./ui-combobox.js";export{UiContextMenu,defineCustomElement as defineCustomElementUiContextMenu}from"./ui-context-menu.js";export{UiDialog,defineCustomElement as defineCustomElementUiDialog}from"./ui-dialog.js";export{UiDisclosure,defineCustomElement as defineCustomElementUiDisclosure}from"./ui-disclosure.js";export{UiEditable,defineCustomElement as defineCustomElementUiEditable}from"./ui-editable.js";export{UiFloatingActionButton,defineCustomElement as defineCustomElementUiFloatingActionButton}from"./ui-floating-action-button.js";export{UiFormField,defineCustomElement as defineCustomElementUiFormField}from"./ui-form-field.js";export{UiIconButton,defineCustomElement as defineCustomElementUiIconButton}from"./ui-icon-button.js";export{UiInput,defineCustomElement as defineCustomElementUiInput}from"./ui-input.js";export{UiMenu,defineCustomElement as defineCustomElementUiMenu}from"./ui-menu.js";export{UiMenuItem,defineCustomElement as defineCustomElementUiMenuItem}from"./ui-menu-item.js";export{UiMultiCombobox,defineCustomElement as defineCustomElementUiMultiCombobox}from"./ui-multi-combobox.js";export{UiPopover,defineCustomElement as defineCustomElementUiPopover}from"./ui-popover.js";export{UiRadio,defineCustomElement as defineCustomElementUiRadio}from"./ui-radio.js";export{UiRadioGroup,defineCustomElement as defineCustomElementUiRadioGroup}from"./ui-radio-group.js";export{UiSearchResultRow,defineCustomElement as defineCustomElementUiSearchResultRow}from"./ui-search-result-row.js";export{UiSearchShell,defineCustomElement as defineCustomElementUiSearchShell}from"./ui-search-shell.js";export{UiSelect,defineCustomElement as defineCustomElementUiSelect}from"./ui-select.js";export{UiSwitch,defineCustomElement as defineCustomElementUiSwitch}from"./ui-switch.js";export{UiTabs,defineCustomElement as defineCustomElementUiTabs}from"./ui-tabs.js";export{UiTextarea,defineCustomElement as defineCustomElementUiTextarea}from"./ui-textarea.js";export{UiToastRegion,defineCustomElement as defineCustomElementUiToastRegion}from"./ui-toast-region.js";export{UiTooltip,defineCustomElement as defineCustomElementUiTooltip}from"./ui-tooltip.js";export{UiTopBar,defineCustomElement as defineCustomElementUiTopBar}from"./ui-top-bar.js";export{UiTree,defineCustomElement as defineCustomElementUiTree}from"./ui-tree.js";export{UiTreeItem,defineCustomElement as defineCustomElementUiTreeItem}from"./ui-tree-item.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e,H as t,h as i,c as s,t as a}from"./p-Bh_1GxOD.js";import{d as r,e as o}from"./p-JwSoedEO.js";import{o as n,c,r as u}from"./p-C-0syqXZ.js";import{i as l,c as d}from"./p-BnGhGgTH.js";import{c as h}from"./p-DOulVJT7.js";const p=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}get host(){return this}open;defaultOpen=!1;for;placement="bottom-start";internalOpen=!1;overlayId=`ui-menu-${Math.random().toString(36).slice(2,11)}`;anchor=null;surface=null;syncFromProp(){l(this.open)&&(this.internalOpen=this.open)}resetSurface(){this.setupSurface(),this.syncSurface()}syncSurface(){this.syncAnchorState(),this.surface&&(this.internalOpen?(this.surface.show(),n({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.anchor?[this.anchor]:void 0,dismissible:!0,requestClose:(e,t)=>this.closeMenu(e,t)})):(this.surface.hide(),c(this.overlayId)))}componentDidLoad(){this.internalOpen=d(this.open,this.defaultOpen),this.host.addEventListener("click",this.onItemClick),this.host.addEventListener("keydown",this.onKeydown),this.setupSurface(),this.syncSurface()}disconnectedCallback(){this.host.removeEventListener("click",this.onItemClick),this.host.removeEventListener("keydown",this.onKeydown),this.surface?.destroy(),this.surface=null,c(this.overlayId)}setupSurface(){this.surface?.destroy(),this.surface=null,this.anchor=this.for?this.host.ownerDocument.getElementById(this.for):null,this.anchor&&(this.surface=h(this.host,{anchor:this.anchor,placement:this.placement}))}syncAnchorState(){this.anchor&&(this.anchor.setAttribute("aria-haspopup","menu"),this.anchor.setAttribute("aria-expanded",this.internalOpen?"true":"false"))}closeMenu(e,t){this.internalOpen&&(l(this.open)||(this.internalOpen=!1),r(this.host,"close",{open:!1,reason:e,trigger:t}),"escape"===e&&this.anchor?.focus())}getItems(){return Array.from(this.host.querySelectorAll("ui-menu-item"))}isItemDisabled(e){return"true"===e.getAttribute("aria-disabled")||e.hasAttribute("disabled")||"true"===e.getAttribute("disabled")||!0===e.disabled}onItemClick=e=>{const t=e.target.closest?.("ui-menu-item");if(!t||t.getRootNode()!==this.host.getRootNode())return;if(this.isItemDisabled(t))return;const i=t.getAttribute("value")??t.getAttribute("data-value")??"";r(this.host,"select",{value:i,trigger:o(e)}),r(this.host,"close",{open:!1,reason:"action",trigger:o(e)}),l(this.open)||(this.internalOpen=!1)};onKeydown=e=>{if("Escape"===e.key)return e.preventDefault(),void u("escape","keyboard");const i=this.getItems().filter((e=>!this.isItemDisabled(e)));if(0===i.length)return;const s=e.target.closest?.("ui-menu-item"),a=s&&s instanceof t?i.indexOf(s):-1;if("Enter"!==e.key&&" "!==e.key)"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),i["ArrowDown"===e.key?a<0?0:Math.min(a+1,i.length-1):a<=0?i.length-1:a-1].focus());else if(e.preventDefault(),s&&a>=0){const e=s.getAttribute("value")??s.getAttribute("data-value")??"";r(this.host,"select",{value:e,trigger:"keyboard"}),r(this.host,"close",{open:!1,reason:"action",trigger:"keyboard"}),l(this.open)||(this.internalOpen=!1)}};render(){return i(s,{key:"afba5a7f63238afdb6f71a3636c1f294d3e8ac6f",role:"menu","aria-orientation":"vertical","data-open":this.internalOpen?"":void 0},i("div",{key:"50d770efd27dddca436b804f10f1cc40bc604cb5",class:"menu__surface"},i("slot",{key:"5014fc43a0ee2d66168bbcc1d52b20bd5120acb9"})))}static get watchers(){return{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncSurface:0}]}}static get style(){return":host{--ui-menu-viewport-gap:var(--ui-space-2, 0.5rem);display:flex;flex-direction:column;box-sizing:border-box;inline-size:max-content;min-inline-size:min(12rem, calc(100vw - (var(--ui-menu-viewport-gap) * 2)));max-inline-size:calc(100vw - (var(--ui-menu-viewport-gap) * 2));padding:0;border:0;border-radius:0;background:transparent;box-shadow:var(--ui-shadow-lg)}.menu__surface{display:flex;flex-direction:column;box-sizing:border-box;padding:var(--ui-space-1);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;overflow:auto;max-block-size:calc(100dvh - (var(--ui-menu-viewport-gap) * 2));opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}::slotted(ui-menu-item){display:block;width:100%}"}},[769,"ui-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},void 0,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncSurface:0}]}]);function m(){"undefined"!=typeof customElements&&["ui-menu"].forEach((e=>{"ui-menu"===e&&(customElements.get(a(e))||customElements.define(a(e),p))}))}export{p as U,m as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as i,H as t,d as s,h as e,c as a,t as o}from"./p-Bh_1GxOD.js";import{c as r}from"./p-DOulVJT7.js";import{c as n,o as h}from"./p-C-0syqXZ.js";import{d as l}from"./p-C6p-ygxq.js";const d=i(class extends t{constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.queryChange=s(this,"query-change"),this.valueChange=s(this,"value-change"),this.freeEntry=s(this,"free-entry"),this.createEntry=s(this,"create-entry"),this.dependencyInvalidate=s(this,"dependency-invalidate"),this.validationChange=s(this,"validation-change"),this.optionsChange=s(this,"options-change")}get host(){return this}label="";placeholder="";name="";value;defaultValue;query;defaultQuery="";config={};disabled=!1;readOnly=!1;required=!1;size="md";labelVisibility="visible";disclosure=!1;clearable=!1;help="";queryChange;valueChange;freeEntry;createEntry;dependencyInvalidate;validationChange;optionsChange;raw="";display="";selected=null;expanded=!1;rows=[];active=-1;loading=!1;helpOpen=!1;lookupError="";validation={status:"pristine",touched:!1,dirty:!1,issues:[]};input;popup;field;surface;lookup;validationRun;lookupTimer;composing=!1;initialRaw="";overlayId=`ui-combobox-${Math.random().toString(36).slice(2)}`;alive=!1;fullSet=!1;knownOptions=new Map;awaitingLabel=null;proposedChange;formattedRaw;formattedWith;componentWillLoad(){this.selected=void 0!==this.value?this.value:this.defaultValue??null,this.raw=this.query??this.defaultQuery,void 0!==this.query||this.raw||null===this.selected||(this.raw=this.config.options?.find((i=>i.value===this.selected))?.label??this.selected),void 0===this.query&&null!==this.selected&&this.raw===this.selected&&(this.awaitingLabel=this.selected),this.display=this.raw,this.initialRaw=this.raw,this.applyServerIssues()}connectedCallback(){this.alive=!0,this.setupSurface()}componentDidLoad(){this.setupSurface()}componentDidUpdate(){this.input&&!this.composing&&this.input.value!==this.display&&(this.input.value=this.display),this.expanded&&this.surface?.refresh()}disconnectedCallback(){this.alive=!1,this.close(),this.validationRun?.abort(),this.surface?.destroy(),this.surface=void 0}setupSurface(){!this.surface&&this.popup&&this.field&&(this.surface=r(this.popup,{anchor:this.field,placement:"bottom-start"}))}syncValue(){if(void 0!==this.value){if(this.selected=this.value,void 0===this.query){const i=this.proposedChange,t=this.config.options?.find((i=>i.value===this.selected))??(null===this.selected?void 0:this.knownOptions.get(this.selected)),s=i?.value===this.selected?i.query:t?.label??this.selected??"";i?.value===this.selected&&s===this.raw||(this.raw=s,this.display=this.raw,this.formattedRaw=void 0),this.awaitingLabel=t||null===this.selected?null:this.selected}this.resetValidation()}}syncQuery(){void 0!==this.query&&this.query!==this.raw&&(void 0===this.value&&this.proposedChange?.query!==this.query&&(this.selected=null),this.awaitingLabel=null,this.formattedRaw=void 0,this.raw=this.query,this.display=this.raw,this.resetValidation(),this.expanded&&this.search("input"))}syncDisabled(){(this.disabled||this.readOnly)&&(this.close(),this.resetValidation())}syncConfig(i,t){if(this.validationRun?.abort(),i.provider===t?.provider&&i.context===t?.context||this.knownOptions.clear(),i.context!==t?.context){this.close();const t=i.invalidation??"retain-query";this.commit("retain"===t?this.selected:null,"clear"===t?"":this.raw,null,"invalidation","programmatic"),this.validation={status:"pristine",touched:!1,dirty:this.raw!==this.initialRaw,issues:[]}}this.applyServerIssues(),this.expanded&&this.search("context")}applyServerIssues(){const i=this.config.issues??[];i.length?this.setValidation({issues:i},this.validation.touched):this.resetValidation()}resetValidation(){this.validationRun?.abort(),this.validation={status:"pristine",touched:this.validation.touched,dirty:this.raw!==this.initialRaw,issues:[]},this.validationChange?.emit(this.validation)}cancelLookup(){clearTimeout(this.lookupTimer),this.lookup?.abort(),this.lookup=void 0,this.loading=!1}close(){this.expanded=!1,this.active=-1,this.cancelLookup(),this.surface?.hide(),n(this.overlayId)}open(i="input"){this.disabled||this.readOnly||(this.expanded=!0,this.popup&&this.field&&(this.popup.style.minWidth=`${this.field.getBoundingClientRect().width}px`),this.surface?.show(),h({id:this.overlayId,element:this.popup,relatedElements:[this.host],modal:!1,requestClose:()=>this.close()}),this.search(i))}search(i){this.cancelLookup(),this.fullSet="disclosure"===i,this.active=-1,this.lookupError="";const t=this.config,s=this.fullSet?"":this.raw,e=new AbortController;this.lookup=e;const a=i=>{if(e.signal.aborted||!this.alive)return;for(const t of i)this.knownOptions.set(t.value,t);const a=null===this.selected?void 0:this.knownOptions.get(this.selected);void 0===this.query&&this.awaitingLabel===this.selected&&a&&(this.raw=a.label,this.display=this.raw,this.awaitingLabel=null,this.formattedRaw=void 0,this.resetValidation());const o=new Set;this.rows=i.filter((i=>!o.has(i.id)&&(o.add(i.id),this.fullSet||(t.filter?t.filter(i,s,t.context):!!t.provider||i.label.toLocaleLowerCase().includes(s.toLocaleLowerCase())))));const r=new Map;for(const i of this.rows){const t=i.group??"";r.has(t)||r.set(t,[]),r.get(t).push(i)}this.rows=[...r.values()].flat(),this.loading=!1,this.optionsChange.emit(this.rows)};t.provider?(this.rows=[],this.loading=!0,this.lookupTimer=setTimeout((async()=>{try{a(await t.provider({query:s,context:t.context,signal:e.signal,reason:i}))}catch(i){if(e.signal.aborted||!this.alive)return;this.loading=!1,this.lookupError=i instanceof Error?i.message:"Unable to load suggestions."}}),"disclosure"===i?0:Math.max(0,t.debounce??200))):a(t.options??[])}get canCreate(){const i=this.config.options?[...this.config.options,...this.rows]:this.rows;return Boolean(this.config.allowCreate&&this.raw.trim()&&!this.loading&&!this.lookupError&&!i.some((i=>i.label.toLocaleLowerCase()===this.raw.toLocaleLowerCase())))}format(i){if((this.config.formatOn??"blur")!==i||!this.input)return;if(this.formattedRaw===this.raw&&this.formattedWith===this.config.format)return;const t=function(i,t,s){const e={display:i,selection:t};if(!s)return e;let a;try{a=s(i,t)}catch{return e}if(!a)return e;const o=Array.from(i);let r=0;for(const i of a.display)i===o[r]&&(r+=1);return!Number.isInteger(a.selection.start)||!Number.isInteger(a.selection.end)||r!==o.length||a.selection.start<0||a.selection.end<a.selection.start||a.selection.end>a.display.length?e:a}(this.raw,{start:this.input.selectionStart??this.raw.length,end:this.input.selectionEnd??this.raw.length,direction:this.input.selectionDirection??"none"},this.config.format);this.formattedRaw=this.raw,this.formattedWith=this.config.format,this.display=t.display,this.input.value!==t.display&&(this.input.value=t.display,this.input.setSelectionRange(t.selection.start,t.selection.end,t.selection.direction))}onInput=i=>{this.composing||i.isComposing||(this.awaitingLabel=null,this.formattedRaw=void 0,this.raw=this.input.value,this.display=this.raw,this.resetValidation(),this.format("input"),this.queryChange.emit({query:this.raw,display:this.display,trigger:"keyboard"}),null!==this.selected&&this.commit(null,this.raw,null,"clear","keyboard"),this.open(),"input"===this.config.validateOn&&this.validate(),queueMicrotask((()=>{void 0!==this.query&&this.query!==this.raw&&this.syncQuery()})))};commit(i,t,s,e,a){this.awaitingLabel=null;const o=t!==this.raw;void 0===this.value&&(this.selected=i),void 0===this.query&&o&&(this.raw=t,this.display=t,this.formattedRaw=void 0),this.resetValidation();const r={value:i,query:t,option:s,kind:e,trigger:a},n={value:i,query:t};this.proposedChange=n,this.valueChange.emit(r),o&&this.queryChange.emit({query:t,display:t,trigger:a}),"create"===e&&this.createEntry.emit(r),"free-entry"===e&&this.freeEntry.emit(r),"invalidation"===e&&this.dependencyInvalidate.emit(r),queueMicrotask((()=>{this.proposedChange===n&&(void 0!==this.value&&this.value!==n.value&&this.syncValue(),void 0!==this.query&&this.query!==n.query&&(void 0===this.value&&(this.selected=null,this.resetValidation()),this.syncQuery()),this.proposedChange=void 0)}))}choose(i,t){const s=this.rows[i];if(!s?.disabled){if(s)this.commit(s.value,s.label,s,"selection",t);else{if(!this.canCreate||i!==this.rows.length)return;this.commit(null,this.raw,null,"create",t)}this.close(),this.input?.focus(),"submit"!==this.config.validateOn&&queueMicrotask((()=>{this.validate()}))}}move(i){const t=this.rows.flatMap(((i,t)=>i.disabled?[]:[t]));if(this.canCreate&&t.push(this.rows.length),!t.length)return;const s=t.indexOf(this.active),e="Home"===i?0:"End"===i?t.length-1:"ArrowDown"===i?Math.min(s+1,t.length-1):s<0?t.length-1:Math.max(0,s-1);this.active=t[e],requestAnimationFrame((()=>this.host.shadowRoot?.getElementById(`option-${this.active}`)?.scrollIntoView({block:"nearest"})))}onKeydown=i=>{if(!(this.composing||i.isComposing||this.disabled||this.readOnly))return"Escape"===i.key&&this.expanded?(i.preventDefault(),i.stopPropagation(),void this.close()):void("Tab"!==i.key?i.altKey||i.ctrlKey||i.metaKey||i.shiftKey||("ArrowDown"===i.key||"ArrowUp"===i.key?(i.preventDefault(),this.expanded||this.open("disclosure"),this.move(i.key)):("Home"===i.key||"End"===i.key)&&this.expanded&&this.active>=0?(i.preventDefault(),this.move(i.key)):"Enter"===i.key&&this.expanded&&(this.active>=0?(i.preventDefault(),this.choose(this.active,"keyboard")):this.config.allowFreeText&&(i.preventDefault(),this.commit(null,this.raw,null,"free-entry","keyboard"),this.close()))):this.close())};onFocusOut=i=>{i.relatedTarget instanceof Node&&this.host.shadowRoot?.contains(i.relatedTarget)||(this.close(),this.format("blur"),this.validation={...this.validation,touched:!0},this.config.allowFreeText&&null===this.selected&&this.commit(null,this.raw,null,"free-entry","keyboard"),"blur"===(this.config.validateOn??"blur")&&this.validate())};setValidation(i,t=this.validation.touched){const s=i.issues.some((i=>"warning"!==i.severity));this.validation={status:s?"error":i.issues.length?"warning":"valid",touched:t,dirty:this.raw!==this.initialRaw,...i},this.validationChange?.emit(this.validation)}async validate(){this.validationRun?.abort();const i=new AbortController;this.validationRun=i,this.validation={...this.validation,status:"pending",output:void 0},this.validationChange.emit(this.validation);try{const t=await async function(i,t){let s=i.raw,e=[];const a=()=>i.signal.throwIfAborted();try{if(a(),t.parse&&(s=await t.parse(i.raw,i)),a(),t.schema){const i=await t.schema["~standard"].validate(s);a(),i.issues?e=i.issues:"value"in i&&(s=i.value)}if(!e.some((i=>"warning"!==i.severity))&&(t.normalize&&(s=await t.normalize(s,i)),a(),t.validator)){const o=await t.validator(s,i);a(),e=[...e,...o.issues??[]],"output"in o&&(s=o.output)}}catch(i){a(),e=[{message:i instanceof Error?i.message:"Unable to validate this value."}]}return e=[...e,...t.issues??[]],{output:e.some((i=>"warning"!==i.severity))?void 0:s,issues:e}}({raw:this.raw,value:this.selected,context:this.config.context,signal:i.signal},this.config);this.required&&!this.raw.trim()?t.issues=[...t.issues,{message:"A value is required."}]:!this.raw||null!==this.selected||this.config.allowFreeText||this.config.allowCreate||(t.issues=[...t.issues,{message:"Choose a suggestion."}]),t.issues.some((i=>"warning"!==i.severity))&&(t.output=void 0),!i.signal.aborted&&this.alive&&this.setValidation(t)}catch{}return this.validation}async focusInput(){this.input?.focus()}render(){const i=[this.helpOpen?"help-text":"",this.validation.issues.length?"validation":""].filter(Boolean).join(" ")||void 0,t=this.loading?"Loading suggestions…":this.lookupError||(this.expanded?`${this.rows.length} suggestions available.`:""),s=[...new Set(this.rows.map((i=>i.group??"")))];return e(a,{key:"a33890c2824f29dfea5e22edddca4480a6d1d032","data-size":this.size,"data-validation":this.validation.status,onFocusout:this.onFocusOut},e("label",{key:"c936530cf696c1d14245fd83895e9c58c908df12",htmlFor:"input",part:"label",class:"sr-only"===this.labelVisibility?"sr-only":void 0},this.label,this.required?" *":""),e("div",{key:"0fe0ed9b15a3e256867e071ca7e4fa3abc66f27c",class:"field",part:"field",ref:i=>this.field=i,onClick:i=>{i.composedPath().some((i=>i instanceof HTMLButtonElement))||this.input?.focus()}},e("slot",{key:"9cc4c22eb7776e415792fbdf3c17c962c7107f70",name:"start"}),e("input",{key:"0898e8ec5af57c7ba8ad227164f7955ef4011729",id:"input",ref:i=>this.input=i,role:"combobox","aria-autocomplete":"list","aria-expanded":String(this.expanded),"aria-controls":"listbox","aria-activedescendant":this.expanded&&this.active>=0?`option-${this.active}`:void 0,"aria-describedby":i,"aria-invalid":String("error"===this.validation.status),"aria-busy":String("pending"===this.validation.status),value:this.display,placeholder:this.placeholder,name:this.name||void 0,disabled:this.disabled,readOnly:this.readOnly,required:this.required,autoComplete:"off",part:"input",onInput:this.onInput,onKeyDown:this.onKeydown,onCompositionstart:()=>this.composing=!0,onCompositionend:()=>{this.composing=!1,this.onInput(new InputEvent("input"))}}),this.clearable&&e("button",{key:"f9a49484ae9bcc4ace72a46d0c59202040ff39d8",type:"button",part:"affordance","aria-label":`Clear ${this.label}`,disabled:this.disabled||this.readOnly,onClick:()=>{this.commit(null,"",null,"clear","pointer"),this.close(),this.input?.focus()}},"×"),this.help&&e("button",{key:"597106eda4dcc68aa9fb2eaa99c1edad0d68a892",id:"help",type:"button",part:"affordance","aria-label":`Help for ${this.label}`,disabled:this.disabled},e("span",{key:"d26085a52b16d65e26dc20ef8afacb5defec5f7b","aria-hidden":"true"},"?")),this.disclosure&&e("button",{key:"391d1c987eb8e868b2846eafd0627cfc78ab7478",type:"button",part:"affordance","aria-label":`Suggestions for ${this.label}`,"aria-controls":"listbox","aria-expanded":String(this.expanded),disabled:this.disabled||this.readOnly,onClick:()=>{this.expanded?this.close():this.open("disclosure"),this.input?.focus()}},e("span",{key:"45678ce468fd7944306d4542e3c6af0fe211af14","aria-hidden":"true"},"⌄"))),this.help&&e("ui-tooltip",{key:"a8dc037639a60aff5a12b4651ffa10fc5ccd33eb",id:"help-text",for:"help",toggleOnClick:!0,onOpen:()=>this.helpOpen=!0,onClose:()=>this.helpOpen=!1},this.help),e("div",{key:"f13fc7a11c3d22995035b6701ea24637a048a5b8",class:"popup",part:"popup",hidden:!this.expanded,ref:i=>this.popup=i},e("div",{key:"9d2bdfcc558f8e7de87f2915ea5607a8f32c1762",id:"listbox",role:"listbox","aria-label":`${this.label} suggestions`,"aria-busy":String(this.loading)},s.map((i=>e("div",{role:i?"group":"presentation","aria-label":i||void 0},i&&e("div",{class:"group",part:"group"},i),this.rows.map(((t,s)=>(t.group??"")!==i?null:e("div",{id:`option-${s}`,role:"option","aria-selected":String(this.selected===t.value),"aria-disabled":String(Boolean(t.disabled)),"data-active":this.active===s?"":void 0,part:"option",class:"option",onPointerDown:i=>i.preventDefault(),onClick:()=>this.choose(s,"pointer")},e("slot",{name:`option-${t.id}`},e("span",{class:"primary",part:"option-primary"},t.label),t.description&&e("span",{class:"secondary",part:"option-secondary"},t.description)))))))),this.canCreate&&e("div",{key:"9495fd43a721c84621b8083cb8eac776f843ab59",id:`option-${this.rows.length}`,role:"option","aria-selected":"false",class:"option",part:"option","data-active":this.active===this.rows.length?"":void 0,onPointerDown:i=>i.preventDefault(),onClick:()=>this.choose(this.rows.length,"pointer")},e("slot",{key:"f0407c5622dcf3b325985c136657f8b9ac8a4ab5",name:"create"},"Create “",this.raw,"”"))),this.loading?e("div",{class:"message"},e("slot",{name:"loading"},"Loading suggestions…")):this.lookupError?e("div",{class:"message"},e("slot",{name:"error"},this.lookupError)):this.rows.length||this.canCreate?null:e("div",{class:"message"},e("slot",{name:"empty"},"No suggestions.")),e("slot",{key:"efcaee3efb029a9e0bb4e033ab61b251331c1c93",name:"footer"})),e("div",{key:"b44ccb319f94ebc9e6ac3204a8c1771d49485a58",id:"validation",class:"message",part:"validation",hidden:!this.validation.issues.length},this.validation.issues.map((i=>e("div",null,i.message)))),e("div",{key:"c3cb51dd4603734af4c7a02d8fe0bb42ac69083a",class:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true"},t," ","pending"===this.validation.status?"Checking value…":this.validation.issues.map((i=>i.message)).join(" ")))}static get watchers(){return{value:[{syncValue:0}],query:[{syncQuery:0}],disabled:[{syncDisabled:0}],readOnly:[{syncDisabled:0}],config:[{syncConfig:0}]}}static get style(){return":host{display:grid;gap:var(--ui-space-1);min-inline-size:0;color:var(--ui-text-primary);font:inherit}label{color:var(--ui-field-label-color, var(--ui-text-primary));font-size:var(--ui-field-label-size, 0.875rem);font-weight:var(--ui-field-label-weight, 500)}.field{display:flex;min-inline-size:0;border:1px solid var(--ui-control-border, var(--ui-border-default));border-radius:var(--ui-radius-2);background:var(--ui-control-surface, var(--ui-surface-default))}.field:focus-within{border-color:var(--ui-control-focus, var(--ui-focus-ring));outline:2px solid var(--ui-control-focus, var(--ui-focus-ring));outline-offset:1px}input{appearance:none;width:100%;min-inline-size:0;min-block-size:var(--ui-control-min-block-size, 2.75rem);box-sizing:border-box;border:0;border-radius:inherit;background:transparent;color:inherit;font:inherit;line-height:var(--ui-line-height-md);padding:var(--ui-space-2) var(--ui-space-3);margin:0;outline:none}:host([data-size='sm']) input{min-block-size:var(--ui-field-compact-size, 2rem);padding:var(--ui-space-1) var(--ui-space-2)}button{appearance:none;border:0;border-radius:var(--ui-radius-2);background:transparent;color:var(--ui-field-affordance-color, var(--ui-text-secondary));font:inherit;font-weight:var(--ui-field-affordance-weight, 400);min-inline-size:2rem;padding:var(--ui-space-1);cursor:pointer}button:hover:enabled{background:var(--ui-surface-muted);color:var(--ui-text-primary)}button:focus-visible{outline:2px solid var(--ui-focus-ring);outline-offset:-3px}input:disabled,button:disabled{color:var(--ui-text-muted);cursor:not-allowed}.field:has(input:disabled){background:var(--ui-control-surface-disabled, var(--ui-surface-muted))}:host([data-validation='error']) .field{border-color:var(--ui-danger-solid, var(--ui-accent-active))}.popup{box-sizing:border-box;min-inline-size:12rem;max-inline-size:calc(100vw - 1rem);max-block-size:var(--ui-combobox-max-block-size, 18rem);overflow:auto;margin:0;padding:var(--ui-space-1);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-md)}[hidden]{display:none !important}.option{padding:var(--ui-space-2) var(--ui-space-3);border-radius:var(--ui-radius-1);cursor:pointer;overflow-wrap:anywhere}.option:hover,.option[data-active]{background:var(--ui-surface-muted);outline:1px solid var(--ui-focus-ring);outline-offset:-1px}.option[aria-disabled='true']{color:var(--ui-text-muted);cursor:not-allowed}.primary{display:block;color:var(--ui-option-primary-color, var(--ui-text-primary));font-weight:var(--ui-option-primary-weight, 500)}.secondary{display:block;color:var(--ui-option-secondary-color, var(--ui-text-secondary));font-weight:var(--ui-option-secondary-weight, 400);font-size:var(--ui-font-size-sm)}.message,.group{color:var(--ui-field-message-color, var(--ui-text-secondary));font-weight:var(--ui-field-message-weight, 400);font-size:var(--ui-font-size-sm);line-height:var(--ui-line-height-md);overflow-wrap:anywhere}.group,.popup .message{padding:var(--ui-space-2) var(--ui-space-3)}.sr-only{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media (pointer: coarse){button{min-inline-size:2.75rem;min-block-size:2.75rem}}@media (forced-colors: active){.field,.popup{border-color:CanvasText}.option[data-active]{outline-color:Highlight}}"}},[769,"ui-combobox",{label:[1],placeholder:[1],name:[1],value:[1],defaultValue:[1,"default-value"],query:[1],defaultQuery:[1,"default-query"],config:[16],disabled:[4],readOnly:[4,"readonly"],required:[4],size:[1],labelVisibility:[1,"label-visibility"],disclosure:[4],clearable:[4],help:[1],raw:[32],display:[32],selected:[32],expanded:[32],rows:[32],active:[32],loading:[32],helpOpen:[32],lookupError:[32],validation:[32],validate:[64],focusInput:[64]},void 0,{value:[{syncValue:0}],query:[{syncQuery:0}],disabled:[{syncDisabled:0}],readOnly:[{syncDisabled:0}],config:[{syncConfig:0}]}]);function c(){"undefined"!=typeof customElements&&["ui-combobox","ui-tooltip"].forEach((i=>{switch(i){case"ui-combobox":customElements.get(o(i))||customElements.define(o(i),d);break;case"ui-tooltip":customElements.get(o(i))||l()}}))}export{d as U,c as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as i,H as a,h as e,c as t,t as c}from"./p-Bh_1GxOD.js";const r=i(class extends a{constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow()}appearance="tag";size="xs";render(){return e(t,{key:"970cb48cf8d70c47feaab90fe428c09f0d052a03","data-appearance":this.appearance,"data-size":this.size},e("span",{key:"6d8c6104d2869520097a2a61bd2a887b363b4912",class:"chip__surface"},e("slot",{key:"b61c50a8060d8a2684aed6f87dc859b1c9e99858"})))}static get style(){return":host{--ui-chip-surface:var(--ui-surface-subtle);--ui-chip-text:var(--ui-text-secondary);--ui-chip-border:var(--ui-border-default);--ui-chip-font-size:var(--ui-font-size-xs);--ui-chip-font-weight:var(--ui-font-normal);--ui-chip-line-height:var(--ui-line-height-tight);--ui-chip-padding-block:var(--ui-space-0-5);--ui-chip-padding-inline:var(--ui-space-2);--ui-chip-notch:var(--ui-space-1);display:inline-flex;max-width:100%}:host([data-size='sm']){--ui-chip-font-size:var(--ui-font-size-sm)}.chip__surface{display:inline-flex;align-items:center;max-width:100%;padding:var(--ui-chip-padding-block) var(--ui-chip-padding-inline);border:1px solid var(--ui-chip-border);background:var(--ui-chip-surface);color:var(--ui-chip-text) !important;font-family:var(--ui-font-family-sans) !important;font-size:var(--ui-chip-font-size) !important;font-weight:var(--ui-chip-font-weight) !important;line-height:var(--ui-chip-line-height) !important;white-space:nowrap}:host([data-appearance='pill']) .chip__surface{border-radius:var(--ui-radius-round)}:host([data-appearance='tag']) .chip__surface{border:0;padding-inline-end:calc(var(--ui-chip-padding-inline) + var(--ui-chip-notch));clip-path:polygon(0 0, calc(100% - var(--ui-chip-notch)) 0, 100% 50%, calc(100% - var(--ui-chip-notch)) 100%, 0 100%)}"}},[769,"ui-chip",{appearance:[1],size:[1]}]);function n(){"undefined"!=typeof customElements&&["ui-chip"].forEach((i=>{"ui-chip"===i&&(customElements.get(c(i))||customElements.define(c(i),r))}))}export{r as U,n as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=o=>void 0!==o,i=(o,i)=>void 0===o?i:o;export{i as c,o as i}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,H as i,d as s,h as e,c as o,t as r}from"./p-Bh_1GxOD.js";import{o as h,c as n}from"./p-C-0syqXZ.js";import{d as a}from"./p-JwSoedEO.js";import{i as l,c}from"./p-BnGhGgTH.js";import{c as d}from"./p-DOulVJT7.js";const p=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.opened=s(this,"open"),this.closed=s(this,"close")}get host(){return this}for="";open;defaultOpen=!1;placement="top-start";showDelay=500;hideDelay=100;toggleOnClick=!1;pinned=!1;focused=!1;opened;closed;internalOpen=!1;overlayId=`ui-tooltip-${Math.random().toString(36).slice(2,11)}`;trigger=null;surface=null;showTimer=null;hideTimer=null;syncFromProp(){this.clearTimers(),l(this.open)&&(this.internalOpen=this.open)}resetSurface(){this.syncTrigger(),this.setupSurface(),this.syncOverlay()}syncOverlay(){this.internalOpen?(this.surface?.show(),h({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.trigger?[this.trigger]:void 0,dismissible:!0,requestClose:(t,i)=>this.handleRequestClose(t,i)})):(this.surface?.hide(),n(this.overlayId))}componentDidLoad(){this.host.id||(this.host.id=this.overlayId),this.internalOpen=c(this.open,this.defaultOpen),this.syncTrigger(),this.setupSurface(),this.host.addEventListener("pointerenter",this.onSurfaceEnter),this.host.addEventListener("pointerleave",this.onTriggerLeave),this.syncOverlay()}componentDidUpdate(){this.syncTrigger()}disconnectedCallback(){this.clearTimers(),this.detachTriggerListeners(),this.surface?.destroy(),this.surface=null,this.host.removeEventListener("pointerenter",this.onSurfaceEnter),this.host.removeEventListener("pointerleave",this.onTriggerLeave),n(this.overlayId)}syncTrigger(){const t=this.for?this.host.getRootNode().getElementById(this.for):this.host.previousElementSibling;t!==this.trigger&&(this.detachTriggerListeners(),this.trigger=t,this.attachTriggerListeners(),this.surface?.setAnchor(t))}setupSurface(){this.surface?.destroy(),this.surface=d(this.host,{anchor:this.trigger,placement:this.placement})}attachTriggerListeners(){if(this.detachTriggerListeners(),!this.trigger)return;const t=new Set((this.trigger.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean));t.add(this.host.id),this.trigger.setAttribute("aria-describedby",[...t].join(" ")),this.trigger.addEventListener("click",this.onTriggerClick),this.trigger.addEventListener("keydown",this.onTriggerKeydown),this.trigger.addEventListener("pointerenter",this.onTriggerEnter),this.trigger.addEventListener("pointerleave",this.onTriggerLeave),this.trigger.addEventListener("focusin",this.onTriggerFocusIn),this.trigger.addEventListener("focusout",this.onTriggerFocusOut)}detachTriggerListeners(){if(!this.trigger)return;const t=(this.trigger.getAttribute("aria-describedby")||"").split(/\s+/).filter((t=>t&&t!==this.host.id));t.length?this.trigger.setAttribute("aria-describedby",t.join(" ")):this.trigger.removeAttribute("aria-describedby"),this.trigger.removeEventListener("click",this.onTriggerClick),this.trigger.removeEventListener("keydown",this.onTriggerKeydown),this.trigger.removeEventListener("pointerenter",this.onTriggerEnter),this.trigger.removeEventListener("pointerleave",this.onTriggerLeave),this.trigger.removeEventListener("focusin",this.onTriggerFocusIn),this.trigger.removeEventListener("focusout",this.onTriggerFocusOut)}clearShowTimer(){null!==this.showTimer&&(clearTimeout(this.showTimer),this.showTimer=null)}clearHideTimer(){null!==this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null)}clearTimers(){this.clearShowTimer(),this.clearHideTimer()}setInteractionOpen(t,i){this.internalOpen!==t&&(l(this.open)||(this.internalOpen=t),a(this.host,t?"open":"close",{open:t,reason:"action",trigger:i}))}onSurfaceEnter=()=>this.clearHideTimer();onTriggerClick=t=>{this.toggleOnClick&&(this.clearTimers(),this.pinned=!this.pinned,this.setInteractionOpen(this.pinned,0===t.detail?"keyboard":"pointer"))};onTriggerKeydown=t=>{"Escape"===t.key&&this.clearTimers()};onTriggerEnter=t=>{"touch"!==t.pointerType&&(this.clearHideTimer(),this.internalOpen||null!==this.showTimer||(this.showTimer=setTimeout((()=>{this.showTimer=null,this.setInteractionOpen(!0,"pointer")}),Math.max(0,this.showDelay))))};onTriggerLeave=()=>{this.clearShowTimer(),this.focused||this.pinned||!this.internalOpen||null!==this.hideTimer||(this.hideTimer=setTimeout((()=>{this.hideTimer=null,this.setInteractionOpen(!1,"pointer")}),Math.max(0,this.hideDelay)))};onTriggerFocusIn=()=>{this.focused=!0,this.clearTimers(),this.setInteractionOpen(!0,"keyboard")};onTriggerFocusOut=t=>{const i=t.relatedTarget;i&&this.host.contains(i)||(this.focused=!1,this.pinned=!1,this.clearTimers(),this.setInteractionOpen(!1,"keyboard"))};handleRequestClose(t,i){("escape"===t||"light-dismiss"===t&&this.toggleOnClick)&&(this.pinned=!1,this.clearTimers(),l(this.open)||(this.internalOpen=!1),a(this.host,"close",{open:!1,reason:t,trigger:i}))}render(){return e(o,{key:"6c70f235889d6f1c425f0a51fcfc04e06a96dea4",role:"tooltip",hidden:!this.internalOpen,"data-open":this.internalOpen?"":void 0},e("div",{key:"5c4f1d264e32d308f5b26af4e967e13369c4238a",class:"tooltip__surface"},e("slot",{key:"52b5900d67ffa7590b0ff97511f99718d2e8c311"})))}static get watchers(){return{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncOverlay:0}]}}static get style(){return":host{position:fixed;inset:auto;margin:0;display:inline-block;box-sizing:border-box;padding:0;border:0;border-radius:0;background:transparent;opacity:0;transform:translateY(4px);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}.tooltip__surface{box-sizing:border-box;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background:var(--ui-surface-elevated);color:var(--ui-text-primary);padding:var(--ui-space-2) var(--ui-space-3);font-size:var(--ui-font-size-sm);box-shadow:var(--ui-shadow-md)}:host(:popover-open){opacity:1;transform:translateY(0)}@starting-style{:host(:popover-open){opacity:0;transform:translateY(4px)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host{transition:none}}"}},[769,"ui-tooltip",{for:[1],open:[4],defaultOpen:[4,"default-open"],placement:[1],showDelay:[2,"show-delay"],hideDelay:[2,"hide-delay"],toggleOnClick:[4,"toggle-on-click"],internalOpen:[32]},void 0,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncOverlay:0}]}]);function u(){"undefined"!=typeof customElements&&["ui-tooltip"].forEach((t=>{"ui-tooltip"===t&&(customElements.get(r(t))||customElements.define(r(t),p))}))}export{p as U,u as d}
|