@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.
Files changed (158) hide show
  1. package/cjs/avatar/avatar-group.js +9 -4
  2. package/cjs/avatar/avatar.d.ts +3 -1
  3. package/cjs/avatar/avatar.js +20 -30
  4. package/cjs/backdrop/index.d.ts +4 -1
  5. package/cjs/backdrop/index.js +15 -8
  6. package/cjs/button/button-group.d.ts +1 -1
  7. package/cjs/button/button.js +10 -18
  8. package/cjs/card/card-body.d.ts +35 -0
  9. package/cjs/card/card-body.js +73 -0
  10. package/cjs/card/card-context.d.ts +8 -0
  11. package/cjs/card/card-context.js +20 -0
  12. package/cjs/card/card-footer.d.ts +25 -4
  13. package/cjs/card/card-footer.js +56 -8
  14. package/cjs/card/card-header.d.ts +23 -0
  15. package/cjs/card/card-header.js +54 -0
  16. package/cjs/card/card.d.ts +25 -12
  17. package/cjs/card/card.js +99 -36
  18. package/cjs/card/index.js +8 -4
  19. package/cjs/card/styles.d.ts +7 -8
  20. package/cjs/card/styles.js +30 -60
  21. package/cjs/collapse/collapse-context.d.ts +9 -0
  22. package/cjs/collapse/collapse-context.js +20 -0
  23. package/cjs/collapse/collapse-group.d.ts +32 -0
  24. package/cjs/collapse/collapse-group.js +111 -0
  25. package/cjs/collapse/collapse-icon.d.ts +3 -0
  26. package/cjs/collapse/collapse-icon.js +39 -0
  27. package/cjs/collapse/collapse.d.ts +39 -0
  28. package/cjs/collapse/collapse.js +174 -0
  29. package/cjs/collapse/index.d.ts +2 -0
  30. package/cjs/collapse/index.js +15 -0
  31. package/cjs/css-baseline/css-baseline.js +3 -3
  32. package/cjs/divider/divider.d.ts +8 -9
  33. package/cjs/divider/divider.js +9 -9
  34. package/cjs/image/image.d.ts +9 -8
  35. package/cjs/image/image.js +27 -17
  36. package/cjs/index.d.ts +8 -0
  37. package/cjs/index.js +29 -2
  38. package/cjs/input/input-icon-clear.js +1 -1
  39. package/cjs/input/input-password.d.ts +1 -1
  40. package/cjs/modal/modal-close-button.js +1 -1
  41. package/cjs/modal/modal-wrapper.d.ts +1 -0
  42. package/cjs/modal/modal-wrapper.js +28 -15
  43. package/cjs/modal/modal.d.ts +2 -0
  44. package/cjs/modal/modal.js +4 -0
  45. package/cjs/snippet/snippet.js +1 -1
  46. package/cjs/text/child.d.ts +4 -5
  47. package/cjs/text/child.js +11 -7
  48. package/cjs/text/text.d.ts +8 -5
  49. package/cjs/text/text.js +10 -7
  50. package/cjs/theme/dark.js +2 -1
  51. package/cjs/theme/default.js +2 -1
  52. package/cjs/tooltip/placement.d.ts +29 -0
  53. package/cjs/tooltip/{position.js → placement.js} +31 -31
  54. package/cjs/tooltip/tooltip-content.d.ts +3 -3
  55. package/cjs/tooltip/tooltip-content.js +12 -12
  56. package/cjs/tooltip/tooltip.d.ts +9 -9
  57. package/cjs/tooltip/tooltip.js +8 -8
  58. package/cjs/use-drip/index.d.ts +2 -0
  59. package/cjs/use-drip/index.js +12 -0
  60. package/cjs/use-drip/use-drip.d.ts +9 -0
  61. package/cjs/use-drip/use-drip.js +38 -0
  62. package/cjs/{shared → utils}/clear-icon.d.ts +0 -0
  63. package/cjs/{shared → utils}/clear-icon.js +1 -1
  64. package/cjs/utils/collections.d.ts +1 -0
  65. package/cjs/utils/collections.js +26 -2
  66. package/cjs/utils/css-transition.js +1 -1
  67. package/cjs/{button/button.drip.d.ts → utils/drip.d.ts} +6 -2
  68. package/cjs/{button/button.drip.js → utils/drip.js} +13 -10
  69. package/cjs/utils/expand.d.ts +18 -0
  70. package/cjs/utils/expand.js +97 -0
  71. package/cjs/utils/icons.js +60 -2
  72. package/cjs/utils/prop-types.d.ts +9 -2
  73. package/cjs/utils/prop-types.js +22 -2
  74. package/collapse/package.json +6 -0
  75. package/esm/avatar/avatar-group.js +8 -4
  76. package/esm/avatar/avatar.d.ts +3 -1
  77. package/esm/avatar/avatar.js +20 -30
  78. package/esm/backdrop/index.d.ts +4 -1
  79. package/esm/backdrop/index.js +17 -9
  80. package/esm/button/button-group.d.ts +1 -1
  81. package/esm/button/button.js +10 -19
  82. package/esm/card/card-body.d.ts +35 -0
  83. package/esm/card/card-body.js +52 -0
  84. package/esm/card/card-context.d.ts +8 -0
  85. package/esm/card/card-context.js +6 -0
  86. package/esm/card/card-footer.d.ts +25 -4
  87. package/esm/card/card-footer.js +48 -8
  88. package/esm/card/card-header.d.ts +23 -0
  89. package/esm/card/card-header.js +38 -0
  90. package/esm/card/card.d.ts +25 -12
  91. package/esm/card/card.js +95 -37
  92. package/esm/card/index.js +6 -4
  93. package/esm/card/styles.d.ts +7 -8
  94. package/esm/card/styles.js +25 -59
  95. package/esm/collapse/collapse-context.d.ts +9 -0
  96. package/esm/collapse/collapse-context.js +6 -0
  97. package/esm/collapse/collapse-group.d.ts +32 -0
  98. package/esm/collapse/collapse-group.js +87 -0
  99. package/esm/collapse/collapse-icon.d.ts +3 -0
  100. package/esm/collapse/collapse-icon.js +27 -0
  101. package/esm/collapse/collapse.d.ts +39 -0
  102. package/esm/collapse/collapse.js +150 -0
  103. package/esm/collapse/index.d.ts +2 -0
  104. package/esm/collapse/index.js +4 -0
  105. package/esm/css-baseline/css-baseline.js +3 -3
  106. package/esm/divider/divider.d.ts +8 -9
  107. package/esm/divider/divider.js +9 -9
  108. package/esm/image/image.d.ts +9 -8
  109. package/esm/image/image.js +27 -18
  110. package/esm/index.d.ts +8 -0
  111. package/esm/index.js +6 -1
  112. package/esm/input/input-icon-clear.js +1 -1
  113. package/esm/input/input-password.d.ts +1 -1
  114. package/esm/modal/modal-close-button.js +1 -1
  115. package/esm/modal/modal-wrapper.d.ts +1 -0
  116. package/esm/modal/modal-wrapper.js +30 -16
  117. package/esm/modal/modal.d.ts +2 -0
  118. package/esm/modal/modal.js +4 -0
  119. package/esm/snippet/snippet.js +1 -1
  120. package/esm/text/child.d.ts +4 -5
  121. package/esm/text/child.js +10 -7
  122. package/esm/text/text.d.ts +8 -5
  123. package/esm/text/text.js +10 -7
  124. package/esm/theme/dark.js +2 -1
  125. package/esm/theme/default.js +2 -1
  126. package/esm/tooltip/placement.d.ts +29 -0
  127. package/esm/tooltip/{position.js → placement.js} +27 -27
  128. package/esm/tooltip/tooltip-content.d.ts +3 -3
  129. package/esm/tooltip/tooltip-content.js +12 -12
  130. package/esm/tooltip/tooltip.d.ts +9 -9
  131. package/esm/tooltip/tooltip.js +8 -8
  132. package/esm/use-drip/index.d.ts +2 -0
  133. package/esm/use-drip/index.js +2 -0
  134. package/esm/use-drip/use-drip.d.ts +9 -0
  135. package/esm/use-drip/use-drip.js +31 -0
  136. package/esm/{shared → utils}/clear-icon.d.ts +0 -0
  137. package/esm/{shared → utils}/clear-icon.js +1 -1
  138. package/esm/utils/collections.d.ts +1 -0
  139. package/esm/utils/collections.js +21 -0
  140. package/esm/utils/css-transition.js +1 -1
  141. package/esm/{button/button.drip.d.ts → utils/drip.d.ts} +6 -2
  142. package/esm/{button/button.drip.js → utils/drip.js} +13 -10
  143. package/esm/utils/expand.d.ts +18 -0
  144. package/esm/utils/expand.js +78 -0
  145. package/esm/utils/icons.js +52 -0
  146. package/esm/utils/prop-types.d.ts +9 -2
  147. package/esm/utils/prop-types.js +19 -1
  148. package/package.json +1 -1
  149. package/umd/nextui.js +1497 -806
  150. package/umd/nextui.min.js +1 -1
  151. package/use-drip/package.json +6 -0
  152. package/cjs/card/card-content.d.ts +0 -13
  153. package/cjs/card/card-content.js +0 -43
  154. package/cjs/tooltip/position.d.ts +0 -29
  155. package/esm/card/card-content.d.ts +0 -13
  156. package/esm/card/card-content.js +0 -28
  157. package/esm/tooltip/position.d.ts +0 -29
  158. package/shared/package.json +0 -6
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.excludedInputPropsForTextarea = exports.normalWeights = exports.normalLoaders = exports.extraColors = exports.extendedColors = exports.simpleColors = exports.normalColors = exports.tuple = void 0;
4
+ exports.excludedInputPropsForTextarea = exports.textTransforms = exports.textWeights = exports.normalWeights = exports.normalLoaders = exports.extraColors = exports.extendedColors = exports.simpleColors = exports.normalColors = exports.tuple = void 0;
5
5
 
6
6
  const tuple = (...args) => args;
7
7
 
@@ -19,10 +19,30 @@ const normalLoaders = tuple('default', 'points', 'points-opacity', 'gradient', '
19
19
  exports.normalLoaders = normalLoaders;
20
20
  const normalWeights = tuple('light', 'normal', 'bold');
21
21
  exports.normalWeights = normalWeights;
22
+ const textWeights = tuple(
23
+ /* Keyword values */
24
+ 'normal', 'bold',
25
+ /* Keyword values relative to the parent */
26
+ 'lighter', 'bolder',
27
+ /* Global values */
28
+ 'inherit', 'initial', 'revert', 'unset');
29
+ exports.textWeights = textWeights;
30
+ const textTransforms = tuple(
31
+ /* Keyword values */
32
+ 'none', 'capitalize', 'uppercase', 'lowercase', 'full-width', 'full-size-kana',
33
+ /* Global values */
34
+ 'inherit', 'initial', 'revert', 'unset');
35
+ exports.textTransforms = textTransforms;
22
36
  const themeTypes = tuple('dark', 'light');
23
37
  const copyTypes = tuple('default', 'slient', 'prevent');
24
38
  const triggerTypes = tuple('hover', 'click');
25
- const position = tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
39
+ const placement = tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
40
+ const position = tuple('static', 'relative', 'absolute', 'fixed', 'sticky',
41
+ /* Global values */
42
+ 'inherit', 'initial', 'revert', 'unset');
43
+ const objectFit = tuple('contain', 'cover', 'fill', 'none', 'scale-down',
44
+ /* Global values */
45
+ 'inherit', 'initial', 'revert', 'unset');
26
46
  const dividerAlign = tuple('start', 'center', 'end', 'left', 'right');
27
47
  const justify = tuple('flex-start', 'center', 'flex-end', 'space-between', 'space-around', 'space-evenly');
28
48
  const alignItems = tuple('flex-start', 'flex-end', 'center', 'stretch', 'baseline');
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "main": "../cjs/collapse/index.js",
4
+ "module": "../esm/collapse/index.js",
5
+ "types": "../esm/collapse/index.d.ts"
6
+ }
@@ -2,6 +2,7 @@ import _JSXStyle from "styled-jsx/style";
2
2
  import React from 'react';
3
3
  import useTheme from '../use-theme';
4
4
  import withDefaults from '../utils/with-defaults';
5
+ import clsx from '../utils/clsx';
5
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  const defaultProps = {
@@ -17,15 +18,18 @@ const AvatarGroup = ({
17
18
  ...props
18
19
  }) => {
19
20
  const theme = useTheme();
21
+ const isDark = theme.type === 'dark';
20
22
  return /*#__PURE__*/_jsxs("div", { ...props,
21
- className: _JSXStyle.dynamic([["1646920449", [animated ? 'translate(-0.625rem)' : '', theme.layout.gapQuarter, theme.palette.accents_7]]]) + " " + (props && props.className != null && props.className || `avatar-group ${className}`),
23
+ className: _JSXStyle.dynamic([["1480508104", [animated ? 'translate(-0.625rem)' : '', theme.layout.gapQuarter, theme.palette.accents_7]]]) + " " + (props && props.className != null && props.className || clsx('avatar-group', {
24
+ 'is-dark': isDark
25
+ }, className) || ""),
22
26
  children: [children, count && /*#__PURE__*/_jsxs("span", {
23
- className: _JSXStyle.dynamic([["1646920449", [animated ? 'translate(-0.625rem)' : '', theme.layout.gapQuarter, theme.palette.accents_7]]]) + " " + "count",
27
+ className: _JSXStyle.dynamic([["1480508104", [animated ? 'translate(-0.625rem)' : '', theme.layout.gapQuarter, theme.palette.accents_7]]]) + " " + "count",
24
28
  children: ["+", count]
25
29
  }), /*#__PURE__*/_jsx(_JSXStyle, {
26
- id: "1646920449",
30
+ id: "1480508104",
27
31
  dynamic: [animated ? 'translate(-0.625rem)' : '', theme.layout.gapQuarter, theme.palette.accents_7],
28
- children: `.avatar-group.__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;height:auto;width:-webkit-max-content;width:-moz-max-content;width:max-content;}.avatar-group.__jsx-style-dynamic-selector .avatar{margin-left:-0.625rem;-webkit-transition:-webkit-transform 0.25s ease;-webkit-transition:transform 0.25s ease;transition:transform 0.25s ease;}.avatar-group.__jsx-style-dynamic-selector .avatar:hover{-webkit-transform:${animated ? 'translate(-0.625rem)' : ''};-ms-transform:${animated ? 'translate(-0.625rem)' : ''};transform:${animated ? 'translate(-0.625rem)' : ''};}.count.__jsx-style-dynamic-selector{font-size:0.875rem;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-left:${theme.layout.gapQuarter};color:${theme.palette.accents_7};}`
32
+ children: `.avatar-group.__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;height:auto;width:-webkit-max-content;width:-moz-max-content;width:max-content;}.avatar-group.__jsx-style-dynamic-selector .avatar{margin-left:-0.625rem;-webkit-transition:-webkit-transform 0.25s ease;-webkit-transition:transform 0.25s ease;transition:transform 0.25s ease;}.avatar-group.__jsx-style-dynamic-selector .only-text-avatar{box-shadow:-4px 0 4px rgb(0 0 0 / 5%);}.is-dark.__jsx-style-dynamic-selector .only-text-avatar{box-shadow:-4px 0 15px rgb(0 0 0 / 50%);}.avatar-group.__jsx-style-dynamic-selector .avatar:hover{-webkit-transform:${animated ? 'translate(-0.625rem)' : ''};-ms-transform:${animated ? 'translate(-0.625rem)' : ''};transform:${animated ? 'translate(-0.625rem)' : ''};}.count.__jsx-style-dynamic-selector{font-size:0.875rem;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-left:${theme.layout.gapQuarter};color:${theme.palette.accents_7};}`
29
33
  })]
30
34
  });
31
35
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { NormalSizes, NormalColors, SimpleColors } from '../utils/prop-types';
2
+ import { NormalSizes, NormalColors, SimpleColors, NormalWeights } from '../utils/prop-types';
3
3
  import AvatarGroup from './avatar-group';
4
4
  interface Props {
5
5
  src?: string;
@@ -13,6 +13,7 @@ interface Props {
13
13
  alt?: string;
14
14
  text?: string;
15
15
  size?: NormalSizes | number;
16
+ borderWeight?: NormalWeights;
16
17
  squared?: boolean;
17
18
  className?: string;
18
19
  }
@@ -20,6 +21,7 @@ declare const defaultProps: {
20
21
  text: string;
21
22
  stacked: boolean;
22
23
  size: number | "mini" | "small" | "medium" | "large" | "xlarge";
24
+ borderWeight: "light" | "normal" | "bold";
23
25
  textColor: "default" | "primary" | "secondary" | "success" | "warning" | "error";
24
26
  squared: boolean;
25
27
  zoomed: boolean;
@@ -1,15 +1,16 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import React, { useMemo, useState, useRef, useEffect } from 'react';
3
3
  import useTheme from '../use-theme';
4
- import useWarning from '../use-warning';
5
- import { __DEV__ } from '../utils/assertion';
6
- import { isColor, getNormalColor, isNormalColor, addColorAlpha } from '../utils/color';
4
+ import { getNormalColor, addColorAlpha } from '../utils/color';
5
+ import clsx from '../utils/clsx';
6
+ import { getNormalWeight } from '../utils/dimensions';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
9
  const defaultProps = {
10
10
  text: '',
11
11
  stacked: false,
12
12
  size: 'medium',
13
+ borderWeight: 'normal',
13
14
  textColor: 'default',
14
15
  squared: false,
15
16
  zoomed: false,
@@ -28,18 +29,6 @@ const getSize = size => {
28
29
  return sizes[size];
29
30
  };
30
31
 
31
- const getBorder = size => {
32
- const sizes = {
33
- mini: '1px',
34
- small: '1px',
35
- medium: '1.5px',
36
- large: '2px',
37
- xlarge: '2.5px'
38
- };
39
- if (typeof size === 'number') return `1.5px`;
40
- return sizes[size];
41
- };
42
-
43
32
  const safeText = text => {
44
33
  if (text.length <= 4) return text;
45
34
  return text.slice(0, 3);
@@ -50,6 +39,7 @@ const Avatar = ({
50
39
  stacked,
51
40
  text,
52
41
  size,
42
+ borderWeight,
53
43
  squared,
54
44
  zoomed,
55
45
  bordered,
@@ -67,7 +57,7 @@ const Avatar = ({
67
57
  const marginLeft = stacked ? '-.625rem' : 0;
68
58
  const [ready, setReady] = useState(false);
69
59
  const width = useMemo(() => getSize(size), [size]);
70
- const border = useMemo(() => getBorder(size), [size]);
60
+ const border = useMemo(() => getNormalWeight(borderWeight), [borderWeight]);
71
61
  const imgRef = useRef(null);
72
62
  useEffect(() => {
73
63
  var _imgRef$current;
@@ -76,32 +66,32 @@ const Avatar = ({
76
66
  }, []);
77
67
  const avatarColor = useMemo(() => getNormalColor(color, theme.palette, theme.palette.accents_2), [color, theme.palette]);
78
68
  const avatarTextColor = useMemo(() => getNormalColor(textColor, theme.palette, theme.palette.text), [textColor, theme.palette]);
79
- const hoverBackground = useMemo(() => color === 'gradient' || !bordered ? avatarColor : addColorAlpha(avatarColor, 0.8), [color, avatarColor, bordered]);
80
-
81
- if (__DEV__ && color && !isNormalColor(color) && !isColor(color)) {
82
- useWarning(`Props "color" ${color} is not a valid color.`, 'Avatar');
83
- }
84
-
69
+ const hoverBackground = useMemo(() => color === 'gradient' || !bordered ? avatarColor : addColorAlpha(avatarColor, 0.6), [color, avatarColor, bordered]);
85
70
  return /*#__PURE__*/_jsxs("span", { ...props,
86
- className: _JSXStyle.dynamic([["556121610", [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'hue-rotate(40deg)' : 'none', zoomed && 'scale(1.125)']]]) + " " + (props && props.className != null && props.className || `avatar ${bordered ? 'bordered' : ''} ${className}`),
71
+ className: _JSXStyle.dynamic([["3734005641", [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'opacity(0.6)' : 'none', zoomed && 'scale(1.125)']]]) + " " + (props && props.className != null && props.className || clsx('avatar', {
72
+ bordered,
73
+ 'only-text-avatar': showText
74
+ }, className) || ""),
87
75
  children: [/*#__PURE__*/_jsx("span", {
88
- className: _JSXStyle.dynamic([["556121610", [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'hue-rotate(40deg)' : 'none', zoomed && 'scale(1.125)']]]) + " " + "avatar-bg"
76
+ className: _JSXStyle.dynamic([["3734005641", [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'opacity(0.6)' : 'none', zoomed && 'scale(1.125)']]]) + " " + "avatar-bg"
89
77
  }), !showText && /*#__PURE__*/_jsx("img", {
90
78
  ref: imgRef,
91
79
  src: src,
92
80
  alt: alt,
93
81
  onLoad: () => setReady(true),
94
- className: _JSXStyle.dynamic([["556121610", [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'hue-rotate(40deg)' : 'none', zoomed && 'scale(1.125)']]]) + " " + `avatar-img ${ready ? 'avatar-ready' : ''}`
82
+ className: _JSXStyle.dynamic([["3734005641", [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'opacity(0.6)' : 'none', zoomed && 'scale(1.125)']]]) + " " + (clsx('avatar-img', {
83
+ 'avatar-ready': ready
84
+ }) || "")
95
85
  }), showText && !icon && /*#__PURE__*/_jsx("span", {
96
- className: _JSXStyle.dynamic([["556121610", [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'hue-rotate(40deg)' : 'none', zoomed && 'scale(1.125)']]]) + " " + "avatar-text",
86
+ className: _JSXStyle.dynamic([["3734005641", [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'opacity(0.6)' : 'none', zoomed && 'scale(1.125)']]]) + " " + "avatar-text",
97
87
  children: safeText(text)
98
88
  }), icon && /*#__PURE__*/_jsx("span", {
99
- className: _JSXStyle.dynamic([["556121610", [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'hue-rotate(40deg)' : 'none', zoomed && 'scale(1.125)']]]) + " " + "icon",
89
+ className: _JSXStyle.dynamic([["3734005641", [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'opacity(0.6)' : 'none', zoomed && 'scale(1.125)']]]) + " " + "icon",
100
90
  children: icon
101
91
  }), /*#__PURE__*/_jsx(_JSXStyle, {
102
- id: "556121610",
103
- dynamic: [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'hue-rotate(40deg)' : 'none', zoomed && 'scale(1.125)'],
104
- children: `.avatar.__jsx-style-dynamic-selector{position:relative;z-index:1;min-width:${width};min-height:${width};width:${width};height:${width};display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display: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;box-sizing:border-box;position:relative;overflow:hidden;border-radius:${radius};vertical-align:top;cursor:${pointer ? 'pointer' : 'auto'};margin:0 0 0 ${marginLeft};-webkit-transition:all 0.25s ease;transition:all 0.25s ease;}.avatar-bg.__jsx-style-dynamic-selector{position:absolute;top:0;left:0;right:0;bottom:0;width:${width};height:${width};background:${avatarColor};-webkit-transition:all 0.25s ease;transition:all 0.25s ease;}.avatar.bordered.__jsx-style-dynamic-selector{padding:${border};}.avatar.__jsx-style-dynamic-selector:first-child{margin:0;}.avatar-img.__jsx-style-dynamic-selector{z-index:99;opacity:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;border-radius:50%;background:${theme.palette.background};border-radius:${radius};-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;}.avatar-ready.__jsx-style-dynamic-selector{opacity:1;}.bordered.__jsx-style-dynamic-selector .avatar-img.__jsx-style-dynamic-selector{border:${border} solid ${theme.palette.background};}.avatar-text.__jsx-style-dynamic-selector{position:absolute;left:50%;top:50%;font-size:calc(0.8em + ${width} * 0.1);text-align:center;color:${avatarTextColor};-webkit-transform:translate(-50%,-50%) scale(0.65);-ms-transform:translate(-50%,-50%) scale(0.65);transform:translate(-50%,-50%) scale(0.65);white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.icon.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;position:absolute;left:50%;top:50%;text-align:center;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.bordered.__jsx-style-dynamic-selector:hover .avatar-bg.__jsx-style-dynamic-selector{background:${hoverBackground};-webkit-filter:${color === 'gradient' ? 'hue-rotate(40deg)' : 'none'};filter:${color === 'gradient' ? 'hue-rotate(40deg)' : 'none'};}.avatar.__jsx-style-dynamic-selector:hover .avatar-img.__jsx-style-dynamic-selector{-webkit-transform:${zoomed && 'scale(1.125)'};-ms-transform:${zoomed && 'scale(1.125)'};transform:${zoomed && 'scale(1.125)'};}.avatar.__jsx-style-dynamic-selector:hover .avatar-bg.__jsx-style-dynamic-selector{box-shadow:inset 0 0 40px 0 rgb(0 0 0 / 14%);}`
92
+ id: "3734005641",
93
+ dynamic: [width, width, width, width, radius, pointer ? 'pointer' : 'auto', marginLeft, width, width, avatarColor, border, theme.palette.background, radius, border, theme.palette.background, width, avatarTextColor, hoverBackground, color === 'gradient' ? 'opacity(0.6)' : 'none', zoomed && 'scale(1.125)'],
94
+ children: `.avatar.__jsx-style-dynamic-selector{position:relative;z-index:1;min-width:${width};min-height:${width};width:${width};height:${width};display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display: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;box-sizing:border-box;position:relative;overflow:hidden;border-radius:${radius};vertical-align:top;cursor:${pointer ? 'pointer' : 'auto'};margin:0 0 0 ${marginLeft};-webkit-transition:all 0.25s ease;transition:all 0.25s ease;}.avatar-bg.__jsx-style-dynamic-selector{position:absolute;top:0;left:0;right:0;bottom:0;width:${width};height:${width};background:${avatarColor};-webkit-transition:all 0.25s ease;transition:all 0.25s ease;}.avatar.bordered.__jsx-style-dynamic-selector{padding:${border};}.avatar.__jsx-style-dynamic-selector:first-child{margin:0;}.avatar-img.__jsx-style-dynamic-selector{z-index:99;opacity:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;border-radius:50%;background:${theme.palette.background};border-radius:${radius};-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;}.avatar-ready.__jsx-style-dynamic-selector{opacity:1;}.bordered.__jsx-style-dynamic-selector .avatar-img.__jsx-style-dynamic-selector{border:${border} solid ${theme.palette.background};}.avatar-text.__jsx-style-dynamic-selector{position:absolute;left:50%;top:50%;font-size:calc(0.8em + ${width} * 0.1);text-align:center;color:${avatarTextColor};-webkit-transform:translate(-50%,-50%) scale(0.65);-ms-transform:translate(-50%,-50%) scale(0.65);transform:translate(-50%,-50%) scale(0.65);white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.icon.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;position:absolute;left:50%;top:50%;text-align:center;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.bordered.__jsx-style-dynamic-selector:hover .avatar-bg.__jsx-style-dynamic-selector{background:${hoverBackground};-webkit-filter:${color === 'gradient' ? 'opacity(0.6)' : 'none'};filter:${color === 'gradient' ? 'opacity(0.6)' : 'none'};}.avatar.__jsx-style-dynamic-selector:hover .avatar-img.__jsx-style-dynamic-selector{-webkit-transform:${zoomed && 'scale(1.125)'};-ms-transform:${zoomed && 'scale(1.125)'};transform:${zoomed && 'scale(1.125)'};}.avatar.__jsx-style-dynamic-selector:hover .avatar-bg.__jsx-style-dynamic-selector{box-shadow:inset 0 0 40px 0 rgb(0 0 0 / 14%);}`
105
95
  })]
106
96
  });
107
97
  };
@@ -4,12 +4,14 @@ interface Props {
4
4
  visible?: boolean;
5
5
  fullScreenContent?: boolean;
6
6
  width?: string;
7
+ animated?: boolean;
7
8
  blur?: boolean;
8
9
  }
9
10
  declare const defaultProps: {
10
11
  onClick: () => void;
11
12
  visible: boolean;
12
13
  blur: boolean;
14
+ animated: boolean;
13
15
  fullScreenContent: boolean;
14
16
  };
15
17
  declare type NativeAttrs = Omit<React.HTMLAttributes<unknown>, keyof Props>;
@@ -18,6 +20,7 @@ declare const _default: React.ComponentType<Partial<{
18
20
  onClick: () => void;
19
21
  visible: boolean;
20
22
  blur: boolean;
23
+ animated: boolean;
21
24
  fullScreenContent: boolean;
22
- }> & Omit<React.PropsWithChildren<BackdropProps>, "blur" | "onClick" | "visible" | "fullScreenContent">>;
25
+ }> & Omit<React.PropsWithChildren<BackdropProps>, "blur" | "animated" | "onClick" | "visible" | "fullScreenContent">>;
23
26
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
- import React, { useCallback } from 'react';
2
+ import React, { useCallback, useMemo } 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,10 +8,12 @@ import cslx from '../utils/clsx';
8
8
  import { __DEV__ } from '../utils/assertion';
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
  onClick: () => {},
13
14
  visible: false,
14
15
  blur: false,
16
+ animated: true,
15
17
  fullScreenContent: false
16
18
  };
17
19
  const Backdrop = /*#__PURE__*/React.memo(({
@@ -20,6 +22,7 @@ const Backdrop = /*#__PURE__*/React.memo(({
20
22
  visible,
21
23
  width,
22
24
  blur,
25
+ animated,
23
26
  fullScreenContent,
24
27
  ...props
25
28
  }) => {
@@ -43,13 +46,8 @@ const Backdrop = /*#__PURE__*/React.memo(({
43
46
  }, 0);
44
47
  };
45
48
 
46
- return /*#__PURE__*/_jsx(CSSTransition, {
47
- name: "backdrop-wrapper",
48
- visible: visible,
49
- enterTime: 20,
50
- leaveTime: 20,
51
- clearTime: 150,
52
- children: /*#__PURE__*/_jsxs("div", {
49
+ const renderChildren = useMemo(() => {
50
+ return /*#__PURE__*/_jsxs("div", {
53
51
  onClick: clickHandler,
54
52
  onMouseUp: mouseUpHandler,
55
53
  ...props,
@@ -68,7 +66,17 @@ const Backdrop = /*#__PURE__*/React.memo(({
68
66
  dynamic: [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.breakpoints.sm.max],
69
67
  children: `.backdrop.__jsx-style-dynamic-selector{position:fixed;top:0;left:0;right:0;bottom:0;overflow:auto;z-index:99999;-webkit-overflow-scrolling:touch;box-sizing:border-box;text-align:center;}.content.__jsx-style-dynamic-selector{position:relative;z-index:999999;outline:none;width:100%;max-width:${width};margin:20px auto;vertical-align:middle;display:inline-block;}.fullscreen.__jsx-style-dynamic-selector .content.__jsx-style-dynamic-selector{width:100vw;max-width:100vw;height:100vh;margin:0;}.backdrop.__jsx-style-dynamic-selector:before{display:inline-block;width:0;height:100%;vertical-align:middle;content:'';}.layer.__jsx-style-dynamic-selector{position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none;z-index:99999;}.layer-default.__jsx-style-dynamic-selector{background-color:black;opacity:${theme.expressiveness.portalOpacity};-webkit-transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1);transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1);}.layer-blur.__jsx-style-dynamic-selector{opacity:1;-webkit-transition:background 0.35s cubic-bezier(0.4,0,0.2,1);transition:background 0.35s cubic-bezier(0.4,0,0.2,1);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:rgba(0,0,0,0.1);}.fullscreen.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{display:none;}.backdrop-wrapper-enter.__jsx-style-dynamic-selector .layer-default.__jsx-style-dynamic-selector{opacity:0;}.backdrop-wrapper-enter-active.__jsx-style-dynamic-selector .layer-default.__jsx-style-dynamic-selector{opacity:${theme.expressiveness.portalOpacity};}.backdrop-wrapper-leave.__jsx-style-dynamic-selector .layer-default.__jsx-style-dynamic-selector{opacity:${theme.expressiveness.portalOpacity};}.backdrop-wrapper-leave-active.__jsx-style-dynamic-selector .layer-default.__jsx-style-dynamic-selector{opacity:0;}.backdrop-wrapper-enter.__jsx-style-dynamic-selector .layer-blur.__jsx-style-dynamic-selector{background-color:rgba(0,0,0,0.1);}.backdrop-wrapper-enter-active.__jsx-style-dynamic-selector .layer-blur.__jsx-style-dynamic-selector{background-color:rgba(0,0,0,0.4);}.backdrop-wrapper-leave.__jsx-style-dynamic-selector .layer-blur.__jsx-style-dynamic-selector{background-color:rgba(0,0,0,0.4);}.backdrop-wrapper-leave-active.__jsx-style-dynamic-selector .layer-blur.__jsx-style-dynamic-selector{background-color:rgba(0,0,0,0.1);}@media only screen and (max-width:${theme.breakpoints.sm.max}){.content.__jsx-style-dynamic-selector{width:90%;}}`
70
68
  })]
71
- })
69
+ });
70
+ }, [children]);
71
+ return /*#__PURE__*/_jsx(_Fragment, {
72
+ children: animated ? /*#__PURE__*/_jsx(CSSTransition, {
73
+ name: "backdrop-wrapper",
74
+ visible: visible,
75
+ enterTime: 20,
76
+ leaveTime: 20,
77
+ clearTime: 150,
78
+ children: renderChildren
79
+ }) : visible ? renderChildren : null
72
80
  });
73
81
  });
74
82
 
@@ -49,5 +49,5 @@ declare const _default: React.ComponentType<Partial<{
49
49
  size: "mini" | "small" | "medium" | "large" | "xlarge";
50
50
  color: "default" | "primary" | "secondary" | "success" | "warning" | "error" | "gradient";
51
51
  className: string;
52
- }> & Omit<ButtonGroupProps, "light" | "rounded" | "className" | "animated" | "color" | "vertical" | "bordered" | "size" | "auto" | "flat" | "disabled" | "shadow" | "ghost" | "borderWeight">>;
52
+ }> & Omit<ButtonGroupProps, "light" | "rounded" | "className" | "animated" | "color" | "vertical" | "bordered" | "size" | "borderWeight" | "auto" | "flat" | "disabled" | "shadow" | "ghost">>;
53
53
  export default _default;
@@ -1,8 +1,8 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
- import React, { useRef, useState, useMemo, useImperativeHandle } from 'react';
2
+ import React, { useRef, useMemo, useImperativeHandle } from 'react';
3
3
  import useWarning from '../use-warning';
4
4
  import useTheme from '../use-theme';
5
- import ButtonDrip from './button.drip';
5
+ import ButtonDrip from '../utils/drip';
6
6
  import ButtonLoading from './button-loading';
7
7
  import { filterPropsWithGroup } from './utils';
8
8
  import { useButtonGroupContext } from './button-group-context';
@@ -10,6 +10,7 @@ import ButtonIcon from './button-icon';
10
10
  import { getButtonColors, getButtonCursor, getButtonDripColor, getShadowColor, getButtonSize } from './styles';
11
11
  import { getNormalRadius } from '../utils/dimensions';
12
12
  import { __DEV__ } from '../utils/assertion';
13
+ import useDrip from '../use-drip';
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
16
  const defaultProps = {
@@ -37,9 +38,6 @@ const Button = /*#__PURE__*/React.forwardRef(({ ...btnProps
37
38
  const theme = useTheme();
38
39
  const buttonRef = useRef(null);
39
40
  useImperativeHandle(ref, () => buttonRef.current);
40
- const [dripShow, setDripShow] = useState(false);
41
- const [dripX, setDripX] = useState(0);
42
- const [dripY, setDripY] = useState(0);
43
41
  const groupConfig = useButtonGroupContext();
44
42
  const filteredProps = filterPropsWithGroup(btnProps, groupConfig);
45
43
  /* eslint-disable @typescript-eslint/no-unused-vars */
@@ -97,24 +95,19 @@ const Button = /*#__PURE__*/React.forwardRef(({ ...btnProps
97
95
  loaderSize
98
96
  } = useMemo(() => getButtonSize(size, auto), [size, auto]);
99
97
  const dripColor = useMemo(() => getButtonDripColor(theme.palette, filteredProps), [theme.palette, filteredProps]);
98
+ const {
99
+ onClick: onDripClickHandler,
100
+ ...dripBindings
101
+ } = useDrip(false, buttonRef);
100
102
  const paddingForAutoMode = useMemo(() => auto || size === 'mini' ? `calc(var(--next-ui-button-height) / 2 + var(--next-ui-button-padding) * .5)` : 0, [auto, size]);
101
103
  const hoverBeforeOpacity = useMemo(() => filteredProps.color === 'gradient' && ghost ? 1 : 0, [ghost, filteredProps]);
102
104
  const paddingForBorderedGradient = useMemo(() => filteredProps.color === 'gradient' && (bordered || ghost) ? `var(--next-ui-button-padding)` : 0, [filteredProps.color, bordered]);
103
105
 
104
- const dripCompletedHandle = () => {
105
- setDripShow(false);
106
- setDripX(0);
107
- setDripY(0);
108
- };
109
-
110
106
  const clickHandler = event => {
111
107
  if (disabled || loading) return;
112
108
 
113
109
  if (animated && buttonRef.current) {
114
- const rect = buttonRef.current.getBoundingClientRect();
115
- setDripShow(true);
116
- setDripX(event.clientX - rect.left);
117
- setDripY(event.clientY - rect.top);
110
+ onDripClickHandler(event);
118
111
  }
119
112
 
120
113
  onClick && onClick(event);
@@ -153,11 +146,9 @@ const Button = /*#__PURE__*/React.forwardRef(({ ...btnProps
153
146
  }) : /*#__PURE__*/_jsx("div", {
154
147
  className: _JSXStyle.dynamic([["3651782765", [bg, padding, height, height, minWidth, width, radius, (border == null ? void 0 : border.width) || '2px', (border == null ? void 0 : border.display) || 'none', (border == null ? void 0 : border.color) || 'transparent', fontSize, color, cursor, events, shadowColor, radius, padding, height, color, bg, hover == null ? void 0 : hover.bg, radius, hoverBeforeOpacity, animated ? 'scale(0.97)' : 'none', (hover == null ? void 0 : hover.bg) || 'inherit', hover == null ? void 0 : hover.color, (hover == null ? void 0 : (_hover$style = hover.style) == null ? void 0 : _hover$style.filter) || 'none', hover == null ? void 0 : hover.color, (hover == null ? void 0 : (_hover$border = hover.border) == null ? void 0 : _hover$border.color) || 'transparent', hover == null ? void 0 : (_hover$border2 = hover.border) == null ? void 0 : _hover$border2.width, hover == null ? void 0 : hover.padding, cursor, events, bordered || ghost ? (border == null ? void 0 : border.width) || '2px' : '0', paddingForBorderedGradient, loading ? 0 : 1, paddingForAutoMode, paddingForAutoMode]]]) + " " + "text",
155
148
  children: children
156
- }), dripShow && /*#__PURE__*/_jsx(ButtonDrip, {
157
- x: dripX,
158
- y: dripY,
149
+ }), /*#__PURE__*/_jsx(ButtonDrip, {
159
150
  color: dripColor,
160
- onCompleted: dripCompletedHandle
151
+ ...dripBindings
161
152
  }), /*#__PURE__*/_jsx(_JSXStyle, {
162
153
  id: "3651782765",
163
154
  dynamic: [bg, padding, height, height, minWidth, width, radius, (border == null ? void 0 : border.width) || '2px', (border == null ? void 0 : border.display) || 'none', (border == null ? void 0 : border.color) || 'transparent', fontSize, color, cursor, events, shadowColor, radius, padding, height, color, bg, hover == null ? void 0 : hover.bg, radius, hoverBeforeOpacity, animated ? 'scale(0.97)' : 'none', (hover == null ? void 0 : hover.bg) || 'inherit', hover == null ? void 0 : hover.color, (hover == null ? void 0 : (_hover$style = hover.style) == null ? void 0 : _hover$style.filter) || 'none', hover == null ? void 0 : hover.color, (hover == null ? void 0 : (_hover$border = hover.border) == null ? void 0 : _hover$border.color) || 'transparent', hover == null ? void 0 : (_hover$border2 = hover.border) == null ? void 0 : _hover$border2.width, hover == null ? void 0 : hover.padding, cursor, events, bordered || ghost ? (border == null ? void 0 : border.width) || '2px' : '0', paddingForBorderedGradient, loading ? 0 : 1, paddingForAutoMode, paddingForAutoMode],
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { AlignContent, AlignItems, Justify, Direction } from '../utils/prop-types';
3
+ interface Props {
4
+ justify?: Justify;
5
+ direction?: Direction;
6
+ alignItems?: AlignItems;
7
+ alignContent?: AlignContent;
8
+ noPadding?: boolean;
9
+ width?: string;
10
+ height?: string;
11
+ className?: string;
12
+ }
13
+ declare const defaultProps: {
14
+ width: string;
15
+ height: string;
16
+ justify: string;
17
+ alignItems: string;
18
+ alignContent: string;
19
+ direction: string;
20
+ noPadding: boolean;
21
+ className: string;
22
+ };
23
+ declare type NativeAttrs = Omit<React.HTMLAttributes<unknown>, keyof Props>;
24
+ export declare type CardBodyProps = Props & typeof defaultProps & NativeAttrs;
25
+ declare const _default: React.ComponentType<Partial<{
26
+ width: string;
27
+ height: string;
28
+ justify: string;
29
+ alignItems: string;
30
+ alignContent: string;
31
+ direction: string;
32
+ noPadding: boolean;
33
+ className: string;
34
+ }> & Omit<CardBodyProps, "width" | "height" | "className" | "justify" | "direction" | "alignItems" | "alignContent" | "noPadding">>;
35
+ export default _default;
@@ -0,0 +1,52 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ import React, { useMemo, useContext } from 'react';
3
+ import useTheme from '../use-theme';
4
+ import { CardContext } from './card-context';
5
+ import clsx from '../utils/clsx';
6
+ import withDefaults from '../utils/with-defaults';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ const defaultProps = {
10
+ width: '100%',
11
+ height: 'auto',
12
+ justify: 'inherit',
13
+ alignItems: 'inherit',
14
+ alignContent: 'inherit',
15
+ direction: 'column',
16
+ noPadding: false,
17
+ className: ''
18
+ };
19
+
20
+ const CardBody = ({
21
+ className,
22
+ justify,
23
+ alignContent,
24
+ alignItems,
25
+ noPadding: noPaddingProp,
26
+ direction,
27
+ width,
28
+ height,
29
+ children,
30
+ ...props
31
+ }) => {
32
+ const theme = useTheme();
33
+ const {
34
+ noPadding: noPaddingContext
35
+ } = useContext(CardContext);
36
+ const noPadding = useMemo(() => {
37
+ return noPaddingContext !== undefined ? noPaddingContext : noPaddingProp;
38
+ }, [noPaddingProp, noPaddingContext]);
39
+ return /*#__PURE__*/_jsxs("div", { ...props,
40
+ className: _JSXStyle.dynamic([["3689227210", [width, height, direction, justify, alignItems, alignContent, theme.layout.gapHalf, theme.layout.gap]]]) + " " + (props && props.className != null && props.className || clsx('card-body', {
41
+ 'no-padding': noPadding
42
+ }, className) || ""),
43
+ children: [children, /*#__PURE__*/_jsx(_JSXStyle, {
44
+ id: "3689227210",
45
+ dynamic: [width, height, direction, justify, alignItems, alignContent, theme.layout.gapHalf, theme.layout.gap],
46
+ children: `.card-body.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:1 1 auto;-ms-flex:1 1 auto;flex:1 1 auto;width:${width};height:${height};-webkit-flex-direction:${direction};-ms-flex-direction:${direction};flex-direction:${direction};-webkit-box-pack:${justify};-webkit-justify-content:${justify};-ms-flex-pack:${justify};justify-content:${justify};-webkit-align-items:${alignItems};-webkit-box-align:${alignItems};-ms-flex-align:${alignItems};align-items:${alignItems};-webkit-align-content:${alignContent};-ms-flex-line-pack:${alignContent};align-content:${alignContent};padding:${theme.layout.gapHalf} calc(${theme.layout.gap} + 0.25rem);overflow-y:auto;position:relative;text-align:left;}.card-body.no-padding.__jsx-style-dynamic-selector{padding:0;}.card-body.__jsx-style-dynamic-selector>*:first-child{margin-top:0;}.card-body.__jsx-style-dynamic-selector>*:last-child{margin-bottom:0;}`
47
+ })]
48
+ });
49
+ };
50
+
51
+ const MemoCardBody = /*#__PURE__*/React.memo(CardBody);
52
+ export default withDefaults(MemoCardBody, defaultProps);
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface CardConfig {
3
+ autoMargin?: boolean;
4
+ noPadding?: boolean;
5
+ background?: string;
6
+ }
7
+ export declare const CardContext: React.Context<CardConfig>;
8
+ export declare const useCardContext: () => CardConfig;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ const defaultContext = {
3
+ noPadding: undefined
4
+ };
5
+ export const CardContext = /*#__PURE__*/React.createContext(defaultContext);
6
+ export const useCardContext = () => React.useContext(CardContext);
@@ -1,16 +1,37 @@
1
1
  import React from 'react';
2
+ import { NormalColors, NormalWeights, SimpleColors } from '../utils/prop-types';
2
3
  interface Props {
3
- disableAutoMargin?: boolean;
4
+ blur?: boolean;
5
+ autoMargin?: boolean;
6
+ border?: boolean;
4
7
  className?: string;
8
+ width?: string;
9
+ height?: string;
10
+ color?: NormalColors | string;
11
+ borderColor?: SimpleColors | string;
12
+ borderWeight?: NormalWeights;
13
+ noPadding?: boolean;
5
14
  }
6
15
  declare const defaultProps: {
7
- disableAutoMargin: boolean;
16
+ autoMargin: boolean;
17
+ blur: boolean;
18
+ border: boolean;
19
+ width: string;
20
+ height: string;
21
+ noPadding: boolean;
22
+ borderWeight: "light" | "normal" | "bold";
8
23
  className: string;
9
24
  };
10
25
  declare type NativeAttrs = Omit<React.HTMLAttributes<unknown>, keyof Props>;
11
26
  export declare type CardFooterProps = Props & typeof defaultProps & NativeAttrs;
12
27
  declare const _default: React.ComponentType<Partial<{
13
- disableAutoMargin: boolean;
28
+ autoMargin: boolean;
29
+ blur: boolean;
30
+ border: boolean;
31
+ width: string;
32
+ height: string;
33
+ noPadding: boolean;
34
+ borderWeight: "light" | "normal" | "bold";
14
35
  className: string;
15
- }> & Omit<CardFooterProps, "className" | "disableAutoMargin">>;
36
+ }> & Omit<CardFooterProps, "width" | "height" | "blur" | "className" | "borderWeight" | "border" | "autoMargin" | "noPadding">>;
16
37
  export default _default;
@@ -1,27 +1,67 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
- import React from 'react';
2
+ import React, { useContext, useMemo } from 'react';
3
3
  import useTheme from '../use-theme';
4
4
  import withDefaults from '../utils/with-defaults';
5
+ import clsx from '../utils/clsx';
6
+ import { CardContext } from './card-context';
7
+ import { addColorAlpha, getNormalColor } from '../utils/color';
8
+ import { getNormalWeight } from '../utils/dimensions';
5
9
  import { jsx as _jsx } from "react/jsx-runtime";
6
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
11
  const defaultProps = {
8
- disableAutoMargin: false,
12
+ autoMargin: false,
13
+ blur: false,
14
+ border: false,
15
+ width: '100%',
16
+ height: 'auto',
17
+ noPadding: false,
18
+ borderWeight: 'light',
9
19
  className: ''
10
20
  };
11
21
 
12
22
  const CardFooter = ({
13
23
  children,
24
+ blur,
14
25
  className,
15
- disableAutoMargin,
26
+ color,
27
+ width,
28
+ height,
29
+ border: borderProp,
30
+ borderColor,
31
+ borderWeight,
32
+ noPadding,
33
+ autoMargin: autoMarginProp,
16
34
  ...props
17
35
  }) => {
18
36
  const theme = useTheme();
19
- return /*#__PURE__*/_jsxs("footer", { ...props,
20
- className: _JSXStyle.dynamic([["3326643427", [theme.layout.gapHalf, theme.layout.gap, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.layout.gap, theme.layout.gapQuarter]]]) + " " + (props && props.className != null && props.className || `${disableAutoMargin ? '' : 'auto-margin'} ${className}`),
37
+ const {
38
+ background,
39
+ autoMargin: autoMarginContext
40
+ } = useContext(CardContext);
41
+ const autoMargin = useMemo(() => {
42
+ return autoMarginContext !== undefined ? autoMarginContext : autoMarginProp;
43
+ }, [autoMarginProp, autoMarginContext]);
44
+ const bgColor = useMemo(() => {
45
+ if (color) {
46
+ return getNormalColor(color, theme.palette);
47
+ }
48
+
49
+ return background || theme.palette.background;
50
+ }, [color, theme.palette, background]);
51
+ const border = useMemo(() => {
52
+ if (!borderProp) return 'none';
53
+ return `${getNormalWeight(borderWeight)} solid ${getNormalColor(borderColor, theme.palette, theme.palette.border)}`;
54
+ }, [borderWeight, theme.palette, borderColor, borderProp]);
55
+ return /*#__PURE__*/_jsxs("div", { ...props,
56
+ className: _JSXStyle.dynamic([["135585066", [width, height, theme.layout.gapHalf, theme.layout.gap, bgColor, border, theme.layout.radius, theme.layout.radius, addColorAlpha(bgColor, 0.4), theme.layout.gapQuarter]]]) + " " + (props && props.className != null && props.className || clsx('card-footer', {
57
+ 'auto-margin': autoMargin,
58
+ blur,
59
+ 'no-padding': noPadding
60
+ }, className) || ""),
21
61
  children: [children, /*#__PURE__*/_jsx(_JSXStyle, {
22
- id: "3326643427",
23
- dynamic: [theme.layout.gapHalf, theme.layout.gap, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.layout.gap, theme.layout.gapQuarter],
24
- children: `footer.__jsx-style-dynamic-selector{padding:${theme.layout.gapHalf} ${theme.layout.gap};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;overflow:hidden;color:inherit;background-color:inherit;font-size:0.875rem;border-top:1px solid ${theme.palette.border};border-bottom-left-radius:${theme.layout.radius};border-bottom-right-radius:${theme.layout.radius};min-height:calc(2.5 * ${theme.layout.gap});}.auto-margin.__jsx-style-dynamic-selector *{margin-top:0;margin-bottom:0;margin-right:${theme.layout.gapQuarter};}`
62
+ id: "135585066",
63
+ dynamic: [width, height, theme.layout.gapHalf, theme.layout.gap, bgColor, border, theme.layout.radius, theme.layout.radius, addColorAlpha(bgColor, 0.4), theme.layout.gapQuarter],
64
+ children: `.card-footer.__jsx-style-dynamic-selector{width:${width};height:${height};padding:${theme.layout.gapHalf} ${theme.layout.gap};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;overflow:hidden;color:inherit;background-color:${bgColor};font-size:0.875rem;border-top:${border};border-bottom-left-radius:${theme.layout.radius};border-bottom-right-radius:${theme.layout.radius};}.card-footer.blur.__jsx-style-dynamic-selector{-webkit-backdrop-filter:saturate(180%) blur(10px);backdrop-filter:saturate(180%) blur(10px);background:${addColorAlpha(bgColor, 0.4)};}.card-footer.no-padding.__jsx-style-dynamic-selector{padding:0;}.auto-margin.__jsx-style-dynamic-selector *{margin-top:0;margin-bottom:0;margin-right:${theme.layout.gapQuarter};}`
25
65
  })]
26
66
  });
27
67
  };