gantri-components 2.208.0 → 2.210.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.
Files changed (30) hide show
  1. package/dist/components/banner/banner.d.ts +3 -0
  2. package/dist/components/banner/banner.styles.d.ts +16 -0
  3. package/dist/components/banner/banner.types.d.ts +29 -0
  4. package/dist/components/banner/index.d.ts +2 -0
  5. package/dist/components/button/button.styles.d.ts +3 -1
  6. package/dist/components/checkbox/checkbox.styles.d.ts +6 -4
  7. package/dist/components/icon/generated/ui-control/Phone.d.ts +3 -0
  8. package/dist/components/icon/generated/ui-control/Phone24.d.ts +3 -0
  9. package/dist/components/icon/generated/ui-control/index.d.ts +2 -0
  10. package/dist/components/icon/icon.type.d.ts +1 -1
  11. package/dist/components/index.d.ts +3 -0
  12. package/dist/components/label/index.d.ts +2 -0
  13. package/dist/components/label/label.d.ts +3 -0
  14. package/dist/components/label/label.styles.d.ts +3 -0
  15. package/dist/components/label/label.types.d.ts +19 -0
  16. package/dist/components/option-selector/index.d.ts +2 -0
  17. package/dist/components/option-selector/option-selector.d.ts +6 -0
  18. package/dist/components/option-selector/option-selector.presets.d.ts +2 -0
  19. package/dist/components/option-selector/option-selector.styles.d.ts +5 -0
  20. package/dist/components/option-selector/option-selector.types.d.ts +68 -0
  21. package/dist/components/radio/radio.styles.d.ts +10 -7
  22. package/dist/components/toggle/toggle.styles.styles.d.ts +5 -3
  23. package/dist/index.cjs.js +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.esm.js +1 -1
  26. package/dist/index.umd.js +1 -1
  27. package/dist/styles/index.d.ts +2 -1
  28. package/dist/styles/theme-style.d.ts +36 -0
  29. package/dist/styles/theme.d.ts +11 -0
  30. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
- export { getButtonsColors, getThemeColor, getThemeSpacing, palette, spacing, lightTheme, darkTheme, createTheme, } from './theme';
1
+ export { getButtonsColors, getThemeColor, getThemeSpacing, palette, spacing, lightTheme, darkTheme, modernLightTheme, modernDarkTheme, createTheme, } from './theme';
2
+ export { themeStyle } from './theme-style';
2
3
  export { type PaletteColor as Color } from './theme';
3
4
  export { ThemeProvider } from './theme-provider';
4
5
  export * from './animations';
@@ -0,0 +1,36 @@
1
+ import { DefaultTheme } from 'styled-components';
2
+ type ThemeStyleValue<P = Record<string, unknown>> = any | ((props: P & {
3
+ theme: DefaultTheme;
4
+ }) => any);
5
+ type ThemeStyleMap<P = Record<string, unknown>> = Record<string, ThemeStyleValue<P>>;
6
+ /**
7
+ * Resolves CSS blocks by theme with automatic fallback.
8
+ *
9
+ * Resolution order: walks `theme.fallbacks` array and returns the first match.
10
+ * Typical fallback chain: [theme.id, theme.name] → 'default'.
11
+ *
12
+ * Values can be static css blocks or functions that receive the component's props.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // Static css blocks
17
+ * const StyledCard = styled.div`
18
+ * ${themeStyle({
19
+ * light: css`background: white;`,
20
+ * 'modern-dark': css`background: rgba(38, 38, 38, 0.4);`,
21
+ * })}
22
+ * `;
23
+ *
24
+ * // Functions that receive component props
25
+ * const StyledInput = styled.div<{ $size: string }>`
26
+ * ${themeStyle<{ $size: string }>({
27
+ * 'modern-dark': ({ $size }) => getModernDarkInput($size),
28
+ * 'modern-light': ({ $size }) => getModernLightInput($size),
29
+ * })}
30
+ * `;
31
+ * ```
32
+ */
33
+ export declare const themeStyle: <P = Record<string, unknown>>(styles: ThemeStyleMap<P>) => (props: P & {
34
+ theme: DefaultTheme;
35
+ }) => any;
36
+ export {};
@@ -165,6 +165,7 @@ declare module 'styled-components' {
165
165
  x: string;
166
166
  };
167
167
  };
168
+ fallbacks: string[];
168
169
  fonts: {
169
170
  boldFontFamily: string;
170
171
  boldFontWeight?: Property.FontWeight;
@@ -194,6 +195,7 @@ declare module 'styled-components' {
194
195
  regularFontWeight?: Property.FontWeight;
195
196
  useCssVariablesForFontFamily?: boolean;
196
197
  };
198
+ id: string;
197
199
  name: 'dark' | 'light';
198
200
  transitions: {
199
201
  base: string;
@@ -222,6 +224,8 @@ export interface ProductColorDetails {
222
224
  export declare const productColorsMap: Record<ProductColorCode, ProductColorDetails>;
223
225
  export declare const lightTheme: DefaultTheme;
224
226
  export declare const darkTheme: DefaultTheme;
227
+ export declare const modernLightTheme: DefaultTheme;
228
+ export declare const modernDarkTheme: DefaultTheme;
225
229
  export declare const getThemeColor: (color: PaletteColor, currentTheme?: DefaultTheme) => string;
226
230
  export declare const getThemeProductColor: (color: ProductColorCode, currentTheme?: DefaultTheme) => string;
227
231
  export declare const getThemeSpacing: (property: BoxDimension | string, currentTheme?: DefaultTheme) => string;
@@ -275,7 +279,14 @@ export declare const getButtonsColors: (variant: ButtonVariant, theme?: DefaultT
275
279
  borderProcessing?: undefined;
276
280
  };
277
281
  export declare const createTheme: (config: {
282
+ /** Base theme to extend from. Accepts 'light', 'dark', or any registered theme id. */
283
+ base?: string;
278
284
  defaults?: Partial<DefaultTheme['defaults']>;
285
+ /** Fallback chain for themeStyle resolution. Defaults to [id, base name]. */
286
+ fallbacks?: string[];
287
+ /** Unique theme identifier. */
288
+ id?: string;
289
+ /** @deprecated Use `base` instead. Kept for backward compatibility. */
279
290
  theme: 'light' | 'dark';
280
291
  typography?: Partial<Omit<DefaultTheme['fonts'], 'useCssVariablesForFontFamily'>>;
281
292
  }) => DefaultTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantri-components",
3
- "version": "2.208.0",
3
+ "version": "2.210.0",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "umd": "dist/index.umd.js",