@devschile/chucao 2.4.0 → 2.6.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-0409c063.entry.js +2 -0
- package/dist/chucao/p-0409c063.entry.js.map +1 -0
- package/dist/chucao/{p-1ebd9dc4.entry.js → p-090d26f1.entry.js} +2 -2
- package/dist/chucao/{p-84d875e9.entry.js → p-207648f9.entry.js} +2 -2
- package/dist/chucao/{p-b5552b50.entry.js → p-20ea1b18.entry.js} +2 -2
- package/dist/chucao/p-21ca2235.entry.js +2 -0
- package/dist/chucao/p-21ca2235.entry.js.map +1 -0
- package/dist/chucao/{p-1778a313.entry.js → p-2c1bc8bd.entry.js} +2 -2
- package/dist/chucao/{p-6e95f31f.entry.js → p-337d7f68.entry.js} +2 -2
- package/dist/chucao/p-370d9629.entry.js +2 -0
- package/dist/chucao/p-370d9629.entry.js.map +1 -0
- package/dist/chucao/{p-d0533af6.entry.js → p-50cbea7f.entry.js} +2 -2
- package/dist/chucao/p-66ae9e2c.entry.js +2 -0
- package/dist/chucao/p-66ae9e2c.entry.js.map +1 -0
- package/dist/chucao/p-79f20bfd.entry.js +2 -0
- package/dist/chucao/p-79f20bfd.entry.js.map +1 -0
- package/dist/chucao/{p-56d64d84.entry.js → p-7d4336bd.entry.js} +2 -2
- package/dist/chucao/p-81b6622f.entry.js +2 -0
- package/dist/chucao/p-81b6622f.entry.js.map +1 -0
- package/dist/chucao/{p-17451d92.entry.js → p-925af6b8.entry.js} +2 -2
- package/dist/chucao/p-95061461.entry.js +2 -0
- package/dist/chucao/{p-34a9d1f4.entry.js → p-9794a3fa.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-85db779c.entry.js → p-b56f4a29.entry.js} +2 -2
- package/dist/chucao/p-b9b47942.entry.js +2 -0
- package/dist/chucao/p-b9b47942.entry.js.map +1 -0
- package/dist/chucao/{p-449e1ba0.entry.js → p-c1b35f1b.entry.js} +2 -2
- package/dist/chucao/{p-0e3c83a6.entry.js → p-e2f725bd.entry.js} +2 -2
- package/dist/chucao/{p-7c85f5fe.entry.js → p-e6f959f4.entry.js} +2 -2
- package/dist/chucao/{p-907195ff.entry.js → p-f0aea6ed.entry.js} +2 -2
- package/dist/chucao/{p-a07e0e97.entry.js → p-f7305552.entry.js} +2 -2
- package/dist/chucao/p-ffaf1a31.entry.js +2 -0
- package/dist/chucao/p-ffaf1a31.entry.js.map +1 -0
- package/dist/cjs/ch-accordion.cjs.entry.js +2 -2
- 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-description-list.cjs.entry.js +29 -0
- package/dist/cjs/ch-description-list.cjs.entry.js.map +1 -0
- 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-stat.cjs.entry.js +46 -0
- package/dist/cjs/ch-stat.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-tabs.cjs.entry.js +2 -2
- package/dist/cjs/ch-textarea.cjs.entry.js +2 -2
- package/dist/cjs/ch-timeline.cjs.entry.js +20 -0
- package/dist/cjs/ch-timeline.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-tooltip.cjs.entry.js +206 -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 +12 -6
- package/dist/collection/components/ch-accordion/ch-accordion.js +1 -1
- 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-description-list/ch-description-list.css +60 -0
- package/dist/collection/components/ch-description-list/ch-description-list.js +78 -0
- package/dist/collection/components/ch-description-list/ch-description-list.js.map +1 -0
- 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-stat/ch-stat.css +68 -0
- package/dist/collection/components/ch-stat/ch-stat.js +151 -0
- package/dist/collection/components/ch-stat/ch-stat.js.map +1 -0
- 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-timeline/ch-timeline.css +54 -0
- package/dist/collection/components/ch-timeline/ch-timeline.js +43 -0
- package/dist/collection/components/ch-timeline/ch-timeline.js.map +1 -0
- package/dist/collection/components/ch-tooltip/ch-tooltip.css +29 -1
- package/dist/collection/components/ch-tooltip/ch-tooltip.js +127 -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-card.js.map +1 -1
- package/dist/components/ch-checkbox.js +1 -1
- package/dist/components/ch-cluster.js +1 -1
- package/dist/components/ch-description-list.d.ts +11 -0
- package/dist/components/ch-description-list.js +2 -0
- package/dist/components/ch-description-list.js.map +1 -0
- 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-stat.d.ts +11 -0
- package/dist/components/ch-stat.js +2 -0
- package/dist/components/ch-stat.js.map +1 -0
- 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-timeline.d.ts +11 -0
- package/dist/components/ch-timeline.js +2 -0
- package/dist/components/ch-timeline.js.map +1 -0
- 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-CnivhwvG.js +2 -0
- package/dist/components/p-CnivhwvG.js.map +1 -0
- package/dist/components/{p-no2_9Jk-.js → p-Cw0b4OGc.js} +2 -2
- 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 +2 -2
- 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-description-list.entry.js +27 -0
- package/dist/esm/ch-description-list.entry.js.map +1 -0
- 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-stat.entry.js +44 -0
- package/dist/esm/ch-stat.entry.js.map +1 -0
- package/dist/esm/ch-tabs.entry.js +2 -2
- package/dist/esm/ch-textarea.entry.js +2 -2
- package/dist/esm/ch-timeline.entry.js +18 -0
- package/dist/esm/ch-timeline.entry.js.map +1 -0
- package/dist/esm/ch-tooltip.entry.js +206 -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-description-list/ch-description-list.d.ts +30 -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-stat/ch-stat.d.ts +42 -0
- package/dist/types/components/ch-timeline/ch-timeline.d.ts +27 -0
- package/dist/types/components/ch-tooltip/ch-tooltip.d.ts +34 -2
- package/dist/types/components.d.ts +718 -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 +21 -1
- package/dist-react/components.js +54 -0
- package/dist-react/components.ts +73 -1
- package/dist-vue/index.d.ts +6 -0
- package/dist-vue/index.js +42 -1
- package/dist-vue/index.ts +54 -1
- package/hydrate/index.js +772 -35
- package/hydrate/index.mjs +772 -35
- package/package.json +104 -5
- package/dist/chucao/p-82216381.entry.js +0 -2
- package/dist/chucao/p-82216381.entry.js.map +0 -1
- 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/chucao/p-d776b092.entry.js +0 -2
- 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-090d26f1.entry.js.map} +0 -0
- /package/dist/chucao/{p-84d875e9.entry.js.map → p-207648f9.entry.js.map} +0 -0
- /package/dist/chucao/{p-b5552b50.entry.js.map → p-20ea1b18.entry.js.map} +0 -0
- /package/dist/chucao/{p-1778a313.entry.js.map → p-2c1bc8bd.entry.js.map} +0 -0
- /package/dist/chucao/{p-6e95f31f.entry.js.map → p-337d7f68.entry.js.map} +0 -0
- /package/dist/chucao/{p-d0533af6.entry.js.map → p-50cbea7f.entry.js.map} +0 -0
- /package/dist/chucao/{p-56d64d84.entry.js.map → p-7d4336bd.entry.js.map} +0 -0
- /package/dist/chucao/{p-17451d92.entry.js.map → p-925af6b8.entry.js.map} +0 -0
- /package/dist/chucao/{p-d776b092.entry.js.map → p-95061461.entry.js.map} +0 -0
- /package/dist/chucao/{p-34a9d1f4.entry.js.map → p-9794a3fa.entry.js.map} +0 -0
- /package/dist/chucao/{p-85db779c.entry.js.map → p-b56f4a29.entry.js.map} +0 -0
- /package/dist/chucao/{p-449e1ba0.entry.js.map → p-c1b35f1b.entry.js.map} +0 -0
- /package/dist/chucao/{p-0e3c83a6.entry.js.map → p-e2f725bd.entry.js.map} +0 -0
- /package/dist/chucao/{p-7c85f5fe.entry.js.map → p-e6f959f4.entry.js.map} +0 -0
- /package/dist/chucao/{p-907195ff.entry.js.map → p-f0aea6ed.entry.js.map} +0 -0
- /package/dist/chucao/{p-a07e0e97.entry.js.map → p-f7305552.entry.js.map} +0 -0
- /package/dist/components/{p-no2_9Jk-.js.map → p-Cw0b4OGc.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-ByZY6aTj.js');
|
|
4
4
|
var scrollLock = require('./scroll-lock-DIRqLP4K.js');
|
|
5
5
|
|
|
6
6
|
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}}`;
|
|
@@ -140,7 +140,7 @@ const ChModal = class {
|
|
|
140
140
|
this.chClose.emit();
|
|
141
141
|
};
|
|
142
142
|
render() {
|
|
143
|
-
return (index.h(index.Host, { key: '
|
|
143
|
+
return (index.h(index.Host, { key: '01e01a6927352410f85cb7022aa653482e52f010' }, index.h("dialog", { key: '166798e913c662fad6c517d3c5ac957b3d9a44cf', class: { modal: true, [`modal--${this.size}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, index.h("div", { key: '3d0766206306e7efe1c613313a99d049aea168ef', class: "modal-head" }, index.h("slot", { key: '9b50ec72180b64e7eef52dab2f9246eee1cbe788', name: "heading" }), this.closeLabel && (index.h("button", { key: 'd6c375363d9debb0c3858bb0dc1a67c816b24442', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, index.h("span", { key: '128216aa8fca200775cd7ab28b23555bd516d1db', "aria-hidden": "true" }, "\u00D7")))), index.h("div", { key: 'eebabfd71be502cc99e8337526cd31d4406d5eb8', class: "modal-body" }, index.h("slot", { key: '1bbc38d606a23c6b499a80a6695a1ee6334c414f' })))));
|
|
144
144
|
}
|
|
145
145
|
static get watchers() { return {
|
|
146
146
|
"open": [{
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-ByZY6aTj.js');
|
|
4
|
+
|
|
5
|
+
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}}`;
|
|
6
|
+
|
|
7
|
+
const ChPageHeader = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The page title. Rendered as a real heading, so it also works as the
|
|
13
|
+
* accessible name of the page region.
|
|
14
|
+
*/
|
|
15
|
+
title;
|
|
16
|
+
/**
|
|
17
|
+
* Heading element to render. Use `h2` (or `h3`) when the page already has a
|
|
18
|
+
* higher-level heading above this block, so the document outline stays valid.
|
|
19
|
+
*/
|
|
20
|
+
headingLevel = 'h1';
|
|
21
|
+
/**
|
|
22
|
+
* Optional small label above the title, as slotted content. Use it for a
|
|
23
|
+
* section or entity kind ("Proyecto", "Factura #1042"), not for the title.
|
|
24
|
+
*/
|
|
25
|
+
eyebrow;
|
|
26
|
+
/**
|
|
27
|
+
* Optional supporting line under the title.
|
|
28
|
+
*/
|
|
29
|
+
description;
|
|
30
|
+
/**
|
|
31
|
+
* Puts the actions below the title instead of beside it. Use it when the
|
|
32
|
+
* actions are too wide to sit on the same row even after wrapping.
|
|
33
|
+
*/
|
|
34
|
+
actionsStacked = false;
|
|
35
|
+
render() {
|
|
36
|
+
const Heading = this.headingLevel;
|
|
37
|
+
return (index.h(index.Host, { key: '0e2bc8c10790e1f6f36a4c679579ac775f6ec3a4' }, index.h("div", { key: '8ef9876c61f0ff325fedfb899d2e09c02b8e5e53', class: { 'header': true, 'header--stacked': this.actionsStacked } }, index.h("div", { key: '3bef4d66f8d69397c4117e9d4a0637e978abbe2e', class: "header-text" }, this.eyebrow && index.h("p", { key: '1ae504669807c48d95d12ce5b7d488f85e5dc864', class: "header-eyebrow" }, this.eyebrow), index.h(Heading, { key: '9b6374d6b1d18124e49acf67af08443175f4bbaa', class: "header-title" }, this.title), this.description && index.h("p", { key: '9c3d2d58f1c2dde2c70fc5f86eb2d580a13f8594', class: "header-description" }, this.description)), index.h("div", { key: '3b48c89c2a8c4c5d3e42f6b78db80b3e9c2e0c50', class: "header-actions" }, index.h("slot", { key: '77b2010fec0113af7c8ee7c7bcd884dd11b05138', name: "actions" })))));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
ChPageHeader.style = chPageHeaderCss();
|
|
41
|
+
|
|
42
|
+
exports.ch_page_header = ChPageHeader;
|
|
43
|
+
//# sourceMappingURL=ch-page-header.entry.cjs.js.map
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=ch-page-header.cjs.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"ch-page-header.cjs.entry.js","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,QACEA,QAACC,UAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACHD,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,CAAC,cAAc,EAAE,EAAA,EACpEA,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,aAAa,EAAA,EACrB,IAAI,CAAC,OAAO,IAAIA,OAAA,CAAA,GAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAG,KAAK,EAAC,gBAAgB,EAAA,EAAE,IAAI,CAAC,OAAO,CAAK,EAC7DA,OAAA,CAAC,OAAO,qDAAC,KAAK,EAAC,cAAc,EAAA,EAAE,IAAI,CAAC,KAAK,CAAW,EACnD,IAAI,CAAC,WAAW,IAAIA,OAAA,CAAA,GAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAG,KAAK,EAAC,oBAAoB,EAAA,EAAE,IAAI,CAAC,WAAW,CAAK,CACrE,EACNA,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,gBAAgB,EAAA,EACzBA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,SAAS,EAAA,CAAQ,CACxB,CACF,CACD;;;;;;;","names":["h","Host"],"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"],"version":3}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-ByZY6aTj.js');
|
|
4
4
|
var validationMessage = require('./validation-message-bbtJ2sa_.js');
|
|
5
5
|
|
|
6
6
|
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)}`;
|
|
@@ -114,7 +114,7 @@ const ChRadio = class {
|
|
|
114
114
|
}
|
|
115
115
|
render() {
|
|
116
116
|
const groupName = this.name || `${this.groupId}-group`;
|
|
117
|
-
return (index.h(index.Host, { key: '
|
|
117
|
+
return (index.h(index.Host, { key: 'f55466f6bcbe3283d294161c02498419066ca958' }, this.label && (index.h("span", { key: '789131e7d8812ee930db5e0a0c6dc7f7e353249f', class: "group-label", id: this.labelId }, this.label)), index.h("div", { key: 'fc0a7adbde7feaaca99d156d45aacb6d18d5588e', class: "radio-group", role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (index.h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, index.h("input", { class: { 'input': true, 'input--invalid': this.invalid }, type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), index.h("span", { class: "mark" }), index.h("span", { class: "label-text" }, option.label))))), this.hint && !(this.invalid && this.errorMessage) && (index.h("p", { key: '53f3e9d368cfefa9a4d85010b65f002a3b92e0f4', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (index.h("p", { key: '517b7204ebf91042d293be294d7e936954eb80fb', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
118
118
|
}
|
|
119
119
|
static get formAssociated() { return true; }
|
|
120
120
|
static get watchers() { return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-ByZY6aTj.js');
|
|
4
4
|
var validationMessage = require('./validation-message-bbtJ2sa_.js');
|
|
5
5
|
|
|
6
6
|
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}}`;
|
|
@@ -93,7 +93,7 @@ const ChSegmentedControl = class {
|
|
|
93
93
|
}
|
|
94
94
|
render() {
|
|
95
95
|
const groupName = this.name || `${this.groupId}-group`;
|
|
96
|
-
return (index.h(index.Host, { key: '
|
|
96
|
+
return (index.h(index.Host, { key: 'a8782886fd0c20fa96a5a54c9997fe9d91d3e670' }, this.label && (index.h("span", { key: '99a2727035a62f71d01f07e0cf222becb118d3b2', class: "group-label", id: this.labelId }, this.label)), index.h("div", { key: '31b293c379a996e06650c1a6c9fe9c46c32097a2', class: { segmented: true, [`segmented--${this.size}`]: true }, role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (index.h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, index.h("input", { class: "input", type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, onChange: this.handleChange }), index.h("span", { class: "label-text" }, option.label)))))));
|
|
97
97
|
}
|
|
98
98
|
static get formAssociated() { return true; }
|
|
99
99
|
static get watchers() { return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-ByZY6aTj.js');
|
|
4
4
|
|
|
5
5
|
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}}`;
|
|
6
6
|
|
|
@@ -47,7 +47,7 @@ const ChSkeleton = class {
|
|
|
47
47
|
return { width: this.width, height: this.height };
|
|
48
48
|
}
|
|
49
49
|
render() {
|
|
50
|
-
return (index.h(index.Host, { key: '
|
|
50
|
+
return (index.h(index.Host, { key: '705e4cd6dac9c8c8578cb8133a700c3297d9fffe', "aria-hidden": "true", class: { 'skeleton': true, [`skeleton--${this.shape}`]: true, 'skeleton--animated': this.animated } }, Array.from({ length: this.items }).map((value, index$1) => (index.h("span", { class: "skeleton__item", style: this.sizeStyle, key: index$1, "data-index": String(value) })))));
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
ChSkeleton.style = chSkeletonCss();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-ByZY6aTj.js');
|
|
4
4
|
|
|
5
5
|
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}`;
|
|
6
6
|
|
|
@@ -26,7 +26,7 @@ const ChStack = class {
|
|
|
26
26
|
return GAPS.has(this.gap) ? this.gap : 'md';
|
|
27
27
|
}
|
|
28
28
|
render() {
|
|
29
|
-
return (index.h(index.Host, { key: '
|
|
29
|
+
return (index.h(index.Host, { key: 'd4ee90331cd1ff0d65eb9c80aa684d3b2f5e2876', class: { stack: true, [`stack--gap-${this.gapStep}`]: true, [`stack--align-${this.align}`]: true, [`stack--justify-${this.justify}`]: true } }, index.h("slot", { key: 'bdfe358adc457ed6ba79ca80b9e96f17597fbcb5' })));
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
ChStack.style = chStackCss();
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-ByZY6aTj.js');
|
|
4
|
+
|
|
5
|
+
const chStatCss = () => `:host{display:block;font-family:var(--typography-body);color:var(--color-text-primary)}:host([hidden]){display:none}.stat__inner{display:flex;flex-direction:column;gap:var(--spacing-2xs);padding:var(--spacing-md) var(--spacing-lg);border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-md);background:var(--color-surface-default)}.stat__label{font-size:var(--typography-size-xs);font-weight:var(--typography-weight-semibold);letter-spacing:0.06em;text-transform:uppercase;color:var(--color-text-secondary)}.stat__value{font-family:var(--typography-heading);font-size:var(--typography-size-xl);font-weight:var(--typography-weight-bold);font-variant-numeric:tabular-nums;display:flex;align-items:baseline;gap:var(--spacing-2xs)}.stat__cue{font-size:var(--typography-size-md)}.stat__value--positive{color:var(--color-status-positive)}.stat__value--negative{color:var(--color-status-negative)}.stat__value--unavailable{color:var(--color-text-tertiary);font-style:italic}.stat__hint{font-size:var(--typography-size-sm);color:var(--color-text-secondary)}.stat__footer:empty{display:none}.stat__footer{margin-top:var(--spacing-2xs)}`;
|
|
6
|
+
|
|
7
|
+
const TONES = new Set(['default', 'positive', 'negative', 'unavailable']);
|
|
8
|
+
const ChStat = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Short label naming the metric, rendered in small caps above the value.
|
|
14
|
+
*/
|
|
15
|
+
label;
|
|
16
|
+
/**
|
|
17
|
+
* The metric value, already formatted by the consumer. Shown verbatim.
|
|
18
|
+
*/
|
|
19
|
+
value;
|
|
20
|
+
/**
|
|
21
|
+
* Secondary line under the value — a comparison or a unit note.
|
|
22
|
+
*/
|
|
23
|
+
hint;
|
|
24
|
+
/**
|
|
25
|
+
* Visual tone of the value. `positive` and `negative` add a sign cue so
|
|
26
|
+
* the tone survives greyscale; `unavailable` dims the value for the
|
|
27
|
+
* "could not be measured" case. An unknown value falls back to `default`.
|
|
28
|
+
*/
|
|
29
|
+
tone = 'default';
|
|
30
|
+
get toneClass() {
|
|
31
|
+
return TONES.has(this.tone) ? this.tone : 'default';
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
const cue = this.toneClass === 'positive' ? '+' : this.toneClass === 'negative' ? '−' : null;
|
|
35
|
+
return (index.h(index.Host, { key: '5a43c713faab1513866d8f06899bb3fd3184cf09', class: "stat" }, index.h("div", { key: '9c24e9774cfe0a70b8ba37c06ce7f264b34a9d8c', class: "stat__inner" }, index.h("span", { key: '1a9330c2b31ec6de29f1b8c77761d7eb16160aae', class: "stat__label" }, this.label), index.h("span", { key: '3f6c5e76f5c062effcb9793206a949942bcdfb9a', class: {
|
|
36
|
+
stat__value: true,
|
|
37
|
+
[`stat__value--${this.toneClass}`]: this.toneClass !== 'default',
|
|
38
|
+
} }, cue && (index.h("span", { key: 'b5f79899ec52e7e2b3ec3c00295f755f770a8bca', class: "stat__cue", "aria-hidden": "true" }, cue)), index.h("slot", { key: 'b64083aa5738b4088cf9029650286b2564649ec9', name: "value" }, this.value)), this.hint && index.h("span", { key: '9f560c1f1fd23f08ea63eccc9076066a7fd1a0f9', class: "stat__hint" }, this.hint), index.h("div", { key: '77f3fe1f87e3abc2cce829e06b21f6b2c5f9aa15', class: "stat__footer" }, index.h("slot", { key: 'd75204702eab0ab1f55df92e9c13c899235f6840', name: "footer" })))));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
ChStat.style = chStatCss();
|
|
42
|
+
|
|
43
|
+
exports.ch_stat = ChStat;
|
|
44
|
+
//# sourceMappingURL=ch-stat.entry.cjs.js.map
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=ch-stat.cjs.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"ch-stat.cjs.entry.js","mappings":";;;;AAAA,MAAM,SAAS,GAAG,MAAM,CAAC,soCAAsoC,CAAC;;ACIhqC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;MA0B5D,MAAM,GAAA,MAAA;;;;AACjB;;AAEG;AACK,IAAA,KAAK;AAEb;;AAEG;AACK,IAAA,KAAK;AAEb;;AAEG;AACK,IAAA,IAAI;AAEZ;;;;AAIG;IACK,IAAI,GAAe,SAAS;AAEpC,IAAA,IAAY,SAAS,GAAA;AACnB,QAAA,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,SAAS;;IAGrD,MAAM,GAAA;QACJ,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,KAAK,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,KAAK,UAAU,GAAG,GAAG,GAAG,IAAI;QAE5F,QACEA,OAAA,CAACC,UAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAC,KAAK,EAAC,MAAM,EAAA,EAChBD,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,aAAa,EAAA,EACtBA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,KAAK,EAAC,aAAa,IAAE,IAAI,CAAC,KAAK,CAAQ,EAC7CA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,KAAK,EAAE;AACL,gBAAA,WAAW,EAAE,IAAI;gBACjB,CAAC,CAAA,aAAA,EAAgB,IAAI,CAAC,SAAS,CAAA,CAAE,GAAG,IAAI,CAAC,SAAS,KAAK,SAAS;aACjE,EAAA,EAEA,GAAG,KACFA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,KAAK,EAAC,WAAW,EAAA,aAAA,EAAa,MAAM,EAAA,EACvC,GAAG,CACC,CACR,EACDA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,OAAO,EAAA,EAAE,IAAI,CAAC,KAAK,CAAQ,CACjC,EACN,IAAI,CAAC,IAAI,IAAIA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,KAAK,EAAC,YAAY,EAAA,EAAE,IAAI,CAAC,IAAI,CAAQ,EACzDA,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,cAAc,EAAA,EACvBA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,QAAQ,EAAA,CAAQ,CACvB,CACF,CACD;;;;;;;","names":["h","Host"],"sources":["src/components/ch-stat/ch-stat.css?tag=ch-stat&encapsulation=shadow","src/components/ch-stat/ch-stat.tsx"],"sourcesContent":[":host {\n display: block;\n font-family: var(--typography-body);\n color: var(--color-text-primary);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.stat__inner {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-2xs);\n padding: var(--spacing-md) var(--spacing-lg);\n border: var(--border-width) solid var(--color-border-default);\n border-radius: var(--radius-md);\n background: var(--color-surface-default);\n}\n\n.stat__label {\n font-size: var(--typography-size-xs);\n font-weight: var(--typography-weight-semibold);\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--color-text-secondary);\n}\n\n.stat__value {\n font-family: var(--typography-heading);\n font-size: var(--typography-size-xl);\n font-weight: var(--typography-weight-bold);\n font-variant-numeric: tabular-nums;\n display: flex;\n align-items: baseline;\n gap: var(--spacing-2xs);\n}\n\n/* The sign cue carries the tone in greyscale; colour only reinforces it. */\n.stat__cue {\n font-size: var(--typography-size-md);\n}\n\n.stat__value--positive {\n color: var(--color-status-positive);\n}\n\n.stat__value--negative {\n color: var(--color-status-negative);\n}\n\n.stat__value--unavailable {\n color: var(--color-text-tertiary);\n font-style: italic;\n}\n\n.stat__hint {\n font-size: var(--typography-size-sm);\n color: var(--color-text-secondary);\n}\n\n.stat__footer:empty {\n display: none;\n}\n\n.stat__footer {\n margin-top: var(--spacing-2xs);\n}\n","import { Component, Host, Prop, h } from '@stencil/core';\n\nexport type ChStatTone = 'default' | 'positive' | 'negative' | 'unavailable';\n\nconst TONES = new Set(['default', 'positive', 'negative', 'unavailable']);\n\n/**\n * One dashboard metric: a label, a value and an optional hint.\n *\n * The value is a string the consumer has already formatted — the component\n * never parses numbers, so locale, currency and precision stay where the\n * data comes from. On a fetch error, pass the em dash and the unavailable\n * tone rather than a zero that would read as a real measurement:\n *\n * ```html\n * <ch-stat label=\"Ventas del mes\" value=\"$1.250.000\" tone=\"positive\"></ch-stat>\n * <ch-stat label=\"Ticket promedio\" value=\"—\" tone=\"unavailable\"></ch-stat>\n * ```\n *\n * A tone is never carried by colour alone: positive and negative values get\n * a visible sign cue, so the three states stay distinguishable in greyscale\n * and for colour-blind users. The `value` slot replaces the rendered value\n * for composed content (a link, a spinner), and the `footer` slot sits under\n * the hint for a comparison line or a sparkline.\n */\n@Component({\n tag: 'ch-stat',\n styleUrl: 'ch-stat.css',\n shadow: true,\n})\nexport class ChStat {\n /**\n * Short label naming the metric, rendered in small caps above the value.\n */\n @Prop() label!: string;\n\n /**\n * The metric value, already formatted by the consumer. Shown verbatim.\n */\n @Prop() value!: string;\n\n /**\n * Secondary line under the value — a comparison or a unit note.\n */\n @Prop() hint?: string;\n\n /**\n * Visual tone of the value. `positive` and `negative` add a sign cue so\n * the tone survives greyscale; `unavailable` dims the value for the\n * \"could not be measured\" case. An unknown value falls back to `default`.\n */\n @Prop() tone: ChStatTone = 'default';\n\n private get toneClass() {\n return TONES.has(this.tone) ? this.tone : 'default';\n }\n\n render() {\n const cue = this.toneClass === 'positive' ? '+' : this.toneClass === 'negative' ? '−' : null;\n\n return (\n <Host class=\"stat\">\n <div class=\"stat__inner\">\n <span class=\"stat__label\">{this.label}</span>\n <span\n class={{\n stat__value: true,\n [`stat__value--${this.toneClass}`]: this.toneClass !== 'default',\n }}\n >\n {cue && (\n <span class=\"stat__cue\" aria-hidden=\"true\">\n {cue}\n </span>\n )}\n <slot name=\"value\">{this.value}</slot>\n </span>\n {this.hint && <span class=\"stat__hint\">{this.hint}</span>}\n <div class=\"stat__footer\">\n <slot name=\"footer\"></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-ByZY6aTj.js');
|
|
4
4
|
|
|
5
5
|
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}`;
|
|
6
6
|
|
|
@@ -86,7 +86,7 @@ const ChTabs = class {
|
|
|
86
86
|
}
|
|
87
87
|
render() {
|
|
88
88
|
const active = this.activeValue;
|
|
89
|
-
return (index.h(index.Host, { key: '
|
|
89
|
+
return (index.h(index.Host, { key: 'de167280c159345631f84f5eb7a3dc165396f361' }, index.h("div", { key: '62c008bcf9eafd1c5f5121540b2841e2a6ada541', class: "tablist", role: "tablist", "aria-label": this.label, onKeyDown: this.handleKeyDown, ref: el => (this.tablistEl = el) }, this.tabs.map(tab => {
|
|
90
90
|
const selected = tab.value === active;
|
|
91
91
|
return (index.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));
|
|
92
92
|
})), this.tabs.map(tab => (index.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 }, index.h("slot", { name: `panel-${tab.value}` }))))));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-ByZY6aTj.js');
|
|
4
4
|
var validationMessage = require('./validation-message-bbtJ2sa_.js');
|
|
5
5
|
|
|
6
6
|
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)}`;
|
|
@@ -125,7 +125,7 @@ const ChTextarea = class {
|
|
|
125
125
|
return undefined;
|
|
126
126
|
}
|
|
127
127
|
render() {
|
|
128
|
-
return (index.h(index.Host, { key: '
|
|
128
|
+
return (index.h(index.Host, { key: 'c4334a23f6ad2394d410498726f3f422a654ffe3' }, this.label && (index.h("label", { key: 'd935613b40c6c52be41e258aad2a3c17a290a506', class: "label", htmlFor: this.textareaId }, this.label)), index.h("textarea", { key: 'ab27ae9a6be7d2bcc17638c209ef23eb3757c102', 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) && (index.h("p", { key: 'eb488704ac6ff76534308aefd0938d848d14608f', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (index.h("p", { key: '04c084b29d102f06bf15efc4c416b6ba0967ba8d', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
129
129
|
}
|
|
130
130
|
static get formAssociated() { return true; }
|
|
131
131
|
static get watchers() { return {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-ByZY6aTj.js');
|
|
4
|
+
|
|
5
|
+
const chTimelineCss = () => `:host{display:block;font-family:var(--typography-body);color:var(--color-text-secondary)}:host([hidden]){display:none}.list{margin:0;padding:0;display:grid;gap:var(--spacing-md);list-style:none}::slotted(li){position:relative;padding-left:var(--spacing-2xl);min-width:0}::slotted(li)::before{content:'';position:absolute;left:0;top:0.35em;width:var(--spacing-sm);height:var(--spacing-sm);border-radius:50%;background:var(--color-border-default)}::slotted(li:not(:last-of-type))::after{content:'';position:absolute;left:calc(var(--spacing-sm) / 2 - var(--border-width));top:calc(0.35em + var(--spacing-sm));bottom:calc(0px - var(--spacing-md));width:var(--border-width);background:var(--color-border-default)}::slotted(time){font-variant-numeric:tabular-nums}`;
|
|
6
|
+
|
|
7
|
+
const ChTimeline = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
}
|
|
11
|
+
render() {
|
|
12
|
+
return (index.h(index.Host, { key: 'da3288af540acb92113ba83d08fc5e1693e83b3e', class: "timeline" }, index.h("ol", { key: '1aaee846703dd0a67d6df04945eb4a62e2bbf711', class: "list" }, index.h("slot", { key: '394cfd03640a2cf78bd620338de9ed9ef7b9d9f5' }))));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
ChTimeline.style = chTimelineCss();
|
|
16
|
+
|
|
17
|
+
exports.ch_timeline = ChTimeline;
|
|
18
|
+
//# sourceMappingURL=ch-timeline.entry.cjs.js.map
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=ch-timeline.cjs.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"ch-timeline.cjs.entry.js","mappings":";;;;AAAA,MAAM,aAAa,GAAG,MAAM,CAAC,svBAAsvB,CAAC;;MC+BvwB,UAAU,GAAA,MAAA;;;;IACrB,MAAM,GAAA;AACJ,QAAA,QACEA,OAAA,CAACC,UAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAC,KAAK,EAAC,UAAU,EAAA,EACpBD,OAAA,CAAA,IAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAI,KAAK,EAAC,MAAM,EAAA,EACdA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAa,CACV,CACA;;;;;;;","names":["h","Host"],"sources":["src/components/ch-timeline/ch-timeline.css?tag=ch-timeline&encapsulation=shadow","src/components/ch-timeline/ch-timeline.tsx"],"sourcesContent":[":host {\n display: block;\n font-family: var(--typography-body);\n color: var(--color-text-secondary);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.list {\n margin: 0;\n padding: 0;\n display: grid;\n gap: var(--spacing-md);\n /* Reserve the rail: every item indents past its marker. */\n list-style: none;\n}\n\n/* Each slotted item indents past its dot; pseudo-elements on slotted\n * content are part of the shadow stylesheet's remit here. */\n::slotted(li) {\n position: relative;\n padding-left: var(--spacing-2xl);\n min-width: 0;\n}\n\n/* The marker dot, vertically on the item's first line. */\n::slotted(li)::before {\n content: '';\n position: absolute;\n left: 0;\n top: 0.35em;\n width: var(--spacing-sm);\n height: var(--spacing-sm);\n border-radius: 50%;\n background: var(--color-border-default);\n}\n\n/* The connector to the next item; the last item never gets one, so the\n * timeline does not trail off into nothing. */\n::slotted(li:not(:last-of-type))::after {\n content: '';\n position: absolute;\n left: calc(var(--spacing-sm) / 2 - var(--border-width));\n top: calc(0.35em + var(--spacing-sm));\n bottom: calc(0px - var(--spacing-md));\n width: var(--border-width);\n background: var(--color-border-default);\n}\n\n::slotted(time) {\n font-variant-numeric: tabular-nums;\n}\n","import { Component, Host, h } from '@stencil/core';\n\n/**\n * Chronological history: a native ordered list with a marker dot per item\n * and a connector line between items — the last item never gets a trailing\n * connector.\n *\n * The component renders the `<ol>` and owns the rail; the consumer writes\n * plain `<li>` items with whatever content each entry needs — a preformatted\n * date, a title, a description, and a non-colour state cue from `ch-icon`:\n *\n * ```html\n * <ch-timeline>\n * <li>\n * <ch-icon name=\"check\"></ch-icon>\n * <time datetime=\"2026-11-02\">2 nov 2026</time> — Creado el pedido\n * </li>\n * <li><ch-icon name=\"spinner\"></ch-icon> Esperando despacho</li>\n * </ch-timeline>\n * ```\n *\n * The list semantics survive untouched because the `li` elements stay native\n * in the light DOM — measured on #83: a wrapped item still counts as a\n * `listitem`, so nothing is gained by a `ch-timeline-item` element, and\n * native markup is the safe bet across browsers.\n */\n@Component({\n tag: 'ch-timeline',\n styleUrl: 'ch-timeline.css',\n shadow: true,\n})\nexport class ChTimeline {\n render() {\n return (\n <Host class=\"timeline\">\n <ol class=\"list\">\n <slot></slot>\n </ol>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,18 +1,124 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-ByZY6aTj.js');
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const OPPOSITE = {
|
|
6
|
+
top: 'bottom',
|
|
7
|
+
bottom: 'top',
|
|
8
|
+
left: 'right',
|
|
9
|
+
right: 'left',
|
|
10
|
+
};
|
|
11
|
+
const AXIS = {
|
|
12
|
+
top: 'vertical',
|
|
13
|
+
bottom: 'vertical',
|
|
14
|
+
left: 'horizontal',
|
|
15
|
+
right: 'horizontal',
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* How far a placed surface overflows each viewport edge. Positive values are
|
|
19
|
+
* overflow. Used both to pick a placement and to shift the surface back in.
|
|
20
|
+
*/
|
|
21
|
+
function overflowOf(surface, viewport) {
|
|
22
|
+
return {
|
|
23
|
+
top: viewport.top - surface.top,
|
|
24
|
+
left: viewport.left - surface.left,
|
|
25
|
+
bottom: surface.top + surface.height - (viewport.top + viewport.height),
|
|
26
|
+
right: surface.left + surface.width - (viewport.left + viewport.width),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function offsetFor(placement, anchor, surface, gap) {
|
|
30
|
+
switch (placement) {
|
|
31
|
+
case 'top':
|
|
32
|
+
return {
|
|
33
|
+
top: anchor.top - surface.height - gap,
|
|
34
|
+
left: anchor.left + (anchor.width - surface.width) / 2,
|
|
35
|
+
};
|
|
36
|
+
case 'bottom':
|
|
37
|
+
return {
|
|
38
|
+
top: anchor.top + anchor.height + gap,
|
|
39
|
+
left: anchor.left + (anchor.width - surface.width) / 2,
|
|
40
|
+
};
|
|
41
|
+
case 'left':
|
|
42
|
+
return {
|
|
43
|
+
top: anchor.top + (anchor.height - surface.height) / 2,
|
|
44
|
+
left: anchor.left - surface.width - gap,
|
|
45
|
+
};
|
|
46
|
+
case 'right':
|
|
47
|
+
return {
|
|
48
|
+
top: anchor.top + (anchor.height - surface.height) / 2,
|
|
49
|
+
left: anchor.left + anchor.width + gap,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Picks the placement that overflows least and then shifts the surface along
|
|
55
|
+
* the cross axis so it stays inside the viewport.
|
|
56
|
+
*
|
|
57
|
+
* The main-axis overflow is not compensated with a translate: a tooltip pinned
|
|
58
|
+
* to the top edge would cover its own trigger. Flipping to the other side is
|
|
59
|
+
* what keeps it readable, and the caller decides whether to accept the
|
|
60
|
+
* remaining overflow.
|
|
61
|
+
*/
|
|
62
|
+
function placeOverlay({ anchor, surface, viewport, preferred, gap, }) {
|
|
63
|
+
const candidates = [preferred, OPPOSITE[preferred]];
|
|
64
|
+
let placement = preferred;
|
|
65
|
+
let best = Number.POSITIVE_INFINITY;
|
|
66
|
+
for (const candidate of candidates) {
|
|
67
|
+
const { top, left } = offsetFor(candidate, anchor, surface, gap);
|
|
68
|
+
const rect = { top, left, width: surface.width, height: surface.height };
|
|
69
|
+
const overflow = overflowOf(rect, viewport);
|
|
70
|
+
const main = AXIS[candidate] === 'vertical' ? clamp(overflow.top) + clamp(overflow.bottom) : clamp(overflow.left) + clamp(overflow.right);
|
|
71
|
+
if (main < best) {
|
|
72
|
+
best = main;
|
|
73
|
+
placement = candidate;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const { top, left } = offsetFor(placement, anchor, surface, gap);
|
|
77
|
+
const rect = { top, left, width: surface.width, height: surface.height };
|
|
78
|
+
const overflow = overflowOf(rect, viewport);
|
|
79
|
+
const shifted = AXIS[placement] === 'vertical' ? { top, left: left + correction(overflow.left, overflow.right) } : { top: top + correction(overflow.top, overflow.bottom), left };
|
|
80
|
+
return { placement, top: shifted.top, left: shifted.left };
|
|
81
|
+
}
|
|
82
|
+
/** Only real overflow counts: the side that fits contributes nothing. */
|
|
83
|
+
function clamp(overflow) {
|
|
84
|
+
return overflow > 0 ? overflow : 0;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Turns the two overflows on an axis into a shift. `before` is the overflow on
|
|
88
|
+
* the leading edge (top or left), `after` the one on the trailing edge; both
|
|
89
|
+
* are positive when the surface spills past that edge.
|
|
90
|
+
*
|
|
91
|
+
* Pushing away from the leading edge moves the surface inwards, so the shift is
|
|
92
|
+
* `+before`. The trailing edge needs the opposite sign. When both overflow the
|
|
93
|
+
* surface is larger than the viewport: pin it to the leading edge and let
|
|
94
|
+
* `max-width` stop the spill.
|
|
95
|
+
*/
|
|
96
|
+
function correction(before, after) {
|
|
97
|
+
if (before > 0) {
|
|
98
|
+
return before;
|
|
99
|
+
}
|
|
100
|
+
if (after > 0) {
|
|
101
|
+
return -after;
|
|
102
|
+
}
|
|
103
|
+
return 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
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}}`;
|
|
6
107
|
|
|
7
108
|
let tooltipIds = 0;
|
|
109
|
+
/** Space between the trigger and the bubble, matching `--spacing-md`. */
|
|
110
|
+
const GAP = 8;
|
|
8
111
|
const ChTooltip = class {
|
|
9
112
|
constructor(hostRef) {
|
|
10
113
|
index.registerInstance(this, hostRef);
|
|
11
114
|
}
|
|
12
115
|
get el() { return index.getElement(this); }
|
|
13
116
|
fallbackId = `ch-tooltip-${++tooltipIds}`;
|
|
117
|
+
bubbleEl;
|
|
118
|
+
cleanup;
|
|
14
119
|
/**
|
|
15
|
-
*
|
|
120
|
+
* The side the bubble is placed on. It is a preference: when that side has no
|
|
121
|
+
* room the bubble flips to the opposite one.
|
|
16
122
|
*/
|
|
17
123
|
placement = 'top';
|
|
18
124
|
// Hover and focus are tracked apart so that neither cancels the other: a
|
|
@@ -21,15 +127,26 @@ const ChTooltip = class {
|
|
|
21
127
|
hovered = false;
|
|
22
128
|
focused = false;
|
|
23
129
|
dismissed = false;
|
|
130
|
+
/** The placement actually used, which may differ from the prop after a flip. */
|
|
131
|
+
resolvedPlacement;
|
|
132
|
+
/** Offset applied to the bubble once it has been measured. */
|
|
133
|
+
offset;
|
|
24
134
|
get visible() {
|
|
25
135
|
return (this.hovered || this.focused) && !this.dismissed;
|
|
26
136
|
}
|
|
27
137
|
componentDidLoad() {
|
|
28
138
|
this.associate();
|
|
29
139
|
}
|
|
140
|
+
connectedCallback() {
|
|
141
|
+
this.watchViewport();
|
|
142
|
+
}
|
|
143
|
+
disconnectedCallback() {
|
|
144
|
+
this.cleanup?.();
|
|
145
|
+
}
|
|
30
146
|
handleMouseEnter() {
|
|
31
147
|
this.hovered = true;
|
|
32
148
|
this.dismissed = false;
|
|
149
|
+
this.position();
|
|
33
150
|
}
|
|
34
151
|
handleMouseLeave() {
|
|
35
152
|
this.hovered = false;
|
|
@@ -37,6 +154,7 @@ const ChTooltip = class {
|
|
|
37
154
|
handleFocusIn() {
|
|
38
155
|
this.focused = true;
|
|
39
156
|
this.dismissed = false;
|
|
157
|
+
this.position();
|
|
40
158
|
}
|
|
41
159
|
handleFocusOut() {
|
|
42
160
|
this.focused = false;
|
|
@@ -44,15 +162,85 @@ const ChTooltip = class {
|
|
|
44
162
|
/**
|
|
45
163
|
* Listens on the document because a tooltip opened by hovering leaves focus
|
|
46
164
|
* wherever it was, so a host-scoped handler would never see the key.
|
|
165
|
+
*
|
|
166
|
+
* `preventDefault()` dismisses only the innermost surface: the platform's
|
|
167
|
+
* close request for an open native `<dialog>` is the default action of this
|
|
168
|
+
* same keydown, so cancelling it keeps an enclosing `ch-modal` open. Proven
|
|
169
|
+
* against a real `ch-modal` in `tests/browser/ch-tooltip.browser.spec.ts`.
|
|
47
170
|
*/
|
|
48
171
|
handleKeyDown(event) {
|
|
49
|
-
if (event.key === 'Escape' && this.visible) {
|
|
172
|
+
if (event.key === 'Escape' && this.visible && !event.defaultPrevented) {
|
|
173
|
+
event.preventDefault();
|
|
50
174
|
this.dismissed = true;
|
|
51
175
|
}
|
|
52
176
|
}
|
|
177
|
+
/** Cheap guard so scroll frames do not measure while nothing is shown. */
|
|
178
|
+
handleScroll() {
|
|
179
|
+
if (this.visible && this.offset) {
|
|
180
|
+
this.position();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
handleResize() {
|
|
184
|
+
this.position();
|
|
185
|
+
}
|
|
186
|
+
watchViewport() {
|
|
187
|
+
if (typeof window === 'undefined') {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const viewport = window.visualViewport;
|
|
191
|
+
if (!viewport || this.cleanup) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const update = () => this.position();
|
|
195
|
+
viewport.addEventListener('resize', update);
|
|
196
|
+
viewport.addEventListener('scroll', update);
|
|
197
|
+
this.cleanup = () => {
|
|
198
|
+
viewport.removeEventListener('resize', update);
|
|
199
|
+
viewport.removeEventListener('scroll', update);
|
|
200
|
+
};
|
|
201
|
+
}
|
|
53
202
|
slotted(name) {
|
|
54
203
|
return Array.from(this.el.children).find(child => child.getAttribute('slot') === name);
|
|
55
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Measures the anchor and the bubble and stores the offset that keeps the
|
|
207
|
+
* bubble inside the viewport. Nothing is measured before the bubble has a
|
|
208
|
+
* box to measure, so the pre-paint render uses plain CSS.
|
|
209
|
+
*/
|
|
210
|
+
position() {
|
|
211
|
+
if (typeof window === 'undefined') {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const bubble = this.bubbleEl ?? (this.bubbleEl = this.el.shadowRoot?.querySelector('.bubble') ?? undefined);
|
|
215
|
+
if (!bubble || bubble.offsetWidth === 0) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const anchorRect = this.slotted('trigger')?.getBoundingClientRect?.();
|
|
219
|
+
if (!anchorRect) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const surface = {
|
|
223
|
+
width: bubble.offsetWidth + horizontalMargin(bubble),
|
|
224
|
+
height: bubble.offsetHeight,
|
|
225
|
+
};
|
|
226
|
+
const viewport = window.visualViewport;
|
|
227
|
+
const { placement, top, left } = placeOverlay({
|
|
228
|
+
anchor: { top: anchorRect.top, left: anchorRect.left, width: anchorRect.width, height: anchorRect.height },
|
|
229
|
+
surface,
|
|
230
|
+
viewport: viewport
|
|
231
|
+
? { top: viewport.offsetTop, left: viewport.offsetLeft, width: viewport.width, height: viewport.height }
|
|
232
|
+
: { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight },
|
|
233
|
+
preferred: this.placement,
|
|
234
|
+
gap: GAP,
|
|
235
|
+
});
|
|
236
|
+
const current = this.offset;
|
|
237
|
+
const unchanged = current?.top === top && current?.left === left && this.resolvedPlacement === placement;
|
|
238
|
+
this.resolvedPlacement = placement;
|
|
239
|
+
this.offset = { top, left };
|
|
240
|
+
if (!unchanged) {
|
|
241
|
+
index.forceUpdate(this);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
56
244
|
/**
|
|
57
245
|
* Points the trigger at the text with `aria-describedby`. Re-run on
|
|
58
246
|
* `slotchange` because a framework re-render can replace the slotted nodes
|
|
@@ -71,9 +259,22 @@ const ChTooltip = class {
|
|
|
71
259
|
trigger.setAttribute('aria-describedby', content.id);
|
|
72
260
|
};
|
|
73
261
|
render() {
|
|
74
|
-
|
|
262
|
+
const { offset } = this;
|
|
263
|
+
return (index.h(index.Host, { key: '676e431d0100ecc9ea688b7e37bc87e8295bb24d' }, index.h("span", { key: '20a388681252e9c4d52e662c014efd9a198efbd7', class: "anchor" }, index.h("slot", { key: 'a06cbe31dd04cba38ef09788359783d816fc1a5b', name: "trigger", onSlotchange: this.associate }), index.h("span", { key: '13cb5b782a7029fc82c10b9b6765de62b94b9afa', ref: el => (this.bubbleEl = el), style: {
|
|
264
|
+
'--ch-tooltip-offset-top': offset ? `${offset.top}px` : null,
|
|
265
|
+
'--ch-tooltip-offset-left': offset ? `${offset.left}px` : null,
|
|
266
|
+
}, class: {
|
|
267
|
+
'bubble': true,
|
|
268
|
+
'bubble--positioned': Boolean(this.offset),
|
|
269
|
+
[`bubble--${this.resolvedPlacement ?? this.placement}`]: true,
|
|
270
|
+
'bubble--visible': this.visible,
|
|
271
|
+
} }, index.h("slot", { key: '6610bbf299354bb3be07bb273fab3f8fd91fd254', name: "content", onSlotchange: this.associate })))));
|
|
75
272
|
}
|
|
76
273
|
};
|
|
274
|
+
function horizontalMargin(el) {
|
|
275
|
+
const style = getComputedStyle(el);
|
|
276
|
+
return (parseFloat(style.marginLeft) || 0) + (parseFloat(style.marginRight) || 0);
|
|
277
|
+
}
|
|
77
278
|
ChTooltip.style = chTooltipCss();
|
|
78
279
|
|
|
79
280
|
exports.ch_tooltip = ChTooltip;
|