@orange-halo/components 2.1.0 → 3.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 (130) hide show
  1. package/custom-elements.json +968 -362
  2. package/dist/base.d.ts.map +1 -1
  3. package/dist/base.js +1 -2
  4. package/dist/base.js.map +1 -1
  5. package/dist/index.d.ts +4 -8
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -4
  8. package/dist/index.js.map +1 -1
  9. package/dist/oh-accordion.d.ts +53 -8
  10. package/dist/oh-accordion.d.ts.map +1 -1
  11. package/dist/oh-accordion.js +99 -29
  12. package/dist/oh-accordion.js.map +1 -1
  13. package/dist/oh-alert.d.ts +26 -8
  14. package/dist/oh-alert.d.ts.map +1 -1
  15. package/dist/oh-alert.js +96 -36
  16. package/dist/oh-alert.js.map +1 -1
  17. package/dist/oh-badge.d.ts +32 -13
  18. package/dist/oh-badge.d.ts.map +1 -1
  19. package/dist/oh-badge.js +38 -19
  20. package/dist/oh-badge.js.map +1 -1
  21. package/dist/oh-breadcrumb.d.ts +39 -12
  22. package/dist/oh-breadcrumb.d.ts.map +1 -1
  23. package/dist/oh-breadcrumb.js +66 -25
  24. package/dist/oh-breadcrumb.js.map +1 -1
  25. package/dist/oh-button.d.ts +49 -23
  26. package/dist/oh-button.d.ts.map +1 -1
  27. package/dist/oh-button.figma.js +1 -3
  28. package/dist/oh-button.figma.js.map +1 -1
  29. package/dist/oh-button.js +133 -82
  30. package/dist/oh-button.js.map +1 -1
  31. package/dist/oh-card.d.ts +47 -19
  32. package/dist/oh-card.d.ts.map +1 -1
  33. package/dist/oh-card.js +143 -96
  34. package/dist/oh-card.js.map +1 -1
  35. package/dist/oh-checkbox-group.d.ts +56 -12
  36. package/dist/oh-checkbox-group.d.ts.map +1 -1
  37. package/dist/oh-checkbox-group.figma.js +4 -6
  38. package/dist/oh-checkbox-group.figma.js.map +1 -1
  39. package/dist/oh-checkbox-group.js +114 -49
  40. package/dist/oh-checkbox-group.js.map +1 -1
  41. package/dist/oh-checkbox.d.ts +54 -17
  42. package/dist/oh-checkbox.d.ts.map +1 -1
  43. package/dist/oh-checkbox.js +117 -60
  44. package/dist/oh-checkbox.js.map +1 -1
  45. package/dist/oh-cluster.d.ts +19 -14
  46. package/dist/oh-cluster.d.ts.map +1 -1
  47. package/dist/oh-cluster.js +19 -19
  48. package/dist/oh-cluster.js.map +1 -1
  49. package/dist/oh-container.d.ts +19 -16
  50. package/dist/oh-container.d.ts.map +1 -1
  51. package/dist/oh-container.js +21 -23
  52. package/dist/oh-container.js.map +1 -1
  53. package/dist/oh-drawer.d.ts +28 -11
  54. package/dist/oh-drawer.d.ts.map +1 -1
  55. package/dist/oh-drawer.js +52 -24
  56. package/dist/oh-drawer.js.map +1 -1
  57. package/dist/oh-footer.d.ts +37 -18
  58. package/dist/oh-footer.d.ts.map +1 -1
  59. package/dist/oh-footer.js +38 -19
  60. package/dist/oh-footer.js.map +1 -1
  61. package/dist/oh-grid.d.ts +27 -14
  62. package/dist/oh-grid.d.ts.map +1 -1
  63. package/dist/oh-grid.js +28 -21
  64. package/dist/oh-grid.js.map +1 -1
  65. package/dist/oh-icon.d.ts +21 -5
  66. package/dist/oh-icon.d.ts.map +1 -1
  67. package/dist/oh-icon.js +27 -9
  68. package/dist/oh-icon.js.map +1 -1
  69. package/dist/oh-input.d.ts +110 -21
  70. package/dist/oh-input.d.ts.map +1 -1
  71. package/dist/oh-input.figma.js +2 -2
  72. package/dist/oh-input.figma.js.map +1 -1
  73. package/dist/oh-input.js +227 -71
  74. package/dist/oh-input.js.map +1 -1
  75. package/dist/oh-link.d.ts +42 -19
  76. package/dist/oh-link.d.ts.map +1 -1
  77. package/dist/oh-link.js +83 -38
  78. package/dist/oh-link.js.map +1 -1
  79. package/dist/oh-modal.d.ts +35 -6
  80. package/dist/oh-modal.d.ts.map +1 -1
  81. package/dist/oh-modal.js +90 -39
  82. package/dist/oh-modal.js.map +1 -1
  83. package/dist/oh-navbar.d.ts +42 -19
  84. package/dist/oh-navbar.d.ts.map +1 -1
  85. package/dist/oh-navbar.js +44 -20
  86. package/dist/oh-navbar.js.map +1 -1
  87. package/dist/oh-progress.d.ts +26 -7
  88. package/dist/oh-progress.d.ts.map +1 -1
  89. package/dist/oh-progress.js +35 -14
  90. package/dist/oh-progress.js.map +1 -1
  91. package/dist/oh-radio-group.d.ts +55 -13
  92. package/dist/oh-radio-group.d.ts.map +1 -1
  93. package/dist/oh-radio-group.figma.js +2 -2
  94. package/dist/oh-radio-group.figma.js.map +1 -1
  95. package/dist/oh-radio-group.js +122 -51
  96. package/dist/oh-radio-group.js.map +1 -1
  97. package/dist/oh-radio.d.ts +55 -17
  98. package/dist/oh-radio.d.ts.map +1 -1
  99. package/dist/oh-radio.js +120 -61
  100. package/dist/oh-radio.js.map +1 -1
  101. package/dist/oh-select.d.ts +59 -16
  102. package/dist/oh-select.d.ts.map +1 -1
  103. package/dist/oh-select.js +141 -69
  104. package/dist/oh-select.js.map +1 -1
  105. package/dist/oh-skip-link.d.ts +33 -15
  106. package/dist/oh-skip-link.d.ts.map +1 -1
  107. package/dist/oh-skip-link.js +43 -32
  108. package/dist/oh-skip-link.js.map +1 -1
  109. package/dist/oh-stack.d.ts +17 -14
  110. package/dist/oh-stack.d.ts.map +1 -1
  111. package/dist/oh-stack.js +18 -20
  112. package/dist/oh-stack.js.map +1 -1
  113. package/dist/oh-tabs.d.ts +55 -30
  114. package/dist/oh-tabs.d.ts.map +1 -1
  115. package/dist/oh-tabs.js +100 -76
  116. package/dist/oh-tabs.js.map +1 -1
  117. package/dist/oh-textarea.d.ts +129 -0
  118. package/dist/oh-textarea.d.ts.map +1 -0
  119. package/dist/oh-textarea.js +401 -0
  120. package/dist/oh-textarea.js.map +1 -0
  121. package/dist/oh-toggle.d.ts +45 -12
  122. package/dist/oh-toggle.d.ts.map +1 -1
  123. package/dist/oh-toggle.js +84 -34
  124. package/dist/oh-toggle.js.map +1 -1
  125. package/dist/styles/typography.js +1 -1
  126. package/package.json +7 -7
  127. package/dist/oh-hero.d.ts +0 -33
  128. package/dist/oh-hero.d.ts.map +0 -1
  129. package/dist/oh-hero.js +0 -246
  130. package/dist/oh-hero.js.map +0 -1
@@ -1,24 +1,20 @@
1
1
  /**
2
2
  * oh-breadcrumb
3
3
  *
4
- * Accessible breadcrumb navigation with responsive collapse.
5
- *
6
4
  * DESIGN DECISIONS:
7
5
  * ─────────────────
8
6
  * 1. SEMANTIC STRUCTURE
9
- * - <nav> with aria-label="Breadcrumb"
10
- * - <ol> for ordered list semantics
11
- * - aria-current="page" on last item
7
+ * - <nav aria-label="Breadcrumb"> around an <ol>
8
+ * - aria-current="page" on the last item, which is not a link
9
+ * - Separators are aria-hidden
12
10
  *
13
- * 2. REUSES EXISTING STYLES
14
- * - Link styles match oh-link (dashed underline, shrink animation)
15
- * - Typography and spacing from tokens
11
+ * 2. LINKS MIRROR oh-link INLINE
12
+ * - Same underline tokens and hover/focus behaviour, written locally
13
+ * so the trail is one component
16
14
  *
17
15
  * 3. RESPONSIVE
18
- * - Desktop: Full breadcrumb trail
19
- * - Mobile (<640px): Collapses to "← Back to [parent]"
20
- *
21
- * @element oh-breadcrumb
16
+ * - Wide viewports: the full trail
17
+ * - Below `size.breakpoint.sm`: a single "Back to [parent]" link
22
18
  */
23
19
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
24
20
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -29,6 +25,37 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
29
25
  import { html, css, nothing } from "lit";
30
26
  import { customElement, property } from "lit/decorators.js";
31
27
  import { OhElement, baseStyles } from "./base.js";
28
+ /**
29
+ * A breadcrumb trail showing where the current page sits in the site's hierarchy.
30
+ *
31
+ * **Use it for** pages two or more levels deep in a hierarchy. **Don't use it
32
+ * for** a site's main navigation (use `oh-navbar`) or for steps in a process.
33
+ *
34
+ * **Parts:** pass `items`, an array of `{ label, href }`, from the top level
35
+ * down. The last item is the current page and is shown as text, not a link.
36
+ *
37
+ * **Behaviour:** below the `size.breakpoint.sm` width the trail collapses to a
38
+ * single "Back to [parent]" link to the second-to-last item; with one item,
39
+ * nothing shows there. Link underlines retract on hover; keyboard focus
40
+ * (`:focus-visible`) shows a solid underline and a background tint.
41
+ * Transitions are cut short under `prefers-reduced-motion`. Renders nothing
42
+ * when `items` is empty.
43
+ *
44
+ * **Accessibility:** renders `<nav aria-label="Breadcrumb">` with an ordered
45
+ * list, `aria-current="page"` on the last item and `aria-hidden` separators.
46
+ * Use one breadcrumb per page.
47
+ *
48
+ * **Look:** set by tokens — `color.text.link` the links,
49
+ * `decoration.underlineThickness`, `decoration.underlineDash` and
50
+ * `decoration.underlinePeriod` their underline; `color.brand.primary` the
51
+ * focus underline and `color.surface.hover` the focus tint;
52
+ * `color.text.primary` and `typography.label.base.fontWeight` the current
53
+ * page; `color.text.secondary` the separators; `typography.body.*` the text;
54
+ * `spacing.*` the gaps; `motion.relaxed` and `motion.easeGentle` the
55
+ * transitions.
56
+ *
57
+ * @element oh-breadcrumb
58
+ */
32
59
  let OhBreadcrumb = class OhBreadcrumb extends OhElement {
33
60
  constructor() {
34
61
  super(...arguments);
@@ -37,11 +64,6 @@ let OhBreadcrumb = class OhBreadcrumb extends OhElement {
37
64
  static { this.styles = [
38
65
  baseStyles,
39
66
  css `
40
- /* ═══════════════════════════════════════════════════════════════
41
- ORANGE HALO BREADCRUMB
42
- Semantic • Responsive • Accessible
43
- ═══════════════════════════════════════════════════════════════ */
44
-
45
67
  :host {
46
68
  display: block;
47
69
  font-family: var(--oh-typography-body-font-family);
@@ -91,7 +113,7 @@ let OhBreadcrumb = class OhBreadcrumb extends OhElement {
91
113
  }
92
114
 
93
115
  .breadcrumb-link::after {
94
- content: '';
116
+ content: "";
95
117
  position: absolute;
96
118
  left: 0;
97
119
  bottom: 0;
@@ -107,7 +129,8 @@ let OhBreadcrumb = class OhBreadcrumb extends OhElement {
107
129
  background-size: 100% 100%;
108
130
  background-repeat: no-repeat;
109
131
  transform-origin: right;
110
- transition: transform var(--oh-motion-relaxed) var(--oh-motion-ease-gentle);
132
+ transition: transform var(--oh-motion-relaxed)
133
+ var(--oh-motion-ease-gentle);
111
134
  }
112
135
 
113
136
  .breadcrumb-link:hover::after {
@@ -157,7 +180,7 @@ let OhBreadcrumb = class OhBreadcrumb extends OhElement {
157
180
  }
158
181
 
159
182
  .back-link::after {
160
- content: '';
183
+ content: "";
161
184
  position: absolute;
162
185
  left: 0;
163
186
  bottom: 0;
@@ -173,7 +196,8 @@ let OhBreadcrumb = class OhBreadcrumb extends OhElement {
173
196
  background-size: 100% 100%;
174
197
  background-repeat: no-repeat;
175
198
  transform-origin: right;
176
- transition: transform var(--oh-motion-relaxed) var(--oh-motion-ease-gentle);
199
+ transition: transform var(--oh-motion-relaxed)
200
+ var(--oh-motion-ease-gentle);
177
201
  }
178
202
 
179
203
  .back-link:hover::after {
@@ -240,10 +264,16 @@ let OhBreadcrumb = class OhBreadcrumb extends OhElement {
240
264
  return html `
241
265
  <li class="breadcrumb-item">
242
266
  ${isLast
243
- ? html `<span class="breadcrumb-current" aria-current="page">${item.label}</span>`
244
- : html `<a class="breadcrumb-link" href=${item.href || "#"}>${item.label}</a>`}
267
+ ? html `<span class="breadcrumb-current" aria-current="page"
268
+ >${item.label}</span
269
+ >`
270
+ : html `<a class="breadcrumb-link" href=${item.href || "#"}
271
+ >${item.label}</a
272
+ >`}
245
273
  ${showSeparator
246
- ? html `<span class="breadcrumb-separator" aria-hidden="true">/</span>`
274
+ ? html `<span class="breadcrumb-separator" aria-hidden="true"
275
+ >/</span
276
+ >`
247
277
  : nothing}
248
278
  </li>
249
279
  `;
@@ -255,7 +285,18 @@ let OhBreadcrumb = class OhBreadcrumb extends OhElement {
255
285
  ? html `
256
286
  <div class="breadcrumb-back">
257
287
  <a class="back-link" href=${parentItem.href || "#"}>
258
- <svg class="back-arrow" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
288
+ <svg
289
+ class="back-arrow"
290
+ width="16"
291
+ height="16"
292
+ viewBox="0 0 16 16"
293
+ fill="none"
294
+ stroke="currentColor"
295
+ stroke-width="2"
296
+ stroke-linecap="round"
297
+ stroke-linejoin="round"
298
+ aria-hidden="true"
299
+ >
259
300
  <path d="M10 12L6 8L10 4" />
260
301
  </svg>
261
302
  <span>Back to ${parentItem.label}</span>
@@ -1 +1 @@
1
- {"version":3,"file":"oh-breadcrumb.js","sourceRoot":"","sources":["../src/oh-breadcrumb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;;;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;AAQ3C,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,SAAS;IAApC;;QAkML,UAAK,GAAqB,EAAE,CAAC;IA8C/B,CAAC;aA/OiB,WAAM,GAAG;QACvB,UAAU;QACV,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2LF;KACF,AA9LqB,CA8LpB;IAKF,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,M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CAAC,KAAK;sBACb;gBACJ,CAAC,CAAC,IAAI,CAAA,mCAAmC,IAAI,CAAC,IAAI,IAAI,GAAG;yBAClD,IAAI,CAAC,KAAK;sBACb;kBACJ,aAAa;gBACb,CAAC,CAAC,IAAI,CAAA;;sBAEF;gBACJ,CAAC,CAAC,OAAO;;aAEd,CAAC;QACJ,CAAC,CAAC;;;;UAIF,UAAU;YACV,CAAC,CAAC,IAAI,CAAA;;4CAE4B,UAAU,CAAC,IAAI,IAAI,GAAG;;;;;;;;;;;;;;;kCAehC,UAAU,CAAC,KAAK;;;aAGrC;YACH,CAAC,CAAC,OAAO;;KAEd,CAAC;IACJ,CAAC;;AA/DD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;2CACG;AA/LlB,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA+PxB"}
@@ -1,37 +1,63 @@
1
1
  /**
2
2
  * oh-button
3
3
  *
4
- * A chunky, confident button with playful personality.
5
- * Inspired by hand-crafted, illustrative UI — not corporate SaaS.
6
- *
7
4
  * DESIGN DECISIONS:
8
5
  * ─────────────────
9
- * 1. CHUNKY & CONFIDENT
10
- * - Thick border (stroke.control) that feels illustrative
11
- * - Solid fills, no subtle gradients
12
- * - Generous padding, substantial presence
6
+ * 1. Renders a native <button>, or an <a> when `href` is set, inside the
7
+ * shadow root, so keyboard and screen reader behaviour come from the
8
+ * platform. `accessible-label` is forwarded to it (an aria-label on the
9
+ * host isn't).
10
+ * 2. Look comes from button.* component tokens: button.base.borderWidth
11
+ * (stroke.control), button.base.borderRadius (shape.control),
12
+ * button.variant.<variant>.* for fills, text, border and shadow colour,
13
+ * button.size.<size>.* for type, padding and height.
14
+ * 3. Hover and active move the button by lift.hoverMd / lift.pressMd and set
15
+ * the shadow offset to elevation.offset.2xl / elevation.offset.xs (rest is
16
+ * elevation.offset.lg).
17
+ * 4. Focus is a solid underline on the label (an underline the button draws
18
+ * itself for icon-only and loading buttons, whose text is hidden).
19
+ * 5. Loading uses aria-disabled + aria-busy, not disabled, so focus stays on
20
+ * the button.
21
+ */
22
+ import { OhElement } from "./base.js";
23
+ export type ButtonVariant = "primary" | "secondary" | "accent";
24
+ export type ButtonSize = "sm" | "md" | "lg";
25
+ export type ButtonState = "default" | "hover" | "active" | "focus";
26
+ /**
27
+ * A button that starts an action, or a link styled as a button when `href` is set.
13
28
  *
14
- * 2. OFFSET SHADOW (STICKER EFFECT)
15
- * - Shadow offset to bottom-right
16
- * - Feels like a physical sticker or stamp
17
- * - Not a generic centered drop shadow
29
+ * **Use it for** actions: submitting, saving, opening a dialog, confirming.
30
+ * **Don't use it for** links inside running text (use `oh-link`).
18
31
  *
19
- * 3. PLAYFUL INTERACTIONS
20
- * - Hover: slight upward lift + shadow grows
21
- * - Active: pressed down, shadow shrinks (stamp effect)
22
- * - Focus: warm glow + accessible underline
32
+ * **Variants:** `primary` for the main action, `secondary` for the others,
33
+ * `accent` for an action that takes the accent colour role. **Sizes:** `sm`, `md` (default), `lg`.
34
+ * **States:** rest, hover, active, focus and `loading`.
23
35
  *
24
- * 4. HAND-CRAFTED FEEL
25
- * - Bold, defined edges
26
- * - Confident color choices
27
- * - Personality over polish
36
+ * **Behaviour:** fires `oh-click` when the inner `<button>` is clicked, except
37
+ * while `loading`. `loading` shows a spinner, keeps the label for screen
38
+ * readers, sets `aria-busy` and `aria-disabled` and ignores clicks, while the
39
+ * button stays focusable. With `href` it renders an `<a>` (and
40
+ * `target="_blank"` adds `rel="noopener noreferrer"`); link buttons don't fire
41
+ * `oh-click`. It has no `disabled` property and doesn't submit a form by
42
+ * itself: handle `oh-click`. Under `prefers-reduced-motion` it doesn't move.
43
+ *
44
+ * **Accessibility:** focus shows a solid underline on the label. An
45
+ * `icon-only` button has no visible text, so always set `accessible-label`
46
+ * (not `aria-label`, which isn't forwarded into the shadow root).
47
+ *
48
+ * **Look:** set by tokens — `stroke.control` (border width), `shape.control`
49
+ * (corners), `typography.control.*` (type), `button.variant.<variant>.*`
50
+ * (background, text, border and shadow colour per state), `button.size.<size>.*`
51
+ * (font size, padding, minimum height), `elevation.offset.*` (shadow offset)
52
+ * and `lift.hoverMd` / `lift.pressMd` (movement on hover and press).
28
53
  *
29
54
  * @element oh-button
55
+ * @fires oh-click - The button was clicked (not while loading). `detail.originalEvent` is the click.
56
+ * @slot - The label.
57
+ * @slot icon-left - An icon before the label.
58
+ * @slot icon-right - An icon after the label.
59
+ * @csspart button - The inner `<button>` or `<a>`.
30
60
  */
31
- import { OhElement } from "./base.js";
32
- export type ButtonVariant = "primary" | "secondary" | "accent";
33
- export type ButtonSize = "sm" | "md" | "lg";
34
- export type ButtonState = "default" | "hover" | "active" | "focus";
35
61
  export declare class OhButton extends OhElement {
36
62
  static styles: import("lit").CSSResult[];
37
63
  variant: ButtonVariant;
@@ -1 +1 @@
1
- {"version":3,"file":"oh-button.d.ts","sourceRoot":"","sources":["../src/oh-button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAC/D,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC5C,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEnE,qBACa,QAAS,SAAQ,SAAS;IACrC,OAAgB,MAAM,4BA8WpB;IAGF,OAAO,EAAE,aAAa,CAAa;IAGnC,IAAI,EAAE,UAAU,CAAQ;IAGxB,OAAO,UAAS;IAGhB,QAAQ,UAAS;IAEjB;;;;OAIG;IAEH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IAEH,UAAU,EAAE,WAAW,CAAa;IAEpC,kEAAkE;IAElE,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,uDAAuD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B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
@@ -12,9 +12,7 @@ figma.connect("https://www.figma.com/design/q9ZYrOj2w9DrTVmgQFU7bu/OHDS?node-id=
12
12
  label: figma.string("Label"),
13
13
  },
14
14
  example: (props) => html `
15
- <oh-button variant="${props.variant}">
16
- ${props.label}
17
- </oh-button>
15
+ <oh-button variant="${props.variant}"> ${props.label} </oh-button>
18
16
  `,
19
17
  });
20
18
  //# sourceMappingURL=oh-button.figma.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"oh-button.figma.js","sourceRoot":"","sources":["../src/oh-button.figma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;GAEG;AAEH,KAAK,CAAC,OAAO,CACX,uEAAuE,EACvE;IACE,KAAK,EAAE;QACL,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE;YAC7B,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,QAAQ;SACjB,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;KAC7B;IACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;4BACA,KAAK,CAAC,OAAO;UAC/B,KAAK,CAAC,KAAK;;KAEhB;CACF,CACF,CAAC"}
1
+ {"version":3,"file":"oh-button.figma.js","sourceRoot":"","sources":["../src/oh-button.figma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;GAEG;AAEH,KAAK,CAAC,OAAO,CACX,uEAAuE,EACvE;IACE,KAAK,EAAE;QACL,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE;YAC7B,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,QAAQ;SACjB,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;KAC7B;IACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;4BACA,KAAK,CAAC,OAAO,MAAM,KAAK,CAAC,KAAK;KACrD;CACF,CACF,CAAC"}