@hero-design/rn 7.22.1 → 7.22.2
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/.turbo/turbo-build.log +2 -2
- package/es/index.js +42 -46
- package/lib/index.js +42 -46
- package/package.json +4 -4
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +4 -18
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +4 -18
- package/src/components/List/StyledBasicListItem.tsx +1 -0
- package/src/components/List/__tests__/BasicListItem.spec.tsx +37 -13
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +162 -1
- package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +6 -2
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +2 -2
- package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +3 -1
- package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +4 -1
- package/src/components/RichTextEditor/RichTextEditor.tsx +1 -3
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +8 -36
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +2 -1
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +17 -5
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +56 -98
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +2 -1
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +16 -4
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +52 -94
- package/src/components/TextInput/StyledTextInput.tsx +11 -16
- package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +3 -3
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +18 -36
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +55 -237
- package/src/components/TextInput/index.tsx +27 -27
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +4 -18
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +4 -18
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +4 -2
- package/src/theme/components/list.ts +5 -2
- package/src/theme/global/colors/swag.ts +1 -0
- package/src/theme/global/colors/types.ts +1 -0
- package/types/components/TextInput/StyledTextInput.d.ts +3 -9
- package/types/components/TextInput/index.d.ts +4 -4
- package/types/theme/components/list.d.ts +1 -0
- package/types/theme/global/colors/types.d.ts +1 -0
- package/types/theme/global/index.d.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[34m@hero-design/rn:build[0m: cache hit, replaying output [
|
|
1
|
+
[34m@hero-design/rn:build[0m: cache hit, replaying output [2m593e087778fd2d6f[0m
|
|
2
2
|
[34m@hero-design/rn:build: [0m$ yarn build:js && yarn build:types
|
|
3
3
|
[34m@hero-design/rn:build: [0m$ rollup -c
|
|
4
4
|
[34m@hero-design/rn:build: [0m[36m
|
|
5
5
|
[34m@hero-design/rn:build: [0m[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
6
6
|
[34m@hero-design/rn:build: [0m[1m[33m(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
7
7
|
[34m@hero-design/rn:build: [0m[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning[39m[22m
|
|
8
|
-
[34m@hero-design/rn:build: [0m[32mcreated [1mlib/index.js, es/index.js[22m in [1m26.
|
|
8
|
+
[34m@hero-design/rn:build: [0m[32mcreated [1mlib/index.js, es/index.js[22m in [1m26.2s[22m[39m
|
|
9
9
|
[34m@hero-design/rn:build: [0m$ tsc --noEmit false --emitDeclarationOnly
|
package/es/index.js
CHANGED
|
@@ -1328,7 +1328,8 @@ var swagSystemPalette = {
|
|
|
1328
1328
|
__alpha__secondary1: palette$2.scarletGumLight30,
|
|
1329
1329
|
__alpha__secondary2: palette$2.scarletGumLight50,
|
|
1330
1330
|
__alpha__secondary3: palette$2.scarletGumLight80,
|
|
1331
|
-
__alpha__secondary4: palette$2.scarletGumLight90
|
|
1331
|
+
__alpha__secondary4: palette$2.scarletGumLight90,
|
|
1332
|
+
__alpha__lightHighlightedSurface: '#ECE8EF'
|
|
1332
1333
|
};
|
|
1333
1334
|
|
|
1334
1335
|
var workSystemPalette = _objectSpread2(_objectSpread2({}, swagSystemPalette), {}, {
|
|
@@ -2033,8 +2034,8 @@ var getImageTheme = function getImageTheme(theme) {
|
|
|
2033
2034
|
|
|
2034
2035
|
var getListTheme = function getListTheme(theme) {
|
|
2035
2036
|
var colors = {
|
|
2036
|
-
checkedListItemContainerBackground: theme.colors.
|
|
2037
|
-
highlightedListItemContainerBackground: theme.colors.
|
|
2037
|
+
checkedListItemContainerBackground: theme.colors.__alpha__lightHighlightedSurface,
|
|
2038
|
+
highlightedListItemContainerBackground: theme.colors.__alpha__lightHighlightedSurface,
|
|
2038
2039
|
listItemContainerBackground: theme.colors.platformBackground,
|
|
2039
2040
|
leadingStatus: {
|
|
2040
2041
|
danger: theme.colors.dangerMediumLight,
|
|
@@ -2052,6 +2053,7 @@ var getListTheme = function getListTheme(theme) {
|
|
|
2052
2053
|
};
|
|
2053
2054
|
var radii = {
|
|
2054
2055
|
card: theme.radii.medium,
|
|
2056
|
+
basicItem: theme.radii.base,
|
|
2055
2057
|
cardShadow: theme.radii.base,
|
|
2056
2058
|
leadingStatus: theme.radii.rounded
|
|
2057
2059
|
};
|
|
@@ -19107,10 +19109,16 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
19107
19109
|
};
|
|
19108
19110
|
|
|
19109
19111
|
var StyledContainer$3 = index$8(View)(function (_ref) {
|
|
19110
|
-
var
|
|
19112
|
+
var _theme$__hd__$textInp;
|
|
19113
|
+
|
|
19114
|
+
var theme = _ref.theme,
|
|
19115
|
+
themeVariant = _ref.themeVariant;
|
|
19111
19116
|
return {
|
|
19112
19117
|
width: '100%',
|
|
19113
|
-
marginVertical: theme.__hd__.textInput.space.containerMarginVertical
|
|
19118
|
+
marginVertical: theme.__hd__.textInput.space.containerMarginVertical,
|
|
19119
|
+
borderWidth: themeVariant === 'focused' ? theme.__hd__.textInput.borderWidths.container.focused : theme.__hd__.textInput.borderWidths.container.normal,
|
|
19120
|
+
borderRadius: theme.__hd__.textInput.radii.container,
|
|
19121
|
+
borderColor: (_theme$__hd__$textInp = theme.__hd__.textInput.colors.borders[themeVariant]) !== null && _theme$__hd__$textInp !== void 0 ? _theme$__hd__$textInp : theme.__hd__.textInput.colors.borders["default"]
|
|
19114
19122
|
};
|
|
19115
19123
|
});
|
|
19116
19124
|
var StyledLabelContainer = index$8(View)(function (_ref2) {
|
|
@@ -19212,19 +19220,8 @@ var StyledTextInput = index$8(TextInput$1)(function (_ref11) {
|
|
|
19212
19220
|
marginHorizontal: theme.__hd__.textInput.space.inputHorizontalMargin
|
|
19213
19221
|
};
|
|
19214
19222
|
});
|
|
19215
|
-
var
|
|
19216
|
-
var
|
|
19217
|
-
|
|
19218
|
-
var theme = _ref12.theme,
|
|
19219
|
-
themeVariant = _ref12.themeVariant;
|
|
19220
|
-
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
19221
|
-
borderWidth: themeVariant === 'focused' ? theme.__hd__.textInput.borderWidths.container.focused : theme.__hd__.textInput.borderWidths.container.normal,
|
|
19222
|
-
borderRadius: theme.__hd__.textInput.radii.container,
|
|
19223
|
-
borderColor: (_theme$__hd__$textInp = theme.__hd__.textInput.colors.borders[themeVariant]) !== null && _theme$__hd__$textInp !== void 0 ? _theme$__hd__$textInp : theme.__hd__.textInput.colors.borders["default"]
|
|
19224
|
-
});
|
|
19225
|
-
});
|
|
19226
|
-
var StyledTextInputContainer = index$8(View)(function (_ref13) {
|
|
19227
|
-
var theme = _ref13.theme;
|
|
19223
|
+
var StyledTextInputContainer = index$8(View)(function (_ref12) {
|
|
19224
|
+
var theme = _ref12.theme;
|
|
19228
19225
|
return {
|
|
19229
19226
|
flexDirection: 'row',
|
|
19230
19227
|
alignItems: 'center',
|
|
@@ -19240,8 +19237,8 @@ var StyledTextInputAndLabelContainer = index$8(View)(function () {
|
|
|
19240
19237
|
flexShrink: 1
|
|
19241
19238
|
};
|
|
19242
19239
|
});
|
|
19243
|
-
var StyledErrorAndHelpTextContainer = index$8(View)(function (
|
|
19244
|
-
var theme =
|
|
19240
|
+
var StyledErrorAndHelpTextContainer = index$8(View)(function (_ref13) {
|
|
19241
|
+
var theme = _ref13.theme;
|
|
19245
19242
|
return {
|
|
19246
19243
|
paddingLeft: theme.__hd__.textInput.space.errorAndHelpTextContainerPaddingLeft
|
|
19247
19244
|
};
|
|
@@ -19263,26 +19260,26 @@ var getVariant$1 = function getVariant(_ref) {
|
|
|
19263
19260
|
isEmptyValue = _ref.isEmptyValue;
|
|
19264
19261
|
|
|
19265
19262
|
if (disabled) {
|
|
19266
|
-
return
|
|
19263
|
+
return 'disabled';
|
|
19267
19264
|
}
|
|
19268
19265
|
|
|
19269
19266
|
if (error) {
|
|
19270
|
-
return
|
|
19267
|
+
return 'error';
|
|
19271
19268
|
}
|
|
19272
19269
|
|
|
19273
19270
|
if (!editable || loading) {
|
|
19274
|
-
return
|
|
19271
|
+
return 'readonly';
|
|
19275
19272
|
}
|
|
19276
19273
|
|
|
19277
19274
|
if (isFocused) {
|
|
19278
|
-
return
|
|
19275
|
+
return 'focused';
|
|
19279
19276
|
}
|
|
19280
19277
|
|
|
19281
19278
|
if (!isEmptyValue) {
|
|
19282
|
-
return
|
|
19279
|
+
return 'filled';
|
|
19283
19280
|
}
|
|
19284
19281
|
|
|
19285
|
-
return
|
|
19282
|
+
return 'default';
|
|
19286
19283
|
};
|
|
19287
19284
|
|
|
19288
19285
|
var TextInput = function TextInput(_ref2) {
|
|
@@ -19310,9 +19307,9 @@ var TextInput = function TextInput(_ref2) {
|
|
|
19310
19307
|
renderInputValue = _ref2.renderInputValue,
|
|
19311
19308
|
nativeProps = _objectWithoutProperties(_ref2, _excluded$6);
|
|
19312
19309
|
|
|
19313
|
-
var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 :
|
|
19310
|
+
var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
|
|
19314
19311
|
var isEmptyValue = displayText.length === 0;
|
|
19315
|
-
var actualSuffix = loading ?
|
|
19312
|
+
var actualSuffix = loading ? 'loading' : suffix;
|
|
19316
19313
|
|
|
19317
19314
|
var _React$useState = React.useState(false),
|
|
19318
19315
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -19334,9 +19331,9 @@ var TextInput = function TextInput(_ref2) {
|
|
|
19334
19331
|
style: StyleSheet$1.flatten([{
|
|
19335
19332
|
color: theme.__hd__.textInput.colors.text
|
|
19336
19333
|
}, textStyle]),
|
|
19337
|
-
testID:
|
|
19334
|
+
testID: 'text-input',
|
|
19338
19335
|
accessibilityState: {
|
|
19339
|
-
disabled: variant ===
|
|
19336
|
+
disabled: variant === 'disabled' || variant === 'readonly'
|
|
19340
19337
|
},
|
|
19341
19338
|
// @ts-ignore
|
|
19342
19339
|
accessibilityLabelledBy: accessibilityLabelledBy
|
|
@@ -19362,16 +19359,15 @@ var TextInput = function TextInput(_ref2) {
|
|
|
19362
19359
|
(_nativeProps$onChange = nativeProps.onChangeText) === null || _nativeProps$onChange === void 0 ? void 0 : _nativeProps$onChange.call(nativeProps, text);
|
|
19363
19360
|
},
|
|
19364
19361
|
defaultValue: defaultValue,
|
|
19365
|
-
placeholder: variant ===
|
|
19362
|
+
placeholder: variant === 'focused' ? nativeProps.placeholder : undefined
|
|
19366
19363
|
});
|
|
19367
19364
|
|
|
19368
19365
|
return /*#__PURE__*/React.createElement(StyledContainer$3, {
|
|
19369
|
-
pointerEvents: variant ===
|
|
19370
|
-
testID: testID
|
|
19371
|
-
|
|
19372
|
-
themeVariant: variant
|
|
19373
|
-
|
|
19374
|
-
}), (isFocused || label && !isEmptyValue) && /*#__PURE__*/React.createElement(StyledLabelContainer, {
|
|
19366
|
+
pointerEvents: variant === 'disabled' || variant === 'readonly' ? 'none' : 'auto',
|
|
19367
|
+
testID: testID,
|
|
19368
|
+
style: style,
|
|
19369
|
+
themeVariant: variant
|
|
19370
|
+
}, /*#__PURE__*/React.createElement(StyledTextInputContainer, null, (isFocused || label && !isEmptyValue) && /*#__PURE__*/React.createElement(StyledLabelContainer, {
|
|
19375
19371
|
pointerEvents: "none"
|
|
19376
19372
|
}, required && /*#__PURE__*/React.createElement(StyledAsteriskLabel, {
|
|
19377
19373
|
themeVariant: variant,
|
|
@@ -19381,8 +19377,8 @@ var TextInput = function TextInput(_ref2) {
|
|
|
19381
19377
|
testID: "input-label",
|
|
19382
19378
|
fontSize: "small",
|
|
19383
19379
|
themeVariant: variant
|
|
19384
|
-
}, label)), typeof prefix ===
|
|
19385
|
-
intent: variant ===
|
|
19380
|
+
}, label)), typeof prefix === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
19381
|
+
intent: variant === 'disabled' ? 'disabled-text' : 'text',
|
|
19386
19382
|
testID: "input-prefix",
|
|
19387
19383
|
icon: prefix,
|
|
19388
19384
|
size: "xsmall"
|
|
@@ -19395,11 +19391,11 @@ var TextInput = function TextInput(_ref2) {
|
|
|
19395
19391
|
testID: "input-label",
|
|
19396
19392
|
fontSize: "medium",
|
|
19397
19393
|
themeVariant: variant
|
|
19398
|
-
}, label)), renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React.createElement(StyledTextInput, nativeInputProps)), typeof actualSuffix ===
|
|
19399
|
-
intent: variant ===
|
|
19394
|
+
}, label)), renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React.createElement(StyledTextInput, nativeInputProps)), typeof actualSuffix === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
19395
|
+
intent: variant === 'disabled' ? 'disabled-text' : 'text',
|
|
19400
19396
|
testID: "input-suffix",
|
|
19401
19397
|
icon: actualSuffix,
|
|
19402
|
-
spin: actualSuffix ===
|
|
19398
|
+
spin: actualSuffix === 'loading',
|
|
19403
19399
|
size: "xsmall"
|
|
19404
19400
|
}) : suffix), /*#__PURE__*/React.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React.createElement(StyledErrorAndMaxLengthContainer, null, !!error && /*#__PURE__*/React.createElement(StyledErrorContainer$1, null, /*#__PURE__*/React.createElement(Icon, {
|
|
19405
19401
|
testID: "input-error-icon",
|
|
@@ -20387,7 +20383,8 @@ var StyledListItemContainer = index$8(TouchableHighlight)(function (_ref3) {
|
|
|
20387
20383
|
flexDirection: 'row',
|
|
20388
20384
|
backgroundColor: themeSelected ? theme.__hd__.list.colors.checkedListItemContainerBackground : theme.__hd__.list.colors.listItemContainerBackground,
|
|
20389
20385
|
padding: theme.__hd__.list.space.listItemContainerPadding,
|
|
20390
|
-
opacity: themeDisabled ? theme.__hd__.list.opacity.disabled : theme.__hd__.list.opacity.enabled
|
|
20386
|
+
opacity: themeDisabled ? theme.__hd__.list.opacity.disabled : theme.__hd__.list.opacity.enabled,
|
|
20387
|
+
borderRadius: theme.__hd__.list.radii.basicItem
|
|
20391
20388
|
};
|
|
20392
20389
|
});
|
|
20393
20390
|
|
|
@@ -41225,10 +41222,9 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
41225
41222
|
}
|
|
41226
41223
|
}, []);
|
|
41227
41224
|
return /*#__PURE__*/React.createElement(StyledContainer$3, {
|
|
41228
|
-
testID: testID
|
|
41229
|
-
}, /*#__PURE__*/React.createElement(StyledTextInputContainer, null, /*#__PURE__*/React.createElement(StyledBorderBackDrop, {
|
|
41225
|
+
testID: testID,
|
|
41230
41226
|
themeVariant: variant
|
|
41231
|
-
}
|
|
41227
|
+
}, /*#__PURE__*/React.createElement(StyledTextInputContainer, null, (isFocused || label && !isEmptyValue) && /*#__PURE__*/React.createElement(StyledLabelContainer, {
|
|
41232
41228
|
pointerEvents: "none"
|
|
41233
41229
|
}, required && /*#__PURE__*/React.createElement(StyledAsteriskLabel, {
|
|
41234
41230
|
themeVariant: variant,
|
package/lib/index.js
CHANGED
|
@@ -1357,7 +1357,8 @@ var swagSystemPalette = {
|
|
|
1357
1357
|
__alpha__secondary1: palette$2.scarletGumLight30,
|
|
1358
1358
|
__alpha__secondary2: palette$2.scarletGumLight50,
|
|
1359
1359
|
__alpha__secondary3: palette$2.scarletGumLight80,
|
|
1360
|
-
__alpha__secondary4: palette$2.scarletGumLight90
|
|
1360
|
+
__alpha__secondary4: palette$2.scarletGumLight90,
|
|
1361
|
+
__alpha__lightHighlightedSurface: '#ECE8EF'
|
|
1361
1362
|
};
|
|
1362
1363
|
|
|
1363
1364
|
var workSystemPalette = _objectSpread2(_objectSpread2({}, swagSystemPalette), {}, {
|
|
@@ -2062,8 +2063,8 @@ var getImageTheme = function getImageTheme(theme) {
|
|
|
2062
2063
|
|
|
2063
2064
|
var getListTheme = function getListTheme(theme) {
|
|
2064
2065
|
var colors = {
|
|
2065
|
-
checkedListItemContainerBackground: theme.colors.
|
|
2066
|
-
highlightedListItemContainerBackground: theme.colors.
|
|
2066
|
+
checkedListItemContainerBackground: theme.colors.__alpha__lightHighlightedSurface,
|
|
2067
|
+
highlightedListItemContainerBackground: theme.colors.__alpha__lightHighlightedSurface,
|
|
2067
2068
|
listItemContainerBackground: theme.colors.platformBackground,
|
|
2068
2069
|
leadingStatus: {
|
|
2069
2070
|
danger: theme.colors.dangerMediumLight,
|
|
@@ -2081,6 +2082,7 @@ var getListTheme = function getListTheme(theme) {
|
|
|
2081
2082
|
};
|
|
2082
2083
|
var radii = {
|
|
2083
2084
|
card: theme.radii.medium,
|
|
2085
|
+
basicItem: theme.radii.base,
|
|
2084
2086
|
cardShadow: theme.radii.base,
|
|
2085
2087
|
leadingStatus: theme.radii.rounded
|
|
2086
2088
|
};
|
|
@@ -19136,10 +19138,16 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
19136
19138
|
};
|
|
19137
19139
|
|
|
19138
19140
|
var StyledContainer$3 = index$8(reactNative.View)(function (_ref) {
|
|
19139
|
-
var
|
|
19141
|
+
var _theme$__hd__$textInp;
|
|
19142
|
+
|
|
19143
|
+
var theme = _ref.theme,
|
|
19144
|
+
themeVariant = _ref.themeVariant;
|
|
19140
19145
|
return {
|
|
19141
19146
|
width: '100%',
|
|
19142
|
-
marginVertical: theme.__hd__.textInput.space.containerMarginVertical
|
|
19147
|
+
marginVertical: theme.__hd__.textInput.space.containerMarginVertical,
|
|
19148
|
+
borderWidth: themeVariant === 'focused' ? theme.__hd__.textInput.borderWidths.container.focused : theme.__hd__.textInput.borderWidths.container.normal,
|
|
19149
|
+
borderRadius: theme.__hd__.textInput.radii.container,
|
|
19150
|
+
borderColor: (_theme$__hd__$textInp = theme.__hd__.textInput.colors.borders[themeVariant]) !== null && _theme$__hd__$textInp !== void 0 ? _theme$__hd__$textInp : theme.__hd__.textInput.colors.borders["default"]
|
|
19143
19151
|
};
|
|
19144
19152
|
});
|
|
19145
19153
|
var StyledLabelContainer = index$8(reactNative.View)(function (_ref2) {
|
|
@@ -19241,19 +19249,8 @@ var StyledTextInput = index$8(reactNative.TextInput)(function (_ref11) {
|
|
|
19241
19249
|
marginHorizontal: theme.__hd__.textInput.space.inputHorizontalMargin
|
|
19242
19250
|
};
|
|
19243
19251
|
});
|
|
19244
|
-
var
|
|
19245
|
-
var
|
|
19246
|
-
|
|
19247
|
-
var theme = _ref12.theme,
|
|
19248
|
-
themeVariant = _ref12.themeVariant;
|
|
19249
|
-
return _objectSpread2(_objectSpread2({}, reactNative.StyleSheet.absoluteFillObject), {}, {
|
|
19250
|
-
borderWidth: themeVariant === 'focused' ? theme.__hd__.textInput.borderWidths.container.focused : theme.__hd__.textInput.borderWidths.container.normal,
|
|
19251
|
-
borderRadius: theme.__hd__.textInput.radii.container,
|
|
19252
|
-
borderColor: (_theme$__hd__$textInp = theme.__hd__.textInput.colors.borders[themeVariant]) !== null && _theme$__hd__$textInp !== void 0 ? _theme$__hd__$textInp : theme.__hd__.textInput.colors.borders["default"]
|
|
19253
|
-
});
|
|
19254
|
-
});
|
|
19255
|
-
var StyledTextInputContainer = index$8(reactNative.View)(function (_ref13) {
|
|
19256
|
-
var theme = _ref13.theme;
|
|
19252
|
+
var StyledTextInputContainer = index$8(reactNative.View)(function (_ref12) {
|
|
19253
|
+
var theme = _ref12.theme;
|
|
19257
19254
|
return {
|
|
19258
19255
|
flexDirection: 'row',
|
|
19259
19256
|
alignItems: 'center',
|
|
@@ -19269,8 +19266,8 @@ var StyledTextInputAndLabelContainer = index$8(reactNative.View)(function () {
|
|
|
19269
19266
|
flexShrink: 1
|
|
19270
19267
|
};
|
|
19271
19268
|
});
|
|
19272
|
-
var StyledErrorAndHelpTextContainer = index$8(reactNative.View)(function (
|
|
19273
|
-
var theme =
|
|
19269
|
+
var StyledErrorAndHelpTextContainer = index$8(reactNative.View)(function (_ref13) {
|
|
19270
|
+
var theme = _ref13.theme;
|
|
19274
19271
|
return {
|
|
19275
19272
|
paddingLeft: theme.__hd__.textInput.space.errorAndHelpTextContainerPaddingLeft
|
|
19276
19273
|
};
|
|
@@ -19292,26 +19289,26 @@ var getVariant$1 = function getVariant(_ref) {
|
|
|
19292
19289
|
isEmptyValue = _ref.isEmptyValue;
|
|
19293
19290
|
|
|
19294
19291
|
if (disabled) {
|
|
19295
|
-
return
|
|
19292
|
+
return 'disabled';
|
|
19296
19293
|
}
|
|
19297
19294
|
|
|
19298
19295
|
if (error) {
|
|
19299
|
-
return
|
|
19296
|
+
return 'error';
|
|
19300
19297
|
}
|
|
19301
19298
|
|
|
19302
19299
|
if (!editable || loading) {
|
|
19303
|
-
return
|
|
19300
|
+
return 'readonly';
|
|
19304
19301
|
}
|
|
19305
19302
|
|
|
19306
19303
|
if (isFocused) {
|
|
19307
|
-
return
|
|
19304
|
+
return 'focused';
|
|
19308
19305
|
}
|
|
19309
19306
|
|
|
19310
19307
|
if (!isEmptyValue) {
|
|
19311
|
-
return
|
|
19308
|
+
return 'filled';
|
|
19312
19309
|
}
|
|
19313
19310
|
|
|
19314
|
-
return
|
|
19311
|
+
return 'default';
|
|
19315
19312
|
};
|
|
19316
19313
|
|
|
19317
19314
|
var TextInput = function TextInput(_ref2) {
|
|
@@ -19339,9 +19336,9 @@ var TextInput = function TextInput(_ref2) {
|
|
|
19339
19336
|
renderInputValue = _ref2.renderInputValue,
|
|
19340
19337
|
nativeProps = _objectWithoutProperties(_ref2, _excluded$6);
|
|
19341
19338
|
|
|
19342
|
-
var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 :
|
|
19339
|
+
var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
|
|
19343
19340
|
var isEmptyValue = displayText.length === 0;
|
|
19344
|
-
var actualSuffix = loading ?
|
|
19341
|
+
var actualSuffix = loading ? 'loading' : suffix;
|
|
19345
19342
|
|
|
19346
19343
|
var _React$useState = React__default["default"].useState(false),
|
|
19347
19344
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -19363,9 +19360,9 @@ var TextInput = function TextInput(_ref2) {
|
|
|
19363
19360
|
style: reactNative.StyleSheet.flatten([{
|
|
19364
19361
|
color: theme.__hd__.textInput.colors.text
|
|
19365
19362
|
}, textStyle]),
|
|
19366
|
-
testID:
|
|
19363
|
+
testID: 'text-input',
|
|
19367
19364
|
accessibilityState: {
|
|
19368
|
-
disabled: variant ===
|
|
19365
|
+
disabled: variant === 'disabled' || variant === 'readonly'
|
|
19369
19366
|
},
|
|
19370
19367
|
// @ts-ignore
|
|
19371
19368
|
accessibilityLabelledBy: accessibilityLabelledBy
|
|
@@ -19391,16 +19388,15 @@ var TextInput = function TextInput(_ref2) {
|
|
|
19391
19388
|
(_nativeProps$onChange = nativeProps.onChangeText) === null || _nativeProps$onChange === void 0 ? void 0 : _nativeProps$onChange.call(nativeProps, text);
|
|
19392
19389
|
},
|
|
19393
19390
|
defaultValue: defaultValue,
|
|
19394
|
-
placeholder: variant ===
|
|
19391
|
+
placeholder: variant === 'focused' ? nativeProps.placeholder : undefined
|
|
19395
19392
|
});
|
|
19396
19393
|
|
|
19397
19394
|
return /*#__PURE__*/React__default["default"].createElement(StyledContainer$3, {
|
|
19398
|
-
pointerEvents: variant ===
|
|
19399
|
-
testID: testID
|
|
19400
|
-
|
|
19401
|
-
themeVariant: variant
|
|
19402
|
-
|
|
19403
|
-
}), (isFocused || label && !isEmptyValue) && /*#__PURE__*/React__default["default"].createElement(StyledLabelContainer, {
|
|
19395
|
+
pointerEvents: variant === 'disabled' || variant === 'readonly' ? 'none' : 'auto',
|
|
19396
|
+
testID: testID,
|
|
19397
|
+
style: style,
|
|
19398
|
+
themeVariant: variant
|
|
19399
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledTextInputContainer, null, (isFocused || label && !isEmptyValue) && /*#__PURE__*/React__default["default"].createElement(StyledLabelContainer, {
|
|
19404
19400
|
pointerEvents: "none"
|
|
19405
19401
|
}, required && /*#__PURE__*/React__default["default"].createElement(StyledAsteriskLabel, {
|
|
19406
19402
|
themeVariant: variant,
|
|
@@ -19410,8 +19406,8 @@ var TextInput = function TextInput(_ref2) {
|
|
|
19410
19406
|
testID: "input-label",
|
|
19411
19407
|
fontSize: "small",
|
|
19412
19408
|
themeVariant: variant
|
|
19413
|
-
}, label)), typeof prefix ===
|
|
19414
|
-
intent: variant ===
|
|
19409
|
+
}, label)), typeof prefix === 'string' ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
19410
|
+
intent: variant === 'disabled' ? 'disabled-text' : 'text',
|
|
19415
19411
|
testID: "input-prefix",
|
|
19416
19412
|
icon: prefix,
|
|
19417
19413
|
size: "xsmall"
|
|
@@ -19424,11 +19420,11 @@ var TextInput = function TextInput(_ref2) {
|
|
|
19424
19420
|
testID: "input-label",
|
|
19425
19421
|
fontSize: "medium",
|
|
19426
19422
|
themeVariant: variant
|
|
19427
|
-
}, label)), renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React__default["default"].createElement(StyledTextInput, nativeInputProps)), typeof actualSuffix ===
|
|
19428
|
-
intent: variant ===
|
|
19423
|
+
}, label)), renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React__default["default"].createElement(StyledTextInput, nativeInputProps)), typeof actualSuffix === 'string' ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
19424
|
+
intent: variant === 'disabled' ? 'disabled-text' : 'text',
|
|
19429
19425
|
testID: "input-suffix",
|
|
19430
19426
|
icon: actualSuffix,
|
|
19431
|
-
spin: actualSuffix ===
|
|
19427
|
+
spin: actualSuffix === 'loading',
|
|
19432
19428
|
size: "xsmall"
|
|
19433
19429
|
}) : suffix), /*#__PURE__*/React__default["default"].createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default["default"].createElement(StyledErrorAndMaxLengthContainer, null, !!error && /*#__PURE__*/React__default["default"].createElement(StyledErrorContainer$1, null, /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
19434
19430
|
testID: "input-error-icon",
|
|
@@ -20416,7 +20412,8 @@ var StyledListItemContainer = index$8(reactNative.TouchableHighlight)(function (
|
|
|
20416
20412
|
flexDirection: 'row',
|
|
20417
20413
|
backgroundColor: themeSelected ? theme.__hd__.list.colors.checkedListItemContainerBackground : theme.__hd__.list.colors.listItemContainerBackground,
|
|
20418
20414
|
padding: theme.__hd__.list.space.listItemContainerPadding,
|
|
20419
|
-
opacity: themeDisabled ? theme.__hd__.list.opacity.disabled : theme.__hd__.list.opacity.enabled
|
|
20415
|
+
opacity: themeDisabled ? theme.__hd__.list.opacity.disabled : theme.__hd__.list.opacity.enabled,
|
|
20416
|
+
borderRadius: theme.__hd__.list.radii.basicItem
|
|
20420
20417
|
};
|
|
20421
20418
|
});
|
|
20422
20419
|
|
|
@@ -41254,10 +41251,9 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
41254
41251
|
}
|
|
41255
41252
|
}, []);
|
|
41256
41253
|
return /*#__PURE__*/React__default["default"].createElement(StyledContainer$3, {
|
|
41257
|
-
testID: testID
|
|
41258
|
-
}, /*#__PURE__*/React__default["default"].createElement(StyledTextInputContainer, null, /*#__PURE__*/React__default["default"].createElement(StyledBorderBackDrop, {
|
|
41254
|
+
testID: testID,
|
|
41259
41255
|
themeVariant: variant
|
|
41260
|
-
}
|
|
41256
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledTextInputContainer, null, (isFocused || label && !isEmptyValue) && /*#__PURE__*/React__default["default"].createElement(StyledLabelContainer, {
|
|
41261
41257
|
pointerEvents: "none"
|
|
41262
41258
|
}, required && /*#__PURE__*/React__default["default"].createElement(StyledAsteriskLabel, {
|
|
41263
41259
|
themeVariant: variant,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "7.22.
|
|
3
|
+
"version": "7.22.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@emotion/native": "^11.9.3",
|
|
22
22
|
"@emotion/react": "^11.9.3",
|
|
23
|
-
"@hero-design/colors": "7.22.
|
|
23
|
+
"@hero-design/colors": "7.22.2",
|
|
24
24
|
"date-fns": "^2.16.1",
|
|
25
25
|
"events": "^3.2.0",
|
|
26
26
|
"hero-editor": "^1.9.9"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@types/react-native": "^0.67.7",
|
|
58
58
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
59
59
|
"babel-plugin-inline-import": "^3.0.0",
|
|
60
|
-
"eslint-config-hd": "7.22.
|
|
60
|
+
"eslint-config-hd": "7.22.2",
|
|
61
61
|
"jest": "^27.3.1",
|
|
62
62
|
"react": "17.0.2",
|
|
63
63
|
"react-native": "0.65.1",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"rollup-plugin-copy": "^3.4.0",
|
|
71
71
|
"rollup-plugin-flow": "^1.1.1",
|
|
72
72
|
"ts-jest": "^27.0.7",
|
|
73
|
-
"prettier-config-hd": "7.22.
|
|
73
|
+
"prettier-config-hd": "7.22.2"
|
|
74
74
|
},
|
|
75
75
|
"prettier": "prettier-config-hd"
|
|
76
76
|
}
|
|
@@ -26,12 +26,16 @@ exports[`DatePickerAndroid renders correctly 1`] = `
|
|
|
26
26
|
style={
|
|
27
27
|
Array [
|
|
28
28
|
Object {
|
|
29
|
+
"borderColor": "#001f23",
|
|
30
|
+
"borderRadius": 8,
|
|
31
|
+
"borderWidth": 1,
|
|
29
32
|
"marginVertical": 8,
|
|
30
33
|
"width": "100%",
|
|
31
34
|
},
|
|
32
35
|
undefined,
|
|
33
36
|
]
|
|
34
37
|
}
|
|
38
|
+
themeVariant="filled"
|
|
35
39
|
>
|
|
36
40
|
<View
|
|
37
41
|
style={
|
|
@@ -45,24 +49,6 @@ exports[`DatePickerAndroid renders correctly 1`] = `
|
|
|
45
49
|
]
|
|
46
50
|
}
|
|
47
51
|
>
|
|
48
|
-
<View
|
|
49
|
-
style={
|
|
50
|
-
Array [
|
|
51
|
-
Object {
|
|
52
|
-
"borderColor": "#001f23",
|
|
53
|
-
"borderRadius": 8,
|
|
54
|
-
"borderWidth": 1,
|
|
55
|
-
"bottom": 0,
|
|
56
|
-
"left": 0,
|
|
57
|
-
"position": "absolute",
|
|
58
|
-
"right": 0,
|
|
59
|
-
"top": 0,
|
|
60
|
-
},
|
|
61
|
-
undefined,
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
themeVariant="filled"
|
|
65
|
-
/>
|
|
66
52
|
<View
|
|
67
53
|
pointerEvents="none"
|
|
68
54
|
style={
|
|
@@ -26,12 +26,16 @@ exports[`DatePickerIOS renders correctly 1`] = `
|
|
|
26
26
|
style={
|
|
27
27
|
Array [
|
|
28
28
|
Object {
|
|
29
|
+
"borderColor": "#001f23",
|
|
30
|
+
"borderRadius": 8,
|
|
31
|
+
"borderWidth": 1,
|
|
29
32
|
"marginVertical": 8,
|
|
30
33
|
"width": "100%",
|
|
31
34
|
},
|
|
32
35
|
undefined,
|
|
33
36
|
]
|
|
34
37
|
}
|
|
38
|
+
themeVariant="filled"
|
|
35
39
|
>
|
|
36
40
|
<View
|
|
37
41
|
style={
|
|
@@ -45,24 +49,6 @@ exports[`DatePickerIOS renders correctly 1`] = `
|
|
|
45
49
|
]
|
|
46
50
|
}
|
|
47
51
|
>
|
|
48
|
-
<View
|
|
49
|
-
style={
|
|
50
|
-
Array [
|
|
51
|
-
Object {
|
|
52
|
-
"borderColor": "#001f23",
|
|
53
|
-
"borderRadius": 8,
|
|
54
|
-
"borderWidth": 1,
|
|
55
|
-
"bottom": 0,
|
|
56
|
-
"left": 0,
|
|
57
|
-
"position": "absolute",
|
|
58
|
-
"right": 0,
|
|
59
|
-
"top": 0,
|
|
60
|
-
},
|
|
61
|
-
undefined,
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
themeVariant="filled"
|
|
65
|
-
/>
|
|
66
52
|
<View
|
|
67
53
|
pointerEvents="none"
|
|
68
54
|
style={
|
|
@@ -24,6 +24,7 @@ const StyledListItemContainer = styled(TouchableHighlight)<{
|
|
|
24
24
|
opacity: themeDisabled
|
|
25
25
|
? theme.__hd__.list.opacity.disabled
|
|
26
26
|
: theme.__hd__.list.opacity.enabled,
|
|
27
|
+
borderRadius: theme.__hd__.list.radii.basicItem,
|
|
27
28
|
}));
|
|
28
29
|
export {
|
|
29
30
|
StyledListItemContainer,
|
|
@@ -1,22 +1,46 @@
|
|
|
1
1
|
import { fireEvent } from '@testing-library/react-native';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
|
+
import Icon from '../../Icon';
|
|
4
5
|
import BasicListItem from '../BasicListItem';
|
|
5
6
|
|
|
6
7
|
describe('BasicListItem', () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
describe('when suffix and prefix are icon name', () => {
|
|
9
|
+
it('renders correctly', () => {
|
|
10
|
+
const wrapper = renderWithTheme(
|
|
11
|
+
<BasicListItem
|
|
12
|
+
title="List item"
|
|
13
|
+
subtitle="subtitle"
|
|
14
|
+
suffix="checkmark"
|
|
15
|
+
prefix="circle-question-outlined"
|
|
16
|
+
testID="basic-list-item"
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
20
|
+
expect(wrapper.queryAllByTestId('basic-list-item')).toHaveLength(1);
|
|
21
|
+
expect(wrapper.queryAllByText('List item')).toHaveLength(1);
|
|
22
|
+
expect(wrapper.queryAllByText('subtitle')).toHaveLength(1);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('when suffix and prefix are react element', () => {
|
|
27
|
+
it('renders correctly', () => {
|
|
28
|
+
const wrapper = renderWithTheme(
|
|
29
|
+
<BasicListItem
|
|
30
|
+
title="List item"
|
|
31
|
+
subtitle="subtitle"
|
|
32
|
+
suffix={<Icon icon="checkmark" testID="suffix" />}
|
|
33
|
+
prefix={<Icon icon="circle-question-outlined" testID="prefix" />}
|
|
34
|
+
testID="basic-list-item"
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
38
|
+
expect(wrapper.queryAllByTestId('basic-list-item')).toHaveLength(1);
|
|
39
|
+
expect(wrapper.queryAllByTestId('suffix')).toHaveLength(1);
|
|
40
|
+
expect(wrapper.queryAllByTestId('prefix')).toHaveLength(1);
|
|
41
|
+
expect(wrapper.queryAllByText('List item')).toHaveLength(1);
|
|
42
|
+
expect(wrapper.queryAllByText('subtitle')).toHaveLength(1);
|
|
43
|
+
});
|
|
20
44
|
});
|
|
21
45
|
|
|
22
46
|
it('onPress', () => {
|