@devschile/chucao 2.4.0 → 2.5.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/README.md +17 -16
- package/dist/chucao/chucao.css +1 -1
- package/dist/chucao/chucao.esm.js +1 -1
- package/dist/chucao/index.esm.js +1 -1
- package/dist/chucao/index.esm.js.map +1 -1
- package/dist/chucao/{p-1ebd9dc4.entry.js → p-0bc141a2.entry.js} +2 -2
- package/dist/chucao/{p-449e1ba0.entry.js → p-0e044eff.entry.js} +2 -2
- package/dist/chucao/{p-a07e0e97.entry.js → p-1108062e.entry.js} +2 -2
- package/dist/chucao/{p-85db779c.entry.js → p-26e144ff.entry.js} +2 -2
- package/dist/chucao/p-2c681cc0.entry.js +2 -0
- package/dist/chucao/p-2c681cc0.entry.js.map +1 -0
- package/dist/chucao/p-2e785177.entry.js +2 -0
- package/dist/chucao/{p-0e3c83a6.entry.js.map → p-2e785177.entry.js.map} +1 -1
- package/dist/chucao/{p-6e95f31f.entry.js → p-337d7f68.entry.js} +2 -2
- package/dist/chucao/{p-7c85f5fe.entry.js → p-350f974d.entry.js} +2 -2
- package/dist/chucao/p-4846cac4.entry.js +2 -0
- package/dist/chucao/{p-d0533af6.entry.js → p-6345c9e1.entry.js} +2 -2
- package/dist/chucao/p-957acf39.entry.js +2 -0
- package/dist/chucao/p-957acf39.entry.js.map +1 -0
- package/dist/chucao/{p-34a9d1f4.entry.js → p-97655c41.entry.js} +2 -2
- package/dist/chucao/{p-b5552b50.entry.js → p-9f73855e.entry.js} +2 -2
- package/dist/chucao/p-CIV5Gg1o.js +3 -0
- package/dist/chucao/p-CIV5Gg1o.js.map +1 -0
- package/dist/chucao/p-CnivhwvG.js +2 -0
- package/dist/chucao/p-CnivhwvG.js.map +1 -0
- package/dist/chucao/{p-17451d92.entry.js → p-b53d954e.entry.js} +2 -2
- package/dist/chucao/{p-d776b092.entry.js → p-b6cc08f0.entry.js} +2 -2
- package/dist/chucao/p-be7b5c21.entry.js +2 -0
- package/dist/chucao/p-be7b5c21.entry.js.map +1 -0
- package/dist/chucao/p-c165f839.entry.js +2 -0
- package/dist/chucao/p-c165f839.entry.js.map +1 -0
- package/dist/chucao/{p-56d64d84.entry.js → p-c251b0d1.entry.js} +2 -2
- package/dist/chucao/p-f5b74bca.entry.js +2 -0
- package/dist/chucao/p-f5b74bca.entry.js.map +1 -0
- package/dist/chucao/{p-84d875e9.entry.js → p-f9fe752c.entry.js} +2 -2
- package/dist/chucao/{p-1778a313.entry.js → p-fdf065e6.entry.js} +2 -2
- package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ch-alert_8.cjs.entry.js +34 -10
- package/dist/cjs/ch-alert_8.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/ch-cluster.cjs.entry.js +3 -3
- package/dist/cjs/ch-divider.cjs.entry.js +2 -2
- package/dist/cjs/ch-drawer.cjs.entry.js +2 -2
- package/dist/cjs/ch-emoji.cjs.entry.js +2 -2
- package/dist/cjs/ch-empty-state.cjs.entry.js +2 -2
- package/dist/cjs/ch-grid.cjs.entry.js +2 -2
- package/dist/cjs/ch-icon-button.cjs.entry.js +51 -0
- package/dist/cjs/ch-icon-button.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-icon.cjs.entry.js +38 -0
- package/dist/cjs/ch-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-link.cjs.entry.js +1 -1
- package/dist/cjs/ch-modal.cjs.entry.js +2 -2
- package/dist/cjs/ch-page-header.cjs.entry.js +45 -0
- package/dist/cjs/ch-page-header.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-radio.cjs.entry.js +2 -2
- package/dist/cjs/ch-segmented-control.cjs.entry.js +2 -2
- package/dist/cjs/ch-skeleton.cjs.entry.js +2 -2
- package/dist/cjs/ch-stack.cjs.entry.js +2 -2
- package/dist/cjs/ch-tabs.cjs.entry.js +2 -2
- package/dist/cjs/ch-textarea.cjs.entry.js +2 -2
- package/dist/cjs/ch-tooltip.cjs.entry.js +204 -5
- package/dist/cjs/ch-tooltip.cjs.entry.js.map +1 -1
- package/dist/cjs/chucao.cjs.js +2 -2
- package/dist/cjs/icons-CNyDgV-q.js +88 -0
- package/dist/cjs/icons-CNyDgV-q.js.map +1 -0
- package/dist/cjs/{index-ysucLiAq.js → index-ByZY6aTj.js} +81 -5
- package/dist/cjs/index-ByZY6aTj.js.map +1 -0
- package/dist/cjs/index.cjs.js +16 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/ch-alert/ch-alert.css +13 -0
- package/dist/collection/components/ch-alert/ch-alert.js +44 -1
- package/dist/collection/components/ch-alert/ch-alert.js.map +1 -1
- package/dist/collection/components/ch-badge/ch-badge.css +30 -1
- package/dist/collection/components/ch-badge/ch-badge.js +35 -1
- package/dist/collection/components/ch-badge/ch-badge.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-cluster/ch-cluster.js +2 -2
- package/dist/collection/components/ch-divider/ch-divider.js +1 -1
- package/dist/collection/components/ch-drawer/ch-drawer.js +1 -1
- package/dist/collection/components/ch-emoji/ch-emoji.js +1 -1
- package/dist/collection/components/ch-empty-state/ch-empty-state.js +1 -1
- package/dist/collection/components/ch-grid/ch-grid.js +1 -1
- package/dist/collection/components/ch-icon/ch-icon.css +25 -0
- package/dist/collection/components/ch-icon/ch-icon.js +121 -0
- package/dist/collection/components/ch-icon/ch-icon.js.map +1 -0
- package/dist/collection/components/ch-icon-button/ch-icon-button.css +99 -0
- package/dist/collection/components/ch-icon-button/ch-icon-button.js +216 -0
- package/dist/collection/components/ch-icon-button/ch-icon-button.js.map +1 -0
- package/dist/collection/components/ch-input/ch-input.js +1 -1
- package/dist/collection/components/ch-modal/ch-modal.js +1 -1
- package/dist/collection/components/ch-page-header/ch-page-header.css +84 -0
- package/dist/collection/components/ch-page-header/ch-page-header.js +162 -0
- package/dist/collection/components/ch-page-header/ch-page-header.js.map +1 -0
- package/dist/collection/components/ch-radio/ch-radio.js +1 -1
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +1 -1
- package/dist/collection/components/ch-select/ch-select.js +1 -1
- package/dist/collection/components/ch-skeleton/ch-skeleton.js +1 -1
- package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
- package/dist/collection/components/ch-stack/ch-stack.js +1 -1
- package/dist/collection/components/ch-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.css +29 -1
- package/dist/collection/components/ch-tooltip/ch-tooltip.js +125 -6
- package/dist/collection/components/ch-tooltip/ch-tooltip.js.map +1 -1
- package/dist/collection/tokens/tokens.js +12 -0
- package/dist/collection/tokens/tokens.js.map +1 -1
- package/dist/collection/tokens/types.js.map +1 -1
- package/dist/collection/utils/icons.js +82 -0
- package/dist/collection/utils/icons.js.map +1 -0
- package/dist/collection/utils/overlay.js +101 -0
- package/dist/collection/utils/overlay.js.map +1 -0
- package/dist/components/ch-accordion.js +1 -1
- package/dist/components/ch-alert.js +1 -1
- package/dist/components/ch-alert.js.map +1 -1
- package/dist/components/ch-badge.js +1 -1
- package/dist/components/ch-badge.js.map +1 -1
- package/dist/components/ch-button.js +1 -1
- package/dist/components/ch-card.js +1 -1
- package/dist/components/ch-checkbox.js +1 -1
- package/dist/components/ch-cluster.js +1 -1
- package/dist/components/ch-divider.js +1 -1
- package/dist/components/ch-drawer.js +1 -1
- package/dist/components/ch-emoji.js +1 -1
- package/dist/components/ch-empty-state.js +1 -1
- package/dist/components/ch-grid.js +1 -1
- package/dist/components/ch-icon-button.d.ts +11 -0
- package/dist/components/ch-icon-button.js +2 -0
- package/dist/components/ch-icon-button.js.map +1 -0
- package/dist/components/ch-icon.d.ts +11 -0
- package/dist/components/ch-icon.js +2 -0
- package/dist/components/ch-icon.js.map +1 -0
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-link.js +1 -1
- package/dist/components/ch-modal.js +1 -1
- package/dist/components/ch-page-header.d.ts +11 -0
- package/dist/components/ch-page-header.js +2 -0
- package/dist/components/ch-page-header.js.map +1 -0
- package/dist/components/ch-radio.js +1 -1
- package/dist/components/ch-segmented-control.js +1 -1
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-skeleton.js +1 -1
- package/dist/components/ch-spinner.js +1 -1
- package/dist/components/ch-stack.js +1 -1
- package/dist/components/ch-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/ch-tooltip.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-no2_9Jk-.js → p-CV0rD-fF.js} +2 -2
- package/dist/components/p-CnivhwvG.js +2 -0
- package/dist/components/p-CnivhwvG.js.map +1 -0
- package/dist/components/p-qP_9qshx.js +2 -0
- package/dist/components/p-qP_9qshx.js.map +1 -0
- package/dist/esm/ch-accordion.entry.js +1 -1
- package/dist/esm/ch-alert_8.entry.js +34 -10
- package/dist/esm/ch-alert_8.entry.js.map +1 -1
- package/dist/esm/ch-checkbox.entry.js +2 -2
- package/dist/esm/ch-cluster.entry.js +3 -3
- package/dist/esm/ch-divider.entry.js +2 -2
- package/dist/esm/ch-drawer.entry.js +2 -2
- package/dist/esm/ch-emoji.entry.js +2 -2
- package/dist/esm/ch-empty-state.entry.js +2 -2
- package/dist/esm/ch-grid.entry.js +2 -2
- package/dist/esm/ch-icon-button.entry.js +49 -0
- package/dist/esm/ch-icon-button.entry.js.map +1 -0
- package/dist/esm/ch-icon.entry.js +36 -0
- package/dist/esm/ch-icon.entry.js.map +1 -0
- package/dist/esm/ch-link.entry.js +1 -1
- package/dist/esm/ch-modal.entry.js +2 -2
- package/dist/esm/ch-page-header.entry.js +43 -0
- package/dist/esm/ch-page-header.entry.js.map +1 -0
- package/dist/esm/ch-radio.entry.js +2 -2
- package/dist/esm/ch-segmented-control.entry.js +2 -2
- package/dist/esm/ch-skeleton.entry.js +2 -2
- package/dist/esm/ch-stack.entry.js +2 -2
- package/dist/esm/ch-tabs.entry.js +2 -2
- package/dist/esm/ch-textarea.entry.js +2 -2
- package/dist/esm/ch-tooltip.entry.js +204 -5
- package/dist/esm/ch-tooltip.entry.js.map +1 -1
- package/dist/esm/chucao.js +3 -3
- package/dist/esm/icons-CnivhwvG.js +86 -0
- package/dist/esm/icons-CnivhwvG.js.map +1 -0
- package/dist/esm/{index-DVKZbUp9.js → index-CIV5Gg1o.js} +81 -6
- package/dist/esm/index-CIV5Gg1o.js.map +1 -0
- package/dist/esm/index.js +13 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/ch-alert/ch-alert.d.ts +11 -0
- package/dist/types/components/ch-badge/ch-badge.d.ts +14 -0
- package/dist/types/components/ch-icon/ch-icon.d.ts +29 -0
- package/dist/types/components/ch-icon-button/ch-icon-button.d.ts +36 -0
- package/dist/types/components/ch-page-header/ch-page-header.d.ts +39 -0
- package/dist/types/components/ch-tooltip/ch-tooltip.d.ts +32 -2
- package/dist/types/components.d.ts +406 -2
- package/dist/types/tokens/tokens.d.ts +12 -0
- package/dist/types/tokens/types.d.ts +2 -1
- package/dist/types/utils/icons.d.ts +15 -0
- package/dist/types/utils/overlay.d.ts +49 -0
- package/dist-react/components.d.ts +12 -1
- package/dist-react/components.js +27 -0
- package/dist-react/components.ts +37 -1
- package/dist-vue/index.d.ts +3 -0
- package/dist-vue/index.js +29 -1
- package/dist-vue/index.ts +35 -1
- package/hydrate/index.js +601 -34
- package/hydrate/index.mjs +601 -34
- package/package.json +91 -4
- package/dist/chucao/p-0e3c83a6.entry.js +0 -2
- package/dist/chucao/p-82216381.entry.js +0 -2
- package/dist/chucao/p-82216381.entry.js.map +0 -1
- package/dist/chucao/p-907195ff.entry.js +0 -2
- package/dist/chucao/p-DVKZbUp9.js +0 -3
- package/dist/chucao/p-DVKZbUp9.js.map +0 -1
- package/dist/chucao/p-b392021c.entry.js +0 -2
- package/dist/chucao/p-b392021c.entry.js.map +0 -1
- package/dist/cjs/index-ysucLiAq.js.map +0 -1
- package/dist/components/p-DQOKq7af.js +0 -2
- package/dist/components/p-DQOKq7af.js.map +0 -1
- package/dist/esm/index-DVKZbUp9.js.map +0 -1
- /package/dist/chucao/{p-1ebd9dc4.entry.js.map → p-0bc141a2.entry.js.map} +0 -0
- /package/dist/chucao/{p-449e1ba0.entry.js.map → p-0e044eff.entry.js.map} +0 -0
- /package/dist/chucao/{p-a07e0e97.entry.js.map → p-1108062e.entry.js.map} +0 -0
- /package/dist/chucao/{p-85db779c.entry.js.map → p-26e144ff.entry.js.map} +0 -0
- /package/dist/chucao/{p-6e95f31f.entry.js.map → p-337d7f68.entry.js.map} +0 -0
- /package/dist/chucao/{p-7c85f5fe.entry.js.map → p-350f974d.entry.js.map} +0 -0
- /package/dist/chucao/{p-907195ff.entry.js.map → p-4846cac4.entry.js.map} +0 -0
- /package/dist/chucao/{p-d0533af6.entry.js.map → p-6345c9e1.entry.js.map} +0 -0
- /package/dist/chucao/{p-34a9d1f4.entry.js.map → p-97655c41.entry.js.map} +0 -0
- /package/dist/chucao/{p-b5552b50.entry.js.map → p-9f73855e.entry.js.map} +0 -0
- /package/dist/chucao/{p-17451d92.entry.js.map → p-b53d954e.entry.js.map} +0 -0
- /package/dist/chucao/{p-d776b092.entry.js.map → p-b6cc08f0.entry.js.map} +0 -0
- /package/dist/chucao/{p-56d64d84.entry.js.map → p-c251b0d1.entry.js.map} +0 -0
- /package/dist/chucao/{p-84d875e9.entry.js.map → p-f9fe752c.entry.js.map} +0 -0
- /package/dist/chucao/{p-1778a313.entry.js.map → p-fdf065e6.entry.js.map} +0 -0
- /package/dist/components/{p-no2_9Jk-.js.map → p-CV0rD-fF.js.map} +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
|
+
import { c as chIcons } from './icons-CnivhwvG.js';
|
|
3
|
+
|
|
4
|
+
const chIconButtonCss = () => `:host{display:inline-block}.button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;border:var(--border-width) solid var(--border);border-radius:var(--radius-pill);background:transparent;color:var(--text);cursor:pointer;transition:background-color var(--duration-normal) var(--easing-default), border-color var(--duration-normal) var(--easing-default), color var(--duration-normal) var(--easing-default)}.button--sm{width:calc(var(--icon-size-sm) + 2 * var(--spacing-md));height:calc(var(--icon-size-sm) + 2 * var(--spacing-md))}.button--md{width:calc(var(--icon-size-md) + 2 * var(--spacing-xl));height:calc(var(--icon-size-md) + 2 * var(--spacing-xl))}.button--lg{width:calc(var(--icon-size-lg) + 2 * var(--spacing-2xl));height:calc(var(--icon-size-lg) + 2 * var(--spacing-2xl))}.button--sm .icon{width:var(--icon-size-sm);height:var(--icon-size-sm)}.button--md .icon{width:var(--icon-size-md);height:var(--icon-size-md)}.button--lg .icon{width:var(--icon-size-lg);height:var(--icon-size-lg)}.button:hover:not([aria-disabled='true']){border-color:var(--border-hover);background:var(--surface-hover)}.button:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.button[aria-disabled='true']{opacity:var(--opacity-disabled);cursor:not-allowed}.button[aria-busy='true']{cursor:progress}.button[aria-busy='true'] .icon{animation:ch-icon-button-spin var(--duration-spin) linear infinite}@keyframes ch-icon-button-spin{to{transform:rotate(360deg)}}@media (pointer: coarse){.button--sm{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.button{transition:none}.button[aria-busy='true'] .icon{animation:none}}`;
|
|
5
|
+
|
|
6
|
+
const ChIconButton = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.chClick = createEvent(this, "chClick");
|
|
10
|
+
}
|
|
11
|
+
/** The glyph to draw. */
|
|
12
|
+
name;
|
|
13
|
+
/**
|
|
14
|
+
* Accessible name, set as `aria-label`. Required: say what the button does
|
|
15
|
+
* ("Eliminar producto"), not what the glyph is ("papelera").
|
|
16
|
+
*/
|
|
17
|
+
label;
|
|
18
|
+
/** Visual size. `md` matches the height of a default `ch-button`. */
|
|
19
|
+
size = 'md';
|
|
20
|
+
/** Native button type, defaulting to `button` so it never submits a form by accident. */
|
|
21
|
+
type = 'button';
|
|
22
|
+
disabled = false;
|
|
23
|
+
/**
|
|
24
|
+
* Blocks pointer and keyboard activation and marks the button `aria-busy`
|
|
25
|
+
* while keeping it focusable, so focus does not fall to `<body>` when an
|
|
26
|
+
* action completes.
|
|
27
|
+
*/
|
|
28
|
+
loading = false;
|
|
29
|
+
/** Emitted on click. A click while disabled or loading emits nothing. */
|
|
30
|
+
chClick;
|
|
31
|
+
handleClick = (event) => {
|
|
32
|
+
if (this.disabled || this.loading) {
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
event.stopImmediatePropagation();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.chClick.emit(event);
|
|
38
|
+
};
|
|
39
|
+
render() {
|
|
40
|
+
const shapes = this.name ? chIcons[this.name] : undefined;
|
|
41
|
+
return (h(Host, { key: '235a3813a30b5e98cc0b37774e0fe9cce680ac4c' }, h("button", { key: 'e2d76ea663bb4746f1431affde538c2429033615', class: `button button--${this.size}`, type: this.type, "aria-label": this.label, "aria-busy": this.loading ? 'true' : undefined, "aria-disabled": this.disabled ? 'true' : undefined, onClick: this.handleClick }, h("svg", { key: '3cbc2fc57cf274920dbb12fb7f0a6eed189e7b23', class: "icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true", focusable: "false" }, (shapes ?? []).map(shape => h(shape.tag, shape.attrs))))));
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
ChIconButton.style = chIconButtonCss();
|
|
45
|
+
|
|
46
|
+
export { ChIconButton as ch_icon_button };
|
|
47
|
+
//# sourceMappingURL=ch-icon-button.entry.js.map
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=ch-icon-button.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-icon-button.entry.js","sources":["src/components/ch-icon-button/ch-icon-button.css?tag=ch-icon-button&encapsulation=shadow","src/components/ch-icon-button/ch-icon-button.tsx"],"sourcesContent":[":host {\n display: inline-block;\n}\n\n.button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n border: var(--border-width) solid var(--border);\n border-radius: var(--radius-pill);\n background: transparent;\n color: var(--text);\n cursor: pointer;\n transition:\n background-color var(--duration-normal) var(--easing-default),\n border-color var(--duration-normal) var(--easing-default),\n color var(--duration-normal) var(--easing-default);\n}\n\n/* Square hit area at each size, matching the height of the same-size ch-button\n so the two line up in a toolbar. */\n.button--sm {\n width: calc(var(--icon-size-sm) + 2 * var(--spacing-md));\n height: calc(var(--icon-size-sm) + 2 * var(--spacing-md));\n}\n\n.button--md {\n width: calc(var(--icon-size-md) + 2 * var(--spacing-xl));\n height: calc(var(--icon-size-md) + 2 * var(--spacing-xl));\n}\n\n.button--lg {\n width: calc(var(--icon-size-lg) + 2 * var(--spacing-2xl));\n height: calc(var(--icon-size-lg) + 2 * var(--spacing-2xl));\n}\n\n.button--sm .icon {\n width: var(--icon-size-sm);\n height: var(--icon-size-sm);\n}\n\n.button--md .icon {\n width: var(--icon-size-md);\n height: var(--icon-size-md);\n}\n\n.button--lg .icon {\n width: var(--icon-size-lg);\n height: var(--icon-size-lg);\n}\n\n.button:hover:not([aria-disabled='true']) {\n border-color: var(--border-hover);\n background: var(--surface-hover);\n}\n\n.button:focus-visible {\n outline: var(--focus-outline-width) solid var(--accent);\n outline-offset: var(--focus-outline-offset);\n}\n\n/* Disabled stays focusable on purpose: dropping focus to <body> when an action\n completes is worse than a button that can still be read. */\n.button[aria-disabled='true'] {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.button[aria-busy='true'] {\n cursor: progress;\n}\n\n.button[aria-busy='true'] .icon {\n animation: ch-icon-button-spin var(--duration-spin) linear infinite;\n}\n\n@keyframes ch-icon-button-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n@media (pointer: coarse) {\n .button--sm {\n min-width: 44px;\n min-height: 44px;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .button {\n transition: none;\n }\n\n .button[aria-busy='true'] .icon {\n animation: none;\n }\n}\n","import { Component, Event, type EventEmitter, Host, Prop, h } from '@stencil/core';\n\nimport { chIcons, type ChIconName } from '../../utils/icons';\n\nexport type ChIconButtonSize = 'sm' | 'md' | 'lg';\n\n/**\n * A button whose only content is an icon.\n *\n * The label is required rather than optional. An icon-only button without an\n * accessible name is unusable by voice, screen reader or automation, and there\n * is no adjacent text to fall back on — the same reasoning as `ch-modal`, and\n * the reason this component exists instead of letting consumers bolt an icon\n * slot onto `ch-button` and forget the name.\n */\n@Component({\n tag: 'ch-icon-button',\n styleUrl: 'ch-icon-button.css',\n shadow: true,\n})\nexport class ChIconButton {\n /** The glyph to draw. */\n @Prop() name!: ChIconName;\n\n /**\n * Accessible name, set as `aria-label`. Required: say what the button does\n * (\"Eliminar producto\"), not what the glyph is (\"papelera\").\n */\n @Prop() label!: string;\n\n /** Visual size. `md` matches the height of a default `ch-button`. */\n @Prop() size: ChIconButtonSize = 'md';\n\n /** Native button type, defaulting to `button` so it never submits a form by accident. */\n @Prop() type: 'button' | 'submit' | 'reset' = 'button';\n\n @Prop() disabled = false;\n\n /**\n * Blocks pointer and keyboard activation and marks the button `aria-busy`\n * while keeping it focusable, so focus does not fall to `<body>` when an\n * action completes.\n */\n @Prop() loading = false;\n\n /** Emitted on click. A click while disabled or loading emits nothing. */\n @Event() chClick: EventEmitter<MouseEvent>;\n\n private handleClick = (event: MouseEvent) => {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n this.chClick.emit(event);\n };\n\n render() {\n const shapes = this.name ? chIcons[this.name] : undefined;\n\n return (\n <Host>\n <button\n class={`button button--${this.size}`}\n type={this.type}\n aria-label={this.label}\n aria-busy={this.loading ? 'true' : undefined}\n aria-disabled={this.disabled ? 'true' : undefined}\n onClick={this.handleClick}\n >\n <svg\n class=\"icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n {(shapes ?? []).map(shape => h(shape.tag, shape.attrs))}\n </svg>\n </button>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;AAAA,MAAM,eAAe,GAAG,MAAM,CAAC,+rDAA+rD,CAAC;;MCoBltD,YAAY,GAAA,MAAA;;;;;;AAEf,IAAA,IAAI;AAEZ;;;AAGG;AACK,IAAA,KAAK;;IAGL,IAAI,GAAqB,IAAI;;IAG7B,IAAI,GAAkC,QAAQ;IAE9C,QAAQ,GAAG,KAAK;AAExB;;;;AAIG;IACK,OAAO,GAAG,KAAK;;AAGd,IAAA,OAAO;AAER,IAAA,WAAW,GAAG,CAAC,KAAiB,KAAI;QAC1C,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE;YACjC,KAAK,CAAC,cAAc,EAAE;YACtB,KAAK,CAAC,wBAAwB,EAAE;YAChC;;AAEF,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1B,KAAC;IAED,MAAM,GAAA;AACJ,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS;AAEzD,QAAA,QACE,EAAC,IAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACH,CAAA,CAAA,QAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,KAAK,EAAE,CAAA,eAAA,EAAkB,IAAI,CAAC,IAAI,CAAA,CAAE,EACpC,IAAI,EAAE,IAAI,CAAC,IAAI,gBACH,IAAI,CAAC,KAAK,EAAA,WAAA,EACX,IAAI,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,mBAC7B,IAAI,CAAC,QAAQ,GAAG,MAAM,GAAG,SAAS,EACjD,OAAO,EAAE,IAAI,CAAC,WAAW,EAAA,EAEzB,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,KAAK,EAAC,MAAM,EACZ,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EAAA,cAAA,EACR,GAAG,EAAA,gBAAA,EACD,OAAO,EAAA,iBAAA,EACN,OAAO,EAAA,aAAA,EACX,MAAM,EAClB,SAAS,EAAC,OAAO,IAEhB,CAAC,MAAM,IAAI,EAAE,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CACnD,CACC,CACJ;;;;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
|
+
import { c as chIcons } from './icons-CnivhwvG.js';
|
|
3
|
+
|
|
4
|
+
const chIconCss = () => `:host{display:inline-flex;line-height:0}.icon{display:block;flex:none;color:inherit}.icon--sm{width:var(--icon-size-sm);height:var(--icon-size-sm)}.icon--md{width:var(--icon-size-md);height:var(--icon-size-md)}.icon--lg{width:var(--icon-size-lg);height:var(--icon-size-lg)}`;
|
|
5
|
+
|
|
6
|
+
const ChIcon = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Which glyph to draw. Unknown values render nothing rather than throwing,
|
|
12
|
+
* so a stale name in a data payload cannot break the page.
|
|
13
|
+
*/
|
|
14
|
+
name;
|
|
15
|
+
/**
|
|
16
|
+
* `sm` is 16px, `md` is 20px and `lg` is 24px — the sizes the scale's line
|
|
17
|
+
* heights were built around.
|
|
18
|
+
*/
|
|
19
|
+
size = 'md';
|
|
20
|
+
/**
|
|
21
|
+
* Accessible name. When set, the icon becomes `role="img"` and is announced;
|
|
22
|
+
* when omitted it is `aria-hidden`.
|
|
23
|
+
*/
|
|
24
|
+
label;
|
|
25
|
+
render() {
|
|
26
|
+
const shapes = this.name ? chIcons[this.name] : undefined;
|
|
27
|
+
const decorative = !this.label;
|
|
28
|
+
return (h(Host, { key: '46040274042301b799f103c483281a0c8088c23d' }, h("svg", { key: '9e116b6983020700ceababc691216b1f05d1c460', class: `icon icon--${this.size}`, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", role: decorative ? undefined : 'img', "aria-label": this.label, "aria-hidden": decorative ? 'true' : undefined, focusable: "false" }, (shapes ?? []).map(shape => h(shape.tag, shape.attrs)))));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
ChIcon.style = chIconCss();
|
|
32
|
+
|
|
33
|
+
export { ChIcon as ch_icon };
|
|
34
|
+
//# sourceMappingURL=ch-icon.entry.js.map
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=ch-icon.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-icon.entry.js","sources":["src/components/ch-icon/ch-icon.css?tag=ch-icon&encapsulation=shadow","src/components/ch-icon/ch-icon.tsx"],"sourcesContent":[":host {\n display: inline-flex;\n line-height: 0;\n}\n\n.icon {\n display: block;\n flex: none;\n color: inherit;\n}\n\n.icon--sm {\n width: var(--icon-size-sm);\n height: var(--icon-size-sm);\n}\n\n.icon--md {\n width: var(--icon-size-md);\n height: var(--icon-size-md);\n}\n\n.icon--lg {\n width: var(--icon-size-lg);\n height: var(--icon-size-lg);\n}\n","import { Component, Host, Prop, h } from '@stencil/core';\n\nimport { chIcons, type ChIconName } from '../../utils/icons';\n\nexport type ChIconSize = 'sm' | 'md' | 'lg';\n\n/**\n * A single Lucide glyph.\n *\n * Decorative by default: the icon is hidden from assistive technology unless\n * you give it a `label`, because most icons sit next to text that already says\n * what they mean and a second announcement is noise. Set `label` only when the\n * icon carries meaning on its own; a control whose only content is an icon\n * should use `ch-icon-button`, which requires the name.\n */\n@Component({\n tag: 'ch-icon',\n styleUrl: 'ch-icon.css',\n shadow: true,\n})\nexport class ChIcon {\n /**\n * Which glyph to draw. Unknown values render nothing rather than throwing,\n * so a stale name in a data payload cannot break the page.\n */\n @Prop() name!: ChIconName;\n\n /**\n * `sm` is 16px, `md` is 20px and `lg` is 24px — the sizes the scale's line\n * heights were built around.\n */\n @Prop() size: ChIconSize = 'md';\n\n /**\n * Accessible name. When set, the icon becomes `role=\"img\"` and is announced;\n * when omitted it is `aria-hidden`.\n */\n @Prop() label?: string;\n\n render() {\n const shapes = this.name ? chIcons[this.name] : undefined;\n const decorative = !this.label;\n\n return (\n <Host>\n <svg\n class={`icon icon--${this.size}`}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n role={decorative ? undefined : 'img'}\n aria-label={this.label}\n aria-hidden={decorative ? 'true' : undefined}\n focusable=\"false\"\n >\n {(shapes ?? []).map(shape => h(shape.tag, shape.attrs))}\n </svg>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;AAAA,MAAM,SAAS,GAAG,MAAM,CAAC,iRAAiR,CAAC;;MCoB9R,MAAM,GAAA,MAAA;;;;AACjB;;;AAGG;AACK,IAAA,IAAI;AAEZ;;;AAGG;IACK,IAAI,GAAe,IAAI;AAE/B;;;AAGG;AACK,IAAA,KAAK;IAEb,MAAM,GAAA;AACJ,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS;AACzD,QAAA,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,KAAK;QAE9B,QACE,EAAC,IAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACH,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,KAAK,EAAE,CAAA,WAAA,EAAc,IAAI,CAAC,IAAI,CAAA,CAAE,EAChC,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EAAA,cAAA,EACR,GAAG,oBACD,OAAO,EAAA,iBAAA,EACN,OAAO,EACvB,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,KAAK,EAAA,YAAA,EACxB,IAAI,CAAC,KAAK,EAAA,aAAA,EACT,UAAU,GAAG,MAAM,GAAG,SAAS,EAC5C,SAAS,EAAC,OAAO,EAAA,EAEhB,CAAC,MAAM,IAAI,EAAE,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CACnD,CACD;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
2
|
|
|
3
3
|
const chLinkCss = () => `:host{display:inline}.link{color:var(--accent);font-weight:var(--typography-weight-semibold);text-decoration:var(--ch-link-text-decoration, underline);text-decoration-thickness:var(--border-width);text-underline-offset:var(--spacing-shift);border-radius:var(--radius-sm);transition:color var(--duration-normal) var(--easing-default), opacity var(--duration-normal) var(--easing-default)}.link:hover{color:var(--accent-hover)}.link:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.link--muted{color:var(--text-muted);text-decoration:none}.link--muted:hover{color:var(--text)}.link--disabled{color:var(--text-muted);text-decoration:none;opacity:var(--opacity-disabled);cursor:not-allowed}`;
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
2
|
import { l as lockScroll, u as unlockScroll } from './scroll-lock-d8DfpzMR.js';
|
|
3
3
|
|
|
4
4
|
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}}`;
|
|
@@ -138,7 +138,7 @@ const ChModal = class {
|
|
|
138
138
|
this.chClose.emit();
|
|
139
139
|
};
|
|
140
140
|
render() {
|
|
141
|
-
return (h(Host, { key: '
|
|
141
|
+
return (h(Host, { key: 'c50dad31f2b1897549837aed1d8e6df2df8cd491' }, h("dialog", { key: '327f6ef27b447386c180248bbeab4cc3ee0160eb', class: { modal: true, [`modal--${this.size}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, h("div", { key: 'c8c2f8eacf26c817073920bc2ef1c7ac89fe8208', class: "modal-head" }, h("slot", { key: '73d0e3ae45c7936d345ce6f3262d9ce08058b9e7', name: "heading" }), this.closeLabel && (h("button", { key: 'a72d04701cd9d60e6c1486f5c38f46f7f3ff1da5', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, h("span", { key: '10d1b697611309e79f28dcad9385fa7e4300c916', "aria-hidden": "true" }, "\u00D7")))), h("div", { key: '040029fdc7dc7544a15b51f3c0b7d855902b7028', class: "modal-body" }, h("slot", { key: '00291b7d78f49dcf366c1780562893260be3dc74' })))));
|
|
142
142
|
}
|
|
143
143
|
static get watchers() { return {
|
|
144
144
|
"open": [{
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
|
+
|
|
3
|
+
const chPageHeaderCss = () => `:host{display:block}.header{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:var(--spacing-2xl);padding-bottom:var(--spacing-2xl);border-bottom:var(--border-width) solid var(--border)}.header-text{display:flex;flex-direction:column;gap:var(--spacing-xs);flex:1 1 20rem;min-width:0}.header-eyebrow{margin:0;color:var(--text-secondary);font-family:var(--font-heading);font-size:var(--typography-size-xs);letter-spacing:var(--typography-tracking-badge);text-transform:uppercase}.header-title{margin:0;color:var(--text);font-family:var(--font-heading);font-size:var(--typography-size-xl);font-weight:var(--typography-weight-bold);line-height:1.2;overflow-wrap:anywhere}.header-description{margin:0;color:var(--text-secondary);font-size:var(--typography-size-sm);line-height:1.5;overflow-wrap:anywhere}.header-actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--spacing-md);max-width:100%}.header-actions:empty{display:none}.header--stacked .header-actions{flex-basis:100%}@media (max-width: 30rem){.header{flex-direction:column}.header-actions{width:100%}}@media (forced-colors: active){.header{border-bottom-color:CanvasText}}`;
|
|
4
|
+
|
|
5
|
+
const ChPageHeader = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The page title. Rendered as a real heading, so it also works as the
|
|
11
|
+
* accessible name of the page region.
|
|
12
|
+
*/
|
|
13
|
+
title;
|
|
14
|
+
/**
|
|
15
|
+
* Heading element to render. Use `h2` (or `h3`) when the page already has a
|
|
16
|
+
* higher-level heading above this block, so the document outline stays valid.
|
|
17
|
+
*/
|
|
18
|
+
headingLevel = 'h1';
|
|
19
|
+
/**
|
|
20
|
+
* Optional small label above the title, as slotted content. Use it for a
|
|
21
|
+
* section or entity kind ("Proyecto", "Factura #1042"), not for the title.
|
|
22
|
+
*/
|
|
23
|
+
eyebrow;
|
|
24
|
+
/**
|
|
25
|
+
* Optional supporting line under the title.
|
|
26
|
+
*/
|
|
27
|
+
description;
|
|
28
|
+
/**
|
|
29
|
+
* Puts the actions below the title instead of beside it. Use it when the
|
|
30
|
+
* actions are too wide to sit on the same row even after wrapping.
|
|
31
|
+
*/
|
|
32
|
+
actionsStacked = false;
|
|
33
|
+
render() {
|
|
34
|
+
const Heading = this.headingLevel;
|
|
35
|
+
return (h(Host, { key: '02317c9b8a8164400ac269cbfd872e066e3269e3' }, h("div", { key: 'c1ab176079e95f4854826588405cd49c1bc42b58', class: { 'header': true, 'header--stacked': this.actionsStacked } }, h("div", { key: '57553e0d8ac563dfd55bedb23fb6896f922c187c', class: "header-text" }, this.eyebrow && h("p", { key: 'b38cbdfbc5a08cfddf60e9f82481df3ed8ad48e6', class: "header-eyebrow" }, this.eyebrow), h(Heading, { key: '521003f555a4adaae81bac11a6410638db923399', class: "header-title" }, this.title), this.description && h("p", { key: '0625bcd1903f52dfe16963bfc6d3ccf7e404d13a', class: "header-description" }, this.description)), h("div", { key: '23b65e1729bfa24324c24958b946435ff247cb4d', class: "header-actions" }, h("slot", { key: '45b4c24e4ce2bb4edc2929a2f17563260efb410f', name: "actions" })))));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
ChPageHeader.style = chPageHeaderCss();
|
|
39
|
+
|
|
40
|
+
export { ChPageHeader as ch_page_header };
|
|
41
|
+
//# sourceMappingURL=ch-page-header.entry.js.map
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=ch-page-header.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-page-header.entry.js","sources":["src/components/ch-page-header/ch-page-header.css?tag=ch-page-header&encapsulation=shadow","src/components/ch-page-header/ch-page-header.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.header {\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--spacing-2xl);\n padding-bottom: var(--spacing-2xl);\n border-bottom: var(--border-width) solid var(--border);\n}\n\n.header-text {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-xs);\n /* Lets a long, unbroken title shrink instead of pushing the actions off the\n row at narrow widths. */\n flex: 1 1 20rem;\n min-width: 0;\n}\n\n.header-eyebrow {\n margin: 0;\n color: var(--text-secondary);\n font-family: var(--font-heading);\n font-size: var(--typography-size-xs);\n letter-spacing: var(--typography-tracking-badge);\n text-transform: uppercase;\n}\n\n.header-title {\n margin: 0;\n color: var(--text);\n font-family: var(--font-heading);\n font-size: var(--typography-size-xl);\n font-weight: var(--typography-weight-bold);\n line-height: 1.2;\n overflow-wrap: anywhere;\n}\n\n.header-description {\n margin: 0;\n color: var(--text-secondary);\n font-size: var(--typography-size-sm);\n line-height: 1.5;\n overflow-wrap: anywhere;\n}\n\n.header-actions {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--spacing-md);\n /* Never wider than the row: the actions wrap inside it rather than forcing\n horizontal overflow on a 390px screen. */\n max-width: 100%;\n}\n\n.header-actions:empty {\n display: none;\n}\n\n.header--stacked .header-actions {\n flex-basis: 100%;\n}\n\n@media (max-width: 30rem) {\n .header {\n flex-direction: column;\n }\n\n .header-actions {\n width: 100%;\n }\n}\n\n@media (forced-colors: active) {\n .header {\n border-bottom-color: CanvasText;\n }\n}\n","import { Component, Host, Prop, h } from '@stencil/core';\n\nexport type ChPageHeaderHeadingLevel = 'h1' | 'h2' | 'h3';\n\n/**\n * The heading block at the top of a page: title, optional eyebrow and\n * description, and a trailing actions area.\n *\n * The title is a `title` prop rather than a slot so the heading level always\n * matches the page. A slotted heading lets a consumer nest a second `h1`, and\n * \"one top-level heading per page\" then depends on every caller remembering it;\n * here the level is explicit and defaults to `h1`. The actions wrap rather than\n * push the page sideways at 390px, and the DOM order keeps the heading before\n * the actions so reading and focus order still start with the title.\n */\n@Component({\n tag: 'ch-page-header',\n styleUrl: 'ch-page-header.css',\n shadow: true,\n})\nexport class ChPageHeader {\n /**\n * The page title. Rendered as a real heading, so it also works as the\n * accessible name of the page region.\n */\n @Prop() title!: string;\n\n /**\n * Heading element to render. Use `h2` (or `h3`) when the page already has a\n * higher-level heading above this block, so the document outline stays valid.\n */\n @Prop() headingLevel: ChPageHeaderHeadingLevel = 'h1';\n\n /**\n * Optional small label above the title, as slotted content. Use it for a\n * section or entity kind (\"Proyecto\", \"Factura #1042\"), not for the title.\n */\n @Prop() eyebrow?: string;\n\n /**\n * Optional supporting line under the title.\n */\n @Prop() description?: string;\n\n /**\n * Puts the actions below the title instead of beside it. Use it when the\n * actions are too wide to sit on the same row even after wrapping.\n */\n @Prop() actionsStacked = false;\n\n render() {\n const Heading = this.headingLevel;\n\n return (\n <Host>\n <div class={{ 'header': true, 'header--stacked': this.actionsStacked }}>\n <div class=\"header-text\">\n {this.eyebrow && <p class=\"header-eyebrow\">{this.eyebrow}</p>}\n <Heading class=\"header-title\">{this.title}</Heading>\n {this.description && <p class=\"header-description\">{this.description}</p>}\n </div>\n <div class=\"header-actions\">\n <slot name=\"actions\"></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,eAAe,GAAG,MAAM,CAAC,opCAAopC,CAAC;;MCoBvqC,YAAY,GAAA,MAAA;;;;AACvB;;;AAGG;AACK,IAAA,KAAK;AAEb;;;AAGG;IACK,YAAY,GAA6B,IAAI;AAErD;;;AAGG;AACK,IAAA,OAAO;AAEf;;AAEG;AACK,IAAA,WAAW;AAEnB;;;AAGG;IACK,cAAc,GAAG,KAAK;IAE9B,MAAM,GAAA;AACJ,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY;AAEjC,QAAA,QACE,EAAC,IAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACH,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,CAAC,cAAc,EAAE,EAAA,EACpE,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,aAAa,EAAA,EACrB,IAAI,CAAC,OAAO,IAAI,CAAA,CAAA,GAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAG,KAAK,EAAC,gBAAgB,EAAA,EAAE,IAAI,CAAC,OAAO,CAAK,EAC7D,CAAA,CAAC,OAAO,qDAAC,KAAK,EAAC,cAAc,EAAA,EAAE,IAAI,CAAC,KAAK,CAAW,EACnD,IAAI,CAAC,WAAW,IAAI,CAAA,CAAA,GAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAG,KAAK,EAAC,oBAAoB,EAAA,EAAE,IAAI,CAAC,WAAW,CAAK,CACrE,EACN,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,gBAAgB,EAAA,EACzB,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,SAAS,EAAA,CAAQ,CACxB,CACF,CACD;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
2
|
import { r as resolveValidity } from './validation-message-BXzZsX2r.js';
|
|
3
3
|
|
|
4
4
|
const chRadioCss = () => `:host{display:inline-block}.group-label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.radio-group{display:flex;flex-direction:column;gap:var(--spacing-lg)}.control{display:inline-flex;align-items:center;gap:var(--spacing-lg);cursor:pointer}.control--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.input{appearance:none;-webkit-appearance:none;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--spacing-4xl);height:var(--spacing-4xl);margin:0;flex-shrink:0;border:var(--border-width) solid var(--border);border-radius:50%;background:var(--surface);cursor:pointer;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.input:checked{border-color:var(--accent)}.input:checked::before{content:'';width:var(--spacing-md);height:var(--spacing-md);border-radius:50%;background:var(--accent)}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus-visible{outline-color:var(--color-status-warning)}:host([data-touched]:invalid) .input,:host(:user-invalid) .input{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .input:focus-visible,:host(:user-invalid) .input:focus-visible{outline-color:var(--color-status-warning)}.label-text{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)}`;
|
|
@@ -112,7 +112,7 @@ const ChRadio = class {
|
|
|
112
112
|
}
|
|
113
113
|
render() {
|
|
114
114
|
const groupName = this.name || `${this.groupId}-group`;
|
|
115
|
-
return (h(Host, { key: '
|
|
115
|
+
return (h(Host, { key: '9803d5b41d3985503d1b304d53504239d2a2de1d' }, this.label && (h("span", { key: 'f75cf217d50a300e5c6ddcdcfb9c5832e1f6b964', class: "group-label", id: this.labelId }, this.label)), h("div", { key: 'd8e9e24e82dfb77f728e8d9c994102202a9ce85b', class: "radio-group", role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, h("input", { class: { 'input': true, 'input--invalid': this.invalid }, type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), h("span", { class: "mark" }), h("span", { class: "label-text" }, option.label))))), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '91bed0d5cd70a032de7b8ba6e298903b387e1a4a', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'a2e6d6c87d60e98ac3d396f7dde907ce1e46946a', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
116
116
|
}
|
|
117
117
|
static get formAssociated() { return true; }
|
|
118
118
|
static get watchers() { return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
2
|
import { r as resolveValidity } from './validation-message-BXzZsX2r.js';
|
|
3
3
|
|
|
4
4
|
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}}`;
|
|
@@ -91,7 +91,7 @@ const ChSegmentedControl = class {
|
|
|
91
91
|
}
|
|
92
92
|
render() {
|
|
93
93
|
const groupName = this.name || `${this.groupId}-group`;
|
|
94
|
-
return (h(Host, { key: '
|
|
94
|
+
return (h(Host, { key: 'd6a9a720a1a210c73711cff1f7cd6c1ffa0c89b2' }, this.label && (h("span", { key: 'af5fb9ab87e918ac6047ebd6e65e540044c6a2d0', class: "group-label", id: this.labelId }, this.label)), h("div", { key: '8dd76ea8d792d918ac5e413946e8a08cb89480c7', class: { segmented: true, [`segmented--${this.size}`]: true }, role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, h("input", { class: "input", type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, onChange: this.handleChange }), h("span", { class: "label-text" }, option.label)))))));
|
|
95
95
|
}
|
|
96
96
|
static get formAssociated() { return true; }
|
|
97
97
|
static get watchers() { return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
2
|
|
|
3
3
|
const chSkeletonCss = () => `:host{display:block;width:100%}:host([hidden]){display:none}:host(.skeleton--circle){width:auto;display:inline-flex}.skeleton__item{display:block;background:var(--color-surface-default);border-radius:var(--radius-sm)}.skeleton--circle .skeleton__item{border-radius:50%}.skeleton--rect .skeleton__item{border-radius:var(--radius-md)}.skeleton--animated .skeleton__item{background-image:linear-gradient(90deg, transparent 0%, var(--color-surface-hover) 50%, transparent 100%);background-size:200% 100%;background-repeat:no-repeat;animation:ch-skeleton-shimmer 1.4s ease-in-out infinite}@keyframes ch-skeleton-shimmer{from{background-position:100% 0}to{background-position:-100% 0}}@media (prefers-reduced-motion: reduce){.skeleton--animated .skeleton__item{animation:none;background-image:none}}`;
|
|
4
4
|
|
|
@@ -45,7 +45,7 @@ const ChSkeleton = class {
|
|
|
45
45
|
return { width: this.width, height: this.height };
|
|
46
46
|
}
|
|
47
47
|
render() {
|
|
48
|
-
return (h(Host, { key: '
|
|
48
|
+
return (h(Host, { key: 'bbcafacc79f0288204028378f2cf460f793ca702', "aria-hidden": "true", class: { 'skeleton': true, [`skeleton--${this.shape}`]: true, 'skeleton--animated': this.animated } }, Array.from({ length: this.items }).map((value, index) => (h("span", { class: "skeleton__item", style: this.sizeStyle, key: index, "data-index": String(value) })))));
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
ChSkeleton.style = chSkeletonCss();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
2
|
|
|
3
3
|
const chStackCss = () => `:host{display:flex;flex-direction:column;box-sizing:border-box}:host([hidden]){display:none}.stack--gap-none{gap:0}.stack--gap-2xs{gap:var(--spacing-2xs)}.stack--gap-xs{gap:var(--spacing-xs)}.stack--gap-sm{gap:var(--spacing-sm)}.stack--gap-md{gap:var(--spacing-md)}.stack--gap-lg{gap:var(--spacing-lg)}.stack--gap-xl{gap:var(--spacing-xl)}.stack--gap-2xl{gap:var(--spacing-2xl)}.stack--gap-3xl{gap:var(--spacing-3xl)}.stack--gap-4xl{gap:var(--spacing-4xl)}.stack--gap-5xl{gap:var(--spacing-5xl)}.stack--gap-6xl{gap:var(--spacing-6xl)}.stack--align-stretch{align-items:stretch}.stack--align-start{align-items:flex-start}.stack--align-center{align-items:center}.stack--align-end{align-items:flex-end}.stack--justify-start{justify-content:flex-start}.stack--justify-center{justify-content:center}.stack--justify-end{justify-content:flex-end}.stack--justify-between{justify-content:space-between}.stack--justify-around{justify-content:space-around}`;
|
|
4
4
|
|
|
@@ -24,7 +24,7 @@ const ChStack = class {
|
|
|
24
24
|
return GAPS.has(this.gap) ? this.gap : 'md';
|
|
25
25
|
}
|
|
26
26
|
render() {
|
|
27
|
-
return (h(Host, { key: '
|
|
27
|
+
return (h(Host, { key: '646286c45adc0d816b0fdbcdfe9e70f809fedb95', class: { stack: true, [`stack--gap-${this.gapStep}`]: true, [`stack--align-${this.align}`]: true, [`stack--justify-${this.justify}`]: true } }, h("slot", { key: '1c18713eb95fc568a08bcbd6e018add9336a0fd0' })));
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
ChStack.style = chStackCss();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
2
|
|
|
3
3
|
const chTabsCss = () => `:host{display:block}.tablist{display:flex;gap:var(--spacing-2xl);border-bottom:var(--border-width) solid var(--border)}.tab{appearance:none;position:relative;background:transparent;border:none;padding:var(--spacing-md) 0 var(--spacing-xl);margin-bottom:calc(-1 * var(--border-width));color:var(--text-muted);font-family:inherit;font-size:inherit;font-weight:var(--typography-weight-semibold);cursor:pointer;transition:color var(--duration-normal) var(--easing-default), border-color var(--duration-normal) var(--easing-default)}.tab::after{content:'';position:absolute;left:0;right:0;bottom:0;height:var(--border-accent-bar);background:var(--accent);opacity:0;transition:opacity var(--duration-normal) var(--easing-default)}.tab:hover{color:var(--text)}.tab:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.tab--active{color:var(--text)}.tab--active::after{opacity:1}.tab--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.tabpanel{padding-top:var(--spacing-2xl);color:var(--text)}.tabpanel[hidden]{display:none}`;
|
|
4
4
|
|
|
@@ -84,7 +84,7 @@ const ChTabs = class {
|
|
|
84
84
|
}
|
|
85
85
|
render() {
|
|
86
86
|
const active = this.activeValue;
|
|
87
|
-
return (h(Host, { key: '
|
|
87
|
+
return (h(Host, { key: '915c7a584397bbe10a72642a1ce5ed68f2264ed2' }, h("div", { key: 'b37a294722442c73d224410793cd0c098734993f', class: "tablist", role: "tablist", "aria-label": this.label, onKeyDown: this.handleKeyDown, ref: el => (this.tablistEl = el) }, this.tabs.map(tab => {
|
|
88
88
|
const selected = tab.value === active;
|
|
89
89
|
return (h("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));
|
|
90
90
|
})), this.tabs.map(tab => (h("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 }, h("slot", { name: `panel-${tab.value}` }))))));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, a as getElement, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
2
|
import { r as resolveValidity } from './validation-message-BXzZsX2r.js';
|
|
3
3
|
|
|
4
4
|
const chTextareaCss = () => `: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)}.textarea{box-sizing:border-box;width:100%;min-height:var(--spacing-6xl);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;line-height:var(--spacing-5xl);resize:vertical;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.textarea::placeholder{color:var(--text-muted)}.textarea:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.textarea--invalid{border-color:var(--color-status-warning)}.textarea--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}:host([data-touched]:invalid) .textarea,:host(:user-invalid) .textarea{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .textarea:focus,:host(:user-invalid) .textarea:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.textarea:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;
|
|
@@ -123,7 +123,7 @@ const ChTextarea = class {
|
|
|
123
123
|
return undefined;
|
|
124
124
|
}
|
|
125
125
|
render() {
|
|
126
|
-
return (h(Host, { key: '
|
|
126
|
+
return (h(Host, { key: '5e7f4e6c779b677f259b56ebf6cb2e829511275e' }, this.label && (h("label", { key: '73a3a3d44b4926aaf0681aa68f878932c7932dae', class: "label", htmlFor: this.textareaId }, this.label)), h("textarea", { key: '10edc56d4846b578bd11c7bd001e7ca47aa1838d', 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) && (h("p", { key: '393ea00da6e7def75d4305c242a9cf957013359b', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'ba405aec9d92b410e063cec29235240a4a4ec715', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
127
127
|
}
|
|
128
128
|
static get formAssociated() { return true; }
|
|
129
129
|
static get watchers() { return {
|
|
@@ -1,16 +1,122 @@
|
|
|
1
|
-
import { r as registerInstance, a as getElement, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, a as getElement, f as forceUpdate, h, H as Host } from './index-CIV5Gg1o.js';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const OPPOSITE = {
|
|
4
|
+
top: 'bottom',
|
|
5
|
+
bottom: 'top',
|
|
6
|
+
left: 'right',
|
|
7
|
+
right: 'left',
|
|
8
|
+
};
|
|
9
|
+
const AXIS = {
|
|
10
|
+
top: 'vertical',
|
|
11
|
+
bottom: 'vertical',
|
|
12
|
+
left: 'horizontal',
|
|
13
|
+
right: 'horizontal',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* How far a placed surface overflows each viewport edge. Positive values are
|
|
17
|
+
* overflow. Used both to pick a placement and to shift the surface back in.
|
|
18
|
+
*/
|
|
19
|
+
function overflowOf(surface, viewport) {
|
|
20
|
+
return {
|
|
21
|
+
top: viewport.top - surface.top,
|
|
22
|
+
left: viewport.left - surface.left,
|
|
23
|
+
bottom: surface.top + surface.height - (viewport.top + viewport.height),
|
|
24
|
+
right: surface.left + surface.width - (viewport.left + viewport.width),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function offsetFor(placement, anchor, surface, gap) {
|
|
28
|
+
switch (placement) {
|
|
29
|
+
case 'top':
|
|
30
|
+
return {
|
|
31
|
+
top: anchor.top - surface.height - gap,
|
|
32
|
+
left: anchor.left + (anchor.width - surface.width) / 2,
|
|
33
|
+
};
|
|
34
|
+
case 'bottom':
|
|
35
|
+
return {
|
|
36
|
+
top: anchor.top + anchor.height + gap,
|
|
37
|
+
left: anchor.left + (anchor.width - surface.width) / 2,
|
|
38
|
+
};
|
|
39
|
+
case 'left':
|
|
40
|
+
return {
|
|
41
|
+
top: anchor.top + (anchor.height - surface.height) / 2,
|
|
42
|
+
left: anchor.left - surface.width - gap,
|
|
43
|
+
};
|
|
44
|
+
case 'right':
|
|
45
|
+
return {
|
|
46
|
+
top: anchor.top + (anchor.height - surface.height) / 2,
|
|
47
|
+
left: anchor.left + anchor.width + gap,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Picks the placement that overflows least and then shifts the surface along
|
|
53
|
+
* the cross axis so it stays inside the viewport.
|
|
54
|
+
*
|
|
55
|
+
* The main-axis overflow is not compensated with a translate: a tooltip pinned
|
|
56
|
+
* to the top edge would cover its own trigger. Flipping to the other side is
|
|
57
|
+
* what keeps it readable, and the caller decides whether to accept the
|
|
58
|
+
* remaining overflow.
|
|
59
|
+
*/
|
|
60
|
+
function placeOverlay({ anchor, surface, viewport, preferred, gap, }) {
|
|
61
|
+
const candidates = [preferred, OPPOSITE[preferred]];
|
|
62
|
+
let placement = preferred;
|
|
63
|
+
let best = Number.POSITIVE_INFINITY;
|
|
64
|
+
for (const candidate of candidates) {
|
|
65
|
+
const { top, left } = offsetFor(candidate, anchor, surface, gap);
|
|
66
|
+
const rect = { top, left, width: surface.width, height: surface.height };
|
|
67
|
+
const overflow = overflowOf(rect, viewport);
|
|
68
|
+
const main = AXIS[candidate] === 'vertical' ? clamp(overflow.top) + clamp(overflow.bottom) : clamp(overflow.left) + clamp(overflow.right);
|
|
69
|
+
if (main < best) {
|
|
70
|
+
best = main;
|
|
71
|
+
placement = candidate;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const { top, left } = offsetFor(placement, anchor, surface, gap);
|
|
75
|
+
const rect = { top, left, width: surface.width, height: surface.height };
|
|
76
|
+
const overflow = overflowOf(rect, viewport);
|
|
77
|
+
const shifted = AXIS[placement] === 'vertical' ? { top, left: left + correction(overflow.left, overflow.right) } : { top: top + correction(overflow.top, overflow.bottom), left };
|
|
78
|
+
return { placement, top: shifted.top, left: shifted.left };
|
|
79
|
+
}
|
|
80
|
+
/** Only real overflow counts: the side that fits contributes nothing. */
|
|
81
|
+
function clamp(overflow) {
|
|
82
|
+
return overflow > 0 ? overflow : 0;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Turns the two overflows on an axis into a shift. `before` is the overflow on
|
|
86
|
+
* the leading edge (top or left), `after` the one on the trailing edge; both
|
|
87
|
+
* are positive when the surface spills past that edge.
|
|
88
|
+
*
|
|
89
|
+
* Pushing away from the leading edge moves the surface inwards, so the shift is
|
|
90
|
+
* `+before`. The trailing edge needs the opposite sign. When both overflow the
|
|
91
|
+
* surface is larger than the viewport: pin it to the leading edge and let
|
|
92
|
+
* `max-width` stop the spill.
|
|
93
|
+
*/
|
|
94
|
+
function correction(before, after) {
|
|
95
|
+
if (before > 0) {
|
|
96
|
+
return before;
|
|
97
|
+
}
|
|
98
|
+
if (after > 0) {
|
|
99
|
+
return -after;
|
|
100
|
+
}
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const chTooltipCss = () => `:host{display:inline-block}.anchor{position:relative;display:inline-flex}.bubble{position:absolute;z-index:var(--z-index-dropdown);width:max-content;max-width:min(16rem, calc(100vw - 2 * var(--spacing-2xl)));padding:var(--spacing-md) var(--spacing-2xl);border:var(--border-width) solid var(--border);border-radius:var(--radius-sm);background:var(--color-background-base);color:var(--text);font-family:var(--font-body);font-size:var(--typography-size-sm);line-height:1.4;opacity:0;visibility:hidden;transition:opacity var(--duration-fast) var(--easing-default), visibility var(--duration-fast) var(--easing-default)}.bubble--visible{opacity:1;visibility:visible}.bubble::before{content:'';position:absolute}.bubble--positioned{position:fixed;top:var(--ch-tooltip-offset-top);left:var(--ch-tooltip-offset-left);transform:none;margin:0}.bubble--top{bottom:100%;left:50%;transform:translateX(-50%);margin-bottom:var(--spacing-md)}.bubble.bubble--positioned.bubble--top,.bubble.bubble--positioned.bubble--bottom,.bubble.bubble--positioned.bubble--left,.bubble.bubble--positioned.bubble--right{inset:auto;top:var(--ch-tooltip-offset-top);left:var(--ch-tooltip-offset-left);right:auto;bottom:auto;transform:none;margin:0}.bubble--top::before{top:100%;left:0;right:0;height:var(--spacing-md)}.bubble--bottom{top:100%;left:50%;transform:translateX(-50%);margin-top:var(--spacing-md)}.bubble--bottom::before{bottom:100%;left:0;right:0;height:var(--spacing-md)}.bubble--left{right:100%;top:50%;transform:translateY(-50%);margin-right:var(--spacing-md)}.bubble--left::before{left:100%;top:0;bottom:0;width:var(--spacing-md)}.bubble--right{left:100%;top:50%;transform:translateY(-50%);margin-left:var(--spacing-md)}.bubble--right::before{right:100%;top:0;bottom:0;width:var(--spacing-md)}@media (prefers-reduced-motion: reduce){.bubble{transition:none}}`;
|
|
4
105
|
|
|
5
106
|
let tooltipIds = 0;
|
|
107
|
+
/** Space between the trigger and the bubble, matching `--spacing-md`. */
|
|
108
|
+
const GAP = 8;
|
|
6
109
|
const ChTooltip = class {
|
|
7
110
|
constructor(hostRef) {
|
|
8
111
|
registerInstance(this, hostRef);
|
|
9
112
|
}
|
|
10
113
|
get el() { return getElement(this); }
|
|
11
114
|
fallbackId = `ch-tooltip-${++tooltipIds}`;
|
|
115
|
+
bubbleEl;
|
|
116
|
+
cleanup;
|
|
12
117
|
/**
|
|
13
|
-
*
|
|
118
|
+
* The side the bubble is placed on. It is a preference: when that side has no
|
|
119
|
+
* room the bubble flips to the opposite one.
|
|
14
120
|
*/
|
|
15
121
|
placement = 'top';
|
|
16
122
|
// Hover and focus are tracked apart so that neither cancels the other: a
|
|
@@ -19,15 +125,26 @@ const ChTooltip = class {
|
|
|
19
125
|
hovered = false;
|
|
20
126
|
focused = false;
|
|
21
127
|
dismissed = false;
|
|
128
|
+
/** The placement actually used, which may differ from the prop after a flip. */
|
|
129
|
+
resolvedPlacement;
|
|
130
|
+
/** Offset applied to the bubble once it has been measured. */
|
|
131
|
+
offset;
|
|
22
132
|
get visible() {
|
|
23
133
|
return (this.hovered || this.focused) && !this.dismissed;
|
|
24
134
|
}
|
|
25
135
|
componentDidLoad() {
|
|
26
136
|
this.associate();
|
|
27
137
|
}
|
|
138
|
+
connectedCallback() {
|
|
139
|
+
this.watchViewport();
|
|
140
|
+
}
|
|
141
|
+
disconnectedCallback() {
|
|
142
|
+
this.cleanup?.();
|
|
143
|
+
}
|
|
28
144
|
handleMouseEnter() {
|
|
29
145
|
this.hovered = true;
|
|
30
146
|
this.dismissed = false;
|
|
147
|
+
this.position();
|
|
31
148
|
}
|
|
32
149
|
handleMouseLeave() {
|
|
33
150
|
this.hovered = false;
|
|
@@ -35,6 +152,7 @@ const ChTooltip = class {
|
|
|
35
152
|
handleFocusIn() {
|
|
36
153
|
this.focused = true;
|
|
37
154
|
this.dismissed = false;
|
|
155
|
+
this.position();
|
|
38
156
|
}
|
|
39
157
|
handleFocusOut() {
|
|
40
158
|
this.focused = false;
|
|
@@ -42,15 +160,83 @@ const ChTooltip = class {
|
|
|
42
160
|
/**
|
|
43
161
|
* Listens on the document because a tooltip opened by hovering leaves focus
|
|
44
162
|
* wherever it was, so a host-scoped handler would never see the key.
|
|
163
|
+
*
|
|
164
|
+
* Only the outermost Escape handler is stopped from propagating, so a
|
|
165
|
+
* tooltip inside an open modal closes itself and leaves the modal open.
|
|
45
166
|
*/
|
|
46
167
|
handleKeyDown(event) {
|
|
47
|
-
if (event.key === 'Escape' && this.visible) {
|
|
168
|
+
if (event.key === 'Escape' && this.visible && !event.defaultPrevented) {
|
|
169
|
+
event.preventDefault();
|
|
48
170
|
this.dismissed = true;
|
|
49
171
|
}
|
|
50
172
|
}
|
|
173
|
+
/** Cheap guard so scroll frames do not measure while nothing is shown. */
|
|
174
|
+
handleScroll() {
|
|
175
|
+
if (this.visible && this.offset) {
|
|
176
|
+
this.position();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
handleResize() {
|
|
180
|
+
this.position();
|
|
181
|
+
}
|
|
182
|
+
watchViewport() {
|
|
183
|
+
if (typeof window === 'undefined') {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const viewport = window.visualViewport;
|
|
187
|
+
if (!viewport || this.cleanup) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const update = () => this.position();
|
|
191
|
+
viewport.addEventListener('resize', update);
|
|
192
|
+
viewport.addEventListener('scroll', update);
|
|
193
|
+
this.cleanup = () => {
|
|
194
|
+
viewport.removeEventListener('resize', update);
|
|
195
|
+
viewport.removeEventListener('scroll', update);
|
|
196
|
+
};
|
|
197
|
+
}
|
|
51
198
|
slotted(name) {
|
|
52
199
|
return Array.from(this.el.children).find(child => child.getAttribute('slot') === name);
|
|
53
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Measures the anchor and the bubble and stores the offset that keeps the
|
|
203
|
+
* bubble inside the viewport. Nothing is measured before the bubble has a
|
|
204
|
+
* box to measure, so the pre-paint render uses plain CSS.
|
|
205
|
+
*/
|
|
206
|
+
position() {
|
|
207
|
+
if (typeof window === 'undefined') {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const bubble = this.bubbleEl ?? (this.bubbleEl = this.el.shadowRoot?.querySelector('.bubble') ?? undefined);
|
|
211
|
+
if (!bubble || bubble.offsetWidth === 0) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const anchorRect = this.slotted('trigger')?.getBoundingClientRect?.();
|
|
215
|
+
if (!anchorRect) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const surface = {
|
|
219
|
+
width: bubble.offsetWidth + horizontalMargin(bubble),
|
|
220
|
+
height: bubble.offsetHeight,
|
|
221
|
+
};
|
|
222
|
+
const viewport = window.visualViewport;
|
|
223
|
+
const { placement, top, left } = placeOverlay({
|
|
224
|
+
anchor: { top: anchorRect.top, left: anchorRect.left, width: anchorRect.width, height: anchorRect.height },
|
|
225
|
+
surface,
|
|
226
|
+
viewport: viewport
|
|
227
|
+
? { top: viewport.offsetTop, left: viewport.offsetLeft, width: viewport.width, height: viewport.height }
|
|
228
|
+
: { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight },
|
|
229
|
+
preferred: this.placement,
|
|
230
|
+
gap: GAP,
|
|
231
|
+
});
|
|
232
|
+
const current = this.offset;
|
|
233
|
+
const unchanged = current?.top === top && current?.left === left && this.resolvedPlacement === placement;
|
|
234
|
+
this.resolvedPlacement = placement;
|
|
235
|
+
this.offset = { top, left };
|
|
236
|
+
if (!unchanged) {
|
|
237
|
+
forceUpdate(this);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
54
240
|
/**
|
|
55
241
|
* Points the trigger at the text with `aria-describedby`. Re-run on
|
|
56
242
|
* `slotchange` because a framework re-render can replace the slotted nodes
|
|
@@ -69,9 +255,22 @@ const ChTooltip = class {
|
|
|
69
255
|
trigger.setAttribute('aria-describedby', content.id);
|
|
70
256
|
};
|
|
71
257
|
render() {
|
|
72
|
-
|
|
258
|
+
const { offset } = this;
|
|
259
|
+
return (h(Host, { key: 'fb651dc0bf007fb86c9f69b2c714106520df4d4a' }, h("span", { key: '74324b8e4c0b7c552255605c6aa4ae739e16d832', class: "anchor" }, h("slot", { key: 'd4c2025af2d96b2ea4e7d8d601ce803be82a4a3e', name: "trigger", onSlotchange: this.associate }), h("span", { key: 'f6561dce022d8d9d2d0fb2b6984591301483b1f3', ref: el => (this.bubbleEl = el), style: {
|
|
260
|
+
'--ch-tooltip-offset-top': offset ? `${offset.top}px` : null,
|
|
261
|
+
'--ch-tooltip-offset-left': offset ? `${offset.left}px` : null,
|
|
262
|
+
}, class: {
|
|
263
|
+
'bubble': true,
|
|
264
|
+
'bubble--positioned': Boolean(this.offset),
|
|
265
|
+
[`bubble--${this.resolvedPlacement ?? this.placement}`]: true,
|
|
266
|
+
'bubble--visible': this.visible,
|
|
267
|
+
} }, h("slot", { key: 'a099d15660ea17211b4c50912842b3152e5f652c', name: "content", onSlotchange: this.associate })))));
|
|
73
268
|
}
|
|
74
269
|
};
|
|
270
|
+
function horizontalMargin(el) {
|
|
271
|
+
const style = getComputedStyle(el);
|
|
272
|
+
return (parseFloat(style.marginLeft) || 0) + (parseFloat(style.marginRight) || 0);
|
|
273
|
+
}
|
|
75
274
|
ChTooltip.style = chTooltipCss();
|
|
76
275
|
|
|
77
276
|
export { ChTooltip as ch_tooltip };
|