@quen-ui/components 1.0.1 → 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/dist/Banner/Banner.cjs.js +96 -0
- package/dist/Banner/Banner.d.ts +4 -0
- package/dist/Banner/Banner.es.js +96 -0
- package/dist/Banner/index.d.ts +2 -0
- package/dist/Banner/styles.cjs.js +113 -0
- package/dist/Banner/styles.d.ts +12 -0
- package/dist/Banner/styles.es.js +113 -0
- package/dist/Banner/types.d.ts +40 -0
- package/dist/Button/styles.cjs.js +6 -10
- package/dist/Button/styles.es.js +6 -10
- package/dist/Calendar/Calendar.cjs.js +5 -3
- package/dist/Calendar/Calendar.es.js +5 -3
- package/dist/Calendar/styles.cjs.js +0 -1
- package/dist/Calendar/styles.es.js +0 -1
- package/dist/Card/Card.cjs.js +8 -4
- package/dist/Card/Card.d.ts +1 -1
- package/dist/Card/Card.es.js +8 -4
- package/dist/Card/styles.cjs.js +9 -3
- package/dist/Card/styles.d.ts +3 -1
- package/dist/Card/styles.es.js +9 -3
- package/dist/Card/types.d.ts +2 -0
- package/dist/Dropdown/Dropdown.cjs.js +47 -43
- package/dist/Dropdown/Dropdown.d.ts +1 -1
- package/dist/Dropdown/Dropdown.es.js +48 -44
- package/dist/Dropdown/DropdownItem.cjs.js +10 -13
- package/dist/Dropdown/DropdownItem.es.js +10 -13
- package/dist/Dropdown/DropdownList.cjs.js +0 -2
- package/dist/Dropdown/DropdownList.es.js +0 -2
- package/dist/Form/Form.cjs.js +1 -1
- package/dist/Form/Form.es.js +1 -1
- package/dist/Image/styles.cjs.js +3 -1
- package/dist/Image/styles.es.js +3 -1
- package/dist/InputBase/InputBase.cjs.js +55 -12
- package/dist/InputBase/InputBase.d.ts +1 -1
- package/dist/InputBase/InputBase.es.js +57 -14
- package/dist/InputBase/styles.cjs.js +44 -4
- package/dist/InputBase/styles.d.ts +7 -1
- package/dist/InputBase/styles.es.js +45 -5
- package/dist/InputBase/types.d.ts +5 -1
- package/dist/InputDate/styles.d.ts +1 -1
- package/dist/InputNumber/styles.d.ts +1 -1
- package/dist/Layout/Footer.cjs.js +9 -0
- package/dist/Layout/Footer.d.ts +1 -2
- package/dist/Layout/Footer.es.js +9 -0
- package/dist/Layout/Header.cjs.js +12 -4
- package/dist/Layout/Header.es.js +12 -4
- package/dist/Layout/Layout.cjs.js +8 -3
- package/dist/Layout/Layout.d.ts +1 -1
- package/dist/Layout/Layout.es.js +8 -3
- package/dist/Layout/Sidebar.cjs.js +2 -1
- package/dist/Layout/Sidebar.es.js +2 -1
- package/dist/Layout/styles.cjs.js +6 -4
- package/dist/Layout/styles.d.ts +2 -0
- package/dist/Layout/styles.es.js +6 -4
- package/dist/Layout/types.d.ts +6 -0
- package/dist/Menu/MenuItem.cjs.js +9 -1
- package/dist/Menu/MenuItem.es.js +9 -1
- package/dist/Menu/styles.cjs.js +3 -1
- package/dist/Menu/styles.es.js +3 -1
- package/dist/Menu/types.d.ts +4 -1
- package/dist/Modal/Modal.cjs.js +2 -2
- package/dist/Modal/Modal.es.js +2 -2
- package/dist/Modal/styles.cjs.js +3 -1
- package/dist/Modal/styles.es.js +3 -1
- package/dist/Select/Select.cjs.js +2 -5
- package/dist/Select/Select.es.js +2 -5
- package/dist/Select/helpers.d.ts +8 -0
- package/dist/Select/styles.d.ts +1 -1
- package/dist/Select/useSelect.d.ts +8 -0
- package/dist/Slider/Slider.cjs.js +122 -224
- package/dist/Slider/Slider.d.ts +1 -1
- package/dist/Slider/Slider.es.js +125 -227
- package/dist/Slider/styles.cjs.js +49 -32
- package/dist/Slider/styles.d.ts +1 -1
- package/dist/Slider/styles.es.js +49 -32
- package/dist/Slider/useSlider.cjs.js +194 -0
- package/dist/Slider/useSlider.d.ts +11 -0
- package/dist/Slider/useSlider.es.js +194 -0
- package/dist/Stepper/Step.cjs.js +114 -0
- package/dist/Stepper/Step.d.ts +2 -0
- package/dist/Stepper/Step.es.js +114 -0
- package/dist/Stepper/StepContent.cjs.js +10 -0
- package/dist/Stepper/StepContent.d.ts +4 -0
- package/dist/Stepper/StepContent.es.js +10 -0
- package/dist/Stepper/StepLabel.cjs.js +28 -0
- package/dist/Stepper/StepLabel.d.ts +2 -0
- package/dist/Stepper/StepLabel.es.js +28 -0
- package/dist/Stepper/Stepper.cjs.js +54 -0
- package/dist/Stepper/Stepper.d.ts +2 -0
- package/dist/Stepper/Stepper.es.js +54 -0
- package/dist/Stepper/StepperContext.cjs.js +13 -0
- package/dist/Stepper/StepperContext.d.ts +3 -0
- package/dist/Stepper/StepperContext.es.js +13 -0
- package/dist/Stepper/index.cjs.js +10 -0
- package/dist/Stepper/index.d.ts +12 -0
- package/dist/Stepper/index.es.js +11 -0
- package/dist/Stepper/styles.cjs.js +149 -0
- package/dist/Stepper/styles.d.ts +44 -0
- package/dist/Stepper/styles.es.js +149 -0
- package/dist/Stepper/types.d.ts +70 -0
- package/dist/TextField/TextField.cjs.js +4 -0
- package/dist/TextField/TextField.d.ts +1 -1
- package/dist/TextField/TextField.es.js +4 -0
- package/dist/TextField/styles.d.ts +1 -1
- package/dist/Textarea/styles.d.ts +1 -1
- package/dist/Tooltip/Tooltip.cjs.js +3 -1
- package/dist/Tooltip/Tooltip.es.js +4 -2
- package/dist/index.cjs.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +4 -0
- package/dist/typography/Text/Text.cjs.js +2 -2
- package/dist/typography/Text/Text.es.js +2 -2
- package/dist/typography/Text/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const iconsReact = require("@tabler/icons-react");
|
|
6
|
+
const Title = require("../typography/Title/Title.cjs.js");
|
|
7
|
+
const Text = require("../typography/Text/Text.cjs.js");
|
|
8
|
+
const Button = require("../Button/Button.cjs.js");
|
|
9
|
+
const styles = require("./styles.cjs.js");
|
|
10
|
+
const Flex = require("../Flex/Flex.cjs.js");
|
|
11
|
+
const DEFAULT_ICONS = {
|
|
12
|
+
info: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconInfoCircle, {}),
|
|
13
|
+
success: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconRosetteDiscountCheck, {}),
|
|
14
|
+
warning: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconAlertTriangle, {}),
|
|
15
|
+
danger: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconAlertTriangle, {}),
|
|
16
|
+
neutral: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconInfoCircle, {})
|
|
17
|
+
};
|
|
18
|
+
const Banner = ({
|
|
19
|
+
variant = "info",
|
|
20
|
+
title,
|
|
21
|
+
description,
|
|
22
|
+
action,
|
|
23
|
+
onClose,
|
|
24
|
+
dismissible = false,
|
|
25
|
+
icon,
|
|
26
|
+
size = "m",
|
|
27
|
+
as = "div",
|
|
28
|
+
className,
|
|
29
|
+
children,
|
|
30
|
+
storageKey,
|
|
31
|
+
...restProps
|
|
32
|
+
}) => {
|
|
33
|
+
const [isVisible, setIsVisible] = React.useState(true);
|
|
34
|
+
const [isMounted, setIsMounted] = React.useState(false);
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
if (storageKey && typeof window !== "undefined") {
|
|
37
|
+
const dismissed = window.localStorage.getItem(`banner:${storageKey}`);
|
|
38
|
+
if (dismissed === "true") {
|
|
39
|
+
setIsVisible(false);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
setIsMounted(true);
|
|
43
|
+
}, [storageKey]);
|
|
44
|
+
const handleClose = React.useCallback(() => {
|
|
45
|
+
setIsVisible(false);
|
|
46
|
+
onClose?.();
|
|
47
|
+
if (storageKey && typeof window !== "undefined") {
|
|
48
|
+
window.localStorage.setItem(`banner:${storageKey}`, "true");
|
|
49
|
+
}
|
|
50
|
+
}, [onClose, storageKey]);
|
|
51
|
+
if (!isMounted || !isVisible) return null;
|
|
52
|
+
const displayIcon = icon ?? DEFAULT_ICONS[variant];
|
|
53
|
+
const titleId = `banner-title-${title?.toString().slice(0, 8) || Date.now()}`;
|
|
54
|
+
const descId = `banner-desc-${Date.now()}`;
|
|
55
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
56
|
+
styles.BannerStyled,
|
|
57
|
+
{
|
|
58
|
+
as,
|
|
59
|
+
role: "region",
|
|
60
|
+
variant,
|
|
61
|
+
size,
|
|
62
|
+
visible: isVisible,
|
|
63
|
+
dismissible,
|
|
64
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
65
|
+
"aria-describedby": description ? descId : void 0,
|
|
66
|
+
className,
|
|
67
|
+
...restProps,
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsxRuntime.jsxs(styles.BannerContent, { children: [
|
|
70
|
+
title && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { align: "center", gap: "xs", children: [
|
|
71
|
+
displayIcon && /* @__PURE__ */ jsxRuntime.jsx(styles.BannerIcon, { "aria-hidden": "true", children: displayIcon }),
|
|
72
|
+
/* @__PURE__ */ jsxRuntime.jsx(Title, { size: "s", id: titleId, children: title })
|
|
73
|
+
] }),
|
|
74
|
+
description && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { align: "center", gap: "xs", children: [
|
|
75
|
+
displayIcon && !title && /* @__PURE__ */ jsxRuntime.jsx(styles.BannerIcon, { "aria-hidden": "true", children: displayIcon }),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text, { id: descId, children: description })
|
|
77
|
+
] })
|
|
78
|
+
] }),
|
|
79
|
+
action && /* @__PURE__ */ jsxRuntime.jsx(styles.BannerAction, { children: action }),
|
|
80
|
+
dismissible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
81
|
+
Button,
|
|
82
|
+
{
|
|
83
|
+
size: "s",
|
|
84
|
+
view: "icon",
|
|
85
|
+
onClick: handleClose,
|
|
86
|
+
"aria-label": "Close notification",
|
|
87
|
+
type: "button",
|
|
88
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconX, { width: 16, height: 16 })
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
exports.Banner = Banner;
|
|
96
|
+
exports.default = Banner;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useCallback } from "react";
|
|
3
|
+
import { IconX, IconInfoCircle, IconAlertTriangle, IconRosetteDiscountCheck } from "@tabler/icons-react";
|
|
4
|
+
import Title from "../typography/Title/Title.es.js";
|
|
5
|
+
import Text from "../typography/Text/Text.es.js";
|
|
6
|
+
import Button from "../Button/Button.es.js";
|
|
7
|
+
import { BannerStyled, BannerContent, BannerIcon, BannerAction } from "./styles.es.js";
|
|
8
|
+
import Flex from "../Flex/Flex.es.js";
|
|
9
|
+
const DEFAULT_ICONS = {
|
|
10
|
+
info: /* @__PURE__ */ jsx(IconInfoCircle, {}),
|
|
11
|
+
success: /* @__PURE__ */ jsx(IconRosetteDiscountCheck, {}),
|
|
12
|
+
warning: /* @__PURE__ */ jsx(IconAlertTriangle, {}),
|
|
13
|
+
danger: /* @__PURE__ */ jsx(IconAlertTriangle, {}),
|
|
14
|
+
neutral: /* @__PURE__ */ jsx(IconInfoCircle, {})
|
|
15
|
+
};
|
|
16
|
+
const Banner = ({
|
|
17
|
+
variant = "info",
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
action,
|
|
21
|
+
onClose,
|
|
22
|
+
dismissible = false,
|
|
23
|
+
icon,
|
|
24
|
+
size = "m",
|
|
25
|
+
as = "div",
|
|
26
|
+
className,
|
|
27
|
+
children,
|
|
28
|
+
storageKey,
|
|
29
|
+
...restProps
|
|
30
|
+
}) => {
|
|
31
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
32
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (storageKey && typeof window !== "undefined") {
|
|
35
|
+
const dismissed = window.localStorage.getItem(`banner:${storageKey}`);
|
|
36
|
+
if (dismissed === "true") {
|
|
37
|
+
setIsVisible(false);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
setIsMounted(true);
|
|
41
|
+
}, [storageKey]);
|
|
42
|
+
const handleClose = useCallback(() => {
|
|
43
|
+
setIsVisible(false);
|
|
44
|
+
onClose?.();
|
|
45
|
+
if (storageKey && typeof window !== "undefined") {
|
|
46
|
+
window.localStorage.setItem(`banner:${storageKey}`, "true");
|
|
47
|
+
}
|
|
48
|
+
}, [onClose, storageKey]);
|
|
49
|
+
if (!isMounted || !isVisible) return null;
|
|
50
|
+
const displayIcon = icon ?? DEFAULT_ICONS[variant];
|
|
51
|
+
const titleId = `banner-title-${title?.toString().slice(0, 8) || Date.now()}`;
|
|
52
|
+
const descId = `banner-desc-${Date.now()}`;
|
|
53
|
+
return /* @__PURE__ */ jsxs(
|
|
54
|
+
BannerStyled,
|
|
55
|
+
{
|
|
56
|
+
as,
|
|
57
|
+
role: "region",
|
|
58
|
+
variant,
|
|
59
|
+
size,
|
|
60
|
+
visible: isVisible,
|
|
61
|
+
dismissible,
|
|
62
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
63
|
+
"aria-describedby": description ? descId : void 0,
|
|
64
|
+
className,
|
|
65
|
+
...restProps,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsxs(BannerContent, { children: [
|
|
68
|
+
title && /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "xs", children: [
|
|
69
|
+
displayIcon && /* @__PURE__ */ jsx(BannerIcon, { "aria-hidden": "true", children: displayIcon }),
|
|
70
|
+
/* @__PURE__ */ jsx(Title, { size: "s", id: titleId, children: title })
|
|
71
|
+
] }),
|
|
72
|
+
description && /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "xs", children: [
|
|
73
|
+
displayIcon && !title && /* @__PURE__ */ jsx(BannerIcon, { "aria-hidden": "true", children: displayIcon }),
|
|
74
|
+
/* @__PURE__ */ jsx(Text, { id: descId, children: description })
|
|
75
|
+
] })
|
|
76
|
+
] }),
|
|
77
|
+
action && /* @__PURE__ */ jsx(BannerAction, { children: action }),
|
|
78
|
+
dismissible && /* @__PURE__ */ jsx(
|
|
79
|
+
Button,
|
|
80
|
+
{
|
|
81
|
+
size: "s",
|
|
82
|
+
view: "icon",
|
|
83
|
+
onClick: handleClose,
|
|
84
|
+
"aria-label": "Close notification",
|
|
85
|
+
type: "button",
|
|
86
|
+
children: /* @__PURE__ */ jsx(IconX, { width: 16, height: 16 })
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
Banner,
|
|
95
|
+
Banner as default
|
|
96
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const styled = require("styled-components");
|
|
4
|
+
const variantStyles = {
|
|
5
|
+
info: styled.css`
|
|
6
|
+
background: ${({ theme }) => theme.components.Banner.info.background};
|
|
7
|
+
border-color: ${({ theme }) => theme.components.Banner.info.borderColor};
|
|
8
|
+
color: ${({ theme }) => theme.components.Banner.info.color};
|
|
9
|
+
--banner-icon-color: ${({ theme }) => theme.components.Banner.info.iconColor};
|
|
10
|
+
`,
|
|
11
|
+
success: styled.css`
|
|
12
|
+
background: ${({ theme }) => theme.components.Banner.success.background};
|
|
13
|
+
border-color: ${({ theme }) => theme.components.Banner.success.borderColor};
|
|
14
|
+
color: ${({ theme }) => theme.components.Banner.success.color};
|
|
15
|
+
--banner-icon-color: ${({ theme }) => theme.components.Banner.success.iconColor};
|
|
16
|
+
`,
|
|
17
|
+
warning: styled.css`
|
|
18
|
+
background: ${({ theme }) => theme.components.Banner.warning.background};
|
|
19
|
+
border-color: ${({ theme }) => theme.components.Banner.warning.borderColor};
|
|
20
|
+
color: ${({ theme }) => theme.components.Banner.warning.color};
|
|
21
|
+
--banner-icon-color: ${({ theme }) => theme.components.Banner.warning.iconColor};
|
|
22
|
+
`,
|
|
23
|
+
danger: styled.css`
|
|
24
|
+
background: ${({ theme }) => theme.components.Banner.danger.background};
|
|
25
|
+
border-color: ${({ theme }) => theme.components.Banner.danger.borderColor};
|
|
26
|
+
color: ${({ theme }) => theme.components.Banner.danger.color};
|
|
27
|
+
--banner-icon-color: ${({ theme }) => theme.components.Banner.danger.iconColor};
|
|
28
|
+
`,
|
|
29
|
+
neutral: styled.css`
|
|
30
|
+
background: ${({ theme }) => theme.components.Banner.neutral.background};
|
|
31
|
+
border-color: ${({ theme }) => theme.components.Banner.neutral.borderColor};
|
|
32
|
+
color: ${({ theme }) => theme.components.Banner.neutral.color};
|
|
33
|
+
--banner-icon-color: ${({ theme }) => theme.components.Banner.neutral.iconColor};
|
|
34
|
+
`
|
|
35
|
+
};
|
|
36
|
+
const sizeStyles = {
|
|
37
|
+
xs: styled.css`
|
|
38
|
+
padding: ${({ theme }) => theme.space.xs};
|
|
39
|
+
gap: ${({ theme }) => theme.space.xs};
|
|
40
|
+
`,
|
|
41
|
+
s: styled.css`
|
|
42
|
+
padding: ${({ theme }) => theme.space.s};
|
|
43
|
+
gap: ${({ theme }) => theme.space.s};
|
|
44
|
+
`,
|
|
45
|
+
m: styled.css`
|
|
46
|
+
padding: ${({ theme }) => theme.space.m};
|
|
47
|
+
gap: ${({ theme }) => theme.space.m};
|
|
48
|
+
`,
|
|
49
|
+
l: styled.css`
|
|
50
|
+
padding: ${({ theme }) => theme.space.l};
|
|
51
|
+
gap: ${({ theme }) => theme.space.l};
|
|
52
|
+
`
|
|
53
|
+
};
|
|
54
|
+
const BannerStyled = styled.div`
|
|
55
|
+
display: grid;
|
|
56
|
+
grid-template-columns: auto 1fr auto auto;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: ${({ size }) => size === "s" ? "10px" : size === "m" ? "14px" : "18px"};
|
|
59
|
+
border-left: 3px solid var(--banner-icon);
|
|
60
|
+
border-radius: ${({ theme }) => theme.control.radius};
|
|
61
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
62
|
+
transition:
|
|
63
|
+
opacity 0.2s ease,
|
|
64
|
+
transform 0.2s ease;
|
|
65
|
+
|
|
66
|
+
${({ visible }) => !visible && styled.css`
|
|
67
|
+
opacity: 0;
|
|
68
|
+
transform: translateY(-8px);
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
max-height: 0;
|
|
71
|
+
padding: 0;
|
|
72
|
+
margin: 0;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
`}
|
|
75
|
+
|
|
76
|
+
${({ variant }) => variantStyles[variant]};
|
|
77
|
+
${({ size }) => sizeStyles[size]};
|
|
78
|
+
|
|
79
|
+
@media (prefers-reduced-motion: reduce) {
|
|
80
|
+
transition: none !important;
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
const BannerIcon = styled.div`
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
color: var(--banner-icon);
|
|
88
|
+
flex-shrink: 0;
|
|
89
|
+
width: 1.2em;
|
|
90
|
+
height: 1.2em;
|
|
91
|
+
`;
|
|
92
|
+
const BannerContent = styled.div`
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
gap: 2px;
|
|
96
|
+
min-width: 0;
|
|
97
|
+
`;
|
|
98
|
+
const BannerAction = styled.div`
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: flex-end;
|
|
102
|
+
margin-left: auto;
|
|
103
|
+
padding-left: 12px;
|
|
104
|
+
|
|
105
|
+
button,
|
|
106
|
+
a {
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
exports.BannerAction = BannerAction;
|
|
111
|
+
exports.BannerContent = BannerContent;
|
|
112
|
+
exports.BannerIcon = BannerIcon;
|
|
113
|
+
exports.BannerStyled = BannerStyled;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TBannerVariant } from './types';
|
|
2
|
+
import { TQuenSize } from '../types/size';
|
|
3
|
+
interface IBannerStyledProps {
|
|
4
|
+
variant: TBannerVariant;
|
|
5
|
+
size: TQuenSize;
|
|
6
|
+
visible: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const BannerStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, IBannerStyledProps>> & string;
|
|
9
|
+
export declare const BannerIcon: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
10
|
+
export declare const BannerContent: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
11
|
+
export declare const BannerAction: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
const variantStyles = {
|
|
3
|
+
info: css`
|
|
4
|
+
background: ${({ theme }) => theme.components.Banner.info.background};
|
|
5
|
+
border-color: ${({ theme }) => theme.components.Banner.info.borderColor};
|
|
6
|
+
color: ${({ theme }) => theme.components.Banner.info.color};
|
|
7
|
+
--banner-icon-color: ${({ theme }) => theme.components.Banner.info.iconColor};
|
|
8
|
+
`,
|
|
9
|
+
success: css`
|
|
10
|
+
background: ${({ theme }) => theme.components.Banner.success.background};
|
|
11
|
+
border-color: ${({ theme }) => theme.components.Banner.success.borderColor};
|
|
12
|
+
color: ${({ theme }) => theme.components.Banner.success.color};
|
|
13
|
+
--banner-icon-color: ${({ theme }) => theme.components.Banner.success.iconColor};
|
|
14
|
+
`,
|
|
15
|
+
warning: css`
|
|
16
|
+
background: ${({ theme }) => theme.components.Banner.warning.background};
|
|
17
|
+
border-color: ${({ theme }) => theme.components.Banner.warning.borderColor};
|
|
18
|
+
color: ${({ theme }) => theme.components.Banner.warning.color};
|
|
19
|
+
--banner-icon-color: ${({ theme }) => theme.components.Banner.warning.iconColor};
|
|
20
|
+
`,
|
|
21
|
+
danger: css`
|
|
22
|
+
background: ${({ theme }) => theme.components.Banner.danger.background};
|
|
23
|
+
border-color: ${({ theme }) => theme.components.Banner.danger.borderColor};
|
|
24
|
+
color: ${({ theme }) => theme.components.Banner.danger.color};
|
|
25
|
+
--banner-icon-color: ${({ theme }) => theme.components.Banner.danger.iconColor};
|
|
26
|
+
`,
|
|
27
|
+
neutral: css`
|
|
28
|
+
background: ${({ theme }) => theme.components.Banner.neutral.background};
|
|
29
|
+
border-color: ${({ theme }) => theme.components.Banner.neutral.borderColor};
|
|
30
|
+
color: ${({ theme }) => theme.components.Banner.neutral.color};
|
|
31
|
+
--banner-icon-color: ${({ theme }) => theme.components.Banner.neutral.iconColor};
|
|
32
|
+
`
|
|
33
|
+
};
|
|
34
|
+
const sizeStyles = {
|
|
35
|
+
xs: css`
|
|
36
|
+
padding: ${({ theme }) => theme.space.xs};
|
|
37
|
+
gap: ${({ theme }) => theme.space.xs};
|
|
38
|
+
`,
|
|
39
|
+
s: css`
|
|
40
|
+
padding: ${({ theme }) => theme.space.s};
|
|
41
|
+
gap: ${({ theme }) => theme.space.s};
|
|
42
|
+
`,
|
|
43
|
+
m: css`
|
|
44
|
+
padding: ${({ theme }) => theme.space.m};
|
|
45
|
+
gap: ${({ theme }) => theme.space.m};
|
|
46
|
+
`,
|
|
47
|
+
l: css`
|
|
48
|
+
padding: ${({ theme }) => theme.space.l};
|
|
49
|
+
gap: ${({ theme }) => theme.space.l};
|
|
50
|
+
`
|
|
51
|
+
};
|
|
52
|
+
const BannerStyled = styled.div`
|
|
53
|
+
display: grid;
|
|
54
|
+
grid-template-columns: auto 1fr auto auto;
|
|
55
|
+
align-items: center;
|
|
56
|
+
gap: ${({ size }) => size === "s" ? "10px" : size === "m" ? "14px" : "18px"};
|
|
57
|
+
border-left: 3px solid var(--banner-icon);
|
|
58
|
+
border-radius: ${({ theme }) => theme.control.radius};
|
|
59
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
60
|
+
transition:
|
|
61
|
+
opacity 0.2s ease,
|
|
62
|
+
transform 0.2s ease;
|
|
63
|
+
|
|
64
|
+
${({ visible }) => !visible && css`
|
|
65
|
+
opacity: 0;
|
|
66
|
+
transform: translateY(-8px);
|
|
67
|
+
pointer-events: none;
|
|
68
|
+
max-height: 0;
|
|
69
|
+
padding: 0;
|
|
70
|
+
margin: 0;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
`}
|
|
73
|
+
|
|
74
|
+
${({ variant }) => variantStyles[variant]};
|
|
75
|
+
${({ size }) => sizeStyles[size]};
|
|
76
|
+
|
|
77
|
+
@media (prefers-reduced-motion: reduce) {
|
|
78
|
+
transition: none !important;
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
const BannerIcon = styled.div`
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
color: var(--banner-icon);
|
|
86
|
+
flex-shrink: 0;
|
|
87
|
+
width: 1.2em;
|
|
88
|
+
height: 1.2em;
|
|
89
|
+
`;
|
|
90
|
+
const BannerContent = styled.div`
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
gap: 2px;
|
|
94
|
+
min-width: 0;
|
|
95
|
+
`;
|
|
96
|
+
const BannerAction = styled.div`
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: flex-end;
|
|
100
|
+
margin-left: auto;
|
|
101
|
+
padding-left: 12px;
|
|
102
|
+
|
|
103
|
+
button,
|
|
104
|
+
a {
|
|
105
|
+
white-space: nowrap;
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
export {
|
|
109
|
+
BannerAction,
|
|
110
|
+
BannerContent,
|
|
111
|
+
BannerIcon,
|
|
112
|
+
BannerStyled
|
|
113
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode, ElementType, HTMLAttributes } from 'react';
|
|
2
|
+
import { TQuenSize } from '../types/size';
|
|
3
|
+
export type TBannerVariant = 'info' | 'success' | 'warning' | 'danger' | 'neutral';
|
|
4
|
+
export interface IBannerProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
5
|
+
/**
|
|
6
|
+
* Unique key for storing the closure state in localStorage.
|
|
7
|
+
* If transferred, the banner will not appear again after closing.
|
|
8
|
+
*/
|
|
9
|
+
storageKey?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Visual style of the banner
|
|
12
|
+
* @default 'info'
|
|
13
|
+
*/
|
|
14
|
+
variant?: TBannerVariant;
|
|
15
|
+
/** Banner title */
|
|
16
|
+
title?: ReactNode;
|
|
17
|
+
/** Description/banner content */
|
|
18
|
+
description?: ReactNode;
|
|
19
|
+
/** Action element (button, link) */
|
|
20
|
+
action?: ReactNode;
|
|
21
|
+
/** Callback when closing a banner */
|
|
22
|
+
onClose?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to show the close button
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
dismissible?: boolean;
|
|
28
|
+
/** Custom icon (overrides the icon by variant) */
|
|
29
|
+
icon?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Banner size
|
|
32
|
+
* @default 'm'
|
|
33
|
+
*/
|
|
34
|
+
size?: TQuenSize;
|
|
35
|
+
/**
|
|
36
|
+
* Custom rendering element
|
|
37
|
+
* @default 'div'
|
|
38
|
+
*/
|
|
39
|
+
as?: ElementType;
|
|
40
|
+
}
|
|
@@ -6,21 +6,17 @@ const getBackground = (theme, view = "primary", isDisabled) => {
|
|
|
6
6
|
switch (view) {
|
|
7
7
|
case "secondary":
|
|
8
8
|
return styled.css`
|
|
9
|
-
background:
|
|
10
|
-
|
|
9
|
+
background: transparent;
|
|
10
|
+
border: 1px solid ${theme.components.Button.secondaryBackground};
|
|
11
11
|
|
|
12
12
|
&:hover {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
theme.components.Button.secondaryBackground
|
|
16
|
-
)};
|
|
13
|
+
color: ${theme.colors[theme.primaryColor][7]};
|
|
14
|
+
border: 1px solid ${theme.colors[theme.primaryColor][7]};
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
&:active {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
theme.components.Button.secondaryBackground
|
|
23
|
-
)};
|
|
18
|
+
color: ${theme.colors[theme.primaryColor][9]};
|
|
19
|
+
border: 1px solid ${theme.colors[theme.primaryColor][9]};
|
|
24
20
|
}
|
|
25
21
|
`;
|
|
26
22
|
case "danger":
|
package/dist/Button/styles.es.js
CHANGED
|
@@ -4,21 +4,17 @@ const getBackground = (theme, view = "primary", isDisabled) => {
|
|
|
4
4
|
switch (view) {
|
|
5
5
|
case "secondary":
|
|
6
6
|
return css`
|
|
7
|
-
background:
|
|
8
|
-
|
|
7
|
+
background: transparent;
|
|
8
|
+
border: 1px solid ${theme.components.Button.secondaryBackground};
|
|
9
9
|
|
|
10
10
|
&:hover {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
theme.components.Button.secondaryBackground
|
|
14
|
-
)};
|
|
11
|
+
color: ${theme.colors[theme.primaryColor][7]};
|
|
12
|
+
border: 1px solid ${theme.colors[theme.primaryColor][7]};
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
&:active {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
theme.components.Button.secondaryBackground
|
|
21
|
-
)};
|
|
16
|
+
color: ${theme.colors[theme.primaryColor][9]};
|
|
17
|
+
border: 1px solid ${theme.colors[theme.primaryColor][9]};
|
|
22
18
|
}
|
|
23
19
|
`;
|
|
24
20
|
case "danger":
|
|
@@ -48,9 +48,11 @@ const Calendar = ({
|
|
|
48
48
|
}
|
|
49
49
|
}, [level]);
|
|
50
50
|
React.useEffect(() => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
if (typeof range !== "undefined") {
|
|
52
|
+
setInternalSingleDate(null);
|
|
53
|
+
setInternalEndDate(null);
|
|
54
|
+
setInternalStartDate(null);
|
|
55
|
+
}
|
|
54
56
|
}, [range]);
|
|
55
57
|
const [currentMonth, setCurrentMonth] = React.useState(/* @__PURE__ */ new Date());
|
|
56
58
|
const levelTitle = React.useMemo(() => {
|
|
@@ -47,9 +47,11 @@ const Calendar$1 = ({
|
|
|
47
47
|
}
|
|
48
48
|
}, [level]);
|
|
49
49
|
useEffect(() => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
if (typeof range !== "undefined") {
|
|
51
|
+
setInternalSingleDate(null);
|
|
52
|
+
setInternalEndDate(null);
|
|
53
|
+
setInternalStartDate(null);
|
|
54
|
+
}
|
|
53
55
|
}, [range]);
|
|
54
56
|
const [currentMonth, setCurrentMonth] = useState(/* @__PURE__ */ new Date());
|
|
55
57
|
const levelTitle = useMemo(() => {
|
|
@@ -59,7 +59,6 @@ const DayStyled = styled(Button).attrs({ view: "icon" }).withConfig({
|
|
|
59
59
|
|
|
60
60
|
${({ theme, isSelected, isCurrentMonth }) => {
|
|
61
61
|
const { secondaryColor } = theme.components.Calendar;
|
|
62
|
-
console.log(secondaryColor);
|
|
63
62
|
return styled.css`
|
|
64
63
|
color: ${isSelected ? "#fff" : isCurrentMonth ? theme.textColor : secondaryColor};
|
|
65
64
|
`;
|
|
@@ -57,7 +57,6 @@ const DayStyled = styled(Button).attrs({ view: "icon" }).withConfig({
|
|
|
57
57
|
|
|
58
58
|
${({ theme, isSelected, isCurrentMonth }) => {
|
|
59
59
|
const { secondaryColor } = theme.components.Calendar;
|
|
60
|
-
console.log(secondaryColor);
|
|
61
60
|
return css`
|
|
62
61
|
color: ${isSelected ? "#fff" : isCurrentMonth ? theme.textColor : secondaryColor};
|
|
63
62
|
`;
|
package/dist/Card/Card.cjs.js
CHANGED
|
@@ -4,6 +4,7 @@ const Title = require("../typography/Title/Title.cjs.js");
|
|
|
4
4
|
const styles = require("./styles.cjs.js");
|
|
5
5
|
const Button = require("../Button/Button.cjs.js");
|
|
6
6
|
const Divider = require("../Divider/Divider.cjs.js");
|
|
7
|
+
const Flex = require("../Flex/Flex.cjs.js");
|
|
7
8
|
const Card = ({
|
|
8
9
|
title,
|
|
9
10
|
children,
|
|
@@ -18,14 +19,17 @@ const Card = ({
|
|
|
18
19
|
leftContent,
|
|
19
20
|
style,
|
|
20
21
|
onClickExtra,
|
|
22
|
+
shadow,
|
|
21
23
|
...props
|
|
22
24
|
}) => {
|
|
23
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(styles.CardStyled, { className, ...props, style, children: [
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(styles.CardStyled, { className, ...props, style, shadow, children: [
|
|
24
26
|
cover,
|
|
25
27
|
title && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
26
|
-
/* @__PURE__ */ jsxRuntime.jsxs(styles.CardHeaderStyled, { size, className: classNameHeader, children: [
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
/* @__PURE__ */ jsxRuntime.jsxs(styles.CardHeaderStyled, { size, className: classNameHeader, "data-testid": "card-header", children: [
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: "m", align: "center", children: [
|
|
30
|
+
leftContent,
|
|
31
|
+
/* @__PURE__ */ jsxRuntime.jsx(Title, { size, children: title })
|
|
32
|
+
] }),
|
|
29
33
|
extra && /* @__PURE__ */ jsxRuntime.jsx(Button, { view: "link", size: "s", onClick: onClickExtra, children: extra })
|
|
30
34
|
] }),
|
|
31
35
|
/* @__PURE__ */ jsxRuntime.jsx(Divider, { direction: "horizontal" })
|
package/dist/Card/Card.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ICardProps } from './types';
|
|
2
|
-
declare const Card: ({ title, children, size, extra, className, classNameHeader, classNameContent, classNameAction, actionContent, cover, leftContent, style, onClickExtra, ...props }: ICardProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const Card: ({ title, children, size, extra, className, classNameHeader, classNameContent, classNameAction, actionContent, cover, leftContent, style, onClickExtra, shadow, ...props }: ICardProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default Card;
|
package/dist/Card/Card.es.js
CHANGED
|
@@ -3,6 +3,7 @@ import Title from "../typography/Title/Title.es.js";
|
|
|
3
3
|
import { CardStyled, CardHeaderStyled, CardContentStyled, CardActionsStyled } from "./styles.es.js";
|
|
4
4
|
import Button from "../Button/Button.es.js";
|
|
5
5
|
import Divider from "../Divider/Divider.es.js";
|
|
6
|
+
import Flex from "../Flex/Flex.es.js";
|
|
6
7
|
const Card = ({
|
|
7
8
|
title,
|
|
8
9
|
children,
|
|
@@ -17,14 +18,17 @@ const Card = ({
|
|
|
17
18
|
leftContent,
|
|
18
19
|
style,
|
|
19
20
|
onClickExtra,
|
|
21
|
+
shadow,
|
|
20
22
|
...props
|
|
21
23
|
}) => {
|
|
22
|
-
return /* @__PURE__ */ jsxs(CardStyled, { className, ...props, style, children: [
|
|
24
|
+
return /* @__PURE__ */ jsxs(CardStyled, { className, ...props, style, shadow, children: [
|
|
23
25
|
cover,
|
|
24
26
|
title && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
-
/* @__PURE__ */ jsxs(CardHeaderStyled, { size, className: classNameHeader, children: [
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
/* @__PURE__ */ jsxs(CardHeaderStyled, { size, className: classNameHeader, "data-testid": "card-header", children: [
|
|
28
|
+
/* @__PURE__ */ jsxs(Flex, { gap: "m", align: "center", children: [
|
|
29
|
+
leftContent,
|
|
30
|
+
/* @__PURE__ */ jsx(Title, { size, children: title })
|
|
31
|
+
] }),
|
|
28
32
|
extra && /* @__PURE__ */ jsx(Button, { view: "link", size: "s", onClick: onClickExtra, children: extra })
|
|
29
33
|
] }),
|
|
30
34
|
/* @__PURE__ */ jsx(Divider, { direction: "horizontal" })
|