@loadsmart/loadsmart-ui 7.1.0 → 7.2.1

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": "@loadsmart/loadsmart-ui",
3
- "version": "7.1.0",
3
+ "version": "7.2.1",
4
4
  "description": "Miranda UI, a React UI library",
5
5
  "main": "dist",
6
6
  "files": [
@@ -114,6 +114,12 @@ describe('DateFormatHelper', () => {
114
114
  DateFormatHelper('MM/DD/YYYY HH:mm:ss').format(DateHelper('2022-02-01T12:00:00.000Z'))
115
115
  ).toBe('02/01/2022 12:00:00')
116
116
 
117
+ expect(
118
+ DateFormatHelper('MM/DD/YYYY HH:mm:ss').format(
119
+ DateHelper('2022-02-01T00:00:00.000Z', { normalize: false })
120
+ )
121
+ ).toBe('02/01/2022 00:00:00')
122
+
117
123
  expect(
118
124
  DateFormatHelper('MM/DD/YYYY, hh:mm A').format(
119
125
  DateHelper('2022-02-01T10:30:00.000Z', { normalize: false })
@@ -144,7 +144,7 @@ const DEFAULT_FORMATTERS: Record<string, Intl.DateTimeFormat> = {
144
144
  }),
145
145
  HH: new Intl.DateTimeFormat('en-US', {
146
146
  hour: '2-digit',
147
- hour12: false,
147
+ hourCycle: 'h23',
148
148
  }),
149
149
  hh: new Intl.DateTimeFormat('en-US', {
150
150
  hour: '2-digit',
@@ -32,6 +32,22 @@ describe('Select', () => {
32
32
  screen.getByTestId('select-trigger-search-field')
33
33
  })
34
34
 
35
+ it('transfer additional input props to SelectTrigger', () => {
36
+ const props: Partial<SelectProps> = {
37
+ getInputProps: () => ({
38
+ minLength: 11,
39
+ maxLength: 33,
40
+ }),
41
+ }
42
+
43
+ setup({ ...props })
44
+
45
+ const searchInput = screen.getByTestId('select-trigger-search-field')
46
+
47
+ expect(searchInput).toHaveAttribute('minlength', '11')
48
+ expect(searchInput).toHaveAttribute('maxlength', '33')
49
+ })
50
+
35
51
  describe('when disabled', () => {
36
52
  it('does not expand with the available options when search input is clicked', () => {
37
53
  setup({ disabled: true })
@@ -87,6 +87,7 @@ export interface SelectProps extends DropdownProps {
87
87
  onChange?: OnChange
88
88
  onCreate?: OnCreate
89
89
  onQueryChange?: OnQueryChange
90
+ getInputProps?: () => Partial<TextFieldProps>
90
91
  isValidNewOption?: ((query: string) => boolean) | boolean
91
92
  createOptionPosition?: CreateOptionPosition
92
93
  /**
@@ -61,8 +61,8 @@ const SelectTrigger = forwardRef<HTMLInputElement, SelectTriggerProps>(function
61
61
  return (
62
62
  <GenericSelectTrigger className={className}>
63
63
  <SelectTriggerSearchField
64
- data-testid="select-trigger-search-field"
65
64
  {...others}
65
+ data-testid="select-trigger-search-field"
66
66
  ref={(node) => {
67
67
  if (isFunction(ref)) {
68
68
  ref(node)
@@ -220,6 +220,7 @@ function useSelect(props: SelectProps): useSelectReturn {
220
220
  onQueryChange,
221
221
  onChange,
222
222
  onCreate,
223
+ getInputProps,
223
224
  id,
224
225
  name,
225
226
  disabled = false,
@@ -348,6 +349,7 @@ function useSelect(props: SelectProps): useSelectReturn {
348
349
  const getTriggerProps = useCallback(
349
350
  function getTriggerProps() {
350
351
  return {
352
+ ...getInputProps?.(),
351
353
  id,
352
354
  ref(node: HTMLInputElement | null) {
353
355
  if (node != null) {