@mason-ds/react 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -12,6 +12,9 @@ function cssVar(path) {
12
12
  function spacingVar(axis, level) {
13
13
  return cssVar(`spacing.${axis}.${level}`);
14
14
  }
15
+ function containerMaxWidthVar(level) {
16
+ return cssVar(`spacing.layout.container.${level}`);
17
+ }
15
18
  function radiusVar(level) {
16
19
  return cssVar(`radius.${level}`);
17
20
  }
@@ -35,7 +38,7 @@ function mergeClassName(...parts) {
35
38
  return merged.length > 0 ? merged : void 0;
36
39
  }
37
40
 
38
- // src/textStyles.ts
41
+ // src/primitives/textStyles.ts
39
42
  function textStyle({
40
43
  variant = "body.md",
41
44
  tone = "primary",
@@ -51,7 +54,7 @@ function textStyle({
51
54
  };
52
55
  }
53
56
 
54
- // src/Text.tsx
57
+ // src/primitives/Text.tsx
55
58
  import { jsx as jsx2 } from "react/jsx-runtime";
56
59
  function Text({
57
60
  as = "p",
@@ -78,7 +81,7 @@ function Text({
78
81
  );
79
82
  }
80
83
 
81
- // src/stackStyles.ts
84
+ // src/primitives/stackStyles.ts
82
85
  var FLEX_ALIGN = {
83
86
  start: "flex-start",
84
87
  center: "center",
@@ -111,7 +114,7 @@ function stackStyle({
111
114
  };
112
115
  }
113
116
 
114
- // src/Stack.tsx
117
+ // src/primitives/Stack.tsx
115
118
  import { jsx as jsx3 } from "react/jsx-runtime";
116
119
  function Stack({
117
120
  direction = "column",
@@ -141,8 +144,156 @@ function Stack({
141
144
  );
142
145
  }
143
146
 
144
- // src/cardStyles.ts
147
+ // src/primitives/boxStyles.ts
145
148
  var TONE_BG = {
149
+ canvas: "color.bg.canvas",
150
+ surface: "color.bg.surface",
151
+ elevated: "color.bg.elevated"
152
+ };
153
+ function boxStyle({
154
+ padding,
155
+ tone = "transparent",
156
+ radius,
157
+ bordered = false
158
+ }) {
159
+ return {
160
+ display: "block",
161
+ boxSizing: "border-box",
162
+ minWidth: 0,
163
+ ...padding ? { padding: spacingVar("inset", padding) } : null,
164
+ ...tone !== "transparent" ? { backgroundColor: cssVar(TONE_BG[tone]) } : null,
165
+ ...radius ? { borderRadius: radiusVar(radius) } : null,
166
+ ...bordered ? { border: `1px solid ${cssVar("color.border.subtle")}` } : null
167
+ };
168
+ }
169
+
170
+ // src/primitives/Box.tsx
171
+ import { jsx as jsx4 } from "react/jsx-runtime";
172
+ function Box({
173
+ as = "div",
174
+ padding,
175
+ tone = "transparent",
176
+ radius,
177
+ bordered = false,
178
+ className,
179
+ style,
180
+ children,
181
+ ...rest
182
+ }) {
183
+ const Component = as;
184
+ return /* @__PURE__ */ jsx4(
185
+ Component,
186
+ {
187
+ "data-mason-component": "box",
188
+ "data-tone": tone,
189
+ className: mergeClassName(className),
190
+ style: { ...boxStyle({ padding, tone, radius, bordered }), ...style },
191
+ ...rest,
192
+ children
193
+ }
194
+ );
195
+ }
196
+
197
+ // src/primitives/gridStyles.ts
198
+ var GRID_ALIGN = {
199
+ start: "start",
200
+ center: "center",
201
+ end: "end",
202
+ stretch: "stretch",
203
+ baseline: "baseline"
204
+ };
205
+ var GRID_JUSTIFY = {
206
+ start: "start",
207
+ center: "center",
208
+ end: "end",
209
+ between: "space-between"
210
+ };
211
+ function gridStyle({
212
+ columns = 2,
213
+ gap = "md",
214
+ align,
215
+ justify
216
+ }) {
217
+ return {
218
+ display: "grid",
219
+ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
220
+ gap: spacingVar("stack", gap),
221
+ minWidth: 0,
222
+ ...align ? { alignItems: GRID_ALIGN[align] } : null,
223
+ ...justify ? { justifyContent: GRID_JUSTIFY[justify] } : null
224
+ };
225
+ }
226
+
227
+ // src/primitives/Grid.tsx
228
+ import { jsx as jsx5 } from "react/jsx-runtime";
229
+ function Grid({
230
+ columns = 2,
231
+ gap = "md",
232
+ align,
233
+ justify,
234
+ className,
235
+ style,
236
+ children,
237
+ ...rest
238
+ }) {
239
+ return /* @__PURE__ */ jsx5(
240
+ "div",
241
+ {
242
+ "data-mason-component": "grid",
243
+ "data-columns": columns,
244
+ className: mergeClassName(className),
245
+ style: { ...gridStyle({ columns, gap, align, justify }), ...style },
246
+ ...rest,
247
+ children
248
+ }
249
+ );
250
+ }
251
+
252
+ // src/primitives/containerStyles.ts
253
+ function containerStyle({
254
+ maxWidth = "lg",
255
+ padding,
256
+ center = true
257
+ }) {
258
+ return {
259
+ display: "block",
260
+ boxSizing: "border-box",
261
+ width: "100%",
262
+ minWidth: 0,
263
+ maxWidth: containerMaxWidthVar(maxWidth),
264
+ ...center ? { marginInline: "auto" } : null,
265
+ ...padding ? { paddingInline: spacingVar("inline", padding) } : null
266
+ };
267
+ }
268
+
269
+ // src/primitives/Container.tsx
270
+ import { jsx as jsx6 } from "react/jsx-runtime";
271
+ function Container({
272
+ as = "div",
273
+ maxWidth = "lg",
274
+ padding,
275
+ center = true,
276
+ className,
277
+ style,
278
+ children,
279
+ ...rest
280
+ }) {
281
+ const Component = as;
282
+ return /* @__PURE__ */ jsx6(
283
+ Component,
284
+ {
285
+ "data-mason-component": "container",
286
+ "data-max-width": maxWidth,
287
+ className: mergeClassName(className),
288
+ style: { ...containerStyle({ maxWidth, padding, center }), ...style },
289
+ ...rest,
290
+ children
291
+ }
292
+ );
293
+ }
294
+
295
+ // src/primitives/cardStyles.ts
296
+ var TONE_BG2 = {
146
297
  surface: "color.bg.surface",
147
298
  canvas: "color.bg.canvas",
148
299
  elevated: "color.bg.elevated"
@@ -157,7 +308,7 @@ function cardStyle({
157
308
  return {
158
309
  display: "block",
159
310
  padding: spacingVar("inset", padding),
160
- backgroundColor: cssVar(TONE_BG[tone]),
311
+ backgroundColor: cssVar(TONE_BG2[tone]),
161
312
  color: cssVar("color.text.primary"),
162
313
  border: bordered ? `1px solid ${cssVar("color.border.subtle")}` : "none",
163
314
  borderRadius: radiusVar(radius),
@@ -167,8 +318,8 @@ function cardStyle({
167
318
  };
168
319
  }
169
320
 
170
- // src/Card.tsx
171
- import { jsx as jsx4 } from "react/jsx-runtime";
321
+ // src/primitives/Card.tsx
322
+ import { jsx as jsx7 } from "react/jsx-runtime";
172
323
  function Card({
173
324
  padding = "md",
174
325
  elevation = "sm",
@@ -180,7 +331,7 @@ function Card({
180
331
  children,
181
332
  ...rest
182
333
  }) {
183
- return /* @__PURE__ */ jsx4(
334
+ return /* @__PURE__ */ jsx7(
184
335
  "div",
185
336
  {
186
337
  "data-mason-component": "card",
@@ -196,7 +347,7 @@ function Card({
196
347
  );
197
348
  }
198
349
 
199
- // src/dividerStyles.ts
350
+ // src/primitives/dividerStyles.ts
200
351
  function dividerStyle(orientation = "horizontal") {
201
352
  const line = `1px solid ${cssVar("color.border.subtle")}`;
202
353
  if (orientation === "vertical") {
@@ -218,15 +369,15 @@ function dividerStyle(orientation = "horizontal") {
218
369
  };
219
370
  }
220
371
 
221
- // src/Divider.tsx
222
- import { jsx as jsx5 } from "react/jsx-runtime";
372
+ // src/primitives/Divider.tsx
373
+ import { jsx as jsx8 } from "react/jsx-runtime";
223
374
  function Divider({
224
375
  orientation = "horizontal",
225
376
  className,
226
377
  style,
227
378
  ...rest
228
379
  }) {
229
- return /* @__PURE__ */ jsx5(
380
+ return /* @__PURE__ */ jsx8(
230
381
  "hr",
231
382
  {
232
383
  "data-mason-component": "divider",
@@ -239,7 +390,7 @@ function Divider({
239
390
  );
240
391
  }
241
392
 
242
- // src/linkStyles.ts
393
+ // src/primitives/linkStyles.ts
243
394
  function linkStyle({
244
395
  tone = "link",
245
396
  underline = "hover"
@@ -253,8 +404,8 @@ function linkStyle({
253
404
  };
254
405
  }
255
406
 
256
- // src/Link.tsx
257
- import { jsx as jsx6 } from "react/jsx-runtime";
407
+ // src/primitives/Link.tsx
408
+ import { jsx as jsx9 } from "react/jsx-runtime";
258
409
  function Link({
259
410
  tone = "link",
260
411
  underline = "hover",
@@ -265,7 +416,7 @@ function Link({
265
416
  ...rest
266
417
  }) {
267
418
  const externalProps = external ? { target: "_blank", rel: "noreferrer noopener" } : null;
268
- return /* @__PURE__ */ jsx6(
419
+ return /* @__PURE__ */ jsx9(
269
420
  "a",
270
421
  {
271
422
  "data-mason-component": "link",
@@ -280,7 +431,7 @@ function Link({
280
431
  );
281
432
  }
282
433
 
283
- // src/spinnerStyles.ts
434
+ // src/primitives/spinnerStyles.ts
284
435
  var SIZE_DIMENSION = {
285
436
  sm: cssVar("font.body.sm.size"),
286
437
  md: cssVar("font.body.md.size"),
@@ -300,8 +451,8 @@ function spinnerStyle(size = "md") {
300
451
  };
301
452
  }
302
453
 
303
- // src/Spinner.tsx
304
- import { jsx as jsx7 } from "react/jsx-runtime";
454
+ // src/primitives/Spinner.tsx
455
+ import { jsx as jsx10 } from "react/jsx-runtime";
305
456
  function Spinner({
306
457
  size = "md",
307
458
  label,
@@ -309,7 +460,7 @@ function Spinner({
309
460
  style,
310
461
  ...rest
311
462
  }) {
312
- return /* @__PURE__ */ jsx7(
463
+ return /* @__PURE__ */ jsx10(
313
464
  "span",
314
465
  {
315
466
  "data-mason-component": "spinner",
@@ -324,14 +475,7 @@ function Spinner({
324
475
  );
325
476
  }
326
477
 
327
- // src/buttonStyles.ts
328
- function actionColors(variant) {
329
- return {
330
- bg: `color.action.${variant}.bg`,
331
- text: `color.action.${variant}.text`,
332
- border: `color.action.${variant}.border`
333
- };
334
- }
478
+ // src/primitives/buttonStyles.ts
335
479
  var sizeStyles = {
336
480
  sm: {
337
481
  paddingBlock: cssVar("spacing.inset.sm"),
@@ -355,14 +499,7 @@ var sizeStyles = {
355
499
  font: "label.lg"
356
500
  }
357
501
  };
358
- function buttonStyle({
359
- variant = "primary",
360
- size = "md",
361
- disabled = false,
362
- loading = false
363
- }) {
364
- const inactive = disabled || loading;
365
- const colors = actionColors(inactive ? "disabled" : variant);
502
+ function buttonStyle({ size = "md" }) {
366
503
  const sizing = sizeStyles[size];
367
504
  return {
368
505
  display: "inline-flex",
@@ -372,9 +509,6 @@ function buttonStyle({
372
509
  paddingBlock: sizing.paddingBlock,
373
510
  paddingInline: sizing.paddingInline,
374
511
  margin: 0,
375
- backgroundColor: cssVar(colors.bg),
376
- color: cssVar(colors.text),
377
- border: `1px solid ${cssVar(colors.border)}`,
378
512
  borderRadius: sizing.radius,
379
513
  boxSizing: "border-box",
380
514
  ...typographyStyle(sizing.font),
@@ -383,8 +517,8 @@ function buttonStyle({
383
517
  };
384
518
  }
385
519
 
386
- // src/Button.tsx
387
- import { jsx as jsx8, jsxs } from "react/jsx-runtime";
520
+ // src/primitives/Button.tsx
521
+ import { jsx as jsx11, jsxs } from "react/jsx-runtime";
388
522
  function Button({
389
523
  variant = "primary",
390
524
  size = "md",
@@ -410,20 +544,20 @@ function Button({
410
544
  "aria-busy": loading || void 0,
411
545
  className: mergeClassName(className),
412
546
  style: {
413
- ...buttonStyle({ variant, size, disabled, loading }),
547
+ ...buttonStyle({ size }),
414
548
  ...style
415
549
  },
416
550
  ...rest,
417
551
  children: [
418
- loading ? /* @__PURE__ */ jsx8(Spinner, { size: "inherit", "data-mason-slot": "spinner" }) : leadingSlot ? /* @__PURE__ */ jsx8("span", { "data-mason-slot": "leading", children: leadingSlot }) : null,
419
- children ? /* @__PURE__ */ jsx8("span", { "data-mason-slot": "label", children }) : null,
420
- trailingSlot && !loading ? /* @__PURE__ */ jsx8("span", { "data-mason-slot": "trailing", children: trailingSlot }) : null
552
+ loading ? /* @__PURE__ */ jsx11(Spinner, { size: "inherit", "data-mason-slot": "spinner" }) : leadingSlot ? /* @__PURE__ */ jsx11("span", { "data-mason-slot": "leading", children: leadingSlot }) : null,
553
+ children ? /* @__PURE__ */ jsx11("span", { "data-mason-slot": "label", children }) : null,
554
+ trailingSlot && !loading ? /* @__PURE__ */ jsx11("span", { "data-mason-slot": "trailing", children: trailingSlot }) : null
421
555
  ]
422
556
  }
423
557
  );
424
558
  }
425
559
 
426
- // src/badgeStyles.ts
560
+ // src/primitives/badgeStyles.ts
427
561
  function badgeStyle({
428
562
  tone = "neutral",
429
563
  size = "sm"
@@ -452,8 +586,8 @@ function badgeStyle({
452
586
  };
453
587
  }
454
588
 
455
- // src/Badge.tsx
456
- import { jsx as jsx9 } from "react/jsx-runtime";
589
+ // src/primitives/Badge.tsx
590
+ import { jsx as jsx12 } from "react/jsx-runtime";
457
591
  function Badge({
458
592
  tone = "neutral",
459
593
  size = "sm",
@@ -462,7 +596,7 @@ function Badge({
462
596
  children,
463
597
  ...rest
464
598
  }) {
465
- return /* @__PURE__ */ jsx9(
599
+ return /* @__PURE__ */ jsx12(
466
600
  "span",
467
601
  {
468
602
  "data-mason-component": "badge",
@@ -476,7 +610,7 @@ function Badge({
476
610
  );
477
611
  }
478
612
 
479
- // src/calloutStyles.ts
613
+ // src/primitives/calloutStyles.ts
480
614
  function calloutStyle(tone = "info") {
481
615
  return {
482
616
  display: "flex",
@@ -505,8 +639,8 @@ function calloutBodyStyle() {
505
639
  return { margin: 0, ...typographyStyle("body.sm") };
506
640
  }
507
641
 
508
- // src/Callout.tsx
509
- import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
642
+ // src/primitives/Callout.tsx
643
+ import { jsx as jsx13, jsxs as jsxs2 } from "react/jsx-runtime";
510
644
  function Callout({
511
645
  tone = "info",
512
646
  title,
@@ -525,20 +659,20 @@ function Callout({
525
659
  style: { ...calloutStyle(tone), ...style },
526
660
  ...rest,
527
661
  children: [
528
- iconSlot ? /* @__PURE__ */ jsx10("span", { "data-mason-slot": "icon", "aria-hidden": "true", children: iconSlot }) : null,
662
+ iconSlot ? /* @__PURE__ */ jsx13("span", { "data-mason-slot": "icon", "aria-hidden": "true", children: iconSlot }) : null,
529
663
  /* @__PURE__ */ jsxs2("div", { "data-mason-slot": "content", style: calloutContentStyle(), children: [
530
- title ? /* @__PURE__ */ jsx10("p", { "data-mason-slot": "title", style: calloutTitleStyle(), children: title }) : null,
531
- children ? /* @__PURE__ */ jsx10("div", { "data-mason-slot": "body", style: calloutBodyStyle(), children }) : null
664
+ title ? /* @__PURE__ */ jsx13("p", { "data-mason-slot": "title", style: calloutTitleStyle(), children: title }) : null,
665
+ children ? /* @__PURE__ */ jsx13("div", { "data-mason-slot": "body", style: calloutBodyStyle(), children }) : null
532
666
  ] })
533
667
  ]
534
668
  }
535
669
  );
536
670
  }
537
671
 
538
- // src/field.tsx
672
+ // src/compounds/field.tsx
539
673
  import { useId } from "react";
540
674
 
541
- // src/fieldStyles.ts
675
+ // src/compounds/fieldStyles.ts
542
676
  var CONTROL_FONT = {
543
677
  sm: "body.sm",
544
678
  md: "body.md",
@@ -602,10 +736,12 @@ function fieldErrorStyle() {
602
736
  function visuallyHiddenControlStyle() {
603
737
  return {
604
738
  position: "absolute",
739
+ left: 0,
740
+ top: 0,
605
741
  width: 1,
606
742
  height: 1,
607
743
  padding: 0,
608
- margin: -1,
744
+ margin: 0,
609
745
  overflow: "hidden",
610
746
  clip: "rect(0, 0, 0, 0)",
611
747
  whiteSpace: "nowrap",
@@ -615,8 +751,8 @@ function visuallyHiddenControlStyle() {
615
751
  };
616
752
  }
617
753
 
618
- // src/field.tsx
619
- import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
754
+ // src/compounds/field.tsx
755
+ import { jsx as jsx14, jsxs as jsxs3 } from "react/jsx-runtime";
620
756
  function useFieldIds({
621
757
  id,
622
758
  description,
@@ -652,7 +788,7 @@ function FieldFrame({
652
788
  className: mergeClassName(className),
653
789
  style: { ...fieldRootStyle(), ...style },
654
790
  children: [
655
- label ? /* @__PURE__ */ jsx11(
791
+ label ? /* @__PURE__ */ jsx14(
656
792
  "label",
657
793
  {
658
794
  "data-mason-slot": "label",
@@ -662,7 +798,7 @@ function FieldFrame({
662
798
  }
663
799
  ) : null,
664
800
  children,
665
- description ? /* @__PURE__ */ jsx11(
801
+ description ? /* @__PURE__ */ jsx14(
666
802
  "p",
667
803
  {
668
804
  "data-mason-slot": "description",
@@ -671,7 +807,7 @@ function FieldFrame({
671
807
  children: description
672
808
  }
673
809
  ) : null,
674
- error ? /* @__PURE__ */ jsx11(
810
+ error ? /* @__PURE__ */ jsx14(
675
811
  "p",
676
812
  {
677
813
  "data-mason-slot": "error",
@@ -686,8 +822,8 @@ function FieldFrame({
686
822
  );
687
823
  }
688
824
 
689
- // src/TextField.tsx
690
- import { jsx as jsx12 } from "react/jsx-runtime";
825
+ // src/compounds/TextField.tsx
826
+ import { jsx as jsx15 } from "react/jsx-runtime";
691
827
  function TextField({
692
828
  label,
693
829
  description,
@@ -702,7 +838,7 @@ function TextField({
702
838
  }) {
703
839
  const ids = useFieldIds({ id, description, error });
704
840
  const isInvalid = invalid ?? Boolean(error);
705
- return /* @__PURE__ */ jsx12(
841
+ return /* @__PURE__ */ jsx15(
706
842
  FieldFrame,
707
843
  {
708
844
  component: "text-field",
@@ -715,7 +851,7 @@ function TextField({
715
851
  disabled,
716
852
  className,
717
853
  style,
718
- children: /* @__PURE__ */ jsx12(
854
+ children: /* @__PURE__ */ jsx15(
719
855
  "input",
720
856
  {
721
857
  ...rest,
@@ -731,8 +867,8 @@ function TextField({
731
867
  );
732
868
  }
733
869
 
734
- // src/Select.tsx
735
- import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
870
+ // src/compounds/Select.tsx
871
+ import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
736
872
  function Select({
737
873
  label,
738
874
  description,
@@ -749,7 +885,7 @@ function Select({
749
885
  }) {
750
886
  const ids = useFieldIds({ id, description, error });
751
887
  const isInvalid = invalid ?? Boolean(error);
752
- return /* @__PURE__ */ jsx13(
888
+ return /* @__PURE__ */ jsx16(
753
889
  FieldFrame,
754
890
  {
755
891
  component: "select",
@@ -773,7 +909,7 @@ function Select({
773
909
  "aria-describedby": ids.describedBy,
774
910
  style: fieldControlStyle({ size, invalid: isInvalid, disabled }),
775
911
  children: [
776
- placeholder ? /* @__PURE__ */ jsx13("option", { value: "", children: placeholder }) : null,
912
+ placeholder ? /* @__PURE__ */ jsx16("option", { value: "", children: placeholder }) : null,
777
913
  children
778
914
  ]
779
915
  }
@@ -782,10 +918,11 @@ function Select({
782
918
  );
783
919
  }
784
920
 
785
- // src/checkboxStyles.ts
921
+ // src/compounds/checkboxStyles.ts
786
922
  var CONTROL_SIZE = "1.125rem";
787
923
  function checkboxRootStyle() {
788
924
  return {
925
+ position: "relative",
789
926
  display: "flex",
790
927
  flexDirection: "column",
791
928
  gap: spacingVar("stack", "sm"),
@@ -818,8 +955,8 @@ function checkboxIndicatorStyle() {
818
955
  };
819
956
  }
820
957
 
821
- // src/Checkbox.tsx
822
- import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
958
+ // src/compounds/Checkbox.tsx
959
+ import { jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
823
960
  function Checkbox({
824
961
  label,
825
962
  description,
@@ -849,7 +986,7 @@ function Checkbox({
849
986
  htmlFor: ids.controlId,
850
987
  style: checkboxLabelStyle(disabled),
851
988
  children: [
852
- /* @__PURE__ */ jsx14(
989
+ /* @__PURE__ */ jsx17(
853
990
  "input",
854
991
  {
855
992
  ...rest,
@@ -862,12 +999,12 @@ function Checkbox({
862
999
  style: visuallyHiddenControlStyle()
863
1000
  }
864
1001
  ),
865
- /* @__PURE__ */ jsx14("span", { "data-mason-slot": "indicator", "aria-hidden": "true", style: checkboxIndicatorStyle() }),
866
- label ? /* @__PURE__ */ jsx14("span", { "data-mason-slot": "label-text", children: label }) : null
1002
+ /* @__PURE__ */ jsx17("span", { "data-mason-slot": "indicator", "aria-hidden": "true", style: checkboxIndicatorStyle() }),
1003
+ label ? /* @__PURE__ */ jsx17("span", { "data-mason-slot": "label-text", children: label }) : null
867
1004
  ]
868
1005
  }
869
1006
  ),
870
- description ? /* @__PURE__ */ jsx14(
1007
+ description ? /* @__PURE__ */ jsx17(
871
1008
  "p",
872
1009
  {
873
1010
  "data-mason-slot": "description",
@@ -876,7 +1013,7 @@ function Checkbox({
876
1013
  children: description
877
1014
  }
878
1015
  ) : null,
879
- error ? /* @__PURE__ */ jsx14(
1016
+ error ? /* @__PURE__ */ jsx17(
880
1017
  "p",
881
1018
  {
882
1019
  "data-mason-slot": "error",
@@ -891,10 +1028,11 @@ function Checkbox({
891
1028
  );
892
1029
  }
893
1030
 
894
- // src/radioStyles.ts
1031
+ // src/compounds/radioStyles.ts
895
1032
  var CONTROL_SIZE2 = "1.125rem";
896
1033
  function radioRootStyle() {
897
1034
  return {
1035
+ position: "relative",
898
1036
  display: "flex",
899
1037
  flexDirection: "column",
900
1038
  gap: spacingVar("stack", "sm"),
@@ -927,8 +1065,8 @@ function radioIndicatorStyle() {
927
1065
  };
928
1066
  }
929
1067
 
930
- // src/Radio.tsx
931
- import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
1068
+ // src/compounds/Radio.tsx
1069
+ import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
932
1070
  function Radio({
933
1071
  label,
934
1072
  description,
@@ -958,7 +1096,7 @@ function Radio({
958
1096
  htmlFor: ids.controlId,
959
1097
  style: radioLabelStyle(disabled),
960
1098
  children: [
961
- /* @__PURE__ */ jsx15(
1099
+ /* @__PURE__ */ jsx18(
962
1100
  "input",
963
1101
  {
964
1102
  ...rest,
@@ -971,12 +1109,140 @@ function Radio({
971
1109
  style: visuallyHiddenControlStyle()
972
1110
  }
973
1111
  ),
974
- /* @__PURE__ */ jsx15("span", { "data-mason-slot": "indicator", "aria-hidden": "true", style: radioIndicatorStyle() }),
975
- label ? /* @__PURE__ */ jsx15("span", { "data-mason-slot": "label-text", children: label }) : null
1112
+ /* @__PURE__ */ jsx18("span", { "data-mason-slot": "indicator", "aria-hidden": "true", style: radioIndicatorStyle() }),
1113
+ label ? /* @__PURE__ */ jsx18("span", { "data-mason-slot": "label-text", children: label }) : null
1114
+ ]
1115
+ }
1116
+ ),
1117
+ description ? /* @__PURE__ */ jsx18(
1118
+ "p",
1119
+ {
1120
+ "data-mason-slot": "description",
1121
+ id: ids.descriptionId,
1122
+ style: fieldDescriptionStyle(),
1123
+ children: description
1124
+ }
1125
+ ) : null,
1126
+ error ? /* @__PURE__ */ jsx18(
1127
+ "p",
1128
+ {
1129
+ "data-mason-slot": "error",
1130
+ id: ids.errorId,
1131
+ role: "alert",
1132
+ style: fieldErrorStyle(),
1133
+ children: error
1134
+ }
1135
+ ) : null
1136
+ ]
1137
+ }
1138
+ );
1139
+ }
1140
+
1141
+ // src/compounds/toggleStyles.ts
1142
+ var TRACK = {
1143
+ sm: { width: "1.75rem", height: "1rem" },
1144
+ md: { width: "2.25rem", height: "1.25rem" },
1145
+ lg: { width: "2.75rem", height: "1.5rem" }
1146
+ };
1147
+ var THUMB = {
1148
+ sm: "0.75rem",
1149
+ md: "1rem",
1150
+ lg: "1.25rem"
1151
+ };
1152
+ function toggleRootStyle() {
1153
+ return {
1154
+ position: "relative",
1155
+ display: "flex",
1156
+ flexDirection: "column",
1157
+ gap: spacingVar("stack", "sm"),
1158
+ minWidth: 0
1159
+ };
1160
+ }
1161
+ function toggleLabelStyle(disabled = false) {
1162
+ return {
1163
+ display: "inline-flex",
1164
+ alignItems: "center",
1165
+ gap: spacingVar("inline", "sm"),
1166
+ cursor: disabled ? "not-allowed" : "pointer",
1167
+ color: disabled ? cssVar("color.text.disabled") : cssVar("color.text.primary"),
1168
+ ...typographyStyle("label.md")
1169
+ };
1170
+ }
1171
+ function toggleIndicatorStyle(size = "md") {
1172
+ return {
1173
+ position: "relative",
1174
+ display: "inline-flex",
1175
+ alignItems: "center",
1176
+ width: TRACK[size].width,
1177
+ height: TRACK[size].height,
1178
+ padding: "0.125rem",
1179
+ flexShrink: 0,
1180
+ boxSizing: "border-box",
1181
+ borderRadius: radiusVar("full")
1182
+ };
1183
+ }
1184
+ function toggleThumbStyle(size = "md") {
1185
+ return {
1186
+ width: THUMB[size],
1187
+ height: THUMB[size],
1188
+ borderRadius: radiusVar("full"),
1189
+ flexShrink: 0
1190
+ };
1191
+ }
1192
+
1193
+ // src/compounds/Toggle.tsx
1194
+ import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
1195
+ function Toggle({
1196
+ label,
1197
+ description,
1198
+ error,
1199
+ invalid,
1200
+ size = "md",
1201
+ id,
1202
+ disabled = false,
1203
+ className,
1204
+ style,
1205
+ ...rest
1206
+ }) {
1207
+ const ids = useFieldIds({ id, description, error });
1208
+ const isInvalid = invalid ?? Boolean(error);
1209
+ return /* @__PURE__ */ jsxs7(
1210
+ "div",
1211
+ {
1212
+ "data-mason-component": "toggle",
1213
+ "data-size": size,
1214
+ "data-invalid": isInvalid || void 0,
1215
+ "data-disabled": disabled || void 0,
1216
+ className: mergeClassName(className),
1217
+ style: { ...toggleRootStyle(), ...style },
1218
+ children: [
1219
+ /* @__PURE__ */ jsxs7(
1220
+ "label",
1221
+ {
1222
+ "data-mason-slot": "label",
1223
+ htmlFor: ids.controlId,
1224
+ style: toggleLabelStyle(disabled),
1225
+ children: [
1226
+ label ? /* @__PURE__ */ jsx19("span", { "data-mason-slot": "label-text", children: label }) : null,
1227
+ /* @__PURE__ */ jsx19(
1228
+ "input",
1229
+ {
1230
+ ...rest,
1231
+ type: "checkbox",
1232
+ role: "switch",
1233
+ id: ids.controlId,
1234
+ "data-mason-slot": "control",
1235
+ disabled,
1236
+ "aria-invalid": isInvalid || void 0,
1237
+ "aria-describedby": ids.describedBy,
1238
+ style: visuallyHiddenControlStyle()
1239
+ }
1240
+ ),
1241
+ /* @__PURE__ */ jsx19("span", { "data-mason-slot": "indicator", "aria-hidden": "true", style: toggleIndicatorStyle(size), children: /* @__PURE__ */ jsx19("span", { "data-mason-slot": "thumb", style: toggleThumbStyle(size) }) })
976
1242
  ]
977
1243
  }
978
1244
  ),
979
- description ? /* @__PURE__ */ jsx15(
1245
+ description ? /* @__PURE__ */ jsx19(
980
1246
  "p",
981
1247
  {
982
1248
  "data-mason-slot": "description",
@@ -985,7 +1251,7 @@ function Radio({
985
1251
  children: description
986
1252
  }
987
1253
  ) : null,
988
- error ? /* @__PURE__ */ jsx15(
1254
+ error ? /* @__PURE__ */ jsx19(
989
1255
  "p",
990
1256
  {
991
1257
  "data-mason-slot": "error",
@@ -1001,11 +1267,14 @@ function Radio({
1001
1267
  }
1002
1268
  export {
1003
1269
  Badge,
1270
+ Box,
1004
1271
  Button,
1005
1272
  Callout,
1006
1273
  Card,
1007
1274
  Checkbox,
1275
+ Container,
1008
1276
  Divider,
1277
+ Grid,
1009
1278
  Link,
1010
1279
  MasonProvider,
1011
1280
  Radio,
@@ -1013,6 +1282,7 @@ export {
1013
1282
  Spinner,
1014
1283
  Stack,
1015
1284
  Text,
1016
- TextField
1285
+ TextField,
1286
+ Toggle
1017
1287
  };
1018
1288
  //# sourceMappingURL=index.js.map