@razorpay/blade 11.11.1 → 11.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/Box/BaseBox/baseBoxStyles.js +1 -1
- package/build/lib/native/components/Box/BaseBox/baseBoxStyles.js.map +1 -1
- package/build/lib/native/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/native/components/Button/BaseButton/StyledBaseButton.native.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/AnimatedBaseInputWrapper.native.js +1 -1
- package/build/lib/native/components/Input/BaseInput/AnimatedBaseInputWrapper.native.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js +2 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputTagSlot.native.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputTagSlot.native.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputWrapper.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputWrapper.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js +1 -1
- package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputStyles.js +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/useTaggedInput.js +13 -0
- package/build/lib/native/components/Input/BaseInput/useTaggedInput.js.map +1 -0
- package/build/lib/native/components/Input/TextArea/TextArea.js +2 -1
- package/build/lib/native/components/Input/TextArea/TextArea.js.map +1 -1
- package/build/lib/native/components/Input/TextInput/TextInput.js +2 -1
- package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/native/components/ProgressBar/CircularProgressBar.native.js +31 -0
- package/build/lib/native/components/ProgressBar/CircularProgressBar.native.js.map +1 -0
- package/build/lib/native/components/ProgressBar/CircularProgressLabel.js +17 -0
- package/build/lib/native/components/ProgressBar/CircularProgressLabel.js.map +1 -0
- package/build/lib/native/components/ProgressBar/ProgressBar.js +2 -1
- package/build/lib/native/components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/lib/native/components/ProgressBar/ProgressBarFilled.native.js +1 -1
- package/build/lib/native/components/ProgressBar/ProgressBarFilled.native.js.map +1 -1
- package/build/lib/native/components/ProgressBar/progressBarTokens.js +6 -2
- package/build/lib/native/components/ProgressBar/progressBarTokens.js.map +1 -1
- package/build/lib/native/components/Tag/AnimatedTag.native.js.map +1 -1
- package/build/lib/native/components/Tag/Tag.js +1 -1
- package/build/lib/native/components/Tag/Tag.js.map +1 -1
- package/build/lib/native/components/Tag/getTagsGroup.js +1 -1
- package/build/lib/native/components/Tag/getTagsGroup.js.map +1 -1
- package/build/lib/native/components/Tag/tagAnimationConfig.js +1 -2
- package/build/lib/native/components/Tag/tagAnimationConfig.js.map +1 -1
- package/build/lib/native/components/Typography/BaseText/getBaseTextStyles.js +1 -1
- package/build/lib/native/components/Typography/BaseText/getBaseTextStyles.js.map +1 -1
- package/build/lib/native/tokens/global/size.js +1 -1
- package/build/lib/native/tokens/global/size.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/baseBoxStyles.js +2 -1
- package/build/lib/web/development/components/Box/BaseBox/baseBoxStyles.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +8 -2
- package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +13 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js +14 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputWrapper.js +4 -2
- package/build/lib/web/development/components/Input/BaseInput/BaseInputWrapper.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js +5 -2
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js +2 -2
- package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/useTaggedInput.js +172 -0
- package/build/lib/web/development/components/Input/BaseInput/useTaggedInput.js.map +1 -0
- package/build/lib/web/development/components/Input/TextArea/TextArea.js +54 -8
- package/build/lib/web/development/components/Input/TextArea/TextArea.js.map +1 -1
- package/build/lib/web/development/components/Input/TextInput/TextInput.js +51 -5
- package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/development/components/ProgressBar/CircularProgressBar.web.js +140 -0
- package/build/lib/web/development/components/ProgressBar/CircularProgressBar.web.js.map +1 -0
- package/build/lib/web/development/components/ProgressBar/CircularProgressLabel.js +38 -0
- package/build/lib/web/development/components/ProgressBar/CircularProgressLabel.js.map +1 -0
- package/build/lib/web/development/components/ProgressBar/ProgressBar.js +47 -10
- package/build/lib/web/development/components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/lib/web/development/components/ProgressBar/ProgressBarFilled.web.js +6 -6
- package/build/lib/web/development/components/ProgressBar/ProgressBarFilled.web.js.map +1 -1
- package/build/lib/web/development/components/ProgressBar/progressBarTokens.js +45 -1
- package/build/lib/web/development/components/ProgressBar/progressBarTokens.js.map +1 -1
- package/build/lib/web/development/components/Tag/AnimatedTag.web.js +2 -3
- package/build/lib/web/development/components/Tag/AnimatedTag.web.js.map +1 -1
- package/build/lib/web/development/components/Tag/Tag.js +5 -6
- package/build/lib/web/development/components/Tag/Tag.js.map +1 -1
- package/build/lib/web/development/components/Tag/getTagsGroup.js +1 -1
- package/build/lib/web/development/components/Tag/getTagsGroup.js.map +1 -1
- package/build/lib/web/development/components/Tag/tagAnimationConfig.js +4 -2
- package/build/lib/web/development/components/Tag/tagAnimationConfig.js.map +1 -1
- package/build/lib/web/development/components/Typography/BaseText/getBaseTextStyles.js +2 -1
- package/build/lib/web/development/components/Typography/BaseText/getBaseTextStyles.js.map +1 -1
- package/build/lib/web/development/tokens/global/size.js +4 -0
- package/build/lib/web/development/tokens/global/size.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/baseBoxStyles.js +2 -1
- package/build/lib/web/production/components/Box/BaseBox/baseBoxStyles.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +8 -2
- package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +13 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js +14 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputWrapper.js +4 -2
- package/build/lib/web/production/components/Input/BaseInput/BaseInputWrapper.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js +5 -2
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js +2 -2
- package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/useTaggedInput.js +172 -0
- package/build/lib/web/production/components/Input/BaseInput/useTaggedInput.js.map +1 -0
- package/build/lib/web/production/components/Input/TextArea/TextArea.js +54 -8
- package/build/lib/web/production/components/Input/TextArea/TextArea.js.map +1 -1
- package/build/lib/web/production/components/Input/TextInput/TextInput.js +51 -5
- package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/production/components/ProgressBar/CircularProgressBar.web.js +140 -0
- package/build/lib/web/production/components/ProgressBar/CircularProgressBar.web.js.map +1 -0
- package/build/lib/web/production/components/ProgressBar/CircularProgressLabel.js +38 -0
- package/build/lib/web/production/components/ProgressBar/CircularProgressLabel.js.map +1 -0
- package/build/lib/web/production/components/ProgressBar/ProgressBar.js +47 -10
- package/build/lib/web/production/components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/lib/web/production/components/ProgressBar/ProgressBarFilled.web.js +6 -6
- package/build/lib/web/production/components/ProgressBar/ProgressBarFilled.web.js.map +1 -1
- package/build/lib/web/production/components/ProgressBar/progressBarTokens.js +45 -1
- package/build/lib/web/production/components/ProgressBar/progressBarTokens.js.map +1 -1
- package/build/lib/web/production/components/Tag/AnimatedTag.web.js +2 -3
- package/build/lib/web/production/components/Tag/AnimatedTag.web.js.map +1 -1
- package/build/lib/web/production/components/Tag/Tag.js +5 -6
- package/build/lib/web/production/components/Tag/Tag.js.map +1 -1
- package/build/lib/web/production/components/Tag/getTagsGroup.js +1 -1
- package/build/lib/web/production/components/Tag/getTagsGroup.js.map +1 -1
- package/build/lib/web/production/components/Tag/tagAnimationConfig.js +4 -2
- package/build/lib/web/production/components/Tag/tagAnimationConfig.js.map +1 -1
- package/build/lib/web/production/components/Typography/BaseText/getBaseTextStyles.js +2 -1
- package/build/lib/web/production/components/Typography/BaseText/getBaseTextStyles.js.map +1 -1
- package/build/lib/web/production/tokens/global/size.js +4 -0
- package/build/lib/web/production/tokens/global/size.js.map +1 -1
- package/build/types/components/index.d.ts +30 -8
- package/build/types/components/index.native.d.ts +22 -8
- package/build/types/tokens/index.d.ts +4 -0
- package/build/types/tokens/index.native.d.ts +4 -0
- package/codemods/migrate-progressbar/transformers/__test__/migrate-progressbar.test.ts +28 -0
- package/codemods/migrate-progressbar/transformers/index.ts +89 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CircularProgressLabel.js","sources":["../../../../../../src/components/ProgressBar/CircularProgressLabel.tsx"],"sourcesContent":["import React from 'react';\nimport type { CircularProgressBarFilledProps } from './types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\n\nconst CircularProgressLabel = ({\n progressPercent,\n size = 'small',\n label,\n showPercentage = true,\n}: Pick<\n CircularProgressBarFilledProps,\n 'progressPercent' | 'size' | 'label' | 'showPercentage'\n>): React.ReactElement => {\n const hasLabel = label && label.trim()?.length > 0;\n\n return (\n <BaseBox display=\"flex\" flexDirection=\"column\" alignItems=\"center\">\n {hasLabel && (\n <Text marginTop=\"spacing.3\" variant=\"body\" weight=\"regular\" size=\"small\">\n {label}\n </Text>\n )}\n\n {showPercentage && size === 'small' && (\n <Text\n marginTop={hasLabel ? 'spacing.0' : 'spacing.3'}\n variant=\"body\"\n weight=\"semibold\"\n size=\"small\"\n >\n {progressPercent}%\n </Text>\n )}\n </BaseBox>\n );\n};\n\nexport { CircularProgressLabel };\n"],"names":["CircularProgressLabel","_ref","_label$trim","progressPercent","_ref$size","size","label","_ref$showPercentage","showPercentage","hasLabel","trim","length","_jsxs","BaseBox","display","flexDirection","alignItems","children","_jsx","Text","marginTop","variant","weight"],"mappings":";;;;;;;AAKA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAAC,IAAA,EAQD;AAAA,EAAA,IAAAC,WAAA,CAAA;AAAA,EAAA,IAPxBC,eAAe,GAAAF,IAAA,CAAfE,eAAe;IAAAC,SAAA,GAAAH,IAAA,CACfI,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,SAAA;IACdE,KAAK,GAAAL,IAAA,CAALK,KAAK;IAAAC,mBAAA,GAAAN,IAAA,CACLO,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA,CAAA;AAKrB,EAAA,IAAME,QAAQ,GAAGH,KAAK,IAAI,CAAAJ,CAAAA,WAAA,GAAAI,KAAK,CAACI,IAAI,EAAE,cAAAR,WAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAZA,WAAA,CAAcS,MAAM,IAAG,CAAC,CAAA;EAElD,oBACEC,IAAA,CAACC,OAAO,EAAA;AAACC,IAAAA,OAAO,EAAC,MAAM;AAACC,IAAAA,aAAa,EAAC,QAAQ;AAACC,IAAAA,UAAU,EAAC,QAAQ;AAAAC,IAAAA,QAAA,EAC/DR,CAAAA,QAAQ,iBACPS,GAAA,CAACC,IAAI,EAAA;AAACC,MAAAA,SAAS,EAAC,WAAW;AAACC,MAAAA,OAAO,EAAC,MAAM;AAACC,MAAAA,MAAM,EAAC,SAAS;AAACjB,MAAAA,IAAI,EAAC,OAAO;AAAAY,MAAAA,QAAA,EACrEX,KAAAA;KACG,CACP,EAEAE,cAAc,IAAIH,IAAI,KAAK,OAAO,iBACjCO,IAAA,CAACO,IAAI,EAAA;AACHC,MAAAA,SAAS,EAAEX,QAAQ,GAAG,WAAW,GAAG,WAAY;AAChDY,MAAAA,OAAO,EAAC,MAAM;AACdC,MAAAA,MAAM,EAAC,UAAU;AACjBjB,MAAAA,IAAI,EAAC,OAAO;MAAAY,QAAA,EAAA,CAEXd,eAAe,EAAC,GACnB,CAAA;AAAA,KAAM,CACP,CAAA;AAAA,GACM,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
3
|
import { ProgressBarFilled } from './ProgressBarFilled.web.js';
|
|
4
|
+
import { CircularProgressBarFilled } from './CircularProgressBar.web.js';
|
|
4
5
|
import clamp from '../../utils/lodashButBetter/clamp.js';
|
|
5
6
|
import '../../utils/metaAttribute/index.js';
|
|
6
7
|
import '../Typography/Text/index.js';
|
|
@@ -24,17 +25,20 @@ import { Text } from '../Typography/Text/Text.js';
|
|
|
24
25
|
import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
|
|
25
26
|
import { makeSize } from '../../utils/makeSize/makeSize.js';
|
|
26
27
|
|
|
27
|
-
var _excluded = ["accessibilityLabel", "color", "isIndeterminate", "label", "showPercentage", "size", "value", "variant", "min", "max", "testID"];
|
|
28
|
+
var _excluded = ["accessibilityLabel", "color", "type", "isIndeterminate", "label", "showPercentage", "size", "value", "variant", "min", "max", "testID"];
|
|
28
29
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
29
30
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
30
31
|
var progressBarHeight = {
|
|
31
32
|
small: size[2],
|
|
32
|
-
medium: size[4]
|
|
33
|
+
medium: size[4],
|
|
34
|
+
// Large size isn't available when variant is 'linear'
|
|
35
|
+
large: size[0]
|
|
33
36
|
};
|
|
34
37
|
var ProgressBar = function ProgressBar(_ref) {
|
|
35
38
|
var _label$trim;
|
|
36
39
|
var accessibilityLabel = _ref.accessibilityLabel,
|
|
37
40
|
color = _ref.color,
|
|
41
|
+
type = _ref.type,
|
|
38
42
|
_ref$isIndeterminate = _ref.isIndeterminate,
|
|
39
43
|
isIndeterminate = _ref$isIndeterminate === void 0 ? false : _ref$isIndeterminate,
|
|
40
44
|
label = _ref.label,
|
|
@@ -54,19 +58,40 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
54
58
|
styledProps = _objectWithoutProperties(_ref, _excluded);
|
|
55
59
|
var _useTheme = useTheme(),
|
|
56
60
|
theme = _useTheme.theme;
|
|
57
|
-
var
|
|
61
|
+
var progressType = !type && (variant === 'meter' || variant === 'progress') ? variant : type;
|
|
62
|
+
var progressVariant = variant === 'meter' || variant === 'progress' ? 'linear' : variant;
|
|
63
|
+
var id = useId("".concat(progressType, "-").concat(progressVariant));
|
|
58
64
|
if (false) {
|
|
59
|
-
if (
|
|
65
|
+
if (progressType === 'meter' && isIndeterminate) {
|
|
60
66
|
throwBladeError({
|
|
61
67
|
moduleName: 'ProgressBar',
|
|
62
|
-
message: "Cannot set 'isIndeterminate' when 'variant' is 'meter'."
|
|
68
|
+
message: "Cannot set 'isIndeterminate' when 'type' or 'variant' is 'meter'."
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (progressVariant === 'circular' && isIndeterminate) {
|
|
72
|
+
throwBladeError({
|
|
73
|
+
moduleName: 'ProgressBar',
|
|
74
|
+
message: "Cannot set 'isIndeterminate' when 'variant' is 'circular'."
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (progressVariant === 'linear' && size === 'large') {
|
|
78
|
+
throwBladeError({
|
|
79
|
+
moduleName: 'ProgressBar',
|
|
80
|
+
message: "Large size isn't available when 'variant' is 'linear'."
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (type && (variant === 'progress' || variant === 'meter')) {
|
|
84
|
+
throwBladeError({
|
|
85
|
+
moduleName: 'ProgressBar',
|
|
86
|
+
message: "variant can only be 'linear' or 'circular' when 'type=".concat(type, "'.")
|
|
63
87
|
});
|
|
64
88
|
}
|
|
65
89
|
}
|
|
66
90
|
var unfilledBackgroundColor = theme.colors.feedback.background.neutral.subtle;
|
|
67
91
|
var filledBackgroundColor = color ? theme.colors.feedback.background[color].intense : theme.colors.surface.background.primary.intense;
|
|
68
92
|
var hasLabel = label && ((_label$trim = label.trim()) === null || _label$trim === void 0 ? void 0 : _label$trim.length) > 0;
|
|
69
|
-
var isMeter =
|
|
93
|
+
var isMeter = progressType === 'meter';
|
|
94
|
+
var isCircular = progressVariant === 'circular';
|
|
70
95
|
var progressValue = clamp(value, min, max);
|
|
71
96
|
var percentageProgressValue = Math.floor((progressValue - min) * 100 / (max - min));
|
|
72
97
|
var shouldShowPercentage = showPercentage && !isMeter && !isIndeterminate;
|
|
@@ -97,7 +122,7 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
97
122
|
display: "flex",
|
|
98
123
|
flexDirection: "column",
|
|
99
124
|
width: "100%",
|
|
100
|
-
children: [/*#__PURE__*/jsxs(BaseBox, {
|
|
125
|
+
children: [!isCircular ? /*#__PURE__*/jsxs(BaseBox, {
|
|
101
126
|
display: "flex",
|
|
102
127
|
flexDirection: "row",
|
|
103
128
|
justifyContent: hasLabel ? 'space-between' : 'flex-end',
|
|
@@ -116,7 +141,7 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
116
141
|
children: "".concat(percentageProgressValue, "%")
|
|
117
142
|
})
|
|
118
143
|
}) : null]
|
|
119
|
-
}), /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({
|
|
144
|
+
}) : null, /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({
|
|
120
145
|
id: id
|
|
121
146
|
}, makeAccessible({
|
|
122
147
|
role: accessibilityProps.role,
|
|
@@ -126,7 +151,19 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
126
151
|
valueMin: accessibilityProps.valueMin,
|
|
127
152
|
valueMax: accessibilityProps.valueMax
|
|
128
153
|
})), {}, {
|
|
129
|
-
children: /*#__PURE__*/jsx(
|
|
154
|
+
children: isCircular ? /*#__PURE__*/jsx(CircularProgressBarFilled, {
|
|
155
|
+
size: size,
|
|
156
|
+
label: label,
|
|
157
|
+
progressPercent: percentageProgressValue,
|
|
158
|
+
isMeter: isMeter,
|
|
159
|
+
showPercentage: shouldShowPercentage,
|
|
160
|
+
backgroundColor: unfilledBackgroundColor,
|
|
161
|
+
fillColor: filledBackgroundColor,
|
|
162
|
+
pulseMotionDuration: "duration.2xgentle",
|
|
163
|
+
fillMotionDuration: "duration.2xgentle",
|
|
164
|
+
pulseMotionDelay: "delay.long",
|
|
165
|
+
motionEasing: "easing.standard.revealing"
|
|
166
|
+
}) : /*#__PURE__*/jsx(BaseBox, {
|
|
130
167
|
backgroundColor: unfilledBackgroundColor,
|
|
131
168
|
height: makeSize(progressBarHeight[size]),
|
|
132
169
|
overflow: "hidden",
|
|
@@ -139,7 +176,7 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
139
176
|
indeterminateMotionDuration: "duration.2xgentle",
|
|
140
177
|
pulseMotionDelay: "delay.long",
|
|
141
178
|
motionEasing: "easing.standard.revealing",
|
|
142
|
-
|
|
179
|
+
type: progressType,
|
|
143
180
|
isIndeterminate: isIndeterminate
|
|
144
181
|
})
|
|
145
182
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","sources":["../../../../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { ProgressBarFilled } from './ProgressBarFilled';\nimport clamp from '~utils/lodashButBetter/clamp';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { Text } from '~components/Typography/Text';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useId } from '~utils/useId';\nimport { useTheme } from '~components/BladeProvider';\nimport type { BaseBoxProps } from '~components/Box/BaseBox';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { size } from '~tokens/global';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\n\ntype ProgressBarCommonProps = {\n /**\n * Sets aria-label to help users know what the progress bar is for. Default value is the same as the `label` passed.\n */\n accessibilityLabel?: string;\n /**\n * Sets the color of the progress bar which changes the feedback color.\n */\n color?: FeedbackColors;\n /**\n * Sets the label to be rendered for the progress bar. This value will also be used as default for `accessibilityLabel`.\n */\n label?: string;\n /**\n * Sets the size of the progress bar.\n * @default 'small'\n */\n size?: 'small' | 'medium';\n /**\n * Sets the progress value of the progress bar.\n * @default 'small'\n */\n value?: number;\n /**\n * Sets the minimum value for the progress bar.\n * @default 0\n */\n min?: number;\n /**\n * Sets the maximum value for the progress bar.\n * @default 100\n */\n max?: number;\n} & TestID &\n StyledPropsBlade;\n\ntype ProgressBarVariant = 'progress' | 'meter';\n\ntype ProgressBarProgressProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for the progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'progress'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default true\n */\n showPercentage?: boolean;\n};\n\ntype ProgressBarMeterProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for thr progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'meter'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: undefined;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default false\n */\n showPercentage?: undefined;\n};\n\ntype ProgressBarProps = ProgressBarProgressProps | ProgressBarMeterProps;\n\nconst progressBarHeight: Record<NonNullable<ProgressBarCommonProps['size']>, 2 | 4> = {\n small: size[2],\n medium: size[4],\n};\n\nconst ProgressBar = ({\n accessibilityLabel,\n color,\n isIndeterminate = false,\n label,\n showPercentage = true,\n size = 'small',\n value = 0,\n variant = 'progress',\n min = 0,\n max = 100,\n testID,\n ...styledProps\n}: ProgressBarProps): ReactElement => {\n const { theme } = useTheme();\n const id = useId(variant);\n\n if (__DEV__) {\n if (variant === 'meter' && isIndeterminate) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Cannot set 'isIndeterminate' when 'variant' is 'meter'.`,\n });\n }\n }\n\n const unfilledBackgroundColor = theme.colors.feedback.background.neutral\n .subtle as BaseBoxProps['backgroundColor'];\n const filledBackgroundColor = color\n ? theme.colors.feedback.background[color].intense\n : theme.colors.surface.background.primary.intense;\n const hasLabel = label && label.trim()?.length > 0;\n const isMeter = variant === 'meter';\n const progressValue = clamp(value, min, max);\n const percentageProgressValue = Math.floor(((progressValue - min) * 100) / (max - min));\n const shouldShowPercentage = showPercentage && !isMeter && !isIndeterminate;\n const accessibilityProps: Pick<\n AccessibilityProps,\n 'role' | 'label' | 'valueMax' | 'valueNow' | 'valueMin' | 'valueText'\n > = {\n role: 'progressbar',\n label: accessibilityLabel ?? label,\n valueNow: percentageProgressValue,\n valueText: `${percentageProgressValue}%`,\n valueMin: min,\n valueMax: max,\n };\n\n if (isMeter) {\n accessibilityProps.role = 'meter';\n accessibilityProps.valueNow = progressValue;\n accessibilityProps.valueText = `${progressValue}`;\n }\n\n if (isIndeterminate) {\n accessibilityProps.valueNow = undefined;\n accessibilityProps.valueMin = undefined;\n accessibilityProps.valueMax = undefined;\n accessibilityProps.valueText = undefined;\n }\n\n return (\n <BaseBox\n {...getStyledProps(styledProps)}\n {...metaAttribute({ name: MetaConstants.ProgressBar, testID })}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\" width=\"100%\">\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent={hasLabel ? 'space-between' : 'flex-end'}\n >\n {hasLabel ? (\n <Text as=\"label\" variant=\"body\" size=\"small\" color=\"surface.text.gray.subtle\">\n {label}\n </Text>\n ) : null}\n {shouldShowPercentage ? (\n <BaseBox marginBottom=\"spacing.2\">\n <Text\n variant=\"body\"\n size=\"small\"\n color=\"surface.text.gray.subtle\"\n >{`${percentageProgressValue}%`}</Text>\n </BaseBox>\n ) : null}\n </BaseBox>\n <BaseBox\n id={id}\n {...makeAccessible({\n role: accessibilityProps.role,\n label: accessibilityProps.label,\n valueNow: accessibilityProps.valueNow,\n valueText: accessibilityProps.valueText,\n valueMin: accessibilityProps.valueMin,\n valueMax: accessibilityProps.valueMax,\n })}\n >\n <BaseBox\n backgroundColor={unfilledBackgroundColor}\n height={makeSize(progressBarHeight[size])}\n overflow=\"hidden\"\n position=\"relative\"\n >\n <ProgressBarFilled\n backgroundColor={filledBackgroundColor}\n progress={percentageProgressValue}\n fillMotionDuration=\"duration.2xgentle\"\n pulseMotionDuration=\"duration.2xgentle\"\n indeterminateMotionDuration=\"duration.2xgentle\"\n pulseMotionDelay=\"delay.long\"\n motionEasing=\"easing.standard.revealing\"\n variant={variant}\n isIndeterminate={isIndeterminate}\n />\n </BaseBox>\n </BaseBox>\n </BaseBox>\n </BaseBox>\n );\n};\n\nexport type { ProgressBarProps, ProgressBarVariant };\nexport { ProgressBar };\n"],"names":["progressBarHeight","small","size","medium","ProgressBar","_ref","_label$trim","accessibilityLabel","color","_ref$isIndeterminate","isIndeterminate","label","_ref$showPercentage","showPercentage","_ref$size","_ref$value","value","_ref$variant","variant","_ref$min","min","_ref$max","max","testID","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","id","useId","throwBladeError","moduleName","message","unfilledBackgroundColor","colors","feedback","background","neutral","subtle","filledBackgroundColor","intense","surface","primary","hasLabel","trim","length","isMeter","progressValue","clamp","percentageProgressValue","Math","floor","shouldShowPercentage","accessibilityProps","role","valueNow","valueText","concat","valueMin","valueMax","undefined","_jsx","BaseBox","_objectSpread","getStyledProps","metaAttribute","name","MetaConstants","children","_jsxs","display","flexDirection","width","justifyContent","Text","as","marginBottom","makeAccessible","backgroundColor","height","makeSize","overflow","position","ProgressBarFilled","progress","fillMotionDuration","pulseMotionDuration","indeterminateMotionDuration","pulseMotionDelay","motionEasing"],"mappings":";;;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AACG,SAAS;QACvCE,QAAQ,EAAEL,kBAAkB,CAACK,QAAQ;QACrCC,QAAQ,EAAEN,kBAAkB,CAACM,QAAAA;AAC/B,OAAC,CAAC,CAAA,EAAA,EAAA,EAAA;QAAAS,QAAA,eAEFP,GAAA,CAACC,OAAO,EAAA;AACNgB,UAAAA,eAAe,EAAE7C,uBAAwB;AACzC8C,UAAAA,MAAM,EAAEC,QAAQ,CAAClF,iBAAiB,CAACE,IAAI,CAAC,CAAE;AAC1CiF,UAAAA,QAAQ,EAAC,QAAQ;AACjBC,UAAAA,QAAQ,EAAC,UAAU;UAAAd,QAAA,eAEnBP,GAAA,CAACsB,iBAAiB,EAAA;AAChBL,YAAAA,eAAe,EAAEvC,qBAAsB;AACvC6C,YAAAA,QAAQ,EAAEnC,uBAAwB;AAClCoC,YAAAA,kBAAkB,EAAC,mBAAmB;AACtCC,YAAAA,mBAAmB,EAAC,mBAAmB;AACvCC,YAAAA,2BAA2B,EAAC,mBAAmB;AAC/CC,YAAAA,gBAAgB,EAAC,YAAY;AAC7BC,YAAAA,YAAY,EAAC,2BAA2B;AACxCzE,YAAAA,OAAO,EAAEA,OAAQ;AACjBR,YAAAA,eAAe,EAAEA,eAAAA;WAClB,CAAA;SACM,CAAA;AAAC,OAAA,CACH,CAAC,CAAA;KACH,CAAA;AAAC,GAAA,CACH,CAAC,CAAA;AAEd;;;;"}
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sources":["../../../../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { ProgressBarFilled } from './ProgressBarFilled';\nimport { CircularProgressBarFilled } from './CircularProgressBar';\nimport clamp from '~utils/lodashButBetter/clamp';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { Text } from '~components/Typography/Text';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useId } from '~utils/useId';\nimport { useTheme } from '~components/BladeProvider';\nimport type { BaseBoxProps } from '~components/Box/BaseBox';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { size } from '~tokens/global';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\n\ntype ProgressBarCommonProps = {\n /**\n * Sets aria-label to help users know what the progress bar is for. Default value is the same as the `label` passed.\n */\n accessibilityLabel?: string;\n /**\n * Sets the color of the progress bar which changes the feedback color.\n */\n color?: FeedbackColors;\n /**\n * Sets the type of the progress bar.\n * @default 'progress'\n */\n type?: 'meter' | 'progress';\n /**\n * Sets the label to be rendered for the progress bar. This value will also be used as default for `accessibilityLabel`.\n */\n label?: string;\n /**\n * Sets the size of the progress bar.\n * Note: 'large' size isn't available when the variant is 'linear'.\n * @default 'small'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Sets the progress value of the progress bar.\n * @default 'small'\n */\n value?: number;\n /**\n * Sets the minimum value for the progress bar.\n * @default 0\n */\n min?: number;\n /**\n * Sets the maximum value for the progress bar.\n * @default 100\n */\n max?: number;\n} & TestID &\n StyledPropsBlade;\n\ntype ProgressBarVariant = 'progress' | 'meter' | 'linear' | 'circular';\n\ntype ProgressBarProgressProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for the progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'progress' | 'linear' | 'circular'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default true\n */\n showPercentage?: boolean;\n};\n\ntype ProgressBarMeterProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for thr progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'meter' | 'linear' | 'circular'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: undefined;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default false\n */\n showPercentage?: undefined;\n};\n\ntype ProgressBarProps = ProgressBarProgressProps | ProgressBarMeterProps;\n\nconst progressBarHeight: Record<NonNullable<ProgressBarProps['size']>, 2 | 4 | 0> = {\n small: size[2],\n medium: size[4],\n // Large size isn't available when variant is 'linear'\n large: size[0],\n};\n\nconst ProgressBar = ({\n accessibilityLabel,\n color,\n type,\n isIndeterminate = false,\n label,\n showPercentage = true,\n size = 'small',\n value = 0,\n variant = 'progress',\n min = 0,\n max = 100,\n testID,\n ...styledProps\n}: ProgressBarProps): ReactElement => {\n const { theme } = useTheme();\n const progressType = !type && (variant === 'meter' || variant === 'progress') ? variant : type;\n const progressVariant = variant === 'meter' || variant === 'progress' ? 'linear' : variant;\n const id = useId(`${progressType}-${progressVariant}`);\n\n if (__DEV__) {\n if (progressType === 'meter' && isIndeterminate) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Cannot set 'isIndeterminate' when 'type' or 'variant' is 'meter'.`,\n });\n }\n\n if (progressVariant === 'circular' && isIndeterminate) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Cannot set 'isIndeterminate' when 'variant' is 'circular'.`,\n });\n }\n\n if (progressVariant === 'linear' && size === 'large') {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Large size isn't available when 'variant' is 'linear'.`,\n });\n }\n\n if (type && (variant === 'progress' || variant === 'meter')) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `variant can only be 'linear' or 'circular' when 'type=${type}'.`,\n });\n }\n }\n\n const unfilledBackgroundColor = theme.colors.feedback.background.neutral\n .subtle as BaseBoxProps['backgroundColor'];\n const filledBackgroundColor = color\n ? theme.colors.feedback.background[color].intense\n : theme.colors.surface.background.primary.intense;\n const hasLabel = label && label.trim()?.length > 0;\n const isMeter = progressType === 'meter';\n const isCircular = progressVariant === 'circular';\n const progressValue = clamp(value, min, max);\n const percentageProgressValue = Math.floor(((progressValue - min) * 100) / (max - min));\n const shouldShowPercentage = showPercentage && !isMeter && !isIndeterminate;\n const accessibilityProps: Pick<\n AccessibilityProps,\n 'role' | 'label' | 'valueMax' | 'valueNow' | 'valueMin' | 'valueText'\n > = {\n role: 'progressbar',\n label: accessibilityLabel ?? label,\n valueNow: percentageProgressValue,\n valueText: `${percentageProgressValue}%`,\n valueMin: min,\n valueMax: max,\n };\n\n if (isMeter) {\n accessibilityProps.role = 'meter';\n accessibilityProps.valueNow = progressValue;\n accessibilityProps.valueText = `${progressValue}`;\n }\n\n if (isIndeterminate) {\n accessibilityProps.valueNow = undefined;\n accessibilityProps.valueMin = undefined;\n accessibilityProps.valueMax = undefined;\n accessibilityProps.valueText = undefined;\n }\n\n return (\n <BaseBox\n {...getStyledProps(styledProps)}\n {...metaAttribute({ name: MetaConstants.ProgressBar, testID })}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\" width=\"100%\">\n {!isCircular ? (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent={hasLabel ? 'space-between' : 'flex-end'}\n >\n {hasLabel ? (\n <Text as=\"label\" variant=\"body\" size=\"small\" color=\"surface.text.gray.subtle\">\n {label}\n </Text>\n ) : null}\n {shouldShowPercentage ? (\n <BaseBox marginBottom=\"spacing.2\">\n <Text\n variant=\"body\"\n size=\"small\"\n color=\"surface.text.gray.subtle\"\n >{`${percentageProgressValue}%`}</Text>\n </BaseBox>\n ) : null}\n </BaseBox>\n ) : null}\n\n <BaseBox\n id={id}\n {...makeAccessible({\n role: accessibilityProps.role,\n label: accessibilityProps.label,\n valueNow: accessibilityProps.valueNow,\n valueText: accessibilityProps.valueText,\n valueMin: accessibilityProps.valueMin,\n valueMax: accessibilityProps.valueMax,\n })}\n >\n {isCircular ? (\n <CircularProgressBarFilled\n size={size}\n label={label}\n progressPercent={percentageProgressValue}\n isMeter={isMeter}\n showPercentage={shouldShowPercentage}\n backgroundColor={unfilledBackgroundColor as string}\n fillColor={filledBackgroundColor}\n pulseMotionDuration=\"duration.2xgentle\"\n fillMotionDuration=\"duration.2xgentle\"\n pulseMotionDelay=\"delay.long\"\n motionEasing=\"easing.standard.revealing\"\n />\n ) : (\n <BaseBox\n backgroundColor={unfilledBackgroundColor}\n height={makeSize(progressBarHeight[size])}\n overflow=\"hidden\"\n position=\"relative\"\n >\n <ProgressBarFilled\n backgroundColor={filledBackgroundColor}\n progress={percentageProgressValue}\n fillMotionDuration=\"duration.2xgentle\"\n pulseMotionDuration=\"duration.2xgentle\"\n indeterminateMotionDuration=\"duration.2xgentle\"\n pulseMotionDelay=\"delay.long\"\n motionEasing=\"easing.standard.revealing\"\n type={progressType}\n isIndeterminate={isIndeterminate}\n />\n </BaseBox>\n )}\n </BaseBox>\n </BaseBox>\n </BaseBox>\n );\n};\n\nexport type { ProgressBarProps, ProgressBarVariant };\nexport { ProgressBar };\n"],"names":["progressBarHeight","small","size","medium","large","ProgressBar","_ref","_label$trim","accessibilityLabel","color","type","_ref$isIndeterminate","isIndeterminate","label","_ref$showPercentage","showPercentage","_ref$size","_ref$value","value","_ref$variant","variant","_ref$min","min","_ref$max","max","testID","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","progressType","progressVariant","id","useId","concat","throwBladeError","moduleName","message","unfilledBackgroundColor","colors","feedback","background","neutral","subtle","filledBackgroundColor","intense","surface","primary","hasLabel","trim","length","isMeter","isCircular","progressValue","clamp","percentageProgressValue","Math","floor","shouldShowPercentage","accessibilityProps","role","valueNow","valueText","valueMin","valueMax","undefined","_jsx","BaseBox","_objectSpread","getStyledProps","metaAttribute","name","MetaConstants","children","_jsxs","display","flexDirection","width","justifyContent","Text","as","marginBottom","makeAccessible","CircularProgressBarFilled","progressPercent","backgroundColor","fillColor","pulseMotionDuration","fillMotionDuration","pulseMotionDelay","motionEasing","height","makeSize","overflow","position","ProgressBarFilled","progress","indeterminateMot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AAA,CACH,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -46,11 +46,11 @@ var IndeterminatePulseAnimation = /*#__PURE__*/styled(BoxWithIndeterminateAnimat
|
|
|
46
46
|
pulseMotionDuration = _ref4.pulseMotionDuration,
|
|
47
47
|
pulseMotionDelay = _ref4.pulseMotionDelay,
|
|
48
48
|
motionEasing = _ref4.motionEasing,
|
|
49
|
-
|
|
49
|
+
type = _ref4.type;
|
|
50
50
|
var duration = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDuration)));
|
|
51
51
|
var easing = castWebType(getIn(theme.motion, motionEasing));
|
|
52
52
|
var delay = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDelay)));
|
|
53
|
-
return
|
|
53
|
+
return type === 'progress' ? getPulseAnimationStyles({
|
|
54
54
|
duration: duration,
|
|
55
55
|
easing: easing,
|
|
56
56
|
delay: delay
|
|
@@ -89,11 +89,11 @@ var DeterminatePulseAnimation = /*#__PURE__*/styled(BoxWithProgressFillTransitio
|
|
|
89
89
|
pulseMotionDuration = _ref7.pulseMotionDuration,
|
|
90
90
|
pulseMotionDelay = _ref7.pulseMotionDelay,
|
|
91
91
|
motionEasing = _ref7.motionEasing,
|
|
92
|
-
|
|
92
|
+
type = _ref7.type;
|
|
93
93
|
var duration = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDuration)));
|
|
94
94
|
var easing = castWebType(getIn(theme.motion, motionEasing));
|
|
95
95
|
var delay = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDelay)));
|
|
96
|
-
return
|
|
96
|
+
return type === 'progress' ? getPulseAnimationStyles({
|
|
97
97
|
duration: duration,
|
|
98
98
|
easing: easing,
|
|
99
99
|
delay: delay
|
|
@@ -107,7 +107,7 @@ var ProgressBarFilled = function ProgressBarFilled(_ref8) {
|
|
|
107
107
|
pulseMotionDelay = _ref8.pulseMotionDelay,
|
|
108
108
|
pulseMotionDuration = _ref8.pulseMotionDuration,
|
|
109
109
|
indeterminateMotionDuration = _ref8.indeterminateMotionDuration,
|
|
110
|
-
|
|
110
|
+
type = _ref8.type,
|
|
111
111
|
isIndeterminate = _ref8.isIndeterminate;
|
|
112
112
|
var ProgressBarFilledContainer = isIndeterminate ? IndeterminateFilledContainer : DeterminateFilledContainer;
|
|
113
113
|
var ProgressBarPulseAnimation = isIndeterminate ? IndeterminatePulseAnimation : DeterminatePulseAnimation;
|
|
@@ -119,7 +119,7 @@ var ProgressBarFilled = function ProgressBarFilled(_ref8) {
|
|
|
119
119
|
children: /*#__PURE__*/jsx(ProgressBarPulseAnimation, {
|
|
120
120
|
fillMotionDuration: fillMotionDuration,
|
|
121
121
|
motionEasing: motionEasing,
|
|
122
|
-
|
|
122
|
+
type: type,
|
|
123
123
|
pulseMotionDelay: pulseMotionDelay,
|
|
124
124
|
pulseMotionDuration: pulseMotionDuration
|
|
125
125
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBarFilled.web.js","sources":["../../../../../../src/components/ProgressBar/ProgressBarFilled.web.tsx"],"sourcesContent":["import type { FlattenSimpleInterpolation } from 'styled-components';\nimport styled, { css, keyframes } from 'styled-components';\nimport React from 'react';\nimport type { ProgressBarFilledProps } from './types';\nimport { indeterminateAnimation, pulseAnimation } from './progressBarTokens';\nimport getIn from '~utils/lodashButBetter/get';\nimport BaseBox from '~components/Box/BaseBox';\nimport { castWebType } from '~utils';\nimport { makeMotionTime } from '~utils/makeMotionTime';\n\nconst pulseKeyframes = keyframes`\n 0% {\n opacity: ${pulseAnimation.opacityInitial};\n }\n 50% {\n opacity: ${pulseAnimation.opacityMid};\n }\n 100% {\n opacity: ${pulseAnimation.opacityFinal};\n }\n`;\n\nconst slideAndScaleKeyframes = keyframes`\n 0% {\n left: ${indeterminateAnimation.leftInitial};\n transform: scaleX(${indeterminateAnimation.scaleXInitial});\n }\n 50% {\n left: ${indeterminateAnimation.leftMid};\n transform: scaleX(${indeterminateAnimation.scaleXMid});\n }\n 100% {\n left: ${indeterminateAnimation.leftFinal};\n transform: scaleX(${indeterminateAnimation.scaleXFinal});\n }\n`;\n\nconst getPulseAnimationStyles = ({\n duration,\n easing,\n delay,\n}: {\n duration: string;\n easing: string;\n delay: string;\n}): FlattenSimpleInterpolation => css`\n height: 100%;\n width: 100%;\n opacity: ${pulseAnimation.opacityInitial};\n background-color: ${pulseAnimation.backgroundColor};\n animation: ${pulseKeyframes} ${duration} ${easing} infinite;\n animation-delay: ${delay};\n`;\n\nconst BoxWithIndeterminateAnimation = styled(BaseBox)<\n Pick<ProgressBarFilledProps, 'fillMotionDuration' | 'indeterminateMotionDuration'>\n>(({ theme, indeterminateMotionDuration }) => {\n const duration = castWebType(makeMotionTime(getIn(theme.motion, indeterminateMotionDuration)));\n const easing = 'linear'; // TODO: Add this in motion tokens\n\n return css`\n animation: ${slideAndScaleKeyframes} ${duration} ${easing} infinite;\n position: absolute;\n width: ${indeterminateAnimation.fillWidth};\n height: 100%;\n `;\n});\n\nconst IndeterminateFilledContainer = styled(BoxWithIndeterminateAnimation)<\n Pick<ProgressBarFilledProps, 'backgroundColor' | 'progress'>\n>(({ backgroundColor }) => ({\n backgroundColor,\n}));\n\nconst IndeterminatePulseAnimation = styled(BoxWithIndeterminateAnimation)<\n Pick<\n ProgressBarFilledProps,\n 'pulseMotionDuration' | 'pulseMotionDelay' | 'motionEasing' | 'variant'\n >\n>(({ theme, pulseMotionDuration, pulseMotionDelay, motionEasing, variant }) => {\n const duration = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDuration)));\n const easing = castWebType(getIn(theme.motion, motionEasing));\n const delay = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDelay)));\n\n return variant === 'progress' ? getPulseAnimationStyles({ duration, easing, delay }) : '';\n});\n\nconst BoxWithProgressFillTransition = styled(BaseBox)<\n Pick<ProgressBarFilledProps, 'fillMotionDuration' | 'motionEasing'>\n>(({ theme, fillMotionDuration, motionEasing }) => ({\n transitionProperty: 'width',\n transitionDuration: castWebType(makeMotionTime(getIn(theme.motion, fillMotionDuration))),\n transitionTimingFunction: castWebType(getIn(theme.motion, motionEasing)),\n}));\n\nconst DeterminateFilledContainer = styled(BoxWithProgressFillTransition)<\n Pick<ProgressBarFilledProps, 'backgroundColor' | 'progress' | 'indeterminateMotionDuration'>\n>(({ backgroundColor, progress }) => ({\n backgroundColor,\n height: '100%',\n width: `${progress}%`,\n}));\n\nconst DeterminatePulseAnimation = styled(BoxWithProgressFillTransition)<\n Pick<\n ProgressBarFilledProps,\n 'pulseMotionDuration' | 'pulseMotionDelay' | 'motionEasing' | 'variant'\n >\n>(({ theme, pulseMotionDuration, pulseMotionDelay, motionEasing, variant }) => {\n const duration = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDuration)));\n const easing = castWebType(getIn(theme.motion, motionEasing));\n const delay = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDelay)));\n\n return variant === 'progress' ? getPulseAnimationStyles({ duration, easing, delay }) : '';\n});\n\nconst ProgressBarFilled = ({\n backgroundColor,\n fillMotionDuration,\n motionEasing,\n progress,\n pulseMotionDelay,\n pulseMotionDuration,\n indeterminateMotionDuration,\n variant,\n isIndeterminate,\n}: ProgressBarFilledProps): React.ReactElement => {\n const ProgressBarFilledContainer = isIndeterminate\n ? IndeterminateFilledContainer\n : DeterminateFilledContainer;\n const ProgressBarPulseAnimation = isIndeterminate\n ? IndeterminatePulseAnimation\n : DeterminatePulseAnimation;\n\n return (\n <ProgressBarFilledContainer\n backgroundColor={backgroundColor}\n fillMotionDuration={fillMotionDuration}\n progress={progress}\n indeterminateMotionDuration={indeterminateMotionDuration}\n >\n <ProgressBarPulseAnimation\n fillMotionDuration={fillMotionDuration}\n motionEasing={motionEasing}\n variant={variant}\n pulseMotionDelay={pulseMotionDelay}\n pulseMotionDuration={pulseMotionDuration}\n />\n </ProgressBarFilledContainer>\n );\n};\n\nexport { ProgressBarFilled };\n"],"names":["pulseKeyframes","keyframes","pulseAnimation","opacityInitial","opacityMid","opacityFinal","slideAndScaleKeyframes","indeterminateAnimation","leftInitial","scaleXInitial","leftMid","scaleXMid","leftFinal","scaleXFinal","getPulseAnimationStyles","_ref","duration","easing","delay","css","backgroundColor","BoxWithIndeterminateAnimation","styled","BaseBox","withConfig","displayName","componentId","_ref2","theme","indeterminateMotionDuration","castWebType","makeMotionTime","getIn","motion","fillWidth","IndeterminateFilledContainer","_ref3","IndeterminatePulseAnimation","_ref4","pulseMotionDuration","pulseMotionDelay","motionEasing","variant","BoxWithProgressFillTransition","_ref5","fillMotionDuration","transitionProperty","transitionDuration","transitionTimingFunction","DeterminateFilledContainer","_ref6","progress","height","width","concat","DeterminatePulseAnimation","_ref7","ProgressBarFilled","_ref8","isIndeterminate","ProgressBarFilledContainer","ProgressBarPulseAnimation","_jsx","children"],"mappings":";;;;;;;;;;;;AAUA,IAAMA,cAAc,gBAAGC,SAAS,CAAA,CAAA,aAAA,EAAA,gBAAA,EAAA,iBAAA,EAAA,IAAA,CAAA,EAEjBC,cAAc,CAACC,cAAc,EAG7BD,cAAc,CAACE,UAAU,EAGzBF,cAAc,CAACG,YAAY,CAEzC,CAAA;AAED,IAAMC,sBAAsB,gBAAGL,SAAS,CAE5BM,CAAAA,UAAAA,EAAAA,oBAAAA,EAAAA,cAAAA,EAAAA,oBAAAA,EAAAA,eAAAA,EAAAA,oBAAAA,EAAAA,KAAAA,CAAAA,EAAAA,sBAAsB,CAACC,WAAW,EACtBD,sBAAsB,CAACE,aAAa,EAGhDF,sBAAsB,CAACG,OAAO,EAClBH,sBAAsB,CAACI,SAAS,EAG5CJ,sBAAsB,CAACK,SAAS,EACnBL,sBAAsB,CAACM,WAAW,CAE1D,CAAA;AAED,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAC3BC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,KAAK,GAAAH,IAAA,CAALG,KAAK,CAAA;AAAA,EAAA,O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yBAAyB,GAAGF,eAAe,GAC7CtB,2BAA2B,GAC3BkB,yBAAyB,CAAA;EAE7B,oBACEO,GAAA,CAACF,0BAA0B,EAAA;AACzBxC,IAAAA,eAAe,EAAEA,eAAgB;AACjCyB,IAAAA,kBAAkB,EAAEA,kBAAmB;AACvCM,IAAAA,QAAQ,EAAEA,QAAS;AACnBtB,IAAAA,2BAA2B,EAAEA,2BAA4B;IAAAkC,QAAA,eAEzDD,GAAA,CAACD,yBAAyB,EAAA;AACxBhB,MAAAA,kBAAkB,EAAEA,kBAAmB;AACvCJ,MAAAA,YAAY,EAAEA,YAAa;AAC3BC,MAAAA,OAAO,EAAEA,OAAQ;AACjBF,MAAAA,gBAAgB,EAAEA,gBAAiB;AACnCD,MAAAA,mBAAmB,EAAEA,mBAAAA;KACtB,CAAA;AAAC,GACwB,CAAC,CAAA;AAEjC;;;;"}
|
|
1
|
+
{"version":3,"file":"ProgressBarFilled.web.js","sources":["../../../../../../src/components/ProgressBar/ProgressBarFilled.web.tsx"],"sourcesContent":["import type { FlattenSimpleInterpolation } from 'styled-components';\nimport styled, { css, keyframes } from 'styled-components';\nimport React from 'react';\nimport type { ProgressBarFilledProps } from './types';\nimport { indeterminateAnimation, pulseAnimation } from './progressBarTokens';\nimport getIn from '~utils/lodashButBetter/get';\nimport BaseBox from '~components/Box/BaseBox';\nimport { castWebType } from '~utils';\nimport { makeMotionTime } from '~utils/makeMotionTime';\n\nconst pulseKeyframes = keyframes`\n 0% {\n opacity: ${pulseAnimation.opacityInitial};\n }\n 50% {\n opacity: ${pulseAnimation.opacityMid};\n }\n 100% {\n opacity: ${pulseAnimation.opacityFinal};\n }\n`;\n\nconst slideAndScaleKeyframes = keyframes`\n 0% {\n left: ${indeterminateAnimation.leftInitial};\n transform: scaleX(${indeterminateAnimation.scaleXInitial});\n }\n 50% {\n left: ${indeterminateAnimation.leftMid};\n transform: scaleX(${indeterminateAnimation.scaleXMid});\n }\n 100% {\n left: ${indeterminateAnimation.leftFinal};\n transform: scaleX(${indeterminateAnimation.scaleXFinal});\n }\n`;\n\nconst getPulseAnimationStyles = ({\n duration,\n easing,\n delay,\n}: {\n duration: string;\n easing: string;\n delay: string;\n}): FlattenSimpleInterpolation => css`\n height: 100%;\n width: 100%;\n opacity: ${pulseAnimation.opacityInitial};\n background-color: ${pulseAnimation.backgroundColor};\n animation: ${pulseKeyframes} ${duration} ${easing} infinite;\n animation-delay: ${delay};\n`;\n\nconst BoxWithIndeterminateAnimation = styled(BaseBox)<\n Pick<ProgressBarFilledProps, 'fillMotionDuration' | 'indeterminateMotionDuration'>\n>(({ theme, indeterminateMotionDuration }) => {\n const duration = castWebType(makeMotionTime(getIn(theme.motion, indeterminateMotionDuration)));\n const easing = 'linear'; // TODO: Add this in motion tokens\n\n return css`\n animation: ${slideAndScaleKeyframes} ${duration} ${easing} infinite;\n position: absolute;\n width: ${indeterminateAnimation.fillWidth};\n height: 100%;\n `;\n});\n\nconst IndeterminateFilledContainer = styled(BoxWithIndeterminateAnimation)<\n Pick<ProgressBarFilledProps, 'backgroundColor' | 'progress'>\n>(({ backgroundColor }) => ({\n backgroundColor,\n}));\n\nconst IndeterminatePulseAnimation = styled(BoxWithIndeterminateAnimation)<\n Pick<ProgressBarFilledProps, 'pulseMotionDuration' | 'pulseMotionDelay' | 'motionEasing' | 'type'>\n>(({ theme, pulseMotionDuration, pulseMotionDelay, motionEasing, type }) => {\n const duration = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDuration)));\n const easing = castWebType(getIn(theme.motion, motionEasing));\n const delay = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDelay)));\n\n return type === 'progress' ? getPulseAnimationStyles({ duration, easing, delay }) : '';\n});\n\nconst BoxWithProgressFillTransition = styled(BaseBox)<\n Pick<ProgressBarFilledProps, 'fillMotionDuration' | 'motionEasing'>\n>(({ theme, fillMotionDuration, motionEasing }) => ({\n transitionProperty: 'width',\n transitionDuration: castWebType(makeMotionTime(getIn(theme.motion, fillMotionDuration))),\n transitionTimingFunction: castWebType(getIn(theme.motion, motionEasing)),\n}));\n\nconst DeterminateFilledContainer = styled(BoxWithProgressFillTransition)<\n Pick<ProgressBarFilledProps, 'backgroundColor' | 'progress' | 'indeterminateMotionDuration'>\n>(({ backgroundColor, progress }) => ({\n backgroundColor,\n height: '100%',\n width: `${progress}%`,\n}));\n\nconst DeterminatePulseAnimation = styled(BoxWithProgressFillTransition)<\n Pick<ProgressBarFilledProps, 'pulseMotionDuration' | 'pulseMotionDelay' | 'motionEasing' | 'type'>\n>(({ theme, pulseMotionDuration, pulseMotionDelay, motionEasing, type }) => {\n const duration = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDuration)));\n const easing = castWebType(getIn(theme.motion, motionEasing));\n const delay = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDelay)));\n\n return type === 'progress' ? getPulseAnimationStyles({ duration, easing, delay }) : '';\n});\n\nconst ProgressBarFilled = ({\n backgroundColor,\n fillMotionDuration,\n motionEasing,\n progress,\n pulseMotionDelay,\n pulseMotionDuration,\n indeterminateMotionDuration,\n type,\n isIndeterminate,\n}: ProgressBarFilledProps): React.ReactElement => {\n const ProgressBarFilledContainer = isIndeterminate\n ? IndeterminateFilledContainer\n : DeterminateFilledContainer;\n const ProgressBarPulseAnimation = isIndeterminate\n ? IndeterminatePulseAnimation\n : DeterminatePulseAnimation;\n\n return (\n <ProgressBarFilledContainer\n backgroundColor={backgroundColor}\n fillMotionDuration={fillMotionDuration}\n progress={progress}\n indeterminateMotionDuration={indeterminateMotionDuration}\n >\n <ProgressBarPulseAnimation\n fillMotionDuration={fillMotionDuration}\n motionEasing={motionEasing}\n type={type}\n pulseMotionDelay={pulseMotionDelay}\n pulseMotionDuration={pulseMotionDuration}\n />\n </ProgressBarFilledContainer>\n );\n};\n\nexport { ProgressBarFilled };\n"],"names":["pulseKeyframes","keyframes","pulseAnimation","opacityInitial","opacityMid","opacityFinal","slideAndScaleKeyframes","indeterminateAnimation","leftInitial","scaleXInitial","leftMid","scaleXMid","leftFinal","scaleXFinal","getPulseAnimationStyles","_ref","duration","easing","delay","css","backgroundColor","BoxWithIndeterminateAnimation","styled","BaseBox","withConfig","displayName","componentId","_ref2","theme","indeterminateMotionDuration","castWebType","makeMotionTime","getIn","motion","fillWidth","IndeterminateFilledContainer","_ref3","IndeterminatePulseAnimation","_ref4","pulseMotionDuration","pulseMotionDelay","motionEasing","type","BoxWithProgressFillTransition","_ref5","fillMotionDuration","transitionProperty","transitionDuration","transitionTimingFunction","DeterminateFilledContainer","_ref6","progress","height","width","concat","DeterminatePulseAnimation","_ref7","ProgressBarFilled","_ref8","isIndeterminate","ProgressBarFilledContainer","ProgressBarPulseAnimation","_jsx","children"],"mappings":";;;;;;;;;;;;AAUA,IAAMA,cAAc,gBAAGC,SAAS,CAAA,CAAA,aAAA,EAAA,gBAAA,EAAA,iBAAA,EAAA,IAAA,CAAA,EAEjBC,cAAc,CAACC,cAAc,EAG7BD,cAAc,CAACE,UAAU,EAGzBF,cAAc,CAACG,YAAY,CAEzC,CAAA;AAED,IAAMC,sBAAsB,gBAAGL,SAAS,CAE5BM,CAAAA,UAAAA,EAAAA,oBAAAA,EAAAA,cAAAA,EAAAA,oBAAAA,EAAAA,eAAAA,EAAAA,oBAAAA,EAAAA,KAAAA,CAAAA,EAAAA,sBAAsB,CAACC,WAAW,EACtBD,sBAAsB,CAACE,aAAa,EAGhDF,sBAAsB,CAACG,OAAO,EAClBH,sBAAsB,CAACI,SAAS,EAG5CJ,sBAAsB,CAACK,SAAS,EACnBL,sBAAsB,CAACM,WAAW,CAE1D,CAAA;AAED,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAC3BC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,KAAK,GAAAH,IAAA,CAALG,KAAK,CAAA;AAAA,EAAA,OAK2BC,GAAG,CAGxBjB,CAAAA,iCAAAA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AC3BkB,yBAAyB,CAAA;EAE7B,oBACEO,GAAA,CAACF,0BAA0B,EAAA;AACzBxC,IAAAA,eAAe,EAAEA,eAAgB;AACjCyB,IAAAA,kBAAkB,EAAEA,kBAAmB;AACvCM,IAAAA,QAAQ,EAAEA,QAAS;AACnBtB,IAAAA,2BAA2B,EAAEA,2BAA4B;IAAAkC,QAAA,eAEzDD,GAAA,CAACD,yBAAyB,EAAA;AACxBhB,MAAAA,kBAAkB,EAAEA,kBAAmB;AACvCJ,MAAAA,YAAY,EAAEA,YAAa;AAC3BC,MAAAA,IAAI,EAAEA,IAAK;AACXF,MAAAA,gBAAgB,EAAEA,gBAAiB;AACnCD,MAAAA,mBAAmB,EAAEA,mBAAAA;KACtB,CAAA;AAAC,GACwB,CAAC,CAAA;AAEjC;;;;"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import '../../tokens/global/index.js';
|
|
2
|
+
import { size } from '../../tokens/global/size.js';
|
|
3
|
+
|
|
1
4
|
var indeterminateAnimation = {
|
|
2
5
|
scaleXInitial: 1,
|
|
3
6
|
scaleXMid: 5,
|
|
@@ -13,6 +16,47 @@ var pulseAnimation = {
|
|
|
13
16
|
opacityFinal: 0,
|
|
14
17
|
backgroundColor: 'white'
|
|
15
18
|
};
|
|
19
|
+
var circularProgressSizeTokens = {
|
|
20
|
+
small: {
|
|
21
|
+
size: size[24],
|
|
22
|
+
strokeWidth: size[3],
|
|
23
|
+
percentTextSize: 'small'
|
|
24
|
+
},
|
|
25
|
+
medium: {
|
|
26
|
+
size: size[48],
|
|
27
|
+
strokeWidth: size[5],
|
|
28
|
+
percentTextSize: 'small'
|
|
29
|
+
},
|
|
30
|
+
large: {
|
|
31
|
+
size: size[72],
|
|
32
|
+
strokeWidth: size[7],
|
|
33
|
+
percentTextSize: 'medium'
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var getCircularProgressSVGTokens = function getCircularProgressSVGTokens(_ref) {
|
|
37
|
+
var size = _ref.size,
|
|
38
|
+
progressPercent = _ref.progressPercent;
|
|
39
|
+
// Size of the enclosing square
|
|
40
|
+
var sqSize = circularProgressSizeTokens[size].size;
|
|
41
|
+
var strokeWidth = circularProgressSizeTokens[size].strokeWidth;
|
|
42
|
+
|
|
43
|
+
// SVG centers the stroke width on the radius, subtract out so circle fits in square
|
|
44
|
+
var radius = (sqSize - strokeWidth) / 2;
|
|
45
|
+
// Enclose circle in a circumscribing square
|
|
46
|
+
var viewBox = "0 0 ".concat(sqSize, " ").concat(sqSize);
|
|
47
|
+
// Arc length at 100% coverage is the circle circumference
|
|
48
|
+
var dashArray = radius * Math.PI * 2;
|
|
49
|
+
// Scale 100% coverage overlay with the actual percent
|
|
50
|
+
var dashOffset = dashArray - dashArray * progressPercent / 100;
|
|
51
|
+
return {
|
|
52
|
+
sqSize: sqSize,
|
|
53
|
+
strokeWidth: strokeWidth,
|
|
54
|
+
radius: radius,
|
|
55
|
+
viewBox: viewBox,
|
|
56
|
+
dashArray: dashArray,
|
|
57
|
+
dashOffset: dashOffset
|
|
58
|
+
};
|
|
59
|
+
};
|
|
16
60
|
|
|
17
|
-
export { indeterminateAnimation, pulseAnimation };
|
|
61
|
+
export { circularProgressSizeTokens, getCircularProgressSVGTokens, indeterminateAnimation, pulseAnimation };
|
|
18
62
|
//# sourceMappingURL=progressBarTokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressBarTokens.js","sources":["../../../../../../src/components/ProgressBar/progressBarTokens.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"progressBarTokens.js","sources":["../../../../../../src/components/ProgressBar/progressBarTokens.ts"],"sourcesContent":["import type { CircularProgressBarFilledProps } from './types';\nimport { size } from '~tokens/global';\n\nconst indeterminateAnimation = {\n scaleXInitial: 1,\n scaleXMid: 5,\n scaleXFinal: 1,\n leftInitial: '-8%',\n leftMid: '50%',\n leftFinal: '103%',\n fillWidth: '5%',\n};\n\nconst pulseAnimation = {\n opacityInitial: 0,\n opacityMid: 0.25,\n opacityFinal: 0,\n backgroundColor: 'white',\n};\n\nconst circularProgressSizeTokens = {\n small: {\n size: size[24],\n strokeWidth: size[3],\n percentTextSize: 'small',\n },\n medium: {\n size: size[48],\n strokeWidth: size[5],\n percentTextSize: 'small',\n },\n large: {\n size: size[72],\n strokeWidth: size[7],\n percentTextSize: 'medium',\n },\n} as const;\n\nconst getCircularProgressSVGTokens = ({\n size,\n progressPercent,\n}: {\n size: NonNullable<CircularProgressBarFilledProps['size']>;\n progressPercent: number;\n}): {\n sqSize: number;\n strokeWidth: number;\n radius: number;\n viewBox: string;\n dashArray: number;\n dashOffset: number;\n} => {\n // Size of the enclosing square\n const sqSize = circularProgressSizeTokens[size].size;\n const strokeWidth = circularProgressSizeTokens[size].strokeWidth;\n\n // SVG centers the stroke width on the radius, subtract out so circle fits in square\n const radius = (sqSize - strokeWidth) / 2;\n // Enclose circle in a circumscribing square\n const viewBox = `0 0 ${sqSize} ${sqSize}`;\n // Arc length at 100% coverage is the circle circumference\n const dashArray = radius * Math.PI * 2;\n // Scale 100% coverage overlay with the actual percent\n const dashOffset = dashArray - (dashArray * progressPercent) / 100;\n\n return {\n sqSize,\n strokeWidth,\n radius,\n viewBox,\n dashArray,\n dashOffset,\n };\n};\n\nexport {\n indeterminateAnimation,\n pulseAnimation,\n circularProgressSizeTokens,\n getCircularProgressSVGTokens,\n};\n"],"names":["indeterminateAnimation","scaleXInitial","scaleXMid","scaleXFinal","leftInitial","leftMid","leftFinal","fillWidth","pulseAnimation","opacityInitial","opacityMid","opacityFinal","backgroundColor","circularProgressSizeTokens","small","size","strokeWidth","percentTextSize","medium","large","getCircularProgressSVGTokens","_ref","progressPercent","sqSize","radius","viewBox","concat","dashArray","Math","PI","dashOffset"],"mappings":";;;AAGA,IAAMA,sBAAsB,GAAG;AAC7BC,EAAAA,aAAa,EAAE,CAAC;AAChBC,EAAAA,SAAS,EAAE,CAAC;AACZC,EAAAA,WAAW,EAAE,CAAC;AACdC,EAAAA,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ACzC;EACA,IAAMS,OAAO,UAAAC,MAAA,CAAUH,MAAM,EAAAG,GAAAA,CAAAA,CAAAA,MAAA,CAAIH,MAAM,CAAE,CAAA;AACzC;EACA,IAAMI,SAAS,GAAGH,MAAM,GAAGI,IAAI,CAACC,EAAE,GAAG,CAAC,CAAA;AACtC;EACA,IAAMC,UAAU,GAAGH,SAAS,GAAIA,SAAS,GAAGL,eAAe,GAAI,GAAG,CAAA;EAElE,OAAO;AACLC,IAAAA,MAAM,EAANA,MAAM;AACNP,IAAAA,WAAW,EAAXA,WAAW;AACXQ,IAAAA,MAAM,EAANA,MAAM;AACNC,IAAAA,OAAO,EAAPA,OAAO;AACPE,IAAAA,SAAS,EAATA,SAAS;AACTG,IAAAA,UAAU,EAAVA,UAAAA;GACD,CAAA;AACH;;;;"}
|
|
@@ -7,18 +7,17 @@ import '../Box/BaseBox/index.js';
|
|
|
7
7
|
import '../BladeProvider/index.js';
|
|
8
8
|
import '../../utils/index.js';
|
|
9
9
|
import { jsx } from 'react/jsx-runtime';
|
|
10
|
-
import { makeSize } from '../../utils/makeSize/makeSize.js';
|
|
11
10
|
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
12
11
|
import useTheme from '../BladeProvider/useTheme.js';
|
|
13
12
|
import { makeMotionTime } from '../../utils/makeMotionTime/makeMotionTime.web.js';
|
|
14
13
|
|
|
15
|
-
var tagDissappearKeyframe = /*#__PURE__*/keyframes(["0%{opacity:", ";max-width:", "
|
|
14
|
+
var tagDissappearKeyframe = /*#__PURE__*/keyframes(["0%{opacity:", ";max-width:", "}100%{opacity:", ";max-width:", ";}"], TAG_OPACITY_START, TAG_MAX_WIDTH_START, TAG_OPACITY_END, TAG_MAX_WIDTH_END);
|
|
16
15
|
var tagShowKeyframe = /*#__PURE__*/keyframes(["0%{opacity:", ";}100%{opacity:", ";}"], TAG_OPACITY_END, TAG_OPACITY_START);
|
|
17
16
|
var AnimatedTagContainer = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
18
17
|
displayName: "AnimatedTagweb__AnimatedTagContainer",
|
|
19
18
|
componentId: "sc-1ypkpkt-0"
|
|
20
19
|
})(function (props) {
|
|
21
|
-
return css(["", ";display:inline-block;opacity:", ";max-width:", ";flex-shrink:0;"], props.transition, props.isVisible ? TAG_OPACITY_START : TAG_OPACITY_END,
|
|
20
|
+
return css(["", ";display:inline-block;opacity:", ";max-width:", ";flex-shrink:0;"], props.transition, props.isVisible ? TAG_OPACITY_START : TAG_OPACITY_END, props.isVisible ? TAG_MAX_WIDTH_START : TAG_MAX_WIDTH_END);
|
|
22
21
|
});
|
|
23
22
|
var AnimatedTag = function AnimatedTag(_ref) {
|
|
24
23
|
var children = _ref.children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedTag.web.js","sources":["../../../../../../src/components/Tag/AnimatedTag.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { FlattenSimpleInterpolation } from 'styled-components';\nimport styled, { css, keyframes } from 'styled-components';\nimport { Tag } from './Tag';\nimport type { AnimatedTagProps } from './types';\nimport {\n TAG_MAX_WIDTH_END,\n TAG_MAX_WIDTH_START,\n TAG_OPACITY_END,\n TAG_OPACITY_START,\n} from './tagAnimationConfig';\nimport BaseBox from '~components/Box/BaseBox';\nimport { useTheme } from '~components/BladeProvider';\nimport { makeMotionTime
|
|
1
|
+
{"version":3,"file":"AnimatedTag.web.js","sources":["../../../../../../src/components/Tag/AnimatedTag.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { FlattenSimpleInterpolation } from 'styled-components';\nimport styled, { css, keyframes } from 'styled-components';\nimport { Tag } from './Tag';\nimport type { AnimatedTagProps } from './types';\nimport {\n TAG_MAX_WIDTH_END,\n TAG_MAX_WIDTH_START,\n TAG_OPACITY_END,\n TAG_OPACITY_START,\n} from './tagAnimationConfig';\nimport BaseBox from '~components/Box/BaseBox';\nimport { useTheme } from '~components/BladeProvider';\nimport { makeMotionTime } from '~utils';\n\nconst tagDissappearKeyframe = keyframes`\n 0% {\n opacity: ${TAG_OPACITY_START};\n max-width: ${TAG_MAX_WIDTH_START}\n }\n\n 100% {\n opacity: ${TAG_OPACITY_END};\n max-width: ${TAG_MAX_WIDTH_END};\n }\n`;\n\nconst tagShowKeyframe = keyframes`\n 0% {\n opacity: ${TAG_OPACITY_END};\n }\n\n 100% {\n opacity: ${TAG_OPACITY_START};\n }\n`;\n\nconst AnimatedTagContainer = styled(BaseBox)<{\n transition: FlattenSimpleInterpolation;\n isVisible: boolean;\n}>(\n (props) => css`\n ${props.transition};\n display: inline-block;\n opacity: ${props.isVisible ? TAG_OPACITY_START : TAG_OPACITY_END};\n max-width: ${props.isVisible ? TAG_MAX_WIDTH_START : TAG_MAX_WIDTH_END};\n flex-shrink: 0;\n `,\n);\n\nconst AnimatedTag = ({\n children,\n currentTagIndex,\n isDisabled,\n activeTagIndex,\n onDismiss,\n size = 'medium',\n}: AnimatedTagProps): React.ReactElement => {\n const [isTagVisible, setIsTagVisible] = React.useState(true);\n const { theme } = useTheme();\n\n const hideTagTransition = css`\n animation: ${tagDissappearKeyframe} ${makeMotionTime(theme.motion.duration.xquick)}\n ${String(theme.motion.easing.exit.effective)};\n `;\n\n const showTagTransition = css`\n animation: ${tagShowKeyframe} ${makeMotionTime(theme.motion.duration.xquick)}\n ${String(theme.motion.easing.entrance.effective)};\n `;\n\n return (\n <AnimatedTagContainer\n isVisible={isTagVisible}\n onAnimationEnd={() => {\n if (!isTagVisible) {\n onDismiss({ tagIndex: currentTagIndex, tagName: children });\n }\n }}\n transition={isTagVisible ? showTagTransition : hideTagTransition}\n >\n <Tag\n _isVirtuallyFocused={currentTagIndex === activeTagIndex}\n _isTagInsideInput={true}\n onDismiss={() => {\n setIsTagVisible(false);\n }}\n marginRight=\"spacing.3\"\n marginY=\"spacing.2\"\n isDisabled={isDisabled}\n size={size}\n >\n {children}\n </Tag>\n </AnimatedTagContainer>\n );\n};\n\nexport { AnimatedTag };\n"],"names":["tagDissappearKeyframe","keyframes","TAG_OPACITY_START","TAG_MAX_WIDTH_START","TAG_OPACITY_END","TAG_MAX_WIDTH_END","tagShowKeyframe","AnimatedTagContainer","styled","BaseBox","withConfig","displayName","componentId","props","css","transition","isVisible","AnimatedTag","_ref","children","currentTagIndex","isDisabled","activeTagIndex","onDismiss","_ref$size","size","_React$useState","React","useState","_React$useState2","_slicedToArray","isTagVisible","setIsTagVisible","_useTheme","useTheme","theme","hideTagTransition","makeMotionTime","motion","duration","xquick","String","easing","exit","effective","showTagTransition","entrance","_jsx","onAnimationEnd","tagIndex","tagName","Tag","_isVirtuallyFocused","_isTagInsideInput","marginRight","marginY"],"mappings":";;;;;;;;;;;;;AAeA,IAAMA,qBAAqB,gBAAGC,SAAS,CAExBC,CAAAA,aAAAA,EAAAA,aAAAA,EAAAA,gBAAAA,EAAAA,aAAAA,EAAAA,IAAAA,CAAAA,EAAAA,iBAAiB,EACfC,mBAAmB,EAIrBC,eAAe,EACbC,iBAAiB,CAEjC,CAAA;AAED,IAAMC,eAAe,gBAAGL,SAAS,2CAElBG,eAAe,EAIfF,iBAAiB,CAE/B,CAAA;AAED,IAAMK,oBAAoB,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,sCAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAAA,CAAA,CAI1C,UAACC,KAAK,EAAA;EAAA,OAAKC,GAAG,2EACVD,KAAK,CAACE,UAAU,EAEPF,KAAK,CAACG,SAAS,GAAGd,iBAAiB,GAAGE,eAAe,EACnDS,KAAK,CAACG,SAAS,GAAGb,mBAAmB,GAAGE,iBAAiB,CAAA,CAAA;AAAA,CAEvE,CACF,CAAA;AAED,IAAMY,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAO2B;AAAA,EAAA,IAN1CC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,eAAe,GAAAF,IAAA,CAAfE,eAAe;IACfC,UAAU,GAAAH,IAAA,CAAVG,UAAU;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EAAE;AACjBR,QAAAA,SAAS,CAAC;AAAE0B,UAAAA,QAAQ,EAAE7B,eAAe;AAAE8B,UAAAA,OAAO,EAAE/B,QAAAA;AAAS,SAAC,CAAC,CAAA;AAC7D,OAAA;KACA;AACFJ,IAAAA,UAAU,EAAEgB,YAAY,GAAGc,iBAAiB,GAAGT,iBAAkB;IAAAjB,QAAA,eAEjE4B,GAAA,CAACI,GAAG,EAAA;MACFC,mBAAmB,EAAEhC,eAAe,KAAKE,cAAe;AACxD+B,MAAAA,iBAAiB,EAAE,IAAK;MACxB9B,SAAS,EAAE,SAAAA,SAAAA,GAAM;QACfS,eAAe,CAAC,KAAK,CAAC,CAAA;OACtB;AACFsB,MAAAA,WAAW,EAAC,WAAW;AACvBC,MAAAA,OAAO,EAAC,WAAW;AACnBlC,MAAAA,UAAU,EAAEA,UAAW;AACvBI,MAAAA,IAAI,EAAEA,IAAK;AAAAN,MAAAA,QAAA,EAEVA,QAAAA;KACE,CAAA;AAAC,GACc,CAAC,CAAA;AAE3B;;;;"}
|
|
@@ -70,7 +70,7 @@ var FocussableTag = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
70
70
|
*/
|
|
71
71
|
var Tag = function Tag(_ref) {
|
|
72
72
|
var _ref$size = _ref.size,
|
|
73
|
-
size
|
|
73
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
74
74
|
Icon = _ref.icon,
|
|
75
75
|
onDismiss = _ref.onDismiss,
|
|
76
76
|
children = _ref.children,
|
|
@@ -92,11 +92,11 @@ var Tag = function Tag(_ref) {
|
|
|
92
92
|
m: ['spacing.2', 'spacing.3', 'spacing.2', 'spacing.4']
|
|
93
93
|
};
|
|
94
94
|
var assetSize = React__default.useMemo(function () {
|
|
95
|
-
if (isMobile && size
|
|
95
|
+
if (isMobile && size === 'large') {
|
|
96
96
|
return 'medium';
|
|
97
97
|
}
|
|
98
98
|
return 'small';
|
|
99
|
-
}, [isMobile, size
|
|
99
|
+
}, [isMobile, size]);
|
|
100
100
|
return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread({
|
|
101
101
|
display: isReactNative() ? 'flex' : 'inline-flex'
|
|
102
102
|
}, getStyledProps(styledProps)), metaAttribute({
|
|
@@ -111,7 +111,7 @@ var Tag = function Tag(_ref) {
|
|
|
111
111
|
flexShrink: 0,
|
|
112
112
|
backgroundColor: backgroundColor,
|
|
113
113
|
borderRadius: "max",
|
|
114
|
-
padding: size
|
|
114
|
+
padding: size === 'medium' ? mediumPadding : largePadding,
|
|
115
115
|
_isVirtuallyFocused: _isVirtuallyFocused,
|
|
116
116
|
children: [Icon ? /*#__PURE__*/jsx(Box, {
|
|
117
117
|
display: "flex",
|
|
@@ -125,13 +125,12 @@ var Tag = function Tag(_ref) {
|
|
|
125
125
|
}) : null, /*#__PURE__*/jsx(Box, {
|
|
126
126
|
display: "flex",
|
|
127
127
|
flexDirection: "row",
|
|
128
|
-
maxWidth: makeSize(size['100']),
|
|
129
128
|
children: /*#__PURE__*/jsx(Text, {
|
|
130
129
|
textAlign: "center",
|
|
131
130
|
truncateAfterLines: 1,
|
|
132
131
|
marginRight: "spacing.2",
|
|
133
132
|
color: textColor,
|
|
134
|
-
size:
|
|
133
|
+
size: "small",
|
|
135
134
|
children: children
|
|
136
135
|
})
|
|
137
136
|
}), /*#__PURE__*/jsx(Box, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","sources":["../../../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport type { TagProps } from './types';\nimport { Box } from '~components/Box';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { IconButton } from '~components/Button/IconButton';\nimport { CloseIcon } from '~components/Icons';\nimport { Text } from '~components/Typography';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { isReactNative, makeSize } from '~utils';\nimport { size as globalSizeTokens } from '~tokens/global';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { PaddingProps } from '~components/Box/BaseBox/types/spacingTypes';\nimport { useIsMobile } from '~utils/useIsMobile';\n\nconst FocussableTag = styled(BaseBox)<{ _isVirtuallyFocused: TagProps['_isVirtuallyFocused'] }>(\n (props) => {\n if (props._isVirtuallyFocused && !isReactNative()) {\n return {\n outline: `${makeSize(globalSizeTokens['1'])} solid ${\n props.theme.colors.surface.background.gray.subtle\n }`,\n boxShadow: `0px 0px 0px 4px ${props.theme.colors.interactive.background.primary.faded}`,\n };\n }\n\n return {};\n },\n);\n\n/**\n * ## Tags\n *\n * Tag component can be used to display selected items on UI.\n *\n * ### Usage\n *\n * ***Note:*** _Make sure to handle state when using Tag_\n *\n * ```jsx\n * const [showTag, setShowTag] = React.useState(true);\n *\n * // ...\n *\n * {showTag && (\n * <Tag\n * icon={CheckIcon}\n * onDismiss={() => setShowTag(false)}\n * >\n * Transactions\n * </Tag>\n * )}\n * ```\n *\n * Checkout [Tags Documentation](https://blade.razorpay.com/?path=/story/components-tag--default) for more info.\n *\n */\nconst Tag = ({\n size = 'medium',\n icon: Icon,\n onDismiss,\n children,\n isDisabled,\n testID,\n _isVirtuallyFocused,\n _isTagInsideInput,\n ...styledProps\n}: TagProps): React.ReactElement | null => {\n const isMobile = useIsMobile();\n\n const textColor = isDisabled ? 'interactive.text.gray.disabled' : 'interactive.text.gray.subtle';\n const iconColor = isDisabled ? 'interactive.icon.gray.disabled' : 'interactive.icon.gray.muted';\n const backgroundColor = isDisabled\n ? 'interactive.background.gray.disabled'\n : 'interactive.background.gray.default';\n\n const mediumPadding: PaddingProps['padding'] = {\n base: ['spacing.2', 'spacing.3', 'spacing.2', 'spacing.4'],\n m: ['spacing.1', 'spacing.2', 'spacing.1', 'spacing.3'],\n };\n\n const largePadding: PaddingProps['padding'] = {\n base: ['spacing.2', 'spacing.3', 'spacing.2', 'spacing.4'],\n m: ['spacing.2', 'spacing.3', 'spacing.2', 'spacing.4'],\n };\n\n const assetSize = React.useMemo((): 'small' | 'medium' => {\n if (isMobile && size === 'large') {\n return 'medium';\n }\n\n return 'small';\n }, [isMobile, size]);\n\n return (\n <BaseBox\n display={(isReactNative() ? 'flex' : 'inline-flex') as never}\n {...getStyledProps(styledProps)}\n {...metaAttribute({ name: MetaConstants.Tag, testID })}\n >\n <FocussableTag\n display={(isReactNative() ? 'flex' : 'inline-flex') as never}\n alignSelf={isReactNative() ? 'center' : undefined}\n flexDirection=\"row\"\n flexWrap=\"nowrap\"\n flexShrink={0}\n backgroundColor={backgroundColor}\n borderRadius=\"max\"\n padding={size === 'medium' ? mediumPadding : largePadding}\n _isVirtuallyFocused={_isVirtuallyFocused}\n >\n {/* Leading Icon */}\n {Icon ? (\n <Box display=\"flex\" flexDirection=\"row\" alignItems=\"center\">\n <Icon color={iconColor} size={assetSize} marginRight=\"spacing.2\" />\n </Box>\n ) : null}\n\n {/* Tag Text */}\n <Box display=\"flex\" flexDirection=\"row\"
|
|
1
|
+
{"version":3,"file":"Tag.js","sources":["../../../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport type { TagProps } from './types';\nimport { Box } from '~components/Box';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { IconButton } from '~components/Button/IconButton';\nimport { CloseIcon } from '~components/Icons';\nimport { Text } from '~components/Typography';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { isReactNative, makeSize } from '~utils';\nimport { size as globalSizeTokens } from '~tokens/global';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { PaddingProps } from '~components/Box/BaseBox/types/spacingTypes';\nimport { useIsMobile } from '~utils/useIsMobile';\n\nconst FocussableTag = styled(BaseBox)<{ _isVirtuallyFocused: TagProps['_isVirtuallyFocused'] }>(\n (props) => {\n if (props._isVirtuallyFocused && !isReactNative()) {\n return {\n outline: `${makeSize(globalSizeTokens['1'])} solid ${\n props.theme.colors.surface.background.gray.subtle\n }`,\n boxShadow: `0px 0px 0px 4px ${props.theme.colors.interactive.background.primary.faded}`,\n };\n }\n\n return {};\n },\n);\n\n/**\n * ## Tags\n *\n * Tag component can be used to display selected items on UI.\n *\n * ### Usage\n *\n * ***Note:*** _Make sure to handle state when using Tag_\n *\n * ```jsx\n * const [showTag, setShowTag] = React.useState(true);\n *\n * // ...\n *\n * {showTag && (\n * <Tag\n * icon={CheckIcon}\n * onDismiss={() => setShowTag(false)}\n * >\n * Transactions\n * </Tag>\n * )}\n * ```\n *\n * Checkout [Tags Documentation](https://blade.razorpay.com/?path=/story/components-tag--default) for more info.\n *\n */\nconst Tag = ({\n size = 'medium',\n icon: Icon,\n onDismiss,\n children,\n isDisabled,\n testID,\n _isVirtuallyFocused,\n _isTagInsideInput,\n ...styledProps\n}: TagProps): React.ReactElement | null => {\n const isMobile = useIsMobile();\n\n const textColor = isDisabled ? 'interactive.text.gray.disabled' : 'interactive.text.gray.subtle';\n const iconColor = isDisabled ? 'interactive.icon.gray.disabled' : 'interactive.icon.gray.muted';\n const backgroundColor = isDisabled\n ? 'interactive.background.gray.disabled'\n : 'interactive.background.gray.default';\n\n const mediumPadding: PaddingProps['padding'] = {\n base: ['spacing.2', 'spacing.3', 'spacing.2', 'spacing.4'],\n m: ['spacing.1', 'spacing.2', 'spacing.1', 'spacing.3'],\n };\n\n const largePadding: PaddingProps['padding'] = {\n base: ['spacing.2', 'spacing.3', 'spacing.2', 'spacing.4'],\n m: ['spacing.2', 'spacing.3', 'spacing.2', 'spacing.4'],\n };\n\n const assetSize = React.useMemo((): 'small' | 'medium' => {\n if (isMobile && size === 'large') {\n return 'medium';\n }\n\n return 'small';\n }, [isMobile, size]);\n\n return (\n <BaseBox\n display={(isReactNative() ? 'flex' : 'inline-flex') as never}\n {...getStyledProps(styledProps)}\n {...metaAttribute({ name: MetaConstants.Tag, testID })}\n >\n <FocussableTag\n display={(isReactNative() ? 'flex' : 'inline-flex') as never}\n alignSelf={isReactNative() ? 'center' : undefined}\n flexDirection=\"row\"\n flexWrap=\"nowrap\"\n flexShrink={0}\n backgroundColor={backgroundColor}\n borderRadius=\"max\"\n padding={size === 'medium' ? mediumPadding : largePadding}\n _isVirtuallyFocused={_isVirtuallyFocused}\n >\n {/* Leading Icon */}\n {Icon ? (\n <Box display=\"flex\" flexDirection=\"row\" alignItems=\"center\">\n <Icon color={iconColor} size={assetSize} marginRight=\"spacing.2\" />\n </Box>\n ) : null}\n\n {/* Tag Text */}\n <Box display=\"flex\" flexDirection=\"row\">\n <Text\n textAlign=\"center\"\n truncateAfterLines={1}\n marginRight=\"spacing.2\"\n color={textColor}\n size=\"small\"\n >\n {children}\n </Text>\n </Box>\n\n {/* Dismiss Icon */}\n <Box display=\"flex\" flexDirection=\"row\" alignItems=\"center\" justifyContent=\"center\">\n <IconButton\n size={assetSize}\n icon={CloseIcon}\n accessibilityLabel={`Close ${children} tag`}\n isDisabled={isDisabled}\n _tabIndex={_isTagInsideInput ? -1 : undefined}\n onClick={(e) => {\n // Inside tag input, we stop propagation to avoid opening dropdown on click of close on tag\n if (_isTagInsideInput) {\n e.stopPropagation();\n }\n onDismiss();\n }}\n />\n </Box>\n </FocussableTag>\n </BaseBox>\n );\n};\n\nexport { Tag };\n"],"names":["FocussableTag","styled","BaseBox","withConfig","displayName","componentId","props","_isVirtuallyFocused","isReactNative","outline","concat","makeSize","globalSizeTokens","theme","colors","surface","background","gray","subtle","boxShadow","interactive","primary","faded","Tag","_ref","_ref$size","size","Icon","icon","onDismiss","children","isDisabled","testID","_isTagInsideInput","styledProps","_objectWithoutProperties","_excluded","isMobile","useIsMobile","textColor","iconColor","backgroundColor","mediumPadding","base","m","largePadding","assetSize","React","useMemo","_jsx","_objectSpread","display","getStyledProps","metaAttribute","name","MetaConstants","_jsxs","alignSelf","undefined","flexDirection","flexWrap","flexShrink","borderRadius","padding","Box","alignItems","color","marginRight","Text","textAlign","truncateAfterLines","justifyContent","IconButton","CloseIcon","accessibilityLabel","_tabIndex","onClick","e","stopPropagation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAA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B,SAAU;AACjBb,UAAAA,IAAI,EAAC,OAAO;AAAAI,UAAAA,QAAA,EAEXA,QAAAA;SACG,CAAA;AAAC,OACJ,CAAC,eAGNmB,GAAA,CAACe,GAAG,EAAA;AAACb,QAAAA,OAAO,EAAC,MAAM;AAACQ,QAAAA,aAAa,EAAC,KAAK;AAACM,QAAAA,UAAU,EAAC,QAAQ;AAACM,QAAAA,cAAc,EAAC,QAAQ;QAAAzC,QAAA,eACjFmB,GAAA,CAACuB,UAAU,EAAA;AACT9C,UAAAA,IAAI,EAAEoB,SAAU;AAChBlB,UAAAA,IAAI,EAAE6C,SAAU;AAChBC,UAAAA,kBAAkB,EAAAhE,QAAAA,CAAAA,MAAA,CAAWoB,QAAQ,EAAO,MAAA,CAAA;AAC5CC,UAAAA,UAAU,EAAEA,UAAW;AACvB4C,UAAAA,SAAS,EAAE1C,iBAAiB,GAAG,CAAC,CAAC,GAAGyB,SAAU;AAC9CkB,UAAAA,OAAO,EAAE,SAAAA,OAACC,CAAAA,CAAC,EAAK;AACd;AACA,YAAA,IAAI5C,iBAAiB,EAAE;cACrB4C,CAAC,CAACC,eAAe,EAAE,CAAA;AACrB,aAAA;AACAjD,YAAAA,SAAS,EAAE,CAAA;AACb,WAAA;SACD,CAAA;AAAC,OACC,CAAC,CAAA;KACO,CAAA;AAAC,GAAA,CACT,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTagsGroup.js","sources":["../../../../../../src/components/Tag/getTagsGroup.tsx"],"sourcesContent":["import React from 'react';\nimport { AnimatedTag } from './AnimatedTag';\nimport type { TagsGroupProps } from './types';\n\nconst getTagsGroup = ({\n tags,\n activeTagIndex,\n isDisabled,\n onDismiss,\n size = 'medium',\n}: TagsGroupProps): React.ReactElement[] => {\n return tags.map((tagName, tagIndex) => (\n <AnimatedTag\n key={tagName}\n activeTagIndex={activeTagIndex}\n onDismiss={onDismiss}\n currentTagIndex={tagIndex}\n tagsLength={tags.length}\n isDisabled={isDisabled}\n size={size}\n >\n {tagName}\n </AnimatedTag>\n ));\n};\n\nexport { getTagsGroup };\n"],"names":["getTagsGroup","_ref","tags","activeTagIndex","isDisabled","onDismiss","_ref$size","size","map","tagName","tagIndex","_jsx","AnimatedTag","currentTagIndex","tagsLength","length","children"],"mappings":";;;;AAIA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAM0B;AAAA,EAAA,IAL1CC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IACVC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAAC,SAAA,GAAAL,IAAA,CACTM,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,SAAA,CAAA;AAEf,EAAA,OAAOJ,IAAI,CAACM,GAAG,CAAC,UAACC,OAAO,EAAEC,QAAQ,EAAA;IAAA,oBAChCC,GAAA,CAACC,WAAW,EAAA;AAEVT,MAAAA,cAAc,EAAEA,cAAe;AAC/BE,MAAAA,SAAS,EAAEA,SAAU;AACrBQ,MAAAA,eAAe,EAAEH,QAAS;MAC1BI,UAAU,EAAEZ,IAAI,CAACa,MAAO;AACxBX,MAAAA,UAAU,EAAEA,UAAW;AACvBG,MAAAA,IAAI,EAAEA,IAAK;AAAAS,MAAAA,QAAA,EAEVP,OAAAA;
|
|
1
|
+
{"version":3,"file":"getTagsGroup.js","sources":["../../../../../../src/components/Tag/getTagsGroup.tsx"],"sourcesContent":["import React from 'react';\nimport { AnimatedTag } from './AnimatedTag';\nimport type { TagsGroupProps } from './types';\n\nconst getTagsGroup = ({\n tags,\n activeTagIndex,\n isDisabled,\n onDismiss,\n size = 'medium',\n}: TagsGroupProps): React.ReactElement[] => {\n return tags.map((tagName, tagIndex) => (\n <AnimatedTag\n key={`${tagName}-${tagIndex}`}\n activeTagIndex={activeTagIndex}\n onDismiss={onDismiss}\n currentTagIndex={tagIndex}\n tagsLength={tags.length}\n isDisabled={isDisabled}\n size={size}\n >\n {tagName}\n </AnimatedTag>\n ));\n};\n\nexport { getTagsGroup };\n"],"names":["getTagsGroup","_ref","tags","activeTagIndex","isDisabled","onDismiss","_ref$size","size","map","tagName","tagIndex","_jsx","AnimatedTag","currentTagIndex","tagsLength","length","children","concat"],"mappings":";;;;AAIA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAM0B;AAAA,EAAA,IAL1CC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IACVC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAAC,SAAA,GAAAL,IAAA,CACTM,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,SAAA,CAAA;AAEf,EAAA,OAAOJ,IAAI,CAACM,GAAG,CAAC,UAACC,OAAO,EAAEC,QAAQ,EAAA;IAAA,oBAChCC,GAAA,CAACC,WAAW,EAAA;AAEVT,MAAAA,cAAc,EAAEA,cAAe;AAC/BE,MAAAA,SAAS,EAAEA,SAAU;AACrBQ,MAAAA,eAAe,EAAEH,QAAS;MAC1BI,UAAU,EAAEZ,IAAI,CAACa,MAAO;AACxBX,MAAAA,UAAU,EAAEA,UAAW;AACvBG,MAAAA,IAAI,EAAEA,IAAK;AAAAS,MAAAA,QAAA,EAEVP,OAAAA;KAAOQ,EAAAA,EAAAA,CAAAA,MAAA,CARAR,OAAO,EAAA,GAAA,CAAA,CAAAQ,MAAA,CAAIP,QAAQ,CAShB,CAAC,CAAA;AAAA,GACf,CAAC,CAAA;AACJ;;;;"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import '../../tokens/global/index.js';
|
|
2
2
|
import { size } from '../../tokens/global/size.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
// we have to set some max-width for width animations to work correctly while tags are disappearing
|
|
5
|
+
// https://stackoverflow.com/a/38643863
|
|
6
|
+
var TAG_MAX_WIDTH_START = '100%';
|
|
7
|
+
var TAG_MAX_WIDTH_END = '0%';
|
|
6
8
|
var TAG_MAX_HEIGHT_END = size['0'];
|
|
7
9
|
var TAG_OPACITY_START = 1;
|
|
8
10
|
var TAG_OPACITY_END = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tagAnimationConfig.js","sources":["../../../../../../src/components/Tag/tagAnimationConfig.ts"],"sourcesContent":["import { size } from '~tokens/global';\n\nexport const TAG_MAX_WIDTH_START: number =
|
|
1
|
+
{"version":3,"file":"tagAnimationConfig.js","sources":["../../../../../../src/components/Tag/tagAnimationConfig.ts"],"sourcesContent":["import { size } from '~tokens/global';\n\n// we have to set some max-width for width animations to work correctly while tags are disappearing\n// https://stackoverflow.com/a/38643863\nexport const TAG_MAX_WIDTH_START: `${number}%` = '100%';\nexport const TAG_MAX_WIDTH_END: `${number}%` = '0%';\nexport const TAG_MAX_HEIGHT_END: number = size['0'];\nexport const TAG_OPACITY_START = 1;\nexport const TAG_OPACITY_END = 0;\n"],"names":["TAG_MAX_WIDTH_START","TAG_MAX_WIDTH_END","TAG_MAX_HEIGHT_END","size","TAG_OPACITY_START","TAG_OPACITY_END"],"mappings":";;;AAEA;AACA;AACO,IAAMA,mBAAiC,GAAG,OAAM;AAChD,IAAMC,iBAA+B,GAAG,KAAI;IACtCC,kBAA0B,GAAGC,IAAI,CAAC,GAAG,EAAC;AAC5C,IAAMC,iBAAiB,GAAG,EAAC;AAC3B,IAAMC,eAAe,GAAG;;;;"}
|