stratosphere-ui 0.2.0 → 0.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.
@@ -1,3 +1,7 @@
1
1
  export type GenericDataType = {
2
2
  id: string | number;
3
3
  } & Record<string, unknown>;
4
+ export interface Transform<TOutput> {
5
+ output: (val: string) => TOutput | undefined;
6
+ input: (val: TOutput) => string;
7
+ }
@@ -1,7 +1,8 @@
1
1
  import { ReactNode, RefObject } from 'react';
2
2
  import { InputProps } from 'react-daisyui';
3
3
  import { FieldValues } from 'react-hook-form';
4
- import { FormFieldProps, Transform } from './types';
4
+ import { FormFieldProps } from './types';
5
+ import { Transform } from '../../common';
5
6
  export interface FormControlProps<Values extends FieldValues, TOutput> extends FormFieldProps<Values>, Omit<InputProps, 'name'> {
6
7
  elementLeft?: ReactNode;
7
8
  elementRight?: ReactNode;
@@ -16,7 +16,3 @@ export interface ComboboxProps<DataItem extends GenericDataType, Values extends
16
16
  setShowDropdown: Dispatch<SetStateAction<boolean>>;
17
17
  setSelectedItems: Dispatch<SetStateAction<DataItem[]>>;
18
18
  }
19
- export interface Transform<TOutput> {
20
- output: (val: string) => TOutput | null;
21
- input: (val: TOutput) => string;
22
- }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './common';
2
2
  export * from './components';
3
3
  export * from './hooks';
4
+ export * from './utils';
@@ -26940,7 +26940,7 @@ const jP = ({
26940
26940
  name: R,
26941
26941
  onChange: ({ target: { value: ee } }) => {
26942
26942
  const oe = N === void 0 ? ee : N.output(ee);
26943
- oe !== null && $(R, oe, {
26943
+ oe !== void 0 && $(R, oe, {
26944
26944
  shouldDirty: !0,
26945
26945
  shouldTouch: !0
26946
26946
  });
@@ -30112,6 +30112,15 @@ const FI = My, zI = ({
30112
30112
  ]
30113
30113
  }
30114
30114
  );
30115
+ }, l3 = {
30116
+ input: (r) => r !== null ? r.toString() : "",
30117
+ output: (r) => {
30118
+ const s = parseInt(r);
30119
+ return Number.isNaN(s) ? null : s;
30120
+ }
30121
+ }, i3 = {
30122
+ input: (r) => r ?? "",
30123
+ output: (r) => r.length > 0 ? r : null
30115
30124
  };
30116
30125
  export {
30117
30126
  YI as AlertMessages,
@@ -30148,6 +30157,8 @@ export {
30148
30157
  r3 as Tabs,
30149
30158
  a3 as TypeaheadSelect,
30150
30159
  U$ as WarningIcon,
30160
+ l3 as integerInputTransformer,
30161
+ i3 as nullEmptyStringTransformer,
30151
30162
  D$ as useAlertMessages,
30152
30163
  UP as useDebouncedValue,
30153
30164
  Nm as useFieldColor,
@@ -0,0 +1 @@
1
+ export * from './transformers';
@@ -0,0 +1,3 @@
1
+ import { Transform } from '../common/types';
2
+ export declare const integerInputTransformer: Transform<number | null>;
3
+ export declare const nullEmptyStringTransformer: Transform<string | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stratosphere-ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "React component library for all Stratosphere Labs user interfaces",
5
5
  "type": "module",
6
6
  "files": [