@mason-ds/react 0.2.0 → 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",
@@ -599,9 +733,26 @@ function fieldErrorStyle() {
599
733
  ...typographyStyle("body.sm")
600
734
  };
601
735
  }
736
+ function visuallyHiddenControlStyle() {
737
+ return {
738
+ position: "absolute",
739
+ left: 0,
740
+ top: 0,
741
+ width: 1,
742
+ height: 1,
743
+ padding: 0,
744
+ margin: 0,
745
+ overflow: "hidden",
746
+ clip: "rect(0, 0, 0, 0)",
747
+ whiteSpace: "nowrap",
748
+ borderWidth: 0,
749
+ borderStyle: "solid",
750
+ borderColor: "transparent"
751
+ };
752
+ }
602
753
 
603
- // src/field.tsx
604
- 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";
605
756
  function useFieldIds({
606
757
  id,
607
758
  description,
@@ -637,7 +788,7 @@ function FieldFrame({
637
788
  className: mergeClassName(className),
638
789
  style: { ...fieldRootStyle(), ...style },
639
790
  children: [
640
- label ? /* @__PURE__ */ jsx11(
791
+ label ? /* @__PURE__ */ jsx14(
641
792
  "label",
642
793
  {
643
794
  "data-mason-slot": "label",
@@ -647,7 +798,7 @@ function FieldFrame({
647
798
  }
648
799
  ) : null,
649
800
  children,
650
- description ? /* @__PURE__ */ jsx11(
801
+ description ? /* @__PURE__ */ jsx14(
651
802
  "p",
652
803
  {
653
804
  "data-mason-slot": "description",
@@ -656,7 +807,7 @@ function FieldFrame({
656
807
  children: description
657
808
  }
658
809
  ) : null,
659
- error ? /* @__PURE__ */ jsx11(
810
+ error ? /* @__PURE__ */ jsx14(
660
811
  "p",
661
812
  {
662
813
  "data-mason-slot": "error",
@@ -671,8 +822,8 @@ function FieldFrame({
671
822
  );
672
823
  }
673
824
 
674
- // src/TextField.tsx
675
- import { jsx as jsx12 } from "react/jsx-runtime";
825
+ // src/compounds/TextField.tsx
826
+ import { jsx as jsx15 } from "react/jsx-runtime";
676
827
  function TextField({
677
828
  label,
678
829
  description,
@@ -687,7 +838,7 @@ function TextField({
687
838
  }) {
688
839
  const ids = useFieldIds({ id, description, error });
689
840
  const isInvalid = invalid ?? Boolean(error);
690
- return /* @__PURE__ */ jsx12(
841
+ return /* @__PURE__ */ jsx15(
691
842
  FieldFrame,
692
843
  {
693
844
  component: "text-field",
@@ -700,7 +851,7 @@ function TextField({
700
851
  disabled,
701
852
  className,
702
853
  style,
703
- children: /* @__PURE__ */ jsx12(
854
+ children: /* @__PURE__ */ jsx15(
704
855
  "input",
705
856
  {
706
857
  ...rest,
@@ -716,8 +867,8 @@ function TextField({
716
867
  );
717
868
  }
718
869
 
719
- // src/Select.tsx
720
- 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";
721
872
  function Select({
722
873
  label,
723
874
  description,
@@ -734,7 +885,7 @@ function Select({
734
885
  }) {
735
886
  const ids = useFieldIds({ id, description, error });
736
887
  const isInvalid = invalid ?? Boolean(error);
737
- return /* @__PURE__ */ jsx13(
888
+ return /* @__PURE__ */ jsx16(
738
889
  FieldFrame,
739
890
  {
740
891
  component: "select",
@@ -758,7 +909,7 @@ function Select({
758
909
  "aria-describedby": ids.describedBy,
759
910
  style: fieldControlStyle({ size, invalid: isInvalid, disabled }),
760
911
  children: [
761
- placeholder ? /* @__PURE__ */ jsx13("option", { value: "", children: placeholder }) : null,
912
+ placeholder ? /* @__PURE__ */ jsx16("option", { value: "", children: placeholder }) : null,
762
913
  children
763
914
  ]
764
915
  }
@@ -767,9 +918,11 @@ function Select({
767
918
  );
768
919
  }
769
920
 
770
- // src/checkboxStyles.ts
921
+ // src/compounds/checkboxStyles.ts
922
+ var CONTROL_SIZE = "1.125rem";
771
923
  function checkboxRootStyle() {
772
924
  return {
925
+ position: "relative",
773
926
  display: "flex",
774
927
  flexDirection: "column",
775
928
  gap: spacingVar("stack", "sm"),
@@ -786,19 +939,24 @@ function checkboxLabelStyle(disabled = false) {
786
939
  ...typographyStyle("body.md")
787
940
  };
788
941
  }
789
- function checkboxControlStyle() {
942
+ function checkboxIndicatorStyle() {
790
943
  return {
791
- width: "1em",
792
- height: "1em",
793
- margin: 0,
794
- marginBlockStart: "0.15em",
795
- accentColor: cssVar("color.action.primary.bg"),
796
- flexShrink: 0
944
+ display: "inline-flex",
945
+ alignItems: "center",
946
+ justifyContent: "center",
947
+ width: CONTROL_SIZE,
948
+ height: CONTROL_SIZE,
949
+ marginBlockStart: "0.2em",
950
+ flexShrink: 0,
951
+ boxSizing: "border-box",
952
+ borderRadius: radiusVar("sm"),
953
+ borderStyle: "solid",
954
+ borderWidth: "1.5px"
797
955
  };
798
956
  }
799
957
 
800
- // src/Checkbox.tsx
801
- 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";
802
960
  function Checkbox({
803
961
  label,
804
962
  description,
@@ -828,7 +986,7 @@ function Checkbox({
828
986
  htmlFor: ids.controlId,
829
987
  style: checkboxLabelStyle(disabled),
830
988
  children: [
831
- /* @__PURE__ */ jsx14(
989
+ /* @__PURE__ */ jsx17(
832
990
  "input",
833
991
  {
834
992
  ...rest,
@@ -838,14 +996,15 @@ function Checkbox({
838
996
  disabled,
839
997
  "aria-invalid": isInvalid || void 0,
840
998
  "aria-describedby": ids.describedBy,
841
- style: checkboxControlStyle()
999
+ style: visuallyHiddenControlStyle()
842
1000
  }
843
1001
  ),
844
- 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
845
1004
  ]
846
1005
  }
847
1006
  ),
848
- description ? /* @__PURE__ */ jsx14(
1007
+ description ? /* @__PURE__ */ jsx17(
849
1008
  "p",
850
1009
  {
851
1010
  "data-mason-slot": "description",
@@ -854,7 +1013,245 @@ function Checkbox({
854
1013
  children: description
855
1014
  }
856
1015
  ) : null,
857
- error ? /* @__PURE__ */ jsx14(
1016
+ error ? /* @__PURE__ */ jsx17(
1017
+ "p",
1018
+ {
1019
+ "data-mason-slot": "error",
1020
+ id: ids.errorId,
1021
+ role: "alert",
1022
+ style: fieldErrorStyle(),
1023
+ children: error
1024
+ }
1025
+ ) : null
1026
+ ]
1027
+ }
1028
+ );
1029
+ }
1030
+
1031
+ // src/compounds/radioStyles.ts
1032
+ var CONTROL_SIZE2 = "1.125rem";
1033
+ function radioRootStyle() {
1034
+ return {
1035
+ position: "relative",
1036
+ display: "flex",
1037
+ flexDirection: "column",
1038
+ gap: spacingVar("stack", "sm"),
1039
+ minWidth: 0
1040
+ };
1041
+ }
1042
+ function radioLabelStyle(disabled = false) {
1043
+ return {
1044
+ display: "inline-flex",
1045
+ alignItems: "flex-start",
1046
+ gap: spacingVar("inline", "sm"),
1047
+ cursor: disabled ? "not-allowed" : "pointer",
1048
+ color: disabled ? cssVar("color.text.disabled") : cssVar("color.text.primary"),
1049
+ ...typographyStyle("body.md")
1050
+ };
1051
+ }
1052
+ function radioIndicatorStyle() {
1053
+ return {
1054
+ display: "inline-flex",
1055
+ alignItems: "center",
1056
+ justifyContent: "center",
1057
+ width: CONTROL_SIZE2,
1058
+ height: CONTROL_SIZE2,
1059
+ marginBlockStart: "0.2em",
1060
+ flexShrink: 0,
1061
+ boxSizing: "border-box",
1062
+ borderRadius: "999px",
1063
+ borderStyle: "solid",
1064
+ borderWidth: "1.5px"
1065
+ };
1066
+ }
1067
+
1068
+ // src/compounds/Radio.tsx
1069
+ import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
1070
+ function Radio({
1071
+ label,
1072
+ description,
1073
+ error,
1074
+ invalid,
1075
+ id,
1076
+ disabled = false,
1077
+ className,
1078
+ style,
1079
+ ...rest
1080
+ }) {
1081
+ const ids = useFieldIds({ id, description, error });
1082
+ const isInvalid = invalid ?? Boolean(error);
1083
+ return /* @__PURE__ */ jsxs6(
1084
+ "div",
1085
+ {
1086
+ "data-mason-component": "radio",
1087
+ "data-invalid": isInvalid || void 0,
1088
+ "data-disabled": disabled || void 0,
1089
+ className: mergeClassName(className),
1090
+ style: { ...radioRootStyle(), ...style },
1091
+ children: [
1092
+ /* @__PURE__ */ jsxs6(
1093
+ "label",
1094
+ {
1095
+ "data-mason-slot": "label",
1096
+ htmlFor: ids.controlId,
1097
+ style: radioLabelStyle(disabled),
1098
+ children: [
1099
+ /* @__PURE__ */ jsx18(
1100
+ "input",
1101
+ {
1102
+ ...rest,
1103
+ type: "radio",
1104
+ id: ids.controlId,
1105
+ "data-mason-slot": "control",
1106
+ disabled,
1107
+ "aria-invalid": isInvalid || void 0,
1108
+ "aria-describedby": ids.describedBy,
1109
+ style: visuallyHiddenControlStyle()
1110
+ }
1111
+ ),
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) }) })
1242
+ ]
1243
+ }
1244
+ ),
1245
+ description ? /* @__PURE__ */ jsx19(
1246
+ "p",
1247
+ {
1248
+ "data-mason-slot": "description",
1249
+ id: ids.descriptionId,
1250
+ style: fieldDescriptionStyle(),
1251
+ children: description
1252
+ }
1253
+ ) : null,
1254
+ error ? /* @__PURE__ */ jsx19(
858
1255
  "p",
859
1256
  {
860
1257
  "data-mason-slot": "error",
@@ -870,17 +1267,22 @@ function Checkbox({
870
1267
  }
871
1268
  export {
872
1269
  Badge,
1270
+ Box,
873
1271
  Button,
874
1272
  Callout,
875
1273
  Card,
876
1274
  Checkbox,
1275
+ Container,
877
1276
  Divider,
1277
+ Grid,
878
1278
  Link,
879
1279
  MasonProvider,
1280
+ Radio,
880
1281
  Select,
881
1282
  Spinner,
882
1283
  Stack,
883
1284
  Text,
884
- TextField
1285
+ TextField,
1286
+ Toggle
885
1287
  };
886
1288
  //# sourceMappingURL=index.js.map