@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
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
/** A multi-value combobox with removable, customizable selected items. */
|
|
3
|
+
export class UIMultiCombobox {
|
|
4
|
+
host;
|
|
5
|
+
label = '';
|
|
6
|
+
placeholder = '';
|
|
7
|
+
items = [];
|
|
8
|
+
config = {};
|
|
9
|
+
query;
|
|
10
|
+
defaultQuery = '';
|
|
11
|
+
disabled = false;
|
|
12
|
+
readOnly = false;
|
|
13
|
+
required = false;
|
|
14
|
+
name = '';
|
|
15
|
+
queryChange;
|
|
16
|
+
addItem;
|
|
17
|
+
removeItem;
|
|
18
|
+
createItem;
|
|
19
|
+
optionsChange;
|
|
20
|
+
raw = '';
|
|
21
|
+
rows = [];
|
|
22
|
+
combobox;
|
|
23
|
+
filteredConfig;
|
|
24
|
+
filteredConfigSource;
|
|
25
|
+
filteredSelection = '';
|
|
26
|
+
componentWillLoad() { this.raw = this.query ?? this.defaultQuery; }
|
|
27
|
+
syncQuery() {
|
|
28
|
+
if (this.query !== undefined)
|
|
29
|
+
this.raw = this.query;
|
|
30
|
+
}
|
|
31
|
+
get selectedValues() { return new Set(this.items.map(item => item.value)); }
|
|
32
|
+
get comboboxConfig() {
|
|
33
|
+
const selectionKey = this.items.map(item => item.value).join('\u0000');
|
|
34
|
+
if (this.filteredConfig && this.filteredConfigSource === this.config && this.filteredSelection === selectionKey) {
|
|
35
|
+
return this.filteredConfig;
|
|
36
|
+
}
|
|
37
|
+
const ownerFilter = this.config.filter;
|
|
38
|
+
const selected = this.selectedValues;
|
|
39
|
+
this.filteredConfigSource = this.config;
|
|
40
|
+
this.filteredSelection = selectionKey;
|
|
41
|
+
this.filteredConfig = {
|
|
42
|
+
...this.config,
|
|
43
|
+
filter: (option, query, context) => !selected.has(option.value)
|
|
44
|
+
&& (ownerFilter ? ownerFilter(option, query, context) : option.label.toLocaleLowerCase().includes(query.toLocaleLowerCase())),
|
|
45
|
+
};
|
|
46
|
+
return this.filteredConfig;
|
|
47
|
+
}
|
|
48
|
+
setQuery(query, trigger) {
|
|
49
|
+
if (this.query === undefined)
|
|
50
|
+
this.raw = query;
|
|
51
|
+
this.queryChange.emit({ query, display: query, trigger });
|
|
52
|
+
}
|
|
53
|
+
onQueryChange = (event) => {
|
|
54
|
+
event.stopPropagation();
|
|
55
|
+
this.setQuery(event.detail.query, event.detail.trigger);
|
|
56
|
+
};
|
|
57
|
+
onOptionsChange = (event) => {
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
this.rows = event.detail;
|
|
60
|
+
this.optionsChange.emit(event.detail);
|
|
61
|
+
};
|
|
62
|
+
onValueChange = (event) => {
|
|
63
|
+
event.stopPropagation();
|
|
64
|
+
if (event.detail.kind !== 'selection' || !event.detail.option)
|
|
65
|
+
return;
|
|
66
|
+
const item = event.detail.option;
|
|
67
|
+
this.addItem.emit({ item, index: this.items.length, trigger: event.detail.trigger });
|
|
68
|
+
// ui-combobox emits its selection value before the matching label query.
|
|
69
|
+
// Clear after both owner notifications so the stale label cannot win.
|
|
70
|
+
queueMicrotask(() => this.setQuery('', event.detail.trigger));
|
|
71
|
+
};
|
|
72
|
+
onCreateEntry = (event) => {
|
|
73
|
+
event.stopPropagation();
|
|
74
|
+
const query = event.detail.query.trim();
|
|
75
|
+
if (!query)
|
|
76
|
+
return;
|
|
77
|
+
this.setQuery('', event.detail.trigger);
|
|
78
|
+
this.createItem.emit({ query, trigger: event.detail.trigger });
|
|
79
|
+
};
|
|
80
|
+
remove(index, trigger) {
|
|
81
|
+
const item = this.items[index];
|
|
82
|
+
if (!item || item.disabled || this.disabled || this.readOnly)
|
|
83
|
+
return;
|
|
84
|
+
this.removeItem.emit({ item, index, trigger });
|
|
85
|
+
requestAnimationFrame(() => {
|
|
86
|
+
const buttons = this.host.shadowRoot?.querySelectorAll('[part="item"]') ?? [];
|
|
87
|
+
const next = buttons[Math.min(index, buttons.length - 1)] ?? buttons[index - 1];
|
|
88
|
+
if (next && next.dataset.value !== item.value)
|
|
89
|
+
next.focus();
|
|
90
|
+
else
|
|
91
|
+
void this.focusInput();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
focusItem(index) {
|
|
95
|
+
this.host.shadowRoot?.querySelectorAll('[part="item"]')[index]?.focus();
|
|
96
|
+
}
|
|
97
|
+
onItemKeyDown = (event, index) => {
|
|
98
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
99
|
+
return;
|
|
100
|
+
if (event.key === 'ArrowLeft') {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
event.stopPropagation();
|
|
103
|
+
this.focusItem(Math.max(0, index - 1));
|
|
104
|
+
}
|
|
105
|
+
else if (event.key === 'ArrowRight') {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
event.stopPropagation();
|
|
108
|
+
if (index === this.items.length - 1)
|
|
109
|
+
void this.focusInput();
|
|
110
|
+
else
|
|
111
|
+
this.focusItem(index + 1);
|
|
112
|
+
}
|
|
113
|
+
else if (event.key === 'Backspace' || event.key === 'Delete') {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
event.stopPropagation();
|
|
116
|
+
this.remove(index, 'keyboard');
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
onKeyDown = (event) => {
|
|
120
|
+
if (event.defaultPrevented || this.disabled || this.readOnly || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
121
|
+
return;
|
|
122
|
+
const input = event.composedPath().find(node => node instanceof HTMLInputElement);
|
|
123
|
+
if (!input || this.raw || (input.selectionStart ?? 0) > 0)
|
|
124
|
+
return;
|
|
125
|
+
if (event.key === 'ArrowLeft' && this.items.length) {
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
this.focusItem(this.items.length - 1);
|
|
128
|
+
}
|
|
129
|
+
else if (event.key === 'Backspace' && this.items.length) {
|
|
130
|
+
event.preventDefault();
|
|
131
|
+
this.remove(this.items.length - 1, 'keyboard');
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
async focusInput() { await this.combobox?.focusInput(); }
|
|
135
|
+
render() {
|
|
136
|
+
return h(Host, { key: 'bdb03a28ea25b22340dc56381fa45031f0c47c27', onKeyDown: this.onKeyDown }, h("ui-combobox", { key: '51ba1ab747af9f216223bd71f524db79ef57b8a9', ref: element => this.combobox = element, label: this.label, "label-visibility": "sr-only", placeholder: this.placeholder, name: this.name, value: null, query: this.raw, config: this.comboboxConfig, size: "sm", disabled: this.disabled, readOnly: this.readOnly, required: this.required, "onQuery-change": this.onQueryChange, "onValue-change": this.onValueChange, "onCreate-entry": this.onCreateEntry, "onOptions-change": this.onOptionsChange }, h("div", { key: 'ebd8fd8e62db3c2e47b1bfc7558c01e7e1abb8ba', slot: "start", class: "items", role: "group", "aria-label": `Selected ${this.label}` }, this.items.map((item, index) => h("button", { type: "button", part: "item", class: "item", "data-value": item.value, tabIndex: -1, disabled: this.disabled || this.readOnly || item.disabled, "aria-label": `${item.label}, press Delete or Backspace to remove`, onKeyDown: event => this.onItemKeyDown(event, index) }, h("slot", { name: `item-${item.id}` }, h("ui-chip", { appearance: "pill" }, item.label))))), this.rows.map(option => h("span", { slot: `option-${option.id}` }, h("slot", { name: `option-${option.id}` }, option.label))), h("span", { key: '99cd9848130de37e52a4f735c95e3754dbc64691', slot: "create" }, h("slot", { key: '84cc7c14716819bd968bdfcb9213fe3887a5c2b9', name: "create" }, "Create \u201C", this.raw, "\u201D")), h("span", { key: '1660eb03425dea4d36797e416d91b051531a470d', slot: "loading" }, h("slot", { key: '10c979403e89331e8bdf69ff2db3f5bc272b2685', name: "loading" }, "Loading suggestions\u2026")), h("span", { key: '1c862b6c5906aa3ec5fc874de5a5119e13ef9422', slot: "empty" }, h("slot", { key: '1c70a1beb7321d3b2be888b3826a1dba2f6fcc70', name: "empty" }, "No suggestions.")), h("span", { key: '4b4da5cb8b22543b90ff9230191bbb2e81d16408', slot: "error" }, h("slot", { key: 'a371a5ce50895562ebc6e55227e4a4834af37f3d', name: "error" }, "Unable to load suggestions.")), h("div", { key: 'f82e38165d90bdbfa8413c0a561abf7ab5da0183', slot: "footer" }, h("slot", { key: '6c0bd2b89428832f4cb485f5d2e30a792859ba9e', name: "footer" }))));
|
|
137
|
+
}
|
|
138
|
+
static get is() { return "ui-multi-combobox"; }
|
|
139
|
+
static get encapsulation() { return "shadow"; }
|
|
140
|
+
static get originalStyleUrls() {
|
|
141
|
+
return {
|
|
142
|
+
"$": ["ui-multi-combobox.css"]
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
static get styleUrls() {
|
|
146
|
+
return {
|
|
147
|
+
"$": ["ui-multi-combobox.css"]
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
static get properties() {
|
|
151
|
+
return {
|
|
152
|
+
"label": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"mutable": false,
|
|
155
|
+
"complexType": {
|
|
156
|
+
"original": "string",
|
|
157
|
+
"resolved": "string",
|
|
158
|
+
"references": {}
|
|
159
|
+
},
|
|
160
|
+
"required": false,
|
|
161
|
+
"optional": false,
|
|
162
|
+
"docs": {
|
|
163
|
+
"tags": [],
|
|
164
|
+
"text": ""
|
|
165
|
+
},
|
|
166
|
+
"getter": false,
|
|
167
|
+
"setter": false,
|
|
168
|
+
"reflect": false,
|
|
169
|
+
"attribute": "label",
|
|
170
|
+
"defaultValue": "''"
|
|
171
|
+
},
|
|
172
|
+
"placeholder": {
|
|
173
|
+
"type": "string",
|
|
174
|
+
"mutable": false,
|
|
175
|
+
"complexType": {
|
|
176
|
+
"original": "string",
|
|
177
|
+
"resolved": "string",
|
|
178
|
+
"references": {}
|
|
179
|
+
},
|
|
180
|
+
"required": false,
|
|
181
|
+
"optional": false,
|
|
182
|
+
"docs": {
|
|
183
|
+
"tags": [],
|
|
184
|
+
"text": ""
|
|
185
|
+
},
|
|
186
|
+
"getter": false,
|
|
187
|
+
"setter": false,
|
|
188
|
+
"reflect": false,
|
|
189
|
+
"attribute": "placeholder",
|
|
190
|
+
"defaultValue": "''"
|
|
191
|
+
},
|
|
192
|
+
"items": {
|
|
193
|
+
"type": "unknown",
|
|
194
|
+
"mutable": false,
|
|
195
|
+
"complexType": {
|
|
196
|
+
"original": "readonly MultiComboboxItem[]",
|
|
197
|
+
"resolved": "readonly MultiComboboxItem[]",
|
|
198
|
+
"references": {
|
|
199
|
+
"MultiComboboxItem": {
|
|
200
|
+
"location": "import",
|
|
201
|
+
"path": "../../field/multi-combobox",
|
|
202
|
+
"id": "src/field/multi-combobox.ts::MultiComboboxItem",
|
|
203
|
+
"referenceLocation": "MultiComboboxItem"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"required": false,
|
|
208
|
+
"optional": false,
|
|
209
|
+
"docs": {
|
|
210
|
+
"tags": [],
|
|
211
|
+
"text": ""
|
|
212
|
+
},
|
|
213
|
+
"getter": false,
|
|
214
|
+
"setter": false,
|
|
215
|
+
"defaultValue": "[]"
|
|
216
|
+
},
|
|
217
|
+
"config": {
|
|
218
|
+
"type": "unknown",
|
|
219
|
+
"mutable": false,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "ComboboxConfig",
|
|
222
|
+
"resolved": "ComboboxConfig",
|
|
223
|
+
"references": {
|
|
224
|
+
"ComboboxConfig": {
|
|
225
|
+
"location": "import",
|
|
226
|
+
"path": "../../field/combobox",
|
|
227
|
+
"id": "src/field/combobox.ts::ComboboxConfig",
|
|
228
|
+
"referenceLocation": "ComboboxConfig"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"required": false,
|
|
233
|
+
"optional": false,
|
|
234
|
+
"docs": {
|
|
235
|
+
"tags": [],
|
|
236
|
+
"text": ""
|
|
237
|
+
},
|
|
238
|
+
"getter": false,
|
|
239
|
+
"setter": false,
|
|
240
|
+
"defaultValue": "{}"
|
|
241
|
+
},
|
|
242
|
+
"query": {
|
|
243
|
+
"type": "string",
|
|
244
|
+
"mutable": false,
|
|
245
|
+
"complexType": {
|
|
246
|
+
"original": "string",
|
|
247
|
+
"resolved": "string",
|
|
248
|
+
"references": {}
|
|
249
|
+
},
|
|
250
|
+
"required": false,
|
|
251
|
+
"optional": true,
|
|
252
|
+
"docs": {
|
|
253
|
+
"tags": [],
|
|
254
|
+
"text": ""
|
|
255
|
+
},
|
|
256
|
+
"getter": false,
|
|
257
|
+
"setter": false,
|
|
258
|
+
"reflect": false,
|
|
259
|
+
"attribute": "query"
|
|
260
|
+
},
|
|
261
|
+
"defaultQuery": {
|
|
262
|
+
"type": "string",
|
|
263
|
+
"mutable": false,
|
|
264
|
+
"complexType": {
|
|
265
|
+
"original": "string",
|
|
266
|
+
"resolved": "string",
|
|
267
|
+
"references": {}
|
|
268
|
+
},
|
|
269
|
+
"required": false,
|
|
270
|
+
"optional": false,
|
|
271
|
+
"docs": {
|
|
272
|
+
"tags": [],
|
|
273
|
+
"text": ""
|
|
274
|
+
},
|
|
275
|
+
"getter": false,
|
|
276
|
+
"setter": false,
|
|
277
|
+
"reflect": false,
|
|
278
|
+
"attribute": "default-query",
|
|
279
|
+
"defaultValue": "''"
|
|
280
|
+
},
|
|
281
|
+
"disabled": {
|
|
282
|
+
"type": "boolean",
|
|
283
|
+
"mutable": false,
|
|
284
|
+
"complexType": {
|
|
285
|
+
"original": "boolean",
|
|
286
|
+
"resolved": "boolean",
|
|
287
|
+
"references": {}
|
|
288
|
+
},
|
|
289
|
+
"required": false,
|
|
290
|
+
"optional": false,
|
|
291
|
+
"docs": {
|
|
292
|
+
"tags": [],
|
|
293
|
+
"text": ""
|
|
294
|
+
},
|
|
295
|
+
"getter": false,
|
|
296
|
+
"setter": false,
|
|
297
|
+
"reflect": false,
|
|
298
|
+
"attribute": "disabled",
|
|
299
|
+
"defaultValue": "false"
|
|
300
|
+
},
|
|
301
|
+
"readOnly": {
|
|
302
|
+
"type": "boolean",
|
|
303
|
+
"mutable": false,
|
|
304
|
+
"complexType": {
|
|
305
|
+
"original": "boolean",
|
|
306
|
+
"resolved": "boolean",
|
|
307
|
+
"references": {}
|
|
308
|
+
},
|
|
309
|
+
"required": false,
|
|
310
|
+
"optional": false,
|
|
311
|
+
"docs": {
|
|
312
|
+
"tags": [],
|
|
313
|
+
"text": ""
|
|
314
|
+
},
|
|
315
|
+
"getter": false,
|
|
316
|
+
"setter": false,
|
|
317
|
+
"reflect": false,
|
|
318
|
+
"attribute": "readonly",
|
|
319
|
+
"defaultValue": "false"
|
|
320
|
+
},
|
|
321
|
+
"required": {
|
|
322
|
+
"type": "boolean",
|
|
323
|
+
"mutable": false,
|
|
324
|
+
"complexType": {
|
|
325
|
+
"original": "boolean",
|
|
326
|
+
"resolved": "boolean",
|
|
327
|
+
"references": {}
|
|
328
|
+
},
|
|
329
|
+
"required": false,
|
|
330
|
+
"optional": false,
|
|
331
|
+
"docs": {
|
|
332
|
+
"tags": [],
|
|
333
|
+
"text": ""
|
|
334
|
+
},
|
|
335
|
+
"getter": false,
|
|
336
|
+
"setter": false,
|
|
337
|
+
"reflect": false,
|
|
338
|
+
"attribute": "required",
|
|
339
|
+
"defaultValue": "false"
|
|
340
|
+
},
|
|
341
|
+
"name": {
|
|
342
|
+
"type": "string",
|
|
343
|
+
"mutable": false,
|
|
344
|
+
"complexType": {
|
|
345
|
+
"original": "string",
|
|
346
|
+
"resolved": "string",
|
|
347
|
+
"references": {}
|
|
348
|
+
},
|
|
349
|
+
"required": false,
|
|
350
|
+
"optional": false,
|
|
351
|
+
"docs": {
|
|
352
|
+
"tags": [],
|
|
353
|
+
"text": ""
|
|
354
|
+
},
|
|
355
|
+
"getter": false,
|
|
356
|
+
"setter": false,
|
|
357
|
+
"reflect": false,
|
|
358
|
+
"attribute": "name",
|
|
359
|
+
"defaultValue": "''"
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
static get states() {
|
|
364
|
+
return {
|
|
365
|
+
"raw": {},
|
|
366
|
+
"rows": {}
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
static get events() {
|
|
370
|
+
return [{
|
|
371
|
+
"method": "queryChange",
|
|
372
|
+
"name": "query-change",
|
|
373
|
+
"bubbles": true,
|
|
374
|
+
"cancelable": true,
|
|
375
|
+
"composed": true,
|
|
376
|
+
"docs": {
|
|
377
|
+
"tags": [],
|
|
378
|
+
"text": ""
|
|
379
|
+
},
|
|
380
|
+
"complexType": {
|
|
381
|
+
"original": "{ query: string; display: string; trigger: 'keyboard' | 'pointer' | 'programmatic' }",
|
|
382
|
+
"resolved": "{ query: string; display: string; trigger: \"keyboard\" | \"pointer\" | \"programmatic\"; }",
|
|
383
|
+
"references": {}
|
|
384
|
+
}
|
|
385
|
+
}, {
|
|
386
|
+
"method": "addItem",
|
|
387
|
+
"name": "add-item",
|
|
388
|
+
"bubbles": true,
|
|
389
|
+
"cancelable": true,
|
|
390
|
+
"composed": true,
|
|
391
|
+
"docs": {
|
|
392
|
+
"tags": [],
|
|
393
|
+
"text": ""
|
|
394
|
+
},
|
|
395
|
+
"complexType": {
|
|
396
|
+
"original": "MultiComboboxItemChange",
|
|
397
|
+
"resolved": "MultiComboboxItemChange",
|
|
398
|
+
"references": {
|
|
399
|
+
"MultiComboboxItemChange": {
|
|
400
|
+
"location": "import",
|
|
401
|
+
"path": "../../field/multi-combobox",
|
|
402
|
+
"id": "src/field/multi-combobox.ts::MultiComboboxItemChange",
|
|
403
|
+
"referenceLocation": "MultiComboboxItemChange"
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}, {
|
|
408
|
+
"method": "removeItem",
|
|
409
|
+
"name": "remove-item",
|
|
410
|
+
"bubbles": true,
|
|
411
|
+
"cancelable": true,
|
|
412
|
+
"composed": true,
|
|
413
|
+
"docs": {
|
|
414
|
+
"tags": [],
|
|
415
|
+
"text": ""
|
|
416
|
+
},
|
|
417
|
+
"complexType": {
|
|
418
|
+
"original": "MultiComboboxItemChange",
|
|
419
|
+
"resolved": "MultiComboboxItemChange",
|
|
420
|
+
"references": {
|
|
421
|
+
"MultiComboboxItemChange": {
|
|
422
|
+
"location": "import",
|
|
423
|
+
"path": "../../field/multi-combobox",
|
|
424
|
+
"id": "src/field/multi-combobox.ts::MultiComboboxItemChange",
|
|
425
|
+
"referenceLocation": "MultiComboboxItemChange"
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}, {
|
|
430
|
+
"method": "createItem",
|
|
431
|
+
"name": "create-item",
|
|
432
|
+
"bubbles": true,
|
|
433
|
+
"cancelable": true,
|
|
434
|
+
"composed": true,
|
|
435
|
+
"docs": {
|
|
436
|
+
"tags": [],
|
|
437
|
+
"text": ""
|
|
438
|
+
},
|
|
439
|
+
"complexType": {
|
|
440
|
+
"original": "MultiComboboxCreate",
|
|
441
|
+
"resolved": "MultiComboboxCreate",
|
|
442
|
+
"references": {
|
|
443
|
+
"MultiComboboxCreate": {
|
|
444
|
+
"location": "import",
|
|
445
|
+
"path": "../../field/multi-combobox",
|
|
446
|
+
"id": "src/field/multi-combobox.ts::MultiComboboxCreate",
|
|
447
|
+
"referenceLocation": "MultiComboboxCreate"
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}, {
|
|
452
|
+
"method": "optionsChange",
|
|
453
|
+
"name": "options-change",
|
|
454
|
+
"bubbles": true,
|
|
455
|
+
"cancelable": true,
|
|
456
|
+
"composed": true,
|
|
457
|
+
"docs": {
|
|
458
|
+
"tags": [],
|
|
459
|
+
"text": ""
|
|
460
|
+
},
|
|
461
|
+
"complexType": {
|
|
462
|
+
"original": "readonly ComboboxOption[]",
|
|
463
|
+
"resolved": "readonly ComboboxOption<unknown>[]",
|
|
464
|
+
"references": {
|
|
465
|
+
"ComboboxOption": {
|
|
466
|
+
"location": "import",
|
|
467
|
+
"path": "../../field/combobox",
|
|
468
|
+
"id": "src/field/combobox.ts::ComboboxOption",
|
|
469
|
+
"referenceLocation": "ComboboxOption"
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}];
|
|
474
|
+
}
|
|
475
|
+
static get methods() {
|
|
476
|
+
return {
|
|
477
|
+
"focusInput": {
|
|
478
|
+
"complexType": {
|
|
479
|
+
"signature": "() => Promise<void>",
|
|
480
|
+
"parameters": [],
|
|
481
|
+
"references": {
|
|
482
|
+
"Promise": {
|
|
483
|
+
"location": "global",
|
|
484
|
+
"id": "global::Promise"
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
"return": "Promise<void>"
|
|
488
|
+
},
|
|
489
|
+
"docs": {
|
|
490
|
+
"text": "",
|
|
491
|
+
"tags": []
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
static get elementRef() { return "host"; }
|
|
497
|
+
static get watchers() {
|
|
498
|
+
return [{
|
|
499
|
+
"propName": "query",
|
|
500
|
+
"methodName": "syncQuery"
|
|
501
|
+
}];
|
|
502
|
+
}
|
|
503
|
+
}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
--ui-popover-viewport-gap: var(--ui-space-2, 0.5rem);
|
|
3
|
-
|
|
4
|
-
background: var(--ui-surface-elevated);
|
|
5
|
-
border: 1px solid var(--ui-border-default);
|
|
6
|
-
border-radius: var(--ui-radius-3);
|
|
7
|
-
box-shadow: var(--ui-shadow-lg);
|
|
3
|
+
box-sizing: border-box;
|
|
8
4
|
max-inline-size: min(
|
|
9
5
|
20rem,
|
|
10
6
|
calc(100vw - (var(--ui-popover-viewport-gap) * 2))
|
|
11
7
|
);
|
|
12
8
|
max-block-size: calc(100dvh - (var(--ui-popover-viewport-gap) * 2));
|
|
13
9
|
overflow: auto;
|
|
10
|
+
padding: 0;
|
|
11
|
+
border: 0;
|
|
12
|
+
border-radius: 0;
|
|
13
|
+
background: transparent;
|
|
14
|
+
box-shadow: var(--ui-shadow-lg);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.popover__surface {
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
padding: var(--ui-space-3);
|
|
20
|
+
background: var(--ui-surface-elevated);
|
|
21
|
+
border: 1px solid var(--ui-border-default);
|
|
22
|
+
border-radius: var(--ui-radius-3);
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
:host(:not([data-open])) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { openOverlay, closeOverlay, requestTopOverlayClose } from "../../overlay/manager";
|
|
3
3
|
import { dispatchDetail } from "../../utils/events";
|
|
4
|
+
import { controlledOrDefault, isControlled } from "../../utils/controlled-state";
|
|
4
5
|
import { createAnchoredSurface, } from "../../overlay/positioning";
|
|
5
6
|
export class UIPopover {
|
|
6
7
|
host;
|
|
7
|
-
open
|
|
8
|
+
/** Controlled open state. Omit it to use defaultOpen and local interaction state. */
|
|
9
|
+
open;
|
|
8
10
|
defaultOpen = false;
|
|
9
11
|
/** Optional id of the element this popover follows in the top layer. */
|
|
10
12
|
for;
|
|
@@ -14,7 +16,8 @@ export class UIPopover {
|
|
|
14
16
|
anchor = null;
|
|
15
17
|
surface = null;
|
|
16
18
|
syncFromProp() {
|
|
17
|
-
|
|
19
|
+
if (isControlled(this.open))
|
|
20
|
+
this.internalOpen = this.open;
|
|
18
21
|
}
|
|
19
22
|
onOpenChange() {
|
|
20
23
|
this.syncOverlay();
|
|
@@ -73,8 +76,7 @@ export class UIPopover {
|
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
78
|
componentDidLoad() {
|
|
76
|
-
this.
|
|
77
|
-
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
79
|
+
this.internalOpen = controlledOrDefault(this.open, this.defaultOpen);
|
|
78
80
|
this.host.addEventListener('keydown', this.onKeydown);
|
|
79
81
|
this.setupSurface();
|
|
80
82
|
this.syncOverlay();
|
|
@@ -89,7 +91,8 @@ export class UIPopover {
|
|
|
89
91
|
this.syncOverlay();
|
|
90
92
|
}
|
|
91
93
|
handleRequestClose(reason, trigger) {
|
|
92
|
-
this.
|
|
94
|
+
if (!isControlled(this.open))
|
|
95
|
+
this.internalOpen = false;
|
|
93
96
|
dispatchDetail(this.host, 'close', {
|
|
94
97
|
open: false,
|
|
95
98
|
reason: reason,
|
|
@@ -102,7 +105,7 @@ export class UIPopover {
|
|
|
102
105
|
}
|
|
103
106
|
};
|
|
104
107
|
render() {
|
|
105
|
-
return (h(Host, { key: '
|
|
108
|
+
return (h(Host, { key: 'a4986ace0f3c586774a549cb844287b28ccd0531', "data-open": this.internalOpen ? '' : undefined, onKeyDown: this.onKeydown }, h("div", { key: '8f2c589916d06138ef72bfe0d039893b3c59a7cc', class: "popover__surface" }, h("slot", { key: 'ee70e7dcc53a99b5c80e56862a6eb00edcfcf912' }))));
|
|
106
109
|
}
|
|
107
110
|
static get is() { return "ui-popover"; }
|
|
108
111
|
static get encapsulation() { return "shadow"; }
|
|
@@ -127,16 +130,15 @@ export class UIPopover {
|
|
|
127
130
|
"references": {}
|
|
128
131
|
},
|
|
129
132
|
"required": false,
|
|
130
|
-
"optional":
|
|
133
|
+
"optional": true,
|
|
131
134
|
"docs": {
|
|
132
135
|
"tags": [],
|
|
133
|
-
"text": ""
|
|
136
|
+
"text": "Controlled open state. Omit it to use defaultOpen and local interaction state."
|
|
134
137
|
},
|
|
135
138
|
"getter": false,
|
|
136
139
|
"setter": false,
|
|
137
140
|
"reflect": false,
|
|
138
|
-
"attribute": "open"
|
|
139
|
-
"defaultValue": "false"
|
|
141
|
+
"attribute": "open"
|
|
140
142
|
},
|
|
141
143
|
"defaultOpen": {
|
|
142
144
|
"type": "boolean",
|