@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.cjs +373 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -2
- package/dist/index.d.ts +50 -2
- package/dist/index.js +359 -89
- package/dist/index.js.map +1 -1
- package/llms.txt +103 -21
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -21,11 +21,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
Badge: () => Badge,
|
|
24
|
+
Box: () => Box,
|
|
24
25
|
Button: () => Button,
|
|
25
26
|
Callout: () => Callout,
|
|
26
27
|
Card: () => Card,
|
|
27
28
|
Checkbox: () => Checkbox,
|
|
29
|
+
Container: () => Container,
|
|
28
30
|
Divider: () => Divider,
|
|
31
|
+
Grid: () => Grid,
|
|
29
32
|
Link: () => Link,
|
|
30
33
|
MasonProvider: () => MasonProvider,
|
|
31
34
|
Radio: () => Radio,
|
|
@@ -33,7 +36,8 @@ __export(index_exports, {
|
|
|
33
36
|
Spinner: () => Spinner,
|
|
34
37
|
Stack: () => Stack,
|
|
35
38
|
Text: () => Text,
|
|
36
|
-
TextField: () => TextField
|
|
39
|
+
TextField: () => TextField,
|
|
40
|
+
Toggle: () => Toggle
|
|
37
41
|
});
|
|
38
42
|
module.exports = __toCommonJS(index_exports);
|
|
39
43
|
|
|
@@ -51,6 +55,9 @@ function cssVar(path) {
|
|
|
51
55
|
function spacingVar(axis, level) {
|
|
52
56
|
return cssVar(`spacing.${axis}.${level}`);
|
|
53
57
|
}
|
|
58
|
+
function containerMaxWidthVar(level) {
|
|
59
|
+
return cssVar(`spacing.layout.container.${level}`);
|
|
60
|
+
}
|
|
54
61
|
function radiusVar(level) {
|
|
55
62
|
return cssVar(`radius.${level}`);
|
|
56
63
|
}
|
|
@@ -74,7 +81,7 @@ function mergeClassName(...parts) {
|
|
|
74
81
|
return merged.length > 0 ? merged : void 0;
|
|
75
82
|
}
|
|
76
83
|
|
|
77
|
-
// src/textStyles.ts
|
|
84
|
+
// src/primitives/textStyles.ts
|
|
78
85
|
function textStyle({
|
|
79
86
|
variant = "body.md",
|
|
80
87
|
tone = "primary",
|
|
@@ -90,7 +97,7 @@ function textStyle({
|
|
|
90
97
|
};
|
|
91
98
|
}
|
|
92
99
|
|
|
93
|
-
// src/Text.tsx
|
|
100
|
+
// src/primitives/Text.tsx
|
|
94
101
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
95
102
|
function Text({
|
|
96
103
|
as = "p",
|
|
@@ -117,7 +124,7 @@ function Text({
|
|
|
117
124
|
);
|
|
118
125
|
}
|
|
119
126
|
|
|
120
|
-
// src/stackStyles.ts
|
|
127
|
+
// src/primitives/stackStyles.ts
|
|
121
128
|
var FLEX_ALIGN = {
|
|
122
129
|
start: "flex-start",
|
|
123
130
|
center: "center",
|
|
@@ -150,7 +157,7 @@ function stackStyle({
|
|
|
150
157
|
};
|
|
151
158
|
}
|
|
152
159
|
|
|
153
|
-
// src/Stack.tsx
|
|
160
|
+
// src/primitives/Stack.tsx
|
|
154
161
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
155
162
|
function Stack({
|
|
156
163
|
direction = "column",
|
|
@@ -180,8 +187,156 @@ function Stack({
|
|
|
180
187
|
);
|
|
181
188
|
}
|
|
182
189
|
|
|
183
|
-
// src/
|
|
190
|
+
// src/primitives/boxStyles.ts
|
|
184
191
|
var TONE_BG = {
|
|
192
|
+
canvas: "color.bg.canvas",
|
|
193
|
+
surface: "color.bg.surface",
|
|
194
|
+
elevated: "color.bg.elevated"
|
|
195
|
+
};
|
|
196
|
+
function boxStyle({
|
|
197
|
+
padding,
|
|
198
|
+
tone = "transparent",
|
|
199
|
+
radius,
|
|
200
|
+
bordered = false
|
|
201
|
+
}) {
|
|
202
|
+
return {
|
|
203
|
+
display: "block",
|
|
204
|
+
boxSizing: "border-box",
|
|
205
|
+
minWidth: 0,
|
|
206
|
+
...padding ? { padding: spacingVar("inset", padding) } : null,
|
|
207
|
+
...tone !== "transparent" ? { backgroundColor: cssVar(TONE_BG[tone]) } : null,
|
|
208
|
+
...radius ? { borderRadius: radiusVar(radius) } : null,
|
|
209
|
+
...bordered ? { border: `1px solid ${cssVar("color.border.subtle")}` } : null
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// src/primitives/Box.tsx
|
|
214
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
215
|
+
function Box({
|
|
216
|
+
as = "div",
|
|
217
|
+
padding,
|
|
218
|
+
tone = "transparent",
|
|
219
|
+
radius,
|
|
220
|
+
bordered = false,
|
|
221
|
+
className,
|
|
222
|
+
style,
|
|
223
|
+
children,
|
|
224
|
+
...rest
|
|
225
|
+
}) {
|
|
226
|
+
const Component = as;
|
|
227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
228
|
+
Component,
|
|
229
|
+
{
|
|
230
|
+
"data-mason-component": "box",
|
|
231
|
+
"data-tone": tone,
|
|
232
|
+
className: mergeClassName(className),
|
|
233
|
+
style: { ...boxStyle({ padding, tone, radius, bordered }), ...style },
|
|
234
|
+
...rest,
|
|
235
|
+
children
|
|
236
|
+
}
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// src/primitives/gridStyles.ts
|
|
241
|
+
var GRID_ALIGN = {
|
|
242
|
+
start: "start",
|
|
243
|
+
center: "center",
|
|
244
|
+
end: "end",
|
|
245
|
+
stretch: "stretch",
|
|
246
|
+
baseline: "baseline"
|
|
247
|
+
};
|
|
248
|
+
var GRID_JUSTIFY = {
|
|
249
|
+
start: "start",
|
|
250
|
+
center: "center",
|
|
251
|
+
end: "end",
|
|
252
|
+
between: "space-between"
|
|
253
|
+
};
|
|
254
|
+
function gridStyle({
|
|
255
|
+
columns = 2,
|
|
256
|
+
gap = "md",
|
|
257
|
+
align,
|
|
258
|
+
justify
|
|
259
|
+
}) {
|
|
260
|
+
return {
|
|
261
|
+
display: "grid",
|
|
262
|
+
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
|
|
263
|
+
gap: spacingVar("stack", gap),
|
|
264
|
+
minWidth: 0,
|
|
265
|
+
...align ? { alignItems: GRID_ALIGN[align] } : null,
|
|
266
|
+
...justify ? { justifyContent: GRID_JUSTIFY[justify] } : null
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// src/primitives/Grid.tsx
|
|
271
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
272
|
+
function Grid({
|
|
273
|
+
columns = 2,
|
|
274
|
+
gap = "md",
|
|
275
|
+
align,
|
|
276
|
+
justify,
|
|
277
|
+
className,
|
|
278
|
+
style,
|
|
279
|
+
children,
|
|
280
|
+
...rest
|
|
281
|
+
}) {
|
|
282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
283
|
+
"div",
|
|
284
|
+
{
|
|
285
|
+
"data-mason-component": "grid",
|
|
286
|
+
"data-columns": columns,
|
|
287
|
+
className: mergeClassName(className),
|
|
288
|
+
style: { ...gridStyle({ columns, gap, align, justify }), ...style },
|
|
289
|
+
...rest,
|
|
290
|
+
children
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// src/primitives/containerStyles.ts
|
|
296
|
+
function containerStyle({
|
|
297
|
+
maxWidth = "lg",
|
|
298
|
+
padding,
|
|
299
|
+
center = true
|
|
300
|
+
}) {
|
|
301
|
+
return {
|
|
302
|
+
display: "block",
|
|
303
|
+
boxSizing: "border-box",
|
|
304
|
+
width: "100%",
|
|
305
|
+
minWidth: 0,
|
|
306
|
+
maxWidth: containerMaxWidthVar(maxWidth),
|
|
307
|
+
...center ? { marginInline: "auto" } : null,
|
|
308
|
+
...padding ? { paddingInline: spacingVar("inline", padding) } : null
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// src/primitives/Container.tsx
|
|
313
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
314
|
+
function Container({
|
|
315
|
+
as = "div",
|
|
316
|
+
maxWidth = "lg",
|
|
317
|
+
padding,
|
|
318
|
+
center = true,
|
|
319
|
+
className,
|
|
320
|
+
style,
|
|
321
|
+
children,
|
|
322
|
+
...rest
|
|
323
|
+
}) {
|
|
324
|
+
const Component = as;
|
|
325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
326
|
+
Component,
|
|
327
|
+
{
|
|
328
|
+
"data-mason-component": "container",
|
|
329
|
+
"data-max-width": maxWidth,
|
|
330
|
+
className: mergeClassName(className),
|
|
331
|
+
style: { ...containerStyle({ maxWidth, padding, center }), ...style },
|
|
332
|
+
...rest,
|
|
333
|
+
children
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// src/primitives/cardStyles.ts
|
|
339
|
+
var TONE_BG2 = {
|
|
185
340
|
surface: "color.bg.surface",
|
|
186
341
|
canvas: "color.bg.canvas",
|
|
187
342
|
elevated: "color.bg.elevated"
|
|
@@ -196,7 +351,7 @@ function cardStyle({
|
|
|
196
351
|
return {
|
|
197
352
|
display: "block",
|
|
198
353
|
padding: spacingVar("inset", padding),
|
|
199
|
-
backgroundColor: cssVar(
|
|
354
|
+
backgroundColor: cssVar(TONE_BG2[tone]),
|
|
200
355
|
color: cssVar("color.text.primary"),
|
|
201
356
|
border: bordered ? `1px solid ${cssVar("color.border.subtle")}` : "none",
|
|
202
357
|
borderRadius: radiusVar(radius),
|
|
@@ -206,8 +361,8 @@ function cardStyle({
|
|
|
206
361
|
};
|
|
207
362
|
}
|
|
208
363
|
|
|
209
|
-
// src/Card.tsx
|
|
210
|
-
var
|
|
364
|
+
// src/primitives/Card.tsx
|
|
365
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
211
366
|
function Card({
|
|
212
367
|
padding = "md",
|
|
213
368
|
elevation = "sm",
|
|
@@ -219,7 +374,7 @@ function Card({
|
|
|
219
374
|
children,
|
|
220
375
|
...rest
|
|
221
376
|
}) {
|
|
222
|
-
return /* @__PURE__ */ (0,
|
|
377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
223
378
|
"div",
|
|
224
379
|
{
|
|
225
380
|
"data-mason-component": "card",
|
|
@@ -235,7 +390,7 @@ function Card({
|
|
|
235
390
|
);
|
|
236
391
|
}
|
|
237
392
|
|
|
238
|
-
// src/dividerStyles.ts
|
|
393
|
+
// src/primitives/dividerStyles.ts
|
|
239
394
|
function dividerStyle(orientation = "horizontal") {
|
|
240
395
|
const line = `1px solid ${cssVar("color.border.subtle")}`;
|
|
241
396
|
if (orientation === "vertical") {
|
|
@@ -257,15 +412,15 @@ function dividerStyle(orientation = "horizontal") {
|
|
|
257
412
|
};
|
|
258
413
|
}
|
|
259
414
|
|
|
260
|
-
// src/Divider.tsx
|
|
261
|
-
var
|
|
415
|
+
// src/primitives/Divider.tsx
|
|
416
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
262
417
|
function Divider({
|
|
263
418
|
orientation = "horizontal",
|
|
264
419
|
className,
|
|
265
420
|
style,
|
|
266
421
|
...rest
|
|
267
422
|
}) {
|
|
268
|
-
return /* @__PURE__ */ (0,
|
|
423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
269
424
|
"hr",
|
|
270
425
|
{
|
|
271
426
|
"data-mason-component": "divider",
|
|
@@ -278,7 +433,7 @@ function Divider({
|
|
|
278
433
|
);
|
|
279
434
|
}
|
|
280
435
|
|
|
281
|
-
// src/linkStyles.ts
|
|
436
|
+
// src/primitives/linkStyles.ts
|
|
282
437
|
function linkStyle({
|
|
283
438
|
tone = "link",
|
|
284
439
|
underline = "hover"
|
|
@@ -292,8 +447,8 @@ function linkStyle({
|
|
|
292
447
|
};
|
|
293
448
|
}
|
|
294
449
|
|
|
295
|
-
// src/Link.tsx
|
|
296
|
-
var
|
|
450
|
+
// src/primitives/Link.tsx
|
|
451
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
297
452
|
function Link({
|
|
298
453
|
tone = "link",
|
|
299
454
|
underline = "hover",
|
|
@@ -304,7 +459,7 @@ function Link({
|
|
|
304
459
|
...rest
|
|
305
460
|
}) {
|
|
306
461
|
const externalProps = external ? { target: "_blank", rel: "noreferrer noopener" } : null;
|
|
307
|
-
return /* @__PURE__ */ (0,
|
|
462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
308
463
|
"a",
|
|
309
464
|
{
|
|
310
465
|
"data-mason-component": "link",
|
|
@@ -319,7 +474,7 @@ function Link({
|
|
|
319
474
|
);
|
|
320
475
|
}
|
|
321
476
|
|
|
322
|
-
// src/spinnerStyles.ts
|
|
477
|
+
// src/primitives/spinnerStyles.ts
|
|
323
478
|
var SIZE_DIMENSION = {
|
|
324
479
|
sm: cssVar("font.body.sm.size"),
|
|
325
480
|
md: cssVar("font.body.md.size"),
|
|
@@ -339,8 +494,8 @@ function spinnerStyle(size = "md") {
|
|
|
339
494
|
};
|
|
340
495
|
}
|
|
341
496
|
|
|
342
|
-
// src/Spinner.tsx
|
|
343
|
-
var
|
|
497
|
+
// src/primitives/Spinner.tsx
|
|
498
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
344
499
|
function Spinner({
|
|
345
500
|
size = "md",
|
|
346
501
|
label,
|
|
@@ -348,7 +503,7 @@ function Spinner({
|
|
|
348
503
|
style,
|
|
349
504
|
...rest
|
|
350
505
|
}) {
|
|
351
|
-
return /* @__PURE__ */ (0,
|
|
506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
352
507
|
"span",
|
|
353
508
|
{
|
|
354
509
|
"data-mason-component": "spinner",
|
|
@@ -363,14 +518,7 @@ function Spinner({
|
|
|
363
518
|
);
|
|
364
519
|
}
|
|
365
520
|
|
|
366
|
-
// src/buttonStyles.ts
|
|
367
|
-
function actionColors(variant) {
|
|
368
|
-
return {
|
|
369
|
-
bg: `color.action.${variant}.bg`,
|
|
370
|
-
text: `color.action.${variant}.text`,
|
|
371
|
-
border: `color.action.${variant}.border`
|
|
372
|
-
};
|
|
373
|
-
}
|
|
521
|
+
// src/primitives/buttonStyles.ts
|
|
374
522
|
var sizeStyles = {
|
|
375
523
|
sm: {
|
|
376
524
|
paddingBlock: cssVar("spacing.inset.sm"),
|
|
@@ -394,14 +542,7 @@ var sizeStyles = {
|
|
|
394
542
|
font: "label.lg"
|
|
395
543
|
}
|
|
396
544
|
};
|
|
397
|
-
function buttonStyle({
|
|
398
|
-
variant = "primary",
|
|
399
|
-
size = "md",
|
|
400
|
-
disabled = false,
|
|
401
|
-
loading = false
|
|
402
|
-
}) {
|
|
403
|
-
const inactive = disabled || loading;
|
|
404
|
-
const colors = actionColors(inactive ? "disabled" : variant);
|
|
545
|
+
function buttonStyle({ size = "md" }) {
|
|
405
546
|
const sizing = sizeStyles[size];
|
|
406
547
|
return {
|
|
407
548
|
display: "inline-flex",
|
|
@@ -411,9 +552,6 @@ function buttonStyle({
|
|
|
411
552
|
paddingBlock: sizing.paddingBlock,
|
|
412
553
|
paddingInline: sizing.paddingInline,
|
|
413
554
|
margin: 0,
|
|
414
|
-
backgroundColor: cssVar(colors.bg),
|
|
415
|
-
color: cssVar(colors.text),
|
|
416
|
-
border: `1px solid ${cssVar(colors.border)}`,
|
|
417
555
|
borderRadius: sizing.radius,
|
|
418
556
|
boxSizing: "border-box",
|
|
419
557
|
...typographyStyle(sizing.font),
|
|
@@ -422,8 +560,8 @@ function buttonStyle({
|
|
|
422
560
|
};
|
|
423
561
|
}
|
|
424
562
|
|
|
425
|
-
// src/Button.tsx
|
|
426
|
-
var
|
|
563
|
+
// src/primitives/Button.tsx
|
|
564
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
427
565
|
function Button({
|
|
428
566
|
variant = "primary",
|
|
429
567
|
size = "md",
|
|
@@ -438,7 +576,7 @@ function Button({
|
|
|
438
576
|
...rest
|
|
439
577
|
}) {
|
|
440
578
|
const isDisabled = disabled || loading;
|
|
441
|
-
return /* @__PURE__ */ (0,
|
|
579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
442
580
|
"button",
|
|
443
581
|
{
|
|
444
582
|
type,
|
|
@@ -449,20 +587,20 @@ function Button({
|
|
|
449
587
|
"aria-busy": loading || void 0,
|
|
450
588
|
className: mergeClassName(className),
|
|
451
589
|
style: {
|
|
452
|
-
...buttonStyle({
|
|
590
|
+
...buttonStyle({ size }),
|
|
453
591
|
...style
|
|
454
592
|
},
|
|
455
593
|
...rest,
|
|
456
594
|
children: [
|
|
457
|
-
loading ? /* @__PURE__ */ (0,
|
|
458
|
-
children ? /* @__PURE__ */ (0,
|
|
459
|
-
trailingSlot && !loading ? /* @__PURE__ */ (0,
|
|
595
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Spinner, { size: "inherit", "data-mason-slot": "spinner" }) : leadingSlot ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "data-mason-slot": "leading", children: leadingSlot }) : null,
|
|
596
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "data-mason-slot": "label", children }) : null,
|
|
597
|
+
trailingSlot && !loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "data-mason-slot": "trailing", children: trailingSlot }) : null
|
|
460
598
|
]
|
|
461
599
|
}
|
|
462
600
|
);
|
|
463
601
|
}
|
|
464
602
|
|
|
465
|
-
// src/badgeStyles.ts
|
|
603
|
+
// src/primitives/badgeStyles.ts
|
|
466
604
|
function badgeStyle({
|
|
467
605
|
tone = "neutral",
|
|
468
606
|
size = "sm"
|
|
@@ -491,8 +629,8 @@ function badgeStyle({
|
|
|
491
629
|
};
|
|
492
630
|
}
|
|
493
631
|
|
|
494
|
-
// src/Badge.tsx
|
|
495
|
-
var
|
|
632
|
+
// src/primitives/Badge.tsx
|
|
633
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
496
634
|
function Badge({
|
|
497
635
|
tone = "neutral",
|
|
498
636
|
size = "sm",
|
|
@@ -501,7 +639,7 @@ function Badge({
|
|
|
501
639
|
children,
|
|
502
640
|
...rest
|
|
503
641
|
}) {
|
|
504
|
-
return /* @__PURE__ */ (0,
|
|
642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
505
643
|
"span",
|
|
506
644
|
{
|
|
507
645
|
"data-mason-component": "badge",
|
|
@@ -515,7 +653,7 @@ function Badge({
|
|
|
515
653
|
);
|
|
516
654
|
}
|
|
517
655
|
|
|
518
|
-
// src/calloutStyles.ts
|
|
656
|
+
// src/primitives/calloutStyles.ts
|
|
519
657
|
function calloutStyle(tone = "info") {
|
|
520
658
|
return {
|
|
521
659
|
display: "flex",
|
|
@@ -544,8 +682,8 @@ function calloutBodyStyle() {
|
|
|
544
682
|
return { margin: 0, ...typographyStyle("body.sm") };
|
|
545
683
|
}
|
|
546
684
|
|
|
547
|
-
// src/Callout.tsx
|
|
548
|
-
var
|
|
685
|
+
// src/primitives/Callout.tsx
|
|
686
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
549
687
|
function Callout({
|
|
550
688
|
tone = "info",
|
|
551
689
|
title,
|
|
@@ -555,7 +693,7 @@ function Callout({
|
|
|
555
693
|
children,
|
|
556
694
|
...rest
|
|
557
695
|
}) {
|
|
558
|
-
return /* @__PURE__ */ (0,
|
|
696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
559
697
|
"div",
|
|
560
698
|
{
|
|
561
699
|
"data-mason-component": "callout",
|
|
@@ -564,20 +702,20 @@ function Callout({
|
|
|
564
702
|
style: { ...calloutStyle(tone), ...style },
|
|
565
703
|
...rest,
|
|
566
704
|
children: [
|
|
567
|
-
iconSlot ? /* @__PURE__ */ (0,
|
|
568
|
-
/* @__PURE__ */ (0,
|
|
569
|
-
title ? /* @__PURE__ */ (0,
|
|
570
|
-
children ? /* @__PURE__ */ (0,
|
|
705
|
+
iconSlot ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "data-mason-slot": "icon", "aria-hidden": "true", children: iconSlot }) : null,
|
|
706
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { "data-mason-slot": "content", style: calloutContentStyle(), children: [
|
|
707
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { "data-mason-slot": "title", style: calloutTitleStyle(), children: title }) : null,
|
|
708
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-mason-slot": "body", style: calloutBodyStyle(), children }) : null
|
|
571
709
|
] })
|
|
572
710
|
]
|
|
573
711
|
}
|
|
574
712
|
);
|
|
575
713
|
}
|
|
576
714
|
|
|
577
|
-
// src/field.tsx
|
|
715
|
+
// src/compounds/field.tsx
|
|
578
716
|
var import_react = require("react");
|
|
579
717
|
|
|
580
|
-
// src/fieldStyles.ts
|
|
718
|
+
// src/compounds/fieldStyles.ts
|
|
581
719
|
var CONTROL_FONT = {
|
|
582
720
|
sm: "body.sm",
|
|
583
721
|
md: "body.md",
|
|
@@ -641,10 +779,12 @@ function fieldErrorStyle() {
|
|
|
641
779
|
function visuallyHiddenControlStyle() {
|
|
642
780
|
return {
|
|
643
781
|
position: "absolute",
|
|
782
|
+
left: 0,
|
|
783
|
+
top: 0,
|
|
644
784
|
width: 1,
|
|
645
785
|
height: 1,
|
|
646
786
|
padding: 0,
|
|
647
|
-
margin:
|
|
787
|
+
margin: 0,
|
|
648
788
|
overflow: "hidden",
|
|
649
789
|
clip: "rect(0, 0, 0, 0)",
|
|
650
790
|
whiteSpace: "nowrap",
|
|
@@ -654,8 +794,8 @@ function visuallyHiddenControlStyle() {
|
|
|
654
794
|
};
|
|
655
795
|
}
|
|
656
796
|
|
|
657
|
-
// src/field.tsx
|
|
658
|
-
var
|
|
797
|
+
// src/compounds/field.tsx
|
|
798
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
659
799
|
function useFieldIds({
|
|
660
800
|
id,
|
|
661
801
|
description,
|
|
@@ -681,7 +821,7 @@ function FieldFrame({
|
|
|
681
821
|
style,
|
|
682
822
|
children
|
|
683
823
|
}) {
|
|
684
|
-
return /* @__PURE__ */ (0,
|
|
824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
685
825
|
"div",
|
|
686
826
|
{
|
|
687
827
|
"data-mason-component": component,
|
|
@@ -691,7 +831,7 @@ function FieldFrame({
|
|
|
691
831
|
className: mergeClassName(className),
|
|
692
832
|
style: { ...fieldRootStyle(), ...style },
|
|
693
833
|
children: [
|
|
694
|
-
label ? /* @__PURE__ */ (0,
|
|
834
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
695
835
|
"label",
|
|
696
836
|
{
|
|
697
837
|
"data-mason-slot": "label",
|
|
@@ -701,7 +841,7 @@ function FieldFrame({
|
|
|
701
841
|
}
|
|
702
842
|
) : null,
|
|
703
843
|
children,
|
|
704
|
-
description ? /* @__PURE__ */ (0,
|
|
844
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
705
845
|
"p",
|
|
706
846
|
{
|
|
707
847
|
"data-mason-slot": "description",
|
|
@@ -710,7 +850,7 @@ function FieldFrame({
|
|
|
710
850
|
children: description
|
|
711
851
|
}
|
|
712
852
|
) : null,
|
|
713
|
-
error ? /* @__PURE__ */ (0,
|
|
853
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
714
854
|
"p",
|
|
715
855
|
{
|
|
716
856
|
"data-mason-slot": "error",
|
|
@@ -725,8 +865,8 @@ function FieldFrame({
|
|
|
725
865
|
);
|
|
726
866
|
}
|
|
727
867
|
|
|
728
|
-
// src/TextField.tsx
|
|
729
|
-
var
|
|
868
|
+
// src/compounds/TextField.tsx
|
|
869
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
730
870
|
function TextField({
|
|
731
871
|
label,
|
|
732
872
|
description,
|
|
@@ -741,7 +881,7 @@ function TextField({
|
|
|
741
881
|
}) {
|
|
742
882
|
const ids = useFieldIds({ id, description, error });
|
|
743
883
|
const isInvalid = invalid ?? Boolean(error);
|
|
744
|
-
return /* @__PURE__ */ (0,
|
|
884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
745
885
|
FieldFrame,
|
|
746
886
|
{
|
|
747
887
|
component: "text-field",
|
|
@@ -754,7 +894,7 @@ function TextField({
|
|
|
754
894
|
disabled,
|
|
755
895
|
className,
|
|
756
896
|
style,
|
|
757
|
-
children: /* @__PURE__ */ (0,
|
|
897
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
758
898
|
"input",
|
|
759
899
|
{
|
|
760
900
|
...rest,
|
|
@@ -770,8 +910,8 @@ function TextField({
|
|
|
770
910
|
);
|
|
771
911
|
}
|
|
772
912
|
|
|
773
|
-
// src/Select.tsx
|
|
774
|
-
var
|
|
913
|
+
// src/compounds/Select.tsx
|
|
914
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
775
915
|
function Select({
|
|
776
916
|
label,
|
|
777
917
|
description,
|
|
@@ -788,7 +928,7 @@ function Select({
|
|
|
788
928
|
}) {
|
|
789
929
|
const ids = useFieldIds({ id, description, error });
|
|
790
930
|
const isInvalid = invalid ?? Boolean(error);
|
|
791
|
-
return /* @__PURE__ */ (0,
|
|
931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
792
932
|
FieldFrame,
|
|
793
933
|
{
|
|
794
934
|
component: "select",
|
|
@@ -801,7 +941,7 @@ function Select({
|
|
|
801
941
|
disabled,
|
|
802
942
|
className,
|
|
803
943
|
style,
|
|
804
|
-
children: /* @__PURE__ */ (0,
|
|
944
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
805
945
|
"select",
|
|
806
946
|
{
|
|
807
947
|
...rest,
|
|
@@ -812,7 +952,7 @@ function Select({
|
|
|
812
952
|
"aria-describedby": ids.describedBy,
|
|
813
953
|
style: fieldControlStyle({ size, invalid: isInvalid, disabled }),
|
|
814
954
|
children: [
|
|
815
|
-
placeholder ? /* @__PURE__ */ (0,
|
|
955
|
+
placeholder ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "", children: placeholder }) : null,
|
|
816
956
|
children
|
|
817
957
|
]
|
|
818
958
|
}
|
|
@@ -821,10 +961,11 @@ function Select({
|
|
|
821
961
|
);
|
|
822
962
|
}
|
|
823
963
|
|
|
824
|
-
// src/checkboxStyles.ts
|
|
964
|
+
// src/compounds/checkboxStyles.ts
|
|
825
965
|
var CONTROL_SIZE = "1.125rem";
|
|
826
966
|
function checkboxRootStyle() {
|
|
827
967
|
return {
|
|
968
|
+
position: "relative",
|
|
828
969
|
display: "flex",
|
|
829
970
|
flexDirection: "column",
|
|
830
971
|
gap: spacingVar("stack", "sm"),
|
|
@@ -857,8 +998,8 @@ function checkboxIndicatorStyle() {
|
|
|
857
998
|
};
|
|
858
999
|
}
|
|
859
1000
|
|
|
860
|
-
// src/Checkbox.tsx
|
|
861
|
-
var
|
|
1001
|
+
// src/compounds/Checkbox.tsx
|
|
1002
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
862
1003
|
function Checkbox({
|
|
863
1004
|
label,
|
|
864
1005
|
description,
|
|
@@ -872,7 +1013,7 @@ function Checkbox({
|
|
|
872
1013
|
}) {
|
|
873
1014
|
const ids = useFieldIds({ id, description, error });
|
|
874
1015
|
const isInvalid = invalid ?? Boolean(error);
|
|
875
|
-
return /* @__PURE__ */ (0,
|
|
1016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
876
1017
|
"div",
|
|
877
1018
|
{
|
|
878
1019
|
"data-mason-component": "checkbox",
|
|
@@ -881,14 +1022,14 @@ function Checkbox({
|
|
|
881
1022
|
className: mergeClassName(className),
|
|
882
1023
|
style: { ...checkboxRootStyle(), ...style },
|
|
883
1024
|
children: [
|
|
884
|
-
/* @__PURE__ */ (0,
|
|
1025
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
885
1026
|
"label",
|
|
886
1027
|
{
|
|
887
1028
|
"data-mason-slot": "label",
|
|
888
1029
|
htmlFor: ids.controlId,
|
|
889
1030
|
style: checkboxLabelStyle(disabled),
|
|
890
1031
|
children: [
|
|
891
|
-
/* @__PURE__ */ (0,
|
|
1032
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
892
1033
|
"input",
|
|
893
1034
|
{
|
|
894
1035
|
...rest,
|
|
@@ -901,12 +1042,12 @@ function Checkbox({
|
|
|
901
1042
|
style: visuallyHiddenControlStyle()
|
|
902
1043
|
}
|
|
903
1044
|
),
|
|
904
|
-
/* @__PURE__ */ (0,
|
|
905
|
-
label ? /* @__PURE__ */ (0,
|
|
1045
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-mason-slot": "indicator", "aria-hidden": "true", style: checkboxIndicatorStyle() }),
|
|
1046
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "data-mason-slot": "label-text", children: label }) : null
|
|
906
1047
|
]
|
|
907
1048
|
}
|
|
908
1049
|
),
|
|
909
|
-
description ? /* @__PURE__ */ (0,
|
|
1050
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
910
1051
|
"p",
|
|
911
1052
|
{
|
|
912
1053
|
"data-mason-slot": "description",
|
|
@@ -915,7 +1056,7 @@ function Checkbox({
|
|
|
915
1056
|
children: description
|
|
916
1057
|
}
|
|
917
1058
|
) : null,
|
|
918
|
-
error ? /* @__PURE__ */ (0,
|
|
1059
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
919
1060
|
"p",
|
|
920
1061
|
{
|
|
921
1062
|
"data-mason-slot": "error",
|
|
@@ -930,10 +1071,11 @@ function Checkbox({
|
|
|
930
1071
|
);
|
|
931
1072
|
}
|
|
932
1073
|
|
|
933
|
-
// src/radioStyles.ts
|
|
1074
|
+
// src/compounds/radioStyles.ts
|
|
934
1075
|
var CONTROL_SIZE2 = "1.125rem";
|
|
935
1076
|
function radioRootStyle() {
|
|
936
1077
|
return {
|
|
1078
|
+
position: "relative",
|
|
937
1079
|
display: "flex",
|
|
938
1080
|
flexDirection: "column",
|
|
939
1081
|
gap: spacingVar("stack", "sm"),
|
|
@@ -966,8 +1108,8 @@ function radioIndicatorStyle() {
|
|
|
966
1108
|
};
|
|
967
1109
|
}
|
|
968
1110
|
|
|
969
|
-
// src/Radio.tsx
|
|
970
|
-
var
|
|
1111
|
+
// src/compounds/Radio.tsx
|
|
1112
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
971
1113
|
function Radio({
|
|
972
1114
|
label,
|
|
973
1115
|
description,
|
|
@@ -981,7 +1123,7 @@ function Radio({
|
|
|
981
1123
|
}) {
|
|
982
1124
|
const ids = useFieldIds({ id, description, error });
|
|
983
1125
|
const isInvalid = invalid ?? Boolean(error);
|
|
984
|
-
return /* @__PURE__ */ (0,
|
|
1126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
985
1127
|
"div",
|
|
986
1128
|
{
|
|
987
1129
|
"data-mason-component": "radio",
|
|
@@ -990,14 +1132,14 @@ function Radio({
|
|
|
990
1132
|
className: mergeClassName(className),
|
|
991
1133
|
style: { ...radioRootStyle(), ...style },
|
|
992
1134
|
children: [
|
|
993
|
-
/* @__PURE__ */ (0,
|
|
1135
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
994
1136
|
"label",
|
|
995
1137
|
{
|
|
996
1138
|
"data-mason-slot": "label",
|
|
997
1139
|
htmlFor: ids.controlId,
|
|
998
1140
|
style: radioLabelStyle(disabled),
|
|
999
1141
|
children: [
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1142
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1001
1143
|
"input",
|
|
1002
1144
|
{
|
|
1003
1145
|
...rest,
|
|
@@ -1010,12 +1152,140 @@ function Radio({
|
|
|
1010
1152
|
style: visuallyHiddenControlStyle()
|
|
1011
1153
|
}
|
|
1012
1154
|
),
|
|
1013
|
-
/* @__PURE__ */ (0,
|
|
1014
|
-
label ? /* @__PURE__ */ (0,
|
|
1155
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "data-mason-slot": "indicator", "aria-hidden": "true", style: radioIndicatorStyle() }),
|
|
1156
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "data-mason-slot": "label-text", children: label }) : null
|
|
1157
|
+
]
|
|
1158
|
+
}
|
|
1159
|
+
),
|
|
1160
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1161
|
+
"p",
|
|
1162
|
+
{
|
|
1163
|
+
"data-mason-slot": "description",
|
|
1164
|
+
id: ids.descriptionId,
|
|
1165
|
+
style: fieldDescriptionStyle(),
|
|
1166
|
+
children: description
|
|
1167
|
+
}
|
|
1168
|
+
) : null,
|
|
1169
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1170
|
+
"p",
|
|
1171
|
+
{
|
|
1172
|
+
"data-mason-slot": "error",
|
|
1173
|
+
id: ids.errorId,
|
|
1174
|
+
role: "alert",
|
|
1175
|
+
style: fieldErrorStyle(),
|
|
1176
|
+
children: error
|
|
1177
|
+
}
|
|
1178
|
+
) : null
|
|
1179
|
+
]
|
|
1180
|
+
}
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
// src/compounds/toggleStyles.ts
|
|
1185
|
+
var TRACK = {
|
|
1186
|
+
sm: { width: "1.75rem", height: "1rem" },
|
|
1187
|
+
md: { width: "2.25rem", height: "1.25rem" },
|
|
1188
|
+
lg: { width: "2.75rem", height: "1.5rem" }
|
|
1189
|
+
};
|
|
1190
|
+
var THUMB = {
|
|
1191
|
+
sm: "0.75rem",
|
|
1192
|
+
md: "1rem",
|
|
1193
|
+
lg: "1.25rem"
|
|
1194
|
+
};
|
|
1195
|
+
function toggleRootStyle() {
|
|
1196
|
+
return {
|
|
1197
|
+
position: "relative",
|
|
1198
|
+
display: "flex",
|
|
1199
|
+
flexDirection: "column",
|
|
1200
|
+
gap: spacingVar("stack", "sm"),
|
|
1201
|
+
minWidth: 0
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1204
|
+
function toggleLabelStyle(disabled = false) {
|
|
1205
|
+
return {
|
|
1206
|
+
display: "inline-flex",
|
|
1207
|
+
alignItems: "center",
|
|
1208
|
+
gap: spacingVar("inline", "sm"),
|
|
1209
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
1210
|
+
color: disabled ? cssVar("color.text.disabled") : cssVar("color.text.primary"),
|
|
1211
|
+
...typographyStyle("label.md")
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
function toggleIndicatorStyle(size = "md") {
|
|
1215
|
+
return {
|
|
1216
|
+
position: "relative",
|
|
1217
|
+
display: "inline-flex",
|
|
1218
|
+
alignItems: "center",
|
|
1219
|
+
width: TRACK[size].width,
|
|
1220
|
+
height: TRACK[size].height,
|
|
1221
|
+
padding: "0.125rem",
|
|
1222
|
+
flexShrink: 0,
|
|
1223
|
+
boxSizing: "border-box",
|
|
1224
|
+
borderRadius: radiusVar("full")
|
|
1225
|
+
};
|
|
1226
|
+
}
|
|
1227
|
+
function toggleThumbStyle(size = "md") {
|
|
1228
|
+
return {
|
|
1229
|
+
width: THUMB[size],
|
|
1230
|
+
height: THUMB[size],
|
|
1231
|
+
borderRadius: radiusVar("full"),
|
|
1232
|
+
flexShrink: 0
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
// src/compounds/Toggle.tsx
|
|
1237
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1238
|
+
function Toggle({
|
|
1239
|
+
label,
|
|
1240
|
+
description,
|
|
1241
|
+
error,
|
|
1242
|
+
invalid,
|
|
1243
|
+
size = "md",
|
|
1244
|
+
id,
|
|
1245
|
+
disabled = false,
|
|
1246
|
+
className,
|
|
1247
|
+
style,
|
|
1248
|
+
...rest
|
|
1249
|
+
}) {
|
|
1250
|
+
const ids = useFieldIds({ id, description, error });
|
|
1251
|
+
const isInvalid = invalid ?? Boolean(error);
|
|
1252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1253
|
+
"div",
|
|
1254
|
+
{
|
|
1255
|
+
"data-mason-component": "toggle",
|
|
1256
|
+
"data-size": size,
|
|
1257
|
+
"data-invalid": isInvalid || void 0,
|
|
1258
|
+
"data-disabled": disabled || void 0,
|
|
1259
|
+
className: mergeClassName(className),
|
|
1260
|
+
style: { ...toggleRootStyle(), ...style },
|
|
1261
|
+
children: [
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1263
|
+
"label",
|
|
1264
|
+
{
|
|
1265
|
+
"data-mason-slot": "label",
|
|
1266
|
+
htmlFor: ids.controlId,
|
|
1267
|
+
style: toggleLabelStyle(disabled),
|
|
1268
|
+
children: [
|
|
1269
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { "data-mason-slot": "label-text", children: label }) : null,
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1271
|
+
"input",
|
|
1272
|
+
{
|
|
1273
|
+
...rest,
|
|
1274
|
+
type: "checkbox",
|
|
1275
|
+
role: "switch",
|
|
1276
|
+
id: ids.controlId,
|
|
1277
|
+
"data-mason-slot": "control",
|
|
1278
|
+
disabled,
|
|
1279
|
+
"aria-invalid": isInvalid || void 0,
|
|
1280
|
+
"aria-describedby": ids.describedBy,
|
|
1281
|
+
style: visuallyHiddenControlStyle()
|
|
1282
|
+
}
|
|
1283
|
+
),
|
|
1284
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { "data-mason-slot": "indicator", "aria-hidden": "true", style: toggleIndicatorStyle(size), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { "data-mason-slot": "thumb", style: toggleThumbStyle(size) }) })
|
|
1015
1285
|
]
|
|
1016
1286
|
}
|
|
1017
1287
|
),
|
|
1018
|
-
description ? /* @__PURE__ */ (0,
|
|
1288
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1019
1289
|
"p",
|
|
1020
1290
|
{
|
|
1021
1291
|
"data-mason-slot": "description",
|
|
@@ -1024,7 +1294,7 @@ function Radio({
|
|
|
1024
1294
|
children: description
|
|
1025
1295
|
}
|
|
1026
1296
|
) : null,
|
|
1027
|
-
error ? /* @__PURE__ */ (0,
|
|
1297
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1028
1298
|
"p",
|
|
1029
1299
|
{
|
|
1030
1300
|
"data-mason-slot": "error",
|
|
@@ -1041,11 +1311,14 @@ function Radio({
|
|
|
1041
1311
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1042
1312
|
0 && (module.exports = {
|
|
1043
1313
|
Badge,
|
|
1314
|
+
Box,
|
|
1044
1315
|
Button,
|
|
1045
1316
|
Callout,
|
|
1046
1317
|
Card,
|
|
1047
1318
|
Checkbox,
|
|
1319
|
+
Container,
|
|
1048
1320
|
Divider,
|
|
1321
|
+
Grid,
|
|
1049
1322
|
Link,
|
|
1050
1323
|
MasonProvider,
|
|
1051
1324
|
Radio,
|
|
@@ -1053,6 +1326,7 @@ function Radio({
|
|
|
1053
1326
|
Spinner,
|
|
1054
1327
|
Stack,
|
|
1055
1328
|
Text,
|
|
1056
|
-
TextField
|
|
1329
|
+
TextField,
|
|
1330
|
+
Toggle
|
|
1057
1331
|
});
|
|
1058
1332
|
//# sourceMappingURL=index.cjs.map
|