@orange-halo/components 2.2.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +565 -328
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +7 -0
- package/dist/base.js.map +1 -1
- package/dist/index.d.ts +2 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/oh-accordion.d.ts +53 -8
- package/dist/oh-accordion.d.ts.map +1 -1
- package/dist/oh-accordion.js +83 -21
- package/dist/oh-accordion.js.map +1 -1
- package/dist/oh-alert.d.ts +26 -8
- package/dist/oh-alert.d.ts.map +1 -1
- package/dist/oh-alert.js +32 -14
- package/dist/oh-alert.js.map +1 -1
- package/dist/oh-badge.d.ts +32 -13
- package/dist/oh-badge.d.ts.map +1 -1
- package/dist/oh-badge.js +35 -16
- package/dist/oh-badge.js.map +1 -1
- package/dist/oh-breadcrumb.d.ts +39 -12
- package/dist/oh-breadcrumb.d.ts.map +1 -1
- package/dist/oh-breadcrumb.js +43 -21
- package/dist/oh-breadcrumb.js.map +1 -1
- package/dist/oh-button.d.ts +50 -24
- package/dist/oh-button.d.ts.map +1 -1
- package/dist/oh-button.js +66 -47
- package/dist/oh-button.js.map +1 -1
- package/dist/oh-card.d.ts +47 -19
- package/dist/oh-card.d.ts.map +1 -1
- package/dist/oh-card.js +110 -82
- package/dist/oh-card.js.map +1 -1
- package/dist/oh-checkbox-group.d.ts +56 -12
- package/dist/oh-checkbox-group.d.ts.map +1 -1
- package/dist/oh-checkbox-group.js +87 -45
- package/dist/oh-checkbox-group.js.map +1 -1
- package/dist/oh-checkbox.d.ts +55 -18
- package/dist/oh-checkbox.d.ts.map +1 -1
- package/dist/oh-checkbox.js +91 -59
- package/dist/oh-checkbox.js.map +1 -1
- package/dist/oh-cluster.d.ts +19 -14
- package/dist/oh-cluster.d.ts.map +1 -1
- package/dist/oh-cluster.js +19 -19
- package/dist/oh-cluster.js.map +1 -1
- package/dist/oh-container.d.ts +19 -16
- package/dist/oh-container.d.ts.map +1 -1
- package/dist/oh-container.js +26 -33
- package/dist/oh-container.js.map +1 -1
- package/dist/oh-drawer.d.ts +36 -14
- package/dist/oh-drawer.d.ts.map +1 -1
- package/dist/oh-drawer.js +57 -26
- package/dist/oh-drawer.js.map +1 -1
- package/dist/oh-footer.d.ts +37 -18
- package/dist/oh-footer.d.ts.map +1 -1
- package/dist/oh-footer.js +38 -19
- package/dist/oh-footer.js.map +1 -1
- package/dist/oh-grid.d.ts +27 -14
- package/dist/oh-grid.d.ts.map +1 -1
- package/dist/oh-grid.js +27 -19
- package/dist/oh-grid.js.map +1 -1
- package/dist/oh-icon.d.ts +21 -5
- package/dist/oh-icon.d.ts.map +1 -1
- package/dist/oh-icon.js +28 -5
- package/dist/oh-icon.js.map +1 -1
- package/dist/oh-input.d.ts +105 -21
- package/dist/oh-input.d.ts.map +1 -1
- package/dist/oh-input.js +207 -68
- package/dist/oh-input.js.map +1 -1
- package/dist/oh-link.d.ts +42 -19
- package/dist/oh-link.d.ts.map +1 -1
- package/dist/oh-link.js +56 -34
- package/dist/oh-link.js.map +1 -1
- package/dist/oh-modal.d.ts +29 -6
- package/dist/oh-modal.d.ts.map +1 -1
- package/dist/oh-modal.js +37 -16
- package/dist/oh-modal.js.map +1 -1
- package/dist/oh-navbar.d.ts +42 -19
- package/dist/oh-navbar.d.ts.map +1 -1
- package/dist/oh-navbar.js +44 -21
- package/dist/oh-navbar.js.map +1 -1
- package/dist/oh-progress.d.ts +26 -7
- package/dist/oh-progress.d.ts.map +1 -1
- package/dist/oh-progress.js +32 -13
- package/dist/oh-progress.js.map +1 -1
- package/dist/oh-radio-group.d.ts +55 -13
- package/dist/oh-radio-group.d.ts.map +1 -1
- package/dist/oh-radio-group.js +84 -44
- package/dist/oh-radio-group.js.map +1 -1
- package/dist/oh-radio.d.ts +56 -18
- package/dist/oh-radio.d.ts.map +1 -1
- package/dist/oh-radio.js +93 -60
- package/dist/oh-radio.js.map +1 -1
- package/dist/oh-select.d.ts +58 -16
- package/dist/oh-select.d.ts.map +1 -1
- package/dist/oh-select.js +72 -36
- package/dist/oh-select.js.map +1 -1
- package/dist/oh-skip-link.d.ts +33 -15
- package/dist/oh-skip-link.d.ts.map +1 -1
- package/dist/oh-skip-link.js +39 -26
- package/dist/oh-skip-link.js.map +1 -1
- package/dist/oh-stack.d.ts +17 -14
- package/dist/oh-stack.d.ts.map +1 -1
- package/dist/oh-stack.js +18 -20
- package/dist/oh-stack.js.map +1 -1
- package/dist/oh-tabs.d.ts +56 -30
- package/dist/oh-tabs.d.ts.map +1 -1
- package/dist/oh-tabs.js +89 -70
- package/dist/oh-tabs.js.map +1 -1
- package/dist/oh-textarea.d.ts +37 -6
- package/dist/oh-textarea.d.ts.map +1 -1
- package/dist/oh-textarea.js +40 -9
- package/dist/oh-textarea.js.map +1 -1
- package/dist/oh-toggle.d.ts +45 -12
- package/dist/oh-toggle.d.ts.map +1 -1
- package/dist/oh-toggle.js +68 -33
- package/dist/oh-toggle.js.map +1 -1
- package/dist/styles/typography.d.ts.map +1 -1
- package/dist/styles/typography.js +1 -2
- package/dist/styles/typography.js.map +1 -1
- package/package.json +3 -7
- package/dist/oh-button.figma.d.ts +0 -2
- package/dist/oh-button.figma.d.ts.map +0 -1
- package/dist/oh-button.figma.js +0 -18
- package/dist/oh-button.figma.js.map +0 -1
- package/dist/oh-checkbox-group.figma.d.ts +0 -2
- package/dist/oh-checkbox-group.figma.d.ts.map +0 -1
- package/dist/oh-checkbox-group.figma.js +0 -24
- package/dist/oh-checkbox-group.figma.js.map +0 -1
- package/dist/oh-hero.d.ts +0 -33
- package/dist/oh-hero.d.ts.map +0 -1
- package/dist/oh-hero.js +0 -248
- package/dist/oh-hero.js.map +0 -1
- package/dist/oh-input.figma.d.ts +0 -2
- package/dist/oh-input.figma.d.ts.map +0 -1
- package/dist/oh-input.figma.js +0 -36
- package/dist/oh-input.figma.js.map +0 -1
- package/dist/oh-radio-group.figma.d.ts +0 -2
- package/dist/oh-radio-group.figma.d.ts.map +0 -1
- package/dist/oh-radio-group.figma.js +0 -22
- package/dist/oh-radio-group.figma.js.map +0 -1
package/dist/oh-checkbox.js
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-checkbox
|
|
3
3
|
*
|
|
4
|
-
* A chunky, playful checkbox with hand-crafted feel.
|
|
5
|
-
* Matches the inset/pressed aesthetic of oh-input.
|
|
6
|
-
*
|
|
7
4
|
* DESIGN DECISIONS:
|
|
8
5
|
* ─────────────────
|
|
9
|
-
* 1.
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
6
|
+
* 1. LOOK FROM TOKENS
|
|
7
|
+
* - Border: stroke.control in color.border.emphasis
|
|
8
|
+
* - Corners: shape.compact (smaller than the other controls' shape.control)
|
|
9
|
+
* - Shadow: offset by elevation.offset.* in elevation.color.secondary; hover and
|
|
10
|
+
* press move the box by lift.hoverSm / lift.pressSm
|
|
13
11
|
*
|
|
14
12
|
* 2. CHECKED STATE
|
|
15
|
-
* - Filled with primary color
|
|
16
|
-
*
|
|
17
|
-
* - Shadow shifts to feel "activated"
|
|
13
|
+
* - Filled with color.brand.primary, a checkmark in color.text.onBrand,
|
|
14
|
+
* and the shadow in elevation.color.primary
|
|
18
15
|
*
|
|
19
16
|
* 3. ACCESSIBILITY
|
|
20
|
-
* -
|
|
17
|
+
* - A native checkbox, visually hidden but focusable and announced; the
|
|
18
|
+
* drawn box is decoration
|
|
21
19
|
* - Label always required
|
|
22
|
-
* - Focus
|
|
23
|
-
* - Minimum touch target 44px
|
|
24
|
-
*
|
|
25
|
-
* @element oh-checkbox
|
|
20
|
+
* - Focus underlines the label (a solid indicator)
|
|
26
21
|
*/
|
|
27
22
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
28
23
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -33,6 +28,44 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
33
28
|
import { html, css, nothing } from "lit";
|
|
34
29
|
import { customElement, property, state } from "lit/decorators.js";
|
|
35
30
|
import { OhElement, baseStyles } from "./base.js";
|
|
31
|
+
/**
|
|
32
|
+
* A single checkbox with its label, for turning one option on or off.
|
|
33
|
+
*
|
|
34
|
+
* **Use it for** one yes/no choice, such as agreeing to terms, or as part of
|
|
35
|
+
* a set where any number can be chosen. **Don't use it for** a set of
|
|
36
|
+
* related options on its own (use `oh-checkbox-group`, which adds the
|
|
37
|
+
* fieldset and legend), one choice from several (use `oh-radio-group`), or a
|
|
38
|
+
* setting that applies straight away (use `oh-toggle`).
|
|
39
|
+
*
|
|
40
|
+
* **States:** unchecked, checked, hover, active, focus, error (set `error-text`).
|
|
41
|
+
*
|
|
42
|
+
* **Behaviour:** clicking the box or the label toggles it, as does Space
|
|
43
|
+
* when it's focused. Each change sets `checked` and fires `oh-change`. The
|
|
44
|
+
* native `<input type="checkbox">` sits in the shadow root, so it doesn't
|
|
45
|
+
* submit with a native form: read `checked` or listen for `oh-change`. It
|
|
46
|
+
* has no `disabled` property.
|
|
47
|
+
*
|
|
48
|
+
* **Accessibility:** a real native checkbox, visually hidden, carries the
|
|
49
|
+
* role, state and keyboard behaviour; the drawn box is decoration. Always
|
|
50
|
+
* set `label`: it's the checkbox's name. Focus underlines the label. The
|
|
51
|
+
* error message shows under the checkbox with an icon, sets `aria-invalid`
|
|
52
|
+
* and is linked with `aria-describedby`; it's announced (`role="alert"`)
|
|
53
|
+
* only when it appears after first render.
|
|
54
|
+
*
|
|
55
|
+
* **Look:** set by tokens — `stroke.control` in `color.border.emphasis`
|
|
56
|
+
* (border), `shape.compact` (corners), `typography.control.*` (label),
|
|
57
|
+
* `elevation.offset.*` and `elevation.color.secondary` (shadow), `lift.hoverSm` /
|
|
58
|
+
* `lift.pressSm` (movement on hover and press), `color.border.hover`
|
|
59
|
+
* (hover), `color.brand.primary` (and its hover and active tokens),
|
|
60
|
+
* `color.text.onBrand` and `elevation.color.primary` (checked),
|
|
61
|
+
* `color.feedback.error` and `elevation.color.error` (error).
|
|
62
|
+
*
|
|
63
|
+
* @element oh-checkbox
|
|
64
|
+
* @fires oh-change - The checkbox was toggled. detail: { checked, value }
|
|
65
|
+
* @csspart box - The drawn checkbox
|
|
66
|
+
* @csspart label - The label text
|
|
67
|
+
* @csspart error - The error message
|
|
68
|
+
*/
|
|
36
69
|
let OhCheckbox = class OhCheckbox extends OhElement {
|
|
37
70
|
constructor() {
|
|
38
71
|
super(...arguments);
|
|
@@ -40,10 +73,13 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
40
73
|
this.label = "";
|
|
41
74
|
this.name = "";
|
|
42
75
|
this.value = "";
|
|
43
|
-
this.error = false;
|
|
44
|
-
this.errorMessage = "";
|
|
45
76
|
/**
|
|
46
|
-
*
|
|
77
|
+
* Error shown with the control and linked to it. Setting it puts the
|
|
78
|
+
* control in its error state; clear it to leave that state.
|
|
79
|
+
*/
|
|
80
|
+
this.errorText = "";
|
|
81
|
+
/**
|
|
82
|
+
* Force a visual state (for documentation only)
|
|
47
83
|
* Values: 'hover' | 'focus'
|
|
48
84
|
*/
|
|
49
85
|
this.forceState = "default";
|
|
@@ -58,11 +94,6 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
58
94
|
static { this.styles = [
|
|
59
95
|
baseStyles,
|
|
60
96
|
css `
|
|
61
|
-
/* ═══════════════════════════════════════════════════════════════
|
|
62
|
-
ORANGE HALO CHECKBOX
|
|
63
|
-
Chunky • Tactile • Playful
|
|
64
|
-
═══════════════════════════════════════════════════════════════ */
|
|
65
|
-
|
|
66
97
|
:host {
|
|
67
98
|
display: inline-block;
|
|
68
99
|
}
|
|
@@ -97,18 +128,18 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
97
128
|
height: 24px;
|
|
98
129
|
flex-shrink: 0;
|
|
99
130
|
|
|
100
|
-
/*
|
|
131
|
+
/* Border: stroke.control in color.border.emphasis */
|
|
101
132
|
border: var(--oh-stroke-control) solid var(--oh-color-border-emphasis);
|
|
102
133
|
border-radius: var(--oh-shape-compact);
|
|
103
134
|
|
|
104
|
-
/* Offset shadow
|
|
135
|
+
/* Offset shadow: elevation.offset.md in elevation.color.secondary */
|
|
105
136
|
background-color: var(--oh-color-surface-base);
|
|
106
137
|
box-shadow: var(--oh-elevation-offset-md) var(--oh-elevation-offset-md)
|
|
107
|
-
0 0 var(--oh-
|
|
138
|
+
0 0 var(--oh-elevation-color-secondary);
|
|
108
139
|
|
|
109
140
|
transition:
|
|
110
|
-
transform var(--oh-motion-snappy) var(--oh-motion-ease-
|
|
111
|
-
box-shadow var(--oh-motion-snappy) var(--oh-motion-ease-
|
|
141
|
+
transform var(--oh-motion-snappy) var(--oh-motion-ease-emphasized),
|
|
142
|
+
box-shadow var(--oh-motion-snappy) var(--oh-motion-ease-emphasized),
|
|
112
143
|
background-color var(--oh-motion-quick) ease,
|
|
113
144
|
border-color var(--oh-motion-quick) ease;
|
|
114
145
|
}
|
|
@@ -118,7 +149,7 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
118
149
|
content: "";
|
|
119
150
|
position: absolute;
|
|
120
151
|
top: 3px;
|
|
121
|
-
left: 7px;
|
|
152
|
+
left: 7px; /* physical: a checkmark isn't mirrored in RTL */
|
|
122
153
|
width: 6px;
|
|
123
154
|
height: 12px;
|
|
124
155
|
border: solid var(--oh-color-text-on-brand);
|
|
@@ -132,27 +163,27 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
132
163
|
STATES
|
|
133
164
|
═══════════════════════════════════════════════════════════════ */
|
|
134
165
|
|
|
135
|
-
/* Hover: lift
|
|
166
|
+
/* Hover: moves by lift.hoverSm; shadow offset elevation.offset.lg */
|
|
136
167
|
.checkbox-wrapper:hover .checkbox-box {
|
|
137
168
|
border-color: var(--oh-color-border-hover);
|
|
138
169
|
transform: translate(var(--oh-lift-hover-sm), var(--oh-lift-hover-sm));
|
|
139
170
|
box-shadow: var(--oh-elevation-offset-lg) var(--oh-elevation-offset-lg)
|
|
140
|
-
0 0 var(--oh-
|
|
171
|
+
0 0 var(--oh-elevation-color-secondary);
|
|
141
172
|
}
|
|
142
173
|
|
|
143
|
-
/* Active:
|
|
174
|
+
/* Active: moves by lift.pressSm; shadow offset elevation.offset.xs */
|
|
144
175
|
.checkbox-wrapper:active .checkbox-box {
|
|
145
176
|
transform: translate(var(--oh-lift-press-sm), var(--oh-lift-press-sm));
|
|
146
177
|
box-shadow: var(--oh-elevation-offset-xs) var(--oh-elevation-offset-xs)
|
|
147
|
-
0 0 var(--oh-
|
|
178
|
+
0 0 var(--oh-elevation-color-secondary);
|
|
148
179
|
}
|
|
149
180
|
|
|
150
|
-
/* Checked: primary color
|
|
181
|
+
/* Checked: color.brand.primary fill, elevation.color.primary shadow */
|
|
151
182
|
.native-checkbox:checked + .checkbox-box {
|
|
152
183
|
background-color: var(--oh-color-brand-primary);
|
|
153
184
|
border-color: var(--oh-color-brand-primary);
|
|
154
185
|
box-shadow: var(--oh-elevation-offset-md) var(--oh-elevation-offset-md)
|
|
155
|
-
0 0 var(--oh-
|
|
186
|
+
0 0 var(--oh-elevation-color-primary);
|
|
156
187
|
}
|
|
157
188
|
|
|
158
189
|
.native-checkbox:checked + .checkbox-box::after {
|
|
@@ -165,7 +196,7 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
165
196
|
border-color: var(--oh-color-brand-primary-hover);
|
|
166
197
|
transform: translate(var(--oh-lift-hover-sm), var(--oh-lift-hover-sm));
|
|
167
198
|
box-shadow: var(--oh-elevation-offset-lg) var(--oh-elevation-offset-lg)
|
|
168
|
-
0 0 var(--oh-
|
|
199
|
+
0 0 var(--oh-elevation-color-primary);
|
|
169
200
|
}
|
|
170
201
|
|
|
171
202
|
/* Checked + Active */
|
|
@@ -173,7 +204,7 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
173
204
|
background-color: var(--oh-color-brand-primary-active);
|
|
174
205
|
transform: translate(var(--oh-lift-press-sm), var(--oh-lift-press-sm));
|
|
175
206
|
box-shadow: var(--oh-elevation-offset-xs) var(--oh-elevation-offset-xs)
|
|
176
|
-
0 0 var(--oh-
|
|
207
|
+
0 0 var(--oh-elevation-color-primary);
|
|
177
208
|
}
|
|
178
209
|
|
|
179
210
|
/* Focus: underline the label (accessible indicator) */
|
|
@@ -199,16 +230,16 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
199
230
|
ERROR STATE
|
|
200
231
|
═══════════════════════════════════════════════════════════════ */
|
|
201
232
|
|
|
202
|
-
:host([
|
|
233
|
+
:host([data-invalid]) .checkbox-box {
|
|
203
234
|
border-color: var(--oh-color-feedback-error);
|
|
204
235
|
box-shadow: var(--oh-elevation-offset-md) var(--oh-elevation-offset-md)
|
|
205
|
-
0 0 var(--oh-
|
|
236
|
+
0 0 var(--oh-elevation-color-error);
|
|
206
237
|
}
|
|
207
238
|
|
|
208
|
-
:host([
|
|
239
|
+
:host([data-invalid]) .checkbox-wrapper:hover .checkbox-box {
|
|
209
240
|
border-color: var(--oh-color-feedback-error-hover);
|
|
210
241
|
box-shadow: var(--oh-elevation-offset-lg) var(--oh-elevation-offset-lg)
|
|
211
|
-
0 0 var(--oh-
|
|
242
|
+
0 0 var(--oh-elevation-color-error);
|
|
212
243
|
}
|
|
213
244
|
|
|
214
245
|
.error-message {
|
|
@@ -219,7 +250,9 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
219
250
|
font-size: var(--oh-typography-body-base-font-size);
|
|
220
251
|
color: var(--oh-color-feedback-error);
|
|
221
252
|
margin-top: var(--oh-spacing-1);
|
|
222
|
-
margin-
|
|
253
|
+
margin-inline-start: calc(
|
|
254
|
+
24px + var(--oh-spacing-3)
|
|
255
|
+
); /* Align with label */
|
|
223
256
|
}
|
|
224
257
|
|
|
225
258
|
.error-icon {
|
|
@@ -240,7 +273,7 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
240
273
|
}
|
|
241
274
|
|
|
242
275
|
/* ═══════════════════════════════════════════════════════════════
|
|
243
|
-
FORCED STATES (for
|
|
276
|
+
FORCED STATES (for documentation)
|
|
244
277
|
═══════════════════════════════════════════════════════════════ */
|
|
245
278
|
|
|
246
279
|
/* Forced Hover - Unchecked */
|
|
@@ -248,7 +281,7 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
248
281
|
border-color: var(--oh-color-border-hover);
|
|
249
282
|
transform: translate(var(--oh-lift-hover-sm), var(--oh-lift-hover-sm));
|
|
250
283
|
box-shadow: var(--oh-elevation-offset-lg) var(--oh-elevation-offset-lg)
|
|
251
|
-
0 0 var(--oh-
|
|
284
|
+
0 0 var(--oh-elevation-color-secondary);
|
|
252
285
|
}
|
|
253
286
|
|
|
254
287
|
/* Forced Focus - Unchecked */
|
|
@@ -263,7 +296,7 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
263
296
|
border-color: var(--oh-color-brand-primary-hover);
|
|
264
297
|
transform: translate(var(--oh-lift-hover-sm), var(--oh-lift-hover-sm));
|
|
265
298
|
box-shadow: var(--oh-elevation-offset-lg) var(--oh-elevation-offset-lg)
|
|
266
|
-
0 0 var(--oh-
|
|
299
|
+
0 0 var(--oh-elevation-color-primary);
|
|
267
300
|
}
|
|
268
301
|
`,
|
|
269
302
|
]; }
|
|
@@ -272,10 +305,14 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
272
305
|
this.checked = target.checked;
|
|
273
306
|
this.emit("oh-change", { checked: this.checked, value: this.value });
|
|
274
307
|
}
|
|
308
|
+
updated(changed) {
|
|
309
|
+
// Styling hook for the error state (data-invalid on the host)
|
|
310
|
+
if (changed.has("errorText"))
|
|
311
|
+
this.toggleAttribute("data-invalid", !!this.errorText);
|
|
312
|
+
}
|
|
275
313
|
willUpdate(changed) {
|
|
276
|
-
if (this.hasUpdated &&
|
|
277
|
-
|
|
278
|
-
this._announceError = !!(this.error && this.errorMessage);
|
|
314
|
+
if (this.hasUpdated && changed.has("errorText")) {
|
|
315
|
+
this._announceError = !!this.errorText;
|
|
279
316
|
}
|
|
280
317
|
}
|
|
281
318
|
render() {
|
|
@@ -290,16 +327,14 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
290
327
|
name=${this.name}
|
|
291
328
|
.value=${this.value}
|
|
292
329
|
.checked=${this.checked}
|
|
293
|
-
aria-invalid=${this.
|
|
294
|
-
aria-describedby=${this.
|
|
295
|
-
? this._errorId
|
|
296
|
-
: nothing}
|
|
330
|
+
aria-invalid=${this.errorText ? "true" : "false"}
|
|
331
|
+
aria-describedby=${this.errorText ? this._errorId : nothing}
|
|
297
332
|
@change=${this._handleChange}
|
|
298
333
|
/>
|
|
299
334
|
<span class="checkbox-box" part="box"></span>
|
|
300
335
|
<span class="label" part="label">${this.label}</span>
|
|
301
336
|
</label>
|
|
302
|
-
${this.
|
|
337
|
+
${this.errorText
|
|
303
338
|
? html `
|
|
304
339
|
<div
|
|
305
340
|
id=${this._errorId}
|
|
@@ -319,7 +354,7 @@ let OhCheckbox = class OhCheckbox extends OhElement {
|
|
|
319
354
|
clip-rule="evenodd"
|
|
320
355
|
/>
|
|
321
356
|
</svg>
|
|
322
|
-
${this.
|
|
357
|
+
${this.errorText}
|
|
323
358
|
</div>
|
|
324
359
|
`
|
|
325
360
|
: ""}
|
|
@@ -340,11 +375,8 @@ __decorate([
|
|
|
340
375
|
property({ type: String })
|
|
341
376
|
], OhCheckbox.prototype, "value", void 0);
|
|
342
377
|
__decorate([
|
|
343
|
-
property({ type:
|
|
344
|
-
], OhCheckbox.prototype, "
|
|
345
|
-
__decorate([
|
|
346
|
-
property({ type: String })
|
|
347
|
-
], OhCheckbox.prototype, "errorMessage", void 0);
|
|
378
|
+
property({ type: String, attribute: "error-text" })
|
|
379
|
+
], OhCheckbox.prototype, "errorText", void 0);
|
|
348
380
|
__decorate([
|
|
349
381
|
property({ type: String, reflect: true, attribute: "force-state" })
|
|
350
382
|
], OhCheckbox.prototype, "forceState", void 0);
|
package/dist/oh-checkbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-checkbox.js","sourceRoot":"","sources":["../src/oh-checkbox.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-checkbox.js","sourceRoot":"","sources":["../src/oh-checkbox.ts"],"names":[],"mappings":"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"}
|
package/dist/oh-cluster.d.ts
CHANGED
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-cluster
|
|
3
3
|
*
|
|
4
|
-
* Horizontal grouping with wrap and gap.
|
|
5
|
-
* Perfect for button groups, tags, navigation items.
|
|
6
|
-
*
|
|
7
4
|
* DESIGN DECISIONS:
|
|
8
5
|
* ─────────────────
|
|
9
|
-
* 1.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* 2. JUSTIFY OPTIONS
|
|
14
|
-
* - start, center, end, between, around
|
|
15
|
-
*
|
|
16
|
-
* 3. ALIGNMENT OPTIONS
|
|
17
|
-
* - start, center, end, baseline
|
|
18
|
-
*
|
|
19
|
-
* @element oh-cluster
|
|
6
|
+
* 1. A wrapping flex row (unless `nowrap`); `gap` maps named steps to
|
|
7
|
+
* `spacing.*` tokens, the same in both directions.
|
|
8
|
+
* 2. Justify: start, center, end, between, around.
|
|
9
|
+
* 3. Align: start, center (default), end, baseline.
|
|
20
10
|
*/
|
|
21
11
|
import { OhElement } from "./base.js";
|
|
22
12
|
export type ClusterGap = "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
23
13
|
export type ClusterJustify = "start" | "center" | "end" | "between" | "around";
|
|
24
14
|
export type ClusterAlign = "start" | "center" | "end" | "baseline";
|
|
15
|
+
/**
|
|
16
|
+
* A horizontal group of items that wraps onto new lines when space runs out.
|
|
17
|
+
*
|
|
18
|
+
* **Use it for** button groups, tags and rows of links. **Don't use it for**
|
|
19
|
+
* vertical lists (use `oh-stack`) or equal-width columns (use `oh-grid`).
|
|
20
|
+
*
|
|
21
|
+
* **Gaps:** `gap` is `none`, `xs` (`spacing.1`), `sm` (`spacing.2`), `md`
|
|
22
|
+
* (default, `spacing.4`), `lg` (`spacing.6`) or `xl` (`spacing.8`), between
|
|
23
|
+
* items and between rows. `justify` is `start` (default), `center`, `end`,
|
|
24
|
+
* `between` or `around`; `align` is `start`, `center` (default), `end` or
|
|
25
|
+
* `baseline`. `nowrap` keeps everything on one line.
|
|
26
|
+
*
|
|
27
|
+
* @element oh-cluster
|
|
28
|
+
* @slot - The items to group.
|
|
29
|
+
*/
|
|
25
30
|
export declare class OhCluster extends OhElement {
|
|
26
31
|
static styles: import("lit").CSSResult[];
|
|
27
32
|
gap: ClusterGap;
|
package/dist/oh-cluster.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-cluster.d.ts","sourceRoot":"","sources":["../src/oh-cluster.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-cluster.d.ts","sourceRoot":"","sources":["../src/oh-cluster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACnE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC/E,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,qBACa,SAAU,SAAQ,SAAS;IACtC,OAAgB,MAAM,4BA6EpB;IAGF,GAAG,EAAE,UAAU,CAAQ;IAGvB,OAAO,EAAE,cAAc,CAAW;IAGlC,KAAK,EAAE,YAAY,CAAY;IAG/B,MAAM,UAAS;IAEf,MAAM;CAGP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
|
package/dist/oh-cluster.js
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-cluster
|
|
3
3
|
*
|
|
4
|
-
* Horizontal grouping with wrap and gap.
|
|
5
|
-
* Perfect for button groups, tags, navigation items.
|
|
6
|
-
*
|
|
7
4
|
* DESIGN DECISIONS:
|
|
8
5
|
* ─────────────────
|
|
9
|
-
* 1.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* 2. JUSTIFY OPTIONS
|
|
14
|
-
* - start, center, end, between, around
|
|
15
|
-
*
|
|
16
|
-
* 3. ALIGNMENT OPTIONS
|
|
17
|
-
* - start, center, end, baseline
|
|
18
|
-
*
|
|
19
|
-
* @element oh-cluster
|
|
6
|
+
* 1. A wrapping flex row (unless `nowrap`); `gap` maps named steps to
|
|
7
|
+
* `spacing.*` tokens, the same in both directions.
|
|
8
|
+
* 2. Justify: start, center, end, between, around.
|
|
9
|
+
* 3. Align: start, center (default), end, baseline.
|
|
20
10
|
*/
|
|
21
11
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
22
12
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -27,6 +17,21 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
27
17
|
import { html, css } from "lit";
|
|
28
18
|
import { customElement, property } from "lit/decorators.js";
|
|
29
19
|
import { OhElement, baseStyles } from "./base.js";
|
|
20
|
+
/**
|
|
21
|
+
* A horizontal group of items that wraps onto new lines when space runs out.
|
|
22
|
+
*
|
|
23
|
+
* **Use it for** button groups, tags and rows of links. **Don't use it for**
|
|
24
|
+
* vertical lists (use `oh-stack`) or equal-width columns (use `oh-grid`).
|
|
25
|
+
*
|
|
26
|
+
* **Gaps:** `gap` is `none`, `xs` (`spacing.1`), `sm` (`spacing.2`), `md`
|
|
27
|
+
* (default, `spacing.4`), `lg` (`spacing.6`) or `xl` (`spacing.8`), between
|
|
28
|
+
* items and between rows. `justify` is `start` (default), `center`, `end`,
|
|
29
|
+
* `between` or `around`; `align` is `start`, `center` (default), `end` or
|
|
30
|
+
* `baseline`. `nowrap` keeps everything on one line.
|
|
31
|
+
*
|
|
32
|
+
* @element oh-cluster
|
|
33
|
+
* @slot - The items to group.
|
|
34
|
+
*/
|
|
30
35
|
let OhCluster = class OhCluster extends OhElement {
|
|
31
36
|
constructor() {
|
|
32
37
|
super(...arguments);
|
|
@@ -38,11 +43,6 @@ let OhCluster = class OhCluster extends OhElement {
|
|
|
38
43
|
static { this.styles = [
|
|
39
44
|
baseStyles,
|
|
40
45
|
css `
|
|
41
|
-
/* ═══════════════════════════════════════════════════════════════
|
|
42
|
-
ORANGE HALO CLUSTER
|
|
43
|
-
Horizontal grouping • Flex wrap • Consistent gaps
|
|
44
|
-
═══════════════════════════════════════════════════════════════ */
|
|
45
|
-
|
|
46
46
|
:host {
|
|
47
47
|
display: flex;
|
|
48
48
|
flex-wrap: wrap;
|
package/dist/oh-cluster.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-cluster.js","sourceRoot":"","sources":["../src/oh-cluster.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-cluster.js","sourceRoot":"","sources":["../src/oh-cluster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;;;;;;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;AAMlD;;;;;;;;;;;;;;GAcG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,SAAS;IAAjC;;QAiFL,QAAG,GAAe,IAAI,CAAC;QAGvB,YAAO,GAAmB,OAAO,CAAC;QAGlC,UAAK,GAAiB,QAAQ,CAAC;QAG/B,WAAM,GAAG,KAAK,CAAC;IAKjB,CAAC;aA9FiB,WAAM,GAAG;QACvB,UAAU;QACV,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0EF;KACF,AA7EqB,CA6EpB;IAcF,MAAM;QACJ,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAbD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCACnB;AAGvB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CACR;AAGlC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCACX;AAG/B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAC5B;AA1FJ,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CA+FrB"}
|
package/dist/oh-container.d.ts
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-container
|
|
3
3
|
*
|
|
4
|
-
* Max-width wrapper with centered content.
|
|
5
|
-
* Used to constrain content width and provide consistent horizontal padding.
|
|
6
|
-
*
|
|
7
4
|
* DESIGN DECISIONS:
|
|
8
5
|
* ─────────────────
|
|
9
|
-
* 1.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
6
|
+
* 1. Max-widths come only from `layout.container.*` (sm, md, lg, xl);
|
|
7
|
+
* `full` is edge to edge with no padding.
|
|
8
|
+
* 2. Horizontal padding from `spacing.*`, stepping up at the
|
|
9
|
+
* `size.breakpoint.sm` and `size.breakpoint.lg` widths.
|
|
10
|
+
* 3. Centred with auto margins.
|
|
11
|
+
*/
|
|
12
|
+
import { OhElement } from "./base.js";
|
|
13
|
+
export type ContainerSize = "sm" | "md" | "lg" | "xl" | "full";
|
|
14
|
+
/**
|
|
15
|
+
* A centred wrapper that limits content to a maximum width and adds side padding.
|
|
16
|
+
*
|
|
17
|
+
* **Use it for** the outer width of a page or section. **Don't use it for**
|
|
18
|
+
* spacing between items (use `oh-stack`, `oh-cluster` or `oh-grid`).
|
|
15
19
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
20
|
+
* **Sizes:** `size` picks the max-width: `sm`, `md`, `lg` (default) and `xl`
|
|
21
|
+
* use `layout.container.sm` to `layout.container.xl`; `full` is the full
|
|
22
|
+
* width with no side padding. `center` centres the text.
|
|
19
23
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
24
|
+
* **Behaviour:** side padding is `spacing.4`, rising to `spacing.6` from the
|
|
25
|
+
* `size.breakpoint.sm` width and `spacing.8` from `size.breakpoint.lg`.
|
|
22
26
|
*
|
|
23
27
|
* @element oh-container
|
|
28
|
+
* @slot - The content to contain.
|
|
24
29
|
*/
|
|
25
|
-
import { OhElement } from "./base.js";
|
|
26
|
-
export type ContainerSize = "sm" | "md" | "lg" | "xl" | "full";
|
|
27
30
|
export declare class OhContainer extends OhElement {
|
|
28
31
|
static styles: import("lit").CSSResult[];
|
|
29
32
|
size: ContainerSize;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-container.d.ts","sourceRoot":"","sources":["../src/oh-container.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-container.d.ts","sourceRoot":"","sources":["../src/oh-container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAE/D;;;;;;;;;;;;;;;GAeG;AACH,qBACa,WAAY,SAAQ,SAAS;IACxC,OAAgB,MAAM,4BAmDpB;IAGF,IAAI,EAAE,aAAa,CAAQ;IAG3B,MAAM,UAAS;IAEf,MAAM;CAGP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
package/dist/oh-container.js
CHANGED
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* oh-container
|
|
3
3
|
*
|
|
4
|
-
* Max-width wrapper with centered content.
|
|
5
|
-
* Used to constrain content width and provide consistent horizontal padding.
|
|
6
|
-
*
|
|
7
4
|
* DESIGN DECISIONS:
|
|
8
5
|
* ─────────────────
|
|
9
|
-
* 1.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* - full: 100% (edge-to-edge)
|
|
15
|
-
*
|
|
16
|
-
* 2. CONSISTENT PADDING
|
|
17
|
-
* - Uses spacing tokens for horizontal padding
|
|
18
|
-
* - Responsive padding on smaller screens
|
|
19
|
-
*
|
|
20
|
-
* 3. CENTERED BY DEFAULT
|
|
21
|
-
* - margin: 0 auto for horizontal centering
|
|
22
|
-
*
|
|
23
|
-
* @element oh-container
|
|
6
|
+
* 1. Max-widths come only from `layout.container.*` (sm, md, lg, xl);
|
|
7
|
+
* `full` is edge to edge with no padding.
|
|
8
|
+
* 2. Horizontal padding from `spacing.*`, stepping up at the
|
|
9
|
+
* `size.breakpoint.sm` and `size.breakpoint.lg` widths.
|
|
10
|
+
* 3. Centred with auto margins.
|
|
24
11
|
*/
|
|
25
12
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
26
13
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -31,6 +18,22 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
31
18
|
import { html, css } from "lit";
|
|
32
19
|
import { customElement, property } from "lit/decorators.js";
|
|
33
20
|
import { OhElement, baseStyles } from "./base.js";
|
|
21
|
+
/**
|
|
22
|
+
* A centred wrapper that limits content to a maximum width and adds side padding.
|
|
23
|
+
*
|
|
24
|
+
* **Use it for** the outer width of a page or section. **Don't use it for**
|
|
25
|
+
* spacing between items (use `oh-stack`, `oh-cluster` or `oh-grid`).
|
|
26
|
+
*
|
|
27
|
+
* **Sizes:** `size` picks the max-width: `sm`, `md`, `lg` (default) and `xl`
|
|
28
|
+
* use `layout.container.sm` to `layout.container.xl`; `full` is the full
|
|
29
|
+
* width with no side padding. `center` centres the text.
|
|
30
|
+
*
|
|
31
|
+
* **Behaviour:** side padding is `spacing.4`, rising to `spacing.6` from the
|
|
32
|
+
* `size.breakpoint.sm` width and `spacing.8` from `size.breakpoint.lg`.
|
|
33
|
+
*
|
|
34
|
+
* @element oh-container
|
|
35
|
+
* @slot - The content to contain.
|
|
36
|
+
*/
|
|
34
37
|
let OhContainer = class OhContainer extends OhElement {
|
|
35
38
|
constructor() {
|
|
36
39
|
super(...arguments);
|
|
@@ -40,18 +43,11 @@ let OhContainer = class OhContainer extends OhElement {
|
|
|
40
43
|
static { this.styles = [
|
|
41
44
|
baseStyles,
|
|
42
45
|
css `
|
|
43
|
-
/* ═══════════════════════════════════════════════════════════════
|
|
44
|
-
ORANGE HALO CONTAINER
|
|
45
|
-
Max-width wrapper • Centered content • Responsive padding
|
|
46
|
-
═══════════════════════════════════════════════════════════════ */
|
|
47
|
-
|
|
48
46
|
:host {
|
|
49
47
|
display: block;
|
|
50
48
|
width: 100%;
|
|
51
|
-
margin-
|
|
52
|
-
|
|
53
|
-
padding-left: var(--oh-spacing-4);
|
|
54
|
-
padding-right: var(--oh-spacing-4);
|
|
49
|
+
margin-inline: auto;
|
|
50
|
+
padding-inline: var(--oh-spacing-4);
|
|
55
51
|
box-sizing: border-box;
|
|
56
52
|
}
|
|
57
53
|
|
|
@@ -74,22 +70,19 @@ let OhContainer = class OhContainer extends OhElement {
|
|
|
74
70
|
|
|
75
71
|
:host([size="full"]) {
|
|
76
72
|
max-width: 100%;
|
|
77
|
-
padding-
|
|
78
|
-
padding-right: 0;
|
|
73
|
+
padding-inline: 0;
|
|
79
74
|
}
|
|
80
75
|
|
|
81
76
|
/* Responsive padding */
|
|
82
77
|
@media (min-width: 640px) {
|
|
83
78
|
:host {
|
|
84
|
-
padding-
|
|
85
|
-
padding-right: var(--oh-spacing-6);
|
|
79
|
+
padding-inline: var(--oh-spacing-6);
|
|
86
80
|
}
|
|
87
81
|
}
|
|
88
82
|
|
|
89
83
|
@media (min-width: 1024px) {
|
|
90
84
|
:host {
|
|
91
|
-
padding-
|
|
92
|
-
padding-right: var(--oh-spacing-8);
|
|
85
|
+
padding-inline: var(--oh-spacing-8);
|
|
93
86
|
}
|
|
94
87
|
}
|
|
95
88
|
|
package/dist/oh-container.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oh-container.js","sourceRoot":"","sources":["../src/oh-container.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oh-container.js","sourceRoot":"","sources":["../src/oh-container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;;;;;;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;AAIlD;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,SAAS;IAAnC;;QAuDL,SAAI,GAAkB,IAAI,CAAC;QAG3B,WAAM,GAAG,KAAK,CAAC;IAKjB,CAAC;aA9DiB,WAAM,GAAG;QACvB,UAAU;QACV,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgDF;KACF,AAnDqB,CAmDpB;IAQF,MAAM;QACJ,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAPD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCACf;AAG3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAC5B;AA1DJ,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA+DvB"}
|