@cyber-harbour/ui 1.0.31 → 1.0.33

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.
@@ -1,5 +1,14 @@
1
1
  import { DefaultTheme } from 'styled-components';
2
- import { Breakpoint, ButtonColor, ButtonSize, ButtonState, ButtonVariant, InputSize, InputState } from './types';
2
+ import {
3
+ Breakpoint,
4
+ ButtonColor,
5
+ ButtonSize,
6
+ ButtonState,
7
+ ButtonVariant,
8
+ InputSize,
9
+ InputState,
10
+ InputVariant,
11
+ } from './types';
3
12
 
4
13
  /**
5
14
  * Helper function to resolve nested color paths from theme
@@ -64,8 +73,9 @@ export const pxToRem = (pxValue: number | string, baseSize: number = 16): string
64
73
  return `${remValue}rem`;
65
74
  };
66
75
 
67
- const IGNORE_CONVERT_KEYS: Record<string, string[]> = {
76
+ const IGNORE_CONVERT_KEYS: Record<string, string[] | boolean> = {
68
77
  contextMenu: ['padding'],
78
+ baseSize: true,
69
79
  };
70
80
 
71
81
  /**
@@ -98,7 +108,10 @@ export const convertPaletteToRem = (
98
108
  key.toLowerCase().includes(prop.toLowerCase())
99
109
  )
100
110
  ) {
101
- if (!(parentKey && IGNORE_CONVERT_KEYS[parentKey]?.includes(key))) {
111
+ if (
112
+ !(parentKey && Array.isArray(IGNORE_CONVERT_KEYS[parentKey]) && IGNORE_CONVERT_KEYS[parentKey].includes(key)) &&
113
+ !IGNORE_CONVERT_KEYS[key]
114
+ ) {
102
115
  result[key] = pxToRem(value, baseSize);
103
116
  } else {
104
117
  result[key] = value; // Keep original value if it's in the ignore list
@@ -130,22 +143,12 @@ export const getButtonSizeStyles = (theme: DefaultTheme, size: ButtonSize) => {
130
143
  return theme.button.sizes[size];
131
144
  };
132
145
 
133
- // /**
134
- // * Функція для отримання стилів інпута за варіантом, станом та розміром
135
- // */
136
- // export const getInputStyles = (
137
- // variant: InputVariant = 'default',
138
- // state: InputState = 'default',
139
- // size: InputSize = 'medium'
140
- // ) => {
141
- // const variantStyles = theme.input[variant][state];
142
- // const sizeStyles = theme.input.sizes[size];
143
-
144
- // return {
145
- // ...variantStyles,
146
- // ...sizeStyles,
147
- // };
148
- // };
146
+ /**
147
+ * Функція для отримання стилів інпута за варіантом та станом
148
+ */
149
+ export const getInputStyles = (theme: DefaultTheme, variant: InputVariant, state: InputState) => {
150
+ return theme.input[variant][state];
151
+ };
149
152
 
150
153
  /**
151
154
  * Функція для отримання типографічних стилів
package/tsup.config.ts CHANGED
@@ -19,8 +19,10 @@ export default defineConfig({
19
19
  platform: 'browser',
20
20
  skipNodeModulesBundle: true,
21
21
  esbuildOptions(options) {
22
- options.drop = ['console', 'debugger'];
23
- options.pure = ['console.log', 'console.info', 'console.debug', 'console.warn'];
22
+ if (process.env.NODE_ENV === 'development') {
23
+ options.drop = ['console', 'debugger'];
24
+ options.pure = ['console.log', 'console.info', 'console.debug', 'console.warn'];
25
+ }
24
26
  },
25
27
  shims: true,
26
28
  keepNames: true,