@thx/controls 16.6.2-alpha.0 → 16.6.2-alpha.4

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.
@@ -22,7 +22,6 @@ function LocalDatePicker(props) {
22
22
  fluid,
23
23
  focus,
24
24
  icon = true,
25
- iconPosition,
26
25
  inverted,
27
26
  label,
28
27
  labelPosition,
@@ -69,8 +68,7 @@ function LocalDatePicker(props) {
69
68
  inverted,
70
69
  loading,
71
70
  size,
72
- transparent,
73
- iconPosition
71
+ transparent
74
72
  };
75
73
  const [isOpen, setIsOpen] = useState(false);
76
74
  const [selected, setSelected] = useState(value ? toDate(value) : null);
@@ -78,15 +76,21 @@ function LocalDatePicker(props) {
78
76
  setSelected(value ? toDate(value) : null);
79
77
  }, [value]);
80
78
  const handleDateChange = (date) => {
81
- setSelected(date);
82
- onChange && onChange(date ? toLocalDate(date) : null);
79
+ let allowedDate = toLocalDate(date);
80
+ if (minDate?.isAfter(allowedDate)) {
81
+ allowedDate = minDate;
82
+ }
83
+ if (maxDate?.isBefore(allowedDate)) {
84
+ allowedDate = maxDate;
85
+ }
86
+ setSelected(toDate(allowedDate));
87
+ onChange && onChange(date ? allowedDate : null);
83
88
  setIsOpen(false);
84
89
  };
85
90
  const handleInputChange = (e) => {
86
91
  const inputValue = e.target.value;
87
92
  const date = inputValue ? toDate(inputValue) : null;
88
- setSelected(date);
89
- onChange && onChange(date ? toLocalDate(date) : null);
93
+ date && handleDateChange(date);
90
94
  };
91
95
  const handleDatePickerBlur = (e) => {
92
96
  setIsOpen(false);
@@ -123,7 +127,8 @@ function LocalDatePicker(props) {
123
127
  open: isOpen,
124
128
  enableTabLoop: openOnFocus,
125
129
  preventOpenOnFocus: openOnFocus,
126
- onBlur: handleDatePickerBlur
130
+ onBlur: handleDatePickerBlur,
131
+ onClickOutside: () => setIsOpen(false)
127
132
  });
128
133
  }
129
134
 
@@ -1 +1 @@
1
- {"version":3,"file":"LocalDatePicker.js","sources":["../../../../src/date/LocalDatePicker/LocalDatePicker.tsx"],"sourcesContent":["import type {LocalDate} from '@js-joda/core';\nimport {toDate, toLocalDate} from '@thx/date';\nimport debug from 'debug';\nimport {useEffect, useState} from 'react';\nimport type {ReactDatePickerProps} from 'react-datepicker';\nimport {Icon, Input, InputProps} from 'semantic-ui-react';\nimport {DatePicker} from '../DatePicker/index';\nimport '../DatePicker/styles.css';\nimport {MaskedDateInput} from './MaskedDateInput';\n\nconst d = debug('thx.controls.date.LocalDatePicker');\n\ninterface ILocalDatePicker {\n\tvalue?: LocalDate | number | null;\n\tonChange?: (value: LocalDate | null) => void;\n\tonChangeRaw?: () => void;\n\tminDate?: LocalDate;\n\tmaxDate?: LocalDate;\n\ticon?: boolean;\n\topenOnFocus?: boolean;\n}\n\ntype InputPropsOmitted = Omit<InputProps, 'onChange'>;\ntype ReactDatePickerPropsOmitted = Omit<Omit<ReactDatePickerProps, 'value'>, 'onChange' | 'minDate' | 'maxDate'>;\nexport type LocalDatePickerProps = ILocalDatePicker & InputPropsOmitted & ReactDatePickerPropsOmitted;\n\nexport function LocalDatePicker(props: LocalDatePickerProps): JSX.Element {\n\tconst {\n\t\tminDate,\n\t\tmaxDate,\n\t\tvalue,\n\t\tonChange,\n\t\tonBlur,\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\terror,\n\t\tfluid,\n\t\tfocus,\n\t\ticon = true,\n\t\ticonPosition,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t\topenOnFocus = false,\n\t\t...rest\n\t} = props;\n\n\tconst inputProps = {\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName: `${className || ''} icon`,\n\t\terror,\n\t\tfocus,\n\t\tfluid,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t};\n\n\tconst maskedInputProps = {\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\terror,\n\t\tfocus,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t};\n\n\tconst iconProps = {\n\t\tclassName,\n\t\tinverted,\n\t\tloading,\n\t\tsize,\n\t\ttransparent,\n\t\ticonPosition,\n\t};\n\n\tconst [isOpen, setIsOpen] = useState(false);\n\tconst [selected, setSelected] = useState(value ? toDate(value) : null);\n\n\tuseEffect(() => {\n\t\tsetSelected(value ? toDate(value) : null);\n\t}, [value]);\n\n\tconst handleDateChange = (date: Date) => {\n\t\tsetSelected(date);\n\t\tonChange && onChange(date ? toLocalDate(date) : null);\n\t\tsetIsOpen(false);\n\t};\n\n\tconst handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n\t\tconst inputValue = e.target.value;\n\t\tconst date = inputValue ? toDate(inputValue) : null;\n\t\tsetSelected(date);\n\t\tonChange && onChange(date ? toLocalDate(date) : null);\n\t};\n\n\tconst handleDatePickerBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n\t\tsetIsOpen(false);\n\t\tonBlur && onBlur(e);\n\t};\n\n\tconst toggleDatePicker = () => {\n\t\tsetIsOpen(!isOpen);\n\t};\n\n\tconst handleOnKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t// toggle on enter\n\t\te?.key === 'Enter' && toggleDatePicker();\n\t\t// hide on escape\n\t\te?.key === 'Escape' && setIsOpen(false);\n\t};\n\n\treturn (\n\t\t<DatePicker\n\t\t\t{...rest}\n\t\t\tselected={selected}\n\t\t\tonChange={handleDateChange}\n\t\t\tcustomInput={\n\t\t\t\t<Input {...inputProps}>\n\t\t\t\t\t<MaskedDateInput\n\t\t\t\t\t\t{...maskedInputProps}\n\t\t\t\t\t\tvalue={selected ? toDate(selected) : ''}\n\t\t\t\t\t\tonChange={handleInputChange}\n\t\t\t\t\t\tonClick={({target}: {target: HTMLInputElement}) => (openOnFocus ? setIsOpen(!isOpen) : target.select())}\n\t\t\t\t\t\tonKeyDown={handleOnKeyDown}\n\t\t\t\t\t/>\n\t\t\t\t\t{icon && <Icon {...iconProps} onClick={toggleDatePicker} tabIndex={-1} name=\"calendar alternate\" link />}\n\t\t\t\t</Input>\n\t\t\t}\n\t\t\tminDate={minDate ? toDate(minDate) : null}\n\t\t\tmaxDate={maxDate ? toDate(maxDate) : null}\n\t\t\topen={isOpen}\n\t\t\tenableTabLoop={openOnFocus}\n\t\t\tpreventOpenOnFocus={openOnFocus}\n\t\t\tonBlur={handleDatePickerBlur}\n\t\t/>\n\t);\n}\n"],"names":[],"mappings":";;;;;;;;AAUU,MAAM,mCAAmC,EAAA;AAgB5C,SAAA,eAAA,CAAyB,KAA0C,EAAA;AACzE,EAAM,MAAA;AAAA,IACL,OAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,EAAA;AAAA,IACA,MAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAO,GAAA,IAAA;AAAA,IACP,YAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,IACA,aAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAc,GAAA,KAAA;AAAA,IACX,GAAA,IAAA;AAAA,GACA,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,UAAa,GAAA;AAAA,IAClB,EAAA;AAAA,IACA,MAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAA,EAAW,GAAG,SAAa,IAAA,EAAA,CAAA,KAAA,CAAA;AAAA,IAC3B,KAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,IACA,aAAA;AAA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ACZ,CAAA,EACC,wBAAS,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,MAAS,GAAA,SAAA;AAAA,MAAW,OAAS,EAAA,gBAAA;AAAA,MAAkB,QAAU,EAAA,CAAA,CAAA;AAAA,MAAI,IAAK,EAAA,oBAAA;AAAA,MAAqB,IAAI,EAAA,IAAA;AAAA,KAAC,CACvG,CAAA;AAAA,IAED,OAAS,EAAA,OAAA,GAAU,MAAO,CAAA,OAAO,CAAI,GAAA,IAAA;AAAA,IACrC,OAAS,EAAA,OAAA,GAAU,MAAO,CAAA,OAAO,CAAI,GAAA,IAAA;AAAA,IACrC,IAAM,EAAA,MAAA;AAAA,IACN,aAAe,EAAA,WAAA;AAAA,IACf,kBAAoB,EAAA,WAAA;AAAA,IACpB,MAAQ,EAAA,oBAAA;AAAA,GACT,CAAA,CAAA;AAEF;;;;"}
1
+ {"version":3,"file":"LocalDatePicker.js","sources":["../../../../src/date/LocalDatePicker/LocalDatePicker.tsx"],"sourcesContent":["import type {LocalDate} from '@js-joda/core';\nimport {toDate, toLocalDate} from '@thx/date';\nimport debug from 'debug';\nimport {useEffect, useState} from 'react';\nimport type {ReactDatePickerProps} from 'react-datepicker';\nimport {Icon, Input, InputProps} from 'semantic-ui-react';\nimport {DatePicker} from '../DatePicker/index';\nimport '../DatePicker/styles.css';\nimport {MaskedDateInput} from './MaskedDateInput';\n\nconst d = debug('thx.controls.date.LocalDatePicker');\n\ninterface ILocalDatePicker {\n\tvalue?: LocalDate | number | null;\n\tonChange?: (value: LocalDate | null) => void;\n\tonChangeRaw?: () => void;\n\tminDate?: LocalDate;\n\tmaxDate?: LocalDate;\n\ticon?: boolean;\n\topenOnFocus?: boolean;\n}\n\ntype InputPropsOmitted = Omit<InputProps, 'onChange'>;\ntype ReactDatePickerPropsOmitted = Omit<Omit<ReactDatePickerProps, 'value'>, 'onChange' | 'minDate' | 'maxDate'>;\nexport type LocalDatePickerProps = ILocalDatePicker & InputPropsOmitted & ReactDatePickerPropsOmitted;\n\nexport function LocalDatePicker(props: LocalDatePickerProps): JSX.Element {\n\tconst {\n\t\tminDate,\n\t\tmaxDate,\n\t\tvalue,\n\t\tonChange,\n\t\tonBlur,\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\terror,\n\t\tfluid,\n\t\tfocus,\n\t\ticon = true,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t\topenOnFocus = false,\n\t\t...rest\n\t} = props;\n\n\tconst inputProps = {\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName: `${className || ''} icon`,\n\t\terror,\n\t\tfocus,\n\t\tfluid,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t};\n\n\tconst maskedInputProps = {\n\t\tas,\n\t\taction,\n\t\tactionPosition,\n\t\tclassName,\n\t\terror,\n\t\tfocus,\n\t\tinverted,\n\t\tlabel,\n\t\tlabelPosition,\n\t\tloading,\n\t\tsize,\n\t\ttabIndex,\n\t\ttransparent,\n\t};\n\n\tconst iconProps = {\n\t\tclassName,\n\t\tinverted,\n\t\tloading,\n\t\tsize,\n\t\ttransparent,\n\t};\n\n\tconst [isOpen, setIsOpen] = useState(false);\n\tconst [selected, setSelected] = useState(value ? toDate(value) : null);\n\n\tuseEffect(() => {\n\t\tsetSelected(value ? toDate(value) : null);\n\t}, [value]);\n\n\tconst handleDateChange = (date: Date) => {\n\t\tlet allowedDate = toLocalDate(date);\n\n\t\tif (minDate?.isAfter(allowedDate)) {\n\t\t\tallowedDate = minDate;\n\t\t}\n\t\tif (maxDate?.isBefore(allowedDate)) {\n\t\t\tallowedDate = maxDate;\n\t\t}\n\t\tsetSelected(toDate(allowedDate));\n\t\tonChange && onChange(date ? allowedDate : null);\n\t\tsetIsOpen(false);\n\t};\n\n\tconst handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n\t\tconst inputValue = e.target.value;\n\t\tconst date = inputValue ? toDate(inputValue) : null;\n\n\t\tdate && handleDateChange(date);\n\t};\n\n\tconst handleDatePickerBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n\t\tsetIsOpen(false);\n\t\tonBlur && onBlur(e);\n\t};\n\n\tconst toggleDatePicker = () => {\n\t\tsetIsOpen(!isOpen);\n\t};\n\n\tconst handleOnKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t// toggle on enter\n\t\te?.key === 'Enter' && toggleDatePicker();\n\t\t// hide on escape\n\t\te?.key === 'Escape' && setIsOpen(false);\n\t};\n\n\treturn (\n\t\t<DatePicker\n\t\t\t{...rest}\n\t\t\tselected={selected}\n\t\t\tonChange={handleDateChange}\n\t\t\tcustomInput={\n\t\t\t\t<Input {...inputProps}>\n\t\t\t\t\t<MaskedDateInput\n\t\t\t\t\t\t{...maskedInputProps}\n\t\t\t\t\t\tvalue={selected ? toDate(selected) : ''}\n\t\t\t\t\t\tonChange={handleInputChange}\n\t\t\t\t\t\tonClick={({target}: {target: HTMLInputElement}) => (openOnFocus ? setIsOpen(!isOpen) : target.select())}\n\t\t\t\t\t\tonKeyDown={handleOnKeyDown}\n\t\t\t\t\t/>\n\t\t\t\t\t{icon && <Icon {...iconProps} onClick={toggleDatePicker} tabIndex={-1} name=\"calendar alternate\" link />}\n\t\t\t\t</Input>\n\t\t\t}\n\t\t\tminDate={minDate ? toDate(minDate) : null}\n\t\t\tmaxDate={maxDate ? toDate(maxDate) : null}\n\t\t\topen={isOpen}\n\t\t\tenableTabLoop={openOnFocus}\n\t\t\tpreventOpenOnFocus={openOnFocus}\n\t\t\tonBlur={handleDatePickerBlur}\n\t\t\tonClickOutside={() => setIsOpen(false)}\n\t\t/>\n\t);\n}\n"],"names":[],"mappings":";;;;;;;;AAUU,MAAM,mCAAmC,EAAA;AAgB5C,SAAA,eAAA,CAAyB,KAA0C,EAAA;AACzE,EAAM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O,CAAI,GAAA,IAAA;AAAA,IACrC,IAAM,EAAA,MAAA;AAAA,IACN,aAAe,EAAA,WAAA;AAAA,IACf,kBAAoB,EAAA,WAAA;AAAA,IACpB,MAAQ,EAAA,oBAAA;AAAA,IACR,cAAA,EAAgB,MAAM,SAAA,CAAU,KAAK,CAAA;AAAA,GACtC,CAAA,CAAA;AAEF;;;;"}
package/dist/esm/index.js CHANGED
@@ -26,7 +26,6 @@ export { StringEditCell } from './inputs/TableInput/StringEditCell.js';
26
26
  export { DropdownCell } from './inputs/TableInput/DropdownCell.js';
27
27
  export { HoverCell } from './inputs/TableInput/HoverCell.js';
28
28
  export { addRowOnTab } from './inputs/TableInput/addRowOnTab.js';
29
- export { useMoneyInput } from './money/useMoneyInput.js';
30
29
  export { MoneyInput } from './money/MoneyInput/MoneyInput.js';
31
30
  export { MoneyCurrencyInput } from './money/MoneyCurrencyInput/MoneyCurrencyInput.js';
32
31
  export { Step } from './step/Step.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,48 +1,56 @@
1
- import React, { useCallback } from 'react';
1
+ import React, { useState, useCallback, useEffect } from 'react';
2
2
  import { toMoney } from '@thx/money';
3
3
  import debug from 'debug';
4
4
  import Money from 'js-money';
5
- import { Input, Label, Dropdown } from 'semantic-ui-react';
6
- import { useMoneyInput } from '../useMoneyInput.js';
5
+ import { Input, Dropdown } from 'semantic-ui-react';
6
+ import CurrencyInput from 'react-currency-input-field';
7
7
 
8
8
  const d = debug("thx.controls.money.MoneyCurrencyInput");
9
9
  function MoneyCurrencyInput(props) {
10
10
  const { name, onBlur, prefix, defaultCurrency, onChange, showPrefix, value, wholeNumber, currencies, locked, lockCurrency, ...rest } = props;
11
+ const [localValue, setLocalValue] = useState("");
11
12
  const options = currencies || [
12
13
  { key: "CAD", text: "CAD", value: "CAD" },
13
14
  { key: "USD", text: "USD", value: "USD" }
14
15
  ];
16
+ const currencyCode = value?.currency || defaultCurrency?.code || "CAD";
15
17
  const handleChange = useCallback((v) => {
16
- if (v && onChange) {
17
- onChange && onChange(v);
18
+ if (onChange) {
19
+ setLocalValue(v);
20
+ onChange(toMoney(v || 0, defaultCurrency || "CAD"));
18
21
  }
19
- }, [onChange]);
20
- const val = !(value instanceof Money) && value !== void 0 ? toMoney(value) : value;
21
- const [inputElement] = useMoneyInput({ onChange: handleChange, prefix, showPrefix, value: val, wholeNumber });
22
+ }, [defaultCurrency, onChange]);
22
23
  const handleDropdownChange = useCallback((e, v) => {
23
24
  const newCurrencyCode = v.value;
24
25
  const newMoney = new Money(value?.amount || 0, newCurrencyCode);
25
26
  d("Change", value, newCurrencyCode, newMoney);
26
27
  onChange && onChange(newMoney);
27
28
  }, [onChange, value]);
28
- const currencyCode = value?.currency || defaultCurrency?.code || "CAD";
29
- d("Render", value, currencyCode);
29
+ useEffect(() => {
30
+ if (!localValue && value) {
31
+ setLocalValue(value?.toDecimal().toString());
32
+ }
33
+ }, [localValue, value]);
30
34
  return /* @__PURE__ */ React.createElement(Input, {
31
- ...rest,
32
- labelPosition: "right"
33
- }, /* @__PURE__ */ React.createElement("input", {
35
+ ...rest
36
+ }, /* @__PURE__ */ React.createElement(CurrencyInput, {
34
37
  name,
35
- ref: inputElement,
38
+ disabled: locked,
39
+ placeholder: "0.00",
40
+ decimalsLimit: wholeNumber ? -1 : 2,
41
+ prefix: showPrefix ? prefix || "$" : void 0,
42
+ onValueChange: handleChange,
43
+ style: { textAlign: "right" },
36
44
  onBlur,
37
- readOnly: locked
38
- }), /* @__PURE__ */ React.createElement(Label, {
39
- basic: true
40
- }, /* @__PURE__ */ React.createElement(Dropdown, {
45
+ value: localValue,
46
+ className: "ui right labeled input"
47
+ }), /* @__PURE__ */ React.createElement(Dropdown, {
41
48
  disabled: locked || lockCurrency,
42
49
  options,
43
50
  value: currencyCode,
44
- onChange: handleDropdownChange
45
- })));
51
+ onChange: handleDropdownChange,
52
+ className: "ui basic label dropdown"
53
+ }));
46
54
  }
47
55
 
48
56
  export { MoneyCurrencyInput };
@@ -1 +1 @@
1
- {"version":3,"file":"MoneyCurrencyInput.js","sources":["../../../../src/money/MoneyCurrencyInput/MoneyCurrencyInput.tsx"],"sourcesContent":["import {toMoney} from '@thx/money';\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport debug from 'debug';\nimport Money, {CurrencyString} from 'js-money';\nimport {SyntheticEvent, useCallback} from 'react';\nimport {Dropdown, DropdownProps, Input, InputProps, Label} from 'semantic-ui-react';\nimport type {MoneyInputProps} from '../MoneyInput';\nimport {useMoneyInput} from '../useMoneyInput';\n\nconst d = debug('thx.controls.money.MoneyCurrencyInput');\n\nexport interface MoneyCurrencyInputProps extends MoneyInputProps {\n\tcurrencies?: {key: string; value: string; text: string}[];\n\tlockCurrency?: boolean;\n}\n\nexport function MoneyCurrencyInput(props: MoneyCurrencyInputProps & Omit<InputProps, 'onChange'>) {\n\tconst {name, onBlur, prefix, defaultCurrency, onChange, showPrefix, value, wholeNumber, currencies, locked, lockCurrency, ...rest} = props;\n\n\tconst options = currencies || [\n\t\t{key: 'CAD', text: 'CAD', value: 'CAD'},\n\t\t{key: 'USD', text: 'USD', value: 'USD'},\n\t];\n\n\tconst handleChange = useCallback(\n\t\t(v?: Money) => {\n\t\t\tif (v && onChange) {\n\t\t\t\tonChange && onChange(v);\n\t\t\t}\n\t\t},\n\t\t[onChange],\n\t);\n\n\tconst val = !(value instanceof Money) && value !== undefined ? toMoney(value) : value;\n\n\tconst [inputElement] = useMoneyInput({onChange: handleChange, prefix, showPrefix, value: val, wholeNumber});\n\n\tconst handleDropdownChange = useCallback(\n\t\t(e: SyntheticEvent<HTMLElement, Event>, v: DropdownProps) => {\n\t\t\tconst newCurrencyCode = v.value as CurrencyString;\n\t\t\tconst newMoney = new Money(value?.amount || 0, newCurrencyCode);\n\n\t\t\td('Change', value, newCurrencyCode, newMoney);\n\t\t\t// setInputValue(newMoney);\n\t\t\tonChange && onChange(newMoney);\n\t\t\t// forceUpdate();\n\t\t},\n\t\t[onChange, value],\n\t);\n\n\tconst currencyCode = value?.currency || defaultCurrency?.code || 'CAD';\n\td('Render', value, currencyCode);\n\n\treturn (\n\t\t<Input {...rest} labelPosition=\"right\">\n\t\t\t<input name={name} ref={inputElement} onBlur={onBlur} readOnly={locked} />\n\t\t\t<Label basic>\n\t\t\t\t<Dropdown disabled={locked || lockCurrency} options={options} value={currencyCode} onChange={handleDropdownChange} />\n\t\t\t</Label>\n\t\t</Input>\n\t);\n}\n"],"names":[],"mappings":";;;;;;;AASA,MAAM,CAAA,GAAI,MAAM,uCAAuC,CAAA,CAAA;AAOhD,SAAA,kBAAA,CAA4B,KAA+D,EAAA;AACjG,EAAA,MAAM,EAAC,IAAA,EAAM,MAAQ,EAAA,MAAA,EAAQ,eAAiB,EAAA,QAAA,EAAU,UAAY,EAAA,KAAA,EAAO,WAAa,EAAA,UAAA,EAAY,MAAQ,EAAA,YAAA,EAAA,GAAiB,IAAQ,EAAA,GAAA,KAAA,CAAA;AAErI,EAAA,MAAM,UAAU,UAAc,IAAA;AAAA,IAC7B,EAAC,GAAK,EAAA,KAAA,EAAO,IAAM,EAAA,KAAA,EAAO,OAAO,KAAK,EAAA;AAAA,IACtC,EAAC,GAAK,EAAA,KAAA,EAAO,IAAM,EAAA,KAAA,EAAO,OAAO,KAAK,EAAA;AAAA,GACvC,CAAA;AAEA,EAAM,MAAA,YAAA,GAAe,WACpB,CAAA,CAAC,CAAc,KAAA;AACd,IAAA,IAAI,KAAK,QAAU,EAAA;AAClB,MAAA,QAAA,IAAY,SAAS,CAAC,CAAA,CAAA;AAAA,KACvB;AAAA,GACD,EACA,CAAC,QAAQ,CACV,CAAA,CAAA;AAEA,EAAM,MAAA,GAAA,GAAM,EAAmB,KAAA,YA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S,UAAU,MAAU,IAAA,YAAA;AAAA,IAAc,OAAA;AAAA,IAAkB,KAAO,EAAA,YAAA;AAAA,IAAc,QAAU,EAAA,oBAAA;AAAA,GAAsB,CACpH,CACD,CAAA,CAAA;AAEF;;;;"}
1
+ {"version":3,"file":"MoneyCurrencyInput.js","sources":["../../../../src/money/MoneyCurrencyInput/MoneyCurrencyInput.tsx"],"sourcesContent":["import {toMoney} from '@thx/money';\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport debug from 'debug';\nimport Money, {CurrencyString} from 'js-money';\nimport {SyntheticEvent, useCallback, useEffect, useState} from 'react';\nimport {Dropdown, DropdownProps, Input, InputProps} from 'semantic-ui-react';\nimport CurrencyInput, {CurrencyInputProps} from 'react-currency-input-field';\nimport type {MoneyInputProps} from '../MoneyInput';\n\nconst d = debug('thx.controls.money.MoneyCurrencyInput');\n\nexport interface MoneyCurrencyInputProps extends MoneyInputProps {\n\tcurrencies?: {key: string; value: string; text: string}[];\n\tlockCurrency?: boolean;\n}\n\nexport function MoneyCurrencyInput(props: MoneyCurrencyInputProps & Omit<InputProps, 'onChange'>) {\n\tconst {name, onBlur, prefix, defaultCurrency, onChange, showPrefix, value, wholeNumber, currencies, locked, lockCurrency, ...rest} = props;\n\tconst [localValue, setLocalValue] = useState<string | undefined>('');\n\n\tconst options = currencies || [\n\t\t{key: 'CAD', text: 'CAD', value: 'CAD'},\n\t\t{key: 'USD', text: 'USD', value: 'USD'},\n\t];\n\n\tconst currencyCode = value?.currency || defaultCurrency?.code || 'CAD';\n\n\tconst handleChange: CurrencyInputProps['onValueChange'] = useCallback(\n\t\t(v): void => {\n\t\t\tif (onChange) {\n\t\t\t\tsetLocalValue(v);\n\t\t\t\tonChange(toMoney(v || 0, defaultCurrency || 'CAD'));\n\t\t\t}\n\t\t},\n\t\t[defaultCurrency, onChange],\n\t);\n\n\tconst handleDropdownChange = useCallback(\n\t\t(e: SyntheticEvent<HTMLElement, Event>, v: DropdownProps) => {\n\t\t\tconst newCurrencyCode = v.value as CurrencyString;\n\t\t\tconst newMoney = new Money(value?.amount || 0, newCurrencyCode);\n\n\t\t\td('Change', value, newCurrencyCode, newMoney);\n\t\t\t// setInputValue(newMoney);\n\t\t\tonChange && onChange(newMoney);\n\t\t\t// forceUpdate();\n\t\t},\n\t\t[onChange, value],\n\t);\n\n\tuseEffect(() => {\n\t\tif (!localValue && value) {\n\t\t\tsetLocalValue(value?.toDecimal().toString());\n\t\t}\n\t}, [localValue, value]);\n\n\treturn (\n\t\t<Input {...rest}>\n\t\t\t<CurrencyInput\n\t\t\t\tname={name}\n\t\t\t\tdisabled={locked}\n\t\t\t\tplaceholder=\"0.00\"\n\t\t\t\tdecimalsLimit={wholeNumber ? -1 : 2}\n\t\t\t\tprefix={showPrefix ? prefix || '$' : undefined}\n\t\t\t\tonValueChange={handleChange}\n\t\t\t\tstyle={{textAlign: 'right'}}\n\t\t\t\tonBlur={onBlur}\n\t\t\t\tvalue={localValue}\n\t\t\t\tclassName=\"ui right labeled input\"\n\t\t\t/>\n\t\t\t<Dropdown\n\t\t\t\tdisabled={locked || lockCurrency}\n\t\t\t\toptions={options}\n\t\t\t\tvalue={currencyCode}\n\t\t\t\tonChange={handleDropdownChange}\n\t\t\t\tclassName=\"ui basic label dropdown\"\n\t\t\t/>\n\t\t</Input>\n\t);\n}\n"],"names":[],"mappings":";;;;;;;AASA,MAAM,CAAA,GAAI,MAAM,uCAAuC,CAAA,CAAA;AAOhD,SAAA,kBAAA,CAA4B,KAA+D,EAAA;AACjG,EAAA,MAAM,EAAC,IAAA,EAAM,MAAQ,EAAA,MAAA,EAAQ,eAAiB,EAAA,QAAA,EAAU,UAAY,EAAA,KAAA,EAAO,WAAa,EAAA,UAAA,EAAY,MAAQ,EAAA,YAAA,EAAA,GAAiB,IAAQ,EAAA,GAAA,KAAA,CAAA;AACrI,EAAA,MAAM,CAAC,UAAA,EAAY,aAAiB,CAAA,GAAA,QAAA,CAA6B,EAAE,CAAA,CAAA;AAEnE,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K,CAAC,CAAA,CAAA;AAEtB,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,IAAU,GAAA,IAAA;AAAA,GAAA,kBACT,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAU,EAAA,MAAA;AAAA,IACV,WAAY,EAAA,MAAA;AAAA,IACZ,aAAA,EAAe,cAAc,CAAK,CAAA,GAAA,CAAA;AAAA,IAClC,MAAA,EAAQ,UAAa,GAAA,MAAA,IAAU,GAAM,GAAA,KAAA,CAAA;AAAA,IACrC,aAAe,EAAA,YAAA;AAAA,IACf,KAAA,EAAO,EAAC,SAAA,EAAW,OAAO,EAAA;AAAA,IAC1B,MAAA;AAAA,IACA,KAAO,EAAA,UAAA;AAAA,IACP,SAAU,EAAA,wBAAA;AAAA,GACX,mBACC,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;AAAA,IACA,UAAU,MAAU,IAAA,YAAA;AAAA,IACpB,OAAA;AAAA,IACA,KAAO,EAAA,YAAA;AAAA,IACP,QAAU,EAAA,oBAAA;AAAA,IACV,SAAU,EAAA,yBAAA;AAAA,GACX,CACD,CAAA,CAAA;AAEF;;;;"}
@@ -1,27 +1,36 @@
1
- import React, { useCallback } from 'react';
2
- import { toMoney } from '@thx/money';
1
+ import React, { useState, useCallback, useEffect } from 'react';
3
2
  import debug from 'debug';
4
- import Money from 'js-money';
5
3
  import { Input } from 'semantic-ui-react';
6
- import { useMoneyInput } from '../useMoneyInput.js';
4
+ import CurrencyInput from 'react-currency-input-field';
5
+ import { toMoney } from '@thx/money';
7
6
 
8
7
  debug("thx.controls.money.MoneyInput");
9
8
  function MoneyInput(props) {
10
9
  const { name, onBlur, locked, prefix, defaultCurrency, onChange, showPrefix, value, wholeNumber, ...rest } = props;
10
+ const [localValue, setLocalValue] = useState("");
11
11
  const handleChange = useCallback((v) => {
12
- if (v && onChange) {
13
- onChange(v);
12
+ if (onChange) {
13
+ setLocalValue(v);
14
+ onChange(toMoney(v || 0, defaultCurrency || "CAD"));
15
+ }
16
+ }, [defaultCurrency, onChange]);
17
+ useEffect(() => {
18
+ if (!localValue && value) {
19
+ setLocalValue(value?.toDecimal().toString());
14
20
  }
15
- }, [onChange]);
16
- const val = !(value instanceof Money) && value !== void 0 ? toMoney(value) : value;
17
- const [inputElement] = useMoneyInput({ onChange: handleChange, prefix, showPrefix, value: val, wholeNumber });
21
+ }, [localValue, value]);
18
22
  return /* @__PURE__ */ React.createElement(Input, {
19
23
  ...rest
20
- }, /* @__PURE__ */ React.createElement("input", {
24
+ }, /* @__PURE__ */ React.createElement(CurrencyInput, {
21
25
  name,
22
- ref: inputElement,
26
+ disabled: locked,
27
+ placeholder: "0.00",
28
+ decimalsLimit: wholeNumber ? -1 : 2,
29
+ prefix: showPrefix ? prefix || "$" : void 0,
30
+ onValueChange: handleChange,
31
+ style: { textAlign: "right" },
23
32
  onBlur,
24
- readOnly: locked
33
+ value: localValue
25
34
  }));
26
35
  }
27
36
 
@@ -1 +1 @@
1
- {"version":3,"file":"MoneyInput.js","sources":["../../../../src/money/MoneyInput/MoneyInput.tsx"],"sourcesContent":["import {toMoney} from '@thx/money';\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport debug from 'debug';\nimport Money, {Currency, MoneyObject} from 'js-money';\nimport {useCallback} from 'react';\nimport {Input, InputProps} from 'semantic-ui-react';\nimport {useMoneyInput} from '../useMoneyInput';\n\nconst d = debug('thx.controls.money.MoneyInput');\n\nexport interface MoneyInputProps {\n\tname?: string;\n\tonChange?: (value?: Money) => void;\n\tvalue?: Money | MoneyObject | undefined;\n\tdefaultCurrency?: Currency; // Defaults to Money.CAD\n\tonBlur?: (ev: any) => void;\n\tprefix?: string; // Defaults to currency symbol\n\tshowPrefix?: boolean; // Defaults to false\n\tlocked?: boolean; // Defaults to false\n\twholeNumber?: boolean; // Defaults to false\n}\n\nexport function MoneyInput(props: MoneyInputProps & Omit<InputProps, 'onChange'>) {\n\tconst {name, onBlur, locked, prefix, defaultCurrency, onChange, showPrefix, value, wholeNumber, ...rest} = props;\n\n\tconst handleChange = useCallback(\n\t\t(v?: Money) => {\n\t\t\tif (v && onChange) {\n\t\t\t\tonChange(v);\n\t\t\t}\n\t\t},\n\t\t[onChange],\n\t);\n\n\tconst val = !(value instanceof Money) && value !== undefined ? toMoney(value) : value;\n\n\tconst [inputElement] = useMoneyInput({onChange: handleChange, prefix, showPrefix, value: val, wholeNumber});\n\n\treturn (\n\t\t<Input {...rest}>\n\t\t\t<input name={name} ref={inputElement} onBlur={onBlur} readOnly={locked} />\n\t\t</Input>\n\t);\n}\n"],"names":[],"mappings":";;;;;;;AAQU,MAAM,+BAA+B,EAAA;AAcxC,SAAA,UAAA,CAAoB,KAAuD,EAAA;AACjF,EAAM,MAAA,EAAC,IAAM,EAAA,MAAA,EAAQ,MAAQ,EAAA,MAAA,EAAQ,iBAAiB,QAAU,EAAA,UAAA,EAAY,KAAO,EAAA,WAAA,EAAA,GAAgB,IAAQ,EAAA,GAAA,KAAA,CAAA;AAE3G,EAAM,MAAA,YAAA,GAAe,WACpB,CAAA,CAAC,CAAc,KAAA;AACd,IAAA,IAAI,KAAK,QAAU,EAAA;AAClB,MAAA,QAAA,CAAS,CAAC,CAAA,CAAA;AAAA,KACX;AAAA,GACD,EACA,CAAC,QAAQ,CACV,CAAA,CAAA;AAEA,EAAM,MAAA,GAAA,GAAM,EAAmB,KAAA,YAAA,KAAA,CAAA,IAAU,UAAU,KAAY,CAAA,GAAA,OAAA,CAAQ,KAAK,CAAI,GAAA,KAAA,CAAA;AAEhF,EAAM,MAAA,CAAC,YAAgB,CAAA,GAAA,aAAA,CAAc,EAAC,QAAA,EAAU,YAAc,EAAA,MAAA,EAAQ,UAAY,EAAA,KAAA,EAAO,GAAK,EAAA,WAAA,EAAY,CAAA,CAAA;AAE1G,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,IAAU,GAAA,IAAA;AAAA,GAAA,kBACT,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA;AAAA,IAAM,IAAA;AAAA,IAAY,GAAK,EAAA,YAAA;AAAA,IAAc,MAAA;AAAA,IAAgB,QAAU,EAAA,MAAA;AAAA,GAAQ,CACzE,CAAA,CAAA;AAEF;;;;"}
1
+ {"version":3,"file":"MoneyInput.js","sources":["../../../../src/money/MoneyInput/MoneyInput.tsx"],"sourcesContent":["import debug from 'debug';\nimport type {Currency} from 'js-money';\nimport type Money from 'js-money';\nimport {Input, InputProps} from 'semantic-ui-react';\nimport CurrencyInput, {CurrencyInputProps} from 'react-currency-input-field';\nimport {useCallback, useEffect, useState} from 'react';\nimport {toMoney} from '@thx/money';\n\nconst d = debug('thx.controls.money.MoneyInput');\n\nexport interface MoneyInputProps {\n\tname?: string;\n\tonChange?: (value?: Money) => void;\n\tvalue?: Money | undefined;\n\tdefaultCurrency?: Currency; // Defaults to Money.CAD\n\tonBlur?: (ev: any) => void;\n\tprefix?: string; // Defaults to currency symbol\n\tshowPrefix?: boolean; // Defaults to false\n\tlocked?: boolean; // Defaults to false\n\twholeNumber?: boolean; // Defaults to false\n}\n\nexport function MoneyInput(props: MoneyInputProps & Omit<InputProps, 'onChange'>) {\n\tconst {name, onBlur, locked, prefix, defaultCurrency, onChange, showPrefix, value, wholeNumber, ...rest} = props;\n\tconst [localValue, setLocalValue] = useState<string | undefined>('');\n\n\tconst handleChange: CurrencyInputProps['onValueChange'] = useCallback(\n\t\t(v): void => {\n\t\t\tif (onChange) {\n\t\t\t\tsetLocalValue(v);\n\t\t\t\tonChange(toMoney(v || 0, defaultCurrency || 'CAD'));\n\t\t\t}\n\t\t},\n\t\t[defaultCurrency, onChange],\n\t);\n\n\tuseEffect(() => {\n\t\tif (!localValue && value) {\n\t\t\tsetLocalValue(value?.toDecimal().toString());\n\t\t}\n\t}, [localValue, value]);\n\n\treturn (\n\t\t<Input {...rest}>\n\t\t\t<CurrencyInput\n\t\t\t\tname={name}\n\t\t\t\tdisabled={locked}\n\t\t\t\tplaceholder=\"0.00\"\n\t\t\t\tdecimalsLimit={wholeNumber ? -1 : 2}\n\t\t\t\tprefix={showPrefix ? prefix || '$' : undefined}\n\t\t\t\tonValueChange={handleChange}\n\t\t\t\tstyle={{textAlign: 'right'}}\n\t\t\t\tonBlur={onBlur}\n\t\t\t\tvalue={localValue}\n\t\t\t/>\n\t\t</Input>\n\t);\n}\n"],"names":[],"mappings":";;;;;;AAQU,MAAM,+BAA+B,EAAA;AAcxC,SAAA,UAAA,CAAoB,KAAuD,EAAA;AACjF,EAAM,MAAA,EAAC,IAAM,EAAA,MAAA,EAAQ,MAAQ,EAAA,MAAA,EAAQ,iBAAiB,QAAU,EAAA,UAAA,EAAY,KAAO,EAAA,WAAA,EAAA,GAAgB,IAAQ,EAAA,GAAA,KAAA,CAAA;AAC3G,EAAA,MAAM,CAAC,UAAA,EAAY,aAAiB,CAAA,GAAA,QAAA,CAA6B,EAAE,CAAA,CAAA;AAEnE,EAAM,MAAA,YAAA,GAAoD,WACzD,CAAA,CAAC,CAAY,KAAA;AACZ,IAAA,IAAI,QAAU,EAAA;AACb,MAAA,aAAA,CAAc,CAAC,CAAA,CAAA;AACf,MAAA,QAAA,CAAS,OAAQ,CAAA,CAAA,IAAK,CAAG,EAAA,eAAA,IAAmB,KAAK,CAAC,CAAA,CAAA;AAAA,KACnD;AAAA,GAED,EAAA,CAAC,eAAiB,EAAA,QAAQ,CAC3B,CAAA,CAAA;AAEA,EAAA,SAAA,CAAU,MAAM;AACf,IAAI,IAAA,CAAC,cAAc,KAAO,EAAA;AACzB,MAAA,aAAA,CAAc,KAAO,EAAA,SAAA,EAAY,CAAA,QAAA,EAAU,CAAA,CAAA;AAAA,KAC5C;AAAA,GACE,EAAA,CAAC,UAAY,EAAA,KAAK,CAAC,CAAA,CAAA;AAEtB,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,IAAU,GAAA,IAAA;AAAA,GAAA,kBACT,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAU,EAAA,MAAA;AAAA,IACV,WAAY,EAAA,MAAA;AAAA,IACZ,aAAA,EAAe,cAAc,CAAK,CAAA,GAAA,CAAA;AAAA,IAClC,MAAA,EAAQ,UAAa,GAAA,MAAA,IAAU,GAAM,GAAA,KAAA,CAAA;AAAA,IACrC,aAAe,EAAA,YAAA;AAAA,IACf,KAAA,EAAO,EAAC,SAAA,EAAW,OAAO,EAAA;AAAA,IAC1B,MAAA;AAAA,IACA,KAAO,EAAA,UAAA;AAAA,GACR,CACD,CAAA,CAAA;AAEF;;;;"}
package/dist/stats.html CHANGED
@@ -2669,7 +2669,7 @@ var drawChart = (function (exports) {
2669
2669
  </script>
2670
2670
  <script>
2671
2671
  /*<!--*/
2672
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src/index.ts","uid":"6c12-1"}]},{"name":"money/useMoneyInput.js","children":[{"name":"src/money/useMoneyInput.ts","uid":"6c12-3"}]},{"name":"step/useStep.js","children":[{"name":"src/step/useStep.ts","uid":"6c12-5"}]},{"name":"step/Step.js","children":[{"name":"src/step/Step.tsx","uid":"6c12-7"}]},{"name":"step/FormStep.js","children":[{"name":"src/step/FormStep.tsx","uid":"6c12-9"}]},{"name":"step/StepProvider.js","children":[{"name":"src/step/StepProvider.tsx","uid":"6c12-11"}]},{"name":"inputs/MaskedInput/useMaskedInput.js","children":[{"name":"src/inputs/MaskedInput/useMaskedInput.ts","uid":"6c12-13"}]},{"name":"inputs/TableInput/addRowOnTab.js","children":[{"name":"src/inputs/TableInput/addRowOnTab.ts","uid":"6c12-15"}]},{"name":"date/LocalMonthSelect/LocalMonthSelect.js","children":[{"name":"src/date/LocalMonthSelect/LocalMonthSelect.tsx","uid":"6c12-17"}]},{"name":"date/LocalDatePicker/LocalDatePicker.js","children":[{"name":"src/date/LocalDatePicker/LocalDatePicker.tsx","uid":"6c12-19"}]},{"name":"date/MonthDayPicker/MonthDayPicker.js","children":[{"name":"src/date/MonthDayPicker/MonthDayPicker.tsx","uid":"6c12-21"}]},{"name":"date/LocalTimePicker/LocalTimePicker.js","children":[{"name":"src/date/LocalTimePicker/LocalTimePicker.tsx","uid":"6c12-23"}]},{"name":"date/MonthYearPicker/MonthYearPicker.js","children":[{"name":"src/date/MonthYearPicker/MonthYearPicker.tsx","uid":"6c12-25"}]},{"name":"date/YearSelect/YearSelect.js","children":[{"name":"src/date/YearSelect/YearSelect.tsx","uid":"6c12-27"}]},{"name":"form/TForm/TForm.js","children":[{"name":"src/form/TForm/TForm.tsx","uid":"6c12-29"}]},{"name":"form/TForm/useTForm.js","children":[{"name":"src/form/TForm/useTForm.tsx","uid":"6c12-31"}]},{"name":"inputs/MaskedInput/MaskedInput.js","children":[{"name":"src/inputs/MaskedInput/MaskedInput.tsx","uid":"6c12-33"}]},{"name":"inputs/RadioGroup/RadioGroup.js","children":[{"name":"src/inputs/RadioGroup/RadioGroup.tsx","uid":"6c12-35"}]},{"name":"inputs/Scriptel/Scriptel.js","children":[{"name":"src/inputs/Scriptel/Scriptel.tsx","uid":"6c12-37"}]},{"name":"inputs/Scriptel/withScriptel.js","children":[{"name":"src/inputs/Scriptel/withScriptel.tsx","uid":"6c12-39"}]},{"name":"inputs/ScriptelInput/ScriptelInput.js","children":[{"name":"src/inputs/ScriptelInput/ScriptelInput.tsx","uid":"6c12-41"}]},{"name":"inputs/PhoneInput/PhoneInput.js","children":[{"name":"src/inputs/PhoneInput/PhoneInput.tsx","uid":"6c12-43"}]},{"name":"inputs/CreditCardInput/CreditCardInput.js","children":[{"name":"src/inputs/CreditCardInput/CreditCardInput.tsx","uid":"6c12-45"}]},{"name":"inputs/TableInput/TableInput.js","children":[{"name":"src/inputs/TableInput/TableInput.tsx","uid":"6c12-47"}]},{"name":"inputs/TableInput/MoneyCell.js","children":[{"name":"src/inputs/TableInput/MoneyCell.tsx","uid":"6c12-49"}]},{"name":"inputs/TableInput/MoneyEditCell.js","children":[{"name":"src/inputs/TableInput/MoneyEditCell.tsx","uid":"6c12-51"}]},{"name":"inputs/TableInput/LocalDateCell.js","children":[{"name":"src/inputs/TableInput/LocalDateCell.tsx","uid":"6c12-53"}]},{"name":"inputs/TableInput/CheckboxEditCell.js","children":[{"name":"src/inputs/TableInput/CheckboxEditCell.tsx","uid":"6c12-55"}]},{"name":"inputs/TableInput/LocalDateEditCell.js","children":[{"name":"src/inputs/TableInput/LocalDateEditCell.tsx","uid":"6c12-57"}]},{"name":"inputs/TableInput/MoneySumFooter.js","children":[{"name":"src/inputs/TableInput/MoneySumFooter.tsx","uid":"6c12-59"}]},{"name":"inputs/TableInput/StringEditCell.js","children":[{"name":"src/inputs/TableInput/StringEditCell.tsx","uid":"6c12-61"}]},{"name":"inputs/TableInput/DropdownCell.js","children":[{"name":"src/inputs/TableInput/DropdownCell.tsx","uid":"6c12-63"}]},{"name":"inputs/TableInput/HoverCell.js","children":[{"name":"src/inputs/TableInput/HoverCell.tsx","uid":"6c12-65"}]},{"name":"inputs/SinInput/SinInput.js","children":[{"name":"src/inputs/SinInput/SinInput.tsx","uid":"6c12-67"}]},{"name":"money/MoneyInput/MoneyInput.js","children":[{"name":"src/money/MoneyInput/MoneyInput.tsx","uid":"6c12-69"}]},{"name":"money/MoneyCurrencyInput/MoneyCurrencyInput.js","children":[{"name":"src/money/MoneyCurrencyInput/MoneyCurrencyInput.tsx","uid":"6c12-71"}]},{"name":"inputs/Scriptel/scriptel/enums.js","children":[{"name":"src/inputs/Scriptel/scriptel/enums.ts","uid":"6c12-73"}]},{"name":"step/stepContext.js","children":[{"name":"src/step/stepContext.ts","uid":"6c12-75"}]},{"name":"date/DatePicker/styles.css.js","children":[{"name":"src/date/DatePicker/styles.css","uid":"6c12-77"}]},{"name":"inputs/CreditCardInput/styles.css.js","children":[{"name":"src/inputs/CreditCardInput/styles.css","uid":"6c12-79"}]},{"name":"date/LocalTimePicker/MaskedTimeInput.js","children":[{"name":"src/date/LocalTimePicker/MaskedTimeInput.tsx","uid":"6c12-81"}]},{"name":"inputs/Scriptel/ScriptelContext.js","children":[{"name":"src/inputs/Scriptel/ScriptelContext.ts","uid":"6c12-83"}]},{"name":"date/LocalDatePicker/MaskedDateInput.js","children":[{"name":"src/date/LocalDatePicker/MaskedDateInput.tsx","uid":"6c12-85"}]},{"name":"inputs/CreditCardInput/CreditCardNumberInput.js","children":[{"name":"src/inputs/CreditCardInput/CreditCardNumberInput.tsx","uid":"6c12-87"}]},{"name":"inputs/Scriptel/scriptel/index.js","children":[{"name":"src/inputs/Scriptel/scriptel/index.ts","uid":"6c12-89"}]},{"name":"external/style-inject/dist/style-inject.es.js","children":[{"name":"home/runner/work/thr-addons/thr-addons/node_modules/style-inject/dist/style-inject.es.js","uid":"6c12-91"}]}],"isRoot":true},"nodeParts":{"6c12-1":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"6c12-0"},"6c12-3":{"renderedLength":2155,"gzipLength":770,"brotliLength":660,"mainUid":"6c12-2"},"6c12-5":{"renderedLength":113,"gzipLength":106,"brotliLength":82,"mainUid":"6c12-4"},"6c12-7":{"renderedLength":203,"gzipLength":157,"brotliLength":111,"mainUid":"6c12-6"},"6c12-9":{"renderedLength":440,"gzipLength":270,"brotliLength":214,"mainUid":"6c12-8"},"6c12-11":{"renderedLength":3529,"gzipLength":1021,"brotliLength":861,"mainUid":"6c12-10"},"6c12-13":{"renderedLength":1487,"gzipLength":502,"brotliLength":423,"mainUid":"6c12-12"},"6c12-15":{"renderedLength":312,"gzipLength":199,"brotliLength":173,"mainUid":"6c12-14"},"6c12-17":{"renderedLength":1135,"gzipLength":503,"brotliLength":415,"mainUid":"6c12-16"},"6c12-19":{"renderedLength":2742,"gzipLength":822,"brotliLength":721,"mainUid":"6c12-18"},"6c12-21":{"renderedLength":1965,"gzipLength":657,"brotliLength":544,"mainUid":"6c12-20"},"6c12-23":{"renderedLength":1205,"gzipLength":488,"brotliLength":402,"mainUid":"6c12-22"},"6c12-25":{"renderedLength":1229,"gzipLength":491,"brotliLength":424,"mainUid":"6c12-24"},"6c12-27":{"renderedLength":1553,"gzipLength":580,"brotliLength":461,"mainUid":"6c12-26"},"6c12-29":{"renderedLength":600,"gzipLength":307,"brotliLength":267,"mainUid":"6c12-28"},"6c12-31":{"renderedLength":2930,"gzipLength":959,"brotliLength":816,"mainUid":"6c12-30"},"6c12-33":{"renderedLength":390,"gzipLength":237,"brotliLength":203,"mainUid":"6c12-32"},"6c12-35":{"renderedLength":561,"gzipLength":301,"brotliLength":259,"mainUid":"6c12-34"},"6c12-37":{"renderedLength":1275,"gzipLength":476,"brotliLength":406,"mainUid":"6c12-36"},"6c12-39":{"renderedLength":275,"gzipLength":163,"brotliLength":130,"mainUid":"6c12-38"},"6c12-41":{"renderedLength":1963,"gzipLength":648,"brotliLength":547,"mainUid":"6c12-40"},"6c12-43":{"renderedLength":381,"gzipLength":248,"brotliLength":218,"mainUid":"6c12-42"},"6c12-45":{"renderedLength":2324,"gzipLength":586,"brotliLength":495,"mainUid":"6c12-44"},"6c12-47":{"renderedLength":2788,"gzipLength":828,"brotliLength":734,"mainUid":"6c12-46"},"6c12-49":{"renderedLength":257,"gzipLength":187,"brotliLength":149,"mainUid":"6c12-48"},"6c12-51":{"renderedLength":708,"gzipLength":368,"brotliLength":313,"mainUid":"6c12-50"},"6c12-53":{"renderedLength":264,"gzipLength":191,"brotliLength":154,"mainUid":"6c12-52"},"6c12-55":{"renderedLength":746,"gzipLength":384,"brotliLength":333,"mainUid":"6c12-54"},"6c12-57":{"renderedLength":695,"gzipLength":350,"brotliLength":295,"mainUid":"6c12-56"},"6c12-59":{"renderedLength":414,"gzipLength":261,"brotliLength":219,"mainUid":"6c12-58"},"6c12-61":{"renderedLength":717,"gzipLength":369,"brotliLength":319,"mainUid":"6c12-60"},"6c12-63":{"renderedLength":493,"gzipLength":255,"brotliLength":211,"mainUid":"6c12-62"},"6c12-65":{"renderedLength":403,"gzipLength":245,"brotliLength":195,"mainUid":"6c12-64"},"6c12-67":{"renderedLength":1144,"gzipLength":530,"brotliLength":462,"mainUid":"6c12-66"},"6c12-69":{"renderedLength":690,"gzipLength":375,"brotliLength":294,"mainUid":"6c12-68"},"6c12-71":{"renderedLength":1529,"gzipLength":627,"brotliLength":525,"mainUid":"6c12-70"},"6c12-73":{"renderedLength":937,"gzipLength":292,"brotliLength":231,"mainUid":"6c12-72"},"6c12-75":{"renderedLength":80,"gzipLength":90,"brotliLength":72,"mainUid":"6c12-74"},"6c12-77":{"renderedLength":538,"gzipLength":263,"brotliLength":211,"mainUid":"6c12-76"},"6c12-79":{"renderedLength":78,"gzipLength":92,"brotliLength":79,"mainUid":"6c12-78"},"6c12-81":{"renderedLength":446,"gzipLength":290,"brotliLength":241,"mainUid":"6c12-80"},"6c12-83":{"renderedLength":46,"gzipLength":60,"brotliLength":45,"mainUid":"6c12-82"},"6c12-85":{"renderedLength":464,"gzipLength":299,"brotliLength":256,"mainUid":"6c12-84"},"6c12-87":{"renderedLength":1713,"gzipLength":687,"brotliLength":585,"mainUid":"6c12-86"},"6c12-89":{"renderedLength":2530,"gzipLength":860,"brotliLength":739,"mainUid":"6c12-88"},"6c12-91":{"renderedLength":636,"gzipLength":318,"brotliLength":242,"mainUid":"6c12-90"}},"nodeMetas":{"6c12-0":{"id":"/src/index.ts","moduleParts":{"index.js":"6c12-1"},"imported":[{"uid":"6c12-92"},{"uid":"6c12-93"},{"uid":"6c12-94"},{"uid":"6c12-95"},{"uid":"6c12-96"},{"uid":"6c12-97"},{"uid":"6c12-98"},{"uid":"6c12-99"},{"uid":"6c12-100"},{"uid":"6c12-101"},{"uid":"6c12-102"},{"uid":"6c12-103"},{"uid":"6c12-104"},{"uid":"6c12-105"},{"uid":"6c12-106"},{"uid":"6c12-2"},{"uid":"6c12-107"},{"uid":"6c12-108"},{"uid":"6c12-109"}],"importedBy":[],"isEntry":true},"6c12-2":{"id":"/src/money/useMoneyInput.ts","moduleParts":{"money/useMoneyInput.js":"6c12-3"},"imported":[{"uid":"6c12-110"},{"uid":"6c12-111"},{"uid":"6c12-112"},{"uid":"6c12-113"},{"uid":"6c12-114"}],"importedBy":[{"uid":"6c12-0"},{"uid":"6c12-68"},{"uid":"6c12-70"}]},"6c12-4":{"id":"/src/step/useStep.ts","moduleParts":{"step/useStep.js":"6c12-5"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-74"}],"importedBy":[{"uid":"6c12-109"},{"uid":"6c12-8"}]},"6c12-6":{"id":"/src/step/Step.tsx","moduleParts":{"step/Step.js":"6c12-7"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"}],"importedBy":[{"uid":"6c12-109"},{"uid":"6c12-10"}]},"6c12-8":{"id":"/src/step/FormStep.tsx","moduleParts":{"step/FormStep.js":"6c12-9"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-4"}],"importedBy":[{"uid":"6c12-109"},{"uid":"6c12-10"}]},"6c12-10":{"id":"/src/step/StepProvider.tsx","moduleParts":{"step/StepProvider.js":"6c12-11"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-127"},{"uid":"6c12-116"},{"uid":"6c12-8"},{"uid":"6c12-6"},{"uid":"6c12-74"}],"importedBy":[{"uid":"6c12-109"}]},"6c12-12":{"id":"/src/inputs/MaskedInput/useMaskedInput.ts","moduleParts":{"inputs/MaskedInput/useMaskedInput.js":"6c12-13"},"imported":[{"uid":"6c12-111"},{"uid":"6c12-112"},{"uid":"6c12-114"},{"uid":"6c12-122"}],"importedBy":[{"uid":"6c12-99"},{"uid":"6c12-32"},{"uid":"6c12-66"},{"uid":"6c12-86"}]},"6c12-14":{"id":"/src/inputs/TableInput/addRowOnTab.ts","moduleParts":{"inputs/TableInput/addRowOnTab.js":"6c12-15"},"imported":[],"importedBy":[{"uid":"6c12-106"},{"uid":"6c12-50"},{"uid":"6c12-54"},{"uid":"6c12-60"}]},"6c12-16":{"id":"/src/date/LocalMonthSelect/LocalMonthSelect.tsx","moduleParts":{"date/LocalMonthSelect/LocalMonthSelect.js":"6c12-17"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-118"},{"uid":"6c12-111"},{"uid":"6c12-116"}],"importedBy":[{"uid":"6c12-93"}]},"6c12-18":{"id":"/src/date/LocalDatePicker/LocalDatePicker.tsx","moduleParts":{"date/LocalDatePicker/LocalDatePicker.js":"6c12-19"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-115"},{"uid":"6c12-111"},{"uid":"6c12-116"},{"uid":"6c12-117"},{"uid":"6c12-76"},{"uid":"6c12-84"}],"importedBy":[{"uid":"6c12-92"}]},"6c12-20":{"id":"/src/date/MonthDayPicker/MonthDayPicker.tsx","moduleParts":{"date/MonthDayPicker/MonthDayPicker.js":"6c12-21"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-115"},{"uid":"6c12-111"},{"uid":"6c12-116"},{"uid":"6c12-117"}],"importedBy":[{"uid":"6c12-95"}]},"6c12-22":{"id":"/src/date/LocalTimePicker/LocalTimePicker.tsx","moduleParts":{"date/LocalTimePicker/LocalTimePicker.js":"6c12-23"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-118"},{"uid":"6c12-115"},{"uid":"6c12-111"},{"uid":"6c12-117"},{"uid":"6c12-80"}],"importedBy":[{"uid":"6c12-94"}]},"6c12-24":{"id":"/src/date/MonthYearPicker/MonthYearPicker.tsx","moduleParts":{"date/MonthYearPicker/MonthYearPicker.js":"6c12-25"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-118"},{"uid":"6c12-115"},{"uid":"6c12-111"},{"uid":"6c12-116"},{"uid":"6c12-117"}],"importedBy":[{"uid":"6c12-96"}]},"6c12-26":{"id":"/src/date/YearSelect/YearSelect.tsx","moduleParts":{"date/YearSelect/YearSelect.js":"6c12-27"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-116"}],"importedBy":[{"uid":"6c12-97"}]},"6c12-28":{"id":"/src/form/TForm/TForm.tsx","moduleParts":{"form/TForm/TForm.js":"6c12-29"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-119"},{"uid":"6c12-30"}],"importedBy":[{"uid":"6c12-98"}]},"6c12-30":{"id":"/src/form/TForm/useTForm.tsx","moduleParts":{"form/TForm/useTForm.js":"6c12-31"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-120"},{"uid":"6c12-119"},{"uid":"6c12-121"},{"uid":"6c12-116"}],"importedBy":[{"uid":"6c12-98"},{"uid":"6c12-28"}]},"6c12-32":{"id":"/src/inputs/MaskedInput/MaskedInput.tsx","moduleParts":{"inputs/MaskedInput/MaskedInput.js":"6c12-33"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-116"},{"uid":"6c12-12"}],"importedBy":[{"uid":"6c12-99"}]},"6c12-34":{"id":"/src/inputs/RadioGroup/RadioGroup.tsx","moduleParts":{"inputs/RadioGroup/RadioGroup.js":"6c12-35"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-116"}],"importedBy":[{"uid":"6c12-100"}]},"6c12-36":{"id":"/src/inputs/Scriptel/Scriptel.tsx","moduleParts":{"inputs/Scriptel/Scriptel.js":"6c12-37"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-82"},{"uid":"6c12-88"}],"importedBy":[{"uid":"6c12-101"},{"uid":"6c12-38"}]},"6c12-38":{"id":"/src/inputs/Scriptel/withScriptel.tsx","moduleParts":{"inputs/Scriptel/withScriptel.js":"6c12-39"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-36"}],"importedBy":[{"uid":"6c12-101"}]},"6c12-40":{"id":"/src/inputs/ScriptelInput/ScriptelInput.tsx","moduleParts":{"inputs/ScriptelInput/ScriptelInput.js":"6c12-41"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-116"},{"uid":"6c12-82"}],"importedBy":[{"uid":"6c12-102"}]},"6c12-42":{"id":"/src/inputs/PhoneInput/PhoneInput.tsx","moduleParts":{"inputs/PhoneInput/PhoneInput.js":"6c12-43"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-99"}],"importedBy":[{"uid":"6c12-103"}]},"6c12-44":{"id":"/src/inputs/CreditCardInput/CreditCardInput.tsx","moduleParts":{"inputs/CreditCardInput/CreditCardInput.js":"6c12-45"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-115"},{"uid":"6c12-111"},{"uid":"6c12-123"},{"uid":"6c12-124"},{"uid":"6c12-116"},{"uid":"6c12-96"},{"uid":"6c12-86"},{"uid":"6c12-78"}],"importedBy":[{"uid":"6c12-104"}]},"6c12-46":{"id":"/src/inputs/TableInput/TableInput.tsx","moduleParts":{"inputs/TableInput/TableInput.js":"6c12-47"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-119"},{"uid":"6c12-126"},{"uid":"6c12-116"}],"importedBy":[{"uid":"6c12-106"}]},"6c12-48":{"id":"/src/inputs/TableInput/MoneyCell.tsx","moduleParts":{"inputs/TableInput/MoneyCell.js":"6c12-49"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-110"}],"importedBy":[{"uid":"6c12-106"}]},"6c12-50":{"id":"/src/inputs/TableInput/MoneyEditCell.tsx","moduleParts":{"inputs/TableInput/MoneyEditCell.js":"6c12-51"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-107"},{"uid":"6c12-14"}],"importedBy":[{"uid":"6c12-106"}]},"6c12-52":{"id":"/src/inputs/TableInput/LocalDateCell.tsx","moduleParts":{"inputs/TableInput/LocalDateCell.js":"6c12-53"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-115"}],"importedBy":[{"uid":"6c12-106"}]},"6c12-54":{"id":"/src/inputs/TableInput/CheckboxEditCell.tsx","moduleParts":{"inputs/TableInput/CheckboxEditCell.js":"6c12-55"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-116"},{"uid":"6c12-14"}],"importedBy":[{"uid":"6c12-106"}]},"6c12-56":{"id":"/src/inputs/TableInput/LocalDateEditCell.tsx","moduleParts":{"inputs/TableInput/LocalDateEditCell.js":"6c12-57"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-92"}],"importedBy":[{"uid":"6c12-106"}]},"6c12-58":{"id":"/src/inputs/TableInput/MoneySumFooter.tsx","moduleParts":{"inputs/TableInput/MoneySumFooter.js":"6c12-59"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-110"}],"importedBy":[{"uid":"6c12-106"}]},"6c12-60":{"id":"/src/inputs/TableInput/StringEditCell.tsx","moduleParts":{"inputs/TableInput/StringEditCell.js":"6c12-61"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-116"},{"uid":"6c12-14"}],"importedBy":[{"uid":"6c12-106"}]},"6c12-62":{"id":"/src/inputs/TableInput/DropdownCell.tsx","moduleParts":{"inputs/TableInput/DropdownCell.js":"6c12-63"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-116"}],"importedBy":[{"uid":"6c12-106"}]},"6c12-64":{"id":"/src/inputs/TableInput/HoverCell.tsx","moduleParts":{"inputs/TableInput/HoverCell.js":"6c12-65"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"}],"importedBy":[{"uid":"6c12-106"}]},"6c12-66":{"id":"/src/inputs/SinInput/SinInput.tsx","moduleParts":{"inputs/SinInput/SinInput.js":"6c12-67"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-116"},{"uid":"6c12-125"},{"uid":"6c12-12"}],"importedBy":[{"uid":"6c12-105"}]},"6c12-68":{"id":"/src/money/MoneyInput/MoneyInput.tsx","moduleParts":{"money/MoneyInput/MoneyInput.js":"6c12-69"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-110"},{"uid":"6c12-111"},{"uid":"6c12-113"},{"uid":"6c12-116"},{"uid":"6c12-2"}],"importedBy":[{"uid":"6c12-107"}]},"6c12-70":{"id":"/src/money/MoneyCurrencyInput/MoneyCurrencyInput.tsx","moduleParts":{"money/MoneyCurrencyInput/MoneyCurrencyInput.js":"6c12-71"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-110"},{"uid":"6c12-111"},{"uid":"6c12-113"},{"uid":"6c12-116"},{"uid":"6c12-2"}],"importedBy":[{"uid":"6c12-108"}]},"6c12-72":{"id":"/src/inputs/Scriptel/scriptel/enums.ts","moduleParts":{"inputs/Scriptel/scriptel/enums.js":"6c12-73"},"imported":[],"importedBy":[{"uid":"6c12-101"},{"uid":"6c12-88"}]},"6c12-74":{"id":"/src/step/stepContext.ts","moduleParts":{"step/stepContext.js":"6c12-75"},"imported":[{"uid":"6c12-114"}],"importedBy":[{"uid":"6c12-4"},{"uid":"6c12-10"}]},"6c12-76":{"id":"/src/date/DatePicker/styles.css","moduleParts":{"date/DatePicker/styles.css.js":"6c12-77"},"imported":[{"uid":"6c12-90"}],"importedBy":[{"uid":"6c12-18"},{"uid":"6c12-117"}]},"6c12-78":{"id":"/src/inputs/CreditCardInput/styles.css","moduleParts":{"inputs/CreditCardInput/styles.css.js":"6c12-79"},"imported":[{"uid":"6c12-90"}],"importedBy":[{"uid":"6c12-44"}]},"6c12-80":{"id":"/src/date/LocalTimePicker/MaskedTimeInput.tsx","moduleParts":{"date/LocalTimePicker/MaskedTimeInput.js":"6c12-81"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-99"}],"importedBy":[{"uid":"6c12-22"}]},"6c12-82":{"id":"/src/inputs/Scriptel/ScriptelContext.ts","moduleParts":{"inputs/Scriptel/ScriptelContext.js":"6c12-83"},"imported":[{"uid":"6c12-114"}],"importedBy":[{"uid":"6c12-36"},{"uid":"6c12-40"}]},"6c12-84":{"id":"/src/date/LocalDatePicker/MaskedDateInput.tsx","moduleParts":{"date/LocalDatePicker/MaskedDateInput.js":"6c12-85"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-111"},{"uid":"6c12-99"}],"importedBy":[{"uid":"6c12-18"}]},"6c12-86":{"id":"/src/inputs/CreditCardInput/CreditCardNumberInput.tsx","moduleParts":{"inputs/CreditCardInput/CreditCardNumberInput.js":"6c12-87"},"imported":[{"uid":"6c12-114"},{"uid":"6c12-130"},{"uid":"6c12-111"},{"uid":"6c12-131"},{"uid":"6c12-116"},{"uid":"6c12-12"}],"importedBy":[{"uid":"6c12-44"}]},"6c12-88":{"id":"/src/inputs/Scriptel/scriptel/index.ts","moduleParts":{"inputs/Scriptel/scriptel/index.js":"6c12-89"},"imported":[{"uid":"6c12-111"},{"uid":"6c12-129"},{"uid":"6c12-72"}],"importedBy":[{"uid":"6c12-36"}]},"6c12-90":{"id":"/home/runner/work/thr-addons/thr-addons/node_modules/style-inject/dist/style-inject.es.js","moduleParts":{"external/style-inject/dist/style-inject.es.js":"6c12-91"},"imported":[],"importedBy":[{"uid":"6c12-76"},{"uid":"6c12-78"}]},"6c12-92":{"id":"/src/date/LocalDatePicker/index.ts","moduleParts":{},"imported":[{"uid":"6c12-18"}],"importedBy":[{"uid":"6c12-0"},{"uid":"6c12-56"}]},"6c12-93":{"id":"/src/date/LocalMonthSelect/index.ts","moduleParts":{},"imported":[{"uid":"6c12-16"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-94":{"id":"/src/date/LocalTimePicker/index.ts","moduleParts":{},"imported":[{"uid":"6c12-22"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-95":{"id":"/src/date/MonthDayPicker/index.ts","moduleParts":{},"imported":[{"uid":"6c12-20"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-96":{"id":"/src/date/MonthYearPicker/index.ts","moduleParts":{},"imported":[{"uid":"6c12-24"}],"importedBy":[{"uid":"6c12-0"},{"uid":"6c12-44"}]},"6c12-97":{"id":"/src/date/YearSelect/index.ts","moduleParts":{},"imported":[{"uid":"6c12-26"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-98":{"id":"/src/form/TForm/index.ts","moduleParts":{},"imported":[{"uid":"6c12-28"},{"uid":"6c12-30"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-99":{"id":"/src/inputs/MaskedInput/index.ts","moduleParts":{},"imported":[{"uid":"6c12-32"},{"uid":"6c12-12"}],"importedBy":[{"uid":"6c12-0"},{"uid":"6c12-42"},{"uid":"6c12-84"},{"uid":"6c12-80"}]},"6c12-100":{"id":"/src/inputs/RadioGroup/index.ts","moduleParts":{},"imported":[{"uid":"6c12-34"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-101":{"id":"/src/inputs/Scriptel/index.ts","moduleParts":{},"imported":[{"uid":"6c12-36"},{"uid":"6c12-38"},{"uid":"6c12-72"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-102":{"id":"/src/inputs/ScriptelInput/index.ts","moduleParts":{},"imported":[{"uid":"6c12-40"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-103":{"id":"/src/inputs/PhoneInput/index.ts","moduleParts":{},"imported":[{"uid":"6c12-42"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-104":{"id":"/src/inputs/CreditCardInput/index.ts","moduleParts":{},"imported":[{"uid":"6c12-44"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-105":{"id":"/src/inputs/SinInput/index.ts","moduleParts":{},"imported":[{"uid":"6c12-66"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-106":{"id":"/src/inputs/TableInput/index.ts","moduleParts":{},"imported":[{"uid":"6c12-46"},{"uid":"6c12-48"},{"uid":"6c12-50"},{"uid":"6c12-52"},{"uid":"6c12-54"},{"uid":"6c12-56"},{"uid":"6c12-58"},{"uid":"6c12-60"},{"uid":"6c12-62"},{"uid":"6c12-64"},{"uid":"6c12-14"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-107":{"id":"/src/money/MoneyInput/index.ts","moduleParts":{},"imported":[{"uid":"6c12-68"}],"importedBy":[{"uid":"6c12-0"},{"uid":"6c12-50"}]},"6c12-108":{"id":"/src/money/MoneyCurrencyInput/index.ts","moduleParts":{},"imported":[{"uid":"6c12-70"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-109":{"id":"/src/step/index.ts","moduleParts":{},"imported":[{"uid":"6c12-6"},{"uid":"6c12-4"},{"uid":"6c12-8"},{"uid":"6c12-10"}],"importedBy":[{"uid":"6c12-0"}]},"6c12-110":{"id":"@thx/money","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-2"},{"uid":"6c12-48"},{"uid":"6c12-58"},{"uid":"6c12-68"},{"uid":"6c12-70"}],"isExternal":true},"6c12-111":{"id":"debug","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-2"},{"uid":"6c12-18"},{"uid":"6c12-16"},{"uid":"6c12-22"},{"uid":"6c12-20"},{"uid":"6c12-24"},{"uid":"6c12-26"},{"uid":"6c12-28"},{"uid":"6c12-32"},{"uid":"6c12-12"},{"uid":"6c12-34"},{"uid":"6c12-36"},{"uid":"6c12-40"},{"uid":"6c12-42"},{"uid":"6c12-44"},{"uid":"6c12-66"},{"uid":"6c12-46"},{"uid":"6c12-50"},{"uid":"6c12-54"},{"uid":"6c12-56"},{"uid":"6c12-60"},{"uid":"6c12-64"},{"uid":"6c12-68"},{"uid":"6c12-70"},{"uid":"6c12-6"},{"uid":"6c12-8"},{"uid":"6c12-10"},{"uid":"6c12-84"},{"uid":"6c12-80"},{"uid":"6c12-88"},{"uid":"6c12-86"}],"isExternal":true},"6c12-112":{"id":"inputmask","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-2"},{"uid":"6c12-12"}],"isExternal":true},"6c12-113":{"id":"js-money","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-2"},{"uid":"6c12-68"},{"uid":"6c12-70"}],"isExternal":true},"6c12-114":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-2"},{"uid":"6c12-18"},{"uid":"6c12-16"},{"uid":"6c12-22"},{"uid":"6c12-20"},{"uid":"6c12-24"},{"uid":"6c12-26"},{"uid":"6c12-28"},{"uid":"6c12-30"},{"uid":"6c12-32"},{"uid":"6c12-12"},{"uid":"6c12-34"},{"uid":"6c12-36"},{"uid":"6c12-38"},{"uid":"6c12-40"},{"uid":"6c12-42"},{"uid":"6c12-44"},{"uid":"6c12-66"},{"uid":"6c12-46"},{"uid":"6c12-48"},{"uid":"6c12-50"},{"uid":"6c12-52"},{"uid":"6c12-54"},{"uid":"6c12-56"},{"uid":"6c12-58"},{"uid":"6c12-60"},{"uid":"6c12-62"},{"uid":"6c12-64"},{"uid":"6c12-68"},{"uid":"6c12-70"},{"uid":"6c12-6"},{"uid":"6c12-4"},{"uid":"6c12-8"},{"uid":"6c12-10"},{"uid":"6c12-84"},{"uid":"6c12-80"},{"uid":"6c12-82"},{"uid":"6c12-86"},{"uid":"6c12-74"}],"isExternal":true},"6c12-115":{"id":"@thx/date","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-18"},{"uid":"6c12-22"},{"uid":"6c12-20"},{"uid":"6c12-24"},{"uid":"6c12-44"},{"uid":"6c12-52"}],"isExternal":true},"6c12-116":{"id":"semantic-ui-react","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-18"},{"uid":"6c12-16"},{"uid":"6c12-20"},{"uid":"6c12-24"},{"uid":"6c12-26"},{"uid":"6c12-30"},{"uid":"6c12-32"},{"uid":"6c12-34"},{"uid":"6c12-40"},{"uid":"6c12-44"},{"uid":"6c12-66"},{"uid":"6c12-46"},{"uid":"6c12-54"},{"uid":"6c12-60"},{"uid":"6c12-62"},{"uid":"6c12-68"},{"uid":"6c12-70"},{"uid":"6c12-10"},{"uid":"6c12-86"}],"isExternal":true},"6c12-117":{"id":"/src/date/DatePicker/index.ts","moduleParts":{},"imported":[{"uid":"6c12-128"},{"uid":"6c12-76"}],"importedBy":[{"uid":"6c12-18"},{"uid":"6c12-22"},{"uid":"6c12-20"},{"uid":"6c12-24"}]},"6c12-118":{"id":"@js-joda/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-16"},{"uid":"6c12-22"},{"uid":"6c12-24"}],"isExternal":true},"6c12-119":{"id":"formik","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-28"},{"uid":"6c12-30"},{"uid":"6c12-46"}],"isExternal":true},"6c12-120":{"id":"flat","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-30"}],"isExternal":true},"6c12-121":{"id":"lodash-es","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-30"}],"isExternal":true},"6c12-122":{"id":"use-deep-compare-effect","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-12"}],"isExternal":true},"6c12-123":{"id":"react-credit-cards","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-44"}],"isExternal":true},"6c12-124":{"id":"react-credit-cards/es/styles-compiled.css","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-44"}],"isExternal":true},"6c12-125":{"id":"social-insurance-number","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-66"}],"isExternal":true},"6c12-126":{"id":"react-table","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-46"}],"isExternal":true},"6c12-127":{"id":"react-router-dom","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-10"}],"isExternal":true},"6c12-128":{"id":"react-datepicker","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-117"}],"isExternal":true},"6c12-129":{"id":"eventemitter3","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-88"}],"isExternal":true},"6c12-130":{"id":"credit-card-type","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-86"}],"isExternal":true},"6c12-131":{"id":"luhn","moduleParts":{},"imported":[],"importedBy":[{"uid":"6c12-86"}],"isExternal":true}},"env":{"rollup":"2.70.1"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
2672
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src/index.ts","uid":"09fb-1"}]},{"name":"step/useStep.js","children":[{"name":"src/step/useStep.ts","uid":"09fb-3"}]},{"name":"step/Step.js","children":[{"name":"src/step/Step.tsx","uid":"09fb-5"}]},{"name":"step/FormStep.js","children":[{"name":"src/step/FormStep.tsx","uid":"09fb-7"}]},{"name":"step/StepProvider.js","children":[{"name":"src/step/StepProvider.tsx","uid":"09fb-9"}]},{"name":"inputs/MaskedInput/useMaskedInput.js","children":[{"name":"src/inputs/MaskedInput/useMaskedInput.ts","uid":"09fb-11"}]},{"name":"date/LocalDatePicker/LocalDatePicker.js","children":[{"name":"src/date/LocalDatePicker/LocalDatePicker.tsx","uid":"09fb-13"}]},{"name":"date/LocalMonthSelect/LocalMonthSelect.js","children":[{"name":"src/date/LocalMonthSelect/LocalMonthSelect.tsx","uid":"09fb-15"}]},{"name":"date/LocalTimePicker/LocalTimePicker.js","children":[{"name":"src/date/LocalTimePicker/LocalTimePicker.tsx","uid":"09fb-17"}]},{"name":"date/MonthDayPicker/MonthDayPicker.js","children":[{"name":"src/date/MonthDayPicker/MonthDayPicker.tsx","uid":"09fb-19"}]},{"name":"date/MonthYearPicker/MonthYearPicker.js","children":[{"name":"src/date/MonthYearPicker/MonthYearPicker.tsx","uid":"09fb-21"}]},{"name":"form/TForm/TForm.js","children":[{"name":"src/form/TForm/TForm.tsx","uid":"09fb-23"}]},{"name":"date/YearSelect/YearSelect.js","children":[{"name":"src/date/YearSelect/YearSelect.tsx","uid":"09fb-25"}]},{"name":"form/TForm/useTForm.js","children":[{"name":"src/form/TForm/useTForm.tsx","uid":"09fb-27"}]},{"name":"inputs/MaskedInput/MaskedInput.js","children":[{"name":"src/inputs/MaskedInput/MaskedInput.tsx","uid":"09fb-29"}]},{"name":"inputs/Scriptel/withScriptel.js","children":[{"name":"src/inputs/Scriptel/withScriptel.tsx","uid":"09fb-31"}]},{"name":"inputs/Scriptel/Scriptel.js","children":[{"name":"src/inputs/Scriptel/Scriptel.tsx","uid":"09fb-33"}]},{"name":"inputs/RadioGroup/RadioGroup.js","children":[{"name":"src/inputs/RadioGroup/RadioGroup.tsx","uid":"09fb-35"}]},{"name":"inputs/TableInput/addRowOnTab.js","children":[{"name":"src/inputs/TableInput/addRowOnTab.ts","uid":"09fb-37"}]},{"name":"inputs/ScriptelInput/ScriptelInput.js","children":[{"name":"src/inputs/ScriptelInput/ScriptelInput.tsx","uid":"09fb-39"}]},{"name":"inputs/PhoneInput/PhoneInput.js","children":[{"name":"src/inputs/PhoneInput/PhoneInput.tsx","uid":"09fb-41"}]},{"name":"inputs/CreditCardInput/CreditCardInput.js","children":[{"name":"src/inputs/CreditCardInput/CreditCardInput.tsx","uid":"09fb-43"}]},{"name":"inputs/SinInput/SinInput.js","children":[{"name":"src/inputs/SinInput/SinInput.tsx","uid":"09fb-45"}]},{"name":"money/MoneyInput/MoneyInput.js","children":[{"name":"src/money/MoneyInput/MoneyInput.tsx","uid":"09fb-47"}]},{"name":"inputs/TableInput/TableInput.js","children":[{"name":"src/inputs/TableInput/TableInput.tsx","uid":"09fb-49"}]},{"name":"inputs/TableInput/MoneyCell.js","children":[{"name":"src/inputs/TableInput/MoneyCell.tsx","uid":"09fb-51"}]},{"name":"inputs/TableInput/MoneyEditCell.js","children":[{"name":"src/inputs/TableInput/MoneyEditCell.tsx","uid":"09fb-53"}]},{"name":"inputs/TableInput/LocalDateCell.js","children":[{"name":"src/inputs/TableInput/LocalDateCell.tsx","uid":"09fb-55"}]},{"name":"inputs/TableInput/CheckboxEditCell.js","children":[{"name":"src/inputs/TableInput/CheckboxEditCell.tsx","uid":"09fb-57"}]},{"name":"inputs/TableInput/LocalDateEditCell.js","children":[{"name":"src/inputs/TableInput/LocalDateEditCell.tsx","uid":"09fb-59"}]},{"name":"inputs/TableInput/MoneySumFooter.js","children":[{"name":"src/inputs/TableInput/MoneySumFooter.tsx","uid":"09fb-61"}]},{"name":"inputs/TableInput/StringEditCell.js","children":[{"name":"src/inputs/TableInput/StringEditCell.tsx","uid":"09fb-63"}]},{"name":"inputs/TableInput/DropdownCell.js","children":[{"name":"src/inputs/TableInput/DropdownCell.tsx","uid":"09fb-65"}]},{"name":"inputs/TableInput/HoverCell.js","children":[{"name":"src/inputs/TableInput/HoverCell.tsx","uid":"09fb-67"}]},{"name":"money/MoneyCurrencyInput/MoneyCurrencyInput.js","children":[{"name":"src/money/MoneyCurrencyInput/MoneyCurrencyInput.tsx","uid":"09fb-69"}]},{"name":"inputs/Scriptel/scriptel/enums.js","children":[{"name":"src/inputs/Scriptel/scriptel/enums.ts","uid":"09fb-71"}]},{"name":"step/stepContext.js","children":[{"name":"src/step/stepContext.ts","uid":"09fb-73"}]},{"name":"inputs/CreditCardInput/styles.css.js","children":[{"name":"src/inputs/CreditCardInput/styles.css","uid":"09fb-75"}]},{"name":"date/DatePicker/styles.css.js","children":[{"name":"src/date/DatePicker/styles.css","uid":"09fb-77"}]},{"name":"inputs/Scriptel/ScriptelContext.js","children":[{"name":"src/inputs/Scriptel/ScriptelContext.ts","uid":"09fb-79"}]},{"name":"date/LocalDatePicker/MaskedDateInput.js","children":[{"name":"src/date/LocalDatePicker/MaskedDateInput.tsx","uid":"09fb-81"}]},{"name":"date/LocalTimePicker/MaskedTimeInput.js","children":[{"name":"src/date/LocalTimePicker/MaskedTimeInput.tsx","uid":"09fb-83"}]},{"name":"inputs/CreditCardInput/CreditCardNumberInput.js","children":[{"name":"src/inputs/CreditCardInput/CreditCardNumberInput.tsx","uid":"09fb-85"}]},{"name":"inputs/Scriptel/scriptel/index.js","children":[{"name":"src/inputs/Scriptel/scriptel/index.ts","uid":"09fb-87"}]},{"name":"external/style-inject/dist/style-inject.es.js","children":[{"name":"home/runner/work/thr-addons/thr-addons/node_modules/style-inject/dist/style-inject.es.js","uid":"09fb-89"}]}],"isRoot":true},"nodeParts":{"09fb-1":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"mainUid":"09fb-0"},"09fb-3":{"renderedLength":113,"gzipLength":106,"brotliLength":82,"mainUid":"09fb-2"},"09fb-5":{"renderedLength":203,"gzipLength":157,"brotliLength":111,"mainUid":"09fb-4"},"09fb-7":{"renderedLength":440,"gzipLength":270,"brotliLength":214,"mainUid":"09fb-6"},"09fb-9":{"renderedLength":3529,"gzipLength":1021,"brotliLength":861,"mainUid":"09fb-8"},"09fb-11":{"renderedLength":1487,"gzipLength":502,"brotliLength":423,"mainUid":"09fb-10"},"09fb-13":{"renderedLength":2907,"gzipLength":898,"brotliLength":796,"mainUid":"09fb-12"},"09fb-15":{"renderedLength":1135,"gzipLength":503,"brotliLength":415,"mainUid":"09fb-14"},"09fb-17":{"renderedLength":1205,"gzipLength":488,"brotliLength":402,"mainUid":"09fb-16"},"09fb-19":{"renderedLength":1965,"gzipLength":657,"brotliLength":544,"mainUid":"09fb-18"},"09fb-21":{"renderedLength":1229,"gzipLength":491,"brotliLength":424,"mainUid":"09fb-20"},"09fb-23":{"renderedLength":600,"gzipLength":307,"brotliLength":267,"mainUid":"09fb-22"},"09fb-25":{"renderedLength":1553,"gzipLength":580,"brotliLength":461,"mainUid":"09fb-24"},"09fb-27":{"renderedLength":2930,"gzipLength":959,"brotliLength":816,"mainUid":"09fb-26"},"09fb-29":{"renderedLength":390,"gzipLength":237,"brotliLength":203,"mainUid":"09fb-28"},"09fb-31":{"renderedLength":275,"gzipLength":163,"brotliLength":130,"mainUid":"09fb-30"},"09fb-33":{"renderedLength":1275,"gzipLength":476,"brotliLength":406,"mainUid":"09fb-32"},"09fb-35":{"renderedLength":561,"gzipLength":301,"brotliLength":259,"mainUid":"09fb-34"},"09fb-37":{"renderedLength":312,"gzipLength":199,"brotliLength":173,"mainUid":"09fb-36"},"09fb-39":{"renderedLength":1963,"gzipLength":648,"brotliLength":547,"mainUid":"09fb-38"},"09fb-41":{"renderedLength":381,"gzipLength":248,"brotliLength":218,"mainUid":"09fb-40"},"09fb-43":{"renderedLength":2324,"gzipLength":586,"brotliLength":495,"mainUid":"09fb-42"},"09fb-45":{"renderedLength":1144,"gzipLength":530,"brotliLength":462,"mainUid":"09fb-44"},"09fb-47":{"renderedLength":945,"gzipLength":488,"brotliLength":381,"mainUid":"09fb-46"},"09fb-49":{"renderedLength":2788,"gzipLength":828,"brotliLength":734,"mainUid":"09fb-48"},"09fb-51":{"renderedLength":257,"gzipLength":187,"brotliLength":149,"mainUid":"09fb-50"},"09fb-53":{"renderedLength":708,"gzipLength":368,"brotliLength":313,"mainUid":"09fb-52"},"09fb-55":{"renderedLength":264,"gzipLength":191,"brotliLength":154,"mainUid":"09fb-54"},"09fb-57":{"renderedLength":746,"gzipLength":384,"brotliLength":333,"mainUid":"09fb-56"},"09fb-59":{"renderedLength":695,"gzipLength":350,"brotliLength":295,"mainUid":"09fb-58"},"09fb-61":{"renderedLength":414,"gzipLength":261,"brotliLength":219,"mainUid":"09fb-60"},"09fb-63":{"renderedLength":717,"gzipLength":369,"brotliLength":319,"mainUid":"09fb-62"},"09fb-65":{"renderedLength":493,"gzipLength":255,"brotliLength":211,"mainUid":"09fb-64"},"09fb-67":{"renderedLength":403,"gzipLength":245,"brotliLength":195,"mainUid":"09fb-66"},"09fb-69":{"renderedLength":1724,"gzipLength":707,"brotliLength":597,"mainUid":"09fb-68"},"09fb-71":{"renderedLength":937,"gzipLength":292,"brotliLength":231,"mainUid":"09fb-70"},"09fb-73":{"renderedLength":80,"gzipLength":90,"brotliLength":72,"mainUid":"09fb-72"},"09fb-75":{"renderedLength":78,"gzipLength":92,"brotliLength":79,"mainUid":"09fb-74"},"09fb-77":{"renderedLength":538,"gzipLength":263,"brotliLength":211,"mainUid":"09fb-76"},"09fb-79":{"renderedLength":46,"gzipLength":60,"brotliLength":45,"mainUid":"09fb-78"},"09fb-81":{"renderedLength":464,"gzipLength":299,"brotliLength":256,"mainUid":"09fb-80"},"09fb-83":{"renderedLength":446,"gzipLength":290,"brotliLength":241,"mainUid":"09fb-82"},"09fb-85":{"renderedLength":1713,"gzipLength":687,"brotliLength":585,"mainUid":"09fb-84"},"09fb-87":{"renderedLength":2530,"gzipLength":860,"brotliLength":739,"mainUid":"09fb-86"},"09fb-89":{"renderedLength":636,"gzipLength":318,"brotliLength":242,"mainUid":"09fb-88"}},"nodeMetas":{"09fb-0":{"id":"/src/index.ts","moduleParts":{"index.js":"09fb-1"},"imported":[{"uid":"09fb-90"},{"uid":"09fb-91"},{"uid":"09fb-92"},{"uid":"09fb-93"},{"uid":"09fb-94"},{"uid":"09fb-95"},{"uid":"09fb-96"},{"uid":"09fb-97"},{"uid":"09fb-98"},{"uid":"09fb-99"},{"uid":"09fb-100"},{"uid":"09fb-101"},{"uid":"09fb-102"},{"uid":"09fb-103"},{"uid":"09fb-104"},{"uid":"09fb-105"},{"uid":"09fb-106"},{"uid":"09fb-107"}],"importedBy":[],"isEntry":true},"09fb-2":{"id":"/src/step/useStep.ts","moduleParts":{"step/useStep.js":"09fb-3"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-72"}],"importedBy":[{"uid":"09fb-107"},{"uid":"09fb-6"}]},"09fb-4":{"id":"/src/step/Step.tsx","moduleParts":{"step/Step.js":"09fb-5"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"}],"importedBy":[{"uid":"09fb-107"},{"uid":"09fb-8"}]},"09fb-6":{"id":"/src/step/FormStep.tsx","moduleParts":{"step/FormStep.js":"09fb-7"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-2"}],"importedBy":[{"uid":"09fb-107"},{"uid":"09fb-8"}]},"09fb-8":{"id":"/src/step/StepProvider.tsx","moduleParts":{"step/StepProvider.js":"09fb-9"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-126"},{"uid":"09fb-111"},{"uid":"09fb-6"},{"uid":"09fb-4"},{"uid":"09fb-72"}],"importedBy":[{"uid":"09fb-107"}]},"09fb-10":{"id":"/src/inputs/MaskedInput/useMaskedInput.ts","moduleParts":{"inputs/MaskedInput/useMaskedInput.js":"09fb-11"},"imported":[{"uid":"09fb-110"},{"uid":"09fb-117"},{"uid":"09fb-108"},{"uid":"09fb-118"}],"importedBy":[{"uid":"09fb-97"},{"uid":"09fb-28"},{"uid":"09fb-44"},{"uid":"09fb-84"}]},"09fb-12":{"id":"/src/date/LocalDatePicker/LocalDatePicker.tsx","moduleParts":{"date/LocalDatePicker/LocalDatePicker.js":"09fb-13"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-109"},{"uid":"09fb-110"},{"uid":"09fb-111"},{"uid":"09fb-112"},{"uid":"09fb-76"},{"uid":"09fb-80"}],"importedBy":[{"uid":"09fb-90"}]},"09fb-14":{"id":"/src/date/LocalMonthSelect/LocalMonthSelect.tsx","moduleParts":{"date/LocalMonthSelect/LocalMonthSelect.js":"09fb-15"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-113"},{"uid":"09fb-110"},{"uid":"09fb-111"}],"importedBy":[{"uid":"09fb-91"}]},"09fb-16":{"id":"/src/date/LocalTimePicker/LocalTimePicker.tsx","moduleParts":{"date/LocalTimePicker/LocalTimePicker.js":"09fb-17"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-113"},{"uid":"09fb-109"},{"uid":"09fb-110"},{"uid":"09fb-112"},{"uid":"09fb-82"}],"importedBy":[{"uid":"09fb-92"}]},"09fb-18":{"id":"/src/date/MonthDayPicker/MonthDayPicker.tsx","moduleParts":{"date/MonthDayPicker/MonthDayPicker.js":"09fb-19"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-109"},{"uid":"09fb-110"},{"uid":"09fb-111"},{"uid":"09fb-112"}],"importedBy":[{"uid":"09fb-93"}]},"09fb-20":{"id":"/src/date/MonthYearPicker/MonthYearPicker.tsx","moduleParts":{"date/MonthYearPicker/MonthYearPicker.js":"09fb-21"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-113"},{"uid":"09fb-109"},{"uid":"09fb-110"},{"uid":"09fb-111"},{"uid":"09fb-112"}],"importedBy":[{"uid":"09fb-94"}]},"09fb-22":{"id":"/src/form/TForm/TForm.tsx","moduleParts":{"form/TForm/TForm.js":"09fb-23"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-114"},{"uid":"09fb-26"}],"importedBy":[{"uid":"09fb-96"}]},"09fb-24":{"id":"/src/date/YearSelect/YearSelect.tsx","moduleParts":{"date/YearSelect/YearSelect.js":"09fb-25"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-111"}],"importedBy":[{"uid":"09fb-95"}]},"09fb-26":{"id":"/src/form/TForm/useTForm.tsx","moduleParts":{"form/TForm/useTForm.js":"09fb-27"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-115"},{"uid":"09fb-114"},{"uid":"09fb-116"},{"uid":"09fb-111"}],"importedBy":[{"uid":"09fb-96"},{"uid":"09fb-22"}]},"09fb-28":{"id":"/src/inputs/MaskedInput/MaskedInput.tsx","moduleParts":{"inputs/MaskedInput/MaskedInput.js":"09fb-29"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-111"},{"uid":"09fb-10"}],"importedBy":[{"uid":"09fb-97"}]},"09fb-30":{"id":"/src/inputs/Scriptel/withScriptel.tsx","moduleParts":{"inputs/Scriptel/withScriptel.js":"09fb-31"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-32"}],"importedBy":[{"uid":"09fb-99"}]},"09fb-32":{"id":"/src/inputs/Scriptel/Scriptel.tsx","moduleParts":{"inputs/Scriptel/Scriptel.js":"09fb-33"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-78"},{"uid":"09fb-86"}],"importedBy":[{"uid":"09fb-99"},{"uid":"09fb-30"}]},"09fb-34":{"id":"/src/inputs/RadioGroup/RadioGroup.tsx","moduleParts":{"inputs/RadioGroup/RadioGroup.js":"09fb-35"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-111"}],"importedBy":[{"uid":"09fb-98"}]},"09fb-36":{"id":"/src/inputs/TableInput/addRowOnTab.ts","moduleParts":{"inputs/TableInput/addRowOnTab.js":"09fb-37"},"imported":[],"importedBy":[{"uid":"09fb-104"},{"uid":"09fb-52"},{"uid":"09fb-56"},{"uid":"09fb-62"}]},"09fb-38":{"id":"/src/inputs/ScriptelInput/ScriptelInput.tsx","moduleParts":{"inputs/ScriptelInput/ScriptelInput.js":"09fb-39"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-111"},{"uid":"09fb-78"}],"importedBy":[{"uid":"09fb-100"}]},"09fb-40":{"id":"/src/inputs/PhoneInput/PhoneInput.tsx","moduleParts":{"inputs/PhoneInput/PhoneInput.js":"09fb-41"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-97"}],"importedBy":[{"uid":"09fb-101"}]},"09fb-42":{"id":"/src/inputs/CreditCardInput/CreditCardInput.tsx","moduleParts":{"inputs/CreditCardInput/CreditCardInput.js":"09fb-43"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-109"},{"uid":"09fb-110"},{"uid":"09fb-119"},{"uid":"09fb-120"},{"uid":"09fb-111"},{"uid":"09fb-94"},{"uid":"09fb-84"},{"uid":"09fb-74"}],"importedBy":[{"uid":"09fb-102"}]},"09fb-44":{"id":"/src/inputs/SinInput/SinInput.tsx","moduleParts":{"inputs/SinInput/SinInput.js":"09fb-45"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-111"},{"uid":"09fb-121"},{"uid":"09fb-10"}],"importedBy":[{"uid":"09fb-103"}]},"09fb-46":{"id":"/src/money/MoneyInput/MoneyInput.tsx","moduleParts":{"money/MoneyInput/MoneyInput.js":"09fb-47"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-111"},{"uid":"09fb-124"},{"uid":"09fb-123"}],"importedBy":[{"uid":"09fb-105"}]},"09fb-48":{"id":"/src/inputs/TableInput/TableInput.tsx","moduleParts":{"inputs/TableInput/TableInput.js":"09fb-49"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-114"},{"uid":"09fb-122"},{"uid":"09fb-111"}],"importedBy":[{"uid":"09fb-104"}]},"09fb-50":{"id":"/src/inputs/TableInput/MoneyCell.tsx","moduleParts":{"inputs/TableInput/MoneyCell.js":"09fb-51"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-123"}],"importedBy":[{"uid":"09fb-104"}]},"09fb-52":{"id":"/src/inputs/TableInput/MoneyEditCell.tsx","moduleParts":{"inputs/TableInput/MoneyEditCell.js":"09fb-53"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-105"},{"uid":"09fb-36"}],"importedBy":[{"uid":"09fb-104"}]},"09fb-54":{"id":"/src/inputs/TableInput/LocalDateCell.tsx","moduleParts":{"inputs/TableInput/LocalDateCell.js":"09fb-55"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-109"}],"importedBy":[{"uid":"09fb-104"}]},"09fb-56":{"id":"/src/inputs/TableInput/CheckboxEditCell.tsx","moduleParts":{"inputs/TableInput/CheckboxEditCell.js":"09fb-57"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-111"},{"uid":"09fb-36"}],"importedBy":[{"uid":"09fb-104"}]},"09fb-58":{"id":"/src/inputs/TableInput/LocalDateEditCell.tsx","moduleParts":{"inputs/TableInput/LocalDateEditCell.js":"09fb-59"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-90"}],"importedBy":[{"uid":"09fb-104"}]},"09fb-60":{"id":"/src/inputs/TableInput/MoneySumFooter.tsx","moduleParts":{"inputs/TableInput/MoneySumFooter.js":"09fb-61"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-123"}],"importedBy":[{"uid":"09fb-104"}]},"09fb-62":{"id":"/src/inputs/TableInput/StringEditCell.tsx","moduleParts":{"inputs/TableInput/StringEditCell.js":"09fb-63"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-111"},{"uid":"09fb-36"}],"importedBy":[{"uid":"09fb-104"}]},"09fb-64":{"id":"/src/inputs/TableInput/DropdownCell.tsx","moduleParts":{"inputs/TableInput/DropdownCell.js":"09fb-65"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-111"}],"importedBy":[{"uid":"09fb-104"}]},"09fb-66":{"id":"/src/inputs/TableInput/HoverCell.tsx","moduleParts":{"inputs/TableInput/HoverCell.js":"09fb-67"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"}],"importedBy":[{"uid":"09fb-104"}]},"09fb-68":{"id":"/src/money/MoneyCurrencyInput/MoneyCurrencyInput.tsx","moduleParts":{"money/MoneyCurrencyInput/MoneyCurrencyInput.js":"09fb-69"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-123"},{"uid":"09fb-110"},{"uid":"09fb-125"},{"uid":"09fb-111"},{"uid":"09fb-124"}],"importedBy":[{"uid":"09fb-106"}]},"09fb-70":{"id":"/src/inputs/Scriptel/scriptel/enums.ts","moduleParts":{"inputs/Scriptel/scriptel/enums.js":"09fb-71"},"imported":[],"importedBy":[{"uid":"09fb-99"},{"uid":"09fb-86"}]},"09fb-72":{"id":"/src/step/stepContext.ts","moduleParts":{"step/stepContext.js":"09fb-73"},"imported":[{"uid":"09fb-108"}],"importedBy":[{"uid":"09fb-2"},{"uid":"09fb-8"}]},"09fb-74":{"id":"/src/inputs/CreditCardInput/styles.css","moduleParts":{"inputs/CreditCardInput/styles.css.js":"09fb-75"},"imported":[{"uid":"09fb-88"}],"importedBy":[{"uid":"09fb-42"}]},"09fb-76":{"id":"/src/date/DatePicker/styles.css","moduleParts":{"date/DatePicker/styles.css.js":"09fb-77"},"imported":[{"uid":"09fb-88"}],"importedBy":[{"uid":"09fb-12"},{"uid":"09fb-112"}]},"09fb-78":{"id":"/src/inputs/Scriptel/ScriptelContext.ts","moduleParts":{"inputs/Scriptel/ScriptelContext.js":"09fb-79"},"imported":[{"uid":"09fb-108"}],"importedBy":[{"uid":"09fb-32"},{"uid":"09fb-38"}]},"09fb-80":{"id":"/src/date/LocalDatePicker/MaskedDateInput.tsx","moduleParts":{"date/LocalDatePicker/MaskedDateInput.js":"09fb-81"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-97"}],"importedBy":[{"uid":"09fb-12"}]},"09fb-82":{"id":"/src/date/LocalTimePicker/MaskedTimeInput.tsx","moduleParts":{"date/LocalTimePicker/MaskedTimeInput.js":"09fb-83"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-110"},{"uid":"09fb-97"}],"importedBy":[{"uid":"09fb-16"}]},"09fb-84":{"id":"/src/inputs/CreditCardInput/CreditCardNumberInput.tsx","moduleParts":{"inputs/CreditCardInput/CreditCardNumberInput.js":"09fb-85"},"imported":[{"uid":"09fb-108"},{"uid":"09fb-129"},{"uid":"09fb-110"},{"uid":"09fb-130"},{"uid":"09fb-111"},{"uid":"09fb-10"}],"importedBy":[{"uid":"09fb-42"}]},"09fb-86":{"id":"/src/inputs/Scriptel/scriptel/index.ts","moduleParts":{"inputs/Scriptel/scriptel/index.js":"09fb-87"},"imported":[{"uid":"09fb-110"},{"uid":"09fb-128"},{"uid":"09fb-70"}],"importedBy":[{"uid":"09fb-32"}]},"09fb-88":{"id":"/home/runner/work/thr-addons/thr-addons/node_modules/style-inject/dist/style-inject.es.js","moduleParts":{"external/style-inject/dist/style-inject.es.js":"09fb-89"},"imported":[],"importedBy":[{"uid":"09fb-76"},{"uid":"09fb-74"}]},"09fb-90":{"id":"/src/date/LocalDatePicker/index.ts","moduleParts":{},"imported":[{"uid":"09fb-12"}],"importedBy":[{"uid":"09fb-0"},{"uid":"09fb-58"}]},"09fb-91":{"id":"/src/date/LocalMonthSelect/index.ts","moduleParts":{},"imported":[{"uid":"09fb-14"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-92":{"id":"/src/date/LocalTimePicker/index.ts","moduleParts":{},"imported":[{"uid":"09fb-16"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-93":{"id":"/src/date/MonthDayPicker/index.ts","moduleParts":{},"imported":[{"uid":"09fb-18"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-94":{"id":"/src/date/MonthYearPicker/index.ts","moduleParts":{},"imported":[{"uid":"09fb-20"}],"importedBy":[{"uid":"09fb-0"},{"uid":"09fb-42"}]},"09fb-95":{"id":"/src/date/YearSelect/index.ts","moduleParts":{},"imported":[{"uid":"09fb-24"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-96":{"id":"/src/form/TForm/index.ts","moduleParts":{},"imported":[{"uid":"09fb-22"},{"uid":"09fb-26"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-97":{"id":"/src/inputs/MaskedInput/index.ts","moduleParts":{},"imported":[{"uid":"09fb-28"},{"uid":"09fb-10"}],"importedBy":[{"uid":"09fb-0"},{"uid":"09fb-40"},{"uid":"09fb-80"},{"uid":"09fb-82"}]},"09fb-98":{"id":"/src/inputs/RadioGroup/index.ts","moduleParts":{},"imported":[{"uid":"09fb-34"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-99":{"id":"/src/inputs/Scriptel/index.ts","moduleParts":{},"imported":[{"uid":"09fb-32"},{"uid":"09fb-30"},{"uid":"09fb-70"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-100":{"id":"/src/inputs/ScriptelInput/index.ts","moduleParts":{},"imported":[{"uid":"09fb-38"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-101":{"id":"/src/inputs/PhoneInput/index.ts","moduleParts":{},"imported":[{"uid":"09fb-40"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-102":{"id":"/src/inputs/CreditCardInput/index.ts","moduleParts":{},"imported":[{"uid":"09fb-42"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-103":{"id":"/src/inputs/SinInput/index.ts","moduleParts":{},"imported":[{"uid":"09fb-44"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-104":{"id":"/src/inputs/TableInput/index.ts","moduleParts":{},"imported":[{"uid":"09fb-48"},{"uid":"09fb-50"},{"uid":"09fb-52"},{"uid":"09fb-54"},{"uid":"09fb-56"},{"uid":"09fb-58"},{"uid":"09fb-60"},{"uid":"09fb-62"},{"uid":"09fb-64"},{"uid":"09fb-66"},{"uid":"09fb-36"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-105":{"id":"/src/money/MoneyInput/index.ts","moduleParts":{},"imported":[{"uid":"09fb-46"}],"importedBy":[{"uid":"09fb-0"},{"uid":"09fb-52"}]},"09fb-106":{"id":"/src/money/MoneyCurrencyInput/index.ts","moduleParts":{},"imported":[{"uid":"09fb-68"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-107":{"id":"/src/step/index.ts","moduleParts":{},"imported":[{"uid":"09fb-4"},{"uid":"09fb-2"},{"uid":"09fb-6"},{"uid":"09fb-8"}],"importedBy":[{"uid":"09fb-0"}]},"09fb-108":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-12"},{"uid":"09fb-14"},{"uid":"09fb-16"},{"uid":"09fb-18"},{"uid":"09fb-20"},{"uid":"09fb-24"},{"uid":"09fb-22"},{"uid":"09fb-26"},{"uid":"09fb-28"},{"uid":"09fb-10"},{"uid":"09fb-34"},{"uid":"09fb-32"},{"uid":"09fb-30"},{"uid":"09fb-38"},{"uid":"09fb-40"},{"uid":"09fb-42"},{"uid":"09fb-44"},{"uid":"09fb-48"},{"uid":"09fb-50"},{"uid":"09fb-52"},{"uid":"09fb-54"},{"uid":"09fb-56"},{"uid":"09fb-58"},{"uid":"09fb-60"},{"uid":"09fb-62"},{"uid":"09fb-64"},{"uid":"09fb-66"},{"uid":"09fb-46"},{"uid":"09fb-68"},{"uid":"09fb-4"},{"uid":"09fb-2"},{"uid":"09fb-6"},{"uid":"09fb-8"},{"uid":"09fb-80"},{"uid":"09fb-82"},{"uid":"09fb-78"},{"uid":"09fb-84"},{"uid":"09fb-72"}],"isExternal":true},"09fb-109":{"id":"@thx/date","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-12"},{"uid":"09fb-16"},{"uid":"09fb-18"},{"uid":"09fb-20"},{"uid":"09fb-42"},{"uid":"09fb-54"}],"isExternal":true},"09fb-110":{"id":"debug","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-12"},{"uid":"09fb-14"},{"uid":"09fb-16"},{"uid":"09fb-18"},{"uid":"09fb-20"},{"uid":"09fb-24"},{"uid":"09fb-22"},{"uid":"09fb-28"},{"uid":"09fb-10"},{"uid":"09fb-34"},{"uid":"09fb-32"},{"uid":"09fb-38"},{"uid":"09fb-40"},{"uid":"09fb-42"},{"uid":"09fb-44"},{"uid":"09fb-48"},{"uid":"09fb-52"},{"uid":"09fb-56"},{"uid":"09fb-58"},{"uid":"09fb-62"},{"uid":"09fb-66"},{"uid":"09fb-46"},{"uid":"09fb-68"},{"uid":"09fb-4"},{"uid":"09fb-6"},{"uid":"09fb-8"},{"uid":"09fb-80"},{"uid":"09fb-82"},{"uid":"09fb-86"},{"uid":"09fb-84"}],"isExternal":true},"09fb-111":{"id":"semantic-ui-react","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-12"},{"uid":"09fb-14"},{"uid":"09fb-18"},{"uid":"09fb-20"},{"uid":"09fb-24"},{"uid":"09fb-26"},{"uid":"09fb-28"},{"uid":"09fb-34"},{"uid":"09fb-38"},{"uid":"09fb-42"},{"uid":"09fb-44"},{"uid":"09fb-48"},{"uid":"09fb-56"},{"uid":"09fb-62"},{"uid":"09fb-64"},{"uid":"09fb-46"},{"uid":"09fb-68"},{"uid":"09fb-8"},{"uid":"09fb-84"}],"isExternal":true},"09fb-112":{"id":"/src/date/DatePicker/index.ts","moduleParts":{},"imported":[{"uid":"09fb-127"},{"uid":"09fb-76"}],"importedBy":[{"uid":"09fb-12"},{"uid":"09fb-16"},{"uid":"09fb-18"},{"uid":"09fb-20"}]},"09fb-113":{"id":"@js-joda/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-14"},{"uid":"09fb-16"},{"uid":"09fb-20"}],"isExternal":true},"09fb-114":{"id":"formik","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-22"},{"uid":"09fb-26"},{"uid":"09fb-48"}],"isExternal":true},"09fb-115":{"id":"flat","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-26"}],"isExternal":true},"09fb-116":{"id":"lodash-es","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-26"}],"isExternal":true},"09fb-117":{"id":"inputmask","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-10"}],"isExternal":true},"09fb-118":{"id":"use-deep-compare-effect","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-10"}],"isExternal":true},"09fb-119":{"id":"react-credit-cards","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-42"}],"isExternal":true},"09fb-120":{"id":"react-credit-cards/es/styles-compiled.css","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-42"}],"isExternal":true},"09fb-121":{"id":"social-insurance-number","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-44"}],"isExternal":true},"09fb-122":{"id":"react-table","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-48"}],"isExternal":true},"09fb-123":{"id":"@thx/money","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-50"},{"uid":"09fb-60"},{"uid":"09fb-46"},{"uid":"09fb-68"}],"isExternal":true},"09fb-124":{"id":"react-currency-input-field","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-46"},{"uid":"09fb-68"}],"isExternal":true},"09fb-125":{"id":"js-money","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-68"}],"isExternal":true},"09fb-126":{"id":"react-router-dom","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-8"}],"isExternal":true},"09fb-127":{"id":"react-datepicker","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-112"}],"isExternal":true},"09fb-128":{"id":"eventemitter3","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-86"}],"isExternal":true},"09fb-129":{"id":"credit-card-type","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-84"}],"isExternal":true},"09fb-130":{"id":"luhn","moduleParts":{},"imported":[],"importedBy":[{"uid":"09fb-84"}],"isExternal":true}},"env":{"rollup":"2.70.1"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
2673
2673
 
2674
2674
  const run = () => {
2675
2675
  const width = window.innerWidth;
@@ -29,7 +29,6 @@ export { SinInput } from './inputs/SinInput';
29
29
  export type { SinInputProps } from './inputs/SinInput';
30
30
  export { TableInput, MoneyCell, MoneyEditCell, CheckboxEditCell, LocalDateCell, LocalDateEditCell, MoneySumFooter, StringEditCell, DropdownCell, HoverCell, addRowOnTab, } from './inputs/TableInput';
31
31
  export type { AddRowOnTabIf } from './inputs/TableInput';
32
- export { useMoneyInput } from './money/useMoneyInput';
33
32
  export { MoneyInput } from './money/MoneyInput';
34
33
  export type { MoneyInputProps } from './money/MoneyInput';
35
34
  export { MoneyCurrencyInput } from './money/MoneyCurrencyInput';
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
- import Money, { Currency, MoneyObject } from 'js-money';
2
+ import type { Currency } from 'js-money';
3
+ import type Money from 'js-money';
3
4
  import { InputProps } from 'semantic-ui-react';
4
5
  export interface MoneyInputProps {
5
6
  name?: string;
6
7
  onChange?: (value?: Money) => void;
7
- value?: Money | MoneyObject | undefined;
8
+ value?: Money | undefined;
8
9
  defaultCurrency?: Currency;
9
10
  onBlur?: (ev: any) => void;
10
11
  prefix?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thx/controls",
3
- "version": "16.6.2-alpha.0+faa1186",
3
+ "version": "16.6.2-alpha.4+6039b93",
4
4
  "description": "A collection of components designed with SemanticUI.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/thr-consulting/thr-addons/issues"
@@ -34,18 +34,19 @@
34
34
  "@thx/date": "^16.4.1",
35
35
  "@thx/money": "^16.0.0",
36
36
  "@thx/yup-types": "^16.0.0",
37
- "@types/inputmask": "^5.0.3",
37
+ "@types/inputmask": "^5.0.6",
38
38
  "@types/react-datepicker": "^4.1.7",
39
39
  "credit-card-type": "^9.1.0",
40
40
  "debug": "^4.3.4",
41
41
  "eventemitter3": "^4.0.0",
42
42
  "flat": "^5.0.0",
43
43
  "formik": "^2.2.9",
44
- "inputmask": "^5.0.8-beta.47",
44
+ "inputmask": "^5.0.8-beta.72",
45
45
  "js-money": "^0.6.3",
46
46
  "lodash-es": "^4.17.15",
47
47
  "luhn": "^2.4.1",
48
48
  "react-credit-cards": "^0.8.3",
49
+ "react-currency-input-field": "^3.6.12",
49
50
  "react-datepicker": "^4.7.0",
50
51
  "react-table": "^7.6.3",
51
52
  "social-insurance-number": "^0.2.2",
@@ -64,5 +65,5 @@
64
65
  "publishConfig": {
65
66
  "access": "public"
66
67
  },
67
- "gitHead": "faa1186a1bcdebd4773279b50a4650b8a3aecd1f"
68
+ "gitHead": "6039b93b8a0cb5144a78db5ca125791a14e1067e"
68
69
  }
@@ -1,75 +0,0 @@
1
- import { toMoney } from '@thx/money';
2
- import debug from 'debug';
3
- import InputmaskImport from 'inputmask';
4
- import Money from 'js-money';
5
- import { useRef, useEffect, useCallback } from 'react';
6
-
7
- const d = debug("thx.controls.money.useMoneyInput");
8
- const InputmaskClass = InputmaskImport.default || InputmaskImport;
9
- function useMoneyInput(props) {
10
- const { value, onChange, onSet, showPrefix, prefix, wholeNumber } = props;
11
- const inputElement = useRef(null);
12
- const maskInstance = useRef(null);
13
- const currencyCode = value?.currency || "CAD";
14
- useEffect(() => {
15
- if (!inputElement.current)
16
- throw new Error("Could not get input element");
17
- d("Creating input mask instance");
18
- maskInstance.current = new InputmaskClass({
19
- alias: "numeric",
20
- groupSeparator: ",",
21
- digits: wholeNumber ? "0" : Money[currencyCode].decimal_digits.toString(),
22
- digitsOptional: false,
23
- prefix: showPrefix ? prefix || Money[currencyCode].symbol : void 0,
24
- placeholder: "0",
25
- autoUnmask: true,
26
- oncomplete() {
27
- if (onChange) {
28
- if (inputElement.current?.value) {
29
- onChange(toMoney(inputElement.current?.value, currencyCode));
30
- } else {
31
- onChange();
32
- }
33
- }
34
- },
35
- oncleared() {
36
- if (onChange)
37
- onChange();
38
- },
39
- onincomplete() {
40
- if (onChange)
41
- onChange(toMoney(inputElement.current?.value, currencyCode));
42
- }
43
- });
44
- maskInstance.current.mask(inputElement.current);
45
- return () => {
46
- if (maskInstance.current) {
47
- d("Cleaning up input mask instance");
48
- maskInstance.current.remove();
49
- maskInstance.current = null;
50
- }
51
- };
52
- }, [currencyCode, prefix, showPrefix, wholeNumber]);
53
- const setVal = useCallback((v) => {
54
- if (inputElement.current) {
55
- d("Value is being set:", v);
56
- if (v) {
57
- inputElement.current.value = v.toDecimal().toString();
58
- } else {
59
- inputElement.current.value = "";
60
- }
61
- onSet && onSet(v);
62
- }
63
- }, [onSet]);
64
- useEffect(() => {
65
- const whatCurrentlyIsDisplayed = inputElement.current?.value || "";
66
- const whatWeAreSetting = value ? value.toString() : "";
67
- if (whatCurrentlyIsDisplayed !== whatWeAreSetting) {
68
- setVal(value);
69
- }
70
- }, [setVal, value]);
71
- return [inputElement, setVal];
72
- }
73
-
74
- export { useMoneyInput };
75
- //# sourceMappingURL=useMoneyInput.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useMoneyInput.js","sources":["../../../src/money/useMoneyInput.ts"],"sourcesContent":["import {toMoney} from '@thx/money';\nimport debug from 'debug';\nimport Inputmask from 'inputmask';\nimport Money from 'js-money';\nimport {MutableRefObject, useCallback, useEffect, useRef} from 'react';\n\nconst d = debug('thx.controls.money.useMoneyInput');\n\n// @ts-ignore inputmask .d.ts file is correct, but ESM causes some difficulty. -mk\nconst InputmaskClass = Inputmask.default || Inputmask;\n\ninterface UseMoneyInputProps {\n\tvalue?: Money;\n\tonChange?: (value?: Money) => void;\n\tonSet?: (value?: Money) => void;\n\t// defaultCurrency?: Currency; // Defaults to Money.CAD\n\tprefix?: string; // Defaults to currency symbol\n\tshowPrefix?: boolean; // Defaults to false\n\twholeNumber?: boolean; // Defaults to false\n}\n\ntype SetValueFn = (value?: Money) => void;\n\nexport function useMoneyInput(props: UseMoneyInputProps): [MutableRefObject<HTMLInputElement | null>, SetValueFn] {\n\tconst {value, onChange, onSet, showPrefix, prefix, wholeNumber} = props;\n\n\tconst inputElement = useRef<HTMLInputElement | null>(null);\n\tconst maskInstance = useRef<Inputmask.Instance | null>(null);\n\n\t// set the adjCurrency\n\t// let adjCurrency = Money.CAD;\n\t// if (value?.currency && Money[value?.currency]) adjCurrency = Money[value?.currency];\n\t// if (defaultCurrency) adjCurrency = defaultCurrency;\n\tconst currencyCode = value?.currency || 'CAD';\n\n\tuseEffect(() => {\n\t\tif (!inputElement.current) throw new Error('Could not get input element');\n\n\t\td('Creating input mask instance');\n\t\tmaskInstance.current = new InputmaskClass({\n\t\t\talias: 'numeric',\n\t\t\tgroupSeparator: ',',\n\t\t\tdigits: wholeNumber ? '0' : Money[currencyCode].decimal_digits.toString(),\n\t\t\tdigitsOptional: false,\n\t\t\tprefix: showPrefix ? prefix || Money[currencyCode].symbol : undefined,\n\t\t\tplaceholder: '0',\n\t\t\tautoUnmask: true,\n\t\t\toncomplete() {\n\t\t\t\tif (onChange) {\n\t\t\t\t\tif (inputElement.current?.value) {\n\t\t\t\t\t\tonChange(toMoney(inputElement.current?.value, currencyCode));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tonChange();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\toncleared() {\n\t\t\t\tif (onChange) onChange();\n\t\t\t},\n\t\t\tonincomplete() {\n\t\t\t\tif (onChange) onChange(toMoney(inputElement.current?.value, currencyCode));\n\t\t\t},\n\t\t});\n\t\t// @ts-ignore We just created the instance but typescript can't figure it out. -mk\n\t\tmaskInstance.current.mask(inputElement.current);\n\n\t\treturn () => {\n\t\t\tif (maskInstance.current) {\n\t\t\t\td('Cleaning up input mask instance');\n\t\t\t\tmaskInstance.current.remove();\n\t\t\t\tmaskInstance.current = null;\n\t\t\t}\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [currencyCode, prefix, showPrefix, wholeNumber]);\n\n\tconst setVal = useCallback<SetValueFn>(\n\t\t(v?: Money | undefined) => {\n\t\t\tif (inputElement.current) {\n\t\t\t\td('Value is being set:', v);\n\t\t\t\tif (v) {\n\t\t\t\t\tinputElement.current.value = v.toDecimal().toString();\n\t\t\t\t} else {\n\t\t\t\t\tinputElement.current.value = '';\n\t\t\t\t}\n\t\t\t\tonSet && onSet(v);\n\t\t\t}\n\t\t},\n\t\t[onSet],\n\t);\n\n\t// If we change the value prop we need to sync the DOM value to display the new value\n\tuseEffect(() => {\n\t\tconst whatCurrentlyIsDisplayed = inputElement.current?.value || ''; // string | undef\n\t\tconst whatWeAreSetting = value ? value.toString() : ''; // money | undef\n\n\t\tif (whatCurrentlyIsDisplayed !== whatWeAreSetting) {\n\t\t\tsetVal(value);\n\t\t}\n\t}, [setVal, value]);\n\n\treturn [inputElement, setVal];\n}\n"],"names":["Inputmask"],"mappings":";;;;;;AAMA,MAAM,CAAA,GAAI,MAAM,kCAAkC,CAAA,CAAA;AAGlD,MAAM,cAAA,GAAiBA,gBAAU,OAAW,IAAAA,eAAA,CAAA;AAcrC,SAAA,aAAA,CAAuB,KAAoF,EAAA;AACjH,EAAA,MAAM,EAAC,KAAO,EAAA,QAAA,EAAU,KAAO,EAAA,UAAA,EAAY,QAAQ,WAAe,EAAA,GAAA,KAAA,CAAA;AAElE,EAAM,MAAA,YAAA,GAAe,OAAgC,IAAI,CAAA,CAAA;AACzD,EAAM,MAAA,YAAA,GAAe,OAAkC,IAAI,CAAA,CAAA;AAM3D,EAAM,MAAA,YAAA,GAAe,OAAO,QAAY,IAAA,KAAA,CAAA;AAExC,EAAA,SAAA,CAAU,MAAM;AACf,IAAA,IAAI,CAAC,YAAa,CAAA,OAAA;AAAS,MAAM,MAAA,IAAI,MAAM,6BAA6B,CAAA,CAAA;AAExE,IAAA,CAAA,CAAE,8BAA8B,CAAA,CAAA;AAChC,IAAa,YAAA,CAAA,OAAA,GAAU,IAAI,cAAe,CAAA;AAAA,MACzC,KAAO,EAAA,SAAA;AAAA,MACP,cAAgB,EAAA,GAA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AAA,GAAS,WACd,CAAA,CAAC,CAA0B,KAAA;AAC1B,IAAA,IAAI,aAAa,OAAS,EAAA;AACzB,MAAA,CAAA,CAAE,uBAAuB,CAAC,CAAA,CAAA;AAC1B,MAAA,IAAI,CAAG,EAAA;AACN,QAAA,YAAA,CAAa,OAAQ,CAAA,KAAA,GAAQ,CAAE,CAAA,SAAA,GAAY,QAAS,EAAA,CAAA;AAAA,OAC9C,MAAA;AACN,QAAA,YAAA,CAAa,QAAQ,KAAQ,GAAA,EAAA,CAAA;AAAA,OAC9B;AACA,MAAA,KAAA,IAAS,MAAM,CAAC,CAAA,CAAA;AAAA,KACjB;AAAA,GACD,EACA,CAAC,KAAK,CACP,CAAA,CAAA;AAGA,EAAA,SAAA,CAAU,MAAM;AACf,IAAM,MAAA,wBAAA,GAA2B,YAAa,CAAA,OAAA,EAAS,KAAS,IAAA,EAAA,CAAA;AAChE,IAAA,MAAM,gBAAmB,GAAA,KAAA,GAAQ,KAAM,CAAA,QAAA,EAAa,GAAA,EAAA,CAAA;AAEpD,IAAA,IAAI,6BAA6B,gBAAkB,EAAA;AAClD,MAAA,MAAA,CAAO,KAAK,CAAA,CAAA;AAAA,KACb;AAAA,GACE,EAAA,CAAC,MAAQ,EAAA,KAAK,CAAC,CAAA,CAAA;AAElB,EAAO,OAAA,CAAC,cAAc,MAAM,CAAA,CAAA;AAC7B;;;;"}
@@ -1,13 +0,0 @@
1
- import Money from 'js-money';
2
- import { MutableRefObject } from 'react';
3
- interface UseMoneyInputProps {
4
- value?: Money;
5
- onChange?: (value?: Money) => void;
6
- onSet?: (value?: Money) => void;
7
- prefix?: string;
8
- showPrefix?: boolean;
9
- wholeNumber?: boolean;
10
- }
11
- declare type SetValueFn = (value?: Money) => void;
12
- export declare function useMoneyInput(props: UseMoneyInputProps): [MutableRefObject<HTMLInputElement | null>, SetValueFn];
13
- export {};