@itcase/ui-core 1.10.46 → 1.10.47
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/types/hooks/index.d.ts +1 -0
- package/dist/types/types/exactlyOne.d.ts +5 -0
- package/dist/types/types/index.d.ts +5 -1
- package/dist/types/types/kebabCase.d.ts +1 -0
- package/dist/types/types/{utils.d.ts → requireAtLeastOneProp.d.ts} +0 -9
- package/dist/types/types/withClassKeys.d.ts +4 -0
- package/dist/types/types/withDeviceProps.d.ts +33 -0
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type KebabCase<S> = S extends string ? S extends `${infer F}${infer R}` ? R extends Uncapitalize<R> ? `${Lowercase<F>}${KebabCase<R>}` : `${Lowercase<F>}-${KebabCase<Uncapitalize<R>>}` : Lowercase<S> : never;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
export type ExactlyOne<K extends PropertyKey, V> = {
|
|
2
|
-
[P in K]: Partial<Record<Exclude<K, P>, never>> & {
|
|
3
|
-
[Q in P]: V;
|
|
4
|
-
};
|
|
5
|
-
}[K];
|
|
6
|
-
export type WithClassKeys<T> = T & {
|
|
7
|
-
[K in keyof T & string as `${K}Class`]: NonNullable<T[K]> extends string ? KebabCase<T[K]> | undefined : string | undefined;
|
|
8
|
-
};
|
|
9
|
-
export type KebabCase<S> = S extends string ? S extends `${infer F}${infer R}` ? R extends Uncapitalize<R> ? `${Lowercase<F>}${KebabCase<R>}` : `${Lowercase<F>}-${KebabCase<Uncapitalize<R>>}` : Lowercase<S> : never;
|
|
10
1
|
/**
|
|
11
2
|
* Проверяет, что у типа `P` есть хотя бы один ключ из списка `Keys`.
|
|
12
3
|
*
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device suffixes that `useStyles` / `useDevicePropsGenerator` resolve at runtime.
|
|
3
|
+
*/
|
|
4
|
+
export type DeviceBreakpoint = 'Desktop' | 'Mobile' | 'Tablet';
|
|
5
|
+
/**
|
|
6
|
+
* Adds `Mobile` / `Tablet` / `Desktop` variants for keys of `T`, keeping the base keys.
|
|
7
|
+
* Pass responsive props into the wrapper; keep the rest outside.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* type Props = WithDeviceProps<{
|
|
11
|
+
* flow?: string
|
|
12
|
+
* fill?: FillProps
|
|
13
|
+
* }> & {
|
|
14
|
+
* dataTestId?: string // no Mobile/Tablet/Desktop
|
|
15
|
+
* }
|
|
16
|
+
* // flow | flowMobile | flowTablet | flowDesktop | fill | ... | dataTestId
|
|
17
|
+
*/
|
|
18
|
+
export type WithDeviceProps<T> = T & WithDeviceVariants<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Only `Mobile` / `Tablet` / `Desktop` keys — without the base props.
|
|
21
|
+
* Use when the base type comes from elsewhere (e.g. `StyleAttributes`)
|
|
22
|
+
* and device variants use a different token type.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* type Props = StyleAttributes & WithDeviceVariants<{
|
|
26
|
+
* alignSelf?: AlignProps
|
|
27
|
+
* }>
|
|
28
|
+
* // alignSelf from StyleAttributes (CSS)
|
|
29
|
+
* // alignSelfMobile | alignSelfTablet | alignSelfDesktop as AlignProps
|
|
30
|
+
*/
|
|
31
|
+
export type WithDeviceVariants<T> = {
|
|
32
|
+
[K in keyof T & string as `${K}${DeviceBreakpoint}`]?: T[K];
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/ui-core",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.47",
|
|
4
4
|
"description": "UI shared components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Modal",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@emotion/is-prop-valid": "^1.4.0",
|
|
66
66
|
"@itcase/common": "^1.2.47",
|
|
67
|
-
"@itcase/storybook-config": "^1.2.
|
|
67
|
+
"@itcase/storybook-config": "^1.2.79",
|
|
68
68
|
"clsx": "^2.1.1",
|
|
69
69
|
"lodash": "^4.18.1",
|
|
70
70
|
"react": "^18.3.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@babel/core": "^8.0.1",
|
|
77
77
|
"@babel/preset-react": "^8.0.1",
|
|
78
78
|
"@itcase/types-core": "^1.1.74",
|
|
79
|
-
"@itcase/types-ui": "^1.1.
|
|
79
|
+
"@itcase/types-ui": "^1.1.89",
|
|
80
80
|
"@rollup/plugin-alias": "^6.0.0",
|
|
81
81
|
"@rollup/plugin-babel": "^7.1.0",
|
|
82
82
|
"@rollup/plugin-commonjs": "^29.0.3",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
97
97
|
"rollup-preserve-directives": "^1.1.3"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "09306c0d4781521c6c7059638852274291cd06a7"
|
|
100
100
|
}
|