@kwantis-id3/frontend-library 0.20.0 → 0.20.1

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 (35) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +333 -333
  3. package/changelog.md +118 -0
  4. package/dist/esm/index.js +240 -0
  5. package/dist/esm/index.js.map +1 -0
  6. package/dist/esm/types/components/Accordion/Accordion.d.ts +22 -0
  7. package/dist/esm/types/components/Accordion/AccordionStyled.d.ts +24 -0
  8. package/dist/esm/types/components/Accordion/index.d.ts +1 -0
  9. package/dist/esm/types/components/Button/Button.d.ts +18 -0
  10. package/dist/esm/types/components/Button/index.d.ts +1 -0
  11. package/dist/esm/types/components/Dropdown/Dropdown.d.ts +19 -0
  12. package/dist/esm/types/components/Dropdown/DropdownStyled.d.ts +50 -0
  13. package/dist/esm/types/components/Dropdown/index.d.ts +1 -0
  14. package/dist/esm/types/components/InputField/InputField.d.ts +22 -0
  15. package/dist/esm/types/components/InputField/StyledInputField.d.ts +12 -0
  16. package/dist/esm/types/components/InputField/index.d.ts +1 -0
  17. package/dist/esm/types/components/Modal/Modal.d.ts +9 -0
  18. package/dist/esm/types/components/Modal/StyledModal.d.ts +9 -0
  19. package/dist/esm/types/components/Modal/index.d.ts +2 -0
  20. package/dist/esm/types/components/SelectFilter/MultiSelect.d.ts +24 -0
  21. package/dist/esm/types/components/SelectFilter/SingleSelect.d.ts +25 -0
  22. package/dist/esm/types/components/SelectFilter/index.d.ts +2 -0
  23. package/dist/esm/types/components/Slider/Slider.d.ts +20 -0
  24. package/dist/esm/types/components/Slider/SliderStyled.d.ts +25 -0
  25. package/dist/esm/types/components/Slider/index.d.ts +1 -0
  26. package/dist/esm/types/components/ThemeContext/ThemeContext.d.ts +78 -0
  27. package/dist/esm/types/components/ThemeContext/index.d.ts +1 -0
  28. package/dist/esm/types/components/index.d.ts +8 -0
  29. package/dist/esm/types/index.d.ts +2 -0
  30. package/dist/esm/types/utils/index.d.ts +4 -0
  31. package/dist/esm/types/utils/isMobile.d.ts +7 -0
  32. package/dist/esm/types/utils/styled.d.ts +40 -0
  33. package/dist/esm/types/utils/transientOptions.d.ts +2 -0
  34. package/dist/index.d.ts +231 -0
  35. package/package.json +45 -12
@@ -0,0 +1,231 @@
1
+ /// <reference types="react" />
2
+ import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
3
+ import * as React$1 from 'react';
4
+ import React__default from 'react';
5
+ import { Interpolation, CreateStyled as CreateStyled$1, CreateStyledComponent, FilteringStyledOptions, StyledOptions } from '@emotion/styled';
6
+ import { Theme, PropsOf } from '@emotion/react';
7
+
8
+ interface Color {
9
+ main: string;
10
+ contrastText: string;
11
+ }
12
+ interface ThemeColorsObject {
13
+ primary: Color;
14
+ secondary: Color;
15
+ tertiary: Color;
16
+ statusOk: Color;
17
+ statusWarning: Color;
18
+ statusCritical: Color;
19
+ statusNeutral: Color;
20
+ }
21
+ type ThemeContextProps = {
22
+ colors: ThemeColorsObject;
23
+ };
24
+ interface Nothing {
25
+ }
26
+ type Union<T, U> = T | (U & Nothing);
27
+ type ThemeColors = keyof ThemeColorsObject;
28
+ type ThemeColorsExtended = Union<ThemeColors, string>;
29
+ type ThemeProperties = {
30
+ colors: ThemeColorsObject;
31
+ /**
32
+ *
33
+ * @param color one of the theme keys, a path to a specific color in the theme, OR a string representing a color (hex, rgb, hsl, etc)
34
+ * @returns a valid color object. If color is not valid, will return the primary color.
35
+ */
36
+ getColor: (color: ThemeColorsExtended) => Color;
37
+ };
38
+ declare const ThemeContextProvider: (props: React__default.PropsWithChildren<{
39
+ theme?: ThemeContextProps;
40
+ }>) => JSX.Element;
41
+ declare const useThemeContext: () => ThemeProperties;
42
+
43
+ type ButtonVariants = "contained" | "outlined" | "text";
44
+ type ButtonProps = {
45
+ color?: ThemeColorsExtended;
46
+ type?: "button" | "submit" | "reset";
47
+ sx?: Interpolation<Theme>;
48
+ variant?: ButtonVariants;
49
+ onClick?: () => void;
50
+ className?: string;
51
+ htmlId?: string;
52
+ disabled?: boolean;
53
+ children?: React$1.ReactNode;
54
+ };
55
+ declare const Button: (props: ButtonProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
56
+
57
+ type AccordionProps = {
58
+ title: string;
59
+ children: React__default.ReactNode;
60
+ customTrigger?: React__default.ReactNode;
61
+ color?: ThemeColorsExtended;
62
+ iconColor?: ThemeColorsExtended;
63
+ dividerColor?: ThemeColorsExtended;
64
+ hideIcon?: boolean;
65
+ hideDivider?: boolean;
66
+ isOpen?: boolean;
67
+ isLazy?: boolean;
68
+ onClick?: () => void;
69
+ onOpen?: () => void;
70
+ onClose?: () => void;
71
+ sx?: Interpolation<Theme>;
72
+ };
73
+ declare const Accordion: (props: AccordionProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
74
+
75
+ type TInputType = "text" | "number" | "password" | "email" | "image" | "search" | "tel" | "url" | "date" | "datetime-local" | "month" | "week" | "time" | "color";
76
+ interface TextFieldProps {
77
+ value?: string | number;
78
+ name?: string;
79
+ onChange?: (value: string) => void;
80
+ placeholder?: string;
81
+ htmlId?: string;
82
+ containerClassName?: string;
83
+ className?: string;
84
+ isDisabled?: boolean;
85
+ color?: ThemeColorsExtended;
86
+ required?: boolean;
87
+ pattern?: string;
88
+ readonly?: boolean;
89
+ autoFocus?: boolean;
90
+ list?: string;
91
+ type?: TInputType;
92
+ }
93
+ declare const InputField: (props: TextFieldProps) => JSX.Element;
94
+
95
+ interface SingleSelectProps<Option = {
96
+ label: string;
97
+ value: string;
98
+ }> {
99
+ options: Option[];
100
+ onChange?: (option: Option | null) => void;
101
+ value?: Option | null;
102
+ name?: string;
103
+ placeholder?: string;
104
+ isDisabled?: boolean;
105
+ isClearable?: boolean;
106
+ isSearchable?: boolean;
107
+ isOptionDisabled?: (option: Option) => boolean;
108
+ isLoading?: boolean;
109
+ color?: ThemeColorsExtended;
110
+ containerId?: string;
111
+ htmlId?: string;
112
+ className?: string;
113
+ inputClassName?: string;
114
+ menuPosition?: "fixed" | "absolute";
115
+ required?: boolean;
116
+ }
117
+ declare const SingleSelect: <Option>(props: SingleSelectProps<Option>) => JSX.Element;
118
+
119
+ interface MultiSelectProps<Option = {
120
+ label: string;
121
+ value: string;
122
+ }> {
123
+ options: Option[];
124
+ onChange?: (option: Option[] | null) => void;
125
+ value?: readonly Option[] | null;
126
+ name?: string;
127
+ placeholder?: string;
128
+ isDisabled?: boolean;
129
+ isClearable?: boolean;
130
+ isSearchable?: boolean;
131
+ isOptionDisabled?: (option: Option) => boolean;
132
+ isLoading?: boolean;
133
+ color?: ThemeColorsExtended;
134
+ containerId?: string;
135
+ htmlId?: string;
136
+ className?: string;
137
+ menuPosition?: "fixed" | "absolute";
138
+ required?: boolean;
139
+ }
140
+ declare const MultiSelect: <Option>(props: MultiSelectProps<Option>) => JSX.Element;
141
+
142
+ type SliderProps = {
143
+ values: number[];
144
+ min?: number;
145
+ max?: number;
146
+ onChange: (values: number[]) => void;
147
+ onFinalChange?: (values: number[]) => void;
148
+ color?: ThemeColorsExtended;
149
+ unselectedColor?: ThemeColorsExtended;
150
+ thumbColor?: ThemeColorsExtended;
151
+ htmlId?: string;
152
+ className?: string;
153
+ showThumbValue?: boolean;
154
+ autoCalculateMinMax?: boolean;
155
+ step?: number;
156
+ disabled?: boolean;
157
+ allowOverlap?: boolean;
158
+ };
159
+ declare const Slider: (props: SliderProps) => JSX.Element;
160
+
161
+ type DropdownItem = {
162
+ value: string;
163
+ color?: ThemeColorsExtended;
164
+ textColor?: string;
165
+ children?: DropdownItem[];
166
+ onClick?: () => void;
167
+ };
168
+ type DropdownProps = {
169
+ content: DropdownItem[];
170
+ trigger: React__default.ReactNode;
171
+ color?: ThemeColorsExtended;
172
+ hoverColor?: ThemeColorsExtended;
173
+ direction?: "left" | "right";
174
+ mobileBreakpoint?: number;
175
+ };
176
+ declare const Dropdown: (props: DropdownProps) => JSX.Element;
177
+
178
+ interface ModalProps {
179
+ children: React__default.ReactNode;
180
+ isOpen: boolean;
181
+ setIsOpen: (isOpen: boolean) => void;
182
+ onClose?: () => void;
183
+ }
184
+ declare const Modal: React__default.FC<ModalProps>;
185
+
186
+ /**
187
+ * Hook to check if the screen is mobile. The default breakpoint is 768px.
188
+ * @param {number=} mobileBreakpoint breakpoint width to check against
189
+ * @returns boolean
190
+ */
191
+ declare const useIsMobile: (mobileBreakpoint?: number) => boolean;
192
+
193
+ declare const transientOptions: Parameters<CreateStyled$1>[1];
194
+
195
+ type StyledTags = {
196
+ [Tag in keyof JSX.IntrinsicElements]: CreateStyledComponent<{
197
+ theme?: ThemeContextProps;
198
+ as?: React.ElementType;
199
+ }, JSX.IntrinsicElements[Tag]>;
200
+ };
201
+ interface BaseCreateStyled {
202
+ <C extends React.ComponentClass<React.ComponentProps<C>>, ForwardedProps extends keyof React.ComponentProps<C> & string = keyof React.ComponentProps<C> & string>(component: C, options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps>): CreateStyledComponent<Pick<PropsOf<C>, ForwardedProps> & {
203
+ theme?: ThemeContextProps;
204
+ }, {}, {
205
+ ref?: React.Ref<InstanceType<C>>;
206
+ }>;
207
+ <C extends React.ComponentClass<React.ComponentProps<C>>>(component: C, options?: StyledOptions<React.ComponentProps<C>>): CreateStyledComponent<PropsOf<C> & {
208
+ theme?: ThemeContextProps;
209
+ }, {}, {
210
+ ref?: React.Ref<InstanceType<C>>;
211
+ }>;
212
+ <C extends React.ComponentType<React.ComponentProps<C>>, ForwardedProps extends keyof React.ComponentProps<C> & string = keyof React.ComponentProps<C> & string>(component: C, options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps>): CreateStyledComponent<Pick<PropsOf<C>, ForwardedProps> & {
213
+ theme?: ThemeContextProps;
214
+ }>;
215
+ <C extends React.ComponentType<React.ComponentProps<C>>>(component: C, options?: StyledOptions<React.ComponentProps<C>>): CreateStyledComponent<PropsOf<C> & {
216
+ theme?: ThemeContextProps;
217
+ }>;
218
+ <Tag extends keyof JSX.IntrinsicElements, ForwardedProps extends keyof JSX.IntrinsicElements[Tag] & string = keyof JSX.IntrinsicElements[Tag] & string>(tag: Tag, options: FilteringStyledOptions<JSX.IntrinsicElements[Tag], ForwardedProps>): CreateStyledComponent<{
219
+ theme?: ThemeContextProps;
220
+ as?: React.ElementType;
221
+ }, Pick<JSX.IntrinsicElements[Tag], ForwardedProps>>;
222
+ <Tag extends keyof JSX.IntrinsicElements>(tag: Tag, options?: StyledOptions<JSX.IntrinsicElements[Tag]>): CreateStyledComponent<{
223
+ theme?: ThemeContextProps;
224
+ as?: React.ElementType;
225
+ }, JSX.IntrinsicElements[Tag]>;
226
+ }
227
+ interface CreateStyled extends BaseCreateStyled, StyledTags {
228
+ }
229
+ declare const styled: CreateStyled;
230
+
231
+ export { Accordion, AccordionProps, Button, ButtonProps, Dropdown, DropdownItem, DropdownProps, InputField, Modal, MultiSelect, MultiSelectProps, SingleSelect, SingleSelectProps, Slider, SliderProps, TInputType, ThemeColors, ThemeColorsObject, ThemeContextProps, ThemeContextProvider, styled, transientOptions, useIsMobile, useThemeContext };
package/package.json CHANGED
@@ -1,7 +1,39 @@
1
1
  {
2
2
  "name": "@kwantis-id3/frontend-library",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "Kwantis frontend components collection",
5
+ "scriptsComments": {
6
+ "storybook": "Starts storybook in development mode",
7
+ "rollup": "Bundles the library",
8
+ "test": "Runs tests",
9
+ "test:watch": "Runs tests in watch mode",
10
+ "test:coverage": "Runs tests in watch mode and generates coverage report",
11
+ "chromatic": "Runs chromatic tests and deploys to chromatic",
12
+ "build-cleanup": "Removes dist folder (if present)",
13
+ "build": "Removes dist folder and bundles the library",
14
+ "bump:patch": "Bumps the version to the next patch",
15
+ "bump:minor": "Bumps the version to the next minor",
16
+ "bump:major": "Bumps the version to the next major",
17
+ "bump:prepatch": "Bumps the version to the next prepatch",
18
+ "bump:preminor": "Bumps the version to the next preminor",
19
+ "bump:premajor": "Bumps the version to the next premajor"
20
+ },
21
+ "scripts": {
22
+ "storybook": "storybook dev -p 6006",
23
+ "rollup": "rollup -c",
24
+ "test": "vitest run",
25
+ "test:watch": "vitest",
26
+ "test:coverage": "vitest --coverage",
27
+ "chromatic": "npx chromatic --project-token=3dd812d03e4c",
28
+ "build-cleanup": "if exist dist rmdir /s /q dist",
29
+ "build": "pnpm clean-build && pnpm rollup",
30
+ "bump:patch": "pnpm version patch",
31
+ "bump:minor": "pnpm version minor",
32
+ "bump:major": "pnpm version major",
33
+ "bump:prepatch": "pnpm version prepatch --preid=rc",
34
+ "bump:preminor": "pnpm version preminor --preid=rc",
35
+ "bump:premajor": "pnpm version premajor --preid=rc"
36
+ },
5
37
  "author": {
6
38
  "name": "kwantis"
7
39
  },
@@ -66,15 +98,16 @@
66
98
  "tinycolor2": "^1.6.0"
67
99
  },
68
100
  "readme": "ERROR: No README data found!",
69
- "scripts": {
70
- "rollup": "rollup -c",
71
- "test": "vitest --coverage",
72
- "storybook": "storybook dev -p 6006",
73
- "build-storybook": "storybook build",
74
- "chromatic": "npx chromatic --project-token=3dd812d03e4c",
75
- "clean-deps": "rmdir /s /q node_modules",
76
- "reinstall-deps": "pnpm clean-deps && pnpm install",
77
- "clean-build": "rmdir /s /q dist",
78
- "build": "pnpm clean-build && pnpm rollup"
101
+ "pnpm": {
102
+ "overrides": {
103
+ "@adobe/css-tools@<4.3.1": ">=4.3.1",
104
+ "postcss@<8.4.31": ">=8.4.31",
105
+ "semver@<5.7.2": ">=5.7.2",
106
+ "semver@>=6.0.0 <6.3.1": ">=6.3.1",
107
+ "semver@>=7.0.0 <7.5.2": ">=7.5.2",
108
+ "tough-cookie@<4.1.3": ">=4.1.3",
109
+ "word-wrap@<1.2.4": ">=1.2.4",
110
+ "@babel/traverse@<7.23.2": ">=7.23.2"
111
+ }
79
112
  }
80
- }
113
+ }