@devschile/chucao 2.3.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/chucao.esm.js.map +1 -1
- package/dist/chucao/index.esm.js +1 -1
- package/dist/chucao/index.esm.js.map +1 -1
- package/dist/chucao/p-0bc141a2.entry.js +2 -0
- package/dist/chucao/p-0bc141a2.entry.js.map +1 -0
- package/dist/chucao/p-0e044eff.entry.js +2 -0
- package/dist/chucao/p-0e044eff.entry.js.map +1 -0
- package/dist/chucao/{p-ff5f5c1f.entry.js → p-1108062e.entry.js} +2 -2
- package/dist/chucao/p-26e144ff.entry.js +2 -0
- package/dist/chucao/p-26e144ff.entry.js.map +1 -0
- 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-2e785177.entry.js.map +1 -0
- package/dist/chucao/{p-04dbcfa0.entry.js → p-337d7f68.entry.js} +2 -2
- package/dist/chucao/p-350f974d.entry.js +2 -0
- package/dist/chucao/p-350f974d.entry.js.map +1 -0
- package/dist/chucao/p-4846cac4.entry.js +2 -0
- package/dist/chucao/p-6345c9e1.entry.js +2 -0
- package/dist/chucao/p-6345c9e1.entry.js.map +1 -0
- package/dist/chucao/p-957acf39.entry.js +2 -0
- package/dist/chucao/p-957acf39.entry.js.map +1 -0
- package/dist/chucao/p-97655c41.entry.js +2 -0
- package/dist/chucao/p-97655c41.entry.js.map +1 -0
- package/dist/chucao/{p-6a4bc80c.entry.js → p-9f73855e.entry.js} +2 -2
- package/dist/chucao/p-BXzZsX2r.js +2 -0
- package/dist/chucao/p-BXzZsX2r.js.map +1 -0
- 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-b53d954e.entry.js +2 -0
- package/dist/chucao/p-b53d954e.entry.js.map +1 -0
- package/dist/chucao/{p-c986036f.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-c251b0d1.entry.js +2 -0
- package/dist/chucao/p-c251b0d1.entry.js.map +1 -0
- package/dist/chucao/p-f5b74bca.entry.js +2 -0
- package/dist/chucao/p-f5b74bca.entry.js.map +1 -0
- package/dist/chucao/p-f9fe752c.entry.js +2 -0
- package/dist/chucao/p-f9fe752c.entry.js.map +1 -0
- package/dist/chucao/p-fdf065e6.entry.js +2 -0
- package/dist/chucao/p-fdf065e6.entry.js.map +1 -0
- package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ch-alert_8.cjs.entry.js +69 -38
- package/dist/cjs/ch-alert_8.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-checkbox.cjs.entry.js +9 -11
- package/dist/cjs/ch-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-cluster.cjs.entry.js +47 -0
- package/dist/cjs/ch-cluster.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-divider.cjs.entry.js +2 -2
- package/dist/cjs/ch-drawer.cjs.entry.js +4 -3
- package/dist/cjs/ch-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-emoji.cjs.entry.js +2 -2
- package/dist/cjs/ch-empty-state.cjs.entry.js +34 -0
- package/dist/cjs/ch-empty-state.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-grid.cjs.entry.js +59 -0
- package/dist/cjs/ch-grid.cjs.entry.js.map +1 -0
- 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 +4 -3
- package/dist/cjs/ch-modal.cjs.entry.js.map +1 -1
- 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 +9 -11
- package/dist/cjs/ch-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-segmented-control.cjs.entry.js +8 -7
- package/dist/cjs/ch-segmented-control.cjs.entry.js.map +1 -1
- package/dist/cjs/ch-skeleton.cjs.entry.js +58 -0
- package/dist/cjs/ch-skeleton.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-stack.cjs.entry.js +37 -0
- package/dist/cjs/ch-stack.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-tabs.cjs.entry.js +2 -2
- package/dist/cjs/ch-textarea.cjs.entry.js +9 -11
- package/dist/cjs/ch-textarea.cjs.entry.js.map +1 -1
- 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 +3 -3
- package/dist/cjs/chucao.cjs.js.map +1 -1
- package/dist/cjs/icons-CNyDgV-q.js +88 -0
- package/dist/cjs/icons-CNyDgV-q.js.map +1 -0
- package/dist/cjs/{index-C9cpLteP.js → index-ByZY6aTj.js} +119 -16
- 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/cjs/validation-message-bbtJ2sa_.js +26 -0
- package/dist/cjs/validation-message-bbtJ2sa_.js.map +1 -0
- package/dist/collection/collection-manifest.json +9 -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-button/ch-button.js +9 -2
- package/dist/collection/components/ch-button/ch-button.js.map +1 -1
- package/dist/collection/components/ch-card/ch-card.js +1 -1
- package/dist/collection/components/ch-checkbox/ch-checkbox.js +8 -10
- package/dist/collection/components/ch-checkbox/ch-checkbox.js.map +1 -1
- package/dist/collection/components/ch-cluster/ch-cluster.css +93 -0
- package/dist/collection/components/ch-cluster/ch-cluster.js +152 -0
- package/dist/collection/components/ch-cluster/ch-cluster.js.map +1 -0
- package/dist/collection/components/ch-divider/ch-divider.js +1 -1
- package/dist/collection/components/ch-drawer/ch-drawer.js +9 -3
- package/dist/collection/components/ch-drawer/ch-drawer.js.map +1 -1
- package/dist/collection/components/ch-emoji/ch-emoji.js +1 -1
- package/dist/collection/components/ch-empty-state/ch-empty-state.css +67 -0
- package/dist/collection/components/ch-empty-state/ch-empty-state.js +108 -0
- package/dist/collection/components/ch-empty-state/ch-empty-state.js.map +1 -0
- package/dist/collection/components/ch-grid/ch-grid.css +47 -0
- package/dist/collection/components/ch-grid/ch-grid.js +137 -0
- package/dist/collection/components/ch-grid/ch-grid.js.map +1 -0
- 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 +8 -10
- package/dist/collection/components/ch-input/ch-input.js.map +1 -1
- package/dist/collection/components/ch-modal/ch-modal.js +9 -3
- package/dist/collection/components/ch-modal/ch-modal.js.map +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 +8 -10
- package/dist/collection/components/ch-radio/ch-radio.js.map +1 -1
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +7 -6
- package/dist/collection/components/ch-segmented-control/ch-segmented-control.js.map +1 -1
- package/dist/collection/components/ch-select/ch-select.js +8 -10
- package/dist/collection/components/ch-select/ch-select.js.map +1 -1
- package/dist/collection/components/ch-skeleton/ch-skeleton.css +50 -0
- package/dist/collection/components/ch-skeleton/ch-skeleton.js +175 -0
- package/dist/collection/components/ch-skeleton/ch-skeleton.js.map +1 -0
- package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
- package/dist/collection/components/ch-stack/ch-stack.css +83 -0
- package/dist/collection/components/ch-stack/ch-stack.js +124 -0
- package/dist/collection/components/ch-stack/ch-stack.js.map +1 -0
- package/dist/collection/components/ch-switch/ch-switch.js +8 -10
- package/dist/collection/components/ch-switch/ch-switch.js.map +1 -1
- package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
- package/dist/collection/components/ch-textarea/ch-textarea.js +8 -10
- package/dist/collection/components/ch-textarea/ch-textarea.js.map +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/accessibility.js +24 -0
- package/dist/collection/utils/accessibility.js.map +1 -0
- 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/collection/utils/validation-message.js +20 -0
- package/dist/collection/utils/validation-message.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-button.js.map +1 -1
- package/dist/components/ch-card.js +1 -1
- package/dist/components/ch-checkbox.js +1 -1
- package/dist/components/ch-checkbox.js.map +1 -1
- package/dist/components/ch-cluster.d.ts +11 -0
- package/dist/components/ch-cluster.js +2 -0
- package/dist/components/ch-cluster.js.map +1 -0
- package/dist/components/ch-divider.js +1 -1
- package/dist/components/ch-drawer.js +1 -1
- package/dist/components/ch-drawer.js.map +1 -1
- package/dist/components/ch-emoji.js +1 -1
- package/dist/components/ch-empty-state.d.ts +11 -0
- package/dist/components/ch-empty-state.js +2 -0
- package/dist/components/ch-empty-state.js.map +1 -0
- package/dist/components/ch-grid.d.ts +11 -0
- package/dist/components/ch-grid.js +2 -0
- package/dist/components/ch-grid.js.map +1 -0
- 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-input.js.map +1 -1
- package/dist/components/ch-link.js +1 -1
- package/dist/components/ch-modal.js +1 -1
- package/dist/components/ch-modal.js.map +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-radio.js.map +1 -1
- package/dist/components/ch-segmented-control.js +1 -1
- package/dist/components/ch-segmented-control.js.map +1 -1
- package/dist/components/ch-select.js +1 -1
- package/dist/components/ch-select.js.map +1 -1
- package/dist/components/ch-skeleton.d.ts +11 -0
- package/dist/components/ch-skeleton.js +2 -0
- package/dist/components/ch-skeleton.js.map +1 -0
- package/dist/components/ch-spinner.js +1 -1
- package/dist/components/ch-stack.d.ts +11 -0
- package/dist/components/ch-stack.js +2 -0
- package/dist/components/ch-stack.js.map +1 -0
- package/dist/components/ch-switch.js +1 -1
- package/dist/components/ch-switch.js.map +1 -1
- package/dist/components/ch-tabs.js +1 -1
- package/dist/components/ch-textarea.js +1 -1
- package/dist/components/ch-textarea.js.map +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-BXzZsX2r.js +2 -0
- package/dist/components/p-BXzZsX2r.js.map +1 -0
- package/dist/components/{p-C1995t1C.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 +69 -38
- package/dist/esm/ch-alert_8.entry.js.map +1 -1
- package/dist/esm/ch-checkbox.entry.js +9 -11
- package/dist/esm/ch-checkbox.entry.js.map +1 -1
- package/dist/esm/ch-cluster.entry.js +45 -0
- package/dist/esm/ch-cluster.entry.js.map +1 -0
- package/dist/esm/ch-divider.entry.js +2 -2
- package/dist/esm/ch-drawer.entry.js +4 -3
- package/dist/esm/ch-drawer.entry.js.map +1 -1
- package/dist/esm/ch-emoji.entry.js +2 -2
- package/dist/esm/ch-empty-state.entry.js +32 -0
- package/dist/esm/ch-empty-state.entry.js.map +1 -0
- package/dist/esm/ch-grid.entry.js +57 -0
- package/dist/esm/ch-grid.entry.js.map +1 -0
- 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 +4 -3
- package/dist/esm/ch-modal.entry.js.map +1 -1
- 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 +9 -11
- package/dist/esm/ch-radio.entry.js.map +1 -1
- package/dist/esm/ch-segmented-control.entry.js +8 -7
- package/dist/esm/ch-segmented-control.entry.js.map +1 -1
- package/dist/esm/ch-skeleton.entry.js +56 -0
- package/dist/esm/ch-skeleton.entry.js.map +1 -0
- package/dist/esm/ch-stack.entry.js +35 -0
- package/dist/esm/ch-stack.entry.js.map +1 -0
- package/dist/esm/ch-tabs.entry.js +2 -2
- package/dist/esm/ch-textarea.entry.js +9 -11
- package/dist/esm/ch-textarea.entry.js.map +1 -1
- package/dist/esm/ch-tooltip.entry.js +204 -5
- package/dist/esm/ch-tooltip.entry.js.map +1 -1
- package/dist/esm/chucao.js +4 -4
- package/dist/esm/chucao.js.map +1 -1
- package/dist/esm/icons-CnivhwvG.js +86 -0
- package/dist/esm/icons-CnivhwvG.js.map +1 -0
- package/dist/esm/{index-DWC12BJ-.js → index-CIV5Gg1o.js} +119 -17
- 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/esm/validation-message-BXzZsX2r.js +24 -0
- package/dist/esm/validation-message-BXzZsX2r.js.map +1 -0
- 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-button/ch-button.d.ts +3 -1
- package/dist/types/components/ch-cluster/ch-cluster.d.ts +28 -0
- package/dist/types/components/ch-drawer/ch-drawer.d.ts +2 -1
- package/dist/types/components/ch-empty-state/ch-empty-state.d.ts +25 -0
- package/dist/types/components/ch-grid/ch-grid.d.ts +38 -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-modal/ch-modal.d.ts +2 -1
- package/dist/types/components/ch-page-header/ch-page-header.d.ts +39 -0
- package/dist/types/components/ch-skeleton/ch-skeleton.d.ts +39 -0
- package/dist/types/components/ch-stack/ch-stack.d.ts +26 -0
- package/dist/types/components/ch-tooltip/ch-tooltip.d.ts +32 -2
- package/dist/types/components.d.ts +807 -8
- package/dist/types/stencil-public-runtime.d.ts +61 -55
- package/dist/types/tokens/tokens.d.ts +12 -0
- package/dist/types/tokens/types.d.ts +2 -1
- package/dist/types/utils/accessibility.d.ts +2 -0
- package/dist/types/utils/icons.d.ts +15 -0
- package/dist/types/utils/overlay.d.ts +49 -0
- package/dist/types/utils/validation-message.d.ts +20 -0
- package/dist-react/components.d.ts +27 -1
- package/dist-react/components.js +72 -0
- package/dist-react/components.ts +97 -1
- package/dist-vue/index.d.ts +8 -0
- package/dist-vue/index.js +62 -1
- package/dist-vue/index.ts +78 -1
- package/hydrate/index.js +1114 -132
- package/hydrate/index.mjs +1114 -132
- package/package.json +112 -5
- package/dist/chucao/p-37e7f9cc.entry.js +0 -2
- package/dist/chucao/p-37e7f9cc.entry.js.map +0 -1
- package/dist/chucao/p-3db38c49.entry.js +0 -2
- package/dist/chucao/p-3db38c49.entry.js.map +0 -1
- package/dist/chucao/p-60c2fd71.entry.js +0 -2
- package/dist/chucao/p-60c2fd71.entry.js.map +0 -1
- package/dist/chucao/p-6c617158.entry.js +0 -2
- package/dist/chucao/p-6c617158.entry.js.map +0 -1
- package/dist/chucao/p-DWC12BJ-.js +0 -3
- package/dist/chucao/p-DWC12BJ-.js.map +0 -1
- package/dist/chucao/p-aeea9cbe.entry.js +0 -2
- package/dist/chucao/p-aeea9cbe.entry.js.map +0 -1
- package/dist/chucao/p-bb2445d1.entry.js +0 -2
- package/dist/chucao/p-c4806e96.entry.js +0 -2
- package/dist/chucao/p-c4806e96.entry.js.map +0 -1
- package/dist/chucao/p-e3265e38.entry.js +0 -2
- package/dist/chucao/p-e3265e38.entry.js.map +0 -1
- package/dist/chucao/p-f78f0163.entry.js +0 -2
- package/dist/chucao/p-f78f0163.entry.js.map +0 -1
- package/dist/cjs/index-C9cpLteP.js.map +0 -1
- package/dist/components/p-BhAZrOxf.js +0 -2
- package/dist/components/p-BhAZrOxf.js.map +0 -1
- package/dist/esm/index-DWC12BJ-.js.map +0 -1
- /package/dist/chucao/{p-ff5f5c1f.entry.js.map → p-1108062e.entry.js.map} +0 -0
- /package/dist/chucao/{p-04dbcfa0.entry.js.map → p-337d7f68.entry.js.map} +0 -0
- /package/dist/chucao/{p-bb2445d1.entry.js.map → p-4846cac4.entry.js.map} +0 -0
- /package/dist/chucao/{p-6a4bc80c.entry.js.map → p-9f73855e.entry.js.map} +0 -0
- /package/dist/chucao/{p-c986036f.entry.js.map → p-b6cc08f0.entry.js.map} +0 -0
- /package/dist/components/{p-C1995t1C.js.map → p-CV0rD-fF.js.map} +0 -0
|
@@ -77,7 +77,7 @@ export class ChTabs {
|
|
|
77
77
|
}
|
|
78
78
|
render() {
|
|
79
79
|
const active = this.activeValue;
|
|
80
|
-
return (h(Host, { key: '
|
|
80
|
+
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 => {
|
|
81
81
|
const selected = tab.value === active;
|
|
82
82
|
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));
|
|
83
83
|
})), 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,5 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { resolveValidity } from "../../utils/validation-message";
|
|
2
3
|
let textareaIds = 0;
|
|
3
4
|
const DEFAULT_ROWS = 4;
|
|
4
5
|
export class ChTextarea {
|
|
@@ -73,15 +74,12 @@ export class ChTextarea {
|
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
76
|
internals.setFormValue(this.value);
|
|
76
|
-
const flags = {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
flags.customError = true;
|
|
83
|
-
}
|
|
84
|
-
message = this.errorMessage ?? (flags.valueMissing ? 'Please fill out this field.' : undefined);
|
|
77
|
+
const { flags, message } = resolveValidity({
|
|
78
|
+
required: this.required,
|
|
79
|
+
empty: this.value === '',
|
|
80
|
+
invalid: this.invalid,
|
|
81
|
+
errorMessage: this.errorMessage,
|
|
82
|
+
});
|
|
85
83
|
internals.setValidity(flags, message);
|
|
86
84
|
}
|
|
87
85
|
componentDidLoad() {
|
|
@@ -110,7 +108,7 @@ export class ChTextarea {
|
|
|
110
108
|
return undefined;
|
|
111
109
|
}
|
|
112
110
|
render() {
|
|
113
|
-
return (h(Host, { key: '
|
|
111
|
+
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))));
|
|
114
112
|
}
|
|
115
113
|
static get is() { return "ch-textarea"; }
|
|
116
114
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ch-textarea.js","sourceRoot":"","sources":["../../../../src/components/ch-textarea/ch-textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAqB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE3H,IAAI,WAAW,GAAG,CAAC,CAAC;AAEpB,MAAM,YAAY,GAAG,CAAC,CAAC;AAQvB,MAAM,OAAO,UAAU;IACJ,UAAU,GAAG,eAAe,EAAE,WAAW,EAAE,CAAC;IAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,OAAO,CAAC;IACnC,OAAO,GAAG,GAAG,IAAI,CAAC,UAAU,QAAQ,CAAC;IAC9C,YAAY,GAAG,EAAE,CAAC;IAEP,SAAS,CAAoB;IACvC,YAAY,GAAG,KAAK,CAAC;IACX,IAAI,CAAe;IAEtC;;;OAGG;IACK,KAAK,CAAU;IAEvB;;OAEG;IACsB,KAAK,GAAG,EAAE,CAAC;IAEpC;;OAEG;IACK,WAAW,CAAU;IAE7B;;OAEG;IACK,IAAI,GAAG,YAAY,CAAC;IAE5B;;OAEG;IACsB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O,EAAE,IAAI,EAAC,OAAO,IAC5C,IAAI,CAAC,YAAY,CAChB,CACL,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { AttachInternals, Component, Element, Event, type EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\nimport { resolveValidity } from '../../utils/validation-message';\n\nlet textareaIds = 0;\n\nconst DEFAULT_ROWS = 4;\n\n@Component({\n tag: 'ch-textarea',\n styleUrl: 'ch-textarea.css',\n shadow: true,\n formAssociated: true,\n})\nexport class ChTextarea {\n private readonly textareaId = `ch-textarea-${++textareaIds}`;\n private readonly hintId = `${this.textareaId}-hint`;\n private readonly errorId = `${this.textareaId}-error`;\n private initialValue = '';\n\n @AttachInternals() internals!: ElementInternals;\n @State() formDisabled = false;\n @Element() private host!: HTMLElement;\n\n /**\n * Visible label rendered above the textarea and associated with it via\n * `for`/`id`, so assistive technology announces the textarea's purpose.\n */\n @Prop() label?: string;\n\n /**\n * The value of the textarea.\n */\n @Prop({ mutable: true }) value = '';\n\n /**\n * Placeholder text shown when the textarea is empty.\n */\n @Prop() placeholder?: string;\n\n /**\n * The number of visible rows of the textarea.\n */\n @Prop() rows = DEFAULT_ROWS;\n\n /**\n * The name of the textarea, submitted with form data.\n */\n @Prop({ reflect: true }) name?: string;\n\n /**\n * Whether the textarea is disabled.\n */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * Whether the textarea is required.\n */\n @Prop({ reflect: true }) required = false;\n\n /**\n * Helper text rendered below the textarea, associated via `aria-describedby`.\n * Replaced by `errorMessage` when the textarea is invalid.\n */\n @Prop() hint?: string;\n\n /**\n * Error message rendered below the textarea when it is invalid.\n */\n @Prop() errorMessage?: string;\n\n /**\n * Whether the textarea is in an invalid state; toggles `aria-invalid` and error styling.\n */\n @Prop() invalid = false;\n\n /**\n * Emitted on every keystroke, with the current textarea value.\n */\n @Event() chInput: EventEmitter<string>;\n\n /**\n * Emitted when the textarea value is committed (on native `change`).\n */\n @Event() chChange: EventEmitter<string>;\n\n private handleInput = (ev: InputEvent) => {\n this.value = (ev.target as HTMLTextAreaElement).value;\n this.chInput.emit(this.value);\n };\n\n private handleChange = (ev: Event) => {\n this.value = (ev.target as HTMLTextAreaElement).value;\n this.chChange.emit(this.value);\n };\n\n @Watch('value')\n @Watch('required')\n @Watch('invalid')\n @Watch('errorMessage')\n protected syncForm(): void {\n const internals = this.internals;\n if (typeof internals?.setFormValue !== 'function') {\n return;\n }\n internals.setFormValue(this.value);\n const { flags, message } = resolveValidity({\n required: this.required,\n empty: this.value === '',\n invalid: this.invalid,\n errorMessage: this.errorMessage,\n });\n internals.setValidity(flags, message);\n }\n\n componentDidLoad() {\n this.initialValue = this.value;\n this.syncForm();\n this.host.addEventListener('change', this.markTouched);\n this.host.addEventListener('focusout', this.markTouched);\n this.host.addEventListener('invalid', this.markTouched);\n }\n\n private markTouched = (): void => {\n this.host.setAttribute('data-touched', '');\n };\n\n formResetCallback(): void {\n this.value = this.initialValue;\n }\n\n formDisabledCallback(isDisabled: boolean): void {\n this.formDisabled = isDisabled;\n }\n\n private get describedBy(): string | undefined {\n if (this.invalid && this.errorMessage) {\n return this.errorId;\n }\n if (this.hint) {\n return this.hintId;\n }\n return undefined;\n }\n\n render() {\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.textareaId}>\n {this.label}\n </label>\n )}\n <textarea\n id={this.label ? this.textareaId : undefined}\n class={{ 'textarea': true, 'textarea--invalid': this.invalid }}\n rows={this.rows}\n name={this.name}\n placeholder={this.placeholder}\n disabled={this.disabled || this.formDisabled}\n required={this.required}\n value={this.value}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n onInput={this.handleInput}\n onChange={this.handleChange}\n ></textarea>\n {this.hint && !(this.invalid && this.errorMessage) && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {this.invalid && this.errorMessage && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
position: absolute;
|
|
12
12
|
z-index: var(--z-index-dropdown);
|
|
13
13
|
width: max-content;
|
|
14
|
-
max-width: 16rem;
|
|
14
|
+
max-width: min(16rem, calc(100vw - 2 * var(--spacing-2xl)));
|
|
15
15
|
padding: var(--spacing-md) var(--spacing-2xl);
|
|
16
16
|
border: var(--border-width) solid var(--border);
|
|
17
17
|
border-radius: var(--radius-sm);
|
|
@@ -37,6 +37,19 @@
|
|
|
37
37
|
position: absolute;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/*
|
|
41
|
+
* Once the component has measured the anchor, the bubble is placed with fixed
|
|
42
|
+
* coordinates. Viewport coordinates do not depend on ancestors' transforms or
|
|
43
|
+
* overflow, so a tooltip inside a scrolling drawer or modal stays anchored.
|
|
44
|
+
*/
|
|
45
|
+
.bubble--positioned {
|
|
46
|
+
position: fixed;
|
|
47
|
+
top: var(--ch-tooltip-offset-top);
|
|
48
|
+
left: var(--ch-tooltip-offset-left);
|
|
49
|
+
transform: none;
|
|
50
|
+
margin: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
40
53
|
.bubble--top {
|
|
41
54
|
bottom: 100%;
|
|
42
55
|
left: 50%;
|
|
@@ -44,6 +57,21 @@
|
|
|
44
57
|
margin-bottom: var(--spacing-md);
|
|
45
58
|
}
|
|
46
59
|
|
|
60
|
+
/* Stencil scopes each rule by doubling its classes, so a three-class selector
|
|
61
|
+
is what actually outranks the single-class placement rules above. */
|
|
62
|
+
.bubble.bubble--positioned.bubble--top,
|
|
63
|
+
.bubble.bubble--positioned.bubble--bottom,
|
|
64
|
+
.bubble.bubble--positioned.bubble--left,
|
|
65
|
+
.bubble.bubble--positioned.bubble--right {
|
|
66
|
+
inset: auto;
|
|
67
|
+
top: var(--ch-tooltip-offset-top);
|
|
68
|
+
left: var(--ch-tooltip-offset-left);
|
|
69
|
+
right: auto;
|
|
70
|
+
bottom: auto;
|
|
71
|
+
transform: none;
|
|
72
|
+
margin: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
47
75
|
.bubble--top::before {
|
|
48
76
|
top: 100%;
|
|
49
77
|
left: 0;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { Host, h } from "@stencil/core";
|
|
1
|
+
import { forceUpdate, Host, h } from "@stencil/core";
|
|
2
|
+
import { placeOverlay } from "../../utils/overlay";
|
|
2
3
|
let tooltipIds = 0;
|
|
4
|
+
/** Space between the trigger and the bubble, matching `--spacing-md`. */
|
|
5
|
+
const GAP = 8;
|
|
3
6
|
/**
|
|
4
7
|
* Short help text shown on hover and on focus.
|
|
5
8
|
*
|
|
@@ -15,12 +18,22 @@ let tooltipIds = 0;
|
|
|
15
18
|
* `<input>`). A chucao component such as `ch-button` will not be described,
|
|
16
19
|
* because `aria-*` set on a custom element host does not reach the native
|
|
17
20
|
* element inside it — see the discussion in issue #47.
|
|
21
|
+
*
|
|
22
|
+
* Positioning is measured, not purely CSS: `placement` is the preferred side,
|
|
23
|
+
* and the bubble flips to the opposite side when the preferred one does not
|
|
24
|
+
* fit, then shifts along the other axis to stay inside the viewport. It
|
|
25
|
+
* re-measures on scroll, resize and visual-viewport changes, which is what
|
|
26
|
+
* keeps it correct inside a scrolling modal or drawer and when a mobile
|
|
27
|
+
* keyboard shrinks the visible area.
|
|
18
28
|
*/
|
|
19
29
|
export class ChTooltip {
|
|
20
30
|
el;
|
|
21
31
|
fallbackId = `ch-tooltip-${++tooltipIds}`;
|
|
32
|
+
bubbleEl;
|
|
33
|
+
cleanup;
|
|
22
34
|
/**
|
|
23
|
-
*
|
|
35
|
+
* The side the bubble is placed on. It is a preference: when that side has no
|
|
36
|
+
* room the bubble flips to the opposite one.
|
|
24
37
|
*/
|
|
25
38
|
placement = 'top';
|
|
26
39
|
// Hover and focus are tracked apart so that neither cancels the other: a
|
|
@@ -29,15 +42,26 @@ export class ChTooltip {
|
|
|
29
42
|
hovered = false;
|
|
30
43
|
focused = false;
|
|
31
44
|
dismissed = false;
|
|
45
|
+
/** The placement actually used, which may differ from the prop after a flip. */
|
|
46
|
+
resolvedPlacement;
|
|
47
|
+
/** Offset applied to the bubble once it has been measured. */
|
|
48
|
+
offset;
|
|
32
49
|
get visible() {
|
|
33
50
|
return (this.hovered || this.focused) && !this.dismissed;
|
|
34
51
|
}
|
|
35
52
|
componentDidLoad() {
|
|
36
53
|
this.associate();
|
|
37
54
|
}
|
|
55
|
+
connectedCallback() {
|
|
56
|
+
this.watchViewport();
|
|
57
|
+
}
|
|
58
|
+
disconnectedCallback() {
|
|
59
|
+
this.cleanup?.();
|
|
60
|
+
}
|
|
38
61
|
handleMouseEnter() {
|
|
39
62
|
this.hovered = true;
|
|
40
63
|
this.dismissed = false;
|
|
64
|
+
this.position();
|
|
41
65
|
}
|
|
42
66
|
handleMouseLeave() {
|
|
43
67
|
this.hovered = false;
|
|
@@ -45,6 +69,7 @@ export class ChTooltip {
|
|
|
45
69
|
handleFocusIn() {
|
|
46
70
|
this.focused = true;
|
|
47
71
|
this.dismissed = false;
|
|
72
|
+
this.position();
|
|
48
73
|
}
|
|
49
74
|
handleFocusOut() {
|
|
50
75
|
this.focused = false;
|
|
@@ -52,15 +77,83 @@ export class ChTooltip {
|
|
|
52
77
|
/**
|
|
53
78
|
* Listens on the document because a tooltip opened by hovering leaves focus
|
|
54
79
|
* wherever it was, so a host-scoped handler would never see the key.
|
|
80
|
+
*
|
|
81
|
+
* Only the outermost Escape handler is stopped from propagating, so a
|
|
82
|
+
* tooltip inside an open modal closes itself and leaves the modal open.
|
|
55
83
|
*/
|
|
56
84
|
handleKeyDown(event) {
|
|
57
|
-
if (event.key === 'Escape' && this.visible) {
|
|
85
|
+
if (event.key === 'Escape' && this.visible && !event.defaultPrevented) {
|
|
86
|
+
event.preventDefault();
|
|
58
87
|
this.dismissed = true;
|
|
59
88
|
}
|
|
60
89
|
}
|
|
90
|
+
/** Cheap guard so scroll frames do not measure while nothing is shown. */
|
|
91
|
+
handleScroll() {
|
|
92
|
+
if (this.visible && this.offset) {
|
|
93
|
+
this.position();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
handleResize() {
|
|
97
|
+
this.position();
|
|
98
|
+
}
|
|
99
|
+
watchViewport() {
|
|
100
|
+
if (typeof window === 'undefined') {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const viewport = window.visualViewport;
|
|
104
|
+
if (!viewport || this.cleanup) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const update = () => this.position();
|
|
108
|
+
viewport.addEventListener('resize', update);
|
|
109
|
+
viewport.addEventListener('scroll', update);
|
|
110
|
+
this.cleanup = () => {
|
|
111
|
+
viewport.removeEventListener('resize', update);
|
|
112
|
+
viewport.removeEventListener('scroll', update);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
61
115
|
slotted(name) {
|
|
62
116
|
return Array.from(this.el.children).find(child => child.getAttribute('slot') === name);
|
|
63
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Measures the anchor and the bubble and stores the offset that keeps the
|
|
120
|
+
* bubble inside the viewport. Nothing is measured before the bubble has a
|
|
121
|
+
* box to measure, so the pre-paint render uses plain CSS.
|
|
122
|
+
*/
|
|
123
|
+
position() {
|
|
124
|
+
if (typeof window === 'undefined') {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const bubble = this.bubbleEl ?? (this.bubbleEl = this.el.shadowRoot?.querySelector('.bubble') ?? undefined);
|
|
128
|
+
if (!bubble || bubble.offsetWidth === 0) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const anchorRect = this.slotted('trigger')?.getBoundingClientRect?.();
|
|
132
|
+
if (!anchorRect) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const surface = {
|
|
136
|
+
width: bubble.offsetWidth + horizontalMargin(bubble),
|
|
137
|
+
height: bubble.offsetHeight,
|
|
138
|
+
};
|
|
139
|
+
const viewport = window.visualViewport;
|
|
140
|
+
const { placement, top, left } = placeOverlay({
|
|
141
|
+
anchor: { top: anchorRect.top, left: anchorRect.left, width: anchorRect.width, height: anchorRect.height },
|
|
142
|
+
surface,
|
|
143
|
+
viewport: viewport
|
|
144
|
+
? { top: viewport.offsetTop, left: viewport.offsetLeft, width: viewport.width, height: viewport.height }
|
|
145
|
+
: { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight },
|
|
146
|
+
preferred: this.placement,
|
|
147
|
+
gap: GAP,
|
|
148
|
+
});
|
|
149
|
+
const current = this.offset;
|
|
150
|
+
const unchanged = current?.top === top && current?.left === left && this.resolvedPlacement === placement;
|
|
151
|
+
this.resolvedPlacement = placement;
|
|
152
|
+
this.offset = { top, left };
|
|
153
|
+
if (!unchanged) {
|
|
154
|
+
forceUpdate(this);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
64
157
|
/**
|
|
65
158
|
* Points the trigger at the text with `aria-describedby`. Re-run on
|
|
66
159
|
* `slotchange` because a framework re-render can replace the slotted nodes
|
|
@@ -79,7 +172,16 @@ export class ChTooltip {
|
|
|
79
172
|
trigger.setAttribute('aria-describedby', content.id);
|
|
80
173
|
};
|
|
81
174
|
render() {
|
|
82
|
-
|
|
175
|
+
const { offset } = this;
|
|
176
|
+
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: {
|
|
177
|
+
'--ch-tooltip-offset-top': offset ? `${offset.top}px` : null,
|
|
178
|
+
'--ch-tooltip-offset-left': offset ? `${offset.left}px` : null,
|
|
179
|
+
}, class: {
|
|
180
|
+
'bubble': true,
|
|
181
|
+
'bubble--positioned': Boolean(this.offset),
|
|
182
|
+
[`bubble--${this.resolvedPlacement ?? this.placement}`]: true,
|
|
183
|
+
'bubble--visible': this.visible,
|
|
184
|
+
} }, h("slot", { key: 'a099d15660ea17211b4c50912842b3152e5f652c', name: "content", onSlotchange: this.associate })))));
|
|
83
185
|
}
|
|
84
186
|
static get is() { return "ch-tooltip"; }
|
|
85
187
|
static get encapsulation() { return "shadow"; }
|
|
@@ -113,7 +215,7 @@ export class ChTooltip {
|
|
|
113
215
|
"optional": false,
|
|
114
216
|
"docs": {
|
|
115
217
|
"tags": [],
|
|
116
|
-
"text": "
|
|
218
|
+
"text": "The side the bubble is placed on. It is a preference: when that side has no\nroom the bubble flips to the opposite one."
|
|
117
219
|
},
|
|
118
220
|
"getter": false,
|
|
119
221
|
"setter": false,
|
|
@@ -127,7 +229,8 @@ export class ChTooltip {
|
|
|
127
229
|
return {
|
|
128
230
|
"hovered": {},
|
|
129
231
|
"focused": {},
|
|
130
|
-
"dismissed": {}
|
|
232
|
+
"dismissed": {},
|
|
233
|
+
"resolvedPlacement": {}
|
|
131
234
|
};
|
|
132
235
|
}
|
|
133
236
|
static get elementRef() { return "el"; }
|
|
@@ -162,7 +265,23 @@ export class ChTooltip {
|
|
|
162
265
|
"target": "document",
|
|
163
266
|
"capture": false,
|
|
164
267
|
"passive": false
|
|
268
|
+
}, {
|
|
269
|
+
"name": "scroll",
|
|
270
|
+
"method": "handleScroll",
|
|
271
|
+
"target": "window",
|
|
272
|
+
"capture": true,
|
|
273
|
+
"passive": true
|
|
274
|
+
}, {
|
|
275
|
+
"name": "resize",
|
|
276
|
+
"method": "handleResize",
|
|
277
|
+
"target": "window",
|
|
278
|
+
"capture": false,
|
|
279
|
+
"passive": true
|
|
165
280
|
}];
|
|
166
281
|
}
|
|
167
282
|
}
|
|
283
|
+
function horizontalMargin(el) {
|
|
284
|
+
const style = getComputedStyle(el);
|
|
285
|
+
return (parseFloat(style.marginLeft) || 0) + (parseFloat(style.marginRight) || 0);
|
|
286
|
+
}
|
|
168
287
|
//# sourceMappingURL=ch-tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ch-tooltip.js","sourceRoot":"","sources":["../../../../src/components/ch-tooltip/ch-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAIjF,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB;;;;;;;;;;;;;;;GAeG;AAMH,MAAM,OAAO,SAAS;IACD,EAAE,CAAc;IAElB,UAAU,GAAG,cAAc,EAAE,UAAU,EAAE,CAAC;IAE3D;;OAEG;IACK,SAAS,GAAuB,KAAK,CAAC;IAE9C,yEAAyE;IACzE,4EAA4E;IAC5E,wBAAwB;IACf,OAAO,GAAG,KAAK,CAAC;IAChB,OAAO,GAAG,KAAK,CAAC;IAChB,SAAS,GAAG,KAAK,CAAC;IAE3B,IAAY,OAAO;QACjB,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;IAC3D,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAGD,gBAAgB;QACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;IAGD,gBAAgB;QACd,IAAI,CAAC,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AC,YAAY,EAAE,IAAI,CAAC,SAAS,GAAS;gBAC1D,6DAAM,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,WAAW,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,CAAC,OAAO,EAAE;oBACnG,6DAAM,IAAI,EAAC,SAAS,EAAC,YAAY,EAAE,IAAI,CAAC,SAAS,GAAS,CACrD,CACF,CACF,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Host, Listen, Prop, State, h } from '@stencil/core';\n\nexport type ChTooltipPlacement = 'top' | 'bottom' | 'left' | 'right';\n\nlet tooltipIds = 0;\n\n/**\n * Short help text shown on hover and on focus.\n *\n * Both the trigger and the text come from the consumer's light DOM through\n * named slots. That is what makes the accessible association work: an\n * `aria-describedby` IDREF only resolves within a single tree, and slotted\n * nodes stay in the document tree even though they render inside the shadow\n * root. Keeping the text in the shadow root instead would need a reference\n * pointing into a shadow tree, which the platform does not allow — element\n * reflection only points outwards, and `referenceTarget` is not available yet.\n *\n * The trigger has to be a natively focusable element (`<button>`, `<a>`,\n * `<input>`). A chucao component such as `ch-button` will not be described,\n * because `aria-*` set on a custom element host does not reach the native\n * element inside it — see the discussion in issue #47.\n */\n@Component({\n tag: 'ch-tooltip',\n styleUrl: 'ch-tooltip.css',\n shadow: true,\n})\nexport class ChTooltip {\n @Element() private el: HTMLElement;\n\n private readonly fallbackId = `ch-tooltip-${++tooltipIds}`;\n\n /**\n * Which side of the trigger the bubble is placed on.\n */\n @Prop() placement: ChTooltipPlacement = 'top';\n\n // Hover and focus are tracked apart so that neither cancels the other: a\n // pointer passing over and away must not hide a tooltip whose trigger still\n // holds keyboard focus.\n @State() hovered = false;\n @State() focused = false;\n @State() dismissed = false;\n\n private get visible() {\n return (this.hovered || this.focused) && !this.dismissed;\n }\n\n componentDidLoad() {\n this.associate();\n }\n\n @Listen('mouseenter')\n handleMouseEnter() {\n this.hovered = true;\n this.dismissed = false;\n }\n\n @Listen('mouseleave')\n handleMouseLeave() {\n this.hovered = false;\n }\n\n @Listen('focusin')\n handleFocusIn() {\n this.focused = true;\n this.dismissed = false;\n }\n\n @Listen('focusout')\n handleFocusOut() {\n this.focused = false;\n }\n\n /**\n * Listens on the document because a tooltip opened by hovering leaves focus\n * wherever it was, so a host-scoped handler would never see the key.\n */\n @Listen('keydown', { target: 'document' })\n handleKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape' && this.visible) {\n this.dismissed = true;\n }\n }\n\n private slotted(name: string) {\n return Array.from(this.el.children).find(child => child.getAttribute('slot') === name);\n }\n\n /**\n * Points the trigger at the text with `aria-describedby`. Re-run on\n * `slotchange` because a framework re-render can replace the slotted nodes\n * and take the attributes with them.\n */\n private associate = () => {\n const trigger = this.slotted('trigger');\n const content = this.slotted('content');\n if (!trigger || !content) {\n return;\n }\n if (!content.id) {\n content.id = this.fallbackId;\n }\n content.setAttribute('role', 'tooltip');\n trigger.setAttribute('aria-describedby', content.id);\n };\n\n render() {\n return (\n <Host>\n <span class=\"anchor\">\n <slot name=\"trigger\" onSlotchange={this.associate}></slot>\n <span class={{ 'bubble': true, [`bubble--${this.placement}`]: true, 'bubble--visible': this.visible }}>\n <slot name=\"content\" onSlotchange={this.associate}></slot>\n </span>\n </span>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ch-tooltip.js","sourceRoot":"","sources":["../../../../src/components/ch-tooltip/ch-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE9F,OAAO,EAAE,YAAY,EAA2B,MAAM,qBAAqB,CAAC;AAI5E,IAAI,UAAU,GA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EAAC,QAAQ;gBAGlB,6DAAM,IAAI,EAAC,SAAS,EAAC,YAAY,EAAE,IAAI,CAAC,SAAS,GAAS;gBAC1D,6DACE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,EAC/B,KAAK,EAAE;wBACL,yBAAyB,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI;wBAC5D,0BAA0B,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI;qBAC/D,EACD,KAAK,EAAE;wBACL,QAAQ,EAAE,IAAI;wBACd,oBAAoB,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;wBAC1C,CAAC,WAAW,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,IAAI;wBAC7D,iBAAiB,EAAE,IAAI,CAAC,OAAO;qBAChC;oBAED,6DAAM,IAAI,EAAC,SAAS,EAAC,YAAY,EAAE,IAAI,CAAC,SAAS,GAAS,CACrD,CACF,CACF,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,SAAS,gBAAgB,CAAC,EAAe;IACvC,MAAM,KAAK,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACnC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACpF,CAAC","sourcesContent":["import { Component, Element, forceUpdate, Host, Listen, Prop, State, h } from '@stencil/core';\n\nimport { placeOverlay, type ChOverlayPlacement } from '../../utils/overlay';\n\nexport type ChTooltipPlacement = ChOverlayPlacement;\n\nlet tooltipIds = 0;\n\n/** Space between the trigger and the bubble, matching `--spacing-md`. */\nconst GAP = 8;\n\n/**\n * Short help text shown on hover and on focus.\n *\n * Both the trigger and the text come from the consumer's light DOM through\n * named slots. That is what makes the accessible association work: an\n * `aria-describedby` IDREF only resolves within a single tree, and slotted\n * nodes stay in the document tree even though they render inside the shadow\n * root. Keeping the text in the shadow root instead would need a reference\n * pointing into a shadow tree, which the platform does not allow — element\n * reflection only points outwards, and `referenceTarget` is not available yet.\n *\n * The trigger has to be a natively focusable element (`<button>`, `<a>`,\n * `<input>`). A chucao component such as `ch-button` will not be described,\n * because `aria-*` set on a custom element host does not reach the native\n * element inside it — see the discussion in issue #47.\n *\n * Positioning is measured, not purely CSS: `placement` is the preferred side,\n * and the bubble flips to the opposite side when the preferred one does not\n * fit, then shifts along the other axis to stay inside the viewport. It\n * re-measures on scroll, resize and visual-viewport changes, which is what\n * keeps it correct inside a scrolling modal or drawer and when a mobile\n * keyboard shrinks the visible area.\n */\n@Component({\n tag: 'ch-tooltip',\n styleUrl: 'ch-tooltip.css',\n shadow: true,\n})\nexport class ChTooltip {\n @Element() private el: HTMLElement;\n\n private readonly fallbackId = `ch-tooltip-${++tooltipIds}`;\n\n private bubbleEl?: HTMLElement;\n\n private cleanup?: () => void;\n\n /**\n * The side the bubble is placed on. It is a preference: when that side has no\n * room the bubble flips to the opposite one.\n */\n @Prop() placement: ChTooltipPlacement = 'top';\n\n // Hover and focus are tracked apart so that neither cancels the other: a\n // pointer passing over and away must not hide a tooltip whose trigger still\n // holds keyboard focus.\n @State() hovered = false;\n @State() focused = false;\n @State() dismissed = false;\n\n /** The placement actually used, which may differ from the prop after a flip. */\n @State() resolvedPlacement?: ChTooltipPlacement;\n\n /** Offset applied to the bubble once it has been measured. */\n private offset?: { top: number; left: number };\n\n private get visible() {\n return (this.hovered || this.focused) && !this.dismissed;\n }\n\n componentDidLoad() {\n this.associate();\n }\n\n connectedCallback() {\n this.watchViewport();\n }\n\n disconnectedCallback() {\n this.cleanup?.();\n }\n\n @Listen('mouseenter')\n handleMouseEnter() {\n this.hovered = true;\n this.dismissed = false;\n this.position();\n }\n\n @Listen('mouseleave')\n handleMouseLeave() {\n this.hovered = false;\n }\n\n @Listen('focusin')\n handleFocusIn() {\n this.focused = true;\n this.dismissed = false;\n this.position();\n }\n\n @Listen('focusout')\n handleFocusOut() {\n this.focused = false;\n }\n\n /**\n * Listens on the document because a tooltip opened by hovering leaves focus\n * wherever it was, so a host-scoped handler would never see the key.\n *\n * Only the outermost Escape handler is stopped from propagating, so a\n * tooltip inside an open modal closes itself and leaves the modal open.\n */\n @Listen('keydown', { target: 'document' })\n handleKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape' && this.visible && !event.defaultPrevented) {\n event.preventDefault();\n this.dismissed = true;\n }\n }\n\n /** Cheap guard so scroll frames do not measure while nothing is shown. */\n @Listen('scroll', { target: 'window', capture: true, passive: true })\n handleScroll() {\n if (this.visible && this.offset) {\n this.position();\n }\n }\n\n @Listen('resize', { target: 'window', passive: true })\n handleResize() {\n this.position();\n }\n\n private watchViewport() {\n if (typeof window === 'undefined') {\n return;\n }\n const viewport = window.visualViewport;\n if (!viewport || this.cleanup) {\n return;\n }\n const update = () => this.position();\n viewport.addEventListener('resize', update);\n viewport.addEventListener('scroll', update);\n this.cleanup = () => {\n viewport.removeEventListener('resize', update);\n viewport.removeEventListener('scroll', update);\n };\n }\n\n private slotted(name: string) {\n return Array.from(this.el.children).find(child => child.getAttribute('slot') === name);\n }\n\n /**\n * Measures the anchor and the bubble and stores the offset that keeps the\n * bubble inside the viewport. Nothing is measured before the bubble has a\n * box to measure, so the pre-paint render uses plain CSS.\n */\n private position() {\n if (typeof window === 'undefined') {\n return;\n }\n const bubble = this.bubbleEl ?? (this.bubbleEl = this.el.shadowRoot?.querySelector<HTMLElement>('.bubble') ?? undefined);\n if (!bubble || bubble.offsetWidth === 0) {\n return;\n }\n\n const anchorRect = (this.slotted('trigger') as HTMLElement | undefined)?.getBoundingClientRect?.();\n if (!anchorRect) {\n return;\n }\n\n const surface = {\n width: bubble.offsetWidth + horizontalMargin(bubble),\n height: bubble.offsetHeight,\n };\n const viewport = window.visualViewport;\n\n const { placement, top, left } = placeOverlay({\n anchor: { top: anchorRect.top, left: anchorRect.left, width: anchorRect.width, height: anchorRect.height },\n surface,\n viewport: viewport\n ? { top: viewport.offsetTop, left: viewport.offsetLeft, width: viewport.width, height: viewport.height }\n : { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight },\n preferred: this.placement,\n gap: GAP,\n });\n\n const current = this.offset;\n const unchanged = current?.top === top && current?.left === left && this.resolvedPlacement === placement;\n this.resolvedPlacement = placement;\n this.offset = { top, left };\n if (!unchanged) {\n forceUpdate(this);\n }\n }\n\n /**\n * Points the trigger at the text with `aria-describedby`. Re-run on\n * `slotchange` because a framework re-render can replace the slotted nodes\n * and take the attributes with them.\n */\n private associate = () => {\n const trigger = this.slotted('trigger');\n const content = this.slotted('content');\n if (!trigger || !content) {\n return;\n }\n if (!content.id) {\n content.id = this.fallbackId;\n }\n content.setAttribute('role', 'tooltip');\n trigger.setAttribute('aria-describedby', content.id);\n };\n\n render() {\n const { offset } = this;\n\n return (\n <Host>\n <span class=\"anchor\">\n {/* Pre-measure render uses the preferred side so the bubble never\n jumps from the wrong edge on its first frame. */}\n <slot name=\"trigger\" onSlotchange={this.associate}></slot>\n <span\n ref={el => (this.bubbleEl = el)}\n style={{\n '--ch-tooltip-offset-top': offset ? `${offset.top}px` : null,\n '--ch-tooltip-offset-left': offset ? `${offset.left}px` : null,\n }}\n class={{\n 'bubble': true,\n 'bubble--positioned': Boolean(this.offset),\n [`bubble--${this.resolvedPlacement ?? this.placement}`]: true,\n 'bubble--visible': this.visible,\n }}\n >\n <slot name=\"content\" onSlotchange={this.associate}></slot>\n </span>\n </span>\n </Host>\n );\n }\n}\n\nfunction horizontalMargin(el: HTMLElement) {\n const style = getComputedStyle(el);\n return (parseFloat(style.marginLeft) || 0) + (parseFloat(style.marginRight) || 0);\n}\n"]}
|
|
@@ -63,6 +63,10 @@ export const zIndexBase = 0;
|
|
|
63
63
|
export const zIndexDropdown = 100;
|
|
64
64
|
export const zIndexModal = 1000;
|
|
65
65
|
export const layoutMaxWidth = '68rem';
|
|
66
|
+
export const iconSizeSm = '16px';
|
|
67
|
+
export const iconSizeMd = '20px';
|
|
68
|
+
export const iconSizeLg = '24px';
|
|
69
|
+
export const iconStroke = '2px';
|
|
66
70
|
export const tokens = {
|
|
67
71
|
'color': {
|
|
68
72
|
background: {
|
|
@@ -176,5 +180,13 @@ export const tokens = {
|
|
|
176
180
|
'layout': {
|
|
177
181
|
maxWidth: '68rem',
|
|
178
182
|
},
|
|
183
|
+
'icon': {
|
|
184
|
+
size: {
|
|
185
|
+
sm: '16px',
|
|
186
|
+
md: '20px',
|
|
187
|
+
lg: '24px',
|
|
188
|
+
},
|
|
189
|
+
stroke: '2px',
|
|
190
|
+
},
|
|
179
191
|
};
|
|
180
192
|
//# sourceMappingURL=tokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/tokens/tokens.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAC7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAS,CAAC;AAChD,MAAM,CAAC,MAAM,yBAAyB,GAAG,SAAS,CAAC;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAC5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAC9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAC1D,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,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edit */\n\nexport const colorBackgroundBase = '#100a1c';\nexport const colorBackgroundTopGlow = '#201e40';\nexport const colorBackgroundBottomGlow = '#261226';\nexport const colorSurfaceDefault = 'rgba(32, 30, 64, 0.6)';\nexport const colorSurfaceHover = 'rgba(45, 212, 191, 0.08)';\nexport const colorScrimDefault = 'rgba(0, 0, 0, 0.6)';\nexport const colorBorderDefault = 'rgba(255, 255, 255, 0.08)';\nexport const colorBorderHover = 'rgba(45, 212, 191, 0.3)';\nexport const colorAccentDefault = '#2dd4bf';\nexport const colorAccentHover = '#5ee8d4';\nexport const colorAccentText = '#06210f';\nexport const colorStatusPositive = '#4ade80';\nexport const colorStatusPositiveBackground = 'rgba(34, 197, 94, 0.18)';\nexport const colorStatusWarning = '#f87171';\nexport const colorStatusWarningBackground = 'rgba(248, 113, 113, 0.15)';\nexport const colorTextPrimary = '#ffffff';\nexport const colorTextSecondary = 'rgba(255, 255, 255, 0.55)';\nexport const colorBrandHuemulDark = '#85422b';\nexport const colorBrandHuemulLight = '#b45b38';\nexport const colorBrandStroke = '#1d1d1b';\nexport const typographyBody = 'Fira Sans, Droid Sans, Helvetica Neue, sans-serif';\nexport const typographyHeading = 'Inconsolata, monospace';\nexport const typographySizeXs = '0.68rem';\nexport const typographySizeSm = '0.85rem';\nexport const typographySizeMd = '1rem';\nexport const typographySizeLg = '1.25rem';\nexport const typographySizeXl = '1.5rem';\nexport const typographyWeightRegular = '400';\nexport const typographyWeightSemibold = '600';\nexport const typographyWeightBold = '700';\nexport const typographyTrackingBadge = '0.03em';\nexport const spacing2xs = '0.18rem';\nexport const spacingXs = '0.25rem';\nexport const spacingSm = '0.35rem';\nexport const spacingMd = '0.5rem';\nexport const spacingLg = '0.6rem';\nexport const spacingXl = '0.8rem';\nexport const spacing2xl = '1rem';\nexport const spacing3xl = '1.25rem';\nexport const spacing4xl = '1.35rem';\nexport const spacing5xl = '1.5rem';\nexport const spacing6xl = '2rem';\nexport const spacingShift = '2px';\nexport const spacingElevate = '1px';\nexport const radiusSm = '6px';\nexport const radiusMd = '8px';\nexport const radiusPill = '999px';\nexport const borderWidth = '1px';\nexport const borderAccentBar = '3px';\nexport const shadowFocusRing = '0 0 0 3px rgba(45, 212, 191, 0.12)';\nexport const shadowCardHover = '0 4px 20px rgba(45, 212, 191, 0.06)';\nexport const effectBlur = '10px';\nexport const durationFast = '150ms';\nexport const durationNormal = '200ms';\nexport const durationSpin = '800ms';\nexport const easingDefault = 'ease';\nexport const easingLinear = 'linear';\nexport const focusOutlineWidth = '2px';\nexport const focusOutlineOffset = '2px';\nexport const opacityDisabled = 0.5;\nexport const zIndexBase = 0;\nexport const zIndexDropdown = 100;\nexport const zIndexModal = 1000;\nexport const layoutMaxWidth = '68rem';\n\nexport const tokens = {\n 'color': {\n background: {\n base: '#100a1c',\n topGlow: '#201e40',\n bottomGlow: '#261226',\n },\n surface: {\n default: 'rgba(32, 30, 64, 0.6)',\n hover: 'rgba(45, 212, 191, 0.08)',\n },\n scrim: {\n default: 'rgba(0, 0, 0, 0.6)',\n },\n border: {\n default: 'rgba(255, 255, 255, 0.08)',\n hover: 'rgba(45, 212, 191, 0.3)',\n },\n accent: {\n default: '#2dd4bf',\n hover: '#5ee8d4',\n text: '#06210f',\n },\n status: {\n positive: '#4ade80',\n positiveBackground: 'rgba(34, 197, 94, 0.18)',\n warning: '#f87171',\n warningBackground: 'rgba(248, 113, 113, 0.15)',\n },\n text: {\n primary: '#ffffff',\n secondary: 'rgba(255, 255, 255, 0.55)',\n },\n brand: {\n huemulDark: '#85422b',\n huemulLight: '#b45b38',\n stroke: '#1d1d1b',\n },\n },\n 'typography': {\n body: 'Fira Sans, Droid Sans, Helvetica Neue, sans-serif',\n heading: 'Inconsolata, monospace',\n size: {\n xs: '0.68rem',\n sm: '0.85rem',\n md: '1rem',\n lg: '1.25rem',\n xl: '1.5rem',\n },\n weight: {\n regular: '400',\n semibold: '600',\n bold: '700',\n },\n tracking: {\n badge: '0.03em',\n },\n },\n 'spacing': {\n '2xs': '0.18rem',\n 'xs': '0.25rem',\n 'sm': '0.35rem',\n 'md': '0.5rem',\n 'lg': '0.6rem',\n 'xl': '0.8rem',\n '2xl': '1rem',\n '3xl': '1.25rem',\n '4xl': '1.35rem',\n '5xl': '1.5rem',\n '6xl': '2rem',\n 'shift': '2px',\n 'elevate': '1px',\n },\n 'radius': {\n sm: '6px',\n md: '8px',\n pill: '999px',\n },\n 'border': {\n width: '1px',\n accentBar: '3px',\n },\n 'shadow': {\n focusRing: '0 0 0 3px rgba(45, 212, 191, 0.12)',\n cardHover: '0 4px 20px rgba(45, 212, 191, 0.06)',\n },\n 'effect': {\n blur: '10px',\n },\n 'duration': {\n fast: '150ms',\n normal: '200ms',\n spin: '800ms',\n },\n 'easing': {\n default: 'ease',\n linear: 'linear',\n },\n 'focus': {\n outlineWidth: '2px',\n outlineOffset: '2px',\n },\n 'opacity': {\n disabled: 0.5,\n },\n 'z-index': {\n base: 0,\n dropdown: 100,\n modal: 1000,\n },\n 'layout': {\n maxWidth: '68rem',\n },\n} as const;\n\nexport type TokenCategory = keyof typeof tokens;\n"]}
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/tokens/tokens.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAC7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAS,CAAC;AAChD,MAAM,CAAC,MAAM,yBAAyB,GAAG,SAAS,CAAC;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAC5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAC9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAC1D,MAAM,CAAC,MAAM,kBAAkB,GAAG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EAAE,GAAG;KACd;IACD,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,GAAG;QACb,KAAK,EAAE,IAAI;KACZ;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,OAAO;KAClB;IACD,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;SACX;QACD,MAAM,EAAE,KAAK;KACd;CACO,CAAC","sourcesContent":["/* Generated by toki v1.12.1 — do not edit */\n\nexport const colorBackgroundBase = '#100a1c';\nexport const colorBackgroundTopGlow = '#201e40';\nexport const colorBackgroundBottomGlow = '#261226';\nexport const colorSurfaceDefault = 'rgba(32, 30, 64, 0.6)';\nexport const colorSurfaceHover = 'rgba(45, 212, 191, 0.08)';\nexport const colorScrimDefault = 'rgba(0, 0, 0, 0.6)';\nexport const colorBorderDefault = 'rgba(255, 255, 255, 0.08)';\nexport const colorBorderHover = 'rgba(45, 212, 191, 0.3)';\nexport const colorAccentDefault = '#2dd4bf';\nexport const colorAccentHover = '#5ee8d4';\nexport const colorAccentText = '#06210f';\nexport const colorStatusPositive = '#4ade80';\nexport const colorStatusPositiveBackground = 'rgba(34, 197, 94, 0.18)';\nexport const colorStatusWarning = '#f87171';\nexport const colorStatusWarningBackground = 'rgba(248, 113, 113, 0.15)';\nexport const colorTextPrimary = '#ffffff';\nexport const colorTextSecondary = 'rgba(255, 255, 255, 0.55)';\nexport const colorBrandHuemulDark = '#85422b';\nexport const colorBrandHuemulLight = '#b45b38';\nexport const colorBrandStroke = '#1d1d1b';\nexport const typographyBody = 'Fira Sans, Droid Sans, Helvetica Neue, sans-serif';\nexport const typographyHeading = 'Inconsolata, monospace';\nexport const typographySizeXs = '0.68rem';\nexport const typographySizeSm = '0.85rem';\nexport const typographySizeMd = '1rem';\nexport const typographySizeLg = '1.25rem';\nexport const typographySizeXl = '1.5rem';\nexport const typographyWeightRegular = '400';\nexport const typographyWeightSemibold = '600';\nexport const typographyWeightBold = '700';\nexport const typographyTrackingBadge = '0.03em';\nexport const spacing2xs = '0.18rem';\nexport const spacingXs = '0.25rem';\nexport const spacingSm = '0.35rem';\nexport const spacingMd = '0.5rem';\nexport const spacingLg = '0.6rem';\nexport const spacingXl = '0.8rem';\nexport const spacing2xl = '1rem';\nexport const spacing3xl = '1.25rem';\nexport const spacing4xl = '1.35rem';\nexport const spacing5xl = '1.5rem';\nexport const spacing6xl = '2rem';\nexport const spacingShift = '2px';\nexport const spacingElevate = '1px';\nexport const radiusSm = '6px';\nexport const radiusMd = '8px';\nexport const radiusPill = '999px';\nexport const borderWidth = '1px';\nexport const borderAccentBar = '3px';\nexport const shadowFocusRing = '0 0 0 3px rgba(45, 212, 191, 0.12)';\nexport const shadowCardHover = '0 4px 20px rgba(45, 212, 191, 0.06)';\nexport const effectBlur = '10px';\nexport const durationFast = '150ms';\nexport const durationNormal = '200ms';\nexport const durationSpin = '800ms';\nexport const easingDefault = 'ease';\nexport const easingLinear = 'linear';\nexport const focusOutlineWidth = '2px';\nexport const focusOutlineOffset = '2px';\nexport const opacityDisabled = 0.5;\nexport const zIndexBase = 0;\nexport const zIndexDropdown = 100;\nexport const zIndexModal = 1000;\nexport const layoutMaxWidth = '68rem';\nexport const iconSizeSm = '16px';\nexport const iconSizeMd = '20px';\nexport const iconSizeLg = '24px';\nexport const iconStroke = '2px';\n\nexport const tokens = {\n 'color': {\n background: {\n base: '#100a1c',\n topGlow: '#201e40',\n bottomGlow: '#261226',\n },\n surface: {\n default: 'rgba(32, 30, 64, 0.6)',\n hover: 'rgba(45, 212, 191, 0.08)',\n },\n scrim: {\n default: 'rgba(0, 0, 0, 0.6)',\n },\n border: {\n default: 'rgba(255, 255, 255, 0.08)',\n hover: 'rgba(45, 212, 191, 0.3)',\n },\n accent: {\n default: '#2dd4bf',\n hover: '#5ee8d4',\n text: '#06210f',\n },\n status: {\n positive: '#4ade80',\n positiveBackground: 'rgba(34, 197, 94, 0.18)',\n warning: '#f87171',\n warningBackground: 'rgba(248, 113, 113, 0.15)',\n },\n text: {\n primary: '#ffffff',\n secondary: 'rgba(255, 255, 255, 0.55)',\n },\n brand: {\n huemulDark: '#85422b',\n huemulLight: '#b45b38',\n stroke: '#1d1d1b',\n },\n },\n 'typography': {\n body: 'Fira Sans, Droid Sans, Helvetica Neue, sans-serif',\n heading: 'Inconsolata, monospace',\n size: {\n xs: '0.68rem',\n sm: '0.85rem',\n md: '1rem',\n lg: '1.25rem',\n xl: '1.5rem',\n },\n weight: {\n regular: '400',\n semibold: '600',\n bold: '700',\n },\n tracking: {\n badge: '0.03em',\n },\n },\n 'spacing': {\n '2xs': '0.18rem',\n 'xs': '0.25rem',\n 'sm': '0.35rem',\n 'md': '0.5rem',\n 'lg': '0.6rem',\n 'xl': '0.8rem',\n '2xl': '1rem',\n '3xl': '1.25rem',\n '4xl': '1.35rem',\n '5xl': '1.5rem',\n '6xl': '2rem',\n 'shift': '2px',\n 'elevate': '1px',\n },\n 'radius': {\n sm: '6px',\n md: '8px',\n pill: '999px',\n },\n 'border': {\n width: '1px',\n accentBar: '3px',\n },\n 'shadow': {\n focusRing: '0 0 0 3px rgba(45, 212, 191, 0.12)',\n cardHover: '0 4px 20px rgba(45, 212, 191, 0.06)',\n },\n 'effect': {\n blur: '10px',\n },\n 'duration': {\n fast: '150ms',\n normal: '200ms',\n spin: '800ms',\n },\n 'easing': {\n default: 'ease',\n linear: 'linear',\n },\n 'focus': {\n outlineWidth: '2px',\n outlineOffset: '2px',\n },\n 'opacity': {\n disabled: 0.5,\n },\n 'z-index': {\n base: 0,\n dropdown: 100,\n modal: 1000,\n },\n 'layout': {\n maxWidth: '68rem',\n },\n 'icon': {\n size: {\n sm: '16px',\n md: '20px',\n lg: '24px',\n },\n stroke: '2px',\n },\n} as const;\n\nexport type TokenCategory = keyof typeof tokens;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tokens/types.ts"],"names":[],"mappings":"AAAA,6CAA6C","sourcesContent":["/* Generated by toki v1.12.1 — do not edit */\n\nexport type ColorToken =\n | 'color.background.base'\n | 'color.background.top-glow'\n | 'color.background.bottom-glow'\n | 'color.surface.default'\n | 'color.surface.hover'\n | 'color.scrim.default'\n | 'color.border.default'\n | 'color.border.hover'\n | 'color.accent.default'\n | 'color.accent.hover'\n | 'color.accent.text'\n | 'color.status.positive'\n | 'color.status.positive-background'\n | 'color.status.warning'\n | 'color.status.warning-background'\n | 'color.text.primary'\n | 'color.text.secondary'\n | 'color.brand.huemul-dark'\n | 'color.brand.huemul-light'\n | 'color.brand.stroke';\n\nexport type TypographyToken =\n | 'typography.body'\n | 'typography.heading'\n | 'typography.size.xs'\n | 'typography.size.sm'\n | 'typography.size.md'\n | 'typography.size.lg'\n | 'typography.size.xl'\n | 'typography.weight.regular'\n | 'typography.weight.semibold'\n | 'typography.weight.bold'\n | 'typography.tracking.badge';\n\nexport type SpacingToken =\n | 'spacing.2xs'\n | 'spacing.xs'\n | 'spacing.sm'\n | 'spacing.md'\n | 'spacing.lg'\n | 'spacing.xl'\n | 'spacing.2xl'\n | 'spacing.3xl'\n | 'spacing.4xl'\n | 'spacing.5xl'\n | 'spacing.6xl'\n | 'spacing.shift'\n | 'spacing.elevate';\n\nexport type RadiusToken = 'radius.sm' | 'radius.md' | 'radius.pill';\n\nexport type BorderToken = 'border.width' | 'border.accent-bar';\n\nexport type ShadowToken = 'shadow.focus-ring' | 'shadow.card-hover';\n\nexport type EffectToken = 'effect.blur';\n\nexport type DurationToken = 'duration.fast' | 'duration.normal' | 'duration.spin';\n\nexport type EasingToken = 'easing.default' | 'easing.linear';\n\nexport type FocusToken = 'focus.outline-width' | 'focus.outline-offset';\n\nexport type OpacityToken = 'opacity.disabled';\n\nexport type ZIndexToken = 'z-index.base' | 'z-index.dropdown' | 'z-index.modal';\n\nexport type LayoutToken = 'layout.max-width';\n\nexport type TokenName =\n | ColorToken\n | TypographyToken\n | SpacingToken\n | RadiusToken\n | BorderToken\n | ShadowToken\n | EffectToken\n | DurationToken\n | EasingToken\n | FocusToken\n | OpacityToken\n | ZIndexToken\n | LayoutToken;\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tokens/types.ts"],"names":[],"mappings":"AAAA,6CAA6C","sourcesContent":["/* Generated by toki v1.12.1 — do not edit */\n\nexport type ColorToken =\n | 'color.background.base'\n | 'color.background.top-glow'\n | 'color.background.bottom-glow'\n | 'color.surface.default'\n | 'color.surface.hover'\n | 'color.scrim.default'\n | 'color.border.default'\n | 'color.border.hover'\n | 'color.accent.default'\n | 'color.accent.hover'\n | 'color.accent.text'\n | 'color.status.positive'\n | 'color.status.positive-background'\n | 'color.status.warning'\n | 'color.status.warning-background'\n | 'color.text.primary'\n | 'color.text.secondary'\n | 'color.brand.huemul-dark'\n | 'color.brand.huemul-light'\n | 'color.brand.stroke';\n\nexport type TypographyToken =\n | 'typography.body'\n | 'typography.heading'\n | 'typography.size.xs'\n | 'typography.size.sm'\n | 'typography.size.md'\n | 'typography.size.lg'\n | 'typography.size.xl'\n | 'typography.weight.regular'\n | 'typography.weight.semibold'\n | 'typography.weight.bold'\n | 'typography.tracking.badge';\n\nexport type SpacingToken =\n | 'spacing.2xs'\n | 'spacing.xs'\n | 'spacing.sm'\n | 'spacing.md'\n | 'spacing.lg'\n | 'spacing.xl'\n | 'spacing.2xl'\n | 'spacing.3xl'\n | 'spacing.4xl'\n | 'spacing.5xl'\n | 'spacing.6xl'\n | 'spacing.shift'\n | 'spacing.elevate';\n\nexport type RadiusToken = 'radius.sm' | 'radius.md' | 'radius.pill';\n\nexport type BorderToken = 'border.width' | 'border.accent-bar';\n\nexport type ShadowToken = 'shadow.focus-ring' | 'shadow.card-hover';\n\nexport type EffectToken = 'effect.blur';\n\nexport type DurationToken = 'duration.fast' | 'duration.normal' | 'duration.spin';\n\nexport type EasingToken = 'easing.default' | 'easing.linear';\n\nexport type FocusToken = 'focus.outline-width' | 'focus.outline-offset';\n\nexport type OpacityToken = 'opacity.disabled';\n\nexport type ZIndexToken = 'z-index.base' | 'z-index.dropdown' | 'z-index.modal';\n\nexport type LayoutToken = 'layout.max-width';\n\nexport type IconToken = 'icon.size.sm' | 'icon.size.md' | 'icon.size.lg' | 'icon.stroke';\n\nexport type TokenName =\n | ColorToken\n | TypographyToken\n | SpacingToken\n | RadiusToken\n | BorderToken\n | ShadowToken\n | EffectToken\n | DurationToken\n | EasingToken\n | FocusToken\n | OpacityToken\n | ZIndexToken\n | LayoutToken\n | IconToken;\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Build } from "@stencil/core";
|
|
2
|
+
const warned = new WeakSet();
|
|
3
|
+
export function hasLightDomText(host) {
|
|
4
|
+
return Array.from(host.childNodes).some(child => {
|
|
5
|
+
if (child.nodeType !== 3 && child.nodeType !== 1) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
if (child.nodeType === 1 && child.hasAttribute('slot')) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return (child.textContent ?? '').trim() !== '';
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function warnMissingName(host, tag, reason) {
|
|
15
|
+
if (!Build.isDev && !Build.isTesting) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (typeof globalThis.window === 'undefined' || warned.has(host)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
warned.add(host);
|
|
22
|
+
console.warn(`[chucao] <${tag}> has no accessible name: ${reason}. See docs/components.md.`);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=accessibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessibility.js","sourceRoot":"","sources":["../../../src/utils/accessibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,MAAM,MAAM,GAAG,IAAI,OAAO,EAAW,CAAC;AAEtC,MAAM,UAAU,eAAe,CAAC,IAAa;IAC3C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QAC9C,IAAI,KAAK,CAAC,QAAQ,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YACjD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,KAAK,CAAC,IAAK,KAAiB,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;YACpE,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAa,EAAE,GAAW,EAAE,MAAc;IACxE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QACrC,OAAO;IACT,CAAC;IACD,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACjE,OAAO;IACT,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjB,OAAO,CAAC,IAAI,CAAC,aAAa,GAAG,6BAA6B,MAAM,2BAA2B,CAAC,CAAC;AAC/F,CAAC","sourcesContent":["import { Build } from '@stencil/core';\n\nconst warned = new WeakSet<Element>();\n\nexport function hasLightDomText(host: Element): boolean {\n return Array.from(host.childNodes).some(child => {\n if (child.nodeType !== 3 && child.nodeType !== 1) {\n return false;\n }\n if (child.nodeType === 1 && (child as Element).hasAttribute('slot')) {\n return false;\n }\n return (child.textContent ?? '').trim() !== '';\n });\n}\n\nexport function warnMissingName(host: Element, tag: string, reason: string) {\n if (!Build.isDev && !Build.isTesting) {\n return;\n }\n if (typeof globalThis.window === 'undefined' || warned.has(host)) {\n return;\n }\n warned.add(host);\n console.warn(`[chucao] <${tag}> has no accessible name: ${reason}. See docs/components.md.`);\n}\n"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export const chIcons = {
|
|
2
|
+
alert: [
|
|
3
|
+
{ tag: 'path', attrs: { d: 'm21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3' } },
|
|
4
|
+
{ tag: 'path', attrs: { d: 'M12 9v4' } },
|
|
5
|
+
{ tag: 'path', attrs: { d: 'M12 17h.01' } },
|
|
6
|
+
],
|
|
7
|
+
arrowRight: [
|
|
8
|
+
{ tag: 'path', attrs: { d: 'M5 12h14' } },
|
|
9
|
+
{ tag: 'path', attrs: { d: 'm12 5 7 7-7 7' } },
|
|
10
|
+
],
|
|
11
|
+
check: [{ tag: 'path', attrs: { d: 'M20 6 9 17l-5-5' } }],
|
|
12
|
+
chevronDown: [{ tag: 'path', attrs: { d: 'm6 9 6 6 6-6' } }],
|
|
13
|
+
chevronRight: [{ tag: 'path', attrs: { d: 'm9 18 6-6-6-6' } }],
|
|
14
|
+
close: [
|
|
15
|
+
{ tag: 'path', attrs: { d: 'M18 6 6 18' } },
|
|
16
|
+
{ tag: 'path', attrs: { d: 'm6 6 12 12' } },
|
|
17
|
+
],
|
|
18
|
+
copy: [
|
|
19
|
+
{ tag: 'rect', attrs: { width: '14', height: '14', x: '8', y: '8', rx: '2', ry: '2' } },
|
|
20
|
+
{ tag: 'path', attrs: { d: 'M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2' } },
|
|
21
|
+
],
|
|
22
|
+
delete: [
|
|
23
|
+
{ tag: 'path', attrs: { d: 'M10 11v6' } },
|
|
24
|
+
{ tag: 'path', attrs: { d: 'M14 11v6' } },
|
|
25
|
+
{ tag: 'path', attrs: { d: 'M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6' } },
|
|
26
|
+
{ tag: 'path', attrs: { d: 'M3 6h18' } },
|
|
27
|
+
{ tag: 'path', attrs: { d: 'M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2' } },
|
|
28
|
+
],
|
|
29
|
+
download: [
|
|
30
|
+
{ tag: 'path', attrs: { d: 'M12 15V3' } },
|
|
31
|
+
{ tag: 'path', attrs: { d: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4' } },
|
|
32
|
+
{ tag: 'path', attrs: { d: 'm7 10 5 5 5-5' } },
|
|
33
|
+
],
|
|
34
|
+
error: [
|
|
35
|
+
{ tag: 'circle', attrs: { cx: '12', cy: '12', r: '10' } },
|
|
36
|
+
{ tag: 'line', attrs: {} },
|
|
37
|
+
{ tag: 'line', attrs: {} },
|
|
38
|
+
],
|
|
39
|
+
externalLink: [
|
|
40
|
+
{ tag: 'path', attrs: { d: 'M15 3h6v6' } },
|
|
41
|
+
{ tag: 'path', attrs: { d: 'M10 14 21 3' } },
|
|
42
|
+
{ tag: 'path', attrs: { d: 'M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6' } },
|
|
43
|
+
],
|
|
44
|
+
info: [
|
|
45
|
+
{ tag: 'circle', attrs: { cx: '12', cy: '12', r: '10' } },
|
|
46
|
+
{ tag: 'path', attrs: { d: 'M12 16v-4' } },
|
|
47
|
+
{ tag: 'path', attrs: { d: 'M12 8h.01' } },
|
|
48
|
+
],
|
|
49
|
+
menu: [
|
|
50
|
+
{ tag: 'path', attrs: { d: 'M4 5h16' } },
|
|
51
|
+
{ tag: 'path', attrs: { d: 'M4 12h16' } },
|
|
52
|
+
{ tag: 'path', attrs: { d: 'M4 19h16' } },
|
|
53
|
+
],
|
|
54
|
+
plus: [
|
|
55
|
+
{ tag: 'path', attrs: { d: 'M5 12h14' } },
|
|
56
|
+
{ tag: 'path', attrs: { d: 'M12 5v14' } },
|
|
57
|
+
],
|
|
58
|
+
search: [
|
|
59
|
+
{ tag: 'path', attrs: { d: 'm21 21-4.34-4.34' } },
|
|
60
|
+
{ tag: 'circle', attrs: { cx: '11', cy: '11', r: '8' } },
|
|
61
|
+
],
|
|
62
|
+
spinner: [
|
|
63
|
+
{ tag: 'path', attrs: { d: 'M12 2v4' } },
|
|
64
|
+
{ tag: 'path', attrs: { d: 'm16.2 7.8 2.9-2.9' } },
|
|
65
|
+
{ tag: 'path', attrs: { d: 'M18 12h4' } },
|
|
66
|
+
{ tag: 'path', attrs: { d: 'm16.2 16.2 2.9 2.9' } },
|
|
67
|
+
{ tag: 'path', attrs: { d: 'M12 18v4' } },
|
|
68
|
+
{ tag: 'path', attrs: { d: 'm4.9 19.1 2.9-2.9' } },
|
|
69
|
+
{ tag: 'path', attrs: { d: 'M2 12h4' } },
|
|
70
|
+
{ tag: 'path', attrs: { d: 'm4.9 4.9 2.9 2.9' } },
|
|
71
|
+
],
|
|
72
|
+
success: [
|
|
73
|
+
{ tag: 'circle', attrs: { cx: '12', cy: '12', r: '10' } },
|
|
74
|
+
{ tag: 'path', attrs: { d: 'm16 9-5.5 5.5L8 12' } },
|
|
75
|
+
],
|
|
76
|
+
upload: [
|
|
77
|
+
{ tag: 'path', attrs: { d: 'M12 3v12' } },
|
|
78
|
+
{ tag: 'path', attrs: { d: 'm17 8-5-5-5 5' } },
|
|
79
|
+
{ tag: 'path', attrs: { d: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4' } },
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=icons.js.map
|