design-system-next 2.11.7 → 2.11.9
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 +5908 -6004
- 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/package.json.d.ts +1 -1
- package/package.json +1 -1
- package/src/App.vue +49 -1
- package/src/components/date-picker/date-picker.vue +3 -0
- package/src/components/date-picker/use-date-picker.ts +39 -6
- package/src/components/sidenav/sidenav.vue +18 -18
|
Binary file
|
package/dist/package.json.d.ts
CHANGED
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<spr-button tone="success" @click="datePickerModel = '09-11-1997'">Open Sidepanel</spr-button>
|
|
3
|
+
<spr-sidepanel :is-open="isSidepanelOpen" header-title="Sidepanel Example" @close="isSidepanelOpen = false">
|
|
4
|
+
<div class="p-4">Sidepanel Content</div>
|
|
5
|
+
<template #footer>
|
|
6
|
+
<div class="spr-flex spr-justify-end spr-gap-2 spr-px-2">
|
|
7
|
+
<spr-button>Cancel</spr-button>
|
|
8
|
+
<spr-button-dropdown
|
|
9
|
+
v-model="wew"
|
|
10
|
+
dropdown-id="example1"
|
|
11
|
+
:menu-list="menuList"
|
|
12
|
+
placement="top-end"
|
|
13
|
+
popper-inner-width="200px"
|
|
14
|
+
>
|
|
15
|
+
Button Dropdown
|
|
16
|
+
</spr-button-dropdown>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
</spr-sidepanel>
|
|
20
|
+
|
|
21
|
+
<spr-date-picker id="datepicker" v-model="datePickerModel" label="Date Picker" display-helper />
|
|
3
22
|
</template>
|
|
23
|
+
<script setup>
|
|
24
|
+
import { ref } from 'vue';
|
|
25
|
+
|
|
26
|
+
import SprButton from './components/button/button.vue';
|
|
27
|
+
import SprButtonDropdown from './components/button/button-dropdown/button-dropdown.vue';
|
|
28
|
+
import SprSidepanel from './components/sidepanel/sidepanel.vue';
|
|
29
|
+
import SprDatePicker from './components/date-picker/date-picker.vue';
|
|
30
|
+
|
|
31
|
+
const isSidepanelOpen = ref(false);
|
|
32
|
+
|
|
33
|
+
const wew = ref();
|
|
34
|
+
|
|
35
|
+
const menuList = ref([
|
|
36
|
+
{
|
|
37
|
+
text: 'Option 1',
|
|
38
|
+
value: 'option1',
|
|
39
|
+
icon: 'ph:check',
|
|
40
|
+
iconColor: 'spr-text-color-brand-base',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
text: 'Option 2',
|
|
44
|
+
value: 'option2',
|
|
45
|
+
icon: 'ph:check',
|
|
46
|
+
iconColor: 'spr-text-color-brand-base',
|
|
47
|
+
},
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
const datePickerModel = ref('');
|
|
51
|
+
</script>
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
maxlength="3"
|
|
35
35
|
:disabled="props.disabled"
|
|
36
36
|
:readonly="props.readonly"
|
|
37
|
+
autocomplete="off"
|
|
37
38
|
@input="handleMonthInput"
|
|
38
39
|
@keyup="handleMonthInput"
|
|
39
40
|
@keydown="handleBackspace('month', $event)"
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
maxlength="2"
|
|
50
51
|
:disabled="props.disabled"
|
|
51
52
|
:readonly="props.readonly"
|
|
53
|
+
autocomplete="off"
|
|
52
54
|
@input="handleDateInput"
|
|
53
55
|
@keyup="handleDateInput"
|
|
54
56
|
@keydown="handleBackspace('date', $event)"
|
|
@@ -64,6 +66,7 @@
|
|
|
64
66
|
maxlength="4"
|
|
65
67
|
:disabled="props.disabled"
|
|
66
68
|
:readonly="props.readonly"
|
|
69
|
+
autocomplete="off"
|
|
67
70
|
@input="handleYearInput"
|
|
68
71
|
@keyup="handleYearInput"
|
|
69
72
|
@keydown="handleBackspace('year', $event)"
|
|
@@ -684,6 +684,8 @@ export const useDatePicker = (props: DatePickerPropTypes, emit: SetupContext<Dat
|
|
|
684
684
|
};
|
|
685
685
|
|
|
686
686
|
const handleMonthInput = () => {
|
|
687
|
+
datePopperState.value = false;
|
|
688
|
+
|
|
687
689
|
monthInput.value = monthInput.value.replace(/[^A-Za-z0-9\s]/g, '').toLocaleUpperCase();
|
|
688
690
|
|
|
689
691
|
datePickerErrors.value = [];
|
|
@@ -694,10 +696,19 @@ export const useDatePicker = (props: DatePickerPropTypes, emit: SetupContext<Dat
|
|
|
694
696
|
|
|
695
697
|
handleValidateDate();
|
|
696
698
|
|
|
697
|
-
|
|
699
|
+
// Do not set yearInput when typing monthInput
|
|
700
|
+
if (!monthInput.value && !dateInput.value && !yearInput.value) {
|
|
701
|
+
emit('getInputValue', null);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
if (monthInput.value && dateInput.value && yearInput.value) {
|
|
705
|
+
emitInputValue();
|
|
706
|
+
}
|
|
698
707
|
};
|
|
699
708
|
|
|
700
709
|
const handleDateInput = () => {
|
|
710
|
+
datePopperState.value = false;
|
|
711
|
+
|
|
701
712
|
dateInput.value = dateInput.value.replace(/[^0-9]/g, '');
|
|
702
713
|
|
|
703
714
|
datePickerErrors.value = [];
|
|
@@ -706,19 +717,39 @@ export const useDatePicker = (props: DatePickerPropTypes, emit: SetupContext<Dat
|
|
|
706
717
|
|
|
707
718
|
handleValidateDate();
|
|
708
719
|
|
|
709
|
-
|
|
720
|
+
// Do not set yearInput when typing dateInput
|
|
721
|
+
if (!monthInput.value && !dateInput.value && !yearInput.value) {
|
|
722
|
+
emit('getInputValue', null);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
if (monthInput.value && dateInput.value && yearInput.value) {
|
|
726
|
+
emitInputValue();
|
|
727
|
+
}
|
|
710
728
|
};
|
|
711
729
|
|
|
712
730
|
const handleYearInput = () => {
|
|
731
|
+
datePopperState.value = false;
|
|
732
|
+
|
|
713
733
|
yearInput.value = yearInput.value.replace(/[^0-9]/g, '');
|
|
714
734
|
|
|
715
735
|
datePickerErrors.value = [];
|
|
716
736
|
|
|
717
737
|
emit('getDateErrors', datePickerErrors.value);
|
|
718
738
|
|
|
719
|
-
|
|
739
|
+
// Only validate year, do not set monthInput or dateInput
|
|
740
|
+
// Only emit year-related changes
|
|
741
|
+
// Only validate if yearInput is 4 digits (full year)
|
|
742
|
+
if (yearInput.value.length === 4) {
|
|
743
|
+
handleValidateDate();
|
|
720
744
|
|
|
721
|
-
|
|
745
|
+
if (!monthInput.value && !dateInput.value && !yearInput.value) {
|
|
746
|
+
emit('getInputValue', null);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
if (monthInput.value && dateInput.value && yearInput.value) {
|
|
750
|
+
emitInputValue();
|
|
751
|
+
}
|
|
752
|
+
}
|
|
722
753
|
};
|
|
723
754
|
|
|
724
755
|
const handleConvertMonthIfValid = () => {
|
|
@@ -884,8 +915,6 @@ export const useDatePicker = (props: DatePickerPropTypes, emit: SetupContext<Dat
|
|
|
884
915
|
const dateObj = dayjs(`${emittedMonth}-${dateInput.value}-${yearInput.value}`, 'MM-DD-YYYY');
|
|
885
916
|
|
|
886
917
|
// Use the specified format for the input value
|
|
887
|
-
if (!emittedMonth && !dateInput.value && !yearInput.value) return;
|
|
888
|
-
|
|
889
918
|
emit('getInputValue', (modelValue.value = dateObj.format(format.value)));
|
|
890
919
|
};
|
|
891
920
|
|
|
@@ -954,6 +983,10 @@ export const useDatePicker = (props: DatePickerPropTypes, emit: SetupContext<Dat
|
|
|
954
983
|
emitYearList();
|
|
955
984
|
});
|
|
956
985
|
|
|
986
|
+
watch(modelValue, () => {
|
|
987
|
+
setModelValue();
|
|
988
|
+
});
|
|
989
|
+
|
|
957
990
|
return {
|
|
958
991
|
datePickerClasses,
|
|
959
992
|
datePickerRef,
|
|
@@ -234,20 +234,20 @@
|
|
|
234
234
|
v-for="(submenuLink, submenuLinkIndex) in menuLinkItem.submenuLinks"
|
|
235
235
|
:key="submenuLinkIndex"
|
|
236
236
|
>
|
|
237
|
-
<h5
|
|
238
|
-
v-if="submenuLink.subMenuHeading"
|
|
239
|
-
:class="{
|
|
240
|
-
'spr-label-xs-medium spr-text-color-supporting spr-m-0 spr-p-2': true,
|
|
241
|
-
'spr-mt-2': submenuLinkIndex !== 0,
|
|
242
|
-
}"
|
|
243
|
-
>
|
|
244
|
-
{{ submenuLink.subMenuHeading }}
|
|
245
|
-
</h5>
|
|
246
237
|
<template
|
|
247
238
|
v-for="(submenuLinkItem, submenuLinkItemIndex) in submenuLink.items"
|
|
248
239
|
:key="submenuLinkItemIndex"
|
|
249
240
|
>
|
|
250
241
|
<Menu aria-id="sidenav-sub-submenu-wrapper" :triggers="['click', 'hover']" instant-move>
|
|
242
|
+
<h5
|
|
243
|
+
v-if="submenuLink.subMenuHeading"
|
|
244
|
+
:class="{
|
|
245
|
+
'spr-label-xs-medium spr-text-color-supporting spr-m-0 spr-p-2': true,
|
|
246
|
+
'spr-mt-2': submenuLinkIndex !== 0,
|
|
247
|
+
}"
|
|
248
|
+
>
|
|
249
|
+
{{ submenuLink.subMenuHeading }}
|
|
250
|
+
</h5>
|
|
251
251
|
<div
|
|
252
252
|
v-if="!submenuLinkItem.hidden"
|
|
253
253
|
:id="`${generateId(parentLink.title, menuLinkItem.title, submenuLinkItem.title)}`"
|
|
@@ -459,20 +459,20 @@
|
|
|
459
459
|
v-for="(submenuLink, submenuLinkIndex) in menuLinkItem.submenuLinks"
|
|
460
460
|
:key="submenuLinkIndex"
|
|
461
461
|
>
|
|
462
|
-
<h5
|
|
463
|
-
v-if="submenuLink.subMenuHeading"
|
|
464
|
-
:class="{
|
|
465
|
-
'spr-label-xs-medium spr-text-color-supporting spr-m-0 spr-p-2': true,
|
|
466
|
-
'spr-mt-3': submenuLinkIndex !== 0,
|
|
467
|
-
}"
|
|
468
|
-
>
|
|
469
|
-
{{ submenuLink.subMenuHeading }}
|
|
470
|
-
</h5>
|
|
471
462
|
<template
|
|
472
463
|
v-for="(submenuLinkItem, submenuLinkItemIndex) in submenuLink.items"
|
|
473
464
|
:key="submenuLinkItemIndex"
|
|
474
465
|
>
|
|
475
466
|
<Menu aria-id="sidenav-sub-submenu-wrapper" :triggers="['click', 'hover']" instant-move>
|
|
467
|
+
<h5
|
|
468
|
+
v-if="submenuLink.subMenuHeading"
|
|
469
|
+
:class="{
|
|
470
|
+
'spr-label-xs-medium spr-text-color-supporting spr-m-0 spr-p-2': true,
|
|
471
|
+
'spr-mt-3': submenuLinkIndex !== 0,
|
|
472
|
+
}"
|
|
473
|
+
>
|
|
474
|
+
{{ submenuLink.subMenuHeading }}
|
|
475
|
+
</h5>
|
|
476
476
|
<div
|
|
477
477
|
v-if="!submenuLinkItem.hidden"
|
|
478
478
|
:id="`${generateId(parentLink.title, menuLinkItem.title, submenuLinkItem.title)}`"
|