@devschile/chucao 2.0.0 → 2.2.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.
Files changed (173) hide show
  1. package/README.md +2 -0
  2. package/dist/chucao/chucao.esm.js +1 -1
  3. package/dist/chucao/chucao.esm.js.map +1 -1
  4. package/dist/chucao/{p-a0ec231a.entry.js → p-04dbcfa0.entry.js} +2 -2
  5. package/dist/chucao/{p-96c852f5.entry.js → p-077dc2a6.entry.js} +2 -2
  6. package/dist/chucao/{p-19dde4f9.entry.js → p-079c2017.entry.js} +2 -2
  7. package/dist/chucao/p-37e7f9cc.entry.js +2 -0
  8. package/dist/chucao/p-37e7f9cc.entry.js.map +1 -0
  9. package/dist/chucao/{p-f04d2f75.entry.js → p-5ae89a19.entry.js} +2 -2
  10. package/dist/chucao/p-70285203.entry.js +2 -0
  11. package/dist/chucao/p-70285203.entry.js.map +1 -0
  12. package/dist/chucao/{p-2e20c7a1.entry.js → p-9c072600.entry.js} +2 -2
  13. package/dist/chucao/{p-BaKXvAYc.js → p-DWC12BJ-.js} +2 -2
  14. package/dist/chucao/p-DWC12BJ-.js.map +1 -0
  15. package/dist/chucao/p-b678a7e2.entry.js +2 -0
  16. package/dist/chucao/p-b678a7e2.entry.js.map +1 -0
  17. package/dist/chucao/p-b8bd0310.entry.js +2 -0
  18. package/dist/chucao/p-b8bd0310.entry.js.map +1 -0
  19. package/dist/chucao/p-bb2445d1.entry.js +2 -0
  20. package/dist/chucao/p-c986036f.entry.js +2 -0
  21. package/dist/chucao/p-c986036f.entry.js.map +1 -0
  22. package/dist/chucao/p-d8DfpzMR.js +2 -0
  23. package/dist/chucao/p-d8DfpzMR.js.map +1 -0
  24. package/dist/chucao/{p-10658dc9.entry.js → p-e3265e38.entry.js} +2 -2
  25. package/dist/chucao/{p-f62e1da2.entry.js → p-ff5f5c1f.entry.js} +2 -2
  26. package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
  27. package/dist/cjs/ch-alert_8.cjs.entry.js +55 -12
  28. package/dist/cjs/ch-alert_8.cjs.entry.js.map +1 -1
  29. package/dist/cjs/ch-checkbox.cjs.entry.js +2 -2
  30. package/dist/cjs/ch-divider.cjs.entry.js +2 -2
  31. package/dist/cjs/ch-drawer.cjs.entry.js +153 -0
  32. package/dist/cjs/ch-drawer.cjs.entry.js.map +1 -0
  33. package/dist/cjs/ch-emoji.cjs.entry.js +104 -0
  34. package/dist/cjs/ch-emoji.cjs.entry.js.map +1 -0
  35. package/dist/cjs/ch-link.cjs.entry.js +1 -1
  36. package/dist/cjs/ch-modal.cjs.entry.js +5 -24
  37. package/dist/cjs/ch-modal.cjs.entry.js.map +1 -1
  38. package/dist/cjs/ch-radio.cjs.entry.js +2 -2
  39. package/dist/cjs/ch-segmented-control.cjs.entry.js +112 -0
  40. package/dist/cjs/ch-segmented-control.cjs.entry.js.map +1 -0
  41. package/dist/cjs/ch-tabs.cjs.entry.js +2 -2
  42. package/dist/cjs/ch-textarea.cjs.entry.js +2 -2
  43. package/dist/cjs/ch-tooltip.cjs.entry.js +2 -2
  44. package/dist/cjs/chucao.cjs.js +3 -3
  45. package/dist/cjs/chucao.cjs.js.map +1 -1
  46. package/dist/cjs/{index-C9Abf0td.js → index-C9cpLteP.js} +15 -8
  47. package/dist/cjs/index-C9cpLteP.js.map +1 -0
  48. package/dist/cjs/loader.cjs.js +2 -2
  49. package/dist/cjs/scroll-lock-DIRqLP4K.js +49 -0
  50. package/dist/cjs/scroll-lock-DIRqLP4K.js.map +1 -0
  51. package/dist/collection/collection-manifest.json +4 -1
  52. package/dist/collection/components/ch-button/ch-button.css +56 -18
  53. package/dist/collection/components/ch-button/ch-button.js +135 -8
  54. package/dist/collection/components/ch-button/ch-button.js.map +1 -1
  55. package/dist/collection/components/ch-card/ch-card.js +1 -1
  56. package/dist/collection/components/ch-checkbox/ch-checkbox.js +1 -1
  57. package/dist/collection/components/ch-divider/ch-divider.js +1 -1
  58. package/dist/collection/components/ch-drawer/ch-drawer.css +152 -0
  59. package/dist/collection/components/ch-drawer/ch-drawer.js +285 -0
  60. package/dist/collection/components/ch-drawer/ch-drawer.js.map +1 -0
  61. package/dist/collection/components/ch-emoji/ch-emoji.css +33 -0
  62. package/dist/collection/components/ch-emoji/ch-emoji.js +151 -0
  63. package/dist/collection/components/ch-emoji/ch-emoji.js.map +1 -0
  64. package/dist/collection/components/ch-input/ch-input.js +1 -1
  65. package/dist/collection/components/ch-modal/ch-modal.js +4 -23
  66. package/dist/collection/components/ch-modal/ch-modal.js.map +1 -1
  67. package/dist/collection/components/ch-radio/ch-radio.js +1 -1
  68. package/dist/collection/components/ch-segmented-control/ch-segmented-control.css +88 -0
  69. package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +295 -0
  70. package/dist/collection/components/ch-segmented-control/ch-segmented-control.js.map +1 -0
  71. package/dist/collection/components/ch-select/ch-select.js +1 -1
  72. package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
  73. package/dist/collection/components/ch-switch/ch-switch.js +1 -1
  74. package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
  75. package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
  76. package/dist/collection/components/ch-tooltip/ch-tooltip.js +1 -1
  77. package/dist/collection/utils/scroll-lock.js +42 -0
  78. package/dist/collection/utils/scroll-lock.js.map +1 -0
  79. package/dist/components/ch-accordion.js +1 -1
  80. package/dist/components/ch-alert.js +1 -1
  81. package/dist/components/ch-badge.js +1 -1
  82. package/dist/components/ch-button.js +1 -1
  83. package/dist/components/ch-button.js.map +1 -1
  84. package/dist/components/ch-card.js +1 -1
  85. package/dist/components/ch-checkbox.js +1 -1
  86. package/dist/components/ch-divider.js +1 -1
  87. package/dist/components/ch-drawer.d.ts +11 -0
  88. package/dist/components/ch-drawer.js +2 -0
  89. package/dist/components/ch-drawer.js.map +1 -0
  90. package/dist/components/ch-emoji.d.ts +11 -0
  91. package/dist/components/ch-emoji.js +2 -0
  92. package/dist/components/ch-emoji.js.map +1 -0
  93. package/dist/components/ch-input.js +1 -1
  94. package/dist/components/ch-link.js +1 -1
  95. package/dist/components/ch-modal.js +1 -1
  96. package/dist/components/ch-modal.js.map +1 -1
  97. package/dist/components/ch-radio.js +1 -1
  98. package/dist/components/ch-segmented-control.d.ts +11 -0
  99. package/dist/components/ch-segmented-control.js +2 -0
  100. package/dist/components/ch-segmented-control.js.map +1 -0
  101. package/dist/components/ch-select.js +1 -1
  102. package/dist/components/ch-spinner.js +1 -1
  103. package/dist/components/ch-spinner.js.map +1 -1
  104. package/dist/components/ch-switch.js +1 -1
  105. package/dist/components/ch-tabs.js +1 -1
  106. package/dist/components/ch-textarea.js +1 -1
  107. package/dist/components/ch-tooltip.js +1 -1
  108. package/dist/components/index.js +1 -1
  109. package/dist/components/{p-DL-bL54o.js → p-BhAZrOxf.js} +2 -2
  110. package/dist/components/p-BhAZrOxf.js.map +1 -0
  111. package/dist/components/p-C4eGmLcE.js +2 -0
  112. package/dist/components/p-C4eGmLcE.js.map +1 -0
  113. package/dist/components/p-d8DfpzMR.js +2 -0
  114. package/dist/components/p-d8DfpzMR.js.map +1 -0
  115. package/dist/esm/ch-accordion.entry.js +1 -1
  116. package/dist/esm/ch-alert_8.entry.js +55 -12
  117. package/dist/esm/ch-alert_8.entry.js.map +1 -1
  118. package/dist/esm/ch-checkbox.entry.js +2 -2
  119. package/dist/esm/ch-divider.entry.js +2 -2
  120. package/dist/esm/ch-drawer.entry.js +151 -0
  121. package/dist/esm/ch-drawer.entry.js.map +1 -0
  122. package/dist/esm/ch-emoji.entry.js +102 -0
  123. package/dist/esm/ch-emoji.entry.js.map +1 -0
  124. package/dist/esm/ch-link.entry.js +1 -1
  125. package/dist/esm/ch-modal.entry.js +5 -24
  126. package/dist/esm/ch-modal.entry.js.map +1 -1
  127. package/dist/esm/ch-radio.entry.js +2 -2
  128. package/dist/esm/ch-segmented-control.entry.js +110 -0
  129. package/dist/esm/ch-segmented-control.entry.js.map +1 -0
  130. package/dist/esm/ch-tabs.entry.js +2 -2
  131. package/dist/esm/ch-textarea.entry.js +2 -2
  132. package/dist/esm/ch-tooltip.entry.js +2 -2
  133. package/dist/esm/chucao.js +4 -4
  134. package/dist/esm/chucao.js.map +1 -1
  135. package/dist/esm/{index-BaKXvAYc.js → index-DWC12BJ-.js} +15 -8
  136. package/dist/esm/index-DWC12BJ-.js.map +1 -0
  137. package/dist/esm/loader.js +3 -3
  138. package/dist/esm/scroll-lock-d8DfpzMR.js +46 -0
  139. package/dist/esm/scroll-lock-d8DfpzMR.js.map +1 -0
  140. package/dist/types/components/ch-button/ch-button.d.ts +29 -5
  141. package/dist/types/components/ch-drawer/ch-drawer.d.ts +68 -0
  142. package/dist/types/components/ch-emoji/ch-emoji.d.ts +32 -0
  143. package/dist/types/components/ch-segmented-control/ch-segmented-control.d.ts +72 -0
  144. package/dist/types/components.d.ts +405 -6
  145. package/dist/types/stencil-public-runtime.d.ts +1 -0
  146. package/dist/types/utils/scroll-lock.d.ts +17 -0
  147. package/dist-react/components.d.ts +15 -1
  148. package/dist-react/components.js +30 -0
  149. package/dist-react/components.ts +43 -1
  150. package/dist-vue/index.d.ts +3 -0
  151. package/dist-vue/index.js +35 -0
  152. package/dist-vue/index.ts +41 -0
  153. package/hydrate/index.js +541 -46
  154. package/hydrate/index.mjs +541 -46
  155. package/loader/index.d.ts +1 -1
  156. package/package.json +5 -3
  157. package/dist/chucao/p-66dce533.entry.js +0 -2
  158. package/dist/chucao/p-66dce533.entry.js.map +0 -1
  159. package/dist/chucao/p-75184fe1.entry.js +0 -2
  160. package/dist/chucao/p-75184fe1.entry.js.map +0 -1
  161. package/dist/chucao/p-BaKXvAYc.js.map +0 -1
  162. package/dist/chucao/p-e48912c7.entry.js +0 -2
  163. package/dist/cjs/index-C9Abf0td.js.map +0 -1
  164. package/dist/components/p-DL-bL54o.js.map +0 -1
  165. package/dist/esm/index-BaKXvAYc.js.map +0 -1
  166. /package/dist/chucao/{p-a0ec231a.entry.js.map → p-04dbcfa0.entry.js.map} +0 -0
  167. /package/dist/chucao/{p-96c852f5.entry.js.map → p-077dc2a6.entry.js.map} +0 -0
  168. /package/dist/chucao/{p-19dde4f9.entry.js.map → p-079c2017.entry.js.map} +0 -0
  169. /package/dist/chucao/{p-f04d2f75.entry.js.map → p-5ae89a19.entry.js.map} +0 -0
  170. /package/dist/chucao/{p-2e20c7a1.entry.js.map → p-9c072600.entry.js.map} +0 -0
  171. /package/dist/chucao/{p-e48912c7.entry.js.map → p-bb2445d1.entry.js.map} +0 -0
  172. /package/dist/chucao/{p-10658dc9.entry.js.map → p-e3265e38.entry.js.map} +0 -0
  173. /package/dist/chucao/{p-f62e1da2.entry.js.map → p-ff5f5c1f.entry.js.map} +0 -0
@@ -0,0 +1,88 @@
1
+ :host {
2
+ display: inline-block;
3
+ max-width: 100%;
4
+ }
5
+
6
+ .group-label {
7
+ display: block;
8
+ margin-bottom: var(--spacing-sm);
9
+ font-size: var(--typography-size-sm);
10
+ font-weight: var(--typography-weight-semibold);
11
+ color: var(--text);
12
+ }
13
+
14
+ .segmented {
15
+ display: inline-flex;
16
+ align-items: stretch;
17
+ max-width: 100%;
18
+ padding: var(--spacing-2xs);
19
+ border: var(--border-width) solid var(--border);
20
+ border-radius: var(--radius-pill);
21
+ background: var(--surface);
22
+ }
23
+
24
+ .control {
25
+ position: relative;
26
+ display: inline-flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ border-radius: var(--radius-pill);
30
+ cursor: pointer;
31
+ transition: background-color var(--duration-normal) var(--easing-default);
32
+ }
33
+
34
+ .control:hover:not(.control--disabled) {
35
+ background: var(--surface-hover);
36
+ }
37
+
38
+ .control--disabled {
39
+ opacity: var(--opacity-disabled);
40
+ cursor: not-allowed;
41
+ }
42
+
43
+ .input {
44
+ position: absolute;
45
+ inset: 0;
46
+ margin: 0;
47
+ opacity: 0;
48
+ cursor: inherit;
49
+ }
50
+
51
+ .input:checked ~ .label-text {
52
+ background: var(--accent);
53
+ color: var(--color-accent-text);
54
+ font-weight: var(--typography-weight-semibold);
55
+ }
56
+
57
+ .input:focus-visible ~ .label-text {
58
+ outline: var(--focus-outline-width) solid var(--accent);
59
+ outline-offset: var(--focus-outline-offset);
60
+ }
61
+
62
+ .label-text {
63
+ display: block;
64
+ padding: var(--spacing-2xs) var(--spacing-3xl);
65
+ border-radius: inherit;
66
+ font-size: var(--typography-size-sm);
67
+ white-space: nowrap;
68
+ transition:
69
+ background-color var(--duration-normal) var(--easing-default),
70
+ color var(--duration-normal) var(--easing-default);
71
+ }
72
+
73
+ .segmented--sm .label-text {
74
+ padding: var(--spacing-2xs) var(--spacing-2xl);
75
+ font-size: var(--typography-size-xs);
76
+ }
77
+
78
+ :host([data-touched]:invalid) .segmented,
79
+ :host(:user-invalid) .segmented {
80
+ border-color: var(--color-status-warning);
81
+ }
82
+
83
+ @media (prefers-reduced-motion: reduce) {
84
+ .control,
85
+ .label-text {
86
+ transition: none;
87
+ }
88
+ }
@@ -0,0 +1,295 @@
1
+ import { Host, h } from "@stencil/core";
2
+ let segmentedIds = 0;
3
+ /**
4
+ * Compact control for switching between a few mutually exclusive options
5
+ * (all/in/out, movement type, and similar filters).
6
+ *
7
+ * Built on native radio inputs sharing a name inside a `role="radiogroup"`,
8
+ * so arrow-key navigation, a single tab stop, `:focus-visible` and native form
9
+ * participation come from the platform instead of hand-rolled key handling.
10
+ * It is form-associated like the other controls: inside a `<form>` the selected
11
+ * value is submitted under `name`, and `required` with an empty value is
12
+ * invalid.
13
+ *
14
+ * It differs from `ch-radio` in presentation only — segments in a joined track
15
+ * instead of a vertical list of radio marks — so it is meant for compact
16
+ * filters, not for long option lists.
17
+ */
18
+ export class ChSegmentedControl {
19
+ groupId = `ch-segmented-${++segmentedIds}`;
20
+ labelId = `${this.groupId}-label`;
21
+ initialValue;
22
+ internals;
23
+ formDisabled = false;
24
+ host;
25
+ /**
26
+ * Visible label describing the group, associated with it via
27
+ * `aria-labelledby`.
28
+ */
29
+ label;
30
+ /**
31
+ * The list of options rendered as segments.
32
+ */
33
+ options = [];
34
+ /**
35
+ * The value of the selected option.
36
+ */
37
+ value;
38
+ /**
39
+ * The size of the segments. Either `sm` or `md`.
40
+ */
41
+ size = 'md';
42
+ /**
43
+ * The name shared by all radio inputs in the group, also used to submit the
44
+ * value. Defaults to an auto-generated group name so options are mutually
45
+ * exclusive out of the box.
46
+ */
47
+ name;
48
+ /**
49
+ * Whether all segments are disabled.
50
+ */
51
+ disabled = false;
52
+ /**
53
+ * Whether a value is required.
54
+ */
55
+ required = false;
56
+ /**
57
+ * Emitted when a new option is selected, with the selected value.
58
+ */
59
+ chChange;
60
+ handleChange = (ev) => {
61
+ this.value = ev.target.value;
62
+ this.chChange.emit(this.value);
63
+ };
64
+ syncForm() {
65
+ const internals = this.internals;
66
+ if (typeof internals?.setFormValue !== 'function') {
67
+ return;
68
+ }
69
+ internals.setFormValue(this.value ?? null);
70
+ const flags = {};
71
+ if (this.required && !this.value) {
72
+ flags.valueMissing = true;
73
+ }
74
+ internals.setValidity(flags, flags.valueMissing ? 'Please fill out this field.' : undefined);
75
+ }
76
+ componentDidLoad() {
77
+ this.initialValue = this.value;
78
+ this.syncForm();
79
+ this.host.addEventListener('change', this.markTouched);
80
+ this.host.addEventListener('focusout', this.markTouched);
81
+ this.host.addEventListener('invalid', this.markTouched);
82
+ }
83
+ markTouched = () => {
84
+ this.host.setAttribute('data-touched', '');
85
+ };
86
+ formResetCallback() {
87
+ this.value = this.initialValue;
88
+ }
89
+ formDisabledCallback(isDisabled) {
90
+ this.formDisabled = isDisabled;
91
+ }
92
+ render() {
93
+ const groupName = this.name || `${this.groupId}-group`;
94
+ return (h(Host, { key: 'fd588544d9cdebaaeb1961f4ecb5c5630e8e4699' }, this.label && (h("span", { key: '58ade8d7858d6e12d71778bc07337ab485be383d', class: "group-label", id: this.labelId }, this.label)), h("div", { key: 'b872fc7e4a2dc678dbc1c9cf7c30d66ce24ebcac', class: { segmented: true, [`segmented--${this.size}`]: true }, role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, h("input", { class: "input", type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, onChange: this.handleChange }), h("span", { class: "label-text" }, option.label)))))));
95
+ }
96
+ static get is() { return "ch-segmented-control"; }
97
+ static get encapsulation() { return "shadow"; }
98
+ static get formAssociated() { return true; }
99
+ static get originalStyleUrls() {
100
+ return {
101
+ "$": ["ch-segmented-control.css"]
102
+ };
103
+ }
104
+ static get styleUrls() {
105
+ return {
106
+ "$": ["ch-segmented-control.css"]
107
+ };
108
+ }
109
+ static get properties() {
110
+ return {
111
+ "label": {
112
+ "type": "string",
113
+ "mutable": false,
114
+ "complexType": {
115
+ "original": "string",
116
+ "resolved": "string",
117
+ "references": {}
118
+ },
119
+ "required": false,
120
+ "optional": true,
121
+ "docs": {
122
+ "tags": [],
123
+ "text": "Visible label describing the group, associated with it via\n`aria-labelledby`."
124
+ },
125
+ "getter": false,
126
+ "setter": false,
127
+ "reflect": false,
128
+ "attribute": "label"
129
+ },
130
+ "options": {
131
+ "type": "unknown",
132
+ "mutable": false,
133
+ "complexType": {
134
+ "original": "ChSegmentedControlOption[]",
135
+ "resolved": "ChSegmentedControlOption[]",
136
+ "references": {
137
+ "ChSegmentedControlOption": {
138
+ "location": "local",
139
+ "path": "/home/runner/work/chucao/chucao/src/components/ch-segmented-control/ch-segmented-control.tsx",
140
+ "id": "src/components/ch-segmented-control/ch-segmented-control.tsx::ChSegmentedControlOption"
141
+ }
142
+ }
143
+ },
144
+ "required": false,
145
+ "optional": false,
146
+ "docs": {
147
+ "tags": [],
148
+ "text": "The list of options rendered as segments."
149
+ },
150
+ "getter": false,
151
+ "setter": false,
152
+ "defaultValue": "[]"
153
+ },
154
+ "value": {
155
+ "type": "string",
156
+ "mutable": true,
157
+ "complexType": {
158
+ "original": "string",
159
+ "resolved": "string",
160
+ "references": {}
161
+ },
162
+ "required": false,
163
+ "optional": true,
164
+ "docs": {
165
+ "tags": [],
166
+ "text": "The value of the selected option."
167
+ },
168
+ "getter": false,
169
+ "setter": false,
170
+ "reflect": false,
171
+ "attribute": "value"
172
+ },
173
+ "size": {
174
+ "type": "string",
175
+ "mutable": false,
176
+ "complexType": {
177
+ "original": "ChSegmentedControlSize",
178
+ "resolved": "\"md\" | \"sm\"",
179
+ "references": {
180
+ "ChSegmentedControlSize": {
181
+ "location": "local",
182
+ "path": "/home/runner/work/chucao/chucao/src/components/ch-segmented-control/ch-segmented-control.tsx",
183
+ "id": "src/components/ch-segmented-control/ch-segmented-control.tsx::ChSegmentedControlSize"
184
+ }
185
+ }
186
+ },
187
+ "required": false,
188
+ "optional": false,
189
+ "docs": {
190
+ "tags": [],
191
+ "text": "The size of the segments. Either `sm` or `md`."
192
+ },
193
+ "getter": false,
194
+ "setter": false,
195
+ "reflect": false,
196
+ "attribute": "size",
197
+ "defaultValue": "'md'"
198
+ },
199
+ "name": {
200
+ "type": "string",
201
+ "mutable": false,
202
+ "complexType": {
203
+ "original": "string",
204
+ "resolved": "string",
205
+ "references": {}
206
+ },
207
+ "required": false,
208
+ "optional": true,
209
+ "docs": {
210
+ "tags": [],
211
+ "text": "The name shared by all radio inputs in the group, also used to submit the\nvalue. Defaults to an auto-generated group name so options are mutually\nexclusive out of the box."
212
+ },
213
+ "getter": false,
214
+ "setter": false,
215
+ "reflect": true,
216
+ "attribute": "name"
217
+ },
218
+ "disabled": {
219
+ "type": "boolean",
220
+ "mutable": false,
221
+ "complexType": {
222
+ "original": "boolean",
223
+ "resolved": "boolean",
224
+ "references": {}
225
+ },
226
+ "required": false,
227
+ "optional": false,
228
+ "docs": {
229
+ "tags": [],
230
+ "text": "Whether all segments are disabled."
231
+ },
232
+ "getter": false,
233
+ "setter": false,
234
+ "reflect": true,
235
+ "attribute": "disabled",
236
+ "defaultValue": "false"
237
+ },
238
+ "required": {
239
+ "type": "boolean",
240
+ "mutable": false,
241
+ "complexType": {
242
+ "original": "boolean",
243
+ "resolved": "boolean",
244
+ "references": {}
245
+ },
246
+ "required": false,
247
+ "optional": false,
248
+ "docs": {
249
+ "tags": [],
250
+ "text": "Whether a value is required."
251
+ },
252
+ "getter": false,
253
+ "setter": false,
254
+ "reflect": true,
255
+ "attribute": "required",
256
+ "defaultValue": "false"
257
+ }
258
+ };
259
+ }
260
+ static get states() {
261
+ return {
262
+ "formDisabled": {}
263
+ };
264
+ }
265
+ static get events() {
266
+ return [{
267
+ "method": "chChange",
268
+ "name": "chChange",
269
+ "bubbles": true,
270
+ "cancelable": true,
271
+ "composed": true,
272
+ "docs": {
273
+ "tags": [],
274
+ "text": "Emitted when a new option is selected, with the selected value."
275
+ },
276
+ "complexType": {
277
+ "original": "string",
278
+ "resolved": "string",
279
+ "references": {}
280
+ }
281
+ }];
282
+ }
283
+ static get elementRef() { return "host"; }
284
+ static get watchers() {
285
+ return [{
286
+ "propName": "value",
287
+ "methodName": "syncForm"
288
+ }, {
289
+ "propName": "required",
290
+ "methodName": "syncForm"
291
+ }];
292
+ }
293
+ static get attachInternalsMemberName() { return "internals"; }
294
+ }
295
+ //# sourceMappingURL=ch-segmented-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ch-segmented-control.js","sourceRoot":"","sources":["../../../../src/components/ch-segmented-control/ch-segmented-control.tsx"],"names":[],"mappings":"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","sourcesContent":["import { AttachInternals, Component, Element, Event, type EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\nexport interface ChSegmentedControlOption {\n label: string;\n value: string;\n disabled?: boolean;\n}\n\nexport type ChSegmentedControlSize = 'sm' | 'md';\n\nlet segmentedIds = 0;\n\n/**\n * Compact control for switching between a few mutually exclusive options\n * (all/in/out, movement type, and similar filters).\n *\n * Built on native radio inputs sharing a name inside a `role=\"radiogroup\"`,\n * so arrow-key navigation, a single tab stop, `:focus-visible` and native form\n * participation come from the platform instead of hand-rolled key handling.\n * It is form-associated like the other controls: inside a `<form>` the selected\n * value is submitted under `name`, and `required` with an empty value is\n * invalid.\n *\n * It differs from `ch-radio` in presentation only — segments in a joined track\n * instead of a vertical list of radio marks — so it is meant for compact\n * filters, not for long option lists.\n */\n@Component({\n tag: 'ch-segmented-control',\n styleUrl: 'ch-segmented-control.css',\n shadow: true,\n formAssociated: true,\n})\nexport class ChSegmentedControl {\n private readonly groupId = `ch-segmented-${++segmentedIds}`;\n private readonly labelId = `${this.groupId}-label`;\n private initialValue: string | undefined;\n\n @AttachInternals() internals!: ElementInternals;\n @State() formDisabled = false;\n @Element() private host!: HTMLElement;\n\n /**\n * Visible label describing the group, associated with it via\n * `aria-labelledby`.\n */\n @Prop() label?: string;\n\n /**\n * The list of options rendered as segments.\n */\n @Prop() options: ChSegmentedControlOption[] = [];\n\n /**\n * The value of the selected option.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * The size of the segments. Either `sm` or `md`.\n */\n @Prop() size: ChSegmentedControlSize = 'md';\n\n /**\n * The name shared by all radio inputs in the group, also used to submit the\n * value. Defaults to an auto-generated group name so options are mutually\n * exclusive out of the box.\n */\n @Prop({ reflect: true }) name?: string;\n\n /**\n * Whether all segments are disabled.\n */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * Whether a value is required.\n */\n @Prop({ reflect: true }) required = false;\n\n /**\n * Emitted when a new option is selected, with the selected value.\n */\n @Event() chChange: EventEmitter<string>;\n\n private handleChange = (ev: Event) => {\n this.value = (ev.target as HTMLInputElement).value;\n this.chChange.emit(this.value);\n };\n\n @Watch('value')\n @Watch('required')\n protected syncForm(): void {\n const internals = this.internals;\n if (typeof internals?.setFormValue !== 'function') {\n return;\n }\n internals.setFormValue(this.value ?? null);\n const flags: ValidityStateFlags = {};\n if (this.required && !this.value) {\n flags.valueMissing = true;\n }\n internals.setValidity(flags, flags.valueMissing ? 'Please fill out this field.' : undefined);\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 render() {\n const groupName = this.name || `${this.groupId}-group`;\n return (\n <Host>\n {this.label && (\n <span class=\"group-label\" id={this.labelId}>\n {this.label}\n </span>\n )}\n <div class={{ segmented: true, [`segmented--${this.size}`]: true }} role=\"radiogroup\" aria-labelledby={this.label ? this.labelId : undefined}>\n {this.options.map(option => (\n <label class={{ 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled }}>\n <input\n class=\"input\"\n type=\"radio\"\n name={groupName}\n value={option.value}\n checked={option.value === this.value}\n disabled={this.disabled || this.formDisabled || option.disabled}\n onChange={this.handleChange}\n />\n <span class=\"label-text\">{option.label}</span>\n </label>\n ))}\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -101,7 +101,7 @@ export class ChSelect {
101
101
  return undefined;
102
102
  }
103
103
  render() {
104
- return (h(Host, { key: 'b3336d43945543f23e903df41eaefef23fde6ff4' }, this.label && (h("label", { key: '1928d359fce76001c24c969ccc59c5bc7c67e676', class: "label", htmlFor: this.selectId }, this.label)), h("select", { key: '7896282971021ef35d9bd3926335e02bc0efc804', id: this.label ? this.selectId : undefined, class: { 'select': true, 'select--invalid': this.invalid }, name: this.name, disabled: this.disabled || this.formDisabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }, this.placeholder && (h("option", { key: '4acfff84e5616092c6a8d0741cdf6bf959a4cfee', value: "", disabled: true, hidden: true, selected: !this.value }, this.placeholder)), this.options.map(option => (h("option", { value: option.value, disabled: option.disabled, selected: option.value === this.value }, option.label)))), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: 'cb079b5ed1a64e53b6bc3ba07f63dee0baa0f78f', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '87e730d857a4a8c44378c98759ac8ecc7cfde366', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
104
+ return (h(Host, { key: 'bf1cb02b17b6c31297e1b77e9cad6488c9fafd1c' }, this.label && (h("label", { key: '837158a8827a3f9af3a58a14c104f15919058ae0', class: "label", htmlFor: this.selectId }, this.label)), h("select", { key: '4622f105d8852a2658b917f1329c3c71c791547a', id: this.label ? this.selectId : undefined, class: { 'select': true, 'select--invalid': this.invalid }, name: this.name, disabled: this.disabled || this.formDisabled, required: this.required, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }, this.placeholder && (h("option", { key: '1d3ea13f0f9f8f0c7b3b5d0c3a5a36cb465937b2', value: "", disabled: true, hidden: true, selected: !this.value }, this.placeholder)), this.options.map(option => (h("option", { value: option.value, disabled: option.disabled, selected: option.value === this.value }, option.label)))), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: 'd73ff8034dfe5546f7f77417d73e91a0fc763321', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'fa487e405f01ae8473d442b1b94ea1cc9eb07d31', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
105
105
  }
106
106
  static get is() { return "ch-select"; }
107
107
  static get encapsulation() { return "shadow"; }
@@ -23,7 +23,7 @@ export class ChSpinner {
23
23
  label;
24
24
  render() {
25
25
  const labelled = Boolean(this.label);
26
- return (h(Host, { key: 'dc7c7e19f6a6878680555b0d7dbd84f5dc5774c8' }, h("span", { key: 'd29d5f3344ae578d2a28382b13b45b901d41e52b', class: { spinner: true, [`spinner--${this.size}`]: true }, role: labelled ? 'status' : undefined, "aria-label": labelled ? this.label : undefined, "aria-hidden": labelled ? undefined : 'true' })));
26
+ return (h(Host, { key: 'cdb44d362b4f366703c13816d7c72967e03709b1' }, h("span", { key: '5368a6f9cef9ff6eafc4ac0323e2cc01da6e627f', class: { spinner: true, [`spinner--${this.size}`]: true }, role: labelled ? 'status' : undefined, "aria-label": labelled ? this.label : undefined, "aria-hidden": labelled ? undefined : 'true' })));
27
27
  }
28
28
  static get is() { return "ch-spinner"; }
29
29
  static get encapsulation() { return "shadow"; }
@@ -97,7 +97,7 @@ export class ChSwitch {
97
97
  return undefined;
98
98
  }
99
99
  render() {
100
- return (h(Host, { key: '1f868bf2f0a95e5eb0b0013de2a1414034a0af78' }, h("label", { key: 'bfa3ff8ca66a9c367882808718b882bb1679d5fd', class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled }, htmlFor: this.switchId }, h("input", { key: '49d10196b6df781b1e76d0b33118cc21294136f4', id: this.switchId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", role: "switch", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled || this.formDisabled, required: this.required, "aria-checked": this.checked ? 'true' : 'false', "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), h("span", { key: '79948dc41567e2c52023e1c0ddd17888b4a04335', class: "track" }, h("span", { key: 'd07b297ff5edd963954e4ab2b7e678176a1823f6', class: "thumb" })), this.label && h("span", { key: '33695230dab7fc68c0dc1b06cc21b7f8bf7bb1ec', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '3be08bad4526e8c1adde62a154654079b17d6910', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '623cff85e039ecb640238d9e41fd3aa82c671ddd', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
100
+ return (h(Host, { key: '0aae2ddd370936be88af621aba79507531c9ca46' }, h("label", { key: '70a97960763688fbdcad1807468ce647c33c6601', class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled }, htmlFor: this.switchId }, h("input", { key: '6addc2227c9f8a07f9695f1c40a6cf1667a097e6', id: this.switchId, class: { 'input': true, 'input--invalid': this.invalid }, type: "checkbox", role: "switch", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled || this.formDisabled, required: this.required, "aria-checked": this.checked ? 'true' : 'false', "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), h("span", { key: '06dc52e18e506a49bf188d4d1562c73d1e2b141c', class: "track" }, h("span", { key: 'c7072be8d8a38472aa88e2f7ae1db4c79960ccda', class: "thumb" })), this.label && h("span", { key: 'b3b24e569e5d46d51600fab3546c5d4bf5aca515', class: "label-text" }, this.label)), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '0b7bb4fff74be16b96d18af71ef46b0d6dec7984', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'b8bfccb23ee16e3885508dbb23052ebc297c36de', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
101
101
  }
102
102
  static get is() { return "ch-switch"; }
103
103
  static get encapsulation() { return "shadow"; }
@@ -77,7 +77,7 @@ export class ChTabs {
77
77
  }
78
78
  render() {
79
79
  const active = this.activeValue;
80
- return (h(Host, { key: '0467e7ea24884d4c19c33b736a07303569dfaa3b' }, h("div", { key: '8ad451816ef31809c82486f3c9dd36b6e89e77e5', class: "tablist", role: "tablist", "aria-label": this.label, onKeyDown: this.handleKeyDown, ref: el => (this.tablistEl = el) }, this.tabs.map(tab => {
80
+ return (h(Host, { key: '8b0757158cca856bd984e99b86b9f1c3a79e1dfb' }, h("div", { key: 'e1ecf05df41e26787ed3702c113a393edcc6dea4', 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}` }))))));
@@ -110,7 +110,7 @@ export class ChTextarea {
110
110
  return undefined;
111
111
  }
112
112
  render() {
113
- return (h(Host, { key: 'de54ff9593c43939689cfbe2e13de538fcc7c022' }, this.label && (h("label", { key: 'bfab3a6e82c1dbb03bd8f3477e6def631eca2e26', class: "label", htmlFor: this.textareaId }, this.label)), h("textarea", { key: 'a2de483052ac7849f9f7ff61b4052d068cf7fcf6', 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: '80e2a1a36274eaff1609b60882dee02c34138687', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: 'b086d35f6579c56debdb8445aefa79ae953c8734', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
113
+ return (h(Host, { key: '35cdb2ec4cb35cb33492c4827f6f69251eea64be' }, this.label && (h("label", { key: '157579852d461707fddc660f33acd21768f7d3fe', class: "label", htmlFor: this.textareaId }, this.label)), h("textarea", { key: 'bf43052c6c66c24a906f6e4fae4256675a1b9f89', id: this.label ? this.textareaId : undefined, class: { 'textarea': true, 'textarea--invalid': this.invalid }, rows: this.rows, name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (h("p", { key: '3dcacf048dccc3474d9397f917da32b334a072fd', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (h("p", { key: '22e706a1e0b17112b39e296d267d33a1bced06ee', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
114
114
  }
115
115
  static get is() { return "ch-textarea"; }
116
116
  static get encapsulation() { return "shadow"; }
@@ -79,7 +79,7 @@ export class ChTooltip {
79
79
  trigger.setAttribute('aria-describedby', content.id);
80
80
  };
81
81
  render() {
82
- return (h(Host, { key: '654d4a12f84c94e014691e911e7c63c6c45b8755' }, h("span", { key: '726269e02fedc37efc39f1561d8b9baf83d6a4cc', class: "anchor" }, h("slot", { key: '876cb19249032d6d1c66f22bd2c255683b6a7f66', name: "trigger", onSlotchange: this.associate }), h("span", { key: '7436eb75b40b33d0b6c8ce194245d4a08a29facb', class: { 'bubble': true, [`bubble--${this.placement}`]: true, 'bubble--visible': this.visible } }, h("slot", { key: '24648cc6078d61803793df011058da9515b466b5', name: "content", onSlotchange: this.associate })))));
82
+ return (h(Host, { key: '89e1b0de9e5d2a33edba2cc0b479788694c5a202' }, h("span", { key: 'c7a31597ba6fd6a7c68cdd74cf8170d14b9e85ba', class: "anchor" }, h("slot", { key: 'eac54ebeffa8ccbfdd0c4e42e26cd4c40e81d649', name: "trigger", onSlotchange: this.associate }), h("span", { key: '326581a3f64a2165a9031818782a50de7fe05fa7', class: { 'bubble': true, [`bubble--${this.placement}`]: true, 'bubble--visible': this.visible } }, h("slot", { key: '739d4b50a611cc4db8fdc802f2f39deb68f974eb', name: "content", onSlotchange: this.associate })))));
83
83
  }
84
84
  static get is() { return "ch-tooltip"; }
85
85
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,42 @@
1
+ let openOverlays = 0;
2
+ let previousOverflow = '';
3
+ let previousPaddingRight = '';
4
+ /**
5
+ * Prevents the page behind an overlay from scrolling, compensating for the
6
+ * scrollbar it removes so the layout does not shift.
7
+ *
8
+ * Reference-counted on a module-level counter, so concurrent overlays (a modal
9
+ * over a drawer, several stacked dialogs) cannot unlock the page early:
10
+ * whichever overlay closes first only decrements the count, and the last one
11
+ * restores the original styles.
12
+ *
13
+ * Callers must pair every `lockScroll()` with exactly one `unlockScroll()`.
14
+ */
15
+ export function lockScroll() {
16
+ openOverlays += 1;
17
+ if (openOverlays > 1) {
18
+ return;
19
+ }
20
+ const root = document.documentElement;
21
+ const scrollbar = window.innerWidth - root.clientWidth;
22
+ previousOverflow = root.style.overflow;
23
+ previousPaddingRight = root.style.paddingRight;
24
+ root.style.overflow = 'hidden';
25
+ if (scrollbar > 0) {
26
+ root.style.paddingRight = `${scrollbar}px`;
27
+ }
28
+ }
29
+ /**
30
+ * Releases one scroll lock. Only the last lock restores the page; earlier calls
31
+ * are a no-op so the overlay still open keeps the page frozen.
32
+ */
33
+ export function unlockScroll() {
34
+ openOverlays -= 1;
35
+ if (openOverlays > 0) {
36
+ return;
37
+ }
38
+ const root = document.documentElement;
39
+ root.style.overflow = previousOverflow;
40
+ root.style.paddingRight = previousPaddingRight;
41
+ }
42
+ //# sourceMappingURL=scroll-lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll-lock.js","sourceRoot":"","sources":["../../../src/utils/scroll-lock.ts"],"names":[],"mappings":"AAAA,IAAI,YAAY,GAAG,CAAC,CAAC;AACrB,IAAI,gBAAgB,GAAG,EAAE,CAAC;AAC1B,IAAI,oBAAoB,GAAG,EAAE,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU;IACxB,YAAY,IAAI,CAAC,CAAC;IAClB,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe,CAAC;IACtC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;IACvD,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IACvC,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;IAC/C,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,GAAG,SAAS,IAAI,CAAC;IAC7C,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,YAAY,IAAI,CAAC,CAAC;IAClB,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe,CAAC;IACtC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,gBAAgB,CAAC;IACvC,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,oBAAoB,CAAC;AACjD,CAAC","sourcesContent":["let openOverlays = 0;\nlet previousOverflow = '';\nlet previousPaddingRight = '';\n\n/**\n * Prevents the page behind an overlay from scrolling, compensating for the\n * scrollbar it removes so the layout does not shift.\n *\n * Reference-counted on a module-level counter, so concurrent overlays (a modal\n * over a drawer, several stacked dialogs) cannot unlock the page early:\n * whichever overlay closes first only decrements the count, and the last one\n * restores the original styles.\n *\n * Callers must pair every `lockScroll()` with exactly one `unlockScroll()`.\n */\nexport function lockScroll() {\n openOverlays += 1;\n if (openOverlays > 1) {\n return;\n }\n const root = document.documentElement;\n const scrollbar = window.innerWidth - root.clientWidth;\n previousOverflow = root.style.overflow;\n previousPaddingRight = root.style.paddingRight;\n root.style.overflow = 'hidden';\n if (scrollbar > 0) {\n root.style.paddingRight = `${scrollbar}px`;\n }\n}\n\n/**\n * Releases one scroll lock. Only the last lock restores the page; earlier calls\n * are a no-op so the overlay still open keeps the page frozen.\n */\nexport function unlockScroll() {\n openOverlays -= 1;\n if (openOverlays > 0) {\n return;\n }\n const root = document.documentElement;\n root.style.overflow = previousOverflow;\n root.style.paddingRight = previousPaddingRight;\n}\n"]}
@@ -1,2 +1,2 @@
1
- import{p as e,t,H as a,c as r,h as i,d as o}from"./p-DL-bL54o.js";const s=()=>`:host{display:block}.item{background:var(--surface);border:var(--border-width) solid var(--border);border-radius:var(--radius);transition:border-color var(--duration-normal) var(--easing-default)}.item+.item{margin-top:var(--spacing-md)}.item--open{border-color:var(--border-hover)}.item-head{margin:0}.item-toggle{display:flex;align-items:center;justify-content:space-between;gap:var(--spacing-lg);width:100%;padding:var(--spacing-2xl) var(--spacing-3xl);background:transparent;border:none;color:var(--text);font-family:inherit;font-size:inherit;font-weight:var(--typography-weight-semibold);cursor:pointer}.item-toggle::after{content:'';width:var(--spacing-md);height:var(--spacing-md);flex-shrink:0;border-right:var(--border-width) solid var(--text-muted);border-bottom:var(--border-width) solid var(--text-muted);transform:rotate(45deg);transition:transform var(--duration-normal) var(--easing-default)}.item--open .item-toggle::after{transform:rotate(-135deg)}.item-toggle:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.item-toggle:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.item-panel{padding:0 var(--spacing-3xl) var(--spacing-3xl);color:var(--text-muted)}.item-panel[hidden]{display:none}`;let n=0;const d=e(class e extends a{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.chChange=r(this,"chChange")}baseId=`ch-accordion-${++n}`;items=[];value;chChange;headerId(e){return`${this.baseId}-${e}-header`}panelId(e){return`${this.baseId}-${e}-panel`}toggle=e=>{this.value=this.value===e?undefined:e;this.chChange.emit(this.value)};render(){return i(o,{key:"a0b6859c9efc45b158825f2b44aab73a5eb63f0b"},this.items.map((e=>{const t=this.value===e.value;return i("div",{key:e.value,class:{item:true,"item--open":t}},i("h3",{class:"item-head"},i("button",{type:"button",class:"item-toggle",id:this.headerId(e.value),"data-value":e.value,"aria-expanded":t?"true":"false","aria-controls":this.panelId(e.value),disabled:e.disabled,onClick:()=>this.toggle(e.value)},e.title)),i("div",{class:"item-panel",id:this.panelId(e.value),role:"region","aria-labelledby":this.headerId(e.value),hidden:!t},i("slot",{name:`panel-${e.value}`})))})))}static get style(){return s()}},[769,"ch-accordion",{items:[16],value:[1025]}]);function l(){if(typeof customElements==="undefined"){return}const e=["ch-accordion"];e.forEach((e=>{switch(e){case"ch-accordion":if(!customElements.get(t(e))){customElements.define(t(e),d)}break}}))}l();const c=d;const h=l;export{c as ChAccordion,h as defineCustomElement};
1
+ import{p as e,t,H as r,c as a,h as i,d as o}from"./p-BhAZrOxf.js";const s=()=>`:host{display:block}.item{background:var(--surface);border:var(--border-width) solid var(--border);border-radius:var(--radius);transition:border-color var(--duration-normal) var(--easing-default)}.item+.item{margin-top:var(--spacing-md)}.item--open{border-color:var(--border-hover)}.item-head{margin:0}.item-toggle{display:flex;align-items:center;justify-content:space-between;gap:var(--spacing-lg);width:100%;padding:var(--spacing-2xl) var(--spacing-3xl);background:transparent;border:none;color:var(--text);font-family:inherit;font-size:inherit;font-weight:var(--typography-weight-semibold);cursor:pointer}.item-toggle::after{content:'';width:var(--spacing-md);height:var(--spacing-md);flex-shrink:0;border-right:var(--border-width) solid var(--text-muted);border-bottom:var(--border-width) solid var(--text-muted);transform:rotate(45deg);transition:transform var(--duration-normal) var(--easing-default)}.item--open .item-toggle::after{transform:rotate(-135deg)}.item-toggle:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.item-toggle:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.item-panel{padding:0 var(--spacing-3xl) var(--spacing-3xl);color:var(--text-muted)}.item-panel[hidden]{display:none}`;let n=0;const d=e(class e extends r{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.chChange=a(this,"chChange")}baseId=`ch-accordion-${++n}`;items=[];value;chChange;headerId(e){return`${this.baseId}-${e}-header`}panelId(e){return`${this.baseId}-${e}-panel`}toggle=e=>{this.value=this.value===e?undefined:e;this.chChange.emit(this.value)};render(){return i(o,{key:"a0b6859c9efc45b158825f2b44aab73a5eb63f0b"},this.items.map((e=>{const t=this.value===e.value;return i("div",{key:e.value,class:{item:true,"item--open":t}},i("h3",{class:"item-head"},i("button",{type:"button",class:"item-toggle",id:this.headerId(e.value),"data-value":e.value,"aria-expanded":t?"true":"false","aria-controls":this.panelId(e.value),disabled:e.disabled,onClick:()=>this.toggle(e.value)},e.title)),i("div",{class:"item-panel",id:this.panelId(e.value),role:"region","aria-labelledby":this.headerId(e.value),hidden:!t},i("slot",{name:`panel-${e.value}`})))})))}static get style(){return s()}},[769,"ch-accordion",{items:[16],value:[1025]}]);function l(){if(typeof customElements==="undefined"){return}const e=["ch-accordion"];e.forEach((e=>{switch(e){case"ch-accordion":if(!customElements.get(t(e))){customElements.define(t(e),d)}break}}))}l();const c=d;const h=l;export{c as ChAccordion,h as defineCustomElement};
2
2
  //# sourceMappingURL=ch-accordion.js.map
@@ -1,2 +1,2 @@
1
- import{p as r,H as s,c as e,h as a,d as t,t as i}from"./p-DL-bL54o.js";const o=()=>`:host{display:block}.alert{display:flex;align-items:flex-start;gap:var(--spacing-2xl);padding:var(--spacing-2xl) var(--spacing-3xl);border:var(--border-width) solid transparent;border-radius:var(--radius);font-size:var(--typography-size-sm);line-height:1.5}.alert-content{flex:1;min-width:0;overflow-wrap:anywhere}.alert--default{color:var(--text);background:var(--surface);border-color:var(--border)}.alert--positive{color:var(--color-status-positive);background:var(--color-status-positive-background);border-color:var(--color-status-positive)}.alert--warning{color:var(--color-status-warning);background:var(--color-status-warning-background);border-color:var(--color-status-warning)}.alert-dismiss{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--spacing-2xs) var(--spacing-md);border:0;border-radius:var(--radius);background:none;color:inherit;cursor:pointer;font-family:var(--font-heading);font-size:var(--typography-size-lg);line-height:1;transition:background-color var(--duration-normal) var(--easing-default)}.alert-dismiss:hover{background:var(--surface-hover)}.alert-dismiss:focus-visible{outline:var(--focus-outline-width) solid currentColor;outline-offset:var(--focus-outline-offset)}@media (pointer: coarse){.alert-dismiss{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.alert-dismiss{transition:none}}`;const n=r(class r extends s{constructor(r){super();if(r!==false){this.__registerHost()}this.__attachShadow();this.chDismiss=e(this,"chDismiss")}variant="default";dismissLabel;chDismiss;handleDismiss=()=>{this.chDismiss.emit()};render(){const r=this.variant==="warning"?"alert":"status";return a(t,{key:"7d96602ad2c2b3824588f01d5b94d73098da6ce4"},a("div",{key:r,class:{alert:true,[`alert--${this.variant}`]:true},role:r},a("div",{key:"64d7af5aad0e4b103b35cc2ba3756b1a1601b148",class:"alert-content"},a("slot",{key:"44573092407161bbeafe5117bddb54168b183d90"})),this.dismissLabel&&a("button",{key:"018858ac292c0fb7f26c788f629638f533d0dfd6",class:"alert-dismiss",type:"button","aria-label":this.dismissLabel,onClick:this.handleDismiss},a("span",{key:"f6454d5285ed9c7c414d839d2d35d2ce0c271dd4","aria-hidden":"true"},"×"))))}static get style(){return o()}},[769,"ch-alert",{variant:[1],dismissLabel:[1,"dismiss-label"]}]);function d(){if(typeof customElements==="undefined"){return}const r=["ch-alert"];r.forEach((r=>{switch(r){case"ch-alert":if(!customElements.get(i(r))){customElements.define(i(r),n)}break}}))}d();const l=n;const c=d;export{l as ChAlert,c as defineCustomElement};
1
+ import{p as r,H as s,c as e,h as a,d as t,t as i}from"./p-BhAZrOxf.js";const o=()=>`:host{display:block}.alert{display:flex;align-items:flex-start;gap:var(--spacing-2xl);padding:var(--spacing-2xl) var(--spacing-3xl);border:var(--border-width) solid transparent;border-radius:var(--radius);font-size:var(--typography-size-sm);line-height:1.5}.alert-content{flex:1;min-width:0;overflow-wrap:anywhere}.alert--default{color:var(--text);background:var(--surface);border-color:var(--border)}.alert--positive{color:var(--color-status-positive);background:var(--color-status-positive-background);border-color:var(--color-status-positive)}.alert--warning{color:var(--color-status-warning);background:var(--color-status-warning-background);border-color:var(--color-status-warning)}.alert-dismiss{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:var(--spacing-2xs) var(--spacing-md);border:0;border-radius:var(--radius);background:none;color:inherit;cursor:pointer;font-family:var(--font-heading);font-size:var(--typography-size-lg);line-height:1;transition:background-color var(--duration-normal) var(--easing-default)}.alert-dismiss:hover{background:var(--surface-hover)}.alert-dismiss:focus-visible{outline:var(--focus-outline-width) solid currentColor;outline-offset:var(--focus-outline-offset)}@media (pointer: coarse){.alert-dismiss{min-width:44px;min-height:44px}}@media (prefers-reduced-motion: reduce){.alert-dismiss{transition:none}}`;const n=r(class r extends s{constructor(r){super();if(r!==false){this.__registerHost()}this.__attachShadow();this.chDismiss=e(this,"chDismiss")}variant="default";dismissLabel;chDismiss;handleDismiss=()=>{this.chDismiss.emit()};render(){const r=this.variant==="warning"?"alert":"status";return a(t,{key:"7d96602ad2c2b3824588f01d5b94d73098da6ce4"},a("div",{key:r,class:{alert:true,[`alert--${this.variant}`]:true},role:r},a("div",{key:"64d7af5aad0e4b103b35cc2ba3756b1a1601b148",class:"alert-content"},a("slot",{key:"44573092407161bbeafe5117bddb54168b183d90"})),this.dismissLabel&&a("button",{key:"018858ac292c0fb7f26c788f629638f533d0dfd6",class:"alert-dismiss",type:"button","aria-label":this.dismissLabel,onClick:this.handleDismiss},a("span",{key:"f6454d5285ed9c7c414d839d2d35d2ce0c271dd4","aria-hidden":"true"},"×"))))}static get style(){return o()}},[769,"ch-alert",{variant:[1],dismissLabel:[1,"dismiss-label"]}]);function d(){if(typeof customElements==="undefined"){return}const r=["ch-alert"];r.forEach((r=>{switch(r){case"ch-alert":if(!customElements.get(i(r))){customElements.define(i(r),n)}break}}))}d();const l=n;const c=d;export{l as ChAlert,c as defineCustomElement};
2
2
  //# sourceMappingURL=ch-alert.js.map
@@ -1,2 +1,2 @@
1
- import{p as a,H as e,h as t,d as r,t as s}from"./p-DL-bL54o.js";const o=()=>`:host{display:inline-block}.badge{display:inline-block;padding:var(--spacing-2xs) var(--spacing-lg);border-radius:var(--radius-pill);font-size:var(--typography-size-xs);font-weight:var(--typography-weight-semibold);text-transform:uppercase;letter-spacing:var(--typography-tracking-badge)}.badge--default{background:var(--color-surface-hover);color:var(--accent)}.badge--positive{background:var(--color-status-positive-background);color:var(--color-status-positive)}.badge--warning{background:var(--color-status-warning-background);color:var(--color-status-warning)}`;const c=a(class a extends e{constructor(a){super();if(a!==false){this.__registerHost()}this.__attachShadow()}variant="default";render(){return t(r,{key:"ca1fb0c9d678b6ea5b68ca131ba153116bbd577d"},t("span",{key:"929e2268094bdad7df6e3c8371896e364ebf79c3",class:{badge:true,[`badge--${this.variant}`]:true}},t("slot",{key:"64422988ad046244722755d39e564295f79a6ce1"})))}static get style(){return o()}},[769,"ch-badge",{variant:[1]}]);function n(){if(typeof customElements==="undefined"){return}const a=["ch-badge"];a.forEach((a=>{switch(a){case"ch-badge":if(!customElements.get(s(a))){customElements.define(s(a),c)}break}}))}n();const i=c;const d=n;export{i as ChBadge,d as defineCustomElement};
1
+ import{p as a,H as e,h as t,d as r,t as s}from"./p-BhAZrOxf.js";const o=()=>`:host{display:inline-block}.badge{display:inline-block;padding:var(--spacing-2xs) var(--spacing-lg);border-radius:var(--radius-pill);font-size:var(--typography-size-xs);font-weight:var(--typography-weight-semibold);text-transform:uppercase;letter-spacing:var(--typography-tracking-badge)}.badge--default{background:var(--color-surface-hover);color:var(--accent)}.badge--positive{background:var(--color-status-positive-background);color:var(--color-status-positive)}.badge--warning{background:var(--color-status-warning-background);color:var(--color-status-warning)}`;const c=a(class a extends e{constructor(a){super();if(a!==false){this.__registerHost()}this.__attachShadow()}variant="default";render(){return t(r,{key:"ca1fb0c9d678b6ea5b68ca131ba153116bbd577d"},t("span",{key:"929e2268094bdad7df6e3c8371896e364ebf79c3",class:{badge:true,[`badge--${this.variant}`]:true}},t("slot",{key:"64422988ad046244722755d39e564295f79a6ce1"})))}static get style(){return o()}},[769,"ch-badge",{variant:[1]}]);function n(){if(typeof customElements==="undefined"){return}const a=["ch-badge"];a.forEach((a=>{switch(a){case"ch-badge":if(!customElements.get(s(a))){customElements.define(s(a),c)}break}}))}n();const i=c;const d=n;export{i as ChBadge,d as defineCustomElement};
2
2
  //# sourceMappingURL=ch-badge.js.map
@@ -1,2 +1,2 @@
1
- import{p as a,H as r,c as t,h as e,d as o,t as n}from"./p-DL-bL54o.js";const i=()=>`:host{display:inline-block}.btn{display:inline-flex;align-items:center;gap:var(--spacing-sm);border:none;cursor:pointer;font-family:inherit;font-size:inherit}.btn:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.btn:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.btn--primary{background-color:var(--accent);color:var(--color-accent-text);font-weight:var(--typography-weight-bold);padding:var(--spacing-xs) var(--spacing-xl);border-radius:var(--radius-pill);transition:background-color var(--duration-normal) var(--easing-default), transform var(--duration-fast) var(--easing-default)}.btn--primary:hover{background-color:var(--accent-hover);transform:translateY(calc(-1 * var(--spacing-elevate)))}.btn--secondary{background-color:transparent;color:var(--text);font-weight:var(--typography-weight-bold);padding:var(--spacing-xs) var(--spacing-xl);border-radius:var(--radius-pill);border:var(--border-width) solid var(--border);transition:border-color var(--duration-normal) var(--easing-default), background-color var(--duration-normal) var(--easing-default), transform var(--duration-fast) var(--easing-default)}.btn--secondary:hover{border-color:var(--border-hover);background-color:var(--surface-hover);transform:translateY(calc(-1 * var(--spacing-elevate)))}`;const s=a(class a extends r{constructor(a){super();if(a!==false){this.__registerHost()}this.__attachShadow();this.chClick=t(this,"chClick")}variant="primary";disabled=false;label;chClick;handleClick=a=>{this.chClick.emit(a)};render(){return e(o,{key:"9363b49e8d38c0fab49ed10356380ded20a8cf5e"},e("button",{key:"3c98506ae1418c4bc88f5aa72dfe058948556ed5",class:{btn:true,[`btn--${this.variant}`]:true},type:"button",disabled:this.disabled,"aria-label":this.label,onClick:this.handleClick},e("slot",{key:"cdcf4f656b995fa527d4139a41b2ea3c7086e065"})))}static get style(){return i()}},[769,"ch-button",{variant:[1],disabled:[4],label:[1]}]);function c(){if(typeof customElements==="undefined"){return}const a=["ch-button"];a.forEach((a=>{switch(a){case"ch-button":if(!customElements.get(n(a))){customElements.define(n(a),s)}break}}))}c();const l=s;const d=c;export{l as ChButton,d as defineCustomElement};
1
+ import{p as r,H as t,c as a,h as e,d as n,t as s}from"./p-BhAZrOxf.js";import{d as i}from"./p-C4eGmLcE.js";const o=()=>`:host{display:inline-block}.btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--spacing-sm);box-sizing:border-box;border:var(--border-width) solid transparent;border-radius:var(--radius-pill);cursor:pointer;font-family:inherit;font-weight:var(--typography-weight-bold);text-decoration:none;line-height:1.2;transition:background-color var(--duration-normal) var(--easing-default), border-color var(--duration-normal) var(--easing-default), color var(--duration-normal) var(--easing-default), transform var(--duration-fast) var(--easing-default)}.btn--sm{padding:var(--spacing-2xs) var(--spacing-lg);font-size:var(--typography-size-sm)}.btn--md{padding:var(--spacing-xs) var(--spacing-xl);font-size:inherit}.btn--lg{padding:var(--spacing-sm) var(--spacing-2xl);font-size:var(--typography-size-lg)}.btn:disabled,.btn--disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.btn--loading:disabled,.btn--loading.btn--disabled{opacity:1;cursor:progress}.btn:focus-visible{outline:var(--focus-outline-width) solid var(--accent);outline-offset:var(--focus-outline-offset)}.btn--primary{background-color:var(--accent);color:var(--color-accent-text)}.btn--primary:hover:not(:disabled){background-color:var(--accent-hover);transform:translateY(calc(-1 * var(--spacing-elevate)))}.btn--secondary{background-color:transparent;color:var(--text);border-color:var(--border)}.btn--secondary:hover:not(:disabled){border-color:var(--border-hover);background-color:var(--surface-hover);transform:translateY(calc(-1 * var(--spacing-elevate)))}.btn--ghost{background-color:transparent;color:var(--text)}.btn--ghost:hover:not(:disabled){background-color:var(--surface-hover)}.btn--danger{background-color:var(--color-status-warning);color:var(--bg)}.btn--danger:hover:not(:disabled){filter:brightness(0.92);transform:translateY(calc(-1 * var(--spacing-elevate)))}`;const l=r(class r extends t{constructor(r){super();if(r!==false){this.__registerHost()}this.__attachShadow();this.chClick=a(this,"chClick")}variant="primary";size="md";disabled=false;loading=false;href;target;label;chClick;handleClick=r=>{if(this.disabled||this.loading){r.preventDefault();return}this.chClick.emit(r)};get spinnerSize(){return this.size==="lg"?"md":"sm"}renderContent(){return[this.loading?e("ch-spinner",{size:this.spinnerSize}):e("slot",{name:"start"}),e("slot",null),e("slot",{name:"end"})]}render(){const r={btn:true,[`btn--${this.variant}`]:true,[`btn--${this.size}`]:true,"btn--loading":this.loading};if(this.href&&!this.disabled&&!this.loading){return e(n,null,e("a",{class:r,href:this.href,target:this.target,rel:this.target==="_blank"?"noopener noreferrer":undefined,"aria-label":this.label,onClick:this.handleClick},this.renderContent()))}if(this.href){return e(n,null,e("span",{class:{...r,"btn--disabled":true},"aria-label":this.label,"aria-disabled":"true","aria-busy":this.loading?"true":undefined},this.renderContent()))}return e(n,null,e("button",{class:r,type:"button",disabled:this.disabled||this.loading,"aria-label":this.label,"aria-busy":this.loading?"true":undefined,onClick:this.handleClick},this.renderContent()))}static get style(){return o()}},[769,"ch-button",{variant:[1],size:[1],disabled:[4],loading:[4],href:[1],target:[1],label:[1]}]);function c(){if(typeof customElements==="undefined"){return}const r=["ch-button","ch-spinner"];r.forEach((r=>{switch(r){case"ch-button":if(!customElements.get(s(r))){customElements.define(s(r),l)}break;case"ch-spinner":if(!customElements.get(s(r))){i()}break}}))}c();const d=l;const b=c;export{d as ChButton,b as defineCustomElement};
2
2
  //# sourceMappingURL=ch-button.js.map