@devschile/chucao 2.1.0 → 2.3.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-37e7f9cc.entry.js +2 -0
- package/dist/chucao/p-37e7f9cc.entry.js.map +1 -0
- package/dist/chucao/p-3db38c49.entry.js +2 -0
- package/dist/chucao/p-3db38c49.entry.js.map +1 -0
- package/dist/chucao/p-60c2fd71.entry.js +2 -0
- package/dist/chucao/p-60c2fd71.entry.js.map +1 -0
- package/dist/chucao/{p-121fbfc8.entry.js → p-6a4bc80c.entry.js} +2 -2
- package/dist/chucao/p-6c617158.entry.js +2 -0
- package/dist/chucao/p-6c617158.entry.js.map +1 -0
- package/dist/chucao/{p-4bc8e098.entry.js → p-aeea9cbe.entry.js} +2 -2
- package/dist/chucao/p-bb2445d1.entry.js +2 -0
- package/dist/chucao/{p-5fe8bfff.entry.js → p-c4806e96.entry.js} +2 -2
- 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/chucao/{p-d5a9e340.entry.js → p-f78f0163.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 +12 -24
- 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 +3 -1
- 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.css +12 -1
- package/dist/collection/components/ch-modal/ch-modal.js +37 -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-card.js.map +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-C1995t1C.js +2 -0
- package/dist/components/p-C1995t1C.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 +12 -24
- 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-modal/ch-modal.d.ts +8 -0
- package/dist/types/components/ch-segmented-control/ch-segmented-control.d.ts +72 -0
- package/dist/types/components.d.ts +346 -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 +30 -0
- package/dist-vue/index.ts +34 -0
- package/hydrate/index.js +428 -43
- package/hydrate/index.mjs +428 -43
- 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-121fbfc8.entry.js.map → p-6a4bc80c.entry.js.map} +0 -0
- /package/dist/chucao/{p-4bc8e098.entry.js.map → p-aeea9cbe.entry.js.map} +0 -0
- /package/dist/chucao/{p-2ab4a6a8.entry.js.map → p-bb2445d1.entry.js.map} +0 -0
- /package/dist/chucao/{p-5fe8bfff.entry.js.map → p-c4806e96.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/dist/chucao/{p-d5a9e340.entry.js.map → p-f78f0163.entry.js.map} +0 -0
package/hydrate/index.mjs
CHANGED
|
@@ -5459,7 +5459,7 @@ class ChBadge {
|
|
|
5459
5459
|
}; }
|
|
5460
5460
|
}
|
|
5461
5461
|
|
|
5462
|
-
const chButtonCss = () => `:host{display:inline-block}.btn{display:inline-flex;align-items:center;gap:var(--spacing-sm);border:
|
|
5462
|
+
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)))}`;
|
|
5463
5463
|
|
|
5464
5464
|
class ChButton {
|
|
5465
5465
|
constructor(hostRef) {
|
|
@@ -5467,17 +5467,38 @@ class ChButton {
|
|
|
5467
5467
|
this.chClick = createEvent(this, "chClick");
|
|
5468
5468
|
}
|
|
5469
5469
|
/**
|
|
5470
|
-
* The visual style of the button.
|
|
5470
|
+
* The visual style of the button. One of `primary`, `secondary`, `ghost`,
|
|
5471
|
+
* or `danger`.
|
|
5471
5472
|
*/
|
|
5472
5473
|
variant = 'primary';
|
|
5474
|
+
/**
|
|
5475
|
+
* The size of the button. One of `sm`, `md`, or `lg`.
|
|
5476
|
+
*/
|
|
5477
|
+
size = 'md';
|
|
5473
5478
|
/**
|
|
5474
5479
|
* Whether the button is disabled.
|
|
5475
5480
|
*/
|
|
5476
5481
|
disabled = false;
|
|
5477
5482
|
/**
|
|
5478
|
-
*
|
|
5479
|
-
*
|
|
5480
|
-
|
|
5483
|
+
* Whether the button is loading. Shows a spinner, disables interaction, and
|
|
5484
|
+
* announces the busy state with `aria-busy`.
|
|
5485
|
+
*/
|
|
5486
|
+
loading = false;
|
|
5487
|
+
/**
|
|
5488
|
+
* When set, the button renders as an `<a>` pointing to this URL while
|
|
5489
|
+
* keeping the button styling.
|
|
5490
|
+
*/
|
|
5491
|
+
href;
|
|
5492
|
+
/**
|
|
5493
|
+
* The browsing context the link opens in (e.g. `_blank`). Only used when
|
|
5494
|
+
* `href` is set. For `_blank`, a `noopener noreferrer` `rel` is added
|
|
5495
|
+
* automatically.
|
|
5496
|
+
*/
|
|
5497
|
+
target;
|
|
5498
|
+
/**
|
|
5499
|
+
* Accessible label set as `aria-label` on the native element. Use it when
|
|
5500
|
+
* the button's content doesn't convey its purpose on its own (e.g. an
|
|
5501
|
+
* icon-only button).
|
|
5481
5502
|
*/
|
|
5482
5503
|
label;
|
|
5483
5504
|
/**
|
|
@@ -5485,10 +5506,32 @@ class ChButton {
|
|
|
5485
5506
|
*/
|
|
5486
5507
|
chClick;
|
|
5487
5508
|
handleClick = (ev) => {
|
|
5509
|
+
if (this.disabled || this.loading) {
|
|
5510
|
+
ev.preventDefault();
|
|
5511
|
+
return;
|
|
5512
|
+
}
|
|
5488
5513
|
this.chClick.emit(ev);
|
|
5489
5514
|
};
|
|
5515
|
+
get spinnerSize() {
|
|
5516
|
+
return this.size === 'lg' ? 'md' : 'sm';
|
|
5517
|
+
}
|
|
5518
|
+
renderContent() {
|
|
5519
|
+
return [this.loading ? hAsync("ch-spinner", { size: this.spinnerSize }) : hAsync("slot", { name: "start" }), hAsync("slot", null), hAsync("slot", { name: "end" })];
|
|
5520
|
+
}
|
|
5490
5521
|
render() {
|
|
5491
|
-
|
|
5522
|
+
const classes = {
|
|
5523
|
+
'btn': true,
|
|
5524
|
+
[`btn--${this.variant}`]: true,
|
|
5525
|
+
[`btn--${this.size}`]: true,
|
|
5526
|
+
'btn--loading': this.loading,
|
|
5527
|
+
};
|
|
5528
|
+
if (this.href && !this.disabled && !this.loading) {
|
|
5529
|
+
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())));
|
|
5530
|
+
}
|
|
5531
|
+
if (this.href) {
|
|
5532
|
+
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())));
|
|
5533
|
+
}
|
|
5534
|
+
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())));
|
|
5492
5535
|
}
|
|
5493
5536
|
static get style() { return chButtonCss(); }
|
|
5494
5537
|
static get cmpMeta() { return {
|
|
@@ -5496,7 +5539,11 @@ class ChButton {
|
|
|
5496
5539
|
"$tagName$": "ch-button",
|
|
5497
5540
|
"$members$": {
|
|
5498
5541
|
"variant": [1],
|
|
5542
|
+
"size": [1],
|
|
5499
5543
|
"disabled": [4],
|
|
5544
|
+
"loading": [4],
|
|
5545
|
+
"href": [1],
|
|
5546
|
+
"target": [1],
|
|
5500
5547
|
"label": [1]
|
|
5501
5548
|
},
|
|
5502
5549
|
"$listeners$": undefined,
|
|
@@ -5512,7 +5559,7 @@ class ChCard {
|
|
|
5512
5559
|
registerInstance(this, hostRef);
|
|
5513
5560
|
}
|
|
5514
5561
|
render() {
|
|
5515
|
-
return (hAsync(Host, { key: '
|
|
5562
|
+
return (hAsync(Host, { key: '6d8b2d96c45fe2b0d5f23562d3c1b394adc8f9ea' }, hAsync("div", { key: '79b824b6924adbc407334adcd82128f8b1ec8a0a', class: "card" }, hAsync("slot", { key: '89b6bea5dee03bc65faf4aadb1725df393d55f51' }))));
|
|
5516
5563
|
}
|
|
5517
5564
|
static get style() { return chCardCss(); }
|
|
5518
5565
|
static get cmpMeta() { return {
|
|
@@ -5636,7 +5683,7 @@ class ChCheckbox {
|
|
|
5636
5683
|
return undefined;
|
|
5637
5684
|
}
|
|
5638
5685
|
render() {
|
|
5639
|
-
return (hAsync(Host, { key: '
|
|
5686
|
+
return (hAsync(Host, { key: '664ce0b9de17ed5beb378ed2ebaf2b554002a0c0' }, hAsync("label", { key: 'a9115153696ea97d404e901e463b9c2aa3fbc9c6', class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled }, htmlFor: this.checkboxId }, hAsync("input", { key: '2b8254463d3af0c36a46fda4fbe0eabbc8875e74', 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: '764e0e2d588f25850efa559487f62ed72f3422ef', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (hAsync("p", { key: '5ec4c53625bfb0a56451e8a6eab285d5268ac246', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: '36dabfce3ea276a4cc77b5f1e8b799403abcfccc', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
5640
5687
|
}
|
|
5641
5688
|
static get formAssociated() { return true; }
|
|
5642
5689
|
static get watchers() { return {
|
|
@@ -5686,7 +5733,7 @@ class ChDivider {
|
|
|
5686
5733
|
*/
|
|
5687
5734
|
orientation = 'horizontal';
|
|
5688
5735
|
render() {
|
|
5689
|
-
return (hAsync(Host, { key: '
|
|
5736
|
+
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 })));
|
|
5690
5737
|
}
|
|
5691
5738
|
static get style() { return chDividerCss(); }
|
|
5692
5739
|
static get cmpMeta() { return {
|
|
@@ -5701,6 +5748,218 @@ class ChDivider {
|
|
|
5701
5748
|
}; }
|
|
5702
5749
|
}
|
|
5703
5750
|
|
|
5751
|
+
let openOverlays = 0;
|
|
5752
|
+
let previousOverflow = '';
|
|
5753
|
+
let previousPaddingRight = '';
|
|
5754
|
+
/**
|
|
5755
|
+
* Prevents the page behind an overlay from scrolling, compensating for the
|
|
5756
|
+
* scrollbar it removes so the layout does not shift.
|
|
5757
|
+
*
|
|
5758
|
+
* Reference-counted on a module-level counter, so concurrent overlays (a modal
|
|
5759
|
+
* over a drawer, several stacked dialogs) cannot unlock the page early:
|
|
5760
|
+
* whichever overlay closes first only decrements the count, and the last one
|
|
5761
|
+
* restores the original styles.
|
|
5762
|
+
*
|
|
5763
|
+
* Callers must pair every `lockScroll()` with exactly one `unlockScroll()`.
|
|
5764
|
+
*/
|
|
5765
|
+
function lockScroll() {
|
|
5766
|
+
openOverlays += 1;
|
|
5767
|
+
if (openOverlays > 1) {
|
|
5768
|
+
return;
|
|
5769
|
+
}
|
|
5770
|
+
const root = document.documentElement;
|
|
5771
|
+
const scrollbar = window.innerWidth - root.clientWidth;
|
|
5772
|
+
previousOverflow = root.style.overflow;
|
|
5773
|
+
previousPaddingRight = root.style.paddingRight;
|
|
5774
|
+
root.style.overflow = 'hidden';
|
|
5775
|
+
if (scrollbar > 0) {
|
|
5776
|
+
root.style.paddingRight = `${scrollbar}px`;
|
|
5777
|
+
}
|
|
5778
|
+
}
|
|
5779
|
+
/**
|
|
5780
|
+
* Releases one scroll lock. Only the last lock restores the page; earlier calls
|
|
5781
|
+
* are a no-op so the overlay still open keeps the page frozen.
|
|
5782
|
+
*/
|
|
5783
|
+
function unlockScroll() {
|
|
5784
|
+
openOverlays -= 1;
|
|
5785
|
+
if (openOverlays > 0) {
|
|
5786
|
+
return;
|
|
5787
|
+
}
|
|
5788
|
+
const root = document.documentElement;
|
|
5789
|
+
root.style.overflow = previousOverflow;
|
|
5790
|
+
root.style.paddingRight = previousPaddingRight;
|
|
5791
|
+
}
|
|
5792
|
+
|
|
5793
|
+
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}}`;
|
|
5794
|
+
|
|
5795
|
+
/**
|
|
5796
|
+
* Sliding side panel for navigation, editing forms and quick detail views.
|
|
5797
|
+
*
|
|
5798
|
+
* Built on the native `<dialog>` element and opened with `showModal()`, exactly
|
|
5799
|
+
* like `ch-modal`, so the browser owns focus management, the inert background,
|
|
5800
|
+
* `Escape`, the top layer, `::backdrop`, and the implicit `dialog` role with
|
|
5801
|
+
* `aria-modal="true"`. The only differences are placement — anchored to one
|
|
5802
|
+
* edge instead of centred — and the longer content it is meant for, which is
|
|
5803
|
+
* why it exposes `header` and `footer` slots around a scrollable body.
|
|
5804
|
+
*
|
|
5805
|
+
* Scroll locking is shared with `ch-modal` through `utils/scroll-lock`, so a
|
|
5806
|
+
* drawer and a modal opened together cannot unlock the page early.
|
|
5807
|
+
*/
|
|
5808
|
+
class ChDrawer {
|
|
5809
|
+
constructor(hostRef) {
|
|
5810
|
+
registerInstance(this, hostRef);
|
|
5811
|
+
this.chOpen = createEvent(this, "chOpen");
|
|
5812
|
+
this.chClose = createEvent(this, "chClose");
|
|
5813
|
+
}
|
|
5814
|
+
/**
|
|
5815
|
+
* Whether the drawer is open. Kept in sync when the user closes it with
|
|
5816
|
+
* `Escape`, the close button or a click outside.
|
|
5817
|
+
*/
|
|
5818
|
+
open = false;
|
|
5819
|
+
/**
|
|
5820
|
+
* The edge the panel slides in from. `start`/`end` follow the writing
|
|
5821
|
+
* direction, so `start` is the left edge in LTR and the right edge in RTL.
|
|
5822
|
+
*/
|
|
5823
|
+
side = 'end';
|
|
5824
|
+
/**
|
|
5825
|
+
* Accessible name for the drawer, set as `aria-label`. A slotted heading
|
|
5826
|
+
* cannot be referenced with `aria-labelledby` across the shadow boundary, so
|
|
5827
|
+
* the name comes through this prop — and a modal dialog needs one, so pass
|
|
5828
|
+
* the same text as the heading.
|
|
5829
|
+
*/
|
|
5830
|
+
label;
|
|
5831
|
+
/**
|
|
5832
|
+
* Accessible label for the close button, set as `aria-label`. Setting it is
|
|
5833
|
+
* what adds the button: its only content is a decorative glyph, so without a
|
|
5834
|
+
* label it would have no accessible name.
|
|
5835
|
+
*/
|
|
5836
|
+
closeLabel;
|
|
5837
|
+
/**
|
|
5838
|
+
* Emitted after the drawer opens.
|
|
5839
|
+
*/
|
|
5840
|
+
chOpen;
|
|
5841
|
+
/**
|
|
5842
|
+
* Emitted after the drawer closes, however it was closed.
|
|
5843
|
+
*/
|
|
5844
|
+
chClose;
|
|
5845
|
+
dialog;
|
|
5846
|
+
scrollLocked = false;
|
|
5847
|
+
pointerDownedOutside = false;
|
|
5848
|
+
componentDidLoad() {
|
|
5849
|
+
// Wired here rather than in JSX because Stencil derives a listener's event
|
|
5850
|
+
// name from whether `on<name>` exists on `window`, which differs between
|
|
5851
|
+
// the browser and the test environment for pointer events.
|
|
5852
|
+
this.dialog?.addEventListener('close', this.handleNativeClose);
|
|
5853
|
+
this.dialog?.addEventListener('pointerdown', this.handlePointerDown);
|
|
5854
|
+
this.dialog?.addEventListener('click', this.handleClick);
|
|
5855
|
+
if (this.open) {
|
|
5856
|
+
this.showDialog();
|
|
5857
|
+
}
|
|
5858
|
+
}
|
|
5859
|
+
disconnectedCallback() {
|
|
5860
|
+
this.dialog?.removeEventListener('close', this.handleNativeClose);
|
|
5861
|
+
this.dialog?.removeEventListener('pointerdown', this.handlePointerDown);
|
|
5862
|
+
this.dialog?.removeEventListener('click', this.handleClick);
|
|
5863
|
+
this.unlockScroll();
|
|
5864
|
+
}
|
|
5865
|
+
handleOpenChange(open) {
|
|
5866
|
+
if (open) {
|
|
5867
|
+
this.showDialog();
|
|
5868
|
+
}
|
|
5869
|
+
else {
|
|
5870
|
+
this.closeDialog();
|
|
5871
|
+
}
|
|
5872
|
+
}
|
|
5873
|
+
showDialog() {
|
|
5874
|
+
if (typeof this.dialog?.showModal !== 'function') {
|
|
5875
|
+
return;
|
|
5876
|
+
}
|
|
5877
|
+
this.lockScroll();
|
|
5878
|
+
this.dialog.showModal();
|
|
5879
|
+
this.chOpen.emit();
|
|
5880
|
+
}
|
|
5881
|
+
closeDialog() {
|
|
5882
|
+
if (typeof this.dialog?.close === 'function' && this.dialog.open) {
|
|
5883
|
+
this.dialog.close();
|
|
5884
|
+
}
|
|
5885
|
+
}
|
|
5886
|
+
lockScroll() {
|
|
5887
|
+
if (this.scrollLocked) {
|
|
5888
|
+
return;
|
|
5889
|
+
}
|
|
5890
|
+
this.scrollLocked = true;
|
|
5891
|
+
lockScroll();
|
|
5892
|
+
}
|
|
5893
|
+
unlockScroll() {
|
|
5894
|
+
if (!this.scrollLocked) {
|
|
5895
|
+
return;
|
|
5896
|
+
}
|
|
5897
|
+
this.scrollLocked = false;
|
|
5898
|
+
unlockScroll();
|
|
5899
|
+
}
|
|
5900
|
+
/**
|
|
5901
|
+
* True for a pointer event on the backdrop: the `<dialog>` is the event
|
|
5902
|
+
* target for its own box only, and the coordinates fall outside that box.
|
|
5903
|
+
*/
|
|
5904
|
+
isOnBackdrop(event) {
|
|
5905
|
+
if (!this.dialog || event.target !== this.dialog) {
|
|
5906
|
+
return false;
|
|
5907
|
+
}
|
|
5908
|
+
const box = this.dialog.getBoundingClientRect();
|
|
5909
|
+
return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
|
|
5910
|
+
}
|
|
5911
|
+
handlePointerDown = (event) => {
|
|
5912
|
+
this.pointerDownedOutside = this.isOnBackdrop(event);
|
|
5913
|
+
};
|
|
5914
|
+
handleClick = (event) => {
|
|
5915
|
+
// Requiring the press to have started on the backdrop too keeps a
|
|
5916
|
+
// selection dragged out of the drawer, and a keyboard-synthesised click
|
|
5917
|
+
// (which reports coordinates of 0), from closing it.
|
|
5918
|
+
const dismiss = this.pointerDownedOutside && this.isOnBackdrop(event);
|
|
5919
|
+
this.pointerDownedOutside = false;
|
|
5920
|
+
if (dismiss) {
|
|
5921
|
+
this.closeDialog();
|
|
5922
|
+
}
|
|
5923
|
+
};
|
|
5924
|
+
handleNativeClose = () => {
|
|
5925
|
+
this.unlockScroll();
|
|
5926
|
+
if (this.open) {
|
|
5927
|
+
this.open = false;
|
|
5928
|
+
}
|
|
5929
|
+
this.chClose.emit();
|
|
5930
|
+
};
|
|
5931
|
+
handleCloseClick = () => {
|
|
5932
|
+
if (typeof this.dialog?.close === 'function' && this.dialog.open) {
|
|
5933
|
+
this.dialog.close();
|
|
5934
|
+
return;
|
|
5935
|
+
}
|
|
5936
|
+
this.open = false;
|
|
5937
|
+
this.chClose.emit();
|
|
5938
|
+
};
|
|
5939
|
+
render() {
|
|
5940
|
+
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" }))));
|
|
5941
|
+
}
|
|
5942
|
+
static get watchers() { return {
|
|
5943
|
+
"open": [{
|
|
5944
|
+
"handleOpenChange": 0
|
|
5945
|
+
}]
|
|
5946
|
+
}; }
|
|
5947
|
+
static get style() { return chDrawerCss(); }
|
|
5948
|
+
static get cmpMeta() { return {
|
|
5949
|
+
"$flags$": 777,
|
|
5950
|
+
"$tagName$": "ch-drawer",
|
|
5951
|
+
"$members$": {
|
|
5952
|
+
"open": [1028],
|
|
5953
|
+
"side": [1],
|
|
5954
|
+
"label": [1],
|
|
5955
|
+
"closeLabel": [1, "close-label"]
|
|
5956
|
+
},
|
|
5957
|
+
"$listeners$": undefined,
|
|
5958
|
+
"$lazyBundleId$": "-",
|
|
5959
|
+
"$attrsToReflect$": []
|
|
5960
|
+
}; }
|
|
5961
|
+
}
|
|
5962
|
+
|
|
5704
5963
|
const aaaa = "aaaa";
|
|
5705
5964
|
const ameno = "ameno";
|
|
5706
5965
|
const heart = "huemul-love";
|
|
@@ -5790,7 +6049,7 @@ class ChEmoji {
|
|
|
5790
6049
|
this.loaded = true;
|
|
5791
6050
|
};
|
|
5792
6051
|
render() {
|
|
5793
|
-
return (hAsync(Host, { key: '
|
|
6052
|
+
return (hAsync(Host, { key: '494b67e2300a9e1e9bb013aeefa6154cd26984ee' }, hAsync("img", { key: 'f05cacf5cdfdf09ba21a5841a6571741aa86e8b5', class: {
|
|
5794
6053
|
'emoji': true,
|
|
5795
6054
|
[`emoji--${this.size}`]: true,
|
|
5796
6055
|
'emoji--hidden': !this.loaded,
|
|
@@ -5942,7 +6201,7 @@ class ChInput {
|
|
|
5942
6201
|
return undefined;
|
|
5943
6202
|
}
|
|
5944
6203
|
render() {
|
|
5945
|
-
return (hAsync(Host, { key: '
|
|
6204
|
+
return (hAsync(Host, { key: 'cf143097fd39199c6c8a81484a4e8621e7c4d9cb' }, this.label && (hAsync("label", { key: '40643f72949b11fc7dcdd4a43794a37103708992', class: "label", htmlFor: this.inputId }, this.label)), hAsync("input", { key: 'ab3a0b8cc51e9c863001ddb089516bbf0874e889', 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: 'ad7eb7b40aaab69b6bc929c632ce4736fe3c39a5', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: '6f7738076128a8242d1dcc97ac99ee1275fc7e14', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
5946
6205
|
}
|
|
5947
6206
|
static get formAssociated() { return true; }
|
|
5948
6207
|
static get watchers() { return {
|
|
@@ -6036,11 +6295,8 @@ class ChLink {
|
|
|
6036
6295
|
}; }
|
|
6037
6296
|
}
|
|
6038
6297
|
|
|
6039
|
-
const chModalCss = () => `.modal{box-sizing:border-box;max-
|
|
6298
|
+
const chModalCss = () => `.modal{box-sizing:border-box;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--sm{max-width:min(var(--ch-modal-width, 24rem), calc(100vw - var(--spacing-6xl)))}.modal--md{max-width:min(var(--ch-modal-width, 32rem), calc(100vw - var(--spacing-6xl)))}.modal--lg{max-width:min(var(--ch-modal-width, 48rem), calc(100vw - var(--spacing-6xl)))}.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}}`;
|
|
6040
6299
|
|
|
6041
|
-
let openModals = 0;
|
|
6042
|
-
let previousOverflow = '';
|
|
6043
|
-
let previousPaddingRight = '';
|
|
6044
6300
|
/**
|
|
6045
6301
|
* Modal dialog, built on the native `<dialog>` element and opened with
|
|
6046
6302
|
* `showModal()`.
|
|
@@ -6083,6 +6339,13 @@ class ChModal {
|
|
|
6083
6339
|
* label it would have no accessible name.
|
|
6084
6340
|
*/
|
|
6085
6341
|
closeLabel;
|
|
6342
|
+
/**
|
|
6343
|
+
* The maximum width of the dialog. One of `sm` (24rem), `md` (32rem), or
|
|
6344
|
+
* `lg` (48rem). The `--ch-modal-width` custom property overrides it for a
|
|
6345
|
+
* width none of the three cover. Either way the dialog never exceeds the
|
|
6346
|
+
* viewport.
|
|
6347
|
+
*/
|
|
6348
|
+
size = 'md';
|
|
6086
6349
|
/**
|
|
6087
6350
|
* Emitted after the dialog opens.
|
|
6088
6351
|
*/
|
|
@@ -6137,31 +6400,14 @@ class ChModal {
|
|
|
6137
6400
|
return;
|
|
6138
6401
|
}
|
|
6139
6402
|
this.scrollLocked = true;
|
|
6140
|
-
|
|
6141
|
-
if (openModals > 1) {
|
|
6142
|
-
return;
|
|
6143
|
-
}
|
|
6144
|
-
const root = document.documentElement;
|
|
6145
|
-
const scrollbar = window.innerWidth - root.clientWidth;
|
|
6146
|
-
previousOverflow = root.style.overflow;
|
|
6147
|
-
previousPaddingRight = root.style.paddingRight;
|
|
6148
|
-
root.style.overflow = 'hidden';
|
|
6149
|
-
if (scrollbar > 0) {
|
|
6150
|
-
root.style.paddingRight = `${scrollbar}px`;
|
|
6151
|
-
}
|
|
6403
|
+
lockScroll();
|
|
6152
6404
|
}
|
|
6153
6405
|
unlockScroll() {
|
|
6154
6406
|
if (!this.scrollLocked) {
|
|
6155
6407
|
return;
|
|
6156
6408
|
}
|
|
6157
6409
|
this.scrollLocked = false;
|
|
6158
|
-
|
|
6159
|
-
if (openModals > 0) {
|
|
6160
|
-
return;
|
|
6161
|
-
}
|
|
6162
|
-
const root = document.documentElement;
|
|
6163
|
-
root.style.overflow = previousOverflow;
|
|
6164
|
-
root.style.paddingRight = previousPaddingRight;
|
|
6410
|
+
unlockScroll();
|
|
6165
6411
|
}
|
|
6166
6412
|
/**
|
|
6167
6413
|
* True for a pointer event on the backdrop: the `<dialog>` is the event
|
|
@@ -6203,7 +6449,7 @@ class ChModal {
|
|
|
6203
6449
|
this.chClose.emit();
|
|
6204
6450
|
};
|
|
6205
6451
|
render() {
|
|
6206
|
-
return (hAsync(Host, { key: '
|
|
6452
|
+
return (hAsync(Host, { key: 'd4dfbaad43391e3f34eb890b0d04a6ee38fa82e5' }, hAsync("dialog", { key: '3a3142c9baee06b381c7aaa920718f92bb8f1176', class: { modal: true, [`modal--${this.size}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, hAsync("div", { key: '34855134cc5cb2701a9b8b60ee46087d4f00fd13', class: "modal-head" }, hAsync("slot", { key: '7fa6a49a0f6b914fc8b825009bb46f5cd799f33b', name: "heading" }), this.closeLabel && (hAsync("button", { key: '55f15f81f94c7a08f54e9d6f9a722452b32f01af', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, hAsync("span", { key: '545af17e1065c558a1cc5274a444f610a77a3044', "aria-hidden": "true" }, "\u00D7")))), hAsync("div", { key: 'a78ea4c9f66c03d641c9ef1aa14058b6371160fb', class: "modal-body" }, hAsync("slot", { key: 'ffc1accb70cfc2e8ee6f11088a3a1da09a8b3430' })))));
|
|
6207
6453
|
}
|
|
6208
6454
|
static get watchers() { return {
|
|
6209
6455
|
"open": [{
|
|
@@ -6217,7 +6463,8 @@ class ChModal {
|
|
|
6217
6463
|
"$members$": {
|
|
6218
6464
|
"open": [1028],
|
|
6219
6465
|
"label": [1],
|
|
6220
|
-
"closeLabel": [1, "close-label"]
|
|
6466
|
+
"closeLabel": [1, "close-label"],
|
|
6467
|
+
"size": [1]
|
|
6221
6468
|
},
|
|
6222
6469
|
"$listeners$": undefined,
|
|
6223
6470
|
"$lazyBundleId$": "-",
|
|
@@ -6339,7 +6586,7 @@ class ChRadio {
|
|
|
6339
6586
|
}
|
|
6340
6587
|
render() {
|
|
6341
6588
|
const groupName = this.name || `${this.groupId}-group`;
|
|
6342
|
-
return (hAsync(Host, { key: '
|
|
6589
|
+
return (hAsync(Host, { key: '67d5306b86b9c5f6a085748cf18bcd8421afb7df' }, this.label && (hAsync("span", { key: '65ff0ced1f1954899765b1df3e77a0a10830b952', class: "group-label", id: this.labelId }, this.label)), hAsync("div", { key: '65d1a571a6a88ded21b3adc25dff9bd9cfbc5634', 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: '328c40801e34c823de319f5de92be8eb19360bcb', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: '3606463c798a7bd3ff0545e7691107cf506a2df1', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
6343
6590
|
}
|
|
6344
6591
|
static get formAssociated() { return true; }
|
|
6345
6592
|
static get watchers() { return {
|
|
@@ -6378,6 +6625,142 @@ class ChRadio {
|
|
|
6378
6625
|
}; }
|
|
6379
6626
|
}
|
|
6380
6627
|
|
|
6628
|
+
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}}`;
|
|
6629
|
+
|
|
6630
|
+
let segmentedIds = 0;
|
|
6631
|
+
/**
|
|
6632
|
+
* Compact control for switching between a few mutually exclusive options
|
|
6633
|
+
* (all/in/out, movement type, and similar filters).
|
|
6634
|
+
*
|
|
6635
|
+
* Built on native radio inputs sharing a name inside a `role="radiogroup"`,
|
|
6636
|
+
* so arrow-key navigation, a single tab stop, `:focus-visible` and native form
|
|
6637
|
+
* participation come from the platform instead of hand-rolled key handling.
|
|
6638
|
+
* It is form-associated like the other controls: inside a `<form>` the selected
|
|
6639
|
+
* value is submitted under `name`, and `required` with an empty value is
|
|
6640
|
+
* invalid.
|
|
6641
|
+
*
|
|
6642
|
+
* It differs from `ch-radio` in presentation only — segments in a joined track
|
|
6643
|
+
* instead of a vertical list of radio marks — so it is meant for compact
|
|
6644
|
+
* filters, not for long option lists.
|
|
6645
|
+
*/
|
|
6646
|
+
class ChSegmentedControl {
|
|
6647
|
+
constructor(hostRef) {
|
|
6648
|
+
registerInstance(this, hostRef);
|
|
6649
|
+
this.chChange = createEvent(this, "chChange");
|
|
6650
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
6651
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
6652
|
+
}
|
|
6653
|
+
else {
|
|
6654
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
6655
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
6656
|
+
}
|
|
6657
|
+
}
|
|
6658
|
+
groupId = `ch-segmented-${++segmentedIds}`;
|
|
6659
|
+
labelId = `${this.groupId}-label`;
|
|
6660
|
+
initialValue;
|
|
6661
|
+
internals;
|
|
6662
|
+
formDisabled = false;
|
|
6663
|
+
get host() { return getElement(this); }
|
|
6664
|
+
/**
|
|
6665
|
+
* Visible label describing the group, associated with it via
|
|
6666
|
+
* `aria-labelledby`.
|
|
6667
|
+
*/
|
|
6668
|
+
label;
|
|
6669
|
+
/**
|
|
6670
|
+
* The list of options rendered as segments.
|
|
6671
|
+
*/
|
|
6672
|
+
options = [];
|
|
6673
|
+
/**
|
|
6674
|
+
* The value of the selected option.
|
|
6675
|
+
*/
|
|
6676
|
+
value;
|
|
6677
|
+
/**
|
|
6678
|
+
* The size of the segments. Either `sm` or `md`.
|
|
6679
|
+
*/
|
|
6680
|
+
size = 'md';
|
|
6681
|
+
/**
|
|
6682
|
+
* The name shared by all radio inputs in the group, also used to submit the
|
|
6683
|
+
* value. Defaults to an auto-generated group name so options are mutually
|
|
6684
|
+
* exclusive out of the box.
|
|
6685
|
+
*/
|
|
6686
|
+
name;
|
|
6687
|
+
/**
|
|
6688
|
+
* Whether all segments are disabled.
|
|
6689
|
+
*/
|
|
6690
|
+
disabled = false;
|
|
6691
|
+
/**
|
|
6692
|
+
* Whether a value is required.
|
|
6693
|
+
*/
|
|
6694
|
+
required = false;
|
|
6695
|
+
/**
|
|
6696
|
+
* Emitted when a new option is selected, with the selected value.
|
|
6697
|
+
*/
|
|
6698
|
+
chChange;
|
|
6699
|
+
handleChange = (ev) => {
|
|
6700
|
+
this.value = ev.target.value;
|
|
6701
|
+
this.chChange.emit(this.value);
|
|
6702
|
+
};
|
|
6703
|
+
syncForm() {
|
|
6704
|
+
const internals = this.internals;
|
|
6705
|
+
if (typeof internals?.setFormValue !== 'function') {
|
|
6706
|
+
return;
|
|
6707
|
+
}
|
|
6708
|
+
internals.setFormValue(this.value ?? null);
|
|
6709
|
+
const flags = {};
|
|
6710
|
+
if (this.required && !this.value) {
|
|
6711
|
+
flags.valueMissing = true;
|
|
6712
|
+
}
|
|
6713
|
+
internals.setValidity(flags, flags.valueMissing ? 'Please fill out this field.' : undefined);
|
|
6714
|
+
}
|
|
6715
|
+
componentDidLoad() {
|
|
6716
|
+
this.initialValue = this.value;
|
|
6717
|
+
this.syncForm();
|
|
6718
|
+
this.host.addEventListener('change', this.markTouched);
|
|
6719
|
+
this.host.addEventListener('focusout', this.markTouched);
|
|
6720
|
+
this.host.addEventListener('invalid', this.markTouched);
|
|
6721
|
+
}
|
|
6722
|
+
markTouched = () => {
|
|
6723
|
+
this.host.setAttribute('data-touched', '');
|
|
6724
|
+
};
|
|
6725
|
+
formResetCallback() {
|
|
6726
|
+
this.value = this.initialValue;
|
|
6727
|
+
}
|
|
6728
|
+
formDisabledCallback(isDisabled) {
|
|
6729
|
+
this.formDisabled = isDisabled;
|
|
6730
|
+
}
|
|
6731
|
+
render() {
|
|
6732
|
+
const groupName = this.name || `${this.groupId}-group`;
|
|
6733
|
+
return (hAsync(Host, { key: 'd1b6810caed6826dc4020962c0e9dd0a037013e9' }, this.label && (hAsync("span", { key: '11bc2a5a41b38f10c7d5a6687609c3f3688db533', class: "group-label", id: this.labelId }, this.label)), hAsync("div", { key: 'ca18b975c4a0b7d42fea8ca6d483d58d15112f58', 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)))))));
|
|
6734
|
+
}
|
|
6735
|
+
static get formAssociated() { return true; }
|
|
6736
|
+
static get watchers() { return {
|
|
6737
|
+
"value": [{
|
|
6738
|
+
"syncForm": 0
|
|
6739
|
+
}],
|
|
6740
|
+
"required": [{
|
|
6741
|
+
"syncForm": 0
|
|
6742
|
+
}]
|
|
6743
|
+
}; }
|
|
6744
|
+
static get style() { return chSegmentedControlCss(); }
|
|
6745
|
+
static get cmpMeta() { return {
|
|
6746
|
+
"$flags$": 585,
|
|
6747
|
+
"$tagName$": "ch-segmented-control",
|
|
6748
|
+
"$members$": {
|
|
6749
|
+
"label": [1],
|
|
6750
|
+
"options": [16],
|
|
6751
|
+
"value": [1025],
|
|
6752
|
+
"size": [1],
|
|
6753
|
+
"name": [513],
|
|
6754
|
+
"disabled": [516],
|
|
6755
|
+
"required": [516],
|
|
6756
|
+
"formDisabled": [32]
|
|
6757
|
+
},
|
|
6758
|
+
"$listeners$": undefined,
|
|
6759
|
+
"$lazyBundleId$": "-",
|
|
6760
|
+
"$attrsToReflect$": [["name", "name"], ["disabled", "disabled"], ["required", "required"]]
|
|
6761
|
+
}; }
|
|
6762
|
+
}
|
|
6763
|
+
|
|
6381
6764
|
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)}`;
|
|
6382
6765
|
|
|
6383
6766
|
let selectIds = 0;
|
|
@@ -6493,7 +6876,7 @@ class ChSelect {
|
|
|
6493
6876
|
return undefined;
|
|
6494
6877
|
}
|
|
6495
6878
|
render() {
|
|
6496
|
-
return (hAsync(Host, { key: '
|
|
6879
|
+
return (hAsync(Host, { key: '3490540c681d453acea3a53fe09f52d1e51c61b3' }, this.label && (hAsync("label", { key: '33d478bb47da9fca08c57021decdf6c9eac00142', class: "label", htmlFor: this.selectId }, this.label)), hAsync("select", { key: 'b109bcf23a516df3190a6648d02163b84c0418ad', 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: '76e447051d2cf751211884a926df71a0eed141a7', 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: '8756bc6783bdb9d18d306516a89c805e6fc5b647', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (hAsync("p", { key: 'f52f95a4d067f29ae7ac22337622411a762385a0', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
6497
6880
|
}
|
|
6498
6881
|
static get formAssociated() { return true; }
|
|
6499
6882
|
static get watchers() { return {
|
|
@@ -6562,7 +6945,7 @@ class ChSpinner {
|
|
|
6562
6945
|
label;
|
|
6563
6946
|
render() {
|
|
6564
6947
|
const labelled = Boolean(this.label);
|
|
6565
|
-
return (hAsync(Host, { key: '
|
|
6948
|
+
return (hAsync(Host, { key: '027b184e902f41230aa10e15a3a28f2795758c57' }, hAsync("span", { key: '8fa60714afc8767a01f2b8b3313eb003576592b6', class: { spinner: true, [`spinner--${this.size}`]: true }, role: labelled ? 'status' : undefined, "aria-label": labelled ? this.label : undefined, "aria-hidden": labelled ? undefined : 'true' })));
|
|
6566
6949
|
}
|
|
6567
6950
|
static get style() { return chSpinnerCss(); }
|
|
6568
6951
|
static get cmpMeta() { return {
|
|
@@ -6689,7 +7072,7 @@ class ChSwitch {
|
|
|
6689
7072
|
return undefined;
|
|
6690
7073
|
}
|
|
6691
7074
|
render() {
|
|
6692
|
-
return (hAsync(Host, { key: '
|
|
7075
|
+
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))));
|
|
6693
7076
|
}
|
|
6694
7077
|
static get formAssociated() { return true; }
|
|
6695
7078
|
static get watchers() { return {
|
|
@@ -6812,7 +7195,7 @@ class ChTabs {
|
|
|
6812
7195
|
}
|
|
6813
7196
|
render() {
|
|
6814
7197
|
const active = this.activeValue;
|
|
6815
|
-
return (hAsync(Host, { key: '
|
|
7198
|
+
return (hAsync(Host, { key: '831a0c2d53d4caa19be95a3c2cbbfefb84f65599' }, hAsync("div", { key: '791bb980cb6d7bb137390737bba4796b9f86c963', class: "tablist", role: "tablist", "aria-label": this.label, onKeyDown: this.handleKeyDown, ref: el => (this.tablistEl = el) }, this.tabs.map(tab => {
|
|
6816
7199
|
const selected = tab.value === active;
|
|
6817
7200
|
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));
|
|
6818
7201
|
})), 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}` }))))));
|
|
@@ -6957,7 +7340,7 @@ class ChTextarea {
|
|
|
6957
7340
|
return undefined;
|
|
6958
7341
|
}
|
|
6959
7342
|
render() {
|
|
6960
|
-
return (hAsync(Host, { key: '
|
|
7343
|
+
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))));
|
|
6961
7344
|
}
|
|
6962
7345
|
static get formAssociated() { return true; }
|
|
6963
7346
|
static get watchers() { return {
|
|
@@ -7082,7 +7465,7 @@ class ChTooltip {
|
|
|
7082
7465
|
trigger.setAttribute('aria-describedby', content.id);
|
|
7083
7466
|
};
|
|
7084
7467
|
render() {
|
|
7085
|
-
return (hAsync(Host, { key: '
|
|
7468
|
+
return (hAsync(Host, { key: '77c1788847db3e52409bf13d1d21bf7828310ef5' }, hAsync("span", { key: '8fcb630946914891dbc1812e506a4160c101c426', class: "anchor" }, hAsync("slot", { key: '798c3d880b53191653f02fab57ce400fcf679f55', name: "trigger", onSlotchange: this.associate }), hAsync("span", { key: '3c10d8e0872da7c0f2920283f812e652ae3f2b71', class: { 'bubble': true, [`bubble--${this.placement}`]: true, 'bubble--visible': this.visible } }, hAsync("slot", { key: '3a9bc13d5871144d75153d248ee05a28dda6679e', name: "content", onSlotchange: this.associate })))));
|
|
7086
7469
|
}
|
|
7087
7470
|
static get style() { return chTooltipCss(); }
|
|
7088
7471
|
static get cmpMeta() { return {
|
|
@@ -7108,11 +7491,13 @@ registerComponents([
|
|
|
7108
7491
|
ChCard,
|
|
7109
7492
|
ChCheckbox,
|
|
7110
7493
|
ChDivider,
|
|
7494
|
+
ChDrawer,
|
|
7111
7495
|
ChEmoji,
|
|
7112
7496
|
ChInput,
|
|
7113
7497
|
ChLink,
|
|
7114
7498
|
ChModal,
|
|
7115
7499
|
ChRadio,
|
|
7500
|
+
ChSegmentedControl,
|
|
7116
7501
|
ChSelect,
|
|
7117
7502
|
ChSpinner,
|
|
7118
7503
|
ChSwitch,
|