@nextui-org/react 1.0.1-alpha.50 → 1.0.1-alpha.54
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/cjs/avatar/avatar-group.js +9 -4
- package/cjs/avatar/avatar.d.ts +3 -1
- package/cjs/avatar/avatar.js +20 -30
- package/cjs/backdrop/index.d.ts +4 -1
- package/cjs/backdrop/index.js +15 -8
- package/cjs/button/button-group.d.ts +1 -1
- package/cjs/button/button.js +10 -18
- package/cjs/card/card-body.d.ts +35 -0
- package/cjs/card/card-body.js +73 -0
- package/cjs/card/card-context.d.ts +8 -0
- package/cjs/card/card-context.js +20 -0
- package/cjs/card/card-footer.d.ts +25 -4
- package/cjs/card/card-footer.js +56 -8
- package/cjs/card/card-header.d.ts +23 -0
- package/cjs/card/card-header.js +54 -0
- package/cjs/card/card.d.ts +25 -12
- package/cjs/card/card.js +99 -36
- package/cjs/card/index.js +8 -4
- package/cjs/card/styles.d.ts +7 -8
- package/cjs/card/styles.js +30 -60
- package/cjs/collapse/collapse-context.d.ts +9 -0
- package/cjs/collapse/collapse-context.js +20 -0
- package/cjs/collapse/collapse-group.d.ts +32 -0
- package/cjs/collapse/collapse-group.js +111 -0
- package/cjs/collapse/collapse-icon.d.ts +3 -0
- package/cjs/collapse/collapse-icon.js +39 -0
- package/cjs/collapse/collapse.d.ts +39 -0
- package/cjs/collapse/collapse.js +174 -0
- package/cjs/collapse/index.d.ts +2 -0
- package/cjs/collapse/index.js +15 -0
- package/cjs/css-baseline/css-baseline.js +3 -3
- package/cjs/divider/divider.d.ts +8 -9
- package/cjs/divider/divider.js +9 -9
- package/cjs/image/image.d.ts +9 -8
- package/cjs/image/image.js +27 -17
- package/cjs/index.d.ts +8 -0
- package/cjs/index.js +29 -2
- package/cjs/input/input-icon-clear.js +1 -1
- package/cjs/input/input-password.d.ts +1 -1
- package/cjs/modal/modal-close-button.js +1 -1
- package/cjs/modal/modal-wrapper.d.ts +1 -0
- package/cjs/modal/modal-wrapper.js +28 -15
- package/cjs/modal/modal.d.ts +2 -0
- package/cjs/modal/modal.js +4 -0
- package/cjs/snippet/snippet.js +1 -1
- package/cjs/text/child.d.ts +4 -5
- package/cjs/text/child.js +11 -7
- package/cjs/text/text.d.ts +8 -5
- package/cjs/text/text.js +10 -7
- package/cjs/theme/dark.js +2 -1
- package/cjs/theme/default.js +2 -1
- package/cjs/tooltip/placement.d.ts +29 -0
- package/cjs/tooltip/{position.js → placement.js} +31 -31
- package/cjs/tooltip/tooltip-content.d.ts +3 -3
- package/cjs/tooltip/tooltip-content.js +12 -12
- package/cjs/tooltip/tooltip.d.ts +9 -9
- package/cjs/tooltip/tooltip.js +8 -8
- package/cjs/use-drip/index.d.ts +2 -0
- package/cjs/use-drip/index.js +12 -0
- package/cjs/use-drip/use-drip.d.ts +9 -0
- package/cjs/use-drip/use-drip.js +38 -0
- package/cjs/{shared → utils}/clear-icon.d.ts +0 -0
- package/cjs/{shared → utils}/clear-icon.js +1 -1
- package/cjs/utils/collections.d.ts +1 -0
- package/cjs/utils/collections.js +26 -2
- package/cjs/utils/css-transition.js +1 -1
- package/cjs/{button/button.drip.d.ts → utils/drip.d.ts} +6 -2
- package/cjs/{button/button.drip.js → utils/drip.js} +13 -10
- package/cjs/utils/expand.d.ts +18 -0
- package/cjs/utils/expand.js +97 -0
- package/cjs/utils/icons.js +60 -2
- package/cjs/utils/prop-types.d.ts +9 -2
- package/cjs/utils/prop-types.js +22 -2
- package/collapse/package.json +6 -0
- package/esm/avatar/avatar-group.js +8 -4
- package/esm/avatar/avatar.d.ts +3 -1
- package/esm/avatar/avatar.js +20 -30
- package/esm/backdrop/index.d.ts +4 -1
- package/esm/backdrop/index.js +17 -9
- package/esm/button/button-group.d.ts +1 -1
- package/esm/button/button.js +10 -19
- package/esm/card/card-body.d.ts +35 -0
- package/esm/card/card-body.js +52 -0
- package/esm/card/card-context.d.ts +8 -0
- package/esm/card/card-context.js +6 -0
- package/esm/card/card-footer.d.ts +25 -4
- package/esm/card/card-footer.js +48 -8
- package/esm/card/card-header.d.ts +23 -0
- package/esm/card/card-header.js +38 -0
- package/esm/card/card.d.ts +25 -12
- package/esm/card/card.js +95 -37
- package/esm/card/index.js +6 -4
- package/esm/card/styles.d.ts +7 -8
- package/esm/card/styles.js +25 -59
- package/esm/collapse/collapse-context.d.ts +9 -0
- package/esm/collapse/collapse-context.js +6 -0
- package/esm/collapse/collapse-group.d.ts +32 -0
- package/esm/collapse/collapse-group.js +87 -0
- package/esm/collapse/collapse-icon.d.ts +3 -0
- package/esm/collapse/collapse-icon.js +27 -0
- package/esm/collapse/collapse.d.ts +39 -0
- package/esm/collapse/collapse.js +150 -0
- package/esm/collapse/index.d.ts +2 -0
- package/esm/collapse/index.js +4 -0
- package/esm/css-baseline/css-baseline.js +3 -3
- package/esm/divider/divider.d.ts +8 -9
- package/esm/divider/divider.js +9 -9
- package/esm/image/image.d.ts +9 -8
- package/esm/image/image.js +27 -18
- package/esm/index.d.ts +8 -0
- package/esm/index.js +6 -1
- package/esm/input/input-icon-clear.js +1 -1
- package/esm/input/input-password.d.ts +1 -1
- package/esm/modal/modal-close-button.js +1 -1
- package/esm/modal/modal-wrapper.d.ts +1 -0
- package/esm/modal/modal-wrapper.js +30 -16
- package/esm/modal/modal.d.ts +2 -0
- package/esm/modal/modal.js +4 -0
- package/esm/snippet/snippet.js +1 -1
- package/esm/text/child.d.ts +4 -5
- package/esm/text/child.js +10 -7
- package/esm/text/text.d.ts +8 -5
- package/esm/text/text.js +10 -7
- package/esm/theme/dark.js +2 -1
- package/esm/theme/default.js +2 -1
- package/esm/tooltip/placement.d.ts +29 -0
- package/esm/tooltip/{position.js → placement.js} +27 -27
- package/esm/tooltip/tooltip-content.d.ts +3 -3
- package/esm/tooltip/tooltip-content.js +12 -12
- package/esm/tooltip/tooltip.d.ts +9 -9
- package/esm/tooltip/tooltip.js +8 -8
- package/esm/use-drip/index.d.ts +2 -0
- package/esm/use-drip/index.js +2 -0
- package/esm/use-drip/use-drip.d.ts +9 -0
- package/esm/use-drip/use-drip.js +31 -0
- package/esm/{shared → utils}/clear-icon.d.ts +0 -0
- package/esm/{shared → utils}/clear-icon.js +1 -1
- package/esm/utils/collections.d.ts +1 -0
- package/esm/utils/collections.js +21 -0
- package/esm/utils/css-transition.js +1 -1
- package/esm/{button/button.drip.d.ts → utils/drip.d.ts} +6 -2
- package/esm/{button/button.drip.js → utils/drip.js} +13 -10
- package/esm/utils/expand.d.ts +18 -0
- package/esm/utils/expand.js +78 -0
- package/esm/utils/icons.js +52 -0
- package/esm/utils/prop-types.d.ts +9 -2
- package/esm/utils/prop-types.js +19 -1
- package/package.json +1 -1
- package/umd/nextui.js +1497 -806
- package/umd/nextui.min.js +1 -1
- package/use-drip/package.json +6 -0
- package/cjs/card/card-content.d.ts +0 -13
- package/cjs/card/card-content.js +0 -43
- package/cjs/tooltip/position.d.ts +0 -29
- package/esm/card/card-content.d.ts +0 -13
- package/esm/card/card-content.js +0 -28
- package/esm/tooltip/position.d.ts +0 -29
- package/shared/package.json +0 -6
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import React, { useEffect, useMemo } from 'react';
|
|
3
|
+
import CollapseIcon from './collapse-icon';
|
|
4
|
+
import useTheme from '../use-theme';
|
|
5
|
+
import Expand from '../utils/expand';
|
|
6
|
+
import { useCollapseContext } from './collapse-context';
|
|
7
|
+
import useCurrentState from '../use-current-state';
|
|
8
|
+
import useWarning from '../use-warning';
|
|
9
|
+
import { getNormalWeight } from '../utils/dimensions';
|
|
10
|
+
import { getId } from '../utils/collections';
|
|
11
|
+
import clsx from '../utils/clsx';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
const defaultProps = {
|
|
15
|
+
className: '',
|
|
16
|
+
shadow: false,
|
|
17
|
+
divider: true,
|
|
18
|
+
bordered: false,
|
|
19
|
+
showArrow: true,
|
|
20
|
+
animated: true,
|
|
21
|
+
disabled: false,
|
|
22
|
+
borderWeight: 'light',
|
|
23
|
+
initialExpanded: false
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Collapse = ({
|
|
27
|
+
children,
|
|
28
|
+
title,
|
|
29
|
+
subtitle,
|
|
30
|
+
initialExpanded,
|
|
31
|
+
shadow,
|
|
32
|
+
className,
|
|
33
|
+
divider,
|
|
34
|
+
arrowIcon,
|
|
35
|
+
showArrow,
|
|
36
|
+
disabled,
|
|
37
|
+
onChange,
|
|
38
|
+
bordered,
|
|
39
|
+
contentLeft,
|
|
40
|
+
animated: animatedProp,
|
|
41
|
+
borderWeight: borderWeightProp,
|
|
42
|
+
index,
|
|
43
|
+
...props
|
|
44
|
+
}) => {
|
|
45
|
+
const theme = useTheme();
|
|
46
|
+
const [visible, setVisible, visibleRef] = useCurrentState(initialExpanded);
|
|
47
|
+
const {
|
|
48
|
+
values,
|
|
49
|
+
divider: groupDivider,
|
|
50
|
+
animated: groupAnimated,
|
|
51
|
+
updateValues
|
|
52
|
+
} = useCollapseContext();
|
|
53
|
+
|
|
54
|
+
if (!title) {
|
|
55
|
+
useWarning('"title" is required.', 'Collapse');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (!values.length) return;
|
|
60
|
+
const isActive = !!values.find(item => item === index);
|
|
61
|
+
setVisible(isActive);
|
|
62
|
+
}, [values.join(',')]);
|
|
63
|
+
const arrowComponent = useMemo(() => {
|
|
64
|
+
if (!showArrow) return null;
|
|
65
|
+
return arrowIcon ? arrowIcon : /*#__PURE__*/_jsx(CollapseIcon, {});
|
|
66
|
+
}, [arrowIcon, showArrow]);
|
|
67
|
+
const borderWeight = useMemo(() => {
|
|
68
|
+
const withDivider = groupDivider === undefined ? divider : groupDivider;
|
|
69
|
+
return withDivider ? getNormalWeight(borderWeightProp) : '0px';
|
|
70
|
+
}, [divider, groupDivider, borderWeightProp]);
|
|
71
|
+
const animated = useMemo(() => {
|
|
72
|
+
return groupAnimated === undefined ? animatedProp : groupAnimated;
|
|
73
|
+
}, [groupAnimated, animatedProp]);
|
|
74
|
+
const bgColor = useMemo(() => theme.type === 'dark' ? theme.palette.accents_1 : theme.palette.background, [theme.type]);
|
|
75
|
+
const {
|
|
76
|
+
ariaLabelledById,
|
|
77
|
+
ariaControlId
|
|
78
|
+
} = useMemo(() => {
|
|
79
|
+
const nextuiId = getId();
|
|
80
|
+
return {
|
|
81
|
+
ariaLabelledById: `collapse-button-next-ui-${nextuiId}`,
|
|
82
|
+
ariaControlId: `collapse-next-ui-${nextuiId}`
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
|
|
86
|
+
const clickHandler = event => {
|
|
87
|
+
if (disabled) return;
|
|
88
|
+
const next = !visibleRef.current;
|
|
89
|
+
setVisible(next);
|
|
90
|
+
updateValues && updateValues(index, next);
|
|
91
|
+
onChange && onChange(event, index, next);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return /*#__PURE__*/_jsxs("div", { ...props,
|
|
95
|
+
className: _JSXStyle.dynamic([["1757461102", [borderWeight, theme.palette.border, borderWeight, theme.palette.border, bgColor, theme.expressiveness.shadowMedium, theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.radius, borderWeight, theme.palette.border, theme.layout.gap, theme.layout.gapHalf, theme.palette.foreground, visible ? '-90deg' : '0', theme.palette.accents_5, theme.layout.gap]]]) + " " + (props && props.className != null && props.className || clsx('collapse', {
|
|
96
|
+
shadow,
|
|
97
|
+
bordered
|
|
98
|
+
}, className) || ""),
|
|
99
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
100
|
+
role: "button",
|
|
101
|
+
id: ariaLabelledById,
|
|
102
|
+
"aria-disabled": disabled,
|
|
103
|
+
"aria-expanded": visible,
|
|
104
|
+
"aria-controls": ariaControlId,
|
|
105
|
+
onClick: clickHandler,
|
|
106
|
+
className: _JSXStyle.dynamic([["1757461102", [borderWeight, theme.palette.border, borderWeight, theme.palette.border, bgColor, theme.expressiveness.shadowMedium, theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.radius, borderWeight, theme.palette.border, theme.layout.gap, theme.layout.gapHalf, theme.palette.foreground, visible ? '-90deg' : '0', theme.palette.accents_5, theme.layout.gap]]]) + " " + (clsx('view', {
|
|
107
|
+
disabled
|
|
108
|
+
}) || ""),
|
|
109
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
110
|
+
className: _JSXStyle.dynamic([["1757461102", [borderWeight, theme.palette.border, borderWeight, theme.palette.border, bgColor, theme.expressiveness.shadowMedium, theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.radius, borderWeight, theme.palette.border, theme.layout.gap, theme.layout.gapHalf, theme.palette.foreground, visible ? '-90deg' : '0', theme.palette.accents_5, theme.layout.gap]]]) + " " + (clsx('title', {
|
|
111
|
+
animated
|
|
112
|
+
}) || ""),
|
|
113
|
+
children: [contentLeft && /*#__PURE__*/_jsx("div", {
|
|
114
|
+
className: _JSXStyle.dynamic([["1757461102", [borderWeight, theme.palette.border, borderWeight, theme.palette.border, bgColor, theme.expressiveness.shadowMedium, theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.radius, borderWeight, theme.palette.border, theme.layout.gap, theme.layout.gapHalf, theme.palette.foreground, visible ? '-90deg' : '0', theme.palette.accents_5, theme.layout.gap]]]) + " " + "title-content-left",
|
|
115
|
+
children: contentLeft
|
|
116
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
117
|
+
className: _JSXStyle.dynamic([["1757461102", [borderWeight, theme.palette.border, borderWeight, theme.palette.border, bgColor, theme.expressiveness.shadowMedium, theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.radius, borderWeight, theme.palette.border, theme.layout.gap, theme.layout.gapHalf, theme.palette.foreground, visible ? '-90deg' : '0', theme.palette.accents_5, theme.layout.gap]]]) + " " + "title-content",
|
|
118
|
+
children: [/*#__PURE__*/React.isValidElement(title) ? title : /*#__PURE__*/_jsx("h3", {
|
|
119
|
+
className: _JSXStyle.dynamic([["1757461102", [borderWeight, theme.palette.border, borderWeight, theme.palette.border, bgColor, theme.expressiveness.shadowMedium, theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.radius, borderWeight, theme.palette.border, theme.layout.gap, theme.layout.gapHalf, theme.palette.foreground, visible ? '-90deg' : '0', theme.palette.accents_5, theme.layout.gap]]]),
|
|
120
|
+
children: title
|
|
121
|
+
}), subtitle && /*#__PURE__*/_jsx("div", {
|
|
122
|
+
className: _JSXStyle.dynamic([["1757461102", [borderWeight, theme.palette.border, borderWeight, theme.palette.border, bgColor, theme.expressiveness.shadowMedium, theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.radius, borderWeight, theme.palette.border, theme.layout.gap, theme.layout.gapHalf, theme.palette.foreground, visible ? '-90deg' : '0', theme.palette.accents_5, theme.layout.gap]]]) + " " + "subtitle",
|
|
123
|
+
children: subtitle
|
|
124
|
+
})]
|
|
125
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
126
|
+
className: _JSXStyle.dynamic([["1757461102", [borderWeight, theme.palette.border, borderWeight, theme.palette.border, bgColor, theme.expressiveness.shadowMedium, theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.radius, borderWeight, theme.palette.border, theme.layout.gap, theme.layout.gapHalf, theme.palette.foreground, visible ? '-90deg' : '0', theme.palette.accents_5, theme.layout.gap]]]) + " " + "title-content-right",
|
|
127
|
+
children: arrowComponent
|
|
128
|
+
})]
|
|
129
|
+
})
|
|
130
|
+
}), /*#__PURE__*/_jsx(Expand, {
|
|
131
|
+
isExpanded: visible,
|
|
132
|
+
animated: animated,
|
|
133
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
134
|
+
role: "region",
|
|
135
|
+
tabIndex: -1,
|
|
136
|
+
id: ariaControlId,
|
|
137
|
+
"aria-labelledby": ariaLabelledById,
|
|
138
|
+
className: _JSXStyle.dynamic([["1757461102", [borderWeight, theme.palette.border, borderWeight, theme.palette.border, bgColor, theme.expressiveness.shadowMedium, theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.radius, borderWeight, theme.palette.border, theme.layout.gap, theme.layout.gapHalf, theme.palette.foreground, visible ? '-90deg' : '0', theme.palette.accents_5, theme.layout.gap]]]) + " " + "content",
|
|
139
|
+
children: children
|
|
140
|
+
})
|
|
141
|
+
}), /*#__PURE__*/_jsx(_JSXStyle, {
|
|
142
|
+
id: "1757461102",
|
|
143
|
+
dynamic: [borderWeight, theme.palette.border, borderWeight, theme.palette.border, bgColor, theme.expressiveness.shadowMedium, theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.radius, borderWeight, theme.palette.border, theme.layout.gap, theme.layout.gapHalf, theme.palette.foreground, visible ? '-90deg' : '0', theme.palette.accents_5, theme.layout.gap],
|
|
144
|
+
children: `.collapse.__jsx-style-dynamic-selector{border-top:${borderWeight} solid ${theme.palette.border};border-bottom:${borderWeight} solid ${theme.palette.border};}.shadow.__jsx-style-dynamic-selector{border:none;background:${bgColor};box-shadow:${theme.expressiveness.shadowMedium};border-radius:${theme.layout.radius};padding:0 ${theme.layout.gap};}.bordered.__jsx-style-dynamic-selector{padding:0 ${theme.layout.gap};border-radius:${theme.layout.radius};border:${borderWeight} solid ${theme.palette.border};}.view.__jsx-style-dynamic-selector{cursor:pointer;outline:none;padding:${theme.layout.gap} 0;}.view.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}.view.disabled.__jsx-style-dynamic-selector .title.__jsx-style-dynamic-selector,.view.disabled.__jsx-style-dynamic-selector .subtitle.__jsx-style-dynamic-selector{opacity:0.5;}.title-content-left.__jsx-style-dynamic-selector,.title-content-right.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.title-content-left.__jsx-style-dynamic-selector{margin-right:${theme.layout.gapHalf};}.title-content.__jsx-style-dynamic-selector{width:100%;}.title.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:${theme.palette.foreground};}.title-content-right.__jsx-style-dynamic-selector svg{-webkit-transform:rotateZ(${visible ? '-90deg' : '0'});-ms-transform:rotateZ(${visible ? '-90deg' : '0'});transform:rotateZ(${visible ? '-90deg' : '0'});}.animated.__jsx-style-dynamic-selector .title-content-right.__jsx-style-dynamic-selector svg{-webkit-transition:-webkit-transform 200ms ease;-webkit-transition:transform 200ms ease;transition:transform 200ms ease;}.title-content.__jsx-style-dynamic-selector h1,.title-content.__jsx-style-dynamic-selector h2,.title-content.__jsx-style-dynamic-selector h3,.title-content.__jsx-style-dynamic-selector h4,.title-content.__jsx-style-dynamic-selector h5,.title-content.__jsx-style-dynamic-selector h6,.title-content.__jsx-style-dynamic-selector p,.title-content.__jsx-style-dynamic-selector span,.title-content.__jsx-style-dynamic-selector b{margin:0 !important;}.subtitle.__jsx-style-dynamic-selector{color:${theme.palette.accents_5};margin:0;}.subtitle.__jsx-style-dynamic-selector>*{margin:0;}.content.__jsx-style-dynamic-selector{font-size:1rem;line-height:1.625rem;padding-bottom:${theme.layout.gap};}.content.__jsx-style-dynamic-selector>*:first-child{margin-top:0;}.content.__jsx-style-dynamic-selector>*:last-child{margin-bottom:0;}`
|
|
145
|
+
})]
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
Collapse.defaultProps = defaultProps;
|
|
150
|
+
export default Collapse;
|
|
@@ -12,9 +12,9 @@ const CssBaseline = ({
|
|
|
12
12
|
const theme = useTheme();
|
|
13
13
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
14
14
|
children: [children, /*#__PURE__*/_jsx(_JSXStyle, {
|
|
15
|
-
id: "
|
|
16
|
-
dynamic: [theme.palette.background, theme.palette.text, theme.palette.background, theme.font.sans, theme.font.sans, theme.palette.link, theme.expressiveness.linkStyle, theme.expressiveness.linkHoverStyle, theme.layout.gapHalf, theme.layout.gapHalf, theme.layout.gapHalf, theme.layout.gap, theme.palette.foreground, theme.palette.code, theme.layout.gapQuarter, theme.layout.gapQuarter, addColorAlpha(theme.palette.code, 0.2), theme.font.mono, addColorAlpha(theme.palette.code, 0.3), theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.font.mono, theme.palette.foreground, theme.palette.accents_2, theme.palette.accents_1, theme.layout.gap, theme.layout.gap, theme.palette.accents_5, theme.palette.accents_1, theme.layout.radius, theme.palette.selection, theme.palette.
|
|
17
|
-
children: `html,body{background-color:${theme.palette.background};color:${theme.palette.text};}html{font-size:16px;--nextui-icons-background:${theme.palette.background};}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-size:1rem;line-height:1.5;margin:0;padding:0;min-height:100%;position:relative;overflow-x:hidden;font-family:${theme.font.sans};}*,*:before,*:after{box-sizing:
|
|
15
|
+
id: "2908832453",
|
|
16
|
+
dynamic: [theme.palette.background, theme.palette.text, theme.palette.background, theme.font.sans, theme.font.sans, theme.palette.link, theme.expressiveness.linkStyle, theme.expressiveness.linkHoverStyle, theme.layout.gapHalf, theme.layout.gapHalf, theme.layout.gapHalf, theme.layout.gap, theme.palette.foreground, theme.palette.code, theme.layout.gapQuarter, theme.layout.gapQuarter, addColorAlpha(theme.palette.code, 0.2), theme.font.mono, addColorAlpha(theme.palette.code, 0.3), theme.layout.radius, theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.font.mono, theme.palette.foreground, theme.palette.accents_2, theme.palette.accents_1, theme.layout.gap, theme.layout.gap, theme.palette.accents_5, theme.palette.accents_1, theme.layout.radius, theme.palette.selection, theme.palette.background],
|
|
17
|
+
children: `html,body{background-color:${theme.palette.background};color:${theme.palette.text};}html{font-size:16px;--nextui-icons-background:${theme.palette.background};}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-size:1rem;line-height:1.5;margin:0;padding:0;min-height:100%;position:relative;overflow-x:hidden;font-family:${theme.font.sans};}*,*:before,*:after{box-sizing:border-box;text-rendering:geometricPrecision;-webkit-tap-highlight-color:transparent;}p,small{font-weight:400;color:inherit;-webkit-letter-spacing:-0.005625rem;-moz-letter-spacing:-0.005625rem;-ms-letter-spacing:-0.005625rem;letter-spacing:-0.005625rem;font-family:${theme.font.sans};}p{margin:1rem 0;font-size:1em;line-height:1.625em;}small{margin:0;line-height:1.5;font-size:0.875rem;}b{font-weight:600;}span{font-size:inherit;color:inherit;font-weight:inherit;}img{max-width:100%;}a{cursor:pointer;font-size:inherit;-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:${theme.palette.link};-webkit-text-decoration:${theme.expressiveness.linkStyle};text-decoration:${theme.expressiveness.linkStyle};}a:hover{-webkit-text-decoration:${theme.expressiveness.linkHoverStyle};text-decoration:${theme.expressiveness.linkHoverStyle};}ul,ol{padding:0;list-style-type:none;margin:${theme.layout.gapHalf} ${theme.layout.gapHalf} ${theme.layout.gapHalf} ${theme.layout.gap};color:${theme.palette.foreground};}ol{list-style-type:decimal;}li{margin-bottom:0.625rem;font-size:1em;line-height:1.625em;}h1,h2,h3,h4,h5,h6{color:inherit;margin:0 0 0.625rem 0;}h1{font-size:3rem;-webkit-letter-spacing:-0.066875rem;-moz-letter-spacing:-0.066875rem;-ms-letter-spacing:-0.066875rem;letter-spacing:-0.066875rem;line-height:1.5;font-weight:700;}h2{font-size:2.25rem;-webkit-letter-spacing:-0.020625rem;-moz-letter-spacing:-0.020625rem;-ms-letter-spacing:-0.020625rem;letter-spacing:-0.020625rem;font-weight:600;}h3{font-size:1.5rem;-webkit-letter-spacing:-0.029375rem;-moz-letter-spacing:-0.029375rem;-ms-letter-spacing:-0.029375rem;letter-spacing:-0.029375rem;font-weight:600;}h4{font-size:1.25rem;-webkit-letter-spacing:-0.020625rem;-moz-letter-spacing:-0.020625rem;-ms-letter-spacing:-0.020625rem;letter-spacing:-0.020625rem;font-weight:600;}h5{font-size:1rem;-webkit-letter-spacing:-0.01125rem;-moz-letter-spacing:-0.01125rem;-ms-letter-spacing:-0.01125rem;letter-spacing:-0.01125rem;font-weight:600;}h6{font-size:0.875rem;-webkit-letter-spacing:-0.005625rem;-moz-letter-spacing:-0.005625rem;-ms-letter-spacing:-0.005625rem;letter-spacing:-0.005625rem;font-weight:600;}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;margin:0;}button:focus,input:focus,select:focus,textarea:focus{outline:none;}code{color:${theme.palette.code};padding:calc(${theme.layout.gapQuarter} * 0.5) ${theme.layout.gapQuarter};border-radius:0.375rem;background-color:${addColorAlpha(theme.palette.code, 0.2)};font-family:${theme.font.mono};font-size:0.8rem;white-space:pre-wrap;-webkit-transition:background-color 0.25s ease;transition:background-color 0.25s ease;}code:hover{background-color:${addColorAlpha(theme.palette.code, 0.3)};}pre{border-radius:${theme.layout.radius};padding:calc(${theme.layout.gap} * 0.75) ${theme.layout.gap};margin:${theme.layout.gap} 0;font-family:${theme.font.mono};white-space:pre;overflow:auto;line-height:1.5;text-align:left;font-size:0.875rem;-webkit-overflow-scrolling:touch;}pre code{color:${theme.palette.foreground};font-size:0.8125rem;line-height:1.25rem;white-space:pre;}pre code:before,pre code:after{display:none;}pre p{margin:0;}pre::-webkit-scrollbar{display:none;width:0;height:0;background:transparent;}hr{border-color:${theme.palette.accents_2};}details{background-color:${theme.palette.accents_1};border:none;}details:focus,details:hover,details:active{outline:none;}summary{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;outline:none;}summary::-webkit-details-marker,summary::before{display:none;}summary::-moz-list-bullet{font-size:0;}summary:focus,summary:hover,summary:active{outline:none;list-style:none;}blockquote{padding:calc(0.667 * ${theme.layout.gap}) ${theme.layout.gap};color:${theme.palette.accents_5};background-color:${theme.palette.accents_1};border-radius:${theme.layout.radius};margin:1.5rem 0;}blockquote *:first-child{margin-top:0;}blockquote *:last-child{margin-bottom:0;}::selection{background-color:${theme.palette.selection};color:${theme.palette.background};}`
|
|
18
18
|
})]
|
|
19
19
|
});
|
|
20
20
|
};
|
package/esm/divider/divider.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DividerAlign,
|
|
3
|
-
export declare type DividerTypes = SnippetTypes;
|
|
2
|
+
import { DividerAlign, SimpleColors } from '../utils/prop-types';
|
|
4
3
|
interface Props {
|
|
5
4
|
x?: number;
|
|
6
5
|
y?: number;
|
|
7
|
-
|
|
8
|
-
color?:
|
|
6
|
+
height?: number;
|
|
7
|
+
color?: SimpleColors | string;
|
|
9
8
|
align?: DividerAlign;
|
|
10
9
|
className?: string;
|
|
11
10
|
}
|
|
12
11
|
declare const defaultProps: {
|
|
13
12
|
x: number;
|
|
14
13
|
y: number;
|
|
15
|
-
|
|
14
|
+
height: number;
|
|
16
15
|
align: "left" | "right" | "start" | "center" | "end";
|
|
17
|
-
color:
|
|
16
|
+
color: string;
|
|
18
17
|
className: string;
|
|
19
18
|
};
|
|
20
19
|
declare type NativeAttrs = Omit<React.HTMLAttributes<unknown>, keyof Props>;
|
|
@@ -22,9 +21,9 @@ export declare type DividerProps = Props & typeof defaultProps & NativeAttrs;
|
|
|
22
21
|
declare const _default: React.ComponentType<Partial<{
|
|
23
22
|
x: number;
|
|
24
23
|
y: number;
|
|
25
|
-
|
|
24
|
+
height: number;
|
|
26
25
|
align: "left" | "right" | "start" | "center" | "end";
|
|
27
|
-
color:
|
|
26
|
+
color: string;
|
|
28
27
|
className: string;
|
|
29
|
-
}> & Omit<DividerProps, "className" | "color" | "x" | "y" | "align"
|
|
28
|
+
}> & Omit<DividerProps, "height" | "className" | "color" | "x" | "y" | "align">>;
|
|
30
29
|
export default _default;
|
package/esm/divider/divider.js
CHANGED
|
@@ -9,14 +9,14 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
const defaultProps = {
|
|
10
10
|
x: 0,
|
|
11
11
|
y: 2,
|
|
12
|
-
|
|
12
|
+
height: 1,
|
|
13
13
|
align: 'center',
|
|
14
14
|
color: 'default',
|
|
15
15
|
className: ''
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const Divider = ({
|
|
19
|
-
|
|
19
|
+
height,
|
|
20
20
|
color,
|
|
21
21
|
x,
|
|
22
22
|
y,
|
|
@@ -26,26 +26,26 @@ const Divider = ({
|
|
|
26
26
|
...props
|
|
27
27
|
}) => {
|
|
28
28
|
const theme = useTheme();
|
|
29
|
-
const bgColor = useMemo(() => getNormalColor(color, theme.palette), [color, theme.palette]);
|
|
29
|
+
const bgColor = useMemo(() => getNormalColor(color, theme.palette, theme.palette.border), [color, theme.palette]);
|
|
30
30
|
const alignClassName = useMemo(() => {
|
|
31
31
|
if (!align || align === 'center') return '';
|
|
32
32
|
if (align === 'left' || align === 'start') return 'start';
|
|
33
33
|
return 'end';
|
|
34
34
|
}, [align]);
|
|
35
|
-
const textColor = color === 'default'
|
|
35
|
+
const textColor = color === 'default' ? theme.palette.foreground : color;
|
|
36
36
|
const top = y ? getMargin(y / 2) : 0;
|
|
37
37
|
const left = x ? getMargin(x / 2) : 0;
|
|
38
38
|
return /*#__PURE__*/_jsxs("div", {
|
|
39
39
|
role: "separator",
|
|
40
40
|
...props,
|
|
41
|
-
className: _JSXStyle.dynamic([["
|
|
41
|
+
className: _JSXStyle.dynamic([["3028347750", [height, bgColor, top, left, theme.layout.gap, theme.palette.background, textColor]]]) + " " + (props && props.className != null && props.className || `divider ${className}`),
|
|
42
42
|
children: [children && /*#__PURE__*/_jsx("span", {
|
|
43
|
-
className: _JSXStyle.dynamic([["
|
|
43
|
+
className: _JSXStyle.dynamic([["3028347750", [height, bgColor, top, left, theme.layout.gap, theme.palette.background, textColor]]]) + " " + `text ${alignClassName}`,
|
|
44
44
|
children: children
|
|
45
45
|
}), /*#__PURE__*/_jsx(_JSXStyle, {
|
|
46
|
-
id: "
|
|
47
|
-
dynamic: [
|
|
48
|
-
children: `.divider.__jsx-style-dynamic-selector{width:auto;max-width:100%;height:calc(${
|
|
46
|
+
id: "3028347750",
|
|
47
|
+
dynamic: [height, bgColor, top, left, theme.layout.gap, theme.palette.background, textColor],
|
|
48
|
+
children: `.divider.__jsx-style-dynamic-selector{width:auto;width:100%;max-width:100%;height:calc(${height} * 1px);background:${bgColor};margin:${top} ${left};position:relative;}.text.__jsx-style-dynamic-selector{position:absolute;left:50%;top:50%;min-height:100%;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);padding:0 ${theme.layout.gap};font-size:1rem;font-weight:bold;text-transform:capitalize;background-color:${theme.palette.background};color:${textColor};z-index:10;}.text.start.__jsx-style-dynamic-selector{-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);left:7%;}.text.end.__jsx-style-dynamic-selector{-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);left:auto;right:7%;}`
|
|
49
49
|
})]
|
|
50
50
|
});
|
|
51
51
|
};
|
package/esm/image/image.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ObjectFit } from '../utils/prop-types';
|
|
2
3
|
import ImageBrowser from './image-browser';
|
|
3
4
|
interface Props {
|
|
4
5
|
src: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
width?: number;
|
|
8
|
-
height?: number;
|
|
6
|
+
autoResize?: boolean;
|
|
7
|
+
showSkeleton?: boolean;
|
|
8
|
+
width?: number | string;
|
|
9
|
+
height?: number | string;
|
|
9
10
|
className?: string;
|
|
10
|
-
scale?: string;
|
|
11
11
|
maxDelay?: number;
|
|
12
|
+
objectFit?: ObjectFit;
|
|
12
13
|
}
|
|
13
14
|
declare const defaultProps: {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
showSkeleton: boolean;
|
|
16
|
+
autoResize: boolean;
|
|
17
|
+
objectFit: "inherit" | "initial" | "revert" | "unset" | "none" | "contain" | "cover" | "fill" | "scale-down";
|
|
16
18
|
className: string;
|
|
17
|
-
scale: string;
|
|
18
19
|
maxDelay: number;
|
|
19
20
|
};
|
|
20
21
|
declare type NativeAttrs = Omit<React.ImgHTMLAttributes<unknown>, keyof Props>;
|
package/esm/image/image.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import React, { useEffect, useRef, useMemo, useState } from 'react';
|
|
3
3
|
import useTheme from '../use-theme';
|
|
4
4
|
import ImageSkeleton from './image.skeleton';
|
|
5
5
|
import useRealShape from '../use-real-shape';
|
|
6
6
|
import useCurrentState from '../use-current-state';
|
|
7
7
|
import useResize from '../use-resize';
|
|
8
|
+
import cslx from '../utils/clsx';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
11
|
const defaultProps = {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
showSkeleton: true,
|
|
13
|
+
autoResize: true,
|
|
14
|
+
objectFit: 'scale-down',
|
|
13
15
|
className: '',
|
|
14
|
-
scale: '100%',
|
|
15
16
|
maxDelay: 3000
|
|
16
17
|
};
|
|
17
18
|
|
|
@@ -19,25 +20,31 @@ const Image = ({
|
|
|
19
20
|
src,
|
|
20
21
|
width,
|
|
21
22
|
height,
|
|
22
|
-
|
|
23
|
+
showSkeleton: showSkeletonProp,
|
|
23
24
|
className,
|
|
24
|
-
scale,
|
|
25
25
|
maxDelay,
|
|
26
|
-
|
|
26
|
+
autoResize,
|
|
27
|
+
objectFit,
|
|
27
28
|
...props
|
|
28
29
|
}) => {
|
|
29
|
-
const showAnimation = !disableSkeleton && width && height;
|
|
30
|
-
const w = width ? `${width}px` : 'auto';
|
|
31
|
-
const h = height ? `${height}px` : 'auto';
|
|
32
30
|
const theme = useTheme();
|
|
33
31
|
const [loading, setLoading] = useState(true);
|
|
34
32
|
const [showSkeleton, setShowSkeleton] = useState(true);
|
|
33
|
+
const {
|
|
34
|
+
w,
|
|
35
|
+
h
|
|
36
|
+
} = useMemo(() => {
|
|
37
|
+
return {
|
|
38
|
+
w: width ? typeof width === 'number' ? `${width}px` : width : 'auto',
|
|
39
|
+
h: height ? typeof height === 'number' ? `${height}px` : height : 'auto'
|
|
40
|
+
};
|
|
41
|
+
}, [width, height]);
|
|
35
42
|
const [zoomHeight, setZoomHeight, zoomHeightRef] = useCurrentState(h);
|
|
36
43
|
const imageRef = useRef(null);
|
|
37
44
|
const [shape, updateShape] = useRealShape(imageRef);
|
|
45
|
+
const showAnimation = showSkeletonProp && width && height;
|
|
38
46
|
|
|
39
47
|
const imageLoaded = () => {
|
|
40
|
-
if (!showAnimation) return;
|
|
41
48
|
setLoading(false);
|
|
42
49
|
};
|
|
43
50
|
|
|
@@ -69,7 +76,7 @@ const Image = ({
|
|
|
69
76
|
*/
|
|
70
77
|
|
|
71
78
|
useEffect(() => {
|
|
72
|
-
if (
|
|
79
|
+
if (!autoResize) return;
|
|
73
80
|
const notLoaded = shape.width === 0;
|
|
74
81
|
const isAutoZoom = zoomHeightRef.current === 'auto';
|
|
75
82
|
if (notLoaded || !width || !height) return;
|
|
@@ -81,11 +88,13 @@ const Image = ({
|
|
|
81
88
|
}
|
|
82
89
|
}, [shape, width]);
|
|
83
90
|
useResize(() => {
|
|
84
|
-
if (
|
|
91
|
+
if (!autoResize) return;
|
|
85
92
|
updateShape();
|
|
86
93
|
});
|
|
87
94
|
return /*#__PURE__*/_jsxs("div", {
|
|
88
|
-
className: _JSXStyle.dynamic([["
|
|
95
|
+
className: _JSXStyle.dynamic([["2293692961", [w, zoomHeight, theme.layout.radius, objectFit]]]) + " " + (cslx('image', {
|
|
96
|
+
'image-ready': !loading
|
|
97
|
+
}, className) || ""),
|
|
89
98
|
children: [showSkeleton && showAnimation && /*#__PURE__*/_jsx(ImageSkeleton, {
|
|
90
99
|
opacity: loading ? 0.5 : 0
|
|
91
100
|
}), /*#__PURE__*/_jsx("img", {
|
|
@@ -95,11 +104,11 @@ const Image = ({
|
|
|
95
104
|
onLoad: imageLoaded,
|
|
96
105
|
src: src,
|
|
97
106
|
...props,
|
|
98
|
-
className: _JSXStyle.dynamic([["
|
|
107
|
+
className: _JSXStyle.dynamic([["2293692961", [w, zoomHeight, theme.layout.radius, objectFit]]]) + " " + (props && props.className != null && props.className || "")
|
|
99
108
|
}), /*#__PURE__*/_jsx(_JSXStyle, {
|
|
100
|
-
id: "
|
|
101
|
-
dynamic: [w, zoomHeight, theme.layout.radius,
|
|
102
|
-
children: `.image.__jsx-style-dynamic-selector{width:${w};height:${zoomHeight};margin:0 auto;position:relative;border-radius:${theme.layout.radius};overflow:hidden;max-width:100
|
|
109
|
+
id: "2293692961",
|
|
110
|
+
dynamic: [w, zoomHeight, theme.layout.radius, objectFit],
|
|
111
|
+
children: `.image.__jsx-style-dynamic-selector{width:${w};opacity:0;height:${zoomHeight};margin:0 auto;position:relative;border-radius:${theme.layout.radius};overflow:hidden;max-width:100%;-webkit-transition:-webkit-transform 250ms ease 0ms,opacity 200ms ease-in 0ms;-webkit-transition:transform 250ms ease 0ms,opacity 200ms ease-in 0ms;transition:transform 250ms ease 0ms,opacity 200ms ease-in 0ms;}.image-ready.__jsx-style-dynamic-selector{opacity:1;}img.__jsx-style-dynamic-selector{width:100%;height:100%;object-fit:${objectFit};display:block;}`
|
|
103
112
|
})]
|
|
104
113
|
});
|
|
105
114
|
};
|
package/esm/index.d.ts
CHANGED
|
@@ -7,9 +7,15 @@ export { default as useTheme } from './use-theme';
|
|
|
7
7
|
export { default as usePortal } from './use-portal';
|
|
8
8
|
export { default as useSSR } from './use-ssr';
|
|
9
9
|
export { default as useBodyScroll } from './use-body-scroll';
|
|
10
|
+
export type { BodyScrollOptions } from './use-body-scroll';
|
|
10
11
|
export { default as useClickAway } from './use-click-away';
|
|
12
|
+
export { default as useClipboard } from './use-clipboard';
|
|
13
|
+
export type { UseClipboardOptions, UseClipboardResult } from './use-clipboard';
|
|
11
14
|
export { default as useClickAnywhere } from './use-click-anywhere';
|
|
12
15
|
export { default as useInput } from './use-input';
|
|
16
|
+
export { default as useKeyboard } from './use-keyboard';
|
|
17
|
+
export type { UseKeyboardHandler, KeyboardOptions, KeyboardResult, UseKeyboard } from './use-keyboard';
|
|
18
|
+
export { KeyMod, KeyCode } from './use-keyboard/codes';
|
|
13
19
|
export { default as Avatar } from './avatar';
|
|
14
20
|
export { default as CssBaseline } from './css-baseline';
|
|
15
21
|
export { default as Checkbox } from './checkbox';
|
|
@@ -41,3 +47,5 @@ export { default as Input } from './input';
|
|
|
41
47
|
export { default as Textarea } from './textarea';
|
|
42
48
|
export { default as Modal } from './modal';
|
|
43
49
|
export { default as useModal } from './modal/use-modal';
|
|
50
|
+
export { default as Backdrop } from './backdrop';
|
|
51
|
+
export { default as Collapse } from './collapse';
|
package/esm/index.js
CHANGED
|
@@ -9,8 +9,11 @@ export { default as usePortal } from './use-portal';
|
|
|
9
9
|
export { default as useSSR } from './use-ssr';
|
|
10
10
|
export { default as useBodyScroll } from './use-body-scroll';
|
|
11
11
|
export { default as useClickAway } from './use-click-away';
|
|
12
|
+
export { default as useClipboard } from './use-clipboard';
|
|
12
13
|
export { default as useClickAnywhere } from './use-click-anywhere';
|
|
13
14
|
export { default as useInput } from './use-input';
|
|
15
|
+
export { default as useKeyboard } from './use-keyboard';
|
|
16
|
+
export { KeyMod, KeyCode } from './use-keyboard/codes';
|
|
14
17
|
export { default as Avatar } from './avatar';
|
|
15
18
|
export { default as CssBaseline } from './css-baseline';
|
|
16
19
|
export { default as Checkbox } from './checkbox';
|
|
@@ -41,4 +44,6 @@ export { default as Tooltip } from './tooltip';
|
|
|
41
44
|
export { default as Input } from './input';
|
|
42
45
|
export { default as Textarea } from './textarea';
|
|
43
46
|
export { default as Modal } from './modal';
|
|
44
|
-
export { default as useModal } from './modal/use-modal';
|
|
47
|
+
export { default as useModal } from './modal/use-modal';
|
|
48
|
+
export { default as Backdrop } from './backdrop';
|
|
49
|
+
export { default as Collapse } from './collapse';
|
|
@@ -2,7 +2,7 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import clsx from '../utils/clsx';
|
|
4
4
|
import useTheme from '../use-theme';
|
|
5
|
-
import ClearIcon from '../
|
|
5
|
+
import ClearIcon from '../utils/clear-icon';
|
|
6
6
|
import { getNormalColor } from '../utils/color';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -89,5 +89,5 @@ declare const _default: React.ComponentType<Partial<{
|
|
|
89
89
|
className: string;
|
|
90
90
|
placeholder: string;
|
|
91
91
|
initialValue: string;
|
|
92
|
-
} & NativeAttrs & React.RefAttributes<HTMLInputElement>, "clearable" | "rounded" | "contentClickable" | "contentLeftStyling" | "contentRightStyling" | "width" | "className" | "animated" | "placeholder" | "color" | "status" | "bordered" | "size" | "disabled" | "autoComplete" | "readOnly" | "required" | "initialValue" | "shadow" | "
|
|
92
|
+
} & NativeAttrs & React.RefAttributes<HTMLInputElement>, "clearable" | "rounded" | "contentClickable" | "contentLeftStyling" | "contentRightStyling" | "width" | "className" | "animated" | "placeholder" | "color" | "status" | "bordered" | "size" | "borderWeight" | "disabled" | "autoComplete" | "readOnly" | "required" | "initialValue" | "shadow" | "underlined" | "fullWidth" | "helperColor" | "hideToggle" | "visibleIcon" | "hiddenIcon">>;
|
|
93
93
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import useTheme from '../use-theme';
|
|
4
|
-
import ClearIcon from '../
|
|
4
|
+
import ClearIcon from '../utils/clear-icon';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import React, { useEffect, useRef, useMemo, useState } from 'react';
|
|
3
3
|
import withDefaults from '../utils/with-defaults';
|
|
4
4
|
import useTheme from '../use-theme';
|
|
5
5
|
import CSSTransition from '../utils/css-transition';
|
|
@@ -8,6 +8,7 @@ import ModalCloseButton from './modal-close-button';
|
|
|
8
8
|
import cslx from '../utils/clsx';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
12
|
const defaultProps = {
|
|
12
13
|
className: '',
|
|
13
14
|
visible: false,
|
|
@@ -21,6 +22,7 @@ const ModalWrapper = ({
|
|
|
21
22
|
fullScreen,
|
|
22
23
|
closeButton,
|
|
23
24
|
rebound,
|
|
25
|
+
animated,
|
|
24
26
|
onCloseButtonClick,
|
|
25
27
|
scroll,
|
|
26
28
|
...props
|
|
@@ -29,6 +31,12 @@ const ModalWrapper = ({
|
|
|
29
31
|
const modalContent = useRef(null);
|
|
30
32
|
const tabStart = useRef(null);
|
|
31
33
|
const tabEnd = useRef(null);
|
|
34
|
+
const [rendered, setRendered] = useState(false);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
setRendered(true);
|
|
38
|
+
}, 300);
|
|
39
|
+
}, []);
|
|
32
40
|
useEffect(() => {
|
|
33
41
|
if (!visible) return;
|
|
34
42
|
const activeElement = document.activeElement;
|
|
@@ -57,42 +65,48 @@ const ModalWrapper = ({
|
|
|
57
65
|
onCloseButtonClick && onCloseButtonClick();
|
|
58
66
|
};
|
|
59
67
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
visible: visible,
|
|
63
|
-
enterTime: 20,
|
|
64
|
-
leaveTime: 20,
|
|
65
|
-
clearTime: 300,
|
|
66
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
68
|
+
const renderChildren = useMemo(() => {
|
|
69
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
67
70
|
role: "dialog",
|
|
68
71
|
"aria-modal": visible,
|
|
69
72
|
tabIndex: -1,
|
|
70
73
|
onKeyDown: onKeyDown,
|
|
71
74
|
ref: modalContent,
|
|
72
75
|
...props,
|
|
73
|
-
className: _JSXStyle.dynamic([["
|
|
76
|
+
className: _JSXStyle.dynamic([["1270377280", [scroll ? 'calc(100vh - 200px)' : 'inherit', theme.type === 'light' ? theme.palette.background : theme.palette.accents_1, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gap, theme.layout.gap, theme.layout.gap]]]) + " " + (props && props.className != null && props.className || cslx('modal-wrapper', {
|
|
74
77
|
fullscreen: fullScreen,
|
|
75
78
|
'with-close-button': closeButton,
|
|
76
|
-
'modal-rebound': rebound
|
|
79
|
+
'modal-rebound': rebound,
|
|
80
|
+
rendered
|
|
77
81
|
}, className) || ""),
|
|
78
82
|
children: [/*#__PURE__*/_jsx("div", {
|
|
79
83
|
tabIndex: 0,
|
|
80
84
|
"aria-hidden": "true",
|
|
81
85
|
ref: tabStart,
|
|
82
|
-
className: _JSXStyle.dynamic([["
|
|
86
|
+
className: _JSXStyle.dynamic([["1270377280", [scroll ? 'calc(100vh - 200px)' : 'inherit', theme.type === 'light' ? theme.palette.background : theme.palette.accents_1, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gap, theme.layout.gap, theme.layout.gap]]]) + " " + "hide-tab"
|
|
83
87
|
}), closeButton && /*#__PURE__*/_jsx(ModalCloseButton, {
|
|
84
88
|
onClick: handleClose
|
|
85
89
|
}), children, /*#__PURE__*/_jsx("div", {
|
|
86
90
|
tabIndex: 0,
|
|
87
91
|
"aria-hidden": "true",
|
|
88
92
|
ref: tabEnd,
|
|
89
|
-
className: _JSXStyle.dynamic([["
|
|
93
|
+
className: _JSXStyle.dynamic([["1270377280", [scroll ? 'calc(100vh - 200px)' : 'inherit', theme.type === 'light' ? theme.palette.background : theme.palette.accents_1, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gap, theme.layout.gap, theme.layout.gap]]]) + " " + "hide-tab"
|
|
90
94
|
}), /*#__PURE__*/_jsx(_JSXStyle, {
|
|
91
|
-
id: "
|
|
92
|
-
dynamic: [scroll ? 'calc(100vh - 200px)' : 'inherit', theme.palette.background, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gap, theme.layout.gap, theme.layout.gap],
|
|
93
|
-
children: `.modal-wrapper.__jsx-style-dynamic-selector{max-width:100%;vertical-align:middle;overflow:hidden;height:-webkit-fit-content(20em);height:-moz-fit-content(20em);height:fit-content(20em);max-height:${scroll ? 'calc(100vh - 200px)' : 'inherit'};display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:relative;box-sizing:border-box;background-color:${theme.palette.background};color:${theme.palette.foreground};border-radius:${theme.layout.radius};box-shadow:${theme.expressiveness.shadowLarge};
|
|
95
|
+
id: "1270377280",
|
|
96
|
+
dynamic: [scroll ? 'calc(100vh - 200px)' : 'inherit', theme.type === 'light' ? theme.palette.background : theme.palette.accents_1, theme.palette.foreground, theme.layout.radius, theme.expressiveness.shadowLarge, theme.layout.gap, theme.layout.gap, theme.layout.gap],
|
|
97
|
+
children: `.modal-wrapper.__jsx-style-dynamic-selector{max-width:100%;vertical-align:middle;overflow:hidden;height:-webkit-fit-content(20em);height:-moz-fit-content(20em);height:fit-content(20em);max-height:${scroll ? 'calc(100vh - 200px)' : 'inherit'};display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:relative;box-sizing:border-box;background-color:${theme.type === 'light' ? theme.palette.background : theme.palette.accents_1};color:${theme.palette.foreground};border-radius:${theme.layout.radius};box-shadow:${theme.expressiveness.shadowLarge};outline:none;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;}.hide-tab.__jsx-style-dynamic-selector{outline:none;overflow:hidden;width:0;height:0;opacity:0;}.fullscreen.__jsx-style-dynamic-selector{width:100%;height:100%;max-height:100%;}.modal-rebound.__jsx-style-dynamic-selector:not(.fullscreen){-webkit-animation-duration:250ms;animation-duration:250ms;-webkit-animation-name:rebound-__jsx-style-dynamic-selector;animation-name:rebound-__jsx-style-dynamic-selector;-webkit-animation-timing-function:ease;animation-timing-function:ease;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;}.modal-wrapper-enter.__jsx-style-dynamic-selector:not(.rendered){-webkit-animation-name:appearance-in-__jsx-style-dynamic-selector;animation-name:appearance-in-__jsx-style-dynamic-selector;-webkit-animation-duration:200ms;animation-duration:200ms;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-direction:normal;animation-direction:normal;}.modal-wrapper-leave.__jsx-style-dynamic-selector{-webkit-animation-name:appearance-out-__jsx-style-dynamic-selector;animation-name:appearance-out-__jsx-style-dynamic-selector;-webkit-animation-duration:50ms;animation-duration:50ms;-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out;}.with-close-button.__jsx-style-dynamic-selector{padding-top:${theme.layout.gap};}.fullscreen.__jsx-style-dynamic-selector .close-icon{top:${theme.layout.gap};right:calc(${theme.layout.gap} * 0.5);}.fullscreen.__jsx-style-dynamic-selector .close-icon svg{width:24px;height:24px;}@-webkit-keyframes appearance-in-__jsx-style-dynamic-selector{0%{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}60%{opacity:0.75;-webkit-transform:scale(1.02);-ms-transform:scale(1.02);transform:scale(1.02);}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@keyframes appearance-in-__jsx-style-dynamic-selector{0%{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}60%{opacity:0.75;-webkit-transform:scale(1.02);-ms-transform:scale(1.02);transform:scale(1.02);}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@-webkit-keyframes appearance-out-__jsx-style-dynamic-selector{0%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}100%{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}}@keyframes appearance-out-__jsx-style-dynamic-selector{0%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}100%{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}}@-webkit-keyframes rebound-__jsx-style-dynamic-selector{0%{-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}40%{-webkit-transform:scale(1.02);-ms-transform:scale(1.02);transform:scale(1.02);}80%{-webkit-transform:scale(0.98);-ms-transform:scale(0.98);transform:scale(0.98);}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@keyframes rebound-__jsx-style-dynamic-selector{0%{-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}40%{-webkit-transform:scale(1.02);-ms-transform:scale(1.02);transform:scale(1.02);}80%{-webkit-transform:scale(0.98);-ms-transform:scale(0.98);transform:scale(0.98);}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}`
|
|
94
98
|
})]
|
|
95
|
-
})
|
|
99
|
+
});
|
|
100
|
+
}, [rebound, children]);
|
|
101
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
102
|
+
children: animated ? /*#__PURE__*/_jsx(CSSTransition, {
|
|
103
|
+
name: "modal-wrapper",
|
|
104
|
+
visible: visible,
|
|
105
|
+
enterTime: 20,
|
|
106
|
+
leaveTime: 20,
|
|
107
|
+
clearTime: 300,
|
|
108
|
+
children: renderChildren
|
|
109
|
+
}) : visible ? renderChildren : null
|
|
96
110
|
});
|
|
97
111
|
};
|
|
98
112
|
|