@weni/unnnic-system 3.8.2-alpha.1 → 3.9.0
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/CHANGELOG.md +9 -1
- package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
- package/dist/components/Alert/Alert.vue.d.ts +116 -17
- package/dist/components/Alert/Alert.vue.d.ts.map +1 -1
- package/dist/components/Alert/Version1dot1.vue.d.ts +38 -2
- package/dist/components/Alert/Version1dot1.vue.d.ts.map +1 -1
- package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +2 -2
- package/dist/components/AudioRecorder/AudioPlayer.vue.d.ts +1 -1
- package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +5 -5
- package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +3 -3
- package/dist/components/Banner/Banner.vue.d.ts +1 -1
- package/dist/components/Banner/InfoBanner.vue.d.ts +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/Button/ButtonIcon.vue.d.ts +1 -1
- package/dist/components/Button/types.d.ts +1 -1
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/Card/AccountCard.vue.d.ts +5 -5
- package/dist/components/Card/BlankCard.vue.d.ts +1 -1
- package/dist/components/Card/Card.vue.d.ts +27 -27
- package/dist/components/Card/CardCompany.vue.d.ts +5 -5
- package/dist/components/Card/CardData.vue.d.ts +1 -1
- package/dist/components/Card/CardStatusesContainer.vue.d.ts +5 -5
- package/dist/components/Card/ContentCard.vue.d.ts +3 -3
- package/dist/components/Card/DashCard.vue.d.ts +5 -5
- package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
- package/dist/components/Card/MarketplaceCard.vue.d.ts +2 -2
- package/dist/components/Card/SimpleCard.vue.d.ts +3 -3
- package/dist/components/Card/StatusCard.vue.d.ts +2 -2
- package/dist/components/Card/TitleCard.vue.d.ts +3 -3
- package/dist/components/CardImage/CardImage.vue.d.ts +31 -24
- package/dist/components/CardInformation/CardInformation.vue.d.ts +5 -5
- package/dist/components/CardProject/CardProject.vue.d.ts +3 -3
- package/dist/components/Carousel/Carousel.vue.d.ts +7 -7
- package/dist/components/Carousel/TagCarousel.vue.d.ts +6 -6
- package/dist/components/ChartBar/ChartBar.vue.d.ts +5 -5
- package/dist/components/ChartLine/ChartLine.vue.d.ts +1 -1
- package/dist/components/ChatText/ChatText.vue.d.ts +2 -2
- package/dist/components/ChatsContact/ChatsContact.vue.d.ts +34 -27
- package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +1 -1
- package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts +1 -1
- package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
- package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +5 -5
- package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +2 -2
- package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +1 -1
- package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.vue.d.ts +26 -19
- package/dist/components/Checkbox/Checkbox.vue.d.ts.map +1 -1
- package/dist/components/Comment/Comment.vue.d.ts +1 -1
- package/dist/components/DataArea/DataArea.vue.d.ts +2 -2
- package/dist/components/DataTable/index.vue.d.ts +1 -1
- package/dist/components/DataTable/index.vue.d.ts.map +1 -1
- package/dist/components/DateFilter/DateFilter.vue.d.ts +41 -251
- package/dist/components/DatePicker/DatePicker.vue.d.ts +4 -4
- package/dist/components/Drawer/Drawer.vue.d.ts +4 -4
- package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
- package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
- package/dist/components/Flag.vue.d.ts +2 -2
- package/dist/components/FormElement/FormElement.vue.d.ts +28 -51
- package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
- package/dist/components/Icon.vue.d.ts +1 -1
- package/dist/components/Icon.vue.d.ts.map +1 -1
- package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
- package/dist/components/ImportCard/ImportCard.vue.d.ts +4 -4
- package/dist/components/Input/BaseInput.vue.d.ts +2 -33
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +41 -251
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +25 -85
- package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +47 -257
- package/dist/components/InputNext/InputNext.vue.d.ts +5 -5
- package/dist/components/Label/Label.vue.d.ts +15 -9
- package/dist/components/Label/Label.vue.d.ts.map +1 -1
- package/dist/components/Modal/Modal.vue.d.ts +2 -2
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts +34 -199
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
- package/dist/components/ModalNext/ModalNext.vue.d.ts +46 -256
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +8 -8
- package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts +14 -20
- package/dist/components/Pagination/Pagination.vue.d.ts +3 -3
- package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
- package/dist/components/Radio/Radio.vue.d.ts +6 -8
- package/dist/components/Radio/Radio.vue.d.ts.map +1 -1
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +60 -113
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +5 -5
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +28 -21
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts.map +1 -1
- package/dist/components/SelectTime/index.vue.d.ts +25 -85
- package/dist/components/SkeletonLoading/skeletonTheme.vue.d.ts +1 -1
- package/dist/components/Slider/Slider.vue.d.ts +2 -2
- package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
- package/dist/components/Switch/Switch.vue.d.ts +21 -55
- package/dist/components/Switch/Switch.vue.d.ts.map +1 -1
- package/dist/components/Tab/Tab.vue.d.ts +2 -13
- package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
- package/dist/components/TableNext/TablePagination.vue.d.ts +3 -3
- package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
- package/dist/components/Tag/BrandTag.vue.d.ts +1 -1
- package/dist/components/Tag/DefaultTag.vue.d.ts +1 -1
- package/dist/components/Tag/IndicatorTag.vue.d.ts +2 -2
- package/dist/components/Tag/Tag.vue.d.ts +5 -5
- package/dist/components/TextArea/TextArea.vue.d.ts +30 -66
- package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
- package/dist/components/ToolTip/ToolTip.vue.d.ts +1 -1
- package/dist/components/Tour/Tour.vue.d.ts +3 -3
- package/dist/components/Tour/TourPopover.vue.d.ts +3 -3
- package/dist/components/UploadArea/UploadArea.vue.d.ts +4 -4
- package/dist/components/index.d.ts +1468 -3755
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +1 -1
- package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +1 -1
- package/dist/components/ui/{dialog/Dialog.vue.d.ts → tabs/Tabs.vue.d.ts} +7 -6
- package/dist/components/ui/tabs/Tabs.vue.d.ts.map +1 -0
- package/dist/components/ui/{dialog/DialogTitle.vue.d.ts → tabs/TabsContent.vue.d.ts} +3 -3
- package/dist/components/ui/tabs/TabsContent.vue.d.ts.map +1 -0
- package/dist/components/ui/{dialog/DialogFooter.vue.d.ts → tabs/TabsList.vue.d.ts} +5 -7
- package/dist/components/ui/tabs/TabsList.vue.d.ts.map +1 -0
- package/dist/components/ui/{dialog/DialogHeader.vue.d.ts → tabs/TabsTrigger.vue.d.ts} +5 -11
- package/dist/components/ui/tabs/TabsTrigger.vue.d.ts.map +1 -0
- package/dist/components/ui/tabs/index.d.ts +5 -0
- package/dist/components/ui/tabs/index.d.ts.map +1 -0
- package/dist/{es-dc440fef.mjs → es-4b7090cd.mjs} +1 -1
- package/dist/{index-6b5eeee8.mjs → index-65c23d9a.mjs} +15213 -15538
- package/dist/locales/en.json.d.ts +1 -2
- package/dist/locales/es.json.d.ts +1 -2
- package/dist/locales/pt_br.json.d.ts +1 -2
- package/dist/{pt-br-a2cfd62d.mjs → pt-br-6324858c.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +185 -194
- package/dist/unnnic.umd.js +38 -42
- package/dist/utils/call.d.ts +1 -2
- package/dist/utils/call.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/assets/scss/tailwind.scss +0 -8
- package/src/components/Alert/Alert.vue +135 -26
- package/src/components/Alert/AlertBanner.vue +182 -0
- package/src/components/Alert/AlertCaller.vue +49 -0
- package/src/components/Alert/Version1dot1.vue +36 -0
- package/src/components/Alert/__tests__/Alert.spec.js +45 -2
- package/src/components/Alert/__tests__/AlertBanner.spec.js +89 -0
- package/src/components/Alert/__tests__/AlertCaller.spec.js +98 -0
- package/src/components/Alert/__tests__/Version1dot1.spec.js +21 -0
- package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
- package/src/components/Alert/__tests__/__snapshots__/AlertBanner.spec.js.snap +2 -2
- package/src/components/Alert/__tests__/__snapshots__/Version1dot1.spec.js.snap +3 -3
- package/src/components/AvatarIcon/__tests__/__snapshots__/AvatarIcon.spec.js.snap +1 -1
- package/src/components/Button/Button.vue +117 -68
- package/src/components/Button/types.ts +1 -0
- package/src/components/Checkbox/Checkbox.vue +65 -117
- package/src/components/Checkbox/__tests__/Checkbox.spec.js +21 -6
- package/src/components/Collapse/__tests__/__snapshots__/Collapse.spec.js.snap +1 -3
- package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +3 -3
- package/src/components/FormElement/FormElement.vue +93 -63
- package/src/components/Icon.vue +0 -2
- package/src/components/Input/BaseInput.vue +14 -33
- package/src/components/Input/Input.scss +21 -20
- package/src/components/Input/Input.vue +56 -79
- package/src/components/Input/TextInput.vue +68 -80
- package/src/components/Input/__test__/Input.spec.js +33 -13
- package/src/components/Input/__test__/TextInput.spec.js +8 -6
- package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +1 -1
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
- package/src/components/Label/Label.vue +21 -52
- package/src/components/Label/__tests__/Label.spec.js +1 -1
- package/src/components/ModalDialog/ModalDialog.vue +146 -60
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +22 -1
- package/src/components/Radio/Radio.vue +67 -98
- package/src/components/Radio/__test__/Radio.spec.js +20 -14
- package/src/components/Radio/__test__/__snapshots__/Radio.spec.js.snap +1 -1
- package/src/components/SelectSmart/SelectSmart.vue +3 -4
- package/src/components/Switch/Switch.vue +91 -132
- package/src/components/Switch/__tests__/Switch.spec.js +75 -8
- package/src/components/Switch/__tests__/__snapshots__/Switch.spec.js.snap +1 -1
- package/src/components/Tab/Tab.vue +23 -37
- package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -1
- package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
- package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
- package/src/components/TextArea/TextArea.vue +11 -34
- package/src/components/index.ts +27 -48
- package/src/components/ui/tabs/Tabs.vue +19 -0
- package/src/components/ui/tabs/TabsContent.vue +22 -0
- package/src/components/ui/tabs/TabsList.vue +34 -0
- package/src/components/ui/tabs/TabsTrigger.vue +79 -0
- package/src/components/ui/tabs/index.ts +4 -0
- package/src/locales/en.json +1 -2
- package/src/locales/es.json +1 -2
- package/src/locales/pt_br.json +1 -2
- package/src/stories/Alert.stories.js +67 -6
- package/src/stories/Button.stories.js +39 -29
- package/src/stories/Checkbox.stories.js +4 -11
- package/src/stories/Input.stories.js +76 -71
- package/src/stories/Label.stories.js +0 -7
- package/src/stories/ModalDialog.mdx +0 -3
- package/src/stories/ModalDialog.stories.js +1 -1
- package/src/stories/Switch.stories.js +5 -10
- package/src/stories/Tab.stories.js +4 -11
- package/src/stories/Tabs.stories.js +125 -0
- package/src/stories/TextArea.stories.js +2 -13
- package/src/types/scheme-colors.d.ts +0 -1
- package/src/utils/call.js +18 -46
- package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts +0 -28
- package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts.map +0 -1
- package/dist/components/Toast/Toast.vue.d.ts +0 -16
- package/dist/components/Toast/Toast.vue.d.ts.map +0 -1
- package/dist/components/Toast/ToastManager.d.ts +0 -14
- package/dist/components/Toast/ToastManager.d.ts.map +0 -1
- package/dist/components/Toast/types.d.ts +0 -35
- package/dist/components/Toast/types.d.ts.map +0 -1
- package/dist/components/ui/dialog/Dialog.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +0 -19
- package/dist/components/ui/dialog/DialogClose.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +0 -40
- package/dist/components/ui/dialog/DialogContent.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +0 -19
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts.map +0 -1
- package/dist/components/ui/dialog/index.d.ts +0 -8
- package/dist/components/ui/dialog/index.d.ts.map +0 -1
- package/src/assets/icons/checkbox-checked-disabled.svg +0 -3
- package/src/assets/icons/checkbox-checked.svg +0 -3
- package/src/assets/icons/checkbox-less-disabled.svg +0 -3
- package/src/assets/icons/checkbox-less.svg +0 -3
- package/src/assets/icons/radio-checked.svg +0 -3
- package/src/assets/icons/switch-checked-disabled.svg +0 -3
- package/src/assets/icons/switch-checked.svg +0 -3
- package/src/components/Alert/SIMPLE_MIGRATION_GUIDE.md +0 -152
- package/src/components/CheckboxGroup/CheckboxGroup.vue +0 -96
- package/src/components/Popover/__tests__/Popover.spec.js +0 -147
- package/src/components/Popover/__tests__/__snapshots__/Popover.spec.js.snap +0 -8
- package/src/components/Popover/index.vue +0 -146
- package/src/components/RadioGroup/RadioGroup.vue +0 -142
- package/src/components/Select/SelectOption.vue +0 -65
- package/src/components/Select/__tests__/Select.spec.js +0 -412
- package/src/components/Select/__tests__/SelectItem.spec.js +0 -330
- package/src/components/Select/__tests__/SelectOption.spec.js +0 -174
- package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +0 -97
- package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +0 -15
- package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +0 -25
- package/src/components/Select/index.vue +0 -245
- package/src/components/Toast/Toast.vue +0 -246
- package/src/components/Toast/ToastManager.ts +0 -110
- package/src/components/Toast/__tests__/Toast.spec.js +0 -284
- package/src/components/Toast/__tests__/ToastManager.spec.js +0 -294
- package/src/components/Toast/types.ts +0 -57
- package/src/components/ui/dialog/Dialog.vue +0 -15
- package/src/components/ui/dialog/DialogClose.vue +0 -25
- package/src/components/ui/dialog/DialogContent.vue +0 -114
- package/src/components/ui/dialog/DialogFooter.vue +0 -46
- package/src/components/ui/dialog/DialogHeader.vue +0 -78
- package/src/components/ui/dialog/DialogTitle.vue +0 -34
- package/src/components/ui/dialog/DialogTrigger.vue +0 -12
- package/src/components/ui/dialog/index.ts +0 -7
- package/src/stories/CheckboxGroup.stories.js +0 -105
- package/src/stories/Dialog.stories.js +0 -832
- package/src/stories/RadioGroup.stories.js +0 -144
- package/src/stories/Select.stories.js +0 -158
- package/src/stories/Toast.mdx +0 -123
- package/src/stories/Toast.stories.js +0 -126
|
@@ -1,65 +1,34 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<p class="unnnic-label__label">{{ fullySanitize(props.label) }}</p>
|
|
4
|
-
<UnnnicToolTip
|
|
5
|
-
v-if="tooltip"
|
|
6
|
-
enabled
|
|
7
|
-
:text="tooltip"
|
|
8
|
-
:enableHtml="props.useHtmlTooltip"
|
|
9
|
-
>
|
|
10
|
-
<UnnnicIcon
|
|
11
|
-
icon="help"
|
|
12
|
-
size="sm"
|
|
13
|
-
scheme="fg-base"
|
|
14
|
-
/>
|
|
15
|
-
</UnnnicToolTip>
|
|
16
|
-
</section>
|
|
2
|
+
<p class="unnnic-label__label">{{ fullySanitize(label) }}</p>
|
|
17
3
|
</template>
|
|
18
4
|
|
|
19
|
-
<script
|
|
20
|
-
import { fullySanitize } from '
|
|
21
|
-
|
|
22
|
-
import UnnnicToolTip from '../ToolTip/ToolTip.vue';
|
|
23
|
-
import UnnnicIcon from '../Icon.vue';
|
|
24
|
-
|
|
25
|
-
defineOptions({
|
|
5
|
+
<script>
|
|
6
|
+
import { fullySanitize } from '../../utils/sanitize';
|
|
7
|
+
export default {
|
|
26
8
|
name: 'UnnnicLabel',
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
tooltip: '',
|
|
38
|
-
useHtmlTooltip: false,
|
|
39
|
-
});
|
|
9
|
+
props: {
|
|
10
|
+
label: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: null,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
methods: {
|
|
16
|
+
fullySanitize,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
40
19
|
</script>
|
|
41
20
|
|
|
42
|
-
<style lang="scss"
|
|
21
|
+
<style lang="scss">
|
|
43
22
|
@use '@/assets/scss/unnnic' as *;
|
|
44
23
|
|
|
45
|
-
* {
|
|
46
|
-
box-sizing: border-box;
|
|
47
|
-
padding: $unnnic-space-0;
|
|
48
|
-
margin: $unnnic-space-0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
24
|
.unnnic-label {
|
|
52
|
-
display: flex;
|
|
53
|
-
align-items: center;
|
|
54
|
-
gap: $unnnic-space-2;
|
|
55
|
-
color: $unnnic-color-fg-base;
|
|
56
|
-
|
|
57
25
|
&__label {
|
|
58
|
-
font: $unnnic-font-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
26
|
+
font-family: $unnnic-font-family-secondary;
|
|
27
|
+
font-weight: $unnnic-font-weight-regular;
|
|
28
|
+
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
29
|
+
font-size: $unnnic-font-size-body-gt;
|
|
30
|
+
color: $unnnic-color-neutral-cloudy;
|
|
31
|
+
margin: $unnnic-spacing-stack-xs 0;
|
|
63
32
|
}
|
|
64
33
|
}
|
|
65
34
|
</style>
|
|
@@ -24,7 +24,7 @@ describe('Label', () => {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it('applies the correct classes and styles', () => {
|
|
27
|
-
const label = wrapper.
|
|
27
|
+
const label = wrapper.findComponent('.unnnic-label__label');
|
|
28
28
|
expect(label.html()).toMatchSnapshot();
|
|
29
29
|
});
|
|
30
30
|
});
|
|
@@ -1,46 +1,64 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
2
|
+
<section
|
|
3
|
+
v-if="modelValue"
|
|
4
|
+
class="unnnic-modal-dialog"
|
|
4
5
|
data-testid="modal-dialog"
|
|
5
|
-
@update:open="$emit('update:modelValue', $event)"
|
|
6
6
|
>
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
<section
|
|
8
|
+
class="unnnic-modal-dialog__overlay"
|
|
9
|
+
data-testid="modal-overlay"
|
|
10
|
+
@click.stop="!persistent && close()"
|
|
11
|
+
/>
|
|
12
|
+
<section
|
|
13
|
+
:class="[
|
|
14
|
+
'unnnic-modal-dialog__container',
|
|
15
|
+
`unnnic-modal-dialog__container--${size}`,
|
|
16
|
+
]"
|
|
10
17
|
data-testid="modal-container"
|
|
11
|
-
@escape-key-down="persistentHandler"
|
|
12
|
-
@pointer-down-outside="persistentHandler"
|
|
13
18
|
>
|
|
14
19
|
<section
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
'unnnic-modal-dialog__container__body--left-sidebar':
|
|
19
|
-
$slots.leftSidebar,
|
|
20
|
-
},
|
|
21
|
-
]"
|
|
20
|
+
v-if="$slots.leftSidebar"
|
|
21
|
+
class="unnnic-modal-dialog__container__left-sidebar"
|
|
22
22
|
>
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</section>
|
|
29
|
-
<UnnnicDialogHeader
|
|
23
|
+
<slot name="leftSidebar" />
|
|
24
|
+
</section>
|
|
25
|
+
|
|
26
|
+
<section class="unnnic-modal-dialog__container__body">
|
|
27
|
+
<header
|
|
30
28
|
v-if="title"
|
|
31
|
-
|
|
32
|
-
:type="type"
|
|
29
|
+
class="unnnic-modal-dialog__container__header"
|
|
33
30
|
>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
<section class="unnnic-modal-dialog__container__title-container">
|
|
32
|
+
<UnnnicIcon
|
|
33
|
+
v-if="icon || type"
|
|
34
|
+
data-testid="title-icon"
|
|
35
|
+
class="unnnic-modal-dialog__container__title-icon"
|
|
36
|
+
:icon="icon || iconsMapper[type]?.icon"
|
|
37
|
+
:scheme="iconScheme || iconsMapper[type]?.scheme"
|
|
38
|
+
size="md"
|
|
39
|
+
/>
|
|
40
|
+
<h1
|
|
41
|
+
class="unnnic-modal-dialog__container__title-text"
|
|
42
|
+
data-testid="title-text"
|
|
43
|
+
>
|
|
44
|
+
{{ title }}
|
|
45
|
+
</h1>
|
|
46
|
+
</section>
|
|
47
|
+
<UnnnicIcon
|
|
48
|
+
v-if="showCloseIcon"
|
|
49
|
+
data-testid="close-icon"
|
|
50
|
+
icon="close"
|
|
51
|
+
clickable
|
|
52
|
+
scheme="neutral-cloudy"
|
|
53
|
+
@click="close()"
|
|
54
|
+
/>
|
|
55
|
+
</header>
|
|
38
56
|
<section class="unnnic-modal-dialog__container__content">
|
|
39
57
|
<slot></slot>
|
|
40
58
|
</section>
|
|
41
|
-
|
|
42
|
-
<UnnnicDialogFooter
|
|
59
|
+
<section
|
|
43
60
|
v-if="primaryButtonProps.text"
|
|
61
|
+
data-testid="actions-section"
|
|
44
62
|
:class="[
|
|
45
63
|
'unnnic-modal-dialog__container__actions',
|
|
46
64
|
{
|
|
@@ -48,8 +66,6 @@
|
|
|
48
66
|
showActionsDivider,
|
|
49
67
|
},
|
|
50
68
|
]"
|
|
51
|
-
:divider="showActionsDivider"
|
|
52
|
-
data-testid="actions-section"
|
|
53
69
|
>
|
|
54
70
|
<UnnnicButton
|
|
55
71
|
v-if="!hideSecondaryButton"
|
|
@@ -76,30 +92,22 @@
|
|
|
76
92
|
class="unnnic-modal-dialog__container__actions__primary-button"
|
|
77
93
|
@click.stop="$emit('primaryButtonClick')"
|
|
78
94
|
/>
|
|
79
|
-
</
|
|
95
|
+
</section>
|
|
80
96
|
</section>
|
|
81
|
-
</
|
|
82
|
-
</
|
|
97
|
+
</section>
|
|
98
|
+
</section>
|
|
83
99
|
</template>
|
|
84
100
|
|
|
85
101
|
<script>
|
|
102
|
+
import UnnnicIcon from '../Icon.vue';
|
|
86
103
|
import UnnnicButton from '../Button/Button.vue';
|
|
87
104
|
import UnnnicI18n from '../../mixins/i18n';
|
|
88
|
-
import UnnnicDialog from '../ui/dialog/Dialog.vue';
|
|
89
|
-
import UnnnicDialogContent from '../ui/dialog/DialogContent.vue';
|
|
90
|
-
import UnnnicDialogHeader from '../ui/dialog/DialogHeader.vue';
|
|
91
|
-
import UnnnicDialogTitle from '../ui/dialog/DialogTitle.vue';
|
|
92
|
-
import UnnnicDialogFooter from '../ui/dialog/DialogFooter.vue';
|
|
93
105
|
|
|
94
106
|
export default {
|
|
95
107
|
name: 'UnnnicModalDialog',
|
|
96
108
|
components: {
|
|
109
|
+
UnnnicIcon,
|
|
97
110
|
UnnnicButton,
|
|
98
|
-
UnnnicDialog,
|
|
99
|
-
UnnnicDialogContent,
|
|
100
|
-
UnnnicDialogHeader,
|
|
101
|
-
UnnnicDialogTitle,
|
|
102
|
-
UnnnicDialogFooter,
|
|
103
111
|
},
|
|
104
112
|
mixins: [UnnnicI18n],
|
|
105
113
|
props: {
|
|
@@ -169,6 +177,11 @@ export default {
|
|
|
169
177
|
es: 'Cancelar',
|
|
170
178
|
},
|
|
171
179
|
},
|
|
180
|
+
iconsMapper: {
|
|
181
|
+
success: { icon: 'check_circle', scheme: 'aux-green-500' },
|
|
182
|
+
warning: { icon: 'warning', scheme: 'aux-red-500' },
|
|
183
|
+
attention: { icon: 'error', scheme: 'aux-yellow-500' },
|
|
184
|
+
},
|
|
172
185
|
primaryButtonTypeMapper: {
|
|
173
186
|
success: 'primary',
|
|
174
187
|
warning: 'warning',
|
|
@@ -188,39 +201,91 @@ export default {
|
|
|
188
201
|
updateBodyOverflow(isHidden) {
|
|
189
202
|
document.body.style.overflow = isHidden ? 'hidden' : '';
|
|
190
203
|
},
|
|
191
|
-
persistentHandler(event) {
|
|
192
|
-
if (this.persistent) {
|
|
193
|
-
event.preventDefault();
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
204
|
},
|
|
197
205
|
};
|
|
198
206
|
</script>
|
|
199
207
|
|
|
200
208
|
<style lang="scss" scoped>
|
|
201
209
|
@use '@/assets/scss/unnnic' as *;
|
|
210
|
+
* {
|
|
211
|
+
margin: 0;
|
|
212
|
+
padding: 0;
|
|
213
|
+
box-sizing: border-box;
|
|
214
|
+
}
|
|
215
|
+
.unnnic-modal-dialog {
|
|
216
|
+
width: 100vw;
|
|
217
|
+
height: 100vh;
|
|
218
|
+
position: fixed;
|
|
219
|
+
left: 0;
|
|
220
|
+
top: 0;
|
|
221
|
+
display: flex;
|
|
222
|
+
justify-content: center;
|
|
223
|
+
align-items: center;
|
|
224
|
+
z-index: 9999;
|
|
225
|
+
|
|
226
|
+
&__overlay {
|
|
227
|
+
position: absolute;
|
|
228
|
+
width: 100%;
|
|
229
|
+
height: 100%;
|
|
230
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
202
234
|
.unnnic-modal-dialog__container {
|
|
235
|
+
display: flex;
|
|
236
|
+
background: $unnnic-color-neutral-white;
|
|
237
|
+
border-radius: $unnnic-spacing-xs;
|
|
238
|
+
box-shadow: $unnnic-shadow-level-near;
|
|
239
|
+
position: fixed;
|
|
240
|
+
max-height: calc(100vh - $unnnic-spacing-giant);
|
|
241
|
+
overflow: hidden;
|
|
242
|
+
|
|
243
|
+
&--sm {
|
|
244
|
+
width: 400px;
|
|
245
|
+
}
|
|
246
|
+
&--md {
|
|
247
|
+
width: 600px;
|
|
248
|
+
}
|
|
249
|
+
&--lg {
|
|
250
|
+
width: 800px;
|
|
251
|
+
}
|
|
252
|
+
|
|
203
253
|
&__left-sidebar {
|
|
204
254
|
background-color: $unnnic-color-neutral-black;
|
|
205
255
|
color: $unnnic-color-neutral-white;
|
|
206
|
-
|
|
207
|
-
grid-area: left-sidebar;
|
|
208
|
-
grid-row: span 3;
|
|
209
256
|
}
|
|
210
257
|
|
|
211
258
|
&__body {
|
|
212
259
|
flex: 1;
|
|
213
260
|
display: flex;
|
|
214
261
|
flex-direction: column;
|
|
262
|
+
}
|
|
215
263
|
|
|
216
|
-
|
|
264
|
+
&__header {
|
|
265
|
+
display: flex;
|
|
266
|
+
justify-content: space-between;
|
|
267
|
+
align-items: center;
|
|
268
|
+
border-bottom: 1px solid $unnnic-color-neutral-soft;
|
|
269
|
+
padding: $unnnic-spacing-md;
|
|
270
|
+
flex-shrink: 0;
|
|
271
|
+
}
|
|
217
272
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
273
|
+
&__title-container {
|
|
274
|
+
display: flex;
|
|
275
|
+
align-items: center;
|
|
276
|
+
gap: $unnnic-spacing-ant;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
&__title-icon {
|
|
280
|
+
font-size: 28px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
&__title-text {
|
|
284
|
+
font-family: $unnnic-font-family-secondary;
|
|
285
|
+
font-size: $unnnic-font-size-title-sm;
|
|
286
|
+
font-weight: $unnnic-font-weight-black;
|
|
287
|
+
line-height: 28px;
|
|
288
|
+
color: $unnnic-color-neutral-darkest;
|
|
224
289
|
}
|
|
225
290
|
|
|
226
291
|
&__content {
|
|
@@ -244,5 +309,26 @@ export default {
|
|
|
244
309
|
border-radius: $unnnic-border-radius-pill;
|
|
245
310
|
}
|
|
246
311
|
}
|
|
312
|
+
|
|
313
|
+
&__actions {
|
|
314
|
+
display: grid;
|
|
315
|
+
grid-template-columns: 1fr 1fr;
|
|
316
|
+
grid-template-areas: 'secondary-button primary-button';
|
|
317
|
+
gap: $unnnic-spacing-sm;
|
|
318
|
+
padding: $unnnic-spacing-md;
|
|
319
|
+
flex-shrink: 0;
|
|
320
|
+
|
|
321
|
+
&--divider {
|
|
322
|
+
border-top: 1px solid $unnnic-color-neutral-soft;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
&__secondary-button {
|
|
326
|
+
grid-area: secondary-button;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
&__primary-button {
|
|
330
|
+
grid-area: primary-button;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
247
333
|
}
|
|
248
334
|
</style>
|
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`ModalDialog.vue > Elements rendering > matches the snapshot 1`] = `
|
|
3
|
+
exports[`ModalDialog.vue > Elements rendering > matches the snapshot 1`] = `
|
|
4
|
+
"<section data-v-68ebadeb="" class="unnnic-modal-dialog" data-testid="modal-dialog">
|
|
5
|
+
<section data-v-68ebadeb="" class="unnnic-modal-dialog__overlay" data-testid="modal-overlay"></section>
|
|
6
|
+
<section data-v-68ebadeb="" class="unnnic-modal-dialog__container unnnic-modal-dialog__container--md" data-testid="modal-container">
|
|
7
|
+
<!--v-if-->
|
|
8
|
+
<section data-v-68ebadeb="" class="unnnic-modal-dialog__container__body">
|
|
9
|
+
<header data-v-68ebadeb="" class="unnnic-modal-dialog__container__header">
|
|
10
|
+
<section data-v-68ebadeb="" class="unnnic-modal-dialog__container__title-container">
|
|
11
|
+
<unnnic-icon-stub data-v-68ebadeb="" filled="false" icon="test-icon" clickable="false" size="md" scheme="neutral-darkest" data-testid="title-icon" class="unnnic-modal-dialog__container__title-icon"></unnnic-icon-stub>
|
|
12
|
+
<h1 data-v-68ebadeb="" class="unnnic-modal-dialog__container__title-text" data-testid="title-text">Test Title</h1>
|
|
13
|
+
</section>
|
|
14
|
+
<unnnic-icon-stub data-v-68ebadeb="" filled="false" icon="close" clickable="true" size="md" scheme="neutral-cloudy" data-testid="close-icon"></unnnic-icon-stub>
|
|
15
|
+
</header>
|
|
16
|
+
<section data-v-68ebadeb="" class="unnnic-modal-dialog__container__content"></section>
|
|
17
|
+
<section data-v-68ebadeb="" data-testid="actions-section" class="unnnic-modal-dialog__container__actions">
|
|
18
|
+
<unnnic-button-stub data-v-68ebadeb="" size="large" text="Cancel" type="tertiary" float="false" iconleft="" iconright="" iconcenter="" iconsfilled="false" disabled="false" loading="false" data-testid="secondary-button" class="unnnic-modal-dialog__container__actions__secondary-button"></unnnic-button-stub>
|
|
19
|
+
<unnnic-button-stub data-v-68ebadeb="" size="large" text="Confirm" type="primary" float="false" iconleft="" iconright="" iconcenter="" iconsfilled="false" disabled="false" loading="false" data-testid="primary-button" class="unnnic-modal-dialog__container__actions__primary-button"></unnnic-button-stub>
|
|
20
|
+
</section>
|
|
21
|
+
</section>
|
|
22
|
+
</section>
|
|
23
|
+
</section>"
|
|
24
|
+
`;
|
|
@@ -1,38 +1,29 @@
|
|
|
1
1
|
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
2
|
<template>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'unnnic-radio__label',
|
|
23
|
-
{ 'unnnic-radio__label--disabled': disabled },
|
|
24
|
-
]"
|
|
25
|
-
>
|
|
26
|
-
{{ label }}
|
|
27
|
-
<slot />
|
|
28
|
-
</p>
|
|
29
|
-
</label>
|
|
30
|
-
</section>
|
|
3
|
+
<div
|
|
4
|
+
:class="[
|
|
5
|
+
'unnnic-radio-container',
|
|
6
|
+
`unnnic-radio-container--${size}`,
|
|
7
|
+
disabled ? 'disabled' : null,
|
|
8
|
+
]"
|
|
9
|
+
@click="click"
|
|
10
|
+
>
|
|
11
|
+
<UnnnicIcon
|
|
12
|
+
class="unnnic-radio"
|
|
13
|
+
:icon="icon"
|
|
14
|
+
:scheme="color"
|
|
15
|
+
:size="size"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<span class="label">
|
|
19
|
+
<slot />
|
|
20
|
+
</span>
|
|
21
|
+
</div>
|
|
31
22
|
</template>
|
|
32
23
|
|
|
33
24
|
<script setup>
|
|
34
|
-
import {
|
|
35
|
-
import
|
|
25
|
+
import { computed } from 'vue';
|
|
26
|
+
import UnnnicIcon from '../Icon.vue';
|
|
36
27
|
|
|
37
28
|
const props = defineProps({
|
|
38
29
|
modelValue: {
|
|
@@ -47,101 +38,79 @@ const props = defineProps({
|
|
|
47
38
|
type: Boolean,
|
|
48
39
|
default: false,
|
|
49
40
|
},
|
|
50
|
-
|
|
51
|
-
type: String,
|
|
52
|
-
default: '',
|
|
53
|
-
},
|
|
54
|
-
name: {
|
|
41
|
+
size: {
|
|
55
42
|
type: String,
|
|
56
|
-
default: '',
|
|
43
|
+
default: 'md',
|
|
44
|
+
validator(value) {
|
|
45
|
+
return ['md', 'sm'].includes(value);
|
|
46
|
+
},
|
|
57
47
|
},
|
|
58
48
|
});
|
|
59
49
|
|
|
60
50
|
const emit = defineEmits(['update:modelValue']);
|
|
61
51
|
|
|
62
|
-
const
|
|
63
|
-
|
|
52
|
+
const valueName = computed(() =>
|
|
53
|
+
props.modelValue === props.value ? 'selected' : 'default',
|
|
54
|
+
);
|
|
55
|
+
const icon = computed(
|
|
56
|
+
() =>
|
|
57
|
+
({
|
|
58
|
+
selected: 'radio-selected',
|
|
59
|
+
default: props.disabled ? 'radio-disable' : 'radio-default',
|
|
60
|
+
})[valueName.value],
|
|
61
|
+
);
|
|
62
|
+
const color = computed(() => {
|
|
63
|
+
if (props.disabled) {
|
|
64
|
+
return 'brand-sec';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return valueName.value === 'selected' ? 'brand-weni' : 'neutral-cleanest';
|
|
68
|
+
});
|
|
64
69
|
|
|
65
70
|
function click() {
|
|
66
71
|
if (!props.disabled) {
|
|
67
72
|
emit('update:modelValue', props.value);
|
|
68
|
-
|
|
69
|
-
if (contextModelValue) {
|
|
70
|
-
contextModelValue.value = props.value;
|
|
71
|
-
}
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
-
const computedModelValue = computed(() => {
|
|
76
|
-
return contextModelValue?.value || props.modelValue;
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const computedName = computed(() => {
|
|
80
|
-
return contextName?.value || props.name;
|
|
81
|
-
});
|
|
82
75
|
</script>
|
|
83
76
|
|
|
84
77
|
<style lang="scss" scoped>
|
|
85
78
|
@use '@/assets/scss/unnnic' as *;
|
|
86
79
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
.unnnic-radio {
|
|
80
|
+
.unnnic-radio-container {
|
|
90
81
|
display: inline-flex;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
&__input-wrapper {
|
|
94
|
-
width: fit-content;
|
|
95
|
-
|
|
96
|
-
display: flex;
|
|
97
|
-
align-items: center;
|
|
98
|
-
gap: $unnnic-space-2;
|
|
82
|
+
align-items: center;
|
|
99
83
|
|
|
84
|
+
&:not(.disabled) {
|
|
100
85
|
cursor: pointer;
|
|
101
|
-
|
|
102
|
-
&--disabled {
|
|
103
|
-
cursor: not-allowed;
|
|
104
|
-
}
|
|
105
86
|
}
|
|
106
87
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
width: $radio-size;
|
|
111
|
-
height: $radio-size;
|
|
112
|
-
margin: 0;
|
|
113
|
-
background-color: $unnnic-color-bg-base;
|
|
114
|
-
border: 1px solid $unnnic-color-border-base;
|
|
115
|
-
border-radius: $unnnic-radius-full;
|
|
116
|
-
box-sizing: border-box;
|
|
117
|
-
outline: none;
|
|
118
|
-
|
|
119
|
-
cursor: pointer;
|
|
120
|
-
|
|
121
|
-
&:checked {
|
|
122
|
-
border-width: 0;
|
|
123
|
-
background-color: $unnnic-color-bg-active;
|
|
124
|
-
background-image: url('@/assets/icons/radio-checked.svg');
|
|
125
|
-
background-position: center;
|
|
126
|
-
background-repeat: no-repeat;
|
|
127
|
-
}
|
|
88
|
+
&--sm .unnnic-radio {
|
|
89
|
+
margin: $unnnic-spacing-stack-nano $unnnic-spacing-inline-nano;
|
|
90
|
+
}
|
|
128
91
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
92
|
+
&--md .unnnic-radio {
|
|
93
|
+
margin: $unnnic-spacing-stack-nano 0;
|
|
94
|
+
margin-left: $unnnic-spacing-inline-nano;
|
|
95
|
+
margin-right: $unnnic-spacing-inline-xs;
|
|
96
|
+
}
|
|
132
97
|
|
|
133
|
-
|
|
134
|
-
|
|
98
|
+
.label {
|
|
99
|
+
font-family: $unnnic-font-family-secondary;
|
|
100
|
+
font-weight: $unnnic-font-weight-regular;
|
|
101
|
+
color: $unnnic-color-neutral-darkest;
|
|
102
|
+
margin: $unnnic-spacing-stack-nano 0;
|
|
103
|
+
margin-right: $unnnic-spacing-inline-nano;
|
|
135
104
|
}
|
|
136
105
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
106
|
+
&--sm .label {
|
|
107
|
+
font-size: $unnnic-font-size-body-md;
|
|
108
|
+
line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
|
|
109
|
+
}
|
|
141
110
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
111
|
+
&--md .label {
|
|
112
|
+
font-size: $unnnic-font-size-body-gt;
|
|
113
|
+
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
|
|
145
114
|
}
|
|
146
115
|
}
|
|
147
116
|
</style>
|
|
@@ -33,35 +33,41 @@ describe('Radio.vue', () => {
|
|
|
33
33
|
expect(wrapper.exists()).toBe(true);
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
test('renders
|
|
37
|
-
const
|
|
38
|
-
expect(
|
|
39
|
-
expect(
|
|
40
|
-
expect(
|
|
41
|
-
expect(
|
|
36
|
+
test('renders UnnnicIcon component with correct props', () => {
|
|
37
|
+
const unnnicIcon = wrapper.findComponent(UnnnicIcon);
|
|
38
|
+
expect(unnnicIcon.exists()).toBe(true);
|
|
39
|
+
expect(unnnicIcon.props('icon')).toBe('radio-default');
|
|
40
|
+
expect(unnnicIcon.props('scheme')).toBe('neutral-cleanest');
|
|
41
|
+
expect(unnnicIcon.props('size')).toBe('md');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('applies the correct size class', async () => {
|
|
45
|
+
expect(wrapper.classes()).toContain('unnnic-radio-container--md');
|
|
46
|
+
|
|
47
|
+
await wrapper.setProps({ size: 'sm' });
|
|
48
|
+
expect(wrapper.classes()).toContain('unnnic-radio-container--sm');
|
|
42
49
|
});
|
|
43
50
|
|
|
44
51
|
test('applies disabled class when disabled prop is true', async () => {
|
|
45
52
|
await wrapper.setProps({ disabled: true });
|
|
46
|
-
expect(wrapper.
|
|
47
|
-
'unnnic-radio__label--disabled',
|
|
48
|
-
);
|
|
53
|
+
expect(wrapper.classes()).toContain('disabled');
|
|
49
54
|
});
|
|
50
55
|
|
|
51
56
|
test('icon changes based on valueName', async () => {
|
|
52
57
|
await wrapper.setProps({ modelValue: 'option1' });
|
|
53
|
-
const
|
|
54
|
-
expect(
|
|
58
|
+
const unnnicIcon = wrapper.findComponent(UnnnicIcon);
|
|
59
|
+
expect(unnnicIcon.props('icon')).toBe('radio-selected');
|
|
55
60
|
});
|
|
56
61
|
|
|
57
62
|
test('icon and color change when disabled is true', async () => {
|
|
58
63
|
await wrapper.setProps({ disabled: true });
|
|
59
|
-
const
|
|
60
|
-
expect(
|
|
64
|
+
const unnnicIcon = wrapper.findComponent(UnnnicIcon);
|
|
65
|
+
expect(unnnicIcon.props('icon')).toBe('radio-disable');
|
|
66
|
+
expect(unnnicIcon.props('scheme')).toBe('brand-sec');
|
|
61
67
|
});
|
|
62
68
|
|
|
63
69
|
test('emits update:modelValue with correct value when clicked and not disabled', async () => {
|
|
64
|
-
await wrapper.
|
|
70
|
+
await wrapper.trigger('click');
|
|
65
71
|
expect(wrapper.emitted('update:modelValue')).toBeTruthy();
|
|
66
72
|
expect(wrapper.emitted('update:modelValue')[0]).toEqual(['option1']);
|
|
67
73
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
3
|
exports[`Radio.vue > matches the snapshot 1`] = `
|
|
4
|
-
"<div data-v-38c6bf5e="" class="unnnic-radio-container unnnic-radio-container--md"><svg data-v-26446d8e="" data-v-38c6bf5e="" width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" class="unnnic-icon unnnic-icon__size--md unnnic-icon-scheme--neutral-cleanest unnnic-radio" data-testid="
|
|
4
|
+
"<div data-v-38c6bf5e="" class="unnnic-radio-container unnnic-radio-container--md"><svg data-v-26446d8e="" data-v-38c6bf5e="" width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" class="unnnic-icon unnnic-icon--size-svg-md unnnic-icon__size--md unnnic-icon-scheme--neutral-cleanest unnnic-radio" data-testid="custom-icon">
|
|
5
5
|
<circle cx="20" cy="20.0005" r="14.5" stroke="#3B414D" class="primary-stroke"></circle>
|
|
6
6
|
</svg><span data-v-38c6bf5e="" class="label">Option 1</span></div>"
|
|
7
7
|
`;
|