@nextui-org/react 1.0.1-alpha.55 → 1.0.1-alpha.56

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/index.d.ts CHANGED
@@ -49,3 +49,4 @@ export { default as Modal } from './modal';
49
49
  export { default as useModal } from './modal/use-modal';
50
50
  export { default as Backdrop } from './backdrop';
51
51
  export { default as Collapse } from './collapse';
52
+ export { default as Progress } from './progress';
package/cjs/index.js CHANGED
@@ -44,10 +44,11 @@ var _exportNames = {
44
44
  useModal: true,
45
45
  Backdrop: true,
46
46
  Collapse: true,
47
+ Progress: true,
47
48
  KeyMod: true,
48
49
  KeyCode: true
49
50
  };
50
- exports.KeyCode = exports.KeyMod = exports.Collapse = exports.Backdrop = exports.useModal = exports.Modal = exports.Textarea = exports.Input = exports.Tooltip = exports.Snippet = exports.Container = exports.Code = exports.Divider = exports.Col = exports.Row = exports.Image = exports.Card = exports.Grid = exports.Button = exports.Loading = exports.Link = exports.User = exports.Spacer = exports.Switch = exports.Radio = exports.Text = exports.Checkbox = exports.CssBaseline = exports.Avatar = exports.useKeyboard = exports.useInput = exports.useClickAnywhere = exports.useClipboard = exports.useClickAway = exports.useBodyScroll = exports.useSSR = exports.usePortal = exports.useTheme = exports.useResize = exports.useRealShape = exports.useCurrentState = exports.ThemeProvider = void 0;
51
+ exports.KeyCode = exports.KeyMod = exports.Progress = exports.Collapse = exports.Backdrop = exports.useModal = exports.Modal = exports.Textarea = exports.Input = exports.Tooltip = exports.Snippet = exports.Container = exports.Code = exports.Divider = exports.Col = exports.Row = exports.Image = exports.Card = exports.Grid = exports.Button = exports.Loading = exports.Link = exports.User = exports.Spacer = exports.Switch = exports.Radio = exports.Text = exports.Checkbox = exports.CssBaseline = exports.Avatar = exports.useKeyboard = exports.useInput = exports.useClickAnywhere = exports.useClipboard = exports.useClickAway = exports.useBodyScroll = exports.useSSR = exports.usePortal = exports.useTheme = exports.useResize = exports.useRealShape = exports.useCurrentState = exports.ThemeProvider = void 0;
51
52
 
52
53
  var _types = require("./theme/types");
53
54
 
@@ -259,6 +260,10 @@ var _collapse = _interopRequireDefault(require("./collapse"));
259
260
 
260
261
  exports.Collapse = _collapse.default;
261
262
 
263
+ var _progress = _interopRequireDefault(require("./progress"));
264
+
265
+ exports.Progress = _progress.default;
266
+
262
267
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
263
268
 
264
269
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -0,0 +1,2 @@
1
+ import Progress from './progress';
2
+ export default Progress;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports.default = void 0;
7
+
8
+ var _progress = _interopRequireDefault(require("./progress"));
9
+
10
+ var _default = _progress.default;
11
+ exports.default = _default;
12
+ module.exports = exports.default;
@@ -0,0 +1,60 @@
1
+ import React from 'react';
2
+ import { NormalColors, NormalSizes } from '../utils/prop-types';
3
+ interface Props {
4
+ value: number;
5
+ striped?: boolean;
6
+ animated?: boolean;
7
+ squared?: boolean;
8
+ indeterminated?: boolean;
9
+ shadow?: boolean;
10
+ max?: number;
11
+ min?: number;
12
+ color?: NormalColors | string;
13
+ status?: NormalColors | string;
14
+ size?: NormalSizes;
15
+ className?: string;
16
+ }
17
+ declare const defaultProps: {
18
+ color: string;
19
+ status: string;
20
+ size: "mini" | "small" | "medium" | "large" | "xlarge";
21
+ striped: boolean;
22
+ animated: boolean;
23
+ squared: boolean;
24
+ shadow: boolean;
25
+ indeterminated: boolean;
26
+ value: number;
27
+ min: number;
28
+ max: number;
29
+ className: string;
30
+ };
31
+ declare type NativeAttrs = Omit<Partial<React.ProgressHTMLAttributes<unknown> & React.HTMLAttributes<unknown>>, keyof Props>;
32
+ export declare type ProgressBarProps = Props & typeof defaultProps & NativeAttrs;
33
+ declare const _default: React.ComponentType<Partial<{
34
+ color: string;
35
+ status: string;
36
+ size: "mini" | "small" | "medium" | "large" | "xlarge";
37
+ striped: boolean;
38
+ animated: boolean;
39
+ squared: boolean;
40
+ shadow: boolean;
41
+ indeterminated: boolean;
42
+ value: number;
43
+ min: number;
44
+ max: number;
45
+ className: string;
46
+ }> & Omit<Props & {
47
+ color: string;
48
+ status: string;
49
+ size: "mini" | "small" | "medium" | "large" | "xlarge";
50
+ striped: boolean;
51
+ animated: boolean;
52
+ squared: boolean;
53
+ shadow: boolean;
54
+ indeterminated: boolean;
55
+ value: number;
56
+ min: number;
57
+ max: number;
58
+ className: string;
59
+ } & NativeAttrs, "value" | "className" | "animated" | "color" | "status" | "size" | "squared" | "max" | "min" | "shadow" | "striped" | "indeterminated">>;
60
+ export default _default;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports.default = void 0;
7
+
8
+ var _style = _interopRequireDefault(require("styled-jsx/style"));
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _useTheme = _interopRequireDefault(require("../use-theme"));
13
+
14
+ var _cssTransition = _interopRequireDefault(require("../utils/css-transition"));
15
+
16
+ var _withDefaults = _interopRequireDefault(require("../utils/with-defaults"));
17
+
18
+ var _color = require("../utils/color");
19
+
20
+ var _styles = require("./styles");
21
+
22
+ var _numbers = require("../utils/numbers");
23
+
24
+ var _clsx = _interopRequireDefault(require("../utils/clsx"));
25
+
26
+ var _assertion = require("../utils/assertion");
27
+
28
+ var _jsxRuntime = require("react/jsx-runtime");
29
+
30
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
+
32
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
+
34
+ const defaultProps = {
35
+ color: 'primary',
36
+ status: 'default',
37
+ size: 'medium',
38
+ striped: false,
39
+ animated: true,
40
+ squared: false,
41
+ shadow: false,
42
+ indeterminated: false,
43
+ value: 0,
44
+ min: 0,
45
+ max: 100,
46
+ className: ''
47
+ };
48
+
49
+ const ProgressBar = ({
50
+ color,
51
+ value: valueProp,
52
+ max,
53
+ min,
54
+ striped,
55
+ status,
56
+ animated,
57
+ shadow,
58
+ squared,
59
+ size,
60
+ indeterminated,
61
+ className,
62
+ ...props
63
+ }) => {
64
+ const theme = (0, _useTheme.default)();
65
+ const value = (0, _react.useMemo)(() => valueProp > max ? max : valueProp < min ? min : valueProp, [valueProp, min, max]);
66
+ const percent = (0, _react.useMemo)(() => (0, _numbers.valueToPercent)(valueProp, min, max), [valueProp, min, max]);
67
+ const fillerColor = (0, _react.useMemo)(() => (0, _color.getNormalColor)(color, theme.palette, theme.palette.primary), [color, theme.palette]);
68
+ const shadowColor = (0, _react.useMemo)(() => shadow ? (0, _styles.getShadowColor)(color, theme.palette) : 'none', [color, shadow, theme.palette]);
69
+ const {
70
+ height,
71
+ radius
72
+ } = (0, _react.useMemo)(() => (0, _styles.getSizes)(size, squared), [size, squared]);
73
+ const bgColor = (0, _react.useMemo)(() => {
74
+ if (status === 'default') {
75
+ return theme.palette.accents_2;
76
+ }
77
+
78
+ const normalColor = (0, _color.getNormalColor)(status, theme.palette, theme.palette.accents_2);
79
+ return (0, _color.addColorAlpha)(normalColor, 0.2);
80
+ }, [status, theme.palette]);
81
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", { ...props,
82
+ className: _style.default.dynamic([["1976762788", [height, shadow && !indeterminated ? 'visible' : 'hidden', bgColor, radius, fillerColor, animated ? 'width 0.5s cubic-bezier(0.4, 0, 0.2, 1)' : 'none', shadowColor, percent, theme.layout.gap, theme.layout.gap]]]) + " " + (props && props.className != null && props.className || (0, _clsx.default)('progress', className) || ""),
83
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_cssTransition.default, {
84
+ visible: true,
85
+ name: "progress-wrapper",
86
+ enterTime: 0,
87
+ leaveTime: 0,
88
+ clearTime: 300,
89
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
90
+ role: "progressbar",
91
+ "aria-valuenow": value,
92
+ "aria-valuemin": min,
93
+ "aria-valuemax": max,
94
+ ...props,
95
+ className: _style.default.dynamic([["1976762788", [height, shadow && !indeterminated ? 'visible' : 'hidden', bgColor, radius, fillerColor, animated ? 'width 0.5s cubic-bezier(0.4, 0, 0.2, 1)' : 'none', shadowColor, percent, theme.layout.gap, theme.layout.gap]]]) + " " + (props && props.className != null && props.className || (0, _clsx.default)('filler', {
96
+ striped,
97
+ indeterminated
98
+ }) || "")
99
+ })
100
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_style.default, {
101
+ id: "1976762788",
102
+ dynamic: [height, shadow && !indeterminated ? 'visible' : 'hidden', bgColor, radius, fillerColor, animated ? 'width 0.5s cubic-bezier(0.4, 0, 0.2, 1)' : 'none', shadowColor, percent, theme.layout.gap, theme.layout.gap],
103
+ children: `.progress.__jsx-style-dynamic-selector{margin:0;padding:0;width:100%;height:${height};position:relative;overflow:${shadow && !indeterminated ? 'visible' : 'hidden'};background:${bgColor};border-radius:${radius};}.filler.__jsx-style-dynamic-selector{margin:0;padding:0;width:0;opacity:0;height:100%;min-width:inherit;background:${fillerColor};border-radius:inherit;-webkit-transition:${animated ? 'width 0.5s cubic-bezier(0.4, 0, 0.2, 1)' : 'none'};transition:${animated ? 'width 0.5s cubic-bezier(0.4, 0, 0.2, 1)' : 'none'};box-shadow:${shadowColor};}.progress-wrapper-enter.__jsx-style-dynamic-selector{opacity:0;}.progress-wrapper-enter-active.__jsx-style-dynamic-selector{opacity:1;width:${percent}%;}.filler.striped.__jsx-style-dynamic-selector{background-image:linear-gradient( 45deg, rgba(0,0,0,0.1) 25%, transparent 25%, transparent 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1) 75%, transparent 75%, transparent );background-size:${theme.layout.gap} ${theme.layout.gap};}.filler.indeterminated.__jsx-style-dynamic-selector{position:absolute;width:0%;-webkit-transition-property:background-color,width,left,border-color, opacity,shadow,-webkit-transform;-webkit-transition-property:background-color,width,left,border-color, opacity,shadow,transform;transition-property:background-color,width,left,border-color, opacity,shadow,transform;-webkit-transition-duration:300ms;transition-duration:300ms;will-change:left;min-width:50%;-webkit-animation:1s ease 0s infinite normal none running indeterminate-animation-__jsx-style-dynamic-selector;animation:1s ease 0s infinite normal none running indeterminate-animation-__jsx-style-dynamic-selector;}@-webkit-keyframes indeterminate-animation-__jsx-style-dynamic-selector{0%{left:-40%;}100%{left:100%;}}@keyframes indeterminate-animation-__jsx-style-dynamic-selector{0%{left:-40%;}100%{left:100%;}}`
104
+ })]
105
+ });
106
+ };
107
+
108
+ ProgressBar.defaultProps = defaultProps;
109
+
110
+ if (_assertion.__DEV__) {
111
+ ProgressBar.displayName = 'NextUI - Progress';
112
+ }
113
+
114
+ var _default = (0, _withDefaults.default)( /*#__PURE__*/_react.default.memo(ProgressBar), defaultProps);
115
+
116
+ exports.default = _default;
117
+ module.exports = exports.default;
@@ -0,0 +1,8 @@
1
+ import { NextUIThemesPalette } from '../theme';
2
+ import { NormalColors, NormalSizes } from '../utils/prop-types';
3
+ export declare type ProgessSize = {
4
+ height: string;
5
+ radius: string;
6
+ };
7
+ export declare const getShadowColor: (color: NormalColors | string, palette: NextUIThemesPalette) => string;
8
+ export declare const getSizes: (size: NormalSizes, squared: boolean) => ProgessSize;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getSizes = exports.getShadowColor = void 0;
5
+
6
+ var _color = require("../utils/color");
7
+
8
+ const getShadowColor = (color, palette) => {
9
+ try {
10
+ const hexColor = color === 'gradient' ? (0, _color.hexFromString)(palette.gradient, palette.primary, true) : (0, _color.getNormalColor)(color, palette, palette.primary);
11
+ const [r, g, b] = (0, _color.hexToRgb)(hexColor);
12
+ return `1px 2px 10px 0px rgb(${r} ${g} ${b}/ 60%);`;
13
+ } catch (err) {
14
+ return 'none';
15
+ }
16
+ };
17
+
18
+ exports.getShadowColor = getShadowColor;
19
+
20
+ const getSizes = (size, squared) => {
21
+ const sizes = {
22
+ mini: {
23
+ height: '0.25rem',
24
+ radius: squared ? '1px' : '0.25rem'
25
+ },
26
+ small: {
27
+ height: '0.5rem',
28
+ radius: squared ? '2px' : '0.5rem'
29
+ },
30
+ medium: {
31
+ height: '1rem',
32
+ radius: squared ? '3px' : '0.75rem'
33
+ },
34
+ large: {
35
+ height: '1.5rem',
36
+ radius: squared ? '4px' : '1rem'
37
+ },
38
+ xlarge: {
39
+ height: '1.75rem',
40
+ radius: squared ? '5px' : '1.5rem'
41
+ }
42
+ };
43
+ if (!size) return sizes.medium;
44
+ return sizes[size];
45
+ };
46
+
47
+ exports.getSizes = getSizes;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Convert a value to percentage based on lower and upper bound values
3
+ *
4
+ * @param value the value in number
5
+ * @param min the minimum value
6
+ * @param max the maximum value
7
+ */
8
+ export declare function valueToPercent(value: number, min: number, max: number): number;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.valueToPercent = valueToPercent;
5
+
6
+ /**
7
+ * Convert a value to percentage based on lower and upper bound values
8
+ *
9
+ * @param value the value in number
10
+ * @param min the minimum value
11
+ * @param max the maximum value
12
+ */
13
+ function valueToPercent(value, min, max) {
14
+ return (value - min) * 100 / (max - min);
15
+ }
package/esm/index.d.ts CHANGED
@@ -49,3 +49,4 @@ export { default as Modal } from './modal';
49
49
  export { default as useModal } from './modal/use-modal';
50
50
  export { default as Backdrop } from './backdrop';
51
51
  export { default as Collapse } from './collapse';
52
+ export { default as Progress } from './progress';
package/esm/index.js CHANGED
@@ -46,4 +46,5 @@ export { default as Textarea } from './textarea';
46
46
  export { default as Modal } from './modal';
47
47
  export { default as useModal } from './modal/use-modal';
48
48
  export { default as Backdrop } from './backdrop';
49
- export { default as Collapse } from './collapse';
49
+ export { default as Collapse } from './collapse';
50
+ export { default as Progress } from './progress';
@@ -0,0 +1,2 @@
1
+ import Progress from './progress';
2
+ export default Progress;
@@ -0,0 +1,2 @@
1
+ import Progress from './progress';
2
+ export default Progress;
@@ -0,0 +1,60 @@
1
+ import React from 'react';
2
+ import { NormalColors, NormalSizes } from '../utils/prop-types';
3
+ interface Props {
4
+ value: number;
5
+ striped?: boolean;
6
+ animated?: boolean;
7
+ squared?: boolean;
8
+ indeterminated?: boolean;
9
+ shadow?: boolean;
10
+ max?: number;
11
+ min?: number;
12
+ color?: NormalColors | string;
13
+ status?: NormalColors | string;
14
+ size?: NormalSizes;
15
+ className?: string;
16
+ }
17
+ declare const defaultProps: {
18
+ color: string;
19
+ status: string;
20
+ size: "mini" | "small" | "medium" | "large" | "xlarge";
21
+ striped: boolean;
22
+ animated: boolean;
23
+ squared: boolean;
24
+ shadow: boolean;
25
+ indeterminated: boolean;
26
+ value: number;
27
+ min: number;
28
+ max: number;
29
+ className: string;
30
+ };
31
+ declare type NativeAttrs = Omit<Partial<React.ProgressHTMLAttributes<unknown> & React.HTMLAttributes<unknown>>, keyof Props>;
32
+ export declare type ProgressBarProps = Props & typeof defaultProps & NativeAttrs;
33
+ declare const _default: React.ComponentType<Partial<{
34
+ color: string;
35
+ status: string;
36
+ size: "mini" | "small" | "medium" | "large" | "xlarge";
37
+ striped: boolean;
38
+ animated: boolean;
39
+ squared: boolean;
40
+ shadow: boolean;
41
+ indeterminated: boolean;
42
+ value: number;
43
+ min: number;
44
+ max: number;
45
+ className: string;
46
+ }> & Omit<Props & {
47
+ color: string;
48
+ status: string;
49
+ size: "mini" | "small" | "medium" | "large" | "xlarge";
50
+ striped: boolean;
51
+ animated: boolean;
52
+ squared: boolean;
53
+ shadow: boolean;
54
+ indeterminated: boolean;
55
+ value: number;
56
+ min: number;
57
+ max: number;
58
+ className: string;
59
+ } & NativeAttrs, "value" | "className" | "animated" | "color" | "status" | "size" | "squared" | "max" | "min" | "shadow" | "striped" | "indeterminated">>;
60
+ export default _default;
@@ -0,0 +1,93 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ import React, { useMemo } from 'react';
3
+ import useTheme from '../use-theme';
4
+ import CSSTransition from '../utils/css-transition';
5
+ import withDefaults from '../utils/with-defaults';
6
+ import { addColorAlpha, getNormalColor } from '../utils/color';
7
+ import { getShadowColor, getSizes } from './styles';
8
+ import { valueToPercent } from '../utils/numbers';
9
+ import clsx from '../utils/clsx';
10
+ import { __DEV__ } from '../utils/assertion';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ const defaultProps = {
14
+ color: 'primary',
15
+ status: 'default',
16
+ size: 'medium',
17
+ striped: false,
18
+ animated: true,
19
+ squared: false,
20
+ shadow: false,
21
+ indeterminated: false,
22
+ value: 0,
23
+ min: 0,
24
+ max: 100,
25
+ className: ''
26
+ };
27
+
28
+ const ProgressBar = ({
29
+ color,
30
+ value: valueProp,
31
+ max,
32
+ min,
33
+ striped,
34
+ status,
35
+ animated,
36
+ shadow,
37
+ squared,
38
+ size,
39
+ indeterminated,
40
+ className,
41
+ ...props
42
+ }) => {
43
+ const theme = useTheme();
44
+ const value = useMemo(() => valueProp > max ? max : valueProp < min ? min : valueProp, [valueProp, min, max]);
45
+ const percent = useMemo(() => valueToPercent(valueProp, min, max), [valueProp, min, max]);
46
+ const fillerColor = useMemo(() => getNormalColor(color, theme.palette, theme.palette.primary), [color, theme.palette]);
47
+ const shadowColor = useMemo(() => shadow ? getShadowColor(color, theme.palette) : 'none', [color, shadow, theme.palette]);
48
+ const {
49
+ height,
50
+ radius
51
+ } = useMemo(() => getSizes(size, squared), [size, squared]);
52
+ const bgColor = useMemo(() => {
53
+ if (status === 'default') {
54
+ return theme.palette.accents_2;
55
+ }
56
+
57
+ const normalColor = getNormalColor(status, theme.palette, theme.palette.accents_2);
58
+ return addColorAlpha(normalColor, 0.2);
59
+ }, [status, theme.palette]);
60
+ return /*#__PURE__*/_jsxs("div", { ...props,
61
+ className: _JSXStyle.dynamic([["1976762788", [height, shadow && !indeterminated ? 'visible' : 'hidden', bgColor, radius, fillerColor, animated ? 'width 0.5s cubic-bezier(0.4, 0, 0.2, 1)' : 'none', shadowColor, percent, theme.layout.gap, theme.layout.gap]]]) + " " + (props && props.className != null && props.className || clsx('progress', className) || ""),
62
+ children: [/*#__PURE__*/_jsx(CSSTransition, {
63
+ visible: true,
64
+ name: "progress-wrapper",
65
+ enterTime: 0,
66
+ leaveTime: 0,
67
+ clearTime: 300,
68
+ children: /*#__PURE__*/_jsx("div", {
69
+ role: "progressbar",
70
+ "aria-valuenow": value,
71
+ "aria-valuemin": min,
72
+ "aria-valuemax": max,
73
+ ...props,
74
+ className: _JSXStyle.dynamic([["1976762788", [height, shadow && !indeterminated ? 'visible' : 'hidden', bgColor, radius, fillerColor, animated ? 'width 0.5s cubic-bezier(0.4, 0, 0.2, 1)' : 'none', shadowColor, percent, theme.layout.gap, theme.layout.gap]]]) + " " + (props && props.className != null && props.className || clsx('filler', {
75
+ striped,
76
+ indeterminated
77
+ }) || "")
78
+ })
79
+ }), /*#__PURE__*/_jsx(_JSXStyle, {
80
+ id: "1976762788",
81
+ dynamic: [height, shadow && !indeterminated ? 'visible' : 'hidden', bgColor, radius, fillerColor, animated ? 'width 0.5s cubic-bezier(0.4, 0, 0.2, 1)' : 'none', shadowColor, percent, theme.layout.gap, theme.layout.gap],
82
+ children: `.progress.__jsx-style-dynamic-selector{margin:0;padding:0;width:100%;height:${height};position:relative;overflow:${shadow && !indeterminated ? 'visible' : 'hidden'};background:${bgColor};border-radius:${radius};}.filler.__jsx-style-dynamic-selector{margin:0;padding:0;width:0;opacity:0;height:100%;min-width:inherit;background:${fillerColor};border-radius:inherit;-webkit-transition:${animated ? 'width 0.5s cubic-bezier(0.4, 0, 0.2, 1)' : 'none'};transition:${animated ? 'width 0.5s cubic-bezier(0.4, 0, 0.2, 1)' : 'none'};box-shadow:${shadowColor};}.progress-wrapper-enter.__jsx-style-dynamic-selector{opacity:0;}.progress-wrapper-enter-active.__jsx-style-dynamic-selector{opacity:1;width:${percent}%;}.filler.striped.__jsx-style-dynamic-selector{background-image:linear-gradient( 45deg, rgba(0,0,0,0.1) 25%, transparent 25%, transparent 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1) 75%, transparent 75%, transparent );background-size:${theme.layout.gap} ${theme.layout.gap};}.filler.indeterminated.__jsx-style-dynamic-selector{position:absolute;width:0%;-webkit-transition-property:background-color,width,left,border-color, opacity,shadow,-webkit-transform;-webkit-transition-property:background-color,width,left,border-color, opacity,shadow,transform;transition-property:background-color,width,left,border-color, opacity,shadow,transform;-webkit-transition-duration:300ms;transition-duration:300ms;will-change:left;min-width:50%;-webkit-animation:1s ease 0s infinite normal none running indeterminate-animation-__jsx-style-dynamic-selector;animation:1s ease 0s infinite normal none running indeterminate-animation-__jsx-style-dynamic-selector;}@-webkit-keyframes indeterminate-animation-__jsx-style-dynamic-selector{0%{left:-40%;}100%{left:100%;}}@keyframes indeterminate-animation-__jsx-style-dynamic-selector{0%{left:-40%;}100%{left:100%;}}`
83
+ })]
84
+ });
85
+ };
86
+
87
+ ProgressBar.defaultProps = defaultProps;
88
+
89
+ if (__DEV__) {
90
+ ProgressBar.displayName = 'NextUI - Progress';
91
+ }
92
+
93
+ export default withDefaults( /*#__PURE__*/React.memo(ProgressBar), defaultProps);
@@ -0,0 +1,8 @@
1
+ import { NextUIThemesPalette } from '../theme';
2
+ import { NormalColors, NormalSizes } from '../utils/prop-types';
3
+ export declare type ProgessSize = {
4
+ height: string;
5
+ radius: string;
6
+ };
7
+ export declare const getShadowColor: (color: NormalColors | string, palette: NextUIThemesPalette) => string;
8
+ export declare const getSizes: (size: NormalSizes, squared: boolean) => ProgessSize;
@@ -0,0 +1,36 @@
1
+ import { hexFromString, getNormalColor, hexToRgb } from '../utils/color';
2
+ export const getShadowColor = (color, palette) => {
3
+ try {
4
+ const hexColor = color === 'gradient' ? hexFromString(palette.gradient, palette.primary, true) : getNormalColor(color, palette, palette.primary);
5
+ const [r, g, b] = hexToRgb(hexColor);
6
+ return `1px 2px 10px 0px rgb(${r} ${g} ${b}/ 60%);`;
7
+ } catch (err) {
8
+ return 'none';
9
+ }
10
+ };
11
+ export const getSizes = (size, squared) => {
12
+ const sizes = {
13
+ mini: {
14
+ height: '0.25rem',
15
+ radius: squared ? '1px' : '0.25rem'
16
+ },
17
+ small: {
18
+ height: '0.5rem',
19
+ radius: squared ? '2px' : '0.5rem'
20
+ },
21
+ medium: {
22
+ height: '1rem',
23
+ radius: squared ? '3px' : '0.75rem'
24
+ },
25
+ large: {
26
+ height: '1.5rem',
27
+ radius: squared ? '4px' : '1rem'
28
+ },
29
+ xlarge: {
30
+ height: '1.75rem',
31
+ radius: squared ? '5px' : '1.5rem'
32
+ }
33
+ };
34
+ if (!size) return sizes.medium;
35
+ return sizes[size];
36
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Convert a value to percentage based on lower and upper bound values
3
+ *
4
+ * @param value the value in number
5
+ * @param min the minimum value
6
+ * @param max the maximum value
7
+ */
8
+ export declare function valueToPercent(value: number, min: number, max: number): number;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Convert a value to percentage based on lower and upper bound values
3
+ *
4
+ * @param value the value in number
5
+ * @param min the minimum value
6
+ * @param max the maximum value
7
+ */
8
+ export function valueToPercent(value, min, max) {
9
+ return (value - min) * 100 / (max - min);
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextui-org/react",
3
- "version": "1.0.1-alpha.55",
3
+ "version": "1.0.1-alpha.56",
4
4
  "license": "MIT",
5
5
  "description": "🚀 Beautiful and modern React UI library.",
6
6
  "homepage": "https://nextui.org",
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "main": "../cjs/progress/index.js",
4
+ "module": "../esm/progress/index.js",
5
+ "types": "../esm/progress/index.d.ts"
6
+ }