@central-design-system/components 3.0.0-alpha.5 → 3.0.0-alpha.6
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/cds.css +1 -1
- package/dist/cds.d.ts +51 -48
- package/dist/cds.es.js +3816 -3310
- package/dist/cds.umd.js +1 -1
- package/dist/components/CdsButton/CdsButton.vue.d.ts +1 -0
- package/dist/components/CdsCombobox/CdsCombobox.vue.d.ts +18 -18
- package/dist/components/CdsDropdown/CdsDropdown.vue.d.ts +18 -18
- package/dist/components/CdsGrid/composable/grid.d.ts +2 -1
- package/dist/components/CdsMenu/CdsMenu.vue.d.ts +24 -18
- package/dist/components/CdsOverlay/CdsOverlay.vue.d.ts +9 -13
- package/dist/components/CdsOverlay/composable/locationStrategies.d.ts +3 -0
- package/dist/components/CdsPagination/CdsPagination.vue.d.ts +142 -0
- package/dist/components/CdsTooltip/CdsTooltip.vue.d.ts +765 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/composable/dimensions.d.ts +23 -5
- package/dist/composable/display.d.ts +56 -0
- package/dist/composable/index.d.ts +3 -0
- package/dist/composable/overlay.d.ts +1 -1
- package/dist/composable/refs.d.ts +6 -0
- package/dist/composable/resizeObserver.d.ts +7 -0
- package/dist/create.d.ts +21 -0
- package/dist/globals.d.ts +2 -0
- package/dist/utils/helpers.d.ts +2 -0
- package/package.json +1 -2
- package/src/scss/themes/index.ts +1 -1
- package/dist/types/CdsOptions.d.ts +0 -3
- package/src/utils/__test__/helper.test.ts +0 -59
- package/src/utils/__test__/mocks/helper.mock.ts +0 -362
- package/src/utils/__test__/mocks/propFactory.mock.ts +0 -88
- package/src/utils/__test__/propFactory.test.ts +0 -9
- package/src/utils/anchor.ts +0 -76
- package/src/utils/animation.ts +0 -62
- package/src/utils/box.ts +0 -39
- package/src/utils/cache.ts +0 -12
- package/src/utils/changeCase/__test__/lowerCase.test.ts +0 -12
- package/src/utils/changeCase/__test__/mocks/lowerCase.mock.ts +0 -80
- package/src/utils/changeCase/__test__/mocks/noCase.mock.ts +0 -131
- package/src/utils/changeCase/__test__/mocks/paramCase.mock.ts +0 -39
- package/src/utils/changeCase/__test__/mocks/pascalCase.mock.ts +0 -46
- package/src/utils/changeCase/__test__/noCase.test.ts +0 -8
- package/src/utils/changeCase/__test__/paramCase.test.ts +0 -8
- package/src/utils/changeCase/__test__/pascalCase.test.ts +0 -8
- package/src/utils/changeCase/lowerCase.ts +0 -56
- package/src/utils/changeCase/noCase.ts +0 -45
- package/src/utils/changeCase/paramCase.ts +0 -11
- package/src/utils/changeCase/pascalCase.ts +0 -24
- package/src/utils/date.ts +0 -1106
- package/src/utils/dom.ts +0 -24
- package/src/utils/getCurrentInstance.ts +0 -43
- package/src/utils/getScrollParent.ts +0 -29
- package/src/utils/globals.ts +0 -8
- package/src/utils/helpers.ts +0 -312
- package/src/utils/index.ts +0 -19
- package/src/utils/propsFactory.ts +0 -92
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { lowerCase } from './lowerCase';
|
|
2
|
-
|
|
3
|
-
export interface IChangeCaseOptions {
|
|
4
|
-
splitRegexp?: RegExp | RegExp[];
|
|
5
|
-
stripRegexp?: RegExp | RegExp[];
|
|
6
|
-
delimiter?: string;
|
|
7
|
-
transform?: (part: string, index: number, parts: string[]) => string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
|
|
11
|
-
const DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
|
|
12
|
-
|
|
13
|
-
// Remove all non-word characters.
|
|
14
|
-
const DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Normalize the string into something other libraries can manipulate easier.
|
|
18
|
-
*/
|
|
19
|
-
export function noCase(input: string, options: IChangeCaseOptions = {}) {
|
|
20
|
-
const {
|
|
21
|
-
splitRegexp = DEFAULT_SPLIT_REGEXP,
|
|
22
|
-
stripRegexp = DEFAULT_STRIP_REGEXP,
|
|
23
|
-
transform = lowerCase,
|
|
24
|
-
delimiter = ' '
|
|
25
|
-
} = options;
|
|
26
|
-
|
|
27
|
-
const result = replace(replace(input, splitRegexp, '$1\0$2'), stripRegexp, '\0');
|
|
28
|
-
let start = 0;
|
|
29
|
-
let end = result.length;
|
|
30
|
-
|
|
31
|
-
// Trim the delimiter from around the output string.
|
|
32
|
-
while (result.charAt(start) === '\0') start++;
|
|
33
|
-
while (result.charAt(end - 1) === '\0') end--;
|
|
34
|
-
|
|
35
|
-
// Transform each token independently.
|
|
36
|
-
return result.slice(start, end).split('\0').map(transform).join(delimiter);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Replace `re` in the input string with the replacement value.
|
|
41
|
-
*/
|
|
42
|
-
function replace(input: string, re: RegExp | RegExp[], value: string) {
|
|
43
|
-
if (re instanceof RegExp) return input.replace(re, value);
|
|
44
|
-
return re.reduce((input, re) => input.replace(re, value), input);
|
|
45
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { noCase } from './noCase';
|
|
2
|
-
import type { IChangeCaseOptions } from './noCase';
|
|
3
|
-
|
|
4
|
-
export type { IChangeCaseOptions };
|
|
5
|
-
|
|
6
|
-
export function paramCase(input: string, options: IChangeCaseOptions = {}) {
|
|
7
|
-
return noCase(input, {
|
|
8
|
-
delimiter: '-',
|
|
9
|
-
...options
|
|
10
|
-
});
|
|
11
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { noCase, IChangeCaseOptions } from './noCase';
|
|
2
|
-
|
|
3
|
-
export type { IChangeCaseOptions };
|
|
4
|
-
|
|
5
|
-
export function pascalCaseTransform(input: string, index: number) {
|
|
6
|
-
const firstChar = input.charAt(0);
|
|
7
|
-
const lowerChars = input.substr(1).toLowerCase();
|
|
8
|
-
if (index > 0 && firstChar >= '0' && firstChar <= '9') {
|
|
9
|
-
return `_${firstChar}${lowerChars}`;
|
|
10
|
-
}
|
|
11
|
-
return `${firstChar.toUpperCase()}${lowerChars}`;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function pascalCaseTransformMerge(input: string) {
|
|
15
|
-
return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function pascalCase(input: string, options: IChangeCaseOptions = {}) {
|
|
19
|
-
return noCase(input, {
|
|
20
|
-
delimiter: '',
|
|
21
|
-
transform: pascalCaseTransform,
|
|
22
|
-
...options
|
|
23
|
-
});
|
|
24
|
-
}
|