gd-design-library 1.4.0 → 1.5.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 (49) hide show
  1. package/ai/README.md +1 -1
  2. package/ai/schemas/components/Badge.d.ts +57 -0
  3. package/ai/schemas/components/ContentCarousel.d.ts +21 -2
  4. package/components/core/Badge/Badge.d.ts +2 -0
  5. package/components/core/Badge/Badge.js +30 -0
  6. package/components/core/Badge/Badge.types.d.ts +20 -0
  7. package/components/core/Badge/BadgeStyled.d.ts +5 -0
  8. package/components/core/Badge/BadgeStyled.js +54 -0
  9. package/components/core/Badge/constants.d.ts +1 -0
  10. package/components/core/Badge/constants.js +4 -0
  11. package/components/core/Badge/index.d.ts +2 -0
  12. package/components/core/Box/index.d.ts +0 -1
  13. package/components/core/DropdownItem/DropdownItem.js +34 -33
  14. package/components/core/Modal/Modal.js +12 -12
  15. package/components/core/Select/Select.js +215 -179
  16. package/components/core/Select/Select.stories.play.d.ts +10 -0
  17. package/components/core/Select/Select.types.d.ts +6 -4
  18. package/components/core/Select/SelectStyled.d.ts +1 -2
  19. package/components/core/Select/SelectStyled.js +7 -8
  20. package/components/core/Table/Table.stories.play.d.ts +14 -0
  21. package/components/core/Textarea/Textarea.d.ts +0 -4
  22. package/components/core/Textarea/Textarea.js +30 -28
  23. package/components/core/Textarea/Textarea.types.d.ts +7 -13
  24. package/components/core/Textarea/Textarea.types.js +2 -4
  25. package/components/core/Textarea/TextareaStyled.js +25 -24
  26. package/components/core/Tooltip/utils.js +90 -50
  27. package/components/core/Truncate/Truncate.stories.play.d.ts +4 -0
  28. package/components/core/index.d.ts +1 -0
  29. package/components/domainSpecific/ContentCarousel/ContentCarousel.js +86 -53
  30. package/components/domainSpecific/ContentCarousel/ContentCarousel.types.d.ts +4 -0
  31. package/components/domainSpecific/ContentCarousel/ContentCarouselStyled.d.ts +5 -1
  32. package/components/domainSpecific/ContentCarousel/ContentCarouselStyled.js +27 -18
  33. package/hooks/useCarousel/useCarousel.js +16 -16
  34. package/hooks/useTheme/NoOpTheme.d.ts +283 -29
  35. package/index.js +231 -231
  36. package/llms.txt +10 -5
  37. package/package.json +1 -1
  38. package/tokens/badge.d.ts +235 -0
  39. package/tokens/badge.js +239 -0
  40. package/tokens/defaultTheme.d.ts +283 -29
  41. package/tokens/defaultTheme.js +103 -101
  42. package/tokens/index.d.ts +284 -29
  43. package/tokens/index.js +89 -86
  44. package/tokens/tabs.d.ts +3 -1
  45. package/tokens/tabs.js +10 -12
  46. package/tokens/textarea.d.ts +45 -32
  47. package/tokens/textarea.js +51 -32
  48. package/tokens/values.js +17 -20
  49. package/utils/play/waitUtils.d.ts +7 -0
package/ai/README.md CHANGED
@@ -85,7 +85,7 @@ Component catalog
85
85
  - Forms: Form, Input, Select, Search, Label, Textarea, Switch, Toggle, RadioGroup, Slider, InputFile, DragAndDropFiles
86
86
  - Feedback & overlays: InlineNotification, Loader, Skeleton, Snackbar, SnackbarManager, Tooltip, Modal, Portal
87
87
  - Navigation & structure: Breadcrumbs, Tabs, Stepper, List, Accordion (with subcomponents: AccordionItem, AccordionHeader, AccordionContent), Link
88
- - Display & content: Typography, Button, Icon, Image, Card, Avatar, Carousel, ContentCarousel, Counter, Price, ProgressBar, Rating, ChatContainer, ChatBubble
88
+ - Display & content: Typography, Button, Icon, Image, Card, Avatar, Carousel, ContentCarousel (with visibleItems, scrollStep, scrollAlignment props), Counter, Price, ProgressBar, Rating, ChatContainer, ChatBubble
89
89
  - Not part of gd-design-library (do not request/use): Grid, Stack, Alert, Toast, Table, Badge, ButtonGroup, Dropdown, Drawer, Popover, Pagination, Heading, Spinner.
90
90
 
91
91
  Important component structures:
@@ -0,0 +1,57 @@
1
+ declare const _default: {
2
+ component: {
3
+ name: string;
4
+ import: string;
5
+ description: string;
6
+ category: string;
7
+ complexity: string;
8
+ accessibility: string;
9
+ performance: string;
10
+ dependencies: string[];
11
+ peerDependencies: string[];
12
+ bundleSize: string;
13
+ browserSupport: string;
14
+ touchSupport: boolean;
15
+ keyboardSupport: boolean;
16
+ screenReaderSupport: boolean;
17
+ props: ({
18
+ name: string;
19
+ type: string;
20
+ description: string;
21
+ default: string;
22
+ enum: string[];
23
+ required?: undefined;
24
+ } | {
25
+ name: string;
26
+ type: string;
27
+ description: string;
28
+ default: string;
29
+ enum?: undefined;
30
+ required?: undefined;
31
+ } | {
32
+ name: string;
33
+ type: string;
34
+ description: string;
35
+ default?: undefined;
36
+ enum?: undefined;
37
+ required?: undefined;
38
+ } | {
39
+ name: string;
40
+ type: string;
41
+ description: string;
42
+ required: boolean;
43
+ default?: undefined;
44
+ enum?: undefined;
45
+ } | {
46
+ name: string;
47
+ type: string;
48
+ description: string;
49
+ default: {};
50
+ enum?: undefined;
51
+ required?: undefined;
52
+ })[];
53
+ examples: string[];
54
+ };
55
+ compositionTips: string[];
56
+ };
57
+ export default _default;
@@ -50,6 +50,24 @@ declare const _default: {
50
50
  required?: undefined;
51
51
  examples?: undefined;
52
52
  recommended?: undefined;
53
+ } | {
54
+ name: string;
55
+ type: string;
56
+ description: string;
57
+ default: string;
58
+ examples: number[];
59
+ recommended: string;
60
+ required?: undefined;
61
+ accessibility?: undefined;
62
+ } | {
63
+ name: string;
64
+ type: string;
65
+ description: string;
66
+ default: string;
67
+ examples: string[];
68
+ recommended: string;
69
+ required?: undefined;
70
+ accessibility?: undefined;
53
71
  } | {
54
72
  name: string;
55
73
  type: string;
@@ -72,8 +90,9 @@ declare const _default: {
72
90
  quickStart: {
73
91
  basic: string;
74
92
  withNavigation: string;
75
- itemByItem: string;
76
- accessible: string;
93
+ multipleVisible: string;
94
+ centered: string;
95
+ customScrollStep: string;
77
96
  };
78
97
  commonPatterns: {
79
98
  'Product Gallery': {
@@ -0,0 +1,2 @@
1
+ import { BadgeProps } from './';
2
+ export declare const Badge: import('react').ForwardRefExoticComponent<BadgeProps & import('react').RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { jsxs as p, jsx as d } from "@emotion/react/jsx-runtime";
3
+ import { forwardRef as f } from "react";
4
+ import { convertToInlineBoxStyles as u } from "../../../tokens/utils.js";
5
+ import { COMPONENT_NAME as e } from "./constants.js";
6
+ import { BadgeStyled as y, BadgeStartIconStyled as $, BadgeContentStyled as B, BadgeEndIconStyled as g } from "./BadgeStyled.js";
7
+ import { useTheme as h } from "../../../hooks/useTheme/useTheme.js";
8
+ const S = f(({
9
+ variant: n = "primary",
10
+ appearance: o = "filled",
11
+ size: l = "md",
12
+ children: i,
13
+ disabled: m,
14
+ iconStart: r = null,
15
+ iconEnd: a = null,
16
+ ...s
17
+ }, c) => {
18
+ const {
19
+ theme: t
20
+ } = h();
21
+ return /* @__PURE__ */ p(y, { ref: c, $variant: n, $appearance: o, $size: l, theme: t, $disabled: m, "data-testid": e, ...u(s), children: [
22
+ r ? /* @__PURE__ */ d($, { theme: t, "data-testid": `${e}-icon-start`, children: r }) : null,
23
+ /* @__PURE__ */ d(B, { theme: t, "data-testid": `${e}-content`, children: i }),
24
+ a ? /* @__PURE__ */ d(g, { theme: t, "data-testid": `${e}-icon-end`, children: a }) : null
25
+ ] });
26
+ });
27
+ S.displayName = e;
28
+ export {
29
+ S as Badge
30
+ };
@@ -0,0 +1,20 @@
1
+ import { PropsWithChildren, ReactNode } from 'react';
2
+ import { EnumOrPrimitive } from '../../../types';
3
+ import { BoxCssComponentProps, BoxCssComponentStyledProps } from '../..';
4
+ export type BadgeVariant = 'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'quinary';
5
+ export type BadgeAppearance = 'outline' | 'outlineFilledLight' | 'filled' | 'filledLight';
6
+ export type BadgeSize = 'sm' | 'md';
7
+ export interface BadgeProps extends BoxCssComponentProps<HTMLSpanElement>, PropsWithChildren {
8
+ variant?: EnumOrPrimitive<BadgeVariant>;
9
+ disabled?: boolean;
10
+ appearance?: EnumOrPrimitive<BadgeAppearance>;
11
+ size?: EnumOrPrimitive<BadgeSize>;
12
+ iconStart?: ReactNode;
13
+ iconEnd?: ReactNode;
14
+ }
15
+ export interface BadgeStyledProps extends BoxCssComponentStyledProps<HTMLSpanElement>, PropsWithChildren {
16
+ $variant?: EnumOrPrimitive<BadgeVariant>;
17
+ $appearance?: EnumOrPrimitive<BadgeAppearance>;
18
+ $size?: EnumOrPrimitive<BadgeSize>;
19
+ $disabled?: boolean;
20
+ }
@@ -0,0 +1,5 @@
1
+ import { BadgeStyledProps } from './';
2
+ export declare const BadgeStyled: import('react').ForwardRefExoticComponent<Omit<BadgeStyledProps, "ref"> & import('react').RefAttributes<HTMLSpanElement>>;
3
+ export declare const BadgeContentStyled: import('react').ForwardRefExoticComponent<Omit<BadgeStyledProps, "ref"> & import('react').RefAttributes<HTMLSpanElement>>;
4
+ export declare const BadgeStartIconStyled: import('react').ForwardRefExoticComponent<Omit<BadgeStyledProps, "ref"> & import('react').RefAttributes<HTMLSpanElement>>;
5
+ export declare const BadgeEndIconStyled: import('react').ForwardRefExoticComponent<Omit<BadgeStyledProps, "ref"> & import('react').RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,54 @@
1
+ import { jsx as d } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as a } from "react";
3
+ import { getBoxStyles as i, tokensHandler as B } from "../../../tokens/utils.js";
4
+ import { get as e } from "../../../utils/helpers.js";
5
+ const I = a(({
6
+ theme: {
7
+ badge: s,
8
+ ...n
9
+ } = {},
10
+ $variant: t,
11
+ $appearance: o,
12
+ $size: r,
13
+ $disabled: l,
14
+ className: m,
15
+ styles: f = {},
16
+ ...g
17
+ }, p) => {
18
+ const {
19
+ boxStyles: y,
20
+ restProps: S
21
+ } = i(g), c = new Proxy(s || {}, B(n)), u = [e(c, "default", {}), e(c, [t, o, "default"], {}), l ? e(c, [t, o, "disabled"], {}) : {}, r ? e(c, ["size", r], {}) : {}, y, f];
22
+ return /* @__PURE__ */ d("span", { css: u, className: m, ...S, ref: p });
23
+ }), N = a(({
24
+ theme: {
25
+ badge: s
26
+ } = {},
27
+ styles: n,
28
+ ...t
29
+ }, o) => {
30
+ const r = e(s, "content", {});
31
+ return /* @__PURE__ */ d("span", { css: [e(r, "default", {}), n], className: "gd-badge__content", ...t, ref: o });
32
+ }), P = a(({
33
+ theme: {
34
+ badge: s
35
+ } = {},
36
+ ...n
37
+ }, t) => {
38
+ const o = e(s, "startIcon", {});
39
+ return /* @__PURE__ */ d("span", { css: e(o, "default", {}), className: "gd-badge__icon-start", ...n, ref: t });
40
+ }), w = a(({
41
+ theme: {
42
+ badge: s
43
+ } = {},
44
+ ...n
45
+ }, t) => {
46
+ const o = e(s, "endIcon", {});
47
+ return /* @__PURE__ */ d("span", { css: e(o, "default", {}), className: "gd-badge__icon-end", ...n, ref: t });
48
+ });
49
+ export {
50
+ N as BadgeContentStyled,
51
+ w as BadgeEndIconStyled,
52
+ P as BadgeStartIconStyled,
53
+ I as BadgeStyled
54
+ };
@@ -0,0 +1 @@
1
+ export declare const COMPONENT_NAME = "Badge";
@@ -0,0 +1,4 @@
1
+ const N = "Badge";
2
+ export {
3
+ N as COMPONENT_NAME
4
+ };
@@ -0,0 +1,2 @@
1
+ export * from './Badge';
2
+ export * from './Badge.types';
@@ -1,3 +1,2 @@
1
1
  export * from './Box';
2
2
  export * from './Box.types';
3
- export * from './constants';
@@ -1,45 +1,46 @@
1
1
  "use client";
2
2
  import { jsx as E } from "@emotion/react/jsx-runtime";
3
- import { forwardRef as x, useMemo as I, useCallback as u } from "react";
4
- import { KEYBOARD_KEYS as O } from "../../../constants/keyboard.js";
3
+ import { forwardRef as x, useMemo as O, useCallback as p } from "react";
4
+ import { KEYBOARD_KEYS as K } from "../../../constants/keyboard.js";
5
5
  import { COMPONENT_NAME as D } from "./constants.js";
6
- import { DropdownItemStyled as v } from "./DropdownItemStyled.js";
7
- import { useSelectContext as K } from "../Select/hooks/useSelectContext.js";
8
- import { useTheme as T } from "../../../hooks/useTheme/useTheme.js";
9
- import { TabIndex as p } from "../../../types/accesability.js";
10
- const k = x((S, N) => {
6
+ import { DropdownItemStyled as N } from "./DropdownItemStyled.js";
7
+ import { useSelectContext as T } from "../Select/hooks/useSelectContext.js";
8
+ import { useTheme as k } from "../../../hooks/useTheme/useTheme.js";
9
+ import { TabIndex as y } from "../../../types/accesability.js";
10
+ const I = x((S, v) => {
11
11
  const {
12
- children: y,
13
- value: n,
14
- onSelect: i,
15
- className: o,
16
- disabled: e,
17
- name: d,
12
+ children: A,
13
+ value: a,
14
+ onSelect: l,
15
+ className: e,
16
+ disabled: t,
17
+ name: c,
18
18
  ...b
19
19
  } = S, {
20
20
  theme: h
21
- } = T(), {
21
+ } = k(), {
22
22
  onSelect: s,
23
- value: l,
24
- itemIdentifier: m
25
- } = K(), r = {
26
- name: d,
27
- value: n
28
- }, c = JSON.stringify(r), f = l !== void 0 && m ? m(l, r) : o == null ? void 0 : o.includes("active"), w = I(() => `${o || ""} ${f ? "active" : ""}`, [o, f]), a = u((t) => {
29
- if (!e)
30
- return i ? i({
31
- event: t,
32
- data: r
23
+ value: n,
24
+ itemIdentifier: i,
25
+ multiple: u
26
+ } = T(), o = {
27
+ name: c,
28
+ value: a
29
+ }, f = JSON.stringify(o), m = n === void 0 ? e == null ? void 0 : e.includes("active") : u && Array.isArray(n) ? n.some((r) => (i == null ? void 0 : i(r, o)) ?? r.value === o.value) : !u && !Array.isArray(n) && i ? i(n, o) : e == null ? void 0 : e.includes("active"), w = O(() => `${e || ""} ${m ? "active" : ""}`, [e, m]), d = p((r) => {
30
+ if (!t)
31
+ return l ? l({
32
+ event: r,
33
+ data: o
33
34
  }) : s && s({
34
- event: t,
35
- data: r
36
- }), n;
37
- }, [i, s, c, JSON.stringify(n), e]), C = u((t) => {
38
- e || t.key === O.ENTER && (t.preventDefault(), a(t));
39
- }, [a, e, c]);
40
- return /* @__PURE__ */ E(v, { ref: N, theme: h, $disabled: e, tabIndex: e ? p.Disabled : p.Default, "data-testid": D, className: w, onClick: a, onKeyDown: C, ...b, children: y || d });
35
+ event: r,
36
+ data: o
37
+ }), a;
38
+ }, [l, s, f, JSON.stringify(a), t]), C = p((r) => {
39
+ t || r.key === K.ENTER && (r.preventDefault(), d(r));
40
+ }, [d, t, f]);
41
+ return /* @__PURE__ */ E(N, { ref: v, theme: h, $disabled: t, tabIndex: t ? y.Disabled : y.Default, "data-testid": D, className: w, onClick: d, onKeyDown: C, ...b, children: A || c });
41
42
  });
42
- k.displayName = D;
43
+ I.displayName = D;
43
44
  export {
44
- k as DropdownItem
45
+ I as DropdownItem
45
46
  };
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as d, jsxs as y, Fragment as B } from "@emotion/react/jsx-runtime";
3
- import { forwardRef as T, useCallback as g, useEffect as w } from "react";
3
+ import { forwardRef as T, useCallback as s, useEffect as w } from "react";
4
4
  import { COMPONENT_NAME as e } from "./constants.js";
5
5
  import { ModalOverlayStyled as x, ModalContentStyled as N, ModalHeaderStyled as P, ModalTitleStyled as A, CloseButtonStyled as K, ModalBodyStyled as L, ModalFooterStyled as j } from "./ModalStyled.js";
6
6
  import { useTheme as D } from "../../../hooks/useTheme/useTheme.js";
7
7
  import { useLogger as F } from "../../../hooks/useLogger/useLogger.js";
8
- import { get as s } from "../../../utils/helpers.js";
8
+ import { get as g } from "../../../utils/helpers.js";
9
9
  import { Portal as H } from "../Portal/Portal.js";
10
10
  import { convertToInlineBoxStyles as I } from "../../../tokens/utils.js";
11
11
  import { Icon as R } from "../Icon/Icon.js";
@@ -18,39 +18,39 @@ const _ = T(({
18
18
  closeOnClickOutside: o = !0,
19
19
  closeOnEscape: f,
20
20
  title: a,
21
- children: m,
21
+ children: l,
22
22
  footer: u,
23
23
  styles: h,
24
24
  ...S
25
- }, M) => {
25
+ }, b) => {
26
26
  const {
27
27
  theme: r
28
- } = D(), l = F(), b = s(r, "modal.icons", {}), k = a || !!(n && t), E = g(() => {
29
- l.debug(`${e}: Close`, {
28
+ } = D(), m = F(), M = g(r, "modal.icons", {}), k = a || !!(n && t), E = s(() => {
29
+ m.debug(`${e}: Close`, {
30
30
  trigger: "overlay",
31
31
  closeOnClickOutside: o
32
32
  }), o && (t == null || t());
33
- }, [t, o]), $ = g(() => {
34
- l.debug(`${e}: Close`, {
33
+ }, [t, o]), $ = s(() => {
34
+ m.debug(`${e}: Close`, {
35
35
  trigger: "closeButton"
36
36
  }), t == null || t();
37
37
  }, [t]);
38
38
  return w(() => {
39
39
  if (!f) return;
40
40
  const i = (v) => {
41
- t && v.key === Y.ESCAPE && (l.debug(`${e}: Close`, {
41
+ t && v.key === Y.ESCAPE && (m.debug(`${e}: Close`, {
42
42
  trigger: "escape"
43
43
  }), t == null || t());
44
44
  };
45
45
  return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
46
- }, [c, f, t]), c ? /* @__PURE__ */ d(H, { blocksScroll: !0, children: /* @__PURE__ */ d(x, { onClick: E, theme: r, children: /* @__PURE__ */ d(N, { ref: M, onClick: (i) => i.stopPropagation(), "data-testid": e, theme: r, styles: h, ...I(S), children: p ? m : /* @__PURE__ */ y(B, { children: [
46
+ }, [c, f, t]), c ? /* @__PURE__ */ d(H, { blocksScroll: !0, children: /* @__PURE__ */ d(x, { onClick: E, theme: r, children: /* @__PURE__ */ d(N, { ref: b, onClick: (i) => i.stopPropagation(), "data-testid": e, theme: r, styles: h, ...I(S), children: p ? l : /* @__PURE__ */ y(B, { children: [
47
47
  k && /* @__PURE__ */ y(P, { theme: r, $withTitle: !!a, "data-testid": `${e}-header`, children: [
48
48
  a && /* @__PURE__ */ d(A, { theme: r, "data-testid": `${e}-title`, children: a }),
49
- n && t && /* @__PURE__ */ d(K, { onClick: $, "data-testid": "close-button", theme: r, children: /* @__PURE__ */ d(R, { ...s(b, "close", {
49
+ n && t && /* @__PURE__ */ d(K, { onClick: $, "data-testid": "close-button", theme: r, "aria-label": "Close modal", children: /* @__PURE__ */ d(R, { ...g(M, "close", {
50
50
  name: "cross"
51
51
  }) }) })
52
52
  ] }),
53
- m && /* @__PURE__ */ d(L, { theme: r, "data-testid": `${e}-body`, children: m }),
53
+ l && /* @__PURE__ */ d(L, { theme: r, "data-testid": `${e}-body`, children: l }),
54
54
  u && /* @__PURE__ */ d(j, { theme: r, "data-testid": `${e}-footer`, children: u })
55
55
  ] }) }) }) }) : null;
56
56
  });