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