@devschile/chucao 2.7.1 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chucao/chucao.esm.js +1 -1
- package/dist/chucao/{p-01b6c7bf.entry.js → p-03acf096.entry.js} +2 -2
- package/dist/chucao/{p-10f6801e.entry.js → p-0ce2b15d.entry.js} +2 -2
- package/dist/chucao/p-10e37157.entry.js +2 -0
- package/dist/chucao/p-10e37157.entry.js.map +1 -0
- package/dist/chucao/{p-f917d34f.entry.js → p-12043dc1.entry.js} +2 -2
- package/dist/chucao/p-1dca55d6.entry.js +2 -0
- package/dist/chucao/{p-deb2571b.entry.js.map → p-1dca55d6.entry.js.map} +1 -1
- package/dist/chucao/{p-0c7f6f8d.entry.js → p-244d8e96.entry.js} +2 -2
- package/dist/chucao/{p-a7c674b7.entry.js → p-29841714.entry.js} +2 -2
- package/dist/chucao/{p-ffecdf25.entry.js → p-302ec527.entry.js} +2 -2
- package/dist/chucao/{p-337d7f68.entry.js → p-51f6327c.entry.js} +2 -2
- package/dist/chucao/{p-1b70e3f1.entry.js → p-5a62951e.entry.js} +2 -2
- package/dist/chucao/{p-472ec451.entry.js → p-5d0ac17a.entry.js} +2 -2
- package/dist/chucao/{p-d8b71751.entry.js → p-5e0e1012.entry.js} +2 -2
- package/dist/chucao/{p-15d27bb7.entry.js → p-61a94a4e.entry.js} +2 -2
- package/dist/chucao/p-649c2cef.entry.js +2 -0
- package/dist/chucao/p-649c2cef.entry.js.map +1 -0
- package/dist/chucao/p-674c0f61.entry.js +2 -0
- package/dist/chucao/p-674c0f61.entry.js.map +1 -0
- package/dist/chucao/{p-c4b2bd1f.entry.js → p-67f0fc77.entry.js} +2 -2
- package/dist/chucao/{p-5240f5ac.entry.js → p-68e4a129.entry.js} +2 -2
- package/dist/chucao/{p-2e37c61b.entry.js → p-6e345b3f.entry.js} +2 -2
- package/dist/chucao/{p-f6ab0a11.entry.js → p-72d4dacf.entry.js} +2 -2
- package/dist/chucao/{p-8ae680a4.entry.js → p-74d9b7e5.entry.js} +2 -2
- package/dist/chucao/p-791ce537.entry.js +2 -0
- package/dist/chucao/p-791ce537.entry.js.map +1 -0
- package/dist/chucao/{p-c90da3c0.entry.js → p-79e8c10b.entry.js} +2 -2
- package/dist/chucao/{p-90284ebe.entry.js → p-7e13f725.entry.js} +2 -2
- package/dist/chucao/{p-9ebcc7be.entry.js → p-8b23d072.entry.js} +2 -2
- package/dist/chucao/{p-CIV5Gg1o.js → p-8l_6qAY9.js} +3 -3
- package/dist/chucao/p-8l_6qAY9.js.map +1 -0
- package/dist/chucao/{p-1e4cd3aa.entry.js → p-a5430e95.entry.js} +2 -2
- package/dist/chucao/{p-e77d35c3.entry.js → p-a7c66879.entry.js} +2 -2
- package/dist/chucao/p-b452d6cb.entry.js +2 -0
- package/dist/chucao/p-b7332faf.entry.js +2 -0
- package/dist/chucao/{p-60e1c1df.entry.js.map → p-b7332faf.entry.js.map} +1 -1
- package/dist/chucao/{p-42028c97.entry.js → p-f3d03388.entry.js} +2 -2
- package/dist/chucao/{p-7cdc71cc.entry.js → p-f925d45c.entry.js} +2 -2
- package/dist/cjs/ch-accordion.cjs.entry.js +2 -2
- package/dist/cjs/ch-alert_8.cjs.entry.js +8 -8
- package/dist/cjs/ch-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/ch-cluster.cjs.entry.js +3 -3
- package/dist/cjs/ch-combobox.cjs.entry.js +304 -0
- package/dist/cjs/ch-combobox.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-confirm-dialog.cjs.entry.js +138 -0
- package/dist/cjs/ch-confirm-dialog.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-description-list.cjs.entry.js +2 -2
- 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 +2 -2
- package/dist/cjs/ch-icon.cjs.entry.js +2 -2
- package/dist/cjs/ch-link.cjs.entry.js +1 -1
- package/dist/cjs/ch-modal.cjs.entry.js +2 -2
- package/dist/cjs/ch-number-input.cjs.entry.js +3 -3
- package/dist/cjs/ch-otp-input.cjs.entry.js +196 -0
- package/dist/cjs/ch-otp-input.cjs.entry.js.map +1 -0
- package/dist/cjs/ch-page-header.cjs.entry.js +2 -2
- package/dist/cjs/ch-pagination.cjs.entry.js +67 -0
- package/dist/cjs/ch-pagination.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 +3 -3
- package/dist/cjs/ch-table.cjs.entry.js +2 -2
- package/dist/cjs/ch-tabs.cjs.entry.js +2 -2
- package/dist/cjs/ch-textarea.cjs.entry.js +2 -2
- package/dist/cjs/ch-timeline.cjs.entry.js +2 -2
- package/dist/cjs/ch-tooltip.cjs.entry.js +3 -3
- package/dist/cjs/chucao.cjs.js +2 -2
- package/dist/cjs/{index-ByZY6aTj.js → index-C6khqyw3.js} +19 -2
- package/dist/cjs/index-C6khqyw3.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/ch-accordion/ch-accordion.js +1 -1
- package/dist/collection/components/ch-alert/ch-alert.js +1 -1
- package/dist/collection/components/ch-badge/ch-badge.js +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-combobox/ch-combobox.css +153 -0
- package/dist/collection/components/ch-combobox/ch-combobox.js +577 -0
- package/dist/collection/components/ch-combobox/ch-combobox.js.map +1 -0
- package/dist/collection/components/ch-confirm-dialog/ch-confirm-dialog.css +71 -0
- package/dist/collection/components/ch-confirm-dialog/ch-confirm-dialog.js +382 -0
- package/dist/collection/components/ch-confirm-dialog/ch-confirm-dialog.js.map +1 -0
- package/dist/collection/components/ch-description-list/ch-description-list.js +1 -1
- 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.js +1 -1
- package/dist/collection/components/ch-icon-button/ch-icon-button.js +1 -1
- 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-number-input/ch-number-input.js +2 -2
- package/dist/collection/components/ch-otp-input/ch-otp-input.css +86 -0
- package/dist/collection/components/ch-otp-input/ch-otp-input.js +478 -0
- package/dist/collection/components/ch-otp-input/ch-otp-input.js.map +1 -0
- package/dist/collection/components/ch-page-header/ch-page-header.js +1 -1
- package/dist/collection/components/ch-pagination/ch-pagination.css +63 -0
- package/dist/collection/components/ch-pagination/ch-pagination.js +228 -0
- package/dist/collection/components/ch-pagination/ch-pagination.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.js +2 -2
- package/dist/collection/components/ch-switch/ch-switch.js +1 -1
- package/dist/collection/components/ch-table/ch-table.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.js +1 -1
- package/dist/collection/components/ch-tooltip/ch-tooltip.js +2 -2
- package/dist/components/ch-accordion.js +1 -1
- package/dist/components/ch-alert.js +1 -1
- package/dist/components/ch-badge.js +1 -1
- package/dist/components/ch-button.js +1 -1
- package/dist/components/ch-card.js +1 -1
- package/dist/components/ch-checkbox.js +1 -1
- package/dist/components/ch-cluster.js +1 -1
- package/dist/components/ch-combobox.d.ts +11 -0
- package/dist/components/ch-combobox.js +2 -0
- package/dist/components/ch-combobox.js.map +1 -0
- package/dist/components/ch-confirm-dialog.d.ts +11 -0
- package/dist/components/ch-confirm-dialog.js +2 -0
- package/dist/components/ch-confirm-dialog.js.map +1 -0
- package/dist/components/ch-description-list.js +1 -1
- package/dist/components/ch-divider.js +1 -1
- package/dist/components/ch-drawer.js +1 -1
- package/dist/components/ch-emoji.js +1 -1
- package/dist/components/ch-empty-state.js +1 -1
- package/dist/components/ch-grid.js +1 -1
- package/dist/components/ch-icon-button.js +1 -1
- package/dist/components/ch-icon.js +1 -1
- package/dist/components/ch-input.js +1 -1
- package/dist/components/ch-modal.js +1 -1
- package/dist/components/ch-modal.js.map +1 -1
- package/dist/components/ch-number-input.js +1 -1
- package/dist/components/ch-otp-input.d.ts +11 -0
- package/dist/components/ch-otp-input.js +2 -0
- package/dist/components/ch-otp-input.js.map +1 -0
- package/dist/components/ch-page-header.js +1 -1
- package/dist/components/ch-pagination.d.ts +11 -0
- package/dist/components/ch-pagination.js +2 -0
- package/dist/components/ch-pagination.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.js +1 -1
- package/dist/components/ch-switch.js +1 -1
- package/dist/components/ch-table.js +1 -1
- package/dist/components/ch-tabs.js +1 -1
- package/dist/components/ch-textarea.js +1 -1
- package/dist/components/ch-timeline.js +1 -1
- package/dist/components/ch-tooltip.js +1 -1
- package/dist/components/{p-DiUN1WGc.js → p-CuSstsTP.js} +2 -2
- package/dist/components/p-MBLhKofG.js +2 -0
- package/dist/components/p-MBLhKofG.js.map +1 -0
- package/dist/components/p-qP_9qshx.js.map +1 -1
- package/dist/esm/ch-accordion.entry.js +2 -2
- package/dist/esm/ch-alert_8.entry.js +8 -8
- package/dist/esm/ch-checkbox.entry.js +2 -2
- package/dist/esm/ch-cluster.entry.js +3 -3
- package/dist/esm/ch-combobox.entry.js +302 -0
- package/dist/esm/ch-combobox.entry.js.map +1 -0
- package/dist/esm/ch-confirm-dialog.entry.js +136 -0
- package/dist/esm/ch-confirm-dialog.entry.js.map +1 -0
- package/dist/esm/ch-description-list.entry.js +2 -2
- 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 +2 -2
- package/dist/esm/ch-icon.entry.js +2 -2
- package/dist/esm/ch-link.entry.js +1 -1
- package/dist/esm/ch-modal.entry.js +2 -2
- package/dist/esm/ch-number-input.entry.js +3 -3
- package/dist/esm/ch-otp-input.entry.js +194 -0
- package/dist/esm/ch-otp-input.entry.js.map +1 -0
- package/dist/esm/ch-page-header.entry.js +2 -2
- package/dist/esm/ch-pagination.entry.js +65 -0
- package/dist/esm/ch-pagination.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 +3 -3
- package/dist/esm/ch-table.entry.js +2 -2
- package/dist/esm/ch-tabs.entry.js +2 -2
- package/dist/esm/ch-textarea.entry.js +2 -2
- package/dist/esm/ch-timeline.entry.js +2 -2
- package/dist/esm/ch-tooltip.entry.js +3 -3
- package/dist/esm/chucao.js +3 -3
- package/dist/esm/{index-CIV5Gg1o.js → index-8l_6qAY9.js} +19 -2
- package/dist/esm/index-8l_6qAY9.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/ch-combobox/ch-combobox.d.ts +98 -0
- package/dist/types/components/ch-confirm-dialog/ch-confirm-dialog.d.ts +81 -0
- package/dist/types/components/ch-otp-input/ch-otp-input.d.ts +79 -0
- package/dist/types/components/ch-pagination/ch-pagination.d.ts +44 -0
- package/dist/types/components.d.ts +757 -0
- package/dist-react/components.d.ts +27 -1
- package/dist-react/components.js +45 -0
- package/dist-react/components.ts +67 -1
- package/dist-vue/index.d.ts +4 -0
- package/dist-vue/index.js +67 -0
- package/dist-vue/index.ts +75 -0
- package/hydrate/index.js +855 -35
- package/hydrate/index.mjs +855 -35
- package/package.json +17 -1
- package/dist/chucao/p-60e1c1df.entry.js +0 -2
- package/dist/chucao/p-9db118d9.entry.js +0 -2
- package/dist/chucao/p-CIV5Gg1o.js.map +0 -1
- package/dist/chucao/p-deb2571b.entry.js +0 -2
- package/dist/cjs/index-ByZY6aTj.js.map +0 -1
- package/dist/esm/index-CIV5Gg1o.js.map +0 -1
- /package/dist/chucao/{p-01b6c7bf.entry.js.map → p-03acf096.entry.js.map} +0 -0
- /package/dist/chucao/{p-10f6801e.entry.js.map → p-0ce2b15d.entry.js.map} +0 -0
- /package/dist/chucao/{p-f917d34f.entry.js.map → p-12043dc1.entry.js.map} +0 -0
- /package/dist/chucao/{p-0c7f6f8d.entry.js.map → p-244d8e96.entry.js.map} +0 -0
- /package/dist/chucao/{p-a7c674b7.entry.js.map → p-29841714.entry.js.map} +0 -0
- /package/dist/chucao/{p-ffecdf25.entry.js.map → p-302ec527.entry.js.map} +0 -0
- /package/dist/chucao/{p-337d7f68.entry.js.map → p-51f6327c.entry.js.map} +0 -0
- /package/dist/chucao/{p-1b70e3f1.entry.js.map → p-5a62951e.entry.js.map} +0 -0
- /package/dist/chucao/{p-472ec451.entry.js.map → p-5d0ac17a.entry.js.map} +0 -0
- /package/dist/chucao/{p-d8b71751.entry.js.map → p-5e0e1012.entry.js.map} +0 -0
- /package/dist/chucao/{p-15d27bb7.entry.js.map → p-61a94a4e.entry.js.map} +0 -0
- /package/dist/chucao/{p-c4b2bd1f.entry.js.map → p-67f0fc77.entry.js.map} +0 -0
- /package/dist/chucao/{p-5240f5ac.entry.js.map → p-68e4a129.entry.js.map} +0 -0
- /package/dist/chucao/{p-2e37c61b.entry.js.map → p-6e345b3f.entry.js.map} +0 -0
- /package/dist/chucao/{p-f6ab0a11.entry.js.map → p-72d4dacf.entry.js.map} +0 -0
- /package/dist/chucao/{p-8ae680a4.entry.js.map → p-74d9b7e5.entry.js.map} +0 -0
- /package/dist/chucao/{p-c90da3c0.entry.js.map → p-79e8c10b.entry.js.map} +0 -0
- /package/dist/chucao/{p-90284ebe.entry.js.map → p-7e13f725.entry.js.map} +0 -0
- /package/dist/chucao/{p-9ebcc7be.entry.js.map → p-8b23d072.entry.js.map} +0 -0
- /package/dist/chucao/{p-1e4cd3aa.entry.js.map → p-a5430e95.entry.js.map} +0 -0
- /package/dist/chucao/{p-e77d35c3.entry.js.map → p-a7c66879.entry.js.map} +0 -0
- /package/dist/chucao/{p-9db118d9.entry.js.map → p-b452d6cb.entry.js.map} +0 -0
- /package/dist/chucao/{p-42028c97.entry.js.map → p-f3d03388.entry.js.map} +0 -0
- /package/dist/chucao/{p-7cdc71cc.entry.js.map → p-f925d45c.entry.js.map} +0 -0
- /package/dist/components/{p-DiUN1WGc.js.map → p-CuSstsTP.js.map} +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: contents;
|
|
3
|
+
font-family: var(--typography-body);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.confirm__heading {
|
|
7
|
+
margin: 0;
|
|
8
|
+
font-family: var(--typography-heading);
|
|
9
|
+
font-size: var(--typography-size-lg);
|
|
10
|
+
font-weight: var(--typography-weight-semibold);
|
|
11
|
+
color: var(--color-text-primary);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.confirm__message {
|
|
15
|
+
margin: 0;
|
|
16
|
+
font-size: var(--typography-size-sm);
|
|
17
|
+
color: var(--color-text-secondary);
|
|
18
|
+
overflow-wrap: break-word;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.confirm__actions {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-wrap: wrap;
|
|
24
|
+
justify-content: flex-end;
|
|
25
|
+
gap: var(--spacing-md);
|
|
26
|
+
margin-top: var(--spacing-2xl);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.confirm__button {
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
min-height: 2.25rem;
|
|
34
|
+
padding: 0 var(--spacing-lg);
|
|
35
|
+
border: var(--border-width) solid var(--color-border-default);
|
|
36
|
+
border-radius: var(--radius-sm);
|
|
37
|
+
background: var(--color-surface-default);
|
|
38
|
+
color: var(--color-text-primary);
|
|
39
|
+
font-family: var(--typography-body);
|
|
40
|
+
font-size: var(--typography-size-sm);
|
|
41
|
+
font-weight: var(--typography-weight-semibold);
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.confirm__button:focus-visible {
|
|
46
|
+
outline: 2px solid var(--color-accent-default);
|
|
47
|
+
outline-offset: 2px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.confirm__button:disabled {
|
|
51
|
+
opacity: var(--opacity-disabled);
|
|
52
|
+
cursor: not-allowed;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.confirm__button--confirm {
|
|
56
|
+
border-color: var(--color-accent-default);
|
|
57
|
+
background: var(--color-accent-default);
|
|
58
|
+
color: var(--color-accent-text);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Destructive intent is carried by weight and iconography as well as colour. */
|
|
62
|
+
.confirm__button--danger {
|
|
63
|
+
border-color: var(--color-status-warning);
|
|
64
|
+
background: var(--color-status-warning);
|
|
65
|
+
color: var(--color-text-primary);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.confirm__button--danger::before {
|
|
69
|
+
content: '⚠';
|
|
70
|
+
margin-right: var(--spacing-xs);
|
|
71
|
+
}
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* A confirmation dialog over `ch-modal`.
|
|
4
|
+
*
|
|
5
|
+
* Declarative only: the consumer opens it with `open` and handles the outcome.
|
|
6
|
+
* The imperative `confirm()` helper is a separate concern and a separate issue,
|
|
7
|
+
* because a promise-returning helper has to own mounting, focus and unhandled
|
|
8
|
+
* rejection, none of which a component should decide for its consumer.
|
|
9
|
+
*
|
|
10
|
+
* The guarantees this adds over a plain `ch-modal` are the ones that make a
|
|
11
|
+
* confirmation safe:
|
|
12
|
+
*
|
|
13
|
+
* - exactly one outcome per interaction — a double click on Confirm emits once;
|
|
14
|
+
* - every dismissal path (Cancel, Escape, backdrop, confirm) is reported, so a
|
|
15
|
+
* consumer awaiting an answer cannot hang;
|
|
16
|
+
* - focus lands on Cancel for a destructive action, so the absent-minded Enter
|
|
17
|
+
* does not destroy anything;
|
|
18
|
+
* - `pending` is not a cancellation: a slow request keeps the dialog open.
|
|
19
|
+
*/
|
|
20
|
+
export class ChConfirmDialog {
|
|
21
|
+
el;
|
|
22
|
+
/** Whether the dialog is open. Kept in sync when it is dismissed. */
|
|
23
|
+
open = false;
|
|
24
|
+
/**
|
|
25
|
+
* The question, set as the dialog's accessible name. Required: a dialog
|
|
26
|
+
* without a name is announced as an unlabelled group.
|
|
27
|
+
*/
|
|
28
|
+
heading;
|
|
29
|
+
/** Supporting text, rendered under the heading. */
|
|
30
|
+
message;
|
|
31
|
+
/** Label of the confirming action. */
|
|
32
|
+
confirmLabel = 'Confirm';
|
|
33
|
+
/** Label of the dismissing action. */
|
|
34
|
+
cancelLabel = 'Cancel';
|
|
35
|
+
/**
|
|
36
|
+
* `danger` styles the confirm action as destructive and moves the initial
|
|
37
|
+
* focus to Cancel, so the safe choice is the default one.
|
|
38
|
+
*/
|
|
39
|
+
tone = 'default';
|
|
40
|
+
/** Whether the confirm action is in flight; both buttons are then disabled. */
|
|
41
|
+
pending = false;
|
|
42
|
+
/**
|
|
43
|
+
* Whether Escape and the backdrop dismiss the dialog. When false, the only
|
|
44
|
+
* way out is one of the two buttons — use it only for a decision that must
|
|
45
|
+
* be answered rather than abandoned.
|
|
46
|
+
*/
|
|
47
|
+
dismissible = true;
|
|
48
|
+
/** Emitted once when the user confirms. */
|
|
49
|
+
chConfirm;
|
|
50
|
+
/** Emitted once when the dialog is dismissed without confirming. */
|
|
51
|
+
chCancel;
|
|
52
|
+
/** `true` once an outcome has been emitted for the current opening. */
|
|
53
|
+
settled = false;
|
|
54
|
+
cancelButton;
|
|
55
|
+
confirmButton;
|
|
56
|
+
componentDidLoad() {
|
|
57
|
+
if (this.open) {
|
|
58
|
+
this.onOpening();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
handleOpenChange(open) {
|
|
62
|
+
if (open) {
|
|
63
|
+
this.onOpening();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.settled = false;
|
|
67
|
+
}
|
|
68
|
+
onOpening() {
|
|
69
|
+
this.settled = false;
|
|
70
|
+
// Focus is moved once the dialog is actually shown; the modal handles
|
|
71
|
+
// moving focus into itself, and this refines where it lands.
|
|
72
|
+
requestAnimationFrame(() => {
|
|
73
|
+
const target = this.tone === 'danger' ? this.cancelButton : this.confirmButton;
|
|
74
|
+
target?.focus();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
settle(outcome) {
|
|
78
|
+
if (this.settled) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.settled = true;
|
|
82
|
+
if (outcome === 'confirm') {
|
|
83
|
+
this.chConfirm.emit();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.chCancel.emit();
|
|
87
|
+
}
|
|
88
|
+
handleConfirm = () => {
|
|
89
|
+
if (this.pending) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this.settle('confirm');
|
|
93
|
+
};
|
|
94
|
+
handleCancel = () => {
|
|
95
|
+
if (this.pending) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
this.open = false;
|
|
99
|
+
this.settle('cancel');
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* `ch-modal` reports every close that was not requested by the consumer —
|
|
103
|
+
* Escape and the backdrop. A close while `pending` is the consumer's own
|
|
104
|
+
* doing and is not a cancellation.
|
|
105
|
+
*/
|
|
106
|
+
handleModalClose = () => {
|
|
107
|
+
this.open = false;
|
|
108
|
+
if (this.pending) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this.settle('cancel');
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Escape is a platform close request on the inner `<dialog>`, so a
|
|
115
|
+
* non-dismissible dialog cancels it before it takes effect. The backdrop is
|
|
116
|
+
* handled by `ch-modal` and is suppressed the same way.
|
|
117
|
+
*/
|
|
118
|
+
handleKeyDown = (event) => {
|
|
119
|
+
if (this.dismissible || event.key !== 'Escape') {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
event.stopPropagation();
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Focus the safe action. Exposed so a consumer can return focus deliberately
|
|
127
|
+
* after a request settles.
|
|
128
|
+
*/
|
|
129
|
+
async focusCancel() {
|
|
130
|
+
this.cancelButton?.focus();
|
|
131
|
+
}
|
|
132
|
+
render() {
|
|
133
|
+
return (h(Host, { key: 'b51a806f4cca331fc3a95421d3342608c6e0df4c', onKeyDown: this.handleKeyDown }, h("ch-modal", { key: '453db02cd724bc9bf2ed7c4b61bcf04c77b8d449', open: this.open, label: this.heading, size: "sm", onChClose: this.handleModalClose, onChOpen: () => this.onOpening() }, h("h2", { key: '1dee8f11ee68679792c394506ab2e8a7f98b852b', slot: "heading", class: "confirm__heading" }, this.heading), this.message && h("p", { key: 'f2a8a473acfcdfee51600a0dc7bc47b85f4a0889', class: "confirm__message" }, this.message), h("div", { key: '7ecfa78e4df217e38519f115fdcb4761ed88937d', class: "confirm__actions" }, h("button", { key: '0c4a117caee9ef316932e2eea9c0aa3734f0bbee', class: { 'confirm__button': true, 'confirm__button--cancel': true }, type: "button", ref: el => (this.cancelButton = el), disabled: this.pending, onClick: this.handleCancel }, this.cancelLabel), h("button", { key: 'd33fd5f6f218bfcd39f179e29d757f7f9bdcae30', class: { 'confirm__button': true, 'confirm__button--confirm': true, 'confirm__button--danger': this.tone === 'danger' }, type: "button", ref: el => (this.confirmButton = el), disabled: this.pending, "aria-busy": this.pending ? 'true' : undefined, onClick: this.handleConfirm }, this.confirmLabel)))));
|
|
134
|
+
}
|
|
135
|
+
static get is() { return "ch-confirm-dialog"; }
|
|
136
|
+
static get encapsulation() { return "shadow"; }
|
|
137
|
+
static get originalStyleUrls() {
|
|
138
|
+
return {
|
|
139
|
+
"$": ["ch-confirm-dialog.css"]
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
static get styleUrls() {
|
|
143
|
+
return {
|
|
144
|
+
"$": ["ch-confirm-dialog.css"]
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
static get properties() {
|
|
148
|
+
return {
|
|
149
|
+
"open": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"mutable": true,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "boolean",
|
|
154
|
+
"resolved": "boolean",
|
|
155
|
+
"references": {}
|
|
156
|
+
},
|
|
157
|
+
"required": false,
|
|
158
|
+
"optional": false,
|
|
159
|
+
"docs": {
|
|
160
|
+
"tags": [],
|
|
161
|
+
"text": "Whether the dialog is open. Kept in sync when it is dismissed."
|
|
162
|
+
},
|
|
163
|
+
"getter": false,
|
|
164
|
+
"setter": false,
|
|
165
|
+
"reflect": false,
|
|
166
|
+
"attribute": "open",
|
|
167
|
+
"defaultValue": "false"
|
|
168
|
+
},
|
|
169
|
+
"heading": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"mutable": false,
|
|
172
|
+
"complexType": {
|
|
173
|
+
"original": "string",
|
|
174
|
+
"resolved": "string",
|
|
175
|
+
"references": {}
|
|
176
|
+
},
|
|
177
|
+
"required": true,
|
|
178
|
+
"optional": false,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "The question, set as the dialog's accessible name. Required: a dialog\nwithout a name is announced as an unlabelled group."
|
|
182
|
+
},
|
|
183
|
+
"getter": false,
|
|
184
|
+
"setter": false,
|
|
185
|
+
"reflect": false,
|
|
186
|
+
"attribute": "heading"
|
|
187
|
+
},
|
|
188
|
+
"message": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"mutable": false,
|
|
191
|
+
"complexType": {
|
|
192
|
+
"original": "string",
|
|
193
|
+
"resolved": "string",
|
|
194
|
+
"references": {}
|
|
195
|
+
},
|
|
196
|
+
"required": false,
|
|
197
|
+
"optional": true,
|
|
198
|
+
"docs": {
|
|
199
|
+
"tags": [],
|
|
200
|
+
"text": "Supporting text, rendered under the heading."
|
|
201
|
+
},
|
|
202
|
+
"getter": false,
|
|
203
|
+
"setter": false,
|
|
204
|
+
"reflect": false,
|
|
205
|
+
"attribute": "message"
|
|
206
|
+
},
|
|
207
|
+
"confirmLabel": {
|
|
208
|
+
"type": "string",
|
|
209
|
+
"mutable": false,
|
|
210
|
+
"complexType": {
|
|
211
|
+
"original": "string",
|
|
212
|
+
"resolved": "string",
|
|
213
|
+
"references": {}
|
|
214
|
+
},
|
|
215
|
+
"required": false,
|
|
216
|
+
"optional": false,
|
|
217
|
+
"docs": {
|
|
218
|
+
"tags": [],
|
|
219
|
+
"text": "Label of the confirming action."
|
|
220
|
+
},
|
|
221
|
+
"getter": false,
|
|
222
|
+
"setter": false,
|
|
223
|
+
"reflect": false,
|
|
224
|
+
"attribute": "confirm-label",
|
|
225
|
+
"defaultValue": "'Confirm'"
|
|
226
|
+
},
|
|
227
|
+
"cancelLabel": {
|
|
228
|
+
"type": "string",
|
|
229
|
+
"mutable": false,
|
|
230
|
+
"complexType": {
|
|
231
|
+
"original": "string",
|
|
232
|
+
"resolved": "string",
|
|
233
|
+
"references": {}
|
|
234
|
+
},
|
|
235
|
+
"required": false,
|
|
236
|
+
"optional": false,
|
|
237
|
+
"docs": {
|
|
238
|
+
"tags": [],
|
|
239
|
+
"text": "Label of the dismissing action."
|
|
240
|
+
},
|
|
241
|
+
"getter": false,
|
|
242
|
+
"setter": false,
|
|
243
|
+
"reflect": false,
|
|
244
|
+
"attribute": "cancel-label",
|
|
245
|
+
"defaultValue": "'Cancel'"
|
|
246
|
+
},
|
|
247
|
+
"tone": {
|
|
248
|
+
"type": "string",
|
|
249
|
+
"mutable": false,
|
|
250
|
+
"complexType": {
|
|
251
|
+
"original": "ChConfirmDialogTone",
|
|
252
|
+
"resolved": "\"danger\" | \"default\"",
|
|
253
|
+
"references": {
|
|
254
|
+
"ChConfirmDialogTone": {
|
|
255
|
+
"location": "local",
|
|
256
|
+
"path": "/home/runner/work/chucao/chucao/src/components/ch-confirm-dialog/ch-confirm-dialog.tsx",
|
|
257
|
+
"id": "src/components/ch-confirm-dialog/ch-confirm-dialog.tsx::ChConfirmDialogTone"
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"required": false,
|
|
262
|
+
"optional": false,
|
|
263
|
+
"docs": {
|
|
264
|
+
"tags": [],
|
|
265
|
+
"text": "`danger` styles the confirm action as destructive and moves the initial\nfocus to Cancel, so the safe choice is the default one."
|
|
266
|
+
},
|
|
267
|
+
"getter": false,
|
|
268
|
+
"setter": false,
|
|
269
|
+
"reflect": false,
|
|
270
|
+
"attribute": "tone",
|
|
271
|
+
"defaultValue": "'default'"
|
|
272
|
+
},
|
|
273
|
+
"pending": {
|
|
274
|
+
"type": "boolean",
|
|
275
|
+
"mutable": false,
|
|
276
|
+
"complexType": {
|
|
277
|
+
"original": "boolean",
|
|
278
|
+
"resolved": "boolean",
|
|
279
|
+
"references": {}
|
|
280
|
+
},
|
|
281
|
+
"required": false,
|
|
282
|
+
"optional": false,
|
|
283
|
+
"docs": {
|
|
284
|
+
"tags": [],
|
|
285
|
+
"text": "Whether the confirm action is in flight; both buttons are then disabled."
|
|
286
|
+
},
|
|
287
|
+
"getter": false,
|
|
288
|
+
"setter": false,
|
|
289
|
+
"reflect": false,
|
|
290
|
+
"attribute": "pending",
|
|
291
|
+
"defaultValue": "false"
|
|
292
|
+
},
|
|
293
|
+
"dismissible": {
|
|
294
|
+
"type": "boolean",
|
|
295
|
+
"mutable": false,
|
|
296
|
+
"complexType": {
|
|
297
|
+
"original": "boolean",
|
|
298
|
+
"resolved": "boolean",
|
|
299
|
+
"references": {}
|
|
300
|
+
},
|
|
301
|
+
"required": false,
|
|
302
|
+
"optional": false,
|
|
303
|
+
"docs": {
|
|
304
|
+
"tags": [],
|
|
305
|
+
"text": "Whether Escape and the backdrop dismiss the dialog. When false, the only\nway out is one of the two buttons \u2014 use it only for a decision that must\nbe answered rather than abandoned."
|
|
306
|
+
},
|
|
307
|
+
"getter": false,
|
|
308
|
+
"setter": false,
|
|
309
|
+
"reflect": false,
|
|
310
|
+
"attribute": "dismissible",
|
|
311
|
+
"defaultValue": "true"
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
static get states() {
|
|
316
|
+
return {
|
|
317
|
+
"settled": {}
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
static get events() {
|
|
321
|
+
return [{
|
|
322
|
+
"method": "chConfirm",
|
|
323
|
+
"name": "chConfirm",
|
|
324
|
+
"bubbles": true,
|
|
325
|
+
"cancelable": true,
|
|
326
|
+
"composed": true,
|
|
327
|
+
"docs": {
|
|
328
|
+
"tags": [],
|
|
329
|
+
"text": "Emitted once when the user confirms."
|
|
330
|
+
},
|
|
331
|
+
"complexType": {
|
|
332
|
+
"original": "void",
|
|
333
|
+
"resolved": "void",
|
|
334
|
+
"references": {}
|
|
335
|
+
}
|
|
336
|
+
}, {
|
|
337
|
+
"method": "chCancel",
|
|
338
|
+
"name": "chCancel",
|
|
339
|
+
"bubbles": true,
|
|
340
|
+
"cancelable": true,
|
|
341
|
+
"composed": true,
|
|
342
|
+
"docs": {
|
|
343
|
+
"tags": [],
|
|
344
|
+
"text": "Emitted once when the dialog is dismissed without confirming."
|
|
345
|
+
},
|
|
346
|
+
"complexType": {
|
|
347
|
+
"original": "void",
|
|
348
|
+
"resolved": "void",
|
|
349
|
+
"references": {}
|
|
350
|
+
}
|
|
351
|
+
}];
|
|
352
|
+
}
|
|
353
|
+
static get methods() {
|
|
354
|
+
return {
|
|
355
|
+
"focusCancel": {
|
|
356
|
+
"complexType": {
|
|
357
|
+
"signature": "() => Promise<void>",
|
|
358
|
+
"parameters": [],
|
|
359
|
+
"references": {
|
|
360
|
+
"Promise": {
|
|
361
|
+
"location": "global",
|
|
362
|
+
"id": "global::Promise"
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
"return": "Promise<void>"
|
|
366
|
+
},
|
|
367
|
+
"docs": {
|
|
368
|
+
"text": "Focus the safe action. Exposed so a consumer can return focus deliberately\nafter a request settles.",
|
|
369
|
+
"tags": []
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
static get elementRef() { return "el"; }
|
|
375
|
+
static get watchers() {
|
|
376
|
+
return [{
|
|
377
|
+
"propName": "open",
|
|
378
|
+
"methodName": "handleOpenChange"
|
|
379
|
+
}];
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
//# sourceMappingURL=ch-confirm-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ch-confirm-dialog.js","sourceRoot":"","sources":["../../../../src/components/ch-confirm-dialog/ch-confirm-dialog.tsx"],"names":[],"mappings":"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","sourcesContent":["import { Component, Element, Event, type EventEmitter, Host, Method, Prop, State, Watch, h } from '@stencil/core';\n\nexport type ChConfirmDialogTone = 'default' | 'danger';\n\n/**\n * A confirmation dialog over `ch-modal`.\n *\n * Declarative only: the consumer opens it with `open` and handles the outcome.\n * The imperative `confirm()` helper is a separate concern and a separate issue,\n * because a promise-returning helper has to own mounting, focus and unhandled\n * rejection, none of which a component should decide for its consumer.\n *\n * The guarantees this adds over a plain `ch-modal` are the ones that make a\n * confirmation safe:\n *\n * - exactly one outcome per interaction — a double click on Confirm emits once;\n * - every dismissal path (Cancel, Escape, backdrop, confirm) is reported, so a\n * consumer awaiting an answer cannot hang;\n * - focus lands on Cancel for a destructive action, so the absent-minded Enter\n * does not destroy anything;\n * - `pending` is not a cancellation: a slow request keeps the dialog open.\n */\n@Component({\n tag: 'ch-confirm-dialog',\n styleUrl: 'ch-confirm-dialog.css',\n shadow: true,\n})\nexport class ChConfirmDialog {\n @Element() el: HTMLElement;\n\n /** Whether the dialog is open. Kept in sync when it is dismissed. */\n @Prop({ mutable: true }) open = false;\n\n /**\n * The question, set as the dialog's accessible name. Required: a dialog\n * without a name is announced as an unlabelled group.\n */\n @Prop() heading!: string;\n\n /** Supporting text, rendered under the heading. */\n @Prop() message?: string;\n\n /** Label of the confirming action. */\n @Prop() confirmLabel = 'Confirm';\n\n /** Label of the dismissing action. */\n @Prop() cancelLabel = 'Cancel';\n\n /**\n * `danger` styles the confirm action as destructive and moves the initial\n * focus to Cancel, so the safe choice is the default one.\n */\n @Prop() tone: ChConfirmDialogTone = 'default';\n\n /** Whether the confirm action is in flight; both buttons are then disabled. */\n @Prop() pending = false;\n\n /**\n * Whether Escape and the backdrop dismiss the dialog. When false, the only\n * way out is one of the two buttons — use it only for a decision that must\n * be answered rather than abandoned.\n */\n @Prop() dismissible = true;\n\n /** Emitted once when the user confirms. */\n @Event() chConfirm: EventEmitter<void>;\n\n /** Emitted once when the dialog is dismissed without confirming. */\n @Event() chCancel: EventEmitter<void>;\n\n /** `true` once an outcome has been emitted for the current opening. */\n @State() private settled = false;\n\n private cancelButton?: HTMLButtonElement;\n private confirmButton?: HTMLButtonElement;\n\n componentDidLoad() {\n if (this.open) {\n this.onOpening();\n }\n }\n\n @Watch('open')\n handleOpenChange(open: boolean) {\n if (open) {\n this.onOpening();\n return;\n }\n this.settled = false;\n }\n\n private onOpening() {\n this.settled = false;\n // Focus is moved once the dialog is actually shown; the modal handles\n // moving focus into itself, and this refines where it lands.\n requestAnimationFrame(() => {\n const target = this.tone === 'danger' ? this.cancelButton : this.confirmButton;\n target?.focus();\n });\n }\n\n private settle(outcome: 'confirm' | 'cancel') {\n if (this.settled) {\n return;\n }\n this.settled = true;\n if (outcome === 'confirm') {\n this.chConfirm.emit();\n return;\n }\n this.chCancel.emit();\n }\n\n private handleConfirm = () => {\n if (this.pending) {\n return;\n }\n this.settle('confirm');\n };\n\n private handleCancel = () => {\n if (this.pending) {\n return;\n }\n this.open = false;\n this.settle('cancel');\n };\n\n /**\n * `ch-modal` reports every close that was not requested by the consumer —\n * Escape and the backdrop. A close while `pending` is the consumer's own\n * doing and is not a cancellation.\n */\n private handleModalClose = () => {\n this.open = false;\n if (this.pending) {\n return;\n }\n this.settle('cancel');\n };\n\n /**\n * Escape is a platform close request on the inner `<dialog>`, so a\n * non-dismissible dialog cancels it before it takes effect. The backdrop is\n * handled by `ch-modal` and is suppressed the same way.\n */\n private handleKeyDown = (event: KeyboardEvent) => {\n if (this.dismissible || event.key !== 'Escape') {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n };\n\n /**\n * Focus the safe action. Exposed so a consumer can return focus deliberately\n * after a request settles.\n */\n @Method()\n async focusCancel(): Promise<void> {\n this.cancelButton?.focus();\n }\n\n render() {\n return (\n <Host onKeyDown={this.handleKeyDown}>\n <ch-modal open={this.open} label={this.heading} size=\"sm\" onChClose={this.handleModalClose} onChOpen={() => this.onOpening()}>\n <h2 slot=\"heading\" class=\"confirm__heading\">\n {this.heading}\n </h2>\n {this.message && <p class=\"confirm__message\">{this.message}</p>}\n <div class=\"confirm__actions\">\n <button\n class={{ 'confirm__button': true, 'confirm__button--cancel': true }}\n type=\"button\"\n ref={el => (this.cancelButton = el as HTMLButtonElement)}\n disabled={this.pending}\n onClick={this.handleCancel}\n >\n {this.cancelLabel}\n </button>\n <button\n class={{ 'confirm__button': true, 'confirm__button--confirm': true, 'confirm__button--danger': this.tone === 'danger' }}\n type=\"button\"\n ref={el => (this.confirmButton = el as HTMLButtonElement)}\n disabled={this.pending}\n aria-busy={this.pending ? 'true' : undefined}\n onClick={this.handleConfirm}\n >\n {this.confirmLabel}\n </button>\n </div>\n </ch-modal>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -30,7 +30,7 @@ export class ChDescriptionList {
|
|
|
30
30
|
return COLUMNS.has(this.columns) ? this.columns : '1';
|
|
31
31
|
}
|
|
32
32
|
render() {
|
|
33
|
-
return (h(Host, { key: '
|
|
33
|
+
return (h(Host, { key: '1fd1228705a78196b618efc4b9665de038663ae5' }, h("dl", { key: '0b724aa3c5dec011106347d9d29d0420f723012f', class: `list list--columns-${this.columnCount}` }, h("slot", { key: '4da2c6965568cf7d2f93ee98e131a7bede26d5dc' }))));
|
|
34
34
|
}
|
|
35
35
|
static get is() { return "ch-description-list"; }
|
|
36
36
|
static get encapsulation() { return "shadow"; }
|
|
@@ -5,7 +5,7 @@ export class ChDivider {
|
|
|
5
5
|
*/
|
|
6
6
|
orientation = 'horizontal';
|
|
7
7
|
render() {
|
|
8
|
-
return (h(Host, { key: '
|
|
8
|
+
return (h(Host, { key: 'cc193b7e7229de8ff96eb056bd345cc8d666004b', class: { 'divider--vertical': this.orientation === 'vertical' } }, h("hr", { key: '659320c0372d208aab9b13d471427e479499a72c', class: { divider: true, [`divider--${this.orientation}`]: true }, "aria-orientation": this.orientation })));
|
|
9
9
|
}
|
|
10
10
|
static get is() { return "ch-divider"; }
|
|
11
11
|
static get encapsulation() { return "shadow"; }
|
|
@@ -145,7 +145,7 @@ export class ChDrawer {
|
|
|
145
145
|
if (!this.label) {
|
|
146
146
|
warnMissingName(this.el, 'ch-drawer', 'pass label with the same text as the header');
|
|
147
147
|
}
|
|
148
|
-
return (h(Host, { key: '
|
|
148
|
+
return (h(Host, { key: '1a51b3f19b956fe860fe4def9f2ac23eac7f86ac' }, h("dialog", { key: 'ad7366eb2e6274962faa2a1564a06ecc3268329c', class: { drawer: true, [`drawer--${this.side}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, h("div", { key: 'ce532be71c35234f1713051e5669f1cf9316031e', class: "drawer-head" }, h("slot", { key: 'b522a8f26dddefd2aaf146134ac24e026a5eb72a', name: "header" }), this.closeLabel && (h("button", { key: 'b51fb4e20797cd82661c72c9250b0875338180f0', class: "drawer-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, h("span", { key: 'dd21e30fcb74f08c80b1c2ba79696e1d54bf4c26', "aria-hidden": "true" }, "\u00D7")))), h("div", { key: 'eacafa24e5af7c107e09a7cbfdfc93ae6f373dc5', class: "drawer-body" }, h("slot", { key: 'ddf9370c27956bc2954a3af29064394d37ec5e67' })), h("slot", { key: '0065c8f5bafb14791e63d15bbec0ec2ba533c222', name: "footer" }))));
|
|
149
149
|
}
|
|
150
150
|
static get is() { return "ch-drawer"; }
|
|
151
151
|
static get encapsulation() { return "shadow"; }
|
|
@@ -49,7 +49,7 @@ export class ChEmoji {
|
|
|
49
49
|
this.loaded = true;
|
|
50
50
|
};
|
|
51
51
|
render() {
|
|
52
|
-
return (h(Host, { key: '
|
|
52
|
+
return (h(Host, { key: 'd6e224a01b95fdebb4525b30b326585ee96e1050' }, h("img", { key: '6bc232d8f25e0099c9e2794f15b8e47f6c2dbb22', class: {
|
|
53
53
|
'emoji': true,
|
|
54
54
|
[`emoji--${this.size}`]: true,
|
|
55
55
|
'emoji--hidden': !this.loaded,
|
|
@@ -22,7 +22,7 @@ export class ChEmptyState {
|
|
|
22
22
|
*/
|
|
23
23
|
size = 'md';
|
|
24
24
|
render() {
|
|
25
|
-
return (h(Host, { key: '
|
|
25
|
+
return (h(Host, { key: '15a171d5e6128b278078f3564fe27a75f2d3638f', class: { 'empty-state': true, [`empty-state--${this.size}`]: true } }, h("div", { key: '959baade697f5817d46fe2ef1e08b31d1f14168d', class: "empty-state__inner" }, h("div", { key: 'c97f9d6405da2d81e538701c48e12acbb6bbbd76', class: "empty-state__icon", "aria-hidden": "true" }, h("slot", { key: 'abb50aae0a68ff11b5042a51cdb8d7f69d965ae8', name: "icon" })), h("h3", { key: '2049c3cb4714b642670ba283f8c3c9e3e1ba6ae4', class: "empty-state__title" }, this.title), this.description && h("p", { key: 'b74601952c870aab10345c7bdc856dc779396645', class: "empty-state__description" }, this.description), h("div", { key: 'c72be9f5a4f40113d1c6df1d62c9b617e8dcb407', class: "empty-state__actions" }, h("slot", { key: 'c998904407c1cf174921873e3d547c2056f3d1b5' })))));
|
|
26
26
|
}
|
|
27
27
|
static get is() { return "ch-empty-state"; }
|
|
28
28
|
static get encapsulation() { return "shadow"; }
|
|
@@ -48,7 +48,7 @@ export class ChGrid {
|
|
|
48
48
|
this.el.style.setProperty('--ch-grid-columns', template);
|
|
49
49
|
}
|
|
50
50
|
render() {
|
|
51
|
-
return (h(Host, { key: '
|
|
51
|
+
return (h(Host, { key: '4fbcd3b5e563ebf0f5b2878ef6af0cb2d1c0f427', class: { grid: true, [`grid--gap-${this.gapStep}`]: true } }, h("slot", { key: '4fe1548392ab44de9dd895129d77f20650a0d929' })));
|
|
52
52
|
}
|
|
53
53
|
static get is() { return "ch-grid"; }
|
|
54
54
|
static get encapsulation() { return "shadow"; }
|
|
@@ -28,7 +28,7 @@ export class ChIcon {
|
|
|
28
28
|
render() {
|
|
29
29
|
const shapes = this.name ? chIcons[this.name] : undefined;
|
|
30
30
|
const decorative = !this.label;
|
|
31
|
-
return (h(Host, { key: '
|
|
31
|
+
return (h(Host, { key: 'c55af60731d59ee48bfb2566f498c5675c36cb04' }, h("svg", { key: '65334ba063c059ef2a505c7ea34859d1d1971f01', class: `icon icon--${this.size}`, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", role: decorative ? undefined : 'img', "aria-label": this.label, "aria-hidden": decorative ? 'true' : undefined, focusable: "false" }, (shapes ?? []).map(shape => h(shape.tag, shape.attrs)))));
|
|
32
32
|
}
|
|
33
33
|
static get is() { return "ch-icon"; }
|
|
34
34
|
static get encapsulation() { return "shadow"; }
|
|
@@ -40,7 +40,7 @@ export class ChIconButton {
|
|
|
40
40
|
};
|
|
41
41
|
render() {
|
|
42
42
|
const shapes = this.name ? chIcons[this.name] : undefined;
|
|
43
|
-
return (h(Host, { key: '
|
|
43
|
+
return (h(Host, { key: '585bbba80a0811664fcc2fa8fd625cd8655e3395' }, h("button", { key: 'd817e9eda842b824a052be9b822c860b9417ddd4', class: `button button--${this.size}`, type: this.type, "aria-label": this.label, "aria-busy": this.loading ? 'true' : undefined, "aria-disabled": this.disabled ? 'true' : undefined, onClick: this.handleClick }, h("svg", { key: '2f0278d9f551da6b526c3fe5a6680cd38080502e', class: "icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true", focusable: "false" }, (shapes ?? []).map(shape => h(shape.tag, shape.attrs))))));
|
|
44
44
|
}
|
|
45
45
|
static get is() { return "ch-icon-button"; }
|
|
46
46
|
static get encapsulation() { return "shadow"; }
|
|
@@ -107,7 +107,7 @@ export class ChInput {
|
|
|
107
107
|
return undefined;
|
|
108
108
|
}
|
|
109
109
|
render() {
|
|
110
|
-
return (h(Host, { key: '
|
|
110
|
+
return (h(Host, { key: '80dd56c8fa40d4c8c4eec2b62d1fea2aaa574dcc' }, this.label && (h("label", { key: 'd1d4c26e7a49f176f5d986af107395fd32abbd11', class: "label", htmlFor: this.inputId }, this.label)), h("input", { key: '9220c4f98593dce4af626a2d068e654cf360199b', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.invalid }, type: this.type, name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '802ec36ef19bebd3371ff9535fba4052268f3db6', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '489b9634ce6577f71c5875a45cfc5b8a5eeb6cf1', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
111
111
|
}
|
|
112
112
|
static get is() { return "ch-input"; }
|
|
113
113
|
static get encapsulation() { return "shadow"; }
|
|
@@ -152,7 +152,7 @@ export class ChModal {
|
|
|
152
152
|
if (!this.label) {
|
|
153
153
|
warnMissingName(this.el, 'ch-modal', 'pass label with the same text as the heading');
|
|
154
154
|
}
|
|
155
|
-
return (h(Host, { key: '
|
|
155
|
+
return (h(Host, { key: '36395dc0b52676493b93d02c04d1c810d98c8028' }, h("dialog", { key: '99d446c5d0ecd9e16f8d36fc2903f1ab06c274f2', class: { modal: true, [`modal--${this.size}`]: true }, "aria-label": this.label, ref: el => (this.dialog = el) }, h("div", { key: '9dd7043302df7ffa89fdb44f54ed5c93a48fff7e', class: "modal-head" }, h("slot", { key: '473041c868d2234c66276936cde0d020b8ed74ce', name: "heading" }), this.closeLabel && (h("button", { key: 'e3f65a8c91283b8f3a27975afe44e47e65fbf03f', class: "modal-close", type: "button", "aria-label": this.closeLabel, onClick: this.handleCloseClick }, h("span", { key: 'dbacf11f6b06ed4183e6d277fc807d63867fdf1d', "aria-hidden": "true" }, "\u00D7")))), h("div", { key: '1d9e1567fe0046078f1d26f5dea25c3c06c7e6ed', class: "modal-body" }, h("slot", { key: 'cc0a63c64b512a6c40c59d8395ced225a961adfc' })))));
|
|
156
156
|
}
|
|
157
157
|
static get is() { return "ch-modal"; }
|
|
158
158
|
static get encapsulation() { return "shadow"; }
|
|
@@ -204,10 +204,10 @@ export class ChNumberInput {
|
|
|
204
204
|
}
|
|
205
205
|
render() {
|
|
206
206
|
const showError = this.isInvalid && this.errorMessage;
|
|
207
|
-
return (h(Host, { key: '
|
|
207
|
+
return (h(Host, { key: '0265106cccf730338541d292be247b7853ab00cf' }, this.label && (h("label", { key: '17293d5cc55a8d4de0cd544ea1f508d1ed820b12', class: "label", htmlFor: this.inputId }, this.label)), h("input", { key: 'ce17dc7c0f5c1064d8535aef942e486a46b72188', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid },
|
|
208
208
|
// `text` with `inputmode`, not `type="number"`: a number input drops
|
|
209
209
|
// partial values and cannot show grouped digits.
|
|
210
|
-
type: "text", inputMode: this.decimals ? 'decimal' : 'numeric', name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.typing ? this.draft : this.formatDisplay(this.value), "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange, onBlur: this.handleBlur }), this.hint && !showError && (h("p", { key: '
|
|
210
|
+
type: "text", inputMode: this.decimals ? 'decimal' : 'numeric', name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.typing ? this.draft : this.formatDisplay(this.value), "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange, onBlur: this.handleBlur }), this.hint && !showError && (h("p", { key: '37611a7755f6885e6f87a600b1a27cc5edd5fefd', class: "hint", id: this.hintId }, this.hint)), showError && (h("p", { key: '68b8c5b964a2a98df493103b1fde088aeefda769', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
211
211
|
}
|
|
212
212
|
static get is() { return "ch-number-input"; }
|
|
213
213
|
static get encapsulation() { return "shadow"; }
|