gd-design-library 0.3.5 → 0.4.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.
- package/CHANGELOG.md +86 -17
- package/components/core/Image/ImageStyled.js +14 -13
- package/components/core/Snackbar/SnackbarStyled.js +17 -17
- package/components/domainSpecific/Carousel/Carousel.js +15 -15
- package/components/domainSpecific/Carousel/Carousel.types.d.ts +1 -12
- package/components/domainSpecific/Carousel/CarouselStyled.js +3 -3
- package/components/domainSpecific/ContentCarousel/ContentCarousel.js +6 -6
- package/components/domainSpecific/RadioGroup/RadioGroupItem/RadioGroupItem.js +2 -2
- package/constants/positioning.js +1 -0
- package/hooks/useTheme/useTheme.js +28 -27
- package/index.js +256 -257
- package/package.json +1 -1
- package/tokens/breakpoints.d.ts +8 -0
- package/tokens/breakpoints.js +12 -0
- package/tokens/card.d.ts +5 -1
- package/tokens/card.js +9 -5
- package/tokens/chat.d.ts +4 -0
- package/tokens/chat.js +22 -18
- package/tokens/chatbubble.d.ts +1 -3
- package/tokens/chatbubble.js +44 -25
- package/tokens/defaultTheme.d.ts +132 -32
- package/tokens/defaultTheme.js +21 -11
- package/tokens/index.d.ts +49 -32
- package/tokens/index.js +100 -97
- package/tokens/shadow.js +11 -10
- package/tokens/snackbar.d.ts +30 -28
- package/tokens/snackbar.js +31 -29
- package/tokens/utils.d.ts +6 -0
- package/tokens/utils.js +27 -24
- package/types/carousel.d.ts +12 -1
- package/types/index.d.ts +1 -0
- /package/{components/domainSpecific/Carousel/Carousel.types.js → types/carousel.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
-
## [0.1.0]
|
|
5
|
+
## [0.1.0] - 2025-05-15
|
|
6
6
|
|
|
7
7
|
### Features
|
|
8
8
|
|
|
@@ -51,25 +51,94 @@
|
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
54
|
-
##
|
|
54
|
+
## [1.2.0] - 2025-06-12
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
<summary>Expand full history</summary>
|
|
56
|
+
### Added
|
|
58
57
|
|
|
59
|
-
|
|
58
|
+
- New `Stepper` component with horizontal/vertical orientation
|
|
59
|
+
- `Button` now supports `loading` prop
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
- **Tabs**: Implemented Tabs component (#139)
|
|
63
|
-
- **Stepper**: Added stepper view (#46)
|
|
64
|
-
- **Form**: Added base form concept (#32)
|
|
65
|
-
- **Textarea**: Added core textarea functionality (#26)
|
|
66
|
-
- **Link**: Added Link component (#27)
|
|
67
|
-
- **Input**: Added base input component (#13)
|
|
61
|
+
### Changed
|
|
68
62
|
|
|
69
|
-
|
|
63
|
+
- `Input` now accepts `size="small" | "medium" | "large"`
|
|
64
|
+
- Improved `Modal` focus trap behavior
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
- **Linting**: Configured ESLint and Prettier (#6)
|
|
73
|
-
- **Testing**: Added Jest and React Testing Library (#11)
|
|
66
|
+
### Fixed
|
|
74
67
|
|
|
75
|
-
|
|
68
|
+
- Fixed `Tooltip` not displaying on keyboard focus
|
|
69
|
+
- `Checkbox` label alignment issue in Safari
|
|
70
|
+
|
|
71
|
+
### Removed
|
|
72
|
+
|
|
73
|
+
- Deprecated `LegacyBanner` component (removed in v1.2.0)
|
|
74
|
+
|
|
75
|
+
## [1.3.0] - 2025-07-14
|
|
76
|
+
|
|
77
|
+
### Features
|
|
78
|
+
|
|
79
|
+
- Integrated Google Generative AI with markdown support and file uploads in ChatDemo.
|
|
80
|
+
- Added multi-chat session support with search functionality and chat caching.
|
|
81
|
+
- Introduced ChatBubble component with status-based styling (pending, fulfilled, rejected).
|
|
82
|
+
- Implemented AI feedback loop for iterative improvements in chat interactions.
|
|
83
|
+
- Added DragAndDrop widget with file validation and upload progress indicators.
|
|
84
|
+
- New Separator component for visual content division.
|
|
85
|
+
- Enhanced Loader with customizable name prop for targeted styling.
|
|
86
|
+
- Added use client directive for Next.js compatibility.
|
|
87
|
+
- Dynamic theme support in ChatBubble using commonHeader tokens.
|
|
88
|
+
|
|
89
|
+
### Refactor
|
|
90
|
+
|
|
91
|
+
- Full migration from styled-components to @emotion/styled across all components.
|
|
92
|
+
- Restructured Storybook stories and updated meta titles for consistency.
|
|
93
|
+
- Replaced static styles with array-based computed styles (e.g., Avatar, Carousel).
|
|
94
|
+
- Standardized prop names (e.g., wrap → isWrap in Row/Column).
|
|
95
|
+
- Library imports are optimized for tree-shaking and performance.
|
|
96
|
+
|
|
97
|
+
### Fixes
|
|
98
|
+
|
|
99
|
+
- Fixed OptionPicker accessibility by adding explicit type="radio".
|
|
100
|
+
- Resolved textarea dynamic height reset and added minHeight/maxHeight support.
|
|
101
|
+
- Addressed chat container overflow, snackbar shadow clipping, and file card rendering issues.
|
|
102
|
+
- Patched type errors, linter warnings, and CI/CD pipeline failures.
|
|
103
|
+
- Restored automation step in Jenkins workflow.
|
|
104
|
+
- Fixed ChatDemo image handling and scroll behavior.
|
|
105
|
+
|
|
106
|
+
### Documentation
|
|
107
|
+
|
|
108
|
+
- Updated Storybook documentation for all components post-Emotion migration.
|
|
109
|
+
- Revised theming guide to use @emotion/styled and gd-design-library.
|
|
110
|
+
- Added .env.example for ChatDemo API key setup.
|
|
111
|
+
- Enhanced component docs with JSDoc examples and usage guidelines.
|
|
112
|
+
|
|
113
|
+
### Summary
|
|
114
|
+
|
|
115
|
+
This release delivers major enhancements to the chat system, full Emotion adoption for styling, critical UX fixes, and
|
|
116
|
+
comprehensive documentation updates. The refactor improves maintainability, while new features like AI integration and
|
|
117
|
+
drag-and-drop elevate component capabilities.
|
|
118
|
+
|
|
119
|
+
## [1.4.0] - 2025-08-18
|
|
120
|
+
|
|
121
|
+
### New Features
|
|
122
|
+
|
|
123
|
+
- Added responsiveness documentation for layout composition techniques
|
|
124
|
+
- Implemented TokenViewer for visual theme token representation in Storybook
|
|
125
|
+
- Added styleVariant prop to Typography for combined styles (bold/italic/underline)
|
|
126
|
+
- Introduced theme export script with downloadable defaultTheme.json in documentation
|
|
127
|
+
|
|
128
|
+
### Improvements
|
|
129
|
+
|
|
130
|
+
- Enhanced theme styles, fixed typos, and improved documentation across components
|
|
131
|
+
- Updated mobile responsiveness and documentation for ChatBubble, ChatContainer, and Breadcrumbs
|
|
132
|
+
- Refined Storybook controls and documentation for Button, Modal, and Card
|
|
133
|
+
- Improved Textarea usability (removed deprecated props, added rows, updated docs)
|
|
134
|
+
- Optimized build with tree shaking, dependency updates, and external library dependencies
|
|
135
|
+
|
|
136
|
+
### Bug Fixes
|
|
137
|
+
|
|
138
|
+
- Fixed Carousel SSR type errors and Dropdown linting issues
|
|
139
|
+
- Adjusted Snackbar documentation and fixed style inconsistencies
|
|
140
|
+
- Fixed Image styles, Carousel token styles, and RadioGroupItem behavior
|
|
141
|
+
- Resolved avatar and chat page responsiveness issues
|
|
142
|
+
- Eliminated console warnings in app.tsx and removed unused code
|
|
143
|
+
- Fixed hardcoded Google API key by adding environment variable support
|
|
144
|
+
- Patched entry point configuration and Portal import errors
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as r } from "@emotion/react/jsx-runtime";
|
|
3
|
-
import { forwardRef as
|
|
3
|
+
import { forwardRef as a } from "react";
|
|
4
4
|
import { get as c } from "../../../utils/helpers.js";
|
|
5
|
-
const
|
|
5
|
+
const h = (o) => {
|
|
6
6
|
const {
|
|
7
7
|
width: t,
|
|
8
8
|
height: e,
|
|
@@ -15,20 +15,21 @@ const g = (o) => {
|
|
|
15
15
|
height: `${e ? `${e}px` : "100%"}`
|
|
16
16
|
}];
|
|
17
17
|
return /* @__PURE__ */ r("div", { css: p, ...i });
|
|
18
|
-
},
|
|
18
|
+
}, u = a((o, t) => {
|
|
19
19
|
const {
|
|
20
20
|
objectFit: e = "cover",
|
|
21
21
|
$isLoading: s,
|
|
22
22
|
theme: {
|
|
23
23
|
image: i
|
|
24
24
|
} = {},
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
styles: p,
|
|
26
|
+
...m
|
|
27
|
+
} = o, n = [c(i, "default", {}), {
|
|
27
28
|
objectFit: e,
|
|
28
29
|
opacity: `${s ? 0 : 1}`
|
|
29
|
-
}];
|
|
30
|
-
return /* @__PURE__ */ r("img", { css:
|
|
31
|
-
}),
|
|
30
|
+
}, p];
|
|
31
|
+
return /* @__PURE__ */ r("img", { css: n, ...m, ref: t });
|
|
32
|
+
}), y = (o) => {
|
|
32
33
|
const {
|
|
33
34
|
theme: {
|
|
34
35
|
image: t
|
|
@@ -36,7 +37,7 @@ const g = (o) => {
|
|
|
36
37
|
...e
|
|
37
38
|
} = o, s = [c(t, "placeholder", {})];
|
|
38
39
|
return /* @__PURE__ */ r("div", { css: s, ...e });
|
|
39
|
-
},
|
|
40
|
+
}, f = (o) => {
|
|
40
41
|
const {
|
|
41
42
|
theme: {
|
|
42
43
|
image: t
|
|
@@ -46,8 +47,8 @@ const g = (o) => {
|
|
|
46
47
|
return /* @__PURE__ */ r("figcaption", { css: s, ...e });
|
|
47
48
|
};
|
|
48
49
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
f as CaptionStyled,
|
|
51
|
+
u as ImageStyled,
|
|
52
|
+
h as ImageWrapperStyled,
|
|
53
|
+
y as PlaceholderStyled
|
|
53
54
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as e } from "@emotion/react/jsx-runtime";
|
|
3
3
|
import { forwardRef as O } from "react";
|
|
4
|
-
import { convertJsonToCssKeyframeCss as
|
|
5
|
-
import { Typography as
|
|
4
|
+
import { convertJsonToCssKeyframeCss as S, getBoxStyles as j } from "../../../tokens/utils.js";
|
|
5
|
+
import { Typography as p } from "../Typography/Typography.js";
|
|
6
6
|
import { get as r } from "../../../utils/helpers.js";
|
|
7
|
-
import { Icon as
|
|
8
|
-
import { TypographyStyleVariant as
|
|
7
|
+
import { Icon as b } from "../Icon/Icon.js";
|
|
8
|
+
import { TypographyStyleVariant as k, TypographyVariant as f, TextAlign as g } from "../../../types/typography.js";
|
|
9
9
|
const G = O((n, o) => {
|
|
10
|
-
var
|
|
10
|
+
var l, m, y, u;
|
|
11
11
|
const {
|
|
12
12
|
theme: {
|
|
13
13
|
animations: t,
|
|
14
14
|
snackbar: s
|
|
15
15
|
} = {},
|
|
16
|
-
$variant:
|
|
16
|
+
$variant: a,
|
|
17
17
|
$colored: $,
|
|
18
18
|
$isClosing: v,
|
|
19
19
|
$isAnimated: h,
|
|
20
20
|
styles: C,
|
|
21
21
|
...B
|
|
22
|
-
} = n, A =
|
|
22
|
+
} = n, A = S(t == null ? void 0 : t.slideIn), T = S(t == null ? void 0 : t.slideOut), {
|
|
23
23
|
boxStyles: x,
|
|
24
24
|
restProps: I
|
|
25
|
-
} = j(B),
|
|
26
|
-
${T} ${
|
|
25
|
+
} = j(B), c = (m = (l = s == null ? void 0 : s.snackbar) == null ? void 0 : l.animation) == null ? void 0 : m.duration, i = (u = (y = s == null ? void 0 : s.snackbar) == null ? void 0 : y.animation) == null ? void 0 : u.timing, P = `
|
|
26
|
+
${T} ${c} ${i} forwards
|
|
27
27
|
`, V = `
|
|
28
|
-
${A} ${
|
|
29
|
-
`,
|
|
30
|
-
background: $ ? r(s, `snackbar.background.variants.${
|
|
28
|
+
${A} ${c} ${i}
|
|
29
|
+
`, d = r(s, "snackbar.background.default"), w = r(s, "snackbar.default", {}), N = {
|
|
30
|
+
background: $ ? r(s, `snackbar.background.variants.${a}`, d) : d
|
|
31
31
|
};
|
|
32
32
|
return /* @__PURE__ */ e("div", { css: [h ? {
|
|
33
33
|
animation: {
|
|
@@ -50,7 +50,7 @@ const G = O((n, o) => {
|
|
|
50
50
|
} = n, t = r(o, "icons.close", {
|
|
51
51
|
name: "cross"
|
|
52
52
|
});
|
|
53
|
-
return /* @__PURE__ */ e(
|
|
53
|
+
return /* @__PURE__ */ e(b, { ...t });
|
|
54
54
|
}, M = (n) => {
|
|
55
55
|
const {
|
|
56
56
|
$variant: o,
|
|
@@ -60,7 +60,7 @@ const G = O((n, o) => {
|
|
|
60
60
|
} = n, s = r(t, ["icons", o], {
|
|
61
61
|
name: ""
|
|
62
62
|
});
|
|
63
|
-
return /* @__PURE__ */ e(
|
|
63
|
+
return /* @__PURE__ */ e(b, { ...s });
|
|
64
64
|
}, Q = (n) => {
|
|
65
65
|
const {
|
|
66
66
|
theme: {
|
|
@@ -77,7 +77,7 @@ const G = O((n, o) => {
|
|
|
77
77
|
...t
|
|
78
78
|
} = n;
|
|
79
79
|
return /* @__PURE__ */ e("div", { css: r(o, "snackbarContent", {}), ...t });
|
|
80
|
-
}, X = (n) => /* @__PURE__ */ e(
|
|
80
|
+
}, X = (n) => /* @__PURE__ */ e(p, { align: g.Start, variant: f.Body2, styleVariant: k.Semibold, ...n }), Y = (n) => /* @__PURE__ */ e(p, { align: g.Start, variant: f.Body2, styleVariant: k.Normal, ...n }), Z = (n) => {
|
|
81
81
|
const {
|
|
82
82
|
theme: {
|
|
83
83
|
snackbar: o
|
|
@@ -92,8 +92,8 @@ const G = O((n, o) => {
|
|
|
92
92
|
} = {},
|
|
93
93
|
$position: t,
|
|
94
94
|
...s
|
|
95
|
-
} = n;
|
|
96
|
-
return /* @__PURE__ */ e("div", { css:
|
|
95
|
+
} = n, a = [r(o, "container.default", {}), r(o, ["positions", t], {})];
|
|
96
|
+
return /* @__PURE__ */ e("div", { css: a, ...s });
|
|
97
97
|
};
|
|
98
98
|
export {
|
|
99
99
|
L as CloseButtonIconStyled,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as t, jsxs as S } from "@emotion/react/jsx-runtime";
|
|
3
3
|
import { Fragment as q, forwardRef as G, Children as J, isValidElement as K, cloneElement as Q, useRef as U, useImperativeHandle as X } from "react";
|
|
4
4
|
import { COMPONENT_NAME as o } from "./constants.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { CarouselSlideStyled as A, CarouselContainerStyled as Y, CarouselControlsWrapperStyled as Z, CarouselControlsStyled as tt, CarouselControlsButtonStyled as T, ContentContainerStyled as et, CarouselViewportStyled as rt, CarouselViewportSlideWrapperStyled as ot, CarouselDotsStyled as at, CarouselDotStyled as nt, CarouselThumbsStyled as lt, CarouselThumbsViewportStyled as it, CarouselThumbsWrapperStyled as st, CarouselThumbStyled as dt } from "./CarouselStyled.js";
|
|
6
|
+
import { useCarousel as ct } from "../../../hooks/useCarousel/useCarousel.js";
|
|
7
|
+
import { LayoutType as mt, ThumbsPosition as D, CarouselVariantTypes as ut } from "../../../types/carousel.js";
|
|
8
8
|
import { Typography as V } from "../../core/Typography/Typography.js";
|
|
9
9
|
import { TypographyVariant as B } from "../../../types/typography.js";
|
|
10
10
|
import { Image as pt } from "../../core/Image/Image.js";
|
|
@@ -39,8 +39,8 @@ function Ct(r) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
const L = G(({
|
|
42
|
-
layout: r =
|
|
43
|
-
variant: i =
|
|
42
|
+
layout: r = mt.Horizontal,
|
|
43
|
+
variant: i = ut.Cards,
|
|
44
44
|
showArrows: s = !0,
|
|
45
45
|
isFocusable: w = !0,
|
|
46
46
|
showDots: N = !1,
|
|
@@ -74,7 +74,7 @@ const L = G(({
|
|
|
74
74
|
canScrollPrev: $,
|
|
75
75
|
canScrollNext: b,
|
|
76
76
|
slidesCount: F
|
|
77
|
-
} =
|
|
77
|
+
} = ct({
|
|
78
78
|
options: {
|
|
79
79
|
axis: r === "vertical" ? "y" : "x"
|
|
80
80
|
},
|
|
@@ -86,27 +86,27 @@ const L = G(({
|
|
|
86
86
|
scrollTo: C,
|
|
87
87
|
carouselApi: z,
|
|
88
88
|
selectedIndex: f
|
|
89
|
-
}), [h, y, C, f]), /* @__PURE__ */ S(
|
|
90
|
-
/* @__PURE__ */ S(
|
|
89
|
+
}), [h, y, C, f]), /* @__PURE__ */ S(Y, { ref: R, theme: e, $layout: r, styles: d, $variant: i, tabIndex: w ? j.Default : j.Disabled, "data-testid": o, children: [
|
|
90
|
+
/* @__PURE__ */ S(Z, { "data-testid": `${o}-controls-wrapper`, theme: e, styles: {
|
|
91
91
|
order: n === D.Start ? 1 : "inherit"
|
|
92
92
|
}, children: [
|
|
93
|
-
s && /* @__PURE__ */ S(
|
|
93
|
+
s && /* @__PURE__ */ S(tt, { theme: e, "data-testid": `${o}-controls`, children: [
|
|
94
94
|
/* @__PURE__ */ t(T, { isIcon: !0, theme: e, variant: I.Text, color: g.Primary, onClick: h, disabled: !$, "data-testid": `${o}-control-previous`, children: /* @__PURE__ */ t(x, { ...p, name: "arrowLeft", fill: $ ? m : u }) }),
|
|
95
95
|
/* @__PURE__ */ t(T, { isIcon: !0, theme: e, variant: I.Text, styles: {
|
|
96
96
|
transform: "rotate(180deg)"
|
|
97
97
|
}, color: g.Primary, onClick: y, disabled: !b, "data-testid": `${o}-control-next`, children: /* @__PURE__ */ t(x, { ...p, name: "arrowLeft", fill: b ? m : u }) })
|
|
98
98
|
] }),
|
|
99
|
-
/* @__PURE__ */ t(
|
|
100
|
-
/* @__PURE__ */ t(
|
|
101
|
-
N && /* @__PURE__ */ t(
|
|
99
|
+
/* @__PURE__ */ t(et, { theme: e, "data-testid": `${o}-content-container`, children: H }),
|
|
100
|
+
/* @__PURE__ */ t(rt, { theme: e, ref: W, "data-testid": `${o}-viewport`, children: /* @__PURE__ */ t(ot, { theme: e, "data-testid": `${o}-slider-wrapper`, children: l == null ? void 0 : l.map((v, a) => /* @__PURE__ */ t(A, { theme: e, "data-testid": `${o}-slide-${a}`, children: v }, a)) }) }),
|
|
101
|
+
N && /* @__PURE__ */ t(at, { theme: e, "data-testid": `${o}-dots`, children: (k = Array.from({
|
|
102
102
|
length: F
|
|
103
|
-
})) == null ? void 0 : k.map((v, a) => /* @__PURE__ */ t(
|
|
103
|
+
})) == null ? void 0 : k.map((v, a) => /* @__PURE__ */ t(nt, { theme: e, $active: a === f, onClick: () => C(a) }, a)) })
|
|
104
104
|
] }),
|
|
105
|
-
n && /* @__PURE__ */ S(
|
|
105
|
+
n && /* @__PURE__ */ S(lt, { theme: e, $layout: r, "data-testid": `${o}-thumbnails`, children: [
|
|
106
106
|
/* @__PURE__ */ t(T, { isIcon: !0, theme: e, variant: I.Text, styles: {
|
|
107
107
|
transform: `rotate(${r === "vertical" ? "90" : "0"}deg)`
|
|
108
108
|
}, color: g.Primary, onClick: h, disabled: !$, "data-testid": `${o}-thumbnail-control-previous`, children: /* @__PURE__ */ t(x, { ...p, ...M, fill: $ ? m : u }) }),
|
|
109
|
-
/* @__PURE__ */ t(
|
|
109
|
+
/* @__PURE__ */ t(it, { theme: e, $layout: r, "data-testid": `${o}-thumbs-viewport`, ref: _, children: /* @__PURE__ */ t(st, { theme: e, $layout: r, "data-testid": `${o}-thumbs-wrapper`, children: l == null ? void 0 : l.map((v, a) => /* @__PURE__ */ t(dt, { theme: e, $layout: r, $active: a === f, onClick: () => C(a), "data-testid": `${o}-thumbnail-${a}`, children: v }, a)) }) }),
|
|
110
110
|
/* @__PURE__ */ t(T, { isIcon: !0, theme: e, variant: I.Text, color: g.Primary, onClick: y, styles: {
|
|
111
111
|
transform: `rotate(${r === "vertical" ? "90" : "0"}deg)`
|
|
112
112
|
}, disabled: !b, "data-testid": `${o}-thumbnail-control-next`, children: /* @__PURE__ */ t(x, { ...p, ...O, fill: b ? m : u }) })
|
|
@@ -2,18 +2,7 @@ import { ReactElement, ReactNode, PropsWithChildren } from 'react';
|
|
|
2
2
|
import { EmblaOptionsType } from 'embla-carousel';
|
|
3
3
|
import { Theme } from '../../../hooks';
|
|
4
4
|
import { CommonCssComponentProps, CommonCssComponentStyledProps, ButtonProps } from '../..';
|
|
5
|
-
|
|
6
|
-
Cards = "cards",
|
|
7
|
-
Single = "single"
|
|
8
|
-
}
|
|
9
|
-
export declare enum LayoutType {
|
|
10
|
-
Horizontal = "horizontal",
|
|
11
|
-
Vertical = "vertical"
|
|
12
|
-
}
|
|
13
|
-
export declare enum ThumbsPosition {
|
|
14
|
-
Start = "start",
|
|
15
|
-
End = "end"
|
|
16
|
-
}
|
|
5
|
+
import { CarouselVariantTypes, LayoutType, ThumbsPosition } from '../../../types';
|
|
17
6
|
export type KeyboardHandler = () => void;
|
|
18
7
|
export type KeyboardConfig = Record<string, KeyboardHandler>;
|
|
19
8
|
export interface CarouselProps extends PropsWithChildren<CommonCssComponentProps> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as c } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { forwardRef as n } from "react";
|
|
3
3
|
import { get as o } from "../../../utils/helpers.js";
|
|
4
|
-
import { Button as
|
|
4
|
+
import { Button as d } from "../../core/Button/Button.js";
|
|
5
5
|
const S = n((s, e) => {
|
|
6
6
|
const {
|
|
7
7
|
theme: {
|
|
@@ -11,7 +11,7 @@ const S = n((s, e) => {
|
|
|
11
11
|
$variant: u,
|
|
12
12
|
styles: l,
|
|
13
13
|
...a
|
|
14
|
-
} = s, p = [o(t, "container", {}), o(t, `container.layout.${r}`, {}), o(t, `container.variant.${u}`, {}), l];
|
|
14
|
+
} = s, p = [o(t, "container.default", {}), o(t, `container.layout.${r}`, {}), o(t, `container.variant.${u}`, {}), l];
|
|
15
15
|
return /* @__PURE__ */ c("div", { css: p, ...a, ref: e });
|
|
16
16
|
}), C = n((s, e) => {
|
|
17
17
|
const {
|
|
@@ -78,7 +78,7 @@ const S = n((s, e) => {
|
|
|
78
78
|
} = {},
|
|
79
79
|
...t
|
|
80
80
|
} = s;
|
|
81
|
-
return /* @__PURE__ */ c(
|
|
81
|
+
return /* @__PURE__ */ c(d, { styles: o(e, "controlsButton", {}), ...t });
|
|
82
82
|
}, V = (s) => {
|
|
83
83
|
const {
|
|
84
84
|
theme: {
|
|
@@ -4,17 +4,17 @@ import { forwardRef as A, useRef as F, useImperativeHandle as j } from "react";
|
|
|
4
4
|
import { CarouselContainerStyled as E, CarouselControlsWrapperStyled as H, CarouselViewportStyled as L, CarouselViewportSlideWrapperStyled as M, CarouselDotsStyled as O, CarouselDotStyled as W, CarouselControlsButtonStyled as S } from "../Carousel/CarouselStyled.js";
|
|
5
5
|
import { COMPONENT_NAME as o } from "./constants.js";
|
|
6
6
|
import { ContentSlideStyled as _, CarouselFooterStyled as z, CarouselFooterControlsStyled as q } from "./ContentCarouselStyled.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { useCarousel as Q } from "../../../hooks/useCarousel/useCarousel.js";
|
|
7
|
+
import { useTheme as G } from "../../../hooks/useTheme/useTheme.js";
|
|
8
|
+
import { useCarousel as J } from "../../../hooks/useCarousel/useCarousel.js";
|
|
10
9
|
import { TabIndex as $ } from "../../../types/accesability.js";
|
|
10
|
+
import { CarouselVariantTypes as K, LayoutType as Q } from "../../../types/carousel.js";
|
|
11
11
|
import { ButtonColorVariant as v, ButtonVariant as x } from "../../../types/button.js";
|
|
12
12
|
import { Icon as b } from "../../core/Icon/Icon.js";
|
|
13
13
|
const U = A((w, I) => {
|
|
14
14
|
var y;
|
|
15
15
|
const {
|
|
16
16
|
theme: t
|
|
17
|
-
} =
|
|
17
|
+
} = G(), {
|
|
18
18
|
items: l,
|
|
19
19
|
renderItem: T,
|
|
20
20
|
showArrows: N = !0,
|
|
@@ -39,7 +39,7 @@ const U = A((w, I) => {
|
|
|
39
39
|
canScrollPrev: C,
|
|
40
40
|
canScrollNext: f,
|
|
41
41
|
slidesCount: k
|
|
42
|
-
} =
|
|
42
|
+
} = J({
|
|
43
43
|
options: {
|
|
44
44
|
axis: "x"
|
|
45
45
|
},
|
|
@@ -50,7 +50,7 @@ const U = A((w, I) => {
|
|
|
50
50
|
scrollNext: n,
|
|
51
51
|
scrollTo: s,
|
|
52
52
|
selectedIndex: a
|
|
53
|
-
}), [i, n, s, a]), /* @__PURE__ */ d(E, { ref: p, theme: t, styles: P, $layout:
|
|
53
|
+
}), [i, n, s, a]), /* @__PURE__ */ d(E, { ref: p, theme: t, styles: P, $layout: Q.Horizontal, $variant: K.Cards, tabIndex: R ? $.Default : $.Disabled, "data-testid": o, children: [
|
|
54
54
|
/* @__PURE__ */ e(H, { "data-testid": `${o}-controls-wrapper`, theme: t, children: /* @__PURE__ */ e(L, { theme: t, ref: g, "data-testid": `${o}-viewport`, children: /* @__PURE__ */ e(M, { theme: t, "data-testid": `${o}-slider-wrapper`, children: l == null ? void 0 : l.map((h, r) => /* @__PURE__ */ e(_, { theme: t, "data-testid": `${o}-content-slide-${r}`, children: T(h, r) }, r)) }) }) }),
|
|
55
55
|
/* @__PURE__ */ d(z, { theme: t, "data-testid": `${o}-footer`, children: [
|
|
56
56
|
D && /* @__PURE__ */ e(O, { theme: t, "data-testid": `${o}-dots`, children: (y = Array.from({
|
|
@@ -21,11 +21,11 @@ const T = ({
|
|
|
21
21
|
} = C(), h = () => {
|
|
22
22
|
a || x(o.value);
|
|
23
23
|
};
|
|
24
|
-
return o.tooltip ? /* @__PURE__ */ i(m, { content: o.tooltip, position: k.Top, styles: {}, children: /* @__PURE__ */ v(c, { selected: t, disabled: a, theme: r, $hex: o.hex, $image: o.image, $height:
|
|
24
|
+
return o.tooltip ? /* @__PURE__ */ i(m, { content: o.tooltip, position: k.Top, styles: {}, children: /* @__PURE__ */ v(c, { selected: t, disabled: a, theme: r, $hex: o.hex, $image: o.image, $height: $, $width: u, "data-testid": `${p}-${o.value}`, onClick: h, styles: l, children: [
|
|
25
25
|
/* @__PURE__ */ i(f, { name: e, theme: r, "data-testid": `${p}-input-${o.value}`, "aria-checked": t, "aria-disabled": a, value: o.value, checked: t, disabled: a, onChange: h }),
|
|
26
26
|
n && n,
|
|
27
27
|
!n && /* @__PURE__ */ i(g, { theme: r, selected: t, disabled: a, children: o.label })
|
|
28
|
-
] }) }) : /* @__PURE__ */ v(c, { selected: t, disabled: a, theme: r, $hex: o.hex, $image: o.image, $height:
|
|
28
|
+
] }) }) : /* @__PURE__ */ v(c, { selected: t, disabled: a, theme: r, $hex: o.hex, $image: o.image, $height: $, $width: u, "data-testid": `${p}-${o.value}`, onClick: h, styles: l, children: [
|
|
29
29
|
/* @__PURE__ */ i(f, { name: e, theme: r, value: o.value, checked: t, disabled: a, "data-testid": `${p}-input-${o.value}`, onChange: h, "aria-checked": t, "aria-disabled": a }),
|
|
30
30
|
n && n,
|
|
31
31
|
!n && /* @__PURE__ */ i(g, { theme: r, selected: t, disabled: a, children: o.label })
|
package/constants/positioning.js
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { jsx as a } from "@emotion/react/jsx-runtime";
|
|
3
|
+
import { useState as c, useCallback as d, createContext as y, useContext as N } from "react";
|
|
4
|
+
import { ThemeProvider as $ } from "@emotion/react";
|
|
5
|
+
import { get as T, size as g } from "../../utils/helpers.js";
|
|
6
|
+
import { defaultTheme as i } from "../../tokens/defaultTheme.js";
|
|
7
|
+
const u = y({
|
|
8
|
+
theme: i,
|
|
8
9
|
setTheme: () => {
|
|
9
10
|
console.warn("setTheme method is not implemented yet.");
|
|
10
11
|
},
|
|
11
12
|
addTheme: () => {
|
|
12
13
|
console.warn("addTheme method is not implemented yet.");
|
|
13
14
|
}
|
|
14
|
-
}),
|
|
15
|
+
}), E = (o) => {
|
|
15
16
|
const {
|
|
16
|
-
children:
|
|
17
|
-
initialTheme:
|
|
18
|
-
isDefault:
|
|
17
|
+
children: f,
|
|
18
|
+
initialTheme: n,
|
|
19
|
+
isDefault: p = !1
|
|
19
20
|
} = o;
|
|
20
21
|
let e, m;
|
|
21
|
-
|
|
22
|
-
[e]: n
|
|
23
|
-
}) : (e = c(i, "name", ""), m = e ? {
|
|
22
|
+
p ? (e = T(i, "name"), m = {
|
|
24
23
|
[e]: i
|
|
24
|
+
}) : (e = T(n, "name", ""), m = e ? {
|
|
25
|
+
[e]: n
|
|
25
26
|
} : {});
|
|
26
|
-
const [s,
|
|
27
|
+
const [s, x] = c(m), [v, r] = c(e), h = s[v], l = g(s), w = d((t = "") => {
|
|
27
28
|
s[t] ? r(t) : (r(e), console.warn(`Theme '${t}' does not exist.`));
|
|
28
|
-
}, [
|
|
29
|
-
s[t] ? console.warn(`Theme '${t}' already exist.`) :
|
|
30
|
-
[t]:
|
|
29
|
+
}, [l, e]), P = d((t, C) => {
|
|
30
|
+
s[t] ? console.warn(`Theme '${t}' already exist.`) : x((b) => Object.assign(b, {
|
|
31
|
+
[t]: C
|
|
31
32
|
}));
|
|
32
|
-
}, [
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
theme:
|
|
35
|
-
setTheme:
|
|
36
|
-
addTheme:
|
|
37
|
-
}, children:
|
|
38
|
-
},
|
|
39
|
-
const o = N(
|
|
33
|
+
}, [l]);
|
|
34
|
+
return /* @__PURE__ */ a(u.Provider, { value: {
|
|
35
|
+
theme: h,
|
|
36
|
+
setTheme: w,
|
|
37
|
+
addTheme: P
|
|
38
|
+
}, children: /* @__PURE__ */ a($, { theme: h, children: f }) });
|
|
39
|
+
}, O = () => {
|
|
40
|
+
const o = N(u);
|
|
40
41
|
if (!o)
|
|
41
42
|
throw new Error("useTheme could not be used outside ThemeProvider");
|
|
42
43
|
return o;
|
|
43
44
|
};
|
|
44
45
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
E as ThemeProvider,
|
|
47
|
+
O as useTheme
|
|
47
48
|
};
|