sprintify-ui 0.0.33 → 0.0.35
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 +2 -2
- package/dist/sprintify-ui.es.js +886 -814
- package/dist/types/src/components/BaseButtonGroup.vue.d.ts +16 -16
- package/dist/types/src/components/BaseDataIterator.vue.d.ts +1 -32
- package/dist/types/src/components/BaseDataTable.vue.d.ts +1 -32
- package/dist/types/src/components/BaseRadioGroup.vue.d.ts +226 -0
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/index.d.ts +0 -2
- package/package.json +1 -1
- package/src/components/BaseButtonGroup.stories.js +5 -8
- package/src/components/BaseButtonGroup.vue +17 -17
- package/src/components/BaseDataIterator.vue +0 -8
- package/src/components/BaseDataTable.vue +0 -9
- package/src/components/BaseRadioGroup.stories.js +88 -0
- package/src/components/BaseRadioGroup.vue +84 -0
- package/src/components/index.ts +2 -0
- package/src/index.ts +0 -3
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import BaseRadioGroup from './BaseRadioGroup.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form/BaseRadioGroup',
|
|
5
|
+
component: BaseRadioGroup,
|
|
6
|
+
argTypes: {},
|
|
7
|
+
args: {
|
|
8
|
+
name: 'character',
|
|
9
|
+
labelKey: 'label',
|
|
10
|
+
valueKey: 'value',
|
|
11
|
+
options: [
|
|
12
|
+
{ label: 'Dark Vader', value: 'dark_vader' },
|
|
13
|
+
{ label: 'Darth Maul', value: 'darth_maul' },
|
|
14
|
+
{ label: 'Dark Sidious', value: 'dark_sidious' },
|
|
15
|
+
{ label: 'Obi Wan Kenobi', value: 'obiwan' },
|
|
16
|
+
{ label: 'Anakin Skywalker', value: 'anakin' },
|
|
17
|
+
{ label: 'Mace Windu', value: 'windu' },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => ({
|
|
24
|
+
components: { BaseRadioGroup },
|
|
25
|
+
setup() {
|
|
26
|
+
const value = ref(null);
|
|
27
|
+
function onSubmit() {
|
|
28
|
+
alert('submit');
|
|
29
|
+
}
|
|
30
|
+
return { args, value, onSubmit };
|
|
31
|
+
},
|
|
32
|
+
template: `
|
|
33
|
+
<form @submit.prevent="onSubmit">
|
|
34
|
+
<BaseRadioGroup v-model="value" v-bind="args"></BaseRadioGroup>
|
|
35
|
+
<button type="submit" class="btn btn-primary mt-4">Submit</button>
|
|
36
|
+
<p class="mt-5 text-sm">Value: <span class="bg-slate-200 font-mono px-1 py-px rounded">{{ value ?? 'NULL' }}</span></p>
|
|
37
|
+
</form>
|
|
38
|
+
`,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const Demo = Template.bind({});
|
|
42
|
+
Demo.args = {};
|
|
43
|
+
|
|
44
|
+
export const Required = Template.bind({});
|
|
45
|
+
Required.args = {
|
|
46
|
+
required: true,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Disabled = Template.bind({});
|
|
50
|
+
Disabled.args = {
|
|
51
|
+
disabled: true,
|
|
52
|
+
modelValue: { label: 'Dark Maul', value: 'darth_maul' },
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const SlotOption = (args) => ({
|
|
56
|
+
components: { BaseRadioGroup },
|
|
57
|
+
setup() {
|
|
58
|
+
const value = ref(null);
|
|
59
|
+
|
|
60
|
+
const options = [
|
|
61
|
+
{ label: 'Red', value: 'red' },
|
|
62
|
+
{ label: 'Blue', value: 'blue' },
|
|
63
|
+
{ label: 'Green', value: 'green' },
|
|
64
|
+
{ label: 'Black', value: 'black' },
|
|
65
|
+
{ label: 'Gray', value: 'gray' },
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
return { value, options, args };
|
|
69
|
+
},
|
|
70
|
+
template: `
|
|
71
|
+
<BaseRadioGroup
|
|
72
|
+
v-bind="args"
|
|
73
|
+
v-model="value"
|
|
74
|
+
:options="options"
|
|
75
|
+
label-class="flex space-x-2 items-start"
|
|
76
|
+
>
|
|
77
|
+
<template #option="{ option }">
|
|
78
|
+
<div>
|
|
79
|
+
<div class="flex items-center space-x-1">
|
|
80
|
+
<div style="height: 10px; width: 10px; border-radius: 4px;" :style="{ backgroundColor: option.value }"></div>
|
|
81
|
+
<div class="leading-none font-medium text-sm">{{ option.label }}</div>
|
|
82
|
+
</div>
|
|
83
|
+
<p class="text-slate-500 text-xs leading-tight">{{ option.value }}</p>
|
|
84
|
+
</div>
|
|
85
|
+
</template>
|
|
86
|
+
</BaseRadioGroup>
|
|
87
|
+
`,
|
|
88
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<ul class="space-y-3">
|
|
4
|
+
<li v-for="option in normalizedOptions" :key="option.value">
|
|
5
|
+
<label
|
|
6
|
+
:for="name + '-' + option.value"
|
|
7
|
+
class="cursor-pointer"
|
|
8
|
+
:class="[labelClass, disabled ? 'cursor-not-allowed opacity-50' : '']"
|
|
9
|
+
>
|
|
10
|
+
<input
|
|
11
|
+
:id="name + '-' + option.value"
|
|
12
|
+
type="radio"
|
|
13
|
+
:name="name"
|
|
14
|
+
:checked="isSelected(option)"
|
|
15
|
+
:required="required"
|
|
16
|
+
:disabled="disabled"
|
|
17
|
+
:value="option.value"
|
|
18
|
+
:class="inputClass"
|
|
19
|
+
@input="emit('update:modelValue', option.option)"
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<slot name="option" :option="option">
|
|
23
|
+
<span class="text-sm">{{ option.label }}</span>
|
|
24
|
+
</slot>
|
|
25
|
+
</label>
|
|
26
|
+
</li>
|
|
27
|
+
</ul>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script lang="ts" setup>
|
|
32
|
+
import { PropType } from 'vue';
|
|
33
|
+
import { Option } from '@/types/types';
|
|
34
|
+
import { useHasOptions } from '@/composables/hasOptions';
|
|
35
|
+
|
|
36
|
+
const props = defineProps({
|
|
37
|
+
modelValue: {
|
|
38
|
+
default: undefined,
|
|
39
|
+
type: [Object, null] as PropType<Option | undefined>,
|
|
40
|
+
},
|
|
41
|
+
name: {
|
|
42
|
+
required: true,
|
|
43
|
+
type: String,
|
|
44
|
+
},
|
|
45
|
+
required: {
|
|
46
|
+
default: false,
|
|
47
|
+
type: Boolean,
|
|
48
|
+
},
|
|
49
|
+
disabled: {
|
|
50
|
+
default: false,
|
|
51
|
+
type: Boolean,
|
|
52
|
+
},
|
|
53
|
+
options: {
|
|
54
|
+
required: true,
|
|
55
|
+
type: Array as PropType<Option[]>,
|
|
56
|
+
},
|
|
57
|
+
labelKey: {
|
|
58
|
+
required: true,
|
|
59
|
+
type: String,
|
|
60
|
+
},
|
|
61
|
+
valueKey: {
|
|
62
|
+
required: true,
|
|
63
|
+
type: String,
|
|
64
|
+
},
|
|
65
|
+
labelClass: {
|
|
66
|
+
default: 'flex space-x-2',
|
|
67
|
+
type: String,
|
|
68
|
+
},
|
|
69
|
+
inputClass: {
|
|
70
|
+
default: 'mt-0.5 border-slate-300',
|
|
71
|
+
type: String,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const emit = defineEmits(['update:modelValue']);
|
|
76
|
+
|
|
77
|
+
const { normalizedOptions, isSelected } = useHasOptions(
|
|
78
|
+
computed(() => props.modelValue),
|
|
79
|
+
computed(() => props.options),
|
|
80
|
+
computed(() => props.labelKey),
|
|
81
|
+
computed(() => props.valueKey),
|
|
82
|
+
computed(() => false)
|
|
83
|
+
);
|
|
84
|
+
</script>
|
package/src/components/index.ts
CHANGED
|
@@ -46,6 +46,7 @@ import BasePagination from './BasePagination.vue';
|
|
|
46
46
|
import BasePanel from './BasePanel.vue';
|
|
47
47
|
import BasePassword from './BasePassword.vue';
|
|
48
48
|
import BaseProgressCircle from './BaseProgressCircle.vue';
|
|
49
|
+
import BaseRadioGroup from './BaseRadioGroup.vue';
|
|
49
50
|
import BaseReadMore from './BaseReadMore.vue';
|
|
50
51
|
import BaseSelect from './BaseSelect.vue';
|
|
51
52
|
import BaseSideNavigation from './BaseSideNavigation.vue';
|
|
@@ -116,6 +117,7 @@ export {
|
|
|
116
117
|
BasePanel,
|
|
117
118
|
BasePassword,
|
|
118
119
|
BaseProgressCircle,
|
|
120
|
+
BaseRadioGroup,
|
|
119
121
|
BaseReadMore,
|
|
120
122
|
BaseSelect,
|
|
121
123
|
BaseSideNavigation,
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ import fr from '@/lang/fr.json';
|
|
|
8
8
|
import { useDialogsStore } from './stores/dialogs';
|
|
9
9
|
import { useNotificationsStore } from './stores/notifications';
|
|
10
10
|
import { useSystemAlertStore } from './stores/systemAlerts';
|
|
11
|
-
import { ActionItem } from './types/types';
|
|
12
11
|
|
|
13
12
|
const messages = { en, fr };
|
|
14
13
|
|
|
@@ -82,5 +81,3 @@ export { config };
|
|
|
82
81
|
export { useDialogsStore };
|
|
83
82
|
export { useNotificationsStore };
|
|
84
83
|
export { useSystemAlertStore };
|
|
85
|
-
|
|
86
|
-
export { type ActionItem };
|