@mason-ds/vue 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
@@ -20,7 +20,7 @@ var MasonProvider = defineComponent({
20
20
  }
21
21
  });
22
22
 
23
- // src/Text.ts
23
+ // src/primitives/Text.ts
24
24
  import { defineComponent as defineComponent2, h as h2 } from "vue";
25
25
 
26
26
  // src/styles.ts
@@ -31,6 +31,9 @@ function cssVar(path) {
31
31
  function spacingVar(axis, level) {
32
32
  return cssVar(`spacing.${axis}.${level}`);
33
33
  }
34
+ function containerMaxWidthVar(level) {
35
+ return cssVar(`spacing.layout.container.${level}`);
36
+ }
34
37
  function radiusVar(level) {
35
38
  return cssVar(`radius.${level}`);
36
39
  }
@@ -54,7 +57,7 @@ function mergeClassName(...parts) {
54
57
  return merged.length > 0 ? merged : void 0;
55
58
  }
56
59
 
57
- // src/textStyles.ts
60
+ // src/primitives/textStyles.ts
58
61
  function textStyle({
59
62
  variant = "body.md",
60
63
  tone = "primary",
@@ -70,7 +73,7 @@ function textStyle({
70
73
  };
71
74
  }
72
75
 
73
- // src/Text.ts
76
+ // src/primitives/Text.ts
74
77
  var Text = defineComponent2({
75
78
  name: "MasonText",
76
79
  inheritAttrs: false,
@@ -122,10 +125,10 @@ var Text = defineComponent2({
122
125
  }
123
126
  });
124
127
 
125
- // src/Stack.ts
128
+ // src/primitives/Stack.ts
126
129
  import { defineComponent as defineComponent3, h as h3 } from "vue";
127
130
 
128
- // src/stackStyles.ts
131
+ // src/primitives/stackStyles.ts
129
132
  var FLEX_ALIGN = {
130
133
  start: "flex-start",
131
134
  center: "center",
@@ -158,7 +161,7 @@ function stackStyle({
158
161
  };
159
162
  }
160
163
 
161
- // src/Stack.ts
164
+ // src/primitives/Stack.ts
162
165
  var Stack = defineComponent3({
163
166
  name: "MasonStack",
164
167
  inheritAttrs: false,
@@ -216,11 +219,237 @@ var Stack = defineComponent3({
216
219
  }
217
220
  });
218
221
 
219
- // src/Card.ts
222
+ // src/primitives/Box.ts
220
223
  import { defineComponent as defineComponent4, h as h4 } from "vue";
221
224
 
222
- // src/cardStyles.ts
225
+ // src/primitives/boxStyles.ts
223
226
  var TONE_BG = {
227
+ canvas: "color.bg.canvas",
228
+ surface: "color.bg.surface",
229
+ elevated: "color.bg.elevated"
230
+ };
231
+ function boxStyle({
232
+ padding,
233
+ tone = "transparent",
234
+ radius,
235
+ bordered = false
236
+ }) {
237
+ return {
238
+ display: "block",
239
+ boxSizing: "border-box",
240
+ minWidth: 0,
241
+ ...padding ? { padding: spacingVar("inset", padding) } : null,
242
+ ...tone !== "transparent" ? { backgroundColor: cssVar(TONE_BG[tone]) } : null,
243
+ ...radius ? { borderRadius: radiusVar(radius) } : null,
244
+ ...bordered ? { border: `1px solid ${cssVar("color.border.subtle")}` } : null
245
+ };
246
+ }
247
+
248
+ // src/primitives/Box.ts
249
+ var Box = defineComponent4({
250
+ name: "MasonBox",
251
+ inheritAttrs: false,
252
+ props: {
253
+ as: {
254
+ type: String,
255
+ default: "div"
256
+ },
257
+ padding: {
258
+ type: String,
259
+ default: void 0
260
+ },
261
+ tone: {
262
+ type: String,
263
+ default: "transparent"
264
+ },
265
+ radius: {
266
+ type: String,
267
+ default: void 0
268
+ },
269
+ bordered: {
270
+ type: Boolean,
271
+ default: false
272
+ }
273
+ },
274
+ setup(props, { slots, attrs }) {
275
+ return () => {
276
+ const { class: attrClass, style: attrStyle, ...rest } = attrs;
277
+ return h4(
278
+ props.as,
279
+ {
280
+ ...rest,
281
+ "data-mason-component": "box",
282
+ "data-tone": props.tone,
283
+ class: mergeClassName(attrClass),
284
+ style: [
285
+ boxStyle({
286
+ padding: props.padding,
287
+ tone: props.tone,
288
+ radius: props.radius,
289
+ bordered: props.bordered
290
+ }),
291
+ attrStyle
292
+ ]
293
+ },
294
+ slots.default?.()
295
+ );
296
+ };
297
+ }
298
+ });
299
+
300
+ // src/primitives/Grid.ts
301
+ import { defineComponent as defineComponent5, h as h5 } from "vue";
302
+
303
+ // src/primitives/gridStyles.ts
304
+ var GRID_ALIGN = {
305
+ start: "start",
306
+ center: "center",
307
+ end: "end",
308
+ stretch: "stretch",
309
+ baseline: "baseline"
310
+ };
311
+ var GRID_JUSTIFY = {
312
+ start: "start",
313
+ center: "center",
314
+ end: "end",
315
+ between: "space-between"
316
+ };
317
+ function gridStyle({
318
+ columns = 2,
319
+ gap = "md",
320
+ align,
321
+ justify
322
+ }) {
323
+ return {
324
+ display: "grid",
325
+ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
326
+ gap: spacingVar("stack", gap),
327
+ minWidth: 0,
328
+ ...align ? { alignItems: GRID_ALIGN[align] } : null,
329
+ ...justify ? { justifyContent: GRID_JUSTIFY[justify] } : null
330
+ };
331
+ }
332
+
333
+ // src/primitives/Grid.ts
334
+ var Grid = defineComponent5({
335
+ name: "MasonGrid",
336
+ inheritAttrs: false,
337
+ props: {
338
+ columns: {
339
+ type: Number,
340
+ default: 2
341
+ },
342
+ gap: {
343
+ type: String,
344
+ default: "md"
345
+ },
346
+ align: {
347
+ type: String,
348
+ default: void 0
349
+ },
350
+ justify: {
351
+ type: String,
352
+ default: void 0
353
+ }
354
+ },
355
+ setup(props, { slots, attrs }) {
356
+ return () => {
357
+ const { class: attrClass, style: attrStyle, ...rest } = attrs;
358
+ return h5(
359
+ "div",
360
+ {
361
+ ...rest,
362
+ "data-mason-component": "grid",
363
+ "data-columns": props.columns,
364
+ class: mergeClassName(attrClass),
365
+ style: [
366
+ gridStyle({
367
+ columns: props.columns,
368
+ gap: props.gap,
369
+ align: props.align,
370
+ justify: props.justify
371
+ }),
372
+ attrStyle
373
+ ]
374
+ },
375
+ slots.default?.()
376
+ );
377
+ };
378
+ }
379
+ });
380
+
381
+ // src/primitives/Container.ts
382
+ import { defineComponent as defineComponent6, h as h6 } from "vue";
383
+
384
+ // src/primitives/containerStyles.ts
385
+ function containerStyle({
386
+ maxWidth = "lg",
387
+ padding,
388
+ center = true
389
+ }) {
390
+ return {
391
+ display: "block",
392
+ boxSizing: "border-box",
393
+ width: "100%",
394
+ minWidth: 0,
395
+ maxWidth: containerMaxWidthVar(maxWidth),
396
+ ...center ? { marginInline: "auto" } : null,
397
+ ...padding ? { paddingInline: spacingVar("inline", padding) } : null
398
+ };
399
+ }
400
+
401
+ // src/primitives/Container.ts
402
+ var Container = defineComponent6({
403
+ name: "MasonContainer",
404
+ inheritAttrs: false,
405
+ props: {
406
+ as: {
407
+ type: String,
408
+ default: "div"
409
+ },
410
+ maxWidth: {
411
+ type: String,
412
+ default: "lg"
413
+ },
414
+ padding: {
415
+ type: String,
416
+ default: void 0
417
+ },
418
+ center: {
419
+ type: Boolean,
420
+ default: true
421
+ }
422
+ },
423
+ setup(props, { slots, attrs }) {
424
+ return () => {
425
+ const { class: attrClass, style: attrStyle, ...rest } = attrs;
426
+ return h6(
427
+ props.as,
428
+ {
429
+ ...rest,
430
+ "data-mason-component": "container",
431
+ "data-max-width": props.maxWidth,
432
+ class: mergeClassName(attrClass),
433
+ style: [
434
+ containerStyle({
435
+ maxWidth: props.maxWidth,
436
+ padding: props.padding,
437
+ center: props.center
438
+ }),
439
+ attrStyle
440
+ ]
441
+ },
442
+ slots.default?.()
443
+ );
444
+ };
445
+ }
446
+ });
447
+
448
+ // src/primitives/Card.ts
449
+ import { defineComponent as defineComponent7, h as h7 } from "vue";
450
+
451
+ // src/primitives/cardStyles.ts
452
+ var TONE_BG2 = {
224
453
  surface: "color.bg.surface",
225
454
  canvas: "color.bg.canvas",
226
455
  elevated: "color.bg.elevated"
@@ -235,7 +464,7 @@ function cardStyle({
235
464
  return {
236
465
  display: "block",
237
466
  padding: spacingVar("inset", padding),
238
- backgroundColor: cssVar(TONE_BG[tone]),
467
+ backgroundColor: cssVar(TONE_BG2[tone]),
239
468
  color: cssVar("color.text.primary"),
240
469
  border: bordered ? `1px solid ${cssVar("color.border.subtle")}` : "none",
241
470
  borderRadius: radiusVar(radius),
@@ -245,8 +474,8 @@ function cardStyle({
245
474
  };
246
475
  }
247
476
 
248
- // src/Card.ts
249
- var Card = defineComponent4({
477
+ // src/primitives/Card.ts
478
+ var Card = defineComponent7({
250
479
  name: "MasonCard",
251
480
  inheritAttrs: false,
252
481
  props: {
@@ -274,7 +503,7 @@ var Card = defineComponent4({
274
503
  setup(props, { slots, attrs }) {
275
504
  return () => {
276
505
  const { class: attrClass, style: attrStyle, ...rest } = attrs;
277
- return h4(
506
+ return h7(
278
507
  "div",
279
508
  {
280
509
  ...rest,
@@ -298,10 +527,10 @@ var Card = defineComponent4({
298
527
  }
299
528
  });
300
529
 
301
- // src/Divider.ts
302
- import { defineComponent as defineComponent5, h as h5 } from "vue";
530
+ // src/primitives/Divider.ts
531
+ import { defineComponent as defineComponent8, h as h8 } from "vue";
303
532
 
304
- // src/dividerStyles.ts
533
+ // src/primitives/dividerStyles.ts
305
534
  function dividerStyle(orientation = "horizontal") {
306
535
  const line = `1px solid ${cssVar("color.border.subtle")}`;
307
536
  if (orientation === "vertical") {
@@ -323,8 +552,8 @@ function dividerStyle(orientation = "horizontal") {
323
552
  };
324
553
  }
325
554
 
326
- // src/Divider.ts
327
- var Divider = defineComponent5({
555
+ // src/primitives/Divider.ts
556
+ var Divider = defineComponent8({
328
557
  name: "MasonDivider",
329
558
  inheritAttrs: false,
330
559
  props: {
@@ -336,7 +565,7 @@ var Divider = defineComponent5({
336
565
  setup(props, { attrs }) {
337
566
  return () => {
338
567
  const { class: attrClass, style: attrStyle, ...rest } = attrs;
339
- return h5("hr", {
568
+ return h8("hr", {
340
569
  ...rest,
341
570
  "data-mason-component": "divider",
342
571
  "data-orientation": props.orientation,
@@ -348,10 +577,10 @@ var Divider = defineComponent5({
348
577
  }
349
578
  });
350
579
 
351
- // src/Link.ts
352
- import { defineComponent as defineComponent6, h as h6 } from "vue";
580
+ // src/primitives/Link.ts
581
+ import { defineComponent as defineComponent9, h as h9 } from "vue";
353
582
 
354
- // src/linkStyles.ts
583
+ // src/primitives/linkStyles.ts
355
584
  function linkStyle({
356
585
  tone = "link",
357
586
  underline = "hover"
@@ -365,8 +594,8 @@ function linkStyle({
365
594
  };
366
595
  }
367
596
 
368
- // src/Link.ts
369
- var Link = defineComponent6({
597
+ // src/primitives/Link.ts
598
+ var Link = defineComponent9({
370
599
  name: "MasonLink",
371
600
  inheritAttrs: false,
372
601
  props: {
@@ -388,7 +617,7 @@ var Link = defineComponent6({
388
617
  return () => {
389
618
  const { class: attrClass, style: attrStyle, ...rest } = attrs;
390
619
  const externalAttrs = props.external ? { target: "_blank", rel: "noreferrer noopener" } : null;
391
- return h6(
620
+ return h9(
392
621
  "a",
393
622
  {
394
623
  "data-mason-component": "link",
@@ -408,13 +637,13 @@ var Link = defineComponent6({
408
637
  }
409
638
  });
410
639
 
411
- // src/Button.ts
412
- import { computed, defineComponent as defineComponent8, h as h8 } from "vue";
640
+ // src/primitives/Button.ts
641
+ import { computed, defineComponent as defineComponent11, h as h11 } from "vue";
413
642
 
414
- // src/Spinner.ts
415
- import { defineComponent as defineComponent7, h as h7 } from "vue";
643
+ // src/primitives/Spinner.ts
644
+ import { defineComponent as defineComponent10, h as h10 } from "vue";
416
645
 
417
- // src/spinnerStyles.ts
646
+ // src/primitives/spinnerStyles.ts
418
647
  var SIZE_DIMENSION = {
419
648
  sm: cssVar("font.body.sm.size"),
420
649
  md: cssVar("font.body.md.size"),
@@ -434,8 +663,8 @@ function spinnerStyle(size = "md") {
434
663
  };
435
664
  }
436
665
 
437
- // src/Spinner.ts
438
- var Spinner = defineComponent7({
666
+ // src/primitives/Spinner.ts
667
+ var Spinner = defineComponent10({
439
668
  name: "MasonSpinner",
440
669
  inheritAttrs: false,
441
670
  props: {
@@ -452,7 +681,7 @@ var Spinner = defineComponent7({
452
681
  setup(props, { attrs }) {
453
682
  return () => {
454
683
  const { class: attrClass, style: attrStyle, ...rest } = attrs;
455
- return h7("span", {
684
+ return h10("span", {
456
685
  ...rest,
457
686
  "data-mason-component": "spinner",
458
687
  "data-size": props.size,
@@ -466,14 +695,7 @@ var Spinner = defineComponent7({
466
695
  }
467
696
  });
468
697
 
469
- // src/buttonStyles.ts
470
- function actionColors(variant) {
471
- return {
472
- bg: `color.action.${variant}.bg`,
473
- text: `color.action.${variant}.text`,
474
- border: `color.action.${variant}.border`
475
- };
476
- }
698
+ // src/primitives/buttonStyles.ts
477
699
  var sizeStyles = {
478
700
  sm: {
479
701
  paddingBlock: cssVar("spacing.inset.sm"),
@@ -497,14 +719,7 @@ var sizeStyles = {
497
719
  font: "label.lg"
498
720
  }
499
721
  };
500
- function buttonStyle({
501
- variant = "primary",
502
- size = "md",
503
- disabled = false,
504
- loading = false
505
- }) {
506
- const inactive = disabled || loading;
507
- const colors = actionColors(inactive ? "disabled" : variant);
722
+ function buttonStyle({ size = "md" }) {
508
723
  const sizing = sizeStyles[size];
509
724
  return {
510
725
  display: "inline-flex",
@@ -514,9 +729,6 @@ function buttonStyle({
514
729
  paddingBlock: sizing.paddingBlock,
515
730
  paddingInline: sizing.paddingInline,
516
731
  margin: "0",
517
- backgroundColor: cssVar(colors.bg),
518
- color: cssVar(colors.text),
519
- border: `1px solid ${cssVar(colors.border)}`,
520
732
  borderRadius: sizing.radius,
521
733
  boxSizing: "border-box",
522
734
  ...typographyStyle(sizing.font),
@@ -525,8 +737,8 @@ function buttonStyle({
525
737
  };
526
738
  }
527
739
 
528
- // src/Button.ts
529
- var Button = defineComponent8({
740
+ // src/primitives/Button.ts
741
+ var Button = defineComponent11({
530
742
  name: "MasonButton",
531
743
  inheritAttrs: false,
532
744
  props: {
@@ -556,19 +768,19 @@ var Button = defineComponent8({
556
768
  return () => {
557
769
  const children = [];
558
770
  if (props.loading) {
559
- children.push(h8(Spinner, { size: "inherit", "data-mason-slot": "spinner" }));
771
+ children.push(h11(Spinner, { size: "inherit", "data-mason-slot": "spinner" }));
560
772
  } else if (slots.leading) {
561
- children.push(h8("span", { "data-mason-slot": "leading" }, slots.leading()));
773
+ children.push(h11("span", { "data-mason-slot": "leading" }, slots.leading()));
562
774
  }
563
775
  if (slots.default) {
564
- children.push(h8("span", { "data-mason-slot": "label" }, slots.default()));
776
+ children.push(h11("span", { "data-mason-slot": "label" }, slots.default()));
565
777
  }
566
778
  if (slots.trailing && !props.loading) {
567
- children.push(h8("span", { "data-mason-slot": "trailing" }, slots.trailing()));
779
+ children.push(h11("span", { "data-mason-slot": "trailing" }, slots.trailing()));
568
780
  }
569
781
  const attrClass = attrs.class;
570
782
  const attrStyle = attrs.style;
571
- return h8(
783
+ return h11(
572
784
  "button",
573
785
  {
574
786
  ...attrs,
@@ -579,15 +791,7 @@ var Button = defineComponent8({
579
791
  disabled: isDisabled.value,
580
792
  "aria-busy": props.loading || void 0,
581
793
  class: mergeClassName(attrClass),
582
- style: [
583
- buttonStyle({
584
- variant: props.variant,
585
- size: props.size,
586
- disabled: props.disabled,
587
- loading: props.loading
588
- }),
589
- attrStyle
590
- ]
794
+ style: [buttonStyle({ size: props.size }), attrStyle]
591
795
  },
592
796
  children
593
797
  );
@@ -595,10 +799,10 @@ var Button = defineComponent8({
595
799
  }
596
800
  });
597
801
 
598
- // src/Badge.ts
599
- import { defineComponent as defineComponent9, h as h9 } from "vue";
802
+ // src/primitives/Badge.ts
803
+ import { defineComponent as defineComponent12, h as h12 } from "vue";
600
804
 
601
- // src/badgeStyles.ts
805
+ // src/primitives/badgeStyles.ts
602
806
  function badgeStyle({
603
807
  tone = "neutral",
604
808
  size = "sm"
@@ -627,8 +831,8 @@ function badgeStyle({
627
831
  };
628
832
  }
629
833
 
630
- // src/Badge.ts
631
- var Badge = defineComponent9({
834
+ // src/primitives/Badge.ts
835
+ var Badge = defineComponent12({
632
836
  name: "MasonBadge",
633
837
  inheritAttrs: false,
634
838
  props: {
@@ -644,7 +848,7 @@ var Badge = defineComponent9({
644
848
  setup(props, { slots, attrs }) {
645
849
  return () => {
646
850
  const { class: attrClass, style: attrStyle, ...rest } = attrs;
647
- return h9(
851
+ return h12(
648
852
  "span",
649
853
  {
650
854
  ...rest,
@@ -663,10 +867,10 @@ var Badge = defineComponent9({
663
867
  }
664
868
  });
665
869
 
666
- // src/Callout.ts
667
- import { defineComponent as defineComponent10, h as h10 } from "vue";
870
+ // src/primitives/Callout.ts
871
+ import { defineComponent as defineComponent13, h as h13 } from "vue";
668
872
 
669
- // src/calloutStyles.ts
873
+ // src/primitives/calloutStyles.ts
670
874
  function calloutStyle(tone = "info") {
671
875
  return {
672
876
  display: "flex",
@@ -695,8 +899,8 @@ function calloutBodyStyle() {
695
899
  return { margin: "0", ...typographyStyle("body.sm") };
696
900
  }
697
901
 
698
- // src/Callout.ts
699
- var Callout = defineComponent10({
902
+ // src/primitives/Callout.ts
903
+ var Callout = defineComponent13({
700
904
  name: "MasonCallout",
701
905
  inheritAttrs: false,
702
906
  props: {
@@ -718,18 +922,18 @@ var Callout = defineComponent10({
718
922
  const content = [];
719
923
  if (title) {
720
924
  content.push(
721
- h10("p", { "data-mason-slot": "title", style: calloutTitleStyle() }, title)
925
+ h13("p", { "data-mason-slot": "title", style: calloutTitleStyle() }, title)
722
926
  );
723
927
  }
724
928
  if (body) {
725
929
  content.push(
726
- h10("div", { "data-mason-slot": "body", style: calloutBodyStyle() }, body)
930
+ h13("div", { "data-mason-slot": "body", style: calloutBodyStyle() }, body)
727
931
  );
728
932
  }
729
933
  const children = [];
730
934
  if (slots.icon) {
731
935
  children.push(
732
- h10(
936
+ h13(
733
937
  "span",
734
938
  { "data-mason-slot": "icon", "aria-hidden": "true" },
735
939
  slots.icon()
@@ -737,13 +941,13 @@ var Callout = defineComponent10({
737
941
  );
738
942
  }
739
943
  children.push(
740
- h10(
944
+ h13(
741
945
  "div",
742
946
  { "data-mason-slot": "content", style: calloutContentStyle() },
743
947
  content
744
948
  )
745
949
  );
746
- return h10(
950
+ return h13(
747
951
  "div",
748
952
  {
749
953
  ...rest,
@@ -758,13 +962,13 @@ var Callout = defineComponent10({
758
962
  }
759
963
  });
760
964
 
761
- // src/TextField.ts
762
- import { defineComponent as defineComponent11, h as h12 } from "vue";
965
+ // src/compounds/TextField.ts
966
+ import { defineComponent as defineComponent14, h as h15 } from "vue";
763
967
 
764
- // src/field.ts
765
- import { h as h11 } from "vue";
968
+ // src/compounds/field.ts
969
+ import { h as h14 } from "vue";
766
970
 
767
- // src/fieldStyles.ts
971
+ // src/compounds/fieldStyles.ts
768
972
  var CONTROL_FONT = {
769
973
  sm: "body.sm",
770
974
  md: "body.md",
@@ -825,8 +1029,25 @@ function fieldErrorStyle() {
825
1029
  ...typographyStyle("body.sm")
826
1030
  };
827
1031
  }
1032
+ function visuallyHiddenControlStyle() {
1033
+ return {
1034
+ position: "absolute",
1035
+ left: "0",
1036
+ top: "0",
1037
+ width: "1px",
1038
+ height: "1px",
1039
+ padding: "0",
1040
+ margin: "0",
1041
+ overflow: "hidden",
1042
+ clip: "rect(0, 0, 0, 0)",
1043
+ whiteSpace: "nowrap",
1044
+ borderWidth: "0",
1045
+ borderStyle: "solid",
1046
+ borderColor: "transparent"
1047
+ };
1048
+ }
828
1049
 
829
- // src/field.ts
1050
+ // src/compounds/field.ts
830
1051
  var fieldSeq = 0;
831
1052
  function nextFieldId() {
832
1053
  fieldSeq += 1;
@@ -858,7 +1079,7 @@ function renderFieldFrame({
858
1079
  const children = [];
859
1080
  if (label) {
860
1081
  children.push(
861
- h11(
1082
+ h14(
862
1083
  "label",
863
1084
  {
864
1085
  "data-mason-slot": "label",
@@ -872,7 +1093,7 @@ function renderFieldFrame({
872
1093
  children.push(control);
873
1094
  if (description) {
874
1095
  children.push(
875
- h11(
1096
+ h14(
876
1097
  "p",
877
1098
  {
878
1099
  "data-mason-slot": "description",
@@ -885,7 +1106,7 @@ function renderFieldFrame({
885
1106
  }
886
1107
  if (error) {
887
1108
  children.push(
888
- h11(
1109
+ h14(
889
1110
  "p",
890
1111
  {
891
1112
  "data-mason-slot": "error",
@@ -897,7 +1118,7 @@ function renderFieldFrame({
897
1118
  )
898
1119
  );
899
1120
  }
900
- return h11(
1121
+ return h14(
901
1122
  "div",
902
1123
  {
903
1124
  "data-mason-component": component,
@@ -911,8 +1132,8 @@ function renderFieldFrame({
911
1132
  );
912
1133
  }
913
1134
 
914
- // src/TextField.ts
915
- var TextField = defineComponent11({
1135
+ // src/compounds/TextField.ts
1136
+ var TextField = defineComponent14({
916
1137
  name: "MasonTextField",
917
1138
  inheritAttrs: false,
918
1139
  props: {
@@ -969,7 +1190,7 @@ var TextField = defineComponent11({
969
1190
  emit("update:modelValue", event.target.value);
970
1191
  };
971
1192
  const forwarded = attrInput;
972
- const control = h12("input", {
1193
+ const control = h15("input", {
973
1194
  ...controlAttrs,
974
1195
  id: ids.controlId,
975
1196
  "data-mason-slot": "control",
@@ -1001,9 +1222,9 @@ var TextField = defineComponent11({
1001
1222
  }
1002
1223
  });
1003
1224
 
1004
- // src/Select.ts
1005
- import { defineComponent as defineComponent12, h as h13 } from "vue";
1006
- var Select = defineComponent12({
1225
+ // src/compounds/Select.ts
1226
+ import { defineComponent as defineComponent15, h as h16 } from "vue";
1227
+ var Select = defineComponent15({
1007
1228
  name: "MasonSelect",
1008
1229
  inheritAttrs: false,
1009
1230
  props: {
@@ -1066,13 +1287,13 @@ var Select = defineComponent12({
1066
1287
  const forwarded = attrChange;
1067
1288
  const options = [];
1068
1289
  if (props.placeholder) {
1069
- options.push(h13("option", { value: "" }, props.placeholder));
1290
+ options.push(h16("option", { value: "" }, props.placeholder));
1070
1291
  }
1071
1292
  const provided = slots.default?.();
1072
1293
  if (provided) {
1073
1294
  options.push(provided);
1074
1295
  }
1075
- const control = h13(
1296
+ const control = h16(
1076
1297
  "select",
1077
1298
  {
1078
1299
  ...controlAttrs,
@@ -1108,12 +1329,14 @@ var Select = defineComponent12({
1108
1329
  }
1109
1330
  });
1110
1331
 
1111
- // src/Checkbox.ts
1112
- import { defineComponent as defineComponent13, h as h14 } from "vue";
1332
+ // src/compounds/Checkbox.ts
1333
+ import { defineComponent as defineComponent16, h as h17 } from "vue";
1113
1334
 
1114
- // src/checkboxStyles.ts
1335
+ // src/compounds/checkboxStyles.ts
1336
+ var CONTROL_SIZE = "1.125rem";
1115
1337
  function checkboxRootStyle() {
1116
1338
  return {
1339
+ position: "relative",
1117
1340
  display: "flex",
1118
1341
  flexDirection: "column",
1119
1342
  gap: spacingVar("stack", "sm"),
@@ -1130,19 +1353,24 @@ function checkboxLabelStyle(disabled = false) {
1130
1353
  ...typographyStyle("body.md")
1131
1354
  };
1132
1355
  }
1133
- function checkboxControlStyle() {
1356
+ function checkboxIndicatorStyle() {
1134
1357
  return {
1135
- width: "1em",
1136
- height: "1em",
1137
- margin: "0",
1138
- marginBlockStart: "0.15em",
1139
- accentColor: cssVar("color.action.primary.bg"),
1140
- flexShrink: "0"
1358
+ display: "inline-flex",
1359
+ alignItems: "center",
1360
+ justifyContent: "center",
1361
+ width: CONTROL_SIZE,
1362
+ height: CONTROL_SIZE,
1363
+ marginBlockStart: "0.2em",
1364
+ flexShrink: "0",
1365
+ boxSizing: "border-box",
1366
+ borderRadius: radiusVar("sm"),
1367
+ borderStyle: "solid",
1368
+ borderWidth: "1.5px"
1141
1369
  };
1142
1370
  }
1143
1371
 
1144
- // src/Checkbox.ts
1145
- var Checkbox = defineComponent13({
1372
+ // src/compounds/Checkbox.ts
1373
+ var Checkbox = defineComponent16({
1146
1374
  name: "MasonCheckbox",
1147
1375
  inheritAttrs: false,
1148
1376
  props: {
@@ -1195,7 +1423,7 @@ var Checkbox = defineComponent13({
1195
1423
  };
1196
1424
  const forwarded = attrChange;
1197
1425
  const children = [
1198
- h14(
1426
+ h17(
1199
1427
  "label",
1200
1428
  {
1201
1429
  "data-mason-slot": "label",
@@ -1203,7 +1431,7 @@ var Checkbox = defineComponent13({
1203
1431
  style: checkboxLabelStyle(props.disabled)
1204
1432
  },
1205
1433
  [
1206
- h14("input", {
1434
+ h17("input", {
1207
1435
  ...controlAttrs,
1208
1436
  type: "checkbox",
1209
1437
  id: ids.controlId,
@@ -1213,15 +1441,20 @@ var Checkbox = defineComponent13({
1213
1441
  "aria-describedby": ids.describedBy,
1214
1442
  ...props.modelValue === void 0 ? null : { checked: props.modelValue },
1215
1443
  onChange: forwarded ? [emitChange, forwarded] : emitChange,
1216
- style: checkboxControlStyle()
1444
+ style: visuallyHiddenControlStyle()
1217
1445
  }),
1218
- label ? h14("span", { "data-mason-slot": "label-text" }, label) : null
1446
+ h17("span", {
1447
+ "data-mason-slot": "indicator",
1448
+ "aria-hidden": "true",
1449
+ style: checkboxIndicatorStyle()
1450
+ }),
1451
+ label ? h17("span", { "data-mason-slot": "label-text" }, label) : null
1219
1452
  ]
1220
1453
  )
1221
1454
  ];
1222
1455
  if (description) {
1223
1456
  children.push(
1224
- h14(
1457
+ h17(
1225
1458
  "p",
1226
1459
  {
1227
1460
  "data-mason-slot": "description",
@@ -1234,7 +1467,7 @@ var Checkbox = defineComponent13({
1234
1467
  }
1235
1468
  if (error) {
1236
1469
  children.push(
1237
- h14(
1470
+ h17(
1238
1471
  "p",
1239
1472
  {
1240
1473
  "data-mason-slot": "error",
@@ -1246,7 +1479,7 @@ var Checkbox = defineComponent13({
1246
1479
  )
1247
1480
  );
1248
1481
  }
1249
- return h14(
1482
+ return h17(
1250
1483
  "div",
1251
1484
  {
1252
1485
  "data-mason-component": "checkbox",
@@ -1260,19 +1493,391 @@ var Checkbox = defineComponent13({
1260
1493
  };
1261
1494
  }
1262
1495
  });
1496
+
1497
+ // src/compounds/Radio.ts
1498
+ import { defineComponent as defineComponent17, h as h18 } from "vue";
1499
+
1500
+ // src/compounds/radioStyles.ts
1501
+ var CONTROL_SIZE2 = "1.125rem";
1502
+ function radioRootStyle() {
1503
+ return {
1504
+ position: "relative",
1505
+ display: "flex",
1506
+ flexDirection: "column",
1507
+ gap: spacingVar("stack", "sm"),
1508
+ minWidth: "0"
1509
+ };
1510
+ }
1511
+ function radioLabelStyle(disabled = false) {
1512
+ return {
1513
+ display: "inline-flex",
1514
+ alignItems: "flex-start",
1515
+ gap: spacingVar("inline", "sm"),
1516
+ cursor: disabled ? "not-allowed" : "pointer",
1517
+ color: disabled ? cssVar("color.text.disabled") : cssVar("color.text.primary"),
1518
+ ...typographyStyle("body.md")
1519
+ };
1520
+ }
1521
+ function radioIndicatorStyle() {
1522
+ return {
1523
+ display: "inline-flex",
1524
+ alignItems: "center",
1525
+ justifyContent: "center",
1526
+ width: CONTROL_SIZE2,
1527
+ height: CONTROL_SIZE2,
1528
+ marginBlockStart: "0.2em",
1529
+ flexShrink: "0",
1530
+ boxSizing: "border-box",
1531
+ borderRadius: "999px",
1532
+ borderStyle: "solid",
1533
+ borderWidth: "1.5px"
1534
+ };
1535
+ }
1536
+
1537
+ // src/compounds/Radio.ts
1538
+ var Radio = defineComponent17({
1539
+ name: "MasonRadio",
1540
+ inheritAttrs: false,
1541
+ props: {
1542
+ label: {
1543
+ type: String,
1544
+ default: void 0
1545
+ },
1546
+ description: {
1547
+ type: String,
1548
+ default: void 0
1549
+ },
1550
+ error: {
1551
+ type: String,
1552
+ default: void 0
1553
+ },
1554
+ invalid: {
1555
+ type: Boolean,
1556
+ default: void 0
1557
+ },
1558
+ disabled: {
1559
+ type: Boolean,
1560
+ default: false
1561
+ },
1562
+ id: {
1563
+ type: String,
1564
+ default: void 0
1565
+ },
1566
+ modelValue: {
1567
+ type: [String, Number, Boolean],
1568
+ default: void 0
1569
+ },
1570
+ value: {
1571
+ type: [String, Number, Boolean],
1572
+ default: void 0
1573
+ }
1574
+ },
1575
+ emits: ["update:modelValue"],
1576
+ setup(props, { slots, attrs, emit }) {
1577
+ const autoId = nextFieldId();
1578
+ return () => {
1579
+ const {
1580
+ class: attrClass,
1581
+ style: attrStyle,
1582
+ onChange: attrChange,
1583
+ ...controlAttrs
1584
+ } = attrs;
1585
+ const label = slots.label?.() ?? props.label;
1586
+ const description = slots.description?.() ?? props.description;
1587
+ const error = slots.error?.() ?? props.error;
1588
+ const invalid = props.invalid ?? Boolean(error);
1589
+ const ids = fieldIds(props.id ?? autoId, Boolean(description), Boolean(error));
1590
+ const emitChange = (event) => {
1591
+ const input = event.target;
1592
+ emit("update:modelValue", props.value === void 0 ? input.value : props.value);
1593
+ };
1594
+ const forwarded = attrChange;
1595
+ const checked = props.modelValue === void 0 || props.value === void 0 ? void 0 : props.modelValue === props.value;
1596
+ const children = [
1597
+ h18(
1598
+ "label",
1599
+ {
1600
+ "data-mason-slot": "label",
1601
+ for: ids.controlId,
1602
+ style: radioLabelStyle(props.disabled)
1603
+ },
1604
+ [
1605
+ h18("input", {
1606
+ ...controlAttrs,
1607
+ type: "radio",
1608
+ id: ids.controlId,
1609
+ "data-mason-slot": "control",
1610
+ disabled: props.disabled,
1611
+ value: props.value,
1612
+ "aria-invalid": invalid || void 0,
1613
+ "aria-describedby": ids.describedBy,
1614
+ ...checked === void 0 ? null : { checked },
1615
+ onChange: forwarded ? [emitChange, forwarded] : emitChange,
1616
+ style: visuallyHiddenControlStyle()
1617
+ }),
1618
+ h18("span", {
1619
+ "data-mason-slot": "indicator",
1620
+ "aria-hidden": "true",
1621
+ style: radioIndicatorStyle()
1622
+ }),
1623
+ label ? h18("span", { "data-mason-slot": "label-text" }, label) : null
1624
+ ]
1625
+ )
1626
+ ];
1627
+ if (description) {
1628
+ children.push(
1629
+ h18(
1630
+ "p",
1631
+ {
1632
+ "data-mason-slot": "description",
1633
+ id: ids.descriptionId,
1634
+ style: fieldDescriptionStyle()
1635
+ },
1636
+ description
1637
+ )
1638
+ );
1639
+ }
1640
+ if (error) {
1641
+ children.push(
1642
+ h18(
1643
+ "p",
1644
+ {
1645
+ "data-mason-slot": "error",
1646
+ id: ids.errorId,
1647
+ role: "alert",
1648
+ style: fieldErrorStyle()
1649
+ },
1650
+ error
1651
+ )
1652
+ );
1653
+ }
1654
+ return h18(
1655
+ "div",
1656
+ {
1657
+ "data-mason-component": "radio",
1658
+ "data-invalid": invalid || void 0,
1659
+ "data-disabled": props.disabled || void 0,
1660
+ class: mergeClassName(attrClass),
1661
+ style: [radioRootStyle(), attrStyle]
1662
+ },
1663
+ children
1664
+ );
1665
+ };
1666
+ }
1667
+ });
1668
+
1669
+ // src/compounds/Toggle.ts
1670
+ import { defineComponent as defineComponent18, h as h19 } from "vue";
1671
+
1672
+ // src/compounds/toggleStyles.ts
1673
+ var TRACK = {
1674
+ sm: { width: "1.75rem", height: "1rem" },
1675
+ md: { width: "2.25rem", height: "1.25rem" },
1676
+ lg: { width: "2.75rem", height: "1.5rem" }
1677
+ };
1678
+ var THUMB = {
1679
+ sm: "0.75rem",
1680
+ md: "1rem",
1681
+ lg: "1.25rem"
1682
+ };
1683
+ function toggleRootStyle() {
1684
+ return {
1685
+ position: "relative",
1686
+ display: "flex",
1687
+ flexDirection: "column",
1688
+ gap: spacingVar("stack", "sm"),
1689
+ minWidth: "0"
1690
+ };
1691
+ }
1692
+ function toggleLabelStyle(disabled = false) {
1693
+ return {
1694
+ display: "inline-flex",
1695
+ alignItems: "center",
1696
+ gap: spacingVar("inline", "sm"),
1697
+ cursor: disabled ? "not-allowed" : "pointer",
1698
+ color: disabled ? cssVar("color.text.disabled") : cssVar("color.text.primary"),
1699
+ ...typographyStyle("label.md")
1700
+ };
1701
+ }
1702
+ function toggleIndicatorStyle(size = "md") {
1703
+ return {
1704
+ position: "relative",
1705
+ display: "inline-flex",
1706
+ alignItems: "center",
1707
+ width: TRACK[size].width,
1708
+ height: TRACK[size].height,
1709
+ padding: "0.125rem",
1710
+ flexShrink: "0",
1711
+ boxSizing: "border-box",
1712
+ borderRadius: radiusVar("full")
1713
+ };
1714
+ }
1715
+ function toggleThumbStyle(size = "md") {
1716
+ return {
1717
+ width: THUMB[size],
1718
+ height: THUMB[size],
1719
+ borderRadius: radiusVar("full"),
1720
+ flexShrink: "0"
1721
+ };
1722
+ }
1723
+
1724
+ // src/compounds/Toggle.ts
1725
+ var Toggle = defineComponent18({
1726
+ name: "MasonToggle",
1727
+ inheritAttrs: false,
1728
+ props: {
1729
+ label: {
1730
+ type: String,
1731
+ default: void 0
1732
+ },
1733
+ description: {
1734
+ type: String,
1735
+ default: void 0
1736
+ },
1737
+ error: {
1738
+ type: String,
1739
+ default: void 0
1740
+ },
1741
+ invalid: {
1742
+ type: Boolean,
1743
+ default: void 0
1744
+ },
1745
+ disabled: {
1746
+ type: Boolean,
1747
+ default: false
1748
+ },
1749
+ size: {
1750
+ type: String,
1751
+ default: "md"
1752
+ },
1753
+ id: {
1754
+ type: String,
1755
+ default: void 0
1756
+ },
1757
+ modelValue: {
1758
+ type: Boolean,
1759
+ default: void 0
1760
+ }
1761
+ },
1762
+ emits: ["update:modelValue"],
1763
+ setup(props, { slots, attrs, emit }) {
1764
+ const autoId = nextFieldId();
1765
+ return () => {
1766
+ const {
1767
+ class: attrClass,
1768
+ style: attrStyle,
1769
+ onChange: attrChange,
1770
+ ...controlAttrs
1771
+ } = attrs;
1772
+ const label = slots.label?.() ?? props.label;
1773
+ const description = slots.description?.() ?? props.description;
1774
+ const error = slots.error?.() ?? props.error;
1775
+ const invalid = props.invalid ?? Boolean(error);
1776
+ const ids = fieldIds(props.id ?? autoId, Boolean(description), Boolean(error));
1777
+ const emitChange = (event) => {
1778
+ emit("update:modelValue", event.target.checked);
1779
+ };
1780
+ const forwarded = attrChange;
1781
+ const children = [
1782
+ h19(
1783
+ "label",
1784
+ {
1785
+ "data-mason-slot": "label",
1786
+ for: ids.controlId,
1787
+ style: toggleLabelStyle(props.disabled)
1788
+ },
1789
+ [
1790
+ label ? h19("span", { "data-mason-slot": "label-text" }, label) : null,
1791
+ h19("input", {
1792
+ ...controlAttrs,
1793
+ type: "checkbox",
1794
+ role: "switch",
1795
+ id: ids.controlId,
1796
+ "data-mason-slot": "control",
1797
+ disabled: props.disabled,
1798
+ "aria-invalid": invalid || void 0,
1799
+ "aria-describedby": ids.describedBy,
1800
+ ...props.modelValue === void 0 ? null : { checked: props.modelValue },
1801
+ onChange: forwarded ? [emitChange, forwarded] : emitChange,
1802
+ style: visuallyHiddenControlStyle()
1803
+ }),
1804
+ h19(
1805
+ "span",
1806
+ {
1807
+ "data-mason-slot": "indicator",
1808
+ "aria-hidden": "true",
1809
+ style: toggleIndicatorStyle(props.size)
1810
+ },
1811
+ [
1812
+ h19("span", {
1813
+ "data-mason-slot": "thumb",
1814
+ style: toggleThumbStyle(props.size)
1815
+ })
1816
+ ]
1817
+ )
1818
+ ]
1819
+ )
1820
+ ];
1821
+ if (description) {
1822
+ children.push(
1823
+ h19(
1824
+ "p",
1825
+ {
1826
+ "data-mason-slot": "description",
1827
+ id: ids.descriptionId,
1828
+ style: fieldDescriptionStyle()
1829
+ },
1830
+ description
1831
+ )
1832
+ );
1833
+ }
1834
+ if (error) {
1835
+ children.push(
1836
+ h19(
1837
+ "p",
1838
+ {
1839
+ "data-mason-slot": "error",
1840
+ id: ids.errorId,
1841
+ role: "alert",
1842
+ style: fieldErrorStyle()
1843
+ },
1844
+ error
1845
+ )
1846
+ );
1847
+ }
1848
+ return h19(
1849
+ "div",
1850
+ {
1851
+ "data-mason-component": "toggle",
1852
+ "data-size": props.size,
1853
+ "data-invalid": invalid || void 0,
1854
+ "data-disabled": props.disabled || void 0,
1855
+ class: mergeClassName(attrClass),
1856
+ style: [toggleRootStyle(), attrStyle]
1857
+ },
1858
+ children
1859
+ );
1860
+ };
1861
+ }
1862
+ });
1263
1863
  export {
1264
1864
  Badge,
1865
+ Box,
1265
1866
  Button,
1266
1867
  Callout,
1267
1868
  Card,
1268
1869
  Checkbox,
1870
+ Container,
1269
1871
  Divider,
1872
+ Grid,
1270
1873
  Link,
1271
1874
  MasonProvider,
1875
+ Radio,
1272
1876
  Select,
1273
1877
  Spinner,
1274
1878
  Stack,
1275
1879
  Text,
1276
- TextField
1880
+ TextField,
1881
+ Toggle
1277
1882
  };
1278
1883
  //# sourceMappingURL=index.js.map