@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.cjs +733 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +366 -4
- package/dist/index.d.ts +366 -4
- package/dist/index.js +726 -121
- package/dist/index.js.map +1 -1
- package/llms.txt +119 -0
- package/package.json +5 -4
package/dist/index.cjs
CHANGED
|
@@ -21,18 +21,23 @@ 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,
|
|
34
|
+
Radio: () => Radio,
|
|
31
35
|
Select: () => Select,
|
|
32
36
|
Spinner: () => Spinner,
|
|
33
37
|
Stack: () => Stack,
|
|
34
38
|
Text: () => Text,
|
|
35
|
-
TextField: () => TextField
|
|
39
|
+
TextField: () => TextField,
|
|
40
|
+
Toggle: () => Toggle
|
|
36
41
|
});
|
|
37
42
|
module.exports = __toCommonJS(index_exports);
|
|
38
43
|
|
|
@@ -58,7 +63,7 @@ var MasonProvider = (0, import_vue.defineComponent)({
|
|
|
58
63
|
}
|
|
59
64
|
});
|
|
60
65
|
|
|
61
|
-
// src/Text.ts
|
|
66
|
+
// src/primitives/Text.ts
|
|
62
67
|
var import_vue2 = require("vue");
|
|
63
68
|
|
|
64
69
|
// src/styles.ts
|
|
@@ -69,6 +74,9 @@ function cssVar(path) {
|
|
|
69
74
|
function spacingVar(axis, level) {
|
|
70
75
|
return cssVar(`spacing.${axis}.${level}`);
|
|
71
76
|
}
|
|
77
|
+
function containerMaxWidthVar(level) {
|
|
78
|
+
return cssVar(`spacing.layout.container.${level}`);
|
|
79
|
+
}
|
|
72
80
|
function radiusVar(level) {
|
|
73
81
|
return cssVar(`radius.${level}`);
|
|
74
82
|
}
|
|
@@ -92,7 +100,7 @@ function mergeClassName(...parts) {
|
|
|
92
100
|
return merged.length > 0 ? merged : void 0;
|
|
93
101
|
}
|
|
94
102
|
|
|
95
|
-
// src/textStyles.ts
|
|
103
|
+
// src/primitives/textStyles.ts
|
|
96
104
|
function textStyle({
|
|
97
105
|
variant = "body.md",
|
|
98
106
|
tone = "primary",
|
|
@@ -108,7 +116,7 @@ function textStyle({
|
|
|
108
116
|
};
|
|
109
117
|
}
|
|
110
118
|
|
|
111
|
-
// src/Text.ts
|
|
119
|
+
// src/primitives/Text.ts
|
|
112
120
|
var Text = (0, import_vue2.defineComponent)({
|
|
113
121
|
name: "MasonText",
|
|
114
122
|
inheritAttrs: false,
|
|
@@ -160,10 +168,10 @@ var Text = (0, import_vue2.defineComponent)({
|
|
|
160
168
|
}
|
|
161
169
|
});
|
|
162
170
|
|
|
163
|
-
// src/Stack.ts
|
|
171
|
+
// src/primitives/Stack.ts
|
|
164
172
|
var import_vue3 = require("vue");
|
|
165
173
|
|
|
166
|
-
// src/stackStyles.ts
|
|
174
|
+
// src/primitives/stackStyles.ts
|
|
167
175
|
var FLEX_ALIGN = {
|
|
168
176
|
start: "flex-start",
|
|
169
177
|
center: "center",
|
|
@@ -196,7 +204,7 @@ function stackStyle({
|
|
|
196
204
|
};
|
|
197
205
|
}
|
|
198
206
|
|
|
199
|
-
// src/Stack.ts
|
|
207
|
+
// src/primitives/Stack.ts
|
|
200
208
|
var Stack = (0, import_vue3.defineComponent)({
|
|
201
209
|
name: "MasonStack",
|
|
202
210
|
inheritAttrs: false,
|
|
@@ -254,11 +262,237 @@ var Stack = (0, import_vue3.defineComponent)({
|
|
|
254
262
|
}
|
|
255
263
|
});
|
|
256
264
|
|
|
257
|
-
// src/
|
|
265
|
+
// src/primitives/Box.ts
|
|
258
266
|
var import_vue4 = require("vue");
|
|
259
267
|
|
|
260
|
-
// src/
|
|
268
|
+
// src/primitives/boxStyles.ts
|
|
261
269
|
var TONE_BG = {
|
|
270
|
+
canvas: "color.bg.canvas",
|
|
271
|
+
surface: "color.bg.surface",
|
|
272
|
+
elevated: "color.bg.elevated"
|
|
273
|
+
};
|
|
274
|
+
function boxStyle({
|
|
275
|
+
padding,
|
|
276
|
+
tone = "transparent",
|
|
277
|
+
radius,
|
|
278
|
+
bordered = false
|
|
279
|
+
}) {
|
|
280
|
+
return {
|
|
281
|
+
display: "block",
|
|
282
|
+
boxSizing: "border-box",
|
|
283
|
+
minWidth: 0,
|
|
284
|
+
...padding ? { padding: spacingVar("inset", padding) } : null,
|
|
285
|
+
...tone !== "transparent" ? { backgroundColor: cssVar(TONE_BG[tone]) } : null,
|
|
286
|
+
...radius ? { borderRadius: radiusVar(radius) } : null,
|
|
287
|
+
...bordered ? { border: `1px solid ${cssVar("color.border.subtle")}` } : null
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// src/primitives/Box.ts
|
|
292
|
+
var Box = (0, import_vue4.defineComponent)({
|
|
293
|
+
name: "MasonBox",
|
|
294
|
+
inheritAttrs: false,
|
|
295
|
+
props: {
|
|
296
|
+
as: {
|
|
297
|
+
type: String,
|
|
298
|
+
default: "div"
|
|
299
|
+
},
|
|
300
|
+
padding: {
|
|
301
|
+
type: String,
|
|
302
|
+
default: void 0
|
|
303
|
+
},
|
|
304
|
+
tone: {
|
|
305
|
+
type: String,
|
|
306
|
+
default: "transparent"
|
|
307
|
+
},
|
|
308
|
+
radius: {
|
|
309
|
+
type: String,
|
|
310
|
+
default: void 0
|
|
311
|
+
},
|
|
312
|
+
bordered: {
|
|
313
|
+
type: Boolean,
|
|
314
|
+
default: false
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
setup(props, { slots, attrs }) {
|
|
318
|
+
return () => {
|
|
319
|
+
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
320
|
+
return (0, import_vue4.h)(
|
|
321
|
+
props.as,
|
|
322
|
+
{
|
|
323
|
+
...rest,
|
|
324
|
+
"data-mason-component": "box",
|
|
325
|
+
"data-tone": props.tone,
|
|
326
|
+
class: mergeClassName(attrClass),
|
|
327
|
+
style: [
|
|
328
|
+
boxStyle({
|
|
329
|
+
padding: props.padding,
|
|
330
|
+
tone: props.tone,
|
|
331
|
+
radius: props.radius,
|
|
332
|
+
bordered: props.bordered
|
|
333
|
+
}),
|
|
334
|
+
attrStyle
|
|
335
|
+
]
|
|
336
|
+
},
|
|
337
|
+
slots.default?.()
|
|
338
|
+
);
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// src/primitives/Grid.ts
|
|
344
|
+
var import_vue5 = require("vue");
|
|
345
|
+
|
|
346
|
+
// src/primitives/gridStyles.ts
|
|
347
|
+
var GRID_ALIGN = {
|
|
348
|
+
start: "start",
|
|
349
|
+
center: "center",
|
|
350
|
+
end: "end",
|
|
351
|
+
stretch: "stretch",
|
|
352
|
+
baseline: "baseline"
|
|
353
|
+
};
|
|
354
|
+
var GRID_JUSTIFY = {
|
|
355
|
+
start: "start",
|
|
356
|
+
center: "center",
|
|
357
|
+
end: "end",
|
|
358
|
+
between: "space-between"
|
|
359
|
+
};
|
|
360
|
+
function gridStyle({
|
|
361
|
+
columns = 2,
|
|
362
|
+
gap = "md",
|
|
363
|
+
align,
|
|
364
|
+
justify
|
|
365
|
+
}) {
|
|
366
|
+
return {
|
|
367
|
+
display: "grid",
|
|
368
|
+
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
|
|
369
|
+
gap: spacingVar("stack", gap),
|
|
370
|
+
minWidth: 0,
|
|
371
|
+
...align ? { alignItems: GRID_ALIGN[align] } : null,
|
|
372
|
+
...justify ? { justifyContent: GRID_JUSTIFY[justify] } : null
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// src/primitives/Grid.ts
|
|
377
|
+
var Grid = (0, import_vue5.defineComponent)({
|
|
378
|
+
name: "MasonGrid",
|
|
379
|
+
inheritAttrs: false,
|
|
380
|
+
props: {
|
|
381
|
+
columns: {
|
|
382
|
+
type: Number,
|
|
383
|
+
default: 2
|
|
384
|
+
},
|
|
385
|
+
gap: {
|
|
386
|
+
type: String,
|
|
387
|
+
default: "md"
|
|
388
|
+
},
|
|
389
|
+
align: {
|
|
390
|
+
type: String,
|
|
391
|
+
default: void 0
|
|
392
|
+
},
|
|
393
|
+
justify: {
|
|
394
|
+
type: String,
|
|
395
|
+
default: void 0
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
setup(props, { slots, attrs }) {
|
|
399
|
+
return () => {
|
|
400
|
+
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
401
|
+
return (0, import_vue5.h)(
|
|
402
|
+
"div",
|
|
403
|
+
{
|
|
404
|
+
...rest,
|
|
405
|
+
"data-mason-component": "grid",
|
|
406
|
+
"data-columns": props.columns,
|
|
407
|
+
class: mergeClassName(attrClass),
|
|
408
|
+
style: [
|
|
409
|
+
gridStyle({
|
|
410
|
+
columns: props.columns,
|
|
411
|
+
gap: props.gap,
|
|
412
|
+
align: props.align,
|
|
413
|
+
justify: props.justify
|
|
414
|
+
}),
|
|
415
|
+
attrStyle
|
|
416
|
+
]
|
|
417
|
+
},
|
|
418
|
+
slots.default?.()
|
|
419
|
+
);
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
// src/primitives/Container.ts
|
|
425
|
+
var import_vue6 = require("vue");
|
|
426
|
+
|
|
427
|
+
// src/primitives/containerStyles.ts
|
|
428
|
+
function containerStyle({
|
|
429
|
+
maxWidth = "lg",
|
|
430
|
+
padding,
|
|
431
|
+
center = true
|
|
432
|
+
}) {
|
|
433
|
+
return {
|
|
434
|
+
display: "block",
|
|
435
|
+
boxSizing: "border-box",
|
|
436
|
+
width: "100%",
|
|
437
|
+
minWidth: 0,
|
|
438
|
+
maxWidth: containerMaxWidthVar(maxWidth),
|
|
439
|
+
...center ? { marginInline: "auto" } : null,
|
|
440
|
+
...padding ? { paddingInline: spacingVar("inline", padding) } : null
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// src/primitives/Container.ts
|
|
445
|
+
var Container = (0, import_vue6.defineComponent)({
|
|
446
|
+
name: "MasonContainer",
|
|
447
|
+
inheritAttrs: false,
|
|
448
|
+
props: {
|
|
449
|
+
as: {
|
|
450
|
+
type: String,
|
|
451
|
+
default: "div"
|
|
452
|
+
},
|
|
453
|
+
maxWidth: {
|
|
454
|
+
type: String,
|
|
455
|
+
default: "lg"
|
|
456
|
+
},
|
|
457
|
+
padding: {
|
|
458
|
+
type: String,
|
|
459
|
+
default: void 0
|
|
460
|
+
},
|
|
461
|
+
center: {
|
|
462
|
+
type: Boolean,
|
|
463
|
+
default: true
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
setup(props, { slots, attrs }) {
|
|
467
|
+
return () => {
|
|
468
|
+
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
469
|
+
return (0, import_vue6.h)(
|
|
470
|
+
props.as,
|
|
471
|
+
{
|
|
472
|
+
...rest,
|
|
473
|
+
"data-mason-component": "container",
|
|
474
|
+
"data-max-width": props.maxWidth,
|
|
475
|
+
class: mergeClassName(attrClass),
|
|
476
|
+
style: [
|
|
477
|
+
containerStyle({
|
|
478
|
+
maxWidth: props.maxWidth,
|
|
479
|
+
padding: props.padding,
|
|
480
|
+
center: props.center
|
|
481
|
+
}),
|
|
482
|
+
attrStyle
|
|
483
|
+
]
|
|
484
|
+
},
|
|
485
|
+
slots.default?.()
|
|
486
|
+
);
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
// src/primitives/Card.ts
|
|
492
|
+
var import_vue7 = require("vue");
|
|
493
|
+
|
|
494
|
+
// src/primitives/cardStyles.ts
|
|
495
|
+
var TONE_BG2 = {
|
|
262
496
|
surface: "color.bg.surface",
|
|
263
497
|
canvas: "color.bg.canvas",
|
|
264
498
|
elevated: "color.bg.elevated"
|
|
@@ -273,7 +507,7 @@ function cardStyle({
|
|
|
273
507
|
return {
|
|
274
508
|
display: "block",
|
|
275
509
|
padding: spacingVar("inset", padding),
|
|
276
|
-
backgroundColor: cssVar(
|
|
510
|
+
backgroundColor: cssVar(TONE_BG2[tone]),
|
|
277
511
|
color: cssVar("color.text.primary"),
|
|
278
512
|
border: bordered ? `1px solid ${cssVar("color.border.subtle")}` : "none",
|
|
279
513
|
borderRadius: radiusVar(radius),
|
|
@@ -283,8 +517,8 @@ function cardStyle({
|
|
|
283
517
|
};
|
|
284
518
|
}
|
|
285
519
|
|
|
286
|
-
// src/Card.ts
|
|
287
|
-
var Card = (0,
|
|
520
|
+
// src/primitives/Card.ts
|
|
521
|
+
var Card = (0, import_vue7.defineComponent)({
|
|
288
522
|
name: "MasonCard",
|
|
289
523
|
inheritAttrs: false,
|
|
290
524
|
props: {
|
|
@@ -312,7 +546,7 @@ var Card = (0, import_vue4.defineComponent)({
|
|
|
312
546
|
setup(props, { slots, attrs }) {
|
|
313
547
|
return () => {
|
|
314
548
|
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
315
|
-
return (0,
|
|
549
|
+
return (0, import_vue7.h)(
|
|
316
550
|
"div",
|
|
317
551
|
{
|
|
318
552
|
...rest,
|
|
@@ -336,10 +570,10 @@ var Card = (0, import_vue4.defineComponent)({
|
|
|
336
570
|
}
|
|
337
571
|
});
|
|
338
572
|
|
|
339
|
-
// src/Divider.ts
|
|
340
|
-
var
|
|
573
|
+
// src/primitives/Divider.ts
|
|
574
|
+
var import_vue8 = require("vue");
|
|
341
575
|
|
|
342
|
-
// src/dividerStyles.ts
|
|
576
|
+
// src/primitives/dividerStyles.ts
|
|
343
577
|
function dividerStyle(orientation = "horizontal") {
|
|
344
578
|
const line = `1px solid ${cssVar("color.border.subtle")}`;
|
|
345
579
|
if (orientation === "vertical") {
|
|
@@ -361,8 +595,8 @@ function dividerStyle(orientation = "horizontal") {
|
|
|
361
595
|
};
|
|
362
596
|
}
|
|
363
597
|
|
|
364
|
-
// src/Divider.ts
|
|
365
|
-
var Divider = (0,
|
|
598
|
+
// src/primitives/Divider.ts
|
|
599
|
+
var Divider = (0, import_vue8.defineComponent)({
|
|
366
600
|
name: "MasonDivider",
|
|
367
601
|
inheritAttrs: false,
|
|
368
602
|
props: {
|
|
@@ -374,7 +608,7 @@ var Divider = (0, import_vue5.defineComponent)({
|
|
|
374
608
|
setup(props, { attrs }) {
|
|
375
609
|
return () => {
|
|
376
610
|
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
377
|
-
return (0,
|
|
611
|
+
return (0, import_vue8.h)("hr", {
|
|
378
612
|
...rest,
|
|
379
613
|
"data-mason-component": "divider",
|
|
380
614
|
"data-orientation": props.orientation,
|
|
@@ -386,10 +620,10 @@ var Divider = (0, import_vue5.defineComponent)({
|
|
|
386
620
|
}
|
|
387
621
|
});
|
|
388
622
|
|
|
389
|
-
// src/Link.ts
|
|
390
|
-
var
|
|
623
|
+
// src/primitives/Link.ts
|
|
624
|
+
var import_vue9 = require("vue");
|
|
391
625
|
|
|
392
|
-
// src/linkStyles.ts
|
|
626
|
+
// src/primitives/linkStyles.ts
|
|
393
627
|
function linkStyle({
|
|
394
628
|
tone = "link",
|
|
395
629
|
underline = "hover"
|
|
@@ -403,8 +637,8 @@ function linkStyle({
|
|
|
403
637
|
};
|
|
404
638
|
}
|
|
405
639
|
|
|
406
|
-
// src/Link.ts
|
|
407
|
-
var Link = (0,
|
|
640
|
+
// src/primitives/Link.ts
|
|
641
|
+
var Link = (0, import_vue9.defineComponent)({
|
|
408
642
|
name: "MasonLink",
|
|
409
643
|
inheritAttrs: false,
|
|
410
644
|
props: {
|
|
@@ -426,7 +660,7 @@ var Link = (0, import_vue6.defineComponent)({
|
|
|
426
660
|
return () => {
|
|
427
661
|
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
428
662
|
const externalAttrs = props.external ? { target: "_blank", rel: "noreferrer noopener" } : null;
|
|
429
|
-
return (0,
|
|
663
|
+
return (0, import_vue9.h)(
|
|
430
664
|
"a",
|
|
431
665
|
{
|
|
432
666
|
"data-mason-component": "link",
|
|
@@ -446,13 +680,13 @@ var Link = (0, import_vue6.defineComponent)({
|
|
|
446
680
|
}
|
|
447
681
|
});
|
|
448
682
|
|
|
449
|
-
// src/Button.ts
|
|
450
|
-
var
|
|
683
|
+
// src/primitives/Button.ts
|
|
684
|
+
var import_vue11 = require("vue");
|
|
451
685
|
|
|
452
|
-
// src/Spinner.ts
|
|
453
|
-
var
|
|
686
|
+
// src/primitives/Spinner.ts
|
|
687
|
+
var import_vue10 = require("vue");
|
|
454
688
|
|
|
455
|
-
// src/spinnerStyles.ts
|
|
689
|
+
// src/primitives/spinnerStyles.ts
|
|
456
690
|
var SIZE_DIMENSION = {
|
|
457
691
|
sm: cssVar("font.body.sm.size"),
|
|
458
692
|
md: cssVar("font.body.md.size"),
|
|
@@ -472,8 +706,8 @@ function spinnerStyle(size = "md") {
|
|
|
472
706
|
};
|
|
473
707
|
}
|
|
474
708
|
|
|
475
|
-
// src/Spinner.ts
|
|
476
|
-
var Spinner = (0,
|
|
709
|
+
// src/primitives/Spinner.ts
|
|
710
|
+
var Spinner = (0, import_vue10.defineComponent)({
|
|
477
711
|
name: "MasonSpinner",
|
|
478
712
|
inheritAttrs: false,
|
|
479
713
|
props: {
|
|
@@ -490,7 +724,7 @@ var Spinner = (0, import_vue7.defineComponent)({
|
|
|
490
724
|
setup(props, { attrs }) {
|
|
491
725
|
return () => {
|
|
492
726
|
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
493
|
-
return (0,
|
|
727
|
+
return (0, import_vue10.h)("span", {
|
|
494
728
|
...rest,
|
|
495
729
|
"data-mason-component": "spinner",
|
|
496
730
|
"data-size": props.size,
|
|
@@ -504,14 +738,7 @@ var Spinner = (0, import_vue7.defineComponent)({
|
|
|
504
738
|
}
|
|
505
739
|
});
|
|
506
740
|
|
|
507
|
-
// src/buttonStyles.ts
|
|
508
|
-
function actionColors(variant) {
|
|
509
|
-
return {
|
|
510
|
-
bg: `color.action.${variant}.bg`,
|
|
511
|
-
text: `color.action.${variant}.text`,
|
|
512
|
-
border: `color.action.${variant}.border`
|
|
513
|
-
};
|
|
514
|
-
}
|
|
741
|
+
// src/primitives/buttonStyles.ts
|
|
515
742
|
var sizeStyles = {
|
|
516
743
|
sm: {
|
|
517
744
|
paddingBlock: cssVar("spacing.inset.sm"),
|
|
@@ -535,14 +762,7 @@ var sizeStyles = {
|
|
|
535
762
|
font: "label.lg"
|
|
536
763
|
}
|
|
537
764
|
};
|
|
538
|
-
function buttonStyle({
|
|
539
|
-
variant = "primary",
|
|
540
|
-
size = "md",
|
|
541
|
-
disabled = false,
|
|
542
|
-
loading = false
|
|
543
|
-
}) {
|
|
544
|
-
const inactive = disabled || loading;
|
|
545
|
-
const colors = actionColors(inactive ? "disabled" : variant);
|
|
765
|
+
function buttonStyle({ size = "md" }) {
|
|
546
766
|
const sizing = sizeStyles[size];
|
|
547
767
|
return {
|
|
548
768
|
display: "inline-flex",
|
|
@@ -552,9 +772,6 @@ function buttonStyle({
|
|
|
552
772
|
paddingBlock: sizing.paddingBlock,
|
|
553
773
|
paddingInline: sizing.paddingInline,
|
|
554
774
|
margin: "0",
|
|
555
|
-
backgroundColor: cssVar(colors.bg),
|
|
556
|
-
color: cssVar(colors.text),
|
|
557
|
-
border: `1px solid ${cssVar(colors.border)}`,
|
|
558
775
|
borderRadius: sizing.radius,
|
|
559
776
|
boxSizing: "border-box",
|
|
560
777
|
...typographyStyle(sizing.font),
|
|
@@ -563,8 +780,8 @@ function buttonStyle({
|
|
|
563
780
|
};
|
|
564
781
|
}
|
|
565
782
|
|
|
566
|
-
// src/Button.ts
|
|
567
|
-
var Button = (0,
|
|
783
|
+
// src/primitives/Button.ts
|
|
784
|
+
var Button = (0, import_vue11.defineComponent)({
|
|
568
785
|
name: "MasonButton",
|
|
569
786
|
inheritAttrs: false,
|
|
570
787
|
props: {
|
|
@@ -590,23 +807,23 @@ var Button = (0, import_vue8.defineComponent)({
|
|
|
590
807
|
}
|
|
591
808
|
},
|
|
592
809
|
setup(props, { slots, attrs }) {
|
|
593
|
-
const isDisabled = (0,
|
|
810
|
+
const isDisabled = (0, import_vue11.computed)(() => props.disabled || props.loading);
|
|
594
811
|
return () => {
|
|
595
812
|
const children = [];
|
|
596
813
|
if (props.loading) {
|
|
597
|
-
children.push((0,
|
|
814
|
+
children.push((0, import_vue11.h)(Spinner, { size: "inherit", "data-mason-slot": "spinner" }));
|
|
598
815
|
} else if (slots.leading) {
|
|
599
|
-
children.push((0,
|
|
816
|
+
children.push((0, import_vue11.h)("span", { "data-mason-slot": "leading" }, slots.leading()));
|
|
600
817
|
}
|
|
601
818
|
if (slots.default) {
|
|
602
|
-
children.push((0,
|
|
819
|
+
children.push((0, import_vue11.h)("span", { "data-mason-slot": "label" }, slots.default()));
|
|
603
820
|
}
|
|
604
821
|
if (slots.trailing && !props.loading) {
|
|
605
|
-
children.push((0,
|
|
822
|
+
children.push((0, import_vue11.h)("span", { "data-mason-slot": "trailing" }, slots.trailing()));
|
|
606
823
|
}
|
|
607
824
|
const attrClass = attrs.class;
|
|
608
825
|
const attrStyle = attrs.style;
|
|
609
|
-
return (0,
|
|
826
|
+
return (0, import_vue11.h)(
|
|
610
827
|
"button",
|
|
611
828
|
{
|
|
612
829
|
...attrs,
|
|
@@ -617,15 +834,7 @@ var Button = (0, import_vue8.defineComponent)({
|
|
|
617
834
|
disabled: isDisabled.value,
|
|
618
835
|
"aria-busy": props.loading || void 0,
|
|
619
836
|
class: mergeClassName(attrClass),
|
|
620
|
-
style: [
|
|
621
|
-
buttonStyle({
|
|
622
|
-
variant: props.variant,
|
|
623
|
-
size: props.size,
|
|
624
|
-
disabled: props.disabled,
|
|
625
|
-
loading: props.loading
|
|
626
|
-
}),
|
|
627
|
-
attrStyle
|
|
628
|
-
]
|
|
837
|
+
style: [buttonStyle({ size: props.size }), attrStyle]
|
|
629
838
|
},
|
|
630
839
|
children
|
|
631
840
|
);
|
|
@@ -633,10 +842,10 @@ var Button = (0, import_vue8.defineComponent)({
|
|
|
633
842
|
}
|
|
634
843
|
});
|
|
635
844
|
|
|
636
|
-
// src/Badge.ts
|
|
637
|
-
var
|
|
845
|
+
// src/primitives/Badge.ts
|
|
846
|
+
var import_vue12 = require("vue");
|
|
638
847
|
|
|
639
|
-
// src/badgeStyles.ts
|
|
848
|
+
// src/primitives/badgeStyles.ts
|
|
640
849
|
function badgeStyle({
|
|
641
850
|
tone = "neutral",
|
|
642
851
|
size = "sm"
|
|
@@ -665,8 +874,8 @@ function badgeStyle({
|
|
|
665
874
|
};
|
|
666
875
|
}
|
|
667
876
|
|
|
668
|
-
// src/Badge.ts
|
|
669
|
-
var Badge = (0,
|
|
877
|
+
// src/primitives/Badge.ts
|
|
878
|
+
var Badge = (0, import_vue12.defineComponent)({
|
|
670
879
|
name: "MasonBadge",
|
|
671
880
|
inheritAttrs: false,
|
|
672
881
|
props: {
|
|
@@ -682,7 +891,7 @@ var Badge = (0, import_vue9.defineComponent)({
|
|
|
682
891
|
setup(props, { slots, attrs }) {
|
|
683
892
|
return () => {
|
|
684
893
|
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
685
|
-
return (0,
|
|
894
|
+
return (0, import_vue12.h)(
|
|
686
895
|
"span",
|
|
687
896
|
{
|
|
688
897
|
...rest,
|
|
@@ -701,10 +910,10 @@ var Badge = (0, import_vue9.defineComponent)({
|
|
|
701
910
|
}
|
|
702
911
|
});
|
|
703
912
|
|
|
704
|
-
// src/Callout.ts
|
|
705
|
-
var
|
|
913
|
+
// src/primitives/Callout.ts
|
|
914
|
+
var import_vue13 = require("vue");
|
|
706
915
|
|
|
707
|
-
// src/calloutStyles.ts
|
|
916
|
+
// src/primitives/calloutStyles.ts
|
|
708
917
|
function calloutStyle(tone = "info") {
|
|
709
918
|
return {
|
|
710
919
|
display: "flex",
|
|
@@ -733,8 +942,8 @@ function calloutBodyStyle() {
|
|
|
733
942
|
return { margin: "0", ...typographyStyle("body.sm") };
|
|
734
943
|
}
|
|
735
944
|
|
|
736
|
-
// src/Callout.ts
|
|
737
|
-
var Callout = (0,
|
|
945
|
+
// src/primitives/Callout.ts
|
|
946
|
+
var Callout = (0, import_vue13.defineComponent)({
|
|
738
947
|
name: "MasonCallout",
|
|
739
948
|
inheritAttrs: false,
|
|
740
949
|
props: {
|
|
@@ -756,18 +965,18 @@ var Callout = (0, import_vue10.defineComponent)({
|
|
|
756
965
|
const content = [];
|
|
757
966
|
if (title) {
|
|
758
967
|
content.push(
|
|
759
|
-
(0,
|
|
968
|
+
(0, import_vue13.h)("p", { "data-mason-slot": "title", style: calloutTitleStyle() }, title)
|
|
760
969
|
);
|
|
761
970
|
}
|
|
762
971
|
if (body) {
|
|
763
972
|
content.push(
|
|
764
|
-
(0,
|
|
973
|
+
(0, import_vue13.h)("div", { "data-mason-slot": "body", style: calloutBodyStyle() }, body)
|
|
765
974
|
);
|
|
766
975
|
}
|
|
767
976
|
const children = [];
|
|
768
977
|
if (slots.icon) {
|
|
769
978
|
children.push(
|
|
770
|
-
(0,
|
|
979
|
+
(0, import_vue13.h)(
|
|
771
980
|
"span",
|
|
772
981
|
{ "data-mason-slot": "icon", "aria-hidden": "true" },
|
|
773
982
|
slots.icon()
|
|
@@ -775,13 +984,13 @@ var Callout = (0, import_vue10.defineComponent)({
|
|
|
775
984
|
);
|
|
776
985
|
}
|
|
777
986
|
children.push(
|
|
778
|
-
(0,
|
|
987
|
+
(0, import_vue13.h)(
|
|
779
988
|
"div",
|
|
780
989
|
{ "data-mason-slot": "content", style: calloutContentStyle() },
|
|
781
990
|
content
|
|
782
991
|
)
|
|
783
992
|
);
|
|
784
|
-
return (0,
|
|
993
|
+
return (0, import_vue13.h)(
|
|
785
994
|
"div",
|
|
786
995
|
{
|
|
787
996
|
...rest,
|
|
@@ -796,13 +1005,13 @@ var Callout = (0, import_vue10.defineComponent)({
|
|
|
796
1005
|
}
|
|
797
1006
|
});
|
|
798
1007
|
|
|
799
|
-
// src/TextField.ts
|
|
800
|
-
var
|
|
1008
|
+
// src/compounds/TextField.ts
|
|
1009
|
+
var import_vue15 = require("vue");
|
|
801
1010
|
|
|
802
|
-
// src/field.ts
|
|
803
|
-
var
|
|
1011
|
+
// src/compounds/field.ts
|
|
1012
|
+
var import_vue14 = require("vue");
|
|
804
1013
|
|
|
805
|
-
// src/fieldStyles.ts
|
|
1014
|
+
// src/compounds/fieldStyles.ts
|
|
806
1015
|
var CONTROL_FONT = {
|
|
807
1016
|
sm: "body.sm",
|
|
808
1017
|
md: "body.md",
|
|
@@ -863,8 +1072,25 @@ function fieldErrorStyle() {
|
|
|
863
1072
|
...typographyStyle("body.sm")
|
|
864
1073
|
};
|
|
865
1074
|
}
|
|
1075
|
+
function visuallyHiddenControlStyle() {
|
|
1076
|
+
return {
|
|
1077
|
+
position: "absolute",
|
|
1078
|
+
left: "0",
|
|
1079
|
+
top: "0",
|
|
1080
|
+
width: "1px",
|
|
1081
|
+
height: "1px",
|
|
1082
|
+
padding: "0",
|
|
1083
|
+
margin: "0",
|
|
1084
|
+
overflow: "hidden",
|
|
1085
|
+
clip: "rect(0, 0, 0, 0)",
|
|
1086
|
+
whiteSpace: "nowrap",
|
|
1087
|
+
borderWidth: "0",
|
|
1088
|
+
borderStyle: "solid",
|
|
1089
|
+
borderColor: "transparent"
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
866
1092
|
|
|
867
|
-
// src/field.ts
|
|
1093
|
+
// src/compounds/field.ts
|
|
868
1094
|
var fieldSeq = 0;
|
|
869
1095
|
function nextFieldId() {
|
|
870
1096
|
fieldSeq += 1;
|
|
@@ -896,7 +1122,7 @@ function renderFieldFrame({
|
|
|
896
1122
|
const children = [];
|
|
897
1123
|
if (label) {
|
|
898
1124
|
children.push(
|
|
899
|
-
(0,
|
|
1125
|
+
(0, import_vue14.h)(
|
|
900
1126
|
"label",
|
|
901
1127
|
{
|
|
902
1128
|
"data-mason-slot": "label",
|
|
@@ -910,7 +1136,7 @@ function renderFieldFrame({
|
|
|
910
1136
|
children.push(control);
|
|
911
1137
|
if (description) {
|
|
912
1138
|
children.push(
|
|
913
|
-
(0,
|
|
1139
|
+
(0, import_vue14.h)(
|
|
914
1140
|
"p",
|
|
915
1141
|
{
|
|
916
1142
|
"data-mason-slot": "description",
|
|
@@ -923,7 +1149,7 @@ function renderFieldFrame({
|
|
|
923
1149
|
}
|
|
924
1150
|
if (error) {
|
|
925
1151
|
children.push(
|
|
926
|
-
(0,
|
|
1152
|
+
(0, import_vue14.h)(
|
|
927
1153
|
"p",
|
|
928
1154
|
{
|
|
929
1155
|
"data-mason-slot": "error",
|
|
@@ -935,7 +1161,7 @@ function renderFieldFrame({
|
|
|
935
1161
|
)
|
|
936
1162
|
);
|
|
937
1163
|
}
|
|
938
|
-
return (0,
|
|
1164
|
+
return (0, import_vue14.h)(
|
|
939
1165
|
"div",
|
|
940
1166
|
{
|
|
941
1167
|
"data-mason-component": component,
|
|
@@ -949,8 +1175,8 @@ function renderFieldFrame({
|
|
|
949
1175
|
);
|
|
950
1176
|
}
|
|
951
1177
|
|
|
952
|
-
// src/TextField.ts
|
|
953
|
-
var TextField = (0,
|
|
1178
|
+
// src/compounds/TextField.ts
|
|
1179
|
+
var TextField = (0, import_vue15.defineComponent)({
|
|
954
1180
|
name: "MasonTextField",
|
|
955
1181
|
inheritAttrs: false,
|
|
956
1182
|
props: {
|
|
@@ -1007,7 +1233,7 @@ var TextField = (0, import_vue12.defineComponent)({
|
|
|
1007
1233
|
emit("update:modelValue", event.target.value);
|
|
1008
1234
|
};
|
|
1009
1235
|
const forwarded = attrInput;
|
|
1010
|
-
const control = (0,
|
|
1236
|
+
const control = (0, import_vue15.h)("input", {
|
|
1011
1237
|
...controlAttrs,
|
|
1012
1238
|
id: ids.controlId,
|
|
1013
1239
|
"data-mason-slot": "control",
|
|
@@ -1039,9 +1265,9 @@ var TextField = (0, import_vue12.defineComponent)({
|
|
|
1039
1265
|
}
|
|
1040
1266
|
});
|
|
1041
1267
|
|
|
1042
|
-
// src/Select.ts
|
|
1043
|
-
var
|
|
1044
|
-
var Select = (0,
|
|
1268
|
+
// src/compounds/Select.ts
|
|
1269
|
+
var import_vue16 = require("vue");
|
|
1270
|
+
var Select = (0, import_vue16.defineComponent)({
|
|
1045
1271
|
name: "MasonSelect",
|
|
1046
1272
|
inheritAttrs: false,
|
|
1047
1273
|
props: {
|
|
@@ -1104,13 +1330,13 @@ var Select = (0, import_vue13.defineComponent)({
|
|
|
1104
1330
|
const forwarded = attrChange;
|
|
1105
1331
|
const options = [];
|
|
1106
1332
|
if (props.placeholder) {
|
|
1107
|
-
options.push((0,
|
|
1333
|
+
options.push((0, import_vue16.h)("option", { value: "" }, props.placeholder));
|
|
1108
1334
|
}
|
|
1109
1335
|
const provided = slots.default?.();
|
|
1110
1336
|
if (provided) {
|
|
1111
1337
|
options.push(provided);
|
|
1112
1338
|
}
|
|
1113
|
-
const control = (0,
|
|
1339
|
+
const control = (0, import_vue16.h)(
|
|
1114
1340
|
"select",
|
|
1115
1341
|
{
|
|
1116
1342
|
...controlAttrs,
|
|
@@ -1146,12 +1372,14 @@ var Select = (0, import_vue13.defineComponent)({
|
|
|
1146
1372
|
}
|
|
1147
1373
|
});
|
|
1148
1374
|
|
|
1149
|
-
// src/Checkbox.ts
|
|
1150
|
-
var
|
|
1375
|
+
// src/compounds/Checkbox.ts
|
|
1376
|
+
var import_vue17 = require("vue");
|
|
1151
1377
|
|
|
1152
|
-
// src/checkboxStyles.ts
|
|
1378
|
+
// src/compounds/checkboxStyles.ts
|
|
1379
|
+
var CONTROL_SIZE = "1.125rem";
|
|
1153
1380
|
function checkboxRootStyle() {
|
|
1154
1381
|
return {
|
|
1382
|
+
position: "relative",
|
|
1155
1383
|
display: "flex",
|
|
1156
1384
|
flexDirection: "column",
|
|
1157
1385
|
gap: spacingVar("stack", "sm"),
|
|
@@ -1168,19 +1396,24 @@ function checkboxLabelStyle(disabled = false) {
|
|
|
1168
1396
|
...typographyStyle("body.md")
|
|
1169
1397
|
};
|
|
1170
1398
|
}
|
|
1171
|
-
function
|
|
1399
|
+
function checkboxIndicatorStyle() {
|
|
1172
1400
|
return {
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1401
|
+
display: "inline-flex",
|
|
1402
|
+
alignItems: "center",
|
|
1403
|
+
justifyContent: "center",
|
|
1404
|
+
width: CONTROL_SIZE,
|
|
1405
|
+
height: CONTROL_SIZE,
|
|
1406
|
+
marginBlockStart: "0.2em",
|
|
1407
|
+
flexShrink: "0",
|
|
1408
|
+
boxSizing: "border-box",
|
|
1409
|
+
borderRadius: radiusVar("sm"),
|
|
1410
|
+
borderStyle: "solid",
|
|
1411
|
+
borderWidth: "1.5px"
|
|
1179
1412
|
};
|
|
1180
1413
|
}
|
|
1181
1414
|
|
|
1182
|
-
// src/Checkbox.ts
|
|
1183
|
-
var Checkbox = (0,
|
|
1415
|
+
// src/compounds/Checkbox.ts
|
|
1416
|
+
var Checkbox = (0, import_vue17.defineComponent)({
|
|
1184
1417
|
name: "MasonCheckbox",
|
|
1185
1418
|
inheritAttrs: false,
|
|
1186
1419
|
props: {
|
|
@@ -1233,7 +1466,7 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1233
1466
|
};
|
|
1234
1467
|
const forwarded = attrChange;
|
|
1235
1468
|
const children = [
|
|
1236
|
-
(0,
|
|
1469
|
+
(0, import_vue17.h)(
|
|
1237
1470
|
"label",
|
|
1238
1471
|
{
|
|
1239
1472
|
"data-mason-slot": "label",
|
|
@@ -1241,7 +1474,7 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1241
1474
|
style: checkboxLabelStyle(props.disabled)
|
|
1242
1475
|
},
|
|
1243
1476
|
[
|
|
1244
|
-
(0,
|
|
1477
|
+
(0, import_vue17.h)("input", {
|
|
1245
1478
|
...controlAttrs,
|
|
1246
1479
|
type: "checkbox",
|
|
1247
1480
|
id: ids.controlId,
|
|
@@ -1251,15 +1484,20 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1251
1484
|
"aria-describedby": ids.describedBy,
|
|
1252
1485
|
...props.modelValue === void 0 ? null : { checked: props.modelValue },
|
|
1253
1486
|
onChange: forwarded ? [emitChange, forwarded] : emitChange,
|
|
1254
|
-
style:
|
|
1487
|
+
style: visuallyHiddenControlStyle()
|
|
1255
1488
|
}),
|
|
1256
|
-
|
|
1489
|
+
(0, import_vue17.h)("span", {
|
|
1490
|
+
"data-mason-slot": "indicator",
|
|
1491
|
+
"aria-hidden": "true",
|
|
1492
|
+
style: checkboxIndicatorStyle()
|
|
1493
|
+
}),
|
|
1494
|
+
label ? (0, import_vue17.h)("span", { "data-mason-slot": "label-text" }, label) : null
|
|
1257
1495
|
]
|
|
1258
1496
|
)
|
|
1259
1497
|
];
|
|
1260
1498
|
if (description) {
|
|
1261
1499
|
children.push(
|
|
1262
|
-
(0,
|
|
1500
|
+
(0, import_vue17.h)(
|
|
1263
1501
|
"p",
|
|
1264
1502
|
{
|
|
1265
1503
|
"data-mason-slot": "description",
|
|
@@ -1272,7 +1510,7 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1272
1510
|
}
|
|
1273
1511
|
if (error) {
|
|
1274
1512
|
children.push(
|
|
1275
|
-
(0,
|
|
1513
|
+
(0, import_vue17.h)(
|
|
1276
1514
|
"p",
|
|
1277
1515
|
{
|
|
1278
1516
|
"data-mason-slot": "error",
|
|
@@ -1284,7 +1522,7 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1284
1522
|
)
|
|
1285
1523
|
);
|
|
1286
1524
|
}
|
|
1287
|
-
return (0,
|
|
1525
|
+
return (0, import_vue17.h)(
|
|
1288
1526
|
"div",
|
|
1289
1527
|
{
|
|
1290
1528
|
"data-mason-component": "checkbox",
|
|
@@ -1298,20 +1536,392 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1298
1536
|
};
|
|
1299
1537
|
}
|
|
1300
1538
|
});
|
|
1539
|
+
|
|
1540
|
+
// src/compounds/Radio.ts
|
|
1541
|
+
var import_vue18 = require("vue");
|
|
1542
|
+
|
|
1543
|
+
// src/compounds/radioStyles.ts
|
|
1544
|
+
var CONTROL_SIZE2 = "1.125rem";
|
|
1545
|
+
function radioRootStyle() {
|
|
1546
|
+
return {
|
|
1547
|
+
position: "relative",
|
|
1548
|
+
display: "flex",
|
|
1549
|
+
flexDirection: "column",
|
|
1550
|
+
gap: spacingVar("stack", "sm"),
|
|
1551
|
+
minWidth: "0"
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
function radioLabelStyle(disabled = false) {
|
|
1555
|
+
return {
|
|
1556
|
+
display: "inline-flex",
|
|
1557
|
+
alignItems: "flex-start",
|
|
1558
|
+
gap: spacingVar("inline", "sm"),
|
|
1559
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
1560
|
+
color: disabled ? cssVar("color.text.disabled") : cssVar("color.text.primary"),
|
|
1561
|
+
...typographyStyle("body.md")
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
function radioIndicatorStyle() {
|
|
1565
|
+
return {
|
|
1566
|
+
display: "inline-flex",
|
|
1567
|
+
alignItems: "center",
|
|
1568
|
+
justifyContent: "center",
|
|
1569
|
+
width: CONTROL_SIZE2,
|
|
1570
|
+
height: CONTROL_SIZE2,
|
|
1571
|
+
marginBlockStart: "0.2em",
|
|
1572
|
+
flexShrink: "0",
|
|
1573
|
+
boxSizing: "border-box",
|
|
1574
|
+
borderRadius: "999px",
|
|
1575
|
+
borderStyle: "solid",
|
|
1576
|
+
borderWidth: "1.5px"
|
|
1577
|
+
};
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
// src/compounds/Radio.ts
|
|
1581
|
+
var Radio = (0, import_vue18.defineComponent)({
|
|
1582
|
+
name: "MasonRadio",
|
|
1583
|
+
inheritAttrs: false,
|
|
1584
|
+
props: {
|
|
1585
|
+
label: {
|
|
1586
|
+
type: String,
|
|
1587
|
+
default: void 0
|
|
1588
|
+
},
|
|
1589
|
+
description: {
|
|
1590
|
+
type: String,
|
|
1591
|
+
default: void 0
|
|
1592
|
+
},
|
|
1593
|
+
error: {
|
|
1594
|
+
type: String,
|
|
1595
|
+
default: void 0
|
|
1596
|
+
},
|
|
1597
|
+
invalid: {
|
|
1598
|
+
type: Boolean,
|
|
1599
|
+
default: void 0
|
|
1600
|
+
},
|
|
1601
|
+
disabled: {
|
|
1602
|
+
type: Boolean,
|
|
1603
|
+
default: false
|
|
1604
|
+
},
|
|
1605
|
+
id: {
|
|
1606
|
+
type: String,
|
|
1607
|
+
default: void 0
|
|
1608
|
+
},
|
|
1609
|
+
modelValue: {
|
|
1610
|
+
type: [String, Number, Boolean],
|
|
1611
|
+
default: void 0
|
|
1612
|
+
},
|
|
1613
|
+
value: {
|
|
1614
|
+
type: [String, Number, Boolean],
|
|
1615
|
+
default: void 0
|
|
1616
|
+
}
|
|
1617
|
+
},
|
|
1618
|
+
emits: ["update:modelValue"],
|
|
1619
|
+
setup(props, { slots, attrs, emit }) {
|
|
1620
|
+
const autoId = nextFieldId();
|
|
1621
|
+
return () => {
|
|
1622
|
+
const {
|
|
1623
|
+
class: attrClass,
|
|
1624
|
+
style: attrStyle,
|
|
1625
|
+
onChange: attrChange,
|
|
1626
|
+
...controlAttrs
|
|
1627
|
+
} = attrs;
|
|
1628
|
+
const label = slots.label?.() ?? props.label;
|
|
1629
|
+
const description = slots.description?.() ?? props.description;
|
|
1630
|
+
const error = slots.error?.() ?? props.error;
|
|
1631
|
+
const invalid = props.invalid ?? Boolean(error);
|
|
1632
|
+
const ids = fieldIds(props.id ?? autoId, Boolean(description), Boolean(error));
|
|
1633
|
+
const emitChange = (event) => {
|
|
1634
|
+
const input = event.target;
|
|
1635
|
+
emit("update:modelValue", props.value === void 0 ? input.value : props.value);
|
|
1636
|
+
};
|
|
1637
|
+
const forwarded = attrChange;
|
|
1638
|
+
const checked = props.modelValue === void 0 || props.value === void 0 ? void 0 : props.modelValue === props.value;
|
|
1639
|
+
const children = [
|
|
1640
|
+
(0, import_vue18.h)(
|
|
1641
|
+
"label",
|
|
1642
|
+
{
|
|
1643
|
+
"data-mason-slot": "label",
|
|
1644
|
+
for: ids.controlId,
|
|
1645
|
+
style: radioLabelStyle(props.disabled)
|
|
1646
|
+
},
|
|
1647
|
+
[
|
|
1648
|
+
(0, import_vue18.h)("input", {
|
|
1649
|
+
...controlAttrs,
|
|
1650
|
+
type: "radio",
|
|
1651
|
+
id: ids.controlId,
|
|
1652
|
+
"data-mason-slot": "control",
|
|
1653
|
+
disabled: props.disabled,
|
|
1654
|
+
value: props.value,
|
|
1655
|
+
"aria-invalid": invalid || void 0,
|
|
1656
|
+
"aria-describedby": ids.describedBy,
|
|
1657
|
+
...checked === void 0 ? null : { checked },
|
|
1658
|
+
onChange: forwarded ? [emitChange, forwarded] : emitChange,
|
|
1659
|
+
style: visuallyHiddenControlStyle()
|
|
1660
|
+
}),
|
|
1661
|
+
(0, import_vue18.h)("span", {
|
|
1662
|
+
"data-mason-slot": "indicator",
|
|
1663
|
+
"aria-hidden": "true",
|
|
1664
|
+
style: radioIndicatorStyle()
|
|
1665
|
+
}),
|
|
1666
|
+
label ? (0, import_vue18.h)("span", { "data-mason-slot": "label-text" }, label) : null
|
|
1667
|
+
]
|
|
1668
|
+
)
|
|
1669
|
+
];
|
|
1670
|
+
if (description) {
|
|
1671
|
+
children.push(
|
|
1672
|
+
(0, import_vue18.h)(
|
|
1673
|
+
"p",
|
|
1674
|
+
{
|
|
1675
|
+
"data-mason-slot": "description",
|
|
1676
|
+
id: ids.descriptionId,
|
|
1677
|
+
style: fieldDescriptionStyle()
|
|
1678
|
+
},
|
|
1679
|
+
description
|
|
1680
|
+
)
|
|
1681
|
+
);
|
|
1682
|
+
}
|
|
1683
|
+
if (error) {
|
|
1684
|
+
children.push(
|
|
1685
|
+
(0, import_vue18.h)(
|
|
1686
|
+
"p",
|
|
1687
|
+
{
|
|
1688
|
+
"data-mason-slot": "error",
|
|
1689
|
+
id: ids.errorId,
|
|
1690
|
+
role: "alert",
|
|
1691
|
+
style: fieldErrorStyle()
|
|
1692
|
+
},
|
|
1693
|
+
error
|
|
1694
|
+
)
|
|
1695
|
+
);
|
|
1696
|
+
}
|
|
1697
|
+
return (0, import_vue18.h)(
|
|
1698
|
+
"div",
|
|
1699
|
+
{
|
|
1700
|
+
"data-mason-component": "radio",
|
|
1701
|
+
"data-invalid": invalid || void 0,
|
|
1702
|
+
"data-disabled": props.disabled || void 0,
|
|
1703
|
+
class: mergeClassName(attrClass),
|
|
1704
|
+
style: [radioRootStyle(), attrStyle]
|
|
1705
|
+
},
|
|
1706
|
+
children
|
|
1707
|
+
);
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
|
|
1712
|
+
// src/compounds/Toggle.ts
|
|
1713
|
+
var import_vue19 = require("vue");
|
|
1714
|
+
|
|
1715
|
+
// src/compounds/toggleStyles.ts
|
|
1716
|
+
var TRACK = {
|
|
1717
|
+
sm: { width: "1.75rem", height: "1rem" },
|
|
1718
|
+
md: { width: "2.25rem", height: "1.25rem" },
|
|
1719
|
+
lg: { width: "2.75rem", height: "1.5rem" }
|
|
1720
|
+
};
|
|
1721
|
+
var THUMB = {
|
|
1722
|
+
sm: "0.75rem",
|
|
1723
|
+
md: "1rem",
|
|
1724
|
+
lg: "1.25rem"
|
|
1725
|
+
};
|
|
1726
|
+
function toggleRootStyle() {
|
|
1727
|
+
return {
|
|
1728
|
+
position: "relative",
|
|
1729
|
+
display: "flex",
|
|
1730
|
+
flexDirection: "column",
|
|
1731
|
+
gap: spacingVar("stack", "sm"),
|
|
1732
|
+
minWidth: "0"
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1735
|
+
function toggleLabelStyle(disabled = false) {
|
|
1736
|
+
return {
|
|
1737
|
+
display: "inline-flex",
|
|
1738
|
+
alignItems: "center",
|
|
1739
|
+
gap: spacingVar("inline", "sm"),
|
|
1740
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
1741
|
+
color: disabled ? cssVar("color.text.disabled") : cssVar("color.text.primary"),
|
|
1742
|
+
...typographyStyle("label.md")
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
function toggleIndicatorStyle(size = "md") {
|
|
1746
|
+
return {
|
|
1747
|
+
position: "relative",
|
|
1748
|
+
display: "inline-flex",
|
|
1749
|
+
alignItems: "center",
|
|
1750
|
+
width: TRACK[size].width,
|
|
1751
|
+
height: TRACK[size].height,
|
|
1752
|
+
padding: "0.125rem",
|
|
1753
|
+
flexShrink: "0",
|
|
1754
|
+
boxSizing: "border-box",
|
|
1755
|
+
borderRadius: radiusVar("full")
|
|
1756
|
+
};
|
|
1757
|
+
}
|
|
1758
|
+
function toggleThumbStyle(size = "md") {
|
|
1759
|
+
return {
|
|
1760
|
+
width: THUMB[size],
|
|
1761
|
+
height: THUMB[size],
|
|
1762
|
+
borderRadius: radiusVar("full"),
|
|
1763
|
+
flexShrink: "0"
|
|
1764
|
+
};
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
// src/compounds/Toggle.ts
|
|
1768
|
+
var Toggle = (0, import_vue19.defineComponent)({
|
|
1769
|
+
name: "MasonToggle",
|
|
1770
|
+
inheritAttrs: false,
|
|
1771
|
+
props: {
|
|
1772
|
+
label: {
|
|
1773
|
+
type: String,
|
|
1774
|
+
default: void 0
|
|
1775
|
+
},
|
|
1776
|
+
description: {
|
|
1777
|
+
type: String,
|
|
1778
|
+
default: void 0
|
|
1779
|
+
},
|
|
1780
|
+
error: {
|
|
1781
|
+
type: String,
|
|
1782
|
+
default: void 0
|
|
1783
|
+
},
|
|
1784
|
+
invalid: {
|
|
1785
|
+
type: Boolean,
|
|
1786
|
+
default: void 0
|
|
1787
|
+
},
|
|
1788
|
+
disabled: {
|
|
1789
|
+
type: Boolean,
|
|
1790
|
+
default: false
|
|
1791
|
+
},
|
|
1792
|
+
size: {
|
|
1793
|
+
type: String,
|
|
1794
|
+
default: "md"
|
|
1795
|
+
},
|
|
1796
|
+
id: {
|
|
1797
|
+
type: String,
|
|
1798
|
+
default: void 0
|
|
1799
|
+
},
|
|
1800
|
+
modelValue: {
|
|
1801
|
+
type: Boolean,
|
|
1802
|
+
default: void 0
|
|
1803
|
+
}
|
|
1804
|
+
},
|
|
1805
|
+
emits: ["update:modelValue"],
|
|
1806
|
+
setup(props, { slots, attrs, emit }) {
|
|
1807
|
+
const autoId = nextFieldId();
|
|
1808
|
+
return () => {
|
|
1809
|
+
const {
|
|
1810
|
+
class: attrClass,
|
|
1811
|
+
style: attrStyle,
|
|
1812
|
+
onChange: attrChange,
|
|
1813
|
+
...controlAttrs
|
|
1814
|
+
} = attrs;
|
|
1815
|
+
const label = slots.label?.() ?? props.label;
|
|
1816
|
+
const description = slots.description?.() ?? props.description;
|
|
1817
|
+
const error = slots.error?.() ?? props.error;
|
|
1818
|
+
const invalid = props.invalid ?? Boolean(error);
|
|
1819
|
+
const ids = fieldIds(props.id ?? autoId, Boolean(description), Boolean(error));
|
|
1820
|
+
const emitChange = (event) => {
|
|
1821
|
+
emit("update:modelValue", event.target.checked);
|
|
1822
|
+
};
|
|
1823
|
+
const forwarded = attrChange;
|
|
1824
|
+
const children = [
|
|
1825
|
+
(0, import_vue19.h)(
|
|
1826
|
+
"label",
|
|
1827
|
+
{
|
|
1828
|
+
"data-mason-slot": "label",
|
|
1829
|
+
for: ids.controlId,
|
|
1830
|
+
style: toggleLabelStyle(props.disabled)
|
|
1831
|
+
},
|
|
1832
|
+
[
|
|
1833
|
+
label ? (0, import_vue19.h)("span", { "data-mason-slot": "label-text" }, label) : null,
|
|
1834
|
+
(0, import_vue19.h)("input", {
|
|
1835
|
+
...controlAttrs,
|
|
1836
|
+
type: "checkbox",
|
|
1837
|
+
role: "switch",
|
|
1838
|
+
id: ids.controlId,
|
|
1839
|
+
"data-mason-slot": "control",
|
|
1840
|
+
disabled: props.disabled,
|
|
1841
|
+
"aria-invalid": invalid || void 0,
|
|
1842
|
+
"aria-describedby": ids.describedBy,
|
|
1843
|
+
...props.modelValue === void 0 ? null : { checked: props.modelValue },
|
|
1844
|
+
onChange: forwarded ? [emitChange, forwarded] : emitChange,
|
|
1845
|
+
style: visuallyHiddenControlStyle()
|
|
1846
|
+
}),
|
|
1847
|
+
(0, import_vue19.h)(
|
|
1848
|
+
"span",
|
|
1849
|
+
{
|
|
1850
|
+
"data-mason-slot": "indicator",
|
|
1851
|
+
"aria-hidden": "true",
|
|
1852
|
+
style: toggleIndicatorStyle(props.size)
|
|
1853
|
+
},
|
|
1854
|
+
[
|
|
1855
|
+
(0, import_vue19.h)("span", {
|
|
1856
|
+
"data-mason-slot": "thumb",
|
|
1857
|
+
style: toggleThumbStyle(props.size)
|
|
1858
|
+
})
|
|
1859
|
+
]
|
|
1860
|
+
)
|
|
1861
|
+
]
|
|
1862
|
+
)
|
|
1863
|
+
];
|
|
1864
|
+
if (description) {
|
|
1865
|
+
children.push(
|
|
1866
|
+
(0, import_vue19.h)(
|
|
1867
|
+
"p",
|
|
1868
|
+
{
|
|
1869
|
+
"data-mason-slot": "description",
|
|
1870
|
+
id: ids.descriptionId,
|
|
1871
|
+
style: fieldDescriptionStyle()
|
|
1872
|
+
},
|
|
1873
|
+
description
|
|
1874
|
+
)
|
|
1875
|
+
);
|
|
1876
|
+
}
|
|
1877
|
+
if (error) {
|
|
1878
|
+
children.push(
|
|
1879
|
+
(0, import_vue19.h)(
|
|
1880
|
+
"p",
|
|
1881
|
+
{
|
|
1882
|
+
"data-mason-slot": "error",
|
|
1883
|
+
id: ids.errorId,
|
|
1884
|
+
role: "alert",
|
|
1885
|
+
style: fieldErrorStyle()
|
|
1886
|
+
},
|
|
1887
|
+
error
|
|
1888
|
+
)
|
|
1889
|
+
);
|
|
1890
|
+
}
|
|
1891
|
+
return (0, import_vue19.h)(
|
|
1892
|
+
"div",
|
|
1893
|
+
{
|
|
1894
|
+
"data-mason-component": "toggle",
|
|
1895
|
+
"data-size": props.size,
|
|
1896
|
+
"data-invalid": invalid || void 0,
|
|
1897
|
+
"data-disabled": props.disabled || void 0,
|
|
1898
|
+
class: mergeClassName(attrClass),
|
|
1899
|
+
style: [toggleRootStyle(), attrStyle]
|
|
1900
|
+
},
|
|
1901
|
+
children
|
|
1902
|
+
);
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
});
|
|
1301
1906
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1302
1907
|
0 && (module.exports = {
|
|
1303
1908
|
Badge,
|
|
1909
|
+
Box,
|
|
1304
1910
|
Button,
|
|
1305
1911
|
Callout,
|
|
1306
1912
|
Card,
|
|
1307
1913
|
Checkbox,
|
|
1914
|
+
Container,
|
|
1308
1915
|
Divider,
|
|
1916
|
+
Grid,
|
|
1309
1917
|
Link,
|
|
1310
1918
|
MasonProvider,
|
|
1919
|
+
Radio,
|
|
1311
1920
|
Select,
|
|
1312
1921
|
Spinner,
|
|
1313
1922
|
Stack,
|
|
1314
1923
|
Text,
|
|
1315
|
-
TextField
|
|
1924
|
+
TextField,
|
|
1925
|
+
Toggle
|
|
1316
1926
|
});
|
|
1317
1927
|
//# sourceMappingURL=index.cjs.map
|