design-system-next 2.20.5 → 2.21.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/dist/design-system-next.es.d.ts +1427 -0
- package/dist/design-system-next.es.js +2546 -2465
- 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/package.json +11 -5
- package/src/App.vue +1 -51
- package/src/components/file-upload/file-upload.ts +4 -1
- package/src/components/file-upload/use-file-upload.ts +38 -5
- package/src/components/list/list-item/list-item.ts +48 -48
- package/dist/lib/main.d.ts +0 -5
- package/dist/package.json.d.ts +0 -104
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "design-system-next",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.21.0",
|
|
5
5
|
"main": "./dist/design-system-next.umd.js",
|
|
6
6
|
"module": "./dist/design-system-next.es.js",
|
|
7
|
+
"types": "./dist/design-system-next.es.d.ts",
|
|
7
8
|
"repository": {
|
|
8
9
|
"type": "git",
|
|
9
10
|
"url": "https://dev.azure.com/sproutphil/Sprout%20Design%20System/_git/Sprout%20Design%20System%20Next"
|
|
@@ -18,16 +19,21 @@
|
|
|
18
19
|
],
|
|
19
20
|
"exports": {
|
|
20
21
|
".": {
|
|
22
|
+
"types": "./dist/design-system-next.es.d.ts",
|
|
21
23
|
"import": "./dist/design-system-next.es.js",
|
|
22
24
|
"require": "./dist/design-system-next.umd.js"
|
|
23
25
|
},
|
|
24
|
-
"./style.css": "./dist/main.css"
|
|
26
|
+
"./style.css": "./dist/main.css",
|
|
27
|
+
"./types": {
|
|
28
|
+
"types": "./dist/design-system-next.es.d.ts",
|
|
29
|
+
"import": "./dist/design-system-next.es.d.ts"
|
|
30
|
+
}
|
|
25
31
|
},
|
|
26
32
|
"scripts": {
|
|
27
33
|
"dev": "vite",
|
|
28
|
-
"build": "
|
|
29
|
-
"watch-build": "
|
|
30
|
-
"types": "vue-tsc",
|
|
34
|
+
"build": "vite build",
|
|
35
|
+
"watch-build": "vite build --watch",
|
|
36
|
+
"types": "vue-tsc --noEmit",
|
|
31
37
|
"preview": "vite preview",
|
|
32
38
|
"lint:script": "eslint \"**/*.{js,ts,vue}\"",
|
|
33
39
|
"lint:style": "stylelint \"**/*.{vue,css}\"",
|
package/src/App.vue
CHANGED
|
@@ -1,53 +1,3 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
id="sample-dropdownCustomPopper"
|
|
4
|
-
width="150px"
|
|
5
|
-
:triggers="['click']"
|
|
6
|
-
:popper-triggers="['click']"
|
|
7
|
-
popper-width="500px"
|
|
8
|
-
:auto-hide="false"
|
|
9
|
-
>
|
|
10
|
-
<spr-button class="spr-w-full" tone="success" has-icon>
|
|
11
|
-
<span>Custom Popper</span>
|
|
12
|
-
<Icon icon="ph:caret-down" />
|
|
13
|
-
</spr-button>
|
|
14
|
-
|
|
15
|
-
<template #popper>
|
|
16
|
-
<spr-select-multiple
|
|
17
|
-
id="sample-select"
|
|
18
|
-
v-model="selectModel"
|
|
19
|
-
label="Select Label"
|
|
20
|
-
placeholder="Select an option"
|
|
21
|
-
:options="options"
|
|
22
|
-
popper-container="body"
|
|
23
|
-
wrapper-position="relative"
|
|
24
|
-
popper-strategy="fixed"
|
|
25
|
-
placement="bottom"
|
|
26
|
-
/>
|
|
27
|
-
</template>
|
|
28
|
-
</spr-dropdown>
|
|
2
|
+
<div>Test Component Here</div>
|
|
29
3
|
</template>
|
|
30
|
-
|
|
31
|
-
<script setup>
|
|
32
|
-
import { ref } from 'vue';
|
|
33
|
-
|
|
34
|
-
import SprDropdown from './components/dropdown/dropdown.vue';
|
|
35
|
-
import SprButton from './components/button/button.vue';
|
|
36
|
-
import SprSelectMultiple from './components/select/select-multiple/select-multiple.vue';
|
|
37
|
-
|
|
38
|
-
const selectModel = ref('');
|
|
39
|
-
|
|
40
|
-
const options = ref([
|
|
41
|
-
{ text: 'Apple', value: 'apple' },
|
|
42
|
-
{ text: 'Banana', value: 'banana' },
|
|
43
|
-
{ text: 'Cherry', value: 'cherry' },
|
|
44
|
-
{ text: 'Date', value: 'date' },
|
|
45
|
-
{ text: 'Elderberry', value: 'elderberry' },
|
|
46
|
-
{ text: 'Fig', value: 'fig' },
|
|
47
|
-
{ text: 'Grape', value: 'grape' },
|
|
48
|
-
{ text: 'Nectarine', value: 'nectarine' },
|
|
49
|
-
{ text: 'Orange', value: 'orange' },
|
|
50
|
-
{ text: 'Papaya', value: 'papaya' },
|
|
51
|
-
{ text: '89 Quince', value: '50' },
|
|
52
|
-
]);
|
|
53
|
-
</script>
|
|
@@ -92,7 +92,10 @@ export const fileUploadPropTypes = {
|
|
|
92
92
|
},
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
export const fileUploadEmitTypes =
|
|
95
|
+
export const fileUploadEmitTypes = {
|
|
96
|
+
'update:modelValue': () => true,
|
|
97
|
+
'validation-error': () => true,
|
|
98
|
+
}
|
|
96
99
|
|
|
97
100
|
export type FileUploadPropTypes = ExtractPropTypes<typeof fileUploadPropTypes>;
|
|
98
101
|
export type FileUploadEmitTypes = typeof fileUploadEmitTypes;
|
|
@@ -20,20 +20,51 @@ export const useFileUpload = (props: FileUploadPropTypes, emit: SetupContext<Fil
|
|
|
20
20
|
// Hidden shared input file in file list. Used for replace function.
|
|
21
21
|
const listInputFileRef = ref<HTMLInputElement | null>(null);
|
|
22
22
|
const fileArray = useVModel(props, 'modelValue', emit);
|
|
23
|
+
const validationErrors = ref<string[]>([]);
|
|
23
24
|
|
|
24
25
|
// Shared file change event for input file and drag & drop
|
|
25
26
|
const onFileChangeHandler = (files: File[] | Event | null) => {
|
|
26
27
|
if (props.disabled || files === null) return;
|
|
27
28
|
|
|
29
|
+
let filesToValidate: File[] = [];
|
|
30
|
+
|
|
28
31
|
// For input file event
|
|
29
32
|
if(files instanceof Event) {
|
|
30
33
|
const target = files.target as HTMLInputElement;
|
|
31
34
|
const fileList = target.files;
|
|
32
|
-
|
|
35
|
+
filesToValidate = fileList ? Array.from(fileList) : [];
|
|
33
36
|
}
|
|
34
37
|
// For drag and drop event
|
|
35
38
|
else {
|
|
36
|
-
|
|
39
|
+
filesToValidate = files;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Validate file types
|
|
43
|
+
const validFiles: File[] = [];
|
|
44
|
+
const invalidFiles: string[] = [];
|
|
45
|
+
|
|
46
|
+
filesToValidate.forEach((file) => {
|
|
47
|
+
if (props.fileTypes.includes(file.type)) {
|
|
48
|
+
validFiles.push(file);
|
|
49
|
+
} else {
|
|
50
|
+
invalidFiles.push(file.name);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Update file array with valid files only
|
|
55
|
+
fileArray.value = validFiles;
|
|
56
|
+
|
|
57
|
+
// Emit validation errors if any invalid files were found
|
|
58
|
+
if (invalidFiles.length > 0) {
|
|
59
|
+
const errorMessage = invalidFiles.length === 1
|
|
60
|
+
? `File "${invalidFiles[0]}" is not a supported file type.`
|
|
61
|
+
: `Files ${invalidFiles.map(name => `"${name}"`).join(', ')} are not supported file types.`;
|
|
62
|
+
|
|
63
|
+
validationErrors.value = [errorMessage];
|
|
64
|
+
emit('validation-error', validationErrors.value);
|
|
65
|
+
} else {
|
|
66
|
+
validationErrors.value = [];
|
|
67
|
+
emit('validation-error', []);
|
|
37
68
|
}
|
|
38
69
|
}
|
|
39
70
|
|
|
@@ -127,10 +158,11 @@ export const useFileUpload = (props: FileUploadPropTypes, emit: SetupContext<Fil
|
|
|
127
158
|
};
|
|
128
159
|
|
|
129
160
|
const replaceFile = (event: Event,) => {
|
|
130
|
-
|
|
161
|
+
const target = event.target as HTMLInputElement;
|
|
162
|
+
if (!target.files || target.files.length <= 0) return;
|
|
131
163
|
if (tempFileIndex.value === null) return;
|
|
132
164
|
|
|
133
|
-
fileArray.value[tempFileIndex.value] =
|
|
165
|
+
fileArray.value[tempFileIndex.value] = target.files[0];
|
|
134
166
|
tempFileIndex.value = null;
|
|
135
167
|
}
|
|
136
168
|
|
|
@@ -193,6 +225,7 @@ export const useFileUpload = (props: FileUploadPropTypes, emit: SetupContext<Fil
|
|
|
193
225
|
clickListInputFile,
|
|
194
226
|
replaceFile,
|
|
195
227
|
supportedFileTypeLabel,
|
|
196
|
-
iconMap
|
|
228
|
+
iconMap,
|
|
229
|
+
validationErrors
|
|
197
230
|
};
|
|
198
231
|
};
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
import type { MenuListType } from '../list';
|
|
3
|
-
|
|
4
|
-
export const listItemPropTypes = {
|
|
5
|
-
item: {
|
|
6
|
-
type: Object as PropType<MenuListType>,
|
|
7
|
-
required: true,
|
|
8
|
-
},
|
|
9
|
-
isSelected: {
|
|
10
|
-
type: Boolean,
|
|
11
|
-
required: true,
|
|
12
|
-
},
|
|
13
|
-
classes: {
|
|
14
|
-
type: [String, Array, Object] as PropType<string | string[] | Record<string, boolean>>,
|
|
15
|
-
required: true,
|
|
16
|
-
},
|
|
17
|
-
multiSelect: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
default: false,
|
|
20
|
-
},
|
|
21
|
-
lozenge: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: false,
|
|
24
|
-
},
|
|
25
|
-
ladderized: {
|
|
26
|
-
type: Boolean,
|
|
27
|
-
default: false,
|
|
28
|
-
},
|
|
29
|
-
noCheck: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: false,
|
|
32
|
-
},
|
|
33
|
-
itemIcon: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: '',
|
|
36
|
-
},
|
|
37
|
-
disabledUnselectedItems: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: false,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const listItemEmitTypes = {
|
|
44
|
-
select: () => true,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type ListItemPropTypes = ExtractPropTypes<typeof listItemPropTypes>;
|
|
48
|
-
export type ListItemEmitTypes = typeof listItemEmitTypes;
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
import type { MenuListType } from '../list';
|
|
3
|
+
|
|
4
|
+
export const listItemPropTypes = {
|
|
5
|
+
item: {
|
|
6
|
+
type: Object as PropType<MenuListType>,
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
isSelected: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
classes: {
|
|
14
|
+
type: [String, Array, Object] as PropType<string | string[] | Record<string, boolean>>,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
multiSelect: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
lozenge: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
ladderized: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
noCheck: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
itemIcon: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: '',
|
|
36
|
+
},
|
|
37
|
+
disabledUnselectedItems: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const listItemEmitTypes = {
|
|
44
|
+
select: () => true,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type ListItemPropTypes = ExtractPropTypes<typeof listItemPropTypes>;
|
|
48
|
+
export type ListItemEmitTypes = typeof listItemEmitTypes;
|
package/dist/lib/main.d.ts
DELETED
package/dist/package.json.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
"name": "design-system-next",
|
|
3
|
-
"private": false,
|
|
4
|
-
"version": "2.20.5",
|
|
5
|
-
"main": "./dist/design-system-next.umd.js",
|
|
6
|
-
"module": "./dist/design-system-next.es.js",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://dev.azure.com/sproutphil/Sprout%20Design%20System/_git/Sprout%20Design%20System%20Next"
|
|
10
|
-
},
|
|
11
|
-
"type": "module",
|
|
12
|
-
"files": [
|
|
13
|
-
"dist",
|
|
14
|
-
"dist/",
|
|
15
|
-
"src/",
|
|
16
|
-
"README.md",
|
|
17
|
-
"LICENSE"
|
|
18
|
-
],
|
|
19
|
-
"exports": {
|
|
20
|
-
".": {
|
|
21
|
-
"import": "./dist/design-system-next.es.js",
|
|
22
|
-
"require": "./dist/design-system-next.umd.js"
|
|
23
|
-
},
|
|
24
|
-
"./style.css": "./dist/main.css"
|
|
25
|
-
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"dev": "vite",
|
|
28
|
-
"build": "vue-tsc && vite build",
|
|
29
|
-
"watch-build": "vue-tsc && vite build --watch",
|
|
30
|
-
"types": "vue-tsc",
|
|
31
|
-
"preview": "vite preview",
|
|
32
|
-
"lint:script": "eslint \"**/*.{js,ts,vue}\"",
|
|
33
|
-
"lint:style": "stylelint \"**/*.{vue,css}\"",
|
|
34
|
-
"fix:style": "stylelint --fix \"**/*.{vue,css}\"",
|
|
35
|
-
"lint": "npm run lint:script && npm run lint:style",
|
|
36
|
-
"prepublishOnly": "npm run build",
|
|
37
|
-
"docs:dev": "vitepress dev docs",
|
|
38
|
-
"docs:build": "vitepress build docs",
|
|
39
|
-
"docs:serve": "vitepress serve docs",
|
|
40
|
-
"docs:preview": "vitepress preview docs",
|
|
41
|
-
"test:ui": "npx playwright test --ui",
|
|
42
|
-
"test:components": "npx playwright test --config=playwright-ct.config.ts --reporter=line",
|
|
43
|
-
"clean": "rm -rf node_modules dist coverage package-lock.json && npm install"
|
|
44
|
-
},
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"@cloudinary/url-gen": "^1.22.0",
|
|
47
|
-
"@eslint/js": "^9.37.0",
|
|
48
|
-
"@iconify-icons/ph": "^1.2.5",
|
|
49
|
-
"@iconify/vue": "^5.0.0",
|
|
50
|
-
"classnames": "^2.5.1",
|
|
51
|
-
"countries-list": "^3.1.1",
|
|
52
|
-
"dayjs": "^1.11.18",
|
|
53
|
-
"floating-vue": "^5.2.2",
|
|
54
|
-
"libphonenumber-js": "^1.12.24",
|
|
55
|
-
"lodash": "^4.17.21",
|
|
56
|
-
"pinia": "^3.0.3",
|
|
57
|
-
"sortablejs": "^1.15.6",
|
|
58
|
-
"stylelint": "^16.25.0",
|
|
59
|
-
"stylelint-config-recess-order": "^7.4.0",
|
|
60
|
-
"stylelint-config-recommended": "^17.0.0",
|
|
61
|
-
"stylelint-config-recommended-vue": "^1.6.1",
|
|
62
|
-
"typescript-eslint": "^8.46.1",
|
|
63
|
-
"vite-plugin-sass": "^0.1.0",
|
|
64
|
-
"vue": "^3.5.22"
|
|
65
|
-
},
|
|
66
|
-
"devDependencies": {
|
|
67
|
-
"@axe-core/playwright": "^4.10.2",
|
|
68
|
-
"@playwright/experimental-ct-vue": "^1.56.0",
|
|
69
|
-
"@playwright/test": "^1.56.0",
|
|
70
|
-
"@stylistic/stylelint-plugin": "^4.0.0",
|
|
71
|
-
"@types/node": "^24.7.2",
|
|
72
|
-
"@vitejs/plugin-vue": "^6.0.1",
|
|
73
|
-
"@types/sortablejs": "^1.15.8",
|
|
74
|
-
"autoprefixer": "^10.4.21",
|
|
75
|
-
"eslint": "^9.37.0",
|
|
76
|
-
"eslint-config-prettier": "^10.1.8",
|
|
77
|
-
"eslint-plugin-vue": "^10.5.1",
|
|
78
|
-
"prettier": "^3.6.2",
|
|
79
|
-
"prettier-plugin-tailwindcss": "^0.7.0",
|
|
80
|
-
"rollup-plugin-gzip": "^4.1.1",
|
|
81
|
-
"sass-embedded": "^1.93.2",
|
|
82
|
-
"stylelint-order": "^7.0.0",
|
|
83
|
-
"tailwindcss": "^3.4.17",
|
|
84
|
-
"tsconfig-paths": "^4.2.0",
|
|
85
|
-
"typescript": "~5.9.3",
|
|
86
|
-
"unplugin-vue-components": "^29.1.0",
|
|
87
|
-
"vite": "^7.1.10",
|
|
88
|
-
"vite-plugin-dts": "^4.5.4",
|
|
89
|
-
"vite-tsconfig-paths": "^5.1.4",
|
|
90
|
-
"vitepress": "^1.6.4",
|
|
91
|
-
"vue-eslint-parser": "^10.2.0",
|
|
92
|
-
"vue-tsc": "^3.1.1"
|
|
93
|
-
},
|
|
94
|
-
"peerDependencies": {
|
|
95
|
-
"vue": "^3.0.0"
|
|
96
|
-
},
|
|
97
|
-
"engines": {
|
|
98
|
-
"node": ">=20.0.0",
|
|
99
|
-
"npm": ">=10.0.0"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
;
|
|
103
|
-
|
|
104
|
-
export default _default;
|