@mason-ds/react 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,925 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Badge: () => Badge,
24
+ Button: () => Button,
25
+ Callout: () => Callout,
26
+ Card: () => Card,
27
+ Checkbox: () => Checkbox,
28
+ Divider: () => Divider,
29
+ Link: () => Link,
30
+ MasonProvider: () => MasonProvider,
31
+ Select: () => Select,
32
+ Spinner: () => Spinner,
33
+ Stack: () => Stack,
34
+ Text: () => Text,
35
+ TextField: () => TextField
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+
39
+ // src/provider.tsx
40
+ var import_jsx_runtime = require("react/jsx-runtime");
41
+ function MasonProvider({ children, theme = "light" }) {
42
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { "data-mason-provider": true, "data-mason-theme": theme, children });
43
+ }
44
+
45
+ // src/styles.ts
46
+ var import_tokens = require("@mason-ds/tokens");
47
+ function cssVar(path) {
48
+ return `var(${(0, import_tokens.getSemanticCssVar)(path)})`;
49
+ }
50
+ function spacingVar(axis, level) {
51
+ return cssVar(`spacing.${axis}.${level}`);
52
+ }
53
+ function radiusVar(level) {
54
+ return cssVar(`radius.${level}`);
55
+ }
56
+ function shadowVar(level) {
57
+ return cssVar(`shadow.${level}`);
58
+ }
59
+ function textColorVar(tone) {
60
+ return cssVar(`color.text.${tone}`);
61
+ }
62
+ function typographyStyle(variant) {
63
+ return {
64
+ fontFamily: cssVar(`font.${variant}.family`),
65
+ fontSize: cssVar(`font.${variant}.size`),
66
+ fontWeight: cssVar(`font.${variant}.weight`),
67
+ lineHeight: cssVar(`font.${variant}.lineHeight`),
68
+ letterSpacing: cssVar(`font.${variant}.letterSpacing`)
69
+ };
70
+ }
71
+ function mergeClassName(...parts) {
72
+ const merged = parts.filter(Boolean).join(" ");
73
+ return merged.length > 0 ? merged : void 0;
74
+ }
75
+
76
+ // src/textStyles.ts
77
+ function textStyle({
78
+ variant = "body.md",
79
+ tone = "primary",
80
+ align,
81
+ truncate = false
82
+ }) {
83
+ return {
84
+ margin: 0,
85
+ color: textColorVar(tone),
86
+ ...typographyStyle(variant),
87
+ ...align ? { textAlign: align } : null,
88
+ ...truncate ? { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } : null
89
+ };
90
+ }
91
+
92
+ // src/Text.tsx
93
+ var import_jsx_runtime2 = require("react/jsx-runtime");
94
+ function Text({
95
+ as = "p",
96
+ variant = "body.md",
97
+ tone = "primary",
98
+ align,
99
+ truncate = false,
100
+ className,
101
+ style,
102
+ children,
103
+ ...rest
104
+ }) {
105
+ const Component = as;
106
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
107
+ Component,
108
+ {
109
+ "data-mason-component": "text",
110
+ "data-variant": variant,
111
+ className: mergeClassName(className),
112
+ style: { ...textStyle({ variant, tone, align, truncate }), ...style },
113
+ ...rest,
114
+ children
115
+ }
116
+ );
117
+ }
118
+
119
+ // src/stackStyles.ts
120
+ var FLEX_ALIGN = {
121
+ start: "flex-start",
122
+ center: "center",
123
+ end: "flex-end",
124
+ stretch: "stretch",
125
+ baseline: "baseline"
126
+ };
127
+ var FLEX_JUSTIFY = {
128
+ start: "flex-start",
129
+ center: "center",
130
+ end: "flex-end",
131
+ between: "space-between"
132
+ };
133
+ function stackStyle({
134
+ direction = "column",
135
+ gap = "md",
136
+ align,
137
+ justify,
138
+ wrap = false,
139
+ inline = false
140
+ }) {
141
+ return {
142
+ display: inline ? "inline-flex" : "flex",
143
+ flexDirection: direction,
144
+ gap: spacingVar(direction === "row" ? "inline" : "stack", gap),
145
+ flexWrap: wrap ? "wrap" : "nowrap",
146
+ minWidth: 0,
147
+ ...align ? { alignItems: FLEX_ALIGN[align] } : null,
148
+ ...justify ? { justifyContent: FLEX_JUSTIFY[justify] } : null
149
+ };
150
+ }
151
+
152
+ // src/Stack.tsx
153
+ var import_jsx_runtime3 = require("react/jsx-runtime");
154
+ function Stack({
155
+ direction = "column",
156
+ gap = "md",
157
+ align,
158
+ justify,
159
+ wrap = false,
160
+ inline = false,
161
+ className,
162
+ style,
163
+ children,
164
+ ...rest
165
+ }) {
166
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
167
+ "div",
168
+ {
169
+ "data-mason-component": "stack",
170
+ "data-direction": direction,
171
+ className: mergeClassName(className),
172
+ style: {
173
+ ...stackStyle({ direction, gap, align, justify, wrap, inline }),
174
+ ...style
175
+ },
176
+ ...rest,
177
+ children
178
+ }
179
+ );
180
+ }
181
+
182
+ // src/cardStyles.ts
183
+ var TONE_BG = {
184
+ surface: "color.bg.surface",
185
+ canvas: "color.bg.canvas",
186
+ elevated: "color.bg.elevated"
187
+ };
188
+ function cardStyle({
189
+ padding = "md",
190
+ elevation = "sm",
191
+ radius = "md",
192
+ tone = "surface",
193
+ bordered = true
194
+ }) {
195
+ return {
196
+ display: "block",
197
+ padding: spacingVar("inset", padding),
198
+ backgroundColor: cssVar(TONE_BG[tone]),
199
+ color: cssVar("color.text.primary"),
200
+ border: bordered ? `1px solid ${cssVar("color.border.subtle")}` : "none",
201
+ borderRadius: radiusVar(radius),
202
+ boxShadow: shadowVar(elevation),
203
+ boxSizing: "border-box",
204
+ minWidth: 0
205
+ };
206
+ }
207
+
208
+ // src/Card.tsx
209
+ var import_jsx_runtime4 = require("react/jsx-runtime");
210
+ function Card({
211
+ padding = "md",
212
+ elevation = "sm",
213
+ radius = "md",
214
+ tone = "surface",
215
+ bordered = true,
216
+ className,
217
+ style,
218
+ children,
219
+ ...rest
220
+ }) {
221
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
222
+ "div",
223
+ {
224
+ "data-mason-component": "card",
225
+ "data-tone": tone,
226
+ className: mergeClassName(className),
227
+ style: {
228
+ ...cardStyle({ padding, elevation, radius, tone, bordered }),
229
+ ...style
230
+ },
231
+ ...rest,
232
+ children
233
+ }
234
+ );
235
+ }
236
+
237
+ // src/dividerStyles.ts
238
+ function dividerStyle(orientation = "horizontal") {
239
+ const line = `1px solid ${cssVar("color.border.subtle")}`;
240
+ if (orientation === "vertical") {
241
+ return {
242
+ alignSelf: "stretch",
243
+ width: 0,
244
+ minHeight: "1em",
245
+ margin: 0,
246
+ border: "none",
247
+ borderInlineStart: line
248
+ };
249
+ }
250
+ return {
251
+ width: "100%",
252
+ height: 0,
253
+ margin: 0,
254
+ border: "none",
255
+ borderBlockStart: line
256
+ };
257
+ }
258
+
259
+ // src/Divider.tsx
260
+ var import_jsx_runtime5 = require("react/jsx-runtime");
261
+ function Divider({
262
+ orientation = "horizontal",
263
+ className,
264
+ style,
265
+ ...rest
266
+ }) {
267
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
268
+ "hr",
269
+ {
270
+ "data-mason-component": "divider",
271
+ "data-orientation": orientation,
272
+ "aria-orientation": orientation === "vertical" ? "vertical" : void 0,
273
+ className: mergeClassName(className),
274
+ style: { ...dividerStyle(orientation), ...style },
275
+ ...rest
276
+ }
277
+ );
278
+ }
279
+
280
+ // src/linkStyles.ts
281
+ function linkStyle({
282
+ tone = "link",
283
+ underline = "hover"
284
+ }) {
285
+ return {
286
+ color: tone === "inherit" ? "inherit" : textColorVar("link"),
287
+ textDecoration: underline === "always" ? "underline" : "none",
288
+ textUnderlineOffset: "0.15em",
289
+ borderRadius: radiusVar("sm"),
290
+ cursor: "pointer"
291
+ };
292
+ }
293
+
294
+ // src/Link.tsx
295
+ var import_jsx_runtime6 = require("react/jsx-runtime");
296
+ function Link({
297
+ tone = "link",
298
+ underline = "hover",
299
+ external = false,
300
+ className,
301
+ style,
302
+ children,
303
+ ...rest
304
+ }) {
305
+ const externalProps = external ? { target: "_blank", rel: "noreferrer noopener" } : null;
306
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
307
+ "a",
308
+ {
309
+ "data-mason-component": "link",
310
+ "data-tone": tone,
311
+ "data-underline": underline,
312
+ className: mergeClassName(className),
313
+ style: { ...linkStyle({ tone, underline }), ...style },
314
+ ...externalProps,
315
+ ...rest,
316
+ children
317
+ }
318
+ );
319
+ }
320
+
321
+ // src/spinnerStyles.ts
322
+ var SIZE_DIMENSION = {
323
+ sm: cssVar("font.body.sm.size"),
324
+ md: cssVar("font.body.md.size"),
325
+ lg: cssVar("font.display.lg.size"),
326
+ inherit: "1em"
327
+ };
328
+ function spinnerStyle(size = "md") {
329
+ const dimension = SIZE_DIMENSION[size];
330
+ return {
331
+ width: dimension,
332
+ height: dimension,
333
+ border: "2px solid currentColor",
334
+ borderTopColor: "transparent",
335
+ borderRadius: "50%",
336
+ display: "inline-block",
337
+ flexShrink: 0
338
+ };
339
+ }
340
+
341
+ // src/Spinner.tsx
342
+ var import_jsx_runtime7 = require("react/jsx-runtime");
343
+ function Spinner({
344
+ size = "md",
345
+ label,
346
+ className,
347
+ style,
348
+ ...rest
349
+ }) {
350
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
351
+ "span",
352
+ {
353
+ "data-mason-component": "spinner",
354
+ "data-size": size,
355
+ role: label ? "status" : void 0,
356
+ "aria-label": label,
357
+ "aria-hidden": label ? void 0 : true,
358
+ className: mergeClassName(className),
359
+ style: { ...spinnerStyle(size), ...style },
360
+ ...rest
361
+ }
362
+ );
363
+ }
364
+
365
+ // src/buttonStyles.ts
366
+ function actionColors(variant) {
367
+ return {
368
+ bg: `color.action.${variant}.bg`,
369
+ text: `color.action.${variant}.text`,
370
+ border: `color.action.${variant}.border`
371
+ };
372
+ }
373
+ var sizeStyles = {
374
+ sm: {
375
+ paddingBlock: cssVar("spacing.inset.sm"),
376
+ paddingInline: cssVar("spacing.inset.md"),
377
+ gap: cssVar("spacing.inline.sm"),
378
+ radius: cssVar("radius.sm"),
379
+ font: "label.sm"
380
+ },
381
+ md: {
382
+ paddingBlock: cssVar("spacing.inset.md"),
383
+ paddingInline: cssVar("spacing.inset.lg"),
384
+ gap: cssVar("spacing.inline.md"),
385
+ radius: cssVar("radius.md"),
386
+ font: "label.md"
387
+ },
388
+ lg: {
389
+ paddingBlock: cssVar("spacing.inset.lg"),
390
+ paddingInline: `calc(${cssVar("spacing.inset.lg")} + ${cssVar("spacing.inset.md")})`,
391
+ gap: cssVar("spacing.inline.md"),
392
+ radius: cssVar("radius.lg"),
393
+ font: "label.lg"
394
+ }
395
+ };
396
+ function buttonStyle({
397
+ variant = "primary",
398
+ size = "md",
399
+ disabled = false,
400
+ loading = false
401
+ }) {
402
+ const inactive = disabled || loading;
403
+ const colors = actionColors(inactive ? "disabled" : variant);
404
+ const sizing = sizeStyles[size];
405
+ return {
406
+ display: "inline-flex",
407
+ alignItems: "center",
408
+ justifyContent: "center",
409
+ gap: sizing.gap,
410
+ paddingBlock: sizing.paddingBlock,
411
+ paddingInline: sizing.paddingInline,
412
+ margin: 0,
413
+ backgroundColor: cssVar(colors.bg),
414
+ color: cssVar(colors.text),
415
+ border: `1px solid ${cssVar(colors.border)}`,
416
+ borderRadius: sizing.radius,
417
+ boxSizing: "border-box",
418
+ ...typographyStyle(sizing.font),
419
+ textDecoration: "none",
420
+ whiteSpace: "nowrap"
421
+ };
422
+ }
423
+
424
+ // src/Button.tsx
425
+ var import_jsx_runtime8 = require("react/jsx-runtime");
426
+ function Button({
427
+ variant = "primary",
428
+ size = "md",
429
+ disabled = false,
430
+ loading = false,
431
+ leadingSlot,
432
+ trailingSlot,
433
+ className,
434
+ style,
435
+ children,
436
+ type = "button",
437
+ ...rest
438
+ }) {
439
+ const isDisabled = disabled || loading;
440
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
441
+ "button",
442
+ {
443
+ type,
444
+ "data-mason-component": "button",
445
+ "data-variant": variant,
446
+ "data-size": size,
447
+ disabled: isDisabled,
448
+ "aria-busy": loading || void 0,
449
+ className: mergeClassName(className),
450
+ style: {
451
+ ...buttonStyle({ variant, size, disabled, loading }),
452
+ ...style
453
+ },
454
+ ...rest,
455
+ children: [
456
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner, { size: "inherit", "data-mason-slot": "spinner" }) : leadingSlot ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "data-mason-slot": "leading", children: leadingSlot }) : null,
457
+ children ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "data-mason-slot": "label", children }) : null,
458
+ trailingSlot && !loading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "data-mason-slot": "trailing", children: trailingSlot }) : null
459
+ ]
460
+ }
461
+ );
462
+ }
463
+
464
+ // src/badgeStyles.ts
465
+ function badgeStyle({
466
+ tone = "neutral",
467
+ size = "sm"
468
+ }) {
469
+ const colors = tone === "neutral" ? {
470
+ bg: cssVar("color.bg.canvas"),
471
+ text: cssVar("color.text.secondary"),
472
+ border: cssVar("color.border.subtle")
473
+ } : {
474
+ bg: cssVar(`color.feedback.${tone}.bg`),
475
+ text: cssVar(`color.feedback.${tone}.text`),
476
+ border: cssVar(`color.feedback.${tone}.border`)
477
+ };
478
+ return {
479
+ display: "inline-flex",
480
+ alignItems: "center",
481
+ gap: spacingVar("inline", "sm"),
482
+ paddingBlock: "0.125em",
483
+ paddingInline: spacingVar("inset", "sm"),
484
+ backgroundColor: colors.bg,
485
+ color: colors.text,
486
+ border: `1px solid ${colors.border}`,
487
+ borderRadius: radiusVar("full"),
488
+ ...typographyStyle(size === "sm" ? "label.sm" : "label.md"),
489
+ whiteSpace: "nowrap"
490
+ };
491
+ }
492
+
493
+ // src/Badge.tsx
494
+ var import_jsx_runtime9 = require("react/jsx-runtime");
495
+ function Badge({
496
+ tone = "neutral",
497
+ size = "sm",
498
+ className,
499
+ style,
500
+ children,
501
+ ...rest
502
+ }) {
503
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
504
+ "span",
505
+ {
506
+ "data-mason-component": "badge",
507
+ "data-tone": tone,
508
+ "data-size": size,
509
+ className: mergeClassName(className),
510
+ style: { ...badgeStyle({ tone, size }), ...style },
511
+ ...rest,
512
+ children
513
+ }
514
+ );
515
+ }
516
+
517
+ // src/calloutStyles.ts
518
+ function calloutStyle(tone = "info") {
519
+ return {
520
+ display: "flex",
521
+ gap: spacingVar("inline", "md"),
522
+ padding: spacingVar("inset", "md"),
523
+ backgroundColor: cssVar(`color.feedback.${tone}.bg`),
524
+ color: cssVar(`color.feedback.${tone}.text`),
525
+ border: `1px solid ${cssVar(`color.feedback.${tone}.border`)}`,
526
+ borderRadius: radiusVar("md"),
527
+ boxSizing: "border-box",
528
+ ...typographyStyle("body.md")
529
+ };
530
+ }
531
+ function calloutContentStyle() {
532
+ return {
533
+ display: "flex",
534
+ flexDirection: "column",
535
+ gap: spacingVar("stack", "sm"),
536
+ minWidth: 0
537
+ };
538
+ }
539
+ function calloutTitleStyle() {
540
+ return { margin: 0, ...typographyStyle("label.md") };
541
+ }
542
+ function calloutBodyStyle() {
543
+ return { margin: 0, ...typographyStyle("body.sm") };
544
+ }
545
+
546
+ // src/Callout.tsx
547
+ var import_jsx_runtime10 = require("react/jsx-runtime");
548
+ function Callout({
549
+ tone = "info",
550
+ title,
551
+ iconSlot,
552
+ className,
553
+ style,
554
+ children,
555
+ ...rest
556
+ }) {
557
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
558
+ "div",
559
+ {
560
+ "data-mason-component": "callout",
561
+ "data-tone": tone,
562
+ className: mergeClassName(className),
563
+ style: { ...calloutStyle(tone), ...style },
564
+ ...rest,
565
+ children: [
566
+ iconSlot ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "data-mason-slot": "icon", "aria-hidden": "true", children: iconSlot }) : null,
567
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { "data-mason-slot": "content", style: calloutContentStyle(), children: [
568
+ title ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { "data-mason-slot": "title", style: calloutTitleStyle(), children: title }) : null,
569
+ children ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { "data-mason-slot": "body", style: calloutBodyStyle(), children }) : null
570
+ ] })
571
+ ]
572
+ }
573
+ );
574
+ }
575
+
576
+ // src/field.tsx
577
+ var import_react = require("react");
578
+
579
+ // src/fieldStyles.ts
580
+ var CONTROL_FONT = {
581
+ sm: "body.sm",
582
+ md: "body.md",
583
+ lg: "body.lg"
584
+ };
585
+ var LABEL_FONT = {
586
+ sm: "label.sm",
587
+ md: "label.md",
588
+ lg: "label.lg"
589
+ };
590
+ var CONTROL_PADDING_BLOCK = { sm: "sm", md: "sm", lg: "md" };
591
+ var CONTROL_PADDING_INLINE = { sm: "sm", md: "md", lg: "md" };
592
+ function fieldRootStyle() {
593
+ return {
594
+ display: "flex",
595
+ flexDirection: "column",
596
+ gap: spacingVar("stack", "sm"),
597
+ minWidth: 0
598
+ };
599
+ }
600
+ function fieldLabelStyle(size = "md") {
601
+ return {
602
+ color: cssVar("color.text.primary"),
603
+ ...typographyStyle(LABEL_FONT[size])
604
+ };
605
+ }
606
+ function fieldControlStyle({
607
+ size = "md",
608
+ invalid = false,
609
+ disabled = false
610
+ }) {
611
+ return {
612
+ width: "100%",
613
+ boxSizing: "border-box",
614
+ margin: 0,
615
+ paddingBlock: spacingVar("inset", CONTROL_PADDING_BLOCK[size]),
616
+ paddingInline: spacingVar("inset", CONTROL_PADDING_INLINE[size]),
617
+ backgroundColor: disabled ? cssVar("color.action.disabled.bg") : cssVar("color.field.bg"),
618
+ color: disabled ? cssVar("color.text.disabled") : cssVar("color.field.text"),
619
+ border: `1px solid ${cssVar(
620
+ invalid ? "color.field.borderInvalid" : "color.field.border"
621
+ )}`,
622
+ borderRadius: radiusVar("md"),
623
+ ...typographyStyle(CONTROL_FONT[size])
624
+ };
625
+ }
626
+ function fieldDescriptionStyle() {
627
+ return {
628
+ margin: 0,
629
+ color: cssVar("color.text.secondary"),
630
+ ...typographyStyle("body.sm")
631
+ };
632
+ }
633
+ function fieldErrorStyle() {
634
+ return {
635
+ margin: 0,
636
+ color: cssVar("color.text.danger"),
637
+ ...typographyStyle("body.sm")
638
+ };
639
+ }
640
+
641
+ // src/field.tsx
642
+ var import_jsx_runtime11 = require("react/jsx-runtime");
643
+ function useFieldIds({
644
+ id,
645
+ description,
646
+ error
647
+ }) {
648
+ const generated = (0, import_react.useId)();
649
+ const controlId = id ?? `mason-field-${generated}`;
650
+ const descriptionId = `${controlId}-description`;
651
+ const errorId = `${controlId}-error`;
652
+ const describedBy = [description ? descriptionId : null, error ? errorId : null].filter(Boolean).join(" ") || void 0;
653
+ return { controlId, descriptionId, errorId, describedBy };
654
+ }
655
+ function FieldFrame({
656
+ component,
657
+ ids,
658
+ label,
659
+ description,
660
+ error,
661
+ size = "md",
662
+ invalid = false,
663
+ disabled = false,
664
+ className,
665
+ style,
666
+ children
667
+ }) {
668
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
669
+ "div",
670
+ {
671
+ "data-mason-component": component,
672
+ "data-size": size,
673
+ "data-invalid": invalid || void 0,
674
+ "data-disabled": disabled || void 0,
675
+ className: mergeClassName(className),
676
+ style: { ...fieldRootStyle(), ...style },
677
+ children: [
678
+ label ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
679
+ "label",
680
+ {
681
+ "data-mason-slot": "label",
682
+ htmlFor: ids.controlId,
683
+ style: fieldLabelStyle(size),
684
+ children: label
685
+ }
686
+ ) : null,
687
+ children,
688
+ description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
689
+ "p",
690
+ {
691
+ "data-mason-slot": "description",
692
+ id: ids.descriptionId,
693
+ style: fieldDescriptionStyle(),
694
+ children: description
695
+ }
696
+ ) : null,
697
+ error ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
698
+ "p",
699
+ {
700
+ "data-mason-slot": "error",
701
+ id: ids.errorId,
702
+ role: "alert",
703
+ style: fieldErrorStyle(),
704
+ children: error
705
+ }
706
+ ) : null
707
+ ]
708
+ }
709
+ );
710
+ }
711
+
712
+ // src/TextField.tsx
713
+ var import_jsx_runtime12 = require("react/jsx-runtime");
714
+ function TextField({
715
+ label,
716
+ description,
717
+ error,
718
+ size = "md",
719
+ invalid,
720
+ id,
721
+ disabled = false,
722
+ className,
723
+ style,
724
+ ...rest
725
+ }) {
726
+ const ids = useFieldIds({ id, description, error });
727
+ const isInvalid = invalid ?? Boolean(error);
728
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
729
+ FieldFrame,
730
+ {
731
+ component: "text-field",
732
+ ids,
733
+ label,
734
+ description,
735
+ error,
736
+ size,
737
+ invalid: isInvalid,
738
+ disabled,
739
+ className,
740
+ style,
741
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
742
+ "input",
743
+ {
744
+ ...rest,
745
+ id: ids.controlId,
746
+ "data-mason-slot": "control",
747
+ disabled,
748
+ "aria-invalid": isInvalid || void 0,
749
+ "aria-describedby": ids.describedBy,
750
+ style: fieldControlStyle({ size, invalid: isInvalid, disabled })
751
+ }
752
+ )
753
+ }
754
+ );
755
+ }
756
+
757
+ // src/Select.tsx
758
+ var import_jsx_runtime13 = require("react/jsx-runtime");
759
+ function Select({
760
+ label,
761
+ description,
762
+ error,
763
+ size = "md",
764
+ invalid,
765
+ placeholder,
766
+ id,
767
+ disabled = false,
768
+ className,
769
+ style,
770
+ children,
771
+ ...rest
772
+ }) {
773
+ const ids = useFieldIds({ id, description, error });
774
+ const isInvalid = invalid ?? Boolean(error);
775
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
776
+ FieldFrame,
777
+ {
778
+ component: "select",
779
+ ids,
780
+ label,
781
+ description,
782
+ error,
783
+ size,
784
+ invalid: isInvalid,
785
+ disabled,
786
+ className,
787
+ style,
788
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
789
+ "select",
790
+ {
791
+ ...rest,
792
+ id: ids.controlId,
793
+ "data-mason-slot": "control",
794
+ disabled,
795
+ "aria-invalid": isInvalid || void 0,
796
+ "aria-describedby": ids.describedBy,
797
+ style: fieldControlStyle({ size, invalid: isInvalid, disabled }),
798
+ children: [
799
+ placeholder ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "", children: placeholder }) : null,
800
+ children
801
+ ]
802
+ }
803
+ )
804
+ }
805
+ );
806
+ }
807
+
808
+ // src/checkboxStyles.ts
809
+ function checkboxRootStyle() {
810
+ return {
811
+ display: "flex",
812
+ flexDirection: "column",
813
+ gap: spacingVar("stack", "sm"),
814
+ minWidth: 0
815
+ };
816
+ }
817
+ function checkboxLabelStyle(disabled = false) {
818
+ return {
819
+ display: "inline-flex",
820
+ alignItems: "flex-start",
821
+ gap: spacingVar("inline", "sm"),
822
+ cursor: disabled ? "not-allowed" : "pointer",
823
+ color: disabled ? cssVar("color.text.disabled") : cssVar("color.text.primary"),
824
+ ...typographyStyle("body.md")
825
+ };
826
+ }
827
+ function checkboxControlStyle() {
828
+ return {
829
+ width: "1em",
830
+ height: "1em",
831
+ margin: 0,
832
+ marginBlockStart: "0.15em",
833
+ accentColor: cssVar("color.action.primary.bg"),
834
+ flexShrink: 0
835
+ };
836
+ }
837
+
838
+ // src/Checkbox.tsx
839
+ var import_jsx_runtime14 = require("react/jsx-runtime");
840
+ function Checkbox({
841
+ label,
842
+ description,
843
+ error,
844
+ invalid,
845
+ id,
846
+ disabled = false,
847
+ className,
848
+ style,
849
+ ...rest
850
+ }) {
851
+ const ids = useFieldIds({ id, description, error });
852
+ const isInvalid = invalid ?? Boolean(error);
853
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
854
+ "div",
855
+ {
856
+ "data-mason-component": "checkbox",
857
+ "data-invalid": isInvalid || void 0,
858
+ "data-disabled": disabled || void 0,
859
+ className: mergeClassName(className),
860
+ style: { ...checkboxRootStyle(), ...style },
861
+ children: [
862
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
863
+ "label",
864
+ {
865
+ "data-mason-slot": "label",
866
+ htmlFor: ids.controlId,
867
+ style: checkboxLabelStyle(disabled),
868
+ children: [
869
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
870
+ "input",
871
+ {
872
+ ...rest,
873
+ type: "checkbox",
874
+ id: ids.controlId,
875
+ "data-mason-slot": "control",
876
+ disabled,
877
+ "aria-invalid": isInvalid || void 0,
878
+ "aria-describedby": ids.describedBy,
879
+ style: checkboxControlStyle()
880
+ }
881
+ ),
882
+ label ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "data-mason-slot": "label-text", children: label }) : null
883
+ ]
884
+ }
885
+ ),
886
+ description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
887
+ "p",
888
+ {
889
+ "data-mason-slot": "description",
890
+ id: ids.descriptionId,
891
+ style: fieldDescriptionStyle(),
892
+ children: description
893
+ }
894
+ ) : null,
895
+ error ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
896
+ "p",
897
+ {
898
+ "data-mason-slot": "error",
899
+ id: ids.errorId,
900
+ role: "alert",
901
+ style: fieldErrorStyle(),
902
+ children: error
903
+ }
904
+ ) : null
905
+ ]
906
+ }
907
+ );
908
+ }
909
+ // Annotate the CommonJS export names for ESM import in node:
910
+ 0 && (module.exports = {
911
+ Badge,
912
+ Button,
913
+ Callout,
914
+ Card,
915
+ Checkbox,
916
+ Divider,
917
+ Link,
918
+ MasonProvider,
919
+ Select,
920
+ Spinner,
921
+ Stack,
922
+ Text,
923
+ TextField
924
+ });
925
+ //# sourceMappingURL=index.cjs.map