@devschile/chucao 2.1.0 → 2.2.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-d5a9e340.entry.js → p-077dc2a6.entry.js} +2 -2
- package/dist/chucao/{p-4bc8e098.entry.js → p-079c2017.entry.js} +2 -2
- package/dist/chucao/p-37e7f9cc.entry.js +2 -0
- package/dist/chucao/p-37e7f9cc.entry.js.map +1 -0
- package/dist/chucao/{p-121fbfc8.entry.js → p-5ae89a19.entry.js} +2 -2
- package/dist/chucao/p-70285203.entry.js +2 -0
- package/dist/chucao/p-70285203.entry.js.map +1 -0
- package/dist/chucao/{p-5fe8bfff.entry.js → p-9c072600.entry.js} +2 -2
- package/dist/chucao/p-b678a7e2.entry.js +2 -0
- package/dist/chucao/p-b678a7e2.entry.js.map +1 -0
- package/dist/chucao/p-b8bd0310.entry.js +2 -0
- package/dist/chucao/p-b8bd0310.entry.js.map +1 -0
- package/dist/chucao/p-bb2445d1.entry.js +2 -0
- package/dist/chucao/{p-9bb81a65.entry.js → p-c986036f.entry.js} +2 -2
- package/dist/chucao/p-d8DfpzMR.js +2 -0
- package/dist/chucao/p-d8DfpzMR.js.map +1 -0
- package/dist/chucao/{p-1b1e56cd.entry.js → p-e3265e38.entry.js} +2 -2
- package/dist/cjs/ch-alert_8.cjs.entry.js +54 -11
- package/dist/cjs/ch-alert_8.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ch-divider.cjs.entry.js +1 -1
- package/dist/cjs/ch-drawer.cjs.entry.js +153 -0
- package/dist/cjs/ch-drawer.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-emoji.cjs.entry.js +1 -1
- package/dist/cjs/ch-modal.cjs.entry.js +4 -23
- package/dist/cjs/ch-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-radio.cjs.entry.js +1 -1
- package/dist/cjs/ch-segmented-control.cjs.entry.js +112 -0
- package/dist/cjs/ch-segmented-control.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-tabs.cjs.entry.js +1 -1
- package/dist/cjs/ch-textarea.cjs.entry.js +1 -1
- package/dist/cjs/ch-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/chucao.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/scroll-lock-DIRqLP4K.js +49 -0
- package/dist/cjs/scroll-lock-DIRqLP4K.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/ch-button/ch-button.css +56 -18
- package/dist/collection/components/ch-button/ch-button.js +135 -8
- package/dist/collection/components/ch-button/ch-button.js.map +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-divider/ch-divider.js +1 -1
- package/dist/collection/components/ch-drawer/ch-drawer.css +152 -0
- package/dist/collection/components/ch-drawer/ch-drawer.js +285 -0
- package/dist/collection/components/ch-drawer/ch-drawer.js.map +1 -0
- package/dist/collection/components/ch-emoji/ch-emoji.js +1 -1
- package/dist/collection/components/ch-input/ch-input.js +1 -1
- package/dist/collection/components/ch-modal/ch-modal.js +4 -23
- package/dist/collection/components/ch-modal/ch-modal.js.map +1 -1
- package/dist/collection/components/ch-radio/ch-radio.js +1 -1
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.css +88 -0
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +295 -0
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.js.map +1 -0
- package/dist/collection/components/ch-select/ch-select.js +1 -1
- package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
- package/dist/collection/components/ch-switch/ch-switch.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-tooltip/ch-tooltip.js +1 -1
- package/dist/collection/utils/scroll-lock.js +42 -0
- package/dist/collection/utils/scroll-lock.js.map +1 -0
- package/dist/components/ch-button.js +1 -1
- package/dist/components/ch-button.js.map +1 -1
- package/dist/components/ch-card.js +1 -1
- package/dist/components/ch-checkbox.js +1 -1
- package/dist/components/ch-divider.js +1 -1
- package/dist/components/ch-drawer.d.ts +11 -0
- package/dist/components/ch-drawer.js +2 -0
- package/dist/components/ch-drawer.js.map +1 -0
- package/dist/components/ch-emoji.js +1 -1
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-modal.js +1 -1
- package/dist/components/ch-modal.js.map +1 -1
- package/dist/components/ch-radio.js +1 -1
- package/dist/components/ch-segmented-control.d.ts +11 -0
- package/dist/components/ch-segmented-control.js +2 -0
- package/dist/components/ch-segmented-control.js.map +1 -0
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-spinner.js +1 -1
- package/dist/components/ch-spinner.js.map +1 -1
- package/dist/components/ch-switch.js +1 -1
- package/dist/components/ch-tabs.js +1 -1
- package/dist/components/ch-textarea.js +1 -1
- package/dist/components/ch-tooltip.js +1 -1
- package/dist/components/p-C4eGmLcE.js +2 -0
- package/dist/components/p-C4eGmLcE.js.map +1 -0
- package/dist/components/p-d8DfpzMR.js +2 -0
- package/dist/components/p-d8DfpzMR.js.map +1 -0
- package/dist/esm/ch-alert_8.entry.js +54 -11
- package/dist/esm/ch-alert_8.entry.js.map +1 -1
- package/dist/esm/ch-checkbox.entry.js +1 -1
- package/dist/esm/ch-divider.entry.js +1 -1
- package/dist/esm/ch-drawer.entry.js +151 -0
- package/dist/esm/ch-drawer.entry.js.map +1 -0
- package/dist/esm/ch-emoji.entry.js +1 -1
- package/dist/esm/ch-modal.entry.js +4 -23
- package/dist/esm/ch-modal.entry.js.map +1 -1
- package/dist/esm/ch-radio.entry.js +1 -1
- package/dist/esm/ch-segmented-control.entry.js +110 -0
- package/dist/esm/ch-segmented-control.entry.js.map +1 -0
- package/dist/esm/ch-tabs.entry.js +1 -1
- package/dist/esm/ch-textarea.entry.js +1 -1
- package/dist/esm/ch-tooltip.entry.js +1 -1
- package/dist/esm/chucao.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/scroll-lock-d8DfpzMR.js +46 -0
- package/dist/esm/scroll-lock-d8DfpzMR.js.map +1 -0
- package/dist/types/components/ch-button/ch-button.d.ts +29 -5
- package/dist/types/components/ch-drawer/ch-drawer.d.ts +68 -0
- package/dist/types/components/ch-segmented-control/ch-segmented-control.d.ts +72 -0
- package/dist/types/components.d.ts +333 -6
- package/dist/types/utils/scroll-lock.d.ts +17 -0
- package/dist-react/components.d.ts +12 -1
- package/dist-react/components.js +21 -0
- package/dist-react/components.ts +31 -1
- package/dist-vue/index.d.ts +2 -0
- package/dist-vue/index.js +29 -0
- package/dist-vue/index.ts +33 -0
- package/hydrate/index.js +418 -41
- package/hydrate/index.mjs +418 -41
- package/package.json +4 -3
- package/dist/chucao/p-11083711.entry.js +0 -2
- package/dist/chucao/p-11083711.entry.js.map +0 -1
- package/dist/chucao/p-2ab4a6a8.entry.js +0 -2
- package/dist/chucao/p-a955eebf.entry.js +0 -2
- package/dist/chucao/p-a955eebf.entry.js.map +0 -1
- /package/dist/chucao/{p-d5a9e340.entry.js.map → p-077dc2a6.entry.js.map} +0 -0
- /package/dist/chucao/{p-4bc8e098.entry.js.map → p-079c2017.entry.js.map} +0 -0
- /package/dist/chucao/{p-121fbfc8.entry.js.map → p-5ae89a19.entry.js.map} +0 -0
- /package/dist/chucao/{p-5fe8bfff.entry.js.map → p-9c072600.entry.js.map} +0 -0
- /package/dist/chucao/{p-2ab4a6a8.entry.js.map → p-bb2445d1.entry.js.map} +0 -0
- /package/dist/chucao/{p-9bb81a65.entry.js.map → p-c986036f.entry.js.map} +0 -0
- /package/dist/chucao/{p-1b1e56cd.entry.js.map → p-e3265e38.entry.js.map} +0 -0
package/hydrate/index.js
CHANGED
|
@@ -5461,7 +5461,7 @@ class ChBadge {
|
|
|
5461
5461
|
}; }
|
|
5462
5462
|
}
|
|
5463
5463
|
|
|
5464
|
-
const chButtonCss = () => `:host{display:inline-block}.btn{display:inline-flex;align-items:center;gap:var(--spacing-sm);border:
|
|
5464
|
+
const chButtonCss = () => `:host{display:inline-block}.btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--spacing-sm);box-sizing:border-box;border:var(--border-width) solid transparent;border-radius:var(--radius-pill);cursor:pointer;font-family:inherit;font-weight:var(--typography-weight-bold);text-decoration:none;line-height:1.2;transition:background-color var(--duration-normal) var(--easing-default), border-color var(--duration-normal) var(--easing-default), color var(--duration-normal) var(--easing-default), transform var(--duration-fast) var(--easing-default)}.btn--sm{padding:var(--spacing-2xs) var(--spacing-lg);font-size:var(--typography-size-sm)}.btn--md{padding:var(--spacing-xs) var(--spacing-xl);font-size:inherit}.btn--lg{padding:var(--spacing-sm) var(--spacing-2xl);font-size:var(--typography-size-lg)}.btn:disabled,.btn--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.btn--loading:disabled,.btn--loading.btn--disabled{opacity:1;cursor:progress}.btn:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.btn--primary{background-color:var(--accent);color:var(--color-accent-text)}.btn--primary:hover:not(:disabled){background-color:var(--accent-hover);transform:translateY(calc(-1 * var(--spacing-elevate)))}.btn--secondary{background-color:transparent;color:var(--text);border-color:var(--border)}.btn--secondary:hover:not(:disabled){border-color:var(--border-hover);background-color:var(--surface-hover);transform:translateY(calc(-1 * var(--spacing-elevate)))}.btn--ghost{background-color:transparent;color:var(--text)}.btn--ghost:hover:not(:disabled){background-color:var(--surface-hover)}.btn--danger{background-color:var(--color-status-warning);color:var(--bg)}.btn--danger:hover:not(:disabled){filter:brightness(0.92);transform:translateY(calc(-1 * var(--spacing-elevate)))}`;
|
|
5465
5465
|
|
|
5466
5466
|
class ChButton {
|
|
5467
5467
|
constructor(hostRef) {
|
|
@@ -5469,17 +5469,38 @@ class ChButton {
|
|
|
5469
5469
|
this.chClick = createEvent(this, "chClick");
|
|
5470
5470
|
}
|
|
5471
5471
|
/**
|
|
5472
|
-
* The visual style of the button.
|
|
5472
|
+
* The visual style of the button. One of `primary`, `secondary`, `ghost`,
|
|
5473
|
+
* or `danger`.
|
|
5473
5474
|
*/
|
|
5474
5475
|
variant = 'primary';
|
|
5476
|
+
/**
|
|
5477
|
+
* The size of the button. One of `sm`, `md`, or `lg`.
|
|
5478
|
+
*/
|
|
5479
|
+
size = 'md';
|
|
5475
5480
|
/**
|
|
5476
5481
|
* Whether the button is disabled.
|
|
5477
5482
|
*/
|
|
5478
5483
|
disabled = false;
|
|
5479
5484
|
/**
|
|
5480
|
-
*
|
|
5481
|
-
*
|
|
5482
|
-
|
|
5485
|
+
* Whether the button is loading. Shows a spinner, disables interaction, and
|
|
5486
|
+
* announces the busy state with `aria-busy`.
|
|
5487
|
+
*/
|
|
5488
|
+
loading = false;
|
|
5489
|
+
/**
|
|
5490
|
+
* When set, the button renders as an `<a>` pointing to this URL while
|
|
5491
|
+
* keeping the button styling.
|
|
5492
|
+
*/
|
|
5493
|
+
href;
|
|
5494
|
+
/**
|
|
5495
|
+
* The browsing context the link opens in (e.g. `_blank`). Only used when
|
|
5496
|
+
* `href` is set. For `_blank`, a `noopener noreferrer` `rel` is added
|
|
5497
|
+
* automatically.
|
|
5498
|
+
*/
|
|
5499
|
+
target;
|
|
5500
|
+
/**
|
|
5501
|
+
* Accessible label set as `aria-label` on the native element. Use it when
|
|
5502
|
+
* the button's content doesn't convey its purpose on its own (e.g. an
|
|
5503
|
+
* icon-only button).
|
|
5483
5504
|
*/
|
|
5484
5505
|
label;
|
|
5485
5506
|
/**
|
|
@@ -5487,10 +5508,32 @@ class ChButton {
|
|
|
5487
5508
|
*/
|
|
5488
5509
|
chClick;
|
|
5489
5510
|
handleClick = (ev) => {
|
|
5511
|
+
if (this.disabled || this.loading) {
|
|
5512
|
+
ev.preventDefault();
|
|
5513
|
+
return;
|
|
5514
|
+
}
|
|
5490
5515
|
this.chClick.emit(ev);
|
|
5491
5516
|
};
|
|
5517
|
+
get spinnerSize() {
|
|
5518
|
+
return this.size === 'lg' ? 'md' : 'sm';
|
|
5519
|
+
}
|
|
5520
|
+
renderContent() {
|
|
5521
|
+
return [this.loading ? hAsync("ch-spinner", { size: this.spinnerSize }) : hAsync("slot", { name: "start" }), hAsync("slot", null), hAsync("slot", { name: "end" })];
|
|
5522
|
+
}
|
|
5492
5523
|
render() {
|
|
5493
|
-
|
|
5524
|
+
const classes = {
|
|
5525
|
+
'btn': true,
|
|
5526
|
+
[`btn--${this.variant}`]: true,
|
|
5527
|
+
[`btn--${this.size}`]: true,
|
|
5528
|
+
'btn--loading': this.loading,
|
|
5529
|
+
};
|
|
5530
|
+
if (this.href && !this.disabled && !this.loading) {
|
|
5531
|
+
return (hAsync(Host, null, hAsync("a", { class: classes, href: this.href, target: this.target, rel: this.target === '_blank' ? 'noopener noreferrer' : undefined, "aria-label": this.label, onClick: this.handleClick }, this.renderContent())));
|
|
5532
|
+
}
|
|
5533
|
+
if (this.href) {
|
|
5534
|
+
return (hAsync(Host, null, hAsync("span", { class: { ...classes, 'btn--disabled': true }, "aria-label": this.label, "aria-disabled": "true", "aria-busy": this.loading ? 'true' : undefined }, this.renderContent())));
|
|
5535
|
+
}
|
|
5536
|
+
return (hAsync(Host, null, hAsync("button", { class: classes, type: "button", disabled: this.disabled || this.loading, "aria-label": this.label, "aria-busy": this.loading ? 'true' : undefined, onClick: this.handleClick }, this.renderContent())));
|
|
5494
5537
|
}
|
|
5495
5538
|
static get style() { return chButtonCss(); }
|
|
5496
5539
|
static get cmpMeta() { return {
|
|
@@ -5498,7 +5541,11 @@ class ChButton {
|
|
|
5498
5541
|
"$tagName$": "ch-button",
|
|
5499
5542
|
"$members$": {
|
|
5500
5543
|
"variant": [1],
|
|
5544
|
+
"size": [1],
|
|
5501
5545
|
"disabled": [4],
|
|
5546
|
+
"loading": [4],
|
|
5547
|
+
"href": [1],
|
|
5548
|
+
"target": [1],
|
|
5502
5549
|
"label": [1]
|
|
5503
5550
|
},
|
|
5504
5551
|
"$listeners$": undefined,
|
|
@@ -5514,7 +5561,7 @@ class ChCard {
|
|
|
5514
5561
|
registerInstance(this, hostRef);
|
|
5515
5562
|
}
|
|
5516
5563
|
render() {
|
|
5517
|
-
return (hAsync(Host, { key: '
|
|
5564
|
+
return (hAsync(Host, { key: '7e2833cdc6f37c6b8577c17677840913fb7cd9e1' }, hAsync("div", { key: '223c291e98af73ee2c299b8649773cfcf54388d7', class: "card" }, hAsync("slot", { key: 'e948386bcd492c31e264d50cf27d26e98dd771eb' }))));
|
|
5518
5565
|
}
|
|
5519
5566
|
static get style() { return chCardCss(); }
|
|
5520
5567
|
static get cmpMeta() { return {
|
|
@@ -5638,7 +5685,7 @@ class ChCheckbox {
|
|
|
5638
5685
|
return undefined;
|
|
5639
5686
|
}
|
|
5640
5687
|
render() {
|
|
5641
|
-
return (hAsync(Host, { key: '
|
|
5688
|
+
return (hAsync(Host, { key: '4011f5a338d2b006a0bfa8217d1ee9b01b987d7d' }, hAsync("label", { key: '8c6c8d6c530d366b26f0cb602dc1e987ed8324d5', class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled }, htmlFor: this.checkboxId }, hAsync("input", { key: 'c1f58eeba34ae5d5371e863f349433852fc3c882', id: this.checkboxId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled || this.formDisabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), this.label && hAsync("span", { key: '447812e11253c951cb6a5003adda13357fc6dec3', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '5369375f8dd0c2fa787207f8fcef4feeb78ddda6', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'e90274e1df8d205053effe57ceb56f8e8b4deca2', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
5642
5689
|
}
|
|
5643
5690
|
static get formAssociated() { return true; }
|
|
5644
5691
|
static get watchers() { return {
|
|
@@ -5688,7 +5735,7 @@ class ChDivider {
|
|
|
5688
5735
|
*/
|
|
5689
5736
|
orientation = 'horizontal';
|
|
5690
5737
|
render() {
|
|
5691
|
-
return (hAsync(Host, { key: '
|
|
5738
|
+
return (hAsync(Host, { key: '26aa4586507d821e539adcf1e057467654c19491', class: { 'divider--vertical': this.orientation === 'vertical' } }, hAsync("hr", { key: '599b22093ffe91c87899d84ad8c63ab6279107cb', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
|
|
5692
5739
|
}
|
|
5693
5740
|
static get style() { return chDividerCss(); }
|
|
5694
5741
|
static get cmpMeta() { return {
|
|
@@ -5703,6 +5750,218 @@ class ChDivider {
|
|
|
5703
5750
|
}; }
|
|
5704
5751
|
}
|
|
5705
5752
|
|
|
5753
|
+
let openOverlays = 0;
|
|
5754
|
+
let previousOverflow = '';
|
|
5755
|
+
let previousPaddingRight = '';
|
|
5756
|
+
/**
|
|
5757
|
+
* Prevents the page behind an overlay from scrolling, compensating for the
|
|
5758
|
+
* scrollbar it removes so the layout does not shift.
|
|
5759
|
+
*
|
|
5760
|
+
* Reference-counted on a module-level counter, so concurrent overlays (a modal
|
|
5761
|
+
* over a drawer, several stacked dialogs) cannot unlock the page early:
|
|
5762
|
+
* whichever overlay closes first only decrements the count, and the last one
|
|
5763
|
+
* restores the original styles.
|
|
5764
|
+
*
|
|
5765
|
+
* Callers must pair every `lockScroll()` with exactly one `unlockScroll()`.
|
|
5766
|
+
*/
|
|
5767
|
+
function lockScroll() {
|
|
5768
|
+
openOverlays += 1;
|
|
5769
|
+
if (openOverlays > 1) {
|
|
5770
|
+
return;
|
|
5771
|
+
}
|
|
5772
|
+
const root = document.documentElement;
|
|
5773
|
+
const scrollbar = window.innerWidth - root.clientWidth;
|
|
5774
|
+
previousOverflow = root.style.overflow;
|
|
5775
|
+
previousPaddingRight = root.style.paddingRight;
|
|
5776
|
+
root.style.overflow = 'hidden';
|
|
5777
|
+
if (scrollbar > 0) {
|
|
5778
|
+
root.style.paddingRight = `${scrollbar}px`;
|
|
5779
|
+
}
|
|
5780
|
+
}
|
|
5781
|
+
/**
|
|
5782
|
+
* Releases one scroll lock. Only the last lock restores the page; earlier calls
|
|
5783
|
+
* are a no-op so the overlay still open keeps the page frozen.
|
|
5784
|
+
*/
|
|
5785
|
+
function unlockScroll() {
|
|
5786
|
+
openOverlays -= 1;
|
|
5787
|
+
if (openOverlays > 0) {
|
|
5788
|
+
return;
|
|
5789
|
+
}
|
|
5790
|
+
const root = document.documentElement;
|
|
5791
|
+
root.style.overflow = previousOverflow;
|
|
5792
|
+
root.style.paddingRight = previousPaddingRight;
|
|
5793
|
+
}
|
|
5794
|
+
|
|
5795
|
+
const chDrawerCss = () => `.drawer{position:fixed;inset:0;margin:0;box-sizing:border-box;flex-direction:column;gap:var(--spacing-2xl);width:min(24rem, 100vw);height:100vh;height:100dvh;max-width:100vw;max-height:100dvh;padding:var(--spacing-5xl);border:var(--border-width) solid var(--border);border-radius:0;background:var(--color-background-base);color:var(--text);font-family:var(--font-body);font-size:var(--typography-size-md);overflow:hidden}.drawer[open]{display:flex}.drawer--start{inset:0 auto 0 0;border-inline-start:none;animation:drawer-in-start var(--duration-normal) var(--easing-default)}.drawer--end{inset:0 0 0 auto;border-inline-end:none;animation:drawer-in-end var(--duration-normal) var(--easing-default)}.drawer--top{inset:0 0 auto 0;width:100vw;height:auto;max-height:80dvh;border-block-start:none;animation:drawer-in-top var(--duration-normal) var(--easing-default)}.drawer--bottom{inset:auto 0 0 0;width:100vw;height:auto;max-height:80dvh;border-block-end:none;animation:drawer-in-bottom var(--duration-normal) var(--easing-default)}.drawer::backdrop{background:var(--color-scrim-default);backdrop-filter:blur(var(--effect-blur))}.drawer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--spacing-2xl);flex:none}.drawer-body{flex:1;min-height:0;overflow-y:auto}::slotted([slot='footer']){display:flex;align-items:center;justify-content:flex-end;gap:var(--spacing-md);flex:none;padding-top:var(--spacing-2xl);border-top:var(--border-width) solid var(--border)}.drawer-close{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--spacing-2xs) var(--spacing-md);border:0;border-radius:var(--radius);background:none;color:var(--text-muted);cursor:pointer;font-family:var(--font-heading);font-size:var(--typography-size-lg);line-height:1;transition:background-color var(--duration-normal) var(--easing-default)}.drawer-close:hover{background:var(--surface-hover);color:var(--text)}.drawer-close:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}@keyframes drawer-in-start{from{transform:translateX(-100%)}}@keyframes drawer-in-end{from{transform:translateX(100%)}}@keyframes drawer-in-top{from{transform:translateY(-100%)}}@keyframes drawer-in-bottom{from{transform:translateY(100%)}}@media (pointer: coarse){.drawer-close{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.drawer{animation:none}.drawer-close{transition:none}}`;
|
|
5796
|
+
|
|
5797
|
+
/**
|
|
5798
|
+
* Sliding side panel for navigation, editing forms and quick detail views.
|
|
5799
|
+
*
|
|
5800
|
+
* Built on the native `<dialog>` element and opened with `showModal()`, exactly
|
|
5801
|
+
* like `ch-modal`, so the browser owns focus management, the inert background,
|
|
5802
|
+
* `Escape`, the top layer, `::backdrop`, and the implicit `dialog` role with
|
|
5803
|
+
* `aria-modal="true"`. The only differences are placement — anchored to one
|
|
5804
|
+
* edge instead of centred — and the longer content it is meant for, which is
|
|
5805
|
+
* why it exposes `header` and `footer` slots around a scrollable body.
|
|
5806
|
+
*
|
|
5807
|
+
* Scroll locking is shared with `ch-modal` through `utils/scroll-lock`, so a
|
|
5808
|
+
* drawer and a modal opened together cannot unlock the page early.
|
|
5809
|
+
*/
|
|
5810
|
+
class ChDrawer {
|
|
5811
|
+
constructor(hostRef) {
|
|
5812
|
+
registerInstance(this, hostRef);
|
|
5813
|
+
this.chOpen = createEvent(this, "chOpen");
|
|
5814
|
+
this.chClose = createEvent(this, "chClose");
|
|
5815
|
+
}
|
|
5816
|
+
/**
|
|
5817
|
+
* Whether the drawer is open. Kept in sync when the user closes it with
|
|
5818
|
+
* `Escape`, the close button or a click outside.
|
|
5819
|
+
*/
|
|
5820
|
+
open = false;
|
|
5821
|
+
/**
|
|
5822
|
+
* The edge the panel slides in from. `start`/`end` follow the writing
|
|
5823
|
+
* direction, so `start` is the left edge in LTR and the right edge in RTL.
|
|
5824
|
+
*/
|
|
5825
|
+
side = 'end';
|
|
5826
|
+
/**
|
|
5827
|
+
* Accessible name for the drawer, set as `aria-label`. A slotted heading
|
|
5828
|
+
* cannot be referenced with `aria-labelledby` across the shadow boundary, so
|
|
5829
|
+
* the name comes through this prop — and a modal dialog needs one, so pass
|
|
5830
|
+
* the same text as the heading.
|
|
5831
|
+
*/
|
|
5832
|
+
label;
|
|
5833
|
+
/**
|
|
5834
|
+
* Accessible label for the close button, set as `aria-label`. Setting it is
|
|
5835
|
+
* what adds the button: its only content is a decorative glyph, so without a
|
|
5836
|
+
* label it would have no accessible name.
|
|
5837
|
+
*/
|
|
5838
|
+
closeLabel;
|
|
5839
|
+
/**
|
|
5840
|
+
* Emitted after the drawer opens.
|
|
5841
|
+
*/
|
|
5842
|
+
chOpen;
|
|
5843
|
+
/**
|
|
5844
|
+
* Emitted after the drawer closes, however it was closed.
|
|
5845
|
+
*/
|
|
5846
|
+
chClose;
|
|
5847
|
+
dialog;
|
|
5848
|
+
scrollLocked = false;
|
|
5849
|
+
pointerDownedOutside = false;
|
|
5850
|
+
componentDidLoad() {
|
|
5851
|
+
// Wired here rather than in JSX because Stencil derives a listener's event
|
|
5852
|
+
// name from whether `on<name>` exists on `window`, which differs between
|
|
5853
|
+
// the browser and the test environment for pointer events.
|
|
5854
|
+
this.dialog?.addEventListener('close', this.handleNativeClose);
|
|
5855
|
+
this.dialog?.addEventListener('pointerdown', this.handlePointerDown);
|
|
5856
|
+
this.dialog?.addEventListener('click', this.handleClick);
|
|
5857
|
+
if (this.open) {
|
|
5858
|
+
this.showDialog();
|
|
5859
|
+
}
|
|
5860
|
+
}
|
|
5861
|
+
disconnectedCallback() {
|
|
5862
|
+
this.dialog?.removeEventListener('close', this.handleNativeClose);
|
|
5863
|
+
this.dialog?.removeEventListener('pointerdown', this.handlePointerDown);
|
|
5864
|
+
this.dialog?.removeEventListener('click', this.handleClick);
|
|
5865
|
+
this.unlockScroll();
|
|
5866
|
+
}
|
|
5867
|
+
handleOpenChange(open) {
|
|
5868
|
+
if (open) {
|
|
5869
|
+
this.showDialog();
|
|
5870
|
+
}
|
|
5871
|
+
else {
|
|
5872
|
+
this.closeDialog();
|
|
5873
|
+
}
|
|
5874
|
+
}
|
|
5875
|
+
showDialog() {
|
|
5876
|
+
if (typeof this.dialog?.showModal !== 'function') {
|
|
5877
|
+
return;
|
|
5878
|
+
}
|
|
5879
|
+
this.lockScroll();
|
|
5880
|
+
this.dialog.showModal();
|
|
5881
|
+
this.chOpen.emit();
|
|
5882
|
+
}
|
|
5883
|
+
closeDialog() {
|
|
5884
|
+
if (typeof this.dialog?.close === 'function' && this.dialog.open) {
|
|
5885
|
+
this.dialog.close();
|
|
5886
|
+
}
|
|
5887
|
+
}
|
|
5888
|
+
lockScroll() {
|
|
5889
|
+
if (this.scrollLocked) {
|
|
5890
|
+
return;
|
|
5891
|
+
}
|
|
5892
|
+
this.scrollLocked = true;
|
|
5893
|
+
lockScroll();
|
|
5894
|
+
}
|
|
5895
|
+
unlockScroll() {
|
|
5896
|
+
if (!this.scrollLocked) {
|
|
5897
|
+
return;
|
|
5898
|
+
}
|
|
5899
|
+
this.scrollLocked = false;
|
|
5900
|
+
unlockScroll();
|
|
5901
|
+
}
|
|
5902
|
+
/**
|
|
5903
|
+
* True for a pointer event on the backdrop: the `<dialog>` is the event
|
|
5904
|
+
* target for its own box only, and the coordinates fall outside that box.
|
|
5905
|
+
*/
|
|
5906
|
+
isOnBackdrop(event) {
|
|
5907
|
+
if (!this.dialog || event.target !== this.dialog) {
|
|
5908
|
+
return false;
|
|
5909
|
+
}
|
|
5910
|
+
const box = this.dialog.getBoundingClientRect();
|
|
5911
|
+
return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
|
|
5912
|
+
}
|
|
5913
|
+
handlePointerDown = (event) => {
|
|
5914
|
+
this.pointerDownedOutside = this.isOnBackdrop(event);
|
|
5915
|
+
};
|
|
5916
|
+
handleClick = (event) => {
|
|
5917
|
+
// Requiring the press to have started on the backdrop too keeps a
|
|
5918
|
+
// selection dragged out of the drawer, and a keyboard-synthesised click
|
|
5919
|
+
// (which reports coordinates of 0), from closing it.
|
|
5920
|
+
const dismiss = this.pointerDownedOutside && this.isOnBackdrop(event);
|
|
5921
|
+
this.pointerDownedOutside = false;
|
|
5922
|
+
if (dismiss) {
|
|
5923
|
+
this.closeDialog();
|
|
5924
|
+
}
|
|
5925
|
+
};
|
|
5926
|
+
handleNativeClose = () => {
|
|
5927
|
+
this.unlockScroll();
|
|
5928
|
+
if (this.open) {
|
|
5929
|
+
this.open = false;
|
|
5930
|
+
}
|
|
5931
|
+
this.chClose.emit();
|
|
5932
|
+
};
|
|
5933
|
+
handleCloseClick = () => {
|
|
5934
|
+
if (typeof this.dialog?.close === 'function' && this.dialog.open) {
|
|
5935
|
+
this.dialog.close();
|
|
5936
|
+
return;
|
|
5937
|
+
}
|
|
5938
|
+
this.open = false;
|
|
5939
|
+
this.chClose.emit();
|
|
5940
|
+
};
|
|
5941
|
+
render() {
|
|
5942
|
+
return (hAsync(Host, { key: '8ee0dd329f7304e3f4804c26c75514372d49b4b8' }, hAsync("dialog", { key: '7f99c8edf6f820b595d4360ccc90123da37f9314', class: { drawer: true, [`drawer--${this.side}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, hAsync("div", { key: '65c2a386b36305ece253fe644db2a198bc245d12', class: "drawer-head" }, hAsync("slot", { key: '6c259b14a1fea3a38014c832d917554e3d431e18', name: "header" }), this.closeLabel && (hAsync("button", { key: '4d259fbd9850ea4f379f07be50f863e896e67312', class: "drawer-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, hAsync("span", { key: 'f1623602e84587020e77ec84c4b997c726414193', "aria-hidden": "true" }, "\u00D7")))), hAsync("div", { key: 'b239b7da3c9b00a6e80d33290d810297301206de', class: "drawer-body" }, hAsync("slot", { key: 'c3739f84975fc5f4717986214217c23eacb4432f' })), hAsync("slot", { key: '469be1ccedaf474fe40a9c2d264b6c128715cfc7', name: "footer" }))));
|
|
5943
|
+
}
|
|
5944
|
+
static get watchers() { return {
|
|
5945
|
+
"open": [{
|
|
5946
|
+
"handleOpenChange": 0
|
|
5947
|
+
}]
|
|
5948
|
+
}; }
|
|
5949
|
+
static get style() { return chDrawerCss(); }
|
|
5950
|
+
static get cmpMeta() { return {
|
|
5951
|
+
"$flags$": 777,
|
|
5952
|
+
"$tagName$": "ch-drawer",
|
|
5953
|
+
"$members$": {
|
|
5954
|
+
"open": [1028],
|
|
5955
|
+
"side": [1],
|
|
5956
|
+
"label": [1],
|
|
5957
|
+
"closeLabel": [1, "close-label"]
|
|
5958
|
+
},
|
|
5959
|
+
"$listeners$": undefined,
|
|
5960
|
+
"$lazyBundleId$": "-",
|
|
5961
|
+
"$attrsToReflect$": []
|
|
5962
|
+
}; }
|
|
5963
|
+
}
|
|
5964
|
+
|
|
5706
5965
|
const aaaa = "aaaa";
|
|
5707
5966
|
const ameno = "ameno";
|
|
5708
5967
|
const heart = "huemul-love";
|
|
@@ -5792,7 +6051,7 @@ class ChEmoji {
|
|
|
5792
6051
|
this.loaded = true;
|
|
5793
6052
|
};
|
|
5794
6053
|
render() {
|
|
5795
|
-
return (hAsync(Host, { key: '
|
|
6054
|
+
return (hAsync(Host, { key: '494b67e2300a9e1e9bb013aeefa6154cd26984ee' }, hAsync("img", { key: 'f05cacf5cdfdf09ba21a5841a6571741aa86e8b5', class: {
|
|
5796
6055
|
'emoji': true,
|
|
5797
6056
|
[`emoji--${this.size}`]: true,
|
|
5798
6057
|
'emoji--hidden': !this.loaded,
|
|
@@ -5944,7 +6203,7 @@ class ChInput {
|
|
|
5944
6203
|
return undefined;
|
|
5945
6204
|
}
|
|
5946
6205
|
render() {
|
|
5947
|
-
return (hAsync(Host, { key: '
|
|
6206
|
+
return (hAsync(Host, { key: '8f06015ae952c02467d45bb97d306eb7525a7429' }, this.label && (hAsync("label", { key: '300cf07bfc4e79eb5904140e105d33fa96f09efe', class: "label", htmlFor: this.inputId }, this.label)), hAsync("input", { key: '85ab8a0f5a35f421c9af6137bc691e6fb543e940', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.invalid }, type: this.type, name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '4a64db0bc1f03dd756dd55ecf6ff8b95de00dfe1', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'c1c8a0c8f719f53941180ae05b17710a5f7c212b', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
5948
6207
|
}
|
|
5949
6208
|
static get formAssociated() { return true; }
|
|
5950
6209
|
static get watchers() { return {
|
|
@@ -6040,9 +6299,6 @@ class ChLink {
|
|
|
6040
6299
|
|
|
6041
6300
|
const chModalCss = () => `.modal{box-sizing:border-box;max-width:min(32rem, calc(100vw - var(--spacing-6xl)));max-height:calc(100vh - var(--spacing-6xl));padding:var(--spacing-5xl);border:var(--border-width) solid var(--border);border-radius:var(--radius);background:var(--color-background-base);color:var(--text);font-family:var(--font-body);font-size:var(--typography-size-md)}.modal::backdrop{background:var(--color-scrim-default);backdrop-filter:blur(var(--effect-blur))}.modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--spacing-2xl);margin-bottom:var(--spacing-2xl)}.modal-body{overflow-y:auto}.modal-close{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--spacing-2xs) var(--spacing-md);border:0;border-radius:var(--radius);background:none;color:var(--text-muted);cursor:pointer;font-family:var(--font-heading);font-size:var(--typography-size-lg);line-height:1;transition:background-color var(--duration-normal) var(--easing-default)}.modal-close:hover{background:var(--surface-hover);color:var(--text)}.modal-close:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}@media (pointer: coarse){.modal-close{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.modal-close{transition:none}}`;
|
|
6042
6301
|
|
|
6043
|
-
let openModals = 0;
|
|
6044
|
-
let previousOverflow = '';
|
|
6045
|
-
let previousPaddingRight = '';
|
|
6046
6302
|
/**
|
|
6047
6303
|
* Modal dialog, built on the native `<dialog>` element and opened with
|
|
6048
6304
|
* `showModal()`.
|
|
@@ -6139,31 +6395,14 @@ class ChModal {
|
|
|
6139
6395
|
return;
|
|
6140
6396
|
}
|
|
6141
6397
|
this.scrollLocked = true;
|
|
6142
|
-
|
|
6143
|
-
if (openModals > 1) {
|
|
6144
|
-
return;
|
|
6145
|
-
}
|
|
6146
|
-
const root = document.documentElement;
|
|
6147
|
-
const scrollbar = window.innerWidth - root.clientWidth;
|
|
6148
|
-
previousOverflow = root.style.overflow;
|
|
6149
|
-
previousPaddingRight = root.style.paddingRight;
|
|
6150
|
-
root.style.overflow = 'hidden';
|
|
6151
|
-
if (scrollbar > 0) {
|
|
6152
|
-
root.style.paddingRight = `${scrollbar}px`;
|
|
6153
|
-
}
|
|
6398
|
+
lockScroll();
|
|
6154
6399
|
}
|
|
6155
6400
|
unlockScroll() {
|
|
6156
6401
|
if (!this.scrollLocked) {
|
|
6157
6402
|
return;
|
|
6158
6403
|
}
|
|
6159
6404
|
this.scrollLocked = false;
|
|
6160
|
-
|
|
6161
|
-
if (openModals > 0) {
|
|
6162
|
-
return;
|
|
6163
|
-
}
|
|
6164
|
-
const root = document.documentElement;
|
|
6165
|
-
root.style.overflow = previousOverflow;
|
|
6166
|
-
root.style.paddingRight = previousPaddingRight;
|
|
6405
|
+
unlockScroll();
|
|
6167
6406
|
}
|
|
6168
6407
|
/**
|
|
6169
6408
|
* True for a pointer event on the backdrop: the `<dialog>` is the event
|
|
@@ -6205,7 +6444,7 @@ class ChModal {
|
|
|
6205
6444
|
this.chClose.emit();
|
|
6206
6445
|
};
|
|
6207
6446
|
render() {
|
|
6208
|
-
return (hAsync(Host, { key: '
|
|
6447
|
+
return (hAsync(Host, { key: '2a8271f9606bc98d0b054016a60afbcb36dfaa48' }, hAsync("dialog", { key: '8c866544fd071b98a0b2e58df1690705347a183c', class: "modal", "aria-label": this.label, ref: el => (this.dialog = el) }, hAsync("div", { key: 'fceb7d0e17ecfe639f518c26ea75abf96bf3469e', class: "modal-head" }, hAsync("slot", { key: '89359d0e82b4c5694b8ad76bd7c67b2a1a80f11a', name: "heading" }), this.closeLabel && (hAsync("button", { key: 'edcf61410f993d367613a4bd485c63336ee82619', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, hAsync("span", { key: '80ce411b41882508b805aeb1ad0caee07fbbeaaa', "aria-hidden": "true" }, "\u00D7")))), hAsync("div", { key: 'd0f72191474917a8e4c68c4996a40340c4494651', class: "modal-body" }, hAsync("slot", { key: '46c1d56f416a742176b4be753aa7a8af14bb579d' })))));
|
|
6209
6448
|
}
|
|
6210
6449
|
static get watchers() { return {
|
|
6211
6450
|
"open": [{
|
|
@@ -6341,7 +6580,7 @@ class ChRadio {
|
|
|
6341
6580
|
}
|
|
6342
6581
|
render() {
|
|
6343
6582
|
const groupName = this.name || `${this.groupId}-group`;
|
|
6344
|
-
return (hAsync(Host, { key: '
|
|
6583
|
+
return (hAsync(Host, { key: '3cd55c205d303df45671dc76756b1fcc78baf760' }, this.label && (hAsync("span", { key: '0e9ab53baa202dff829a46e8674d7f994f9f14b9', class: "group-label", id: this.labelId }, this.label)), hAsync("div", { key: '584e1e36954f7daad8b71c9b690f7fe42f53bb09', class: "radio-group", role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (hAsync("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, hAsync("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 }), hAsync("span", { class: "mark" }), hAsync("span", { class: "label-text" }, option.label))))), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '9030ddc9030ea728d56fa2f5520f9df26df75f0d', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'e2ba85ff960ae61f4b882190e19558f6189c569b', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
6345
6584
|
}
|
|
6346
6585
|
static get formAssociated() { return true; }
|
|
6347
6586
|
static get watchers() { return {
|
|
@@ -6380,6 +6619,142 @@ class ChRadio {
|
|
|
6380
6619
|
}; }
|
|
6381
6620
|
}
|
|
6382
6621
|
|
|
6622
|
+
const chSegmentedControlCss = () => `:host{display:inline-block;max-width:100%}.group-label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.segmented{display:inline-flex;align-items:stretch;max-width:100%;padding:var(--spacing-2xs);border:var(--border-width) solid var(--border);border-radius:var(--radius-pill);background:var(--surface)}.control{position:relative;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-pill);cursor:pointer;transition:background-color var(--duration-normal) var(--easing-default)}.control:hover:not(.control--disabled){background:var(--surface-hover)}.control--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input{position:absolute;inset:0;margin:0;opacity:0;cursor:inherit}.input:checked~.label-text{background:var(--accent);color:var(--color-accent-text);font-weight:var(--typography-weight-semibold)}.input:focus-visible~.label-text{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.label-text{display:block;padding:var(--spacing-2xs) var(--spacing-3xl);border-radius:inherit;font-size:var(--typography-size-sm);white-space:nowrap;transition:background-color var(--duration-normal) var(--easing-default), color var(--duration-normal) var(--easing-default)}.segmented--sm .label-text{padding:var(--spacing-2xs) var(--spacing-2xl);font-size:var(--typography-size-xs)}:host([data-touched]:invalid) .segmented,:host(:user-invalid) .segmented{border-color:var(--color-status-warning)}@media (prefers-reduced-motion: reduce){.control,.label-text{transition:none}}`;
|
|
6623
|
+
|
|
6624
|
+
let segmentedIds = 0;
|
|
6625
|
+
/**
|
|
6626
|
+
* Compact control for switching between a few mutually exclusive options
|
|
6627
|
+
* (all/in/out, movement type, and similar filters).
|
|
6628
|
+
*
|
|
6629
|
+
* Built on native radio inputs sharing a name inside a `role="radiogroup"`,
|
|
6630
|
+
* so arrow-key navigation, a single tab stop, `:focus-visible` and native form
|
|
6631
|
+
* participation come from the platform instead of hand-rolled key handling.
|
|
6632
|
+
* It is form-associated like the other controls: inside a `<form>` the selected
|
|
6633
|
+
* value is submitted under `name`, and `required` with an empty value is
|
|
6634
|
+
* invalid.
|
|
6635
|
+
*
|
|
6636
|
+
* It differs from `ch-radio` in presentation only — segments in a joined track
|
|
6637
|
+
* instead of a vertical list of radio marks — so it is meant for compact
|
|
6638
|
+
* filters, not for long option lists.
|
|
6639
|
+
*/
|
|
6640
|
+
class ChSegmentedControl {
|
|
6641
|
+
constructor(hostRef) {
|
|
6642
|
+
registerInstance(this, hostRef);
|
|
6643
|
+
this.chChange = createEvent(this, "chChange");
|
|
6644
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
6645
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
6646
|
+
}
|
|
6647
|
+
else {
|
|
6648
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
6649
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
6650
|
+
}
|
|
6651
|
+
}
|
|
6652
|
+
groupId = `ch-segmented-${++segmentedIds}`;
|
|
6653
|
+
labelId = `${this.groupId}-label`;
|
|
6654
|
+
initialValue;
|
|
6655
|
+
internals;
|
|
6656
|
+
formDisabled = false;
|
|
6657
|
+
get host() { return getElement(this); }
|
|
6658
|
+
/**
|
|
6659
|
+
* Visible label describing the group, associated with it via
|
|
6660
|
+
* `aria-labelledby`.
|
|
6661
|
+
*/
|
|
6662
|
+
label;
|
|
6663
|
+
/**
|
|
6664
|
+
* The list of options rendered as segments.
|
|
6665
|
+
*/
|
|
6666
|
+
options = [];
|
|
6667
|
+
/**
|
|
6668
|
+
* The value of the selected option.
|
|
6669
|
+
*/
|
|
6670
|
+
value;
|
|
6671
|
+
/**
|
|
6672
|
+
* The size of the segments. Either `sm` or `md`.
|
|
6673
|
+
*/
|
|
6674
|
+
size = 'md';
|
|
6675
|
+
/**
|
|
6676
|
+
* The name shared by all radio inputs in the group, also used to submit the
|
|
6677
|
+
* value. Defaults to an auto-generated group name so options are mutually
|
|
6678
|
+
* exclusive out of the box.
|
|
6679
|
+
*/
|
|
6680
|
+
name;
|
|
6681
|
+
/**
|
|
6682
|
+
* Whether all segments are disabled.
|
|
6683
|
+
*/
|
|
6684
|
+
disabled = false;
|
|
6685
|
+
/**
|
|
6686
|
+
* Whether a value is required.
|
|
6687
|
+
*/
|
|
6688
|
+
required = false;
|
|
6689
|
+
/**
|
|
6690
|
+
* Emitted when a new option is selected, with the selected value.
|
|
6691
|
+
*/
|
|
6692
|
+
chChange;
|
|
6693
|
+
handleChange = (ev) => {
|
|
6694
|
+
this.value = ev.target.value;
|
|
6695
|
+
this.chChange.emit(this.value);
|
|
6696
|
+
};
|
|
6697
|
+
syncForm() {
|
|
6698
|
+
const internals = this.internals;
|
|
6699
|
+
if (typeof internals?.setFormValue !== 'function') {
|
|
6700
|
+
return;
|
|
6701
|
+
}
|
|
6702
|
+
internals.setFormValue(this.value ?? null);
|
|
6703
|
+
const flags = {};
|
|
6704
|
+
if (this.required && !this.value) {
|
|
6705
|
+
flags.valueMissing = true;
|
|
6706
|
+
}
|
|
6707
|
+
internals.setValidity(flags, flags.valueMissing ? 'Please fill out this field.' : undefined);
|
|
6708
|
+
}
|
|
6709
|
+
componentDidLoad() {
|
|
6710
|
+
this.initialValue = this.value;
|
|
6711
|
+
this.syncForm();
|
|
6712
|
+
this.host.addEventListener('change', this.markTouched);
|
|
6713
|
+
this.host.addEventListener('focusout', this.markTouched);
|
|
6714
|
+
this.host.addEventListener('invalid', this.markTouched);
|
|
6715
|
+
}
|
|
6716
|
+
markTouched = () => {
|
|
6717
|
+
this.host.setAttribute('data-touched', '');
|
|
6718
|
+
};
|
|
6719
|
+
formResetCallback() {
|
|
6720
|
+
this.value = this.initialValue;
|
|
6721
|
+
}
|
|
6722
|
+
formDisabledCallback(isDisabled) {
|
|
6723
|
+
this.formDisabled = isDisabled;
|
|
6724
|
+
}
|
|
6725
|
+
render() {
|
|
6726
|
+
const groupName = this.name || `${this.groupId}-group`;
|
|
6727
|
+
return (hAsync(Host, { key: 'fd588544d9cdebaaeb1961f4ecb5c5630e8e4699' }, this.label && (hAsync("span", { key: '58ade8d7858d6e12d71778bc07337ab485be383d', class: "group-label", id: this.labelId }, this.label)), hAsync("div", { key: 'b872fc7e4a2dc678dbc1c9cf7c30d66ce24ebcac', class: { segmented: true, [`segmented--${this.size}`]: true }, role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (hAsync("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, hAsync("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 }), hAsync("span", { class: "label-text" }, option.label)))))));
|
|
6728
|
+
}
|
|
6729
|
+
static get formAssociated() { return true; }
|
|
6730
|
+
static get watchers() { return {
|
|
6731
|
+
"value": [{
|
|
6732
|
+
"syncForm": 0
|
|
6733
|
+
}],
|
|
6734
|
+
"required": [{
|
|
6735
|
+
"syncForm": 0
|
|
6736
|
+
}]
|
|
6737
|
+
}; }
|
|
6738
|
+
static get style() { return chSegmentedControlCss(); }
|
|
6739
|
+
static get cmpMeta() { return {
|
|
6740
|
+
"$flags$": 585,
|
|
6741
|
+
"$tagName$": "ch-segmented-control",
|
|
6742
|
+
"$members$": {
|
|
6743
|
+
"label": [1],
|
|
6744
|
+
"options": [16],
|
|
6745
|
+
"value": [1025],
|
|
6746
|
+
"size": [1],
|
|
6747
|
+
"name": [513],
|
|
6748
|
+
"disabled": [516],
|
|
6749
|
+
"required": [516],
|
|
6750
|
+
"formDisabled": [32]
|
|
6751
|
+
},
|
|
6752
|
+
"$listeners$": undefined,
|
|
6753
|
+
"$lazyBundleId$": "-",
|
|
6754
|
+
"$attrsToReflect$": [["name", "name"], ["disabled", "disabled"], ["required", "required"]]
|
|
6755
|
+
}; }
|
|
6756
|
+
}
|
|
6757
|
+
|
|
6383
6758
|
const chSelectCss = () => `:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.select{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;cursor:pointer;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.select:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.select--invalid{border-color:var(--color-status-warning)}.select--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}:host([data-touched]:invalid) .select,:host(:user-invalid) .select{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .select:focus,:host(:user-invalid) .select:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.select:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.select option{background:var(--bg);color:var(--text)}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;
|
|
6384
6759
|
|
|
6385
6760
|
let selectIds = 0;
|
|
@@ -6495,7 +6870,7 @@ class ChSelect {
|
|
|
6495
6870
|
return undefined;
|
|
6496
6871
|
}
|
|
6497
6872
|
render() {
|
|
6498
|
-
return (hAsync(Host, { key: '
|
|
6873
|
+
return (hAsync(Host, { key: 'bf1cb02b17b6c31297e1b77e9cad6488c9fafd1c' }, this.label && (hAsync("label", { key: '837158a8827a3f9af3a58a14c104f15919058ae0', class: "label", htmlFor: this.selectId }, this.label)), hAsync("select", { key: '4622f105d8852a2658b917f1329c3c71c791547a', id: this.label ? this.selectId : undefined, class: { 'select': true, 'select--invalid': this.invalid }, name: this.name, disabled: this.disabled || this.formDisabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }, this.placeholder && (hAsync("option", { key: '1d3ea13f0f9f8f0c7b3b5d0c3a5a36cb465937b2', value: "", disabled: true, hidden: true, selected: !this.value }, this.placeholder)), this.options.map(option => (hAsync("option", { value: option.value, disabled: option.disabled, selected: option.value === this.value }, option.label)))), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: 'd73ff8034dfe5546f7f77417d73e91a0fc763321', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'fa487e405f01ae8473d442b1b94ea1cc9eb07d31', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
6499
6874
|
}
|
|
6500
6875
|
static get formAssociated() { return true; }
|
|
6501
6876
|
static get watchers() { return {
|
|
@@ -6564,7 +6939,7 @@ class ChSpinner {
|
|
|
6564
6939
|
label;
|
|
6565
6940
|
render() {
|
|
6566
6941
|
const labelled = Boolean(this.label);
|
|
6567
|
-
return (hAsync(Host, { key: '
|
|
6942
|
+
return (hAsync(Host, { key: 'cdb44d362b4f366703c13816d7c72967e03709b1' }, hAsync("span", { key: '5368a6f9cef9ff6eafc4ac0323e2cc01da6e627f', class: { spinner: true, [`spinner--${this.size}`]: true }, role: labelled ? 'status' : undefined, "aria-label": labelled ? this.label : undefined, "aria-hidden": labelled ? undefined : 'true' })));
|
|
6568
6943
|
}
|
|
6569
6944
|
static get style() { return chSpinnerCss(); }
|
|
6570
6945
|
static get cmpMeta() { return {
|
|
@@ -6691,7 +7066,7 @@ class ChSwitch {
|
|
|
6691
7066
|
return undefined;
|
|
6692
7067
|
}
|
|
6693
7068
|
render() {
|
|
6694
|
-
return (hAsync(Host, { key: '
|
|
7069
|
+
return (hAsync(Host, { key: '0aae2ddd370936be88af621aba79507531c9ca46' }, hAsync("label", { key: '70a97960763688fbdcad1807468ce647c33c6601', class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled }, htmlFor: this.switchId }, hAsync("input", { key: '6addc2227c9f8a07f9695f1c40a6cf1667a097e6', id: this.switchId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", role: "switch", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled || this.formDisabled, required: this.required, "aria-checked": this.checked ? 'true' : 'false', "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), hAsync("span", { key: '06dc52e18e506a49bf188d4d1562c73d1e2b141c', class: "track" }, hAsync("span", { key: 'c7072be8d8a38472aa88e2f7ae1db4c79960ccda', class: "thumb" })), this.label && hAsync("span", { key: 'b3b24e569e5d46d51600fab3546c5d4bf5aca515', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '0b7bb4fff74be16b96d18af71ef46b0d6dec7984', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'b8bfccb23ee16e3885508dbb23052ebc297c36de', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
6695
7070
|
}
|
|
6696
7071
|
static get formAssociated() { return true; }
|
|
6697
7072
|
static get watchers() { return {
|
|
@@ -6814,7 +7189,7 @@ class ChTabs {
|
|
|
6814
7189
|
}
|
|
6815
7190
|
render() {
|
|
6816
7191
|
const active = this.activeValue;
|
|
6817
|
-
return (hAsync(Host, { key: '
|
|
7192
|
+
return (hAsync(Host, { key: '8b0757158cca856bd984e99b86b9f1c3a79e1dfb' }, hAsync("div", { key: 'e1ecf05df41e26787ed3702c113a393edcc6dea4', class: "tablist", role: "tablist", "aria-label": this.label, onKeyDown: this.handleKeyDown, ref: el => (this.tablistEl = el) }, this.tabs.map(tab => {
|
|
6818
7193
|
const selected = tab.value === active;
|
|
6819
7194
|
return (hAsync("button", { key: tab.value, type: "button", class: { 'tab': true, 'tab--active': selected, 'tab--disabled': Boolean(tab.disabled) }, role: "tab", id: this.tabId(tab.value), "data-value": tab.value, "aria-selected": selected ? 'true' : 'false', "aria-controls": this.panelId(tab.value), tabIndex: selected ? FIRST_TAB_INDEX : LAST_TAB_INDEX, disabled: tab.disabled, onClick: () => this.select(tab.value) }, tab.label));
|
|
6820
7195
|
})), this.tabs.map(tab => (hAsync("div", { key: `${tab.value}-panel`, class: "tabpanel", id: this.panelId(tab.value), role: "tabpanel", "aria-labelledby": this.tabId(tab.value), tabIndex: FIRST_TAB_INDEX, hidden: tab.value !== active }, hAsync("slot", { name: `panel-${tab.value}` }))))));
|
|
@@ -6959,7 +7334,7 @@ class ChTextarea {
|
|
|
6959
7334
|
return undefined;
|
|
6960
7335
|
}
|
|
6961
7336
|
render() {
|
|
6962
|
-
return (hAsync(Host, { key: '
|
|
7337
|
+
return (hAsync(Host, { key: '35cdb2ec4cb35cb33492c4827f6f69251eea64be' }, this.label && (hAsync("label", { key: '157579852d461707fddc660f33acd21768f7d3fe', class: "label", htmlFor: this.textareaId }, this.label)), hAsync("textarea", { key: 'bf43052c6c66c24a906f6e4fae4256675a1b9f89', id: this.label ? this.textareaId : undefined, class: { 'textarea': true, 'textarea--invalid': this.invalid }, rows: this.rows, name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '3dcacf048dccc3474d9397f917da32b334a072fd', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: '22e706a1e0b17112b39e296d267d33a1bced06ee', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
6963
7338
|
}
|
|
6964
7339
|
static get formAssociated() { return true; }
|
|
6965
7340
|
static get watchers() { return {
|
|
@@ -7084,7 +7459,7 @@ class ChTooltip {
|
|
|
7084
7459
|
trigger.setAttribute('aria-describedby', content.id);
|
|
7085
7460
|
};
|
|
7086
7461
|
render() {
|
|
7087
|
-
return (hAsync(Host, { key: '
|
|
7462
|
+
return (hAsync(Host, { key: '89e1b0de9e5d2a33edba2cc0b479788694c5a202' }, hAsync("span", { key: 'c7a31597ba6fd6a7c68cdd74cf8170d14b9e85ba', class: "anchor" }, hAsync("slot", { key: 'eac54ebeffa8ccbfdd0c4e42e26cd4c40e81d649', name: "trigger", onSlotchange: this.associate }), hAsync("span", { key: '326581a3f64a2165a9031818782a50de7fe05fa7', class: { 'bubble': true, [`bubble--${this.placement}`]: true, 'bubble--visible': this.visible } }, hAsync("slot", { key: '739d4b50a611cc4db8fdc802f2f39deb68f974eb', name: "content", onSlotchange: this.associate })))));
|
|
7088
7463
|
}
|
|
7089
7464
|
static get style() { return chTooltipCss(); }
|
|
7090
7465
|
static get cmpMeta() { return {
|
|
@@ -7110,11 +7485,13 @@ registerComponents([
|
|
|
7110
7485
|
ChCard,
|
|
7111
7486
|
ChCheckbox,
|
|
7112
7487
|
ChDivider,
|
|
7488
|
+
ChDrawer,
|
|
7113
7489
|
ChEmoji,
|
|
7114
7490
|
ChInput,
|
|
7115
7491
|
ChLink,
|
|
7116
7492
|
ChModal,
|
|
7117
7493
|
ChRadio,
|
|
7494
|
+
ChSegmentedControl,
|
|
7118
7495
|
ChSelect,
|
|
7119
7496
|
ChSpinner,
|
|
7120
7497
|
ChSwitch,
|