@itcase/ui-core 1.10.78 → 1.10.79

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.
Files changed (97) hide show
  1. package/dist/cjs/context/Notifications/index.js +14 -0
  2. package/dist/cjs/context/{UIContext.js → UIProvider/UIProvider.js} +13 -23
  3. package/dist/cjs/context/UIProvider/index.js +15 -0
  4. package/dist/cjs/context/UIProviderApp/UIProviderApp.js +20 -0
  5. package/dist/cjs/context/UIProviderApp/index.js +11 -0
  6. package/dist/cjs/context/UrlAssetPrefix/index.js +10 -0
  7. package/dist/cjs/context/UserDeviceContext/UserDeviceContext.helpers.js +16 -0
  8. package/dist/cjs/context/UserDeviceContext/UserDeviceContext.js +24 -0
  9. package/dist/cjs/context/UserDeviceContext/index.js +12 -0
  10. package/dist/cjs/context/index.js +5 -18
  11. package/dist/cjs/context/index2.js +26 -0
  12. package/dist/cjs/hoc/index.js +1 -1
  13. package/dist/cjs/hoc/urlWithAssetPrefix.js +1 -1
  14. package/dist/cjs/hooks/index.js +3 -9
  15. package/dist/cjs/hooks/useDevicePropsGenerator/index.js +1 -9
  16. package/dist/cjs/hooks/useDevicePropsGenerator/useDevicePropsGenerator.js +2 -10
  17. package/dist/cjs/hooks/useDeviceTargetClass/index.js +10 -0
  18. package/dist/cjs/hooks/useDeviceTargetClass/useDeviceTargetClass.js +50 -0
  19. package/dist/cjs/hooks/useStyles/index.js +1 -9
  20. package/dist/cjs/hooks/useStyles/useStyles.js +2 -10
  21. package/dist/cjs/hooks/useStylesReactNative/index.js +12 -0
  22. package/dist/cjs/hooks/useStylesReactNative/styleAttributes.js +137 -0
  23. package/dist/cjs/hooks/useStylesReactNative/useStyles.js +59 -0
  24. package/dist/cjs/hooks/useViewportFix/index.js +8 -0
  25. package/dist/cjs/utils/setViewportProperty.js +3 -0
  26. package/dist/context/Notifications/index.js +5 -0
  27. package/dist/context/{UIContext.js → UIProvider/UIProvider.js} +14 -23
  28. package/dist/context/UIProvider/index.js +9 -0
  29. package/dist/context/UIProviderApp/UIProviderApp.js +18 -0
  30. package/dist/context/UIProviderApp/index.js +4 -0
  31. package/dist/context/UrlAssetPrefix/index.js +3 -0
  32. package/dist/context/UserDeviceContext/UserDeviceContext.helpers.js +14 -0
  33. package/dist/context/UserDeviceContext/UserDeviceContext.js +20 -0
  34. package/dist/context/UserDeviceContext/index.js +3 -0
  35. package/dist/context/index.js +3 -10
  36. package/dist/context/index2.js +13 -0
  37. package/dist/hoc/index.js +1 -1
  38. package/dist/hoc/urlWithAssetPrefix.js +1 -1
  39. package/dist/hooks/index.js +3 -9
  40. package/dist/hooks/useDevicePropsGenerator/index.js +1 -9
  41. package/dist/hooks/useDevicePropsGenerator/useDevicePropsGenerator.js +1 -9
  42. package/dist/hooks/useDeviceTargetClass/index.js +4 -0
  43. package/dist/hooks/useDeviceTargetClass/useDeviceTargetClass.js +48 -0
  44. package/dist/hooks/useStyles/index.js +1 -9
  45. package/dist/hooks/useStyles/useStyles.js +1 -9
  46. package/dist/hooks/useStylesReactNative/index.js +5 -0
  47. package/dist/hooks/useStylesReactNative/styleAttributes.js +135 -0
  48. package/dist/hooks/useStylesReactNative/useStyles.js +57 -0
  49. package/dist/hooks/useViewportFix/index.js +2 -0
  50. package/dist/stories/useDevicePropsGenerator.mdx +1 -1
  51. package/dist/types/context/Notifications/index.d.ts +4 -0
  52. package/dist/types/context/UIProvider/UIProvider.d.ts +3 -0
  53. package/dist/types/context/UIProvider/UIProvider.interface.d.ts +7 -0
  54. package/dist/types/context/UIProvider/index.d.ts +4 -0
  55. package/dist/types/context/UIProviderApp/UIProviderApp.d.ts +3 -0
  56. package/dist/types/context/UIProviderApp/UIProviderApp.interface.d.ts +5 -0
  57. package/dist/types/context/UIProviderApp/index.d.ts +6 -0
  58. package/dist/types/context/{UrlAssetPrefix.d.ts → UrlAssetPrefix/UrlAssetPrefix.d.ts} +1 -9
  59. package/dist/types/context/UrlAssetPrefix/UrlAssetPrefix.interface.d.ts +11 -0
  60. package/dist/types/context/UrlAssetPrefix/index.d.ts +4 -0
  61. package/dist/types/context/UserDeviceContext/UserDeviceContext.d.ts +5 -0
  62. package/dist/types/context/UserDeviceContext/UserDeviceContext.helpers.d.ts +3 -0
  63. package/dist/types/context/UserDeviceContext/UserDeviceContext.interface.d.ts +10 -0
  64. package/dist/types/context/UserDeviceContext/index.d.ts +5 -0
  65. package/dist/types/context/index.d.ts +10 -4
  66. package/dist/types/context/index.native.d.ts +4 -0
  67. package/dist/types/hooks/useDeviceTargetClass/index.d.ts +4 -0
  68. package/dist/types/hooks/useDeviceTargetClass/useDeviceTargetClass.d.ts +7 -0
  69. package/dist/types/hooks/useDeviceTargetClass/useDeviceTargetClass.interface.d.ts +9 -0
  70. package/dist/types/hooks/useStylesReactNative/index.d.ts +6 -0
  71. package/dist/types/hooks/useStylesReactNative/styleAttributes.d.ts +30 -0
  72. package/dist/types/hooks/useStylesReactNative/styleAttributes.interface.d.ts +143 -0
  73. package/dist/types/hooks/useStylesReactNative/useStyles.d.ts +6 -0
  74. package/dist/types/hooks/useViewportFix/index.d.ts +2 -0
  75. package/dist/utils/setViewportProperty.js +3 -0
  76. package/package.json +42 -4
  77. package/dist/cjs/context/Notifications.interface.js +0 -2
  78. package/dist/cjs/hooks/useActiveClasses/useActiveClasses.interface.js +0 -65
  79. package/dist/cjs/hooks/useDevicePropsGenerator/useDevicePropsGenerator.interface.js +0 -2
  80. package/dist/cjs/hooks/useDeviceTargetClass.js +0 -64
  81. package/dist/cjs/hooks/useStyles/styleAttributes.interface.js +0 -2
  82. package/dist/context/Notifications.interface.js +0 -1
  83. package/dist/hooks/useActiveClasses/useActiveClasses.interface.js +0 -63
  84. package/dist/hooks/useDevicePropsGenerator/useDevicePropsGenerator.interface.js +0 -1
  85. package/dist/hooks/useDeviceTargetClass.js +0 -62
  86. package/dist/hooks/useStyles/styleAttributes.interface.js +0 -1
  87. package/dist/types/context/UIContext.d.ts +0 -23
  88. package/dist/types/hooks/useDeviceTargetClass.d.ts +0 -6
  89. /package/dist/cjs/context/{Notifications.js → Notifications/Notifications.js} +0 -0
  90. /package/dist/cjs/context/{UrlAssetPrefix.js → UrlAssetPrefix/UrlAssetPrefix.js} +0 -0
  91. /package/dist/cjs/hooks/{useViewportFix.js → useViewportFix/useViewportFix.js} +0 -0
  92. /package/dist/context/{Notifications.js → Notifications/Notifications.js} +0 -0
  93. /package/dist/context/{UrlAssetPrefix.js → UrlAssetPrefix/UrlAssetPrefix.js} +0 -0
  94. /package/dist/hooks/{useViewportFix.js → useViewportFix/useViewportFix.js} +0 -0
  95. /package/dist/types/context/{Notifications.d.ts → Notifications/Notifications.d.ts} +0 -0
  96. /package/dist/types/context/{Notifications.interface.d.ts → Notifications/Notifications.interface.d.ts} +0 -0
  97. /package/dist/types/hooks/{useViewportFix.d.ts → useViewportFix/useViewportFix.d.ts} +0 -0
@@ -0,0 +1,3 @@
1
+ import type { UIProviderProps } from './UIProvider.interface';
2
+ declare const UIProvider: import("react").MemoExoticComponent<(props: UIProviderProps) => import("react").JSX.Element>;
3
+ export { UIProvider };
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { UserDeviceState } from '../UserDeviceContext';
3
+ interface UIProviderProps {
4
+ children?: ReactNode;
5
+ userDeviceState?: Partial<UserDeviceState>;
6
+ }
7
+ export type { UIProviderProps };
@@ -0,0 +1,4 @@
1
+ import { UIProvider } from './UIProvider';
2
+ import type { UIProviderProps } from './UIProvider.interface';
3
+ export { UIProvider };
4
+ export type { UIProviderProps };
@@ -0,0 +1,3 @@
1
+ import type { UIProviderAppProps } from './UIProviderApp.interface';
2
+ declare const UIProviderApp: import("react").MemoExoticComponent<(props: UIProviderAppProps) => import("react").JSX.Element>;
3
+ export { UIProviderApp };
@@ -0,0 +1,5 @@
1
+ import type { ReactNode } from 'react';
2
+ interface UIProviderAppProps {
3
+ children?: ReactNode;
4
+ }
5
+ export type { UIProviderAppProps };
@@ -0,0 +1,6 @@
1
+ import { useUserDeviceContext } from '../UserDeviceContext';
2
+ import type { DeviceType, UserDeviceState } from '../UserDeviceContext';
3
+ import { UIProviderApp } from './UIProviderApp';
4
+ import type { UIProviderAppProps } from './UIProviderApp.interface';
5
+ export { UIProviderApp, useUserDeviceContext };
6
+ export type { DeviceType, UIProviderAppProps, UserDeviceState };
@@ -1,12 +1,4 @@
1
- type UrlAssetPrefixValue = {
2
- assetPrefix?: string;
3
- ignorePathsList?: Array<string | RegExp>;
4
- };
5
- type UrlAssetPrefixProviderProps = {
6
- assetPrefix?: string;
7
- children: React.ReactNode;
8
- ignorePathsList?: Array<string | RegExp>;
9
- };
1
+ import type { UrlAssetPrefixProviderProps, UrlAssetPrefixValue } from './UrlAssetPrefix.interface';
10
2
  declare const UrlAssetPrefixContext: import("react").Context<UrlAssetPrefixValue>;
11
3
  declare function UrlAssetPrefixProvider(props: UrlAssetPrefixProviderProps): import("react").JSX.Element;
12
4
  export { UrlAssetPrefixContext, UrlAssetPrefixProvider };
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ type UrlAssetPrefixValue = {
3
+ assetPrefix?: string;
4
+ ignorePathsList?: Array<string | RegExp>;
5
+ };
6
+ interface UrlAssetPrefixProviderProps {
7
+ assetPrefix?: string;
8
+ children: ReactNode;
9
+ ignorePathsList?: Array<string | RegExp>;
10
+ }
11
+ export type { UrlAssetPrefixProviderProps, UrlAssetPrefixValue };
@@ -0,0 +1,4 @@
1
+ import { UrlAssetPrefixContext, UrlAssetPrefixProvider } from './UrlAssetPrefix';
2
+ import type { UrlAssetPrefixProviderProps, UrlAssetPrefixValue } from './UrlAssetPrefix.interface';
3
+ export { UrlAssetPrefixContext, UrlAssetPrefixProvider };
4
+ export type { UrlAssetPrefixProviderProps, UrlAssetPrefixValue };
@@ -0,0 +1,5 @@
1
+ import type { UserDeviceState } from './UserDeviceContext.interface';
2
+ declare const defaultUserDeviceState: UserDeviceState;
3
+ declare const UserDeviceContext: import("react").Context<UserDeviceState>;
4
+ declare function useUserDeviceContext(): UserDeviceState;
5
+ export { defaultUserDeviceState, UserDeviceContext, useUserDeviceContext };
@@ -0,0 +1,3 @@
1
+ import type { UserDeviceState } from './UserDeviceContext.interface';
2
+ declare function getDeviceMainTypeFromFlags(userDeviceState?: Partial<UserDeviceState>): "" | "desktop" | "mobile" | "tablet";
3
+ export { getDeviceMainTypeFromFlags };
@@ -0,0 +1,10 @@
1
+ type DeviceType = '' | 'desktop' | 'mobile' | 'tablet';
2
+ type UserDeviceState = {
3
+ deviceCurrentMainType: DeviceType;
4
+ deviceCurrentType: string;
5
+ deviceTypesList: string[];
6
+ isDesktop?: boolean;
7
+ isMobile?: boolean;
8
+ isTablet?: boolean;
9
+ };
10
+ export type { DeviceType, UserDeviceState };
@@ -0,0 +1,5 @@
1
+ import { defaultUserDeviceState, UserDeviceContext, useUserDeviceContext } from './UserDeviceContext';
2
+ import { getDeviceMainTypeFromFlags } from './UserDeviceContext.helpers';
3
+ import type { DeviceType, UserDeviceState } from './UserDeviceContext.interface';
4
+ export { defaultUserDeviceState, getDeviceMainTypeFromFlags, UserDeviceContext, useUserDeviceContext, };
5
+ export type { DeviceType, UserDeviceState };
@@ -1,4 +1,10 @@
1
- export * from './Notifications';
2
- export * from './Notifications.interface';
3
- export * from './UIContext';
4
- export * from './UrlAssetPrefix';
1
+ import { NotificationsProvider, statusToAppearanceList, useNotifications, useNotificationsAPI } from './Notifications';
2
+ import type { CreatedNotification, Notification, NotificationAppearance, NotificationsProviderProps } from './Notifications';
3
+ import { UIProvider } from './UIProvider';
4
+ import type { UIProviderProps } from './UIProvider';
5
+ import { UrlAssetPrefixContext, UrlAssetPrefixProvider } from './UrlAssetPrefix';
6
+ import type { UrlAssetPrefixProviderProps, UrlAssetPrefixValue } from './UrlAssetPrefix';
7
+ import { useUserDeviceContext } from './UserDeviceContext';
8
+ import type { DeviceType, UserDeviceState } from './UserDeviceContext';
9
+ export { NotificationsProvider, statusToAppearanceList, UIProvider, UrlAssetPrefixContext, UrlAssetPrefixProvider, useNotifications, useNotificationsAPI, useUserDeviceContext, };
10
+ export type { CreatedNotification, DeviceType, Notification, NotificationAppearance, NotificationsProviderProps, UIProviderProps, UrlAssetPrefixProviderProps, UrlAssetPrefixValue, UserDeviceState, };
@@ -0,0 +1,4 @@
1
+ import { UIProviderApp, useUserDeviceContext } from './UIProviderApp';
2
+ import type { DeviceType, UIProviderAppProps, UserDeviceState } from './UIProviderApp';
3
+ export { UIProviderApp, useUserDeviceContext };
4
+ export type { DeviceType, UIProviderAppProps, UserDeviceState };
@@ -0,0 +1,4 @@
1
+ import { useDeviceTargetClass } from './useDeviceTargetClass';
2
+ import type { UseDeviceTargetClassComponentProps, UseDeviceTargetClassParams } from './useDeviceTargetClass.interface';
3
+ export { useDeviceTargetClass };
4
+ export type { UseDeviceTargetClassComponentProps, UseDeviceTargetClassParams };
@@ -0,0 +1,7 @@
1
+ import type { UseDeviceTargetClassComponentProps, UseDeviceTargetClassParams } from './useDeviceTargetClass.interface';
2
+ /** TODO:
3
+ * Hook is still used in "itcase-forms".
4
+ * Need replace with "useDevicePropsGenerator" and delete this.
5
+ */
6
+ declare function useDeviceTargetClass(componentProps: UseDeviceTargetClassComponentProps, hookProps: UseDeviceTargetClassParams): string;
7
+ export { useDeviceTargetClass };
@@ -0,0 +1,9 @@
1
+ interface UseDeviceTargetClassComponentProps {
2
+ [key: string]: unknown;
3
+ }
4
+ interface UseDeviceTargetClassParams {
5
+ prefix?: string;
6
+ propsKey: string;
7
+ replace?: [RegExp, string];
8
+ }
9
+ export type { UseDeviceTargetClassComponentProps, UseDeviceTargetClassParams };
@@ -0,0 +1,6 @@
1
+ import { styleAttributes } from './styleAttributes';
2
+ import type { StyleAttribute, StyleAttributes } from './styleAttributes.interface';
3
+ import { useStyles } from './useStyles';
4
+ import type { CollectedStyles } from './useStyles';
5
+ export { styleAttributes, useStyles };
6
+ export type { CollectedStyles, StyleAttribute, StyleAttributes };
@@ -0,0 +1,30 @@
1
+ declare const styleAttributes: readonly [
2
+ /**
3
+ * Layout
4
+ */
5
+ 'alignContent', 'alignItems', 'alignSelf', 'aspectRatio', 'border', 'borderBottomWidth', 'borderEndWidth', 'borderLeftWidth', 'borderRightWidth', 'borderStartWidth', 'borderTopWidth', 'borderWidth', 'bottom', 'display', 'end', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'gap', 'rowGap', 'columnGap', 'columnWidth', 'height', 'justifyContent', 'left', 'margin', 'marginBottom', 'marginEnd', 'marginHorizontal', 'marginLeft', 'marginRight', 'marginStart', 'marginTop', 'marginVertical', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'overflow', 'padding', 'paddingBottom', 'paddingEnd', 'paddingHorizontal', 'paddingLeft', 'paddingRight', 'paddingStart', 'paddingTop', 'paddingVertical', 'position', 'right', 'start', 'top', 'width', 'zIndex', 'order',
6
+ /**
7
+ * Shadow
8
+ */
9
+ 'elevation', 'shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius',
10
+ /**
11
+ * Transform
12
+ */
13
+ 'transform',
14
+ /**
15
+ * View
16
+ */
17
+ 'background', 'backgroundColor', 'borderBottomColor', 'borderBottomEndRadius', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomStartRadius', 'borderColor', 'borderCurve', 'borderEndColor', 'borderLeftColor', 'borderRadius', 'borderRightColor', 'borderStartColor', 'borderStyle', 'borderTopColor', 'borderTopEndRadius', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderTopStartRadius', 'opacity', 'cursor',
18
+ /**
19
+ * Text
20
+ */
21
+ 'color', 'fontFamily', 'fontSize', 'fontStyle', 'fontVariant', 'fontWeight', 'letterSpacing', 'lineHeight', 'textAlign', 'textDecorationColor', 'textDecorationLine', 'textDecorationStyle', 'textShadowColor', 'textShadowOffset', 'textShadowRadius', 'textTransform', 'verticalAlign', 'writingMode', 'whiteSpace',
22
+ /**
23
+ * Image
24
+ */
25
+ 'overlayColor', 'resizeMode', 'tintColor', 'objectFit',
26
+ /**
27
+ * Filter
28
+ */
29
+ 'backdropFilter'];
30
+ export { styleAttributes };
@@ -0,0 +1,143 @@
1
+ import type { AlignContentProps, AlignItemsProps, AlignSelfProps, ElevationProps, HeightProps, JustifyContentProps, ResizeModeProps, WidthProps } from '@itcase/types-ui';
2
+ import type { styleAttributes } from './styleAttributes';
3
+ type ColorValue = number | string;
4
+ type DimensionValue = number | string;
5
+ type ShadowOffset = {
6
+ height: number;
7
+ width: number;
8
+ };
9
+ type StyleAttribute = (typeof styleAttributes)[number];
10
+ interface StyleAttributes {
11
+ /**
12
+ * Layout
13
+ */
14
+ alignContent?: AlignContentProps;
15
+ alignItems?: AlignItemsProps;
16
+ alignSelf?: AlignSelfProps;
17
+ aspectRatio?: DimensionValue;
18
+ /**
19
+ * Filter
20
+ */
21
+ backdropFilter?: string;
22
+ /**
23
+ * View
24
+ */
25
+ background?: ColorValue;
26
+ backgroundColor?: ColorValue;
27
+ border?: number;
28
+ borderBottomColor?: ColorValue;
29
+ borderBottomEndRadius?: DimensionValue;
30
+ borderBottomLeftRadius?: DimensionValue;
31
+ borderBottomRightRadius?: DimensionValue;
32
+ borderBottomStartRadius?: DimensionValue;
33
+ borderBottomWidth?: number;
34
+ borderColor?: ColorValue;
35
+ borderCurve?: 'circular' | 'continuous';
36
+ borderEndColor?: ColorValue;
37
+ borderEndWidth?: number;
38
+ borderLeftColor?: ColorValue;
39
+ borderLeftWidth?: number;
40
+ borderRadius?: DimensionValue;
41
+ borderRightColor?: ColorValue;
42
+ borderRightWidth?: number;
43
+ borderStartColor?: ColorValue;
44
+ borderStartWidth?: number;
45
+ borderStyle?: 'dashed' | 'dotted' | 'solid';
46
+ borderTopColor?: ColorValue;
47
+ borderTopEndRadius?: DimensionValue;
48
+ borderTopLeftRadius?: DimensionValue;
49
+ borderTopRightRadius?: DimensionValue;
50
+ borderTopStartRadius?: DimensionValue;
51
+ borderTopWidth?: number;
52
+ borderWidth?: number;
53
+ bottom?: DimensionValue;
54
+ /**
55
+ * Text
56
+ */
57
+ color?: ColorValue;
58
+ columnGap?: number;
59
+ columnWidth?: DimensionValue;
60
+ cursor?: string;
61
+ display?: 'contents' | 'flex' | 'none';
62
+ /**
63
+ * Shadow
64
+ */
65
+ elevation?: number | ElevationProps;
66
+ end?: DimensionValue;
67
+ flex?: number;
68
+ flexBasis?: DimensionValue;
69
+ flexDirection?: 'column' | 'column-reverse' | 'row' | 'row-reverse';
70
+ flexGrow?: number;
71
+ flexShrink?: number;
72
+ flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
73
+ fontFamily?: string;
74
+ fontSize?: number;
75
+ fontStyle?: 'italic' | 'normal';
76
+ fontVariant?: string | string[];
77
+ fontWeight?: number | string;
78
+ gap?: number;
79
+ height?: DimensionValue | HeightProps;
80
+ justifyContent?: JustifyContentProps;
81
+ left?: DimensionValue;
82
+ letterSpacing?: number;
83
+ lineHeight?: number;
84
+ margin?: DimensionValue;
85
+ marginBottom?: DimensionValue;
86
+ marginEnd?: DimensionValue;
87
+ marginHorizontal?: DimensionValue;
88
+ marginLeft?: DimensionValue;
89
+ marginRight?: DimensionValue;
90
+ marginStart?: DimensionValue;
91
+ marginTop?: DimensionValue;
92
+ marginVertical?: DimensionValue;
93
+ maxHeight?: DimensionValue | HeightProps;
94
+ maxWidth?: DimensionValue | WidthProps;
95
+ minHeight?: DimensionValue | HeightProps;
96
+ minWidth?: DimensionValue | WidthProps;
97
+ objectFit?: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
98
+ opacity?: number;
99
+ order?: number;
100
+ overflow?: 'hidden' | 'scroll' | 'visible';
101
+ /**
102
+ * Image
103
+ */
104
+ overlayColor?: ColorValue;
105
+ padding?: DimensionValue;
106
+ paddingBottom?: DimensionValue;
107
+ paddingEnd?: DimensionValue;
108
+ paddingHorizontal?: DimensionValue;
109
+ paddingLeft?: DimensionValue;
110
+ paddingRight?: DimensionValue;
111
+ paddingStart?: DimensionValue;
112
+ paddingTop?: DimensionValue;
113
+ paddingVertical?: DimensionValue;
114
+ position?: 'absolute' | 'relative' | 'static' | 'sticky';
115
+ resizeMode?: ResizeModeProps;
116
+ right?: DimensionValue;
117
+ rowGap?: number;
118
+ shadowColor?: ColorValue;
119
+ shadowOffset?: ShadowOffset;
120
+ shadowOpacity?: number;
121
+ shadowRadius?: number;
122
+ start?: DimensionValue;
123
+ textAlign?: 'auto' | 'center' | 'justify' | 'left' | 'right';
124
+ textDecorationColor?: ColorValue;
125
+ textDecorationLine?: 'line-through' | 'none' | 'underline' | 'underline line-through';
126
+ textDecorationStyle?: 'dashed' | 'dotted' | 'double' | 'solid';
127
+ textShadowColor?: ColorValue;
128
+ textShadowOffset?: ShadowOffset;
129
+ textShadowRadius?: number;
130
+ textTransform?: 'capitalize' | 'lowercase' | 'none' | 'uppercase';
131
+ tintColor?: ColorValue;
132
+ top?: DimensionValue;
133
+ /**
134
+ * Transform
135
+ */
136
+ transform?: string | readonly object[];
137
+ verticalAlign?: 'auto' | 'bottom' | 'middle' | 'top';
138
+ whiteSpace?: string;
139
+ width?: DimensionValue | WidthProps;
140
+ writingMode?: string;
141
+ zIndex?: number;
142
+ }
143
+ export type { StyleAttribute, StyleAttributes };
@@ -0,0 +1,6 @@
1
+ type StyleValue = boolean | number | object | string;
2
+ type StyleMap = Record<string, StyleValue>;
3
+ type CollectedStyles = Record<string, StyleMap>;
4
+ declare function useStyles<Props extends Record<string, unknown>>(props: Props): CollectedStyles;
5
+ export type { CollectedStyles };
6
+ export { useStyles };
@@ -0,0 +1,2 @@
1
+ import { useViewportFix } from './useViewportFix';
2
+ export { useViewportFix };
@@ -1,4 +1,7 @@
1
1
  const setViewportProperty = () => {
2
+ if (typeof document === 'undefined') {
3
+ return;
4
+ }
2
5
  const vh = window.innerHeight * 0.01;
3
6
  document.documentElement.style.setProperty('--vh', `${vh}px`);
4
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/ui-core",
3
- "version": "1.10.78",
3
+ "version": "1.10.79",
4
4
  "description": "UI shared components",
5
5
  "keywords": [
6
6
  "Modal",
@@ -16,6 +16,21 @@
16
16
  "import": "./dist/context/index.js",
17
17
  "require": "./dist/cjs/context/index.js"
18
18
  },
19
+ "./context/*": {
20
+ "types": "./dist/types/context/*/index.d.ts",
21
+ "import": "./dist/context/*/index.js",
22
+ "require": "./dist/cjs/context/*/index.js"
23
+ },
24
+ "./context/UIProvider": {
25
+ "types": "./dist/types/context/UIProvider/index.d.ts",
26
+ "import": "./dist/context/UIProvider/index.js",
27
+ "require": "./dist/cjs/context/UIProvider/index.js"
28
+ },
29
+ "./context/UIProviderApp": {
30
+ "types": "./dist/types/context/UIProviderApp/index.d.ts",
31
+ "import": "./dist/context/UIProviderApp/index.js",
32
+ "require": "./dist/cjs/context/UIProviderApp/index.js"
33
+ },
19
34
  "./hoc": {
20
35
  "types": "./dist/types/hoc/index.d.ts",
21
36
  "import": "./dist/hoc/index.js",
@@ -26,6 +41,21 @@
26
41
  "import": "./dist/hooks/index.js",
27
42
  "require": "./dist/cjs/hooks/index.js"
28
43
  },
44
+ "./hooks/*": {
45
+ "types": "./dist/types/hooks/*/index.d.ts",
46
+ "import": "./dist/hooks/*/index.js",
47
+ "require": "./dist/cjs/hooks/*/index.js"
48
+ },
49
+ "./hooks/useAppearanceConfig": {
50
+ "types": "./dist/types/hooks/useAppearanceConfig/index.d.ts",
51
+ "import": "./dist/hooks/useAppearanceConfig/index.js",
52
+ "require": "./dist/cjs/hooks/useAppearanceConfig/index.js"
53
+ },
54
+ "./hooks/useStylesReactNative": {
55
+ "types": "./dist/types/hooks/useStylesReactNative/index.d.ts",
56
+ "import": "./dist/hooks/useStylesReactNative/index.js",
57
+ "require": "./dist/cjs/hooks/useStylesReactNative/index.js"
58
+ },
29
59
  "./utils": {
30
60
  "types": "./dist/types/utils/index.d.ts",
31
61
  "import": "./dist/utils/index.js",
@@ -65,8 +95,8 @@
65
95
  },
66
96
  "dependencies": {
67
97
  "@emotion/is-prop-valid": "^1.4.0",
68
- "@itcase/common": "^1.2.51",
69
- "@itcase/storybook-config": "^1.3.5",
98
+ "@itcase/common": "^1.2.53",
99
+ "@itcase/storybook-config": "^1.3.8",
70
100
  "clsx": "^2.1.1",
71
101
  "lodash": "^4.18.1",
72
102
  "react": "^18.3.1",
@@ -74,6 +104,14 @@
74
104
  "react-responsive": "^10.0.1",
75
105
  "uuid": "^14.0.1"
76
106
  },
107
+ "peerDependencies": {
108
+ "react-native": "*"
109
+ },
110
+ "peerDependenciesMeta": {
111
+ "react-native": {
112
+ "optional": true
113
+ }
114
+ },
77
115
  "devDependencies": {
78
116
  "@babel/core": "^8.0.1",
79
117
  "@babel/preset-react": "^8.0.1",
@@ -98,5 +136,5 @@
98
136
  "rollup-plugin-peer-deps-external": "^2.2.4",
99
137
  "rollup-preserve-directives": "^1.1.3"
100
138
  },
101
- "gitHead": "6fb79901d97812f894b6d26f71a433e8b2c37dea"
139
+ "gitHead": "2e19f45ceb70f5f4db6498549b2557c764082d52"
102
140
  }
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1,65 +0,0 @@
1
- 'use strict';
2
-
3
- const suffix = [
4
- 'Button',
5
- 'Checkbox',
6
- 'Radio',
7
- 'Checkmark',
8
- 'Avatar',
9
- 'AvatarStack',
10
- 'Badge',
11
- 'Breadcrumbs',
12
- 'Cell',
13
- 'Chips',
14
- 'Choice',
15
- 'Code',
16
- 'CookiesWarning',
17
- 'Dadata',
18
- 'DatePeriod',
19
- 'Divider',
20
- 'Dot',
21
- 'Drawer',
22
- 'Dropdown',
23
- 'DropdownItem',
24
- 'Flex',
25
- 'Grid',
26
- 'Group',
27
- 'HeroTitle',
28
- 'HTMLContent',
29
- 'Icon',
30
- 'Image',
31
- 'Input',
32
- 'InputPassword',
33
- 'Label',
34
- 'Link',
35
- 'List',
36
- 'Loader',
37
- 'Logo',
38
- 'MenuItem',
39
- 'Modal',
40
- 'ModalSheetBottom',
41
- 'Notification',
42
- 'Overlay',
43
- 'Pagination',
44
- 'RangeSlider',
45
- 'Response',
46
- 'ScrollBar',
47
- 'ScrollOnDrag',
48
- 'ScrollToView',
49
- 'Search',
50
- 'Segmented',
51
- 'Select',
52
- 'SvgContent',
53
- 'Swiper',
54
- 'Switch',
55
- 'Tab',
56
- 'Text',
57
- 'Textarea',
58
- 'Tile',
59
- 'Title',
60
- 'Tooltip',
61
- 'Video',
62
- 'Warning',
63
- ];
64
-
65
- exports.suffix = suffix;
@@ -1,64 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var camelCase = require('lodash/camelCase');
5
- var castArray = require('lodash/castArray');
6
- require('../context/Notifications.js');
7
- var UIContext = require('../context/UIContext.js');
8
- require('../context/UrlAssetPrefix.js');
9
- require('react/jsx-runtime');
10
- require('uuid');
11
- require('@itcase/common');
12
- require('./useMediaQueries/useMediaQueries.js');
13
- require('react-responsive');
14
- require('../utils/setViewportProperty.js');
15
-
16
- /** TODO:
17
- * Hook is still used in "itcase-forms".
18
- * Need replace with "useDevicePropsGenerator" and delete this.
19
- */
20
- function useDeviceTargetClass(componentProps, hookProps) {
21
- /** Generate a class depending on the user's device.
22
- *
23
- * Usage:
24
- * const sizeClass = useDeviceTargetClass(props, {
25
- * prefix: 'some-item_size_',
26
- * propsKey: 'size',
27
- * })
28
- * Return: "some-item_size_m" (or "s", or "l", or something else)
29
- *
30
- * "componentProps" - "props" from component
31
- * "hookProps" - special props for generating class
32
- **/
33
- const {
34
- prefix = '',
35
- propsKey,
36
- replace = [/([A-Z])/g, '-$1']
37
- } = hookProps;
38
- const {
39
- isMobile,
40
- isTablet,
41
- isDesktop
42
- } = UIContext.useUserDeviceContext();
43
- const targetClassValue = React.useMemo(() => {
44
- // prettier-ignore
45
- const deviceCurrentMainType = isMobile && 'Mobile' || isTablet && 'Tablet' || isDesktop && 'Desktop' || '';
46
- const valueForDevice = componentProps[`${propsKey}${deviceCurrentMainType}`];
47
- const valueDefault = componentProps[propsKey];
48
- return valueForDevice || valueDefault;
49
- }, [isMobile, isTablet, isDesktop, componentProps, propsKey]);
50
- const targetClass = React.useMemo(() => {
51
- if (targetClassValue) {
52
- let cleanClassValue = camelCase(String(targetClassValue));
53
- if (replace) {
54
- const replaceList = castArray(replace);
55
- cleanClassValue = cleanClassValue.replace(replaceList[0], replaceList[1] || '');
56
- }
57
- return `${prefix}${cleanClassValue}`.toLowerCase();
58
- }
59
- return null;
60
- }, [targetClassValue, prefix, replace]);
61
- return targetClass;
62
- }
63
-
64
- exports.useDeviceTargetClass = useDeviceTargetClass;
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1,63 +0,0 @@
1
- const suffix = [
2
- 'Button',
3
- 'Checkbox',
4
- 'Radio',
5
- 'Checkmark',
6
- 'Avatar',
7
- 'AvatarStack',
8
- 'Badge',
9
- 'Breadcrumbs',
10
- 'Cell',
11
- 'Chips',
12
- 'Choice',
13
- 'Code',
14
- 'CookiesWarning',
15
- 'Dadata',
16
- 'DatePeriod',
17
- 'Divider',
18
- 'Dot',
19
- 'Drawer',
20
- 'Dropdown',
21
- 'DropdownItem',
22
- 'Flex',
23
- 'Grid',
24
- 'Group',
25
- 'HeroTitle',
26
- 'HTMLContent',
27
- 'Icon',
28
- 'Image',
29
- 'Input',
30
- 'InputPassword',
31
- 'Label',
32
- 'Link',
33
- 'List',
34
- 'Loader',
35
- 'Logo',
36
- 'MenuItem',
37
- 'Modal',
38
- 'ModalSheetBottom',
39
- 'Notification',
40
- 'Overlay',
41
- 'Pagination',
42
- 'RangeSlider',
43
- 'Response',
44
- 'ScrollBar',
45
- 'ScrollOnDrag',
46
- 'ScrollToView',
47
- 'Search',
48
- 'Segmented',
49
- 'Select',
50
- 'SvgContent',
51
- 'Swiper',
52
- 'Switch',
53
- 'Tab',
54
- 'Text',
55
- 'Textarea',
56
- 'Tile',
57
- 'Title',
58
- 'Tooltip',
59
- 'Video',
60
- 'Warning',
61
- ];
62
-
63
- export { suffix };