@mason-ds/vue 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 +540 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +266 -2
- package/dist/index.d.ts +266 -2
- package/dist/index.js +534 -127
- package/dist/index.js.map +1 -1
- package/llms.txt +81 -19
- 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
|
|
|
@@ -59,7 +63,7 @@ var MasonProvider = (0, import_vue.defineComponent)({
|
|
|
59
63
|
}
|
|
60
64
|
});
|
|
61
65
|
|
|
62
|
-
// src/Text.ts
|
|
66
|
+
// src/primitives/Text.ts
|
|
63
67
|
var import_vue2 = require("vue");
|
|
64
68
|
|
|
65
69
|
// src/styles.ts
|
|
@@ -70,6 +74,9 @@ function cssVar(path) {
|
|
|
70
74
|
function spacingVar(axis, level) {
|
|
71
75
|
return cssVar(`spacing.${axis}.${level}`);
|
|
72
76
|
}
|
|
77
|
+
function containerMaxWidthVar(level) {
|
|
78
|
+
return cssVar(`spacing.layout.container.${level}`);
|
|
79
|
+
}
|
|
73
80
|
function radiusVar(level) {
|
|
74
81
|
return cssVar(`radius.${level}`);
|
|
75
82
|
}
|
|
@@ -93,7 +100,7 @@ function mergeClassName(...parts) {
|
|
|
93
100
|
return merged.length > 0 ? merged : void 0;
|
|
94
101
|
}
|
|
95
102
|
|
|
96
|
-
// src/textStyles.ts
|
|
103
|
+
// src/primitives/textStyles.ts
|
|
97
104
|
function textStyle({
|
|
98
105
|
variant = "body.md",
|
|
99
106
|
tone = "primary",
|
|
@@ -109,7 +116,7 @@ function textStyle({
|
|
|
109
116
|
};
|
|
110
117
|
}
|
|
111
118
|
|
|
112
|
-
// src/Text.ts
|
|
119
|
+
// src/primitives/Text.ts
|
|
113
120
|
var Text = (0, import_vue2.defineComponent)({
|
|
114
121
|
name: "MasonText",
|
|
115
122
|
inheritAttrs: false,
|
|
@@ -161,10 +168,10 @@ var Text = (0, import_vue2.defineComponent)({
|
|
|
161
168
|
}
|
|
162
169
|
});
|
|
163
170
|
|
|
164
|
-
// src/Stack.ts
|
|
171
|
+
// src/primitives/Stack.ts
|
|
165
172
|
var import_vue3 = require("vue");
|
|
166
173
|
|
|
167
|
-
// src/stackStyles.ts
|
|
174
|
+
// src/primitives/stackStyles.ts
|
|
168
175
|
var FLEX_ALIGN = {
|
|
169
176
|
start: "flex-start",
|
|
170
177
|
center: "center",
|
|
@@ -197,7 +204,7 @@ function stackStyle({
|
|
|
197
204
|
};
|
|
198
205
|
}
|
|
199
206
|
|
|
200
|
-
// src/Stack.ts
|
|
207
|
+
// src/primitives/Stack.ts
|
|
201
208
|
var Stack = (0, import_vue3.defineComponent)({
|
|
202
209
|
name: "MasonStack",
|
|
203
210
|
inheritAttrs: false,
|
|
@@ -255,11 +262,237 @@ var Stack = (0, import_vue3.defineComponent)({
|
|
|
255
262
|
}
|
|
256
263
|
});
|
|
257
264
|
|
|
258
|
-
// src/
|
|
265
|
+
// src/primitives/Box.ts
|
|
259
266
|
var import_vue4 = require("vue");
|
|
260
267
|
|
|
261
|
-
// src/
|
|
268
|
+
// src/primitives/boxStyles.ts
|
|
262
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 = {
|
|
263
496
|
surface: "color.bg.surface",
|
|
264
497
|
canvas: "color.bg.canvas",
|
|
265
498
|
elevated: "color.bg.elevated"
|
|
@@ -274,7 +507,7 @@ function cardStyle({
|
|
|
274
507
|
return {
|
|
275
508
|
display: "block",
|
|
276
509
|
padding: spacingVar("inset", padding),
|
|
277
|
-
backgroundColor: cssVar(
|
|
510
|
+
backgroundColor: cssVar(TONE_BG2[tone]),
|
|
278
511
|
color: cssVar("color.text.primary"),
|
|
279
512
|
border: bordered ? `1px solid ${cssVar("color.border.subtle")}` : "none",
|
|
280
513
|
borderRadius: radiusVar(radius),
|
|
@@ -284,8 +517,8 @@ function cardStyle({
|
|
|
284
517
|
};
|
|
285
518
|
}
|
|
286
519
|
|
|
287
|
-
// src/Card.ts
|
|
288
|
-
var Card = (0,
|
|
520
|
+
// src/primitives/Card.ts
|
|
521
|
+
var Card = (0, import_vue7.defineComponent)({
|
|
289
522
|
name: "MasonCard",
|
|
290
523
|
inheritAttrs: false,
|
|
291
524
|
props: {
|
|
@@ -313,7 +546,7 @@ var Card = (0, import_vue4.defineComponent)({
|
|
|
313
546
|
setup(props, { slots, attrs }) {
|
|
314
547
|
return () => {
|
|
315
548
|
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
316
|
-
return (0,
|
|
549
|
+
return (0, import_vue7.h)(
|
|
317
550
|
"div",
|
|
318
551
|
{
|
|
319
552
|
...rest,
|
|
@@ -337,10 +570,10 @@ var Card = (0, import_vue4.defineComponent)({
|
|
|
337
570
|
}
|
|
338
571
|
});
|
|
339
572
|
|
|
340
|
-
// src/Divider.ts
|
|
341
|
-
var
|
|
573
|
+
// src/primitives/Divider.ts
|
|
574
|
+
var import_vue8 = require("vue");
|
|
342
575
|
|
|
343
|
-
// src/dividerStyles.ts
|
|
576
|
+
// src/primitives/dividerStyles.ts
|
|
344
577
|
function dividerStyle(orientation = "horizontal") {
|
|
345
578
|
const line = `1px solid ${cssVar("color.border.subtle")}`;
|
|
346
579
|
if (orientation === "vertical") {
|
|
@@ -362,8 +595,8 @@ function dividerStyle(orientation = "horizontal") {
|
|
|
362
595
|
};
|
|
363
596
|
}
|
|
364
597
|
|
|
365
|
-
// src/Divider.ts
|
|
366
|
-
var Divider = (0,
|
|
598
|
+
// src/primitives/Divider.ts
|
|
599
|
+
var Divider = (0, import_vue8.defineComponent)({
|
|
367
600
|
name: "MasonDivider",
|
|
368
601
|
inheritAttrs: false,
|
|
369
602
|
props: {
|
|
@@ -375,7 +608,7 @@ var Divider = (0, import_vue5.defineComponent)({
|
|
|
375
608
|
setup(props, { attrs }) {
|
|
376
609
|
return () => {
|
|
377
610
|
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
378
|
-
return (0,
|
|
611
|
+
return (0, import_vue8.h)("hr", {
|
|
379
612
|
...rest,
|
|
380
613
|
"data-mason-component": "divider",
|
|
381
614
|
"data-orientation": props.orientation,
|
|
@@ -387,10 +620,10 @@ var Divider = (0, import_vue5.defineComponent)({
|
|
|
387
620
|
}
|
|
388
621
|
});
|
|
389
622
|
|
|
390
|
-
// src/Link.ts
|
|
391
|
-
var
|
|
623
|
+
// src/primitives/Link.ts
|
|
624
|
+
var import_vue9 = require("vue");
|
|
392
625
|
|
|
393
|
-
// src/linkStyles.ts
|
|
626
|
+
// src/primitives/linkStyles.ts
|
|
394
627
|
function linkStyle({
|
|
395
628
|
tone = "link",
|
|
396
629
|
underline = "hover"
|
|
@@ -404,8 +637,8 @@ function linkStyle({
|
|
|
404
637
|
};
|
|
405
638
|
}
|
|
406
639
|
|
|
407
|
-
// src/Link.ts
|
|
408
|
-
var Link = (0,
|
|
640
|
+
// src/primitives/Link.ts
|
|
641
|
+
var Link = (0, import_vue9.defineComponent)({
|
|
409
642
|
name: "MasonLink",
|
|
410
643
|
inheritAttrs: false,
|
|
411
644
|
props: {
|
|
@@ -427,7 +660,7 @@ var Link = (0, import_vue6.defineComponent)({
|
|
|
427
660
|
return () => {
|
|
428
661
|
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
429
662
|
const externalAttrs = props.external ? { target: "_blank", rel: "noreferrer noopener" } : null;
|
|
430
|
-
return (0,
|
|
663
|
+
return (0, import_vue9.h)(
|
|
431
664
|
"a",
|
|
432
665
|
{
|
|
433
666
|
"data-mason-component": "link",
|
|
@@ -447,13 +680,13 @@ var Link = (0, import_vue6.defineComponent)({
|
|
|
447
680
|
}
|
|
448
681
|
});
|
|
449
682
|
|
|
450
|
-
// src/Button.ts
|
|
451
|
-
var
|
|
683
|
+
// src/primitives/Button.ts
|
|
684
|
+
var import_vue11 = require("vue");
|
|
452
685
|
|
|
453
|
-
// src/Spinner.ts
|
|
454
|
-
var
|
|
686
|
+
// src/primitives/Spinner.ts
|
|
687
|
+
var import_vue10 = require("vue");
|
|
455
688
|
|
|
456
|
-
// src/spinnerStyles.ts
|
|
689
|
+
// src/primitives/spinnerStyles.ts
|
|
457
690
|
var SIZE_DIMENSION = {
|
|
458
691
|
sm: cssVar("font.body.sm.size"),
|
|
459
692
|
md: cssVar("font.body.md.size"),
|
|
@@ -473,8 +706,8 @@ function spinnerStyle(size = "md") {
|
|
|
473
706
|
};
|
|
474
707
|
}
|
|
475
708
|
|
|
476
|
-
// src/Spinner.ts
|
|
477
|
-
var Spinner = (0,
|
|
709
|
+
// src/primitives/Spinner.ts
|
|
710
|
+
var Spinner = (0, import_vue10.defineComponent)({
|
|
478
711
|
name: "MasonSpinner",
|
|
479
712
|
inheritAttrs: false,
|
|
480
713
|
props: {
|
|
@@ -491,7 +724,7 @@ var Spinner = (0, import_vue7.defineComponent)({
|
|
|
491
724
|
setup(props, { attrs }) {
|
|
492
725
|
return () => {
|
|
493
726
|
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
494
|
-
return (0,
|
|
727
|
+
return (0, import_vue10.h)("span", {
|
|
495
728
|
...rest,
|
|
496
729
|
"data-mason-component": "spinner",
|
|
497
730
|
"data-size": props.size,
|
|
@@ -505,14 +738,7 @@ var Spinner = (0, import_vue7.defineComponent)({
|
|
|
505
738
|
}
|
|
506
739
|
});
|
|
507
740
|
|
|
508
|
-
// src/buttonStyles.ts
|
|
509
|
-
function actionColors(variant) {
|
|
510
|
-
return {
|
|
511
|
-
bg: `color.action.${variant}.bg`,
|
|
512
|
-
text: `color.action.${variant}.text`,
|
|
513
|
-
border: `color.action.${variant}.border`
|
|
514
|
-
};
|
|
515
|
-
}
|
|
741
|
+
// src/primitives/buttonStyles.ts
|
|
516
742
|
var sizeStyles = {
|
|
517
743
|
sm: {
|
|
518
744
|
paddingBlock: cssVar("spacing.inset.sm"),
|
|
@@ -536,14 +762,7 @@ var sizeStyles = {
|
|
|
536
762
|
font: "label.lg"
|
|
537
763
|
}
|
|
538
764
|
};
|
|
539
|
-
function buttonStyle({
|
|
540
|
-
variant = "primary",
|
|
541
|
-
size = "md",
|
|
542
|
-
disabled = false,
|
|
543
|
-
loading = false
|
|
544
|
-
}) {
|
|
545
|
-
const inactive = disabled || loading;
|
|
546
|
-
const colors = actionColors(inactive ? "disabled" : variant);
|
|
765
|
+
function buttonStyle({ size = "md" }) {
|
|
547
766
|
const sizing = sizeStyles[size];
|
|
548
767
|
return {
|
|
549
768
|
display: "inline-flex",
|
|
@@ -553,9 +772,6 @@ function buttonStyle({
|
|
|
553
772
|
paddingBlock: sizing.paddingBlock,
|
|
554
773
|
paddingInline: sizing.paddingInline,
|
|
555
774
|
margin: "0",
|
|
556
|
-
backgroundColor: cssVar(colors.bg),
|
|
557
|
-
color: cssVar(colors.text),
|
|
558
|
-
border: `1px solid ${cssVar(colors.border)}`,
|
|
559
775
|
borderRadius: sizing.radius,
|
|
560
776
|
boxSizing: "border-box",
|
|
561
777
|
...typographyStyle(sizing.font),
|
|
@@ -564,8 +780,8 @@ function buttonStyle({
|
|
|
564
780
|
};
|
|
565
781
|
}
|
|
566
782
|
|
|
567
|
-
// src/Button.ts
|
|
568
|
-
var Button = (0,
|
|
783
|
+
// src/primitives/Button.ts
|
|
784
|
+
var Button = (0, import_vue11.defineComponent)({
|
|
569
785
|
name: "MasonButton",
|
|
570
786
|
inheritAttrs: false,
|
|
571
787
|
props: {
|
|
@@ -591,23 +807,23 @@ var Button = (0, import_vue8.defineComponent)({
|
|
|
591
807
|
}
|
|
592
808
|
},
|
|
593
809
|
setup(props, { slots, attrs }) {
|
|
594
|
-
const isDisabled = (0,
|
|
810
|
+
const isDisabled = (0, import_vue11.computed)(() => props.disabled || props.loading);
|
|
595
811
|
return () => {
|
|
596
812
|
const children = [];
|
|
597
813
|
if (props.loading) {
|
|
598
|
-
children.push((0,
|
|
814
|
+
children.push((0, import_vue11.h)(Spinner, { size: "inherit", "data-mason-slot": "spinner" }));
|
|
599
815
|
} else if (slots.leading) {
|
|
600
|
-
children.push((0,
|
|
816
|
+
children.push((0, import_vue11.h)("span", { "data-mason-slot": "leading" }, slots.leading()));
|
|
601
817
|
}
|
|
602
818
|
if (slots.default) {
|
|
603
|
-
children.push((0,
|
|
819
|
+
children.push((0, import_vue11.h)("span", { "data-mason-slot": "label" }, slots.default()));
|
|
604
820
|
}
|
|
605
821
|
if (slots.trailing && !props.loading) {
|
|
606
|
-
children.push((0,
|
|
822
|
+
children.push((0, import_vue11.h)("span", { "data-mason-slot": "trailing" }, slots.trailing()));
|
|
607
823
|
}
|
|
608
824
|
const attrClass = attrs.class;
|
|
609
825
|
const attrStyle = attrs.style;
|
|
610
|
-
return (0,
|
|
826
|
+
return (0, import_vue11.h)(
|
|
611
827
|
"button",
|
|
612
828
|
{
|
|
613
829
|
...attrs,
|
|
@@ -618,15 +834,7 @@ var Button = (0, import_vue8.defineComponent)({
|
|
|
618
834
|
disabled: isDisabled.value,
|
|
619
835
|
"aria-busy": props.loading || void 0,
|
|
620
836
|
class: mergeClassName(attrClass),
|
|
621
|
-
style: [
|
|
622
|
-
buttonStyle({
|
|
623
|
-
variant: props.variant,
|
|
624
|
-
size: props.size,
|
|
625
|
-
disabled: props.disabled,
|
|
626
|
-
loading: props.loading
|
|
627
|
-
}),
|
|
628
|
-
attrStyle
|
|
629
|
-
]
|
|
837
|
+
style: [buttonStyle({ size: props.size }), attrStyle]
|
|
630
838
|
},
|
|
631
839
|
children
|
|
632
840
|
);
|
|
@@ -634,10 +842,10 @@ var Button = (0, import_vue8.defineComponent)({
|
|
|
634
842
|
}
|
|
635
843
|
});
|
|
636
844
|
|
|
637
|
-
// src/Badge.ts
|
|
638
|
-
var
|
|
845
|
+
// src/primitives/Badge.ts
|
|
846
|
+
var import_vue12 = require("vue");
|
|
639
847
|
|
|
640
|
-
// src/badgeStyles.ts
|
|
848
|
+
// src/primitives/badgeStyles.ts
|
|
641
849
|
function badgeStyle({
|
|
642
850
|
tone = "neutral",
|
|
643
851
|
size = "sm"
|
|
@@ -666,8 +874,8 @@ function badgeStyle({
|
|
|
666
874
|
};
|
|
667
875
|
}
|
|
668
876
|
|
|
669
|
-
// src/Badge.ts
|
|
670
|
-
var Badge = (0,
|
|
877
|
+
// src/primitives/Badge.ts
|
|
878
|
+
var Badge = (0, import_vue12.defineComponent)({
|
|
671
879
|
name: "MasonBadge",
|
|
672
880
|
inheritAttrs: false,
|
|
673
881
|
props: {
|
|
@@ -683,7 +891,7 @@ var Badge = (0, import_vue9.defineComponent)({
|
|
|
683
891
|
setup(props, { slots, attrs }) {
|
|
684
892
|
return () => {
|
|
685
893
|
const { class: attrClass, style: attrStyle, ...rest } = attrs;
|
|
686
|
-
return (0,
|
|
894
|
+
return (0, import_vue12.h)(
|
|
687
895
|
"span",
|
|
688
896
|
{
|
|
689
897
|
...rest,
|
|
@@ -702,10 +910,10 @@ var Badge = (0, import_vue9.defineComponent)({
|
|
|
702
910
|
}
|
|
703
911
|
});
|
|
704
912
|
|
|
705
|
-
// src/Callout.ts
|
|
706
|
-
var
|
|
913
|
+
// src/primitives/Callout.ts
|
|
914
|
+
var import_vue13 = require("vue");
|
|
707
915
|
|
|
708
|
-
// src/calloutStyles.ts
|
|
916
|
+
// src/primitives/calloutStyles.ts
|
|
709
917
|
function calloutStyle(tone = "info") {
|
|
710
918
|
return {
|
|
711
919
|
display: "flex",
|
|
@@ -734,8 +942,8 @@ function calloutBodyStyle() {
|
|
|
734
942
|
return { margin: "0", ...typographyStyle("body.sm") };
|
|
735
943
|
}
|
|
736
944
|
|
|
737
|
-
// src/Callout.ts
|
|
738
|
-
var Callout = (0,
|
|
945
|
+
// src/primitives/Callout.ts
|
|
946
|
+
var Callout = (0, import_vue13.defineComponent)({
|
|
739
947
|
name: "MasonCallout",
|
|
740
948
|
inheritAttrs: false,
|
|
741
949
|
props: {
|
|
@@ -757,18 +965,18 @@ var Callout = (0, import_vue10.defineComponent)({
|
|
|
757
965
|
const content = [];
|
|
758
966
|
if (title) {
|
|
759
967
|
content.push(
|
|
760
|
-
(0,
|
|
968
|
+
(0, import_vue13.h)("p", { "data-mason-slot": "title", style: calloutTitleStyle() }, title)
|
|
761
969
|
);
|
|
762
970
|
}
|
|
763
971
|
if (body) {
|
|
764
972
|
content.push(
|
|
765
|
-
(0,
|
|
973
|
+
(0, import_vue13.h)("div", { "data-mason-slot": "body", style: calloutBodyStyle() }, body)
|
|
766
974
|
);
|
|
767
975
|
}
|
|
768
976
|
const children = [];
|
|
769
977
|
if (slots.icon) {
|
|
770
978
|
children.push(
|
|
771
|
-
(0,
|
|
979
|
+
(0, import_vue13.h)(
|
|
772
980
|
"span",
|
|
773
981
|
{ "data-mason-slot": "icon", "aria-hidden": "true" },
|
|
774
982
|
slots.icon()
|
|
@@ -776,13 +984,13 @@ var Callout = (0, import_vue10.defineComponent)({
|
|
|
776
984
|
);
|
|
777
985
|
}
|
|
778
986
|
children.push(
|
|
779
|
-
(0,
|
|
987
|
+
(0, import_vue13.h)(
|
|
780
988
|
"div",
|
|
781
989
|
{ "data-mason-slot": "content", style: calloutContentStyle() },
|
|
782
990
|
content
|
|
783
991
|
)
|
|
784
992
|
);
|
|
785
|
-
return (0,
|
|
993
|
+
return (0, import_vue13.h)(
|
|
786
994
|
"div",
|
|
787
995
|
{
|
|
788
996
|
...rest,
|
|
@@ -797,13 +1005,13 @@ var Callout = (0, import_vue10.defineComponent)({
|
|
|
797
1005
|
}
|
|
798
1006
|
});
|
|
799
1007
|
|
|
800
|
-
// src/TextField.ts
|
|
801
|
-
var
|
|
1008
|
+
// src/compounds/TextField.ts
|
|
1009
|
+
var import_vue15 = require("vue");
|
|
802
1010
|
|
|
803
|
-
// src/field.ts
|
|
804
|
-
var
|
|
1011
|
+
// src/compounds/field.ts
|
|
1012
|
+
var import_vue14 = require("vue");
|
|
805
1013
|
|
|
806
|
-
// src/fieldStyles.ts
|
|
1014
|
+
// src/compounds/fieldStyles.ts
|
|
807
1015
|
var CONTROL_FONT = {
|
|
808
1016
|
sm: "body.sm",
|
|
809
1017
|
md: "body.md",
|
|
@@ -867,10 +1075,12 @@ function fieldErrorStyle() {
|
|
|
867
1075
|
function visuallyHiddenControlStyle() {
|
|
868
1076
|
return {
|
|
869
1077
|
position: "absolute",
|
|
1078
|
+
left: "0",
|
|
1079
|
+
top: "0",
|
|
870
1080
|
width: "1px",
|
|
871
1081
|
height: "1px",
|
|
872
1082
|
padding: "0",
|
|
873
|
-
margin: "
|
|
1083
|
+
margin: "0",
|
|
874
1084
|
overflow: "hidden",
|
|
875
1085
|
clip: "rect(0, 0, 0, 0)",
|
|
876
1086
|
whiteSpace: "nowrap",
|
|
@@ -880,7 +1090,7 @@ function visuallyHiddenControlStyle() {
|
|
|
880
1090
|
};
|
|
881
1091
|
}
|
|
882
1092
|
|
|
883
|
-
// src/field.ts
|
|
1093
|
+
// src/compounds/field.ts
|
|
884
1094
|
var fieldSeq = 0;
|
|
885
1095
|
function nextFieldId() {
|
|
886
1096
|
fieldSeq += 1;
|
|
@@ -912,7 +1122,7 @@ function renderFieldFrame({
|
|
|
912
1122
|
const children = [];
|
|
913
1123
|
if (label) {
|
|
914
1124
|
children.push(
|
|
915
|
-
(0,
|
|
1125
|
+
(0, import_vue14.h)(
|
|
916
1126
|
"label",
|
|
917
1127
|
{
|
|
918
1128
|
"data-mason-slot": "label",
|
|
@@ -926,7 +1136,7 @@ function renderFieldFrame({
|
|
|
926
1136
|
children.push(control);
|
|
927
1137
|
if (description) {
|
|
928
1138
|
children.push(
|
|
929
|
-
(0,
|
|
1139
|
+
(0, import_vue14.h)(
|
|
930
1140
|
"p",
|
|
931
1141
|
{
|
|
932
1142
|
"data-mason-slot": "description",
|
|
@@ -939,7 +1149,7 @@ function renderFieldFrame({
|
|
|
939
1149
|
}
|
|
940
1150
|
if (error) {
|
|
941
1151
|
children.push(
|
|
942
|
-
(0,
|
|
1152
|
+
(0, import_vue14.h)(
|
|
943
1153
|
"p",
|
|
944
1154
|
{
|
|
945
1155
|
"data-mason-slot": "error",
|
|
@@ -951,7 +1161,7 @@ function renderFieldFrame({
|
|
|
951
1161
|
)
|
|
952
1162
|
);
|
|
953
1163
|
}
|
|
954
|
-
return (0,
|
|
1164
|
+
return (0, import_vue14.h)(
|
|
955
1165
|
"div",
|
|
956
1166
|
{
|
|
957
1167
|
"data-mason-component": component,
|
|
@@ -965,8 +1175,8 @@ function renderFieldFrame({
|
|
|
965
1175
|
);
|
|
966
1176
|
}
|
|
967
1177
|
|
|
968
|
-
// src/TextField.ts
|
|
969
|
-
var TextField = (0,
|
|
1178
|
+
// src/compounds/TextField.ts
|
|
1179
|
+
var TextField = (0, import_vue15.defineComponent)({
|
|
970
1180
|
name: "MasonTextField",
|
|
971
1181
|
inheritAttrs: false,
|
|
972
1182
|
props: {
|
|
@@ -1023,7 +1233,7 @@ var TextField = (0, import_vue12.defineComponent)({
|
|
|
1023
1233
|
emit("update:modelValue", event.target.value);
|
|
1024
1234
|
};
|
|
1025
1235
|
const forwarded = attrInput;
|
|
1026
|
-
const control = (0,
|
|
1236
|
+
const control = (0, import_vue15.h)("input", {
|
|
1027
1237
|
...controlAttrs,
|
|
1028
1238
|
id: ids.controlId,
|
|
1029
1239
|
"data-mason-slot": "control",
|
|
@@ -1055,9 +1265,9 @@ var TextField = (0, import_vue12.defineComponent)({
|
|
|
1055
1265
|
}
|
|
1056
1266
|
});
|
|
1057
1267
|
|
|
1058
|
-
// src/Select.ts
|
|
1059
|
-
var
|
|
1060
|
-
var Select = (0,
|
|
1268
|
+
// src/compounds/Select.ts
|
|
1269
|
+
var import_vue16 = require("vue");
|
|
1270
|
+
var Select = (0, import_vue16.defineComponent)({
|
|
1061
1271
|
name: "MasonSelect",
|
|
1062
1272
|
inheritAttrs: false,
|
|
1063
1273
|
props: {
|
|
@@ -1120,13 +1330,13 @@ var Select = (0, import_vue13.defineComponent)({
|
|
|
1120
1330
|
const forwarded = attrChange;
|
|
1121
1331
|
const options = [];
|
|
1122
1332
|
if (props.placeholder) {
|
|
1123
|
-
options.push((0,
|
|
1333
|
+
options.push((0, import_vue16.h)("option", { value: "" }, props.placeholder));
|
|
1124
1334
|
}
|
|
1125
1335
|
const provided = slots.default?.();
|
|
1126
1336
|
if (provided) {
|
|
1127
1337
|
options.push(provided);
|
|
1128
1338
|
}
|
|
1129
|
-
const control = (0,
|
|
1339
|
+
const control = (0, import_vue16.h)(
|
|
1130
1340
|
"select",
|
|
1131
1341
|
{
|
|
1132
1342
|
...controlAttrs,
|
|
@@ -1162,13 +1372,14 @@ var Select = (0, import_vue13.defineComponent)({
|
|
|
1162
1372
|
}
|
|
1163
1373
|
});
|
|
1164
1374
|
|
|
1165
|
-
// src/Checkbox.ts
|
|
1166
|
-
var
|
|
1375
|
+
// src/compounds/Checkbox.ts
|
|
1376
|
+
var import_vue17 = require("vue");
|
|
1167
1377
|
|
|
1168
|
-
// src/checkboxStyles.ts
|
|
1378
|
+
// src/compounds/checkboxStyles.ts
|
|
1169
1379
|
var CONTROL_SIZE = "1.125rem";
|
|
1170
1380
|
function checkboxRootStyle() {
|
|
1171
1381
|
return {
|
|
1382
|
+
position: "relative",
|
|
1172
1383
|
display: "flex",
|
|
1173
1384
|
flexDirection: "column",
|
|
1174
1385
|
gap: spacingVar("stack", "sm"),
|
|
@@ -1201,8 +1412,8 @@ function checkboxIndicatorStyle() {
|
|
|
1201
1412
|
};
|
|
1202
1413
|
}
|
|
1203
1414
|
|
|
1204
|
-
// src/Checkbox.ts
|
|
1205
|
-
var Checkbox = (0,
|
|
1415
|
+
// src/compounds/Checkbox.ts
|
|
1416
|
+
var Checkbox = (0, import_vue17.defineComponent)({
|
|
1206
1417
|
name: "MasonCheckbox",
|
|
1207
1418
|
inheritAttrs: false,
|
|
1208
1419
|
props: {
|
|
@@ -1255,7 +1466,7 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1255
1466
|
};
|
|
1256
1467
|
const forwarded = attrChange;
|
|
1257
1468
|
const children = [
|
|
1258
|
-
(0,
|
|
1469
|
+
(0, import_vue17.h)(
|
|
1259
1470
|
"label",
|
|
1260
1471
|
{
|
|
1261
1472
|
"data-mason-slot": "label",
|
|
@@ -1263,7 +1474,7 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1263
1474
|
style: checkboxLabelStyle(props.disabled)
|
|
1264
1475
|
},
|
|
1265
1476
|
[
|
|
1266
|
-
(0,
|
|
1477
|
+
(0, import_vue17.h)("input", {
|
|
1267
1478
|
...controlAttrs,
|
|
1268
1479
|
type: "checkbox",
|
|
1269
1480
|
id: ids.controlId,
|
|
@@ -1275,18 +1486,18 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1275
1486
|
onChange: forwarded ? [emitChange, forwarded] : emitChange,
|
|
1276
1487
|
style: visuallyHiddenControlStyle()
|
|
1277
1488
|
}),
|
|
1278
|
-
(0,
|
|
1489
|
+
(0, import_vue17.h)("span", {
|
|
1279
1490
|
"data-mason-slot": "indicator",
|
|
1280
1491
|
"aria-hidden": "true",
|
|
1281
1492
|
style: checkboxIndicatorStyle()
|
|
1282
1493
|
}),
|
|
1283
|
-
label ? (0,
|
|
1494
|
+
label ? (0, import_vue17.h)("span", { "data-mason-slot": "label-text" }, label) : null
|
|
1284
1495
|
]
|
|
1285
1496
|
)
|
|
1286
1497
|
];
|
|
1287
1498
|
if (description) {
|
|
1288
1499
|
children.push(
|
|
1289
|
-
(0,
|
|
1500
|
+
(0, import_vue17.h)(
|
|
1290
1501
|
"p",
|
|
1291
1502
|
{
|
|
1292
1503
|
"data-mason-slot": "description",
|
|
@@ -1299,7 +1510,7 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1299
1510
|
}
|
|
1300
1511
|
if (error) {
|
|
1301
1512
|
children.push(
|
|
1302
|
-
(0,
|
|
1513
|
+
(0, import_vue17.h)(
|
|
1303
1514
|
"p",
|
|
1304
1515
|
{
|
|
1305
1516
|
"data-mason-slot": "error",
|
|
@@ -1311,7 +1522,7 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1311
1522
|
)
|
|
1312
1523
|
);
|
|
1313
1524
|
}
|
|
1314
|
-
return (0,
|
|
1525
|
+
return (0, import_vue17.h)(
|
|
1315
1526
|
"div",
|
|
1316
1527
|
{
|
|
1317
1528
|
"data-mason-component": "checkbox",
|
|
@@ -1326,13 +1537,14 @@ var Checkbox = (0, import_vue14.defineComponent)({
|
|
|
1326
1537
|
}
|
|
1327
1538
|
});
|
|
1328
1539
|
|
|
1329
|
-
// src/Radio.ts
|
|
1330
|
-
var
|
|
1540
|
+
// src/compounds/Radio.ts
|
|
1541
|
+
var import_vue18 = require("vue");
|
|
1331
1542
|
|
|
1332
|
-
// src/radioStyles.ts
|
|
1543
|
+
// src/compounds/radioStyles.ts
|
|
1333
1544
|
var CONTROL_SIZE2 = "1.125rem";
|
|
1334
1545
|
function radioRootStyle() {
|
|
1335
1546
|
return {
|
|
1547
|
+
position: "relative",
|
|
1336
1548
|
display: "flex",
|
|
1337
1549
|
flexDirection: "column",
|
|
1338
1550
|
gap: spacingVar("stack", "sm"),
|
|
@@ -1365,8 +1577,8 @@ function radioIndicatorStyle() {
|
|
|
1365
1577
|
};
|
|
1366
1578
|
}
|
|
1367
1579
|
|
|
1368
|
-
// src/Radio.ts
|
|
1369
|
-
var Radio = (0,
|
|
1580
|
+
// src/compounds/Radio.ts
|
|
1581
|
+
var Radio = (0, import_vue18.defineComponent)({
|
|
1370
1582
|
name: "MasonRadio",
|
|
1371
1583
|
inheritAttrs: false,
|
|
1372
1584
|
props: {
|
|
@@ -1425,7 +1637,7 @@ var Radio = (0, import_vue15.defineComponent)({
|
|
|
1425
1637
|
const forwarded = attrChange;
|
|
1426
1638
|
const checked = props.modelValue === void 0 || props.value === void 0 ? void 0 : props.modelValue === props.value;
|
|
1427
1639
|
const children = [
|
|
1428
|
-
(0,
|
|
1640
|
+
(0, import_vue18.h)(
|
|
1429
1641
|
"label",
|
|
1430
1642
|
{
|
|
1431
1643
|
"data-mason-slot": "label",
|
|
@@ -1433,7 +1645,7 @@ var Radio = (0, import_vue15.defineComponent)({
|
|
|
1433
1645
|
style: radioLabelStyle(props.disabled)
|
|
1434
1646
|
},
|
|
1435
1647
|
[
|
|
1436
|
-
(0,
|
|
1648
|
+
(0, import_vue18.h)("input", {
|
|
1437
1649
|
...controlAttrs,
|
|
1438
1650
|
type: "radio",
|
|
1439
1651
|
id: ids.controlId,
|
|
@@ -1446,18 +1658,18 @@ var Radio = (0, import_vue15.defineComponent)({
|
|
|
1446
1658
|
onChange: forwarded ? [emitChange, forwarded] : emitChange,
|
|
1447
1659
|
style: visuallyHiddenControlStyle()
|
|
1448
1660
|
}),
|
|
1449
|
-
(0,
|
|
1661
|
+
(0, import_vue18.h)("span", {
|
|
1450
1662
|
"data-mason-slot": "indicator",
|
|
1451
1663
|
"aria-hidden": "true",
|
|
1452
1664
|
style: radioIndicatorStyle()
|
|
1453
1665
|
}),
|
|
1454
|
-
label ? (0,
|
|
1666
|
+
label ? (0, import_vue18.h)("span", { "data-mason-slot": "label-text" }, label) : null
|
|
1455
1667
|
]
|
|
1456
1668
|
)
|
|
1457
1669
|
];
|
|
1458
1670
|
if (description) {
|
|
1459
1671
|
children.push(
|
|
1460
|
-
(0,
|
|
1672
|
+
(0, import_vue18.h)(
|
|
1461
1673
|
"p",
|
|
1462
1674
|
{
|
|
1463
1675
|
"data-mason-slot": "description",
|
|
@@ -1470,7 +1682,7 @@ var Radio = (0, import_vue15.defineComponent)({
|
|
|
1470
1682
|
}
|
|
1471
1683
|
if (error) {
|
|
1472
1684
|
children.push(
|
|
1473
|
-
(0,
|
|
1685
|
+
(0, import_vue18.h)(
|
|
1474
1686
|
"p",
|
|
1475
1687
|
{
|
|
1476
1688
|
"data-mason-slot": "error",
|
|
@@ -1482,7 +1694,7 @@ var Radio = (0, import_vue15.defineComponent)({
|
|
|
1482
1694
|
)
|
|
1483
1695
|
);
|
|
1484
1696
|
}
|
|
1485
|
-
return (0,
|
|
1697
|
+
return (0, import_vue18.h)(
|
|
1486
1698
|
"div",
|
|
1487
1699
|
{
|
|
1488
1700
|
"data-mason-component": "radio",
|
|
@@ -1496,14 +1708,212 @@ var Radio = (0, import_vue15.defineComponent)({
|
|
|
1496
1708
|
};
|
|
1497
1709
|
}
|
|
1498
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
|
+
});
|
|
1499
1906
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1500
1907
|
0 && (module.exports = {
|
|
1501
1908
|
Badge,
|
|
1909
|
+
Box,
|
|
1502
1910
|
Button,
|
|
1503
1911
|
Callout,
|
|
1504
1912
|
Card,
|
|
1505
1913
|
Checkbox,
|
|
1914
|
+
Container,
|
|
1506
1915
|
Divider,
|
|
1916
|
+
Grid,
|
|
1507
1917
|
Link,
|
|
1508
1918
|
MasonProvider,
|
|
1509
1919
|
Radio,
|
|
@@ -1511,6 +1921,7 @@ var Radio = (0, import_vue15.defineComponent)({
|
|
|
1511
1921
|
Spinner,
|
|
1512
1922
|
Stack,
|
|
1513
1923
|
Text,
|
|
1514
|
-
TextField
|
|
1924
|
+
TextField,
|
|
1925
|
+
Toggle
|
|
1515
1926
|
});
|
|
1516
1927
|
//# sourceMappingURL=index.cjs.map
|