design-system-next 2.11.20 → 2.12.1
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/dist/design-system-next.es.js +7837 -7514
- package/dist/design-system-next.es.js.gz +0 -0
- package/dist/design-system-next.umd.js +12 -12
- package/dist/design-system-next.umd.js.gz +0 -0
- package/dist/main.css +1 -1
- package/dist/main.css.gz +0 -0
- package/dist/package.json.d.ts +1 -1
- package/package.json +1 -1
- package/src/App.vue +1 -49
- package/src/assets/scripts/border-radius.ts +15 -15
- package/src/assets/scripts/colors.ts +134 -134
- package/src/assets/scripts/max-width.ts +11 -11
- package/src/assets/scripts/spacing.ts +23 -23
- package/src/assets/scripts/utilities.ts +15 -15
- package/src/components/accordion/accordion.ts +43 -43
- package/src/components/accordion/use-accordion.ts +43 -43
- package/src/components/avatar/avatar.ts +64 -64
- package/src/components/badge/badge.ts +43 -43
- package/src/components/banner/banner.ts +20 -20
- package/src/components/button/button.ts +72 -72
- package/src/components/button/button.vue +15 -15
- package/src/components/card/card.ts +52 -52
- package/src/components/checkbox/checkbox.ts +45 -45
- package/src/components/chips/chips.ts +95 -95
- package/src/components/collapsible/collapsible.ts +21 -21
- package/src/components/collapsible/collapsible.vue +27 -27
- package/src/components/date-picker/__tests__/date-picker.test.ts +112 -112
- package/src/components/date-picker/date-picker.ts +157 -157
- package/src/components/date-picker/date-picker.vue +60 -53
- package/src/components/date-picker/use-date-picker.ts +6 -0
- package/src/components/dropdown/__tests__/dropdown-fixes.spec.ts +106 -106
- package/src/components/dropdown/__tests__/dropdown-value-types.spec.ts +213 -213
- package/src/components/dropdown/fix-multi-number.ts +92 -92
- package/src/components/dropdown/use-dropdown.ts +488 -488
- package/src/components/empty-state/empty-state.ts +50 -50
- package/src/components/file-upload/file-upload.ts +87 -87
- package/src/components/floating-action/floating-action.ts +12 -12
- package/src/components/input/input-contact-number/input-contact-number.ts +83 -83
- package/src/components/input/input-email/input-email.vue +17 -17
- package/src/components/input/input-password/use-input-password.ts +19 -19
- package/src/components/input/input-search/input-search.vue +13 -13
- package/src/components/input/input-url/input-url.vue +20 -20
- package/src/components/input/input-username/input-username.vue +17 -17
- package/src/components/input/input.vue +72 -72
- package/src/components/list/ladderized-list/ladderized-list.ts +39 -39
- package/src/components/logo/logo.ts +43 -43
- package/src/components/logo/logo.vue +14 -14
- package/src/components/logo/use-logo.ts +41 -41
- package/src/components/lozenge/lozenge.ts +16 -0
- package/src/components/lozenge/lozenge.vue +22 -13
- package/src/components/lozenge/use-lozenge.ts +58 -27
- package/src/components/modal/modal.ts +45 -45
- package/src/components/progress-bar/progress-bar.ts +39 -39
- package/src/components/radio/radio.ts +42 -42
- package/src/components/select/select.ts +144 -144
- package/src/components/sidenav/sidenav.ts +14 -0
- package/src/components/sidenav/sidenav.vue +36 -6
- package/src/components/sidenav/use-sidenav.ts +16 -3
- package/src/components/sidepanel/sidepanel.vue +55 -55
- package/src/components/sidepanel/stacking-sidepanel/stacking-sidepanel.ts +16 -16
- package/src/components/sidepanel/stacking-sidepanel/stacking-sidepanel.vue +39 -39
- package/src/components/slider/slider.ts +38 -38
- package/src/components/snackbar/snack/snack.ts +71 -71
- package/src/components/snackbar/use-snackbar.ts +34 -34
- package/src/components/status/status.ts +19 -19
- package/src/components/status/status.vue +13 -13
- package/src/components/stepper/step/step.ts +47 -47
- package/src/components/stepper/stepper.ts +47 -47
- package/src/components/stepper/stepper.vue +34 -34
- package/src/components/switch/switch.ts +42 -42
- package/src/components/table/table-actions/table-actions.ts +42 -42
- package/src/components/table/table-actions/table-actions.vue +40 -40
- package/src/components/table/table-chips-title/table-chips-title.ts +27 -27
- package/src/components/table/table-chips-title/table-chips-title.vue +32 -32
- package/src/components/table/table-chips-title/use-table-chips-title.ts +22 -22
- package/src/components/table/table-lozenge-title/table-lozenge-title.ts +23 -23
- package/src/components/table/table-lozenge-title/table-lozenge-title.vue +26 -26
- package/src/components/table/table-lozenge-title/use-table-lozenge-title.ts +21 -21
- package/src/components/table/table-pagination/table-pagination.ts +63 -63
- package/src/components/table/table-pagination/table-pagination.vue +72 -72
- package/src/components/table/table.ts +173 -173
- package/src/components/tabs/tabs.ts +43 -43
- package/src/components/textarea/textarea.ts +72 -72
- package/src/components/textarea/textarea.vue +45 -45
- package/src/components/time-picker/time-picker.ts +69 -69
- package/src/components/tooltip/use-tooltip.ts +13 -13
- package/src/examples/dropdown-number-multi-select.vue +76 -76
- package/src/stores/useSnackbarStore.ts +44 -44
- package/src/vite-env.d.ts +6 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref,
|
|
1
|
+
import { ref, onMounted } from 'vue';
|
|
2
2
|
|
|
3
3
|
import type { SetupContext } from 'vue';
|
|
4
|
-
import type { SidenavPropTypes, SidenavEmitTypes, ParentLinkItem, NavLinks, NavItem, MenuLinkItem } from './sidenav';
|
|
4
|
+
import type { SidenavPropTypes, SidenavEmitTypes, ParentLinkItem, NavLinks, NavItem, MenuLinkItem, Attributes } from './sidenav';
|
|
5
5
|
|
|
6
6
|
interface ObjectItem {
|
|
7
7
|
redirect?: {
|
|
@@ -17,7 +17,8 @@ interface ObjectItem {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const useSidenav = (props: SidenavPropTypes, emit: SetupContext<SidenavEmitTypes>['emit']) => {
|
|
20
|
-
|
|
20
|
+
// Create a separate reactive reference for the navigation data
|
|
21
|
+
const navLinks = ref<NavLinks>({ top: [], bottom: [] });
|
|
21
22
|
|
|
22
23
|
const isQuckActionMenuVisible = ref(false);
|
|
23
24
|
const isUserMenuVisible = ref(false);
|
|
@@ -148,6 +149,7 @@ export const useSidenav = (props: SidenavPropTypes, emit: SetupContext<SidenavEm
|
|
|
148
149
|
subMenuHeading: string;
|
|
149
150
|
items: ParentLinkItem[];
|
|
150
151
|
}[],
|
|
152
|
+
attributes: item.attributes || [],
|
|
151
153
|
};
|
|
152
154
|
};
|
|
153
155
|
|
|
@@ -180,9 +182,19 @@ export const useSidenav = (props: SidenavPropTypes, emit: SetupContext<SidenavEm
|
|
|
180
182
|
return transformedData;
|
|
181
183
|
};
|
|
182
184
|
|
|
185
|
+
const getLozengeTone = (attr: Attributes) => {
|
|
186
|
+
if (typeof attr === 'object' && attr !== null && 'tone' in attr && typeof attr.tone === 'string' && ['danger', 'information', 'plain', 'pending', 'success', 'neutral', 'caution'].includes(attr.tone)) {
|
|
187
|
+
return attr.tone as 'danger' | 'information' | 'plain' | 'pending' | 'success' | 'neutral' | 'caution';
|
|
188
|
+
}
|
|
189
|
+
return 'success'; // Default tone
|
|
190
|
+
};
|
|
191
|
+
|
|
183
192
|
onMounted(async () => {
|
|
184
193
|
if (props.isNavApi) {
|
|
185
194
|
navLinks.value = await transformedNavItems(props.navLinks);
|
|
195
|
+
} else {
|
|
196
|
+
// Use the original navLinks from props
|
|
197
|
+
navLinks.value = props.navLinks;
|
|
186
198
|
}
|
|
187
199
|
});
|
|
188
200
|
|
|
@@ -195,5 +207,6 @@ export const useSidenav = (props: SidenavPropTypes, emit: SetupContext<SidenavEm
|
|
|
195
207
|
handleRedirect,
|
|
196
208
|
generateId,
|
|
197
209
|
transformedNavItems,
|
|
210
|
+
getLozengeTone
|
|
198
211
|
};
|
|
199
212
|
};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-if="!props.isStacking && isOpen && hasBackdrop" :class="sidepanelClasses.backdropBaseClasses"></div>
|
|
3
|
-
|
|
4
|
-
<Transition
|
|
5
|
-
:enter-active-class="sidepanelClasses.sidepanelTransitionActiveClasses"
|
|
6
|
-
:leave-active-class="sidepanelClasses.sidepanelTransitionActiveClasses"
|
|
7
|
-
:enter-from-class="sidepanelClasses.sidepanelTransitionHiddenClasses"
|
|
8
|
-
:enter-to-class="sidepanelClasses.sidepanelTransitionVisibleClasses"
|
|
9
|
-
:leave-from-class="sidepanelClasses.sidepanelTransitionVisibleClasses"
|
|
10
|
-
:leave-to-class="sidepanelClasses.sidepanelTransitionHiddenClasses"
|
|
11
|
-
:appear="!props.isStacking"
|
|
12
|
-
>
|
|
13
|
-
<div
|
|
14
|
-
v-if="props.isOpen || props.isStacking"
|
|
15
|
-
ref="sidepanelRef"
|
|
16
|
-
role="dialog"
|
|
17
|
-
aria-labelledby="sidepanel-title"
|
|
18
|
-
aria-describedby="sidepanel-content"
|
|
19
|
-
:class="sidepanelClasses.sidepanelBaseClasses"
|
|
20
|
-
:style="{ height: typeof height === 'number' ? `${height}px` : height }"
|
|
21
|
-
>
|
|
22
|
-
<template v-if="!props.hideHeader">
|
|
23
|
-
<div v-if="!$slots.header" :class="sidepanelClasses.sidepanelHeaderClasses">
|
|
24
|
-
<div id="sidepanel-title" :class="sidepanelClasses.sidepanelHeaderTitleClasses">
|
|
25
|
-
{{ headerTitle }}
|
|
26
|
-
</div>
|
|
27
|
-
<Icon :class="sidepanelClasses.sidepanelHeaderIconClasses" icon="ph:x" @click="handleClose" />
|
|
28
|
-
</div>
|
|
29
|
-
<div v-else>
|
|
30
|
-
<slot name="header"></slot>
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<div id="sidepanel-content" :class="sidepanelClasses.sidepanelContentClasses">
|
|
35
|
-
<slot />
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
<div v-if="$slots.footer" :class="sidepanelClasses.sidepanelFooterClasses">
|
|
39
|
-
<slot name="footer"></slot>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</Transition>
|
|
43
|
-
</template>
|
|
44
|
-
|
|
45
|
-
<script lang="ts" setup>
|
|
46
|
-
import { Icon } from '@iconify/vue';
|
|
47
|
-
|
|
48
|
-
import { useSidepanel } from './use-sidepanel';
|
|
49
|
-
import { sidepanelPropTypes, sidepanelEmitTypes } from './sidepanel';
|
|
50
|
-
|
|
51
|
-
const props = defineProps(sidepanelPropTypes);
|
|
52
|
-
const emit = defineEmits(sidepanelEmitTypes);
|
|
53
|
-
|
|
54
|
-
const { sidepanelClasses, sidepanelRef, handleClose } = useSidepanel(props, emit);
|
|
55
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="!props.isStacking && isOpen && hasBackdrop" :class="sidepanelClasses.backdropBaseClasses"></div>
|
|
3
|
+
|
|
4
|
+
<Transition
|
|
5
|
+
:enter-active-class="sidepanelClasses.sidepanelTransitionActiveClasses"
|
|
6
|
+
:leave-active-class="sidepanelClasses.sidepanelTransitionActiveClasses"
|
|
7
|
+
:enter-from-class="sidepanelClasses.sidepanelTransitionHiddenClasses"
|
|
8
|
+
:enter-to-class="sidepanelClasses.sidepanelTransitionVisibleClasses"
|
|
9
|
+
:leave-from-class="sidepanelClasses.sidepanelTransitionVisibleClasses"
|
|
10
|
+
:leave-to-class="sidepanelClasses.sidepanelTransitionHiddenClasses"
|
|
11
|
+
:appear="!props.isStacking"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
v-if="props.isOpen || props.isStacking"
|
|
15
|
+
ref="sidepanelRef"
|
|
16
|
+
role="dialog"
|
|
17
|
+
aria-labelledby="sidepanel-title"
|
|
18
|
+
aria-describedby="sidepanel-content"
|
|
19
|
+
:class="sidepanelClasses.sidepanelBaseClasses"
|
|
20
|
+
:style="{ height: typeof height === 'number' ? `${height}px` : height }"
|
|
21
|
+
>
|
|
22
|
+
<template v-if="!props.hideHeader">
|
|
23
|
+
<div v-if="!$slots.header" :class="sidepanelClasses.sidepanelHeaderClasses">
|
|
24
|
+
<div id="sidepanel-title" :class="sidepanelClasses.sidepanelHeaderTitleClasses">
|
|
25
|
+
{{ headerTitle }}
|
|
26
|
+
</div>
|
|
27
|
+
<Icon :class="sidepanelClasses.sidepanelHeaderIconClasses" icon="ph:x" @click="handleClose" />
|
|
28
|
+
</div>
|
|
29
|
+
<div v-else>
|
|
30
|
+
<slot name="header"></slot>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<div id="sidepanel-content" :class="sidepanelClasses.sidepanelContentClasses">
|
|
35
|
+
<slot />
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<div v-if="$slots.footer" :class="sidepanelClasses.sidepanelFooterClasses">
|
|
39
|
+
<slot name="footer"></slot>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</Transition>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script lang="ts" setup>
|
|
46
|
+
import { Icon } from '@iconify/vue';
|
|
47
|
+
|
|
48
|
+
import { useSidepanel } from './use-sidepanel';
|
|
49
|
+
import { sidepanelPropTypes, sidepanelEmitTypes } from './sidepanel';
|
|
50
|
+
|
|
51
|
+
const props = defineProps(sidepanelPropTypes);
|
|
52
|
+
const emit = defineEmits(sidepanelEmitTypes);
|
|
53
|
+
|
|
54
|
+
const { sidepanelClasses, sidepanelRef, handleClose } = useSidepanel(props, emit);
|
|
55
|
+
</script>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { ExtractPropTypes, PropType } from "vue";
|
|
2
|
-
|
|
3
|
-
export const stackingSidePanelProps = {
|
|
4
|
-
stack: {
|
|
5
|
-
type: Array as PropType<string[]>,
|
|
6
|
-
default: [],
|
|
7
|
-
required: true,
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const stackingSidePanelEmits = {
|
|
12
|
-
'update:stack': (value: string[]) => value,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type StackingSidePanelPropTypes = ExtractPropTypes<typeof stackingSidePanelProps>;
|
|
16
|
-
export type StackingSidePanelEmitTypes = typeof stackingSidePanelEmits;
|
|
1
|
+
import type { ExtractPropTypes, PropType } from "vue";
|
|
2
|
+
|
|
3
|
+
export const stackingSidePanelProps = {
|
|
4
|
+
stack: {
|
|
5
|
+
type: Array as PropType<string[]>,
|
|
6
|
+
default: [],
|
|
7
|
+
required: true,
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const stackingSidePanelEmits = {
|
|
12
|
+
'update:stack': (value: string[]) => value,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type StackingSidePanelPropTypes = ExtractPropTypes<typeof stackingSidePanelProps>;
|
|
16
|
+
export type StackingSidePanelEmitTypes = typeof stackingSidePanelEmits;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-if="activePanels.length > 0" :class="stackingSidepanelClasses.sidepanelStackBackdropClasses"></div>
|
|
3
|
-
<div
|
|
4
|
-
ref="stacking-sidepanel-base"
|
|
5
|
-
:class="[stackingSidepanelClasses.sidepanelStackBaseClasses]"
|
|
6
|
-
:style="stackingSidepanelBaseTransform"
|
|
7
|
-
>
|
|
8
|
-
<transition-group
|
|
9
|
-
:enter-active-class="stackingSidepanelClasses.sidepanelStackTransitionEnterActiveClasses"
|
|
10
|
-
:leave-active-class="stackingSidepanelClasses.sidepanelStackTransitionLeaveActiveClasses"
|
|
11
|
-
:move-class="stackingSidepanelClasses.sidepanelStackMoveClasses"
|
|
12
|
-
:enter-from-class="stackingSidepanelClasses.sidepanelStackEnterFromClasses"
|
|
13
|
-
:leave-to-class="stackingSidepanelClasses.sidepanelStackLeaveToClasses"
|
|
14
|
-
appear
|
|
15
|
-
>
|
|
16
|
-
<div v-for="name in activePanels" :key="name">
|
|
17
|
-
<slot :name="name" />
|
|
18
|
-
</div>
|
|
19
|
-
</transition-group>
|
|
20
|
-
</div>
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<script setup lang="ts">
|
|
24
|
-
import { useTemplateRef } from 'vue';
|
|
25
|
-
import { useStackingSidepanel } from './use-stacking-sidepanel';
|
|
26
|
-
import { stackingSidePanelProps, stackingSidePanelEmits } from './stacking-sidepanel';
|
|
27
|
-
|
|
28
|
-
const stackingSidepanelBase = useTemplateRef('stacking-sidepanel-base');
|
|
29
|
-
const props = defineProps(stackingSidePanelProps);
|
|
30
|
-
const emits = defineEmits(stackingSidePanelEmits);
|
|
31
|
-
|
|
32
|
-
const { showPanel, hidePanel, stackingSidepanelClasses, stackingSidepanelBaseTransform, activePanels } =
|
|
33
|
-
useStackingSidepanel(props, emits, stackingSidepanelBase);
|
|
34
|
-
|
|
35
|
-
defineExpose({
|
|
36
|
-
showPanel,
|
|
37
|
-
hidePanel,
|
|
38
|
-
});
|
|
39
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="activePanels.length > 0" :class="stackingSidepanelClasses.sidepanelStackBackdropClasses"></div>
|
|
3
|
+
<div
|
|
4
|
+
ref="stacking-sidepanel-base"
|
|
5
|
+
:class="[stackingSidepanelClasses.sidepanelStackBaseClasses]"
|
|
6
|
+
:style="stackingSidepanelBaseTransform"
|
|
7
|
+
>
|
|
8
|
+
<transition-group
|
|
9
|
+
:enter-active-class="stackingSidepanelClasses.sidepanelStackTransitionEnterActiveClasses"
|
|
10
|
+
:leave-active-class="stackingSidepanelClasses.sidepanelStackTransitionLeaveActiveClasses"
|
|
11
|
+
:move-class="stackingSidepanelClasses.sidepanelStackMoveClasses"
|
|
12
|
+
:enter-from-class="stackingSidepanelClasses.sidepanelStackEnterFromClasses"
|
|
13
|
+
:leave-to-class="stackingSidepanelClasses.sidepanelStackLeaveToClasses"
|
|
14
|
+
appear
|
|
15
|
+
>
|
|
16
|
+
<div v-for="name in activePanels" :key="name">
|
|
17
|
+
<slot :name="name" />
|
|
18
|
+
</div>
|
|
19
|
+
</transition-group>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import { useTemplateRef } from 'vue';
|
|
25
|
+
import { useStackingSidepanel } from './use-stacking-sidepanel';
|
|
26
|
+
import { stackingSidePanelProps, stackingSidePanelEmits } from './stacking-sidepanel';
|
|
27
|
+
|
|
28
|
+
const stackingSidepanelBase = useTemplateRef('stacking-sidepanel-base');
|
|
29
|
+
const props = defineProps(stackingSidePanelProps);
|
|
30
|
+
const emits = defineEmits(stackingSidePanelEmits);
|
|
31
|
+
|
|
32
|
+
const { showPanel, hidePanel, stackingSidepanelClasses, stackingSidepanelBaseTransform, activePanels } =
|
|
33
|
+
useStackingSidepanel(props, emits, stackingSidepanelBase);
|
|
34
|
+
|
|
35
|
+
defineExpose({
|
|
36
|
+
showPanel,
|
|
37
|
+
hidePanel,
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
const SLIDER_SIZES = ['sm','lg'] as const;
|
|
3
|
-
|
|
4
|
-
export const sliderPropTypes = {
|
|
5
|
-
size: {
|
|
6
|
-
type: String as PropType<(typeof SLIDER_SIZES)[number]>,
|
|
7
|
-
validator: (value: (typeof SLIDER_SIZES)[number]) => SLIDER_SIZES.includes(value),
|
|
8
|
-
default: 'lg',
|
|
9
|
-
},
|
|
10
|
-
min: {
|
|
11
|
-
type: Number,
|
|
12
|
-
default: 0,
|
|
13
|
-
},
|
|
14
|
-
max: {
|
|
15
|
-
type: Number,
|
|
16
|
-
default: 100,
|
|
17
|
-
},
|
|
18
|
-
step: {
|
|
19
|
-
type: Number,
|
|
20
|
-
default: 1,
|
|
21
|
-
},
|
|
22
|
-
modelValue: {
|
|
23
|
-
type: Number,
|
|
24
|
-
default: 0,
|
|
25
|
-
},
|
|
26
|
-
disabled: {
|
|
27
|
-
type: Boolean,
|
|
28
|
-
default: false,
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const sliderEmits = {
|
|
33
|
-
'update:modelValue': (value: number): value is number => typeof value === 'number',
|
|
34
|
-
slideend: (value: number): value is number => typeof value === 'number',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type SliderPropTypes = ExtractPropTypes<typeof sliderPropTypes>;
|
|
38
|
-
export type SliderEmitTypes = typeof sliderEmits;
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
const SLIDER_SIZES = ['sm','lg'] as const;
|
|
3
|
+
|
|
4
|
+
export const sliderPropTypes = {
|
|
5
|
+
size: {
|
|
6
|
+
type: String as PropType<(typeof SLIDER_SIZES)[number]>,
|
|
7
|
+
validator: (value: (typeof SLIDER_SIZES)[number]) => SLIDER_SIZES.includes(value),
|
|
8
|
+
default: 'lg',
|
|
9
|
+
},
|
|
10
|
+
min: {
|
|
11
|
+
type: Number,
|
|
12
|
+
default: 0,
|
|
13
|
+
},
|
|
14
|
+
max: {
|
|
15
|
+
type: Number,
|
|
16
|
+
default: 100,
|
|
17
|
+
},
|
|
18
|
+
step: {
|
|
19
|
+
type: Number,
|
|
20
|
+
default: 1,
|
|
21
|
+
},
|
|
22
|
+
modelValue: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: 0,
|
|
25
|
+
},
|
|
26
|
+
disabled: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const sliderEmits = {
|
|
33
|
+
'update:modelValue': (value: number): value is number => typeof value === 'number',
|
|
34
|
+
slideend: (value: number): value is number => typeof value === 'number',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type SliderPropTypes = ExtractPropTypes<typeof sliderPropTypes>;
|
|
38
|
+
export type SliderEmitTypes = typeof sliderEmits;
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
// export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
-
|
|
5
|
-
export const SNACKBAR_TONES = ['success', 'information', 'danger', 'caution'] as const;
|
|
6
|
-
type ActionIconProps = {
|
|
7
|
-
icon: string;
|
|
8
|
-
tone: 'neutral' | 'success' | 'danger'
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const snackPropTypes = {
|
|
12
|
-
/**
|
|
13
|
-
* @description Text label shown in snack
|
|
14
|
-
*/
|
|
15
|
-
text: {
|
|
16
|
-
type: String,
|
|
17
|
-
required: true,
|
|
18
|
-
},
|
|
19
|
-
/**
|
|
20
|
-
* @description Snack tone either as 'success', 'information', 'danger', 'caution'
|
|
21
|
-
*/
|
|
22
|
-
tone: {
|
|
23
|
-
type: String as PropType<(typeof SNACKBAR_TONES)[number]>,
|
|
24
|
-
validator: (value: (typeof SNACKBAR_TONES)[number]) => SNACKBAR_TONES.includes(value),
|
|
25
|
-
default: 'information',
|
|
26
|
-
},
|
|
27
|
-
/**
|
|
28
|
-
* @description To show action label in snack. Default is false
|
|
29
|
-
*/
|
|
30
|
-
showAction: {
|
|
31
|
-
type: Boolean,
|
|
32
|
-
default: false,
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* @description Text label for the action function.
|
|
36
|
-
*/
|
|
37
|
-
actionText: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: "action",
|
|
40
|
-
},
|
|
41
|
-
/**
|
|
42
|
-
* @description On click function of the action text.
|
|
43
|
-
*/
|
|
44
|
-
action: {
|
|
45
|
-
type: Function,
|
|
46
|
-
default: () => {},
|
|
47
|
-
},
|
|
48
|
-
/**
|
|
49
|
-
* @description To show icon in snack. Default is false.
|
|
50
|
-
*/
|
|
51
|
-
showIcon: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: false,
|
|
54
|
-
},
|
|
55
|
-
/**
|
|
56
|
-
* @description Duration to show snack. Default is 4000 ms (4s) declared on store
|
|
57
|
-
*/
|
|
58
|
-
duration: {
|
|
59
|
-
type: Number,
|
|
60
|
-
},
|
|
61
|
-
actionIconProps: {
|
|
62
|
-
type: Object as PropType<ActionIconProps>,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const snackEmitTypes = {
|
|
67
|
-
click: (evt: MouseEvent): evt is MouseEvent => evt instanceof MouseEvent,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export type SnackPropTypes = ExtractPropTypes<typeof snackPropTypes>;
|
|
71
|
-
export type SnackEmitTypes = typeof snackEmitTypes;
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
// export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
+
|
|
5
|
+
export const SNACKBAR_TONES = ['success', 'information', 'danger', 'caution'] as const;
|
|
6
|
+
type ActionIconProps = {
|
|
7
|
+
icon: string;
|
|
8
|
+
tone: 'neutral' | 'success' | 'danger'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const snackPropTypes = {
|
|
12
|
+
/**
|
|
13
|
+
* @description Text label shown in snack
|
|
14
|
+
*/
|
|
15
|
+
text: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* @description Snack tone either as 'success', 'information', 'danger', 'caution'
|
|
21
|
+
*/
|
|
22
|
+
tone: {
|
|
23
|
+
type: String as PropType<(typeof SNACKBAR_TONES)[number]>,
|
|
24
|
+
validator: (value: (typeof SNACKBAR_TONES)[number]) => SNACKBAR_TONES.includes(value),
|
|
25
|
+
default: 'information',
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* @description To show action label in snack. Default is false
|
|
29
|
+
*/
|
|
30
|
+
showAction: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* @description Text label for the action function.
|
|
36
|
+
*/
|
|
37
|
+
actionText: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "action",
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* @description On click function of the action text.
|
|
43
|
+
*/
|
|
44
|
+
action: {
|
|
45
|
+
type: Function,
|
|
46
|
+
default: () => {},
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* @description To show icon in snack. Default is false.
|
|
50
|
+
*/
|
|
51
|
+
showIcon: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* @description Duration to show snack. Default is 4000 ms (4s) declared on store
|
|
57
|
+
*/
|
|
58
|
+
duration: {
|
|
59
|
+
type: Number,
|
|
60
|
+
},
|
|
61
|
+
actionIconProps: {
|
|
62
|
+
type: Object as PropType<ActionIconProps>,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const snackEmitTypes = {
|
|
67
|
+
click: (evt: MouseEvent): evt is MouseEvent => evt instanceof MouseEvent,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type SnackPropTypes = ExtractPropTypes<typeof snackPropTypes>;
|
|
71
|
+
export type SnackEmitTypes = typeof snackEmitTypes;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { SnackPropTypes } from "@/components/snackbar/snack/snack";
|
|
2
|
-
import { useSnackbarStore } from '@/stores/useSnackbarStore';
|
|
3
|
-
|
|
4
|
-
export const useSnackbar = () => {
|
|
5
|
-
const snackStore = useSnackbarStore();
|
|
6
|
-
|
|
7
|
-
const showSnackbar = (payload: SnackPropTypes) => {
|
|
8
|
-
snackStore.message(payload);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const showSuccess = (payload: SnackPropTypes) => {
|
|
12
|
-
snackStore.message({ ...payload, tone: "success"});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const showInformation = (payload: SnackPropTypes) => {
|
|
16
|
-
snackStore.message({ ...payload, tone: "information"});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const showDanger = (payload: SnackPropTypes) => {
|
|
20
|
-
snackStore.message({ ...payload, tone: "danger"});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const showCaution = (payload: SnackPropTypes) => {
|
|
24
|
-
snackStore.message({ ...payload, tone: "caution"});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
showSnackbar,
|
|
29
|
-
showSuccess,
|
|
30
|
-
showInformation,
|
|
31
|
-
showDanger,
|
|
32
|
-
showCaution,
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
import { SnackPropTypes } from "@/components/snackbar/snack/snack";
|
|
2
|
+
import { useSnackbarStore } from '@/stores/useSnackbarStore';
|
|
3
|
+
|
|
4
|
+
export const useSnackbar = () => {
|
|
5
|
+
const snackStore = useSnackbarStore();
|
|
6
|
+
|
|
7
|
+
const showSnackbar = (payload: SnackPropTypes) => {
|
|
8
|
+
snackStore.message(payload);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const showSuccess = (payload: SnackPropTypes) => {
|
|
12
|
+
snackStore.message({ ...payload, tone: "success"});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const showInformation = (payload: SnackPropTypes) => {
|
|
16
|
+
snackStore.message({ ...payload, tone: "information"});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const showDanger = (payload: SnackPropTypes) => {
|
|
20
|
+
snackStore.message({ ...payload, tone: "danger"});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const showCaution = (payload: SnackPropTypes) => {
|
|
24
|
+
snackStore.message({ ...payload, tone: "caution"});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
showSnackbar,
|
|
29
|
+
showSuccess,
|
|
30
|
+
showInformation,
|
|
31
|
+
showDanger,
|
|
32
|
+
showCaution,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
const STATUS_STATES = ['success', 'information', 'pending', 'caution', 'danger'] as const;
|
|
4
|
-
const STATUS_SIZES = ['2xs', 'xs', 'sm', 'base', 'lg', 'xl', '2xl'] as const;
|
|
5
|
-
|
|
6
|
-
export const statusPropTypes = {
|
|
7
|
-
state: {
|
|
8
|
-
type: String as PropType<(typeof STATUS_STATES)[number]>,
|
|
9
|
-
validator: (value: (typeof STATUS_STATES)[number]) => STATUS_STATES.includes(value),
|
|
10
|
-
default: 'success',
|
|
11
|
-
},
|
|
12
|
-
size: {
|
|
13
|
-
type: String as PropType<(typeof STATUS_SIZES)[number]>,
|
|
14
|
-
validator: (value: (typeof STATUS_SIZES)[number]) => STATUS_SIZES.includes(value),
|
|
15
|
-
default: 'base',
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type StatusPropTypes = ExtractPropTypes<typeof statusPropTypes>;
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
const STATUS_STATES = ['success', 'information', 'pending', 'caution', 'danger'] as const;
|
|
4
|
+
const STATUS_SIZES = ['2xs', 'xs', 'sm', 'base', 'lg', 'xl', '2xl'] as const;
|
|
5
|
+
|
|
6
|
+
export const statusPropTypes = {
|
|
7
|
+
state: {
|
|
8
|
+
type: String as PropType<(typeof STATUS_STATES)[number]>,
|
|
9
|
+
validator: (value: (typeof STATUS_STATES)[number]) => STATUS_STATES.includes(value),
|
|
10
|
+
default: 'success',
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
type: String as PropType<(typeof STATUS_SIZES)[number]>,
|
|
14
|
+
validator: (value: (typeof STATUS_SIZES)[number]) => STATUS_SIZES.includes(value),
|
|
15
|
+
default: 'base',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type StatusPropTypes = ExtractPropTypes<typeof statusPropTypes>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Icon :icon="statusIcon" :class="[statusClass, statusSize]" :aria-label="statusDescription" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script lang="ts" setup>
|
|
6
|
-
import { Icon } from '@iconify/vue';
|
|
7
|
-
import { statusPropTypes } from './status';
|
|
8
|
-
import { useStatus } from './use-status';
|
|
9
|
-
|
|
10
|
-
const props = defineProps(statusPropTypes);
|
|
11
|
-
|
|
12
|
-
const { statusIcon, statusClass, statusDescription, statusSize} = useStatus(props);
|
|
13
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<Icon :icon="statusIcon" :class="[statusClass, statusSize]" :aria-label="statusDescription" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script lang="ts" setup>
|
|
6
|
+
import { Icon } from '@iconify/vue';
|
|
7
|
+
import { statusPropTypes } from './status';
|
|
8
|
+
import { useStatus } from './use-status';
|
|
9
|
+
|
|
10
|
+
const props = defineProps(statusPropTypes);
|
|
11
|
+
|
|
12
|
+
const { statusIcon, statusClass, statusDescription, statusSize} = useStatus(props);
|
|
13
|
+
</script>
|