@threadlabs/looma 0.1.23 → 0.1.24
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-GDMQKT5F.js → chunk-IMHSPETJ.js} +32 -30
- package/dist/chunk-NB6DBRXQ.js +323 -0
- 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-chip.cjs.entry.js +19 -0
- package/dist/cjs/ui-combobox.cjs.entry.js +3 -3
- 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-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-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 +2 -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 +43 -0
- package/dist/collection/components/ui-chip/ui-chip.js +45 -0
- package/dist/collection/components/ui-combobox/ui-combobox.js +3 -3
- 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-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-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/icons.js +6 -1
- package/dist/collection/utils/controlled-state.js +4 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-Bk55QiUK.js +1 -0
- package/dist/components/p-BnGhGgTH.js +1 -0
- package/dist/components/p-CoFximGM.js +13 -0
- package/dist/components/p-DIGcRYAW.js +1 -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-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-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-chip.entry.js +17 -0
- package/dist/esm/ui-combobox.entry.js +3 -3
- 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-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-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 +1224 -842
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +12 -2
- package/dist/looma/looma.esm.js +1 -1
- package/dist/looma/p-03f44c45.entry.js +1 -0
- package/dist/looma/p-08f80207.entry.js +1 -0
- package/dist/looma/{p-f74e5546.entry.js → p-13f8195a.entry.js} +1 -1
- package/dist/looma/{p-5a87b59d.entry.js → p-25e18ad6.entry.js} +1 -1
- package/dist/looma/p-2c03fa73.entry.js +1 -0
- package/dist/looma/{p-ed368426.entry.js → p-314d5c7c.entry.js} +1 -1
- package/dist/looma/{p-5da09f47.entry.js → p-3ef2a21b.entry.js} +1 -1
- package/dist/looma/{p-f0487ff3.entry.js → p-5a900d89.entry.js} +1 -1
- package/dist/looma/p-5fdcee1d.entry.js +1 -0
- package/dist/looma/{p-13347631.entry.js → p-672e3d16.entry.js} +1 -1
- package/dist/looma/{p-582973b5.entry.js → p-68430534.entry.js} +1 -1
- package/dist/looma/{p-add36e74.entry.js → p-72338f53.entry.js} +1 -1
- package/dist/looma/{p-a90d2821.entry.js → p-7ab661ec.entry.js} +1 -1
- package/dist/looma/p-7c4a225f.entry.js +1 -0
- package/dist/looma/p-82f2fa3d.entry.js +1 -0
- package/dist/looma/p-839faf55.entry.js +1 -0
- package/dist/looma/{p-7e0bb7f6.entry.js → p-8e254bc4.entry.js} +1 -1
- package/dist/looma/p-8e6b1001.entry.js +1 -0
- package/dist/looma/p-920656cf.entry.js +1 -0
- package/dist/looma/{p-40fe7fee.entry.js → p-97e8cb0e.entry.js} +1 -1
- package/dist/looma/p-9d2662ca.entry.js +1 -0
- package/dist/looma/p-9e1c4020.entry.js +1 -0
- package/dist/looma/p-BnGhGgTH.js +1 -0
- package/dist/looma/p-CoFximGM.js +13 -0
- package/dist/looma/{p-8b8840b8.entry.js → p-a63e2561.entry.js} +1 -1
- package/dist/looma/p-add67e4c.entry.js +1 -0
- package/dist/looma/p-b63f6d4f.entry.js +1 -0
- package/dist/looma/p-bd00d4e8.entry.js +1 -0
- package/dist/looma/p-cc915913.entry.js +1 -0
- package/dist/looma/p-cfba8f7c.entry.js +1 -0
- package/dist/looma/p-d56571a2.entry.js +1 -0
- package/dist/looma/{p-69a5557b.entry.js → p-e0f241ab.entry.js} +1 -1
- package/dist/looma/p-f1750fd7.entry.js +1 -0
- package/dist/looma/p-fd1e4d22.entry.js +1 -0
- 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 +6 -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-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-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 +110 -47
- 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-3TUZ6GLW.js} +2 -2
- package/dist/ui-avatar-group.entry-XGJKN25W.js +51 -0
- package/dist/{ui-avatar.entry-T6FU6ZYM.js → ui-avatar.entry-SN3G44HW.js} +3 -3
- package/dist/ui-badge.entry-B6WDCWJX.js +22 -0
- package/dist/{ui-button.entry-7UXMUGHN.js → ui-button.entry-AZYUELLV.js} +2 -2
- package/dist/ui-callout.entry-QRPWRMPC.js +32 -0
- package/dist/{ui-checkbox.entry-DMZJB3RE.js → ui-checkbox.entry-OB6GFC4M.js} +17 -8
- package/dist/ui-chip.entry-XSNPJXX3.js +22 -0
- package/dist/{ui-combobox.entry-ZCTPXEES.js → ui-combobox.entry-IIMMUJF7.js} +5 -5
- package/dist/{ui-context-menu.entry-2WMCBGCP.js → ui-context-menu.entry-AIULIE5Y.js} +5 -5
- package/dist/{ui-dialog.entry-WO23XOSW.js → ui-dialog.entry-QSYWYHLY.js} +50 -12
- package/dist/{ui-disclosure.entry-USX7OUEW.js → ui-disclosure.entry-3BJEYU3U.js} +13 -7
- package/dist/{ui-floating-action-button.entry-MXDIN7MV.js → ui-floating-action-button.entry-JEVNV6FI.js} +2 -2
- package/dist/ui-form-field.entry-PKSY7UU4.js +120 -0
- package/dist/{ui-icon-button.entry-MJUNXHBU.js → ui-icon-button.entry-TPX7BE7R.js} +2 -2
- package/dist/{ui-input.entry-AWG63YIG.js → ui-input.entry-6NCLNW4E.js} +2 -2
- package/dist/ui-menu-item.entry-KA2K3PKV.js +22 -0
- package/dist/{ui-menu.entry-IT3GW5TL.js → ui-menu.entry-7GDO5L2T.js} +22 -14
- package/dist/{ui-popover.entry-ZQQB4N6E.js → ui-popover.entry-FR6YRNK6.js} +17 -11
- package/dist/{ui-radio-group.entry-V7PCTS7I.js → ui-radio-group.entry-7QHXQSNO.js} +2 -2
- package/dist/{ui-radio.entry-JYH6TQBI.js → ui-radio.entry-YNMXKLDW.js} +20 -8
- package/dist/{ui-search-result-row.entry-JBNYXXUN.js → ui-search-result-row.entry-AHVVAAIO.js} +2 -2
- package/dist/{ui-search-shell.entry-TEAWE76O.js → ui-search-shell.entry-CNBEAMEZ.js} +2 -2
- package/dist/{ui-select.entry-F3A6TE2U.js → ui-select.entry-TUY6TCTC.js} +2 -2
- package/dist/{ui-switch.entry-MJIICMP2.js → ui-switch.entry-26LFI7B5.js} +23 -11
- package/dist/{ui-tabs.entry-6REFIUHV.js → ui-tabs.entry-LXB62RJJ.js} +14 -10
- package/dist/{ui-textarea.entry-OJTXCED7.js → ui-textarea.entry-JYGMGPX2.js} +2 -2
- package/dist/{ui-toast-region.entry-NOFXLKPS.js → ui-toast-region.entry-TOW4KZLZ.js} +32 -23
- package/dist/{ui-tooltip.entry-COWTWVHX.js → ui-tooltip.entry-SKFNYXPH.js} +19 -12
- package/dist/{ui-top-bar.entry-PIAWXJNV.js → ui-top-bar.entry-S3YP52EA.js} +2 -2
- package/dist/ui-tree-item.entry-LWYIPYLC.js +145 -0
- package/dist/{ui-tree.entry-XYI3ZFAZ.js → ui-tree.entry-LXKUQFRU.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-D4AJULDE.js} +28 -16
- package/vue/editor/index.d.ts +5 -15
- package/vue/editor/index.js +1 -1
- package/vue/index.d.ts +325 -115
- package/vue/index.js +5 -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-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
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { eventToTrigger, dispatchDetail } from "../../utils/events";
|
|
3
|
+
import { controlledOrDefault, isControlled } from "../../utils/controlled-state";
|
|
3
4
|
export class UICheckbox {
|
|
4
5
|
host;
|
|
5
|
-
checked
|
|
6
|
+
/** Controlled checked state. Omit it to use defaultChecked and local interaction state. */
|
|
7
|
+
checked;
|
|
6
8
|
defaultChecked = false;
|
|
7
9
|
disabled = false;
|
|
8
10
|
indeterminate = false;
|
|
@@ -11,7 +13,8 @@ export class UICheckbox {
|
|
|
11
13
|
internalChecked = false;
|
|
12
14
|
slotRef;
|
|
13
15
|
syncFromProp() {
|
|
14
|
-
|
|
16
|
+
if (isControlled(this.checked))
|
|
17
|
+
this.internalChecked = this.checked;
|
|
15
18
|
}
|
|
16
19
|
syncToInput() {
|
|
17
20
|
const input = this.getInput();
|
|
@@ -26,8 +29,7 @@ export class UICheckbox {
|
|
|
26
29
|
input.value = this.value;
|
|
27
30
|
}
|
|
28
31
|
componentDidLoad() {
|
|
29
|
-
this.
|
|
30
|
-
this.internalChecked = this.internalChecked || this.defaultChecked;
|
|
32
|
+
this.internalChecked = controlledOrDefault(this.checked, this.defaultChecked);
|
|
31
33
|
this.slotRef?.addEventListener('slotchange', () => this.syncToInput());
|
|
32
34
|
this.syncToInput();
|
|
33
35
|
const input = this.getInput();
|
|
@@ -49,16 +51,20 @@ export class UICheckbox {
|
|
|
49
51
|
const input = e.target;
|
|
50
52
|
if (!input)
|
|
51
53
|
return;
|
|
52
|
-
|
|
54
|
+
const checked = input.checked;
|
|
55
|
+
if (!isControlled(this.checked))
|
|
56
|
+
this.internalChecked = checked;
|
|
57
|
+
else
|
|
58
|
+
this.syncToInput();
|
|
53
59
|
this.indeterminate = input.indeterminate;
|
|
54
60
|
dispatchDetail(this.host, 'change', {
|
|
55
|
-
checked
|
|
61
|
+
checked,
|
|
56
62
|
value: this.value,
|
|
57
63
|
trigger: eventToTrigger(e),
|
|
58
64
|
});
|
|
59
65
|
};
|
|
60
66
|
render() {
|
|
61
|
-
return (h(Host, { key: '
|
|
67
|
+
return (h(Host, { key: 'eb46eb41a5ab871058960bd2aa1163a03144bc0f', role: "checkbox", "aria-checked": this.indeterminate ? 'mixed' : String(this.internalChecked), "aria-disabled": String(this.disabled), "data-disabled": this.disabled ? '' : undefined }, h("slot", { key: 'ce18b1f1b63efebf048cd67b87064641cf4d915c', ref: (el) => (this.slotRef = el) })));
|
|
62
68
|
}
|
|
63
69
|
static get is() { return "ui-checkbox"; }
|
|
64
70
|
static get encapsulation() { return "shadow"; }
|
|
@@ -83,16 +89,15 @@ export class UICheckbox {
|
|
|
83
89
|
"references": {}
|
|
84
90
|
},
|
|
85
91
|
"required": false,
|
|
86
|
-
"optional":
|
|
92
|
+
"optional": true,
|
|
87
93
|
"docs": {
|
|
88
94
|
"tags": [],
|
|
89
|
-
"text": ""
|
|
95
|
+
"text": "Controlled checked state. Omit it to use defaultChecked and local interaction state."
|
|
90
96
|
},
|
|
91
97
|
"getter": false,
|
|
92
98
|
"setter": false,
|
|
93
99
|
"reflect": false,
|
|
94
|
-
"attribute": "checked"
|
|
95
|
-
"defaultValue": "false"
|
|
100
|
+
"attribute": "checked"
|
|
96
101
|
},
|
|
97
102
|
"defaultChecked": {
|
|
98
103
|
"type": "boolean",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--ui-chip-surface: var(--ui-surface-subtle);
|
|
3
|
+
--ui-chip-text: var(--ui-text-secondary);
|
|
4
|
+
--ui-chip-border: var(--ui-border-default);
|
|
5
|
+
--ui-chip-font-size: var(--ui-font-size-xs);
|
|
6
|
+
--ui-chip-font-weight: var(--ui-font-normal);
|
|
7
|
+
--ui-chip-line-height: var(--ui-line-height-tight);
|
|
8
|
+
--ui-chip-padding-block: var(--ui-space-0-5);
|
|
9
|
+
--ui-chip-padding-inline: var(--ui-space-2);
|
|
10
|
+
--ui-chip-notch: var(--ui-space-1);
|
|
11
|
+
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
max-width: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.chip__surface {
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
max-width: 100%;
|
|
20
|
+
padding: var(--ui-chip-padding-block) var(--ui-chip-padding-inline);
|
|
21
|
+
border: 1px solid var(--ui-chip-border);
|
|
22
|
+
background: var(--ui-chip-surface);
|
|
23
|
+
/* The shared light-DOM reset establishes a baseline host color; the chip's
|
|
24
|
+
semantic text hook must remain authoritative for consumer color systems. */
|
|
25
|
+
color: var(--ui-chip-text) !important;
|
|
26
|
+
/* The shared light-DOM reset establishes inherited defaults; this compact
|
|
27
|
+
metadata primitive owns its own typography contract. */
|
|
28
|
+
font-family: var(--ui-font-family-sans) !important;
|
|
29
|
+
font-size: var(--ui-chip-font-size) !important;
|
|
30
|
+
font-weight: var(--ui-chip-font-weight) !important;
|
|
31
|
+
line-height: var(--ui-chip-line-height) !important;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([data-appearance='pill']) .chip__surface {
|
|
36
|
+
border-radius: var(--ui-radius-round);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([data-appearance='tag']) .chip__surface {
|
|
40
|
+
border: 0;
|
|
41
|
+
padding-inline-end: calc(var(--ui-chip-padding-inline) + var(--ui-chip-notch));
|
|
42
|
+
clip-path: polygon(0 0, calc(100% - var(--ui-chip-notch)) 0, 100% 50%, calc(100% - var(--ui-chip-notch)) 100%, 0 100%);
|
|
43
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
/** A compact, non-interactive metadata label. */
|
|
3
|
+
export class UIChip {
|
|
4
|
+
/** `tag` has a square leading edge and an angled trailing edge; `pill` is fully rounded. */
|
|
5
|
+
appearance = 'tag';
|
|
6
|
+
render() {
|
|
7
|
+
return (h(Host, { key: 'fe1246a1e698098f0ca9cb04e749d5adf233e50c', "data-appearance": this.appearance }, h("span", { key: 'a17237699b9eb20fb0a084adbd900a3aa9bc12b0', class: "chip__surface" }, h("slot", { key: '7f4e5dcc82d360083d4ded2617fa39a9dc1fd3ef' }))));
|
|
8
|
+
}
|
|
9
|
+
static get is() { return "ui-chip"; }
|
|
10
|
+
static get encapsulation() { return "shadow"; }
|
|
11
|
+
static get originalStyleUrls() {
|
|
12
|
+
return {
|
|
13
|
+
"$": ["ui-chip.css"]
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
static get styleUrls() {
|
|
17
|
+
return {
|
|
18
|
+
"$": ["ui-chip.css"]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
static get properties() {
|
|
22
|
+
return {
|
|
23
|
+
"appearance": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"mutable": false,
|
|
26
|
+
"complexType": {
|
|
27
|
+
"original": "'tag' | 'pill'",
|
|
28
|
+
"resolved": "\"pill\" | \"tag\"",
|
|
29
|
+
"references": {}
|
|
30
|
+
},
|
|
31
|
+
"required": false,
|
|
32
|
+
"optional": false,
|
|
33
|
+
"docs": {
|
|
34
|
+
"tags": [],
|
|
35
|
+
"text": "`tag` has a square leading edge and an angled trailing edge; `pill` is fully rounded."
|
|
36
|
+
},
|
|
37
|
+
"getter": false,
|
|
38
|
+
"setter": false,
|
|
39
|
+
"reflect": false,
|
|
40
|
+
"attribute": "appearance",
|
|
41
|
+
"defaultValue": "'tag'"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -432,15 +432,15 @@ export class UICombobox {
|
|
|
432
432
|
const description = [this.helpOpen ? 'help-text' : '', this.validation.issues.length ? 'validation' : ''].filter(Boolean).join(' ') || undefined;
|
|
433
433
|
const status = this.loading ? 'Loading suggestions…' : this.lookupError || (this.expanded ? `${this.rows.length} suggestions available.` : '');
|
|
434
434
|
const groups = [...new Set(this.rows.map(row => row.group ?? ''))];
|
|
435
|
-
return h(Host, { key: '
|
|
435
|
+
return h(Host, { key: 'b485462943bef9e5cb0a4b42f82888024132ab3a', "data-size": this.size, "data-validation": this.validation.status, onFocusout: this.onFocusOut }, h("label", { key: '99db32d80b0a250ff4ebea8481dda94be53df2eb', htmlFor: "input", part: "label" }, this.label, this.required ? ' *' : ''), h("div", { key: '922adddf41c07215d3ec73947e8e3fe801c7ef89', class: "field", part: "field", ref: element => this.field = element }, h("input", { key: '557780297c5afee8112a5085984c5dd4ea1a02be', id: "input", ref: element => this.input = element, role: "combobox", "aria-autocomplete": "list", "aria-expanded": String(this.expanded), "aria-controls": "listbox", "aria-activedescendant": this.expanded && this.active >= 0 ? `option-${this.active}` : undefined, "aria-describedby": description, "aria-invalid": String(this.validation.status === 'error'), "aria-busy": String(this.validation.status === 'pending'), value: this.display, placeholder: this.placeholder, name: this.name || undefined, disabled: this.disabled, readOnly: this.readOnly, required: this.required, autoComplete: "off", part: "input", onInput: this.onInput, onKeyDown: this.onKeydown, onCompositionstart: () => this.composing = true, onCompositionend: () => { this.composing = false; this.onInput(new InputEvent('input')); } }), this.clearable && h("button", { key: 'ab180bacc7f5232eb517b7fed9bee0d62a4b1156', 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(); } }, "\u00D7"), this.help && h("button", { key: 'b4ea9b44c9e22eb9ac259fb67b86368eede2b13f', id: "help", type: "button", part: "affordance", "aria-label": `Help for ${this.label}`, disabled: this.disabled }, h("span", { key: '36222d7a98a4f6abb12f785e9b4f28c2479a4e37', "aria-hidden": "true" }, "?")), this.disclosure && h("button", { key: '1d8757b7c817575b6915d0e8c164e20776df83e5', type: "button", part: "affordance", "aria-label": `Suggestions for ${this.label}`, "aria-controls": "listbox", "aria-expanded": String(this.expanded), disabled: this.disabled || this.readOnly, onClick: () => {
|
|
436
436
|
if (this.expanded)
|
|
437
437
|
this.close();
|
|
438
438
|
else
|
|
439
439
|
this.open('disclosure');
|
|
440
440
|
this.input?.focus();
|
|
441
|
-
} }, h("span", { key: '
|
|
441
|
+
} }, h("span", { key: 'cd2dad7694dc24104521a58d4182d6e866f54095', "aria-hidden": "true" }, "\u2304"))), this.help && h("ui-tooltip", { key: '5e0eecd828a0e82d94b0be5b5f3233cddca4a87b', id: "help-text", for: "help", toggleOnClick: true, onOpen: () => this.helpOpen = true, onClose: () => this.helpOpen = false }, this.help), h("div", { key: '694902d8c8f58664838a943e0e2c14c856be9a08', class: "popup", part: "popup", hidden: !this.expanded, ref: element => this.popup = element }, h("div", { key: '81b18e296151afde18c47492aa997bdd13d553bc', id: "listbox", role: "listbox", "aria-label": `${this.label} suggestions`, "aria-busy": String(this.loading) }, groups.map(group => h("div", { role: group ? 'group' : 'presentation', "aria-label": group || undefined }, group && h("div", { class: "group", part: "group" }, group), this.rows.map((row, index) => (row.group ?? '') !== group ? null : h("div", { id: `option-${index}`, role: "option", "aria-selected": String(this.selected === row.value), "aria-disabled": String(Boolean(row.disabled)), "data-active": this.active === index ? '' : undefined, part: "option", class: "option", onPointerDown: event => event.preventDefault(), onClick: () => this.choose(index, 'pointer') }, h("slot", { name: `option-${row.id}` }, h("span", { class: "primary", part: "option-primary" }, row.label), row.description && h("span", { class: "secondary", part: "option-secondary" }, row.description)))))), this.canCreate && h("div", { key: 'dbf87523b5c6f17aedf15295d9703557f2d31524', id: `option-${this.rows.length}`, role: "option", "aria-selected": "false", class: "option", part: "option", "data-active": this.active === this.rows.length ? '' : undefined, onPointerDown: event => event.preventDefault(), onClick: () => this.choose(this.rows.length, 'pointer') }, h("slot", { key: 'bd4bdd2b132de7f72c1e5450fb0c0d16254aeedb', name: "create" }, "Create \u201C", this.raw, "\u201D"))), this.loading ? h("div", { class: "message" }, h("slot", { name: "loading" }, "Loading suggestions\u2026"))
|
|
442
442
|
: this.lookupError ? h("div", { class: "message" }, h("slot", { name: "error" }, this.lookupError))
|
|
443
|
-
: !this.rows.length && !this.canCreate ? h("div", { class: "message" }, h("slot", { name: "empty" }, "No suggestions.")) : null), h("div", { key: '
|
|
443
|
+
: !this.rows.length && !this.canCreate ? h("div", { class: "message" }, h("slot", { name: "empty" }, "No suggestions.")) : null), h("div", { key: '0d39fb1acb6d65307fabc3f502785a19710dc4af', id: "validation", class: "message", part: "validation", hidden: !this.validation.issues.length }, this.validation.issues.map(issue => h("div", null, issue.message))), h("div", { key: 'a83334d72b90ca0f411e6161a8bf5e2e8c2e33a8', class: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true" }, status, " ", this.validation.status === 'pending' ? 'Checking value…' : this.validation.issues.map(issue => issue.message).join(' ')));
|
|
444
444
|
}
|
|
445
445
|
static get is() { return "ui-combobox"; }
|
|
446
446
|
static get encapsulation() { return "shadow"; }
|
|
@@ -212,7 +212,7 @@ export class UIContextMenu {
|
|
|
212
212
|
this.closeMenu('action', 'pointer');
|
|
213
213
|
};
|
|
214
214
|
render() {
|
|
215
|
-
return (h(Host, { key: '
|
|
215
|
+
return (h(Host, { key: '5d927f41a72e680ad6d6d4a3fa0c913360cb8660', "data-open": this.internalOpen ? '' : undefined, "data-focus-trigger": this.internalOpen ? this.focusTrigger : undefined, onKeyDown: this.onKeydown, onClick: this.onItemClick }, h("slot", { key: 'e5b1ec05d96093671fb839e3b81ddefb730575e1', name: "trigger" }), h("div", { key: 'a0c4a8ca50bcca2b7d3ee53b4c26db054af93151', class: "menu", "data-open": this.internalOpen ? '' : undefined }, h("ui-menu", { key: 'ac03b9dc3fa56d0cbb28115060726de4500a668b', open: this.internalOpen }, h("slot", { key: 'f2d8484cb9fb3956a3a5979795633a74d423577d' })))));
|
|
216
216
|
}
|
|
217
217
|
static get is() { return "ui-context-menu"; }
|
|
218
218
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,19 +1,30 @@
|
|
|
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
|
export class UIDialog {
|
|
5
6
|
host;
|
|
6
|
-
open
|
|
7
|
+
/** Controlled open state. Omit it to use defaultOpen and local interaction state. */
|
|
8
|
+
open;
|
|
7
9
|
defaultOpen = false;
|
|
8
10
|
modal = true;
|
|
9
11
|
dismissible = true;
|
|
10
12
|
/** Accessible name forwarded to the native dialog surface. */
|
|
11
13
|
label;
|
|
12
14
|
internalOpen = false;
|
|
15
|
+
accessibleLabel = 'Dialog';
|
|
13
16
|
overlayId = `ui-dialog-${Math.random().toString(36).slice(2, 11)}`;
|
|
14
17
|
dialogRef;
|
|
18
|
+
contentObserver = null;
|
|
15
19
|
syncFromProp() {
|
|
16
|
-
|
|
20
|
+
if (isControlled(this.open))
|
|
21
|
+
this.internalOpen = this.open;
|
|
22
|
+
}
|
|
23
|
+
syncLabelFromProp() {
|
|
24
|
+
this.syncAccessibleLabel();
|
|
25
|
+
}
|
|
26
|
+
componentWillLoad() {
|
|
27
|
+
this.syncAccessibleLabel();
|
|
17
28
|
}
|
|
18
29
|
syncOpen() {
|
|
19
30
|
if (this.dialogRef) {
|
|
@@ -34,20 +45,29 @@ export class UIDialog {
|
|
|
34
45
|
}
|
|
35
46
|
}
|
|
36
47
|
componentDidLoad() {
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
48
|
+
this.contentObserver = new MutationObserver(this.syncAccessibleLabel);
|
|
49
|
+
this.contentObserver.observe(this.host, {
|
|
50
|
+
childList: true,
|
|
51
|
+
subtree: true,
|
|
52
|
+
characterData: true,
|
|
53
|
+
});
|
|
54
|
+
this.internalOpen = controlledOrDefault(this.open, this.defaultOpen);
|
|
39
55
|
this.dialogRef?.addEventListener('close', this.onDialogClose);
|
|
56
|
+
this.syncAccessibleLabel();
|
|
40
57
|
this.syncOpen();
|
|
41
58
|
}
|
|
42
59
|
disconnectedCallback() {
|
|
43
60
|
this.dialogRef?.removeEventListener('close', this.onDialogClose);
|
|
61
|
+
this.contentObserver?.disconnect();
|
|
62
|
+
this.contentObserver = null;
|
|
44
63
|
closeOverlay(this.overlayId);
|
|
45
64
|
}
|
|
46
65
|
componentDidUpdate() {
|
|
47
66
|
this.syncOpen();
|
|
48
67
|
}
|
|
49
68
|
handleRequestClose(reason, trigger) {
|
|
50
|
-
this.
|
|
69
|
+
if (!isControlled(this.open))
|
|
70
|
+
this.internalOpen = false;
|
|
51
71
|
dispatchDetail(this.host, 'close', {
|
|
52
72
|
open: false,
|
|
53
73
|
reason: reason,
|
|
@@ -56,8 +76,13 @@ export class UIDialog {
|
|
|
56
76
|
}
|
|
57
77
|
onDialogClose = () => {
|
|
58
78
|
if (this.internalOpen) {
|
|
59
|
-
this.
|
|
60
|
-
|
|
79
|
+
if (!isControlled(this.open)) {
|
|
80
|
+
this.internalOpen = false;
|
|
81
|
+
closeOverlay(this.overlayId);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
requestAnimationFrame(() => this.syncOpen());
|
|
85
|
+
}
|
|
61
86
|
dispatchDetail(this.host, 'close', {
|
|
62
87
|
open: false,
|
|
63
88
|
reason: 'programmatic',
|
|
@@ -70,8 +95,16 @@ export class UIDialog {
|
|
|
70
95
|
requestTopOverlayClose('escape', 'keyboard');
|
|
71
96
|
}
|
|
72
97
|
};
|
|
98
|
+
syncAccessibleLabel = () => {
|
|
99
|
+
const explicitLabel = this.label?.trim();
|
|
100
|
+
const heading = this.host.querySelector('[slot="heading"], [data-ui-dialog-title], h1, h2, h3, h4, h5, h6');
|
|
101
|
+
const headingLabel = heading?.textContent?.trim();
|
|
102
|
+
const nextLabel = explicitLabel || headingLabel || 'Dialog';
|
|
103
|
+
if (this.accessibleLabel !== nextLabel)
|
|
104
|
+
this.accessibleLabel = nextLabel;
|
|
105
|
+
};
|
|
73
106
|
render() {
|
|
74
|
-
return (h(Host, { key: '
|
|
107
|
+
return (h(Host, { key: 'b7aa33e24a74527a58718b3fa2218f5a09e9e439', "data-open": this.internalOpen ? '' : undefined, onKeyDown: this.onKeydown }, h("dialog", { key: 'f24455edc404581b5040c9c0090bf64141f9e296', ref: (el) => (this.dialogRef = el), open: this.internalOpen, "aria-label": this.accessibleLabel }, h("slot", { key: 'bad318e44b9c80dc0aae04ea5cdbb7b2ab472c35' }))));
|
|
75
108
|
}
|
|
76
109
|
static get is() { return "ui-dialog"; }
|
|
77
110
|
static get encapsulation() { return "shadow"; }
|
|
@@ -96,16 +129,15 @@ export class UIDialog {
|
|
|
96
129
|
"references": {}
|
|
97
130
|
},
|
|
98
131
|
"required": false,
|
|
99
|
-
"optional":
|
|
132
|
+
"optional": true,
|
|
100
133
|
"docs": {
|
|
101
134
|
"tags": [],
|
|
102
|
-
"text": ""
|
|
135
|
+
"text": "Controlled open state. Omit it to use defaultOpen and local interaction state."
|
|
103
136
|
},
|
|
104
137
|
"getter": false,
|
|
105
138
|
"setter": false,
|
|
106
139
|
"reflect": false,
|
|
107
|
-
"attribute": "open"
|
|
108
|
-
"defaultValue": "false"
|
|
140
|
+
"attribute": "open"
|
|
109
141
|
},
|
|
110
142
|
"defaultOpen": {
|
|
111
143
|
"type": "boolean",
|
|
@@ -190,7 +222,8 @@ export class UIDialog {
|
|
|
190
222
|
}
|
|
191
223
|
static get states() {
|
|
192
224
|
return {
|
|
193
|
-
"internalOpen": {}
|
|
225
|
+
"internalOpen": {},
|
|
226
|
+
"accessibleLabel": {}
|
|
194
227
|
};
|
|
195
228
|
}
|
|
196
229
|
static get elementRef() { return "host"; }
|
|
@@ -198,6 +231,9 @@ export class UIDialog {
|
|
|
198
231
|
return [{
|
|
199
232
|
"propName": "open",
|
|
200
233
|
"methodName": "syncFromProp"
|
|
234
|
+
}, {
|
|
235
|
+
"propName": "label",
|
|
236
|
+
"methodName": "syncLabelFromProp"
|
|
201
237
|
}, {
|
|
202
238
|
"propName": "internalOpen",
|
|
203
239
|
"methodName": "syncOpen"
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { createId } from "../../utils/id";
|
|
3
3
|
import { eventToTrigger, isActivationKey, dispatchDetail } from "../../utils/events";
|
|
4
|
+
import { controlledOrDefault, isControlled } from "../../utils/controlled-state";
|
|
4
5
|
export class UIDisclosure {
|
|
5
6
|
host;
|
|
6
|
-
open
|
|
7
|
+
/** Controlled open state. Omit it to use defaultOpen and local interaction state. */
|
|
8
|
+
open;
|
|
7
9
|
defaultOpen = false;
|
|
8
10
|
disabled = false;
|
|
9
11
|
internalOpen = false;
|
|
@@ -11,7 +13,8 @@ export class UIDisclosure {
|
|
|
11
13
|
trigger = null;
|
|
12
14
|
content = null;
|
|
13
15
|
syncFromProp() {
|
|
14
|
-
|
|
16
|
+
if (isControlled(this.open))
|
|
17
|
+
this.internalOpen = this.open;
|
|
15
18
|
}
|
|
16
19
|
syncState() {
|
|
17
20
|
if (this.trigger) {
|
|
@@ -23,8 +26,7 @@ export class UIDisclosure {
|
|
|
23
26
|
}
|
|
24
27
|
componentDidLoad() {
|
|
25
28
|
this.resolveParts();
|
|
26
|
-
this.
|
|
27
|
-
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
29
|
+
this.internalOpen = controlledOrDefault(this.open, this.defaultOpen);
|
|
28
30
|
this.syncState();
|
|
29
31
|
this.trigger?.addEventListener('click', this.onTriggerClick);
|
|
30
32
|
this.trigger?.addEventListener('keydown', this.onTriggerKeydown);
|
|
@@ -64,7 +66,8 @@ export class UIDisclosure {
|
|
|
64
66
|
setOpen(next, action) {
|
|
65
67
|
if (this.internalOpen === next)
|
|
66
68
|
return;
|
|
67
|
-
this.
|
|
69
|
+
if (!isControlled(this.open))
|
|
70
|
+
this.internalOpen = next;
|
|
68
71
|
dispatchDetail(this.host, next ? 'open' : 'close', {
|
|
69
72
|
open: next,
|
|
70
73
|
reason: action.reason,
|
|
@@ -85,7 +88,7 @@ export class UIDisclosure {
|
|
|
85
88
|
this.setOpen(!this.internalOpen, { reason: 'action', trigger: 'keyboard' });
|
|
86
89
|
};
|
|
87
90
|
render() {
|
|
88
|
-
return (h(Host, { key: '
|
|
91
|
+
return (h(Host, { key: '55a6fd71965104b96b55fd53870becce748a4116' }, h("slot", { key: '542727e10d335ff44fc7cf8250e80f045f89b8f2' })));
|
|
89
92
|
}
|
|
90
93
|
static get is() { return "ui-disclosure"; }
|
|
91
94
|
static get encapsulation() { return "shadow"; }
|
|
@@ -110,16 +113,15 @@ export class UIDisclosure {
|
|
|
110
113
|
"references": {}
|
|
111
114
|
},
|
|
112
115
|
"required": false,
|
|
113
|
-
"optional":
|
|
116
|
+
"optional": true,
|
|
114
117
|
"docs": {
|
|
115
118
|
"tags": [],
|
|
116
|
-
"text": ""
|
|
119
|
+
"text": "Controlled open state. Omit it to use defaultOpen and local interaction state."
|
|
117
120
|
},
|
|
118
121
|
"getter": false,
|
|
119
122
|
"setter": false,
|
|
120
123
|
"reflect": false,
|
|
121
|
-
"attribute": "open"
|
|
122
|
-
"defaultValue": "false"
|
|
124
|
+
"attribute": "open"
|
|
123
125
|
},
|
|
124
126
|
"defaultOpen": {
|
|
125
127
|
"type": "boolean",
|
|
@@ -4,7 +4,7 @@ export class UIFloatingActionButton {
|
|
|
4
4
|
mobileOnly = false;
|
|
5
5
|
label = '';
|
|
6
6
|
render() {
|
|
7
|
-
return (h(Host, { key: '
|
|
7
|
+
return (h(Host, { key: 'b41f0aaabbcd23cb79ac06245e69fd8ecb9c9912', "data-disabled": this.disabled ? '' : undefined }, h("button", { key: '36a023bd66d38845f1116874380d7a28bb46b5a2', type: "button", "aria-label": this.label || undefined, disabled: this.disabled }, h("slot", { key: '412c41e4732cc230f84e7758bfc7faab7e0802e2' }))));
|
|
8
8
|
}
|
|
9
9
|
static get is() { return "ui-floating-action-button"; }
|
|
10
10
|
static get encapsulation() { return "shadow"; }
|
|
@@ -5,17 +5,62 @@ export class UIFormField {
|
|
|
5
5
|
invalid = false;
|
|
6
6
|
disabled = false;
|
|
7
7
|
required = false;
|
|
8
|
+
observer = null;
|
|
9
|
+
activeInput = null;
|
|
10
|
+
ownedDescriptionIds = new Set();
|
|
11
|
+
wireQueued = false;
|
|
8
12
|
componentDidLoad() {
|
|
13
|
+
this.observer = new MutationObserver(this.scheduleWire);
|
|
14
|
+
this.observer.observe(this.host, {
|
|
15
|
+
childList: true,
|
|
16
|
+
subtree: true,
|
|
17
|
+
attributes: true,
|
|
18
|
+
attributeFilter: ['aria-describedby', 'data-slot', 'id', 'role'],
|
|
19
|
+
});
|
|
9
20
|
this.wire();
|
|
10
21
|
}
|
|
11
22
|
componentDidUpdate() {
|
|
12
|
-
this.
|
|
23
|
+
this.scheduleWire();
|
|
24
|
+
}
|
|
25
|
+
disconnectedCallback() {
|
|
26
|
+
this.observer?.disconnect();
|
|
27
|
+
this.observer = null;
|
|
28
|
+
this.removeOwnedDescriptions(this.activeInput);
|
|
29
|
+
this.activeInput = null;
|
|
30
|
+
this.ownedDescriptionIds.clear();
|
|
13
31
|
}
|
|
32
|
+
descriptionIds(input) {
|
|
33
|
+
return Array.from(new Set((input.getAttribute('aria-describedby') ?? '').split(/\s+/).filter(Boolean)));
|
|
34
|
+
}
|
|
35
|
+
removeOwnedDescriptions(input) {
|
|
36
|
+
if (!input || this.ownedDescriptionIds.size === 0)
|
|
37
|
+
return;
|
|
38
|
+
const remaining = this.descriptionIds(input)
|
|
39
|
+
.filter(id => !this.ownedDescriptionIds.has(id));
|
|
40
|
+
if (remaining.length > 0)
|
|
41
|
+
input.setAttribute('aria-describedby', remaining.join(' '));
|
|
42
|
+
else
|
|
43
|
+
input.removeAttribute('aria-describedby');
|
|
44
|
+
}
|
|
45
|
+
scheduleWire = () => {
|
|
46
|
+
if (this.wireQueued)
|
|
47
|
+
return;
|
|
48
|
+
this.wireQueued = true;
|
|
49
|
+
queueMicrotask(() => {
|
|
50
|
+
this.wireQueued = false;
|
|
51
|
+
this.wire();
|
|
52
|
+
});
|
|
53
|
+
};
|
|
14
54
|
wire() {
|
|
15
55
|
const label = this.host.querySelector('label');
|
|
16
56
|
const input = this.host.querySelector('input, textarea, select');
|
|
17
57
|
const help = this.host.querySelector('[data-slot="help"]');
|
|
18
58
|
const error = this.host.querySelector('[data-slot="error"], [role="alert"]');
|
|
59
|
+
if (input !== this.activeInput) {
|
|
60
|
+
this.removeOwnedDescriptions(this.activeInput);
|
|
61
|
+
this.activeInput = input;
|
|
62
|
+
this.ownedDescriptionIds.clear();
|
|
63
|
+
}
|
|
19
64
|
if (!input)
|
|
20
65
|
return;
|
|
21
66
|
if (!input.id) {
|
|
@@ -24,6 +69,9 @@ export class UIFormField {
|
|
|
24
69
|
if (label && !label.getAttribute('for')) {
|
|
25
70
|
label.setAttribute('for', input.id);
|
|
26
71
|
}
|
|
72
|
+
const previousOwnedIds = this.ownedDescriptionIds;
|
|
73
|
+
const externalIds = this.descriptionIds(input)
|
|
74
|
+
.filter(id => !previousOwnedIds.has(id));
|
|
27
75
|
const describedIds = [];
|
|
28
76
|
if (help) {
|
|
29
77
|
if (!help.id)
|
|
@@ -35,15 +83,22 @@ export class UIFormField {
|
|
|
35
83
|
error.id = createId('form-field-error');
|
|
36
84
|
describedIds.push(error.id);
|
|
37
85
|
}
|
|
38
|
-
|
|
39
|
-
|
|
86
|
+
const nextOwnedIds = describedIds.filter(id => !externalIds.includes(id));
|
|
87
|
+
const nextDescribedIds = Array.from(new Set([...externalIds, ...describedIds]));
|
|
88
|
+
const nextDescribedBy = nextDescribedIds.join(' ');
|
|
89
|
+
if (input.getAttribute('aria-describedby') !== nextDescribedBy) {
|
|
90
|
+
if (nextDescribedBy)
|
|
91
|
+
input.setAttribute('aria-describedby', nextDescribedBy);
|
|
92
|
+
else
|
|
93
|
+
input.removeAttribute('aria-describedby');
|
|
40
94
|
}
|
|
95
|
+
this.ownedDescriptionIds = new Set(nextOwnedIds);
|
|
41
96
|
input.disabled = this.disabled;
|
|
42
97
|
input.required = this.required;
|
|
43
98
|
input.setAttribute('aria-invalid', this.invalid ? 'true' : 'false');
|
|
44
99
|
}
|
|
45
100
|
render() {
|
|
46
|
-
return (h(Host, { key: '
|
|
101
|
+
return (h(Host, { key: '0b8fd5608631b5f9159fdf99d6eba918cc6587e4', "data-invalid": this.invalid ? '' : undefined, "data-disabled": this.disabled ? '' : undefined, "data-required": this.required ? '' : undefined }, h("slot", { key: '4ed78782bcc8b6699a40d8402994b486d71d730a', onSlotchange: this.scheduleWire })));
|
|
47
102
|
}
|
|
48
103
|
static get is() { return "ui-form-field"; }
|
|
49
104
|
static get encapsulation() { return "shadow"; }
|
|
@@ -7,7 +7,7 @@ export class UIIconButton {
|
|
|
7
7
|
/** Reveals this control through a surrounding ui-affordance-scope. */
|
|
8
8
|
anticipatory = false;
|
|
9
9
|
render() {
|
|
10
|
-
return (h(Host, { key: '
|
|
10
|
+
return (h(Host, { key: 'fb4534d977b4812f402855f78176b8316ebace61', "data-disabled": this.disabled ? '' : undefined, "data-ui-affordance": this.anticipatory ? 'button' : undefined }, h("button", { key: 'b90d290870ad76ba18de88a6b6947a15040ff12a', type: "button", "aria-label": this.label || undefined, disabled: this.disabled }, h("slot", { key: '88ded6ad90a4cfeffcd687990e5ba8b0c7d3bd30' }))));
|
|
11
11
|
}
|
|
12
12
|
static get is() { return "ui-icon-button"; }
|
|
13
13
|
static get encapsulation() { return "shadow"; }
|
|
@@ -70,7 +70,7 @@ export class UIInput {
|
|
|
70
70
|
});
|
|
71
71
|
};
|
|
72
72
|
render() {
|
|
73
|
-
return (h(Host, { key: '
|
|
73
|
+
return (h(Host, { key: 'fe125b4e8ec35e9ac0b0ca0434aa8439f515c51b', "data-invalid": this.invalid ? '' : undefined }, h("slot", { key: 'ec0609f9143435cf0436abb98488b9f30b71530b', ref: (el) => (this.slotRef = el) })));
|
|
74
74
|
}
|
|
75
75
|
static get is() { return "ui-input"; }
|
|
76
76
|
static get encapsulation() { return "shadow"; }
|
|
@@ -2,14 +2,25 @@
|
|
|
2
2
|
--ui-menu-viewport-gap: var(--ui-space-2, 0.5rem);
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
|
+
box-sizing: border-box;
|
|
5
6
|
inline-size: max-content;
|
|
6
7
|
min-inline-size: min(12rem, calc(100vw - (var(--ui-menu-viewport-gap) * 2)));
|
|
7
8
|
max-inline-size: calc(100vw - (var(--ui-menu-viewport-gap) * 2));
|
|
9
|
+
padding: 0;
|
|
10
|
+
border: 0;
|
|
11
|
+
border-radius: 0;
|
|
12
|
+
background: transparent;
|
|
13
|
+
box-shadow: var(--ui-shadow-lg);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.menu__surface {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
box-sizing: border-box;
|
|
8
20
|
padding: var(--ui-space-1);
|
|
9
21
|
background: var(--ui-surface-elevated);
|
|
10
22
|
border: 1px solid var(--ui-border-default);
|
|
11
23
|
border-radius: var(--ui-radius-3);
|
|
12
|
-
box-shadow: var(--ui-shadow-lg);
|
|
13
24
|
}
|
|
14
25
|
|
|
15
26
|
:host(:not([data-open])) {
|
|
@@ -54,26 +65,4 @@
|
|
|
54
65
|
::slotted(ui-menu-item) {
|
|
55
66
|
display: block;
|
|
56
67
|
width: 100%;
|
|
57
|
-
padding: var(--ui-space-2) var(--ui-space-3);
|
|
58
|
-
text-align: left;
|
|
59
|
-
background: none;
|
|
60
|
-
border: none;
|
|
61
|
-
border-radius: var(--ui-radius-2);
|
|
62
|
-
color: var(--ui-text-primary);
|
|
63
|
-
font-size: var(--ui-font-size-md);
|
|
64
|
-
font-weight: var(--ui-font-medium, 500);
|
|
65
|
-
cursor: pointer;
|
|
66
|
-
transition:
|
|
67
|
-
background-color var(--ui-motion-fast) var(--ui-motion-ease),
|
|
68
|
-
color var(--ui-motion-fast) var(--ui-motion-ease);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
::slotted(ui-menu-item:hover:not([aria-disabled='true']):not([disabled])) {
|
|
72
|
-
background: var(--ui-surface-subtle);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
::slotted(ui-menu-item[aria-disabled='true']),
|
|
76
|
-
::slotted(ui-menu-item[disabled]) {
|
|
77
|
-
opacity: 0.6;
|
|
78
|
-
cursor: not-allowed;
|
|
79
68
|
}
|