vueless 0.0.175 → 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.
- package/package.json +2 -2
- package/ui.data-table/components/TableRow.vue +170 -0
- package/ui.data-table/composables/attrs.composable.js +30 -11
- package/ui.data-table/configs/default.config.js +27 -8
- package/ui.data-table/index.stories.js +106 -16
- package/ui.data-table/index.vue +49 -166
- package/ui.data-table/services/table.service.js +49 -9
- package/ui.dropdown-list/configs/default.config.js +2 -2
- package/ui.form-checkbox/configs/default.config.js +3 -2
- package/ui.form-checkbox/index.vue +3 -1
- package/ui.form-input/configs/default.config.js +3 -3
- package/ui.form-label/configs/default.config.js +31 -25
- package/ui.form-label/index.vue +3 -13
- package/ui.form-radio/configs/default.config.js +3 -0
- package/ui.form-radio/index.vue +1 -1
- package/ui.form-select/configs/default.config.js +8 -8
- package/ui.form-select/index.vue +13 -3
- package/ui.form-textarea/configs/default.config.js +10 -13
- package/ui.loader-rendering/Docs.mdx +2 -1
- package/ui.loader-rendering/index.stories.js +20 -15
- package/ui.loader-top/Docs.mdx +40 -8
- package/ui.loader-top/composables/useLoaderTop.js +10 -23
- package/ui.loader-top/index.stories.js +28 -23
- package/ui.loader-top/index.vue +21 -21
- package/web-types.json +100 -134
- package/ui.form-radio-card/Docs.mdx +0 -16
- package/ui.form-radio-card/composables/attrs.composable.js +0 -37
- package/ui.form-radio-card/configs/default.config.js +0 -31
- package/ui.form-radio-card/constants/index.js +0 -5
- package/ui.form-radio-card/index.stories.js +0 -152
- package/ui.form-radio-card/index.vue +0 -142
- package/ui.form-radio-card/services/variant.service.js +0 -15
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.177",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -181,6 +181,93 @@
|
|
|
181
181
|
"symbol": "default"
|
|
182
182
|
}
|
|
183
183
|
},
|
|
184
|
+
{
|
|
185
|
+
"name": "TableRow",
|
|
186
|
+
"description": "",
|
|
187
|
+
"attributes": [
|
|
188
|
+
{
|
|
189
|
+
"name": "row",
|
|
190
|
+
"required": true,
|
|
191
|
+
"value": {
|
|
192
|
+
"kind": "expression",
|
|
193
|
+
"type": "object"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"name": "columns",
|
|
198
|
+
"required": true,
|
|
199
|
+
"value": {
|
|
200
|
+
"kind": "expression",
|
|
201
|
+
"type": "array"
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "tag",
|
|
206
|
+
"value": {
|
|
207
|
+
"kind": "expression",
|
|
208
|
+
"type": "string"
|
|
209
|
+
},
|
|
210
|
+
"default": "\"tr\""
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"name": "selectable",
|
|
214
|
+
"value": {
|
|
215
|
+
"kind": "expression",
|
|
216
|
+
"type": "boolean"
|
|
217
|
+
},
|
|
218
|
+
"default": "false"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"name": "nestedLevel",
|
|
222
|
+
"value": {
|
|
223
|
+
"kind": "expression",
|
|
224
|
+
"type": "number"
|
|
225
|
+
},
|
|
226
|
+
"default": "0"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"name": "dataCy",
|
|
230
|
+
"required": true,
|
|
231
|
+
"value": {
|
|
232
|
+
"kind": "expression",
|
|
233
|
+
"type": "string"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"name": "attrs",
|
|
238
|
+
"required": true,
|
|
239
|
+
"value": {
|
|
240
|
+
"kind": "expression",
|
|
241
|
+
"type": "object"
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"name": "config",
|
|
246
|
+
"required": true,
|
|
247
|
+
"value": {
|
|
248
|
+
"kind": "expression",
|
|
249
|
+
"type": "object"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
],
|
|
253
|
+
"events": [
|
|
254
|
+
{
|
|
255
|
+
"name": "toggleRowVisibility"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"name": "click"
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
"slots": [
|
|
262
|
+
{
|
|
263
|
+
"name": "`cell-${key}`"
|
|
264
|
+
}
|
|
265
|
+
],
|
|
266
|
+
"source": {
|
|
267
|
+
"module": "./src/ui.data-table/components/TableRow.vue",
|
|
268
|
+
"symbol": "default"
|
|
269
|
+
}
|
|
270
|
+
},
|
|
184
271
|
{
|
|
185
272
|
"name": "UAccordion",
|
|
186
273
|
"description": "",
|
|
@@ -1057,7 +1144,7 @@
|
|
|
1057
1144
|
"description": "Checkbox size.",
|
|
1058
1145
|
"value": {
|
|
1059
1146
|
"kind": "expression",
|
|
1060
|
-
"type": "'sm' | 'md' | 'lg'"
|
|
1147
|
+
"type": "'xs' | 'sm' | 'md' | 'lg' | 'xl'"
|
|
1061
1148
|
},
|
|
1062
1149
|
"default": "md"
|
|
1063
1150
|
},
|
|
@@ -4276,7 +4363,7 @@
|
|
|
4276
4363
|
"description": "Set label size.",
|
|
4277
4364
|
"value": {
|
|
4278
4365
|
"kind": "expression",
|
|
4279
|
-
"type": "'sm' | 'md' | 'lg'"
|
|
4366
|
+
"type": "'xs' | 'sm' | 'md' | 'lg' | 'xl'"
|
|
4280
4367
|
},
|
|
4281
4368
|
"default": "md"
|
|
4282
4369
|
},
|
|
@@ -4655,22 +4742,22 @@
|
|
|
4655
4742
|
"description": "",
|
|
4656
4743
|
"attributes": [
|
|
4657
4744
|
{
|
|
4658
|
-
"name": "
|
|
4659
|
-
"description": "The
|
|
4745
|
+
"name": "color",
|
|
4746
|
+
"description": "The color of the loader stripe.",
|
|
4660
4747
|
"value": {
|
|
4661
4748
|
"kind": "expression",
|
|
4662
|
-
"type": "
|
|
4749
|
+
"type": "'brand' | 'grayscale' | 'gray' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'white'"
|
|
4663
4750
|
},
|
|
4664
|
-
"default": "
|
|
4751
|
+
"default": "brand"
|
|
4665
4752
|
},
|
|
4666
4753
|
{
|
|
4667
|
-
"name": "
|
|
4668
|
-
"description": "
|
|
4754
|
+
"name": "resources",
|
|
4755
|
+
"description": "API resource names (endpoint URIs).",
|
|
4669
4756
|
"value": {
|
|
4670
4757
|
"kind": "expression",
|
|
4671
|
-
"type": "
|
|
4758
|
+
"type": "string|array"
|
|
4672
4759
|
},
|
|
4673
|
-
"default": "
|
|
4760
|
+
"default": "\"\""
|
|
4674
4761
|
}
|
|
4675
4762
|
],
|
|
4676
4763
|
"source": {
|
|
@@ -5666,7 +5753,7 @@
|
|
|
5666
5753
|
"description": "Radio size.",
|
|
5667
5754
|
"value": {
|
|
5668
5755
|
"kind": "expression",
|
|
5669
|
-
"type": "'sm' | 'md' | 'lg'"
|
|
5756
|
+
"type": "'xs' | 'sm' | 'md' | 'lg' | 'xl'"
|
|
5670
5757
|
},
|
|
5671
5758
|
"default": "md"
|
|
5672
5759
|
},
|
|
@@ -5752,117 +5839,6 @@
|
|
|
5752
5839
|
"symbol": "default"
|
|
5753
5840
|
}
|
|
5754
5841
|
},
|
|
5755
|
-
{
|
|
5756
|
-
"name": "URadioCard",
|
|
5757
|
-
"description": "",
|
|
5758
|
-
"attributes": [
|
|
5759
|
-
{
|
|
5760
|
-
"name": "name",
|
|
5761
|
-
"required": true,
|
|
5762
|
-
"description": "Set radio card name.",
|
|
5763
|
-
"value": {
|
|
5764
|
-
"kind": "expression",
|
|
5765
|
-
"type": "string"
|
|
5766
|
-
},
|
|
5767
|
-
"default": "\"\""
|
|
5768
|
-
},
|
|
5769
|
-
{
|
|
5770
|
-
"name": "options",
|
|
5771
|
-
"description": "Set options for component.",
|
|
5772
|
-
"value": {
|
|
5773
|
-
"kind": "expression",
|
|
5774
|
-
"type": "array"
|
|
5775
|
-
},
|
|
5776
|
-
"default": "[]"
|
|
5777
|
-
},
|
|
5778
|
-
{
|
|
5779
|
-
"name": "modelValue",
|
|
5780
|
-
"description": "Set component value.",
|
|
5781
|
-
"value": {
|
|
5782
|
-
"kind": "expression",
|
|
5783
|
-
"type": "string|number|boolean"
|
|
5784
|
-
},
|
|
5785
|
-
"default": "\"\""
|
|
5786
|
-
},
|
|
5787
|
-
{
|
|
5788
|
-
"name": "gridCols",
|
|
5789
|
-
"description": "Set grid cols number.",
|
|
5790
|
-
"value": {
|
|
5791
|
-
"kind": "expression",
|
|
5792
|
-
"type": "number"
|
|
5793
|
-
},
|
|
5794
|
-
"default": "2"
|
|
5795
|
-
},
|
|
5796
|
-
{
|
|
5797
|
-
"name": "withIcon",
|
|
5798
|
-
"description": "Show / hide component icon.",
|
|
5799
|
-
"value": {
|
|
5800
|
-
"kind": "expression",
|
|
5801
|
-
"type": "boolean"
|
|
5802
|
-
},
|
|
5803
|
-
"default": "true"
|
|
5804
|
-
},
|
|
5805
|
-
{
|
|
5806
|
-
"name": "color",
|
|
5807
|
-
"description": "The color of the icon.",
|
|
5808
|
-
"value": {
|
|
5809
|
-
"kind": "expression",
|
|
5810
|
-
"type": "'brand' | 'grayscale' | 'black' | 'white' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose'"
|
|
5811
|
-
},
|
|
5812
|
-
"default": "brand"
|
|
5813
|
-
},
|
|
5814
|
-
{
|
|
5815
|
-
"name": "id",
|
|
5816
|
-
"description": "@ignore: Generates unique element id.",
|
|
5817
|
-
"value": {
|
|
5818
|
-
"kind": "expression",
|
|
5819
|
-
"type": "string"
|
|
5820
|
-
},
|
|
5821
|
-
"default": "() => getRandomId()"
|
|
5822
|
-
},
|
|
5823
|
-
{
|
|
5824
|
-
"name": "labelAlign",
|
|
5825
|
-
"value": {
|
|
5826
|
-
"kind": "expression",
|
|
5827
|
-
"type": "string"
|
|
5828
|
-
},
|
|
5829
|
-
"default": "top"
|
|
5830
|
-
},
|
|
5831
|
-
{
|
|
5832
|
-
"name": "config",
|
|
5833
|
-
"description": "Sets component ui config object.",
|
|
5834
|
-
"value": {
|
|
5835
|
-
"kind": "expression",
|
|
5836
|
-
"type": "object"
|
|
5837
|
-
},
|
|
5838
|
-
"default": "{}"
|
|
5839
|
-
},
|
|
5840
|
-
{
|
|
5841
|
-
"name": "dataCy",
|
|
5842
|
-
"description": "Sets data-cy attribute for automated testing.",
|
|
5843
|
-
"value": {
|
|
5844
|
-
"kind": "expression",
|
|
5845
|
-
"type": "string"
|
|
5846
|
-
},
|
|
5847
|
-
"default": "\"\""
|
|
5848
|
-
}
|
|
5849
|
-
],
|
|
5850
|
-
"events": [
|
|
5851
|
-
{
|
|
5852
|
-
"name": "update:modelValue"
|
|
5853
|
-
}
|
|
5854
|
-
],
|
|
5855
|
-
"slots": [
|
|
5856
|
-
{
|
|
5857
|
-
"name": "icon",
|
|
5858
|
-
"description": "Use it to add icon."
|
|
5859
|
-
}
|
|
5860
|
-
],
|
|
5861
|
-
"source": {
|
|
5862
|
-
"module": "./src/ui.form-radio-card/index.vue",
|
|
5863
|
-
"symbol": "default"
|
|
5864
|
-
}
|
|
5865
|
-
},
|
|
5866
5842
|
{
|
|
5867
5843
|
"name": "URadioGroup",
|
|
5868
5844
|
"description": "",
|
|
@@ -6642,15 +6618,6 @@
|
|
|
6642
6618
|
},
|
|
6643
6619
|
"default": "false"
|
|
6644
6620
|
},
|
|
6645
|
-
{
|
|
6646
|
-
"name": "nesting",
|
|
6647
|
-
"description": "Sets the nesting level from which folding button need to be shown.",
|
|
6648
|
-
"value": {
|
|
6649
|
-
"kind": "expression",
|
|
6650
|
-
"type": "number|boolean"
|
|
6651
|
-
},
|
|
6652
|
-
"default": "false"
|
|
6653
|
-
},
|
|
6654
6621
|
{
|
|
6655
6622
|
"name": "resource",
|
|
6656
6623
|
"description": "Set loader resource name to activate table top loader exact for that resource.",
|
|
@@ -6709,8 +6676,7 @@
|
|
|
6709
6676
|
"description": "Use it to add something before first row."
|
|
6710
6677
|
},
|
|
6711
6678
|
{
|
|
6712
|
-
"name": "`cell-${key}`"
|
|
6713
|
-
"description": "Use it to customise table cell item (in whole column)."
|
|
6679
|
+
"name": "`cell-${key}`"
|
|
6714
6680
|
},
|
|
6715
6681
|
{
|
|
6716
6682
|
"name": "after-last-row",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
|
|
2
|
-
import { getSource } from "../service.storybook";
|
|
3
|
-
|
|
4
|
-
import * as stories from "./index.stories";
|
|
5
|
-
import defaultConfig from "./configs/default.config?raw"
|
|
6
|
-
|
|
7
|
-
<Meta of={stories} />
|
|
8
|
-
<Title of={stories} />
|
|
9
|
-
<Subtitle of={stories} />
|
|
10
|
-
<Description of={stories} />
|
|
11
|
-
<Primary of={stories} />
|
|
12
|
-
<Controls of={stories.Default} />
|
|
13
|
-
<Stories of={stories} />
|
|
14
|
-
|
|
15
|
-
## Default config
|
|
16
|
-
<Source code={getSource(defaultConfig)} language="jsx" dark />
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import useUI from "../../composable.ui";
|
|
2
|
-
import { cva, cx } from "../../service.ui";
|
|
3
|
-
|
|
4
|
-
import defaultConfig from "../configs/default.config";
|
|
5
|
-
import { computed } from "vue";
|
|
6
|
-
|
|
7
|
-
export function useAttrs(props) {
|
|
8
|
-
const { config, getAttrs } = useUI(defaultConfig, () => props.config);
|
|
9
|
-
const { radio } = config.value;
|
|
10
|
-
|
|
11
|
-
const cvaRadio = cva({
|
|
12
|
-
base: radio.base,
|
|
13
|
-
variants: radio.variants,
|
|
14
|
-
compoundVariants: radio.compoundVariants,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const radioClasses = computed(() => cvaRadio({ color: props.color }));
|
|
18
|
-
|
|
19
|
-
const wrapperAttrsRaw = getAttrs("wrapper");
|
|
20
|
-
const itemsAttrs = getAttrs("items");
|
|
21
|
-
const labelAttrs = getAttrs("label");
|
|
22
|
-
const radioAttrs = getAttrs("radio", { isComponent: true, classes: radioClasses });
|
|
23
|
-
const iconAttrs = getAttrs("icon", { isComponent: true });
|
|
24
|
-
|
|
25
|
-
const wrapperAttrs = computed(() => (classes) => ({
|
|
26
|
-
...wrapperAttrsRaw.value,
|
|
27
|
-
class: cx([wrapperAttrsRaw.value.class, classes]),
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
radioAttrs,
|
|
32
|
-
iconAttrs,
|
|
33
|
-
wrapperAttrs,
|
|
34
|
-
labelAttrs,
|
|
35
|
-
itemsAttrs,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export default /*tw*/ {
|
|
2
|
-
wrapper: "grid grid-rows-1 gap-4 md:gap-6 text-center",
|
|
3
|
-
title: "text-base font-normal text-gray-900 mb-1 mt-3",
|
|
4
|
-
description: "text-xs font-normal text-gray-500/[85]",
|
|
5
|
-
radio: {
|
|
6
|
-
base: "w-full right-4 top-2 !gap-0",
|
|
7
|
-
radio: "absolute right-6 top-4",
|
|
8
|
-
},
|
|
9
|
-
label: "size-full cursor-pointer",
|
|
10
|
-
items: `
|
|
11
|
-
relative mr-1 w-full cursor-pointer rounded-lg border border-solid border-gray-300 px-6 py-4
|
|
12
|
-
focus-within:border-gray-500 focus-within:ring-4 focus-within:ring-gray-600/[.15] hover:border-gray-400
|
|
13
|
-
`,
|
|
14
|
-
icon: "mb-3 flex justify-center",
|
|
15
|
-
defaultVariants: {
|
|
16
|
-
color: "brand",
|
|
17
|
-
labelAlign: "top",
|
|
18
|
-
gridCols: 2,
|
|
19
|
-
withIcon: true,
|
|
20
|
-
},
|
|
21
|
-
safelist: (colors) => [
|
|
22
|
-
{ pattern: `border-(${colors})-100`, variants: ["disabled"] },
|
|
23
|
-
{ pattern: `border-(${colors})-300` },
|
|
24
|
-
{ pattern: `border-(${colors})-400`, variants: ["hover"] },
|
|
25
|
-
{ pattern: `border-(${colors})-500`, variants: ["focus", "active"] },
|
|
26
|
-
{ pattern: `text-(${colors})-500` },
|
|
27
|
-
{ pattern: `bg-(${colors})-100`, variants: ["disabled"] },
|
|
28
|
-
{ pattern: `bg-(${colors})-500`, variants: ["focus"] },
|
|
29
|
-
{ pattern: `ring-(${colors})-200`, variants: ["focus"] },
|
|
30
|
-
],
|
|
31
|
-
};
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames } from "../service.storybook";
|
|
2
|
-
|
|
3
|
-
import URadioCard from "../ui.form-radio-card";
|
|
4
|
-
import UIcon from "../ui.image-icon";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The `URadioCard` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.form-radio-card)
|
|
8
|
-
*/
|
|
9
|
-
export default {
|
|
10
|
-
id: "3150",
|
|
11
|
-
title: "Form Inputs & Controls / Radio Card",
|
|
12
|
-
component: URadioCard,
|
|
13
|
-
args: {
|
|
14
|
-
value: "radio card 1",
|
|
15
|
-
name: "radio",
|
|
16
|
-
options: [
|
|
17
|
-
{
|
|
18
|
-
iconName: "star",
|
|
19
|
-
iconFill: true,
|
|
20
|
-
value: "radio card 1",
|
|
21
|
-
description: "some description 1",
|
|
22
|
-
label: "title 1",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
iconName: "star",
|
|
26
|
-
iconFill: true,
|
|
27
|
-
value: "radio card 2",
|
|
28
|
-
description: "some description 2",
|
|
29
|
-
label: "title 2",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
iconName: "star",
|
|
33
|
-
iconFill: true,
|
|
34
|
-
value: "radio card 3",
|
|
35
|
-
description: "some description 3",
|
|
36
|
-
label: "title 3",
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
argTypes: {
|
|
41
|
-
...getArgTypes(URadioCard.name),
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const DefaultTemplate = (args) => ({
|
|
46
|
-
components: { URadioCard },
|
|
47
|
-
setup() {
|
|
48
|
-
const slots = getSlotNames(URadioCard.name);
|
|
49
|
-
|
|
50
|
-
return { args, slots };
|
|
51
|
-
},
|
|
52
|
-
template: `
|
|
53
|
-
<URadioCard v-bind="args">
|
|
54
|
-
<template v-for="(slot, index) of slots" :key="index" v-slot:[slot]>
|
|
55
|
-
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
56
|
-
</template>
|
|
57
|
-
</URadioCard>
|
|
58
|
-
`,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const SlotTemplate = (args) => ({
|
|
62
|
-
components: { URadioCard, UIcon },
|
|
63
|
-
setup() {
|
|
64
|
-
return { args };
|
|
65
|
-
},
|
|
66
|
-
template: `
|
|
67
|
-
<URadioCard v-bind="args">
|
|
68
|
-
${args.slotTemplate}
|
|
69
|
-
</URadioCard>
|
|
70
|
-
`,
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
export const Default = DefaultTemplate.bind({});
|
|
74
|
-
Default.args = {};
|
|
75
|
-
|
|
76
|
-
export const gridCols3 = DefaultTemplate.bind({});
|
|
77
|
-
gridCols3.args = {
|
|
78
|
-
gridCols: 3,
|
|
79
|
-
value: "radio card 4",
|
|
80
|
-
name: "radio 2",
|
|
81
|
-
options: [
|
|
82
|
-
{
|
|
83
|
-
value: "radio card 4",
|
|
84
|
-
description: "some description 1",
|
|
85
|
-
iconName: "star",
|
|
86
|
-
iconFill: true,
|
|
87
|
-
label: "title 1",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
value: "radio card 5",
|
|
91
|
-
description: "some description 2",
|
|
92
|
-
iconName: "star",
|
|
93
|
-
iconFill: true,
|
|
94
|
-
label: "title 2",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
value: "radio card 6",
|
|
98
|
-
description: "some description 3",
|
|
99
|
-
iconName: "star",
|
|
100
|
-
iconFill: true,
|
|
101
|
-
label: "title 3",
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export const withoutIcon = DefaultTemplate.bind({});
|
|
107
|
-
withoutIcon.args = {
|
|
108
|
-
withIcon: false,
|
|
109
|
-
value: "radio card 7",
|
|
110
|
-
name: "radio 3",
|
|
111
|
-
options: [
|
|
112
|
-
{
|
|
113
|
-
value: "radio card 7",
|
|
114
|
-
description: "some description 1",
|
|
115
|
-
iconName: "star",
|
|
116
|
-
iconFill: true,
|
|
117
|
-
label: "title 1",
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
value: "radio card 8",
|
|
121
|
-
description: "some description 2",
|
|
122
|
-
iconName: "star",
|
|
123
|
-
iconFill: true,
|
|
124
|
-
label: "title 2",
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
value: "radio card 9",
|
|
128
|
-
description: "some description 3",
|
|
129
|
-
iconName: "star",
|
|
130
|
-
iconFill: true,
|
|
131
|
-
label: "title 3",
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export const iconSlot = SlotTemplate.bind({});
|
|
137
|
-
iconSlot.args = {
|
|
138
|
-
value: "radio card 10",
|
|
139
|
-
name: "radio 4",
|
|
140
|
-
options: [
|
|
141
|
-
{ value: "radio card 10", description: "some description 1", title: "title 1" },
|
|
142
|
-
{ value: "radio card 11", description: "some description 2", title: "title 2" },
|
|
143
|
-
],
|
|
144
|
-
slotTemplate: `
|
|
145
|
-
<template #icon>
|
|
146
|
-
<UIcon
|
|
147
|
-
name="star"
|
|
148
|
-
size="lg"
|
|
149
|
-
/>
|
|
150
|
-
</template>
|
|
151
|
-
`,
|
|
152
|
-
};
|
|
@@ -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>
|