ropav 0.0.4 → 0.0.6
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/README.md +21 -43
- package/dist/base.css +36 -14
- package/dist/button-group.css +50 -0
- package/dist/button-group.js +49 -0
- package/dist/button-group.js.map +1 -0
- package/dist/button.css +73 -43
- package/dist/button.js +41 -40
- package/dist/button.js.map +1 -1
- package/dist/card.css +88 -0
- package/dist/card.js +71 -0
- package/dist/card.js.map +1 -0
- package/dist/checkbox.css +108 -94
- package/dist/checkbox.js +18 -6
- package/dist/checkbox.js.map +1 -1
- package/dist/componentColors.js +22 -0
- package/dist/componentColors.js.map +1 -0
- package/dist/components/button/button.d.ts +2 -0
- package/dist/components/button/types.d.ts +2 -1
- package/dist/components/button/useButtonColor.d.ts +13 -0
- package/dist/components/button-group/button-group.d.ts +21 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +2 -0
- package/dist/components/button-group/types.d.ts +10 -0
- package/dist/components/card/card.d.ts +21 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +2 -0
- package/dist/components/card/types.d.ts +11 -0
- package/dist/components/checkbox/types.d.ts +2 -1
- package/dist/components/checkbox/useCheckbox.d.ts +4 -0
- package/dist/components/field/field.d.ts +35 -0
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/field/index.js +2 -0
- package/dist/components/field/types.d.ts +21 -0
- package/dist/components/icon-button/icon-button.d.ts +21 -0
- package/dist/components/icon-button/index.d.ts +2 -0
- package/dist/components/icon-button/index.js +2 -0
- package/dist/components/icon-button/types.d.ts +15 -0
- package/dist/components/progress/index.d.ts +3 -0
- package/dist/components/progress/index.js +2 -0
- package/dist/components/progress/progress.d.ts +27 -0
- package/dist/components/progress/types.d.ts +24 -0
- package/dist/components/progress/useProgress.d.ts +28 -0
- package/dist/components/radio/types.d.ts +2 -1
- package/dist/components/radio/useRadio.d.ts +4 -0
- package/dist/components/slider/index.d.ts +3 -0
- package/dist/components/slider/index.js +2 -0
- package/dist/components/slider/slider.d.ts +35 -0
- package/dist/components/slider/types.d.ts +50 -0
- package/dist/components/slider/useSlider.d.ts +50 -0
- package/dist/components/switch/types.d.ts +2 -1
- package/dist/components/switch/useSwitch.d.ts +3 -0
- package/dist/components/textarea/index.d.ts +1 -1
- package/dist/components/textarea/types.d.ts +5 -0
- package/dist/components/textarea/useTextarea.d.ts +2 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +2 -0
- package/dist/components/tooltip/tooltip.d.ts +27 -0
- package/dist/components/tooltip/types.d.ts +29 -0
- package/dist/components/tooltip/useTooltip.d.ts +17 -0
- package/dist/field.css +40 -0
- package/dist/field.js +128 -0
- package/dist/field.js.map +1 -0
- package/dist/icon-button.css +372 -0
- package/dist/icon-button.js +67 -0
- package/dist/icon-button.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +9 -1
- package/dist/input.css +2 -2
- package/dist/progress.css +125 -0
- package/dist/progress.js +177 -0
- package/dist/progress.js.map +1 -0
- package/dist/radio.css +83 -83
- package/dist/radio.js +18 -6
- package/dist/radio.js.map +1 -1
- package/dist/select.css +16 -4
- package/dist/select.js +7 -0
- package/dist/select.js.map +1 -1
- package/dist/slider.css +438 -0
- package/dist/slider.js +412 -0
- package/dist/slider.js.map +1 -0
- package/dist/switch.css +79 -70
- package/dist/switch.js +15 -6
- package/dist/switch.js.map +1 -1
- package/dist/textarea.css +35 -28
- package/dist/textarea.js +106 -15
- package/dist/textarea.js.map +1 -1
- package/dist/tooltip.css +136 -0
- package/dist/tooltip.js +384 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/useButtonColor.js +33 -0
- package/dist/useButtonColor.js.map +1 -0
- package/package.json +30 -2
- package/src/styles/_mixins.scss +17 -0
- package/src/styles/_tokens.scss +14 -13
- package/src/styles/_utilities.scss +13 -0
- package/src/styles/_variables.scss +2 -1
- package/src/styles/base.scss +1 -0
package/dist/input.css
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
--_rp-input-radius: var(--rp-radius-sm);
|
|
6
6
|
--_rp-input-valid-border: var(--rp-color-success-border-hover);
|
|
7
7
|
--_rp-input-valid-ring: color-mix(in srgb, var(--rp-color-success) 32%, transparent);
|
|
8
|
-
--_rp-input-invalid-border: var(--rp-color-danger
|
|
8
|
+
--_rp-input-invalid-border: var(--rp-color-danger);
|
|
9
9
|
--_rp-input-invalid-ring: color-mix(in srgb, var(--rp-color-danger) 32%, transparent);
|
|
10
10
|
display: inline-flex;
|
|
11
11
|
align-items: center;
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
--_rp-input-font-size: var(--rp-font-size-lg);
|
|
59
59
|
}
|
|
60
60
|
.rp-input--radius-xs[data-v-fedf15e7] {
|
|
61
|
-
--_rp-input-radius: var(--rp-radius-
|
|
61
|
+
--_rp-input-radius: var(--rp-radius-xs);
|
|
62
62
|
}
|
|
63
63
|
.rp-input--radius-sm[data-v-fedf15e7] {
|
|
64
64
|
--_rp-input-radius: var(--rp-radius-sm);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
.rp-progress[data-v-7870ef03] {
|
|
2
|
+
--_rp-progress-color: var(--_rp-progress-custom-color, var(--rp-color-control-selected-bg));
|
|
3
|
+
--_rp-progress-track-bg: var(--rp-color-control-track-bg);
|
|
4
|
+
--_rp-progress-track-height: 8px;
|
|
5
|
+
--_rp-progress-font-size: var(--rp-font-size-base);
|
|
6
|
+
--_rp-progress-radius: var(--rp-radius-full);
|
|
7
|
+
--_rp-progress-value: 0%;
|
|
8
|
+
--_rp-progress-ratio: 0;
|
|
9
|
+
display: grid;
|
|
10
|
+
width: 100%;
|
|
11
|
+
min-width: 0;
|
|
12
|
+
gap: var(--rp-spacing-2);
|
|
13
|
+
font-family: var(--rp-font-family);
|
|
14
|
+
font-size: var(--_rp-progress-font-size);
|
|
15
|
+
line-height: var(--rp-line-height-normal);
|
|
16
|
+
}
|
|
17
|
+
.rp-progress__header[data-v-7870ef03] {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
gap: var(--rp-spacing-3);
|
|
23
|
+
}
|
|
24
|
+
.rp-progress__label[data-v-7870ef03] {
|
|
25
|
+
min-width: 0;
|
|
26
|
+
color: var(--rp-color-text);
|
|
27
|
+
}
|
|
28
|
+
.rp-progress__value[data-v-7870ef03] {
|
|
29
|
+
flex-shrink: 0;
|
|
30
|
+
color: var(--rp-color-text-secondary);
|
|
31
|
+
font-variant-numeric: tabular-nums;
|
|
32
|
+
}
|
|
33
|
+
.rp-progress__track[data-v-7870ef03] {
|
|
34
|
+
position: relative;
|
|
35
|
+
display: block;
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: var(--_rp-progress-track-height);
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
background: var(--_rp-progress-track-bg);
|
|
40
|
+
border-radius: var(--_rp-progress-radius);
|
|
41
|
+
}
|
|
42
|
+
.rp-progress__indicator[data-v-7870ef03] {
|
|
43
|
+
display: block;
|
|
44
|
+
width: var(--_rp-progress-value);
|
|
45
|
+
height: 100%;
|
|
46
|
+
background: var(--_rp-progress-color);
|
|
47
|
+
border-radius: inherit;
|
|
48
|
+
transition: width var(--rp-transition-base);
|
|
49
|
+
}
|
|
50
|
+
.rp-progress--indeterminate .rp-progress__indicator[data-v-7870ef03] {
|
|
51
|
+
position: absolute;
|
|
52
|
+
width: 38%;
|
|
53
|
+
min-width: 2rem;
|
|
54
|
+
animation: rp-progress-indeterminate-7870ef03 1200ms ease-in-out infinite;
|
|
55
|
+
}
|
|
56
|
+
.rp-progress--color-primary[data-v-7870ef03] {
|
|
57
|
+
--_rp-progress-color: var(--rp-color-primary);
|
|
58
|
+
}
|
|
59
|
+
.rp-progress--color-secondary[data-v-7870ef03] {
|
|
60
|
+
--_rp-progress-color: var(--rp-color-secondary);
|
|
61
|
+
}
|
|
62
|
+
.rp-progress--color-success[data-v-7870ef03] {
|
|
63
|
+
--_rp-progress-color: var(--rp-color-success);
|
|
64
|
+
}
|
|
65
|
+
.rp-progress--color-warning[data-v-7870ef03] {
|
|
66
|
+
--_rp-progress-color: var(--rp-color-warning);
|
|
67
|
+
}
|
|
68
|
+
.rp-progress--color-danger[data-v-7870ef03] {
|
|
69
|
+
--_rp-progress-color: var(--rp-color-danger);
|
|
70
|
+
}
|
|
71
|
+
.rp-progress--color-info[data-v-7870ef03] {
|
|
72
|
+
--_rp-progress-color: var(--rp-color-info);
|
|
73
|
+
}
|
|
74
|
+
.rp-progress--color-neutral[data-v-7870ef03] {
|
|
75
|
+
--_rp-progress-color: var(--rp-color-neutral);
|
|
76
|
+
}
|
|
77
|
+
.rp-progress--size-xs[data-v-7870ef03] {
|
|
78
|
+
--_rp-progress-track-height: 4px;
|
|
79
|
+
--_rp-progress-font-size: var(--rp-font-size-xs);
|
|
80
|
+
}
|
|
81
|
+
.rp-progress--size-sm[data-v-7870ef03] {
|
|
82
|
+
--_rp-progress-track-height: 6px;
|
|
83
|
+
--_rp-progress-font-size: var(--rp-font-size-sm);
|
|
84
|
+
}
|
|
85
|
+
.rp-progress--size-md[data-v-7870ef03] {
|
|
86
|
+
--_rp-progress-track-height: 8px;
|
|
87
|
+
--_rp-progress-font-size: var(--rp-font-size-base);
|
|
88
|
+
}
|
|
89
|
+
.rp-progress--size-lg[data-v-7870ef03] {
|
|
90
|
+
--_rp-progress-track-height: 10px;
|
|
91
|
+
--_rp-progress-font-size: var(--rp-font-size-lg);
|
|
92
|
+
}
|
|
93
|
+
.rp-progress--size-xl[data-v-7870ef03] {
|
|
94
|
+
--_rp-progress-track-height: 12px;
|
|
95
|
+
--_rp-progress-font-size: var(--rp-font-size-xl);
|
|
96
|
+
}
|
|
97
|
+
.rp-progress--radius-none[data-v-7870ef03] {
|
|
98
|
+
--_rp-progress-radius: var(--rp-radius-none);
|
|
99
|
+
}
|
|
100
|
+
.rp-progress--radius-xs[data-v-7870ef03] {
|
|
101
|
+
--_rp-progress-radius: var(--rp-radius-xs);
|
|
102
|
+
}
|
|
103
|
+
.rp-progress--radius-sm[data-v-7870ef03] {
|
|
104
|
+
--_rp-progress-radius: var(--rp-radius-sm);
|
|
105
|
+
}
|
|
106
|
+
.rp-progress--radius-md[data-v-7870ef03] {
|
|
107
|
+
--_rp-progress-radius: var(--rp-radius-md);
|
|
108
|
+
}
|
|
109
|
+
.rp-progress--radius-lg[data-v-7870ef03] {
|
|
110
|
+
--_rp-progress-radius: var(--rp-radius-lg);
|
|
111
|
+
}
|
|
112
|
+
.rp-progress--radius-xl[data-v-7870ef03] {
|
|
113
|
+
--_rp-progress-radius: var(--rp-radius-xl);
|
|
114
|
+
}
|
|
115
|
+
.rp-progress--radius-full[data-v-7870ef03] {
|
|
116
|
+
--_rp-progress-radius: var(--rp-radius-full);
|
|
117
|
+
}
|
|
118
|
+
@keyframes rp-progress-indeterminate-7870ef03 {
|
|
119
|
+
0% {
|
|
120
|
+
transform: translateX(-110%);
|
|
121
|
+
}
|
|
122
|
+
100% {
|
|
123
|
+
transform: translateX(270%);
|
|
124
|
+
}
|
|
125
|
+
}
|
package/dist/progress.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import './progress.css';
|
|
2
|
+
import { n as getComponentCustomColor, r as isComponentPresetColor, t as componentColors } from "./componentColors.js";
|
|
3
|
+
import { n as bem, t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
4
|
+
import { t as useControlState } from "./useControlState.js";
|
|
5
|
+
import { computed, createIf, createSlot, defineVaporComponent, renderEffect, setAttr, setClass, setInsertionState, setProp, setStyle, setText, template, toDisplayString, unref } from "vue";
|
|
6
|
+
//#region src/components/progress/useProgress.ts
|
|
7
|
+
function normalizeProgressBounds(min, max) {
|
|
8
|
+
const safeMin = Number.isFinite(min) ? min : 0;
|
|
9
|
+
const safeMax = Number.isFinite(max) ? max : 100;
|
|
10
|
+
return safeMax >= safeMin ? {
|
|
11
|
+
min: safeMin,
|
|
12
|
+
max: safeMax
|
|
13
|
+
} : {
|
|
14
|
+
min: safeMax,
|
|
15
|
+
max: safeMin
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function normalizeProgressValue(value, min, max) {
|
|
19
|
+
const safeValue = Number.isFinite(value) ? Number(value) : min;
|
|
20
|
+
return Math.min(max, Math.max(min, safeValue));
|
|
21
|
+
}
|
|
22
|
+
function getProgressValuePercent(value, min, max) {
|
|
23
|
+
if (max <= min) return 0;
|
|
24
|
+
const percent = (value - min) / (max - min) * 100;
|
|
25
|
+
return Math.min(100, Math.max(0, percent));
|
|
26
|
+
}
|
|
27
|
+
function getFormattedProgressValue(value, percent, formatter) {
|
|
28
|
+
return formatter ? formatter(value, percent) : `${Math.round(percent)}%`;
|
|
29
|
+
}
|
|
30
|
+
function getProgressAriaValueText(value, percent, ariaValueText, formatter) {
|
|
31
|
+
if (typeof ariaValueText === "function") return String(ariaValueText(value, percent));
|
|
32
|
+
if (ariaValueText != null && ariaValueText !== "") return String(ariaValueText);
|
|
33
|
+
if (formatter) return String(formatter(value, percent));
|
|
34
|
+
}
|
|
35
|
+
function setProgressStyleValue(style, property, value) {
|
|
36
|
+
if (value) style[property] = value;
|
|
37
|
+
}
|
|
38
|
+
function useProgress(props) {
|
|
39
|
+
const control = useControlState(props);
|
|
40
|
+
const bounds = computed(() => normalizeProgressBounds(props.min, props.max));
|
|
41
|
+
const isIndeterminate = computed(() => props.indeterminate || props.value == null);
|
|
42
|
+
const normalizedValue = computed(() => normalizeProgressValue(props.value, bounds.value.min, bounds.value.max));
|
|
43
|
+
const valuePercent = computed(() => getProgressValuePercent(normalizedValue.value, bounds.value.min, bounds.value.max));
|
|
44
|
+
const formattedValue = computed(() => getFormattedProgressValue(normalizedValue.value, valuePercent.value, props.formatValue));
|
|
45
|
+
const ariaValueText = computed(() => isIndeterminate.value ? void 0 : getProgressAriaValueText(normalizedValue.value, valuePercent.value, props.ariaValueText, props.formatValue));
|
|
46
|
+
return {
|
|
47
|
+
control,
|
|
48
|
+
rootClass: computed(() => bem("rp-progress", {
|
|
49
|
+
[`color-${props.color}`]: isComponentPresetColor(props.color),
|
|
50
|
+
[`size-${props.size}`]: Boolean(props.size),
|
|
51
|
+
[`radius-${props.radius}`]: Boolean(props.radius),
|
|
52
|
+
indeterminate: isIndeterminate.value
|
|
53
|
+
})),
|
|
54
|
+
rootStyle: computed(() => {
|
|
55
|
+
const style = {
|
|
56
|
+
"--_rp-progress-value": `${valuePercent.value}%`,
|
|
57
|
+
"--_rp-progress-ratio": `${valuePercent.value / 100}`
|
|
58
|
+
};
|
|
59
|
+
setProgressStyleValue(style, "--_rp-progress-custom-color", getComponentCustomColor(props.color));
|
|
60
|
+
return style;
|
|
61
|
+
}),
|
|
62
|
+
isIndeterminate,
|
|
63
|
+
normalizedValue,
|
|
64
|
+
valuePercent,
|
|
65
|
+
formattedValue,
|
|
66
|
+
ariaValueText,
|
|
67
|
+
ariaValueMin: computed(() => isIndeterminate.value ? void 0 : bounds.value.min),
|
|
68
|
+
ariaValueMax: computed(() => isIndeterminate.value ? void 0 : bounds.value.max),
|
|
69
|
+
ariaValueNow: computed(() => isIndeterminate.value ? void 0 : normalizedValue.value)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/components/progress/progress.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
74
|
+
var t0 = template("<span data-v-7870ef03 class=rp-progress__label>");
|
|
75
|
+
var t1 = template(" ");
|
|
76
|
+
var t2 = template("<span data-v-7870ef03 class=rp-progress__value aria-hidden=true>");
|
|
77
|
+
var t3 = template("<span data-v-7870ef03 class=rp-progress__header>");
|
|
78
|
+
var t4 = template("<div data-v-7870ef03 role=progressbar><span data-v-7870ef03 class=rp-progress__track aria-hidden=true><span data-v-7870ef03 class=rp-progress__indicator>", 1);
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/components/progress/progress.vue
|
|
81
|
+
var progress_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
82
|
+
name: "RpProgress",
|
|
83
|
+
__name: "progress",
|
|
84
|
+
props: {
|
|
85
|
+
id: {},
|
|
86
|
+
value: {},
|
|
87
|
+
min: { default: 0 },
|
|
88
|
+
max: { default: 100 },
|
|
89
|
+
color: {},
|
|
90
|
+
size: {},
|
|
91
|
+
radius: {},
|
|
92
|
+
indeterminate: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: false
|
|
95
|
+
},
|
|
96
|
+
showValue: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: false
|
|
99
|
+
},
|
|
100
|
+
formatValue: {},
|
|
101
|
+
ariaLabel: {},
|
|
102
|
+
ariaValueText: {},
|
|
103
|
+
describedby: {},
|
|
104
|
+
labelledby: {}
|
|
105
|
+
},
|
|
106
|
+
setup(__props, { slots: $slots }) {
|
|
107
|
+
const { control, rootClass, rootStyle, isIndeterminate, normalizedValue, valuePercent, formattedValue, ariaValueText, ariaValueMin, ariaValueMax, ariaValueNow } = useProgress(__props);
|
|
108
|
+
const n15 = t4();
|
|
109
|
+
renderEffect(() => {
|
|
110
|
+
const _control = unref(control);
|
|
111
|
+
setProp(n15, "id", _control.id);
|
|
112
|
+
setClass(n15, unref(rootClass));
|
|
113
|
+
setStyle(n15, unref(rootStyle));
|
|
114
|
+
setAttr(n15, "data-state", unref(isIndeterminate) ? "indeterminate" : "determinate");
|
|
115
|
+
setAttr(n15, "aria-label", __props.ariaLabel || void 0);
|
|
116
|
+
setAttr(n15, "aria-labelledby", _control.ariaLabelledby);
|
|
117
|
+
setAttr(n15, "aria-describedby", _control.ariaDescribedby);
|
|
118
|
+
setAttr(n15, "aria-valuemin", unref(ariaValueMin));
|
|
119
|
+
setAttr(n15, "aria-valuemax", unref(ariaValueMax));
|
|
120
|
+
setAttr(n15, "aria-valuenow", unref(ariaValueNow));
|
|
121
|
+
setAttr(n15, "aria-valuetext", unref(ariaValueText));
|
|
122
|
+
});
|
|
123
|
+
setInsertionState(n15, 0, 0);
|
|
124
|
+
createIf(() => $slots.default || !unref(isIndeterminate) && ($slots.value || __props.showValue), () => {
|
|
125
|
+
const n14 = t3();
|
|
126
|
+
setInsertionState(n14, null, 0);
|
|
127
|
+
createIf(() => $slots.default, () => {
|
|
128
|
+
const n5 = t0();
|
|
129
|
+
setInsertionState(n5, null, 0);
|
|
130
|
+
createSlot("default", null, null, 1);
|
|
131
|
+
return n5;
|
|
132
|
+
});
|
|
133
|
+
setInsertionState(n14, null, 1);
|
|
134
|
+
createIf(() => !unref(isIndeterminate) && ($slots.value || __props.showValue), () => {
|
|
135
|
+
const n13 = t2();
|
|
136
|
+
setInsertionState(n13, null, 0);
|
|
137
|
+
createIf(() => $slots.value, () => {
|
|
138
|
+
return createSlot("value", {
|
|
139
|
+
value: () => unref(normalizedValue),
|
|
140
|
+
formattedValue: () => unref(formattedValue),
|
|
141
|
+
percent: () => unref(valuePercent)
|
|
142
|
+
}, null, 1);
|
|
143
|
+
}, () => {
|
|
144
|
+
const n12 = t1();
|
|
145
|
+
renderEffect(() => setText(n12, toDisplayString(unref(formattedValue))));
|
|
146
|
+
return n12;
|
|
147
|
+
}, 517);
|
|
148
|
+
return n13;
|
|
149
|
+
});
|
|
150
|
+
return n14;
|
|
151
|
+
});
|
|
152
|
+
return n15;
|
|
153
|
+
}
|
|
154
|
+
}), [["__scopeId", "data-v-7870ef03"]]);
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/components/progress/types.ts
|
|
157
|
+
var progressColors = componentColors;
|
|
158
|
+
var progressSizes = [
|
|
159
|
+
"xs",
|
|
160
|
+
"sm",
|
|
161
|
+
"md",
|
|
162
|
+
"lg",
|
|
163
|
+
"xl"
|
|
164
|
+
];
|
|
165
|
+
var progressRadiuses = [
|
|
166
|
+
"none",
|
|
167
|
+
"xs",
|
|
168
|
+
"sm",
|
|
169
|
+
"md",
|
|
170
|
+
"lg",
|
|
171
|
+
"xl",
|
|
172
|
+
"full"
|
|
173
|
+
];
|
|
174
|
+
//#endregion
|
|
175
|
+
export { progress_default as i, progressRadiuses as n, progressSizes as r, progressColors as t };
|
|
176
|
+
|
|
177
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","names":[],"sources":["../src/components/progress/useProgress.ts","../src/components/progress/progress.vue","../src/components/progress/progress.vue","../src/components/progress/types.ts"],"sourcesContent":["import { computed, type CSSProperties } from 'vue';\nimport { useControlState } from '@/composables/useControlState';\nimport { bem } from '@/utils/bem';\nimport { getComponentCustomColor, isComponentPresetColor } from '@/utils/componentColors';\nimport type { ProgressProps } from './types';\n\ntype ProgressStateProps = Readonly<\n ProgressProps & {\n min: number;\n max: number;\n indeterminate: boolean;\n showValue: boolean;\n }\n>;\n\nexport function normalizeProgressBounds(min: number, max: number) {\n const safeMin = Number.isFinite(min) ? min : 0;\n const safeMax = Number.isFinite(max) ? max : 100;\n\n return safeMax >= safeMin ? { min: safeMin, max: safeMax } : { min: safeMax, max: safeMin };\n}\n\nexport function normalizeProgressValue(value: number | null | undefined, min: number, max: number) {\n const safeValue = Number.isFinite(value) ? Number(value) : min;\n\n return Math.min(max, Math.max(min, safeValue));\n}\n\nexport function getProgressValuePercent(value: number, min: number, max: number) {\n if (max <= min) return 0;\n\n const percent = ((value - min) / (max - min)) * 100;\n return Math.min(100, Math.max(0, percent));\n}\n\nfunction getFormattedProgressValue(\n value: number,\n percent: number,\n formatter: ProgressProps['formatValue'],\n) {\n return formatter ? formatter(value, percent) : `${Math.round(percent)}%`;\n}\n\nfunction getProgressAriaValueText(\n value: number,\n percent: number,\n ariaValueText: ProgressProps['ariaValueText'],\n formatter: ProgressProps['formatValue'],\n) {\n if (typeof ariaValueText === 'function') return String(ariaValueText(value, percent));\n if (ariaValueText != null && ariaValueText !== '') return String(ariaValueText);\n if (formatter) return String(formatter(value, percent));\n\n return undefined;\n}\n\nfunction setProgressStyleValue(\n style: CSSProperties,\n property: `--_rp-progress-${string}`,\n value: string | undefined,\n) {\n if (value) {\n style[property] = value;\n }\n}\n\nexport function useProgress(props: ProgressStateProps) {\n const control = useControlState(props);\n\n const bounds = computed(() => normalizeProgressBounds(props.min, props.max));\n const isIndeterminate = computed(() => props.indeterminate || props.value == null);\n const normalizedValue = computed(() =>\n normalizeProgressValue(props.value, bounds.value.min, bounds.value.max),\n );\n const valuePercent = computed(() =>\n getProgressValuePercent(normalizedValue.value, bounds.value.min, bounds.value.max),\n );\n const formattedValue = computed(() =>\n getFormattedProgressValue(normalizedValue.value, valuePercent.value, props.formatValue),\n );\n const ariaValueText = computed(() =>\n isIndeterminate.value\n ? undefined\n : getProgressAriaValueText(\n normalizedValue.value,\n valuePercent.value,\n props.ariaValueText,\n props.formatValue,\n ),\n );\n const rootClass = computed(() =>\n bem('rp-progress', {\n [`color-${props.color}`]: isComponentPresetColor(props.color),\n [`size-${props.size}`]: Boolean(props.size),\n [`radius-${props.radius}`]: Boolean(props.radius),\n indeterminate: isIndeterminate.value,\n }),\n );\n const rootStyle = computed<CSSProperties>(() => {\n const style: CSSProperties = {\n '--_rp-progress-value': `${valuePercent.value}%`,\n '--_rp-progress-ratio': `${valuePercent.value / 100}`,\n };\n\n setProgressStyleValue(\n style,\n '--_rp-progress-custom-color',\n getComponentCustomColor(props.color),\n );\n\n return style;\n });\n\n return {\n control,\n rootClass,\n rootStyle,\n isIndeterminate,\n normalizedValue,\n valuePercent,\n formattedValue,\n ariaValueText,\n ariaValueMin: computed(() => (isIndeterminate.value ? undefined : bounds.value.min)),\n ariaValueMax: computed(() => (isIndeterminate.value ? undefined : bounds.value.max)),\n ariaValueNow: computed(() => (isIndeterminate.value ? undefined : normalizedValue.value)),\n };\n}\n","<template>\n <div\n :id=\"control.id\"\n :class=\"rootClass\"\n :style=\"rootStyle\"\n role=\"progressbar\"\n :data-state=\"isIndeterminate ? 'indeterminate' : 'determinate'\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :aria-valuemin=\"ariaValueMin\"\n :aria-valuemax=\"ariaValueMax\"\n :aria-valuenow=\"ariaValueNow\"\n :aria-valuetext=\"ariaValueText\"\n >\n <span\n v-if=\"$slots.default || (!isIndeterminate && ($slots.value || showValue))\"\n class=\"rp-progress__header\"\n >\n <span v-if=\"$slots.default\" class=\"rp-progress__label\">\n <slot />\n </span>\n <span\n v-if=\"!isIndeterminate && ($slots.value || showValue)\"\n class=\"rp-progress__value\"\n aria-hidden=\"true\"\n >\n <slot\n v-if=\"$slots.value\"\n name=\"value\"\n :value=\"normalizedValue\"\n :formatted-value=\"formattedValue\"\n :percent=\"valuePercent\"\n />\n <template v-else>{{ formattedValue }}</template>\n </span>\n </span>\n <span class=\"rp-progress__track\" aria-hidden=\"true\">\n <span class=\"rp-progress__indicator\" />\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport type { ProgressProps } from './types';\nimport { useProgress } from './useProgress';\n\ndefineOptions({ name: 'RpProgress' });\n\nconst props = withDefaults(defineProps<ProgressProps>(), {\n min: 0,\n max: 100,\n indeterminate: false,\n showValue: false,\n});\n\nconst {\n control,\n rootClass,\n rootStyle,\n isIndeterminate,\n normalizedValue,\n valuePercent,\n formattedValue,\n ariaValueText,\n ariaValueMin,\n ariaValueMax,\n ariaValueNow,\n} = useProgress(props);\n</script>\n\n<style src=\"./progress.scss\" lang=\"scss\" scoped></style>\n","<template>\n <div\n :id=\"control.id\"\n :class=\"rootClass\"\n :style=\"rootStyle\"\n role=\"progressbar\"\n :data-state=\"isIndeterminate ? 'indeterminate' : 'determinate'\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :aria-valuemin=\"ariaValueMin\"\n :aria-valuemax=\"ariaValueMax\"\n :aria-valuenow=\"ariaValueNow\"\n :aria-valuetext=\"ariaValueText\"\n >\n <span\n v-if=\"$slots.default || (!isIndeterminate && ($slots.value || showValue))\"\n class=\"rp-progress__header\"\n >\n <span v-if=\"$slots.default\" class=\"rp-progress__label\">\n <slot />\n </span>\n <span\n v-if=\"!isIndeterminate && ($slots.value || showValue)\"\n class=\"rp-progress__value\"\n aria-hidden=\"true\"\n >\n <slot\n v-if=\"$slots.value\"\n name=\"value\"\n :value=\"normalizedValue\"\n :formatted-value=\"formattedValue\"\n :percent=\"valuePercent\"\n />\n <template v-else>{{ formattedValue }}</template>\n </span>\n </span>\n <span class=\"rp-progress__track\" aria-hidden=\"true\">\n <span class=\"rp-progress__indicator\" />\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport type { ProgressProps } from './types';\nimport { useProgress } from './useProgress';\n\ndefineOptions({ name: 'RpProgress' });\n\nconst props = withDefaults(defineProps<ProgressProps>(), {\n min: 0,\n max: 100,\n indeterminate: false,\n showValue: false,\n});\n\nconst {\n control,\n rootClass,\n rootStyle,\n isIndeterminate,\n normalizedValue,\n valuePercent,\n formattedValue,\n ariaValueText,\n ariaValueMin,\n ariaValueMax,\n ariaValueNow,\n} = useProgress(props);\n</script>\n\n<style src=\"./progress.scss\" lang=\"scss\" scoped></style>\n","import { componentColors, type ComponentColorValue } from '../../utils/componentColors';\n\nexport const progressColors = componentColors;\n\nexport const progressSizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;\n\nexport const progressRadiuses = ['none', 'xs', 'sm', 'md', 'lg', 'xl', 'full'] as const;\n\nexport type ProgressColor = ComponentColorValue;\n\nexport type ProgressSize = (typeof progressSizes)[number];\n\nexport type ProgressRadius = (typeof progressRadiuses)[number];\n\nexport type ProgressValueFormatter = (value: number, percent: number) => string | number;\n\nexport interface ProgressProps {\n id?: string;\n value?: number | null;\n min?: number;\n max?: number;\n color?: ProgressColor;\n size?: ProgressSize;\n radius?: ProgressRadius;\n indeterminate?: boolean;\n showValue?: boolean;\n formatValue?: ProgressValueFormatter;\n ariaLabel?: string;\n ariaValueText?: string | ProgressValueFormatter;\n describedby?: string;\n labelledby?: string;\n}\n"],"mappings":"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"}
|
package/dist/radio.css
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
.rp-radio[data-v-
|
|
2
|
-
--
|
|
3
|
-
--
|
|
4
|
-
--
|
|
5
|
-
--
|
|
6
|
-
--
|
|
7
|
-
--
|
|
8
|
-
--
|
|
9
|
-
--
|
|
1
|
+
.rp-radio[data-v-18269eb4] {
|
|
2
|
+
--_rp-radio-color: var(--_rp-radio-custom-color, var(--rp-color-control-selected-bg));
|
|
3
|
+
--_rp-radio-on-color: var(--_rp-radio-custom-on-color, var(--rp-color-control-selected-fg));
|
|
4
|
+
--_rp-radio-size: 18px;
|
|
5
|
+
--_rp-radio-dot: 8px;
|
|
6
|
+
--_rp-radio-font-size: var(--rp-font-size-base);
|
|
7
|
+
--_rp-radio-checked-bg: var(--_rp-radio-color);
|
|
8
|
+
--_rp-radio-checked-border: var(--_rp-radio-color);
|
|
9
|
+
--_rp-radio-checked-dot: var(--_rp-radio-on-color);
|
|
10
10
|
display: inline-flex;
|
|
11
11
|
align-items: center;
|
|
12
12
|
cursor: pointer;
|
|
13
13
|
font-family: var(--rp-font-family);
|
|
14
14
|
user-select: none;
|
|
15
15
|
}
|
|
16
|
-
.rp-radio--disabled[data-v-
|
|
16
|
+
.rp-radio--disabled[data-v-18269eb4] {
|
|
17
17
|
opacity: var(--rp-opacity-disabled);
|
|
18
18
|
cursor: not-allowed;
|
|
19
19
|
}
|
|
20
|
-
.rp-radio[data-v-
|
|
20
|
+
.rp-radio[data-v-18269eb4] {
|
|
21
21
|
gap: var(--rp-spacing-2);
|
|
22
|
-
font-size: var(--
|
|
22
|
+
font-size: var(--_rp-radio-font-size);
|
|
23
23
|
}
|
|
24
|
-
.rp-radio__native[data-v-
|
|
24
|
+
.rp-radio__native[data-v-18269eb4] {
|
|
25
25
|
position: absolute;
|
|
26
26
|
width: 1px;
|
|
27
27
|
height: 1px;
|
|
@@ -33,99 +33,99 @@
|
|
|
33
33
|
border-width: 0;
|
|
34
34
|
pointer-events: none;
|
|
35
35
|
}
|
|
36
|
-
.rp-radio__native:focus-visible + .rp-radio__dot[data-v-
|
|
36
|
+
.rp-radio__native:focus-visible + .rp-radio__dot[data-v-18269eb4] {
|
|
37
37
|
border-color: var(--rp-color-primary);
|
|
38
38
|
box-shadow: 0 0 0 var(--rp-border-width-medium) var(--rp-color-focus-ring);
|
|
39
39
|
}
|
|
40
|
-
.rp-radio__dot[data-v-
|
|
40
|
+
.rp-radio__dot[data-v-18269eb4] {
|
|
41
41
|
display: inline-flex;
|
|
42
42
|
align-items: center;
|
|
43
43
|
justify-content: center;
|
|
44
|
-
width: var(--
|
|
45
|
-
height: var(--
|
|
44
|
+
width: var(--_rp-radio-size);
|
|
45
|
+
height: var(--_rp-radio-size);
|
|
46
46
|
flex-shrink: 0;
|
|
47
47
|
border: var(--rp-border-width-medium) solid var(--rp-color-control-border);
|
|
48
48
|
border-radius: var(--rp-radius-full);
|
|
49
49
|
background-color: var(--rp-color-control-bg);
|
|
50
50
|
transition: background-color var(--rp-transition-fast), border-color var(--rp-transition-fast);
|
|
51
51
|
}
|
|
52
|
-
.rp-radio__dot[data-v-
|
|
52
|
+
.rp-radio__dot[data-v-18269eb4]::after {
|
|
53
53
|
content: "";
|
|
54
|
-
width: var(--
|
|
55
|
-
height: var(--
|
|
54
|
+
width: var(--_rp-radio-dot);
|
|
55
|
+
height: var(--_rp-radio-dot);
|
|
56
56
|
border-radius: var(--rp-radius-full);
|
|
57
|
-
background-color: var(--
|
|
57
|
+
background-color: var(--_rp-radio-checked-dot);
|
|
58
58
|
transform: scale(0);
|
|
59
59
|
transition: transform var(--rp-transition-fast);
|
|
60
60
|
}
|
|
61
|
-
.rp-radio--checked .rp-radio__dot[data-v-
|
|
62
|
-
background-color: var(--
|
|
63
|
-
border-color: var(--
|
|
61
|
+
.rp-radio--checked .rp-radio__dot[data-v-18269eb4] {
|
|
62
|
+
background-color: var(--_rp-radio-checked-bg);
|
|
63
|
+
border-color: var(--_rp-radio-checked-border);
|
|
64
64
|
}
|
|
65
|
-
.rp-radio--checked .rp-radio__dot[data-v-
|
|
65
|
+
.rp-radio--checked .rp-radio__dot[data-v-18269eb4]::after {
|
|
66
66
|
transform: scale(1);
|
|
67
67
|
}
|
|
68
|
-
.rp-radio__label[data-v-
|
|
68
|
+
.rp-radio__label[data-v-18269eb4] {
|
|
69
69
|
line-height: var(--rp-line-height-normal);
|
|
70
70
|
color: var(--rp-color-text);
|
|
71
71
|
}
|
|
72
|
-
.rp-radio--color-primary[data-v-
|
|
73
|
-
--
|
|
74
|
-
--
|
|
75
|
-
}
|
|
76
|
-
.rp-radio--color-secondary[data-v-
|
|
77
|
-
--
|
|
78
|
-
--
|
|
79
|
-
}
|
|
80
|
-
.rp-radio--color-success[data-v-
|
|
81
|
-
--
|
|
82
|
-
--
|
|
83
|
-
}
|
|
84
|
-
.rp-radio--color-warning[data-v-
|
|
85
|
-
--
|
|
86
|
-
--
|
|
87
|
-
}
|
|
88
|
-
.rp-radio--color-danger[data-v-
|
|
89
|
-
--
|
|
90
|
-
--
|
|
91
|
-
}
|
|
92
|
-
.rp-radio--color-info[data-v-
|
|
93
|
-
--
|
|
94
|
-
--
|
|
95
|
-
}
|
|
96
|
-
.rp-radio--color-neutral[data-v-
|
|
97
|
-
--
|
|
98
|
-
--
|
|
99
|
-
}
|
|
100
|
-
.rp-radio--outline[data-v-
|
|
101
|
-
--
|
|
102
|
-
--
|
|
103
|
-
--
|
|
104
|
-
}
|
|
105
|
-
.rp-radio--size-xs[data-v-
|
|
106
|
-
--
|
|
107
|
-
--
|
|
108
|
-
--
|
|
109
|
-
}
|
|
110
|
-
.rp-radio--size-sm[data-v-
|
|
111
|
-
--
|
|
112
|
-
--
|
|
113
|
-
--
|
|
114
|
-
}
|
|
115
|
-
.rp-radio--size-md[data-v-
|
|
116
|
-
--
|
|
117
|
-
--
|
|
118
|
-
--
|
|
119
|
-
}
|
|
120
|
-
.rp-radio--size-lg[data-v-
|
|
121
|
-
--
|
|
122
|
-
--
|
|
123
|
-
--
|
|
124
|
-
}
|
|
125
|
-
.rp-radio--size-xl[data-v-
|
|
126
|
-
--
|
|
127
|
-
--
|
|
128
|
-
--
|
|
72
|
+
.rp-radio--color-primary[data-v-18269eb4] {
|
|
73
|
+
--_rp-radio-color: var(--rp-color-primary);
|
|
74
|
+
--_rp-radio-on-color: var(--rp-color-on-primary);
|
|
75
|
+
}
|
|
76
|
+
.rp-radio--color-secondary[data-v-18269eb4] {
|
|
77
|
+
--_rp-radio-color: var(--rp-color-secondary);
|
|
78
|
+
--_rp-radio-on-color: var(--rp-color-on-secondary);
|
|
79
|
+
}
|
|
80
|
+
.rp-radio--color-success[data-v-18269eb4] {
|
|
81
|
+
--_rp-radio-color: var(--rp-color-success);
|
|
82
|
+
--_rp-radio-on-color: var(--rp-color-on-success);
|
|
83
|
+
}
|
|
84
|
+
.rp-radio--color-warning[data-v-18269eb4] {
|
|
85
|
+
--_rp-radio-color: var(--rp-color-warning);
|
|
86
|
+
--_rp-radio-on-color: var(--rp-color-on-warning);
|
|
87
|
+
}
|
|
88
|
+
.rp-radio--color-danger[data-v-18269eb4] {
|
|
89
|
+
--_rp-radio-color: var(--rp-color-danger);
|
|
90
|
+
--_rp-radio-on-color: var(--rp-color-on-danger);
|
|
91
|
+
}
|
|
92
|
+
.rp-radio--color-info[data-v-18269eb4] {
|
|
93
|
+
--_rp-radio-color: var(--rp-color-info);
|
|
94
|
+
--_rp-radio-on-color: var(--rp-color-on-info);
|
|
95
|
+
}
|
|
96
|
+
.rp-radio--color-neutral[data-v-18269eb4] {
|
|
97
|
+
--_rp-radio-color: var(--rp-color-neutral);
|
|
98
|
+
--_rp-radio-on-color: var(--rp-color-on-neutral);
|
|
99
|
+
}
|
|
100
|
+
.rp-radio--outline[data-v-18269eb4] {
|
|
101
|
+
--_rp-radio-checked-bg: var(--rp-color-control-bg);
|
|
102
|
+
--_rp-radio-checked-border: var(--_rp-radio-color);
|
|
103
|
+
--_rp-radio-checked-dot: var(--_rp-radio-color);
|
|
104
|
+
}
|
|
105
|
+
.rp-radio--size-xs[data-v-18269eb4] {
|
|
106
|
+
--_rp-radio-size: 14px;
|
|
107
|
+
--_rp-radio-dot: 6px;
|
|
108
|
+
--_rp-radio-font-size: var(--rp-font-size-xs);
|
|
109
|
+
}
|
|
110
|
+
.rp-radio--size-sm[data-v-18269eb4] {
|
|
111
|
+
--_rp-radio-size: 16px;
|
|
112
|
+
--_rp-radio-dot: 7px;
|
|
113
|
+
--_rp-radio-font-size: var(--rp-font-size-sm);
|
|
114
|
+
}
|
|
115
|
+
.rp-radio--size-md[data-v-18269eb4] {
|
|
116
|
+
--_rp-radio-size: 18px;
|
|
117
|
+
--_rp-radio-dot: 8px;
|
|
118
|
+
--_rp-radio-font-size: var(--rp-font-size-base);
|
|
119
|
+
}
|
|
120
|
+
.rp-radio--size-lg[data-v-18269eb4] {
|
|
121
|
+
--_rp-radio-size: 22px;
|
|
122
|
+
--_rp-radio-dot: 10px;
|
|
123
|
+
--_rp-radio-font-size: var(--rp-font-size-lg);
|
|
124
|
+
}
|
|
125
|
+
.rp-radio--size-xl[data-v-18269eb4] {
|
|
126
|
+
--_rp-radio-size: 26px;
|
|
127
|
+
--_rp-radio-dot: 12px;
|
|
128
|
+
--_rp-radio-font-size: var(--rp-font-size-xl);
|
|
129
129
|
}.rp-radio-group[data-v-a2c46e46] {
|
|
130
130
|
display: flex;
|
|
131
131
|
flex-direction: column;
|
package/dist/radio.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import './radio.css';
|
|
2
|
+
import { n as getComponentCustomColor, r as isComponentPresetColor } from "./componentColors.js";
|
|
2
3
|
import { n as bem, t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
3
4
|
import { t as useControlState } from "./useControlState.js";
|
|
4
|
-
import { child, computed, createIf, createSlot, defineVaporComponent, inject, on, provide, renderEffect, setAttr, setClass, setInsertionState, setProp, setValue, template, unref, useId } from "vue";
|
|
5
|
+
import { child, computed, createIf, createSlot, defineVaporComponent, inject, on, provide, renderEffect, setAttr, setClass, setInsertionState, setProp, setStyle, setValue, template, unref, useId } from "vue";
|
|
5
6
|
//#region src/composables/useRequiredInject.ts
|
|
6
7
|
function useRequiredInject(key, componentName) {
|
|
7
8
|
const value = inject(key);
|
|
@@ -13,6 +14,14 @@ function useRequiredInject(key, componentName) {
|
|
|
13
14
|
var radioGroupKey = Symbol("radioGroup");
|
|
14
15
|
//#endregion
|
|
15
16
|
//#region src/components/radio/useRadio.ts
|
|
17
|
+
function getRadioColorStyle(color) {
|
|
18
|
+
const customColor = getComponentCustomColor(color);
|
|
19
|
+
if (!customColor) return void 0;
|
|
20
|
+
return {
|
|
21
|
+
"--_rp-radio-custom-color": customColor,
|
|
22
|
+
"--_rp-radio-custom-on-color": "var(--rp-color-on-primary)"
|
|
23
|
+
};
|
|
24
|
+
}
|
|
16
25
|
function useRadio(props) {
|
|
17
26
|
const group = useRequiredInject(radioGroupKey, "RpRadio");
|
|
18
27
|
const isChecked = computed(() => group.modelValue === props.value);
|
|
@@ -24,9 +33,10 @@ function useRadio(props) {
|
|
|
24
33
|
checked: isChecked.value,
|
|
25
34
|
disabled: isDisabled.value,
|
|
26
35
|
[variant.value ?? ""]: Boolean(variant.value),
|
|
27
|
-
[`color-${color.value}`]:
|
|
36
|
+
[`color-${color.value}`]: isComponentPresetColor(color.value),
|
|
28
37
|
[`size-${size.value}`]: Boolean(size.value)
|
|
29
38
|
}));
|
|
39
|
+
const rootStyle = computed(() => getRadioColorStyle(color.value));
|
|
30
40
|
function onSelect() {
|
|
31
41
|
if (isDisabled.value) return;
|
|
32
42
|
group.select(props.value);
|
|
@@ -36,6 +46,7 @@ function useRadio(props) {
|
|
|
36
46
|
isChecked,
|
|
37
47
|
isDisabled,
|
|
38
48
|
rootClass,
|
|
49
|
+
rootStyle,
|
|
39
50
|
onSelect
|
|
40
51
|
};
|
|
41
52
|
}
|
|
@@ -80,8 +91,8 @@ function useRadioGroup(props, emitUpdate) {
|
|
|
80
91
|
}
|
|
81
92
|
//#endregion
|
|
82
93
|
//#region src/components/radio/radio.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
83
|
-
var t0$1 = template("<span data-v-
|
|
84
|
-
var t1 = template("<label data-v-
|
|
94
|
+
var t0$1 = template("<span data-v-18269eb4 class=rp-radio__label>");
|
|
95
|
+
var t1 = template("<label data-v-18269eb4><input data-v-18269eb4 type=radio class=rp-radio__native><span data-v-18269eb4 class=rp-radio__dot></span>", 1);
|
|
85
96
|
//#endregion
|
|
86
97
|
//#region src/components/radio/radio.vue
|
|
87
98
|
var radio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -98,7 +109,7 @@ var radio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
98
109
|
}
|
|
99
110
|
},
|
|
100
111
|
setup(__props, { slots: $slots }) {
|
|
101
|
-
const { group, isChecked, isDisabled, rootClass, onSelect } = useRadio(__props);
|
|
112
|
+
const { group, isChecked, isDisabled, rootClass, rootStyle, onSelect } = useRadio(__props);
|
|
102
113
|
const n5 = t1();
|
|
103
114
|
const n0 = child(n5);
|
|
104
115
|
on(n0, "change", (e) => unref(onSelect)(e));
|
|
@@ -106,6 +117,7 @@ var radio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
106
117
|
const _isChecked = unref(isChecked);
|
|
107
118
|
const _group = unref(group);
|
|
108
119
|
setClass(n5, unref(rootClass));
|
|
120
|
+
setStyle(n5, unref(rootStyle));
|
|
109
121
|
setAttr(n5, "data-disabled", unref(isDisabled) || void 0);
|
|
110
122
|
setAttr(n5, "data-state", _isChecked ? "checked" : "unchecked");
|
|
111
123
|
setProp(n0, "name", _group.name);
|
|
@@ -123,7 +135,7 @@ var radio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
123
135
|
});
|
|
124
136
|
return n5;
|
|
125
137
|
}
|
|
126
|
-
}), [["__scopeId", "data-v-
|
|
138
|
+
}), [["__scopeId", "data-v-18269eb4"]]);
|
|
127
139
|
//#endregion
|
|
128
140
|
//#region src/components/radio/radio-group.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
129
141
|
var t0 = template("<div data-v-a2c46e46 role=radiogroup>", 1);
|