@hero-design/rn-work-uikit 1.2.3-alpha.0 → 1.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn-work-uikit",
3
- "version": "1.2.3-alpha.0",
3
+ "version": "1.3.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -13,7 +13,7 @@
13
13
  "test:watch": "jest --runInBand --watch",
14
14
  "test:ci": "jest --c=jest-ci.config.js --i --logHeapUsage --coverage && cat ./coverage/lcov.info",
15
15
  "build:js": "rollup -c",
16
- "build:types": "tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json",
16
+ "build:types": "rollup -c rollup.config.mjs --configPlugin dts",
17
17
  "build": "yarn build:js && yarn build:types",
18
18
  "build:watch": "yarn build:js -w & yarn build:types -w",
19
19
  "publish:npm": "yarn publish --access public",
@@ -23,7 +23,7 @@
23
23
  "@emotion/native": "^11.9.3",
24
24
  "@emotion/primitives-core": "11.0.0",
25
25
  "@emotion/react": "^11.9.3",
26
- "@hero-design/rn": "^8.103.2-alpha.0"
26
+ "@hero-design/rn": "^8.103.2"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@hero-design/react-native-month-year-picker": "^8.43.1",
@@ -64,6 +64,7 @@
64
64
  "@react-native/eslint-config": "0.76.9",
65
65
  "@react-native/metro-config": "0.76.9",
66
66
  "@react-native/typescript-config": "0.76.9",
67
+ "@rollup/plugin-alias": "^5.1.1",
67
68
  "@rollup/plugin-babel": "^6.0.4",
68
69
  "@rollup/plugin-commonjs": "^28.0.1",
69
70
  "@rollup/plugin-json": "^6.1.0",
@@ -80,6 +81,7 @@
80
81
  "@typescript-eslint/eslint-plugin": "^5.12.1",
81
82
  "@typescript-eslint/parser": "^5.12.1",
82
83
  "babel-plugin-inline-import": "^3.0.0",
84
+ "babel-plugin-module-resolver": "^5.0.2",
83
85
  "config-tsconfig": "8.42.5",
84
86
  "core-js": "^3.33.0",
85
87
  "eslint": "^8.56.0",
@@ -111,6 +113,7 @@
111
113
  "rollup": "^4.24.3",
112
114
  "rollup-plugin-copy": "^3.5.0",
113
115
  "rollup-plugin-delete": "^3.0.1",
116
+ "rollup-plugin-dts": "^6.2.1",
114
117
  "rollup-plugin-flow": "^1.1.1",
115
118
  "rollup-plugin-visualizer": "^5.12.0",
116
119
  "ts-jest": "^29.1.1",
package/rollup.config.mjs CHANGED
@@ -9,6 +9,8 @@ import { visualizer } from 'rollup-plugin-visualizer';
9
9
  import pkg from './package.json' assert { type: 'json' };
10
10
  import copy from 'rollup-plugin-copy';
11
11
  import del from 'rollup-plugin-delete';
12
+ import alias from '@rollup/plugin-alias';
13
+ import dts from 'rollup-plugin-dts';
12
14
 
13
15
  const extensions = ['.js', '.jsx', '.ts', '.tsx'];
14
16
 
@@ -48,6 +50,11 @@ export default [
48
50
  '@ptomasroos/react-native-multi-slider',
49
51
  ],
50
52
  plugins: [
53
+ alias({
54
+ entries: [
55
+ { find: '@hero-design/rn', replacement: '../rn/src/index.internal.ts' }
56
+ ]
57
+ }),
51
58
  replace({
52
59
  'process.env.NODE_ENV': JSON.stringify('production'),
53
60
  }),
@@ -59,11 +66,11 @@ export default [
59
66
  babel({ extensions, babelHelpers: 'bundled' }),
60
67
  ...(generateBuildStats
61
68
  ? [
62
- visualizer({
63
- filename: fileName,
64
- template: bundleTemplate,
65
- }),
66
- ]
69
+ visualizer({
70
+ filename: fileName,
71
+ template: bundleTemplate,
72
+ }),
73
+ ]
67
74
  : []),
68
75
  del({ targets: ['locales', 'assets'] }),
69
76
  copy({
@@ -80,4 +87,12 @@ export default [
80
87
  }),
81
88
  ],
82
89
  },
90
+ {
91
+ input: 'src/index.ts',
92
+ output: {
93
+ file: 'types/index.d.ts',
94
+ format: 'es',
95
+ },
96
+ plugins: [dts()],
97
+ },
83
98
  ];
@@ -1,22 +1,3 @@
1
- import React from 'react';
2
- import renderWithTheme from '../../testUtils/renderWithTheme';
3
- import { TextInput } from '..';
4
-
5
- describe('first test to ensure configure correctly', () => {
6
- it('should render TextInput with props in snapshot', () => {
7
- const onChangeTextSpy = jest.fn();
8
- const { toJSON } = renderWithTheme(
9
- <TextInput
10
- placeholder="Enter text here"
11
- value="test value"
12
- onChangeText={onChangeTextSpy}
13
- testID="text-input"
14
- />
15
- );
16
- expect(toJSON()).toMatchSnapshot();
17
- });
18
- });
19
-
20
1
  describe('Export Completeness', () => {
21
2
  it('should include all exports from @hero-design/rn', () => {
22
3
  // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import {
3
+ Select as InternalSelect,
4
+ MultiSelectProps,
5
+ SingleSelectProps,
6
+ SelectOptionType,
7
+ } from '@hero-design/rn';
8
+ import TextInput from '../TextInput';
9
+
10
+ function Select<V, T extends SelectOptionType<V> = SelectOptionType<V>>(
11
+ props: SingleSelectProps<V, T>
12
+ ) {
13
+ return <InternalSelect {...props} TextInputComponent={TextInput} />;
14
+ }
15
+
16
+ Select.Multi = function <
17
+ V,
18
+ T extends SelectOptionType<V> = SelectOptionType<V>
19
+ >(props: MultiSelectProps<V, T>) {
20
+ return <InternalSelect.Multi {...props} TextInputComponent={TextInput} />;
21
+ };
22
+
23
+ export default Select;
@@ -174,7 +174,6 @@ exports[`TextInputGroup should render: xxx 1`] = `
174
174
  "flexDirection": "row",
175
175
  "flexGrow": 2,
176
176
  "flexShrink": 1,
177
- "gap": 3.9230769230769234,
178
177
  "opacity": 1,
179
178
  },
180
179
  ],
@@ -457,7 +456,6 @@ exports[`TextInputGroup should render: xxx 1`] = `
457
456
  "flexDirection": "row",
458
457
  "flexGrow": 2,
459
458
  "flexShrink": 1,
460
- "gap": 3.9230769230769234,
461
459
  "opacity": 1,
462
460
  },
463
461
  ],
@@ -791,7 +789,6 @@ exports[`TextInputGroup should render: xxx 1`] = `
791
789
  "flexDirection": "row",
792
790
  "flexGrow": 2,
793
791
  "flexShrink": 1,
794
- "gap": 3.9230769230769234,
795
792
  "opacity": 1,
796
793
  },
797
794
  ],
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Icon, IconName } from '@hero-design/rn';
3
3
  import { View, ViewProps } from 'react-native';
4
- import type { State } from './StyledTextInput';
4
+ import { StyledPrefixComponentWrapper, type State } from './StyledTextInput';
5
5
 
6
6
  export interface PrefixComponentProps extends ViewProps {
7
7
  /** Current input state for styling decisions */
@@ -46,9 +46,9 @@ const PrefixComponent: React.FC<PrefixComponentProps> = ({
46
46
  }) => {
47
47
  const actualPrefix = typeof prefix === 'string' ? prefix : '';
48
48
 
49
- if (typeof prefix === 'string' && actualPrefix) {
49
+ if (actualPrefix) {
50
50
  return (
51
- <View testID="input-prefix" {...rest}>
51
+ <StyledPrefixComponentWrapper testID="input-prefix" {...rest}>
52
52
  <Icon
53
53
  intent={state === 'disabled' ? 'disabled-text' : 'text'}
54
54
  icon={actualPrefix}
@@ -57,7 +57,7 @@ const PrefixComponent: React.FC<PrefixComponentProps> = ({
57
57
  accessibilityLabel={`Prefix icon: ${actualPrefix}`}
58
58
  accessibilityRole="image"
59
59
  />
60
- </View>
60
+ </StyledPrefixComponentWrapper>
61
61
  );
62
62
  }
63
63
 
@@ -115,16 +115,19 @@ const StyledInputWrapper = styled(View)(({ theme }) => ({
115
115
  }));
116
116
 
117
117
  const StyledInputRow = styled(Pressable)<{ themeOpacity: number }>(
118
- ({ theme, themeOpacity }) => ({
118
+ ({ themeOpacity }) => ({
119
119
  flexDirection: 'row',
120
120
  alignItems: 'center',
121
121
  flexGrow: 2,
122
122
  flexShrink: 1,
123
- gap: theme.__hd__.textInput.space.prefixAndInputContainerGap,
124
123
  opacity: themeOpacity,
125
124
  })
126
125
  );
127
126
 
127
+ const StyledPrefixComponentWrapper = styled(View)(({ theme }) => ({
128
+ marginRight: theme.__hd__.textInput.space.prefixAndInputContainerGap,
129
+ }));
130
+
128
131
  const StyledErrorAndHelpTextContainer = styled(View)(({ theme }) => ({
129
132
  paddingHorizontal:
130
133
  theme.__hd__.textInput.space.errorAndHelpTextContainerHorizontalPadding,
@@ -159,4 +162,5 @@ export {
159
162
  StyledBottomContainer,
160
163
  StyledSuffixContainer,
161
164
  StyledLabel,
165
+ StyledPrefixComponentWrapper,
162
166
  };
@@ -158,7 +158,6 @@ exports[`TextInput when user applies custom styling should respect user-provided
158
158
  "flexDirection": "row",
159
159
  "flexGrow": 2,
160
160
  "flexShrink": 1,
161
- "gap": 3.9230769230769234,
162
161
  "opacity": 1,
163
162
  },
164
163
  ],
@@ -169,6 +168,16 @@ exports[`TextInput when user applies custom styling should respect user-provided
169
168
  >
170
169
  <View>
171
170
  <View
171
+ style={
172
+ [
173
+ [
174
+ {
175
+ "marginRight": 3.9230769230769234,
176
+ },
177
+ ],
178
+ undefined,
179
+ ]
180
+ }
172
181
  testID="input-prefix"
173
182
  >
174
183
  <Text
@@ -535,7 +544,6 @@ exports[`TextInput when user chooses textarea variant should provide multiline t
535
544
  "flexDirection": "row",
536
545
  "flexGrow": 2,
537
546
  "flexShrink": 1,
538
- "gap": 3.9230769230769234,
539
547
  "opacity": 1,
540
548
  },
541
549
  ],
@@ -816,7 +824,6 @@ exports[`TextInput when user encounters a disabled field should display content
816
824
  "flexDirection": "row",
817
825
  "flexGrow": 2,
818
826
  "flexShrink": 1,
819
- "gap": 3.9230769230769234,
820
827
  "opacity": 1,
821
828
  },
822
829
  ],
@@ -1096,7 +1103,6 @@ exports[`TextInput when user encounters a read-only field should display content
1096
1103
  "flexDirection": "row",
1097
1104
  "flexGrow": 2,
1098
1105
  "flexShrink": 1,
1099
- "gap": 3.9230769230769234,
1100
1106
  "opacity": 1,
1101
1107
  },
1102
1108
  ],
@@ -1107,6 +1113,16 @@ exports[`TextInput when user encounters a read-only field should display content
1107
1113
  >
1108
1114
  <View>
1109
1115
  <View
1116
+ style={
1117
+ [
1118
+ [
1119
+ {
1120
+ "marginRight": 3.9230769230769234,
1121
+ },
1122
+ ],
1123
+ undefined,
1124
+ ]
1125
+ }
1110
1126
  testID="input-prefix"
1111
1127
  >
1112
1128
  <Text
@@ -1450,7 +1466,6 @@ exports[`TextInput when user has entered text should show the input content and
1450
1466
  "flexDirection": "row",
1451
1467
  "flexGrow": 2,
1452
1468
  "flexShrink": 1,
1453
- "gap": 3.9230769230769234,
1454
1469
  "opacity": 1,
1455
1470
  },
1456
1471
  ],
@@ -1461,6 +1476,16 @@ exports[`TextInput when user has entered text should show the input content and
1461
1476
  >
1462
1477
  <View>
1463
1478
  <View
1479
+ style={
1480
+ [
1481
+ [
1482
+ {
1483
+ "marginRight": 3.9230769230769234,
1484
+ },
1485
+ ],
1486
+ undefined,
1487
+ ]
1488
+ }
1464
1489
  testID="input-prefix"
1465
1490
  >
1466
1491
  <Text
@@ -1775,7 +1800,6 @@ exports[`TextInput when user interacts with placeholder text starting from empty
1775
1800
  "flexDirection": "row",
1776
1801
  "flexGrow": 2,
1777
1802
  "flexShrink": 1,
1778
- "gap": 3.9230769230769234,
1779
1803
  "opacity": 0,
1780
1804
  },
1781
1805
  ],
@@ -1786,6 +1810,16 @@ exports[`TextInput when user interacts with placeholder text starting from empty
1786
1810
  >
1787
1811
  <View>
1788
1812
  <View
1813
+ style={
1814
+ [
1815
+ [
1816
+ {
1817
+ "marginRight": 3.9230769230769234,
1818
+ },
1819
+ ],
1820
+ undefined,
1821
+ ]
1822
+ }
1789
1823
  testID="input-prefix"
1790
1824
  >
1791
1825
  <Text
@@ -2115,7 +2149,6 @@ exports[`TextInput when user needs programmatic control should provide ref metho
2115
2149
  "flexDirection": "row",
2116
2150
  "flexGrow": 2,
2117
2151
  "flexShrink": 1,
2118
- "gap": 3.9230769230769234,
2119
2152
  "opacity": 1,
2120
2153
  },
2121
2154
  ],
@@ -2366,7 +2399,6 @@ exports[`TextInput when user provides default values starting with pre-filled co
2366
2399
  "flexDirection": "row",
2367
2400
  "flexGrow": 2,
2368
2401
  "flexShrink": 1,
2369
- "gap": 3.9230769230769234,
2370
2402
  "opacity": 1,
2371
2403
  },
2372
2404
  ],
@@ -2377,6 +2409,16 @@ exports[`TextInput when user provides default values starting with pre-filled co
2377
2409
  >
2378
2410
  <View>
2379
2411
  <View
2412
+ style={
2413
+ [
2414
+ [
2415
+ {
2416
+ "marginRight": 3.9230769230769234,
2417
+ },
2418
+ ],
2419
+ undefined,
2420
+ ]
2421
+ }
2380
2422
  testID="input-prefix"
2381
2423
  >
2382
2424
  <Text
@@ -2713,7 +2755,6 @@ exports[`TextInput when user provides default values when both default and contr
2713
2755
  "flexDirection": "row",
2714
2756
  "flexGrow": 2,
2715
2757
  "flexShrink": 1,
2716
- "gap": 3.9230769230769234,
2717
2758
  "opacity": 1,
2718
2759
  },
2719
2760
  ],
@@ -2724,6 +2765,16 @@ exports[`TextInput when user provides default values when both default and contr
2724
2765
  >
2725
2766
  <View>
2726
2767
  <View
2768
+ style={
2769
+ [
2770
+ [
2771
+ {
2772
+ "marginRight": 3.9230769230769234,
2773
+ },
2774
+ ],
2775
+ undefined,
2776
+ ]
2777
+ }
2727
2778
  testID="input-prefix"
2728
2779
  >
2729
2780
  <Text
@@ -3090,7 +3141,6 @@ exports[`TextInput when user sees a loading state should show loading indicator
3090
3141
  "flexDirection": "row",
3091
3142
  "flexGrow": 2,
3092
3143
  "flexShrink": 1,
3093
- "gap": 3.9230769230769234,
3094
3144
  "opacity": 1,
3095
3145
  },
3096
3146
  ],
@@ -3101,6 +3151,16 @@ exports[`TextInput when user sees a loading state should show loading indicator
3101
3151
  >
3102
3152
  <View>
3103
3153
  <View
3154
+ style={
3155
+ [
3156
+ [
3157
+ {
3158
+ "marginRight": 3.9230769230769234,
3159
+ },
3160
+ ],
3161
+ undefined,
3162
+ ]
3163
+ }
3104
3164
  testID="input-prefix"
3105
3165
  >
3106
3166
  <Text
@@ -3434,7 +3494,6 @@ exports[`TextInput when user sees a required field should indicate the field is
3434
3494
  "flexDirection": "row",
3435
3495
  "flexGrow": 2,
3436
3496
  "flexShrink": 1,
3437
- "gap": 3.9230769230769234,
3438
3497
  "opacity": 0,
3439
3498
  },
3440
3499
  ],
@@ -3445,6 +3504,16 @@ exports[`TextInput when user sees a required field should indicate the field is
3445
3504
  >
3446
3505
  <View>
3447
3506
  <View
3507
+ style={
3508
+ [
3509
+ [
3510
+ {
3511
+ "marginRight": 3.9230769230769234,
3512
+ },
3513
+ ],
3514
+ undefined,
3515
+ ]
3516
+ }
3448
3517
  testID="input-prefix"
3449
3518
  >
3450
3519
  <Text
@@ -3787,7 +3856,6 @@ exports[`TextInput when user sees a textarea with character count should display
3787
3856
  "flexDirection": "row",
3788
3857
  "flexGrow": 2,
3789
3858
  "flexShrink": 1,
3790
- "gap": 3.9230769230769234,
3791
3859
  "opacity": 1,
3792
3860
  },
3793
3861
  ],
@@ -3798,6 +3866,16 @@ exports[`TextInput when user sees a textarea with character count should display
3798
3866
  >
3799
3867
  <View>
3800
3868
  <View
3869
+ style={
3870
+ [
3871
+ [
3872
+ {
3873
+ "marginRight": 3.9230769230769234,
3874
+ },
3875
+ ],
3876
+ undefined,
3877
+ ]
3878
+ }
3801
3879
  testID="input-prefix"
3802
3880
  >
3803
3881
  <Text
@@ -4178,7 +4256,6 @@ exports[`TextInput when user sees a textarea with character count should hide ch
4178
4256
  "flexDirection": "row",
4179
4257
  "flexGrow": 2,
4180
4258
  "flexShrink": 1,
4181
- "gap": 3.9230769230769234,
4182
4259
  "opacity": 1,
4183
4260
  },
4184
4261
  ],
@@ -4189,6 +4266,16 @@ exports[`TextInput when user sees a textarea with character count should hide ch
4189
4266
  >
4190
4267
  <View>
4191
4268
  <View
4269
+ style={
4270
+ [
4271
+ [
4272
+ {
4273
+ "marginRight": 3.9230769230769234,
4274
+ },
4275
+ ],
4276
+ undefined,
4277
+ ]
4278
+ }
4192
4279
  testID="input-prefix"
4193
4280
  >
4194
4281
  <Text
@@ -4536,7 +4623,6 @@ exports[`TextInput when user sees an empty input field should display label and
4536
4623
  "flexDirection": "row",
4537
4624
  "flexGrow": 2,
4538
4625
  "flexShrink": 1,
4539
- "gap": 3.9230769230769234,
4540
4626
  "opacity": 0,
4541
4627
  },
4542
4628
  ],
@@ -4547,6 +4633,16 @@ exports[`TextInput when user sees an empty input field should display label and
4547
4633
  >
4548
4634
  <View>
4549
4635
  <View
4636
+ style={
4637
+ [
4638
+ [
4639
+ {
4640
+ "marginRight": 3.9230769230769234,
4641
+ },
4642
+ ],
4643
+ undefined,
4644
+ ]
4645
+ }
4550
4646
  testID="input-prefix"
4551
4647
  >
4552
4648
  <Text
@@ -4860,7 +4956,6 @@ exports[`TextInput when user sees an error state should display error message to
4860
4956
  "flexDirection": "row",
4861
4957
  "flexGrow": 2,
4862
4958
  "flexShrink": 1,
4863
- "gap": 3.9230769230769234,
4864
4959
  "opacity": 0,
4865
4960
  },
4866
4961
  ],
@@ -4871,6 +4966,16 @@ exports[`TextInput when user sees an error state should display error message to
4871
4966
  >
4872
4967
  <View>
4873
4968
  <View
4969
+ style={
4970
+ [
4971
+ [
4972
+ {
4973
+ "marginRight": 3.9230769230769234,
4974
+ },
4975
+ ],
4976
+ undefined,
4977
+ ]
4978
+ }
4874
4979
  testID="input-prefix"
4875
4980
  >
4876
4981
  <Text
@@ -5229,7 +5334,6 @@ exports[`TextInput when user sees helper text should display guidance text to as
5229
5334
  "flexDirection": "row",
5230
5335
  "flexGrow": 2,
5231
5336
  "flexShrink": 1,
5232
- "gap": 3.9230769230769234,
5233
5337
  "opacity": 0,
5234
5338
  },
5235
5339
  ],
@@ -5240,6 +5344,16 @@ exports[`TextInput when user sees helper text should display guidance text to as
5240
5344
  >
5241
5345
  <View>
5242
5346
  <View
5347
+ style={
5348
+ [
5349
+ [
5350
+ {
5351
+ "marginRight": 3.9230769230769234,
5352
+ },
5353
+ ],
5354
+ undefined,
5355
+ ]
5356
+ }
5243
5357
  testID="input-prefix"
5244
5358
  >
5245
5359
  <Text
@@ -5540,7 +5654,6 @@ exports[`TextInput when user sees input with custom prefix and suffix elements s
5540
5654
  "flexDirection": "row",
5541
5655
  "flexGrow": 2,
5542
5656
  "flexShrink": 1,
5543
- "gap": 3.9230769230769234,
5544
5657
  "opacity": 0,
5545
5658
  },
5546
5659
  ],
@@ -0,0 +1,8 @@
1
+ declare module 'hero-editor/dist/app.js' {
2
+ const script: string;
3
+ export default script;
4
+ }
5
+
6
+ declare module 'hero-editor' {
7
+ export function isEmptyContent(content: unknown): boolean;
8
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  // Re-export everything from @hero-design/rn except theme exports we want to override
2
2
  import TextInput from './components/TextInput';
3
+ import Select from './components/Select';
3
4
 
4
5
  export * from '@hero-design/rn';
5
6
 
@@ -14,4 +15,4 @@ export {
14
15
  } from './theme';
15
16
 
16
17
  export { default as theme } from './theme';
17
- export { TextInput };
18
+ export { TextInput, Select };
@@ -253,7 +253,6 @@ exports[`theme returns correct theme object 1`] = `
253
253
  },
254
254
  "space": {
255
255
  "closeIconMargin": 11.76923076923077,
256
- "contentPaddingBottom": 23.53846153846154,
257
256
  "floatingContentMargin": 15.692307692307693,
258
257
  "floatingHeaderIconPadding": 7.846153846153847,
259
258
  "floatingInnerPadding": 7.846153846153847,