@onehat/ui 0.4.10 → 0.4.12

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": "@onehat/ui",
3
- "version": "0.4.10",
3
+ "version": "0.4.12",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -545,7 +545,8 @@ export function ComboComponent(props) {
545
545
  }
546
546
  const triggerClassName = `
547
547
  Combo-trigger
548
- h-full
548
+ self-stretch
549
+ h-auto
549
550
  border
550
551
  border-l-0
551
552
  border-gray-400
@@ -575,7 +576,8 @@ export function ComboComponent(props) {
575
576
  onPress={toggleMenu}
576
577
  className={`
577
578
  toggleMenuBtn
578
- h-full
579
+ h-auto
580
+ self-stretch
579
581
  flex-1
580
582
  flex-row
581
583
  justify-center
@@ -595,7 +597,8 @@ export function ComboComponent(props) {
595
597
  ellipsizeMode="head"
596
598
  className={`
597
599
  Text
598
- h-full
600
+ h-auto
601
+ self-stretch
599
602
  flex-1
600
603
  ${_.isEmpty(textInputValue) ? "text-grey-400" : "text-black"}
601
604
  ${styles.FORM_COMBO_INPUT_FONTSIZE}
@@ -619,9 +622,8 @@ export function ComboComponent(props) {
619
622
  className={`
620
623
  ComboInput
621
624
  grow
622
- h-full
623
- min-h-0
624
- max-h-[40px]
625
+ h-auto
626
+ self-stretch
625
627
  flex-1
626
628
  m-0
627
629
  rounded-tr-none
@@ -1015,8 +1017,9 @@ export function ComboComponent(props) {
1015
1017
  let className = `
1016
1018
  Combo-HStack
1017
1019
  flex-1
1018
- h-[40px]
1019
- min-h-[40px]
1020
+ items-stretch
1021
+ h-auto
1022
+ self-stretch
1020
1023
  justify-center
1021
1024
  items-stretch
1022
1025
  `;
@@ -372,8 +372,7 @@ export const DateElement = forwardRef((props, ref) => {
372
372
  flex-1
373
373
  h-full
374
374
  m-0
375
- rounded-tr-none
376
- rounded-br-none
375
+ rounded-r-lg
377
376
  ${styles.FORM_DATE_INPUT_BG}
378
377
  ${styles.FORM_DATE_INPUT_BG_FOCUS}
379
378
  ${styles.FORM_DATE_READOUT_FONTSIZE}
@@ -30,6 +30,7 @@ const InputElement = forwardRef((props, ref) => {
30
30
  rightIcon,
31
31
  rightIconHandler,
32
32
  placeholder,
33
+ textAlignIsCenter = true,
33
34
  className,
34
35
  ...propsToPass
35
36
  } = props,
@@ -118,11 +119,11 @@ const InputElement = forwardRef((props, ref) => {
118
119
  `,
119
120
  inputFieldClassName = `
120
121
  InputField
121
- min-h-[40px]
122
+ self-stretch
122
123
  h-auto
123
124
  w-full
124
125
  p-2
125
- text-center
126
+ ${textAlignIsCenter ? 'text-center' : 'text-left'}
126
127
  ${styles.FORM_INPUT_FONTSIZE}
127
128
  ${styles.FORM_INPUT_BG}
128
129
  ${styles.FORM_INPUT_BG_FOCUS}
@@ -1,5 +1,5 @@
1
1
  import {
2
- HStack,
2
+ HStackNative,
3
3
  Text,
4
4
  } from '@project-components/Gluestack';
5
5
  import testProps from '../../../../Functions/testProps.js';
@@ -16,7 +16,7 @@ export default function ValueBox(props) {
16
16
  onDelete,
17
17
  } = props,
18
18
  styles = UiGlobals.styles;
19
- return <HStack
19
+ return <HStackNative
20
20
  {...testProps('valueBox-' + text)}
21
21
  className={`
22
22
  max-w-full
@@ -57,5 +57,5 @@ export default function ValueBox(props) {
57
57
  onPress={onDelete}
58
58
  className="h-full"
59
59
  />}
60
- </HStack>;
60
+ </HStackNative>;
61
61
  }
@@ -1205,7 +1205,6 @@ function Form(props) {
1205
1205
  key="resetBtn"
1206
1206
  onPress={() => doReset()}
1207
1207
  icon={Rotate}
1208
- className="mr-2"
1209
1208
  isDisabled={!formState.isDirty}
1210
1209
  />}
1211
1210
 
@@ -1215,7 +1214,7 @@ function Form(props) {
1215
1214
  key="cancelBtn"
1216
1215
  variant={editorType === EDITOR_TYPE__INLINE ? 'solid' : 'outline'}
1217
1216
  onPress={onCancel}
1218
- className="text-white mr-2"
1217
+ className="text-white"
1219
1218
  text="Cancel"
1220
1219
  />}
1221
1220
 
@@ -1225,7 +1224,7 @@ function Form(props) {
1225
1224
  key="closeBtn"
1226
1225
  variant={editorType === EDITOR_TYPE__INLINE ? 'solid' : 'outline'}
1227
1226
  onPress={onClose}
1228
- className="text-white mr-2"
1227
+ className="text-white"
1229
1228
  text="Close"
1230
1229
  />}
1231
1230
 
@@ -1277,6 +1276,7 @@ function Form(props) {
1277
1276
  w-[100px]
1278
1277
  min-w-[300px]
1279
1278
  py-2
1279
+ gap-2
1280
1280
  justify-center
1281
1281
  items-center
1282
1282
  rounded-b-lg
@@ -1287,8 +1287,11 @@ function Form(props) {
1287
1287
  </Box>;
1288
1288
  } else {
1289
1289
  if (!disableFooter) {
1290
- let footerClassName = '';
1291
- footerClassName += ' justify-end';
1290
+ let footerClassName = `
1291
+ Form-Footer
1292
+ justify-end
1293
+ gap-2
1294
+ `;
1292
1295
  if (editorType === EDITOR_TYPE__INLINE) {
1293
1296
  footerClassName += `
1294
1297
  sticky
@@ -303,6 +303,7 @@ export default function withFilters(WrappedComponent) {
303
303
  value={getFilterValue(field)}
304
304
  onChangeValue={(value) => onFilterChangeValue(field, value)}
305
305
  isFilter={true}
306
+ minimizeForRow={true}
306
307
  {...filterProps}
307
308
  {...elementProps}
308
309
  className={filterClassName}
@@ -58,7 +58,8 @@ export default function withWindowedEditor(WrappedComponent, isTree = false) {
58
58
  selectorSelected,
59
59
  selectorSelectedField,
60
60
  h,
61
-
61
+ style,
62
+
62
63
  ...propsToPass
63
64
  } = props,
64
65
  onEditorCancel = props.onEditorCancel;
@@ -137,13 +137,12 @@ function Panel(props) {
137
137
  className={`
138
138
  Panel-VSstack
139
139
  flex-1
140
- flex
141
140
  w-full
142
141
  overflow-hidden
143
142
  `}
144
143
  >
145
144
  {isScrollable ?
146
- <ScrollView className="ScrollView">
145
+ <ScrollView className="Panel-ScrollView">
147
146
  {children}
148
147
  </ScrollView> :
149
148
  children}
@@ -1,9 +1,11 @@
1
- import React from 'react';
1
+ import { cloneElement, isValidElement } from 'react';
2
2
  import {
3
+ Box,
3
4
  HStack,
4
5
  Icon,
5
6
  Text,
6
7
  VStack,
8
+ VStackNative,
7
9
  } from '@project-components/Gluestack';
8
10
  import { EDITOR_TYPE__PLAIN } from '../../Constants/Editor';
9
11
  import {
@@ -41,15 +43,14 @@ function Report(props) {
41
43
  buttons = [];
42
44
 
43
45
  const propsIcon = props._icon || {};
44
- propsIcon.size = 60;
45
- propsIcon.px = 5;
46
+ propsIcon.className = 'w-full h-full text-primary-500';
46
47
  let icon = props.icon;
47
48
  if (_.isEmpty(icon)) {
48
49
  icon = ChartLine;
49
50
  }
50
- if (React.isValidElement(icon)) {
51
+ if (isValidElement(icon)) {
51
52
  if (!_.isEmpty(propsIcon)) {
52
- icon = React.cloneElement(icon, {...propsIcon});
53
+ icon = cloneElement(icon, {...propsIcon});
53
54
  }
54
55
  } else {
55
56
  icon = <Icon as={icon} {...propsIcon} />;
@@ -60,14 +61,13 @@ function Report(props) {
60
61
  ...testProps('excelBtn'),
61
62
  key: 'excelBtn',
62
63
  text: 'Download Excel',
63
- leftIcon: <Icon as={Excel} size="md" className="text-white" />,
64
+ icon: Excel,
64
65
  onPress: (data) => getReport({
65
66
  reportId,
66
67
  data,
67
68
  reportType: REPORT_TYPES__EXCEL,
68
69
  showReportHeaders,
69
70
  }),
70
- ml: 1,
71
71
  });
72
72
  }
73
73
  if (!disablePdf) {
@@ -75,22 +75,30 @@ function Report(props) {
75
75
  ...testProps('pdfBtn'),
76
76
  key: 'pdfBtn',
77
77
  text: 'Download PDF',
78
- leftIcon: <Icon as={Pdf} size="md" className="text-white" />,
78
+ icon: Pdf,
79
79
  onPress: (data) => getReport({
80
80
  reportId,
81
81
  data,
82
82
  reportType: REPORT_TYPES__PDF,
83
83
  showReportHeaders,
84
84
  }),
85
- ml: 1,
86
85
  });
87
86
  }
88
- return <VStack
87
+ return <VStackNative
89
88
  {...testProps('Report-' + reportId)}
90
- className="w-full border border-primary-300 pt-4 mb-3"
89
+ className={`
90
+ w-full
91
+ border
92
+ border-primary-300
93
+ p-4
94
+ mb-3
95
+ rounded-lg
96
+ `}
91
97
  >
92
98
  <HStack>
93
- {icon && <VStack>{icon}</VStack>}
99
+ <Box className="w-[50px] mr-4">
100
+ {icon}
101
+ </Box>
94
102
  <VStack className="flex-1">
95
103
  <Text className="text-2xl max-w-full">{title}</Text>
96
104
  <Text className="text-sm">{description}</Text>
@@ -101,7 +109,7 @@ function Report(props) {
101
109
  additionalFooterButtons={buttons}
102
110
  {...props._form}
103
111
  />
104
- </VStack>;
112
+ </VStackNative>;
105
113
  }
106
114
 
107
115
  export default withComponent(Report);
@@ -362,14 +362,17 @@ function Viewer(props) {
362
362
  canEdit = false;
363
363
  }
364
364
 
365
- let className = 'Viewer-VStackNative';
365
+ let className = `
366
+ Viewer-VStackNative
367
+ h-full
368
+ bg-white
369
+ `;
366
370
  if (props.className) {
367
371
  className += ' ' + props.className;
368
372
  }
369
373
 
370
374
  return <VStackNative
371
375
  {...testProps(self)}
372
- {...props}
373
376
  className={className}
374
377
  onLayout={onLayout}
375
378
  >
@@ -379,9 +382,10 @@ function Viewer(props) {
379
382
  _web={{ height: 1 }}
380
383
  ref={scrollViewRef}
381
384
  className={`
382
- ScrollView
385
+ Viewer-ScrollView
383
386
  w-full
384
387
  pb-1
388
+ flex-1
385
389
  `}
386
390
  >
387
391
  {canEdit && onEditMode &&
@@ -282,7 +282,11 @@ function AttachmentsElement(props) {
282
282
  if (canCrud) {
283
283
  _fileMosaic.onDelete = onFileDelete;
284
284
  }
285
- let content = <VStack background={styles.ATTACHMENTS_BG} className="w-[100%] p-1">
285
+ let className = 'w-full p-1 bg-white rounded-[5px]';
286
+ if (props.className) {
287
+ className += ' ' + props.className;
288
+ }
289
+ let content = <VStack className={className}>
286
290
  <HStack className="flex-wrap">
287
291
  {files.map((file) => {
288
292
  return <Box