@orange-halo/components 1.0.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 (138) hide show
  1. package/custom-elements.json +186 -0
  2. package/dist/base.d.ts +30 -0
  3. package/dist/base.d.ts.map +1 -0
  4. package/dist/base.js +78 -0
  5. package/dist/base.js.map +1 -0
  6. package/dist/index.d.ts +83 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +72 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/oh-accordion.d.ts +47 -0
  11. package/dist/oh-accordion.d.ts.map +1 -0
  12. package/dist/oh-accordion.js +387 -0
  13. package/dist/oh-accordion.js.map +1 -0
  14. package/dist/oh-alert.d.ts +48 -0
  15. package/dist/oh-alert.d.ts.map +1 -0
  16. package/dist/oh-alert.js +343 -0
  17. package/dist/oh-alert.js.map +1 -0
  18. package/dist/oh-badge.d.ts +38 -0
  19. package/dist/oh-badge.d.ts.map +1 -0
  20. package/dist/oh-badge.js +176 -0
  21. package/dist/oh-badge.js.map +1 -0
  22. package/dist/oh-breadcrumb.d.ts +39 -0
  23. package/dist/oh-breadcrumb.d.ts.map +1 -0
  24. package/dist/oh-breadcrumb.js +277 -0
  25. package/dist/oh-breadcrumb.js.map +1 -0
  26. package/dist/oh-button.d.ts +62 -0
  27. package/dist/oh-button.d.ts.map +1 -0
  28. package/dist/oh-button.figma.d.ts +2 -0
  29. package/dist/oh-button.figma.d.ts.map +1 -0
  30. package/dist/oh-button.figma.js +20 -0
  31. package/dist/oh-button.figma.js.map +1 -0
  32. package/dist/oh-button.js +490 -0
  33. package/dist/oh-button.js.map +1 -0
  34. package/dist/oh-card.d.ts +44 -0
  35. package/dist/oh-card.d.ts.map +1 -0
  36. package/dist/oh-card.js +340 -0
  37. package/dist/oh-card.js.map +1 -0
  38. package/dist/oh-checkbox-group.d.ts +39 -0
  39. package/dist/oh-checkbox-group.d.ts.map +1 -0
  40. package/dist/oh-checkbox-group.figma.d.ts +2 -0
  41. package/dist/oh-checkbox-group.figma.d.ts.map +1 -0
  42. package/dist/oh-checkbox-group.figma.js +24 -0
  43. package/dist/oh-checkbox-group.figma.js.map +1 -0
  44. package/dist/oh-checkbox-group.js +309 -0
  45. package/dist/oh-checkbox-group.js.map +1 -0
  46. package/dist/oh-checkbox.d.ts +50 -0
  47. package/dist/oh-checkbox.d.ts.map +1 -0
  48. package/dist/oh-checkbox.js +315 -0
  49. package/dist/oh-checkbox.js.map +1 -0
  50. package/dist/oh-cluster.d.ts +38 -0
  51. package/dist/oh-cluster.d.ts.map +1 -0
  52. package/dist/oh-cluster.js +141 -0
  53. package/dist/oh-cluster.js.map +1 -0
  54. package/dist/oh-container.d.ts +38 -0
  55. package/dist/oh-container.d.ts.map +1 -0
  56. package/dist/oh-container.js +116 -0
  57. package/dist/oh-container.js.map +1 -0
  58. package/dist/oh-drawer.d.ts +66 -0
  59. package/dist/oh-drawer.d.ts.map +1 -0
  60. package/dist/oh-drawer.js +284 -0
  61. package/dist/oh-drawer.js.map +1 -0
  62. package/dist/oh-footer.d.ts +40 -0
  63. package/dist/oh-footer.d.ts.map +1 -0
  64. package/dist/oh-footer.js +112 -0
  65. package/dist/oh-footer.js.map +1 -0
  66. package/dist/oh-grid.d.ts +40 -0
  67. package/dist/oh-grid.d.ts.map +1 -0
  68. package/dist/oh-grid.js +168 -0
  69. package/dist/oh-grid.js.map +1 -0
  70. package/dist/oh-hero.d.ts +28 -0
  71. package/dist/oh-hero.d.ts.map +1 -0
  72. package/dist/oh-hero.js +242 -0
  73. package/dist/oh-hero.js.map +1 -0
  74. package/dist/oh-icon.d.ts +44 -0
  75. package/dist/oh-icon.d.ts.map +1 -0
  76. package/dist/oh-icon.js +321 -0
  77. package/dist/oh-icon.js.map +1 -0
  78. package/dist/oh-input.d.ts +56 -0
  79. package/dist/oh-input.d.ts.map +1 -0
  80. package/dist/oh-input.figma.d.ts +2 -0
  81. package/dist/oh-input.figma.d.ts.map +1 -0
  82. package/dist/oh-input.figma.js +36 -0
  83. package/dist/oh-input.figma.js.map +1 -0
  84. package/dist/oh-input.js +320 -0
  85. package/dist/oh-input.js.map +1 -0
  86. package/dist/oh-link.d.ts +45 -0
  87. package/dist/oh-link.d.ts.map +1 -0
  88. package/dist/oh-link.js +392 -0
  89. package/dist/oh-link.js.map +1 -0
  90. package/dist/oh-modal.d.ts +54 -0
  91. package/dist/oh-modal.d.ts.map +1 -0
  92. package/dist/oh-modal.js +450 -0
  93. package/dist/oh-modal.js.map +1 -0
  94. package/dist/oh-navbar.d.ts +49 -0
  95. package/dist/oh-navbar.d.ts.map +1 -0
  96. package/dist/oh-navbar.js +185 -0
  97. package/dist/oh-navbar.js.map +1 -0
  98. package/dist/oh-progress.d.ts +56 -0
  99. package/dist/oh-progress.d.ts.map +1 -0
  100. package/dist/oh-progress.js +299 -0
  101. package/dist/oh-progress.js.map +1 -0
  102. package/dist/oh-radio-group.d.ts +43 -0
  103. package/dist/oh-radio-group.d.ts.map +1 -0
  104. package/dist/oh-radio-group.figma.d.ts +2 -0
  105. package/dist/oh-radio-group.figma.d.ts.map +1 -0
  106. package/dist/oh-radio-group.figma.js +22 -0
  107. package/dist/oh-radio-group.figma.js.map +1 -0
  108. package/dist/oh-radio-group.js +324 -0
  109. package/dist/oh-radio-group.js.map +1 -0
  110. package/dist/oh-radio.d.ts +50 -0
  111. package/dist/oh-radio.d.ts.map +1 -0
  112. package/dist/oh-radio.js +314 -0
  113. package/dist/oh-radio.js.map +1 -0
  114. package/dist/oh-select.d.ts +82 -0
  115. package/dist/oh-select.d.ts.map +1 -0
  116. package/dist/oh-select.js +638 -0
  117. package/dist/oh-select.js.map +1 -0
  118. package/dist/oh-skip-link.d.ts +37 -0
  119. package/dist/oh-skip-link.d.ts.map +1 -0
  120. package/dist/oh-skip-link.js +145 -0
  121. package/dist/oh-skip-link.js.map +1 -0
  122. package/dist/oh-stack.d.ts +36 -0
  123. package/dist/oh-stack.d.ts.map +1 -0
  124. package/dist/oh-stack.js +112 -0
  125. package/dist/oh-stack.js.map +1 -0
  126. package/dist/oh-tabs.d.ts +85 -0
  127. package/dist/oh-tabs.d.ts.map +1 -0
  128. package/dist/oh-tabs.js +417 -0
  129. package/dist/oh-tabs.js.map +1 -0
  130. package/dist/oh-toggle.d.ts +51 -0
  131. package/dist/oh-toggle.d.ts.map +1 -0
  132. package/dist/oh-toggle.js +219 -0
  133. package/dist/oh-toggle.js.map +1 -0
  134. package/dist/styles/typography.d.ts +15 -0
  135. package/dist/styles/typography.d.ts.map +1 -0
  136. package/dist/styles/typography.js +235 -0
  137. package/dist/styles/typography.js.map +1 -0
  138. package/package.json +140 -0
@@ -0,0 +1,309 @@
1
+ /**
2
+ * oh-checkbox-group
3
+ *
4
+ * A checkbox group with proper semantics and group-level error handling.
5
+ * For single checkboxes, use oh-checkbox directly.
6
+ *
7
+ * ACCESSIBILITY:
8
+ * ─────────────
9
+ * - Uses <fieldset> and <legend> for proper semantics
10
+ * - Group-level error messaging with aria-describedby
11
+ * - Visible focus ring (outline, not inset)
12
+ * - aria-invalid for error state
13
+ *
14
+ * @element oh-checkbox-group
15
+ */
16
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
17
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
19
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
20
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
21
+ };
22
+ import { html, css, nothing } from "lit";
23
+ import { customElement, property } from "lit/decorators.js";
24
+ import { OhElement, baseStyles } from "./base.js";
25
+ let OhCheckboxGroup = class OhCheckboxGroup extends OhElement {
26
+ constructor() {
27
+ super(...arguments);
28
+ this.legend = "";
29
+ this.name = "";
30
+ this.options = [];
31
+ this.value = [];
32
+ this.required = false;
33
+ this.error = false;
34
+ this.errorMessage = "";
35
+ }
36
+ static { this.styles = [
37
+ baseStyles,
38
+ css `
39
+ :host {
40
+ display: block;
41
+ }
42
+
43
+ .checkbox-group {
44
+ display: flex;
45
+ flex-direction: column;
46
+ gap: var(--oh-spacing-2);
47
+ }
48
+
49
+ /* ═══════════════════════════════════════════════════════════════
50
+ FIELDSET & LEGEND
51
+ ═══════════════════════════════════════════════════════════════ */
52
+
53
+ fieldset {
54
+ border: none;
55
+ margin: 0;
56
+ padding: 0;
57
+ min-width: 0;
58
+ }
59
+
60
+ legend {
61
+ font-family: var(--oh-font-family-sans);
62
+ font-size: var(--oh-font-size-base);
63
+ font-weight: var(--oh-font-weight-semibold);
64
+ color: var(--oh-color-text-primary);
65
+ margin-bottom: var(--oh-spacing-2);
66
+ padding: 0;
67
+ display: block;
68
+ width: 100%;
69
+ }
70
+
71
+ legend.legend--required::after {
72
+ content: " *";
73
+ color: var(--oh-color-feedback-error);
74
+ }
75
+
76
+ /* ═══════════════════════════════════════════════════════════════
77
+ CHECKBOX OPTION
78
+ ═══════════════════════════════════════════════════════════════ */
79
+
80
+ .checkbox-option {
81
+ display: inline-flex;
82
+ align-items: center;
83
+ gap: var(--oh-spacing-3);
84
+ cursor: pointer;
85
+ position: relative;
86
+ }
87
+
88
+ .native-checkbox {
89
+ position: absolute;
90
+ width: 1px;
91
+ height: 1px;
92
+ padding: 0;
93
+ margin: -1px;
94
+ overflow: hidden;
95
+ clip: rect(0, 0, 0, 0);
96
+ white-space: nowrap;
97
+ border: 0;
98
+ }
99
+
100
+ .checkbox-box {
101
+ position: relative;
102
+ width: 24px;
103
+ height: 24px;
104
+ flex-shrink: 0;
105
+ border: var(--oh-input-base-border-width) solid var(--oh-color-border-emphasis);
106
+ border-radius: var(--oh-radius-sm);
107
+ background-color: var(--oh-color-surface-base);
108
+ box-shadow: 3px 3px 0 0 var(--oh-shadow-secondary);
109
+ transition:
110
+ transform var(--oh-motion-snappy) var(--oh-motion-ease-playful),
111
+ box-shadow var(--oh-motion-snappy) var(--oh-motion-ease-playful),
112
+ background-color var(--oh-motion-quick) ease,
113
+ border-color var(--oh-motion-quick) ease;
114
+ }
115
+
116
+ .checkbox-box::after {
117
+ content: '';
118
+ position: absolute;
119
+ top: 3px;
120
+ left: 7px;
121
+ width: 6px;
122
+ height: 12px;
123
+ border: solid var(--oh-color-text-on-brand);
124
+ border-width: 0 3px 3px 0;
125
+ transform: rotate(45deg);
126
+ opacity: 0;
127
+ transition: opacity var(--oh-motion-snappy) ease;
128
+ }
129
+
130
+ .option-label {
131
+ font-family: var(--oh-font-family-sans);
132
+ font-size: var(--oh-font-size-lg);
133
+ line-height: var(--oh-font-line-height-normal);
134
+ color: var(--oh-color-text-primary);
135
+ user-select: none;
136
+ }
137
+
138
+ /* ═══════════════════════════════════════════════════════════════
139
+ STATES
140
+ ═══════════════════════════════════════════════════════════════ */
141
+
142
+ /* Hover: lift up-left, shadow grows */
143
+ .checkbox-option:hover .checkbox-box {
144
+ border-color: var(--oh-color-border-hover);
145
+ transform: translate(-1px, -1px);
146
+ box-shadow: 4px 4px 0 0 var(--oh-shadow-secondary);
147
+ }
148
+
149
+ /* Active: press down-right, shadow shrinks */
150
+ .checkbox-option:active .checkbox-box {
151
+ transform: translate(1px, 1px);
152
+ box-shadow: 1px 1px 0 0 var(--oh-shadow-secondary);
153
+ }
154
+
155
+ /* Checked: primary color with warm shadow */
156
+ .native-checkbox:checked + .checkbox-box {
157
+ background-color: var(--oh-color-brand-primary);
158
+ border-color: var(--oh-color-brand-primary);
159
+ box-shadow: 3px 3px 0 0 var(--oh-shadow-primary);
160
+ }
161
+
162
+ .native-checkbox:checked + .checkbox-box::after {
163
+ opacity: 1;
164
+ }
165
+
166
+ /* Checked + Hover */
167
+ .checkbox-option:hover .native-checkbox:checked + .checkbox-box {
168
+ background-color: var(--oh-color-brand-primary-hover);
169
+ border-color: var(--oh-color-brand-primary-hover);
170
+ transform: translate(-1px, -1px);
171
+ box-shadow: 4px 4px 0 0 var(--oh-shadow-primary);
172
+ }
173
+
174
+ /* Checked + Active */
175
+ .checkbox-option:active .native-checkbox:checked + .checkbox-box {
176
+ background-color: var(--oh-color-brand-primary-active);
177
+ transform: translate(1px, 1px);
178
+ box-shadow: 1px 1px 0 0 var(--oh-shadow-primary);
179
+ }
180
+
181
+ /* Focus: underline the label (accessible indicator) */
182
+ .native-checkbox:focus-visible ~ .option-label {
183
+ text-decoration: underline;
184
+ text-underline-offset: var(--oh-spacing-1);
185
+ }
186
+
187
+ /* ═══════════════════════════════════════════════════════════════
188
+ ERROR STATE
189
+ ═══════════════════════════════════════════════════════════════ */
190
+
191
+ :host([error]) .checkbox-box {
192
+ border-color: var(--oh-color-feedback-error);
193
+ box-shadow: 3px 3px 0 0 var(--oh-shadow-error);
194
+ }
195
+
196
+ :host([error]) .checkbox-option:hover .checkbox-box {
197
+ border-color: var(--oh-color-feedback-error-hover);
198
+ box-shadow: 4px 4px 0 0 var(--oh-shadow-error);
199
+ }
200
+
201
+ .error-message {
202
+ display: flex;
203
+ align-items: center;
204
+ gap: var(--oh-spacing-2);
205
+ font-family: var(--oh-font-family-sans);
206
+ font-size: var(--oh-font-size-base);
207
+ color: var(--oh-color-feedback-error);
208
+ margin-bottom: var(--oh-spacing-2);
209
+ }
210
+
211
+ .error-icon {
212
+ flex-shrink: 0;
213
+ width: var(--oh-font-size-lg);
214
+ height: var(--oh-font-size-lg);
215
+ }
216
+
217
+ /* ═══════════════════════════════════════════════════════════════
218
+ REDUCED MOTION
219
+ ═══════════════════════════════════════════════════════════════ */
220
+
221
+ @media (prefers-reduced-motion: reduce) {
222
+ .checkbox-box,
223
+ .checkbox-box::after {
224
+ transition-duration: 0.01ms !important;
225
+ }
226
+ }
227
+ `,
228
+ ]; }
229
+ _handleChange(event, optionValue) {
230
+ const target = event.target;
231
+ if (target.checked) {
232
+ this.value = [...this.value, optionValue];
233
+ }
234
+ else {
235
+ this.value = this.value.filter(v => v !== optionValue);
236
+ }
237
+ this.emit("oh-change", { value: this.value });
238
+ }
239
+ render() {
240
+ return html `
241
+ <fieldset
242
+ aria-invalid=${this.error ? "true" : nothing}
243
+ aria-describedby=${this.error && this.errorMessage ? "error-msg" : nothing}
244
+ >
245
+ ${this.legend
246
+ ? html `
247
+ <legend class="${this.required ? "legend--required" : ""}">
248
+ ${this.legend}
249
+ </legend>
250
+ `
251
+ : nothing}
252
+
253
+ ${this.error && this.errorMessage
254
+ ? html `
255
+ <div id="error-msg" class="error-message" role="alert">
256
+ <svg class="error-icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
257
+ <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd" />
258
+ </svg>
259
+ ${this.errorMessage}
260
+ </div>
261
+ `
262
+ : nothing}
263
+
264
+ <div class="checkbox-group">
265
+ ${this.options.map((option) => html `
266
+ <label class="checkbox-option">
267
+ <input
268
+ type="checkbox"
269
+ class="native-checkbox"
270
+ name=${this.name}
271
+ .value=${option.value}
272
+ .checked=${this.value.includes(option.value)}
273
+ @change=${(e) => this._handleChange(e, option.value)}
274
+ />
275
+ <span class="checkbox-box"></span>
276
+ <span class="option-label">${option.label}</span>
277
+ </label>
278
+ `)}
279
+ </div>
280
+ </fieldset>
281
+ `;
282
+ }
283
+ };
284
+ __decorate([
285
+ property({ type: String })
286
+ ], OhCheckboxGroup.prototype, "legend", void 0);
287
+ __decorate([
288
+ property({ type: String })
289
+ ], OhCheckboxGroup.prototype, "name", void 0);
290
+ __decorate([
291
+ property({ type: Array })
292
+ ], OhCheckboxGroup.prototype, "options", void 0);
293
+ __decorate([
294
+ property({ type: Array })
295
+ ], OhCheckboxGroup.prototype, "value", void 0);
296
+ __decorate([
297
+ property({ type: Boolean, reflect: true })
298
+ ], OhCheckboxGroup.prototype, "required", void 0);
299
+ __decorate([
300
+ property({ type: Boolean, reflect: true })
301
+ ], OhCheckboxGroup.prototype, "error", void 0);
302
+ __decorate([
303
+ property({ type: String })
304
+ ], OhCheckboxGroup.prototype, "errorMessage", void 0);
305
+ OhCheckboxGroup = __decorate([
306
+ customElement("oh-checkbox-group")
307
+ ], OhCheckboxGroup);
308
+ export { OhCheckboxGroup };
309
+ //# sourceMappingURL=oh-checkbox-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oh-checkbox-group.js","sourceRoot":"","sources":["../src/oh-checkbox-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAS3C,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,SAAS;IAAvC;;QAoML,WAAM,GAAG,EAAE,CAAC;QAGZ,SAAI,GAAG,EAAE,CAAC;QAGV,YAAO,GAAqB,EAAE,CAAC;QAG/B,UAAK,GAAa,EAAE,CAAC;QAGrB,aAAQ,GAAG,KAAK,CAAC;QAGjB,UAAK,GAAG,KAAK,CAAC;QAGd,iBAAY,GAAG,EAAE,CAAC;IA4DpB,CAAC;aAjRiB,WAAM,GAAG;QACvB,UAAU;QACV,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6LF;KACF,AAhMqB,CAgMpB;IAuBM,aAAa,CAAC,KAAY,EAA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IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC;;;6CAGhC,MAAM,CAAC,KAAK;;aAE5C,CACF;;;KAGN,CAAC;IACJ,CAAC;;AA7ED;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACf;AAGZ;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACjB;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDACK;AAG/B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;8CACL;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAC1B;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAC7B;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDACT;AAtNP,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAkR3B"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * oh-checkbox
3
+ *
4
+ * A chunky, playful checkbox with hand-crafted feel.
5
+ * Matches the inset/pressed aesthetic of oh-input.
6
+ *
7
+ * DESIGN DECISIONS:
8
+ * ─────────────────
9
+ * 1. CHUNKY & TACTILE
10
+ * - Thick 2.5px border
11
+ * - Inset shadow when unchecked (pressed into page)
12
+ * - 6px border radius (slightly less than buttons)
13
+ *
14
+ * 2. CHECKED STATE
15
+ * - Filled with primary color
16
+ * - Custom chunky checkmark
17
+ * - Shadow shifts to feel "activated"
18
+ *
19
+ * 3. ACCESSIBILITY
20
+ * - Native checkbox hidden but accessible
21
+ * - Label always required
22
+ * - Focus ring matches input (even inner ring)
23
+ * - Minimum touch target 44px
24
+ *
25
+ * @element oh-checkbox
26
+ */
27
+ import { OhElement } from "./base.js";
28
+ export type CheckboxState = "default" | "hover" | "focus";
29
+ export declare class OhCheckbox extends OhElement {
30
+ static styles: import("lit").CSSResult[];
31
+ checked: boolean;
32
+ label: string;
33
+ name: string;
34
+ value: string;
35
+ error: boolean;
36
+ errorMessage: string;
37
+ /**
38
+ * Force a visual state (for documentation/Figma sync only)
39
+ * Values: 'hover' | 'focus'
40
+ */
41
+ forceState: CheckboxState;
42
+ private _handleChange;
43
+ render(): import("lit").TemplateResult<1>;
44
+ }
45
+ declare global {
46
+ interface HTMLElementTagNameMap {
47
+ "oh-checkbox": OhCheckbox;
48
+ }
49
+ }
50
+ //# sourceMappingURL=oh-checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oh-checkbox.d.ts","sourceRoot":"","sources":["../src/oh-checkbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1D,qBACa,UAAW,SAAQ,SAAS;IACvC,OAAgB,MAAM,4BAyMpB;IAGF,OAAO,UAAS;IAGhB,KAAK,SAAM;IAGX,IAAI,SAAM;IAGV,KAAK,SAAM;IAGX,KAAK,UAAS;IAGd,YAAY,SAAM;IAElB;;;OAGG;IAEH,UAAU,EAAE,aAAa,CAAa;IAEtC,OAAO,CAAC,aAAa;IAMrB,MAAM;CAgCP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -0,0 +1,315 @@
1
+ /**
2
+ * oh-checkbox
3
+ *
4
+ * A chunky, playful checkbox with hand-crafted feel.
5
+ * Matches the inset/pressed aesthetic of oh-input.
6
+ *
7
+ * DESIGN DECISIONS:
8
+ * ─────────────────
9
+ * 1. CHUNKY & TACTILE
10
+ * - Thick 2.5px border
11
+ * - Inset shadow when unchecked (pressed into page)
12
+ * - 6px border radius (slightly less than buttons)
13
+ *
14
+ * 2. CHECKED STATE
15
+ * - Filled with primary color
16
+ * - Custom chunky checkmark
17
+ * - Shadow shifts to feel "activated"
18
+ *
19
+ * 3. ACCESSIBILITY
20
+ * - Native checkbox hidden but accessible
21
+ * - Label always required
22
+ * - Focus ring matches input (even inner ring)
23
+ * - Minimum touch target 44px
24
+ *
25
+ * @element oh-checkbox
26
+ */
27
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
28
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
31
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
32
+ };
33
+ import { html, css } from "lit";
34
+ import { customElement, property } from "lit/decorators.js";
35
+ import { OhElement, baseStyles } from "./base.js";
36
+ let OhCheckbox = class OhCheckbox extends OhElement {
37
+ constructor() {
38
+ super(...arguments);
39
+ this.checked = false;
40
+ this.label = "";
41
+ this.name = "";
42
+ this.value = "";
43
+ this.error = false;
44
+ this.errorMessage = "";
45
+ /**
46
+ * Force a visual state (for documentation/Figma sync only)
47
+ * Values: 'hover' | 'focus'
48
+ */
49
+ this.forceState = "default";
50
+ }
51
+ static { this.styles = [
52
+ baseStyles,
53
+ css `
54
+ /* ═══════════════════════════════════════════════════════════════
55
+ ORANGE HALO CHECKBOX
56
+ Chunky • Tactile • Playful
57
+ ═══════════════════════════════════════════════════════════════ */
58
+
59
+ :host {
60
+ display: inline-block;
61
+ }
62
+
63
+ .checkbox-wrapper {
64
+ display: inline-flex;
65
+ align-items: flex-start;
66
+ gap: var(--oh-spacing-3);
67
+ cursor: pointer;
68
+ }
69
+
70
+ /* Hide native checkbox but keep it accessible */
71
+ .native-checkbox {
72
+ position: absolute;
73
+ width: 1px;
74
+ height: 1px;
75
+ padding: 0;
76
+ margin: -1px;
77
+ overflow: hidden;
78
+ clip: rect(0, 0, 0, 0);
79
+ white-space: nowrap;
80
+ border: 0;
81
+ }
82
+
83
+ /* ═══════════════════════════════════════════════════════════════
84
+ CUSTOM CHECKBOX BOX
85
+ ═══════════════════════════════════════════════════════════════ */
86
+
87
+ .checkbox-box {
88
+ position: relative;
89
+ width: 24px;
90
+ height: 24px;
91
+ flex-shrink: 0;
92
+
93
+ /* Chunky border */
94
+ border: var(--oh-input-base-border-width) solid var(--oh-color-border-emphasis);
95
+ border-radius: var(--oh-radius-sm);
96
+
97
+ /* Offset shadow like primary button */
98
+ background-color: var(--oh-color-surface-base);
99
+ box-shadow: 3px 3px 0 0 var(--oh-shadow-secondary);
100
+
101
+ transition:
102
+ transform var(--oh-motion-snappy) var(--oh-motion-ease-playful),
103
+ box-shadow var(--oh-motion-snappy) var(--oh-motion-ease-playful),
104
+ background-color var(--oh-motion-quick) ease,
105
+ border-color var(--oh-motion-quick) ease;
106
+ }
107
+
108
+ /* Checkmark (hidden by default) */
109
+ .checkbox-box::after {
110
+ content: '';
111
+ position: absolute;
112
+ top: 3px;
113
+ left: 7px;
114
+ width: 6px;
115
+ height: 12px;
116
+ border: solid var(--oh-color-text-on-brand);
117
+ border-width: 0 3px 3px 0;
118
+ transform: rotate(45deg);
119
+ opacity: 0;
120
+ transition: opacity var(--oh-motion-snappy) ease;
121
+ }
122
+
123
+ /* ═══════════════════════════════════════════════════════════════
124
+ STATES
125
+ ═══════════════════════════════════════════════════════════════ */
126
+
127
+ /* Hover: lift up-left, shadow grows */
128
+ .checkbox-wrapper:hover .checkbox-box {
129
+ border-color: var(--oh-color-border-hover);
130
+ transform: translate(-1px, -1px);
131
+ box-shadow: 4px 4px 0 0 var(--oh-shadow-secondary);
132
+ }
133
+
134
+ /* Active: press down-right, shadow shrinks */
135
+ .checkbox-wrapper:active .checkbox-box {
136
+ transform: translate(1px, 1px);
137
+ box-shadow: 1px 1px 0 0 var(--oh-shadow-secondary);
138
+ }
139
+
140
+ /* Checked: primary color with warm shadow */
141
+ .native-checkbox:checked + .checkbox-box {
142
+ background-color: var(--oh-color-brand-primary);
143
+ border-color: var(--oh-color-brand-primary);
144
+ box-shadow: 3px 3px 0 0 var(--oh-shadow-primary);
145
+ }
146
+
147
+ .native-checkbox:checked + .checkbox-box::after {
148
+ opacity: 1;
149
+ }
150
+
151
+ /* Checked + Hover */
152
+ .checkbox-wrapper:hover .native-checkbox:checked + .checkbox-box {
153
+ background-color: var(--oh-color-brand-primary-hover);
154
+ border-color: var(--oh-color-brand-primary-hover);
155
+ transform: translate(-1px, -1px);
156
+ box-shadow: 4px 4px 0 0 var(--oh-shadow-primary);
157
+ }
158
+
159
+ /* Checked + Active */
160
+ .checkbox-wrapper:active .native-checkbox:checked + .checkbox-box {
161
+ background-color: var(--oh-color-brand-primary-active);
162
+ transform: translate(1px, 1px);
163
+ box-shadow: 1px 1px 0 0 var(--oh-shadow-primary);
164
+ }
165
+
166
+ /* Focus: underline the label (accessible indicator) */
167
+ .native-checkbox:focus-visible ~ .label {
168
+ text-decoration: underline;
169
+ text-underline-offset: var(--oh-spacing-1);
170
+ }
171
+
172
+ /* ═══════════════════════════════════════════════════════════════
173
+ LABEL
174
+ ═══════════════════════════════════════════════════════════════ */
175
+
176
+ .label {
177
+ font-family: var(--oh-font-family-sans);
178
+ font-size: var(--oh-font-size-lg);
179
+ line-height: var(--oh-font-line-height-normal);
180
+ color: var(--oh-color-text-primary);
181
+ user-select: none;
182
+ padding-top: 0; /* Align with checkbox */
183
+ }
184
+
185
+ /* ═══════════════════════════════════════════════════════════════
186
+ ERROR STATE
187
+ ═══════════════════════════════════════════════════════════════ */
188
+
189
+ :host([error]) .checkbox-box {
190
+ border-color: var(--oh-color-feedback-error);
191
+ box-shadow: 3px 3px 0 0 var(--oh-shadow-error);
192
+ }
193
+
194
+ :host([error]) .checkbox-wrapper:hover .checkbox-box {
195
+ border-color: var(--oh-color-feedback-error-hover);
196
+ box-shadow: 4px 4px 0 0 var(--oh-shadow-error);
197
+ }
198
+
199
+ .error-message {
200
+ display: flex;
201
+ align-items: center;
202
+ gap: var(--oh-spacing-2);
203
+ font-family: var(--oh-font-family-sans);
204
+ font-size: var(--oh-font-size-base);
205
+ color: var(--oh-color-feedback-error);
206
+ margin-top: var(--oh-spacing-1);
207
+ margin-left: calc(24px + var(--oh-spacing-3)); /* Align with label */
208
+ }
209
+
210
+ .error-icon {
211
+ flex-shrink: 0;
212
+ width: var(--oh-spacing-4);
213
+ height: var(--oh-spacing-4);
214
+ }
215
+
216
+ /* ═══════════════════════════════════════════════════════════════
217
+ REDUCED MOTION
218
+ ═══════════════════════════════════════════════════════════════ */
219
+
220
+ @media (prefers-reduced-motion: reduce) {
221
+ .checkbox-box,
222
+ .checkbox-box::after {
223
+ transition-duration: 0.01ms !important;
224
+ }
225
+ }
226
+
227
+ /* ═══════════════════════════════════════════════════════════════
228
+ FORCED STATES (for Figma Sync / documentation)
229
+ ═══════════════════════════════════════════════════════════════ */
230
+
231
+ /* Forced Hover - Unchecked */
232
+ :host([force-state="hover"]) .checkbox-box {
233
+ border-color: var(--oh-color-border-hover);
234
+ transform: translate(-1px, -1px);
235
+ box-shadow: 4px 4px 0 0 var(--oh-shadow-secondary);
236
+ }
237
+
238
+ /* Forced Focus - Unchecked */
239
+ :host([force-state="focus"]) .label {
240
+ text-decoration: underline;
241
+ text-underline-offset: var(--oh-spacing-1);
242
+ }
243
+
244
+ /* Forced Hover - Checked */
245
+ :host([force-state="hover"][checked]) .checkbox-box {
246
+ background-color: var(--oh-color-brand-primary-hover);
247
+ border-color: var(--oh-color-brand-primary-hover);
248
+ transform: translate(-1px, -1px);
249
+ box-shadow: 4px 4px 0 0 var(--oh-shadow-primary);
250
+ }
251
+ `,
252
+ ]; }
253
+ _handleChange(event) {
254
+ const target = event.target;
255
+ this.checked = target.checked;
256
+ this.emit("oh-change", { checked: this.checked, value: this.value });
257
+ }
258
+ render() {
259
+ const inputId = this.name || `oh-checkbox-${Math.random().toString(36).substr(2, 9)}`;
260
+ return html `
261
+ <div>
262
+ <label class="checkbox-wrapper" for=${inputId}>
263
+ <input
264
+ type="checkbox"
265
+ class="native-checkbox"
266
+ id=${inputId}
267
+ name=${this.name}
268
+ .value=${this.value}
269
+ .checked=${this.checked}
270
+ aria-invalid=${this.error ? "true" : "false"}
271
+ @change=${this._handleChange}
272
+ />
273
+ <span class="checkbox-box" part="box"></span>
274
+ <span class="label" part="label">${this.label}</span>
275
+ </label>
276
+ ${this.error && this.errorMessage
277
+ ? html `
278
+ <div class="error-message" part="error" role="alert">
279
+ <svg class="error-icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
280
+ <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd" />
281
+ </svg>
282
+ ${this.errorMessage}
283
+ </div>
284
+ `
285
+ : ""}
286
+ </div>
287
+ `;
288
+ }
289
+ };
290
+ __decorate([
291
+ property({ type: Boolean, reflect: true })
292
+ ], OhCheckbox.prototype, "checked", void 0);
293
+ __decorate([
294
+ property({ type: String })
295
+ ], OhCheckbox.prototype, "label", void 0);
296
+ __decorate([
297
+ property({ type: String })
298
+ ], OhCheckbox.prototype, "name", void 0);
299
+ __decorate([
300
+ property({ type: String })
301
+ ], OhCheckbox.prototype, "value", void 0);
302
+ __decorate([
303
+ property({ type: Boolean, reflect: true })
304
+ ], OhCheckbox.prototype, "error", void 0);
305
+ __decorate([
306
+ property({ type: String })
307
+ ], OhCheckbox.prototype, "errorMessage", void 0);
308
+ __decorate([
309
+ property({ type: String, reflect: true, attribute: "force-state" })
310
+ ], OhCheckbox.prototype, "forceState", void 0);
311
+ OhCheckbox = __decorate([
312
+ customElement("oh-checkbox")
313
+ ], OhCheckbox);
314
+ export { OhCheckbox };
315
+ //# sourceMappingURL=oh-checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oh-checkbox.js","sourceRoot":"","sources":["../src/oh-checkbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;;;;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAK3C,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,SAAS;IAAlC;;QA6ML,YAAO,GAAG,KAAK,CAAC;QAGhB,UAAK,GAAG,EAAE,CAAC;QAGX,SAAI,GAAG,EAAE,CAAC;QAGV,UAAK,GAAG,EAAE,CAAC;QAGX,UAAK,GAAG,KAAK,CAAC;QAGd,iBAAY,GAAG,EAAE,CAAC;QAElB;;;WAGG;QAEH,eAAU,GAAkB,SAAS,CAAC;IAwCxC,CAAC;aA1QiB,WAAM,GAAG;QACvB,UAAU;QACV,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsMF;KACF,AAzMqB,CAyMpB;IA2BM,aAAa,CAAC,KAAY;QAChC,MAAM,MAAM,GAAG,KAAK,CAAC,MAA0B,CAAC;QAChD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,E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