ropav 0.0.10 → 0.0.12
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 +9 -0
- package/dist/accordion.css +115 -111
- package/dist/accordion.js +60 -16
- package/dist/alert.css +110 -108
- package/dist/alert.js +48 -26
- package/dist/aspect-ratio.css +17 -15
- package/dist/aspect-ratio.js +20 -6
- package/dist/avatar.css +98 -96
- package/dist/avatar.js +27 -16
- package/dist/badge.css +95 -93
- package/dist/badge.js +29 -16
- package/dist/base.css +672 -671
- package/dist/button-group.css +39 -37
- package/dist/button-group.js +23 -12
- package/dist/button-link.css +160 -158
- package/dist/button-link.js +43 -24
- package/dist/button.css +160 -158
- package/dist/button.js +37 -19
- package/dist/card.css +109 -107
- package/dist/card.js +42 -17
- package/dist/checkbox.css +139 -137
- package/dist/checkbox.js +103 -33
- package/dist/collapse.css +29 -27
- package/dist/collapse.js +44 -10
- package/dist/color-input.css +137 -107
- package/dist/color-input.js +117 -30
- package/dist/color-picker.css +309 -303
- package/dist/color-picker.js +147 -54
- package/dist/color-picker2.js +9 -1
- package/dist/color-swatch.css +48 -46
- package/dist/color-swatch.js +15 -11
- package/dist/color-swatch2.js +4 -0
- package/dist/components/accordion/accordion-item.d.ts +13 -1
- package/dist/components/accordion/index.d.ts +2 -1
- package/dist/components/accordion/index.js +2 -2
- package/dist/components/accordion/types.d.ts +9 -4
- package/dist/components/alert/alert.d.ts +2 -2
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert/index.js +2 -2
- package/dist/components/alert/types.d.ts +4 -1
- package/dist/components/aspect-ratio/index.d.ts +2 -1
- package/dist/components/aspect-ratio/index.js +2 -2
- package/dist/components/aspect-ratio/types.d.ts +4 -1
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/avatar/index.js +2 -2
- package/dist/components/avatar/types.d.ts +4 -1
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/badge/index.js +2 -2
- package/dist/components/badge/types.d.ts +4 -1
- package/dist/components/button/index.d.ts +2 -1
- package/dist/components/button/index.js +2 -2
- package/dist/components/button/types.d.ts +4 -1
- package/dist/components/button-group/index.d.ts +2 -1
- package/dist/components/button-group/index.js +2 -2
- package/dist/components/button-group/types.d.ts +4 -1
- package/dist/components/button-link/index.d.ts +2 -1
- package/dist/components/button-link/index.js +2 -2
- package/dist/components/button-link/types.d.ts +4 -1
- package/dist/components/card/index.d.ts +2 -1
- package/dist/components/card/index.js +2 -2
- package/dist/components/card/types.d.ts +5 -1
- package/dist/components/checkbox/checkbox.d.ts +4 -1
- package/dist/components/checkbox/index.d.ts +2 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/checkbox/types.d.ts +11 -2
- package/dist/components/checkbox/useCheckbox.d.ts +3 -1
- package/dist/components/collapse/collapse.d.ts +2 -2
- package/dist/components/collapse/index.d.ts +2 -1
- package/dist/components/collapse/index.js +2 -2
- package/dist/components/collapse/types.d.ts +9 -2
- package/dist/components/color-input/index.d.ts +2 -1
- package/dist/components/color-input/index.js +2 -2
- package/dist/components/color-input/types.d.ts +8 -2
- package/dist/components/color-input/useColorInput.d.ts +1 -1
- package/dist/components/color-input/useColorInputValue.d.ts +1 -1
- package/dist/components/color-picker/index.d.ts +2 -2
- package/dist/components/color-picker/index.js +2 -2
- package/dist/components/color-picker/types.d.ts +13 -1
- package/dist/components/color-swatch/index.d.ts +2 -1
- package/dist/components/color-swatch/index.js +2 -1
- package/dist/components/color-swatch/types.d.ts +4 -1
- package/dist/components/dialog/dialog-close.d.ts +21 -0
- package/dist/components/dialog/dialog-content.d.ts +32 -0
- package/dist/components/dialog/dialog-core.d.ts +27 -0
- package/dist/components/dialog/dialog-description.d.ts +21 -0
- package/dist/components/dialog/dialog-overlay.d.ts +21 -0
- package/dist/components/dialog/dialog-portal.d.ts +21 -0
- package/dist/components/dialog/dialog-root.d.ts +28 -0
- package/dist/components/dialog/dialog-title.d.ts +21 -0
- package/dist/components/dialog/dialog-trigger.d.ts +23 -0
- package/dist/components/dialog/index.d.ts +9 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/dialog/types.d.ts +61 -0
- package/dist/components/dropdown-menu/dropdown-menu-checkbox-item.d.ts +24 -0
- package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +34 -0
- package/dist/components/dropdown-menu/dropdown-menu-context-trigger.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-indicator.d.ts +24 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-row.d.ts +28 -0
- package/dist/components/dropdown-menu/dropdown-menu-item.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu-items.d.ts +24 -22
- package/dist/components/dropdown-menu/dropdown-menu-label.d.ts +21 -0
- package/dist/components/dropdown-menu/dropdown-menu-outside.d.ts +3 -0
- package/dist/components/dropdown-menu/dropdown-menu-portal.d.ts +21 -0
- package/dist/components/dropdown-menu/dropdown-menu-primitive-core.d.ts +110 -0
- package/dist/components/dropdown-menu/dropdown-menu-primitives.d.ts +15 -0
- package/dist/components/dropdown-menu/dropdown-menu-radio-group.d.ts +25 -0
- package/dist/components/dropdown-menu/dropdown-menu-radio-item.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu-root.d.ts +30 -0
- package/dist/components/dropdown-menu/dropdown-menu-separator.d.ts +19 -0
- package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +34 -0
- package/dist/components/dropdown-menu/dropdown-menu-sub-trigger.d.ts +28 -0
- package/dist/components/dropdown-menu/dropdown-menu-sub.d.ts +28 -0
- package/dist/components/dropdown-menu/dropdown-menu-trigger.d.ts +23 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +6 -3
- package/dist/components/dropdown-menu/index.d.ts +32 -1
- package/dist/components/dropdown-menu/index.js +2 -2
- package/dist/components/dropdown-menu/types.d.ts +145 -6
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts +15 -3
- package/dist/components/dropdown-menu/useDropdownMenuDisclosure.d.ts +10 -3
- package/dist/components/dropdown-menu/useDropdownMenuDom.d.ts +2 -1
- package/dist/components/dropdown-menu/useDropdownMenuInteractions.d.ts +4 -4
- package/dist/components/dropdown-menu/useDropdownMenuPortalPosition.d.ts +19 -0
- package/dist/components/dropdown-menu/useDropdownMenuPrimitiveContent.d.ts +27 -0
- package/dist/components/dropdown-menu/useDropdownMenuRenderItems.d.ts +14 -2
- package/dist/components/field/index.d.ts +2 -1
- package/dist/components/field/index.js +2 -2
- package/dist/components/field/types.d.ts +4 -1
- package/dist/components/floating/index.d.ts +3 -0
- package/dist/components/floating/index.js +3 -0
- package/dist/components/floating/types.d.ts +105 -0
- package/dist/components/floating/useFloatingPosition.d.ts +15 -0
- package/dist/components/floating/useHoverDisclosure.d.ts +2 -0
- package/dist/components/focus-trap/focus-trap.d.ts +31 -0
- package/dist/components/focus-trap/index.d.ts +4 -0
- package/dist/components/focus-trap/index.js +3 -0
- package/dist/components/focus-trap/types.d.ts +41 -0
- package/dist/components/focus-trap/useFocusTrap.d.ts +2 -0
- package/dist/components/icon-button/index.d.ts +2 -1
- package/dist/components/icon-button/index.js +2 -1
- package/dist/components/icon-button/types.d.ts +4 -1
- package/dist/components/input/index.d.ts +2 -1
- package/dist/components/input/index.js +2 -1
- package/dist/components/input/input.d.ts +4 -1
- package/dist/components/input/types.d.ts +7 -2
- package/dist/components/modal/index.d.ts +2 -1
- package/dist/components/modal/index.js +2 -2
- package/dist/components/modal/modal.d.ts +3 -1
- package/dist/components/modal/types.d.ts +11 -1
- package/dist/components/modal/useModal.d.ts +7 -4
- package/dist/components/number-input/index.d.ts +2 -1
- package/dist/components/number-input/index.js +2 -2
- package/dist/components/number-input/types.d.ts +7 -2
- package/dist/components/number-input/useNumberInput.d.ts +2 -1
- package/dist/components/overlay/index.d.ts +2 -1
- package/dist/components/overlay/index.js +2 -1
- package/dist/components/overlay/types.d.ts +4 -1
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/index.js +2 -2
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/popover/types.d.ts +20 -11
- package/dist/components/popover/usePopover.d.ts +9 -1
- package/dist/components/progress/index.d.ts +2 -2
- package/dist/components/progress/index.js +2 -2
- package/dist/components/progress/types.d.ts +4 -1
- package/dist/components/radio/index.d.ts +2 -1
- package/dist/components/radio/index.js +2 -2
- package/dist/components/radio/radio.d.ts +8 -3
- package/dist/components/radio/types.d.ts +37 -4
- package/dist/components/radio/useRadio.d.ts +12 -4
- package/dist/components/select/index.d.ts +2 -1
- package/dist/components/select/index.js +2 -2
- package/dist/components/select/select.d.ts +4 -1
- package/dist/components/select/types.d.ts +10 -2
- package/dist/components/select/useSelect.d.ts +3 -1
- package/dist/components/slider/index.d.ts +2 -2
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/range-slider-tooltip.d.ts +3 -0
- package/dist/components/slider/range-slider.d.ts +7 -4
- package/dist/components/slider/slider.d.ts +4 -1
- package/dist/components/slider/sliderCore.d.ts +4 -4
- package/dist/components/slider/types.d.ts +22 -4
- package/dist/components/slider/useRangeSlider.d.ts +2 -2
- package/dist/components/slider/useSlider.d.ts +2 -2
- package/dist/components/switch/index.d.ts +2 -1
- package/dist/components/switch/index.js +2 -2
- package/dist/components/switch/switch.d.ts +4 -1
- package/dist/components/switch/types.d.ts +11 -2
- package/dist/components/switch/useSwitch.d.ts +3 -1
- package/dist/components/tabs/index.d.ts +2 -1
- package/dist/components/tabs/index.js +2 -2
- package/dist/components/tabs/types.d.ts +13 -4
- package/dist/components/teleport-provider/index.d.ts +3 -0
- package/dist/components/teleport-provider/index.js +3 -0
- package/dist/components/teleport-provider/teleport-provider.d.ts +21 -0
- package/dist/components/teleport-provider/types.d.ts +4 -0
- package/dist/components/teleport-provider/useTeleportTarget.d.ts +6 -0
- package/dist/components/textarea/index.d.ts +2 -1
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/textarea/textarea.d.ts +4 -1
- package/dist/components/textarea/types.d.ts +10 -2
- package/dist/components/textarea/useTextarea.d.ts +2 -1
- package/dist/components/toast/index.d.ts +3 -2
- package/dist/components/toast/index.js +2 -2
- package/dist/components/toast/toast-store.d.ts +2 -0
- package/dist/components/toast/toast.d.ts +2 -2
- package/dist/components/toast/types.d.ts +20 -10
- package/dist/components/toast/useToast.d.ts +2 -2
- package/dist/components/tooltip/index.d.ts +2 -1
- package/dist/components/tooltip/index.js +2 -1
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/components/tooltip/types.d.ts +13 -12
- package/dist/components/tooltip/useTooltip.d.ts +12 -2
- package/dist/composables/useOverlayLayer.d.ts +32 -0
- package/dist/dialog.js +510 -0
- package/dist/dropdown-menu.css +191 -108
- package/dist/dropdown-menu.js +1954 -198
- package/dist/field.css +41 -39
- package/dist/field.js +40 -16
- package/dist/floating.js +403 -0
- package/dist/focus-trap.js +80 -0
- package/dist/icon-button.css +193 -189
- package/dist/icon-button.js +23 -18
- package/dist/icon-button2.js +8 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +39 -32
- package/dist/input.css +122 -120
- package/dist/input.js +63 -40
- package/dist/input2.js +9 -0
- package/dist/legacy-unlayered.css +5382 -0
- package/dist/modal.css +129 -127
- package/dist/modal.js +182 -281
- package/dist/number-input.css +87 -85
- package/dist/number-input.js +98 -26
- package/dist/overlay.css +26 -24
- package/dist/overlay.js +17 -9
- package/dist/overlay2.js +4 -0
- package/dist/popover.css +140 -107
- package/dist/popover.js +276 -196
- package/dist/popover2.js +6 -1
- package/dist/progress.css +101 -99
- package/dist/progress.js +50 -28
- package/dist/radio.css +114 -105
- package/dist/radio.js +237 -61
- package/dist/select.css +255 -242
- package/dist/select.js +257 -94
- package/dist/slider.css +1090 -1031
- package/dist/slider.js +443 -175
- package/dist/styles-api.d.ts +22 -0
- package/dist/styles-api.js +49 -0
- package/dist/switch.css +120 -108
- package/dist/switch.js +112 -38
- package/dist/tabs.css +286 -278
- package/dist/tabs.js +60 -21
- package/dist/teleport-provider.js +15 -0
- package/dist/textarea.css +132 -130
- package/dist/textarea.js +83 -31
- package/dist/toast.css +229 -225
- package/dist/toast.js +189 -118
- package/dist/tooltip.css +61 -106
- package/dist/tooltip.js +184 -228
- package/dist/tooltip2.js +8 -0
- package/dist/useControlState.js +4 -0
- package/dist/useFloatingPosition.js +1317 -0
- package/dist/useFocusTrap.js +130 -0
- package/dist/useFormControl.js +107 -0
- package/dist/useOverlayLayer.js +262 -0
- package/dist/useTeleportTarget.js +40 -0
- package/docs/public-floating-api.md +148 -0
- package/docs/public-styles-api.md +134 -0
- package/docs/public-tokens.md +545 -0
- package/package.json +37 -9
- package/src/styles/_tokens.scss +33 -28
- package/src/styles/_utilities.scss +11 -9
- package/src/styles/styles-manifest.json +4125 -0
- package/dist/rafScheduler.js +0 -34
- package/dist/useClickOutside.js +0 -24
package/dist/radio.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import './radio.css';
|
|
2
2
|
import { t as bem } from "./bem.js";
|
|
3
|
+
import { n as useStylesApi, t as presence } from "./styles-api.js";
|
|
3
4
|
import { n as getComponentColorValue, r as getComponentContrastColor } from "./componentColors.js";
|
|
4
5
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
5
|
-
import {
|
|
6
|
+
import { i as useFormControl, o as useControllableValue } from "./useFormControl.js";
|
|
6
7
|
import { t as useControlState } from "./useControlState.js";
|
|
7
|
-
import { child, computed, createIf, createSlot, defineVaporComponent,
|
|
8
|
+
import { child, computed, createIf, createSlot, defineVaporComponent, inject, next, onBeforeUnmount, onMounted, provide, ref, renderEffect, setDynamicProps, setInsertionState, setStaticTemplateRef, shallowRef, template, unref, useId } from "vue";
|
|
8
9
|
//#region src/components/radio/types.ts
|
|
10
|
+
var radioParts = [
|
|
11
|
+
"root",
|
|
12
|
+
"input",
|
|
13
|
+
"indicator",
|
|
14
|
+
"label"
|
|
15
|
+
];
|
|
16
|
+
var radioGroupParts = ["root"];
|
|
9
17
|
var radioGroupKey = Symbol("radioGroup");
|
|
10
18
|
//#endregion
|
|
11
19
|
//#region src/components/radio/useRadio.ts
|
|
@@ -18,55 +26,134 @@ function getRadioColorStyle(color, autoContrast) {
|
|
|
18
26
|
if (autoContrast) style["--_rp-radio-on-color"] = getComponentContrastColor(color ?? "primary", { autoContrast });
|
|
19
27
|
return style;
|
|
20
28
|
}
|
|
21
|
-
function useRadio(props) {
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
+
function useRadio(props, emitChange) {
|
|
30
|
+
const inputRef = ref(null);
|
|
31
|
+
const control = useControlState(props);
|
|
32
|
+
const group = inject(radioGroupKey, null);
|
|
33
|
+
const isChecked = computed(() => props.checked ?? (group ? group.modelValue === props.value : false));
|
|
34
|
+
const isDisabled = computed(() => Boolean(props.disabled || group?.disabled));
|
|
35
|
+
const isRequired = computed(() => props.required ?? group?.required ?? false);
|
|
36
|
+
const isInvalid = computed(() => props.invalid ?? group?.invalid ?? false);
|
|
37
|
+
const name = computed(() => props.name ?? group?.name);
|
|
38
|
+
const form = computed(() => props.form ?? group?.form);
|
|
39
|
+
const variant = computed(() => props.variant ?? group?.variant);
|
|
40
|
+
const color = computed(() => props.color ?? group?.color);
|
|
41
|
+
const autoContrast = computed(() => props.autoContrast ?? group?.autoContrast);
|
|
42
|
+
const size = computed(() => props.size ?? group?.size);
|
|
29
43
|
const rootClass = computed(() => bem("rp-radio", {
|
|
30
44
|
checked: isChecked.value,
|
|
31
45
|
disabled: isDisabled.value,
|
|
46
|
+
invalid: isInvalid.value,
|
|
32
47
|
[variant.value ?? ""]: Boolean(variant.value),
|
|
33
48
|
[`size-${size.value}`]: Boolean(size.value)
|
|
34
49
|
}));
|
|
35
50
|
const rootStyle = computed(() => getRadioColorStyle(color.value, autoContrast.value));
|
|
36
|
-
function onSelect() {
|
|
51
|
+
function onSelect(event) {
|
|
37
52
|
if (isDisabled.value) return;
|
|
38
|
-
group
|
|
53
|
+
group?.select(props.value);
|
|
54
|
+
emitChange(event);
|
|
55
|
+
}
|
|
56
|
+
function focus(options) {
|
|
57
|
+
inputRef.value?.focus(options);
|
|
39
58
|
}
|
|
59
|
+
let unregister;
|
|
60
|
+
onMounted(() => {
|
|
61
|
+
if (group && inputRef.value) unregister = group.register({
|
|
62
|
+
input: inputRef.value,
|
|
63
|
+
value: () => props.value,
|
|
64
|
+
disabled: () => isDisabled.value,
|
|
65
|
+
checked: () => isChecked.value,
|
|
66
|
+
validationMessage: () => props.validationMessage
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
onBeforeUnmount(() => unregister?.());
|
|
70
|
+
useFormControl({
|
|
71
|
+
elements: () => group ? [] : [inputRef.value],
|
|
72
|
+
isControlled: () => true,
|
|
73
|
+
initializeDefault(element) {
|
|
74
|
+
element.defaultChecked = isChecked.value;
|
|
75
|
+
},
|
|
76
|
+
validationMessage: () => props.validationMessage,
|
|
77
|
+
readResetValue() {},
|
|
78
|
+
syncControlledValue(elements) {
|
|
79
|
+
elements[0].checked = isChecked.value;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
40
82
|
return {
|
|
41
|
-
|
|
83
|
+
inputRef,
|
|
84
|
+
control,
|
|
85
|
+
name,
|
|
86
|
+
form,
|
|
87
|
+
groupInputAttrs: computed(() => group?.inputAttrs),
|
|
42
88
|
isChecked,
|
|
43
89
|
isDisabled,
|
|
90
|
+
isRequired,
|
|
91
|
+
isInvalid,
|
|
44
92
|
rootClass,
|
|
45
93
|
rootStyle,
|
|
46
|
-
onSelect
|
|
94
|
+
onSelect,
|
|
95
|
+
focus
|
|
47
96
|
};
|
|
48
97
|
}
|
|
49
98
|
function useRadioGroup(props, emitUpdate) {
|
|
50
99
|
const control = useControlState(props);
|
|
100
|
+
const registrations = shallowRef([]);
|
|
101
|
+
const controllable = useControllableValue({
|
|
102
|
+
modelValue: () => props.modelValue,
|
|
103
|
+
defaultValue: () => props.defaultValue ?? null,
|
|
104
|
+
onChange: emitUpdate
|
|
105
|
+
});
|
|
51
106
|
const rootClass = computed(() => bem("rp-radio-group", {
|
|
52
107
|
disabled: control.disabled,
|
|
53
108
|
invalid: control.invalid
|
|
54
109
|
}));
|
|
55
110
|
const generatedName = useId();
|
|
56
111
|
const groupName = computed(() => props.name ?? `${control.id ?? generatedName}-radio`);
|
|
112
|
+
function register(registration) {
|
|
113
|
+
registrations.value = [...registrations.value, registration];
|
|
114
|
+
return () => {
|
|
115
|
+
registrations.value = registrations.value.filter((item) => item !== registration);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
useFormControl({
|
|
119
|
+
elements: () => registrations.value.map((registration) => registration.input),
|
|
120
|
+
isControlled: () => controllable.isControlled.value,
|
|
121
|
+
initializeDefault(element) {
|
|
122
|
+
element.defaultChecked = registrations.value.find((item) => item.input === element)?.value() === controllable.initialValue;
|
|
123
|
+
},
|
|
124
|
+
validationMessage(element) {
|
|
125
|
+
const enabled = registrations.value.filter((registration) => !registration.disabled());
|
|
126
|
+
const anchor = enabled.find((registration) => registration.checked()) ?? enabled[0];
|
|
127
|
+
const registration = registrations.value.find((item) => item.input === element);
|
|
128
|
+
return registration?.validationMessage() ?? (registration === anchor ? props.validationMessage : void 0);
|
|
129
|
+
},
|
|
130
|
+
readResetValue(elements) {
|
|
131
|
+
const checked = registrations.value.find((registration) => elements.includes(registration.input) && registration.input.checked);
|
|
132
|
+
controllable.resetValue(checked?.value() ?? null);
|
|
133
|
+
},
|
|
134
|
+
syncControlledValue() {
|
|
135
|
+
for (const registration of registrations.value) registration.input.checked = registration.value() === controllable.value.value;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
57
138
|
provide(radioGroupKey, {
|
|
58
139
|
get modelValue() {
|
|
59
|
-
return
|
|
140
|
+
return controllable.value.value;
|
|
60
141
|
},
|
|
61
142
|
get name() {
|
|
62
143
|
return groupName.value;
|
|
63
144
|
},
|
|
145
|
+
get form() {
|
|
146
|
+
return control.form;
|
|
147
|
+
},
|
|
64
148
|
get disabled() {
|
|
65
149
|
return control.disabled;
|
|
66
150
|
},
|
|
67
151
|
get required() {
|
|
68
152
|
return control.required;
|
|
69
153
|
},
|
|
154
|
+
get invalid() {
|
|
155
|
+
return control.invalid;
|
|
156
|
+
},
|
|
70
157
|
get variant() {
|
|
71
158
|
return props.variant;
|
|
72
159
|
},
|
|
@@ -79,26 +166,39 @@ function useRadioGroup(props, emitUpdate) {
|
|
|
79
166
|
get size() {
|
|
80
167
|
return props.size;
|
|
81
168
|
},
|
|
169
|
+
get inputAttrs() {
|
|
170
|
+
return props.inputAttrs;
|
|
171
|
+
},
|
|
82
172
|
select(value) {
|
|
83
|
-
|
|
84
|
-
}
|
|
173
|
+
controllable.setValue(value);
|
|
174
|
+
},
|
|
175
|
+
register
|
|
85
176
|
});
|
|
86
177
|
return {
|
|
87
178
|
control,
|
|
88
|
-
rootClass
|
|
179
|
+
rootClass,
|
|
180
|
+
value: controllable.value
|
|
89
181
|
};
|
|
90
182
|
}
|
|
91
183
|
//#endregion
|
|
92
184
|
//#region src/components/radio/radio.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
93
|
-
var t0$1 = template("<span data-v-
|
|
94
|
-
var t1 = template("<label data-v-
|
|
185
|
+
var t0$1 = template("<span data-v-0cdcdcfa>");
|
|
186
|
+
var t1 = template("<label data-v-0cdcdcfa><input data-v-0cdcdcfa><span data-v-0cdcdcfa></span>", 1);
|
|
95
187
|
//#endregion
|
|
96
188
|
//#region src/components/radio/radio.vue
|
|
97
189
|
var radio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
98
190
|
name: "RpRadio",
|
|
191
|
+
inheritAttrs: false,
|
|
99
192
|
__name: "radio",
|
|
100
193
|
props: {
|
|
194
|
+
id: {},
|
|
195
|
+
name: {},
|
|
196
|
+
form: {},
|
|
101
197
|
value: {},
|
|
198
|
+
checked: {
|
|
199
|
+
type: Boolean,
|
|
200
|
+
default: void 0
|
|
201
|
+
},
|
|
102
202
|
variant: { default: void 0 },
|
|
103
203
|
color: { default: void 0 },
|
|
104
204
|
autoContrast: {
|
|
@@ -108,49 +208,117 @@ var radio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
108
208
|
size: { default: void 0 },
|
|
109
209
|
disabled: {
|
|
110
210
|
type: Boolean,
|
|
111
|
-
default:
|
|
112
|
-
}
|
|
211
|
+
default: void 0
|
|
212
|
+
},
|
|
213
|
+
required: {
|
|
214
|
+
type: Boolean,
|
|
215
|
+
default: void 0
|
|
216
|
+
},
|
|
217
|
+
invalid: {
|
|
218
|
+
type: Boolean,
|
|
219
|
+
default: void 0
|
|
220
|
+
},
|
|
221
|
+
ariaLabel: {},
|
|
222
|
+
describedby: {},
|
|
223
|
+
labelledby: {},
|
|
224
|
+
inputAttrs: {},
|
|
225
|
+
validationMessage: {},
|
|
226
|
+
classNames: {},
|
|
227
|
+
styles: {}
|
|
113
228
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
|
|
229
|
+
emits: ["change"],
|
|
230
|
+
setup(__props, { expose: __expose, emit: __emit, slots: $slots }) {
|
|
231
|
+
const props = __props;
|
|
232
|
+
const emit = __emit;
|
|
233
|
+
const { inputRef, control, name, form, groupInputAttrs, isChecked, isDisabled, isRequired, isInvalid, rootClass, rootStyle, onSelect, focus } = useRadio(props, (event) => emit("change", event));
|
|
234
|
+
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
235
|
+
const rootAttrs = computed(() => getRootAttrs({
|
|
236
|
+
class: rootClass.value,
|
|
237
|
+
style: rootStyle.value,
|
|
238
|
+
"data-disabled": presence(isDisabled.value),
|
|
239
|
+
"data-invalid": presence(isInvalid.value),
|
|
240
|
+
"data-state": isChecked.value ? "checked" : "unchecked"
|
|
241
|
+
}));
|
|
242
|
+
const nativeInputAttrs = computed(() => {
|
|
243
|
+
const { class: groupClass, style: groupStyle, onChange: groupOnChange, ...groupForwardedAttrs } = groupInputAttrs.value ?? {};
|
|
244
|
+
const { class: itemClass, style: itemStyle, onChange: itemOnChange, ...itemForwardedAttrs } = props.inputAttrs ?? {};
|
|
245
|
+
return {
|
|
246
|
+
...groupForwardedAttrs,
|
|
247
|
+
...itemForwardedAttrs,
|
|
248
|
+
...getPartAttrs("input", {
|
|
249
|
+
class: "rp-radio__native",
|
|
250
|
+
compatibilityClass: [groupClass, itemClass],
|
|
251
|
+
compatibilityStyle: [groupStyle, itemStyle]
|
|
252
|
+
}),
|
|
253
|
+
onChange(event) {
|
|
254
|
+
onSelect(event);
|
|
255
|
+
groupOnChange?.(event);
|
|
256
|
+
itemOnChange?.(event);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
});
|
|
260
|
+
__expose({
|
|
261
|
+
nativeElement: inputRef,
|
|
262
|
+
focus
|
|
263
|
+
});
|
|
264
|
+
const n6 = t1();
|
|
265
|
+
const n0 = child(n6);
|
|
266
|
+
const n1 = next(n0, 1);
|
|
267
|
+
setStaticTemplateRef(n0, inputRef, null, "inputRef");
|
|
119
268
|
renderEffect(() => {
|
|
269
|
+
const _nativeInputAttrs = nativeInputAttrs.value;
|
|
270
|
+
const _control = unref(control);
|
|
120
271
|
const _isChecked = unref(isChecked);
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
272
|
+
const _isDisabled = unref(isDisabled);
|
|
273
|
+
const _isInvalid = unref(isInvalid);
|
|
274
|
+
const _presence = unref(presence);
|
|
275
|
+
setDynamicProps(n6, [rootAttrs.value]);
|
|
276
|
+
setDynamicProps(n0, [_nativeInputAttrs, {
|
|
277
|
+
id: _control.id,
|
|
278
|
+
type: "radio",
|
|
279
|
+
name: unref(name),
|
|
280
|
+
form: unref(form) ?? _nativeInputAttrs.form,
|
|
281
|
+
value: __props.value,
|
|
282
|
+
checked: _isChecked,
|
|
283
|
+
disabled: _isDisabled || void 0,
|
|
284
|
+
required: unref(isRequired) || void 0,
|
|
285
|
+
"aria-label": __props.ariaLabel || void 0,
|
|
286
|
+
"aria-labelledby": _control.ariaLabelledby,
|
|
287
|
+
"aria-describedby": _control.ariaDescribedby,
|
|
288
|
+
"aria-invalid": _isInvalid || void 0,
|
|
289
|
+
"aria-required": unref(isRequired) || void 0,
|
|
290
|
+
"data-disabled": _presence(_isDisabled),
|
|
291
|
+
"data-invalid": _presence(_isInvalid),
|
|
292
|
+
"data-state": _isChecked ? "checked" : "unchecked"
|
|
293
|
+
}]);
|
|
294
|
+
setDynamicProps(n1, [unref(getPartAttrs)("indicator", { class: "rp-radio__dot" })]);
|
|
131
295
|
});
|
|
132
|
-
setInsertionState(
|
|
296
|
+
setInsertionState(n6, null, 2);
|
|
133
297
|
createIf(() => $slots.default, () => {
|
|
134
|
-
const
|
|
135
|
-
|
|
298
|
+
const n5 = t0$1();
|
|
299
|
+
renderEffect(() => setDynamicProps(n5, [unref(getPartAttrs)("label", { class: "rp-radio__label" })]));
|
|
300
|
+
setInsertionState(n5, null, 0);
|
|
136
301
|
createSlot("default", null, null, 1);
|
|
137
|
-
return
|
|
302
|
+
return n5;
|
|
138
303
|
});
|
|
139
|
-
return
|
|
304
|
+
return n6;
|
|
140
305
|
}
|
|
141
|
-
}), [["__scopeId", "data-v-
|
|
306
|
+
}), [["__scopeId", "data-v-0cdcdcfa"]]);
|
|
142
307
|
//#endregion
|
|
143
308
|
//#region src/components/radio/radio-group.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
144
|
-
var t0 = template("<div data-v-
|
|
309
|
+
var t0 = template("<div data-v-fc40a22d>", 1);
|
|
145
310
|
//#endregion
|
|
146
311
|
//#region src/components/radio/radio-group.vue
|
|
147
312
|
var radio_group_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
148
313
|
name: "RpRadioGroup",
|
|
314
|
+
inheritAttrs: false,
|
|
149
315
|
__name: "radio-group",
|
|
150
316
|
props: {
|
|
151
317
|
id: {},
|
|
152
318
|
name: {},
|
|
153
|
-
|
|
319
|
+
form: {},
|
|
320
|
+
modelValue: { default: void 0 },
|
|
321
|
+
defaultValue: { default: null },
|
|
154
322
|
variant: { default: void 0 },
|
|
155
323
|
color: { default: void 0 },
|
|
156
324
|
autoContrast: {
|
|
@@ -158,6 +326,7 @@ var radio_group_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
158
326
|
default: void 0
|
|
159
327
|
},
|
|
160
328
|
size: { default: void 0 },
|
|
329
|
+
orientation: { default: "vertical" },
|
|
161
330
|
disabled: {
|
|
162
331
|
type: Boolean,
|
|
163
332
|
default: void 0
|
|
@@ -172,7 +341,11 @@ var radio_group_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
172
341
|
},
|
|
173
342
|
ariaLabel: {},
|
|
174
343
|
describedby: {},
|
|
175
|
-
labelledby: {}
|
|
344
|
+
labelledby: {},
|
|
345
|
+
inputAttrs: {},
|
|
346
|
+
validationMessage: {},
|
|
347
|
+
classNames: {},
|
|
348
|
+
styles: {}
|
|
176
349
|
},
|
|
177
350
|
emits: ["update:modelValue"],
|
|
178
351
|
setup(__props, { emit: __emit }) {
|
|
@@ -181,24 +354,27 @@ var radio_group_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
181
354
|
const { control, rootClass } = useRadioGroup(props, (value) => {
|
|
182
355
|
emit("update:modelValue", value);
|
|
183
356
|
});
|
|
357
|
+
const { getRootAttrs } = useStylesApi(props, "root");
|
|
358
|
+
const rootAttrs = computed(() => getRootAttrs({
|
|
359
|
+
id: control.id,
|
|
360
|
+
class: rootClass.value,
|
|
361
|
+
role: "radiogroup",
|
|
362
|
+
"data-orientation": props.orientation,
|
|
363
|
+
"data-disabled": presence(control.disabled),
|
|
364
|
+
"data-invalid": presence(control.invalid),
|
|
365
|
+
"aria-label": props.ariaLabel || void 0,
|
|
366
|
+
"aria-labelledby": control.ariaLabelledby,
|
|
367
|
+
"aria-describedby": control.ariaDescribedby,
|
|
368
|
+
"aria-invalid": control.invalid || void 0,
|
|
369
|
+
"aria-required": control.required || void 0,
|
|
370
|
+
"aria-orientation": props.orientation
|
|
371
|
+
}));
|
|
184
372
|
const n1 = t0();
|
|
185
|
-
renderEffect(() =>
|
|
186
|
-
const _control = unref(control);
|
|
187
|
-
const _control_invalid = _control.invalid;
|
|
188
|
-
setProp(n1, "id", _control.id);
|
|
189
|
-
setClass(n1, unref(rootClass));
|
|
190
|
-
setAttr(n1, "data-disabled", _control.disabled || void 0);
|
|
191
|
-
setAttr(n1, "data-invalid", _control_invalid || void 0);
|
|
192
|
-
setAttr(n1, "aria-label", __props.ariaLabel || void 0);
|
|
193
|
-
setAttr(n1, "aria-labelledby", _control.ariaLabelledby);
|
|
194
|
-
setAttr(n1, "aria-describedby", _control.ariaDescribedby);
|
|
195
|
-
setAttr(n1, "aria-invalid", _control_invalid || void 0);
|
|
196
|
-
setAttr(n1, "aria-required", _control.required || void 0);
|
|
197
|
-
});
|
|
373
|
+
renderEffect(() => setDynamicProps(n1, [rootAttrs.value]));
|
|
198
374
|
setInsertionState(n1, null, 0);
|
|
199
375
|
createSlot("default", null, null, 1);
|
|
200
376
|
return n1;
|
|
201
377
|
}
|
|
202
|
-
}), [["__scopeId", "data-v-
|
|
378
|
+
}), [["__scopeId", "data-v-fc40a22d"]]);
|
|
203
379
|
//#endregion
|
|
204
|
-
export { radio_default as n, radio_group_default as t };
|
|
380
|
+
export { radioParts as i, radio_default as n, radioGroupParts as r, radio_group_default as t };
|