vueless 0.0.176 → 0.0.177

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.
@@ -1,142 +0,0 @@
1
- <template>
2
- <div v-bind="wrapperAttrs(gridColsClass)">
3
- <div v-for="(item, index) in options" :key="id + index" v-bind="itemsAttrs">
4
- <label :for="id + index" v-bind="labelAttrs">
5
- <URadio
6
- :id="id + index"
7
- v-model="selectedItem"
8
- :value="item.value"
9
- :name="name"
10
- :label="item.label"
11
- :checked="item.value === selectedItem"
12
- :description="item.description"
13
- :label-align="labelAlign"
14
- v-bind="radioAttrs"
15
- >
16
- <!-- @slot Use it to add icon. -->
17
- <slot v-if="withIcon" name="icon" :item="item">
18
- <UIcon internal :name="item.iconName" size="xl" :color="color" v-bind="iconAttrs" />
19
- </slot>
20
- </URadio>
21
- </label>
22
- </div>
23
- </div>
24
- </template>
25
-
26
- <script setup>
27
- import { computed } from "vue";
28
-
29
- import UIcon from "../ui.image-icon";
30
- import URadio from "../ui.form-radio";
31
- import UIService, { getRandomId } from "../service.ui";
32
-
33
- import defaultConfig from "./configs/default.config";
34
- import { URadioCard } from "./constants";
35
- import { useAttrs } from "./composables/attrs.composable";
36
- import useBreakpoint from "../composable.breakpoint";
37
-
38
- /* Should be a string for correct web-types gen */
39
- defineOptions({ name: "URadioCard", inheritAttrs: false });
40
-
41
- const props = defineProps({
42
- /**
43
- * Set radio card name.
44
- */
45
- name: {
46
- type: String,
47
- required: true,
48
- default: "",
49
- },
50
-
51
- /**
52
- * Set options for component.
53
- */
54
- options: {
55
- type: Array,
56
- default: () => [],
57
- },
58
-
59
- /**
60
- * Set component value.
61
- */
62
- modelValue: {
63
- type: [String, Number, Boolean],
64
- default: "",
65
- },
66
-
67
- /**
68
- * Set grid cols number.
69
- */
70
- gridCols: {
71
- type: Number,
72
- default: UIService.get(defaultConfig, URadioCard).default.gridCols,
73
- },
74
-
75
- /**
76
- * Show / hide component icon.
77
- */
78
- withIcon: {
79
- type: Boolean,
80
- default: UIService.get(defaultConfig, URadioCard).default.withIcon,
81
- },
82
-
83
- /**
84
- * The color of the icon.
85
- * @values brand, grayscale, black, white, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
86
- */
87
- color: {
88
- type: String,
89
- default: UIService.get(defaultConfig, URadioCard).default.color,
90
- },
91
-
92
- /**
93
- * Generates unique element id.
94
- * @ignore
95
- */
96
- id: {
97
- type: String,
98
- default: () => getRandomId(),
99
- },
100
-
101
- labelAlign: {
102
- type: String,
103
- default: UIService.get(defaultConfig, URadioCard).default.labelAlign,
104
- },
105
-
106
- /**
107
- * Sets component ui config object.
108
- */
109
- config: {
110
- type: Object,
111
- default: () => ({}),
112
- },
113
-
114
- /**
115
- * Sets data-cy attribute for automated testing.
116
- */
117
- dataCy: {
118
- type: String,
119
- default: "",
120
- },
121
- });
122
-
123
- const emit = defineEmits(["update:modelValue"]);
124
-
125
- const { radioAttrs, iconAttrs, wrapperAttrs, labelAttrs, itemsAttrs } = useAttrs(props);
126
-
127
- const { isMobileBreakpoint } = useBreakpoint();
128
-
129
- const selectedItem = computed({
130
- get: () => props.modelValue,
131
- set: (value) => emit("update:modelValue", value),
132
- });
133
-
134
- const gridColsClass = computed(() => {
135
- return {
136
- "grid-cols-1": isMobileBreakpoint.value,
137
- "grid-cols-2": props.gridCols === 2 && isMobileBreakpoint.value,
138
- "grid-cols-3": props.gridCols === 3 && isMobileBreakpoint.value,
139
- "grid-cols-4": props.gridCols === 4 && isMobileBreakpoint.value,
140
- };
141
- });
142
- </script>
@@ -1,15 +0,0 @@
1
- import { cva } from "../service.ui";
2
-
3
- export default class VariantService {
4
- static get(config) {
5
- const { radio } = config;
6
-
7
- const radioVariants = cva({
8
- base: radio.base,
9
- variants: radio.variants,
10
- compoundVariants: radio.compoundVariants,
11
- });
12
-
13
- return { radioVariants };
14
- }
15
- }