gd-design-library 1.2.0 → 1.3.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 (48) hide show
  1. package/ai/schemas/components/Image.d.ts +8 -0
  2. package/ai/schemas/components/Menu.d.ts +5 -0
  3. package/ai/schemas/components/Switch.d.ts +5 -5
  4. package/components/core/Form/Form.stories.play.d.ts +4 -0
  5. package/components/core/Image/Image.d.ts +4 -0
  6. package/components/core/Image/Image.js +26 -24
  7. package/components/core/Image/Image.types.d.ts +10 -3
  8. package/components/core/Image/ImageStyled.js +39 -37
  9. package/components/core/InputFile/InputFile.d.ts +4 -0
  10. package/components/core/Menu/Menu.js +74 -66
  11. package/components/core/Menu/Menu.types.d.ts +5 -1
  12. package/components/core/Menu/constants.d.ts +0 -8
  13. package/components/core/Switch/Switch.js +35 -35
  14. package/components/core/Switch/Switch.types.d.ts +4 -4
  15. package/components/domainSpecific/Accordion/Accordion.d.ts +1 -1
  16. package/components/domainSpecific/Accordion/Accordion.js +38 -29
  17. package/components/domainSpecific/Accordion/Accordion.types.d.ts +4 -0
  18. package/components/domainSpecific/Accordion/AccordionHeader/AccordionHeader.js +17 -16
  19. package/components/domainSpecific/Accordion/AccordionItem/AccordionItem.d.ts +1 -1
  20. package/components/domainSpecific/Accordion/AccordionItem/AccordionItem.js +14 -14
  21. package/components/domainSpecific/Accordion/AccordionStyled.js +25 -22
  22. package/components/domainSpecific/Accordion/constants.js +6 -5
  23. package/components/domainSpecific/Card/Card.stories.play.d.ts +4 -0
  24. package/components/domainSpecific/ChatBubble/ChatBubbleStyled.js +11 -11
  25. package/components/domainSpecific/Header/Header.stories.play.d.ts +9 -0
  26. package/components/domainSpecific/SearchModal/SearchModal.stories.play.d.ts +2 -0
  27. package/components/widget/DragAndDrop/DragAndDrop.stories.play.d.ts +6 -0
  28. package/hooks/useMediaQuery/useMediaQuery.d.ts +3 -0
  29. package/hooks/useMediaQuery/useMediaQuery.js +9 -7
  30. package/hooks/useTheme/NoOpTheme.d.ts +27 -5
  31. package/llms.txt +6 -3
  32. package/package.json +1 -1
  33. package/tokens/accordion.d.ts +17 -4
  34. package/tokens/accordion.js +19 -6
  35. package/tokens/chatbubble.d.ts +2 -1
  36. package/tokens/chatbubble.js +4 -3
  37. package/tokens/defaultTheme.d.ts +27 -5
  38. package/tokens/index.d.ts +10 -1
  39. package/tokens/menu.d.ts +7 -0
  40. package/tokens/menu.js +12 -5
  41. package/tokens/select.d.ts +1 -0
  42. package/tokens/select.js +6 -5
  43. package/utils/play/formUtils.d.ts +27 -0
  44. package/utils/play/imageUtils.d.ts +12 -0
  45. package/utils/play/index.d.ts +5 -0
  46. package/utils/play/mockUtils.d.ts +29 -0
  47. package/utils/play/modalUtils.d.ts +26 -0
  48. package/utils/play/waitUtils.d.ts +47 -0
@@ -12,9 +12,15 @@ const o = {
12
12
  display: "flex",
13
13
  alignItems: "center",
14
14
  justifyContent: "space-between",
15
+ gap: (e) => n(e, "spacing.md", "theme.spacing.md"),
15
16
  ":first-of-type": {
16
17
  flex: "1"
17
18
  }
19
+ },
20
+ inline: {
21
+ width: "auto",
22
+ display: "inline-flex",
23
+ justifyContent: "start"
18
24
  }
19
25
  },
20
26
  content: {
@@ -44,16 +50,23 @@ const o = {
44
50
  left: (e) => n(e, "spacing.none", "theme.spacing.none"),
45
51
  right: (e) => n(e, "spacing.none", "theme.spacing.none"),
46
52
  height: "1px",
47
- width: "100%",
48
53
  backgroundColor: (e) => n(e, "colors.border.default", "theme.colors.border.default")
49
54
  }
50
- }
51
- },
52
- itemNoSeparator: {
53
- default: {
55
+ },
56
+ noSeparator: {
54
57
  position: "relative",
55
58
  padding: (e) => n(e, "spacing.none", "theme.spacing.none")
56
- }
59
+ },
60
+ inline: {
61
+ width: "auto",
62
+ display: "inline-flex",
63
+ flexWrap: "wrap",
64
+ flexDirection: "column"
65
+ },
66
+ opened: {
67
+ width: "100%"
68
+ },
69
+ closed: {}
57
70
  },
58
71
  icon: {
59
72
  default: {
@@ -55,10 +55,11 @@ export declare const chatbubble: {
55
55
  flexDirection: FlexDirection;
56
56
  };
57
57
  loader: {
58
- props: {
58
+ attrs: {
59
59
  name: string;
60
60
  size: string;
61
61
  withWrapper: boolean;
62
+ rounded: (theme: Record<symbol, unknown>) => string;
62
63
  };
63
64
  };
64
65
  };
@@ -1,6 +1,6 @@
1
1
  import { display as s, flexAlignItems as o } from "./display.js";
2
- import { FlexDirection as a } from "../types/layout.js";
3
2
  import { get as t } from "../utils/helpers.js";
3
+ import { FlexDirection as a } from "../types/layout.js";
4
4
  import { TypographyVariant as n } from "../types/typography.js";
5
5
  const g = {
6
6
  default: {
@@ -64,10 +64,11 @@ const g = {
64
64
  flexDirection: a.Row
65
65
  },
66
66
  loader: {
67
- props: {
67
+ attrs: {
68
68
  name: "dots",
69
69
  size: "xs",
70
- withWrapper: !1
70
+ withWrapper: !1,
71
+ rounded: (e) => t(e, "radius.round", "theme.spacing.sm")
71
72
  }
72
73
  }
73
74
  };
@@ -288,10 +288,11 @@ export declare const defaultTheme: {
288
288
  flexDirection: import('../types').FlexDirection;
289
289
  };
290
290
  loader: {
291
- props: {
291
+ attrs: {
292
292
  name: string;
293
293
  size: string;
294
294
  withWrapper: boolean;
295
+ rounded: (theme: Record<symbol, unknown>) => string;
295
296
  };
296
297
  };
297
298
  };
@@ -2426,6 +2427,7 @@ export declare const defaultTheme: {
2426
2427
  dropdown: {
2427
2428
  position: string;
2428
2429
  textAlign: string;
2430
+ color: (theme: Record<symbol, unknown>) => string;
2429
2431
  background: (theme: Record<symbol, unknown>) => string;
2430
2432
  boxShadow: (theme: Record<symbol, unknown>) => string;
2431
2433
  fontFamily: (theme: Record<symbol, unknown>) => string;
@@ -3203,11 +3205,18 @@ export declare const defaultTheme: {
3203
3205
  content: {
3204
3206
  default: {
3205
3207
  backgroundColor: (theme: Record<symbol, unknown>) => string;
3208
+ zIndex: (theme: Record<symbol, unknown>) => string;
3206
3209
  position: string;
3207
3210
  overflow: string;
3208
3211
  boxShadow: (theme: Record<symbol, unknown>) => string;
3209
3212
  };
3210
3213
  };
3214
+ attrs: {
3215
+ minHeight: number;
3216
+ maxHeight: number;
3217
+ offsetX: number;
3218
+ offsetY: number;
3219
+ };
3211
3220
  };
3212
3221
  price: {
3213
3222
  default: {
@@ -3419,10 +3428,16 @@ export declare const defaultTheme: {
3419
3428
  display: string;
3420
3429
  alignItems: string;
3421
3430
  justifyContent: string;
3431
+ gap: (theme: Record<symbol, unknown>) => string;
3422
3432
  ':first-of-type': {
3423
3433
  flex: string;
3424
3434
  };
3425
3435
  };
3436
+ inline: {
3437
+ width: string;
3438
+ display: string;
3439
+ justifyContent: string;
3440
+ };
3426
3441
  };
3427
3442
  content: {
3428
3443
  default: {
@@ -3451,16 +3466,23 @@ export declare const defaultTheme: {
3451
3466
  left: (theme: Record<symbol, unknown>) => string;
3452
3467
  right: (theme: Record<symbol, unknown>) => string;
3453
3468
  height: string;
3454
- width: string;
3455
3469
  backgroundColor: (theme: Record<symbol, unknown>) => string;
3456
3470
  };
3457
3471
  };
3458
- };
3459
- itemNoSeparator: {
3460
- default: {
3472
+ noSeparator: {
3461
3473
  position: string;
3462
3474
  padding: (theme: Record<symbol, unknown>) => string;
3463
3475
  };
3476
+ inline: {
3477
+ width: string;
3478
+ display: string;
3479
+ flexWrap: string;
3480
+ flexDirection: string;
3481
+ };
3482
+ opened: {
3483
+ width: string;
3484
+ };
3485
+ closed: {};
3464
3486
  };
3465
3487
  icon: {
3466
3488
  default: {
package/tokens/index.d.ts CHANGED
@@ -484,10 +484,11 @@ export declare const defaultTokens: {
484
484
  flexDirection: import('../types').FlexDirection;
485
485
  };
486
486
  loader: {
487
- props: {
487
+ attrs: {
488
488
  name: string;
489
489
  size: string;
490
490
  withWrapper: boolean;
491
+ rounded: (theme: Record<symbol, unknown>) => string;
491
492
  };
492
493
  };
493
494
  };
@@ -2734,6 +2735,7 @@ export declare const defaultTokens: {
2734
2735
  dropdown: {
2735
2736
  position: string;
2736
2737
  textAlign: string;
2738
+ color: (theme: Record<symbol, unknown>) => string;
2737
2739
  background: (theme: Record<symbol, unknown>) => string;
2738
2740
  boxShadow: (theme: Record<symbol, unknown>) => string;
2739
2741
  fontFamily: (theme: Record<symbol, unknown>) => string;
@@ -3574,11 +3576,18 @@ export declare const defaultTokens: {
3574
3576
  content: {
3575
3577
  default: {
3576
3578
  backgroundColor: (theme: Record<symbol, unknown>) => string;
3579
+ zIndex: (theme: Record<symbol, unknown>) => string;
3577
3580
  position: string;
3578
3581
  overflow: string;
3579
3582
  boxShadow: (theme: Record<symbol, unknown>) => string;
3580
3583
  };
3581
3584
  };
3585
+ attrs: {
3586
+ minHeight: number;
3587
+ maxHeight: number;
3588
+ offsetX: number;
3589
+ offsetY: number;
3590
+ };
3582
3591
  };
3583
3592
  spacing: {
3584
3593
  none: number;
package/tokens/menu.d.ts CHANGED
@@ -5,9 +5,16 @@ export declare const menu: {
5
5
  content: {
6
6
  default: {
7
7
  backgroundColor: (theme: Record<symbol, unknown>) => string;
8
+ zIndex: (theme: Record<symbol, unknown>) => string;
8
9
  position: string;
9
10
  overflow: string;
10
11
  boxShadow: (theme: Record<symbol, unknown>) => string;
11
12
  };
12
13
  };
14
+ attrs: {
15
+ minHeight: number;
16
+ maxHeight: number;
17
+ offsetX: number;
18
+ offsetY: number;
19
+ };
13
20
  };
package/tokens/menu.js CHANGED
@@ -1,17 +1,24 @@
1
- import { get as e } from "../utils/helpers.js";
2
- const r = {
1
+ import { get as o } from "../utils/helpers.js";
2
+ const h = {
3
3
  wrapper: {
4
4
  default: {}
5
5
  },
6
6
  content: {
7
7
  default: {
8
- backgroundColor: (o) => e(o, "colors.neutral.white", "theme.colors.neutral.white"),
8
+ backgroundColor: (e) => o(e, "colors.neutral.white", "theme.colors.neutral.white"),
9
+ zIndex: (e) => o(e, "zIndex.high", "theme.zIndex.high"),
9
10
  position: "absolute",
10
11
  overflow: "auto",
11
- boxShadow: (o) => e(o, 'shadows.box["1"]', 'theme.shadows.box["1"]')
12
+ boxShadow: (e) => o(e, 'shadows.box["1"]', 'theme.shadows.box["1"]')
12
13
  }
14
+ },
15
+ attrs: {
16
+ minHeight: 80,
17
+ maxHeight: 400,
18
+ offsetX: 4,
19
+ offsetY: 4
13
20
  }
14
21
  };
15
22
  export {
16
- r as menu
23
+ h as menu
17
24
  };
@@ -18,6 +18,7 @@ export declare const select: {
18
18
  dropdown: {
19
19
  position: string;
20
20
  textAlign: string;
21
+ color: (theme: Record<symbol, unknown>) => string;
21
22
  background: (theme: Record<symbol, unknown>) => string;
22
23
  boxShadow: (theme: Record<symbol, unknown>) => string;
23
24
  fontFamily: (theme: Record<symbol, unknown>) => string;
package/tokens/select.js CHANGED
@@ -4,8 +4,8 @@ import { flexAlignItems as t, display as r } from "./display.js";
4
4
  import { get as o } from "../utils/helpers.js";
5
5
  import { FlexDirection as f } from "../types/layout.js";
6
6
  import { Cursors as n } from "../types/cursors.js";
7
- import { ButtonVariant as p } from "../types/button.js";
8
- import { TextAlign as m, TypographyVariant as i } from "../types/typography.js";
7
+ import { ButtonVariant as c } from "../types/button.js";
8
+ import { TextAlign as p, TypographyVariant as i } from "../types/typography.js";
9
9
  var a, l;
10
10
  const v = {
11
11
  default: {
@@ -26,6 +26,7 @@ const v = {
26
26
  dropdown: {
27
27
  position: "absolute",
28
28
  textAlign: "left",
29
+ color: (e) => o(e, "colors.text.default", "theme.colors.text.default"),
29
30
  background: (e) => o(e, "colors.bg.surface", "theme.colors.bg.surface"),
30
31
  boxShadow: (e) => o(e, 'shadows.box["3"]', 'theme.shadows.box["3"]'),
31
32
  fontFamily: (e) => o(e, "font.family", "theme.font.family"),
@@ -49,13 +50,13 @@ const v = {
49
50
  flexDirection: "row",
50
51
  justifyContent: "space-between",
51
52
  alignItems: (l = t) == null ? void 0 : l.center,
52
- textAlign: m.Left,
53
+ textAlign: p.Left,
53
54
  ".gd-button__content": {
54
55
  justifyContent: t.start
55
56
  }
56
57
  },
57
58
  attrs: {
58
- variant: p.Inherit
59
+ variant: c.Inherit
59
60
  }
60
61
  },
61
62
  item: {
@@ -88,7 +89,7 @@ const v = {
88
89
  icons: {
89
90
  arrowIcon: {
90
91
  name: "arrowDown",
91
- fill: 'neutral["grey.90"]',
92
+ fill: "icon.default",
92
93
  width: 18,
93
94
  height: 18
94
95
  }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Fill an input field (clear + type)
3
+ * @param input - The input element to fill
4
+ * @param value - The value to type
5
+ */
6
+ export declare function fillInput(input: HTMLElement, value: string): Promise<void>;
7
+ /**
8
+ * Type into an input with optional delay between keystrokes
9
+ * @param input - The input element
10
+ * @param value - The value to type
11
+ * @param delay - Delay in ms between keystrokes (default: 0)
12
+ */
13
+ export declare function typeIntoInput(input: HTMLElement, value: string, delay?: number): Promise<void>;
14
+ /**
15
+ * Clear an input field
16
+ * @param input - The input element to clear
17
+ */
18
+ export declare function clearInput(input: HTMLElement): Promise<void>;
19
+ /**
20
+ * Click a checkbox or radio button
21
+ * @param input - The checkbox/radio element
22
+ */
23
+ export declare function clickInput(input: HTMLElement): Promise<void>;
24
+ /**
25
+ * Tab to next element
26
+ */
27
+ export declare function tabToNext(): Promise<void>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Wait for an image to load
3
+ * @param imageGetter - Function that returns the image element
4
+ * @param timeout - Maximum time to wait in milliseconds (default: 3000ms)
5
+ */
6
+ export declare function waitForImageLoad(imageGetter: () => HTMLElement, timeout?: number): Promise<void>;
7
+ /**
8
+ * Wait for image to be visible
9
+ * @param imageGetter - Function that returns the image element
10
+ * @param timeout - Maximum time to wait in milliseconds (default: 3000ms)
11
+ */
12
+ export declare function waitForImageToBeVisible(imageGetter: () => HTMLElement, timeout?: number): Promise<void>;
@@ -0,0 +1,5 @@
1
+ export * from './formUtils';
2
+ export * from './modalUtils';
3
+ export * from './mockUtils';
4
+ export * from './waitUtils';
5
+ export * from './imageUtils';
@@ -0,0 +1,29 @@
1
+ interface MockFunction {
2
+ mock: {
3
+ calls: Array<any[]>;
4
+ results: Array<{
5
+ value: any;
6
+ }>;
7
+ };
8
+ }
9
+ /**
10
+ * Get the arguments from the last call to a mock function
11
+ * @param mockFn - The mock function
12
+ * @returns The arguments array from the last call, or undefined if no calls
13
+ */
14
+ export declare function getLastCallArgs(mockFn: MockFunction): any;
15
+ /**
16
+ * Get the result (return value) from a specific call to a mock function
17
+ * @param mockFn - The mock function
18
+ * @param callIndex - Index of the call (0-based)
19
+ * @returns The return value from that call, or undefined
20
+ */
21
+ export declare function getMockCallResult(mockFn: MockFunction, callIndex: number): any;
22
+ /**
23
+ * Get the arguments from a specific call to a mock function
24
+ * @param mockFn - The mock function
25
+ * @param callIndex - Index of the call (0-based)
26
+ * @returns The arguments array from the specified call, or undefined if call doesn't exist
27
+ */
28
+ export declare function getMockCallArgs(mockFn: MockFunction, callIndex: number): any;
29
+ export {};
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Open a modal by clicking the trigger and waiting for it to appear
3
+ * @param triggerGetter - Function that returns the trigger button element
4
+ * @param modalGetter - Function that returns the modal element
5
+ * @param timeout - Maximum time to wait in milliseconds (default: 1000ms)
6
+ */
7
+ export declare function openModal(triggerGetter: () => HTMLElement, modalGetter: () => HTMLElement, timeout?: number): Promise<void>;
8
+ /**
9
+ * Close a modal by clicking the close button and waiting for it to disappear
10
+ * @param closeButtonGetter - Function that returns the close button element
11
+ * @param queryModalGetter - Function that returns the modal element or null (use query variant)
12
+ * @param timeout - Maximum time to wait in milliseconds (default: 2000ms)
13
+ */
14
+ export declare function closeModal(closeButtonGetter: () => HTMLElement, queryModalGetter: () => HTMLElement | null, timeout?: number): Promise<void>;
15
+ /**
16
+ * Close a modal by pressing the Escape key and waiting for it to disappear
17
+ * @param queryModalGetter - Function that returns the modal element or null (use query variant)
18
+ * @param timeout - Maximum time to wait in milliseconds (default: 1000ms)
19
+ */
20
+ export declare function closeModalWithEscape(queryModalGetter: () => HTMLElement | null, timeout?: number): Promise<void>;
21
+ /**
22
+ * Wait for modal to be visible (checks both existence and visibility)
23
+ * @param modalGetter - Function that returns the modal element
24
+ * @param timeout - Maximum time to wait in milliseconds (default: 1000ms)
25
+ */
26
+ export declare function waitForModalToBeVisible(modalGetter: () => HTMLElement, timeout?: number): Promise<void>;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Wait for an element to appear in the DOM
3
+ * @param getter - Function that returns the element
4
+ * @param timeout - Maximum time to wait in milliseconds (default: 1000ms)
5
+ */
6
+ export declare function waitForElementToAppear(getter: () => HTMLElement, timeout?: number): Promise<void>;
7
+ /**
8
+ * Wait for an element to disappear from the DOM
9
+ * Use with query variants (queryBy*) that return null when element doesn't exist
10
+ * @param getter - Function that returns the element or null
11
+ * @param timeout - Maximum time to wait in milliseconds (default: 1000ms)
12
+ */
13
+ export declare function waitForElementToDisappear(getter: () => HTMLElement | null, timeout?: number): Promise<void>;
14
+ /**
15
+ * Wait for an element to become visible
16
+ * @param getter - Function that returns the element
17
+ * @param timeout - Maximum time to wait in milliseconds (default: 500ms)
18
+ */
19
+ export declare function waitForElementToBeVisible(getter: () => HTMLElement, timeout?: number): Promise<void>;
20
+ /**
21
+ * Wait for text content to change to expected value
22
+ * @param getter - Function that returns the element
23
+ * @param expectedText - Expected text content (string or regex)
24
+ * @param timeout - Maximum time to wait in milliseconds (default: 2000ms)
25
+ */
26
+ export declare function waitForTextChange(getter: () => HTMLElement, expectedText: string | RegExp, timeout?: number): Promise<void>;
27
+ /**
28
+ * Wait for an input value to change to expected value
29
+ * @param getter - Function that returns the input element
30
+ * @param expectedValue - Expected input value
31
+ * @param timeout - Maximum time to wait in milliseconds (default: 1000ms)
32
+ */
33
+ export declare function waitForValueChange(getter: () => HTMLElement, expectedValue: string, timeout?: number): Promise<void>;
34
+ /**
35
+ * Wait for an element to have a specific attribute value
36
+ * @param getter - Function that returns the element
37
+ * @param attribute - Attribute name
38
+ * @param expectedValue - Expected attribute value (optional - checks for existence if not provided)
39
+ * @param timeout - Maximum time to wait in milliseconds (default: 1000ms)
40
+ */
41
+ export declare function waitForAttribute(getter: () => HTMLElement, attribute: string, expectedValue?: string, timeout?: number): Promise<void>;
42
+ /**
43
+ * Wait for loading to complete (loading element disappears)
44
+ * @param queryLoadingGetter - Function that returns the loading element or null
45
+ * @param timeout - Maximum time to wait in milliseconds (default: 3000ms)
46
+ */
47
+ export declare function waitForLoadingToComplete(queryLoadingGetter: () => HTMLElement | null, timeout?: number): Promise<void>;