@threadlabs/looma 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/dist/chunk-G53JEAQK.js +94 -0
- package/dist/chunk-OF57X5AR.js +10 -0
- package/dist/chunk-UL7UIUJZ.js +20 -0
- package/dist/chunk-YK4MTZGJ.js +1580 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/events-TcQIzpNv.js +19 -0
- package/dist/cjs/id-CYbKpaYr.js +9 -0
- package/dist/cjs/index-D07f6BOw.js +1569 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/looma.cjs.js +25 -0
- package/dist/cjs/manager-BOpVXb92.js +93 -0
- package/dist/cjs/ui-avatar-group.cjs.entry.js +51 -0
- package/dist/cjs/ui-avatar.cjs.entry.js +50 -0
- package/dist/cjs/ui-badge.cjs.entry.js +19 -0
- package/dist/cjs/ui-button.cjs.entry.js +62 -0
- package/dist/cjs/ui-checkbox.cjs.entry.js +91 -0
- package/dist/cjs/ui-context-menu.cjs.entry.js +201 -0
- package/dist/cjs/ui-dialog.cjs.entry.js +93 -0
- package/dist/cjs/ui-disclosure.cjs.entry.js +109 -0
- package/dist/cjs/ui-floating-action-button.cjs.entry.js +20 -0
- package/dist/cjs/ui-form-field.cjs.entry.js +59 -0
- package/dist/cjs/ui-icon-button.cjs.entry.js +21 -0
- package/dist/cjs/ui-input.cjs.entry.js +101 -0
- package/dist/cjs/ui-menu-item.cjs.entry.js +19 -0
- package/dist/cjs/ui-menu.cjs.entry.js +96 -0
- package/dist/cjs/ui-popover.cjs.entry.js +92 -0
- package/dist/cjs/ui-radio-group.cjs.entry.js +134 -0
- package/dist/cjs/ui-radio.cjs.entry.js +85 -0
- package/dist/cjs/ui-search-result-row.cjs.entry.js +47 -0
- package/dist/cjs/ui-search-shell.cjs.entry.js +39 -0
- package/dist/cjs/ui-select.cjs.entry.js +100 -0
- package/dist/cjs/ui-switch.cjs.entry.js +65 -0
- package/dist/cjs/ui-tabs.cjs.entry.js +117 -0
- package/dist/cjs/ui-textarea.cjs.entry.js +106 -0
- package/dist/cjs/ui-toast-region.cjs.entry.js +67 -0
- package/dist/cjs/ui-tooltip.cjs.entry.js +133 -0
- package/dist/cjs/ui-top-bar.cjs.entry.js +43 -0
- package/dist/collection/collection-manifest.json +38 -0
- package/dist/collection/components/ui-avatar/ui-avatar.css +35 -0
- package/dist/collection/components/ui-avatar/ui-avatar.js +130 -0
- package/dist/collection/components/ui-avatar-group/ui-avatar-group.css +32 -0
- package/dist/collection/components/ui-avatar-group/ui-avatar-group.js +103 -0
- package/dist/collection/components/ui-badge/ui-badge.css +74 -0
- package/dist/collection/components/ui-badge/ui-badge.js +62 -0
- package/dist/collection/components/ui-button/ui-button.css +101 -0
- package/dist/collection/components/ui-button/ui-button.js +127 -0
- package/dist/collection/components/ui-checkbox/ui-checkbox.css +24 -0
- package/dist/collection/components/ui-checkbox/ui-checkbox.js +223 -0
- package/dist/collection/components/ui-context-menu/ui-context-menu.css +17 -0
- package/dist/collection/components/ui-context-menu/ui-context-menu.js +272 -0
- package/dist/collection/components/ui-dialog/ui-dialog.css +65 -0
- package/dist/collection/components/ui-dialog/ui-dialog.js +185 -0
- package/dist/collection/components/ui-disclosure/ui-disclosure.css +7 -0
- package/dist/collection/components/ui-disclosure/ui-disclosure.js +182 -0
- package/dist/collection/components/ui-floating-action-button/ui-floating-action-button.css +70 -0
- package/dist/collection/components/ui-floating-action-button/ui-floating-action-button.js +85 -0
- package/dist/collection/components/ui-form-field/ui-form-field.css +21 -0
- package/dist/collection/components/ui-form-field/ui-form-field.js +125 -0
- package/dist/collection/components/ui-icon-button/ui-icon-button.css +92 -0
- package/dist/collection/components/ui-icon-button/ui-icon-button.js +106 -0
- package/dist/collection/components/ui-input/ui-input.css +46 -0
- package/dist/collection/components/ui-input/ui-input.js +213 -0
- package/dist/collection/components/ui-menu/ui-menu.css +37 -0
- package/dist/collection/components/ui-menu/ui-menu.js +149 -0
- package/dist/collection/components/ui-menu-item/ui-menu-item.css +26 -0
- package/dist/collection/components/ui-menu-item/ui-menu-item.js +64 -0
- package/dist/collection/components/ui-popover/ui-popover.css +8 -0
- package/dist/collection/components/ui-popover/ui-popover.js +144 -0
- package/dist/collection/components/ui-radio/ui-radio.css +22 -0
- package/dist/collection/components/ui-radio/ui-radio.js +213 -0
- package/dist/collection/components/ui-radio-group/ui-radio-group.css +10 -0
- package/dist/collection/components/ui-radio-group/ui-radio-group.js +247 -0
- package/dist/collection/components/ui-search-result-row/ui-search-result-row.css +80 -0
- package/dist/collection/components/ui-search-result-row/ui-search-result-row.js +100 -0
- package/dist/collection/components/ui-search-shell/ui-search-shell.css +61 -0
- package/dist/collection/components/ui-search-shell/ui-search-shell.js +46 -0
- package/dist/collection/components/ui-select/ui-select.css +62 -0
- package/dist/collection/components/ui-select/ui-select.js +212 -0
- package/dist/collection/components/ui-switch/ui-switch.css +63 -0
- package/dist/collection/components/ui-switch/ui-switch.js +177 -0
- package/dist/collection/components/ui-tabs/ui-tabs.css +65 -0
- package/dist/collection/components/ui-tabs/ui-tabs.js +190 -0
- package/dist/collection/components/ui-textarea/ui-textarea.css +48 -0
- package/dist/collection/components/ui-textarea/ui-textarea.js +238 -0
- package/dist/collection/components/ui-toast-region/ui-toast-region.css +52 -0
- package/dist/collection/components/ui-toast-region/ui-toast-region.js +100 -0
- package/dist/collection/components/ui-tooltip/ui-tooltip.css +14 -0
- package/dist/collection/components/ui-tooltip/ui-tooltip.js +205 -0
- package/dist/collection/components/ui-top-bar/ui-top-bar.css +43 -0
- package/dist/collection/components/ui-top-bar/ui-top-bar.js +52 -0
- package/dist/collection/overlay/manager.js +90 -0
- package/dist/collection/utils/events.js +13 -0
- package/dist/collection/utils/id.js +5 -0
- package/dist/collection/utils/initials.js +11 -0
- package/dist/components/index.d.ts +88 -0
- package/dist/components/index.js +1 -0
- package/dist/components/p-CIA4RyEp.js +1 -0
- package/dist/components/p-CR7f2MQC.js +1 -0
- package/dist/components/p-JwSoedEO.js +1 -0
- package/dist/components/p-WvL4iAhX.js +1 -0
- package/dist/components/p-hgBUJRDa.js +1 -0
- package/dist/components/ui-avatar-group.d.ts +11 -0
- package/dist/components/ui-avatar-group.js +1 -0
- package/dist/components/ui-avatar.d.ts +11 -0
- package/dist/components/ui-avatar.js +1 -0
- package/dist/components/ui-badge.d.ts +11 -0
- package/dist/components/ui-badge.js +1 -0
- package/dist/components/ui-button.d.ts +11 -0
- package/dist/components/ui-button.js +1 -0
- package/dist/components/ui-checkbox.d.ts +11 -0
- package/dist/components/ui-checkbox.js +1 -0
- package/dist/components/ui-context-menu.d.ts +11 -0
- package/dist/components/ui-context-menu.js +1 -0
- package/dist/components/ui-dialog.d.ts +11 -0
- package/dist/components/ui-dialog.js +1 -0
- package/dist/components/ui-disclosure.d.ts +11 -0
- package/dist/components/ui-disclosure.js +1 -0
- package/dist/components/ui-floating-action-button.d.ts +11 -0
- package/dist/components/ui-floating-action-button.js +1 -0
- package/dist/components/ui-form-field.d.ts +11 -0
- package/dist/components/ui-form-field.js +1 -0
- package/dist/components/ui-icon-button.d.ts +11 -0
- package/dist/components/ui-icon-button.js +1 -0
- package/dist/components/ui-input.d.ts +11 -0
- package/dist/components/ui-input.js +1 -0
- package/dist/components/ui-menu-item.d.ts +11 -0
- package/dist/components/ui-menu-item.js +1 -0
- package/dist/components/ui-menu.d.ts +11 -0
- package/dist/components/ui-menu.js +1 -0
- package/dist/components/ui-popover.d.ts +11 -0
- package/dist/components/ui-popover.js +1 -0
- package/dist/components/ui-radio-group.d.ts +11 -0
- package/dist/components/ui-radio-group.js +1 -0
- package/dist/components/ui-radio.d.ts +11 -0
- package/dist/components/ui-radio.js +1 -0
- package/dist/components/ui-search-result-row.d.ts +11 -0
- package/dist/components/ui-search-result-row.js +1 -0
- package/dist/components/ui-search-shell.d.ts +11 -0
- package/dist/components/ui-search-shell.js +1 -0
- package/dist/components/ui-select.d.ts +11 -0
- package/dist/components/ui-select.js +1 -0
- package/dist/components/ui-switch.d.ts +11 -0
- package/dist/components/ui-switch.js +1 -0
- package/dist/components/ui-tabs.d.ts +11 -0
- package/dist/components/ui-tabs.js +1 -0
- package/dist/components/ui-textarea.d.ts +11 -0
- package/dist/components/ui-textarea.js +1 -0
- package/dist/components/ui-toast-region.d.ts +11 -0
- package/dist/components/ui-toast-region.js +1 -0
- package/dist/components/ui-tooltip.d.ts +11 -0
- package/dist/components/ui-tooltip.js +1 -0
- package/dist/components/ui-top-bar.d.ts +11 -0
- package/dist/components/ui-top-bar.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/events-JwSoedEO.js +15 -0
- package/dist/esm/id-hgBUJRDa.js +7 -0
- package/dist/esm/index-CEeiinfk.js +1561 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/looma.js +21 -0
- package/dist/esm/manager-CR7f2MQC.js +89 -0
- package/dist/esm/ui-avatar-group.entry.js +49 -0
- package/dist/esm/ui-avatar.entry.js +48 -0
- package/dist/esm/ui-badge.entry.js +17 -0
- package/dist/esm/ui-button.entry.js +60 -0
- package/dist/esm/ui-checkbox.entry.js +89 -0
- package/dist/esm/ui-context-menu.entry.js +199 -0
- package/dist/esm/ui-dialog.entry.js +91 -0
- package/dist/esm/ui-disclosure.entry.js +107 -0
- package/dist/esm/ui-floating-action-button.entry.js +18 -0
- package/dist/esm/ui-form-field.entry.js +57 -0
- package/dist/esm/ui-icon-button.entry.js +19 -0
- package/dist/esm/ui-input.entry.js +99 -0
- package/dist/esm/ui-menu-item.entry.js +17 -0
- package/dist/esm/ui-menu.entry.js +94 -0
- package/dist/esm/ui-popover.entry.js +90 -0
- package/dist/esm/ui-radio-group.entry.js +132 -0
- package/dist/esm/ui-radio.entry.js +83 -0
- package/dist/esm/ui-search-result-row.entry.js +45 -0
- package/dist/esm/ui-search-shell.entry.js +37 -0
- package/dist/esm/ui-select.entry.js +98 -0
- package/dist/esm/ui-switch.entry.js +63 -0
- package/dist/esm/ui-tabs.entry.js +115 -0
- package/dist/esm/ui-textarea.entry.js +104 -0
- package/dist/esm/ui-toast-region.entry.js +65 -0
- package/dist/esm/ui-tooltip.entry.js +131 -0
- package/dist/esm/ui-top-bar.entry.js +41 -0
- package/dist/index.cjs +4062 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +129 -0
- package/dist/looma/index.esm.js +0 -0
- package/dist/looma/looma.esm.js +1 -0
- package/dist/looma/p-03f0594b.entry.js +1 -0
- package/dist/looma/p-15e619fd.entry.js +1 -0
- package/dist/looma/p-201243dc.entry.js +1 -0
- package/dist/looma/p-24d7aa5b.entry.js +1 -0
- package/dist/looma/p-341ba64a.entry.js +1 -0
- package/dist/looma/p-41d62a83.entry.js +1 -0
- package/dist/looma/p-4742e6b4.entry.js +1 -0
- package/dist/looma/p-4c54d489.entry.js +1 -0
- package/dist/looma/p-52c537fa.entry.js +1 -0
- package/dist/looma/p-5a645647.entry.js +1 -0
- package/dist/looma/p-610b2eca.entry.js +1 -0
- package/dist/looma/p-649dad92.entry.js +1 -0
- package/dist/looma/p-66a203a1.entry.js +1 -0
- package/dist/looma/p-754cfff3.entry.js +1 -0
- package/dist/looma/p-93ce1c62.entry.js +1 -0
- package/dist/looma/p-955fb814.entry.js +1 -0
- package/dist/looma/p-96de71ad.entry.js +1 -0
- package/dist/looma/p-CEeiinfk.js +2 -0
- package/dist/looma/p-CR7f2MQC.js +1 -0
- package/dist/looma/p-DQuL1Twl.js +1 -0
- package/dist/looma/p-JwSoedEO.js +1 -0
- package/dist/looma/p-ab4151d5.entry.js +1 -0
- package/dist/looma/p-c14233bc.entry.js +1 -0
- package/dist/looma/p-dc857ed4.entry.js +1 -0
- package/dist/looma/p-dfcb2cca.entry.js +1 -0
- package/dist/looma/p-dff144bd.entry.js +1 -0
- package/dist/looma/p-ebb74106.entry.js +1 -0
- package/dist/looma/p-ecb5739b.entry.js +1 -0
- package/dist/looma/p-ee31c7b4.entry.js +1 -0
- package/dist/looma/p-fa4659c4.entry.js +1 -0
- package/dist/looma/p-hgBUJRDa.js +1 -0
- package/dist/types/components/ui-avatar/ui-avatar.d.ts +11 -0
- package/dist/types/components/ui-avatar-group/ui-avatar-group.d.ts +12 -0
- package/dist/types/components/ui-badge/ui-badge.d.ts +5 -0
- package/dist/types/components/ui-button/ui-button.d.ts +13 -0
- package/dist/types/components/ui-checkbox/ui-checkbox.d.ts +19 -0
- package/dist/types/components/ui-context-menu/ui-context-menu.d.ts +37 -0
- package/dist/types/components/ui-dialog/ui-dialog.d.ts +19 -0
- package/dist/types/components/ui-disclosure/ui-disclosure.d.ts +20 -0
- package/dist/types/components/ui-floating-action-button/ui-floating-action-button.d.ts +6 -0
- package/dist/types/components/ui-form-field/ui-form-field.d.ts +10 -0
- package/dist/types/components/ui-icon-button/ui-icon-button.d.ts +7 -0
- package/dist/types/components/ui-input/ui-input.d.ts +19 -0
- package/dist/types/components/ui-menu/ui-menu.d.ts +14 -0
- package/dist/types/components/ui-menu-item/ui-menu-item.d.ts +5 -0
- package/dist/types/components/ui-popover/ui-popover.d.ts +16 -0
- package/dist/types/components/ui-radio/ui-radio.d.ts +17 -0
- package/dist/types/components/ui-radio-group/ui-radio-group.d.ts +21 -0
- package/dist/types/components/ui-search-result-row/ui-search-result-row.d.ts +15 -0
- package/dist/types/components/ui-search-shell/ui-search-shell.d.ts +9 -0
- package/dist/types/components/ui-select/ui-select.d.ts +19 -0
- package/dist/types/components/ui-switch/ui-switch.d.ts +15 -0
- package/dist/types/components/ui-tabs/ui-tabs.d.ts +17 -0
- package/dist/types/components/ui-textarea/ui-textarea.d.ts +20 -0
- package/dist/types/components/ui-toast-region/ui-toast-region.d.ts +12 -0
- package/dist/types/components/ui-tooltip/ui-tooltip.d.ts +24 -0
- package/dist/types/components/ui-top-bar/ui-top-bar.d.ts +12 -0
- package/dist/types/components.d.ts +1148 -0
- package/dist/types/overlay/manager.d.ts +14 -0
- package/dist/types/stencil-public-runtime.d.ts +1860 -0
- package/dist/types/utils/events.d.ts +4 -0
- package/dist/types/utils/id.d.ts +1 -0
- package/dist/types/utils/initials.d.ts +1 -0
- package/dist/ui-avatar-group.entry-BZGXBOSE.js +59 -0
- package/dist/ui-avatar.entry-S2O2W5SA.js +51 -0
- package/dist/ui-badge.entry-CVJDISCR.js +22 -0
- package/dist/ui-button.entry-LNJBEJFE.js +72 -0
- package/dist/ui-checkbox.entry-5RA2CB43.js +102 -0
- package/dist/ui-context-menu.entry-UUOCT75F.js +211 -0
- package/dist/ui-dialog.entry-OEPJTEES.js +106 -0
- package/dist/ui-disclosure.entry-LRRISGUD.js +120 -0
- package/dist/ui-floating-action-button.entry-7TSAZRXP.js +23 -0
- package/dist/ui-form-field.entry-73YOVICF.js +67 -0
- package/dist/ui-icon-button.entry-MNXGPG36.js +24 -0
- package/dist/ui-input.entry-UWRVAOSW.js +112 -0
- package/dist/ui-menu-item.entry-5AOJO5MP.js +22 -0
- package/dist/ui-menu.entry-YDS6UMB5.js +98 -0
- package/dist/ui-popover.entry-PGWDCQIX.js +104 -0
- package/dist/ui-radio-group.entry-RHP5GNWU.js +142 -0
- package/dist/ui-radio.entry-5WRWPSTK.js +96 -0
- package/dist/ui-search-result-row.entry-IKJB2SJJ.js +50 -0
- package/dist/ui-search-shell.entry-ZIWF4ZHH.js +41 -0
- package/dist/ui-select.entry-N5TIKHR7.js +111 -0
- package/dist/ui-switch.entry-WUSZTXIR.js +75 -0
- package/dist/ui-tabs.entry-UFAVAQIF.js +124 -0
- package/dist/ui-textarea.entry-BYT47RAQ.js +117 -0
- package/dist/ui-toast-region.entry-6UYR3ZU2.js +78 -0
- package/dist/ui-tooltip.entry-YS7UX4FS.js +145 -0
- package/dist/ui-top-bar.entry-V27H6NFO.js +49 -0
- package/editor/chunk-JKRA4D4W.js +435 -0
- package/editor/chunk-NOOV344H.js +783 -0
- package/editor/extensions/index.d.ts +78 -0
- package/editor/extensions/index.js +28 -0
- package/editor/index.d.ts +7 -0
- package/editor/index.js +29 -0
- package/editor/table-overlay-DTr3KC9e.d.ts +12 -0
- package/editor/ui.d.ts +48 -0
- package/editor/ui.js +1 -0
- package/editor.css +662 -0
- package/layout/index.cjs +207 -0
- package/layout/index.css +166 -0
- package/layout/index.d.cts +3 -0
- package/layout/index.d.ts +3 -0
- package/layout/index.js +182 -0
- package/layout.css +124 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +244 -0
- package/styles.css +899 -0
- package/theme-dark.css +59 -0
- package/theme-high-contrast.css +21 -0
- package/theme-light.css +30 -0
- package/tokens.css +148 -0
- package/vue/chunk-J4UBEIIL.js +83 -0
- package/vue/editor/index.d.ts +89 -0
- package/vue/editor/index.js +125 -0
- package/vue/index.d.ts +167 -0
- package/vue/index.js +113 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-D07f6BOw.js');
|
|
4
|
+
var events = require('./events-TcQIzpNv.js');
|
|
5
|
+
|
|
6
|
+
const uiRadioGroupCss = () => `:host{display:inline-flex;align-items:center;gap:var(--ui-space-2)}:host([data-orientation='vertical']){display:inline-grid;justify-items:start}`;
|
|
7
|
+
|
|
8
|
+
const UIRadioGroup = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
}
|
|
12
|
+
get host() { return index.getElement(this); }
|
|
13
|
+
value = '';
|
|
14
|
+
name = '';
|
|
15
|
+
orientation = 'horizontal';
|
|
16
|
+
disabled = false;
|
|
17
|
+
required = false;
|
|
18
|
+
internalValue = '';
|
|
19
|
+
syncFromProp() {
|
|
20
|
+
this.internalValue = this.value;
|
|
21
|
+
}
|
|
22
|
+
syncToRadios() {
|
|
23
|
+
const radios = this.getRadios();
|
|
24
|
+
radios.forEach((radio) => {
|
|
25
|
+
radio.checked =
|
|
26
|
+
(radio.getAttribute('value') ?? '') === this.internalValue;
|
|
27
|
+
radio.name = this.name || this.groupId;
|
|
28
|
+
if (this.disabled) {
|
|
29
|
+
radio.setAttribute('aria-disabled', 'true');
|
|
30
|
+
radio.setAttribute('data-disabled', 'true');
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
radio.removeAttribute('aria-disabled');
|
|
34
|
+
radio.removeAttribute('data-disabled');
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
this.updateRovingTabindex();
|
|
38
|
+
}
|
|
39
|
+
groupId = `ui-radio-group-${Math.random().toString(36).slice(2, 9)}`;
|
|
40
|
+
componentDidLoad() {
|
|
41
|
+
this.syncFromProp();
|
|
42
|
+
this.syncToRadios();
|
|
43
|
+
this.host.addEventListener('change', this.onRadioChange);
|
|
44
|
+
this.host.addEventListener('keydown', this.onKeydown);
|
|
45
|
+
}
|
|
46
|
+
disconnectedCallback() {
|
|
47
|
+
this.host.removeEventListener('change', this.onRadioChange);
|
|
48
|
+
this.host.removeEventListener('keydown', this.onKeydown);
|
|
49
|
+
}
|
|
50
|
+
componentDidUpdate() {
|
|
51
|
+
this.syncToRadios();
|
|
52
|
+
}
|
|
53
|
+
getRadios() {
|
|
54
|
+
return Array.from(this.host.querySelectorAll('ui-radio'));
|
|
55
|
+
}
|
|
56
|
+
updateRovingTabindex() {
|
|
57
|
+
const radios = this.getRadios();
|
|
58
|
+
const currentIndex = radios.findIndex((r) => (r.getAttribute('value') ?? '') === this.internalValue);
|
|
59
|
+
radios.forEach((r, i) => {
|
|
60
|
+
const input = r.querySelector('input[type="radio"]');
|
|
61
|
+
if (input) {
|
|
62
|
+
input.tabIndex = i === (currentIndex >= 0 ? currentIndex : 0) ? 0 : -1;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
setValue(newValue, trigger) {
|
|
67
|
+
const prev = this.internalValue;
|
|
68
|
+
this.internalValue = newValue;
|
|
69
|
+
this.syncToRadios();
|
|
70
|
+
events.dispatchDetail(this.host, 'select', { value: newValue, previousValue: prev, trigger });
|
|
71
|
+
events.dispatchDetail(this.host, 'change', {
|
|
72
|
+
checked: true,
|
|
73
|
+
value: newValue,
|
|
74
|
+
trigger,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
onRadioChange = (e) => {
|
|
78
|
+
const target = e.target.closest?.('ui-radio');
|
|
79
|
+
if (!target || target.getRootNode() !== this.host.getRootNode())
|
|
80
|
+
return;
|
|
81
|
+
const value = target.getAttribute('value') ?? '';
|
|
82
|
+
if (value && value !== this.internalValue) {
|
|
83
|
+
this.setValue(value, events.eventToTrigger(e));
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
onKeydown = (e) => {
|
|
87
|
+
const radios = this.getRadios();
|
|
88
|
+
if (radios.length === 0)
|
|
89
|
+
return;
|
|
90
|
+
const currentIndex = radios.findIndex((r) => (r.getAttribute('value') ?? '') === this.internalValue);
|
|
91
|
+
const axis = this.orientation === 'vertical' ? 'vertical' : 'horizontal';
|
|
92
|
+
const isPrev = axis === 'horizontal' ? e.key === 'ArrowLeft' : e.key === 'ArrowUp';
|
|
93
|
+
const isNext = axis === 'horizontal' ? e.key === 'ArrowRight' : e.key === 'ArrowDown';
|
|
94
|
+
if (!isPrev && !isNext)
|
|
95
|
+
return;
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
let nextIndex;
|
|
98
|
+
if (isNext) {
|
|
99
|
+
nextIndex = currentIndex < 0 ? 0 : Math.min(currentIndex + 1, radios.length - 1);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
nextIndex = currentIndex <= 0 ? radios.length - 1 : currentIndex - 1;
|
|
103
|
+
}
|
|
104
|
+
const nextRadio = radios[nextIndex];
|
|
105
|
+
const nextValue = nextRadio?.getAttribute('value') ?? '';
|
|
106
|
+
if (nextValue) {
|
|
107
|
+
this.setValue(nextValue, 'keyboard');
|
|
108
|
+
nextRadio?.querySelector('input[type="radio"]')?.focus();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
render() {
|
|
112
|
+
return (index.h(index.Host, { key: '5182efff607bcf9add3f0981ce2af3a42bd356b8', role: "radiogroup", "aria-orientation": this.orientation, "data-orientation": this.orientation, "data-disabled": this.disabled ? '' : undefined }, index.h("slot", { key: '2889bc2abecddf3e7cf81cd54053bdd608559dfc' })));
|
|
113
|
+
}
|
|
114
|
+
static get watchers() { return {
|
|
115
|
+
"value": [{
|
|
116
|
+
"syncFromProp": 0
|
|
117
|
+
}],
|
|
118
|
+
"internalValue": [{
|
|
119
|
+
"syncToRadios": 0
|
|
120
|
+
}],
|
|
121
|
+
"name": [{
|
|
122
|
+
"syncToRadios": 0
|
|
123
|
+
}],
|
|
124
|
+
"orientation": [{
|
|
125
|
+
"syncToRadios": 0
|
|
126
|
+
}],
|
|
127
|
+
"disabled": [{
|
|
128
|
+
"syncToRadios": 0
|
|
129
|
+
}]
|
|
130
|
+
}; }
|
|
131
|
+
};
|
|
132
|
+
UIRadioGroup.style = uiRadioGroupCss();
|
|
133
|
+
|
|
134
|
+
exports.ui_radio_group = UIRadioGroup;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-D07f6BOw.js');
|
|
4
|
+
var events = require('./events-TcQIzpNv.js');
|
|
5
|
+
|
|
6
|
+
const uiRadioCss = () => `:host{display:inline-flex;align-items:center;gap:var(--ui-space-2);color:var(--ui-text-primary)}:host([data-disabled='true']),:host([aria-disabled='true']){opacity:0.6;cursor:not-allowed}::slotted(input[type='radio']){accent-color:var(--ui-accent-solid);cursor:pointer}::slotted(input[type='radio']:focus-visible){outline:2px solid var(--ui-accent-solid);outline-offset:2px}`;
|
|
7
|
+
|
|
8
|
+
const UIRadio = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
}
|
|
12
|
+
get host() { return index.getElement(this); }
|
|
13
|
+
checked = false;
|
|
14
|
+
defaultChecked = false;
|
|
15
|
+
disabled = false;
|
|
16
|
+
name = '';
|
|
17
|
+
required = false;
|
|
18
|
+
value = 'on';
|
|
19
|
+
slotRef;
|
|
20
|
+
syncToInput() {
|
|
21
|
+
const input = this.getInput();
|
|
22
|
+
if (!input)
|
|
23
|
+
return;
|
|
24
|
+
this.host.dataset.disabled = this.disabled ? 'true' : '';
|
|
25
|
+
input.checked = this.checked;
|
|
26
|
+
input.disabled = this.disabled;
|
|
27
|
+
input.name = this.name;
|
|
28
|
+
input.required = this.required;
|
|
29
|
+
input.value = this.value;
|
|
30
|
+
}
|
|
31
|
+
componentDidLoad() {
|
|
32
|
+
if (!this.checked && this.defaultChecked) {
|
|
33
|
+
this.checked = true;
|
|
34
|
+
}
|
|
35
|
+
this.slotRef?.addEventListener('slotchange', () => this.syncToInput());
|
|
36
|
+
this.syncToInput();
|
|
37
|
+
const input = this.getInput();
|
|
38
|
+
input?.addEventListener('change', this.onInputChange);
|
|
39
|
+
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
const input = this.getInput();
|
|
42
|
+
input?.removeEventListener('change', this.onInputChange);
|
|
43
|
+
}
|
|
44
|
+
componentDidUpdate() {
|
|
45
|
+
this.syncToInput();
|
|
46
|
+
}
|
|
47
|
+
getInput() {
|
|
48
|
+
const slot = this.host.shadowRoot?.querySelector('slot');
|
|
49
|
+
const nodes = slot?.assignedElements() ?? Array.from(this.host.children);
|
|
50
|
+
return nodes.find((el) => el instanceof HTMLInputElement && el.type === 'radio') ?? null;
|
|
51
|
+
}
|
|
52
|
+
onInputChange = (e) => {
|
|
53
|
+
const input = e.target;
|
|
54
|
+
if (!input || !input.checked)
|
|
55
|
+
return;
|
|
56
|
+
events.dispatchDetail(this.host, 'change', {
|
|
57
|
+
checked: true,
|
|
58
|
+
value: this.value,
|
|
59
|
+
trigger: events.eventToTrigger(e),
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
render() {
|
|
63
|
+
return (index.h(index.Host, { key: '85a3e7f7903c910f6ccbc324ab38bf94ebaf93e0', role: "radio", "aria-checked": String(this.checked), "aria-disabled": String(this.disabled), "data-disabled": this.disabled ? '' : undefined }, index.h("slot", { key: '9117391004b9ed10cb4e819a629f66d32661d7d3', ref: (el) => (this.slotRef = el) })));
|
|
64
|
+
}
|
|
65
|
+
static get watchers() { return {
|
|
66
|
+
"checked": [{
|
|
67
|
+
"syncToInput": 0
|
|
68
|
+
}],
|
|
69
|
+
"disabled": [{
|
|
70
|
+
"syncToInput": 0
|
|
71
|
+
}],
|
|
72
|
+
"name": [{
|
|
73
|
+
"syncToInput": 0
|
|
74
|
+
}],
|
|
75
|
+
"required": [{
|
|
76
|
+
"syncToInput": 0
|
|
77
|
+
}],
|
|
78
|
+
"value": [{
|
|
79
|
+
"syncToInput": 0
|
|
80
|
+
}]
|
|
81
|
+
}; }
|
|
82
|
+
};
|
|
83
|
+
UIRadio.style = uiRadioCss();
|
|
84
|
+
|
|
85
|
+
exports.ui_radio = UIRadio;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-D07f6BOw.js');
|
|
4
|
+
|
|
5
|
+
const uiSearchResultRowCss = () => `:host{display:block}.search-result-row{appearance:none;inline-size:100%;min-block-size:var(--ui-search-result-row-min-height, 56px);margin:0;padding-block:var(--ui-search-result-row-padding-block, var(--ui-space-3, 0.75rem));padding-inline:var(--ui-search-result-row-padding-inline, var(--ui-space-4, 1rem));display:flex;align-items:flex-start;gap:var(--ui-search-result-row-gap, var(--ui-space-3, 0.75rem));background:var(--ui-search-result-row-bg, transparent);border:none;border-block-end:1px solid var(--ui-search-result-row-border, var(--ui-border, #e5e7eb));color:inherit;cursor:pointer;text-align:left;transition:background-color var(--ui-motion-fast, 160ms) var(--ui-motion-ease, ease)}:host(:last-child) .search-result-row{border-block-end:none}.search-result-row:hover:enabled{background:var(--ui-search-result-row-hover-bg, color-mix(in srgb, var(--ui-surface, #ffffff) 85%, black 3%))}:host([selected]) .search-result-row{background:var( --ui-search-result-row-selected-bg, var(--ui-search-result-row-hover-bg, color-mix(in srgb, var(--ui-surface, #ffffff) 85%, black 3%)) )}.search-result-row:focus-visible{outline:2px solid var(--ui-focus-ring, #2563eb);outline-offset:-2px}.search-result-row:disabled,:host([disabled]) .search-result-row{opacity:0.6;cursor:not-allowed}.search-result-row__leading,.search-result-row__trailing{display:inline-flex;align-items:flex-start;flex-shrink:0}.search-result-row__content{min-inline-size:0;flex:1;display:flex;flex-direction:column}.search-result-row__title,.search-result-row__meta,.search-result-row__excerpt{display:block;min-inline-size:0}[hidden]{display:none}::slotted([slot='title']),::slotted([slot='meta']),::slotted([slot='excerpt']){display:block;margin:0}`;
|
|
6
|
+
|
|
7
|
+
function slotHasContent(slot) {
|
|
8
|
+
if (!slot) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return slot.assignedNodes({ flatten: true }).some((node) => {
|
|
12
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
13
|
+
return Boolean(node.textContent?.trim());
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const UISearchResultRow = class {
|
|
19
|
+
constructor(hostRef) {
|
|
20
|
+
index.registerInstance(this, hostRef);
|
|
21
|
+
}
|
|
22
|
+
disabled = false;
|
|
23
|
+
selected = false;
|
|
24
|
+
hasLeading = false;
|
|
25
|
+
hasMeta = false;
|
|
26
|
+
hasExcerpt = false;
|
|
27
|
+
hasTrailing = false;
|
|
28
|
+
leadingSlot;
|
|
29
|
+
metaSlot;
|
|
30
|
+
excerptSlot;
|
|
31
|
+
trailingSlot;
|
|
32
|
+
componentDidLoad() {
|
|
33
|
+
this.syncSlots();
|
|
34
|
+
}
|
|
35
|
+
syncSlots = () => {
|
|
36
|
+
this.hasLeading = slotHasContent(this.leadingSlot);
|
|
37
|
+
this.hasMeta = slotHasContent(this.metaSlot);
|
|
38
|
+
this.hasExcerpt = slotHasContent(this.excerptSlot);
|
|
39
|
+
this.hasTrailing = slotHasContent(this.trailingSlot);
|
|
40
|
+
};
|
|
41
|
+
render() {
|
|
42
|
+
return (index.h(index.Host, { key: 'abd055ed3b7a9140f024181377fd6c0e9b270578' }, index.h("button", { key: 'af6758ec890a63d11e11180f3cccfd94112b9804', class: "search-result-row", type: "button", disabled: this.disabled, part: "button" }, index.h("span", { key: 'e7321d522ac45566e836382d525463825c855afc', class: "search-result-row__leading", part: "leading", hidden: !this.hasLeading }, index.h("slot", { key: '90f578306f8b9c321128f705369531b64d54cca2', name: "leading", ref: (el) => (this.leadingSlot = el), onSlotchange: this.syncSlots })), index.h("span", { key: '37a8ab0b4b19215d1a4c79d92646b18e010be8a0', class: "search-result-row__content", part: "content" }, index.h("span", { key: '1728598d9e9578cf6f04f13c1691e333b7d5ca25', class: "search-result-row__title", part: "title" }, index.h("slot", { key: '556b9da285b7e64298527870a970ef8c02e71988', name: "title" })), index.h("span", { key: 'ed47e52ad83968ca763e01ae7d9d3d66d444145a', class: "search-result-row__meta", part: "meta", hidden: !this.hasMeta }, index.h("slot", { key: 'c374d6328951530227892eec688edd60514e7e04', name: "meta", ref: (el) => (this.metaSlot = el), onSlotchange: this.syncSlots })), index.h("span", { key: '17965c7934d9256ce243a1d3a3e880716fcd42e1', class: "search-result-row__excerpt", part: "excerpt", hidden: !this.hasExcerpt }, index.h("slot", { key: '67cad2d2ea2310944cdf5a7685a1f4e3f537e683', name: "excerpt", ref: (el) => (this.excerptSlot = el), onSlotchange: this.syncSlots }))), index.h("span", { key: '43cb13c90187851fc30cc0c29847658f9f4cb069', class: "search-result-row__trailing", part: "trailing", hidden: !this.hasTrailing }, index.h("slot", { key: '2b262ad21cb605daea5e4ade8c377a60820a1f11', name: "trailing", ref: (el) => (this.trailingSlot = el), onSlotchange: this.syncSlots })))));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
UISearchResultRow.style = uiSearchResultRowCss();
|
|
46
|
+
|
|
47
|
+
exports.ui_search_result_row = UISearchResultRow;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-D07f6BOw.js');
|
|
4
|
+
|
|
5
|
+
const uiSearchShellCss = () => `:host{position:fixed;inset:0;z-index:var(--ui-search-shell-z-index, 400);display:block}.search-shell{position:absolute;inset:0;display:flex;align-items:flex-start;justify-content:center;padding-block-start:var(--ui-search-shell-padding-top, 10vh)}.search-shell__panel{position:relative;inline-size:min( calc(100% - (var(--ui-search-shell-margin-inline, var(--ui-space-4, 1rem)) * 2)), var(--ui-search-shell-max-width, 640px) );max-block-size:var(--ui-search-shell-max-height, 80vh);display:flex;flex-direction:column;overflow:hidden;background:var(--ui-search-shell-bg, var(--ui-surface, #ffffff));border:1px solid var(--ui-search-shell-border, var(--ui-border, #e5e7eb));border-radius:var(--ui-search-shell-radius, var(--ui-radius-xl, 1rem));box-shadow:var(--ui-search-shell-shadow, var(--ui-shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12)))}.search-shell__search,.search-shell__status,.search-shell__footer{flex-shrink:0}.search-shell__body{flex:1;min-block-size:0}[hidden]{display:none}@media (max-width: 767px){.search-shell{padding-block-start:0;align-items:stretch}.search-shell__panel{inline-size:100%;max-block-size:100dvh;border-radius:0;border-inline:none;border-block-start:none}}`;
|
|
6
|
+
|
|
7
|
+
function slotHasContent(slot) {
|
|
8
|
+
if (!slot) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return slot.assignedNodes({ flatten: true }).some((node) => {
|
|
12
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
13
|
+
return Boolean(node.textContent?.trim());
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const UISearchShell = class {
|
|
19
|
+
constructor(hostRef) {
|
|
20
|
+
index.registerInstance(this, hostRef);
|
|
21
|
+
}
|
|
22
|
+
hasStatus = false;
|
|
23
|
+
hasFooter = false;
|
|
24
|
+
statusSlot;
|
|
25
|
+
footerSlot;
|
|
26
|
+
componentDidLoad() {
|
|
27
|
+
this.syncSlots();
|
|
28
|
+
}
|
|
29
|
+
syncSlots = () => {
|
|
30
|
+
this.hasStatus = slotHasContent(this.statusSlot);
|
|
31
|
+
this.hasFooter = slotHasContent(this.footerSlot);
|
|
32
|
+
};
|
|
33
|
+
render() {
|
|
34
|
+
return (index.h("div", { key: '3e8fb4f419a588c441abd5bd137093ba2f730b76', class: "search-shell", part: "base" }, index.h("slot", { key: '4772932f9e077b0e4f68c50657945f3ea30afb8d', name: "backdrop" }), index.h("div", { key: 'c7877bb3ade588797d8419b3c7efc0680ac32b78', class: "search-shell__panel", part: "panel" }, index.h("div", { key: 'd1e7c16a031896187550181be63a1ca14a04b127', class: "search-shell__search", part: "search" }, index.h("slot", { key: 'b61475159d7e18a623246a2872d4897e1ff8388a', name: "search" })), index.h("div", { key: '877a9847bb453d026b5e6c117ffa8ad44562195a', class: "search-shell__status", part: "status", hidden: !this.hasStatus }, index.h("slot", { key: '6b46e668586fa97a30e2d02fc7d46d53483ecdb5', name: "status", ref: (el) => (this.statusSlot = el), onSlotchange: this.syncSlots })), index.h("div", { key: '41622e5fe3b02d8c842a6d07b66119ac68f22bc0', class: "search-shell__body", part: "body" }, index.h("slot", { key: 'f36dc433657d95bb7afa1191351bbbbeaed4f6ed', name: "body" })), index.h("div", { key: 'bcbf35d5e37c0fe48b29dde935745ea792722646', class: "search-shell__footer", part: "footer", hidden: !this.hasFooter }, index.h("slot", { key: '02f99e3442476dbefc57b3a38dc5a4ad0f3e9f00', name: "footer", ref: (el) => (this.footerSlot = el), onSlotchange: this.syncSlots })))));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
UISearchShell.style = uiSearchShellCss();
|
|
38
|
+
|
|
39
|
+
exports.ui_search_shell = UISearchShell;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-D07f6BOw.js');
|
|
4
|
+
var events = require('./events-TcQIzpNv.js');
|
|
5
|
+
|
|
6
|
+
const uiSelectCss = () => `:host{display:inline-flex;color:var(--ui-text-primary)}::slotted(select){width:100%;appearance:none;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background-color:var(--ui-surface-default);color:inherit;font:inherit;line-height:var(--ui-line-height-md);padding-block:var(--ui-select-padding-block, var(--ui-space-2));padding-inline-start:var(--ui-select-padding-inline-start, var(--ui-space-3));padding-inline-end:var(--ui-select-padding-inline-end, calc(var(--ui-space-6) + var(--ui-space-3)));margin:0;background-image:linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);background-position:calc(100% - 1rem) calc(50% - 2px), calc(100% - 0.7rem) calc(50% - 2px);background-size:0.35rem 0.35rem, 0.35rem 0.35rem;background-repeat:no-repeat;transition:border-color var(--ui-motion-fast) var(--ui-motion-ease), box-shadow var(--ui-motion-fast) var(--ui-motion-ease), background-color var(--ui-motion-fast) var(--ui-motion-ease)}::slotted(select:hover:not(:focus):not(:disabled)){border-color:var(--ui-border-strong)}::slotted(select:focus){border-color:var(--ui-focus-ring);box-shadow:0 0 0 3px var(--ui-accent-soft)}:host([data-invalid='true'])::slotted(select),::slotted(select[aria-invalid='true']){border-color:var(--ui-accent-active)}::slotted(select:disabled){background-color:var(--ui-surface-muted);color:var(--ui-text-muted);cursor:not-allowed}::slotted(select:focus-visible){outline:2px solid var(--ui-focus-ring);outline-offset:2px}::slotted(select[multiple]),::slotted(select[size]:not([size='1'])){background-image:none;padding-inline-end:var(--ui-select-padding-inline-start, var(--ui-space-3))}`;
|
|
7
|
+
|
|
8
|
+
const UISelect = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
}
|
|
12
|
+
get host() { return index.getElement(this); }
|
|
13
|
+
value = '';
|
|
14
|
+
defaultValue = '';
|
|
15
|
+
disabled = false;
|
|
16
|
+
invalid = false;
|
|
17
|
+
required = false;
|
|
18
|
+
internalValue = '';
|
|
19
|
+
slotRef;
|
|
20
|
+
syncFromProp() {
|
|
21
|
+
this.internalValue = this.value;
|
|
22
|
+
}
|
|
23
|
+
syncToSelect() {
|
|
24
|
+
const select = this.getSelect();
|
|
25
|
+
if (!select)
|
|
26
|
+
return;
|
|
27
|
+
this.host.dataset.invalid = this.invalid ? 'true' : '';
|
|
28
|
+
select.value = this.internalValue || this.defaultValue;
|
|
29
|
+
select.disabled = this.disabled;
|
|
30
|
+
select.required = this.required;
|
|
31
|
+
select.setAttribute('aria-invalid', this.invalid ? 'true' : 'false');
|
|
32
|
+
}
|
|
33
|
+
componentDidLoad() {
|
|
34
|
+
this.syncFromProp();
|
|
35
|
+
this.slotRef?.addEventListener('slotchange', () => this.syncToSelect());
|
|
36
|
+
this.syncToSelect();
|
|
37
|
+
const select = this.getSelect();
|
|
38
|
+
select?.addEventListener('input', this.onInput);
|
|
39
|
+
select?.addEventListener('change', this.onChange);
|
|
40
|
+
}
|
|
41
|
+
disconnectedCallback() {
|
|
42
|
+
const select = this.getSelect();
|
|
43
|
+
select?.removeEventListener('input', this.onInput);
|
|
44
|
+
select?.removeEventListener('change', this.onChange);
|
|
45
|
+
}
|
|
46
|
+
componentDidUpdate() {
|
|
47
|
+
this.syncToSelect();
|
|
48
|
+
}
|
|
49
|
+
getSelect() {
|
|
50
|
+
const slot = this.host.shadowRoot?.querySelector('slot');
|
|
51
|
+
const nodes = slot?.assignedElements() ?? Array.from(this.host.children);
|
|
52
|
+
return nodes.find((el) => el.tagName === 'SELECT') ?? null;
|
|
53
|
+
}
|
|
54
|
+
onInput = (e) => {
|
|
55
|
+
const select = e.target;
|
|
56
|
+
if (!select)
|
|
57
|
+
return;
|
|
58
|
+
this.internalValue = select.value;
|
|
59
|
+
events.dispatchDetail(this.host, 'input', {
|
|
60
|
+
value: this.internalValue,
|
|
61
|
+
trigger: events.eventToTrigger(e),
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
onChange = (e) => {
|
|
65
|
+
const select = this.getSelect();
|
|
66
|
+
if (!select)
|
|
67
|
+
return;
|
|
68
|
+
this.internalValue = select.value;
|
|
69
|
+
events.dispatchDetail(this.host, 'change', {
|
|
70
|
+
value: this.internalValue,
|
|
71
|
+
trigger: events.eventToTrigger(e),
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
render() {
|
|
75
|
+
return (index.h(index.Host, { key: 'eebea3f7fafafba901e5bd33cbd711565feb251e', "data-invalid": this.invalid ? '' : undefined }, index.h("slot", { key: 'bbb49202d8298fac0912accb3848c8450cab00c9', ref: (el) => (this.slotRef = el) })));
|
|
76
|
+
}
|
|
77
|
+
static get watchers() { return {
|
|
78
|
+
"value": [{
|
|
79
|
+
"syncFromProp": 0
|
|
80
|
+
}],
|
|
81
|
+
"internalValue": [{
|
|
82
|
+
"syncToSelect": 0
|
|
83
|
+
}],
|
|
84
|
+
"defaultValue": [{
|
|
85
|
+
"syncToSelect": 0
|
|
86
|
+
}],
|
|
87
|
+
"disabled": [{
|
|
88
|
+
"syncToSelect": 0
|
|
89
|
+
}],
|
|
90
|
+
"invalid": [{
|
|
91
|
+
"syncToSelect": 0
|
|
92
|
+
}],
|
|
93
|
+
"required": [{
|
|
94
|
+
"syncToSelect": 0
|
|
95
|
+
}]
|
|
96
|
+
}; }
|
|
97
|
+
};
|
|
98
|
+
UISelect.style = uiSelectCss();
|
|
99
|
+
|
|
100
|
+
exports.ui_select = UISelect;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-D07f6BOw.js');
|
|
4
|
+
var events = require('./events-TcQIzpNv.js');
|
|
5
|
+
|
|
6
|
+
const uiSwitchCss = () => `:host{display:inline-flex;align-items:center;gap:var(--ui-space-2);color:var(--ui-text-primary)}:host([aria-disabled='true']),:host([data-disabled='true']){opacity:0.6;cursor:not-allowed}:host([role='switch']){cursor:pointer}:host input[type='checkbox']{appearance:none;-webkit-appearance:none;display:block;position:relative;width:2.25rem;height:1.25rem;padding:0;border:1px solid var(--ui-border-default);border-radius:999px;background:var(--ui-surface-muted);cursor:pointer;transition:background-color var(--ui-motion-fast) var(--ui-motion-ease), border-color var(--ui-motion-fast) var(--ui-motion-ease);margin:0}:host input[type='checkbox']::after{content:'';position:absolute;top:2px;left:2px;width:0.875rem;height:0.875rem;border-radius:999px;background:var(--ui-surface-default);border:1px solid var(--ui-border-default);transition:transform var(--ui-motion-fast) var(--ui-motion-ease)}:host input[type='checkbox']:checked{background:var(--ui-accent-solid);border-color:var(--ui-accent-solid)}:host input[type='checkbox']:checked::after{transform:translateX(calc(2.25rem - 0.875rem - 4px));background:var(--ui-text-on-accent);border-color:var(--ui-text-on-accent)}:host input[type='checkbox']:focus-visible{outline:2px solid var(--ui-accent-solid);outline-offset:2px}`;
|
|
7
|
+
|
|
8
|
+
const UISwitch = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
}
|
|
12
|
+
get host() { return index.getElement(this); }
|
|
13
|
+
checked = false;
|
|
14
|
+
defaultChecked = false;
|
|
15
|
+
disabled = false;
|
|
16
|
+
required = false;
|
|
17
|
+
value = 'on';
|
|
18
|
+
internalChecked = false;
|
|
19
|
+
syncFromProp() {
|
|
20
|
+
this.internalChecked = this.checked;
|
|
21
|
+
}
|
|
22
|
+
componentDidLoad() {
|
|
23
|
+
this.syncFromProp();
|
|
24
|
+
this.internalChecked = this.internalChecked || this.defaultChecked;
|
|
25
|
+
}
|
|
26
|
+
toggle = (trigger) => {
|
|
27
|
+
if (this.disabled)
|
|
28
|
+
return;
|
|
29
|
+
this.internalChecked = !this.internalChecked;
|
|
30
|
+
events.dispatchDetail(this.host, 'change', {
|
|
31
|
+
checked: this.internalChecked,
|
|
32
|
+
value: this.value,
|
|
33
|
+
trigger,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
onKeydown = (e) => {
|
|
37
|
+
if (e.key !== ' ' || this.disabled)
|
|
38
|
+
return;
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
this.toggle('keyboard');
|
|
41
|
+
};
|
|
42
|
+
onClick = (e) => {
|
|
43
|
+
if (e.target === this.host?.shadowRoot?.querySelector('input'))
|
|
44
|
+
return;
|
|
45
|
+
this.toggle('pointer');
|
|
46
|
+
};
|
|
47
|
+
render() {
|
|
48
|
+
return (index.h(index.Host, { key: 'd4e39c8865afa98414dbedcbbff5bdeeef7f4478', role: "switch", "aria-checked": String(this.internalChecked), "aria-disabled": String(this.disabled), "data-disabled": this.disabled ? '' : undefined, tabIndex: this.disabled ? -1 : 0, onKeyDown: this.onKeydown, onClick: this.onClick }, index.h("input", { key: '498774428224b9d09a8657924d4d8b6a2196fddf', type: "checkbox", checked: this.internalChecked, disabled: this.disabled, required: this.required, value: this.value, "aria-hidden": "true", tabIndex: -1, onChange: (e) => {
|
|
49
|
+
this.internalChecked = e.target.checked;
|
|
50
|
+
events.dispatchDetail(this.host, 'change', {
|
|
51
|
+
checked: this.internalChecked,
|
|
52
|
+
value: this.value,
|
|
53
|
+
trigger: 'pointer',
|
|
54
|
+
});
|
|
55
|
+
} }), index.h("slot", { key: 'b8f8c3947a9dd058e12270b9afdfe2a654164987' })));
|
|
56
|
+
}
|
|
57
|
+
static get watchers() { return {
|
|
58
|
+
"checked": [{
|
|
59
|
+
"syncFromProp": 0
|
|
60
|
+
}]
|
|
61
|
+
}; }
|
|
62
|
+
};
|
|
63
|
+
UISwitch.style = uiSwitchCss();
|
|
64
|
+
|
|
65
|
+
exports.ui_switch = UISwitch;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-D07f6BOw.js');
|
|
4
|
+
var events = require('./events-TcQIzpNv.js');
|
|
5
|
+
|
|
6
|
+
const uiTabsCss = () => `:host{display:flex;flex-direction:column;gap:0}:host([data-orientation='vertical']){flex-direction:row}::slotted([role='tablist']){display:flex;gap:0;border-bottom:1px solid var(--ui-border-default)}:host([data-orientation='vertical']) ::slotted([role='tablist']){flex-direction:column;border-bottom:none;border-inline-end:1px solid var(--ui-border-default)}::slotted(button[role='tab']),::slotted([role='tab']),::slotted(ui-button) button[role='tab']{padding:var(--ui-space-2) var(--ui-space-3);font-size:var(--ui-font-size-sm);font-weight:var(--ui-font-medium, 500);color:var(--ui-text-secondary);background:none;border:none;border-bottom:2px solid transparent;margin-bottom:-1px;cursor:pointer;transition:color var(--ui-motion-fast) var(--ui-motion-ease);box-shadow:none}::slotted(button[role='tab']:hover),::slotted([role='tab']:hover){color:var(--ui-text-primary)}::slotted(button[role='tab'][aria-selected='true']),::slotted([role='tab'][aria-selected='true']){color:var(--ui-accent-solid);border-bottom-color:var(--ui-accent-solid)}:host([data-orientation='vertical']) ::slotted(button[role='tab']),:host([data-orientation='vertical']) ::slotted([role='tab']){border-bottom:none;border-inline-end:2px solid transparent;margin-bottom:0;margin-inline-end:-1px}:host([data-orientation='vertical']) ::slotted(button[role='tab'][aria-selected='true']),:host([data-orientation='vertical']) ::slotted([role='tab'][aria-selected='true']){border-inline-end-color:var(--ui-accent-solid)}::slotted([role='tabpanel']){padding:var(--ui-space-4)}`;
|
|
7
|
+
|
|
8
|
+
const UITabs = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
}
|
|
12
|
+
get host() { return index.getElement(this); }
|
|
13
|
+
value = '';
|
|
14
|
+
defaultValue = '';
|
|
15
|
+
orientation = 'horizontal';
|
|
16
|
+
internalValue = '';
|
|
17
|
+
syncFromProp() {
|
|
18
|
+
this.internalValue = this.value;
|
|
19
|
+
}
|
|
20
|
+
syncState() {
|
|
21
|
+
const tabs = this.getTabs();
|
|
22
|
+
if (tabs.length === 0)
|
|
23
|
+
return;
|
|
24
|
+
tabs.forEach((tab) => {
|
|
25
|
+
const tabId = tab.id ?? tab.getAttribute('aria-controls') ?? '';
|
|
26
|
+
const isSelected = tabId === this.internalValue;
|
|
27
|
+
tab.setAttribute('aria-selected', String(isSelected));
|
|
28
|
+
tab.tabIndex = isSelected ? 0 : -1;
|
|
29
|
+
const controlsId = tab.getAttribute('aria-controls');
|
|
30
|
+
if (controlsId) {
|
|
31
|
+
const panel = this.host.querySelector(`#${CSS.escape(controlsId)}`) ?? document.getElementById(controlsId);
|
|
32
|
+
if (panel) {
|
|
33
|
+
panel.hidden = !isSelected;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
componentDidLoad() {
|
|
39
|
+
this.syncFromProp();
|
|
40
|
+
if (!this.internalValue && this.defaultValue) {
|
|
41
|
+
this.internalValue = this.defaultValue;
|
|
42
|
+
}
|
|
43
|
+
if (!this.internalValue) {
|
|
44
|
+
const tabs = this.getTabs();
|
|
45
|
+
if (tabs.length > 0) {
|
|
46
|
+
this.internalValue = tabs[0]?.id ?? tabs[0]?.getAttribute('aria-controls') ?? '';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
this.syncState();
|
|
50
|
+
this.host.addEventListener('keydown', this.onKeydown);
|
|
51
|
+
this.host.addEventListener('click', this.onClick);
|
|
52
|
+
}
|
|
53
|
+
disconnectedCallback() {
|
|
54
|
+
this.host.removeEventListener('keydown', this.onKeydown);
|
|
55
|
+
this.host.removeEventListener('click', this.onClick);
|
|
56
|
+
}
|
|
57
|
+
componentDidUpdate() {
|
|
58
|
+
this.syncState();
|
|
59
|
+
}
|
|
60
|
+
getTabs() {
|
|
61
|
+
return Array.from(this.host.querySelectorAll('[role="tab"]'));
|
|
62
|
+
}
|
|
63
|
+
setValueFromTab(tab, trigger) {
|
|
64
|
+
const newValue = tab.id ?? tab.getAttribute('aria-controls') ?? '';
|
|
65
|
+
if (!newValue)
|
|
66
|
+
return;
|
|
67
|
+
const prev = this.internalValue;
|
|
68
|
+
this.internalValue = newValue;
|
|
69
|
+
this.syncState();
|
|
70
|
+
events.dispatchDetail(this.host, 'select', { value: newValue, previousValue: prev || undefined, trigger });
|
|
71
|
+
}
|
|
72
|
+
onClick = (e) => {
|
|
73
|
+
const tab = e.target.closest?.('[role="tab"]');
|
|
74
|
+
if (!tab || !this.host.contains(tab))
|
|
75
|
+
return;
|
|
76
|
+
this.setValueFromTab(tab, events.eventToTrigger(e));
|
|
77
|
+
};
|
|
78
|
+
onKeydown = (e) => {
|
|
79
|
+
const tab = e.target.closest?.('[role="tab"]');
|
|
80
|
+
if (!tab || !this.host.contains(tab))
|
|
81
|
+
return;
|
|
82
|
+
const tabs = this.getTabs();
|
|
83
|
+
if (tabs.length === 0)
|
|
84
|
+
return;
|
|
85
|
+
const currentIndex = tabs.indexOf(tab);
|
|
86
|
+
const isVertical = this.orientation === 'vertical';
|
|
87
|
+
const prevKey = isVertical ? 'ArrowUp' : 'ArrowLeft';
|
|
88
|
+
const nextKey = isVertical ? 'ArrowDown' : 'ArrowRight';
|
|
89
|
+
if (e.key === nextKey || e.key === prevKey) {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
const nextIndex = e.key === nextKey
|
|
92
|
+
? Math.min(currentIndex + 1, tabs.length - 1)
|
|
93
|
+
: currentIndex <= 0
|
|
94
|
+
? tabs.length - 1
|
|
95
|
+
: currentIndex - 1;
|
|
96
|
+
this.setValueFromTab(tabs[nextIndex], 'keyboard');
|
|
97
|
+
tabs[nextIndex].focus();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
render() {
|
|
101
|
+
return (index.h(index.Host, { key: 'd73e97facf3ffa020f349642bc6c0136f39fc463', orientation: this.orientation, "data-orientation": this.orientation }, index.h("slot", { key: 'a7bd47a4b48780ddf1f21a917fd1cb747376640b' })));
|
|
102
|
+
}
|
|
103
|
+
static get watchers() { return {
|
|
104
|
+
"value": [{
|
|
105
|
+
"syncFromProp": 0
|
|
106
|
+
}],
|
|
107
|
+
"internalValue": [{
|
|
108
|
+
"syncState": 0
|
|
109
|
+
}],
|
|
110
|
+
"orientation": [{
|
|
111
|
+
"syncState": 0
|
|
112
|
+
}]
|
|
113
|
+
}; }
|
|
114
|
+
};
|
|
115
|
+
UITabs.style = uiTabsCss();
|
|
116
|
+
|
|
117
|
+
exports.ui_tabs = UITabs;
|