@thx/controls 14.0.4 → 15.0.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.
Files changed (48) hide show
  1. package/dist/date/DatePicker/datepicker.stories.d.ts +7 -0
  2. package/dist/date/LocalDatePicker/MaskedDateInput.d.ts +7 -6
  3. package/dist/date/LocalDatePicker/localdatepicker.stories.d.ts +8 -0
  4. package/dist/date/LocalDatePicker/maskeddateinput.stories.d.ts +5 -0
  5. package/dist/date/LocalMonthSelect/localmonthselect.stories.d.ts +6 -0
  6. package/dist/date/LocalTimePicker/MaskedTimeInput.d.ts +7 -6
  7. package/dist/date/LocalTimePicker/localtimepicker.stories.d.ts +7 -0
  8. package/dist/date/LocalTimePicker/maskedtimeinput.stories.d.ts +7 -0
  9. package/dist/date/MonthDayPicker/monthdaypicker.stories.d.ts +7 -0
  10. package/dist/date/MonthYearPicker/monthyearpicker.stories.d.ts +8 -0
  11. package/dist/date/YearSelect/yearselect.stories.d.ts +7 -0
  12. package/dist/form/TForm/addeditforms.stories.d.ts +30 -0
  13. package/dist/form/TForm/tform.stories.d.ts +7 -0
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +1241 -654
  16. package/dist/index.min.js +1 -1
  17. package/dist/index.min.js.map +1 -1
  18. package/dist/inputs/CreditCardInput/CreditCardInput.d.ts +14 -5
  19. package/dist/inputs/CreditCardInput/CreditCardNumberInput.d.ts +8 -0
  20. package/dist/inputs/CreditCardInput/creditcardinput.stories.d.ts +5 -0
  21. package/dist/inputs/CreditCardInput/index.d.ts +1 -1
  22. package/dist/inputs/MaskedInput/MaskedInput.d.ts +4 -11
  23. package/dist/inputs/MaskedInput/index.d.ts +1 -0
  24. package/dist/inputs/MaskedInput/maskedinput.stories.d.ts +6 -0
  25. package/dist/inputs/MaskedInput/useMaskedInput.d.ts +9 -0
  26. package/dist/inputs/PhoneInput/PhoneInput.d.ts +2 -1
  27. package/dist/inputs/PhoneInput/phoneinput.stories.d.ts +5 -0
  28. package/dist/inputs/RadioGroup/radiogroup.stories.d.ts +6 -0
  29. package/dist/inputs/Scriptel/withScriptel.d.ts +0 -1
  30. package/dist/inputs/ScriptelInput/scriptelnput.stories.d.ts +5 -0
  31. package/dist/inputs/SinInput/SinInput.d.ts +5 -4
  32. package/dist/inputs/SinInput/sininput.stories.d.ts +5 -0
  33. package/dist/inputs/TableInput/DropdownCell.d.ts +0 -1
  34. package/dist/inputs/TableInput/HoverCell.d.ts +0 -1
  35. package/dist/inputs/TableInput/MoneyCell.d.ts +0 -1
  36. package/dist/inputs/TableInput/MoneyEditCell.d.ts +0 -1
  37. package/dist/inputs/TableInput/MoneySumFooter.d.ts +0 -1
  38. package/dist/inputs/TableInput/StringEditCell.d.ts +0 -1
  39. package/dist/inputs/TableInput/main.story.d.ts +7 -0
  40. package/dist/inputs/TableInput/tableinput.stories.d.ts +6 -0
  41. package/dist/inputs/TableInput/withHover.story.d.ts +7 -0
  42. package/dist/money/MoneyCurrencyInput/MoneyCurrencyInput.d.ts +1 -1
  43. package/dist/money/MoneyCurrencyInput/moneycurrencyinput.stories.d.ts +5 -0
  44. package/dist/money/MoneyInput/MoneyInput.d.ts +3 -4
  45. package/dist/money/MoneyInput/moneyinput.stories.d.ts +6 -0
  46. package/dist/money/useMoneyInput.d.ts +6 -8
  47. package/package.json +32 -42
  48. package/dist/form/TForm/TFormInner.d.ts +0 -33
@@ -1,7 +1,16 @@
1
1
  /// <reference types="react" />
2
- import { CreditCardCardNameEnum } from '@thx/yup-types';
3
- import { MaskedInputProps } from '../MaskedInput';
4
- export interface CreditCardInputType {
5
- cardType?: (cardType: CreditCardCardNameEnum | undefined) => void;
2
+ import type { LocalDate } from '@js-joda/core';
3
+ import 'react-credit-cards/es/styles-compiled.css';
4
+ import { InputProps } from 'semantic-ui-react';
5
+ import './styles.css';
6
+ export interface CreditCardData {
7
+ number?: string;
8
+ name?: string;
9
+ cvc?: string;
10
+ expiry?: LocalDate;
6
11
  }
7
- export declare function CreditCardInput({ cardType, ...rest }: CreditCardInputType & Omit<MaskedInputProps, 'mask'>): JSX.Element;
12
+ export declare type CreditCardInputProps = {
13
+ value?: CreditCardData;
14
+ onChange?: (data: CreditCardData) => void;
15
+ } & Pick<InputProps, 'disabled' | 'onBlur'>;
16
+ export declare function CreditCardInput(props: CreditCardInputProps): JSX.Element;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { InputProps } from 'semantic-ui-react';
3
+ interface CreditCardNumberInputProps {
4
+ onChange?: (value: string | undefined) => void;
5
+ value?: string;
6
+ }
7
+ export declare function CreditCardNumberInput(props: CreditCardNumberInputProps & Omit<InputProps, 'onChange'>): JSX.Element;
8
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { ComponentStory, Meta } from '@storybook/react';
2
+ import { CreditCardInput } from './CreditCardInput';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const Main: ComponentStory<typeof CreditCardInput>;
@@ -1,2 +1,2 @@
1
1
  export { CreditCardInput } from './CreditCardInput';
2
- export type { CreditCardInputType } from './CreditCardInput';
2
+ export type { CreditCardInputProps } from './CreditCardInput';
@@ -1,15 +1,8 @@
1
1
  /// <reference types="react" />
2
- import Inputmask from 'inputmask';
3
2
  import { InputProps } from 'semantic-ui-react';
4
- /**
5
- * See source code for detailed prop types or {@link https://github.com/RobinHerbots/jquery.inputmask|here} for more info.
6
- * @typedef {Object} inputmaskPropTypes
7
- */
8
- export interface MaskedInputProps {
3
+ import { UseMaskedInputProps } from './useMaskedInput';
4
+ export declare type MaskedInputProps = {
9
5
  name?: string;
10
- value?: string;
11
- onChange?: (value?: string) => void;
12
6
  onBlur?: (event: any) => void;
13
- mask?: Inputmask.Options;
14
- }
15
- export declare function MaskedInput(props: MaskedInputProps & Omit<InputProps, 'onChange'>): JSX.Element;
7
+ } & UseMaskedInputProps & Omit<InputProps, 'onChange'>;
8
+ export declare function MaskedInput(props: MaskedInputProps): JSX.Element;
@@ -1,2 +1,3 @@
1
1
  export { MaskedInput } from './MaskedInput';
2
+ export { useMaskedInput } from './useMaskedInput';
2
3
  export type { MaskedInputProps } from './MaskedInput';
@@ -0,0 +1,6 @@
1
+ import type { ComponentStory, Meta } from '@storybook/react';
2
+ import { MaskedInput } from './MaskedInput';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const Main: ComponentStory<typeof MaskedInput>;
6
+ export declare const AutoUnmask: ComponentStory<typeof MaskedInput>;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import Inputmask from 'inputmask';
3
+ export interface UseMaskedInputProps {
4
+ value?: string;
5
+ onChange?: (value?: string) => void;
6
+ mask?: Inputmask.Options;
7
+ onSet?: (value?: string) => void;
8
+ }
9
+ export declare function useMaskedInput(props: UseMaskedInputProps): import("react").MutableRefObject<HTMLInputElement | null>;
@@ -2,5 +2,6 @@
2
2
  import { MaskedInputProps } from '../MaskedInput';
3
3
  export interface PhoneInputProps {
4
4
  extension?: boolean;
5
+ onChange?: (value?: string) => void;
5
6
  }
6
- export declare function PhoneInput(props: PhoneInputProps & Omit<MaskedInputProps, 'mask'>): JSX.Element;
7
+ export declare function PhoneInput(props: PhoneInputProps & Omit<MaskedInputProps, 'mask' | 'onChange'>): JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { ComponentStory, Meta } from '@storybook/react';
2
+ import { PhoneInput } from './PhoneInput';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const Main: ComponentStory<typeof PhoneInput>;
@@ -0,0 +1,6 @@
1
+ import type { ComponentStory, Meta } from '@storybook/react';
2
+ import { RadioGroup } from './RadioGroup';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const Main: ComponentStory<typeof RadioGroup>;
6
+ export declare const WithoutRadioGroup: ComponentStory<typeof RadioGroup>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ScriptelProps } from './Scriptel';
3
2
  /**
4
3
  * A HoC that provides a connection to a Scriptel Omniscript device.
@@ -0,0 +1,5 @@
1
+ import type { ComponentStory, Meta } from '@storybook/react';
2
+ import { ScriptelInput } from './ScriptelInput';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const Main: ComponentStory<typeof ScriptelInput>;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { MaskedInputProps } from '../MaskedInput';
3
- export interface SinInputProps {
4
- hasSin: boolean;
2
+ import type { MaskedInputProps } from '../MaskedInput';
3
+ export interface SinInputProps extends Omit<MaskedInputProps, 'mask'> {
4
+ value?: string;
5
+ onChange(value?: string): void;
5
6
  }
6
- export declare function SinInput(props: SinInputProps & Omit<MaskedInputProps, 'mask' | 'name'>): JSX.Element;
7
+ export declare function SinInput(props: SinInputProps): JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { ComponentStory, Meta } from '@storybook/react';
2
+ import { SinInput } from './SinInput';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const Main: ComponentStory<typeof SinInput>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DropdownProps } from 'semantic-ui-react';
3
2
  import type { TableCellProps } from './TableInput';
4
3
  export declare function DropdownCell<D extends Record<string, unknown>>(dropdownProps: DropdownProps): (props: TableCellProps<D>) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { CellProps, Renderer } from 'react-table';
3
2
  interface HoverCellOptions<D extends Record<string, unknown>> {
4
3
  Action: Renderer<CellProps<D>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type Money from 'js-money';
3
2
  import type { CellProps } from 'react-table';
4
3
  interface MoneyCellOptions<D extends Record<string, unknown>> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type Money from 'js-money';
3
2
  import type { TableCellProps } from './TableInput';
4
3
  import type { AddRowOnTabIf } from './addRowOnTab';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { IdType, TableInstance } from 'react-table';
3
2
  interface MoneySumFooterOptions<A extends Record<string, unknown>> {
4
3
  id: IdType<A>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { InputProps } from 'semantic-ui-react';
3
2
  import type { TableCellProps } from './TableInput';
4
3
  import type { AddRowOnTabIf } from './addRowOnTab';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const Main: {
3
+ (): JSX.Element;
4
+ args: {
5
+ value: undefined;
6
+ };
7
+ };
@@ -0,0 +1,6 @@
1
+ export { Main } from './main.story';
2
+ export { WithHover } from './withHover.story';
3
+ declare const _default: {
4
+ title: string;
5
+ };
6
+ export default _default;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const WithHover: {
3
+ (): JSX.Element;
4
+ args: {
5
+ value: undefined;
6
+ };
7
+ };
@@ -2,7 +2,7 @@
2
2
  import { InputProps } from 'semantic-ui-react';
3
3
  import type { MoneyInputProps } from '../MoneyInput';
4
4
  export interface MoneyCurrencyInputProps extends MoneyInputProps {
5
- currencyOptions?: {
5
+ currencies?: {
6
6
  key: string;
7
7
  value: string;
8
8
  text: string;
@@ -0,0 +1,5 @@
1
+ import type { ComponentStory, Meta } from '@storybook/react';
2
+ import { MoneyCurrencyInput } from './MoneyCurrencyInput';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const Main: ComponentStory<typeof MoneyCurrencyInput>;
@@ -1,12 +1,11 @@
1
1
  /// <reference types="react" />
2
- import type { Currencies, IMoneyObject } from '@thx/money';
3
- import type Money from 'js-money';
2
+ import Money, { Currency, MoneyObject } from 'js-money';
4
3
  import { InputProps } from 'semantic-ui-react';
5
4
  export interface MoneyInputProps {
6
5
  name?: string;
7
6
  onChange?: (value: Money) => void;
8
- value?: Money | IMoneyObject;
9
- defaultCurrency?: Currencies.Currency;
7
+ value?: Money | MoneyObject;
8
+ defaultCurrency?: Currency;
10
9
  onBlur?: (ev: any) => void;
11
10
  prefix?: string;
12
11
  showPrefix?: boolean;
@@ -0,0 +1,6 @@
1
+ import type { ComponentStory, Meta } from '@storybook/react';
2
+ import { MoneyInput } from './MoneyInput';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const Main: ComponentStory<typeof MoneyInput>;
6
+ export declare const MoreDecimals: ComponentStory<typeof MoneyInput>;
@@ -1,15 +1,13 @@
1
- /// <reference types="react" />
2
- import { Currencies, IMoneyObject } from '@thx/money';
3
1
  import Money from 'js-money';
2
+ import { MutableRefObject } from 'react';
4
3
  interface UseMoneyInputProps {
5
- onChange?: (value: Money) => void;
6
- value?: Money | IMoneyObject;
7
- defaultCurrency?: Currencies.Currency;
4
+ value?: Money;
5
+ onChange?: (value?: Money) => void;
6
+ onSet?: (value?: Money) => void;
8
7
  prefix?: string;
9
8
  showPrefix?: boolean;
10
9
  wholeNumber?: boolean;
11
10
  }
12
- export declare function useMoneyInput(props: UseMoneyInputProps): {
13
- inputElement: import("react").MutableRefObject<HTMLInputElement | null>;
14
- };
11
+ declare type SetValueFn = (value?: Money) => void;
12
+ export declare function useMoneyInput(props: UseMoneyInputProps): [MutableRefObject<HTMLInputElement | null>, SetValueFn];
15
13
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thx/controls",
3
- "version": "14.0.4",
3
+ "version": "15.0.0",
4
4
  "description": "A collection of components designed with SemanticUI.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/thr-consulting/thr-addons/issues"
@@ -18,70 +18,60 @@
18
18
  "index.js"
19
19
  ],
20
20
  "scripts": {
21
- "Xtest": "jest",
22
- "Xtest:coverage": "../../tools/coverage.sh",
23
- "Xtest:watch": "jest --watch",
24
- "build": "yarn build:dev && yarn build:prod",
25
- "build:dev": "NODE_ENV=development webpack --config webpack.js",
26
- "build:prod": "NODE_ENV=production webpack --config webpack.js",
27
- "lint": "eslint --cache --ext js,ts src",
28
- "lint:fix": "eslint --cache --fix --ext js,ts src",
29
- "sort": "npx sort-package-json",
30
- "depcheck": "depcheck",
21
+ "build": "thx build",
22
+ "build-storybook": "build-storybook",
23
+ "build:dev": "thx build:dev",
24
+ "build:prod": "thx build:prod",
25
+ "clean": "thx clean",
26
+ "deps": "thx -p *.stories.tsx,*.story.tsx -i style-loader,css-loader deps",
27
+ "lint": "thx lint",
28
+ "lint:fix": "thx lint:fix",
29
+ "sort": "thx sort",
31
30
  "storybook": "start-storybook -p 8000 --ci",
32
- "ts": "tsc"
31
+ "ts": "thx ts"
33
32
  },
34
33
  "eslintConfig": {
35
34
  "parserOptions": {
36
35
  "project": "./tsconfig-eslint.json"
37
36
  }
38
37
  },
39
- "jest": {
40
- "collectCoverageFrom": [
41
- "<rootDir>/src/**/*.js",
42
- "<rootDir>/src/**/*.ts"
43
- ],
44
- "coverageDirectory": "<rootDir>/../../docs/assets/coverage/controls",
45
- "testPathIgnorePatterns": [
46
- "/node_modules/"
47
- ],
48
- "transform": {
49
- "^.+\\.[tj]sx?$": "<rootDir>/../../tools/jest-transform-server.js"
50
- }
51
- },
52
38
  "dependencies": {
53
- "@js-joda/core": "^3.0.0",
54
- "@thx/date": "^14.0.0",
55
- "@thx/money": "^14.0.0",
56
- "@thx/yup-types": "^14.0.0",
57
- "@types/inputmask": "^5.0.0",
58
- "@types/react-datepicker": "^3.1.1",
39
+ "@js-joda/core": "^4.0.0",
40
+ "@thx/date": "^15.0.0",
41
+ "@thx/money": "^15.0.0",
42
+ "@thx/yup-types": "^15.0.0",
43
+ "@types/inputmask": "^5.0.1",
44
+ "@types/react-datepicker": "^4.1.7",
45
+ "credit-card-type": "^9.1.0",
59
46
  "debug": "^4.1.1",
60
47
  "eventemitter3": "^4.0.0",
61
48
  "flat": "^5.0.0",
62
- "formik": "^2.1.4",
63
- "inputmask": "^5.0.5",
49
+ "formik": "^2.2.9",
50
+ "inputmask": "^5.0.6",
64
51
  "js-money": "^0.6.3",
65
52
  "lodash": "^4.17.15",
66
- "react-datepicker": "^3.1.3",
53
+ "luhn": "^2.4.1",
54
+ "react-credit-cards": "^0.8.3",
55
+ "react-datepicker": "^4.2.1",
67
56
  "react-table": "^7.6.3",
68
- "use-deep-compare-effect": "^1.3.1"
57
+ "social-insurance-number": "^0.2.2",
58
+ "use-deep-compare-effect": "1.4.0"
69
59
  },
70
60
  "devDependencies": {
71
- "css-loader": "^5.0.0",
72
- "style-loader": "^2.0.0"
61
+ "css-loader": "^6.3.0",
62
+ "style-loader": "^3.3.0"
73
63
  },
74
64
  "peerDependencies": {
75
- "react": "16.x || 17.x",
76
- "react-dom": "16.x || 17.x",
65
+ "react": "17.x",
66
+ "react-dom": "17.x",
77
67
  "react-router-dom": "5.x",
78
- "semantic-ui-react": "1.x || 2.x"
68
+ "semantic-ui-react": "2.x"
79
69
  },
80
70
  "engines": {
81
- "node": ">=12"
71
+ "node": ">=14"
82
72
  },
83
73
  "publishConfig": {
84
74
  "access": "public"
85
75
  },
86
- "gitHead": "0133db02f7b73a1656e4026c51ee1fea15f76430"
76
+ "gitHead": "6e448208ce9112a61ee68c5daffbf7d59615cf41"
87
77
  }
@@ -1,33 +0,0 @@
1
- import type { FormikProps } from 'formik';
2
- import React from 'react';
3
- export interface TFormChildrenProps<Values> extends FormikProps<Values> {
4
- renderWarnings: () => JSX.Element | null;
5
- hasErrors: boolean;
6
- hasWarnings: boolean;
7
- fieldError: (fieldName: keyof Values | string | number) => boolean;
8
- loading?: boolean;
9
- errorMarkedCleared: boolean;
10
- submitDisabled: boolean;
11
- formError: boolean;
12
- }
13
- interface ApolloError {
14
- message?: string;
15
- graphQLErrors?: {
16
- message?: string;
17
- }[];
18
- }
19
- export interface TFormProps<Values> {
20
- children?: ((props: TFormChildrenProps<Values>) => React.ReactNode) | React.ReactNode;
21
- loading?: boolean;
22
- error?: ApolloError;
23
- onValidate?: (isValid: boolean) => void;
24
- getSubmitFn?: (submitFormFn: () => Promise<void> | Promise<any>) => void;
25
- onChange?: (values: Values) => void;
26
- }
27
- interface TFormInnerProps<Values> {
28
- formikProps: FormikProps<Values>;
29
- tFormProps: TFormProps<Values>;
30
- children?: ((props: TFormChildrenProps<Values>) => React.ReactNode) | React.ReactNode;
31
- }
32
- export declare function TFormInner<Values>(props: TFormInnerProps<Values>): JSX.Element | null;
33
- export {};