@devschile/chucao 2.8.0 → 2.9.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/dist/chucao/chucao.esm.js +1 -1
- package/dist/chucao/{p-5093c486.entry.js → p-03acf096.entry.js} +2 -2
- package/dist/chucao/{p-f0c288db.entry.js → p-0ce2b15d.entry.js} +2 -2
- package/dist/chucao/{p-af088ffd.entry.js → p-10e37157.entry.js} +2 -2
- package/dist/chucao/{p-46dae34b.entry.js → p-12043dc1.entry.js} +2 -2
- package/dist/chucao/p-1dca55d6.entry.js +2 -0
- package/dist/chucao/{p-0831c6f2.entry.js.map → p-1dca55d6.entry.js.map} +1 -1
- package/dist/chucao/{p-c4d68ab7.entry.js → p-244d8e96.entry.js} +2 -2
- package/dist/chucao/{p-ba589c2f.entry.js → p-29841714.entry.js} +2 -2
- package/dist/chucao/{p-5577e0a0.entry.js → p-302ec527.entry.js} +2 -2
- package/dist/chucao/{p-25f4f815.entry.js → p-5a62951e.entry.js} +2 -2
- package/dist/chucao/{p-3e0d7585.entry.js → p-5d0ac17a.entry.js} +2 -2
- package/dist/chucao/{p-b42ec9bf.entry.js → p-5e0e1012.entry.js} +2 -2
- package/dist/chucao/{p-56e41372.entry.js → p-61a94a4e.entry.js} +2 -2
- package/dist/chucao/p-649c2cef.entry.js +2 -0
- package/dist/chucao/p-649c2cef.entry.js.map +1 -0
- package/dist/chucao/{p-eb39b9c2.entry.js → p-674c0f61.entry.js} +2 -2
- package/dist/chucao/{p-d868bdbc.entry.js → p-67f0fc77.entry.js} +2 -2
- package/dist/chucao/{p-d630f662.entry.js → p-68e4a129.entry.js} +2 -2
- package/dist/chucao/{p-b80c39c3.entry.js → p-6e345b3f.entry.js} +2 -2
- package/dist/chucao/{p-6e93c392.entry.js → p-72d4dacf.entry.js} +2 -2
- package/dist/chucao/{p-ca3179ae.entry.js → p-74d9b7e5.entry.js} +2 -2
- package/dist/chucao/{p-8b09ad3c.entry.js → p-791ce537.entry.js} +2 -2
- package/dist/chucao/{p-ad41da02.entry.js → p-79e8c10b.entry.js} +2 -2
- package/dist/chucao/{p-c98e2a50.entry.js → p-7e13f725.entry.js} +2 -2
- package/dist/chucao/{p-6c2e5931.entry.js → p-8b23d072.entry.js} +2 -2
- package/dist/chucao/{p-920d5727.entry.js → p-a5430e95.entry.js} +2 -2
- package/dist/chucao/{p-e6b7b2da.entry.js → p-a7c66879.entry.js} +2 -2
- package/dist/chucao/p-b452d6cb.entry.js +2 -0
- package/dist/chucao/{p-0d7fc720.entry.js → p-b7332faf.entry.js} +2 -2
- package/dist/chucao/{p-19d90f87.entry.js → p-f3d03388.entry.js} +2 -2
- package/dist/chucao/{p-8fcf6d36.entry.js → p-f925d45c.entry.js} +2 -2
- package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ch-alert_8.cjs.entry.js +7 -7
- package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ch-cluster.cjs.entry.js +2 -2
- package/dist/cjs/ch-combobox.cjs.entry.js +304 -0
- package/dist/cjs/ch-combobox.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-confirm-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ch-description-list.cjs.entry.js +1 -1
- package/dist/cjs/ch-divider.cjs.entry.js +1 -1
- package/dist/cjs/ch-drawer.cjs.entry.js +1 -1
- package/dist/cjs/ch-emoji.cjs.entry.js +1 -1
- package/dist/cjs/ch-empty-state.cjs.entry.js +1 -1
- package/dist/cjs/ch-grid.cjs.entry.js +1 -1
- package/dist/cjs/ch-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/ch-icon.cjs.entry.js +1 -1
- package/dist/cjs/ch-modal.cjs.entry.js +1 -1
- package/dist/cjs/ch-number-input.cjs.entry.js +2 -2
- package/dist/cjs/ch-otp-input.cjs.entry.js +2 -2
- package/dist/cjs/ch-page-header.cjs.entry.js +1 -1
- package/dist/cjs/ch-pagination.cjs.entry.js +1 -1
- package/dist/cjs/ch-radio.cjs.entry.js +1 -1
- package/dist/cjs/ch-segmented-control.cjs.entry.js +1 -1
- package/dist/cjs/ch-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/ch-stack.cjs.entry.js +1 -1
- package/dist/cjs/ch-stat.cjs.entry.js +2 -2
- package/dist/cjs/ch-table.cjs.entry.js +1 -1
- package/dist/cjs/ch-tabs.cjs.entry.js +1 -1
- package/dist/cjs/ch-textarea.cjs.entry.js +1 -1
- package/dist/cjs/ch-timeline.cjs.entry.js +1 -1
- package/dist/cjs/ch-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/chucao.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/ch-accordion/ch-accordion.js +1 -1
- package/dist/collection/components/ch-alert/ch-alert.js +1 -1
- package/dist/collection/components/ch-badge/ch-badge.js +1 -1
- package/dist/collection/components/ch-card/ch-card.js +1 -1
- package/dist/collection/components/ch-checkbox/ch-checkbox.js +1 -1
- package/dist/collection/components/ch-cluster/ch-cluster.js +2 -2
- package/dist/collection/components/ch-combobox/ch-combobox.css +153 -0
- package/dist/collection/components/ch-combobox/ch-combobox.js +577 -0
- package/dist/collection/components/ch-combobox/ch-combobox.js.map +1 -0
- package/dist/collection/components/ch-confirm-dialog/ch-confirm-dialog.js +1 -1
- package/dist/collection/components/ch-description-list/ch-description-list.js +1 -1
- package/dist/collection/components/ch-divider/ch-divider.js +1 -1
- package/dist/collection/components/ch-drawer/ch-drawer.js +1 -1
- package/dist/collection/components/ch-emoji/ch-emoji.js +1 -1
- package/dist/collection/components/ch-empty-state/ch-empty-state.js +1 -1
- package/dist/collection/components/ch-grid/ch-grid.js +1 -1
- package/dist/collection/components/ch-icon/ch-icon.js +1 -1
- package/dist/collection/components/ch-icon-button/ch-icon-button.js +1 -1
- package/dist/collection/components/ch-input/ch-input.js +1 -1
- package/dist/collection/components/ch-modal/ch-modal.js +1 -1
- package/dist/collection/components/ch-number-input/ch-number-input.js +2 -2
- package/dist/collection/components/ch-otp-input/ch-otp-input.js +2 -2
- package/dist/collection/components/ch-page-header/ch-page-header.js +1 -1
- package/dist/collection/components/ch-pagination/ch-pagination.js +1 -1
- package/dist/collection/components/ch-radio/ch-radio.js +1 -1
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +1 -1
- package/dist/collection/components/ch-select/ch-select.js +1 -1
- package/dist/collection/components/ch-skeleton/ch-skeleton.js +1 -1
- package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
- package/dist/collection/components/ch-stack/ch-stack.js +1 -1
- package/dist/collection/components/ch-stat/ch-stat.js +2 -2
- package/dist/collection/components/ch-switch/ch-switch.js +1 -1
- package/dist/collection/components/ch-table/ch-table.js +1 -1
- package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
- package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
- package/dist/collection/components/ch-timeline/ch-timeline.js +1 -1
- package/dist/collection/components/ch-tooltip/ch-tooltip.js +2 -2
- package/dist/components/ch-accordion.js +1 -1
- package/dist/components/ch-alert.js +1 -1
- package/dist/components/ch-badge.js +1 -1
- package/dist/components/ch-button.js +1 -1
- package/dist/components/ch-card.js +1 -1
- package/dist/components/ch-checkbox.js +1 -1
- package/dist/components/ch-cluster.js +1 -1
- package/dist/components/ch-combobox.d.ts +11 -0
- package/dist/components/ch-combobox.js +2 -0
- package/dist/components/ch-combobox.js.map +1 -0
- package/dist/components/ch-confirm-dialog.js +1 -1
- package/dist/components/ch-description-list.js +1 -1
- package/dist/components/ch-divider.js +1 -1
- package/dist/components/ch-drawer.js +1 -1
- package/dist/components/ch-emoji.js +1 -1
- package/dist/components/ch-empty-state.js +1 -1
- package/dist/components/ch-grid.js +1 -1
- package/dist/components/ch-icon-button.js +1 -1
- package/dist/components/ch-icon.js +1 -1
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-modal.js +1 -1
- package/dist/components/ch-number-input.js +1 -1
- package/dist/components/ch-otp-input.js +1 -1
- package/dist/components/ch-page-header.js +1 -1
- package/dist/components/ch-pagination.js +1 -1
- package/dist/components/ch-radio.js +1 -1
- package/dist/components/ch-segmented-control.js +1 -1
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-skeleton.js +1 -1
- package/dist/components/ch-spinner.js +1 -1
- package/dist/components/ch-stack.js +1 -1
- package/dist/components/ch-stat.js +1 -1
- package/dist/components/ch-switch.js +1 -1
- package/dist/components/ch-table.js +1 -1
- package/dist/components/ch-tabs.js +1 -1
- package/dist/components/ch-textarea.js +1 -1
- package/dist/components/ch-timeline.js +1 -1
- package/dist/components/ch-tooltip.js +1 -1
- package/dist/components/{p-CF1yV0aa.js → p-CuSstsTP.js} +2 -2
- package/dist/components/{p-CmMN-UuJ.js → p-MBLhKofG.js} +2 -2
- package/dist/esm/ch-accordion.entry.js +1 -1
- package/dist/esm/ch-alert_8.entry.js +7 -7
- package/dist/esm/ch-checkbox.entry.js +1 -1
- package/dist/esm/ch-cluster.entry.js +2 -2
- package/dist/esm/ch-combobox.entry.js +302 -0
- package/dist/esm/ch-combobox.entry.js.map +1 -0
- package/dist/esm/ch-confirm-dialog.entry.js +1 -1
- package/dist/esm/ch-description-list.entry.js +1 -1
- package/dist/esm/ch-divider.entry.js +1 -1
- package/dist/esm/ch-drawer.entry.js +1 -1
- package/dist/esm/ch-emoji.entry.js +1 -1
- package/dist/esm/ch-empty-state.entry.js +1 -1
- package/dist/esm/ch-grid.entry.js +1 -1
- package/dist/esm/ch-icon-button.entry.js +1 -1
- package/dist/esm/ch-icon.entry.js +1 -1
- package/dist/esm/ch-modal.entry.js +1 -1
- package/dist/esm/ch-number-input.entry.js +2 -2
- package/dist/esm/ch-otp-input.entry.js +2 -2
- package/dist/esm/ch-page-header.entry.js +1 -1
- package/dist/esm/ch-pagination.entry.js +1 -1
- package/dist/esm/ch-radio.entry.js +1 -1
- package/dist/esm/ch-segmented-control.entry.js +1 -1
- package/dist/esm/ch-skeleton.entry.js +1 -1
- package/dist/esm/ch-stack.entry.js +1 -1
- package/dist/esm/ch-stat.entry.js +2 -2
- package/dist/esm/ch-table.entry.js +1 -1
- package/dist/esm/ch-tabs.entry.js +1 -1
- package/dist/esm/ch-textarea.entry.js +1 -1
- package/dist/esm/ch-timeline.entry.js +1 -1
- package/dist/esm/ch-tooltip.entry.js +2 -2
- package/dist/esm/chucao.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ch-combobox/ch-combobox.d.ts +98 -0
- package/dist/types/components.d.ts +209 -0
- package/dist-react/components.d.ts +7 -1
- package/dist-react/components.js +12 -0
- package/dist-react/components.ts +19 -1
- package/dist-vue/index.d.ts +1 -0
- package/dist-vue/index.js +19 -0
- package/dist-vue/index.ts +21 -0
- package/hydrate/index.js +376 -39
- package/hydrate/index.mjs +376 -39
- package/package.json +5 -1
- package/dist/chucao/p-0831c6f2.entry.js +0 -2
- package/dist/chucao/p-7f99ae48.entry.js +0 -2
- /package/dist/chucao/{p-5093c486.entry.js.map → p-03acf096.entry.js.map} +0 -0
- /package/dist/chucao/{p-f0c288db.entry.js.map → p-0ce2b15d.entry.js.map} +0 -0
- /package/dist/chucao/{p-af088ffd.entry.js.map → p-10e37157.entry.js.map} +0 -0
- /package/dist/chucao/{p-46dae34b.entry.js.map → p-12043dc1.entry.js.map} +0 -0
- /package/dist/chucao/{p-c4d68ab7.entry.js.map → p-244d8e96.entry.js.map} +0 -0
- /package/dist/chucao/{p-ba589c2f.entry.js.map → p-29841714.entry.js.map} +0 -0
- /package/dist/chucao/{p-5577e0a0.entry.js.map → p-302ec527.entry.js.map} +0 -0
- /package/dist/chucao/{p-25f4f815.entry.js.map → p-5a62951e.entry.js.map} +0 -0
- /package/dist/chucao/{p-3e0d7585.entry.js.map → p-5d0ac17a.entry.js.map} +0 -0
- /package/dist/chucao/{p-b42ec9bf.entry.js.map → p-5e0e1012.entry.js.map} +0 -0
- /package/dist/chucao/{p-56e41372.entry.js.map → p-61a94a4e.entry.js.map} +0 -0
- /package/dist/chucao/{p-eb39b9c2.entry.js.map → p-674c0f61.entry.js.map} +0 -0
- /package/dist/chucao/{p-d868bdbc.entry.js.map → p-67f0fc77.entry.js.map} +0 -0
- /package/dist/chucao/{p-d630f662.entry.js.map → p-68e4a129.entry.js.map} +0 -0
- /package/dist/chucao/{p-b80c39c3.entry.js.map → p-6e345b3f.entry.js.map} +0 -0
- /package/dist/chucao/{p-6e93c392.entry.js.map → p-72d4dacf.entry.js.map} +0 -0
- /package/dist/chucao/{p-ca3179ae.entry.js.map → p-74d9b7e5.entry.js.map} +0 -0
- /package/dist/chucao/{p-8b09ad3c.entry.js.map → p-791ce537.entry.js.map} +0 -0
- /package/dist/chucao/{p-ad41da02.entry.js.map → p-79e8c10b.entry.js.map} +0 -0
- /package/dist/chucao/{p-c98e2a50.entry.js.map → p-7e13f725.entry.js.map} +0 -0
- /package/dist/chucao/{p-6c2e5931.entry.js.map → p-8b23d072.entry.js.map} +0 -0
- /package/dist/chucao/{p-920d5727.entry.js.map → p-a5430e95.entry.js.map} +0 -0
- /package/dist/chucao/{p-e6b7b2da.entry.js.map → p-a7c66879.entry.js.map} +0 -0
- /package/dist/chucao/{p-7f99ae48.entry.js.map → p-b452d6cb.entry.js.map} +0 -0
- /package/dist/chucao/{p-0d7fc720.entry.js.map → p-b7332faf.entry.js.map} +0 -0
- /package/dist/chucao/{p-19d90f87.entry.js.map → p-f3d03388.entry.js.map} +0 -0
- /package/dist/chucao/{p-8fcf6d36.entry.js.map → p-f925d45c.entry.js.map} +0 -0
- /package/dist/components/{p-CF1yV0aa.js.map → p-CuSstsTP.js.map} +0 -0
- /package/dist/components/{p-CmMN-UuJ.js.map → p-MBLhKofG.js.map} +0 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-C6khqyw3.js');
|
|
4
|
+
var validationMessage = require('./validation-message-bbtJ2sa_.js');
|
|
5
|
+
|
|
6
|
+
const chComboboxCss = () => `:host{display:block;width:100%;font-family:var(--typography-body)}:host([hidden]){display:none}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--color-text-primary)}.chips{display:flex;flex-wrap:wrap;gap:var(--spacing-xs);margin:0 0 var(--spacing-sm);padding:0;list-style:none}.chip{display:inline-flex;align-items:center;gap:var(--spacing-xs);max-width:100%;padding:var(--spacing-2xs) var(--spacing-sm);border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-sm);background:var(--color-surface-hover);font-size:var(--typography-size-sm)}.chip__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chip__remove{all:unset;cursor:pointer;padding:0 var(--spacing-2xs);border-radius:var(--radius-sm);color:var(--color-text-secondary);line-height:1}.chip__remove:focus-visible{outline:2px solid var(--color-accent-default);outline-offset:1px}.field{position:relative}.input{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-sm);background:var(--color-surface-default);color:var(--color-text-primary);font-family:inherit;font-size:var(--typography-size-md);transition:border-color var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--color-text-secondary)}.input:focus{border-color:var(--color-accent-default);outline:2px solid var(--color-accent-default);outline-offset:1px}.input:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input--invalid{border-color:var(--color-status-warning)}.listbox{position:absolute;z-index:var(--z-index-dropdown);top:calc(100% + var(--spacing-2xs));left:0;right:0;max-height:16rem;margin:0;padding:var(--spacing-2xs);overflow-y:auto;list-style:none;border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-sm);background:var(--color-surface-default);box-shadow:var(--shadow-elevate)}.listbox[hidden]{display:none}.listbox__option{padding:var(--spacing-sm) var(--spacing-md);border-radius:var(--radius-sm);font-size:var(--typography-size-sm);cursor:pointer}.listbox__option--active{background:var(--color-surface-hover);font-weight:var(--typography-weight-semibold);box-shadow:inset 2px 0 0 var(--color-accent-default)}.listbox__option--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.listbox__empty{padding:var(--spacing-sm) var(--spacing-md);font-size:var(--typography-size-sm);color:var(--color-text-secondary)}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--color-text-secondary)}.error{color:var(--color-status-warning)}`;
|
|
7
|
+
|
|
8
|
+
let comboboxIds = 0;
|
|
9
|
+
const ChCombobox = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.chChange = index.createEvent(this, "chChange");
|
|
13
|
+
this.chFilter = index.createEvent(this, "chFilter");
|
|
14
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
15
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
19
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
inputId = `ch-combobox-${++comboboxIds}`;
|
|
23
|
+
listId = `${this.inputId}-list`;
|
|
24
|
+
hintId = `${this.inputId}-hint`;
|
|
25
|
+
errorId = `${this.inputId}-error`;
|
|
26
|
+
initialValue = [];
|
|
27
|
+
internals;
|
|
28
|
+
formDisabled = false;
|
|
29
|
+
get host() { return index.getElement(this); }
|
|
30
|
+
/** Visible label, associated with the input via `for`/`id`. */
|
|
31
|
+
label;
|
|
32
|
+
/** The options to filter and choose from. */
|
|
33
|
+
options = [];
|
|
34
|
+
/** The committed value. An array when `multiple`. */
|
|
35
|
+
value;
|
|
36
|
+
/** Whether the user can pick more than one option. */
|
|
37
|
+
multiple = false;
|
|
38
|
+
/** Placeholder shown while the field is empty. */
|
|
39
|
+
placeholder;
|
|
40
|
+
/** Name submitted with the form. Repeated once per value when `multiple`. */
|
|
41
|
+
name;
|
|
42
|
+
/** Whether the field is disabled. */
|
|
43
|
+
disabled = false;
|
|
44
|
+
/** Whether at least one value is required. */
|
|
45
|
+
required = false;
|
|
46
|
+
/** Helper text, replaced by `errorMessage` when invalid. */
|
|
47
|
+
hint;
|
|
48
|
+
/** Custom error message; wins over the built-in messages. */
|
|
49
|
+
errorMessage;
|
|
50
|
+
/** Whether the field is marked invalid by the consumer. */
|
|
51
|
+
invalid = false;
|
|
52
|
+
/** Text the user has typed to filter with. */
|
|
53
|
+
query = '';
|
|
54
|
+
/** Whether the list is rendered. */
|
|
55
|
+
expanded = false;
|
|
56
|
+
/** Index into `visibleOptions` of the option under the keyboard cursor. */
|
|
57
|
+
activeIndex = -1;
|
|
58
|
+
/** Emitted whenever the committed value changes. */
|
|
59
|
+
chChange;
|
|
60
|
+
/** Emitted as the user types, with the raw query, so a consumer can filter remotely. */
|
|
61
|
+
chFilter;
|
|
62
|
+
/** The committed values as an array, whatever the mode. */
|
|
63
|
+
get selected() {
|
|
64
|
+
if (Array.isArray(this.value)) {
|
|
65
|
+
return this.value;
|
|
66
|
+
}
|
|
67
|
+
return this.value === undefined || this.value === '' ? [] : [this.value];
|
|
68
|
+
}
|
|
69
|
+
/** Options that match the current query. */
|
|
70
|
+
get visibleOptions() {
|
|
71
|
+
const query = this.query.trim().toLowerCase();
|
|
72
|
+
if (query === '') {
|
|
73
|
+
return this.options;
|
|
74
|
+
}
|
|
75
|
+
return this.options.filter(option => option.label.toLowerCase().includes(query));
|
|
76
|
+
}
|
|
77
|
+
/** Options that are still choosable: already-picked ones drop out in multiple mode. */
|
|
78
|
+
get choosable() {
|
|
79
|
+
if (!this.multiple) {
|
|
80
|
+
return this.visibleOptions;
|
|
81
|
+
}
|
|
82
|
+
const chosen = new Set(this.selected);
|
|
83
|
+
return this.visibleOptions.filter(option => !chosen.has(option.value));
|
|
84
|
+
}
|
|
85
|
+
labelFor(value) {
|
|
86
|
+
return this.options.find(option => option.value === value)?.label ?? value;
|
|
87
|
+
}
|
|
88
|
+
componentDidLoad() {
|
|
89
|
+
this.initialValue = this.selected;
|
|
90
|
+
this.syncForm();
|
|
91
|
+
this.host.addEventListener('focusout', this.handleFocusOut);
|
|
92
|
+
this.host.addEventListener('invalid', this.markTouched);
|
|
93
|
+
}
|
|
94
|
+
disconnectedCallback() {
|
|
95
|
+
this.host.removeEventListener('focusout', this.handleFocusOut);
|
|
96
|
+
}
|
|
97
|
+
markTouched = () => {
|
|
98
|
+
this.host.setAttribute('data-touched', '');
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Closing on blur is deferred: clicking an option also blurs the input, and
|
|
102
|
+
* the click must be allowed to land first.
|
|
103
|
+
*/
|
|
104
|
+
handleFocusOut = () => {
|
|
105
|
+
this.markTouched();
|
|
106
|
+
window.setTimeout(() => {
|
|
107
|
+
if (!this.host.contains(document.activeElement) && this.host.shadowRoot?.activeElement == null) {
|
|
108
|
+
this.expanded = false;
|
|
109
|
+
this.syncForm();
|
|
110
|
+
}
|
|
111
|
+
}, 0);
|
|
112
|
+
};
|
|
113
|
+
syncForm() {
|
|
114
|
+
const internals = this.internals;
|
|
115
|
+
if (typeof internals?.setFormValue !== 'function') {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const values = this.selected;
|
|
119
|
+
// Multiple entries are submitted once per value, the way a multi-select does.
|
|
120
|
+
if (this.multiple) {
|
|
121
|
+
const data = new FormData();
|
|
122
|
+
for (const entry of values) {
|
|
123
|
+
data.append(this.name ?? '', entry);
|
|
124
|
+
}
|
|
125
|
+
internals.setFormValue(values.length === 0 ? null : data);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
internals.setFormValue(values[0] ?? '');
|
|
129
|
+
}
|
|
130
|
+
const { flags, message } = validationMessage.resolveValidity({
|
|
131
|
+
required: this.required,
|
|
132
|
+
empty: values.length === 0,
|
|
133
|
+
invalid: this.invalid,
|
|
134
|
+
errorMessage: this.errorMessage,
|
|
135
|
+
});
|
|
136
|
+
internals.setValidity(flags, message);
|
|
137
|
+
}
|
|
138
|
+
formResetCallback() {
|
|
139
|
+
this.value = this.multiple ? [...this.initialValue] : (this.initialValue[0] ?? '');
|
|
140
|
+
this.query = '';
|
|
141
|
+
this.syncForm();
|
|
142
|
+
const input = this.host.shadowRoot?.querySelector('.input');
|
|
143
|
+
if (input) {
|
|
144
|
+
input.value = '';
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
formDisabledCallback(isDisabled) {
|
|
148
|
+
this.formDisabled = isDisabled;
|
|
149
|
+
}
|
|
150
|
+
commit(value) {
|
|
151
|
+
if (this.multiple) {
|
|
152
|
+
const next = this.selected.includes(value) ? this.selected : [...this.selected, value];
|
|
153
|
+
this.value = next;
|
|
154
|
+
this.query = '';
|
|
155
|
+
const input = this.host.shadowRoot?.querySelector('.input');
|
|
156
|
+
if (input) {
|
|
157
|
+
input.value = '';
|
|
158
|
+
}
|
|
159
|
+
// Keep the list open: choosing again is the common case here.
|
|
160
|
+
this.activeIndex = -1;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
this.value = value;
|
|
164
|
+
this.query = this.labelFor(value);
|
|
165
|
+
this.expanded = false;
|
|
166
|
+
this.activeIndex = -1;
|
|
167
|
+
}
|
|
168
|
+
this.chChange.emit(this.value);
|
|
169
|
+
this.syncForm();
|
|
170
|
+
}
|
|
171
|
+
remove(value) {
|
|
172
|
+
const next = this.selected.filter(entry => entry !== value);
|
|
173
|
+
this.value = this.multiple ? next : '';
|
|
174
|
+
this.chChange.emit(this.value);
|
|
175
|
+
this.syncForm();
|
|
176
|
+
}
|
|
177
|
+
open() {
|
|
178
|
+
if (this.disabled || this.formDisabled) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this.expanded = true;
|
|
182
|
+
}
|
|
183
|
+
moveActive(delta) {
|
|
184
|
+
const count = this.choosable.length;
|
|
185
|
+
if (count === 0) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const next = this.activeIndex + delta;
|
|
189
|
+
this.activeIndex = next < 0 ? count - 1 : next >= count ? 0 : next;
|
|
190
|
+
}
|
|
191
|
+
handleInput = (event) => {
|
|
192
|
+
const input = event.target;
|
|
193
|
+
this.query = input.value;
|
|
194
|
+
this.expanded = true;
|
|
195
|
+
this.activeIndex = this.choosable.length > 0 ? 0 : -1;
|
|
196
|
+
// Single mode shows a typed-but-uncommitted value as no value at all.
|
|
197
|
+
if (!this.multiple && this.value !== undefined && this.value !== this.labelFor(this.selected[0] ?? '')) {
|
|
198
|
+
this.value = '';
|
|
199
|
+
}
|
|
200
|
+
this.chFilter.emit(this.query);
|
|
201
|
+
};
|
|
202
|
+
handleKeyDown = (event) => {
|
|
203
|
+
if (event.key === 'ArrowDown') {
|
|
204
|
+
event.preventDefault();
|
|
205
|
+
this.open();
|
|
206
|
+
this.moveActive(1);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (event.key === 'ArrowUp') {
|
|
210
|
+
event.preventDefault();
|
|
211
|
+
this.open();
|
|
212
|
+
this.moveActive(-1);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (event.key === 'Enter') {
|
|
216
|
+
const option = this.choosable[this.activeIndex];
|
|
217
|
+
if (this.expanded && option && !option.disabled) {
|
|
218
|
+
event.preventDefault();
|
|
219
|
+
this.commit(option.value);
|
|
220
|
+
}
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (event.key === 'Escape' && this.expanded) {
|
|
224
|
+
event.preventDefault();
|
|
225
|
+
this.expanded = false;
|
|
226
|
+
this.activeIndex = -1;
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
// Backspace in an empty multiple field removes the last chip.
|
|
230
|
+
if (event.key === 'Backspace' && this.multiple && this.query === '') {
|
|
231
|
+
const last = this.selected[this.selected.length - 1];
|
|
232
|
+
if (last !== undefined) {
|
|
233
|
+
event.preventDefault();
|
|
234
|
+
this.remove(last);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
handleFocus = () => {
|
|
239
|
+
this.open();
|
|
240
|
+
};
|
|
241
|
+
handleBlur = () => {
|
|
242
|
+
// A single-mode field shows the chosen label, not what was typed.
|
|
243
|
+
const input = this.host.shadowRoot?.querySelector('.input');
|
|
244
|
+
if (input && !this.multiple) {
|
|
245
|
+
this.query = '';
|
|
246
|
+
input.value = this.selected.length > 0 ? this.labelFor(this.selected[0]) : '';
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
get isInvalid() {
|
|
250
|
+
return this.invalid || (this.host.hasAttribute('data-touched') && this.selected.length === 0 && this.required);
|
|
251
|
+
}
|
|
252
|
+
get describedBy() {
|
|
253
|
+
if (this.isInvalid && this.errorMessage) {
|
|
254
|
+
return this.errorId;
|
|
255
|
+
}
|
|
256
|
+
return this.hint ? this.hintId : undefined;
|
|
257
|
+
}
|
|
258
|
+
/** The option id for `aria-activedescendant`. */
|
|
259
|
+
optionId(index) {
|
|
260
|
+
return `${this.inputId}-option-${index}`;
|
|
261
|
+
}
|
|
262
|
+
render() {
|
|
263
|
+
const options = this.choosable;
|
|
264
|
+
const active = this.activeIndex >= 0 && this.activeIndex < options.length ? options[this.activeIndex] : undefined;
|
|
265
|
+
const chosen = this.selected;
|
|
266
|
+
const showError = this.isInvalid && this.errorMessage;
|
|
267
|
+
return (index.h(index.Host, { key: '783df95d2970b0db5c6f839fb0acbaa7582301f0' }, this.label && (index.h("label", { key: '232933c04601d543b391d15603f1dcfafa2f6e73', class: "label", htmlFor: this.inputId }, this.label)), this.multiple && chosen.length > 0 && (index.h("ul", { key: 'e7e92805f42a9a97d0587463f0b68fa79368cc6b', class: "chips", "aria-label": "Selected values" }, chosen.map(entry => (index.h("li", { class: "chip", key: entry }, index.h("span", { class: "chip__label" }, this.labelFor(entry)), index.h("button", { type: "button", class: "chip__remove", "aria-label": `Remove ${this.labelFor(entry)}`, onClick: () => this.remove(entry) }, index.h("span", { "aria-hidden": "true" }, "\u00D7"))))))), index.h("div", { key: '076bd78c0c43327c298baf37e9411d68e6b03734', class: "field" }, index.h("input", { key: '0e2caa28567ea21d8b5a98a8b1ed949e07731e09', id: this.label && !this.multiple ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid }, type: "text", role: "combobox", autocomplete: "off", "aria-expanded": this.expanded ? 'true' : 'false', "aria-controls": this.listId, "aria-autocomplete": "list", "aria-activedescendant": active ? this.optionId(this.activeIndex) : undefined, "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-describedby": this.describedBy, name: this.name, disabled: this.disabled || this.formDisabled, required: this.required, placeholder: chosen.length === 0 ? this.placeholder : undefined, value: this.multiple ? this.query : this.query || (chosen[0] !== undefined ? this.labelFor(chosen[0]) : ''), onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }), index.h("ul", { key: '5f843aef03c09ff9dd1e02c3da90f6e9dbcca858', class: "listbox", id: this.listId, role: "listbox", "aria-multiselectable": this.multiple ? 'true' : undefined, hidden: !this.expanded }, options.length === 0 && (index.h("li", { key: '1bb282438f1889da96af7d27b504e31ab19088e5', class: "listbox__empty", role: "presentation" }, "No results")), options.map((option, index$1) => (index.h("li", { class: {
|
|
268
|
+
'listbox__option': true,
|
|
269
|
+
'listbox__option--active': index$1 === this.activeIndex,
|
|
270
|
+
'listbox__option--disabled': option.disabled === true,
|
|
271
|
+
}, id: this.optionId(index$1), key: option.value, role: "option", "aria-selected": this.multiple ? 'false' : chosen[0] === option.value ? 'true' : 'false', "aria-disabled": option.disabled ? 'true' : undefined,
|
|
272
|
+
// Pointer-down commits before the input's blur closes the list.
|
|
273
|
+
onMouseDown: event => {
|
|
274
|
+
event.preventDefault();
|
|
275
|
+
if (!option.disabled) {
|
|
276
|
+
this.commit(option.value);
|
|
277
|
+
}
|
|
278
|
+
} }, option.label))))), this.hint && !showError && (index.h("p", { key: 'dc7f8a5d26e55d2d7836bf72a5359a6c0fbe0220', class: "hint", id: this.hintId }, this.hint)), showError && (index.h("p", { key: 'd3d9beaa0eb9d830b2c9f3082ea0bf0490efe3ee', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
279
|
+
}
|
|
280
|
+
static get formAssociated() { return true; }
|
|
281
|
+
static get watchers() { return {
|
|
282
|
+
"value": [{
|
|
283
|
+
"syncForm": 0
|
|
284
|
+
}],
|
|
285
|
+
"required": [{
|
|
286
|
+
"syncForm": 0
|
|
287
|
+
}],
|
|
288
|
+
"invalid": [{
|
|
289
|
+
"syncForm": 0
|
|
290
|
+
}],
|
|
291
|
+
"errorMessage": [{
|
|
292
|
+
"syncForm": 0
|
|
293
|
+
}],
|
|
294
|
+
"multiple": [{
|
|
295
|
+
"syncForm": 0
|
|
296
|
+
}]
|
|
297
|
+
}; }
|
|
298
|
+
};
|
|
299
|
+
ChCombobox.style = chComboboxCss();
|
|
300
|
+
|
|
301
|
+
exports.ch_combobox = ChCombobox;
|
|
302
|
+
//# sourceMappingURL=ch-combobox.entry.cjs.js.map
|
|
303
|
+
|
|
304
|
+
//# sourceMappingURL=ch-combobox.cjs.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"ch-combobox.cjs.entry.js","mappings":";;;;;AAAA,MAAM,aAAa,GAAG,MAAM,CAAC,0qFAA0qF,CAAC;;ACYxsF,IAAI,WAAW,GAAG,CAAC;MAyBN,UAAU,GAAA,MAAA;;;;;;;;;;;;;AACJ,IAAA,OAAO,GAAG,CAAA,YAAA,EAAe,EAAE,WAAW,EAAE;AACxC,IAAA,MAAM,GAAG,CAAA,EAAG,IAAI,CAAC,OAAO,OAAO;AAC/B,IAAA,MAAM,GAAG,CAAA,EAAG,IAAI,CAAC,OAAO,OAAO;AAC/B,IAAA,OAAO,GAAG,CAAA,EAAG,IAAI,CAAC,OAAO,QAAQ;IAC1C,YAAY,GAAa,EAAE;AAEhB,IAAA,SAAS;IACnB,YAAY,GAAG,KAAK;;;AAIrB,IAAA,KAAK;;IAGL,OAAO,GAAuB,EAAE;;AAGf,IAAA,KAAK;;IAGL,QAAQ,GAAG,KAAK;;A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Host","index"],"sources":["src/components/ch-combobox/ch-combobox.css?tag=ch-combobox&encapsulation=shadow","src/components/ch-combobox/ch-combobox.tsx"],"sourcesContent":[":host {\n display: block;\n width: 100%;\n font-family: var(--typography-body);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.label {\n display: block;\n margin-bottom: var(--spacing-sm);\n font-size: var(--typography-size-sm);\n font-weight: var(--typography-weight-semibold);\n color: var(--color-text-primary);\n}\n\n.chips {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-xs);\n margin: 0 0 var(--spacing-sm);\n padding: 0;\n list-style: none;\n}\n\n.chip {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-xs);\n max-width: 100%;\n padding: var(--spacing-2xs) var(--spacing-sm);\n border: var(--border-width) solid var(--color-border-default);\n border-radius: var(--radius-sm);\n background: var(--color-surface-hover);\n font-size: var(--typography-size-sm);\n}\n\n.chip__label {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.chip__remove {\n all: unset;\n cursor: pointer;\n padding: 0 var(--spacing-2xs);\n border-radius: var(--radius-sm);\n color: var(--color-text-secondary);\n line-height: 1;\n}\n\n.chip__remove:focus-visible {\n outline: 2px solid var(--color-accent-default);\n outline-offset: 1px;\n}\n\n/* The list is positioned against the field, not the viewport: a dropdown that\n * is part of a form flow should move with it, unlike a tooltip. */\n.field {\n position: relative;\n}\n\n.input {\n box-sizing: border-box;\n width: 100%;\n padding: var(--spacing-xl) var(--spacing-3xl);\n border: var(--border-width) solid var(--color-border-default);\n border-radius: var(--radius-sm);\n background: var(--color-surface-default);\n color: var(--color-text-primary);\n font-family: inherit;\n font-size: var(--typography-size-md);\n transition: border-color var(--duration-normal) var(--easing-default);\n}\n\n.input::placeholder {\n color: var(--color-text-secondary);\n}\n\n.input:focus {\n border-color: var(--color-accent-default);\n outline: 2px solid var(--color-accent-default);\n outline-offset: 1px;\n}\n\n.input:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.input--invalid {\n border-color: var(--color-status-warning);\n}\n\n.listbox {\n position: absolute;\n z-index: var(--z-index-dropdown);\n top: calc(100% + var(--spacing-2xs));\n left: 0;\n right: 0;\n max-height: 16rem;\n margin: 0;\n padding: var(--spacing-2xs);\n overflow-y: auto;\n list-style: none;\n border: var(--border-width) solid var(--color-border-default);\n border-radius: var(--radius-sm);\n background: var(--color-surface-default);\n box-shadow: var(--shadow-elevate);\n}\n\n.listbox[hidden] {\n display: none;\n}\n\n.listbox__option {\n padding: var(--spacing-sm) var(--spacing-md);\n border-radius: var(--radius-sm);\n font-size: var(--typography-size-sm);\n cursor: pointer;\n}\n\n/* The active option is marked by a rule and weight, not only a tint. */\n.listbox__option--active {\n background: var(--color-surface-hover);\n font-weight: var(--typography-weight-semibold);\n box-shadow: inset 2px 0 0 var(--color-accent-default);\n}\n\n.listbox__option--disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.listbox__empty {\n padding: var(--spacing-sm) var(--spacing-md);\n font-size: var(--typography-size-sm);\n color: var(--color-text-secondary);\n}\n\n.hint,\n.error {\n margin: var(--spacing-sm) 0 0;\n font-size: var(--typography-size-sm);\n color: var(--color-text-secondary);\n}\n\n.error {\n color: var(--color-status-warning);\n}\n","import { AttachInternals, Component, Element, Event, type EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\nimport { resolveValidity } from '../../utils/validation-message';\n\nexport interface ChComboboxOption {\n label: string;\n value: string;\n disabled?: boolean;\n /** Optional grouping label; consecutive options with the same group are announced together. */\n group?: string;\n}\n\nlet comboboxIds = 0;\n\n/**\n * A text field that filters a list of options and commits a choice.\n *\n * The input is a native `<input>` rather than `ch-input`: the combobox role\n * and its `aria-*` state have to sit on the element that owns the interaction,\n * and ARIA does not forward through a wrapper component.\n *\n * Single and multiple are one component. `multiple` changes the value shape\n * (`string` vs `string[]`), renders the chosen values as removable chips, and\n * keeps the list open after a pick; single commits and closes. Everything else\n * — filtering, the active option, keyboard behaviour, validity — is shared, so\n * the two cannot drift apart.\n *\n * The consumer owns the options and, if it fetches them, their ordering: this\n * component never sorts, debounces or requests anything. It filters what it is\n * given, and reports what the user asked for.\n */\n@Component({\n tag: 'ch-combobox',\n styleUrl: 'ch-combobox.css',\n shadow: true,\n formAssociated: true,\n})\nexport class ChCombobox {\n private readonly inputId = `ch-combobox-${++comboboxIds}`;\n private readonly listId = `${this.inputId}-list`;\n private readonly hintId = `${this.inputId}-hint`;\n private readonly errorId = `${this.inputId}-error`;\n private initialValue: string[] = [];\n\n @AttachInternals() internals!: ElementInternals;\n @State() formDisabled = false;\n @Element() private host!: HTMLElement;\n\n /** Visible label, associated with the input via `for`/`id`. */\n @Prop() label?: string;\n\n /** The options to filter and choose from. */\n @Prop() options: ChComboboxOption[] = [];\n\n /** The committed value. An array when `multiple`. */\n @Prop({ mutable: true }) value?: string | string[];\n\n /** Whether the user can pick more than one option. */\n @Prop({ reflect: true }) multiple = false;\n\n /** Placeholder shown while the field is empty. */\n @Prop() placeholder?: string;\n\n /** Name submitted with the form. Repeated once per value when `multiple`. */\n @Prop({ reflect: true }) name?: string;\n\n /** Whether the field is disabled. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Whether at least one value is required. */\n @Prop({ reflect: true }) required = false;\n\n /** Helper text, replaced by `errorMessage` when invalid. */\n @Prop() hint?: string;\n\n /** Custom error message; wins over the built-in messages. */\n @Prop() errorMessage?: string;\n\n /** Whether the field is marked invalid by the consumer. */\n @Prop() invalid = false;\n\n /** Text the user has typed to filter with. */\n @State() private query = '';\n\n /** Whether the list is rendered. */\n @State() private expanded = false;\n\n /** Index into `visibleOptions` of the option under the keyboard cursor. */\n @State() private activeIndex = -1;\n\n /** Emitted whenever the committed value changes. */\n @Event() chChange: EventEmitter<string | string[]>;\n\n /** Emitted as the user types, with the raw query, so a consumer can filter remotely. */\n @Event() chFilter: EventEmitter<string>;\n\n /** The committed values as an array, whatever the mode. */\n private get selected(): string[] {\n if (Array.isArray(this.value)) {\n return this.value;\n }\n return this.value === undefined || this.value === '' ? [] : [this.value];\n }\n\n /** Options that match the current query. */\n private get visibleOptions(): ChComboboxOption[] {\n const query = this.query.trim().toLowerCase();\n if (query === '') {\n return this.options;\n }\n return this.options.filter(option => option.label.toLowerCase().includes(query));\n }\n\n /** Options that are still choosable: already-picked ones drop out in multiple mode. */\n private get choosable(): ChComboboxOption[] {\n if (!this.multiple) {\n return this.visibleOptions;\n }\n const chosen = new Set(this.selected);\n return this.visibleOptions.filter(option => !chosen.has(option.value));\n }\n\n private labelFor(value: string): string {\n return this.options.find(option => option.value === value)?.label ?? value;\n }\n\n componentDidLoad() {\n this.initialValue = this.selected;\n this.syncForm();\n this.host.addEventListener('focusout', this.handleFocusOut);\n this.host.addEventListener('invalid', this.markTouched);\n }\n\n disconnectedCallback() {\n this.host.removeEventListener('focusout', this.handleFocusOut);\n }\n\n private markTouched = (): void => {\n this.host.setAttribute('data-touched', '');\n };\n\n /**\n * Closing on blur is deferred: clicking an option also blurs the input, and\n * the click must be allowed to land first.\n */\n private handleFocusOut = () => {\n this.markTouched();\n window.setTimeout(() => {\n if (!this.host.contains(document.activeElement) && this.host.shadowRoot?.activeElement == null) {\n this.expanded = false;\n this.syncForm();\n }\n }, 0);\n };\n\n @Watch('value')\n @Watch('required')\n @Watch('invalid')\n @Watch('errorMessage')\n @Watch('multiple')\n protected syncForm(): void {\n const internals = this.internals;\n if (typeof internals?.setFormValue !== 'function') {\n return;\n }\n const values = this.selected;\n // Multiple entries are submitted once per value, the way a multi-select does.\n if (this.multiple) {\n const data = new FormData();\n for (const entry of values) {\n data.append(this.name ?? '', entry);\n }\n internals.setFormValue(values.length === 0 ? null : data);\n } else {\n internals.setFormValue(values[0] ?? '');\n }\n\n const { flags, message } = resolveValidity({\n required: this.required,\n empty: values.length === 0,\n invalid: this.invalid,\n errorMessage: this.errorMessage,\n });\n internals.setValidity(flags, message);\n }\n\n formResetCallback(): void {\n this.value = this.multiple ? [...this.initialValue] : (this.initialValue[0] ?? '');\n this.query = '';\n this.syncForm();\n const input = this.host.shadowRoot?.querySelector('.input') as HTMLInputElement | null;\n if (input) {\n input.value = '';\n }\n }\n\n formDisabledCallback(isDisabled: boolean): void {\n this.formDisabled = isDisabled;\n }\n\n private commit(value: string) {\n if (this.multiple) {\n const next = this.selected.includes(value) ? this.selected : [...this.selected, value];\n this.value = next;\n this.query = '';\n const input = this.host.shadowRoot?.querySelector('.input') as HTMLInputElement | null;\n if (input) {\n input.value = '';\n }\n // Keep the list open: choosing again is the common case here.\n this.activeIndex = -1;\n } else {\n this.value = value;\n this.query = this.labelFor(value);\n this.expanded = false;\n this.activeIndex = -1;\n }\n this.chChange.emit(this.value as string | string[]);\n this.syncForm();\n }\n\n private remove(value: string) {\n const next = this.selected.filter(entry => entry !== value);\n this.value = this.multiple ? next : '';\n this.chChange.emit(this.value as string | string[]);\n this.syncForm();\n }\n\n private open() {\n if (this.disabled || this.formDisabled) {\n return;\n }\n this.expanded = true;\n }\n\n private moveActive(delta: number) {\n const count = this.choosable.length;\n if (count === 0) {\n return;\n }\n const next = this.activeIndex + delta;\n this.activeIndex = next < 0 ? count - 1 : next >= count ? 0 : next;\n }\n\n private handleInput = (event: InputEvent) => {\n const input = event.target as HTMLInputElement;\n this.query = input.value;\n this.expanded = true;\n this.activeIndex = this.choosable.length > 0 ? 0 : -1;\n // Single mode shows a typed-but-uncommitted value as no value at all.\n if (!this.multiple && this.value !== undefined && this.value !== this.labelFor(this.selected[0] ?? '')) {\n this.value = '';\n }\n this.chFilter.emit(this.query);\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.open();\n this.moveActive(1);\n return;\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.open();\n this.moveActive(-1);\n return;\n }\n if (event.key === 'Enter') {\n const option = this.choosable[this.activeIndex];\n if (this.expanded && option && !option.disabled) {\n event.preventDefault();\n this.commit(option.value);\n }\n return;\n }\n if (event.key === 'Escape' && this.expanded) {\n event.preventDefault();\n this.expanded = false;\n this.activeIndex = -1;\n return;\n }\n // Backspace in an empty multiple field removes the last chip.\n if (event.key === 'Backspace' && this.multiple && this.query === '') {\n const last = this.selected[this.selected.length - 1];\n if (last !== undefined) {\n event.preventDefault();\n this.remove(last);\n }\n }\n };\n\n private handleFocus = () => {\n this.open();\n };\n\n private handleBlur = () => {\n // A single-mode field shows the chosen label, not what was typed.\n const input = this.host.shadowRoot?.querySelector('.input') as HTMLInputElement | null;\n if (input && !this.multiple) {\n this.query = '';\n input.value = this.selected.length > 0 ? this.labelFor(this.selected[0]) : '';\n }\n };\n\n private get isInvalid(): boolean {\n return this.invalid || (this.host.hasAttribute('data-touched') && this.selected.length === 0 && this.required);\n }\n\n private get describedBy(): string | undefined {\n if (this.isInvalid && this.errorMessage) {\n return this.errorId;\n }\n return this.hint ? this.hintId : undefined;\n }\n\n /** The option id for `aria-activedescendant`. */\n private optionId(index: number): string {\n return `${this.inputId}-option-${index}`;\n }\n\n render() {\n const options = this.choosable;\n const active = this.activeIndex >= 0 && this.activeIndex < options.length ? options[this.activeIndex] : undefined;\n const chosen = this.selected;\n const showError = this.isInvalid && this.errorMessage;\n\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.inputId}>\n {this.label}\n </label>\n )}\n {this.multiple && chosen.length > 0 && (\n <ul class=\"chips\" aria-label=\"Selected values\">\n {chosen.map(entry => (\n <li class=\"chip\" key={entry}>\n <span class=\"chip__label\">{this.labelFor(entry)}</span>\n <button type=\"button\" class=\"chip__remove\" aria-label={`Remove ${this.labelFor(entry)}`} onClick={() => this.remove(entry)}>\n <span aria-hidden=\"true\">×</span>\n </button>\n </li>\n ))}\n </ul>\n )}\n <div class=\"field\">\n <input\n id={this.label && !this.multiple ? this.inputId : undefined}\n class={{ 'input': true, 'input--invalid': this.isInvalid }}\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n aria-expanded={this.expanded ? 'true' : 'false'}\n aria-controls={this.listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={active ? this.optionId(this.activeIndex) : undefined}\n aria-invalid={this.isInvalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n name={this.name}\n disabled={this.disabled || this.formDisabled}\n required={this.required}\n placeholder={chosen.length === 0 ? this.placeholder : undefined}\n value={this.multiple ? this.query : this.query || (chosen[0] !== undefined ? this.labelFor(chosen[0]) : '')}\n onInput={this.handleInput}\n onKeyDown={this.handleKeyDown}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n <ul class=\"listbox\" id={this.listId} role=\"listbox\" aria-multiselectable={this.multiple ? 'true' : undefined} hidden={!this.expanded}>\n {options.length === 0 && (\n <li class=\"listbox__empty\" role=\"presentation\">\n No results\n </li>\n )}\n {options.map((option, index) => (\n <li\n class={{\n 'listbox__option': true,\n 'listbox__option--active': index === this.activeIndex,\n 'listbox__option--disabled': option.disabled === true,\n }}\n id={this.optionId(index)}\n key={option.value}\n role=\"option\"\n aria-selected={this.multiple ? 'false' : chosen[0] === option.value ? 'true' : 'false'}\n aria-disabled={option.disabled ? 'true' : undefined}\n // Pointer-down commits before the input's blur closes the list.\n onMouseDown={event => {\n event.preventDefault();\n if (!option.disabled) {\n this.commit(option.value);\n }\n }}\n >\n {option.label}\n </li>\n ))}\n </ul>\n </div>\n {this.hint && !showError && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {showError && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -122,7 +122,7 @@ const ChConfirmDialog = class {
|
|
|
122
122
|
this.cancelButton?.focus();
|
|
123
123
|
}
|
|
124
124
|
render() {
|
|
125
|
-
return (index.h(index.Host, { key: '
|
|
125
|
+
return (index.h(index.Host, { key: 'b51a806f4cca331fc3a95421d3342608c6e0df4c', onKeyDown: this.handleKeyDown }, index.h("ch-modal", { key: '453db02cd724bc9bf2ed7c4b61bcf04c77b8d449', open: this.open, label: this.heading, size: "sm", onChClose: this.handleModalClose, onChOpen: () => this.onOpening() }, index.h("h2", { key: '1dee8f11ee68679792c394506ab2e8a7f98b852b', slot: "heading", class: "confirm__heading" }, this.heading), this.message && index.h("p", { key: 'f2a8a473acfcdfee51600a0dc7bc47b85f4a0889', class: "confirm__message" }, this.message), index.h("div", { key: '7ecfa78e4df217e38519f115fdcb4761ed88937d', class: "confirm__actions" }, index.h("button", { key: '0c4a117caee9ef316932e2eea9c0aa3734f0bbee', class: { 'confirm__button': true, 'confirm__button--cancel': true }, type: "button", ref: el => (this.cancelButton = el), disabled: this.pending, onClick: this.handleCancel }, this.cancelLabel), index.h("button", { key: 'd33fd5f6f218bfcd39f179e29d757f7f9bdcae30', class: { 'confirm__button': true, 'confirm__button--confirm': true, 'confirm__button--danger': this.tone === 'danger' }, type: "button", ref: el => (this.confirmButton = el), disabled: this.pending, "aria-busy": this.pending ? 'true' : undefined, onClick: this.handleConfirm }, this.confirmLabel)))));
|
|
126
126
|
}
|
|
127
127
|
static get watchers() { return {
|
|
128
128
|
"open": [{
|
|
@@ -18,7 +18,7 @@ const ChDescriptionList = class {
|
|
|
18
18
|
return COLUMNS.has(this.columns) ? this.columns : '1';
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
return (index.h(index.Host, { key: '
|
|
21
|
+
return (index.h(index.Host, { key: '1fd1228705a78196b618efc4b9665de038663ae5' }, index.h("dl", { key: '0b724aa3c5dec011106347d9d29d0420f723012f', class: `list list--columns-${this.columnCount}` }, index.h("slot", { key: '4da2c6965568cf7d2f93ee98e131a7bede26d5dc' }))));
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
ChDescriptionList.style = chDescriptionListCss();
|
|
@@ -13,7 +13,7 @@ const ChDivider = class {
|
|
|
13
13
|
*/
|
|
14
14
|
orientation = 'horizontal';
|
|
15
15
|
render() {
|
|
16
|
-
return (index.h(index.Host, { key: '
|
|
16
|
+
return (index.h(index.Host, { key: 'cc193b7e7229de8ff96eb056bd345cc8d666004b', class: { 'divider--vertical': this.orientation === 'vertical' } }, index.h("hr", { key: '659320c0372d208aab9b13d471427e479499a72c', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
ChDivider.style = chDividerCss();
|
|
@@ -138,7 +138,7 @@ const ChDrawer = class {
|
|
|
138
138
|
this.chClose.emit();
|
|
139
139
|
};
|
|
140
140
|
render() {
|
|
141
|
-
return (index.h(index.Host, { key: '
|
|
141
|
+
return (index.h(index.Host, { key: '1a51b3f19b956fe860fe4def9f2ac23eac7f86ac' }, index.h("dialog", { key: 'ad7366eb2e6274962faa2a1564a06ecc3268329c', class: { drawer: true, [`drawer--${this.side}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, index.h("div", { key: 'ce532be71c35234f1713051e5669f1cf9316031e', class: "drawer-head" }, index.h("slot", { key: 'b522a8f26dddefd2aaf146134ac24e026a5eb72a', name: "header" }), this.closeLabel && (index.h("button", { key: 'b51fb4e20797cd82661c72c9250b0875338180f0', class: "drawer-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, index.h("span", { key: 'dd21e30fcb74f08c80b1c2ba79696e1d54bf4c26', "aria-hidden": "true" }, "\u00D7")))), index.h("div", { key: 'eacafa24e5af7c107e09a7cbfdfc93ae6f373dc5', class: "drawer-body" }, index.h("slot", { key: 'ddf9370c27956bc2954a3af29064394d37ec5e67' })), index.h("slot", { key: '0065c8f5bafb14791e63d15bbec0ec2ba533c222', name: "footer" }))));
|
|
142
142
|
}
|
|
143
143
|
static get watchers() { return {
|
|
144
144
|
"open": [{
|
|
@@ -84,7 +84,7 @@ const ChEmoji = class {
|
|
|
84
84
|
this.loaded = true;
|
|
85
85
|
};
|
|
86
86
|
render() {
|
|
87
|
-
return (index.h(index.Host, { key: '
|
|
87
|
+
return (index.h(index.Host, { key: 'd6e224a01b95fdebb4525b30b326585ee96e1050' }, index.h("img", { key: '6bc232d8f25e0099c9e2794f15b8e47f6c2dbb22', class: {
|
|
88
88
|
'emoji': true,
|
|
89
89
|
[`emoji--${this.size}`]: true,
|
|
90
90
|
'emoji--hidden': !this.loaded,
|
|
@@ -23,7 +23,7 @@ const ChEmptyState = class {
|
|
|
23
23
|
*/
|
|
24
24
|
size = 'md';
|
|
25
25
|
render() {
|
|
26
|
-
return (index.h(index.Host, { key: '
|
|
26
|
+
return (index.h(index.Host, { key: '15a171d5e6128b278078f3564fe27a75f2d3638f', class: { 'empty-state': true, [`empty-state--${this.size}`]: true } }, index.h("div", { key: '959baade697f5817d46fe2ef1e08b31d1f14168d', class: "empty-state__inner" }, index.h("div", { key: 'c97f9d6405da2d81e538701c48e12acbb6bbbd76', class: "empty-state__icon", "aria-hidden": "true" }, index.h("slot", { key: 'abb50aae0a68ff11b5042a51cdb8d7f69d965ae8', name: "icon" })), index.h("h3", { key: '2049c3cb4714b642670ba283f8c3c9e3e1ba6ae4', class: "empty-state__title" }, this.title), this.description && index.h("p", { key: 'b74601952c870aab10345c7bdc856dc779396645', class: "empty-state__description" }, this.description), index.h("div", { key: 'c72be9f5a4f40113d1c6df1d62c9b617e8dcb407', class: "empty-state__actions" }, index.h("slot", { key: 'c998904407c1cf174921873e3d547c2056f3d1b5' })))));
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
ChEmptyState.style = chEmptyStateCss();
|
|
@@ -48,7 +48,7 @@ const ChGrid = class {
|
|
|
48
48
|
this.el.style.setProperty('--ch-grid-columns', template);
|
|
49
49
|
}
|
|
50
50
|
render() {
|
|
51
|
-
return (index.h(index.Host, { key: '
|
|
51
|
+
return (index.h(index.Host, { key: '4fbcd3b5e563ebf0f5b2878ef6af0cb2d1c0f427', class: { grid: true, [`grid--gap-${this.gapStep}`]: true } }, index.h("slot", { key: '4fe1548392ab44de9dd895129d77f20650a0d929' })));
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
ChGrid.style = chGridCss();
|
|
@@ -40,7 +40,7 @@ const ChIconButton = class {
|
|
|
40
40
|
};
|
|
41
41
|
render() {
|
|
42
42
|
const shapes = this.name ? icons.chIcons[this.name] : undefined;
|
|
43
|
-
return (index.h(index.Host, { key: '
|
|
43
|
+
return (index.h(index.Host, { key: '585bbba80a0811664fcc2fa8fd625cd8655e3395' }, index.h("button", { key: 'd817e9eda842b824a052be9b822c860b9417ddd4', class: `button button--${this.size}`, type: this.type, "aria-label": this.label, "aria-busy": this.loading ? 'true' : undefined, "aria-disabled": this.disabled ? 'true' : undefined, onClick: this.handleClick }, index.h("svg", { key: '2f0278d9f551da6b526c3fe5a6680cd38080502e', class: "icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true", focusable: "false" }, (shapes ?? []).map(shape => index.h(shape.tag, shape.attrs))))));
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
ChIconButton.style = chIconButtonCss();
|
|
@@ -27,7 +27,7 @@ const ChIcon = class {
|
|
|
27
27
|
render() {
|
|
28
28
|
const shapes = this.name ? icons.chIcons[this.name] : undefined;
|
|
29
29
|
const decorative = !this.label;
|
|
30
|
-
return (index.h(index.Host, { key: '
|
|
30
|
+
return (index.h(index.Host, { key: 'c55af60731d59ee48bfb2566f498c5675c36cb04' }, index.h("svg", { key: '65334ba063c059ef2a505c7ea34859d1d1971f01', class: `icon icon--${this.size}`, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", role: decorative ? undefined : 'img', "aria-label": this.label, "aria-hidden": decorative ? 'true' : undefined, focusable: "false" }, (shapes ?? []).map(shape => index.h(shape.tag, shape.attrs)))));
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
ChIcon.style = chIconCss();
|
|
@@ -140,7 +140,7 @@ const ChModal = class {
|
|
|
140
140
|
this.chClose.emit();
|
|
141
141
|
};
|
|
142
142
|
render() {
|
|
143
|
-
return (index.h(index.Host, { key: '
|
|
143
|
+
return (index.h(index.Host, { key: '36395dc0b52676493b93d02c04d1c810d98c8028' }, index.h("dialog", { key: '99d446c5d0ecd9e16f8d36fc2903f1ab06c274f2', class: { modal: true, [`modal--${this.size}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, index.h("div", { key: '9dd7043302df7ffa89fdb44f54ed5c93a48fff7e', class: "modal-head" }, index.h("slot", { key: '473041c868d2234c66276936cde0d020b8ed74ce', name: "heading" }), this.closeLabel && (index.h("button", { key: 'e3f65a8c91283b8f3a27975afe44e47e65fbf03f', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, index.h("span", { key: 'dbacf11f6b06ed4183e6d277fc807d63867fdf1d', "aria-hidden": "true" }, "\u00D7")))), index.h("div", { key: '1d9e1567fe0046078f1d26f5dea25c3c06c7e6ed', class: "modal-body" }, index.h("slot", { key: 'cc0a63c64b512a6c40c59d8395ced225a961adfc' })))));
|
|
144
144
|
}
|
|
145
145
|
static get watchers() { return {
|
|
146
146
|
"open": [{
|
|
@@ -205,10 +205,10 @@ const ChNumberInput = class {
|
|
|
205
205
|
}
|
|
206
206
|
render() {
|
|
207
207
|
const showError = this.isInvalid && this.errorMessage;
|
|
208
|
-
return (index.h(index.Host, { key: '
|
|
208
|
+
return (index.h(index.Host, { key: '0265106cccf730338541d292be247b7853ab00cf' }, this.label && (index.h("label", { key: '17293d5cc55a8d4de0cd544ea1f508d1ed820b12', class: "label", htmlFor: this.inputId }, this.label)), index.h("input", { key: 'ce17dc7c0f5c1064d8535aef942e486a46b72188', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid },
|
|
209
209
|
// `text` with `inputmode`, not `type="number"`: a number input drops
|
|
210
210
|
// partial values and cannot show grouped digits.
|
|
211
|
-
type: "text", inputMode: this.decimals ? 'decimal' : 'numeric', name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.typing ? this.draft : this.formatDisplay(this.value), "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange, onBlur: this.handleBlur }), this.hint && !showError && (index.h("p", { key: '
|
|
211
|
+
type: "text", inputMode: this.decimals ? 'decimal' : 'numeric', name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.typing ? this.draft : this.formatDisplay(this.value), "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange, onBlur: this.handleBlur }), this.hint && !showError && (index.h("p", { key: '37611a7755f6885e6f87a600b1a27cc5edd5fefd', class: "hint", id: this.hintId }, this.hint)), showError && (index.h("p", { key: '68b8c5b964a2a98df493103b1fde088aeefda769', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
212
212
|
}
|
|
213
213
|
static get formAssociated() { return true; }
|
|
214
214
|
static get watchers() { return {
|
|
@@ -161,10 +161,10 @@ const ChOtpInput = class {
|
|
|
161
161
|
}
|
|
162
162
|
render() {
|
|
163
163
|
const showError = this.isInvalid && this.errorMessage;
|
|
164
|
-
return (index.h(index.Host, { key: '
|
|
164
|
+
return (index.h(index.Host, { key: '1ce9d8e77463ecb270b870461ef96f8e84f418df' }, this.label && (index.h("label", { key: 'd19c88141314b68912c91af235d45eceaa12555b', class: "label", htmlFor: this.inputId }, this.label)), index.h("input", { key: 'e2e93f1672fa753b3b20bc032abc6e375591cf3f', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid }, type: this.secret ? 'password' : 'text', inputMode: this.inputMode,
|
|
165
165
|
// The platform fills a single field carrying this attribute; per-digit
|
|
166
166
|
// inputs never receive the SMS code.
|
|
167
|
-
autocomplete: "one-time-code", autocapitalize: this.inputMode === 'text' ? 'characters' : 'off', spellcheck: false, name: this.name, placeholder: this.placeholder, maxLength: this.length, disabled: this.disabled || this.formDisabled, required: this.required, value: this.value, "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onBlur: this.handleBlur }), this.hint && !showError && (index.h("p", { key: '
|
|
167
|
+
autocomplete: "one-time-code", autocapitalize: this.inputMode === 'text' ? 'characters' : 'off', spellcheck: false, name: this.name, placeholder: this.placeholder, maxLength: this.length, disabled: this.disabled || this.formDisabled, required: this.required, value: this.value, "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onBlur: this.handleBlur }), this.hint && !showError && (index.h("p", { key: 'f02aa008051c1c0d64bba7045fb72d8c89ebaddd', class: "hint", id: this.hintId }, this.hint)), showError && (index.h("p", { key: 'ff9dc44ff5de84fd100fe617677ad18ab898fe1e', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
168
168
|
}
|
|
169
169
|
static get formAssociated() { return true; }
|
|
170
170
|
static get watchers() { return {
|
|
@@ -34,7 +34,7 @@ const ChPageHeader = class {
|
|
|
34
34
|
actionsStacked = false;
|
|
35
35
|
render() {
|
|
36
36
|
const Heading = this.headingLevel;
|
|
37
|
-
return (index.h(index.Host, { key: '
|
|
37
|
+
return (index.h(index.Host, { key: '482cd87ddc139731c8b09ba6441231657aae0fcd' }, index.h("div", { key: '9b4d97c14cc6c88d926e4384c6e85df097fdd4ac', class: { 'header': true, 'header--stacked': this.actionsStacked } }, index.h("div", { key: '55daa00350e1204e7a80cc7ee9d1efad49bc517f', class: "header-text" }, this.eyebrow && index.h("p", { key: 'f30b06834abcc2c6e4aca65b56d6860e8a242dfe', class: "header-eyebrow" }, this.eyebrow), index.h(Heading, { key: '2f0c4b1e6608403ce1b4d9316247d6012c4c810f', class: "header-title" }, this.title), this.description && index.h("p", { key: '28633505d6dcc8346a34010e85664d48bc8b019b', class: "header-description" }, this.description)), index.h("div", { key: '1bda14e777cc0744a9391ea64accb9d2c734dfc2', class: "header-actions" }, index.h("slot", { key: '7869965c1649dfc6ffa0e019e84d6785344187d2', name: "actions" })))));
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
ChPageHeader.style = chPageHeaderCss();
|
|
@@ -56,7 +56,7 @@ const ChPagination = class {
|
|
|
56
56
|
const atStart = this.page <= 1;
|
|
57
57
|
const atEnd = count === 0 || this.page >= count;
|
|
58
58
|
const blocked = this.disabled || count === 0;
|
|
59
|
-
return (index.h(index.Host, { key: '
|
|
59
|
+
return (index.h(index.Host, { key: 'c5091d1a0791a1e0a87fb483ae026484d2aa6c6a' }, index.h("nav", { key: 'f70132cdc0ebd3f08d6b712b843bc5a36b20d355', class: { pager: true, [`pager--${this.size}`]: true }, "aria-label": this.label }, index.h("button", { key: '3aebe1cce9b909f8b5977f231bd540121fc95f50', class: "pager__button", type: "button", disabled: blocked || atStart, onClick: () => this.go(this.page - 1), "aria-label": "Previous page" }, index.h("span", { key: 'e68021c2356a38c6a79ecf79a9a7cbcd9063e6cf', "aria-hidden": "true" }, "\u2039")), index.h("p", { key: 'd615f3d94d3c5c9a4232ca50ddf1fc8113eb932e', class: "pager__summary", id: this.labelId, "aria-live": "polite" }, count === 0 ? 'No results' : `${this.firstRow}–${this.lastRow} of ${this.total}`), index.h("button", { key: '0724d97b05c7fe1ef2501317bd28218fa4d8c440', class: "pager__button", type: "button", disabled: blocked || atEnd, onClick: () => this.go(this.page + 1), "aria-label": "Next page" }, index.h("span", { key: '05cbf13c2be6ccc33e4a517b995a22113306883b', "aria-hidden": "true" }, "\u203A")))));
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
ChPagination.style = chPaginationCss();
|
|
@@ -114,7 +114,7 @@ const ChRadio = class {
|
|
|
114
114
|
}
|
|
115
115
|
render() {
|
|
116
116
|
const groupName = this.name || `${this.groupId}-group`;
|
|
117
|
-
return (index.h(index.Host, { key: '
|
|
117
|
+
return (index.h(index.Host, { key: '51bc6a2d4ff9a098889dc65b55afdb7e70a65d5b' }, this.label && (index.h("span", { key: '0e043e7f3e5a8b48e700975e84c7d5a3515b645a', class: "group-label", id: this.labelId }, this.label)), index.h("div", { key: '70853bba1a97cae044ef799a892049f32eb4d61c', class: "radio-group", role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (index.h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, index.h("input", { class: { 'input': true, 'input--invalid': this.invalid }, type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), index.h("span", { class: "mark" }), index.h("span", { class: "label-text" }, option.label))))), this.hint && !(this.invalid && this.errorMessage) && (index.h("p", { key: 'cb17c2fc139bb933acf2fc8080e10ee0466c1b68', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (index.h("p", { key: 'de2406de9bec97f248c3252a9acd9c1ab0c745e0', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
118
118
|
}
|
|
119
119
|
static get formAssociated() { return true; }
|
|
120
120
|
static get watchers() { return {
|
|
@@ -93,7 +93,7 @@ const ChSegmentedControl = class {
|
|
|
93
93
|
}
|
|
94
94
|
render() {
|
|
95
95
|
const groupName = this.name || `${this.groupId}-group`;
|
|
96
|
-
return (index.h(index.Host, { key: '
|
|
96
|
+
return (index.h(index.Host, { key: '2380775f9f3448f173db291ee69b95cbbe77d12b' }, this.label && (index.h("span", { key: 'fe3f47b45547039550c1581b6aec30b45cf01296', class: "group-label", id: this.labelId }, this.label)), index.h("div", { key: 'fe42cb7bd8a7a675211a0a2637d8b023d12874a4', class: { segmented: true, [`segmented--${this.size}`]: true }, role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (index.h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, index.h("input", { class: "input", type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, onChange: this.handleChange }), index.h("span", { class: "label-text" }, option.label)))))));
|
|
97
97
|
}
|
|
98
98
|
static get formAssociated() { return true; }
|
|
99
99
|
static get watchers() { return {
|
|
@@ -47,7 +47,7 @@ const ChSkeleton = class {
|
|
|
47
47
|
return { width: this.width, height: this.height };
|
|
48
48
|
}
|
|
49
49
|
render() {
|
|
50
|
-
return (index.h(index.Host, { key: '
|
|
50
|
+
return (index.h(index.Host, { key: '0a4de76c2f5d591ccdc128d41412fd99d5b0f191', "aria-hidden": "true", class: { 'skeleton': true, [`skeleton--${this.shape}`]: true, 'skeleton--animated': this.animated } }, Array.from({ length: this.items }).map((value, index$1) => (index.h("span", { class: "skeleton__item", style: this.sizeStyle, key: index$1, "data-index": String(value) })))));
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
ChSkeleton.style = chSkeletonCss();
|
|
@@ -26,7 +26,7 @@ const ChStack = class {
|
|
|
26
26
|
return GAPS.has(this.gap) ? this.gap : 'md';
|
|
27
27
|
}
|
|
28
28
|
render() {
|
|
29
|
-
return (index.h(index.Host, { key: '
|
|
29
|
+
return (index.h(index.Host, { key: 'd9947ce1a6c5b06b8e83d458a9b4a71032e1f8a7', class: { stack: true, [`stack--gap-${this.gapStep}`]: true, [`stack--align-${this.align}`]: true, [`stack--justify-${this.justify}`]: true } }, index.h("slot", { key: '2698e4850b1fd63367d1b7f55dacd1e0e3ae2b3c' })));
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
ChStack.style = chStackCss();
|