cherry-styled-components 0.1.17 → 0.1.19
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/accordion.d.ts +11 -0
- package/dist/accordion.js +88 -0
- package/dist/avatar-dropzone.d.ts +19 -0
- package/dist/avatar-dropzone.js +157 -0
- package/dist/box.js +2 -2
- package/dist/button.js +3 -3
- package/dist/col.js +2 -2
- package/dist/container.js +2 -2
- package/dist/dropzone.d.ts +35 -0
- package/dist/dropzone.js +255 -0
- package/dist/flex.d.ts +53 -0
- package/dist/flex.js +28 -5
- package/dist/grid.js +2 -2
- package/dist/icon-button.d.ts +11 -0
- package/dist/icon-button.js +72 -0
- package/dist/icon.js +1 -1
- package/dist/{src/lib/index.d.ts → index.d.ts} +7 -0
- package/dist/index.js +11 -3
- package/dist/{src/lib/input.d.ts → input.d.ts} +1 -1
- package/dist/input.js +15 -15
- package/dist/max-width.js +2 -2
- package/dist/modal.d.ts +10 -0
- package/dist/modal.js +96 -0
- package/dist/password.d.ts +5 -0
- package/dist/password.js +75 -0
- package/dist/range.js +4 -4
- package/dist/select.js +6 -6
- package/dist/space.js +2 -2
- package/dist/styled-components/registry.js +2 -2
- package/dist/styled-components/theme-provider.js +4 -4
- package/dist/textarea.js +4 -4
- package/dist/toast.d.ts +40 -0
- package/dist/toast.js +115 -0
- package/dist/toggle.js +5 -5
- package/dist/utils/icons.js +15 -15
- package/dist/{src/lib/utils → utils}/index.d.ts +1 -0
- package/dist/{src/lib/utils → utils}/mixins.d.ts +3 -0
- package/dist/utils/mixins.js +16 -1
- package/dist/utils/use-on-click-outside.d.ts +2 -0
- package/dist/utils/use-on-click-outside.js +17 -0
- package/package.json +16 -16
- package/dist/src/lib/flex.d.ts +0 -27
- /package/dist/{src/lib/box.d.ts → box.d.ts} +0 -0
- /package/dist/{src/lib/button.d.ts → button.d.ts} +0 -0
- /package/dist/{src/lib/col.d.ts → col.d.ts} +0 -0
- /package/dist/{src/lib/container.d.ts → container.d.ts} +0 -0
- /package/dist/{src/lib/grid.d.ts → grid.d.ts} +0 -0
- /package/dist/{src/lib/icon.d.ts → icon.d.ts} +0 -0
- /package/dist/{src/lib/max-width.d.ts → max-width.d.ts} +0 -0
- /package/dist/{src/lib/range.d.ts → range.d.ts} +0 -0
- /package/dist/{src/lib/select.d.ts → select.d.ts} +0 -0
- /package/dist/{src/lib/space.d.ts → space.d.ts} +0 -0
- /package/dist/{src/lib/styled-components → styled-components}/index.d.ts +0 -0
- /package/dist/{src/lib/styled-components → styled-components}/registry.d.ts +0 -0
- /package/dist/{src/lib/styled-components → styled-components}/theme-provider.d.ts +0 -0
- /package/dist/{src/lib/textarea.d.ts → textarea.d.ts} +0 -0
- /package/dist/{src/lib/toggle.d.ts → toggle.d.ts} +0 -0
- /package/dist/{src/lib/utils → utils}/global.d.ts +0 -0
- /package/dist/{src/lib/utils → utils}/icons.d.ts +0 -0
- /package/dist/{src/lib/utils → utils}/theme.d.ts +0 -0
- /package/dist/{src/lib/utils → utils}/typography.d.ts +0 -0
package/dist/flex.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
type JustifyContentType = "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
3
|
+
type AlignItemsType = "stretch" | "center" | "flex-start" | "flex-end" | "baseline";
|
|
4
|
+
type AlignContentType = "stretch" | "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
5
|
+
type DirectionType = "row" | "column" | "row-reverse" | "column-reverse";
|
|
6
|
+
type GapType = number | "none";
|
|
7
|
+
interface FlexProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
$justifyContent?: JustifyContentType;
|
|
10
|
+
$xsJustifyContent?: JustifyContentType;
|
|
11
|
+
$smJustifyContent?: JustifyContentType;
|
|
12
|
+
$mdJustifyContent?: JustifyContentType;
|
|
13
|
+
$lgJustifyContent?: JustifyContentType;
|
|
14
|
+
$xlJustifyContent?: JustifyContentType;
|
|
15
|
+
$xxlJustifyContent?: JustifyContentType;
|
|
16
|
+
$xxxlJustifyContent?: JustifyContentType;
|
|
17
|
+
$alignItems?: AlignItemsType;
|
|
18
|
+
$xsAlignItems?: AlignItemsType;
|
|
19
|
+
$smAlignItems?: AlignItemsType;
|
|
20
|
+
$mdAlignItems?: AlignItemsType;
|
|
21
|
+
$lgAlignItems?: AlignItemsType;
|
|
22
|
+
$xlAlignItems?: AlignItemsType;
|
|
23
|
+
$xxlAlignItems?: AlignItemsType;
|
|
24
|
+
$xxxlAlignItems?: AlignItemsType;
|
|
25
|
+
$alignContent?: AlignContentType;
|
|
26
|
+
$xsAlignContent?: AlignContentType;
|
|
27
|
+
$smAlignContent?: AlignContentType;
|
|
28
|
+
$mdAlignContent?: AlignContentType;
|
|
29
|
+
$lgAlignContent?: AlignContentType;
|
|
30
|
+
$xlAlignContent?: AlignContentType;
|
|
31
|
+
$xxlAlignContent?: AlignContentType;
|
|
32
|
+
$xxxlAlignContent?: AlignContentType;
|
|
33
|
+
$wrap?: "wrap" | "nowrap" | "wrap-reverse";
|
|
34
|
+
$gap?: GapType;
|
|
35
|
+
$xsGap?: GapType;
|
|
36
|
+
$smGap?: GapType;
|
|
37
|
+
$mdGap?: GapType;
|
|
38
|
+
$lgGap?: GapType;
|
|
39
|
+
$xlGap?: GapType;
|
|
40
|
+
$xxlGap?: GapType;
|
|
41
|
+
$xxxlGap?: GapType;
|
|
42
|
+
$direction?: DirectionType;
|
|
43
|
+
$xsDirection?: DirectionType;
|
|
44
|
+
$smDirection?: DirectionType;
|
|
45
|
+
$mdDirection?: DirectionType;
|
|
46
|
+
$lgDirection?: DirectionType;
|
|
47
|
+
$xlDirection?: DirectionType;
|
|
48
|
+
$xxlDirection?: DirectionType;
|
|
49
|
+
$xxxlDirection?: DirectionType;
|
|
50
|
+
$fullWidth?: boolean;
|
|
51
|
+
}
|
|
52
|
+
declare const Flex: React.ForwardRefExoticComponent<FlexProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
export { Flex };
|
package/dist/flex.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { mq } from "./utils/theme.js";
|
|
4
|
-
import { fullWidthStyles, generateGapStyles, generateJustifyContentStyles } from "./utils/mixins.js";
|
|
4
|
+
import { fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles } from "./utils/mixins.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { forwardRef } from "react";
|
|
7
7
|
import styled from "styled-components";
|
|
8
8
|
//#region src/lib/flex.tsx
|
|
9
9
|
var StyledFlex = styled.div.withConfig({
|
|
10
10
|
displayName: "flex__StyledFlex",
|
|
11
|
-
componentId: "sc-
|
|
11
|
+
componentId: "sc-5d254fa1-0"
|
|
12
12
|
})([
|
|
13
13
|
`display:flex;justify-content:`,
|
|
14
|
+
`;align-items:`,
|
|
15
|
+
`;align-content:`,
|
|
14
16
|
`;flex-wrap:`,
|
|
15
17
|
`;gap:`,
|
|
16
18
|
`;flex-direction:`,
|
|
@@ -31,15 +33,36 @@ var StyledFlex = styled.div.withConfig({
|
|
|
31
33
|
` `,
|
|
32
34
|
` `,
|
|
33
35
|
` `,
|
|
36
|
+
` `,
|
|
37
|
+
` `,
|
|
38
|
+
` `,
|
|
39
|
+
` `,
|
|
40
|
+
` `,
|
|
41
|
+
` `,
|
|
42
|
+
` `,
|
|
43
|
+
` `,
|
|
44
|
+
` `,
|
|
45
|
+
` `,
|
|
46
|
+
` `,
|
|
47
|
+
` `,
|
|
48
|
+
` `,
|
|
49
|
+
` `,
|
|
50
|
+
` `,
|
|
51
|
+
` `,
|
|
52
|
+
` `,
|
|
53
|
+
` `,
|
|
54
|
+
` `,
|
|
55
|
+
` `,
|
|
56
|
+
` `,
|
|
34
57
|
``
|
|
35
|
-
], ({ $justifyContent }) => $justifyContent || "flex-start", ({ $wrap }) => $wrap || "wrap", ({ $gap, theme }) => $gap !== void 0 && $gap !== "none" ? `${$gap}px` : theme.spacing.gridGap.xs, ({ $direction }) => $direction || "row", mq("lg"), ({ $gap, theme }) => $gap !== void 0 && $gap !== "none" ? `${$gap}px` : theme.spacing.gridGap.lg, ({ $xsGap }) => $xsGap !== void 0 && generateGapStyles("xs", $xsGap), ({ $xsJustifyContent }) => $xsJustifyContent && generateJustifyContentStyles("xs", $xsJustifyContent), ({ $smGap }) => $smGap !== void 0 && generateGapStyles("sm", $smGap), ({ $smJustifyContent }) => $smJustifyContent && generateJustifyContentStyles("sm", $smJustifyContent), ({ $mdGap }) => $mdGap !== void 0 && generateGapStyles("md", $mdGap), ({ $mdJustifyContent }) => $mdJustifyContent && generateJustifyContentStyles("md", $mdJustifyContent), ({ $lgGap }) => $lgGap !== void 0 && generateGapStyles("lg", $lgGap), ({ $lgJustifyContent }) => $lgJustifyContent && generateJustifyContentStyles("lg", $lgJustifyContent), ({ $xlGap }) => $xlGap !== void 0 && generateGapStyles("xl", $xlGap), ({ $xlJustifyContent }) => $xlJustifyContent && generateJustifyContentStyles("xl", $xlJustifyContent), ({ $xxlGap }) => $xxlGap !== void 0 && generateGapStyles("xxl", $xxlGap), ({ $xxlJustifyContent }) => $xxlJustifyContent && generateJustifyContentStyles("xxl", $xxlJustifyContent), ({ $xxxlGap }) => $xxxlGap !== void 0 && generateGapStyles("xxxl", $xxxlGap), ({ $xxxlJustifyContent }) => $xxxlJustifyContent && generateJustifyContentStyles("xxxl", $xxxlJustifyContent), ({ $fullWidth }) => fullWidthStyles($fullWidth));
|
|
58
|
+
], ({ $justifyContent }) => $justifyContent || "flex-start", ({ $alignItems }) => $alignItems || "stretch", ({ $alignContent }) => $alignContent || "stretch", ({ $wrap }) => $wrap || "wrap", ({ $gap, theme }) => $gap !== void 0 && $gap !== "none" ? `${$gap}px` : theme.spacing.gridGap.xs, ({ $direction }) => $direction || "row", mq("lg"), ({ $gap, theme }) => $gap !== void 0 && $gap !== "none" ? `${$gap}px` : theme.spacing.gridGap.lg, ({ $xsGap }) => $xsGap !== void 0 && generateGapStyles("xs", $xsGap), ({ $xsJustifyContent }) => $xsJustifyContent && generateJustifyContentStyles("xs", $xsJustifyContent), ({ $xsAlignItems }) => $xsAlignItems && generateAlignItemsStyles("xs", $xsAlignItems), ({ $xsAlignContent }) => $xsAlignContent && generateAlignContentStyles("xs", $xsAlignContent), ({ $xsDirection }) => $xsDirection && generateDirectionStyles("xs", $xsDirection), ({ $smGap }) => $smGap !== void 0 && generateGapStyles("sm", $smGap), ({ $smJustifyContent }) => $smJustifyContent && generateJustifyContentStyles("sm", $smJustifyContent), ({ $smAlignItems }) => $smAlignItems && generateAlignItemsStyles("sm", $smAlignItems), ({ $smAlignContent }) => $smAlignContent && generateAlignContentStyles("sm", $smAlignContent), ({ $smDirection }) => $smDirection && generateDirectionStyles("sm", $smDirection), ({ $mdGap }) => $mdGap !== void 0 && generateGapStyles("md", $mdGap), ({ $mdJustifyContent }) => $mdJustifyContent && generateJustifyContentStyles("md", $mdJustifyContent), ({ $mdAlignItems }) => $mdAlignItems && generateAlignItemsStyles("md", $mdAlignItems), ({ $mdAlignContent }) => $mdAlignContent && generateAlignContentStyles("md", $mdAlignContent), ({ $mdDirection }) => $mdDirection && generateDirectionStyles("md", $mdDirection), ({ $lgGap }) => $lgGap !== void 0 && generateGapStyles("lg", $lgGap), ({ $lgJustifyContent }) => $lgJustifyContent && generateJustifyContentStyles("lg", $lgJustifyContent), ({ $lgAlignItems }) => $lgAlignItems && generateAlignItemsStyles("lg", $lgAlignItems), ({ $lgAlignContent }) => $lgAlignContent && generateAlignContentStyles("lg", $lgAlignContent), ({ $lgDirection }) => $lgDirection && generateDirectionStyles("lg", $lgDirection), ({ $xlGap }) => $xlGap !== void 0 && generateGapStyles("xl", $xlGap), ({ $xlJustifyContent }) => $xlJustifyContent && generateJustifyContentStyles("xl", $xlJustifyContent), ({ $xlAlignItems }) => $xlAlignItems && generateAlignItemsStyles("xl", $xlAlignItems), ({ $xlAlignContent }) => $xlAlignContent && generateAlignContentStyles("xl", $xlAlignContent), ({ $xlDirection }) => $xlDirection && generateDirectionStyles("xl", $xlDirection), ({ $xxlGap }) => $xxlGap !== void 0 && generateGapStyles("xxl", $xxlGap), ({ $xxlJustifyContent }) => $xxlJustifyContent && generateJustifyContentStyles("xxl", $xxlJustifyContent), ({ $xxlAlignItems }) => $xxlAlignItems && generateAlignItemsStyles("xxl", $xxlAlignItems), ({ $xxlAlignContent }) => $xxlAlignContent && generateAlignContentStyles("xxl", $xxlAlignContent), ({ $xxlDirection }) => $xxlDirection && generateDirectionStyles("xxl", $xxlDirection), ({ $xxxlGap }) => $xxxlGap !== void 0 && generateGapStyles("xxxl", $xxxlGap), ({ $xxxlJustifyContent }) => $xxxlJustifyContent && generateJustifyContentStyles("xxxl", $xxxlJustifyContent), ({ $xxxlAlignItems }) => $xxxlAlignItems && generateAlignItemsStyles("xxxl", $xxxlAlignItems), ({ $xxxlAlignContent }) => $xxxlAlignContent && generateAlignContentStyles("xxxl", $xxxlAlignContent), ({ $xxxlDirection }) => $xxxlDirection && generateDirectionStyles("xxxl", $xxxlDirection), ({ $fullWidth }) => fullWidthStyles($fullWidth));
|
|
36
59
|
function LocalFlex({ ...props }, ref) {
|
|
37
|
-
return
|
|
60
|
+
return /*#__PURE__*/ jsx(StyledFlex, {
|
|
38
61
|
...props,
|
|
39
62
|
ref,
|
|
40
63
|
children: props.children
|
|
41
64
|
});
|
|
42
65
|
}
|
|
43
|
-
var Flex =
|
|
66
|
+
var Flex = /*#__PURE__*/ forwardRef(LocalFlex);
|
|
44
67
|
//#endregion
|
|
45
68
|
export { Flex };
|
package/dist/grid.js
CHANGED
|
@@ -31,12 +31,12 @@ var StyledGrid = styled.div.withConfig({
|
|
|
31
31
|
``
|
|
32
32
|
], ({ $cols }) => `repeat(${$cols || 3}, minmax(0, 1fr))`, ({ $gap, theme }) => $gap !== void 0 && $gap !== "none" ? `${$gap}px` : theme.spacing.gridGap.xs, mq("lg"), ({ $gap, theme }) => $gap !== void 0 && $gap !== "none" ? `${$gap}px` : theme.spacing.gridGap.lg, ({ $xsGap }) => $xsGap !== void 0 && generateGapStyles("xs", $xsGap), ({ $smGap }) => $smGap !== void 0 && generateGapStyles("sm", $smGap), ({ $mdGap }) => $mdGap !== void 0 && generateGapStyles("md", $mdGap), ({ $lgGap }) => $lgGap !== void 0 && generateGapStyles("lg", $lgGap), ({ $xlGap }) => $xlGap !== void 0 && generateGapStyles("xl", $xlGap), ({ $xxlGap }) => $xxlGap !== void 0 && generateGapStyles("xxl", $xxlGap), ({ $xxxlGap }) => $xxxlGap !== void 0 && generateGapStyles("xxxl", $xxxlGap), ({ $xsCols }) => $xsCols && generateColsStyles("xs", $xsCols), ({ $smCols }) => $smCols && generateColsStyles("sm", $smCols), ({ $mdCols }) => $mdCols && generateColsStyles("md", $mdCols), ({ $lgCols }) => $lgCols && generateColsStyles("lg", $lgCols), ({ $xlCols }) => $xlCols && generateColsStyles("xl", $xlCols), ({ $xxlCols }) => $xxlCols && generateColsStyles("xxl", $xxlCols), ({ $xxxlCols }) => $xxxlCols && generateColsStyles("xxxl", $xxxlCols));
|
|
33
33
|
function LocalGrid({ ...props }, ref) {
|
|
34
|
-
return
|
|
34
|
+
return /*#__PURE__*/ jsx(StyledGrid, {
|
|
35
35
|
...props,
|
|
36
36
|
ref,
|
|
37
37
|
children: props.children
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
var Grid =
|
|
40
|
+
var Grid = /*#__PURE__*/ forwardRef(LocalGrid);
|
|
41
41
|
//#endregion
|
|
42
42
|
export { Grid };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Theme } from './utils';
|
|
3
|
+
export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
"aria-label": string;
|
|
6
|
+
$size?: "default" | "big" | "small";
|
|
7
|
+
$error?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const iconButtonStyles: (theme: Theme, $size?: "default" | "big" | "small", $error?: boolean, disabled?: boolean) => import('styled-components').RuleSet<object>;
|
|
10
|
+
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export { IconButton };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { resetButton } from "./utils/mixins.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
|
+
import styled, { css } from "styled-components";
|
|
7
|
+
import { darken, lighten } from "polished";
|
|
8
|
+
//#region src/lib/icon-button.tsx
|
|
9
|
+
var iconButtonSizes = {
|
|
10
|
+
small: {
|
|
11
|
+
box: 24,
|
|
12
|
+
icon: 12
|
|
13
|
+
},
|
|
14
|
+
default: {
|
|
15
|
+
box: 28,
|
|
16
|
+
icon: 14
|
|
17
|
+
},
|
|
18
|
+
big: {
|
|
19
|
+
box: 32,
|
|
20
|
+
icon: 16
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var iconButtonStyles = (theme, $size, $error, disabled) => {
|
|
24
|
+
const { box, icon } = iconButtonSizes[$size ?? "default"];
|
|
25
|
+
return css([
|
|
26
|
+
``,
|
|
27
|
+
`;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:`,
|
|
28
|
+
`px;height:`,
|
|
29
|
+
`px;border-radius:50%;background:`,
|
|
30
|
+
`;border:solid 2px `,
|
|
31
|
+
`;color:`,
|
|
32
|
+
`;box-shadow:0 0 0 0px `,
|
|
33
|
+
`;transition:all 0.3s ease;& svg{width:`,
|
|
34
|
+
`px;height:`,
|
|
35
|
+
`px;}`,
|
|
36
|
+
` `,
|
|
37
|
+
``
|
|
38
|
+
], resetButton, box, box, theme.colors.light, theme.colors.grayLight, $error ? theme.colors.error : theme.colors.grayDark, $error ? lighten(.1, theme.colors.error) : theme.colors.primaryLight, icon, icon, !disabled && ($error ? css([
|
|
39
|
+
`border-color:`,
|
|
40
|
+
`;&:hover{border-color:`,
|
|
41
|
+
`;color:`,
|
|
42
|
+
`;}&:focus{box-shadow:0 0 0 4px `,
|
|
43
|
+
`;}&:active{box-shadow:0 0 0 2px `,
|
|
44
|
+
`;}`
|
|
45
|
+
], theme.colors.error, darken(.1, theme.colors.error), darken(.1, theme.colors.error), lighten(.1, theme.colors.error), lighten(.1, theme.colors.error)) : css([
|
|
46
|
+
`&:hover{border-color:`,
|
|
47
|
+
`;color:`,
|
|
48
|
+
`;}&:focus{box-shadow:0 0 0 4px `,
|
|
49
|
+
`;border-color:`,
|
|
50
|
+
`;}&:active{box-shadow:0 0 0 2px `,
|
|
51
|
+
`;}`
|
|
52
|
+
], theme.colors.primary, theme.colors.primary, theme.colors.primaryLight, theme.colors.primary, theme.colors.primaryLight)), disabled && css([
|
|
53
|
+
`cursor:not-allowed;background:`,
|
|
54
|
+
`;border-color:`,
|
|
55
|
+
`;color:`,
|
|
56
|
+
`;`
|
|
57
|
+
], theme.colors.grayLight, theme.colors.grayLight, theme.colors.gray));
|
|
58
|
+
};
|
|
59
|
+
var StyledIconButton = styled.button.withConfig({
|
|
60
|
+
displayName: "icon-button__StyledIconButton",
|
|
61
|
+
componentId: "sc-def35ae6-0"
|
|
62
|
+
})([``, ``], ({ theme, $size, $error, disabled }) => iconButtonStyles(theme, $size, $error, disabled));
|
|
63
|
+
function LocalIconButton({ ...props }, ref) {
|
|
64
|
+
return /*#__PURE__*/ jsx(StyledIconButton, {
|
|
65
|
+
type: "button",
|
|
66
|
+
...props,
|
|
67
|
+
ref
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
var IconButton = /*#__PURE__*/ forwardRef(LocalIconButton);
|
|
71
|
+
//#endregion
|
|
72
|
+
export { IconButton, iconButtonStyles };
|
package/dist/icon.js
CHANGED
|
@@ -4,7 +4,7 @@ import { icons } from "lucide-react";
|
|
|
4
4
|
var Icon = ({ name, color, size, className, "aria-label": ariaLabel }) => {
|
|
5
5
|
const LucideIcon = icons[name];
|
|
6
6
|
if (!LucideIcon) return null;
|
|
7
|
-
return
|
|
7
|
+
return /*#__PURE__*/ jsx(LucideIcon, {
|
|
8
8
|
color,
|
|
9
9
|
size,
|
|
10
10
|
className,
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
export * from './styled-components';
|
|
2
2
|
export * from './utils';
|
|
3
|
+
export * from './accordion';
|
|
4
|
+
export * from './avatar-dropzone';
|
|
3
5
|
export * from './box';
|
|
4
6
|
export * from './button';
|
|
5
7
|
export * from './col';
|
|
6
8
|
export * from './container';
|
|
9
|
+
export * from './dropzone';
|
|
7
10
|
export * from './flex';
|
|
8
11
|
export * from './grid';
|
|
9
12
|
export * from './icon';
|
|
13
|
+
export * from './icon-button';
|
|
10
14
|
export * from './input';
|
|
11
15
|
export * from './max-width';
|
|
16
|
+
export * from './modal';
|
|
17
|
+
export * from './password';
|
|
12
18
|
export * from './range';
|
|
13
19
|
export * from './select';
|
|
14
20
|
export * from './space';
|
|
15
21
|
export * from './textarea';
|
|
22
|
+
export * from './toast';
|
|
16
23
|
export * from './toggle';
|
package/dist/index.js
CHANGED
|
@@ -2,21 +2,29 @@ import { StyledComponentsRegistry } from "./styled-components/registry.js";
|
|
|
2
2
|
import { GlobalStyles } from "./utils/global.js";
|
|
3
3
|
import { IconArrow, IconCalendar, IconCheck } from "./utils/icons.js";
|
|
4
4
|
import { breakpoints, colors, colorsDark, fontSizes, fonts, lineHeights, mq, shadows, shadowsDark, spacing, theme, themeDark } from "./utils/theme.js";
|
|
5
|
-
import { formElementHeightStyles, fullWidthStyles, generateColSpanStyles, generateColsStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, resetButton, resetInput, statusBorderStyles } from "./utils/mixins.js";
|
|
5
|
+
import { formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, resetButton, resetInput, statusBorderStyles } from "./utils/mixins.js";
|
|
6
6
|
import { createTypographyStyle, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText } from "./utils/typography.js";
|
|
7
|
+
import { useOnClickOutside } from "./utils/use-on-click-outside.js";
|
|
7
8
|
import { CherryThemeProvider, ThemeContext } from "./styled-components/theme-provider.js";
|
|
9
|
+
import { Icon } from "./icon.js";
|
|
10
|
+
import { Accordion } from "./accordion.js";
|
|
11
|
+
import { Dropzone, matchesAccept } from "./dropzone.js";
|
|
12
|
+
import { AvatarDropzone } from "./avatar-dropzone.js";
|
|
8
13
|
import { Container } from "./container.js";
|
|
9
14
|
import { Box } from "./box.js";
|
|
10
15
|
import { Button, buttonStyles } from "./button.js";
|
|
11
16
|
import { Col } from "./col.js";
|
|
12
17
|
import { Flex } from "./flex.js";
|
|
13
18
|
import { Grid } from "./grid.js";
|
|
14
|
-
import {
|
|
19
|
+
import { IconButton, iconButtonStyles } from "./icon-button.js";
|
|
15
20
|
import { Input, StyledInputWrapper, StyledLabel } from "./input.js";
|
|
16
21
|
import { MaxWidth } from "./max-width.js";
|
|
22
|
+
import { Modal } from "./modal.js";
|
|
23
|
+
import { Password } from "./password.js";
|
|
17
24
|
import { Range } from "./range.js";
|
|
18
25
|
import { Select, StyledIconWrapper } from "./select.js";
|
|
19
26
|
import { Space } from "./space.js";
|
|
20
27
|
import { Textarea } from "./textarea.js";
|
|
28
|
+
import { StyledNotifications, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, useToastNotifications } from "./toast.js";
|
|
21
29
|
import { Toggle } from "./toggle.js";
|
|
22
|
-
export { Box, Button, CherryThemeProvider, Col, Container, Flex, GlobalStyles, Grid, Icon, IconArrow, IconCalendar, IconCheck, Input, MaxWidth, Range, Select, Space, StyledComponentsRegistry, StyledIconWrapper, StyledInputWrapper, StyledLabel, Textarea, ThemeContext, Toggle, breakpoints, buttonStyles, colors, colorsDark, createTypographyStyle, fontSizes, fonts, formElementHeightStyles, fullWidthStyles, generateColSpanStyles, generateColsStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, lineHeights, mq, resetButton, resetInput, shadows, shadowsDark, spacing, statusBorderStyles, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText, theme, themeDark };
|
|
30
|
+
export { Accordion, AvatarDropzone, Box, Button, CherryThemeProvider, Col, Container, Dropzone, Flex, GlobalStyles, Grid, Icon, IconArrow, IconButton, IconCalendar, IconCheck, Input, MaxWidth, Modal, Password, Range, Select, Space, StyledComponentsRegistry, StyledIconWrapper, StyledInputWrapper, StyledLabel, StyledNotifications, Textarea, ThemeContext, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, Toggle, breakpoints, buttonStyles, colors, colorsDark, createTypographyStyle, fontSizes, fonts, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, iconButtonStyles, lineHeights, matchesAccept, mq, resetButton, resetInput, shadows, shadowsDark, spacing, statusBorderStyles, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText, theme, themeDark, useOnClickOutside, useToastNotifications };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { IStyledComponent } from 'styled-components';
|
|
3
|
-
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
$wrapperClassName?: string;
|
|
6
6
|
$label?: string;
|
package/dist/input.js
CHANGED
|
@@ -8,7 +8,7 @@ import styled, { css } from "styled-components";
|
|
|
8
8
|
//#region src/lib/input.tsx
|
|
9
9
|
var StyledInputWrapper = styled.span.withConfig({
|
|
10
10
|
displayName: "input__StyledInputWrapper",
|
|
11
|
-
componentId: "sc-
|
|
11
|
+
componentId: "sc-f9d22714-0"
|
|
12
12
|
})([
|
|
13
13
|
`display:inline-flex;flex-wrap:`,
|
|
14
14
|
`;align-items:center;`,
|
|
@@ -17,7 +17,7 @@ var StyledInputWrapper = styled.span.withConfig({
|
|
|
17
17
|
], ({ type }) => type === "checkbox" || type === "radio" ? "nowrap" : "wrap", ({ $label }) => $label && css([`gap:5px;align-items:flex-start;align-content:flex-start;`]), ({ $fullWidth }) => fullWidthStyles($fullWidth));
|
|
18
18
|
var StyledLabel = styled.label.withConfig({
|
|
19
19
|
displayName: "input__StyledLabel",
|
|
20
|
-
componentId: "sc-
|
|
20
|
+
componentId: "sc-f9d22714-1"
|
|
21
21
|
})([
|
|
22
22
|
`display:inline-block;color:`,
|
|
23
23
|
`;font-size:`,
|
|
@@ -26,7 +26,7 @@ var StyledLabel = styled.label.withConfig({
|
|
|
26
26
|
], ({ theme }) => theme.colors.grayDark, ({ theme }) => theme.fontSizes.small.lg, ({ theme }) => theme.lineHeights.small.lg);
|
|
27
27
|
var StyledInput = styled.input.withConfig({
|
|
28
28
|
displayName: "input__StyledInput",
|
|
29
|
-
componentId: "sc-
|
|
29
|
+
componentId: "sc-f9d22714-2"
|
|
30
30
|
})([
|
|
31
31
|
``,
|
|
32
32
|
`;`,
|
|
@@ -76,11 +76,11 @@ var StyledInput = styled.input.withConfig({
|
|
|
76
76
|
`, ({ $fullWidth }) => fullWidthStyles($fullWidth));
|
|
77
77
|
var StyledIconWrapper = styled.span.withConfig({
|
|
78
78
|
displayName: "input__StyledIconWrapper",
|
|
79
|
-
componentId: "sc-
|
|
79
|
+
componentId: "sc-f9d22714-3"
|
|
80
80
|
})([`display:inline-flex;position:relative;line-height:0;min-width:fit-content;& em{display:block;border-radius:50%;background:`, `;}& svg,& em{object-fit:contain;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(0.7);opacity:0;pointer-events:none;transition:all 0.3s ease;}`], ({ theme }) => theme.colors.primary);
|
|
81
81
|
var StyledRadioCheckboxInput = styled.input.withConfig({
|
|
82
82
|
displayName: "input__StyledRadioCheckboxInput",
|
|
83
|
-
componentId: "sc-
|
|
83
|
+
componentId: "sc-f9d22714-4"
|
|
84
84
|
})([
|
|
85
85
|
``,
|
|
86
86
|
`;display:inline-block;background:`,
|
|
@@ -165,7 +165,7 @@ var StyledRadioCheckboxInput = styled.input.withConfig({
|
|
|
165
165
|
});
|
|
166
166
|
var StyledCustomIconWrapper = styled.span.withConfig({
|
|
167
167
|
displayName: "input__StyledCustomIconWrapper",
|
|
168
|
-
componentId: "sc-
|
|
168
|
+
componentId: "sc-f9d22714-5"
|
|
169
169
|
})([
|
|
170
170
|
`position:relative;`,
|
|
171
171
|
`;& svg{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none;width:24px;height:24px;object-fit:contain;color:`,
|
|
@@ -173,45 +173,45 @@ var StyledCustomIconWrapper = styled.span.withConfig({
|
|
|
173
173
|
` &:has(.icon-calendar) > input{padding-right:45px;@supports (-moz-appearance:none){padding-right:15px;}}`
|
|
174
174
|
], ({ $fullWidth }) => fullWidthStyles($fullWidth), ({ theme }) => theme.colors.primary, ({ $icon, $iconPosition }) => $icon && $iconPosition === "right" ? css([`& svg{right:16px;}& input{padding-right:50px;}`]) : css([`& svg{left:16px;}& svg ~ input{padding-left:50px;}`]));
|
|
175
175
|
function LocalInput({ ...props }, ref) {
|
|
176
|
-
if (props.type === "checkbox" || props.type === "radio") return
|
|
176
|
+
if (props.type === "checkbox" || props.type === "radio") return /*#__PURE__*/ jsxs(StyledInputWrapper, {
|
|
177
177
|
$fullWidth: props.$fullWidth,
|
|
178
178
|
type: props.type,
|
|
179
179
|
$label: props.$label,
|
|
180
180
|
className: props.$wrapperClassName,
|
|
181
|
-
children: [
|
|
181
|
+
children: [/*#__PURE__*/ jsxs(StyledIconWrapper, { children: [/*#__PURE__*/ jsx(StyledRadioCheckboxInput, {
|
|
182
182
|
...props,
|
|
183
183
|
"aria-invalid": props.$error || void 0,
|
|
184
184
|
ref
|
|
185
|
-
}), !props.disabled && props.type === "checkbox" ?
|
|
185
|
+
}), !props.disabled && props.type === "checkbox" ? /*#__PURE__*/ jsx(IconCheck, {}) : /*#__PURE__*/ jsx("em", {})] }), props.$label && /*#__PURE__*/ jsx(StyledLabel, {
|
|
186
186
|
htmlFor: props.id,
|
|
187
187
|
children: props.$label
|
|
188
188
|
})]
|
|
189
189
|
});
|
|
190
|
-
return
|
|
190
|
+
return /*#__PURE__*/ jsxs(StyledInputWrapper, {
|
|
191
191
|
$fullWidth: props.$fullWidth,
|
|
192
192
|
type: props.type,
|
|
193
193
|
$label: props.$label,
|
|
194
194
|
className: props.$wrapperClassName,
|
|
195
|
-
children: [props.$label &&
|
|
195
|
+
children: [props.$label && /*#__PURE__*/ jsx(StyledLabel, {
|
|
196
196
|
htmlFor: props.id,
|
|
197
197
|
children: props.$label
|
|
198
|
-
}),
|
|
198
|
+
}), /*#__PURE__*/ jsxs(StyledCustomIconWrapper, {
|
|
199
199
|
$fullWidth: props.$fullWidth,
|
|
200
200
|
$iconPosition: props.$iconPosition,
|
|
201
201
|
$icon: props.$icon,
|
|
202
202
|
children: [
|
|
203
203
|
props.$iconPosition !== "right" && props.$icon && props.$icon,
|
|
204
|
-
|
|
204
|
+
/*#__PURE__*/ jsx(StyledInput, {
|
|
205
205
|
...props,
|
|
206
206
|
"aria-invalid": props.$error || void 0,
|
|
207
207
|
ref
|
|
208
208
|
}),
|
|
209
209
|
props.$iconPosition === "right" && props.$icon && props.$icon,
|
|
210
|
-
(props.type === "date" || props.type === "datetime-local" || props.type === "month" || props.type === "week" || props.type === "time") &&
|
|
210
|
+
(props.type === "date" || props.type === "datetime-local" || props.type === "month" || props.type === "week" || props.type === "time") && /*#__PURE__*/ jsx(IconCalendar, { className: "icon-calendar" })
|
|
211
211
|
]
|
|
212
212
|
})]
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
|
-
var Input =
|
|
215
|
+
var Input = /*#__PURE__*/ forwardRef(LocalInput);
|
|
216
216
|
//#endregion
|
|
217
217
|
export { Input, StyledInputWrapper, StyledLabel };
|
package/dist/max-width.js
CHANGED
|
@@ -39,12 +39,12 @@ var StyledMaxWidth = styled.div.withConfig({
|
|
|
39
39
|
${$size && styles($size)};
|
|
40
40
|
`, (props) => responsiveStyles(props));
|
|
41
41
|
function LocalMaxWidth({ ...props }, ref) {
|
|
42
|
-
return
|
|
42
|
+
return /*#__PURE__*/ jsx(StyledMaxWidth, {
|
|
43
43
|
...props,
|
|
44
44
|
ref,
|
|
45
45
|
children: props.children
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
var MaxWidth =
|
|
48
|
+
var MaxWidth = /*#__PURE__*/ forwardRef(LocalMaxWidth);
|
|
49
49
|
//#endregion
|
|
50
50
|
export { MaxWidth };
|
package/dist/modal.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ModalProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
$isOpen: boolean;
|
|
5
|
+
$onClose: () => void;
|
|
6
|
+
$title?: string;
|
|
7
|
+
$width?: number;
|
|
8
|
+
}
|
|
9
|
+
declare function Modal({ children, $isOpen, $onClose, $title, $width }: ModalProps): React.ReactPortal | null;
|
|
10
|
+
export { Modal };
|
package/dist/modal.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { mq } from "./utils/theme.js";
|
|
4
|
+
import { styledH5, styledText } from "./utils/typography.js";
|
|
5
|
+
import { useOnClickOutside } from "./utils/use-on-click-outside.js";
|
|
6
|
+
import { Icon } from "./icon.js";
|
|
7
|
+
import { IconButton } from "./icon-button.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { useCallback, useEffect, useRef, useSyncExternalStore } from "react";
|
|
10
|
+
import styled, { css } from "styled-components";
|
|
11
|
+
import { rgba } from "polished";
|
|
12
|
+
import { createPortal } from "react-dom";
|
|
13
|
+
//#region src/lib/modal.tsx
|
|
14
|
+
var emptySubscribe = () => () => {};
|
|
15
|
+
function useIsClient() {
|
|
16
|
+
return useSyncExternalStore(emptySubscribe, () => true, () => false);
|
|
17
|
+
}
|
|
18
|
+
var StyledModal = styled.div.withConfig({
|
|
19
|
+
displayName: "modal__StyledModal",
|
|
20
|
+
componentId: "sc-43ca5273-0"
|
|
21
|
+
})([
|
|
22
|
+
`position:fixed;top:0;left:0;width:100%;height:100%;background:`,
|
|
23
|
+
`;display:flex;justify-content:center;align-items:center;z-index:1010;pointer-events:none;opacity:0;transition:all 0.3s ease;`,
|
|
24
|
+
` & .modal-inner{background:`,
|
|
25
|
+
`;border-radius:`,
|
|
26
|
+
`;padding:20px;max-width:calc(100% - 40px);width:100%;margin:auto;position:relative;transform:translateY(40px);transition:all 0.3s ease;`,
|
|
27
|
+
` `,
|
|
28
|
+
`{max-width:500px;`,
|
|
29
|
+
`}}`
|
|
30
|
+
], ({ theme }) => rgba(theme.colors.primary, .5), ({ $isOpen }) => $isOpen && css([`opacity:1;pointer-events:all;`]), ({ theme }) => theme.colors.light, ({ theme }) => theme.spacing.radius.lg, ({ $isOpen }) => $isOpen && css([`transform:translateY(0);`]), mq("lg"), ({ $width }) => $width && css([`max-width:`, `px;`], $width));
|
|
31
|
+
var StyledModalClose = styled(IconButton).withConfig({
|
|
32
|
+
displayName: "modal__StyledModalClose",
|
|
33
|
+
componentId: "sc-43ca5273-1"
|
|
34
|
+
})([`position:absolute;top:20px;right:20px;z-index:10;`]);
|
|
35
|
+
var StyledModalTitle = styled.h2.withConfig({
|
|
36
|
+
displayName: "modal__StyledModalTitle",
|
|
37
|
+
componentId: "sc-43ca5273-2"
|
|
38
|
+
})([
|
|
39
|
+
`--divider-color:`,
|
|
40
|
+
`;margin:0 0 15px 0;padding:0 0 15px 0;color:`,
|
|
41
|
+
`;position:relative;`,
|
|
42
|
+
`;&::after{content:"";position:absolute;bottom:0;left:0;width:100%;height:1px;background:var(--divider-color);}`
|
|
43
|
+
], ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.dark, ({ theme }) => styledH5(theme));
|
|
44
|
+
var StyledModalContent = styled.div.withConfig({
|
|
45
|
+
displayName: "modal__StyledModalContent",
|
|
46
|
+
componentId: "sc-43ca5273-3"
|
|
47
|
+
})([
|
|
48
|
+
`max-height:calc(100svh - 200px);overflow-y:auto;padding:5px;margin:-5px;--divider-color:`,
|
|
49
|
+
`;`,
|
|
50
|
+
`;& hr{margin:20px 0;border:none;border-bottom:solid 1px var(--divider-color);}`
|
|
51
|
+
], ({ theme }) => theme.colors.grayLight, ({ theme }) => styledText(theme));
|
|
52
|
+
function Modal({ children, $isOpen, $onClose, $title, $width }) {
|
|
53
|
+
const wrapperRef = useRef(null);
|
|
54
|
+
const elmRef = useRef(null);
|
|
55
|
+
const isClient = useIsClient();
|
|
56
|
+
const closeModal = useCallback(() => {
|
|
57
|
+
$onClose();
|
|
58
|
+
}, [$onClose]);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (!$isOpen) return;
|
|
61
|
+
function handleKeydown(event) {
|
|
62
|
+
if (event.key === "Escape") {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
closeModal();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
document.addEventListener("keydown", handleKeydown);
|
|
68
|
+
return () => document.removeEventListener("keydown", handleKeydown);
|
|
69
|
+
}, [$isOpen, closeModal]);
|
|
70
|
+
useOnClickOutside([elmRef, wrapperRef], $isOpen ? closeModal : () => {});
|
|
71
|
+
if (!isClient) return null;
|
|
72
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx(StyledModal, {
|
|
73
|
+
$isOpen,
|
|
74
|
+
$width,
|
|
75
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
76
|
+
className: "modal-inner",
|
|
77
|
+
ref: wrapperRef,
|
|
78
|
+
children: [
|
|
79
|
+
/*#__PURE__*/ jsx("span", {
|
|
80
|
+
ref: elmRef,
|
|
81
|
+
children: /*#__PURE__*/ jsx(StyledModalClose, {
|
|
82
|
+
$size: "small",
|
|
83
|
+
onClick: closeModal,
|
|
84
|
+
className: "modal-close",
|
|
85
|
+
"aria-label": "Close Modal",
|
|
86
|
+
children: /*#__PURE__*/ jsx(Icon, { name: "X" })
|
|
87
|
+
})
|
|
88
|
+
}),
|
|
89
|
+
$title && /*#__PURE__*/ jsx(StyledModalTitle, { children: $title }),
|
|
90
|
+
/*#__PURE__*/ jsx(StyledModalContent, { children })
|
|
91
|
+
]
|
|
92
|
+
})
|
|
93
|
+
}), document.body);
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { Modal };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { InputProps } from './input';
|
|
3
|
+
export type PasswordProps = Omit<InputProps, "type" | "$icon" | "$iconPosition">;
|
|
4
|
+
declare const Password: React.ForwardRefExoticComponent<PasswordProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
|
+
export { Password };
|
package/dist/password.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { fullWidthStyles } from "./utils/mixins.js";
|
|
4
|
+
import { Icon } from "./icon.js";
|
|
5
|
+
import { IconButton } from "./icon-button.js";
|
|
6
|
+
import { Input } from "./input.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { forwardRef, useState } from "react";
|
|
9
|
+
import styled, { css } from "styled-components";
|
|
10
|
+
//#region src/lib/password.tsx
|
|
11
|
+
var passwordSizes = {
|
|
12
|
+
small: {
|
|
13
|
+
height: 40,
|
|
14
|
+
inset: 8,
|
|
15
|
+
button: 24
|
|
16
|
+
},
|
|
17
|
+
default: {
|
|
18
|
+
height: 50,
|
|
19
|
+
inset: 11,
|
|
20
|
+
button: 28
|
|
21
|
+
},
|
|
22
|
+
big: {
|
|
23
|
+
height: 60,
|
|
24
|
+
inset: 16,
|
|
25
|
+
button: 28
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var StyledPassword = styled.span.withConfig({
|
|
29
|
+
displayName: "password__StyledPassword",
|
|
30
|
+
componentId: "sc-b3beabaa-0"
|
|
31
|
+
})([
|
|
32
|
+
`position:relative;display:inline-flex;& input{padding-right:`,
|
|
33
|
+
`;}`,
|
|
34
|
+
``
|
|
35
|
+
], ({ $size }) => {
|
|
36
|
+
const { inset, button } = passwordSizes[$size ?? "default"];
|
|
37
|
+
return `${inset + button + 10}px`;
|
|
38
|
+
}, ({ $fullWidth }) => fullWidthStyles($fullWidth));
|
|
39
|
+
var StyledPasswordReveal = styled.span.withConfig({
|
|
40
|
+
displayName: "password__StyledPasswordReveal",
|
|
41
|
+
componentId: "sc-b3beabaa-1"
|
|
42
|
+
})([`position:absolute;bottom:0;display:flex;align-items:center;`, ``], ({ $size }) => {
|
|
43
|
+
const { height, inset } = passwordSizes[$size ?? "default"];
|
|
44
|
+
return css([
|
|
45
|
+
`right:`,
|
|
46
|
+
`px;height:`,
|
|
47
|
+
`px;`
|
|
48
|
+
], inset, height);
|
|
49
|
+
});
|
|
50
|
+
function LocalPassword({ ...props }, ref) {
|
|
51
|
+
const [show, setShow] = useState(false);
|
|
52
|
+
return /*#__PURE__*/ jsxs(StyledPassword, {
|
|
53
|
+
$size: props.$size,
|
|
54
|
+
$fullWidth: props.$fullWidth,
|
|
55
|
+
children: [/*#__PURE__*/ jsx(Input, {
|
|
56
|
+
...props,
|
|
57
|
+
type: show ? "text" : "password",
|
|
58
|
+
ref
|
|
59
|
+
}), /*#__PURE__*/ jsx(StyledPasswordReveal, {
|
|
60
|
+
$size: props.$size,
|
|
61
|
+
children: /*#__PURE__*/ jsx(IconButton, {
|
|
62
|
+
$size: props.$size === "small" ? "small" : "default",
|
|
63
|
+
$error: props.$error,
|
|
64
|
+
"aria-label": show ? "Hide password" : "Show password",
|
|
65
|
+
"aria-pressed": show,
|
|
66
|
+
title: show ? "Hide password" : "Show password",
|
|
67
|
+
onClick: () => setShow((prev) => !prev),
|
|
68
|
+
children: /*#__PURE__*/ jsx(Icon, { name: show ? "EyeOff" : "Eye" })
|
|
69
|
+
})
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
var Password = /*#__PURE__*/ forwardRef(LocalPassword);
|
|
74
|
+
//#endregion
|
|
75
|
+
export { Password };
|
package/dist/range.js
CHANGED
|
@@ -144,13 +144,13 @@ var StyledInput = styled.input.withConfig({
|
|
|
144
144
|
`;
|
|
145
145
|
});
|
|
146
146
|
function LocalRange({ ...props }, ref) {
|
|
147
|
-
return
|
|
147
|
+
return /*#__PURE__*/ jsxs(StyledInputWrapper, {
|
|
148
148
|
$fullWidth: props.$fullWidth,
|
|
149
149
|
className: props.$wrapperClassName,
|
|
150
|
-
children: [props.$label &&
|
|
150
|
+
children: [props.$label && /*#__PURE__*/ jsx(StyledLabel, {
|
|
151
151
|
htmlFor: props.id,
|
|
152
152
|
children: props.$label
|
|
153
|
-
}),
|
|
153
|
+
}), /*#__PURE__*/ jsx(StyledInput, {
|
|
154
154
|
...props,
|
|
155
155
|
"aria-invalid": props.$error || void 0,
|
|
156
156
|
type: "range",
|
|
@@ -158,6 +158,6 @@ function LocalRange({ ...props }, ref) {
|
|
|
158
158
|
})]
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
-
var Range =
|
|
161
|
+
var Range = /*#__PURE__*/ forwardRef(LocalRange);
|
|
162
162
|
//#endregion
|
|
163
163
|
export { Range };
|