ropav 0.0.9 → 0.0.11
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 +6 -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 +79 -28
- package/dist/collapse.css +29 -27
- package/dist/collapse.js +44 -10
- package/dist/color-input.css +137 -107
- package/dist/color-input.js +91 -17
- package/dist/color-picker.css +309 -303
- package/dist/color-picker.js +250 -77
- 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 +16 -4
- package/dist/components/accordion/accordion.d.ts +1 -1
- package/dist/components/accordion/index.d.ts +5 -4
- package/dist/components/accordion/index.js +2 -2
- package/dist/components/accordion/types.d.ts +10 -5
- package/dist/components/accordion/useAccordion.d.ts +1 -1
- package/dist/components/alert/alert.d.ts +3 -3
- package/dist/components/alert/index.d.ts +3 -3
- package/dist/components/alert/index.js +2 -2
- package/dist/components/alert/types.d.ts +5 -2
- package/dist/components/alert/useAlertColor.d.ts +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +1 -1
- package/dist/components/aspect-ratio/index.d.ts +3 -2
- package/dist/components/aspect-ratio/index.js +2 -2
- package/dist/components/aspect-ratio/types.d.ts +4 -1
- package/dist/components/avatar/avatar.d.ts +1 -1
- package/dist/components/avatar/index.d.ts +3 -3
- package/dist/components/avatar/index.js +2 -2
- package/dist/components/avatar/types.d.ts +5 -2
- package/dist/components/avatar/useAvatarColor.d.ts +1 -1
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/badge/index.d.ts +3 -3
- package/dist/components/badge/index.js +2 -2
- package/dist/components/badge/types.d.ts +5 -2
- package/dist/components/badge/useBadgeColor.d.ts +1 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/index.d.ts +3 -2
- package/dist/components/button/index.js +2 -2
- package/dist/components/button/types.d.ts +5 -2
- package/dist/components/button/useButtonColor.d.ts +1 -1
- package/dist/components/button-group/button-group.d.ts +1 -1
- package/dist/components/button-group/index.d.ts +3 -2
- package/dist/components/button-group/index.js +2 -2
- package/dist/components/button-group/types.d.ts +4 -1
- package/dist/components/button-link/button-link.d.ts +1 -1
- package/dist/components/button-link/index.d.ts +3 -2
- package/dist/components/button-link/index.js +2 -2
- package/dist/components/button-link/types.d.ts +5 -2
- package/dist/components/card/card.d.ts +1 -1
- package/dist/components/card/index.d.ts +3 -2
- package/dist/components/card/index.js +2 -2
- package/dist/components/card/types.d.ts +5 -1
- package/dist/components/checkbox/checkbox.d.ts +5 -2
- package/dist/components/checkbox/index.d.ts +3 -2
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/checkbox/types.d.ts +7 -2
- package/dist/components/checkbox/useCheckbox.d.ts +4 -2
- package/dist/components/collapse/collapse.d.ts +2 -2
- package/dist/components/collapse/index.d.ts +4 -3
- package/dist/components/collapse/index.js +2 -2
- package/dist/components/collapse/types.d.ts +9 -2
- package/dist/components/collapse/useCollapse.d.ts +1 -1
- package/dist/components/color-input/color-input.d.ts +1 -1
- package/dist/components/color-input/index.d.ts +3 -2
- package/dist/components/color-input/index.js +2 -2
- package/dist/components/color-input/types.d.ts +8 -4
- package/dist/components/color-input/useColorInput.d.ts +5 -5
- package/dist/components/color-input/useColorInputEyeDropper.d.ts +1 -1
- package/dist/components/color-input/useColorInputPopover.d.ts +2 -2
- package/dist/components/color-input/useColorInputValue.d.ts +1 -1
- package/dist/components/color-picker/color-picker-saturation.d.ts +1 -1
- package/dist/components/color-picker/color-picker-slider.d.ts +1 -1
- package/dist/components/color-picker/color-picker-utils.d.ts +1 -1
- package/dist/components/color-picker/color-picker.d.ts +1 -1
- package/dist/components/color-picker/index.d.ts +3 -3
- package/dist/components/color-picker/index.js +2 -2
- package/dist/components/color-picker/types.d.ts +13 -1
- package/dist/components/color-picker/useColorPickerDrag.d.ts +7 -2
- package/dist/components/color-picker/useColorPickerSwatches.d.ts +1 -1
- package/dist/components/color-picker/useColorPickerValue.d.ts +2 -2
- package/dist/components/color-swatch/color-swatch.d.ts +1 -1
- package/dist/components/color-swatch/index.d.ts +3 -2
- package/dist/components/color-swatch/index.js +2 -1
- package/dist/components/color-swatch/types.d.ts +4 -1
- package/dist/components/dropdown-menu/dropdown-menu-items.d.ts +15 -6
- package/dist/components/dropdown-menu/dropdown-menu-primitives.d.ts +724 -0
- package/dist/components/dropdown-menu/dropdown-menu-utils.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +3 -3
- package/dist/components/dropdown-menu/index.d.ts +55 -3
- package/dist/components/dropdown-menu/index.js +2 -2
- package/dist/components/dropdown-menu/types.d.ts +142 -6
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts +21 -12
- package/dist/components/dropdown-menu/useDropdownMenuDisclosure.d.ts +6 -4
- package/dist/components/dropdown-menu/useDropdownMenuDom.d.ts +4 -3
- package/dist/components/dropdown-menu/useDropdownMenuHoverIntent.d.ts +2 -2
- package/dist/components/dropdown-menu/useDropdownMenuInteractions.d.ts +5 -5
- package/dist/components/dropdown-menu/useDropdownMenuNavigation.d.ts +3 -3
- package/dist/components/dropdown-menu/useDropdownMenuPortalPosition.d.ts +19 -0
- package/dist/components/dropdown-menu/useDropdownMenuRenderItems.d.ts +25 -5
- package/dist/components/dropdown-menu/useDropdownSubmenus.d.ts +3 -3
- package/dist/components/field/field.d.ts +2 -2
- package/dist/components/field/index.d.ts +3 -2
- package/dist/components/field/index.js +2 -2
- package/dist/components/field/types.d.ts +4 -1
- package/dist/components/field/useField.d.ts +1 -1
- package/dist/components/floating/index.d.ts +1 -0
- package/dist/components/floating/index.js +0 -0
- package/dist/components/floating/types.d.ts +31 -0
- package/dist/components/floating/useFloatingPosition.d.ts +38 -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/icon-button.d.ts +1 -1
- package/dist/components/icon-button/index.d.ts +3 -2
- package/dist/components/icon-button/index.js +2 -1
- package/dist/components/icon-button/types.d.ts +5 -2
- package/dist/components/input/index.d.ts +3 -2
- package/dist/components/input/index.js +2 -1
- package/dist/components/input/input.d.ts +1 -1
- package/dist/components/input/types.d.ts +4 -1
- package/dist/components/input/useInput.d.ts +2 -2
- package/dist/components/modal/index.d.ts +3 -2
- package/dist/components/modal/index.js +2 -2
- package/dist/components/modal/modal.d.ts +1 -1
- package/dist/components/modal/types.d.ts +9 -2
- package/dist/components/modal/useModal.d.ts +1 -1
- package/dist/components/number-input/index.d.ts +3 -2
- package/dist/components/number-input/index.js +2 -2
- package/dist/components/number-input/number-input.d.ts +1 -1
- package/dist/components/number-input/types.d.ts +5 -2
- package/dist/components/number-input/useNumberInput.d.ts +2 -2
- package/dist/components/overlay/index.d.ts +3 -2
- package/dist/components/overlay/index.js +2 -1
- package/dist/components/overlay/overlay.d.ts +1 -1
- package/dist/components/overlay/types.d.ts +4 -1
- package/dist/components/overlay/useOverlay.d.ts +1 -1
- package/dist/components/popover/index.d.ts +3 -3
- package/dist/components/popover/index.js +2 -2
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/popover/types.d.ts +21 -11
- package/dist/components/popover/usePopover.d.ts +11 -2
- package/dist/components/progress/index.d.ts +3 -3
- package/dist/components/progress/index.js +2 -2
- package/dist/components/progress/progress.d.ts +1 -1
- package/dist/components/progress/types.d.ts +5 -2
- package/dist/components/progress/useProgress.d.ts +2 -2
- package/dist/components/radio/index.d.ts +4 -3
- package/dist/components/radio/index.js +2 -2
- package/dist/components/radio/radio-group.d.ts +1 -1
- package/dist/components/radio/radio.d.ts +9 -4
- package/dist/components/radio/types.d.ts +21 -4
- package/dist/components/radio/useRadio.d.ts +10 -5
- package/dist/components/select/index.d.ts +3 -2
- package/dist/components/select/index.js +2 -2
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/types.d.ts +4 -1
- package/dist/components/select/useSelect.d.ts +4 -3
- package/dist/components/slider/index.d.ts +4 -4
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/range-slider-tooltip.d.ts +37 -0
- package/dist/components/slider/range-slider.d.ts +8 -13
- package/dist/components/slider/slider.d.ts +5 -2
- package/dist/components/slider/sliderCore.d.ts +35 -0
- package/dist/components/slider/types.d.ts +14 -7
- package/dist/components/slider/useRangeSlider.d.ts +5 -7
- package/dist/components/slider/useRangeSliderPointer.d.ts +19 -0
- package/dist/components/slider/useRangeSliderTooltipCollision.d.ts +31 -2
- package/dist/components/slider/useRangeSliderTooltipState.d.ts +23 -0
- package/dist/components/slider/useSlider.d.ts +11 -15
- package/dist/components/switch/index.d.ts +3 -2
- package/dist/components/switch/index.js +2 -2
- package/dist/components/switch/switch.d.ts +5 -2
- package/dist/components/switch/types.d.ts +7 -2
- package/dist/components/switch/useSwitch.d.ts +4 -2
- package/dist/components/tabs/index.d.ts +7 -6
- package/dist/components/tabs/index.js +2 -2
- package/dist/components/tabs/tabs-content.d.ts +2 -2
- package/dist/components/tabs/tabs-list.d.ts +4 -4
- package/dist/components/tabs/tabs-trigger.d.ts +5 -5
- package/dist/components/tabs/tabs.d.ts +5 -5
- package/dist/components/tabs/types.d.ts +13 -4
- package/dist/components/tabs/useTabs.d.ts +1 -1
- package/dist/components/teleport-provider/index.d.ts +2 -0
- package/dist/components/teleport-provider/index.js +2 -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 +5 -0
- package/dist/components/textarea/index.d.ts +3 -2
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/textarea/textarea.d.ts +5 -2
- package/dist/components/textarea/types.d.ts +6 -1
- package/dist/components/textarea/useTextarea.d.ts +3 -2
- package/dist/components/toast/defaults.d.ts +7 -0
- package/dist/components/toast/index.d.ts +7 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toast/toast-provider.d.ts +21 -0
- package/dist/components/toast/toast-viewport.d.ts +34 -0
- package/dist/components/toast/toast.d.ts +31 -0
- package/dist/components/toast/types.d.ts +110 -0
- package/dist/components/toast/useToast.d.ts +4 -0
- package/dist/components/toast/useToastColor.d.ts +3 -0
- package/dist/components/toast/useToastState.d.ts +2 -0
- package/dist/components/tooltip/index.d.ts +3 -2
- package/dist/components/tooltip/index.js +2 -1
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/components/tooltip/types.d.ts +14 -13
- package/dist/components/tooltip/useTooltip.d.ts +15 -3
- package/dist/dropdown-menu.css +191 -107
- package/dist/dropdown-menu.js +1729 -107
- package/dist/field.css +41 -39
- package/dist/field.js +40 -16
- 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 +35 -30
- package/dist/index.js +36 -31
- package/dist/input.css +122 -120
- package/dist/input.js +47 -34
- package/dist/input2.js +9 -0
- package/dist/legacy-unlayered.css +5461 -0
- package/dist/modal.css +129 -127
- package/dist/modal.js +160 -200
- package/dist/number-input.css +87 -85
- package/dist/number-input.js +61 -17
- 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 +295 -189
- 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 +154 -56
- package/dist/select.css +244 -242
- package/dist/select.js +92 -47
- package/dist/slider.css +1109 -904
- package/dist/slider.js +1118 -923
- 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 +89 -33
- 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 +77 -29
- package/dist/toast.css +236 -0
- package/dist/toast.js +739 -0
- package/dist/tooltip.css +137 -107
- package/dist/tooltip.js +182 -223
- package/dist/tooltip2.js +8 -0
- package/dist/useClickOutside.js +1 -1
- package/dist/useFloatingPosition.js +1284 -0
- package/dist/useFocusTrap.js +130 -0
- package/dist/useTeleportTarget.js +29 -0
- package/dist/utils/componentColors.d.ts +60 -0
- package/docs/public-styles-api.md +133 -0
- package/docs/public-tokens.md +545 -0
- package/package.json +44 -12
- package/src/styles/_tokens.scss +33 -28
- package/src/styles/_utilities.scss +11 -9
- package/src/styles/styles-manifest.json +4125 -0
- package/dist/components/slider/useRangeSliderTooltipTransition.d.ts +0 -4
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HTMLAttributes, StyleValue } from 'vue';
|
|
2
|
+
export type StylesApiClassNames<Part extends string> = Partial<Record<Part, HTMLAttributes['class']>>;
|
|
3
|
+
export type StylesApiStyles<Part extends string> = Partial<Record<Part, StyleValue>>;
|
|
4
|
+
export interface StylesApiProps<Part extends string> {
|
|
5
|
+
classNames?: StylesApiClassNames<Part>;
|
|
6
|
+
styles?: StylesApiStyles<Part>;
|
|
7
|
+
}
|
|
8
|
+
export interface StylesApiPartOptions {
|
|
9
|
+
class?: HTMLAttributes['class'];
|
|
10
|
+
style?: StyleValue;
|
|
11
|
+
compatibilityClass?: HTMLAttributes['class'];
|
|
12
|
+
compatibilityStyle?: StyleValue;
|
|
13
|
+
}
|
|
14
|
+
type StylesApiSource<Part extends string> = Pick<StylesApiProps<Part>, 'classNames' | 'styles'>;
|
|
15
|
+
export declare function presence(value: unknown): '' | undefined;
|
|
16
|
+
export declare function resolveStylesApiPart<Part extends string>(source: Readonly<StylesApiSource<Part>>, part: Part, options?: StylesApiPartOptions): Pick<HTMLAttributes, 'class' | 'style'>;
|
|
17
|
+
export declare function useStylesApi<Part extends string>(source: Readonly<StylesApiSource<Part>>, rootPart: Part): {
|
|
18
|
+
attrs: import('vue').Attrs;
|
|
19
|
+
getPartAttrs: (part: Part, options?: StylesApiPartOptions) => Pick<HTMLAttributes, "class" | "style">;
|
|
20
|
+
getRootAttrs: (internalAttrs?: object, options?: Omit<StylesApiPartOptions, "class" | "style">, excludedAttrs?: readonly string[]) => Record<string, unknown>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { mergeProps, useAttrs } from "vue";
|
|
2
|
+
//#region src/styles-api.ts
|
|
3
|
+
function presence(value) {
|
|
4
|
+
return value ? "" : void 0;
|
|
5
|
+
}
|
|
6
|
+
function resolveStylesApiPart(source, part, options = {}) {
|
|
7
|
+
return {
|
|
8
|
+
class: [
|
|
9
|
+
options.class,
|
|
10
|
+
options.compatibilityClass,
|
|
11
|
+
source.classNames?.[part]
|
|
12
|
+
],
|
|
13
|
+
style: [
|
|
14
|
+
options.style,
|
|
15
|
+
options.compatibilityStyle,
|
|
16
|
+
source.styles?.[part]
|
|
17
|
+
]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function useStylesApi(source, rootPart) {
|
|
21
|
+
const attrs = useAttrs();
|
|
22
|
+
function getPartAttrs(part, options = {}) {
|
|
23
|
+
return resolveStylesApiPart(source, part, options);
|
|
24
|
+
}
|
|
25
|
+
function getRootAttrs(internalAttrs = {}, options = {}, excludedAttrs = []) {
|
|
26
|
+
const internalRecord = internalAttrs;
|
|
27
|
+
const { class: attrClass, style: attrStyle, ...candidateAttrs } = attrs;
|
|
28
|
+
const merged = mergeProps(internalRecord, Object.fromEntries(Object.entries(candidateAttrs).filter(([name]) => !excludedAttrs.includes(name))));
|
|
29
|
+
for (const [name, value] of Object.entries(internalRecord)) {
|
|
30
|
+
if (name === "class" || name === "style" || /^on[A-Z]/.test(name)) continue;
|
|
31
|
+
merged[name] = value;
|
|
32
|
+
}
|
|
33
|
+
const partAttrs = resolveStylesApiPart(source, rootPart, {
|
|
34
|
+
class: internalRecord.class,
|
|
35
|
+
style: internalRecord.style,
|
|
36
|
+
...options
|
|
37
|
+
});
|
|
38
|
+
merged.class = [partAttrs.class, attrClass];
|
|
39
|
+
merged.style = [partAttrs.style, attrStyle];
|
|
40
|
+
return merged;
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
attrs,
|
|
44
|
+
getPartAttrs,
|
|
45
|
+
getRootAttrs
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { useStylesApi as n, presence as t };
|
package/dist/switch.css
CHANGED
|
@@ -1,109 +1,121 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
.rp-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
1
|
+
@layer ropav.components {
|
|
2
|
+
.rp-switch[data-v-403c12b8] {
|
|
3
|
+
--_rp-switch-color: var(--rp-color-control-selected-bg);
|
|
4
|
+
--_rp-switch-font-size: var(--rp-font-size-md);
|
|
5
|
+
--_rp-switch-default-track-width: 46px;
|
|
6
|
+
--_rp-switch-default-track-height: 24px;
|
|
7
|
+
--_rp-switch-default-thumb-size: 18px;
|
|
8
|
+
--_rp-switch-default-thumb-offset: 2px;
|
|
9
|
+
--_rp-switch-track-width: var(--rp-switch-track-width, var(--_rp-switch-default-track-width));
|
|
10
|
+
--_rp-switch-track-height: var(
|
|
11
|
+
--rp-switch-track-height,
|
|
12
|
+
var(--_rp-switch-default-track-height)
|
|
13
|
+
);
|
|
14
|
+
--_rp-switch-thumb-size: var(--rp-switch-thumb-size, var(--_rp-switch-default-thumb-size));
|
|
15
|
+
--_rp-switch-thumb-offset: var(
|
|
16
|
+
--rp-switch-thumb-offset,
|
|
17
|
+
var(--_rp-switch-default-thumb-offset)
|
|
18
|
+
);
|
|
19
|
+
--_rp-switch-track-bg: var(--rp-color-control-track-bg);
|
|
20
|
+
--_rp-switch-thumb-bg: var(--rp-color-control-thumb-bg);
|
|
21
|
+
--_rp-switch-invalid-border: var(--rp-color-red-filled);
|
|
22
|
+
--_rp-switch-invalid-ring: color-mix(in srgb, var(--rp-color-red-filled) 32%, transparent);
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
font-family: var(--rp-font-family);
|
|
27
|
+
user-select: none;
|
|
28
|
+
}
|
|
29
|
+
.rp-switch--disabled[data-v-403c12b8] {
|
|
30
|
+
opacity: var(--rp-opacity-disabled);
|
|
31
|
+
cursor: not-allowed;
|
|
32
|
+
}
|
|
33
|
+
.rp-switch[data-v-403c12b8] {
|
|
34
|
+
gap: var(--rp-spacing-2);
|
|
35
|
+
font-size: var(--_rp-switch-font-size);
|
|
36
|
+
}
|
|
37
|
+
.rp-switch__native[data-v-403c12b8] {
|
|
38
|
+
position: absolute;
|
|
39
|
+
width: 1px;
|
|
40
|
+
height: 1px;
|
|
41
|
+
padding: 0;
|
|
42
|
+
margin: -1px;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
clip: rect(0, 0, 0, 0);
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
border-width: 0;
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
}
|
|
49
|
+
.rp-switch__native:focus-visible + .rp-switch__track[data-v-403c12b8] {
|
|
50
|
+
border-color: var(--rp-color-control-border-focus);
|
|
51
|
+
box-shadow: 0 0 0 var(--rp-border-width-medium) var(--rp-color-focus-ring);
|
|
52
|
+
}
|
|
53
|
+
.rp-switch__track[data-v-403c12b8] {
|
|
54
|
+
position: relative;
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
width: var(--_rp-switch-track-width);
|
|
58
|
+
height: var(--_rp-switch-track-height);
|
|
59
|
+
flex-shrink: 0;
|
|
60
|
+
background-color: var(--_rp-switch-track-bg);
|
|
61
|
+
border-radius: var(--rp-radius-full);
|
|
62
|
+
transition: background-color var(--rp-transition-fast);
|
|
63
|
+
}
|
|
64
|
+
.rp-switch--checked .rp-switch__track[data-v-403c12b8] {
|
|
65
|
+
background-color: var(--_rp-switch-color);
|
|
66
|
+
}
|
|
67
|
+
.rp-switch--invalid .rp-switch__track[data-v-403c12b8] {
|
|
68
|
+
outline: var(--rp-border-width-thin) solid var(--_rp-switch-invalid-border);
|
|
69
|
+
outline-offset: var(--_rp-switch-thumb-offset);
|
|
70
|
+
}
|
|
71
|
+
.rp-switch--invalid .rp-switch__native:focus-visible + .rp-switch__track[data-v-403c12b8] {
|
|
72
|
+
box-shadow: 0 0 0 var(--rp-border-width-medium) var(--_rp-switch-invalid-ring);
|
|
73
|
+
}
|
|
74
|
+
.rp-switch__thumb[data-v-403c12b8] {
|
|
75
|
+
position: absolute;
|
|
76
|
+
left: var(--_rp-switch-thumb-offset);
|
|
77
|
+
width: var(--_rp-switch-thumb-size);
|
|
78
|
+
height: var(--_rp-switch-thumb-size);
|
|
79
|
+
background-color: var(--_rp-switch-thumb-bg);
|
|
80
|
+
border-radius: var(--rp-radius-full);
|
|
81
|
+
box-shadow: var(--rp-shadow-sm);
|
|
82
|
+
transition: transform var(--rp-transition-fast);
|
|
83
|
+
}
|
|
84
|
+
.rp-switch--checked .rp-switch__thumb[data-v-403c12b8] {
|
|
85
|
+
transform: translateX(calc(var(--_rp-switch-track-width) - var(--_rp-switch-thumb-size) - var(--_rp-switch-thumb-offset) * 2));
|
|
86
|
+
}
|
|
87
|
+
.rp-switch__label[data-v-403c12b8] {
|
|
88
|
+
line-height: var(--rp-line-height-md);
|
|
89
|
+
color: var(--rp-color-text);
|
|
90
|
+
}
|
|
91
|
+
.rp-switch--size-xs[data-v-403c12b8] {
|
|
92
|
+
--_rp-switch-default-track-width: 32px;
|
|
93
|
+
--_rp-switch-default-track-height: 16px;
|
|
94
|
+
--_rp-switch-default-thumb-size: 12px;
|
|
95
|
+
--_rp-switch-font-size: var(--rp-font-size-xs);
|
|
96
|
+
}
|
|
97
|
+
.rp-switch--size-sm[data-v-403c12b8] {
|
|
98
|
+
--_rp-switch-default-track-width: 38px;
|
|
99
|
+
--_rp-switch-default-track-height: 20px;
|
|
100
|
+
--_rp-switch-default-thumb-size: 14px;
|
|
101
|
+
--_rp-switch-font-size: var(--rp-font-size-sm);
|
|
102
|
+
}
|
|
103
|
+
.rp-switch--size-md[data-v-403c12b8] {
|
|
104
|
+
--_rp-switch-default-track-width: 46px;
|
|
105
|
+
--_rp-switch-default-track-height: 24px;
|
|
106
|
+
--_rp-switch-default-thumb-size: 18px;
|
|
107
|
+
--_rp-switch-font-size: var(--rp-font-size-md);
|
|
108
|
+
}
|
|
109
|
+
.rp-switch--size-lg[data-v-403c12b8] {
|
|
110
|
+
--_rp-switch-default-track-width: 56px;
|
|
111
|
+
--_rp-switch-default-track-height: 30px;
|
|
112
|
+
--_rp-switch-default-thumb-size: 22px;
|
|
113
|
+
--_rp-switch-font-size: var(--rp-font-size-lg);
|
|
114
|
+
}
|
|
115
|
+
.rp-switch--size-xl[data-v-403c12b8] {
|
|
116
|
+
--_rp-switch-default-track-width: 72px;
|
|
117
|
+
--_rp-switch-default-track-height: 36px;
|
|
118
|
+
--_rp-switch-default-thumb-size: 28px;
|
|
119
|
+
--_rp-switch-font-size: var(--rp-font-size-xl);
|
|
120
|
+
}
|
|
109
121
|
}
|
package/dist/switch.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import './switch.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 } from "./componentColors.js";
|
|
4
5
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
5
6
|
import { t as useControlState } from "./useControlState.js";
|
|
6
|
-
import { child, computed, createIf, createSlot, defineVaporComponent,
|
|
7
|
+
import { child, computed, createIf, createSlot, defineVaporComponent, next, ref, renderEffect, setDynamicProps, setInsertionState, setStaticTemplateRef, template, unref } from "vue";
|
|
7
8
|
//#region src/components/switch/useSwitch.ts
|
|
8
9
|
function getSwitchColorStyle(color) {
|
|
9
10
|
const colorValue = getComponentColorValue(color);
|
|
@@ -11,6 +12,7 @@ function getSwitchColorStyle(color) {
|
|
|
11
12
|
return { "--_rp-switch-color": colorValue };
|
|
12
13
|
}
|
|
13
14
|
function useSwitch(props, emitUpdate) {
|
|
15
|
+
const inputRef = ref(null);
|
|
14
16
|
const control = useControlState(props);
|
|
15
17
|
const rootClass = computed(() => bem("rp-switch", {
|
|
16
18
|
checked: props.modelValue,
|
|
@@ -22,21 +24,27 @@ function useSwitch(props, emitUpdate) {
|
|
|
22
24
|
function onChange(e) {
|
|
23
25
|
emitUpdate(e.target.checked);
|
|
24
26
|
}
|
|
27
|
+
function focus(options) {
|
|
28
|
+
inputRef.value?.focus(options);
|
|
29
|
+
}
|
|
25
30
|
return {
|
|
31
|
+
inputRef,
|
|
26
32
|
control,
|
|
27
33
|
rootClass,
|
|
28
34
|
rootStyle,
|
|
29
|
-
onChange
|
|
35
|
+
onChange,
|
|
36
|
+
focus
|
|
30
37
|
};
|
|
31
38
|
}
|
|
32
39
|
//#endregion
|
|
33
40
|
//#region src/components/switch/switch.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
34
|
-
var t0 = template("<span data-v-
|
|
35
|
-
var t1 = template("<label data-v-
|
|
41
|
+
var t0 = template("<span data-v-403c12b8>");
|
|
42
|
+
var t1 = template("<label data-v-403c12b8><input data-v-403c12b8><span data-v-403c12b8><span data-v-403c12b8></span></span>", 1);
|
|
36
43
|
//#endregion
|
|
37
44
|
//#region src/components/switch/switch.vue
|
|
38
45
|
var switch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
39
46
|
name: "RpSwitch",
|
|
47
|
+
inheritAttrs: false,
|
|
40
48
|
__name: "switch",
|
|
41
49
|
props: {
|
|
42
50
|
id: {},
|
|
@@ -58,48 +66,96 @@ var switch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
|
|
|
58
66
|
},
|
|
59
67
|
ariaLabel: {},
|
|
60
68
|
describedby: {},
|
|
61
|
-
labelledby: {}
|
|
69
|
+
labelledby: {},
|
|
70
|
+
inputAttrs: {},
|
|
71
|
+
classNames: {},
|
|
72
|
+
styles: {}
|
|
62
73
|
},
|
|
63
74
|
emits: ["update:modelValue"],
|
|
64
|
-
setup(__props, { emit: __emit, slots: $slots }) {
|
|
75
|
+
setup(__props, { expose: __expose, emit: __emit, slots: $slots }) {
|
|
65
76
|
const props = __props;
|
|
66
77
|
const emit = __emit;
|
|
67
|
-
const { control, rootClass, rootStyle, onChange } = useSwitch(props, (value) => {
|
|
78
|
+
const { inputRef, control, rootClass, rootStyle, onChange, focus } = useSwitch(props, (value) => {
|
|
68
79
|
emit("update:modelValue", value);
|
|
69
80
|
});
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
81
|
+
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
82
|
+
const rootAttrs = computed(() => getRootAttrs({
|
|
83
|
+
class: rootClass.value,
|
|
84
|
+
style: rootStyle.value,
|
|
85
|
+
"data-disabled": presence(control.disabled),
|
|
86
|
+
"data-invalid": presence(control.invalid),
|
|
87
|
+
"data-state": props.modelValue ? "checked" : "unchecked"
|
|
88
|
+
}));
|
|
89
|
+
const nativeInputAttrs = computed(() => {
|
|
90
|
+
const attrs = props.inputAttrs ?? {};
|
|
91
|
+
const { class: compatibilityClass, style: compatibilityStyle, ...forwardedAttrs } = attrs;
|
|
92
|
+
return {
|
|
93
|
+
...forwardedAttrs,
|
|
94
|
+
...getPartAttrs("input", {
|
|
95
|
+
class: "rp-switch__native",
|
|
96
|
+
compatibilityClass,
|
|
97
|
+
compatibilityStyle
|
|
98
|
+
}),
|
|
99
|
+
"data-disabled": presence(control.disabled),
|
|
100
|
+
"data-invalid": presence(control.invalid),
|
|
101
|
+
onChange(event) {
|
|
102
|
+
onChange(event);
|
|
103
|
+
attrs.onChange?.(event);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
__expose({
|
|
108
|
+
nativeElement: inputRef,
|
|
109
|
+
focus
|
|
110
|
+
});
|
|
111
|
+
const n7 = t1();
|
|
112
|
+
const n0 = child(n7);
|
|
113
|
+
const n2 = next(n0, 1);
|
|
114
|
+
const n1 = child(n2);
|
|
115
|
+
setStaticTemplateRef(n0, inputRef, null, "inputRef");
|
|
73
116
|
renderEffect(() => {
|
|
74
117
|
const _control = unref(control);
|
|
75
118
|
const _modelValue = __props.modelValue;
|
|
76
|
-
const
|
|
119
|
+
const _getPartAttrs = unref(getPartAttrs);
|
|
77
120
|
const _control_required = _control.required;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
121
|
+
setDynamicProps(n7, [rootAttrs.value]);
|
|
122
|
+
setDynamicProps(n0, [nativeInputAttrs.value, {
|
|
123
|
+
id: _control.id,
|
|
124
|
+
name: __props.name,
|
|
125
|
+
type: "checkbox",
|
|
126
|
+
role: "switch",
|
|
127
|
+
checked: _modelValue,
|
|
128
|
+
disabled: _control.disabled || void 0,
|
|
129
|
+
required: _control_required || void 0,
|
|
130
|
+
"aria-checked": _modelValue,
|
|
131
|
+
"aria-label": __props.ariaLabel || void 0,
|
|
132
|
+
"aria-labelledby": _control.ariaLabelledby,
|
|
133
|
+
"aria-describedby": _control.ariaDescribedby,
|
|
134
|
+
"aria-invalid": _control.invalid || void 0,
|
|
135
|
+
"aria-required": _control_required || void 0
|
|
136
|
+
}]);
|
|
137
|
+
setDynamicProps(n2, [_getPartAttrs("track", { class: "rp-switch__track" })]);
|
|
138
|
+
setDynamicProps(n1, [_getPartAttrs("thumb", { class: "rp-switch__thumb" })]);
|
|
93
139
|
});
|
|
94
|
-
setInsertionState(
|
|
140
|
+
setInsertionState(n7, null, 2);
|
|
95
141
|
createIf(() => $slots.default, () => {
|
|
96
|
-
const
|
|
97
|
-
|
|
142
|
+
const n6 = t0();
|
|
143
|
+
renderEffect(() => setDynamicProps(n6, [unref(getPartAttrs)("label", { class: "rp-switch__label" })]));
|
|
144
|
+
setInsertionState(n6, null, 0);
|
|
98
145
|
createSlot("default", null, null, 1);
|
|
99
|
-
return
|
|
146
|
+
return n6;
|
|
100
147
|
});
|
|
101
|
-
return
|
|
148
|
+
return n7;
|
|
102
149
|
}
|
|
103
|
-
}), [["__scopeId", "data-v-
|
|
150
|
+
}), [["__scopeId", "data-v-403c12b8"]]);
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/components/switch/types.ts
|
|
153
|
+
var switchParts = [
|
|
154
|
+
"root",
|
|
155
|
+
"input",
|
|
156
|
+
"track",
|
|
157
|
+
"thumb",
|
|
158
|
+
"label"
|
|
159
|
+
];
|
|
104
160
|
//#endregion
|
|
105
|
-
export { switch_default as t };
|
|
161
|
+
export { switch_default as n, switchParts as t };
|