@razorpay/blade 11.6.3 → 11.8.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/Accordion/Accordion.js +2 -2
- package/build/lib/native/components/Accordion/Accordion.js.map +1 -1
- package/build/lib/native/components/Accordion/AccordionButton.native.js +2 -2
- package/build/lib/native/components/Accordion/AccordionButton.native.js.map +1 -1
- package/build/lib/native/components/Accordion/AccordionContext.js +2 -2
- package/build/lib/native/components/Accordion/AccordionContext.js.map +1 -1
- package/build/lib/native/components/Accordion/AccordionItem.js +11 -14
- package/build/lib/native/components/Accordion/AccordionItem.js.map +1 -1
- package/build/lib/native/components/Accordion/AccordionItemBody.js +24 -0
- package/build/lib/native/components/Accordion/AccordionItemBody.js.map +1 -0
- package/build/lib/native/components/Accordion/AccordionItemHeader.js +24 -0
- package/build/lib/native/components/Accordion/AccordionItemHeader.js.map +1 -0
- package/build/lib/native/components/Accordion/commonStyles.js +1 -1
- package/build/lib/native/components/Accordion/commonStyles.js.map +1 -1
- package/build/lib/native/components/Accordion/componentIds.js +4 -0
- package/build/lib/native/components/Accordion/componentIds.js.map +1 -0
- package/build/lib/native/components/ActionList/ActionListBox.native.js +1 -4
- package/build/lib/native/components/ActionList/ActionListBox.native.js.map +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/native/components/Button/BaseButton/AnimatedButtonContent.native.js +16 -0
- package/build/lib/native/components/Button/BaseButton/AnimatedButtonContent.native.js.map +1 -0
- package/build/lib/native/components/Button/BaseButton/BaseButton.js +7 -5
- package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/native/components/Button/BaseButton/StyledBaseButton.native.js +1 -1
- package/build/lib/native/components/Button/BaseButton/StyledBaseButton.native.js.map +1 -1
- package/build/lib/native/components/ButtonGroup/ButtonGroup.native.js +7 -0
- package/build/lib/native/components/ButtonGroup/ButtonGroup.native.js.map +1 -0
- package/build/lib/native/components/ButtonGroup/ButtonGroupContext.js +6 -0
- package/build/lib/native/components/ButtonGroup/ButtonGroupContext.js.map +1 -0
- package/build/lib/native/components/Collapsible/CollapsibleBodyContent.native.js.map +1 -1
- package/build/lib/native/components/index.js +3 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/development/components/Accordion/Accordion.js +57 -6
- package/build/lib/web/development/components/Accordion/Accordion.js.map +1 -1
- package/build/lib/web/development/components/Accordion/AccordionButton.web.js +21 -25
- package/build/lib/web/development/components/Accordion/AccordionButton.web.js.map +1 -1
- package/build/lib/web/development/components/Accordion/AccordionContext.js +16 -1
- package/build/lib/web/development/components/Accordion/AccordionContext.js.map +1 -1
- package/build/lib/web/development/components/Accordion/AccordionItem.js +66 -66
- package/build/lib/web/development/components/Accordion/AccordionItem.js.map +1 -1
- package/build/lib/web/development/components/Accordion/AccordionItemBody.js +84 -0
- package/build/lib/web/development/components/Accordion/AccordionItemBody.js.map +1 -0
- package/build/lib/web/development/components/Accordion/AccordionItemHeader.js +71 -0
- package/build/lib/web/development/components/Accordion/AccordionItemHeader.js.map +1 -0
- package/build/lib/web/development/components/Accordion/StyledAccordionButton.web.js +3 -2
- package/build/lib/web/development/components/Accordion/StyledAccordionButton.web.js.map +1 -1
- package/build/lib/web/development/components/Accordion/commonStyles.js +8 -6
- package/build/lib/web/development/components/Accordion/commonStyles.js.map +1 -1
- package/build/lib/web/development/components/Accordion/componentIds.js +8 -0
- package/build/lib/web/development/components/Accordion/componentIds.js.map +1 -0
- package/build/lib/web/development/components/Accordion/index.js +2 -0
- package/build/lib/web/development/components/Accordion/index.js.map +1 -1
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +131 -68
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/AnimatedButtonContent.web.js +18 -0
- package/build/lib/web/development/components/Button/BaseButton/AnimatedButtonContent.web.js.map +1 -0
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +116 -66
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js +158 -0
- package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js.map +1 -0
- package/build/lib/web/development/components/ButtonGroup/ButtonGroupContext.js +11 -0
- package/build/lib/web/development/components/ButtonGroup/ButtonGroupContext.js.map +1 -0
- package/build/lib/web/development/components/ButtonGroup/StyledButtonGroup.js +47 -0
- package/build/lib/web/development/components/ButtonGroup/StyledButtonGroup.js.map +1 -0
- package/build/lib/web/development/components/ButtonGroup/index.js +2 -0
- package/build/lib/web/development/components/ButtonGroup/index.js.map +1 -0
- package/build/lib/web/development/components/Collapsible/CollapsibleBodyContent.web.js +3 -1
- package/build/lib/web/development/components/Collapsible/CollapsibleBodyContent.web.js.map +1 -1
- package/build/lib/web/development/components/index.js +4 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js +3 -0
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/production/components/Accordion/Accordion.js +57 -6
- package/build/lib/web/production/components/Accordion/Accordion.js.map +1 -1
- package/build/lib/web/production/components/Accordion/AccordionButton.web.js +21 -25
- package/build/lib/web/production/components/Accordion/AccordionButton.web.js.map +1 -1
- package/build/lib/web/production/components/Accordion/AccordionContext.js +16 -1
- package/build/lib/web/production/components/Accordion/AccordionContext.js.map +1 -1
- package/build/lib/web/production/components/Accordion/AccordionItem.js +66 -66
- package/build/lib/web/production/components/Accordion/AccordionItem.js.map +1 -1
- package/build/lib/web/production/components/Accordion/AccordionItemBody.js +84 -0
- package/build/lib/web/production/components/Accordion/AccordionItemBody.js.map +1 -0
- package/build/lib/web/production/components/Accordion/AccordionItemHeader.js +71 -0
- package/build/lib/web/production/components/Accordion/AccordionItemHeader.js.map +1 -0
- package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js +3 -2
- package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js.map +1 -1
- package/build/lib/web/production/components/Accordion/commonStyles.js +8 -6
- package/build/lib/web/production/components/Accordion/commonStyles.js.map +1 -1
- package/build/lib/web/production/components/Accordion/componentIds.js +8 -0
- package/build/lib/web/production/components/Accordion/componentIds.js.map +1 -0
- package/build/lib/web/production/components/Accordion/index.js +2 -0
- package/build/lib/web/production/components/Accordion/index.js.map +1 -1
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +131 -68
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/production/components/Button/BaseButton/AnimatedButtonContent.web.js +18 -0
- package/build/lib/web/production/components/Button/BaseButton/AnimatedButtonContent.web.js.map +1 -0
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +116 -66
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js +158 -0
- package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js.map +1 -0
- package/build/lib/web/production/components/ButtonGroup/ButtonGroupContext.js +11 -0
- package/build/lib/web/production/components/ButtonGroup/ButtonGroupContext.js.map +1 -0
- package/build/lib/web/production/components/ButtonGroup/StyledButtonGroup.js +47 -0
- package/build/lib/web/production/components/ButtonGroup/StyledButtonGroup.js.map +1 -0
- package/build/lib/web/production/components/ButtonGroup/index.js +2 -0
- package/build/lib/web/production/components/ButtonGroup/index.js.map +1 -0
- package/build/lib/web/production/components/Collapsible/CollapsibleBodyContent.web.js +3 -1
- package/build/lib/web/production/components/Collapsible/CollapsibleBodyContent.web.js.map +1 -1
- package/build/lib/web/production/components/index.js +4 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js +3 -0
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/types/components/index.d.ts +1120 -965
- package/build/types/components/index.native.d.ts +1091 -962
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import '../Divider/index.js';
|
|
5
5
|
import '../Box/BaseBox/index.js';
|
|
@@ -31,39 +31,78 @@ import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/a
|
|
|
31
31
|
|
|
32
32
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
33
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
34
|
-
var
|
|
34
|
+
var commonCenterBoxProps = {
|
|
35
35
|
display: 'flex',
|
|
36
36
|
alignItems: 'center',
|
|
37
|
-
justifyContent: 'center'
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
justifyContent: 'center'
|
|
38
|
+
};
|
|
39
|
+
var centerBoxProps = {
|
|
40
|
+
large: _objectSpread(_objectSpread({}, commonCenterBoxProps), {}, {
|
|
41
|
+
// We want to align title, icon, titleSuffix, trailing, closeButton to baseline
|
|
42
|
+
// But we also want to keep them center aligned to each other
|
|
43
|
+
// So we add a virtual Box around these slots with 28px and center align them to that box
|
|
44
|
+
// We have done similar thing in figma as well (which is where this 28px comes from)
|
|
45
|
+
height: '28px'
|
|
46
|
+
}),
|
|
47
|
+
medium: _objectSpread(_objectSpread({}, commonCenterBoxProps), {}, {
|
|
48
|
+
height: '20px'
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
var sizeTokensMapping = {
|
|
52
|
+
large: {
|
|
53
|
+
title: 'large'
|
|
54
|
+
},
|
|
55
|
+
medium: {
|
|
56
|
+
title: 'medium'
|
|
57
|
+
}
|
|
43
58
|
};
|
|
44
59
|
|
|
45
60
|
// prop restriction map for corresponding sub components
|
|
46
61
|
var propRestrictionMap = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
large: {
|
|
63
|
+
Button: {
|
|
64
|
+
size: 'xsmall',
|
|
65
|
+
variant: 'tertiary'
|
|
66
|
+
},
|
|
67
|
+
Badge: {
|
|
68
|
+
size: 'medium'
|
|
69
|
+
},
|
|
70
|
+
Link: {
|
|
71
|
+
size: 'medium'
|
|
72
|
+
},
|
|
73
|
+
Text: {
|
|
74
|
+
size: 'medium',
|
|
75
|
+
variant: 'body'
|
|
76
|
+
},
|
|
77
|
+
Amount: {
|
|
78
|
+
type: 'body',
|
|
79
|
+
size: 'medium'
|
|
80
|
+
}
|
|
60
81
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
82
|
+
medium: {
|
|
83
|
+
Button: {
|
|
84
|
+
size: 'xsmall',
|
|
85
|
+
variant: 'tertiary'
|
|
86
|
+
},
|
|
87
|
+
Badge: {
|
|
88
|
+
size: 'small'
|
|
89
|
+
},
|
|
90
|
+
Link: {
|
|
91
|
+
size: 'small'
|
|
92
|
+
},
|
|
93
|
+
Text: {
|
|
94
|
+
size: 'small',
|
|
95
|
+
variant: 'body'
|
|
96
|
+
},
|
|
97
|
+
Amount: {
|
|
98
|
+
type: 'body',
|
|
99
|
+
size: 'small'
|
|
100
|
+
}
|
|
64
101
|
}
|
|
65
102
|
};
|
|
66
|
-
var useTrailingRestriction = function useTrailingRestriction(
|
|
103
|
+
var useTrailingRestriction = function useTrailingRestriction(_ref) {
|
|
104
|
+
var trailing = _ref.trailing,
|
|
105
|
+
size = _ref.size;
|
|
67
106
|
var _React$useState = React__default.useState(null),
|
|
68
107
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
69
108
|
validatedTrailingComponent = _React$useState2[0],
|
|
@@ -73,8 +112,8 @@ var useTrailingRestriction = function useTrailingRestriction(trailing) {
|
|
|
73
112
|
React__default.useEffect(function () {
|
|
74
113
|
if ( /*#__PURE__*/React__default.isValidElement(trailing)) {
|
|
75
114
|
var trailingComponentType = getComponentId(trailing);
|
|
76
|
-
var restrictedProps = propRestrictionMap[trailingComponentType];
|
|
77
|
-
var allowedComponents = Object.keys(propRestrictionMap);
|
|
115
|
+
var restrictedProps = propRestrictionMap[size][trailingComponentType];
|
|
116
|
+
var allowedComponents = Object.keys(propRestrictionMap[size]);
|
|
78
117
|
if (true) {
|
|
79
118
|
if (!restrictedProps) {
|
|
80
119
|
throwBladeError({
|
|
@@ -83,7 +122,7 @@ var useTrailingRestriction = function useTrailingRestriction(trailing) {
|
|
|
83
122
|
});
|
|
84
123
|
}
|
|
85
124
|
}
|
|
86
|
-
var restrictedPropKeys = Object.keys(propRestrictionMap[trailingComponentType]);
|
|
125
|
+
var restrictedPropKeys = Object.keys(propRestrictionMap[size][trailingComponentType]);
|
|
87
126
|
for (var _i = 0, _restrictedPropKeys = restrictedPropKeys; _i < _restrictedPropKeys.length; _i++) {
|
|
88
127
|
var _trailing$props;
|
|
89
128
|
var prop = _restrictedPropKeys[_i];
|
|
@@ -97,37 +136,46 @@ var useTrailingRestriction = function useTrailingRestriction(trailing) {
|
|
|
97
136
|
}
|
|
98
137
|
setValidatedTrailingComponent( /*#__PURE__*/React__default.cloneElement(trailing, restrictedProps));
|
|
99
138
|
}
|
|
100
|
-
}, [trailing]);
|
|
139
|
+
}, [trailing, size]);
|
|
101
140
|
return validatedTrailingComponent;
|
|
102
141
|
};
|
|
103
|
-
var _BaseHeader = function _BaseHeader(
|
|
104
|
-
var title =
|
|
105
|
-
subtitle =
|
|
106
|
-
leading =
|
|
107
|
-
titleSuffix =
|
|
108
|
-
trailing =
|
|
109
|
-
|
|
110
|
-
showDivider =
|
|
111
|
-
|
|
112
|
-
showBackButton =
|
|
113
|
-
|
|
114
|
-
showCloseButton =
|
|
115
|
-
onBackButtonClick =
|
|
116
|
-
onCloseButtonClick =
|
|
117
|
-
closeButtonRef =
|
|
118
|
-
backButtonRef =
|
|
119
|
-
testID =
|
|
120
|
-
onClickCapture =
|
|
121
|
-
onKeyDown =
|
|
122
|
-
onKeyUp =
|
|
123
|
-
onLostPointerCapture =
|
|
124
|
-
onPointerCancel =
|
|
125
|
-
onPointerDown =
|
|
126
|
-
onPointerMove =
|
|
127
|
-
onPointerUp =
|
|
128
|
-
metaComponentName =
|
|
129
|
-
|
|
130
|
-
|
|
142
|
+
var _BaseHeader = function _BaseHeader(_ref2) {
|
|
143
|
+
var title = _ref2.title,
|
|
144
|
+
subtitle = _ref2.subtitle,
|
|
145
|
+
leading = _ref2.leading,
|
|
146
|
+
titleSuffix = _ref2.titleSuffix,
|
|
147
|
+
trailing = _ref2.trailing,
|
|
148
|
+
_ref2$showDivider = _ref2.showDivider,
|
|
149
|
+
showDivider = _ref2$showDivider === void 0 ? true : _ref2$showDivider,
|
|
150
|
+
_ref2$showBackButton = _ref2.showBackButton,
|
|
151
|
+
showBackButton = _ref2$showBackButton === void 0 ? false : _ref2$showBackButton,
|
|
152
|
+
_ref2$showCloseButton = _ref2.showCloseButton,
|
|
153
|
+
showCloseButton = _ref2$showCloseButton === void 0 ? true : _ref2$showCloseButton,
|
|
154
|
+
onBackButtonClick = _ref2.onBackButtonClick,
|
|
155
|
+
onCloseButtonClick = _ref2.onCloseButtonClick,
|
|
156
|
+
closeButtonRef = _ref2.closeButtonRef,
|
|
157
|
+
backButtonRef = _ref2.backButtonRef,
|
|
158
|
+
testID = _ref2.testID,
|
|
159
|
+
onClickCapture = _ref2.onClickCapture,
|
|
160
|
+
onKeyDown = _ref2.onKeyDown,
|
|
161
|
+
onKeyUp = _ref2.onKeyUp,
|
|
162
|
+
onLostPointerCapture = _ref2.onLostPointerCapture,
|
|
163
|
+
onPointerCancel = _ref2.onPointerCancel,
|
|
164
|
+
onPointerDown = _ref2.onPointerDown,
|
|
165
|
+
onPointerMove = _ref2.onPointerMove,
|
|
166
|
+
onPointerUp = _ref2.onPointerUp,
|
|
167
|
+
metaComponentName = _ref2.metaComponentName,
|
|
168
|
+
paddingX = _ref2.paddingX,
|
|
169
|
+
marginY = _ref2.marginY,
|
|
170
|
+
_ref2$size = _ref2.size,
|
|
171
|
+
size$1 = _ref2$size === void 0 ? 'large' : _ref2$size,
|
|
172
|
+
isDisabled = _ref2.isDisabled,
|
|
173
|
+
children = _ref2.children,
|
|
174
|
+
trailingInteractionElement = _ref2.trailingInteractionElement;
|
|
175
|
+
var validatedTrailingComponent = useTrailingRestriction({
|
|
176
|
+
trailing: trailing,
|
|
177
|
+
size: size$1
|
|
178
|
+
});
|
|
131
179
|
var shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;
|
|
132
180
|
var webOnlyEventHandlers = isReactNative() ? {} : {
|
|
133
181
|
onClickCapture: onClickCapture,
|
|
@@ -144,11 +192,11 @@ var _BaseHeader = function _BaseHeader(_ref) {
|
|
|
144
192
|
testID: testID
|
|
145
193
|
})), {}, {
|
|
146
194
|
children: [/*#__PURE__*/jsxs(BaseBox, _objectSpread(_objectSpread({
|
|
147
|
-
marginY: {
|
|
195
|
+
marginY: marginY !== null && marginY !== void 0 ? marginY : {
|
|
148
196
|
base: 'spacing.5',
|
|
149
197
|
m: 'spacing.6'
|
|
150
198
|
},
|
|
151
|
-
paddingX: {
|
|
199
|
+
paddingX: paddingX !== null && paddingX !== void 0 ? paddingX : {
|
|
152
200
|
base: 'spacing.5',
|
|
153
201
|
m: 'spacing.6'
|
|
154
202
|
},
|
|
@@ -161,7 +209,7 @@ var _BaseHeader = function _BaseHeader(_ref) {
|
|
|
161
209
|
children: [showBackButton ? /*#__PURE__*/jsx(BaseBox, {
|
|
162
210
|
overflow: "visible",
|
|
163
211
|
marginRight: "spacing.5",
|
|
164
|
-
children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps), {}, {
|
|
212
|
+
children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
|
|
165
213
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
166
214
|
ref: backButtonRef,
|
|
167
215
|
size: "large",
|
|
@@ -181,7 +229,7 @@ var _BaseHeader = function _BaseHeader(_ref) {
|
|
|
181
229
|
alignItems: "flex-start",
|
|
182
230
|
children: [leading ? /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({
|
|
183
231
|
marginRight: "spacing.3"
|
|
184
|
-
}, centerBoxProps), {}, {
|
|
232
|
+
}, centerBoxProps[size$1]), {}, {
|
|
185
233
|
children: leading
|
|
186
234
|
})) : null, /*#__PURE__*/jsxs(BaseBox, {
|
|
187
235
|
flex: "auto",
|
|
@@ -195,14 +243,14 @@ var _BaseHeader = function _BaseHeader(_ref) {
|
|
|
195
243
|
display: "flex",
|
|
196
244
|
flexDirection: "row",
|
|
197
245
|
children: [title ? /*#__PURE__*/jsx(Text, {
|
|
198
|
-
size:
|
|
246
|
+
size: sizeTokensMapping[size$1].title,
|
|
199
247
|
marginTop: makeSize(size['1']),
|
|
200
248
|
weight: "semibold",
|
|
201
|
-
color:
|
|
249
|
+
color: isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.normal',
|
|
202
250
|
children: title
|
|
203
251
|
}) : null, titleSuffix && /*#__PURE__*/jsx(BaseBox, {
|
|
204
252
|
marginLeft: "spacing.3",
|
|
205
|
-
children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps), {}, {
|
|
253
|
+
children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
|
|
206
254
|
children: titleSuffix
|
|
207
255
|
}))
|
|
208
256
|
})]
|
|
@@ -210,16 +258,16 @@ var _BaseHeader = function _BaseHeader(_ref) {
|
|
|
210
258
|
variant: "body",
|
|
211
259
|
size: "small",
|
|
212
260
|
weight: "regular",
|
|
213
|
-
color:
|
|
261
|
+
color: isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted',
|
|
214
262
|
children: subtitle
|
|
215
263
|
}) : null]
|
|
216
264
|
})]
|
|
217
265
|
}), validatedTrailingComponent ? /*#__PURE__*/jsx(BaseBox, {
|
|
218
266
|
marginRight: "spacing.5",
|
|
219
|
-
children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps), {}, {
|
|
267
|
+
children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
|
|
220
268
|
children: validatedTrailingComponent
|
|
221
269
|
}))
|
|
222
|
-
}) : null, showCloseButton ? /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps), {}, {
|
|
270
|
+
}) : null, showCloseButton ? /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
|
|
223
271
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
224
272
|
ref: closeButtonRef,
|
|
225
273
|
size: "large",
|
|
@@ -229,8 +277,23 @@ var _BaseHeader = function _BaseHeader(_ref) {
|
|
|
229
277
|
return onCloseButtonClick === null || onCloseButtonClick === void 0 ? void 0 : onCloseButtonClick();
|
|
230
278
|
}
|
|
231
279
|
})
|
|
280
|
+
})) : null, trailingInteractionElement && !children ? /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
|
|
281
|
+
children: trailingInteractionElement
|
|
282
|
+
})) : null]
|
|
283
|
+
}), /*#__PURE__*/jsxs(BaseBox, {
|
|
284
|
+
display: "flex",
|
|
285
|
+
width: "100%",
|
|
286
|
+
flexDirection: "row",
|
|
287
|
+
alignItems: "center",
|
|
288
|
+
justifyContent: "space-between",
|
|
289
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
290
|
+
children: children
|
|
291
|
+
}), trailingInteractionElement && children ? /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({
|
|
292
|
+
alignSelf: "flex-start"
|
|
293
|
+
}, centerBoxProps[size$1]), {}, {
|
|
294
|
+
children: trailingInteractionElement
|
|
232
295
|
})) : null]
|
|
233
|
-
})
|
|
296
|
+
})]
|
|
234
297
|
})), showDivider ? /*#__PURE__*/jsx(Divider, {}) : null]
|
|
235
298
|
}));
|
|
236
299
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseHeader.js","sources":["../../../../../../src/components/BaseHeaderFooter/BaseHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { IconButton } from '~components/Button/IconButton';\nimport { ChevronLeftIcon, CloseIcon } from '~components/Icons';\nimport type { TestID } from '~utils/types';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { isReactNative, makeSize } from '~utils';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { logger, throwBladeError } from '~utils/logger';\nimport { size } from '~tokens/global';\n\ntype BaseHeaderProps = {\n title?: string;\n subtitle?: string;\n /**\n * Leading part of the header placed at the left most side of the header\n */\n leading?: React.ReactNode;\n /**\n * Trailing part of the header placed at the right most side of the header\n */\n trailing?: React.ReactNode;\n /**\n * Placed adjacent to the title text\n */\n titleSuffix?: React.ReactNode;\n /**\n * @default true\n */\n showDivider?: boolean;\n /**\n * @default false\n */\n showBackButton?: boolean;\n /**\n * @default true\n */\n showCloseButton?: boolean;\n onCloseButtonClick?: () => void;\n onBackButtonClick?: () => void;\n closeButtonRef?: React.MutableRefObject<any>;\n backButtonRef?: React.MutableRefObject<any>;\n metaComponentName?: string;\n /**\n * inner child of BottomSheetHeader. Meant to be used for AutoComplete only\n */\n children?: React.ReactElement;\n} & Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n> &\n TestID;\n\ntype TrailingComponents = 'Button' | 'Badge' | 'Link' | 'Text' | 'Amount';\n\nconst centerBoxProps: BoxProps = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n // We want to align title, icon, titleSuffix, trailing, closeButton to baseline\n // But we also want to keep them center aligned to each other\n // So we add a virtual Box around these slots with 28px and center align them to that box\n // We have done similar thing in figma as well (which is where this 28px comes from)\n height: '28px',\n};\n\n// prop restriction map for corresponding sub components\nconst propRestrictionMap = {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'medium',\n },\n Link: {\n size: 'medium',\n },\n Text: {\n size: 'medium',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'medium',\n },\n} as const;\n\nconst useTrailingRestriction = (trailing: React.ReactNode): React.ReactNode => {\n const [\n validatedTrailingComponent,\n setValidatedTrailingComponent,\n ] = React.useState<React.ReactElement | null>(null);\n\n // validate and restrict sub component props in trailing prop\n React.useEffect(() => {\n if (React.isValidElement(trailing)) {\n const trailingComponentType = getComponentId(trailing) as TrailingComponents;\n const restrictedProps = propRestrictionMap[trailingComponentType];\n const allowedComponents = Object.keys(propRestrictionMap);\n if (__DEV__) {\n if (!restrictedProps) {\n throwBladeError({\n message: `Only one of \\`${allowedComponents.join(\n ', ',\n )}\\` component is accepted as trailing`,\n moduleName: 'Header',\n });\n }\n }\n\n const restrictedPropKeys = Object.keys(propRestrictionMap[trailingComponentType]);\n for (const prop of restrictedPropKeys) {\n if (trailing?.props?.hasOwnProperty(prop)) {\n logger({\n message: `Do not pass \"${prop}\" to \"${trailingComponentType}\" while inside Header trailing, because we override it.`,\n moduleName: 'Header',\n type: 'warn',\n });\n }\n }\n setValidatedTrailingComponent(\n React.cloneElement(trailing as React.ReactElement, restrictedProps),\n );\n }\n }, [trailing]);\n\n return validatedTrailingComponent;\n};\n\nconst _BaseHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n showDivider = true,\n showBackButton = false,\n showCloseButton = true,\n onBackButtonClick,\n onCloseButtonClick,\n closeButtonRef,\n backButtonRef,\n testID,\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n metaComponentName,\n children,\n}: BaseHeaderProps): React.ReactElement => {\n const validatedTrailingComponent = useTrailingRestriction(trailing);\n const shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;\n\n const webOnlyEventHandlers: Record<string, any> = isReactNative()\n ? {}\n : {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n return (\n <BaseBox {...metaAttribute({ name: metaComponentName, testID })}>\n <BaseBox\n marginY={{ base: 'spacing.5', m: 'spacing.6' }}\n paddingX={{ base: 'spacing.5', m: 'spacing.6' }}\n touchAction=\"none\"\n {...webOnlyEventHandlers}\n >\n <BaseBox display=\"flex\" flexDirection=\"row\" userSelect=\"none\">\n {showBackButton ? (\n <BaseBox overflow=\"visible\" marginRight=\"spacing.5\">\n <Box {...centerBoxProps}>\n <IconButton\n ref={backButtonRef}\n size=\"large\"\n icon={ChevronLeftIcon}\n onClick={() => onBackButtonClick?.()}\n accessibilityLabel=\"Back\"\n />\n </Box>\n </BaseBox>\n ) : null}\n <BaseBox\n paddingRight=\"spacing.5\"\n marginRight=\"auto\"\n flex=\"auto\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"flex-start\"\n >\n {leading ? (\n <BaseBox marginRight=\"spacing.3\" {...centerBoxProps}>\n {leading}\n </BaseBox>\n ) : null}\n <BaseBox flex=\"auto\">\n <BaseBox\n // Explicitly setting maxWidth in React Native because text is not being wrapped properly when multiple fix width components are rendered in header\n // In web, flex containers seem to work a expected\n // @todo: resolve this if we figure out some better solution later\n maxWidth={isReactNative() && shouldWrapTitle ? '100px' : undefined}\n flexShrink={0}\n display=\"flex\"\n flexDirection=\"row\"\n >\n {title ? (\n <Text\n size=\"large\"\n marginTop={makeSize(size['1'])}\n weight=\"semibold\"\n color=\"surface.text.gray.normal\"\n >\n {title}\n </Text>\n ) : null}\n {titleSuffix && (\n <BaseBox marginLeft=\"spacing.3\">\n <Box {...centerBoxProps}>{titleSuffix}</Box>\n </BaseBox>\n )}\n </BaseBox>\n {subtitle ? (\n <Text variant=\"body\" size=\"small\" weight=\"regular\" color=\"surface.text.gray.muted\">\n {subtitle}\n </Text>\n ) : null}\n </BaseBox>\n </BaseBox>\n {validatedTrailingComponent ? (\n <BaseBox marginRight=\"spacing.5\">\n <Box {...centerBoxProps}>{validatedTrailingComponent}</Box>\n </BaseBox>\n ) : null}\n {showCloseButton ? (\n <Box {...centerBoxProps}>\n <IconButton\n ref={closeButtonRef}\n size=\"large\"\n icon={CloseIcon}\n accessibilityLabel=\"Close\"\n onClick={() => onCloseButtonClick?.()}\n />\n </Box>\n ) : null}\n </BaseBox>\n {children}\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\n\nconst BaseHeader = assignWithoutSideEffects(_BaseHeader, {\n componentId: 'BaseHeader',\n});\n\nexport type { BaseHeaderProps };\nexport { BaseHeader };\n"],"names":["centerBoxProps","display","alignItems","justifyContent","height","propRestrictionMap","Button","size","variant","Badge","Link","Text","Amount","type","useTrailingRestriction","trailing","_React$useState","React","useState","_React$useState2","_slicedToArray","validatedTrailingComponent","setValidatedTrailingComponent","useEffect","isValidElement","trailingComponentType","getComponentId","restrictedProps","allowedComponents","Object","keys","throwBladeError","message","concat","join","moduleName","restrictedPropKeys","_i","_restrictedPropKeys","length","_trailing$props","prop","props","hasOwnProperty","logger","cloneElement","_BaseHeader","_ref","title","subtitle","leading","titleSuffix","_ref$showDivider","showDivider","_ref$showBackButton","showBackButton","_ref$showCloseButton","showCloseButton","onBackButtonClick","onCloseButtonClick","closeButtonRef","backButtonRef","testID","onClickCapture","onKeyDown","onKeyUp","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerMove","onPointerUp","metaComponentName","children","shouldWrapTitle","webOnlyEventHandlers","isReactNative","_jsxs","BaseBox","_objectSpread","metaAttribute","name","marginY","base","m","paddingX","touchAction","flexDirection","userSelect","_jsx","overflow","marginRight","Box","IconButton","ref","icon","ChevronLeftIcon","onClick","accessibilityLabel","paddingRight","flex","maxWidth","undefined","flexShrink","marginTop","makeSize","weight","color","marginLeft","CloseIcon","Divider","BaseHeader","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,IAAMA,cAAwB,GAAG;AAC/BC,EAAAA,OAAO,EAAE,MAAM;AACfC,EAAAA,UAAU,EAAE,QAAQ;AACpBC,EAAAA,cAAc,EAAE,QAAQ;AACxB;AACA;AACA;AACA;AACAC,EAAAA,MAAM,EAAE,MAAA;AACV,CAAC,CAAA;;AAED;AACA,IAAMC,kBAAkB,GAAG;AACzBC,EAAAA,MAAM,EAAE;AACNC,IAAAA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e,gBACd+B,GAAA,CAACG,GAAG,EAAAb,aAAA,CAAAA,aAAA,KAAK9E,cAAc,CAAA,EAAA,EAAA,EAAA;UAAAwE,QAAA,eACrBgB,GAAA,CAACI,UAAU,EAAA;AACTC,YAAAA,GAAG,EAAEjC,cAAe;AACpBrD,YAAAA,IAAI,EAAC,OAAO;AACZuF,YAAAA,IAAI,EAAEc,SAAU;AAChBX,YAAAA,kBAAkB,EAAC,OAAO;YAC1BD,OAAO,EAAE,SAAAA,OAAA,GAAA;AAAA,cAAA,OAAMrC,kBAAkB,KAAlBA,IAAAA,IAAAA,kBAAkB,KAAlBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,kBAAkB,EAAI,CAAA;AAAA,aAAA;WACtC,CAAA;SACE,CAAA,CAAC,GACJ,IAAI,CAAA;OACD,CAAC,EACTa,QAAQ,CAAA;KACF,CAAA,CAAC,EACTnB,WAAW,gBAAGmC,GAAA,CAACqB,OAAO,EAAA,EAAE,CAAC,GAAG,IAAI,CAAA;AAAA,GAAA,CAC1B,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMC,UAAU,gBAAGC,wBAAwB,CAACjE,WAAW,EAAE;AACvDkE,EAAAA,WAAW,EAAE,YAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseHeader.js","sources":["../../../../../../src/components/BaseHeaderFooter/BaseHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { IconButton } from '~components/Button/IconButton';\nimport { ChevronLeftIcon, CloseIcon } from '~components/Icons';\nimport type { TestID } from '~utils/types';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { isReactNative, makeSize } from '~utils';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { logger, throwBladeError } from '~utils/logger';\nimport { size as sizeToken } from '~tokens/global';\n\ntype BaseHeaderProps = {\n title?: string;\n subtitle?: string;\n /**\n * Leading part of the header placed at the left most side of the header\n */\n leading?: React.ReactNode;\n /**\n * Trailing part of the header placed at the right most side of the header\n */\n trailing?: React.ReactNode;\n /**\n * Placed adjacent to the title text\n */\n titleSuffix?: React.ReactNode;\n /**\n * @default true\n */\n showDivider?: boolean;\n /**\n * @default false\n */\n showBackButton?: boolean;\n\n /**\n * Slot for rendering any trailing interaction element into BaseHeader.\n *\n * E.g. Used in accordion to render CollapsibleChevronIcon\n */\n trailingInteractionElement?: React.ReactNode;\n\n /**\n * Decides size of the Header\n */\n size?: 'large' | 'medium';\n /**\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * Disabled state of BaseHeader\n *\n * @default false\n */\n isDisabled?: boolean;\n\n paddingX?: BoxProps['paddingX'];\n marginY?: BoxProps['marginY'];\n onCloseButtonClick?: () => void;\n onBackButtonClick?: () => void;\n closeButtonRef?: React.MutableRefObject<any>;\n backButtonRef?: React.MutableRefObject<any>;\n metaComponentName?: string;\n /**\n * inner child of BottomSheetHeader. Meant to be used for AutoComplete only\n */\n children?: React.ReactElement | React.ReactElement[];\n} & Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n> &\n TestID;\n\ntype TrailingComponents = 'Button' | 'Badge' | 'Link' | 'Text' | 'Amount';\n\nconst commonCenterBoxProps: BoxProps = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n};\n\nconst centerBoxProps: { large: BoxProps; medium: BoxProps } = {\n large: {\n ...commonCenterBoxProps,\n // We want to align title, icon, titleSuffix, trailing, closeButton to baseline\n // But we also want to keep them center aligned to each other\n // So we add a virtual Box around these slots with 28px and center align them to that box\n // We have done similar thing in figma as well (which is where this 28px comes from)\n height: '28px',\n },\n medium: {\n ...commonCenterBoxProps,\n height: '20px',\n },\n};\n\nconst sizeTokensMapping = {\n large: {\n title: 'large',\n },\n medium: {\n title: 'medium',\n },\n} as const;\n\n// prop restriction map for corresponding sub components\nconst propRestrictionMap = {\n large: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'medium',\n },\n Link: {\n size: 'medium',\n },\n Text: {\n size: 'medium',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'medium',\n },\n },\n medium: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'small',\n },\n Link: {\n size: 'small',\n },\n Text: {\n size: 'small',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'small',\n },\n },\n} as const;\n\nconst useTrailingRestriction = ({\n trailing,\n size,\n}: {\n size: NonNullable<BaseHeaderProps['size']>;\n trailing: BaseHeaderProps['trailing'];\n}): React.ReactNode => {\n const [\n validatedTrailingComponent,\n setValidatedTrailingComponent,\n ] = React.useState<React.ReactElement | null>(null);\n\n // validate and restrict sub component props in trailing prop\n React.useEffect(() => {\n if (React.isValidElement(trailing)) {\n const trailingComponentType = getComponentId(trailing) as TrailingComponents;\n const restrictedProps = propRestrictionMap[size][trailingComponentType];\n const allowedComponents = Object.keys(propRestrictionMap[size]);\n if (__DEV__) {\n if (!restrictedProps) {\n throwBladeError({\n message: `Only one of \\`${allowedComponents.join(\n ', ',\n )}\\` component is accepted as trailing`,\n moduleName: 'Header',\n });\n }\n }\n\n const restrictedPropKeys = Object.keys(propRestrictionMap[size][trailingComponentType]);\n for (const prop of restrictedPropKeys) {\n if (trailing?.props?.hasOwnProperty(prop)) {\n logger({\n message: `Do not pass \"${prop}\" to \"${trailingComponentType}\" while inside Header trailing, because we override it.`,\n moduleName: 'Header',\n type: 'warn',\n });\n }\n }\n setValidatedTrailingComponent(\n React.cloneElement(trailing as React.ReactElement, restrictedProps),\n );\n }\n }, [trailing, size]);\n\n return validatedTrailingComponent;\n};\n\nconst _BaseHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n showDivider = true,\n showBackButton = false,\n showCloseButton = true,\n onBackButtonClick,\n onCloseButtonClick,\n closeButtonRef,\n backButtonRef,\n testID,\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n metaComponentName,\n paddingX,\n marginY,\n size = 'large',\n isDisabled,\n children,\n trailingInteractionElement,\n}: BaseHeaderProps): React.ReactElement => {\n const validatedTrailingComponent = useTrailingRestriction({ trailing, size });\n const shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;\n\n const webOnlyEventHandlers: Record<string, any> = isReactNative()\n ? {}\n : {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n return (\n <BaseBox {...metaAttribute({ name: metaComponentName, testID })}>\n <BaseBox\n marginY={marginY ?? { base: 'spacing.5', m: 'spacing.6' }}\n paddingX={paddingX ?? { base: 'spacing.5', m: 'spacing.6' }}\n touchAction=\"none\"\n {...webOnlyEventHandlers}\n >\n <BaseBox display=\"flex\" flexDirection=\"row\" userSelect=\"none\">\n {showBackButton ? (\n <BaseBox overflow=\"visible\" marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={backButtonRef}\n size=\"large\"\n icon={ChevronLeftIcon}\n onClick={() => onBackButtonClick?.()}\n accessibilityLabel=\"Back\"\n />\n </Box>\n </BaseBox>\n ) : null}\n <BaseBox\n paddingRight=\"spacing.5\"\n marginRight=\"auto\"\n flex=\"auto\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"flex-start\"\n >\n {leading ? (\n <BaseBox marginRight=\"spacing.3\" {...centerBoxProps[size]}>\n {leading}\n </BaseBox>\n ) : null}\n <BaseBox flex=\"auto\">\n <BaseBox\n // Explicitly setting maxWidth in React Native because text is not being wrapped properly when multiple fix width components are rendered in header\n // In web, flex containers seem to work a expected\n // @todo: resolve this if we figure out some better solution later\n maxWidth={isReactNative() && shouldWrapTitle ? '100px' : undefined}\n flexShrink={0}\n display=\"flex\"\n flexDirection=\"row\"\n >\n {title ? (\n <Text\n size={sizeTokensMapping[size].title}\n marginTop={makeSize(sizeToken['1'])}\n weight=\"semibold\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.normal'}\n >\n {title}\n </Text>\n ) : null}\n {titleSuffix && (\n <BaseBox marginLeft=\"spacing.3\">\n <Box {...centerBoxProps[size]}>{titleSuffix}</Box>\n </BaseBox>\n )}\n </BaseBox>\n {subtitle ? (\n <Text\n variant=\"body\"\n size=\"small\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n >\n {subtitle}\n </Text>\n ) : null}\n </BaseBox>\n </BaseBox>\n {validatedTrailingComponent ? (\n <BaseBox marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>{validatedTrailingComponent}</Box>\n </BaseBox>\n ) : null}\n {showCloseButton ? (\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={closeButtonRef}\n size=\"large\"\n icon={CloseIcon}\n accessibilityLabel=\"Close\"\n onClick={() => onCloseButtonClick?.()}\n />\n </Box>\n ) : null}\n {trailingInteractionElement && !children ? (\n <Box {...centerBoxProps[size]}>{trailingInteractionElement}</Box>\n ) : null}\n </BaseBox>\n <BaseBox\n display=\"flex\"\n width=\"100%\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n >\n <Box>{children}</Box>\n {trailingInteractionElement && children ? (\n <Box alignSelf=\"flex-start\" {...centerBoxProps[size]}>\n {trailingInteractionElement}\n </Box>\n ) : null}\n </BaseBox>\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\n\nconst BaseHeader = assignWithoutSideEffects(_BaseHeader, {\n componentId: 'BaseHeader',\n});\n\nexport type { BaseHeaderProps };\nexport { BaseHeader };\n"],"names":["commonCenterBoxProps","display","alignItems","justifyContent","centerBoxProps","large","_objectSpread","height","medium","sizeTokensMapping","title","propRestrictionMap","Button","size","variant","Badge","Link","Text","Amount","type","useTrailingRestriction","_ref","trailing","_React$useState","React","useState","_React$useState2","_slicedToArray","validatedTrailingComponent","setValidatedTrailingComponent","useEffect","isValidElement","trailingComponentType","getComponentId","restrictedProps","allowedComponents","Object","keys","throwBladeError","message","concat","join","moduleName","restrictedPropKeys","_i","_restrictedPropKeys","length","_trailing$props","prop","props","hasOwnProperty","logger","cloneElement","_BaseHeader","_ref2","subtitle","leading","titleSuffix","_ref2$showDivider","showDivider","_ref2$showBackButton","showBackButton","_ref2$showCloseButton","showCloseButton","onBackButtonClick","onCloseButtonClick","closeButtonRef","backButtonRef","testID","onClickCapture","onKeyDown","onKeyUp","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerMove","onPointerUp","metaComponentName","paddingX","marginY","_ref2$size","isDisabled","children","trailingInteractionElement","shouldWrapTitle","webOnlyEventHandlers","isReactNative","_jsxs","BaseBox","metaAttribute","name","base","m","touchAction","flexDirection","userSelect","_jsx","overflow","marginRight","Box","IconButton","ref","icon","ChevronLeftIcon","onClick","accessibilityLabel","paddingRight","flex","maxWidth","undefined","flexShrink","marginTop","makeSize","sizeToken","weight","color","marginLeft","CloseIcon","width","alignSelf","Divider","BaseHeader","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2FA,IAAMA,oBAA8B,GAAG;AACrCC,EAAAA,OAAO,EAAE,MAAM;AACfC,EAAAA,UAAU,EAAE,QAAQ;AACpBC,EAAAA,cAAc,EAAE,QAAA;AAClB,CAAC,CAAA;AAED,IAAMC,cAAqD,GAAG;AAC5DC,EAAAA,KAAK,EAAAC,aAAA,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KF,cAAc,CAACS,MAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAqE,UAAAA,QAAA,EAAGC,0BAAAA;SAAgC,CAAA,CAAC,GAC/D,IAAI,CAAA;AAAA,OACD,CAAC,eACVI,IAAA,CAACC,OAAO,EAAA;AACNvF,QAAAA,OAAO,EAAC,MAAM;AACdqH,QAAAA,KAAK,EAAC,MAAM;AACZxB,QAAAA,aAAa,EAAC,KAAK;AACnB5F,QAAAA,UAAU,EAAC,QAAQ;AACnBC,QAAAA,cAAc,EAAC,eAAe;QAAA+E,QAAA,EAAA,cAE9Bc,GAAA,CAACG,GAAG,EAAA;AAAAjB,UAAAA,QAAA,EAAEA,QAAAA;AAAQ,SAAM,CAAC,EACpBC,0BAA0B,IAAID,QAAQ,gBACrCc,GAAA,CAACG,GAAG,EAAA7F,aAAA,CAAAA,aAAA,CAAA;AAACiH,UAAAA,SAAS,EAAC,YAAA;SAAiBnH,EAAAA,cAAc,CAACS,MAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAqE,UAAAA,QAAA,EACjDC,0BAAAA;SACE,CAAA,CAAC,GACJ,IAAI,CAAA;AAAA,OACD,CAAC,CAAA;KACH,CAAA,CAAC,EACTxB,WAAW,gBAAGqC,GAAA,CAACwB,OAAO,EAAA,EAAE,CAAC,GAAG,IAAI,CAAA;AAAA,GAAA,CAC1B,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMC,UAAU,gBAAGC,wBAAwB,CAACrE,WAAW,EAAE;AACvDsE,EAAAA,WAAW,EAAE,YAAA;AACf,CAAC;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import getIn from '../../../utils/lodashButBetter/get.js';
|
|
3
|
+
import '../../Box/BaseBox/index.js';
|
|
4
|
+
import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
|
|
5
|
+
|
|
6
|
+
var AnimatedButtonContent = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
7
|
+
displayName: "AnimatedButtonContentweb__AnimatedButtonContent",
|
|
8
|
+
componentId: "sc-1fkx0t6-0"
|
|
9
|
+
})(function (props) {
|
|
10
|
+
return {
|
|
11
|
+
transform: "scale(".concat(props.isPressed ? '0.95' : '1', ")"),
|
|
12
|
+
transitionDuration: getIn(props.theme.motion, props.motionEasing),
|
|
13
|
+
transitionTimingFunction: getIn(props.theme.motion, props.motionDuration)
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export { AnimatedButtonContent as default };
|
|
18
|
+
//# sourceMappingURL=AnimatedButtonContent.web.js.map
|
package/build/lib/web/development/components/Button/BaseButton/AnimatedButtonContent.web.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedButtonContent.web.js","sources":["../../../../../../../src/components/Button/BaseButton/AnimatedButtonContent.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport type { AnimatedButtonContentProps } from './types';\nimport getIn from '~utils/lodashButBetter/get';\nimport BaseBox from '~components/Box/BaseBox';\n\nconst AnimatedButtonContent = styled(BaseBox)<AnimatedButtonContentProps>((props) => {\n return {\n transform: `scale(${props.isPressed ? '0.95' : '1'})`,\n transitionDuration: getIn(props.theme.motion, props.motionEasing),\n transitionTimingFunction: getIn(props.theme.motion, props.motionDuration),\n };\n});\n\nexport default AnimatedButtonContent;\n"],"names":["AnimatedButtonContent","styled","BaseBox","withConfig","displayName","componentId","props","transform","concat","isPressed","transitionDuration","getIn","theme","motion","motionEasing","transitionTimingFunction","motionDuration"],"mappings":";;;;;AAKA,IAAMA,qBAAqB,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,iDAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAA6B,CAAA,CAAA,UAACC,KAAK,EAAK;EACnF,OAAO;IACLC,SAAS,EAAA,QAAA,CAAAC,MAAA,CAAWF,KAAK,CAACG,SAAS,GAAG,MAAM,GAAG,GAAG,EAAG,GAAA,CAAA;AACrDC,IAAAA,kBAAkB,EAAEC,KAAK,CAACL,KAAK,CAACM,KAAK,CAACC,MAAM,EAAEP,KAAK,CAACQ,YAAY,CAAC;IACjEC,wBAAwB,EAAEJ,KAAK,CAACL,KAAK,CAACM,KAAK,CAACC,MAAM,EAAEP,KAAK,CAACU,cAAc,CAAA;GACzE,CAAA;AACH,CAAC;;;;"}
|