gd-design-library 1.0.2 → 1.2.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/README.md +2 -2
- package/ai/README.md +210 -16
- package/ai/schemas/components/Accordion.d.ts +84 -0
- package/ai/schemas/components/Button.d.ts +12 -0
- package/ai/schemas/components/ChatContainer.d.ts +0 -8
- package/ai/schemas/components/Column.d.ts +5 -5
- package/ai/schemas/components/InputFile.d.ts +17 -5
- package/ai/schemas/components/Menu.d.ts +37 -0
- package/ai/schemas/components/Row.d.ts +6 -6
- package/ai/schemas/components/Scroll.d.ts +7 -0
- package/ai/schemas/components/Typography.d.ts +0 -21
- package/assets/icons/account_circle.d.ts +1 -3
- package/assets/icons/account_circle.js +7 -14
- package/assets/icons/arrow-down.d.ts +2 -3
- package/assets/icons/arrow-down.js +6 -11
- package/assets/icons/arrow-forward.d.ts +1 -3
- package/assets/icons/arrow-forward.js +6 -13
- package/assets/icons/attachment.d.ts +1 -3
- package/assets/icons/attachment.js +7 -14
- package/assets/icons/check.d.ts +1 -3
- package/assets/icons/check.js +5 -11
- package/assets/icons/chevron-left.d.ts +1 -3
- package/assets/icons/chevron-left.js +7 -14
- package/assets/icons/chevron-right.d.ts +1 -3
- package/assets/icons/chevron-right.js +6 -13
- package/assets/icons/content-copy.d.ts +1 -3
- package/assets/icons/content-copy.js +7 -14
- package/assets/icons/delete_outlined.d.ts +1 -3
- package/assets/icons/delete_outlined.js +5 -12
- package/assets/icons/dot.d.ts +1 -3
- package/assets/icons/dot.js +5 -11
- package/assets/icons/error_outline.d.ts +1 -4
- package/assets/icons/error_outline.js +6 -18
- package/assets/icons/eye.d.ts +1 -3
- package/assets/icons/eye.js +7 -14
- package/assets/icons/file-copy.d.ts +1 -3
- package/assets/icons/file-copy.js +7 -13
- package/assets/icons/filter.d.ts +1 -3
- package/assets/icons/filter.js +6 -13
- package/assets/icons/folder.d.ts +1 -3
- package/assets/icons/folder.js +6 -13
- package/assets/icons/folderOpen.d.ts +1 -3
- package/assets/icons/folderOpen.js +7 -14
- package/assets/icons/home.d.ts +1 -3
- package/assets/icons/home.js +6 -13
- package/assets/icons/local_shipping.d.ts +1 -3
- package/assets/icons/local_shipping.js +4 -11
- package/assets/icons/minus.d.ts +1 -3
- package/assets/icons/minus.js +7 -13
- package/assets/icons/mobile_menu_button.d.ts +1 -3
- package/assets/icons/mobile_menu_button.js +7 -14
- package/assets/icons/paymentCard.d.ts +1 -3
- package/assets/icons/paymentCard.js +6 -13
- package/assets/icons/plus.d.ts +1 -3
- package/assets/icons/plus.js +5 -11
- package/assets/icons/portrait.d.ts +1 -3
- package/assets/icons/portrait.js +5 -12
- package/assets/icons/processing.d.ts +1 -3
- package/assets/icons/processing.js +6 -13
- package/assets/icons/ruler.d.ts +1 -3
- package/assets/icons/ruler.js +6 -13
- package/assets/icons/search.d.ts +1 -3
- package/assets/icons/search.js +6 -13
- package/assets/icons/shopping_bag.d.ts +1 -3
- package/assets/icons/shopping_bag.js +7 -14
- package/assets/icons/slash.d.ts +1 -3
- package/assets/icons/slash.js +6 -13
- package/assets/icons/star.d.ts +1 -3
- package/assets/icons/star.js +6 -12
- package/assets/icons/starOutlined.d.ts +1 -3
- package/assets/icons/starOutlined.js +5 -11
- package/assets/icons/toast_error.d.ts +1 -3
- package/assets/icons/toast_error.js +9 -15
- package/assets/icons/toast_info.d.ts +1 -3
- package/assets/icons/toast_info.js +7 -13
- package/assets/icons/toast_warning.d.ts +1 -3
- package/assets/icons/toast_warning.js +7 -13
- package/assets/icons/upload.d.ts +1 -3
- package/assets/icons/upload.js +6 -13
- package/assets/icons/volume-up.d.ts +1 -3
- package/assets/icons/volume-up.js +6 -13
- package/assets/icons/wifiTethering.d.ts +1 -3
- package/assets/icons/wifiTethering.js +4 -11
- package/components/core/Button/Button.js +30 -27
- package/components/core/Button/Button.types.d.ts +2 -2
- package/components/core/Button/ButtonStyled.js +40 -39
- package/components/core/Dropdown/Dropdown.d.ts +1 -1
- package/components/core/Dropdown/Dropdown.js +16 -16
- package/components/core/Dropdown/Dropdown.types.d.ts +3 -3
- package/components/core/Dropdown/DropdownStyled.js +13 -14
- package/components/core/Icon/Icon.js +41 -33
- package/components/core/Icon/Icon.types.d.ts +2 -1
- package/components/core/Icon/constants.d.ts +37 -109
- package/components/core/Input/Input.d.ts +1 -1
- package/components/core/InputFile/InputFile.d.ts +0 -32
- package/components/core/InputFile/InputFile.js +47 -33
- package/components/core/InputFile/InputFileStyled.js +24 -22
- package/components/core/Loader/Loader.js +19 -17
- package/components/core/Loader/Loader.types.d.ts +3 -1
- package/components/core/Loader/LoaderStyled.js +34 -30
- package/components/core/Menu/Menu.d.ts +2 -2
- package/components/core/Menu/Menu.js +113 -93
- package/components/core/Menu/Menu.types.d.ts +16 -11
- package/components/core/Menu/MenuStyled.d.ts +1 -1
- package/components/core/Menu/constants.js +4 -12
- package/components/core/Modal/Modal.js +60 -36
- package/components/core/Modal/ModalStyled.js +21 -22
- package/components/core/Scroll/Scroll.d.ts +6 -0
- package/components/core/Scroll/Scroll.js +53 -31
- package/components/core/Scroll/Scroll.types.d.ts +5 -0
- package/components/core/Scroll/ScrollBar.js +45 -43
- package/components/core/Scroll/ScrollStyled.js +46 -42
- package/components/core/Scroll/constants.d.ts +2 -0
- package/components/core/Scroll/constants.js +6 -4
- package/components/core/Select/Select.js +162 -134
- package/components/core/Select/Select.types.d.ts +2 -4
- package/components/core/Snackbar/Snackbar.js +60 -37
- package/components/core/Snackbar/Snackbar.types.d.ts +1 -2
- package/components/core/Snackbar/SnackbarManager.js +45 -30
- package/components/core/Snackbar/SnackbarStyled.d.ts +5 -5
- package/components/core/Snackbar/SnackbarStyled.js +111 -101
- package/components/core/Textarea/Textarea.d.ts +4 -0
- package/components/core/Tooltip/Tooltip.js +68 -44
- package/components/core/Tooltip/TooltipStyled.js +26 -27
- package/components/core/Tooltip/utils.js +47 -45
- package/components/core/Typography/Typography.js +18 -18
- package/components/core/Typography/Typography.types.d.ts +3 -3
- package/components/core/Typography/TypographyStyled.js +28 -29
- package/components/domainSpecific/Accordion/Accordion.d.ts +1 -1
- package/components/domainSpecific/Accordion/Accordion.js +19 -17
- package/components/domainSpecific/Accordion/Accordion.types.d.ts +7 -4
- package/components/domainSpecific/Accordion/AccordionContent/AccordionContent.d.ts +1 -1
- package/components/domainSpecific/Accordion/AccordionContent/AccordionContent.js +13 -12
- package/components/domainSpecific/Accordion/AccordionHeader/AccordionHeader.d.ts +1 -1
- package/components/domainSpecific/Accordion/AccordionHeader/AccordionHeader.js +15 -14
- package/components/domainSpecific/Accordion/AccordionItem/AccordionItem.d.ts +1 -1
- package/components/domainSpecific/Accordion/AccordionItem/AccordionItem.js +18 -16
- package/components/domainSpecific/Accordion/AccordionStyled.js +44 -35
- package/components/domainSpecific/Card/Card.js +31 -27
- package/components/domainSpecific/Card/CardTitle/constants.js +4 -4
- package/components/domainSpecific/Header/Header.js +4 -4
- package/components/domainSpecific/SearchModal/SearchModal.js +0 -1
- package/components/domainSpecific/SearchModal/SearchModal.types.d.ts +1 -1
- package/components/index.types.d.ts +1 -0
- package/components/layout/ChatContainer/ChatContainer.d.ts +1 -1
- package/components/layout/ChatContainer/ChatContainer.js +58 -41
- package/components/layout/ChatContainer/ChatContainer.types.d.ts +8 -5
- package/components/layout/ChatContainer/ChatContainerStyled.d.ts +2 -0
- package/components/layout/ChatContainer/ChatContainerStyled.js +105 -84
- package/components/layout/Column/Column.types.d.ts +3 -1
- package/components/layout/Column/ColumnStyled.js +23 -23
- package/components/layout/FlexContainer/FlexContainerStyled.js +7 -8
- package/components/layout/Row/Row.d.ts +1 -1
- package/components/layout/Row/Row.js +20 -20
- package/components/layout/Row/Row.types.d.ts +3 -1
- package/components/layout/Row/RowStyled.js +26 -26
- package/constants/index.d.ts +0 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/useLogger/NoOpLogger.d.ts +11 -0
- package/hooks/useLogger/NoOpLogger.js +15 -0
- package/hooks/useLogger/index.d.ts +2 -0
- package/hooks/useLogger/useLogger.d.ts +4 -0
- package/hooks/useLogger/useLogger.js +27 -0
- package/hooks/useLogger/useLogger.types.d.ts +30 -0
- package/hooks/useTheme/NoOpTheme.d.ts +4050 -0
- package/hooks/useTheme/NoOpTheme.js +15 -0
- package/hooks/useTheme/useTheme.d.ts +3 -4
- package/hooks/useTheme/useTheme.js +62 -41
- package/hooks/useTheme/useTheme.types.d.ts +3 -2
- package/index.d.ts +4 -0
- package/index.js +354 -350
- package/llms.txt +39 -19
- package/package.json +1 -1
- package/tokens/accordion.d.ts +9 -3
- package/tokens/accordion.js +14 -11
- package/tokens/button.d.ts +17 -19
- package/tokens/button.js +54 -56
- package/tokens/card.d.ts +2 -3
- package/tokens/card.js +50 -53
- package/tokens/carousel.d.ts +2 -2
- package/tokens/carousel.js +8 -9
- package/tokens/chat.d.ts +69 -48
- package/tokens/chat.js +86 -68
- package/tokens/constants.d.ts +0 -1
- package/tokens/constants.js +1 -1
- package/tokens/defaultTheme.d.ts +199 -112
- package/tokens/defaultTheme.js +27 -25
- package/tokens/header.d.ts +1 -1
- package/tokens/header.js +3 -4
- package/tokens/index.d.ts +175 -104
- package/tokens/index.js +102 -101
- package/tokens/input.d.ts +2 -2
- package/tokens/input.js +25 -26
- package/tokens/inputfile.d.ts +1 -1
- package/tokens/inputfile.js +4 -4
- package/tokens/link.d.ts +5 -0
- package/tokens/loader.d.ts +3 -0
- package/tokens/loader.js +3 -0
- package/tokens/menu.d.ts +1 -0
- package/tokens/menu.js +1 -0
- package/tokens/modal.d.ts +6 -4
- package/tokens/modal.js +42 -60
- package/tokens/scroll.d.ts +19 -2
- package/tokens/scroll.js +23 -7
- package/tokens/select.d.ts +9 -7
- package/tokens/select.js +30 -29
- package/tokens/snackbar.d.ts +36 -20
- package/tokens/snackbar.js +92 -93
- package/tokens/stepper.d.ts +1 -1
- package/tokens/stepper.js +3 -3
- package/tokens/tabs.d.ts +1 -1
- package/tokens/tabs.js +1 -1
- package/tokens/textarea.d.ts +4 -0
- package/tokens/tooltip.d.ts +5 -1
- package/tokens/tooltip.js +23 -21
- package/tokens/typography.js +114 -116
- package/tokens/values.d.ts +5 -1
- package/tokens/values.js +12 -8
- package/tokens/wrapper.d.ts +2 -2
- package/tokens/wrapper.js +7 -7
- package/tokens/zIndex.d.ts +9 -0
- package/tokens/zIndex.js +12 -0
- package/types/index.d.ts +0 -1
- package/types/styles.d.ts +1 -0
- package/utils/helpers.js +14 -15
- package/CHANGELOG.md +0 -177
- package/constants/positioning.d.ts +0 -9
- package/constants/positioning.js +0 -11
- package/types/chat.d.ts +0 -5
- package/types/chat.js +0 -4
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { getAnimationDataByName as z } from "./utils.js";
|
|
6
|
-
import { WrapperVariant as A } from "../../../types/wrapper.js";
|
|
7
|
-
import { SizeVariant as B } from "../../../types/common.js";
|
|
1
|
+
import { jsxs as N, jsx as P } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as V } from "react";
|
|
3
|
+
import { getBoxStyles as b, tokensHandler as j } from "../../../tokens/utils.js";
|
|
4
|
+
import { getAnimationDataByName as A } from "./utils.js";
|
|
8
5
|
import { get as t } from "../../../utils/helpers.js";
|
|
9
|
-
|
|
6
|
+
import { WrapperVariant as B } from "../../../types/wrapper.js";
|
|
7
|
+
import { SizeVariant as L } from "../../../types/common.js";
|
|
8
|
+
const M = V(({
|
|
9
|
+
theme: {
|
|
10
|
+
loader: a,
|
|
11
|
+
animations: n,
|
|
12
|
+
...e
|
|
13
|
+
} = {},
|
|
14
|
+
styles: m,
|
|
15
|
+
$name: o,
|
|
16
|
+
$variant: s = B.Inline,
|
|
17
|
+
$size: d = L.Md,
|
|
18
|
+
$animationProps: p,
|
|
19
|
+
children: f,
|
|
20
|
+
$rounded: c,
|
|
21
|
+
...l
|
|
22
|
+
}, y) => {
|
|
10
23
|
const {
|
|
11
|
-
theme: {
|
|
12
|
-
loader: i,
|
|
13
|
-
animations: s,
|
|
14
|
-
...m
|
|
15
|
-
} = {},
|
|
16
|
-
styles: p,
|
|
17
|
-
$name: o,
|
|
18
|
-
$variant: l = A.Inline,
|
|
19
|
-
$size: c = B.Md,
|
|
20
|
-
$animationProps: d,
|
|
21
|
-
children: f,
|
|
22
|
-
...y
|
|
23
|
-
} = n, {
|
|
24
24
|
boxStyles: x,
|
|
25
|
-
restProps:
|
|
26
|
-
} =
|
|
27
|
-
animation:
|
|
25
|
+
restProps: u
|
|
26
|
+
} = b(l), r = new Proxy(a || {}, j(e)), S = t(r, ["animation", o, "name"], ""), g = t(n, S, {}), {
|
|
27
|
+
animation: i,
|
|
28
28
|
AnimationView: h
|
|
29
|
-
} =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
} = A(o, g, p), w = [t(r, "default", {}), t(r, s, {}), t(r, [o, "default"], {}), t(r, [o, d], {}), o !== "circle" ? {
|
|
30
|
+
".dot": {
|
|
31
|
+
borderRadius: t(e, ["radius", c], "0px")
|
|
32
|
+
}
|
|
33
|
+
} : {}, ...i ? [{
|
|
34
|
+
animation: i
|
|
35
|
+
}] : [], x, m];
|
|
36
|
+
return /* @__PURE__ */ N("span", { css: w, ...u, ref: y, children: [
|
|
37
|
+
/* @__PURE__ */ P(h, {}),
|
|
34
38
|
f
|
|
35
39
|
] });
|
|
36
40
|
});
|
|
37
41
|
export {
|
|
38
|
-
|
|
42
|
+
M as LoaderStyled
|
|
39
43
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MenuProps } from './
|
|
2
|
-
export declare const Menu: import('react').ForwardRefExoticComponent<MenuProps
|
|
1
|
+
import { MenuProps, MenuRef } from './';
|
|
2
|
+
export declare const Menu: import('react').ForwardRefExoticComponent<MenuProps & import('react').RefAttributes<MenuRef>>;
|
|
@@ -1,106 +1,126 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import {
|
|
5
|
-
import { MenuTriggerStyled as
|
|
6
|
-
import { useAnimationFrame as
|
|
7
|
-
import { SelectContext as
|
|
8
|
-
import { convertToInlineBoxStyles as
|
|
9
|
-
import { useTheme as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
2
|
+
import { jsxs as X, jsx as x } from "@emotion/react/jsx-runtime";
|
|
3
|
+
import { forwardRef as K, useState as y, useRef as H, useCallback as L, useEffect as U, useImperativeHandle as W } from "react";
|
|
4
|
+
import { EMPTY_CLIENT_RECT as j, COMPONENT_NAME as m } from "./constants.js";
|
|
5
|
+
import { MenuTriggerStyled as G, MenuContentStyled as R } from "./MenuStyled.js";
|
|
6
|
+
import { useAnimationFrame as V } from "../../../utils/animationFrame.js";
|
|
7
|
+
import { SelectContext as q } from "../Select/hooks/useSelectContext.js";
|
|
8
|
+
import { convertToInlineBoxStyles as z } from "../../../tokens/utils.js";
|
|
9
|
+
import { useTheme as J } from "../../../hooks/useTheme/useTheme.js";
|
|
10
|
+
import { useLogger as Q } from "../../../hooks/useLogger/useLogger.js";
|
|
11
|
+
import { Portal as Z } from "../Portal/Portal.js";
|
|
12
|
+
import { KEYBOARD_KEYS as ee } from "../../../constants/keyboard.js";
|
|
13
|
+
const n = 4, te = 400, oe = 80, ne = K(({
|
|
14
|
+
onSelect: a,
|
|
15
|
+
children: A,
|
|
16
|
+
content: Y,
|
|
17
|
+
itemIdentifier: I = (f, r) => (f == null ? void 0 : f.value) === (r == null ? void 0 : r.value),
|
|
18
|
+
closeOnSelect: M = !0,
|
|
19
|
+
placement: _,
|
|
20
|
+
...$
|
|
21
|
+
}, v) => {
|
|
13
22
|
const {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
content: k,
|
|
17
|
-
options: x = {},
|
|
18
|
-
itemIdentifier: R = (t, n) => (t == null ? void 0 : t.value) === (n == null ? void 0 : n.value),
|
|
19
|
-
...y
|
|
20
|
-
} = S, {
|
|
21
|
-
theme: C
|
|
22
|
-
} = Q(), [B, L] = M(), a = Y(() => ({
|
|
23
|
-
...j,
|
|
24
|
-
...x
|
|
25
|
-
}), [JSON.stringify(x)]), r = h(null), o = h(null), b = h(), _ = h({
|
|
23
|
+
theme: f
|
|
24
|
+
} = J(), r = Q(), [l, g] = y(!1), [i, P] = y(), [N, E] = y(), p = H(null), s = H(null), S = H({
|
|
26
25
|
top: 0,
|
|
27
|
-
left: 0
|
|
28
|
-
|
|
29
|
-
}), [u, f] = M(!1), A = O(({
|
|
26
|
+
left: 0
|
|
27
|
+
}), F = L(({
|
|
30
28
|
width: t,
|
|
31
|
-
height:
|
|
29
|
+
height: e
|
|
32
30
|
}) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
31
|
+
const o = p.current ? p.current.getBoundingClientRect() : j, w = window.innerWidth, d = window.innerHeight, h = window.scrollX || window.pageXOffset || 0, k = window.scrollY || window.pageYOffset || 0, O = _ || "bottom-right";
|
|
32
|
+
let c, u;
|
|
33
|
+
switch (O) {
|
|
34
|
+
case "top-left": {
|
|
35
|
+
c = o.left - t, u = o.top - e - n;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case "top-right": {
|
|
39
|
+
c = o.right + n, u = o.top - e - n;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case "bottom-left": {
|
|
43
|
+
c = o.left - t, u = o.bottom + n;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case "bottom-right": {
|
|
47
|
+
c = o.right + n, u = o.bottom + n;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return c + t > w && (c = w - t - n), c < 0 && (c = n), u + e > d && (u = d - e - n), u < 0 && (u = n), {
|
|
52
|
+
left: c + h,
|
|
53
|
+
top: u + k
|
|
54
|
+
};
|
|
55
|
+
}, [_]), C = L(({
|
|
56
|
+
event: t,
|
|
57
|
+
data: e
|
|
58
|
+
}) => {
|
|
59
|
+
r.debug(`${m}: Select`, {
|
|
60
|
+
value: e == null ? void 0 : e.value,
|
|
61
|
+
name: e == null ? void 0 : e.name,
|
|
62
|
+
previousValue: i == null ? void 0 : i.value,
|
|
63
|
+
previousName: i == null ? void 0 : i.name
|
|
64
|
+
}), a == null || a({
|
|
57
65
|
event: t,
|
|
58
|
-
data:
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
data: e
|
|
67
|
+
}), P(e), M && g(!1);
|
|
68
|
+
}, [a, M, i]), B = L(() => {
|
|
69
|
+
g((t) => {
|
|
70
|
+
const e = !t;
|
|
71
|
+
return r.debug(`${m}: ${e ? "Open" : "Close"}`, {
|
|
72
|
+
trigger: "toggle"
|
|
73
|
+
}), e;
|
|
74
|
+
});
|
|
75
|
+
}, []), D = {
|
|
76
|
+
onSelect: C,
|
|
77
|
+
value: i,
|
|
78
|
+
itemIdentifier: I
|
|
79
|
+
}, b = (t) => {
|
|
80
|
+
var e;
|
|
81
|
+
((e = v == null ? void 0 : v.current) != null && e.isOpen || l) && t.key === ee.ESCAPE && (r.debug(`${m}: Close`, {
|
|
82
|
+
trigger: "escape"
|
|
83
|
+
}), g(!1));
|
|
84
|
+
}, T = (t) => {
|
|
85
|
+
var e, o;
|
|
86
|
+
!((e = p == null ? void 0 : p.current) != null && e.contains(N || t.target)) && !((o = s == null ? void 0 : s.current) != null && o.contains(t.target)) && (r.debug(`${m}: Close`, {
|
|
87
|
+
trigger: "outsideClick"
|
|
88
|
+
}), g(!1), E(null));
|
|
89
|
+
};
|
|
90
|
+
return U(() => (l ? (document.addEventListener("keydown", b), document.addEventListener("mousedown", T)) : (document.removeEventListener("keydown", b), document.removeEventListener("mousedown", T)), () => {
|
|
91
|
+
document.removeEventListener("keydown", b), document.removeEventListener("mousedown", T);
|
|
92
|
+
}), [l]), V(() => {
|
|
93
|
+
if (s.current && l) {
|
|
94
|
+
const t = s.current.getBoundingClientRect(), {
|
|
73
95
|
top: e,
|
|
74
|
-
left:
|
|
75
|
-
} =
|
|
76
|
-
|
|
77
|
-
maxHeight: m
|
|
78
|
-
} = a, l = i < n.right && t.right > n.left && e < 2 * c ? n.top - 2 * c : window.innerHeight - e - c;
|
|
79
|
-
_.current = {
|
|
96
|
+
left: o
|
|
97
|
+
} = F(t), w = window.innerHeight, d = window.scrollY || window.pageYOffset || 0, h = e - d, k = w - h - n, O = Math.max(oe, Math.min(te, k));
|
|
98
|
+
S.current = {
|
|
80
99
|
top: e,
|
|
81
|
-
left:
|
|
82
|
-
|
|
83
|
-
}, o.current && (o.current.style.left = `${i}px`, o.current.style.top = `${e}px`, o.current.style.maxHeight = `${Math.min(m, l)}px`);
|
|
100
|
+
left: o
|
|
101
|
+
}, s.current && (s.current.style.left = `${o}px`, s.current.style.top = `${e}px`, s.current.style.maxHeight = `${O}px`);
|
|
84
102
|
}
|
|
85
|
-
}),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
}), W(v, () => ({
|
|
104
|
+
ref: p,
|
|
105
|
+
isOpen: l,
|
|
106
|
+
selectedValue: i,
|
|
107
|
+
onSelect: C,
|
|
108
|
+
open: (t) => {
|
|
109
|
+
r.debug(`${m}: Open`, {
|
|
110
|
+
trigger: "ref"
|
|
111
|
+
}), !l && (E(t || null), g(!0));
|
|
112
|
+
},
|
|
113
|
+
close: (t) => {
|
|
114
|
+
r.debug(`${m}: Close`, {
|
|
115
|
+
trigger: "ref"
|
|
116
|
+
}), l && (E(t || null), g(!1));
|
|
117
|
+
}
|
|
118
|
+
}), [l, i, C]), /* @__PURE__ */ X(q.Provider, { value: D, children: [
|
|
119
|
+
/* @__PURE__ */ x(G, { onClick: B, theme: f, ref: p, "data-testid": m, ...$, children: A }),
|
|
120
|
+
l && /* @__PURE__ */ x(Z, { withWrapper: !1, children: /* @__PURE__ */ x(R, { ref: s, "data-testid": m, theme: f, ...z($), children: Y }) })
|
|
101
121
|
] });
|
|
102
122
|
});
|
|
103
|
-
|
|
123
|
+
ne.displayName = m;
|
|
104
124
|
export {
|
|
105
|
-
|
|
125
|
+
ne as Menu
|
|
106
126
|
};
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type VerticalAlignment = 'bottom' | 'top';
|
|
7
|
-
export interface MenuProps<T> extends Partial<Pick<SelectProps<T>, 'styles' | 'onSelect' | 'itemIdentifier' | 'children'>> {
|
|
8
|
-
title?: string;
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
import { BoxCssComponentProps, CommonCssComponentStyledProps, Option, SelectOnSelect, ItemIdentifier } from '../..';
|
|
3
|
+
export type MenuPlacement = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
4
|
+
export interface MenuProps extends Omit<BoxCssComponentProps, 'content' | 'onSelect'> {
|
|
5
|
+
itemIdentifier?: ItemIdentifier;
|
|
9
6
|
content?: ReactNode;
|
|
10
|
-
|
|
7
|
+
onSelect?: SelectOnSelect;
|
|
8
|
+
closeOnSelect?: boolean;
|
|
9
|
+
placement?: MenuPlacement;
|
|
11
10
|
}
|
|
12
|
-
export interface
|
|
13
|
-
|
|
11
|
+
export interface MenuRef {
|
|
12
|
+
ref: Ref<HTMLDivElement>;
|
|
13
|
+
selectedValue?: Option | null;
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
onSelect: SelectOnSelect;
|
|
16
|
+
open: (target?: EventTarget | null) => void;
|
|
17
|
+
close: (target?: EventTarget | null) => void;
|
|
14
18
|
}
|
|
19
|
+
export type MenuTriggerStyledProps = CommonCssComponentStyledProps;
|
|
15
20
|
export type MenuContentStyledProps = CommonCssComponentStyledProps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MenuTriggerStyledProps, MenuContentStyledProps } from './Menu.types';
|
|
2
|
-
export declare const MenuTriggerStyled: import('react').ForwardRefExoticComponent<MenuTriggerStyledProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
2
|
+
export declare const MenuTriggerStyled: import('react').ForwardRefExoticComponent<Omit<MenuTriggerStyledProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
3
3
|
export declare const MenuContentStyled: import('react').ForwardRefExoticComponent<Omit<MenuContentStyledProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o = "Menu", t = {
|
|
2
2
|
bottom: 0,
|
|
3
3
|
height: 0,
|
|
4
4
|
left: 0,
|
|
@@ -7,18 +7,10 @@ const i = "Menu", t = {
|
|
|
7
7
|
width: 0,
|
|
8
8
|
x: 0,
|
|
9
9
|
y: 0
|
|
10
|
-
}, o = {
|
|
11
|
-
...t
|
|
12
10
|
}, e = {
|
|
13
|
-
|
|
14
|
-
direction: null,
|
|
15
|
-
limitWidth: "auto",
|
|
16
|
-
maxHeight: 400,
|
|
17
|
-
minHeight: 80,
|
|
18
|
-
offset: 4
|
|
11
|
+
...t
|
|
19
12
|
};
|
|
20
13
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
e as MENU_DEFAULT_OPTIONS
|
|
14
|
+
o as COMPONENT_NAME,
|
|
15
|
+
e as EMPTY_CLIENT_RECT
|
|
24
16
|
};
|
|
@@ -1,47 +1,71 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { COMPONENT_NAME as
|
|
5
|
-
import { ModalOverlayStyled as
|
|
6
|
-
import { useTheme as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
2
|
+
import { jsx as a, jsxs as g, Fragment as T } from "@emotion/react/jsx-runtime";
|
|
3
|
+
import { forwardRef as x, useEffect as u, useCallback as h } from "react";
|
|
4
|
+
import { COMPONENT_NAME as t } from "./constants.js";
|
|
5
|
+
import { ModalOverlayStyled as N, ModalContentStyled as P, ModalHeaderStyled as A, ModalTitleStyled as B, CloseButtonStyled as F, ModalBodyStyled as K, ModalFooterStyled as L } from "./ModalStyled.js";
|
|
6
|
+
import { useTheme as j } from "../../../hooks/useTheme/useTheme.js";
|
|
7
|
+
import { useLogger as D } from "../../../hooks/useLogger/useLogger.js";
|
|
8
|
+
import { get as p } from "../../../utils/helpers.js";
|
|
9
|
+
import { Portal as H } from "../Portal/Portal.js";
|
|
10
|
+
import { convertToInlineBoxStyles as I } from "../../../tokens/utils.js";
|
|
11
|
+
import { Icon as R } from "../Icon/Icon.js";
|
|
12
|
+
import { KEYBOARD_KEYS as Y } from "../../../constants/keyboard.js";
|
|
13
|
+
const _ = x(({
|
|
14
|
+
isOpen: o = !1,
|
|
15
|
+
isCustomView: f = !1,
|
|
16
|
+
onClose: r,
|
|
17
|
+
showCloseButton: i = !0,
|
|
18
|
+
closeOnEscape: c,
|
|
19
|
+
title: e,
|
|
20
|
+
children: y,
|
|
21
|
+
footer: m,
|
|
22
|
+
styles: s,
|
|
23
|
+
...S
|
|
24
|
+
}, k) => {
|
|
13
25
|
const {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
theme: d
|
|
27
|
+
} = j(), l = D(), b = p(d, "modal.icons", {}), M = e || !!(i && r);
|
|
28
|
+
u(() => {
|
|
29
|
+
o && l.debug(`${t}: Open`, {
|
|
30
|
+
title: e,
|
|
31
|
+
isCustomView: f,
|
|
32
|
+
showCloseButton: i,
|
|
33
|
+
closeOnEscape: c,
|
|
34
|
+
hasFooter: !!m
|
|
35
|
+
});
|
|
36
|
+
}, [o, e, f, i, c, m]);
|
|
37
|
+
const $ = h(() => {
|
|
38
|
+
l.debug(`${t}: Close`, {
|
|
39
|
+
title: e,
|
|
40
|
+
trigger: "overlay"
|
|
41
|
+
}), r == null || r();
|
|
42
|
+
}, [r, e]), v = h(() => {
|
|
43
|
+
l.debug(`${t}: Close`, {
|
|
44
|
+
title: e,
|
|
45
|
+
trigger: "closeButton"
|
|
46
|
+
}), r == null || r();
|
|
47
|
+
}, [r, e]);
|
|
48
|
+
return u(() => {
|
|
49
|
+
if (!c) return;
|
|
50
|
+
const n = (E) => {
|
|
51
|
+
r && E.key === Y.ESCAPE && (l.debug(`${t}: Close`, {
|
|
52
|
+
title: e,
|
|
53
|
+
trigger: "escape"
|
|
54
|
+
}), r());
|
|
31
55
|
};
|
|
32
56
|
return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
33
|
-
}, [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
57
|
+
}, [o, c, r, e]), o ? /* @__PURE__ */ a(H, { blocksScroll: !0, children: /* @__PURE__ */ a(N, { onClick: $, theme: d, children: /* @__PURE__ */ a(P, { ref: k, onClick: (n) => n.stopPropagation(), "data-testid": t, theme: d, styles: s, ...I(S), children: f ? y : /* @__PURE__ */ g(T, { children: [
|
|
58
|
+
M && /* @__PURE__ */ g(A, { theme: d, $withTitle: !!e, "data-testid": `${t}-header`, children: [
|
|
59
|
+
e && /* @__PURE__ */ a(B, { theme: d, "data-testid": `${t}-title`, children: e }),
|
|
60
|
+
i && r && /* @__PURE__ */ a(F, { onClick: v, "data-testid": "close-button", theme: d, children: /* @__PURE__ */ a(R, { ...p(b, "close", {
|
|
37
61
|
name: "cross"
|
|
38
62
|
}) }) })
|
|
39
63
|
] }),
|
|
40
|
-
|
|
41
|
-
|
|
64
|
+
y && /* @__PURE__ */ a(K, { theme: d, "data-testid": `${t}-body`, children: y }),
|
|
65
|
+
m && /* @__PURE__ */ a(L, { theme: d, "data-testid": `${t}-footer`, children: m })
|
|
42
66
|
] }) }) }) }) : null;
|
|
43
67
|
});
|
|
44
|
-
|
|
68
|
+
_.displayName = t;
|
|
45
69
|
export {
|
|
46
|
-
|
|
70
|
+
_ as Modal
|
|
47
71
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { jsx as m } from "@emotion/react/jsx-runtime";
|
|
3
2
|
import { forwardRef as u } from "react";
|
|
4
3
|
import { getBoxStyles as p, tokensHandler as a } from "../../../tokens/utils.js";
|
|
@@ -7,93 +6,93 @@ const M = (t) => {
|
|
|
7
6
|
const {
|
|
8
7
|
theme: {
|
|
9
8
|
modal: e,
|
|
10
|
-
...
|
|
9
|
+
...o
|
|
11
10
|
} = {},
|
|
12
|
-
styles:
|
|
11
|
+
styles: s,
|
|
13
12
|
...r
|
|
14
13
|
} = t, {
|
|
15
14
|
boxStyles: l,
|
|
16
15
|
restProps: n
|
|
17
|
-
} = p(r), d = new Proxy(e || {}, a(
|
|
16
|
+
} = p(r), d = new Proxy(e || {}, a(o)), c = [y(d, "overlay.default", {}), l, s];
|
|
18
17
|
return /* @__PURE__ */ m("div", { css: c, ...n });
|
|
19
18
|
}, w = u((t, e) => {
|
|
20
19
|
const {
|
|
21
20
|
theme: {
|
|
22
|
-
modal:
|
|
23
|
-
...
|
|
21
|
+
modal: o,
|
|
22
|
+
...s
|
|
24
23
|
} = {},
|
|
25
24
|
styles: r = {},
|
|
26
25
|
...l
|
|
27
26
|
} = t, {
|
|
28
27
|
boxStyles: n,
|
|
29
28
|
restProps: d
|
|
30
|
-
} = p(l), c = new Proxy(
|
|
29
|
+
} = p(l), c = new Proxy(o || {}, a(s)), S = [y(c, "content.default", {}), n, r];
|
|
31
30
|
return /* @__PURE__ */ m("div", { css: S, ...d, ref: e });
|
|
32
31
|
}), b = (t) => {
|
|
33
32
|
const {
|
|
34
33
|
theme: {
|
|
35
34
|
modal: e,
|
|
36
|
-
...
|
|
35
|
+
...o
|
|
37
36
|
} = {},
|
|
38
|
-
$withTitle:
|
|
37
|
+
$withTitle: s,
|
|
39
38
|
styles: r,
|
|
40
39
|
...l
|
|
41
40
|
} = t, {
|
|
42
41
|
boxStyles: n,
|
|
43
42
|
restProps: d
|
|
44
|
-
} = p(l), c = new Proxy(e || {}, a(
|
|
43
|
+
} = p(l), c = new Proxy(e || {}, a(o)), S = y(c, "header", {}), P = [y(S, "default", {}), s ? y(S, "withTitle", {}) : {}, n, r];
|
|
45
44
|
return /* @__PURE__ */ m("div", { css: P, ...d });
|
|
46
45
|
}, v = (t) => {
|
|
47
46
|
const {
|
|
48
47
|
theme: {
|
|
49
48
|
modal: e,
|
|
50
|
-
...
|
|
49
|
+
...o
|
|
51
50
|
} = {},
|
|
52
|
-
styles:
|
|
51
|
+
styles: s,
|
|
53
52
|
...r
|
|
54
53
|
} = t, {
|
|
55
54
|
boxStyles: l,
|
|
56
55
|
restProps: n
|
|
57
|
-
} = p(r), d = new Proxy(e || {}, a(
|
|
56
|
+
} = p(r), d = new Proxy(e || {}, a(o)), c = [y(d, "title.default", {}), l, s];
|
|
58
57
|
return /* @__PURE__ */ m("div", { css: c, ...n });
|
|
59
58
|
}, N = (t) => {
|
|
60
59
|
const {
|
|
61
60
|
theme: {
|
|
62
61
|
modal: e,
|
|
63
|
-
...
|
|
62
|
+
...o
|
|
64
63
|
} = {},
|
|
65
|
-
styles:
|
|
64
|
+
styles: s,
|
|
66
65
|
...r
|
|
67
66
|
} = t, {
|
|
68
67
|
boxStyles: l,
|
|
69
68
|
restProps: n
|
|
70
|
-
} = p(r), d = new Proxy(e || {}, a(
|
|
69
|
+
} = p(r), d = new Proxy(e || {}, a(o)), c = [y(d, "body.default", {}), l, s];
|
|
71
70
|
return /* @__PURE__ */ m("div", { css: c, ...n });
|
|
72
71
|
}, B = (t) => {
|
|
73
72
|
const {
|
|
74
73
|
theme: {
|
|
75
74
|
modal: e,
|
|
76
|
-
...
|
|
75
|
+
...o
|
|
77
76
|
} = {},
|
|
78
|
-
styles:
|
|
77
|
+
styles: s,
|
|
79
78
|
...r
|
|
80
79
|
} = t, {
|
|
81
80
|
boxStyles: l,
|
|
82
81
|
restProps: n
|
|
83
|
-
} = p(r), d = new Proxy(e || {}, a(
|
|
82
|
+
} = p(r), d = new Proxy(e || {}, a(o)), c = [y(d, "footer.default", {}), l, s];
|
|
84
83
|
return /* @__PURE__ */ m("div", { css: c, ...n });
|
|
85
84
|
}, T = (t) => {
|
|
86
85
|
const {
|
|
87
86
|
theme: {
|
|
88
87
|
modal: e,
|
|
89
|
-
...
|
|
88
|
+
...o
|
|
90
89
|
} = {},
|
|
91
|
-
styles:
|
|
90
|
+
styles: s,
|
|
92
91
|
...r
|
|
93
92
|
} = t, {
|
|
94
93
|
boxStyles: l,
|
|
95
94
|
restProps: n
|
|
96
|
-
} = p(r), d = new Proxy(e || {}, a(
|
|
95
|
+
} = p(r), d = new Proxy(e || {}, a(o)), c = [y(d, "closeButton.default", {}), l, s];
|
|
97
96
|
return /* @__PURE__ */ m("button", { css: c, ...n });
|
|
98
97
|
};
|
|
99
98
|
export {
|
|
@@ -10,10 +10,16 @@ import { ScrollProps } from './Scroll.types';
|
|
|
10
10
|
* @component
|
|
11
11
|
* @param {'auto' | 'hidden' | 'visible'} [vertical='auto'] - Controls vertical scrollbar visibility.
|
|
12
12
|
* @param {'auto' | 'hidden' | 'visible'} [horizontal='auto'] - Controls horizontal scrollbar visibility.
|
|
13
|
+
* @param {boolean} [autoHide=false] - When true, scrollbars are only visible during scrolling.
|
|
13
14
|
*
|
|
14
15
|
* @example
|
|
15
16
|
* <Scroll vertical="auto" horizontal="hidden">
|
|
16
17
|
* <div>Scrollable content</div>
|
|
17
18
|
* </Scroll>
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <Scroll vertical="auto" autoHide>
|
|
22
|
+
* <div>Scrollable content with auto-hiding scrollbars</div>
|
|
23
|
+
* </Scroll>
|
|
18
24
|
*/
|
|
19
25
|
export declare const Scroll: import('react').ForwardRefExoticComponent<ScrollProps & import('react').RefAttributes<HTMLDivElement>>;
|