@gobolt/genesis 0.3.21 → 0.3.22

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 (60) hide show
  1. package/dist/Table/Table.d.ts +51 -0
  2. package/dist/Table/Table.js +14 -0
  3. package/dist/Table/TableControls/CustomPagination.d.ts +13 -0
  4. package/dist/Table/TableControls/CustomPagination.js +158 -0
  5. package/dist/Table/TableControls/PaginationNumber.d.ts +7 -0
  6. package/dist/Table/TableControls/PaginationNumber.js +30 -0
  7. package/dist/Table/styles.d.ts +14 -0
  8. package/dist/Table/styles.js +64 -0
  9. package/dist/Table/useTable.d.ts +26 -0
  10. package/dist/Table/useTable.js +141 -0
  11. package/dist/Typography/Typography.d.ts +17 -0
  12. package/dist/Typography/Typography.js +16 -0
  13. package/dist/Typography/index.d.ts +2 -0
  14. package/dist/Typography/index.js +1 -0
  15. package/dist/Typography/styles.d.ts +3 -0
  16. package/dist/Typography/styles.js +54 -0
  17. package/dist/components/Badge/Badge.js +9 -32
  18. package/dist/components/Badge/styles.d.ts +1 -10
  19. package/dist/components/Badge/styles.js +39 -14
  20. package/dist/components/Button/Button.js +4 -27
  21. package/dist/components/Button/IconButton.js +4 -27
  22. package/dist/components/Button/icon-button-styles.d.ts +1 -12
  23. package/dist/components/Button/icon-button-styles.js +69 -16
  24. package/dist/components/Button/styles.d.ts +1 -16
  25. package/dist/components/Button/styles.js +88 -30
  26. package/dist/components/Input/Input.js +6 -29
  27. package/dist/components/Input/styles.d.ts +1 -18
  28. package/dist/components/Input/styles.js +146 -42
  29. package/dist/components/Select/Select.js +101 -125
  30. package/dist/components/Select/SelectTrigger.js +71 -57
  31. package/dist/components/Table/Table.js +8 -27
  32. package/dist/components/Table/TableControls/CustomPagination.js +50 -66
  33. package/dist/components/Table/TableControls/PaginationNumber.js +27 -43
  34. package/dist/components/Table/TableControls/PrimaryTableControlsRow.js +16 -17
  35. package/dist/components/Table/TableControls/SecondaryTableControlsRow.js +14 -36
  36. package/dist/components/Table/TableControls/TableControls.js +3 -4
  37. package/dist/components/Table/TablePagination.js +4 -21
  38. package/dist/components/Table/__mocks__/table-mocks.js +15 -24
  39. package/dist/components/Table/styles.d.ts +1 -15
  40. package/dist/components/Table/styles.js +57 -13
  41. package/dist/components/Table/useTable.js +69 -166
  42. package/dist/components/TableWithControls/TableWithControls.js +6 -7
  43. package/dist/components/TableWithControls/useTableWithControls.js +82 -63
  44. package/dist/components/Tooltip/Tooltip.js +1 -2
  45. package/dist/components/Tooltip/styles.d.ts +1 -14
  46. package/dist/components/Tooltip/styles.js +23 -14
  47. package/dist/components/Typography/Typography.js +6 -29
  48. package/dist/components/Typography/styles.d.ts +3 -21
  49. package/dist/components/Typography/styles.js +41 -24
  50. package/dist/components/UtilityButton/UtilityButton.js +4 -27
  51. package/dist/components/shared/DropdownChevron.js +3 -14
  52. package/dist/constants/index.js +14 -14
  53. package/dist/genesis-theme.types.d.ts +263 -0
  54. package/dist/genesis-theme.types.js +6 -0
  55. package/dist/index.js +89 -0
  56. package/dist/styled.d.ts +1 -0
  57. package/dist/styled.js +44 -0
  58. package/dist/utils/icon-util.d.ts +2 -2
  59. package/dist/utils/icon-util.js +16 -19
  60. package/package.json +1 -1
@@ -0,0 +1,263 @@
1
+ export declare enum BreakpointLabel {
2
+ Narrow = "narrow",
3
+ Medium = "medium",
4
+ Wide = "wide"
5
+ }
6
+ export type Breakpoints = {
7
+ [key in BreakpointLabel]: number;
8
+ };
9
+ export type Sizing = {
10
+ Size1: number;
11
+ Size2: number;
12
+ Size3: number;
13
+ Size4: number;
14
+ Size5: number;
15
+ Size6: number;
16
+ Size7: number;
17
+ Size8: number;
18
+ Size10: number;
19
+ Size12: number;
20
+ Size13: number;
21
+ Size14: number;
22
+ Size16: number;
23
+ Size18: number;
24
+ Size20: number;
25
+ Size24: number;
26
+ Size27: number;
27
+ Size28: number;
28
+ Size30: number;
29
+ Size32: number;
30
+ Size34: number;
31
+ Size35: number;
32
+ Size39: number;
33
+ Size43: number;
34
+ Size50: number;
35
+ Size64: number;
36
+ Size05: number;
37
+ Size15: number;
38
+ Size025: number;
39
+ Size25: number;
40
+ };
41
+ type BorderRadius = {
42
+ BorderRadiusNone: number;
43
+ BorderRadiusXs: number;
44
+ BorderRadiusSm: number;
45
+ BorderRadiusMd: number;
46
+ BorderRadiusLg: number;
47
+ BorderRadiusXl: number;
48
+ BorderRadiusXxl: number;
49
+ BorderRadiusXxxl: number;
50
+ BorderRadiusRounded: number;
51
+ };
52
+ type FontStyle = {
53
+ fontSize: string;
54
+ lineHeight: string;
55
+ fontWeight: number;
56
+ };
57
+ export type TypographySize = {
58
+ display1: FontStyle;
59
+ display2: FontStyle;
60
+ display3: FontStyle;
61
+ heading1: FontStyle;
62
+ heading2: FontStyle;
63
+ heading3: FontStyle;
64
+ subHeading1: FontStyle;
65
+ subHeading2: FontStyle;
66
+ subHeading3: FontStyle;
67
+ body1: FontStyle;
68
+ body2: FontStyle;
69
+ body3: FontStyle;
70
+ body4: FontStyle;
71
+ body5: FontStyle;
72
+ message: FontStyle;
73
+ overline: FontStyle;
74
+ label: FontStyle;
75
+ link1: FontStyle;
76
+ link2: FontStyle;
77
+ link3: FontStyle;
78
+ digits1: FontStyle;
79
+ digits2: FontStyle;
80
+ digits3: FontStyle;
81
+ };
82
+ export type Typography = {
83
+ wide: TypographySize;
84
+ medium: TypographySize;
85
+ narrow: TypographySize;
86
+ fontFamily: string;
87
+ lineHeight: string;
88
+ body1: FontStyle;
89
+ body2: FontStyle;
90
+ };
91
+ export type ColorShades = {
92
+ 100?: string;
93
+ 200?: string;
94
+ 300?: string;
95
+ 400?: string;
96
+ 500?: string;
97
+ 600?: string;
98
+ 700?: string;
99
+ 800?: string;
100
+ 900?: string;
101
+ black?: string;
102
+ white?: string;
103
+ };
104
+ type ColorLayer = {
105
+ textColor: string;
106
+ backgroundColor: string;
107
+ borderColor: string;
108
+ ringColor?: string;
109
+ active: ColorShades;
110
+ checked?: string;
111
+ default?: string;
112
+ border?: string;
113
+ onsurface: string;
114
+ generic?: string;
115
+ disabled?: string;
116
+ surface?: string;
117
+ hover?: string;
118
+ pressed?: string;
119
+ focus?: string;
120
+ info?: string;
121
+ success?: string;
122
+ error?: string;
123
+ empty?: string;
124
+ };
125
+ type ColorState = {
126
+ active: ColorLayer;
127
+ hover: ColorLayer;
128
+ pressed: ColorLayer;
129
+ focussed: ColorLayer;
130
+ disabled: ColorLayer;
131
+ link: ColorLayer;
132
+ surface: ColorLayer;
133
+ success: ColorLayer;
134
+ error: ColorLayer;
135
+ onsurface: ColorLayer;
136
+ warning: ColorLayer;
137
+ generic?: ColorLayer;
138
+ hollow?: ColorLayer;
139
+ info?: ColorLayer;
140
+ utility?: ColorLayer;
141
+ icon?: ColorLayer;
142
+ default?: ColorLayer;
143
+ selected?: ColorLayer;
144
+ border?: ColorLayer;
145
+ tertiary?: string;
146
+ copy?: string;
147
+ "copy-dark"?: string;
148
+ "border-light"?: string;
149
+ primary?: string;
150
+ progress?: ColorLayer;
151
+ };
152
+ export type ColorMode = {
153
+ primary: ColorState;
154
+ secondary: ColorState;
155
+ tertiary: ColorState;
156
+ destructive: ColorState;
157
+ success: ColorState;
158
+ warning: ColorState;
159
+ danger: ColorState;
160
+ info: ColorState;
161
+ onsurface: ColorState;
162
+ surface: ColorState;
163
+ inputs: ColorState;
164
+ interactive: ColorState;
165
+ status: ColorState;
166
+ brandon: ColorState;
167
+ };
168
+ export type ColorModes = {
169
+ light: ColorMode;
170
+ dark: ColorMode;
171
+ };
172
+ export type ColorGroup = "red" | "orange" | "yellow" | "green" | "blue" | "purple" | "sky" | "gray";
173
+ type AllColors = {
174
+ red: ColorShades;
175
+ orange: ColorShades;
176
+ yellow: ColorShades;
177
+ green: ColorShades;
178
+ blue: ColorShades;
179
+ purple: ColorShades;
180
+ sky: ColorShades;
181
+ gray: ColorShades;
182
+ };
183
+ type Mode = "light" | "dark";
184
+ type Button = {
185
+ padding: {
186
+ verPadding: number;
187
+ horPadding: number;
188
+ };
189
+ gap: number;
190
+ radius: number;
191
+ };
192
+ type Input = {
193
+ suffixPrefixHorPadding: number;
194
+ suffixPrefixVerPadding: number;
195
+ };
196
+ type Badge = {
197
+ "ver-padding": number;
198
+ "left-padding": number;
199
+ "right-padding": number;
200
+ radius: number;
201
+ };
202
+ type CommonContainer = {
203
+ "ver-padding": number;
204
+ "hor-padding": number;
205
+ radius: number;
206
+ gap: number;
207
+ };
208
+ type Popover = CommonContainer;
209
+ type Row = CommonContainer;
210
+ type TableCell = {
211
+ surface: string;
212
+ hover: string;
213
+ pressed: string;
214
+ };
215
+ export type Components = {
216
+ button: Button;
217
+ utilityButton: Button;
218
+ iconButton: Button;
219
+ input: Input;
220
+ row: Row;
221
+ badge: Badge;
222
+ popover: Popover;
223
+ tableCell: TableCell;
224
+ };
225
+ type Motion = {
226
+ instant: string;
227
+ veryfast: string;
228
+ fast: string;
229
+ medium: string;
230
+ slow: string;
231
+ };
232
+ type Shadows = {
233
+ general: {
234
+ "1": string;
235
+ "2": string;
236
+ "3": string;
237
+ };
238
+ actions: {
239
+ "1": string;
240
+ "2": string;
241
+ };
242
+ inputs: {
243
+ "1": string;
244
+ };
245
+ };
246
+ interface ConvenienceFunctions {
247
+ getStatusColor: (colors: ColorMode, status: string) => string;
248
+ }
249
+ export interface BaseTokens extends ConvenienceFunctions {
250
+ breakpoints: Breakpoints;
251
+ sizing: Sizing;
252
+ borderRadius: BorderRadius;
253
+ typography: Typography;
254
+ allColors: AllColors;
255
+ components: Components;
256
+ motion: Motion;
257
+ shadows: Shadows;
258
+ }
259
+ export interface GenesisTheme extends BaseTokens {
260
+ colors: ColorMode;
261
+ mode: Mode;
262
+ }
263
+ export {};
@@ -0,0 +1,6 @@
1
+ export var BreakpointLabel;
2
+ (function (BreakpointLabel) {
3
+ BreakpointLabel["Narrow"] = "narrow";
4
+ BreakpointLabel["Medium"] = "medium";
5
+ BreakpointLabel["Wide"] = "wide";
6
+ })(BreakpointLabel || (BreakpointLabel = {}));
package/dist/index.js ADDED
@@ -0,0 +1,89 @@
1
+ export const TYPE = {
2
+ primary: "primary",
3
+ secondary: "secondary",
4
+ tertiary: "tertiary",
5
+ destructive: "destructive",
6
+ utility: "utility",
7
+ icon: "icon",
8
+ };
9
+ export const BREAKPOINTS = {
10
+ wide: "wide",
11
+ medium: "medium",
12
+ narrow: "narrow",
13
+ };
14
+ export const STATE = {
15
+ active: "active",
16
+ hover: "hover",
17
+ pressed: "pressed",
18
+ focussed: "focus",
19
+ disabled: "disabled",
20
+ error: "error",
21
+ success: "success",
22
+ warning: "warning",
23
+ progress: "progress",
24
+ info: "info",
25
+ filled: "filled",
26
+ generic: "generic",
27
+ removed: "removed",
28
+ hollow: "hollow",
29
+ };
30
+ export const TYPOGRAPHY_VARIANT = {
31
+ display1: "display1",
32
+ display2: "display2",
33
+ display3: "display3",
34
+ heading1: "heading1",
35
+ heading2: "heading2",
36
+ heading3: "heading3",
37
+ subHeading1: "subHeading1",
38
+ subHeading2: "subHeading2",
39
+ subHeading3: "subHeading3",
40
+ body1: "body1",
41
+ body2: "body2",
42
+ body3: "body3",
43
+ body4: "body4",
44
+ body5: "body5",
45
+ message: "message",
46
+ overline1: "overline1",
47
+ overline2: "overline2",
48
+ overline3: "overline3",
49
+ label1: "label1",
50
+ label2: "label2",
51
+ label3: "label3",
52
+ link1: "link1",
53
+ link2: "link2",
54
+ link3: "link3",
55
+ digits1: "digits1",
56
+ digits2: "digits2",
57
+ digits3: "digits3",
58
+ };
59
+ export const BUTTON_VARIANT = {
60
+ primary: "primary",
61
+ secondary: "secondary",
62
+ tertiary: "tertiary",
63
+ };
64
+ export const SIZE = {
65
+ small: "small",
66
+ medium: "medium",
67
+ large: "large",
68
+ standard: "standard",
69
+ };
70
+ export const BADGE = {
71
+ appointment: "appointment",
72
+ asn: "asn",
73
+ inventory: "inventory",
74
+ parcel: "parcel",
75
+ product: "product",
76
+ route: "route",
77
+ shipment: "shipment",
78
+ shoppingCart: "shopping cart",
79
+ system: "system",
80
+ };
81
+ export default {
82
+ TYPE,
83
+ BREAKPOINTS,
84
+ STATE,
85
+ TYPOGRAPHY_VARIANT,
86
+ BUTTON_VARIANT,
87
+ SIZE,
88
+ BADGE,
89
+ };
@@ -0,0 +1 @@
1
+ export { default, createGlobalStyle, useTheme, ThemeProvider, css, } from "styled-components";
package/dist/styled.js ADDED
@@ -0,0 +1,44 @@
1
+ /*
2
+ Warning: this was a failed attempt to create a universal styled-components library.
3
+ When importing styled-components into a non React Native app, it will throw an error!
4
+
5
+ Even when React Native was setup as an optional peer dependency; it's not actually working.
6
+ Now it's seems like a better idea to create a separate Genesis package for React Native styled-components which is basically only the theme provider.
7
+ */
8
+ /*
9
+ import * as styledComponents from "styled-components";
10
+
11
+ // Platform detection
12
+ const isReactNative =
13
+ typeof navigator !== "undefined" && navigator.product === "ReactNative";
14
+
15
+ // Set up platform-specific styled
16
+ let platformStyled;
17
+ if (isReactNative) {
18
+ try {
19
+ platformStyled = require("styled-components/native");
20
+ } catch (e) {
21
+ console.warn(
22
+ "Failed to load styled-components/native, falling back to web"
23
+ );
24
+ platformStyled = styledComponents;
25
+ }
26
+ } else {
27
+ platformStyled = styledComponents;
28
+ }
29
+
30
+ // Export named exports
31
+ export const styled = platformStyled.default;
32
+ export const ThemeProvider = platformStyled.ThemeProvider;
33
+ export const useTheme = platformStyled.useTheme;
34
+ export const css = platformStyled.css;
35
+
36
+ // Add createGlobalStyle (web only)
37
+ export const createGlobalStyle = isReactNative
38
+ ? () => null
39
+ : styledComponents.createGlobalStyle;
40
+
41
+ // Export default too for backwards compatibility
42
+ export default styled;
43
+ */
44
+ export { default, createGlobalStyle, useTheme, ThemeProvider, css, } from "styled-components";
@@ -1,3 +1,3 @@
1
- export declare const getIcon: (name: string) => import("react/jsx-runtime").JSX.Element | null;
1
+ export declare const getIcon: (name: string) => import("react/jsx-runtime").JSX.Element;
2
2
  export declare const getIconColor: (state: any, theme: any) => any;
3
- export declare const getBadgeStateIcon: (state: any, color: any, isFilled?: boolean, hasIcon?: boolean, customIcon?: null) => import("react/jsx-runtime").JSX.Element | null;
3
+ export declare const getBadgeStateIcon: (state: any, color: any, isFilled?: boolean, hasIcon?: boolean, customIcon?: any) => any;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { STATE } from "@gobolt/genesis/constants";
3
- var iconSize = 18;
3
+ const iconSize = 18;
4
4
  // check circle filled & outline
5
5
  import { FaCircleCheck } from "react-icons/fa6";
6
6
  import { HiOutlineCheckCircle } from "react-icons/hi";
@@ -21,7 +21,7 @@ import { HiOutlineClock } from "react-icons/hi";
21
21
  import { HiOutlineGlobe } from "react-icons/hi";
22
22
  import { TbFiles } from "react-icons/tb";
23
23
  import { LuTag } from "react-icons/lu";
24
- export var getIcon = function (name) {
24
+ export const getIcon = (name) => {
25
25
  switch (name.toLowerCase()) {
26
26
  case "orders": {
27
27
  return _jsx(LuTag, {});
@@ -37,7 +37,7 @@ export var getIcon = function (name) {
37
37
  }
38
38
  }
39
39
  };
40
- export var getIconColor = function (state, theme) {
40
+ export const getIconColor = (state, theme) => {
41
41
  switch (state) {
42
42
  case STATE.error: {
43
43
  return theme.colors.status.error.onsurface;
@@ -60,10 +60,7 @@ export var getIconColor = function (state, theme) {
60
60
  }
61
61
  }
62
62
  };
63
- export var getBadgeStateIcon = function (state, color, isFilled, hasIcon, customIcon) {
64
- if (isFilled === void 0) { isFilled = true; }
65
- if (hasIcon === void 0) { hasIcon = true; }
66
- if (customIcon === void 0) { customIcon = null; }
63
+ export const getBadgeStateIcon = (state, color, isFilled = true, hasIcon = true, customIcon = null) => {
67
64
  if (!state || !hasIcon) {
68
65
  return null;
69
66
  }
@@ -74,46 +71,46 @@ export var getBadgeStateIcon = function (state, color, isFilled, hasIcon, custom
74
71
  switch (state) {
75
72
  // isFilled is false
76
73
  case STATE.warning: {
77
- return _jsx(HiOutlineExclamationCircle, { size: iconSize, style: { color: color } });
74
+ return _jsx(HiOutlineExclamationCircle, { size: iconSize, style: { color } });
78
75
  }
79
76
  case STATE.error: {
80
- return _jsx(HiOutlineXCircle, { size: iconSize, style: { color: color } });
77
+ return _jsx(HiOutlineXCircle, { size: iconSize, style: { color } });
81
78
  }
82
79
  case STATE.success: {
83
- return _jsx(HiOutlineCheckCircle, { size: iconSize, style: { color: color } });
80
+ return _jsx(HiOutlineCheckCircle, { size: iconSize, style: { color } });
84
81
  }
85
82
  case STATE.progress: {
86
- return _jsx(HiOutlineClock, { size: iconSize, style: { color: color } });
83
+ return _jsx(HiOutlineClock, { size: iconSize, style: { color } });
87
84
  }
88
85
  case STATE.removed: {
89
- return _jsx(HiOutlineMinusCircle, { size: iconSize, style: { color: color } });
86
+ return _jsx(HiOutlineMinusCircle, { size: iconSize, style: { color } });
90
87
  }
91
88
  case STATE.info:
92
89
  default: {
93
- return _jsx(PiInfo, { size: iconSize, style: { color: color } });
90
+ return _jsx(PiInfo, { size: iconSize, style: { color } });
94
91
  }
95
92
  }
96
93
  }
97
94
  switch (state) {
98
95
  // isFilled is true
99
96
  case STATE.warning: {
100
- return _jsx(HiExclamationCircle, { size: iconSize, style: { color: color } });
97
+ return _jsx(HiExclamationCircle, { size: iconSize, style: { color } });
101
98
  }
102
99
  case STATE.error: {
103
- return _jsx(HiXCircle, { size: iconSize, style: { color: color } });
100
+ return _jsx(HiXCircle, { size: iconSize, style: { color } });
104
101
  }
105
102
  case STATE.success: {
106
- return _jsx(FaCircleCheck, { size: iconSize, style: { color: color } });
103
+ return _jsx(FaCircleCheck, { size: iconSize, style: { color } });
107
104
  }
108
105
  case STATE.progress: {
109
- return _jsx(HiClock, { size: iconSize, style: { color: color } });
106
+ return _jsx(HiClock, { size: iconSize, style: { color } });
110
107
  }
111
108
  case STATE.removed: {
112
- return _jsx(HiMinusCircle, { size: iconSize, style: { color: color } });
109
+ return _jsx(HiMinusCircle, { size: iconSize, style: { color } });
113
110
  }
114
111
  case STATE.info:
115
112
  default: {
116
- return _jsx(PiInfoFill, { size: iconSize, style: { color: color } });
113
+ return _jsx(PiInfoFill, { size: iconSize, style: { color } });
117
114
  }
118
115
  }
119
116
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobolt/genesis",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "description": "genesis design system",
5
5
  "author": "gobolt",
6
6
  "license": "MIT",