@chayns-components/core 5.0.0-beta.410 → 5.0.0-beta.412

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/lib/components/checkbox/Checkbox.d.ts +1 -1
  2. package/lib/components/checkbox/Checkbox.js.map +1 -1
  3. package/lib/components/number-input/NumberInput.d.ts +4 -0
  4. package/lib/components/number-input/NumberInput.js +13 -6
  5. package/lib/components/number-input/NumberInput.js.map +1 -1
  6. package/lib/components/number-input/constants/number.d.ts +1 -0
  7. package/lib/components/number-input/constants/number.js +3 -2
  8. package/lib/components/number-input/constants/number.js.map +1 -1
  9. package/lib/components/number-input/utils/number.d.ts +3 -1
  10. package/lib/components/number-input/utils/number.js +22 -2
  11. package/lib/components/number-input/utils/number.js.map +1 -1
  12. package/lib/components/opening-times/OpeningTimes.d.ts +19 -0
  13. package/lib/components/opening-times/OpeningTimes.js +73 -0
  14. package/lib/components/opening-times/OpeningTimes.js.map +1 -0
  15. package/lib/components/opening-times/OpeningTimes.styles.d.ts +8 -0
  16. package/lib/components/opening-times/OpeningTimes.styles.js +19 -0
  17. package/lib/components/opening-times/OpeningTimes.styles.js.map +1 -0
  18. package/lib/components/opening-times/opening-inputs/OpeningInputs.d.ts +9 -0
  19. package/lib/components/opening-times/opening-inputs/OpeningInputs.js +81 -0
  20. package/lib/components/opening-times/opening-inputs/OpeningInputs.js.map +1 -0
  21. package/lib/components/opening-times/opening-inputs/OpeningInputs.styles.d.ts +2 -0
  22. package/lib/components/opening-times/opening-inputs/OpeningInputs.styles.js +13 -0
  23. package/lib/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +1 -0
  24. package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.d.ts +13 -0
  25. package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.js +77 -0
  26. package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +1 -0
  27. package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.d.ts +10 -0
  28. package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js +42 -0
  29. package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +1 -0
  30. package/lib/components/progress-bar/ProgressBar.d.ts +2 -2
  31. package/lib/components/progress-bar/ProgressBar.js +2 -2
  32. package/lib/components/progress-bar/ProgressBar.js.map +1 -1
  33. package/lib/components/slider/Slider.d.ts +2 -2
  34. package/lib/components/slider/Slider.js +4 -4
  35. package/lib/components/slider/Slider.js.map +1 -1
  36. package/lib/index.d.ts +2 -0
  37. package/lib/index.js +7 -0
  38. package/lib/index.js.map +1 -1
  39. package/lib/types/openingTimes.d.ts +19 -0
  40. package/lib/types/openingTimes.js +13 -0
  41. package/lib/types/openingTimes.js.map +1 -0
  42. package/package.json +2 -2
@@ -3,7 +3,7 @@ export type CheckboxProps = {
3
3
  /**
4
4
  * Text for checkbox or switch
5
5
  */
6
- children?: ReactElement;
6
+ children?: ReactElement | string;
7
7
  /**
8
8
  * Indicates whether the checkbox or switch is selected
9
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","names":["_react","_interopRequireWildcard","require","_uuid","_calculate","_Checkbox","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Checkbox","_ref","children","isChecked","isDisabled","labelClassName","onChange","shouldShowAsSwitch","shouldShowCentered","isActive","setIsActive","useState","handleChange","useCallback","event","target","checked","uuid","useUuid","lineHeight","useMemo","undefined","getHeightOfSingleTextLine","createElement","StyledCheckbox","StyledCheckboxInput","disabled","id","type","StyledCheckboxLabel","className","htmlFor","displayName","_default","exports"],"sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n FC,\n ReactElement,\n useCallback,\n useMemo,\n useState,\n} from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport { getHeightOfSingleTextLine } from '../../utils/calculate';\nimport { StyledCheckbox, StyledCheckboxInput, StyledCheckboxLabel } from './Checkbox.styles';\n\nexport type CheckboxProps = {\n /**\n * Text for checkbox or switch\n */\n children?: ReactElement;\n /**\n * Indicates whether the checkbox or switch is selected\n */\n isChecked?: boolean;\n /**\n * Disables the checkbox or switch so it cannot be toggled\n */\n isDisabled?: boolean;\n /**\n * Classname for the label\n */\n labelClassName?: string;\n /**\n * Function to be executed if the checked value changes\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Changes the design to use switch instead of checkbox\n */\n shouldShowAsSwitch?: boolean;\n /**\n * Whether the Checkbox should be displayed centered to the label or at the top\n */\n shouldShowCentered?: boolean;\n};\n\nconst Checkbox: FC<CheckboxProps> = ({\n children,\n isChecked,\n isDisabled,\n labelClassName,\n onChange,\n shouldShowAsSwitch,\n shouldShowCentered = false,\n}) => {\n const [isActive, setIsActive] = useState(isChecked ?? false);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setIsActive(event.target.checked);\n\n if (typeof onChange === 'function') {\n onChange(event);\n }\n },\n [onChange],\n );\n\n const uuid = useUuid();\n\n const lineHeight = useMemo(\n () => (shouldShowCentered ? undefined : getHeightOfSingleTextLine()),\n [shouldShowCentered],\n );\n\n return (\n <StyledCheckbox>\n <StyledCheckboxInput\n checked={isChecked}\n disabled={isDisabled}\n id={uuid}\n onChange={handleChange}\n type=\"checkbox\"\n />\n <StyledCheckboxLabel\n className={labelClassName}\n htmlFor={uuid}\n isChecked={isChecked ?? isActive}\n isDisabled={isDisabled}\n shouldShowAsSwitch={shouldShowAsSwitch}\n lineHeight={lineHeight}\n >\n {children}\n </StyledCheckboxLabel>\n </StyledCheckbox>\n );\n};\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,KAAA,GAAAD,OAAA;AACA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;AAEDF,QAAQ,CAACgC,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjD,OAAA,GAEnBe,QAAQ"}
1
+ {"version":3,"file":"Checkbox.js","names":["_react","_interopRequireWildcard","require","_uuid","_calculate","_Checkbox","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Checkbox","_ref","children","isChecked","isDisabled","labelClassName","onChange","shouldShowAsSwitch","shouldShowCentered","isActive","setIsActive","useState","handleChange","useCallback","event","target","checked","uuid","useUuid","lineHeight","useMemo","undefined","getHeightOfSingleTextLine","createElement","StyledCheckbox","StyledCheckboxInput","disabled","id","type","StyledCheckboxLabel","className","htmlFor","displayName","_default","exports"],"sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n FC,\n ReactElement,\n useCallback,\n useMemo,\n useState,\n} from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport { getHeightOfSingleTextLine } from '../../utils/calculate';\nimport { StyledCheckbox, StyledCheckboxInput, StyledCheckboxLabel } from './Checkbox.styles';\n\nexport type CheckboxProps = {\n /**\n * Text for checkbox or switch\n */\n children?: ReactElement | string;\n /**\n * Indicates whether the checkbox or switch is selected\n */\n isChecked?: boolean;\n /**\n * Disables the checkbox or switch so it cannot be toggled\n */\n isDisabled?: boolean;\n /**\n * Classname for the label\n */\n labelClassName?: string;\n /**\n * Function to be executed if the checked value changes\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Changes the design to use switch instead of checkbox\n */\n shouldShowAsSwitch?: boolean;\n /**\n * Whether the Checkbox should be displayed centered to the label or at the top\n */\n shouldShowCentered?: boolean;\n};\n\nconst Checkbox: FC<CheckboxProps> = ({\n children,\n isChecked,\n isDisabled,\n labelClassName,\n onChange,\n shouldShowAsSwitch,\n shouldShowCentered = false,\n}) => {\n const [isActive, setIsActive] = useState(isChecked ?? false);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setIsActive(event.target.checked);\n\n if (typeof onChange === 'function') {\n onChange(event);\n }\n },\n [onChange],\n );\n\n const uuid = useUuid();\n\n const lineHeight = useMemo(\n () => (shouldShowCentered ? undefined : getHeightOfSingleTextLine()),\n [shouldShowCentered],\n );\n\n return (\n <StyledCheckbox>\n <StyledCheckboxInput\n checked={isChecked}\n disabled={isDisabled}\n id={uuid}\n onChange={handleChange}\n type=\"checkbox\"\n />\n <StyledCheckboxLabel\n className={labelClassName}\n htmlFor={uuid}\n isChecked={isChecked ?? isActive}\n isDisabled={isDisabled}\n shouldShowAsSwitch={shouldShowAsSwitch}\n lineHeight={lineHeight}\n >\n {children}\n </StyledCheckboxLabel>\n </StyledCheckbox>\n );\n};\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAA6F,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAA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AGa,SAAS,GAAG,IAAAC,oCAAyB,EAAC,CAAE,EACpE,CAACd,kBAAkB,CACvB,CAAC;EAED,oBACInC,MAAA,CAAAY,OAAA,CAAAsC,aAAA,CAAC7C,SAAA,CAAA8C,cAAc,qBACXnD,MAAA,CAAAY,OAAA,CAAAsC,aAAA,CAAC7C,SAAA,CAAA+C,mBAAmB;IAChBT,OAAO,EAAEb,SAAU;IACnBuB,QAAQ,EAAEtB,UAAW;IACrBuB,EAAE,EAAEV,IAAK;IACTX,QAAQ,EAAEM,YAAa;IACvBgB,IAAI,EAAC;EAAU,CAClB,CAAC,eACFvD,MAAA,CAAAY,OAAA,CAAAsC,aAAA,CAAC7C,SAAA,CAAAmD,mBAAmB;IAChBC,SAAS,EAAEzB,cAAe;IAC1B0B,OAAO,EAAEd,IAAK;IACdd,SAAS,EAAEA,SAAS,IAAIM,QAAS;IACjCL,UAAU,EAAEA,UAAW;IACvBG,kBAAkB,EAAEA,kBAAmB;IACvCY,UAAU,EAAEA;EAAW,GAEtBjB,QACgB,CACT,CAAC;AAEzB,CAAC;AAEDF,QAAQ,CAACgC,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjD,OAAA,GAEnBe,QAAQ"}
@@ -14,6 +14,10 @@ export type NumberInputProps = {
14
14
  * Rules: only two decimal places, one zero before the comma
15
15
  */
16
16
  isMoneyInput?: boolean;
17
+ /**
18
+ * Whether the value should be formatted as a time.
19
+ */
20
+ isTimeInput?: boolean;
17
21
  /**
18
22
  * Limits the number to this value
19
23
  */
@@ -15,6 +15,7 @@ const NumberInput = _ref => {
15
15
  let {
16
16
  isDecimalInput,
17
17
  isMoneyInput,
18
+ isTimeInput,
18
19
  maxNumber = Infinity,
19
20
  value,
20
21
  placeholder,
@@ -32,6 +33,9 @@ const NumberInput = _ref => {
32
33
  const localPlaceholder = placeholder ?? (isMoneyInput ? '€' : undefined);
33
34
  const onLocalChange = event => {
34
35
  const newValue = event.target.value;
36
+ if (newValue.replaceAll(':', '').length > 4) {
37
+ return;
38
+ }
35
39
  const sanitizedValueString = newValue
36
40
  // Removes everything except numbers, commas and points
37
41
  .replace(_number.NUMBER_CLEAR_REGEX, '');
@@ -39,7 +43,8 @@ const NumberInput = _ref => {
39
43
  if (!(0, _number2.isValidString)({
40
44
  string: valueToCheck,
41
45
  isMoneyInput,
42
- isDecimalInput
46
+ isDecimalInput,
47
+ isTimeInput
43
48
  })) {
44
49
  return;
45
50
  }
@@ -52,7 +57,7 @@ const NumberInput = _ref => {
52
57
  const sanitizedValue = plainText.length === 0 ? '0' : plainText;
53
58
  let isInvalid = false;
54
59
  const parsedNumber = (0, _number2.parseFloatWithDecimals)({
55
- stringValue: sanitizedValue.replace(',', '.'),
60
+ stringValue: sanitizedValue.replace(',', '.').replaceAll(':', ''),
56
61
  decimals: isMoneyInput ? 2 : undefined
57
62
  });
58
63
  if (parsedNumber !== 0 && (parsedNumber > maxNumber || parsedNumber < minNumber)) {
@@ -61,7 +66,8 @@ const NumberInput = _ref => {
61
66
  setIsValueInvalid(isInvalid);
62
67
  const newStringValue = plainText.length === 0 ? '' : (0, _number2.formateNumber)({
63
68
  number: parsedNumber,
64
- isMoneyInput
69
+ isMoneyInput,
70
+ isTimeInput
65
71
  });
66
72
  setFormattedValue(newStringValue);
67
73
  setPlainText(newStringValue.replaceAll('.', ''));
@@ -89,7 +95,7 @@ const NumberInput = _ref => {
89
95
  // updates the formattedValue, when the value changes
90
96
  (0, _react.useEffect)(() => {
91
97
  const parsedNumber = (0, _number2.parseFloatWithDecimals)({
92
- stringValue: plainText.replace(',', '.'),
98
+ stringValue: plainText.replace(',', '.').replaceAll(':', ''),
93
99
  decimals: isMoneyInput ? 2 : undefined
94
100
  });
95
101
 
@@ -99,9 +105,10 @@ const NumberInput = _ref => {
99
105
  }
100
106
  setFormattedValue(plainText.length === 0 ? '' : (0, _number2.formateNumber)({
101
107
  number: parsedNumber,
102
- isMoneyInput
108
+ isMoneyInput,
109
+ isTimeInput
103
110
  }));
104
- }, [hasFocus, isMoneyInput, maxNumber, minNumber, plainText]);
111
+ }, [hasFocus, isMoneyInput, isTimeInput, maxNumber, minNumber, plainText]);
105
112
  (0, _react.useEffect)(() => {
106
113
  if (typeof value === 'string') {
107
114
  setPlainText(value);
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInput.js","names":["_react","_interopRequireWildcard","require","_Input","_interopRequireDefault","_number","_number2","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","NumberInput","_ref","isDecimalInput","isMoneyInput","maxNumber","Infinity","value","placeholder","onBlur","isDisabled","onChange","minNumber","plainText","setPlainText","useState","formattedValue","setFormattedValue","hasFocus","setHasFocus","isValueInvalid","setIsValueInvalid","localPlaceholder","undefined","onLocalChange","event","newValue","target","sanitizedValueString","replace","NUMBER_CLEAR_REGEX","valueToCheck","replaceAll","isValidString","string","onLocalBlur","sanitizedValue","length","isInvalid","parsedNumber","parseFloatWithDecimals","stringValue","decimals","newStringValue","formateNumber","number","onLocalFocus","useEffect","createElement","inputMode","onFocus","displayName","_default","exports"],"sources":["../../../src/components/number-input/NumberInput.tsx"],"sourcesContent":["import React, { ChangeEventHandler, FC, useEffect, useState } from 'react';\nimport Input from '../input/Input';\nimport { NUMBER_CLEAR_REGEX } from './constants/number';\nimport { formateNumber, isValidString, parseFloatWithDecimals } from './utils/number';\n\nexport type NumberInputProps = {\n /**\n * Applies rules for decimal input.\n * Enables the user to input one zero as number before the comma\n */\n isDecimalInput?: boolean;\n /**\n * Whether the input is disabled\n */\n isDisabled?: boolean;\n /**\n * Applies rules for money input.\n * Rules: only two decimal places, one zero before the comma\n */\n isMoneyInput?: boolean;\n /**\n * Limits the number to this value\n */\n maxNumber?: number;\n /**\n * Limits the number to this value\n */\n minNumber?: number;\n /**\n * Callback function that is called when the input gets out of focus\n */\n onBlur?: (newNumber: number | null, isInvalid: boolean) => void;\n /**\n * Callback function that is called when the input changes\n * It will pass the text from the input\n */\n onChange?: (newValue: string) => void;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * The value, that should be displayed in the input, when it is in focus.\n * You can also pass a stringified number as default value.\n * NOTE: If you pass a stringified number, it will be formatted to the selected format\n */\n value?: string;\n};\n\nconst NumberInput: FC<NumberInputProps> = (\n {\n isDecimalInput,\n isMoneyInput,\n maxNumber = Infinity,\n value,\n placeholder,\n onBlur,\n isDisabled,\n onChange,\n minNumber = -Infinity\n }) => {\n // the plainText will be shown in the input, when it is in focus\n const [plainText, setPlainText] = useState<string>('');\n // the formattedValue will be shown in the input, when it is not in focus\n const [formattedValue, setFormattedValue] = useState<string>('');\n const [hasFocus, setHasFocus] = useState<boolean>(false);\n\n const [isValueInvalid, setIsValueInvalid] = useState(false);\n const localPlaceholder = placeholder ?? (isMoneyInput ? '€' : undefined);\n\n\n const onLocalChange: ChangeEventHandler<HTMLInputElement> =\n (event) => {\n const newValue = event.target.value;\n\n const sanitizedValueString = newValue\n // Removes everything except numbers, commas and points\n .replace(NUMBER_CLEAR_REGEX, '');\n\n const valueToCheck = sanitizedValueString.replaceAll(',', '.');\n\n if (!isValidString({ string: valueToCheck, isMoneyInput, isDecimalInput })) {\n return;\n }\n\n setPlainText(sanitizedValueString.replaceAll('.', ','));\n\n if (typeof onChange === 'function') {\n onChange(sanitizedValueString.replaceAll('.', ','));\n }\n };\n\n const onLocalBlur = () => {\n const sanitizedValue = plainText.length === 0 ? '0' : plainText;\n let isInvalid = false;\n\n const parsedNumber = parseFloatWithDecimals({\n stringValue: sanitizedValue.replace(',', '.'),\n decimals: isMoneyInput ? 2 : undefined\n });\n\n if (parsedNumber !== 0 && (parsedNumber > maxNumber || parsedNumber < minNumber)) {\n isInvalid = true;\n }\n\n setIsValueInvalid(isInvalid);\n\n const newStringValue = plainText.length === 0\n ? ''\n : formateNumber({\n number: parsedNumber,\n isMoneyInput,\n });\n\n setFormattedValue(newStringValue);\n setPlainText(newStringValue.replaceAll('.', ''));\n setHasFocus(false);\n\n if (typeof onChange === 'function') {\n onChange(newStringValue.replaceAll('.', ''));\n }\n\n if (typeof onBlur === 'function') {\n onBlur(parsedNumber === 0 ? null : parsedNumber, isInvalid);\n }\n };\n\n const onLocalFocus = () => {\n // formattedValue will be a number string with german number format (e.g. 1.000,00)\n // It will remove all dots, so that the user can type in the number\n setPlainText(formattedValue.replaceAll('.', ''));\n\n // This will update the external state\n if (typeof onChange === 'function') {\n onChange(formattedValue.replaceAll('.', ''));\n }\n\n setIsValueInvalid(false);\n setHasFocus(true);\n };\n\n // updates the formattedValue, when the value changes\n useEffect(() => {\n const parsedNumber = parseFloatWithDecimals({\n stringValue: plainText.replace(',', '.'),\n decimals: isMoneyInput ? 2 : undefined\n });\n\n // checks, if a given number is invalid, if the input is not in focus\n if (!hasFocus) {\n setIsValueInvalid(parsedNumber > maxNumber || parsedNumber < minNumber);\n }\n\n setFormattedValue(plainText.length === 0\n ? ''\n : formateNumber({\n number: parsedNumber,\n isMoneyInput,\n }));\n }, [hasFocus, isMoneyInput, maxNumber, minNumber, plainText]);\n\n useEffect(() => {\n if (typeof value === 'string') {\n setPlainText(value);\n }\n }, [value]);\n\n return (\n <Input\n inputMode=\"decimal\"\n onChange={onLocalChange}\n value={hasFocus ? plainText : formattedValue}\n placeholder={localPlaceholder}\n onBlur={onLocalBlur}\n onFocus={onLocalFocus}\n isDisabled={isDisabled}\n isInvalid={isValueInvalid}\n />\n );\n};\n\nNumberInput.displayName = 'NumberInput';\n\nexport default NumberInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAsF,SAAAE,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAA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C,IAAAC,QAAA,GAAAC,OAAA,CAAAxE,OAAA,GAEzBoB,WAAW"}
1
+ {"version":3,"file":"NumberInput.js","names":["_react","_interopRequireWildcard","require","_Input","_interopRequireDefault","_number","_number2","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","NumberInput","_ref","isDecimalInput","isMoneyInput","isTimeInput","maxNumber","Infinity","value","placeholder","onBlur","isDisabled","onChange","minNumber","plainText","setPlainText","useState","formattedValue","setFormattedValue","hasFocus","setHasFocus","isValueInvalid","setIsValueInvalid","localPlaceholder","undefined","onLocalChange","event","newValue","target","replaceAll","length","sanitizedValueString","replace","NUMBER_CLEAR_REGEX","valueToCheck","isValidString","string","onLocalBlur","sanitizedValue","isInvalid","parsedNumber","parseFloatWithDecimals","stringValue","decimals","newStringValue","formateNumber","number","onLocalFocus","useEffect","createElement","inputMode","onFocus","displayName","_default","exports"],"sources":["../../../src/components/number-input/NumberInput.tsx"],"sourcesContent":["import React, { ChangeEventHandler, FC, useEffect, useState } from 'react';\nimport Input from '../input/Input';\nimport { NUMBER_CLEAR_REGEX } from './constants/number';\nimport { formateNumber, isValidString, parseFloatWithDecimals } from './utils/number';\n\nexport type NumberInputProps = {\n /**\n * Applies rules for decimal input.\n * Enables the user to input one zero as number before the comma\n */\n isDecimalInput?: boolean;\n /**\n * Whether the input is disabled\n */\n isDisabled?: boolean;\n /**\n * Applies rules for money input.\n * Rules: only two decimal places, one zero before the comma\n */\n isMoneyInput?: boolean;\n /**\n * Whether the value should be formatted as a time.\n */\n isTimeInput?: boolean;\n /**\n * Limits the number to this value\n */\n maxNumber?: number;\n /**\n * Limits the number to this value\n */\n minNumber?: number;\n /**\n * Callback function that is called when the input gets out of focus\n */\n onBlur?: (newNumber: number | null, isInvalid: boolean) => void;\n /**\n * Callback function that is called when the input changes\n * It will pass the text from the input\n */\n onChange?: (newValue: string) => void;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * The value, that should be displayed in the input, when it is in focus.\n * You can also pass a stringified number as default value.\n * NOTE: If you pass a stringified number, it will be formatted to the selected format\n */\n value?: string;\n};\n\nconst NumberInput: FC<NumberInputProps> = ({\n isDecimalInput,\n isMoneyInput,\n isTimeInput,\n maxNumber = Infinity,\n value,\n placeholder,\n onBlur,\n isDisabled,\n onChange,\n minNumber = -Infinity,\n}) => {\n // the plainText will be shown in the input, when it is in focus\n const [plainText, setPlainText] = useState<string>('');\n // the formattedValue will be shown in the input, when it is not in focus\n const [formattedValue, setFormattedValue] = useState<string>('');\n const [hasFocus, setHasFocus] = useState<boolean>(false);\n\n const [isValueInvalid, setIsValueInvalid] = useState(false);\n const localPlaceholder = placeholder ?? (isMoneyInput ? '€' : undefined);\n\n const onLocalChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n const newValue = event.target.value;\n\n if (newValue.replaceAll(':', '').length > 4) {\n return;\n }\n\n const sanitizedValueString = newValue\n // Removes everything except numbers, commas and points\n .replace(NUMBER_CLEAR_REGEX, '');\n\n const valueToCheck = sanitizedValueString.replaceAll(',', '.');\n\n if (!isValidString({ string: valueToCheck, isMoneyInput, isDecimalInput, isTimeInput })) {\n return;\n }\n\n setPlainText(sanitizedValueString.replaceAll('.', ','));\n\n if (typeof onChange === 'function') {\n onChange(sanitizedValueString.replaceAll('.', ','));\n }\n };\n\n const onLocalBlur = () => {\n const sanitizedValue = plainText.length === 0 ? '0' : plainText;\n let isInvalid = false;\n\n const parsedNumber = parseFloatWithDecimals({\n stringValue: sanitizedValue.replace(',', '.').replaceAll(':', ''),\n decimals: isMoneyInput ? 2 : undefined,\n });\n\n if (parsedNumber !== 0 && (parsedNumber > maxNumber || parsedNumber < minNumber)) {\n isInvalid = true;\n }\n\n setIsValueInvalid(isInvalid);\n\n const newStringValue =\n plainText.length === 0\n ? ''\n : formateNumber({\n number: parsedNumber,\n isMoneyInput,\n isTimeInput,\n });\n\n setFormattedValue(newStringValue);\n setPlainText(newStringValue.replaceAll('.', ''));\n setHasFocus(false);\n\n if (typeof onChange === 'function') {\n onChange(newStringValue.replaceAll('.', ''));\n }\n\n if (typeof onBlur === 'function') {\n onBlur(parsedNumber === 0 ? null : parsedNumber, isInvalid);\n }\n };\n\n const onLocalFocus = () => {\n // formattedValue will be a number string with german number format (e.g. 1.000,00)\n // It will remove all dots, so that the user can type in the number\n setPlainText(formattedValue.replaceAll('.', ''));\n\n // This will update the external state\n if (typeof onChange === 'function') {\n onChange(formattedValue.replaceAll('.', ''));\n }\n\n setIsValueInvalid(false);\n setHasFocus(true);\n };\n\n // updates the formattedValue, when the value changes\n useEffect(() => {\n const parsedNumber = parseFloatWithDecimals({\n stringValue: plainText.replace(',', '.').replaceAll(':', ''),\n decimals: isMoneyInput ? 2 : undefined,\n });\n\n // checks, if a given number is invalid, if the input is not in focus\n if (!hasFocus) {\n setIsValueInvalid(parsedNumber > maxNumber || parsedNumber < minNumber);\n }\n\n setFormattedValue(\n plainText.length === 0\n ? ''\n : formateNumber({\n number: parsedNumber,\n isMoneyInput,\n isTimeInput,\n }),\n );\n }, [hasFocus, isMoneyInput, isTimeInput, maxNumber, minNumber, plainText]);\n\n useEffect(() => {\n if (typeof value === 'string') {\n setPlainText(value);\n }\n }, [value]);\n\n return (\n <Input\n inputMode=\"decimal\"\n onChange={onLocalChange}\n value={hasFocus ? plainText : formattedValue}\n placeholder={localPlaceholder}\n onBlur={onLocalBlur}\n onFocus={onLocalFocus}\n isDisabled={isDisabled}\n isInvalid={isValueInvalid}\n />\n );\n};\n\nNumberInput.displayName = 'NumberInput';\n\nexport default NumberInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAsF,SAAAE,uBAAAG,GAAA,WAAAA,GAAA,I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,SAAS;IACnBtC,QAAQ,EAAEa,aAAc;IACxBjB,KAAK,EAAEW,QAAQ,GAAGL,SAAS,GAAGG,cAAe;IAC7CR,WAAW,EAAEc,gBAAiB;IAC9Bb,MAAM,EAAE2B,WAAY;IACpBc,OAAO,EAAEJ,YAAa;IACtBpC,UAAU,EAAEA,UAAW;IACvB4B,SAAS,EAAElB;EAAe,CAC7B,CAAC;AAEV,CAAC;AAEDpB,WAAW,CAACmD,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzE,OAAA,GAEzBoB,WAAW"}
@@ -2,3 +2,4 @@ export declare const NUMBER_CLEAR_REGEX: RegExp;
2
2
  export declare const INTEGER_TEST: RegExp;
3
3
  export declare const DECIMAL_TEST: RegExp;
4
4
  export declare const MONEY_TEST: RegExp;
5
+ export declare const TIME_TEST: RegExp;
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.NUMBER_CLEAR_REGEX = exports.MONEY_TEST = exports.INTEGER_TEST = exports.DECIMAL_TEST = void 0;
7
- const NUMBER_CLEAR_REGEX = exports.NUMBER_CLEAR_REGEX = /[^\d,.]/gi;
6
+ exports.TIME_TEST = exports.NUMBER_CLEAR_REGEX = exports.MONEY_TEST = exports.INTEGER_TEST = exports.DECIMAL_TEST = void 0;
7
+ const NUMBER_CLEAR_REGEX = exports.NUMBER_CLEAR_REGEX = /[^\d,.:]/gi;
8
8
  const INTEGER_TEST = exports.INTEGER_TEST = /^[1-9][0-9]*$/;
9
9
  const DECIMAL_TEST = exports.DECIMAL_TEST = /^(0|[1-9][0-9]*)?(\.[0-9]*)?$/;
10
10
  const MONEY_TEST = exports.MONEY_TEST = /^(0|[1-9][0-9]*)?(\.[0-9]{0,2})?$/;
11
+ const TIME_TEST = exports.TIME_TEST = /^\d{1,2}(:\d{1,2})?$/;
11
12
  //# sourceMappingURL=number.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"number.js","names":["NUMBER_CLEAR_REGEX","exports","INTEGER_TEST","DECIMAL_TEST","MONEY_TEST"],"sources":["../../../../src/components/number-input/constants/number.ts"],"sourcesContent":["export const NUMBER_CLEAR_REGEX = /[^\\d,.]/gi;\nexport const INTEGER_TEST = /^[1-9][0-9]*$/;\nexport const DECIMAL_TEST = /^(0|[1-9][0-9]*)?(\\.[0-9]*)?$/;\nexport const MONEY_TEST = /^(0|[1-9][0-9]*)?(\\.[0-9]{0,2})?$/;\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,WAAW;AACtC,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG,eAAe;AACpC,MAAMC,YAAY,GAAAF,OAAA,CAAAE,YAAA,GAAG,+BAA+B;AACpD,MAAMC,UAAU,GAAAH,OAAA,CAAAG,UAAA,GAAG,mCAAmC"}
1
+ {"version":3,"file":"number.js","names":["NUMBER_CLEAR_REGEX","exports","INTEGER_TEST","DECIMAL_TEST","MONEY_TEST","TIME_TEST"],"sources":["../../../../src/components/number-input/constants/number.ts"],"sourcesContent":["export const NUMBER_CLEAR_REGEX = /[^\\d,.:]/gi;\nexport const INTEGER_TEST = /^[1-9][0-9]*$/;\nexport const DECIMAL_TEST = /^(0|[1-9][0-9]*)?(\\.[0-9]*)?$/;\nexport const MONEY_TEST = /^(0|[1-9][0-9]*)?(\\.[0-9]{0,2})?$/;\nexport const TIME_TEST = /^\\d{1,2}(:\\d{1,2})?$/;\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,YAAY;AACvC,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG,eAAe;AACpC,MAAMC,YAAY,GAAAF,OAAA,CAAAE,YAAA,GAAG,+BAA+B;AACpD,MAAMC,UAAU,GAAAH,OAAA,CAAAG,UAAA,GAAG,mCAAmC;AACtD,MAAMC,SAAS,GAAAJ,OAAA,CAAAI,SAAA,GAAG,sBAAsB"}
@@ -8,13 +8,15 @@ export declare const parseFloatWithDecimals: ParseFloatWithDecimals;
8
8
  interface FormateNumberOptions {
9
9
  number: number | null;
10
10
  isMoneyInput?: boolean;
11
+ isTimeInput?: boolean;
11
12
  }
12
- export declare const formateNumber: ({ number, isMoneyInput }: FormateNumberOptions) => string;
13
+ export declare const formateNumber: ({ number, isMoneyInput, isTimeInput }: FormateNumberOptions) => string;
13
14
  interface IsValidString {
14
15
  (config: {
15
16
  string: string;
16
17
  isDecimalInput?: boolean;
17
18
  isMoneyInput?: boolean;
19
+ isTimeInput?: boolean;
18
20
  }): boolean;
19
21
  }
20
22
  export declare const isValidString: IsValidString;
@@ -20,11 +20,27 @@ exports.parseFloatWithDecimals = parseFloatWithDecimals;
20
20
  const formateNumber = _ref2 => {
21
21
  let {
22
22
  number,
23
- isMoneyInput
23
+ isMoneyInput,
24
+ isTimeInput
24
25
  } = _ref2;
25
26
  if (typeof number !== 'number') {
26
27
  return '';
27
28
  }
29
+ if (isTimeInput) {
30
+ let hours = 0;
31
+ let minutes = 0;
32
+ const firstTwoNumbers = Number(String(number).substring(0, 2));
33
+ const lastTwoNumbers = Number(String(number).substring(2, 4));
34
+ hours = firstTwoNumbers > 23 ? 23 : firstTwoNumbers;
35
+ if (lastTwoNumbers < 7) {
36
+ minutes = lastTwoNumbers * 10;
37
+ } else {
38
+ minutes = lastTwoNumbers > 59 ? 59 : lastTwoNumbers;
39
+ }
40
+ const hoursStr = hours < 10 ? `0${hours}` : `${hours}`;
41
+ const minutesStr = minutes < 10 ? `0${minutes}` : `${minutes}`;
42
+ return `${hoursStr}:${minutesStr}`;
43
+ }
28
44
  return number.toLocaleString('de-DE', {
29
45
  useGrouping: true,
30
46
  minimumFractionDigits: isMoneyInput ? 2 : undefined,
@@ -37,6 +53,7 @@ const isValidString = _ref3 => {
37
53
  let {
38
54
  isDecimalInput,
39
55
  isMoneyInput,
56
+ isTimeInput,
40
57
  string
41
58
  } = _ref3;
42
59
  let isValid = false;
@@ -50,9 +67,12 @@ const isValidString = _ref3 => {
50
67
  if (isMoneyInput && _number.MONEY_TEST.test(string)) {
51
68
  isValid = true;
52
69
  }
70
+ if (isTimeInput && _number.TIME_TEST) {
71
+ isValid = true;
72
+ }
53
73
 
54
74
  // Allows numbers but excludes numbers with leading 0
55
- if (!isDecimalInput && !isMoneyInput && _number.INTEGER_TEST.test(string)) {
75
+ if (!isDecimalInput && !isMoneyInput && !isTimeInput && _number.INTEGER_TEST.test(string)) {
56
76
  isValid = true;
57
77
  }
58
78
  if (string.length === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"number.js","names":["_number","require","parseFloatWithDecimals","_ref","stringValue","decimals","parsed","parseFloat","toFixed","exports","formateNumber","_ref2","number","isMoneyInput","toLocaleString","useGrouping","minimumFractionDigits","undefined","maximumFractionDigits","maximumSignificantDigits","isValidString","_ref3","isDecimalInput","string","isValid","DECIMAL_TEST","test","MONEY_TEST","INTEGER_TEST","length"],"sources":["../../../../src/components/number-input/utils/number.ts"],"sourcesContent":["import { DECIMAL_TEST, INTEGER_TEST, MONEY_TEST } from '../constants/number';\n\ninterface ParseFloatWithDecimals {\n ({ stringValue, decimals }: { stringValue: string; decimals?: number }): number;\n}\n\nexport const parseFloatWithDecimals: ParseFloatWithDecimals = ({ stringValue, decimals }) => {\n const parsed = parseFloat(stringValue);\n\n if (decimals) {\n return parseFloat(parsed.toFixed(decimals));\n }\n\n return parsed;\n};\n\ninterface FormateNumberOptions {\n number: number | null;\n isMoneyInput?: boolean;\n}\n\nexport const formateNumber = ({ number, isMoneyInput }: FormateNumberOptions) => {\n if (typeof number !== 'number') {\n return '';\n }\n\n return number.toLocaleString('de-DE', {\n useGrouping: true,\n minimumFractionDigits: isMoneyInput ? 2 : undefined,\n maximumFractionDigits: isMoneyInput ? 2 : undefined,\n maximumSignificantDigits: !isMoneyInput ? 20 : undefined,\n });\n};\n\ninterface IsValidString {\n (config: {\n string: string;\n isDecimalInput?: boolean;\n isMoneyInput?: boolean;\n }): boolean;\n}\n\nexport const isValidString: IsValidString = (\n {\n isDecimalInput, isMoneyInput, string\n }) => {\n let isValid = false;\n\n // Allows numbers, one (comma/point) and any number of decimal places\n if (isDecimalInput && DECIMAL_TEST.test(string)) {\n isValid = true;\n }\n\n // Allows numbers but excludes numbers with leading 0\n if (isMoneyInput && MONEY_TEST.test(string)) {\n isValid = true;\n }\n\n // Allows numbers but excludes numbers with leading 0\n if (!isDecimalInput && !isMoneyInput && INTEGER_TEST.test(string)) {\n isValid = true;\n }\n\n if (string.length === 0) {\n isValid = true;\n\n }\n\n return isValid;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAMO,MAAMC,sBAA8C,GAAGC,IAAA,IAA+B;EAAA,IAA9B;IAAEC,WAAW;IAAEC;EAAS,CAAC,GAAAF,IAAA;EACpF,MAAMG,MAAM,GAAGC,UAAU,CAACH,WAAW,CAAC;EAEtC,IAAIC,QAAQ,EAAE;IACV,OAAOE,UAAU,CAACD,MAAM,CAACE,OAAO,CAACH,QAAQ,CAAC,CAAC;EAC/C;EAEA,OAAOC,MAAM;AACjB,CAAC;AAACG,OAAA,CAAAP,sBAAA,GAAAA,sBAAA;AAOK,MAAMQ,aAAa,GAAGC,KAAA,IAAoD;EAAA,IAAnD;IAAEC,MAAM;IAAEC;EAAmC,CAAC,GAAAF,KAAA;EACxE,IAAI,OAAOC,MAAM,KAAK,QAAQ,EAAE;IAC5B,OAAO,EAAE;EACb;EAEA,OAAOA,MAAM,CAACE,cAAc,CAAC,OAAO,EAAE;IAClCC,WAAW,EAAE,IAAI;IACjBC,qBAAqB,EAAEH,YAAY,GAAG,CAAC,GAAGI,SAAS;IACnDC,qBAAqB,EAAEL,YAAY,GAAG,CAAC,GAAGI,SAAS;IACnDE,wBAAwB,EAAE,CAACN,YAAY,GAAG,EAAE,GAAGI;EACnD,CAAC,CAAC;AACN,CAAC;AAACR,OAAA,CAAAC,aAAA,GAAAA,aAAA;AAUK,MAAMU,aAA4B,GAAGC,KAAA,IAGlC;EAAA,IAFN;IACIC,cAAc;IAAET,YAAY;IAAEU;EAClC,CAAC,GAAAF,KAAA;EACD,IAAIG,OAAO,GAAG,KAAK;;EAEnB;EACA,IAAIF,cAAc,IAAIG,oBAAY,CAACC,IAAI,CAACH,MAAM,CAAC,EAAE;IAC7CC,OAAO,GAAG,IAAI;EAClB;;EAEA;EACA,IAAIX,YAAY,IAAIc,kBAAU,CAACD,IAAI,CAACH,MAAM,CAAC,EAAE;IACzCC,OAAO,GAAG,IAAI;EAClB;;EAEA;EACA,IAAI,CAACF,cAAc,IAAI,CAACT,YAAY,IAAIe,oBAAY,CAACF,IAAI,CAACH,MAAM,CAAC,EAAE;IAC/DC,OAAO,GAAG,IAAI;EAClB;EAEA,IAAID,MAAM,CAACM,MAAM,KAAK,CAAC,EAAE;IACrBL,OAAO,GAAG,IAAI;EAElB;EAEA,OAAOA,OAAO;AAClB,CAAC;AAACf,OAAA,CAAAW,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"file":"number.js","names":["_number","require","parseFloatWithDecimals","_ref","stringValue","decimals","parsed","parseFloat","toFixed","exports","formateNumber","_ref2","number","isMoneyInput","isTimeInput","hours","minutes","firstTwoNumbers","Number","String","substring","lastTwoNumbers","hoursStr","minutesStr","toLocaleString","useGrouping","minimumFractionDigits","undefined","maximumFractionDigits","maximumSignificantDigits","isValidString","_ref3","isDecimalInput","string","isValid","DECIMAL_TEST","test","MONEY_TEST","TIME_TEST","INTEGER_TEST","length"],"sources":["../../../../src/components/number-input/utils/number.ts"],"sourcesContent":["import { DECIMAL_TEST, INTEGER_TEST, MONEY_TEST, TIME_TEST } from '../constants/number';\n\ninterface ParseFloatWithDecimals {\n ({ stringValue, decimals }: { stringValue: string; decimals?: number }): number;\n}\n\nexport const parseFloatWithDecimals: ParseFloatWithDecimals = ({ stringValue, decimals }) => {\n const parsed = parseFloat(stringValue);\n\n if (decimals) {\n return parseFloat(parsed.toFixed(decimals));\n }\n\n return parsed;\n};\n\ninterface FormateNumberOptions {\n number: number | null;\n isMoneyInput?: boolean;\n isTimeInput?: boolean;\n}\n\nexport const formateNumber = ({ number, isMoneyInput, isTimeInput }: FormateNumberOptions) => {\n if (typeof number !== 'number') {\n return '';\n }\n\n if (isTimeInput) {\n let hours = 0;\n let minutes = 0;\n\n const firstTwoNumbers = Number(String(number).substring(0, 2));\n const lastTwoNumbers = Number(String(number).substring(2, 4));\n\n hours = firstTwoNumbers > 23 ? 23 : firstTwoNumbers;\n if (lastTwoNumbers < 7) {\n minutes = lastTwoNumbers * 10;\n } else {\n minutes = lastTwoNumbers > 59 ? 59 : lastTwoNumbers;\n }\n\n const hoursStr = hours < 10 ? `0${hours}` : `${hours}`;\n const minutesStr = minutes < 10 ? `0${minutes}` : `${minutes}`;\n\n return `${hoursStr}:${minutesStr}`;\n }\n\n return number.toLocaleString('de-DE', {\n useGrouping: true,\n minimumFractionDigits: isMoneyInput ? 2 : undefined,\n maximumFractionDigits: isMoneyInput ? 2 : undefined,\n maximumSignificantDigits: !isMoneyInput ? 20 : undefined,\n });\n};\n\ninterface IsValidString {\n (config: {\n string: string;\n isDecimalInput?: boolean;\n isMoneyInput?: boolean;\n isTimeInput?: boolean;\n }): boolean;\n}\n\nexport const isValidString: IsValidString = ({\n isDecimalInput,\n isMoneyInput,\n isTimeInput,\n string,\n}) => {\n let isValid = false;\n\n // Allows numbers, one (comma/point) and any number of decimal places\n if (isDecimalInput && DECIMAL_TEST.test(string)) {\n isValid = true;\n }\n\n // Allows numbers but excludes numbers with leading 0\n if (isMoneyInput && MONEY_TEST.test(string)) {\n isValid = true;\n }\n\n if (isTimeInput && TIME_TEST) {\n isValid = true;\n }\n\n // Allows numbers but excludes numbers with leading 0\n if (!isDecimalInput && !isMoneyInput && !isTimeInput && INTEGER_TEST.test(string)) {\n isValid = true;\n }\n\n if (string.length === 0) {\n isValid = true;\n }\n\n return isValid;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OA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AAI,GAAEA,OAAQ,EAAC;IAE9D,OAAQ,GAAEM,QAAS,IAAGC,UAAW,EAAC;EACtC;EAEA,OAAOX,MAAM,CAACY,cAAc,CAAC,OAAO,EAAE;IAClCC,WAAW,EAAE,IAAI;IACjBC,qBAAqB,EAAEb,YAAY,GAAG,CAAC,GAAGc,SAAS;IACnDC,qBAAqB,EAAEf,YAAY,GAAG,CAAC,GAAGc,SAAS;IACnDE,wBAAwB,EAAE,CAAChB,YAAY,GAAG,EAAE,GAAGc;EACnD,CAAC,CAAC;AACN,CAAC;AAAClB,OAAA,CAAAC,aAAA,GAAAA,aAAA;AAWK,MAAMoB,aAA4B,GAAGC,KAAA,IAKtC;EAAA,IALuC;IACzCC,cAAc;IACdnB,YAAY;IACZC,WAAW;IACXmB;EACJ,CAAC,GAAAF,KAAA;EACG,IAAIG,OAAO,GAAG,KAAK;;EAEnB;EACA,IAAIF,cAAc,IAAIG,oBAAY,CAACC,IAAI,CAACH,MAAM,CAAC,EAAE;IAC7CC,OAAO,GAAG,IAAI;EAClB;;EAEA;EACA,IAAIrB,YAAY,IAAIwB,kBAAU,CAACD,IAAI,CAACH,MAAM,CAAC,EAAE;IACzCC,OAAO,GAAG,IAAI;EAClB;EAEA,IAAIpB,WAAW,IAAIwB,iBAAS,EAAE;IAC1BJ,OAAO,GAAG,IAAI;EAClB;;EAEA;EACA,IAAI,CAACF,cAAc,IAAI,CAACnB,YAAY,IAAI,CAACC,WAAW,IAAIyB,oBAAY,CAACH,IAAI,CAACH,MAAM,CAAC,EAAE;IAC/EC,OAAO,GAAG,IAAI;EAClB;EAEA,IAAID,MAAM,CAACO,MAAM,KAAK,CAAC,EAAE;IACrBN,OAAO,GAAG,IAAI;EAClB;EAEA,OAAOA,OAAO;AAClB,CAAC;AAACzB,OAAA,CAAAqB,aAAA,GAAAA,aAAA"}
@@ -0,0 +1,19 @@
1
+ import { FC } from 'react';
2
+ import type { OpeningTime, Weekday } from '../../types/openingTimes';
3
+ export type OpeningTimesProps = {
4
+ /**
5
+ * Function to be executed when a time is changed.
6
+ * @param openingTimes
7
+ */
8
+ onChange?: (openingTimes: OpeningTime[]) => void;
9
+ /**
10
+ * The opening times corresponding to its weekday.
11
+ */
12
+ openingTimes: OpeningTime[];
13
+ /**
14
+ * The weekdays that should be displayed.
15
+ */
16
+ weekdays: Weekday[];
17
+ };
18
+ declare const OpeningTimes: FC<OpeningTimesProps>;
19
+ export default OpeningTimes;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _OpeningTimes = require("./OpeningTimes.styles");
9
+ var _Checkbox = _interopRequireDefault(require("../checkbox/Checkbox"));
10
+ var _OpeningInputs = _interopRequireDefault(require("./opening-inputs/OpeningInputs"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ const OpeningTimes = _ref => {
15
+ let {
16
+ openingTimes,
17
+ weekdays,
18
+ onChange
19
+ } = _ref;
20
+ const [newOpeningTimes, setNewOpeningTimes] = (0, _react.useState)();
21
+ (0, _react.useEffect)(() => {
22
+ setNewOpeningTimes(openingTimes);
23
+ }, [openingTimes]);
24
+ (0, _react.useEffect)(() => {
25
+ if (newOpeningTimes && typeof onChange === 'function') {
26
+ onChange(newOpeningTimes);
27
+ }
28
+ }, [newOpeningTimes, onChange]);
29
+ const handleCheckBoxChange = id => {
30
+ setNewOpeningTimes(prevOpeningTimes => (prevOpeningTimes ?? []).map(openingTime => {
31
+ if (openingTime.id === id) {
32
+ return {
33
+ ...openingTime,
34
+ isDisabled: !openingTime.isDisabled
35
+ };
36
+ }
37
+ return openingTime;
38
+ }));
39
+ };
40
+ const content = (0, _react.useMemo)(() => {
41
+ const items = [];
42
+ if (!newOpeningTimes) {
43
+ return items;
44
+ }
45
+ newOpeningTimes.forEach(_ref2 => {
46
+ let {
47
+ times,
48
+ id,
49
+ weekdayId,
50
+ isDisabled
51
+ } = _ref2;
52
+ const weekday = weekdays.find(weekDay => weekDay.id === weekdayId)?.name;
53
+ if (!weekday) {
54
+ return;
55
+ }
56
+ items.push( /*#__PURE__*/_react.default.createElement(_OpeningTimes.StyledOpeningTimesWrapper, {
57
+ key: `openingTimes__${id}`
58
+ }, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
59
+ isChecked: !isDisabled,
60
+ onChange: () => handleCheckBoxChange(id)
61
+ }, weekday), /*#__PURE__*/_react.default.createElement(_OpeningInputs.default, {
62
+ times: times,
63
+ isDisabled: isDisabled,
64
+ onChange: () => {}
65
+ })));
66
+ });
67
+ return items;
68
+ }, [newOpeningTimes, weekdays]);
69
+ return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_OpeningTimes.StyledOpeningTimes, null, content), [content]);
70
+ };
71
+ OpeningTimes.displayName = 'OpeningTimes';
72
+ var _default = exports.default = OpeningTimes;
73
+ //# sourceMappingURL=OpeningTimes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpeningTimes.js","names":["_react","_interopRequireWildcard","require","_OpeningTimes","_Checkbox","_interopRequireDefault","_OpeningInputs","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","OpeningTimes","_ref","openingTimes","weekdays","onChange","newOpeningTimes","setNewOpeningTimes","useState","useEffect","handleCheckBoxChange","id","prevOpeningTimes","map","openingTime","isDisabled","content","useMemo","items","forEach","_ref2","times","weekdayId","weekday","find","weekDay","name","push","createElement","StyledOpeningTimesWrapper","key","isChecked","StyledOpeningTimes","displayName","_default","exports"],"sources":["../../../src/components/opening-times/OpeningTimes.tsx"],"sourcesContent":["import React, { FC, type ReactElement, useEffect, useMemo, useState } from 'react';\nimport { StyledOpeningTimes, StyledOpeningTimesWrapper } from './OpeningTimes.styles';\nimport type { OpeningTime, Weekday } from '../../types/openingTimes';\nimport Checkbox from '../checkbox/Checkbox';\nimport OpeningInputs from './opening-inputs/OpeningInputs';\n\nexport type OpeningTimesProps = {\n /**\n * Function to be executed when a time is changed.\n * @param openingTimes\n */\n onChange?: (openingTimes: OpeningTime[]) => void;\n /**\n * The opening times corresponding to its weekday.\n */\n openingTimes: OpeningTime[];\n /**\n * The weekdays that should be displayed.\n */\n weekdays: Weekday[];\n};\n\nconst OpeningTimes: FC<OpeningTimesProps> = ({ openingTimes, weekdays, onChange }) => {\n const [newOpeningTimes, setNewOpeningTimes] = useState<OpeningTime[]>();\n\n useEffect(() => {\n setNewOpeningTimes(openingTimes);\n }, [openingTimes]);\n\n useEffect(() => {\n if (newOpeningTimes && typeof onChange === 'function') {\n onChange(newOpeningTimes);\n }\n }, [newOpeningTimes, onChange]);\n\n const handleCheckBoxChange = (id: string) => {\n setNewOpeningTimes((prevOpeningTimes) =>\n (prevOpeningTimes ?? []).map((openingTime) => {\n if (openingTime.id === id) {\n return { ...openingTime, isDisabled: !openingTime.isDisabled };\n }\n return openingTime;\n }),\n );\n };\n\n const content = useMemo(() => {\n const items: ReactElement[] = [];\n\n if (!newOpeningTimes) {\n return items;\n }\n\n newOpeningTimes.forEach(({ times, id, weekdayId, isDisabled }) => {\n const weekday = weekdays.find((weekDay) => weekDay.id === weekdayId)?.name;\n\n if (!weekday) {\n return;\n }\n\n items.push(\n <StyledOpeningTimesWrapper key={`openingTimes__${id}`}>\n <Checkbox isChecked={!isDisabled} onChange={() => handleCheckBoxChange(id)}>\n {weekday}\n </Checkbox>\n <OpeningInputs times={times} isDisabled={isDisabled} onChange={() => {}} />\n </StyledOpeningTimesWrapper>,\n );\n });\n\n return items;\n }, [newOpeningTimes, weekdays]);\n\n return useMemo(() => <StyledOpeningTimes>{content}</StyledOpeningTimes>, [content]);\n};\n\nOpeningTimes.displayName = 'OpeningTimes';\n\nexport default OpeningTimes;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,cAAA,GAAAD,sBAAA,CAAAH,OAAA;AAA2D,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAF,OAAA,EAAAE,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAJ,CAAA,UAAAG,CAAA,CAAAE,GAAA,CAAAL,CAAA,OAAAM,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAA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,aAAA,CAACrD,aAAA,CAAAyD,kBAAkB,QAAEhB,OAA4B,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;AACvF,CAAC;AAEDf,YAAY,CAACgC,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAtD,OAAA,GAE3BoB,YAAY"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';
3
+ type StyledSliderButtonProps = WithTheme<{
4
+ isDisabled?: boolean;
5
+ }>;
6
+ export declare const StyledOpeningTimes: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledSliderButtonProps>>;
7
+ export declare const StyledOpeningTimesWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
8
+ export {};
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledOpeningTimesWrapper = exports.StyledOpeningTimes = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const StyledOpeningTimes = exports.StyledOpeningTimes = _styledComponents.default.div`
10
+ display: flex;
11
+ flex-direction: column;
12
+ gap: 8px;
13
+ `;
14
+ const StyledOpeningTimesWrapper = exports.StyledOpeningTimesWrapper = _styledComponents.default.div`
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: space-between;
18
+ `;
19
+ //# sourceMappingURL=OpeningTimes.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpeningTimes.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledOpeningTimes","exports","styled","div","StyledOpeningTimesWrapper"],"sources":["../../../src/components/opening-times/OpeningTimes.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledSliderButtonProps = WithTheme<{ isDisabled?: boolean }>;\n\nexport const StyledOpeningTimes = styled.div<StyledSliderButtonProps>`\n display: flex;\n flex-direction: column;\n gap: 8px;\n`;\n\nexport const StyledOpeningTimesWrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAKhC,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAGE,yBAAM,CAACC,GAA6B;AACtE;AACA;AACA;AACA,CAAC;AAEM,MAAMC,yBAAyB,GAAAH,OAAA,CAAAG,yBAAA,GAAGF,yBAAM,CAACC,GAAI;AACpD;AACA;AACA;AACA,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { FC } from 'react';
2
+ import { type Time } from '../../../types/openingTimes';
3
+ export type OpeningInputsProps = {
4
+ times: Time[];
5
+ isDisabled?: boolean;
6
+ onChange: (times: Time[]) => void;
7
+ };
8
+ declare const OpeningInputs: FC<OpeningInputsProps>;
9
+ export default OpeningInputs;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _openingTimes = require("../../../types/openingTimes");
9
+ var _OpeningInputs = require("./OpeningInputs.styles");
10
+ var _OpeningInput = _interopRequireDefault(require("./opening-input/OpeningInput"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ const OpeningInputs = _ref => {
15
+ let {
16
+ times,
17
+ isDisabled,
18
+ onChange
19
+ } = _ref;
20
+ const [newTimes, setNewTimes] = (0, _react.useState)();
21
+ (0, _react.useEffect)(() => {
22
+ setNewTimes(times);
23
+ }, [times]);
24
+ (0, _react.useEffect)(() => {}, []);
25
+ const handleAdd = () => {
26
+ const defaultTime = {
27
+ start: '00:00',
28
+ end: '00:00'
29
+ };
30
+ setNewTimes(prevState =>
31
+ // onChange();
32
+
33
+ prevState ? [...prevState, defaultTime] : [defaultTime]);
34
+ };
35
+ const handleRemove = indexToRemove => {
36
+ setNewTimes(prevState => (prevState ?? []).filter((_, index) => index !== indexToRemove));
37
+ };
38
+ const handleChange = (newTime, indexToUpdate) => {
39
+ setNewTimes(prevState => (prevState ?? []).map((time, index) => {
40
+ if (index === indexToUpdate) {
41
+ return newTime;
42
+ }
43
+ return time;
44
+ }));
45
+ };
46
+ const content = (0, _react.useMemo)(() => {
47
+ const items = [];
48
+ if (!newTimes) {
49
+ return items;
50
+ }
51
+ newTimes.forEach((_ref2, index) => {
52
+ let {
53
+ end,
54
+ start
55
+ } = _ref2;
56
+ if (index > 1) {
57
+ return;
58
+ }
59
+ let buttonType = _openingTimes.OpeningTimesButtonType.NONE;
60
+ if (index === 0 && times.length === 1) {
61
+ buttonType = _openingTimes.OpeningTimesButtonType.ADD;
62
+ } else if (index === 1) {
63
+ buttonType = _openingTimes.OpeningTimesButtonType.REMOVE;
64
+ }
65
+ items.push( /*#__PURE__*/_react.default.createElement(_OpeningInput.default, {
66
+ start: start,
67
+ end: end,
68
+ isDisabled: isDisabled,
69
+ buttonType: buttonType,
70
+ onAdd: handleAdd,
71
+ onChange: time => handleChange(time, index),
72
+ onRemove: () => handleRemove(index)
73
+ }));
74
+ });
75
+ return items;
76
+ }, [isDisabled, newTimes, times.length]);
77
+ return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_OpeningInputs.StyledOpeningInputs, null, content), [content]);
78
+ };
79
+ OpeningInputs.displayName = 'OpeningInputs';
80
+ var _default = exports.default = OpeningInputs;
81
+ //# sourceMappingURL=OpeningInputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpeningInputs.js","names":["_react","_interopRequireWildcard","require","_openingTimes","_OpeningInputs","_OpeningInput","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","OpeningInputs","_ref","times","isDisabled","onChange","newTimes","setNewTimes","useState","useEffect","handleAdd","defaultTime","start","end","prevState","handleRemove","indexToRemove","filter","_","index","handleChange","newTime","indexToUpdate","map","time","content","useMemo","items","forEach","_ref2","buttonType","OpeningTimesButtonType","NONE","length","ADD","REMOVE","push","createElement","onAdd","onRemove","StyledOpeningInputs","displayName","_default","exports"],"sources":["../../../../src/components/opening-times/opening-inputs/OpeningInputs.tsx"],"sourcesContent":["import React, { FC, type ReactElement, useEffect, useMemo, useState } from 'react';\nimport { OpeningTimesButtonType, type Time } from '../../../types/openingTimes';\nimport { StyledOpeningInputs } from './OpeningInputs.styles';\nimport OpeningInput from './opening-input/OpeningInput';\n\nexport type OpeningInputsProps = {\n times: Time[];\n isDisabled?: boolean;\n onChange: (times: Time[]) => void;\n};\n\nconst OpeningInputs: FC<OpeningInputsProps> = ({ times, isDisabled, onChange }) => {\n const [newTimes, setNewTimes] = useState<Time[]>();\n\n useEffect(() => {\n setNewTimes(times);\n }, [times]);\n\n useEffect(() => {}, []);\n\n const handleAdd = () => {\n const defaultTime: Time = { start: '00:00', end: '00:00' };\n\n setNewTimes((prevState) =>\n // onChange();\n\n prevState ? [...prevState, defaultTime] : [defaultTime],\n );\n };\n\n const handleRemove = (indexToRemove: number) => {\n setNewTimes((prevState) => (prevState ?? []).filter((_, index) => index !== indexToRemove));\n };\n\n const handleChange = (newTime: Time, indexToUpdate: number) => {\n setNewTimes((prevState) =>\n (prevState ?? []).map((time, index) => {\n if (index === indexToUpdate) {\n return newTime;\n }\n return time;\n }),\n );\n };\n\n const content = useMemo(() => {\n const items: ReactElement[] = [];\n\n if (!newTimes) {\n return items;\n }\n\n newTimes.forEach(({ end, start }, index) => {\n if (index > 1) {\n return;\n }\n\n let buttonType = OpeningTimesButtonType.NONE;\n\n if (index === 0 && times.length === 1) {\n buttonType = OpeningTimesButtonType.ADD;\n } else if (index === 1) {\n buttonType = OpeningTimesButtonType.REMOVE;\n }\n\n items.push(\n <OpeningInput\n start={start}\n end={end}\n isDisabled={isDisabled}\n buttonType={buttonType}\n onAdd={handleAdd}\n onChange={(time) => handleChange(time, index)}\n onRemove={() => handleRemove(index)}\n />,\n );\n });\n\n return items;\n }, [isDisabled, newTimes, times.length]);\n\n return useMemo(() => <StyledOpeningInputs>{content}</StyledOpeningInputs>, [content]);\n};\n\nOpeningInputs.displayName = 'OpeningInputs';\n\nexport default OpeningInputs;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAwD,SAAAI,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,E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KAAA;MAC5B,IAAIV,KAAK,GAAG,CAAC,EAAE;QACX;MACJ;MAEA,IAAIW,UAAU,GAAGC,oCAAsB,CAACC,IAAI;MAE5C,IAAIb,KAAK,KAAK,CAAC,IAAIhB,KAAK,CAAC8B,MAAM,KAAK,CAAC,EAAE;QACnCH,UAAU,GAAGC,oCAAsB,CAACG,GAAG;MAC3C,CAAC,MAAM,IAAIf,KAAK,KAAK,CAAC,EAAE;QACpBW,UAAU,GAAGC,oCAAsB,CAACI,MAAM;MAC9C;MAEAR,KAAK,CAACS,IAAI,eACNhE,MAAA,CAAAS,OAAA,CAAAwD,aAAA,CAAC5D,aAAA,CAAAI,OAAY;QACT+B,KAAK,EAAEA,KAAM;QACbC,GAAG,EAAEA,GAAI;QACTT,UAAU,EAAEA,UAAW;QACvB0B,UAAU,EAAEA,UAAW;QACvBQ,KAAK,EAAE5B,SAAU;QACjBL,QAAQ,EAAGmB,IAAI,IAAKJ,YAAY,CAACI,IAAI,EAAEL,KAAK,CAAE;QAC9CoB,QAAQ,EAAEA,CAAA,KAAMxB,YAAY,CAACI,KAAK;MAAE,CACvC,CACL,CAAC;IACL,CAAC,CAAC;IAEF,OAAOQ,KAAK;EAChB,CAAC,EAAE,CAACvB,UAAU,EAAEE,QAAQ,EAAEH,KAAK,CAAC8B,MAAM,CAAC,CAAC;EAExC,OAAO,IAAAP,cAAO,EAAC,mBAAMtD,MAAA,CAAAS,OAAA,CAAAwD,aAAA,CAAC7D,cAAA,CAAAgE,mBAAmB,QAAEf,OAA6B,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;AACzF,CAAC;AAEDxB,aAAa,CAACwC,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9D,OAAA,GAE7BoB,aAAa"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledOpeningInputs: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledOpeningInputs = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const StyledOpeningInputs = exports.StyledOpeningInputs = _styledComponents.default.div`
10
+ display: flex;
11
+ flex-direction: column;
12
+ `;
13
+ //# sourceMappingURL=OpeningInputs.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpeningInputs.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledOpeningInputs","exports","styled","div"],"sources":["../../../../src/components/opening-times/opening-inputs/OpeningInputs.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledOpeningInputs = styled.div`\n display: flex;\n flex-direction: column;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGE,yBAAM,CAACC,GAAI;AAC9C;AACA;AACA,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { FC } from 'react';
2
+ import { OpeningTimesButtonType, type Time } from '../../../../types/openingTimes';
3
+ export type OpeningInputProps = {
4
+ start: Time['start'];
5
+ end: Time['end'];
6
+ isDisabled?: boolean;
7
+ buttonType: OpeningTimesButtonType;
8
+ onAdd: () => void;
9
+ onRemove: () => void;
10
+ onChange: (time: Time) => void;
11
+ };
12
+ declare const OpeningInput: FC<OpeningInputProps>;
13
+ export default OpeningInput;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _openingTimes = require("../../../../types/openingTimes");
9
+ var _OpeningInput = require("./OpeningInput.styles");
10
+ var _NumberInput = _interopRequireDefault(require("../../../number-input/NumberInput"));
11
+ var _Icon = _interopRequireDefault(require("../../../icon/Icon"));
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
+ const OpeningInput = _ref => {
16
+ let {
17
+ end,
18
+ start,
19
+ isDisabled,
20
+ buttonType,
21
+ onRemove,
22
+ onAdd,
23
+ onChange
24
+ } = _ref;
25
+ const [startTime, setStartTime] = (0, _react.useState)(start);
26
+ const [endTime, setEndTime] = (0, _react.useState)(end);
27
+ (0, _react.useEffect)(() => {
28
+ onChange({
29
+ start: startTime,
30
+ end: endTime
31
+ });
32
+ }, [endTime, onChange, startTime]);
33
+ const button = (0, _react.useMemo)(() => {
34
+ switch (buttonType) {
35
+ case _openingTimes.OpeningTimesButtonType.ADD:
36
+ return /*#__PURE__*/_react.default.createElement(_OpeningInput.StyledOpeningInputButtonWrapper, {
37
+ onClick: onAdd
38
+ }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
39
+ icons: ['fa fa-plus'],
40
+ size: 15,
41
+ color: "white"
42
+ }));
43
+ case _openingTimes.OpeningTimesButtonType.REMOVE:
44
+ return /*#__PURE__*/_react.default.createElement(_OpeningInput.StyledOpeningInputButtonWrapper, {
45
+ onClick: onRemove
46
+ }, /*#__PURE__*/_react.default.createElement(_Icon.default, {
47
+ icons: ['fa fa-x'],
48
+ size: 10,
49
+ color: "white"
50
+ }));
51
+ default:
52
+ return null;
53
+ }
54
+ }, [buttonType, onAdd, onRemove]);
55
+ const handleStartTimeChange = (0, _react.useCallback)(value => {
56
+ setStartTime(value);
57
+ }, []);
58
+ const handleEndTimeChange = (0, _react.useCallback)(value => {
59
+ setEndTime(value);
60
+ }, []);
61
+ return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_OpeningInput.StyledOpeningInput, null, /*#__PURE__*/_react.default.createElement(_OpeningInput.StyledOpeningInputWrapper, null, /*#__PURE__*/_react.default.createElement(_NumberInput.default, {
62
+ isTimeInput: true,
63
+ value: startTime,
64
+ onChange: handleStartTimeChange,
65
+ isDisabled: isDisabled
66
+ })), /*#__PURE__*/_react.default.createElement(_OpeningInput.StyledOpeningInputText, {
67
+ isDisabled: isDisabled
68
+ }, "-"), /*#__PURE__*/_react.default.createElement(_OpeningInput.StyledOpeningInputWrapper, null, /*#__PURE__*/_react.default.createElement(_NumberInput.default, {
69
+ isTimeInput: true,
70
+ value: endTime,
71
+ onChange: handleEndTimeChange,
72
+ isDisabled: isDisabled
73
+ })), button), [button, endTime, handleEndTimeChange, handleStartTimeChange, isDisabled, startTime]);
74
+ };
75
+ OpeningInput.displayName = 'OpeningInput';
76
+ var _default = exports.default = OpeningInput;
77
+ //# sourceMappingURL=OpeningInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpeningInput.js","names":["_react","_interopRequireWildcard","require","_openingTimes","_OpeningInput","_NumberInput","_interopRequireDefault","_Icon","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","OpeningInput","_ref","end","start","isDisabled","buttonType","onRemove","onAdd","onChange","startTime","setStartTime","useState","endTime","setEndTime","useEffect","button","useMemo","OpeningTimesButtonType","ADD","createElement","StyledOpeningInputButtonWrapper","onClick","icons","size","color","REMOVE","handleStartTimeChange","useCallback","value","handleEndTimeChange","StyledOpeningInput","StyledOpeningInputWrapper","isTimeInput","StyledOpeningInputText","displayName","_default","exports"],"sources":["../../../../../src/components/opening-times/opening-inputs/opening-input/OpeningInput.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';\nimport { OpeningTimesButtonType, type Time } from '../../../../types/openingTimes';\nimport {\n StyledOpeningInput,\n StyledOpeningInputButtonWrapper,\n StyledOpeningInputText,\n StyledOpeningInputWrapper,\n} from './OpeningInput.styles';\nimport NumberInput from '../../../number-input/NumberInput';\nimport Icon from '../../../icon/Icon';\n\nexport type OpeningInputProps = {\n start: Time['start'];\n end: Time['end'];\n isDisabled?: boolean;\n buttonType: OpeningTimesButtonType;\n onAdd: () => void;\n onRemove: () => void;\n onChange: (time: Time) => void;\n};\n\nconst OpeningInput: FC<OpeningInputProps> = ({\n end,\n start,\n isDisabled,\n buttonType,\n onRemove,\n onAdd,\n onChange,\n}) => {\n const [startTime, setStartTime] = useState(start);\n const [endTime, setEndTime] = useState(end);\n\n useEffect(() => {\n onChange({ start: startTime, end: endTime });\n }, [endTime, onChange, startTime]);\n\n const button = useMemo(() => {\n switch (buttonType) {\n case OpeningTimesButtonType.ADD:\n return (\n <StyledOpeningInputButtonWrapper onClick={onAdd}>\n <Icon icons={['fa fa-plus']} size={15} color=\"white\" />\n </StyledOpeningInputButtonWrapper>\n );\n case OpeningTimesButtonType.REMOVE:\n return (\n <StyledOpeningInputButtonWrapper onClick={onRemove}>\n <Icon icons={['fa fa-x']} size={10} color=\"white\" />\n </StyledOpeningInputButtonWrapper>\n );\n default:\n return null;\n }\n }, [buttonType, onAdd, onRemove]);\n\n const handleStartTimeChange = useCallback((value: string) => {\n setStartTime(value);\n }, []);\n\n const handleEndTimeChange = useCallback((value: string) => {\n setEndTime(value);\n }, []);\n\n return useMemo(\n () => (\n <StyledOpeningInput>\n <StyledOpeningInputWrapper>\n <NumberInput\n isTimeInput\n value={startTime}\n onChange={handleStartTimeChange}\n isDisabled={isDisabled}\n />\n </StyledOpeningInputWrapper>\n <StyledOpeningInputText isDisabled={isDisabled}>-</StyledOpeningInputText>\n <StyledOpeningInputWrapper>\n <NumberInput\n isTimeInput\n value={endTime}\n onChange={handleEndTimeChange}\n isDisabled={isDisabled}\n />\n </StyledOpeningInputWrapper>\n {button}\n </StyledOpeningInput>\n ),\n [button, endTime, handleEndTimeChange, handleStartTimeChange, isDisabled, startTime],\n );\n};\n\nOpeningInput.displayName = 'OpeningInput';\n\nexport default OpeningInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAMA,IAAAG,YAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAAsC,SAAAI,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAX,wBAAAW,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAF,OAAA,EAAAE,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,C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,MAAA,CAAAU,OAAA,CAAAuC,aAAA,CAAC5C,YAAA,CAAAK,OAAW;IACRoD,WAAW;IACXJ,KAAK,EAAEnB,SAAU;IACjBD,QAAQ,EAAEkB,qBAAsB;IAChCtB,UAAU,EAAEA;EAAW,CAC1B,CACsB,CAAC,eAC5BlC,MAAA,CAAAU,OAAA,CAAAuC,aAAA,CAAC7C,aAAA,CAAA2D,sBAAsB;IAAC7B,UAAU,EAAEA;EAAW,GAAC,GAAyB,CAAC,eAC1ElC,MAAA,CAAAU,OAAA,CAAAuC,aAAA,CAAC7C,aAAA,CAAAyD,yBAAyB,qBACtB7D,MAAA,CAAAU,OAAA,CAAAuC,aAAA,CAAC5C,YAAA,CAAAK,OAAW;IACRoD,WAAW;IACXJ,KAAK,EAAEhB,OAAQ;IACfJ,QAAQ,EAAEqB,mBAAoB;IAC9BzB,UAAU,EAAEA;EAAW,CAC1B,CACsB,CAAC,EAC3BW,MACe,CACvB,EACD,CAACA,MAAM,EAAEH,OAAO,EAAEiB,mBAAmB,EAAEH,qBAAqB,EAAEtB,UAAU,EAAEK,SAAS,CACvF,CAAC;AACL,CAAC;AAEDT,YAAY,CAACkC,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAxD,OAAA,GAE3BoB,YAAY"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import type { WithTheme } from '../../../color-scheme-provider/ColorSchemeProvider';
3
+ export declare const StyledOpeningInput: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
4
+ export declare const StyledOpeningInputWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
5
+ type StyledOpeningInputTextProps = WithTheme<{
6
+ isDisabled?: boolean;
7
+ }>;
8
+ export declare const StyledOpeningInputText: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledOpeningInputTextProps>>;
9
+ export declare const StyledOpeningInputButtonWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
10
+ export {};
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledOpeningInputWrapper = exports.StyledOpeningInputText = exports.StyledOpeningInputButtonWrapper = exports.StyledOpeningInput = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const StyledOpeningInput = exports.StyledOpeningInput = _styledComponents.default.div`
10
+ display: flex;
11
+ align-items: center;
12
+ gap: 6px;
13
+ `;
14
+ const StyledOpeningInputWrapper = exports.StyledOpeningInputWrapper = _styledComponents.default.div`
15
+ width: 60px;
16
+ `;
17
+ const StyledOpeningInputText = exports.StyledOpeningInputText = _styledComponents.default.div`
18
+ opacity: ${_ref => {
19
+ let {
20
+ isDisabled
21
+ } = _ref;
22
+ return isDisabled ? 0.5 : 1;
23
+ }};
24
+ `;
25
+ const StyledOpeningInputButtonWrapper = exports.StyledOpeningInputButtonWrapper = _styledComponents.default.div`
26
+ width: 20px;
27
+ height: 20px;
28
+ background-color: ${_ref2 => {
29
+ let {
30
+ theme
31
+ } = _ref2;
32
+ return theme['408'];
33
+ }};
34
+ border-radius: 3px;
35
+ box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);
36
+ border: none;
37
+ cursor: pointer;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ `;
42
+ //# sourceMappingURL=OpeningInput.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpeningInput.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledOpeningInput","exports","styled","div","StyledOpeningInputWrapper","StyledOpeningInputText","_ref","isDisabled","StyledOpeningInputButtonWrapper","_ref2","theme"],"sources":["../../../../../src/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport type { WithTheme } from '../../../color-scheme-provider/ColorSchemeProvider';\n\nexport const StyledOpeningInput = styled.div`\n display: flex;\n align-items: center;\n gap: 6px;\n`;\n\nexport const StyledOpeningInputWrapper = styled.div`\n width: 60px;\n`;\n\ntype StyledOpeningInputTextProps = WithTheme<{ isDisabled?: boolean }>;\n\nexport const StyledOpeningInputText = styled.div<StyledOpeningInputTextProps>`\n opacity: ${({ isDisabled }) => (isDisabled ? 0.5 : 1)};\n`;\n\ntype StyledOpeningInputButtonWrapperProps = WithTheme<unknown>;\n\nexport const StyledOpeningInputButtonWrapper = styled.div`\n width: 20px;\n height: 20px;\n background-color: ${({ theme }: StyledOpeningInputButtonWrapperProps) => theme['408']};\n border-radius: 3px;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGhC,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAGE,yBAAM,CAACC,GAAI;AAC7C;AACA;AACA;AACA,CAAC;AAEM,MAAMC,yBAAyB,GAAAH,OAAA,CAAAG,yBAAA,GAAGF,yBAAM,CAACC,GAAI;AACpD;AACA,CAAC;AAIM,MAAME,sBAAsB,GAAAJ,OAAA,CAAAI,sBAAA,GAAGH,yBAAM,CAACC,GAAiC;AAC9E,eAAeG,IAAA;EAAA,IAAC;IAAEC;EAAW,CAAC,GAAAD,IAAA;EAAA,OAAMC,UAAU,GAAG,GAAG,GAAG,CAAC;AAAA,CAAE;AAC1D,CAAC;AAIM,MAAMC,+BAA+B,GAAAP,OAAA,CAAAO,+BAAA,GAAGN,yBAAM,CAACC,GAAI;AAC1D;AACA;AACA,wBAAwBM,KAAA;EAAA,IAAC;IAAEC;EAA4C,CAAC,GAAAD,KAAA;EAAA,OAAKC,KAAK,CAAC,KAAK,CAAC;AAAA,CAAC;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { FC } from 'react';
2
2
  export type ProgressBarProps = {
3
3
  /**
4
- * The lable that should be displayed under the progressbar.
4
+ * The label that should be displayed under the progressbar.
5
5
  */
6
- lable?: string;
6
+ label?: string;
7
7
  /**
8
8
  * The percentage of the progress. Number between 0 and 100.
9
9
  */
@@ -11,7 +11,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
11
11
  const ProgressBar = _ref => {
12
12
  let {
13
13
  percentage,
14
- lable
14
+ label
15
15
  } = _ref;
16
16
  const [internalPercentage, setInternalPercentage] = (0, _react.useState)(0);
17
17
  (0, _react.useEffect)(() => {
@@ -32,7 +32,7 @@ const ProgressBar = _ref => {
32
32
  transition: {
33
33
  type: 'tween'
34
34
  }
35
- }), /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarBackground, null), lable && /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarLable, null, lable)), [lable, internalPercentage]);
35
+ }), /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarBackground, null), label && /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarLable, null, label)), [label, internalPercentage]);
36
36
  };
37
37
  ProgressBar.displayName = 'ProgressBar';
38
38
  var _default = exports.default = ProgressBar;
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.js","names":["_react","_interopRequireWildcard","require","_ProgressBar","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ProgressBar","_ref","percentage","lable","internalPercentage","setInternalPercentage","useState","useEffect","useMemo","createElement","StyledProgressBar","StyledMotionProgressBarProgress","initial","width","animate","exit","transition","type","StyledProgressBarBackground","StyledProgressBarLable","displayName","_default","exports"],"sources":["../../../src/components/progress-bar/ProgressBar.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useState } from 'react';\nimport {\n StyledMotionProgressBarProgress,\n StyledProgressBar,\n StyledProgressBarBackground,\n StyledProgressBarLable,\n} from './ProgressBar.styles';\n\nexport type ProgressBarProps = {\n /**\n * The lable that should be displayed under the progressbar.\n */\n lable?: string;\n /**\n * The percentage of the progress. Number between 0 and 100.\n */\n percentage: number;\n};\n\nconst ProgressBar: FC<ProgressBarProps> = ({ percentage, lable }) => {\n const [internalPercentage, setInternalPercentage] = useState(0);\n\n useEffect(() => {\n if (percentage >= 0 && percentage <= 100) {\n setInternalPercentage(percentage);\n }\n }, [percentage]);\n\n return useMemo(\n () => (\n <StyledProgressBar>\n <StyledMotionProgressBarProgress\n initial={{ width: '0%' }}\n animate={{ width: `${internalPercentage}%` }}\n exit={{ width: '0%' }}\n transition={{ type: 'tween' }}\n />\n <StyledProgressBarBackground />\n {lable && <StyledProgressBarLable>{lable}</StyledProgressBarLable>}\n </StyledProgressBar>\n ),\n [lable, internalPercentage]\n );\n};\n\nProgressBar.displayName = 'ProgressBar';\n\nexport default ProgressBar;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAK8B,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAA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;MACtCG,qBAAqB,CAACH,UAAU,CAAC;IACrC;EACJ,CAAC,EAAE,CAACA,UAAU,CAAC,CAAC;EAEhB,OAAO,IAAAM,cAAO,EACV,mBACIjC,MAAA,CAAAU,OAAA,CAAAwB,aAAA,CAAC/B,YAAA,CAAAgC,iBAAiB,qBACdnC,MAAA,CAAAU,OAAA,CAAAwB,aAAA,CAAC/B,YAAA,CAAAiC,+BAA+B;IAC5BC,OAAO,EAAE;MAAEC,KAAK,EAAE;IAAK,CAAE;IACzBC,OAAO,EAAE;MAAED,KAAK,EAAG,GAAET,kBAAmB;IAAG,CAAE;IAC7CW,IAAI,EAAE;MAAEF,KAAK,EAAE;IAAK,CAAE;IACtBG,UAAU,EAAE;MAAEC,IAAI,EAAE;IAAQ;EAAE,CACjC,CAAC,eACF1C,MAAA,CAAAU,OAAA,CAAAwB,aAAA,CAAC/B,YAAA,CAAAwC,2BAA2B,MAAE,CAAC,EAC9Bf,KAAK,iBAAI5B,MAAA,CAAAU,OAAA,CAAAwB,aAAA,CAAC/B,YAAA,CAAAyC,sBAAsB,QAAEhB,KAA8B,CAClD,CACtB,EACD,CAACA,KAAK,EAAEC,kBAAkB,CAC9B,CAAC;AACL,CAAC;AAEDJ,WAAW,CAACoB,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArC,OAAA,GAEzBe,WAAW"}
1
+ {"version":3,"file":"ProgressBar.js","names":["_react","_interopRequireWildcard","require","_ProgressBar","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ProgressBar","_ref","percentage","label","internalPercentage","setInternalPercentage","useState","useEffect","useMemo","createElement","StyledProgressBar","StyledMotionProgressBarProgress","initial","width","animate","exit","transition","type","StyledProgressBarBackground","StyledProgressBarLable","displayName","_default","exports"],"sources":["../../../src/components/progress-bar/ProgressBar.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useState } from 'react';\nimport {\n StyledMotionProgressBarProgress,\n StyledProgressBar,\n StyledProgressBarBackground,\n StyledProgressBarLable,\n} from './ProgressBar.styles';\n\nexport type ProgressBarProps = {\n /**\n * The label that should be displayed under the progressbar.\n */\n label?: string;\n /**\n * The percentage of the progress. Number between 0 and 100.\n */\n percentage: number;\n};\n\nconst ProgressBar: FC<ProgressBarProps> = ({ percentage, label }) => {\n const [internalPercentage, setInternalPercentage] = useState(0);\n\n useEffect(() => {\n if (percentage >= 0 && percentage <= 100) {\n setInternalPercentage(percentage);\n }\n }, [percentage]);\n\n return useMemo(\n () => (\n <StyledProgressBar>\n <StyledMotionProgressBarProgress\n initial={{ width: '0%' }}\n animate={{ width: `${internalPercentage}%` }}\n exit={{ width: '0%' }}\n transition={{ type: 'tween' }}\n />\n <StyledProgressBarBackground />\n {label && <StyledProgressBarLable>{label}</StyledProgressBarLable>}\n </StyledProgressBar>\n ),\n [label, internalPercentage],\n );\n};\n\nProgressBar.displayName = 'ProgressBar';\n\nexport default ProgressBar;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAK8B,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,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ED,KAAK,EAAG,GAAET,kBAAmB;IAAG,CAAE;IAC7CW,IAAI,EAAE;MAAEF,KAAK,EAAE;IAAK,CAAE;IACtBG,UAAU,EAAE;MAAEC,IAAI,EAAE;IAAQ;EAAE,CACjC,CAAC,eACF1C,MAAA,CAAAU,OAAA,CAAAwB,aAAA,CAAC/B,YAAA,CAAAwC,2BAA2B,MAAE,CAAC,EAC9Bf,KAAK,iBAAI5B,MAAA,CAAAU,OAAA,CAAAwB,aAAA,CAAC/B,YAAA,CAAAyC,sBAAsB,QAAEhB,KAA8B,CAClD,CACtB,EACD,CAACA,KAAK,EAAEC,kBAAkB,CAC9B,CAAC;AACL,CAAC;AAEDJ,WAAW,CAACoB,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArC,OAAA,GAEzBe,WAAW"}
@@ -29,9 +29,9 @@ export type SliderProps = {
29
29
  */
30
30
  steps?: number;
31
31
  /**
32
- * A function to format the thumb lable.
32
+ * A function to format the thumb label.
33
33
  */
34
- thumbLableFormatter?: (value: number) => string;
34
+ thumbLabelFormatter?: (value: number) => string;
35
35
  /**
36
36
  * the Value that the slider should have.
37
37
  */
@@ -17,7 +17,7 @@ const Slider = _ref => {
17
17
  value,
18
18
  onChange,
19
19
  interval,
20
- thumbLableFormatter,
20
+ thumbLabelFormatter,
21
21
  shouldShowThumbLable = false,
22
22
  steps = 1
23
23
  } = _ref;
@@ -151,10 +151,10 @@ const Slider = _ref => {
151
151
  }), /*#__PURE__*/_react.default.createElement(_Slider.StyledSliderThumb, {
152
152
  ref: fromSliderThumbRef,
153
153
  position: fromSliderThumbPosition
154
- }, shouldShowThumbLable && /*#__PURE__*/_react.default.createElement(_Slider.StyledSliderThumbLable, null, typeof thumbLableFormatter === 'function' ? thumbLableFormatter(fromValue) : fromValue)), interval && /*#__PURE__*/_react.default.createElement(_Slider.StyledSliderThumb, {
154
+ }, shouldShowThumbLable && /*#__PURE__*/_react.default.createElement(_Slider.StyledSliderThumbLable, null, typeof thumbLabelFormatter === 'function' ? thumbLabelFormatter(fromValue) : fromValue)), interval && /*#__PURE__*/_react.default.createElement(_Slider.StyledSliderThumb, {
155
155
  ref: toSliderThumbRef,
156
156
  position: toSliderThumbPosition
157
- }, shouldShowThumbLable && /*#__PURE__*/_react.default.createElement(_Slider.StyledSliderThumbLable, null, typeof thumbLableFormatter === 'function' ? thumbLableFormatter(toValue) : toValue)), interval && /*#__PURE__*/_react.default.createElement(_Slider.StyledSliderInput, {
157
+ }, shouldShowThumbLable && /*#__PURE__*/_react.default.createElement(_Slider.StyledSliderThumbLable, null, typeof thumbLabelFormatter === 'function' ? thumbLabelFormatter(toValue) : toValue)), interval && /*#__PURE__*/_react.default.createElement(_Slider.StyledSliderInput, {
158
158
  ref: toSliderRef,
159
159
  isInterval: !!interval,
160
160
  type: "range",
@@ -163,7 +163,7 @@ const Slider = _ref => {
163
163
  max: maxValue,
164
164
  min: minValue,
165
165
  onChange: handleControlToSlider
166
- })), [steps, fromSliderThumbPosition, fromValue, handleControlToSlider, handleInputChange, interval, maxValue, minValue, shouldShowThumbLable, thumbLableFormatter, toSliderThumbPosition, toValue]);
166
+ })), [steps, fromSliderThumbPosition, fromValue, handleControlToSlider, handleInputChange, interval, maxValue, minValue, shouldShowThumbLable, thumbLabelFormatter, toSliderThumbPosition, toValue]);
167
167
  };
168
168
  Slider.displayName = 'Slider';
169
169
  var _default = exports.default = Slider;
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","names":["_react","_interopRequireWildcard","require","_Slider","_slider","_styledComponents","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Slider","_ref","maxValue","minValue","value","onChange","interval","thumbLableFormatter","shouldShowThumbLable","steps","fromValue","setFromValue","useState","toValue","setToValue","fromSliderRef","useRef","toSliderRef","fromSliderThumbRef","toSliderThumbRef","theme","useTheme","useEffect","handleControlFromSlider","useCallback","event","current","Number","target","from","to","undefined","fillSlider","toSlider","fromSlider","String","handleControlToSlider","handleInputChange","newValue","fromSliderThumbPosition","useMemo","offsetWidth","toSliderThumbPosition","createElement","StyledSlider","StyledSliderInput","ref","isInterval","type","step","max","min","StyledSliderThumb","position","StyledSliderThumbLable","displayName","_default","exports"],"sources":["../../../src/components/slider/Slider.tsx"],"sourcesContent":["import React, { ChangeEvent, FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n StyledSlider,\n StyledSliderInput,\n StyledSliderThumb,\n StyledSliderThumbLable,\n} from './Slider.styles';\nimport { fillSlider } from '../../utils/slider';\nimport { useTheme } from 'styled-components';\n\nexport interface SliderInterval {\n maxValue: number;\n minValue: number;\n}\n\nexport type SliderProps = {\n /**\n * The range that can be selected with two thumbs..\n */\n interval?: SliderInterval;\n /**\n * The maximum value of the slider.\n */\n maxValue: number;\n /**\n * The minimum value of the slider.\n */\n minValue: number;\n /**\n * Function that will be executed when the value is changed.\n */\n onChange?: (value?: number, interval?: SliderInterval) => void;\n /**\n * Whether the current value should be displayed inside the slider thumb.\n */\n shouldShowThumbLable?: boolean;\n /**\n * The steps of the slider.\n */\n steps?: number;\n /**\n * A function to format the thumb lable.\n */\n thumbLableFormatter?: (value: number) => string;\n /**\n * the Value that the slider should have.\n */\n value?: number;\n};\n\nconst Slider: FC<SliderProps> = ({\n maxValue,\n minValue,\n value,\n onChange,\n interval,\n thumbLableFormatter,\n shouldShowThumbLable = false,\n steps = 1,\n}) => {\n const [fromValue, setFromValue] = useState(0);\n const [toValue, setToValue] = useState(maxValue);\n\n const fromSliderRef = useRef<HTMLInputElement>(null);\n const toSliderRef = useRef<HTMLInputElement>(null);\n const fromSliderThumbRef = useRef<HTMLDivElement>(null);\n const toSliderThumbRef = useRef<HTMLDivElement>(null);\n\n const theme = useTheme();\n\n /**\n * This function sets the value\n */\n useEffect(() => {\n if (typeof value !== 'number') {\n return;\n }\n\n if (value >= minValue && value <= maxValue) {\n setFromValue(value);\n }\n }, [maxValue, minValue, value]);\n\n useEffect(() => {\n if (fromValue > toValue) {\n setFromValue(toValue);\n }\n\n if (toValue < fromValue) {\n setToValue(fromValue);\n }\n }, [fromValue, toValue]);\n\n const handleControlFromSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!fromSliderRef.current || !toSliderRef.current) {\n return;\n }\n\n setFromValue(Number(event.target.value));\n\n const from = Number(fromSliderRef.current.value);\n const to = Number(toSliderRef.current.value);\n\n if (typeof onChange === 'function') {\n onChange(undefined, { maxValue: to, minValue: from });\n }\n\n fillSlider({\n toSlider: toSliderRef.current,\n fromSlider: fromSliderRef.current,\n theme,\n });\n\n if (from > to) {\n fromSliderRef.current.value = String(to);\n } else {\n fromSliderRef.current.value = String(from);\n }\n },\n [onChange, theme],\n );\n\n const handleControlToSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!fromSliderRef.current || !toSliderRef.current) {\n return;\n }\n\n setToValue(Number(event.target.value));\n\n const from = Number(fromSliderRef.current.value);\n const to = Number(toSliderRef.current.value);\n\n if (typeof onChange === 'function') {\n onChange(undefined, { maxValue: to, minValue: from });\n }\n\n fillSlider({\n toSlider: toSliderRef.current,\n fromSlider: fromSliderRef.current,\n theme,\n });\n\n if (from <= to) {\n toSliderRef.current.value = String(to);\n } else {\n toSliderRef.current.value = String(from);\n }\n },\n [onChange, theme],\n );\n\n useEffect(() => {\n if (!fromSliderRef.current || !toSliderRef.current || !interval) {\n return;\n }\n\n setFromValue(interval.minValue);\n setToValue(interval.maxValue);\n\n fromSliderRef.current.value = String(interval.minValue);\n toSliderRef.current.value = String(interval.maxValue);\n\n fillSlider({\n fromSlider: fromSliderRef.current,\n toSlider: toSliderRef.current,\n theme,\n });\n // Note: interval can´t be in the deps because of rerender\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme]);\n\n /**\n * This function updates the value\n */\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const newValue = Number(event.target.value);\n\n if (interval) {\n handleControlFromSlider(event);\n\n return;\n }\n\n setFromValue(newValue);\n\n if (onChange) {\n onChange(newValue);\n }\n },\n [handleControlFromSlider, interval, onChange],\n );\n\n const fromSliderThumbPosition = useMemo(() => {\n if (fromSliderRef.current && fromSliderThumbRef.current) {\n return (\n ((fromValue - minValue) / (maxValue - minValue)) *\n (fromSliderRef.current.offsetWidth - fromSliderThumbRef.current.offsetWidth / 2)\n );\n }\n return 0;\n }, [fromValue, maxValue, minValue]);\n\n const toSliderThumbPosition = useMemo(() => {\n if (toSliderRef.current && toSliderThumbRef.current) {\n return (\n ((toValue - minValue) / (maxValue - minValue)) *\n (toSliderRef.current.offsetWidth - toSliderThumbRef.current.offsetWidth / 2)\n );\n }\n return 0;\n }, [toValue, maxValue, minValue]);\n\n return useMemo(\n () => (\n <StyledSlider>\n <StyledSliderInput\n ref={fromSliderRef}\n isInterval={!!interval}\n type=\"range\"\n value={fromValue}\n step={steps}\n max={maxValue}\n min={minValue}\n onChange={handleInputChange}\n />\n <StyledSliderThumb ref={fromSliderThumbRef} position={fromSliderThumbPosition}>\n {shouldShowThumbLable && (\n <StyledSliderThumbLable>\n {typeof thumbLableFormatter === 'function'\n ? thumbLableFormatter(fromValue)\n : fromValue}\n </StyledSliderThumbLable>\n )}\n </StyledSliderThumb>\n {interval && (\n <StyledSliderThumb ref={toSliderThumbRef} position={toSliderThumbPosition}>\n {shouldShowThumbLable && (\n <StyledSliderThumbLable>\n {typeof thumbLableFormatter === 'function'\n ? thumbLableFormatter(toValue)\n : toValue}\n </StyledSliderThumbLable>\n )}\n </StyledSliderThumb>\n )}\n {interval && (\n <StyledSliderInput\n ref={toSliderRef}\n isInterval={!!interval}\n type=\"range\"\n value={toValue}\n step={steps}\n max={maxValue}\n min={minValue}\n onChange={handleControlToSlider}\n />\n )}\n </StyledSlider>\n ),\n [\n steps,\n fromSliderThumbPosition,\n fromValue,\n handleControlToSlider,\n handleInputChange,\n interval,\n maxValue,\n minValue,\n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CAAC,CAACzC,QAAS;IACvB0C,IAAI,EAAC,OAAO;IACZ5C,KAAK,EAAES,OAAQ;IACfoC,IAAI,EAAExC,KAAM;IACZyC,GAAG,EAAEhD,QAAS;IACdiD,GAAG,EAAEhD,QAAS;IACdE,QAAQ,EAAE+B;EAAsB,CACnC,CAEK,CACjB,EACD,CACI3B,KAAK,EACL8B,uBAAuB,EACvB7B,SAAS,EACT0B,qBAAqB,EACrBC,iBAAiB,EACjB/B,QAAQ,EACRJ,QAAQ,EACRC,QAAQ,EACRK,oBAAoB,EACpBD,mBAAmB,EACnBmC,qBAAqB,EACrB7B,OAAO,CAEf,CAAC;AACL,CAAC;AAEDb,MAAM,CAACuD,WAAW,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAxE,OAAA,GAEfe,MAAM"}
1
+ {"version":3,"file":"Slider.js","names":["_react","_interopRequireWildcard","require","_Slider","_slider","_styledComponents","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Slider","_ref","maxValue","minValue","value","onChange","interval","thumbLabelFormatter","shouldShowThumbLable","steps","fromValue","setFromValue","useState","toValue","setToValue","fromSliderRef","useRef","toSliderRef","fromSliderThumbRef","toSliderThumbRef","theme","useTheme","useEffect","handleControlFromSlider","useCallback","event","current","Number","target","from","to","undefined","fillSlider","toSlider","fromSlider","String","handleControlToSlider","handleInputChange","newValue","fromSliderThumbPosition","useMemo","offsetWidth","toSliderThumbPosition","createElement","StyledSlider","StyledSliderInput","ref","isInterval","type","step","max","min","StyledSliderThumb","position","StyledSliderThumbLable","displayName","_default","exports"],"sources":["../../../src/components/slider/Slider.tsx"],"sourcesContent":["import React, { ChangeEvent, FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n StyledSlider,\n StyledSliderInput,\n StyledSliderThumb,\n StyledSliderThumbLable,\n} from './Slider.styles';\nimport { fillSlider } from '../../utils/slider';\nimport { useTheme } from 'styled-components';\n\nexport interface SliderInterval {\n maxValue: number;\n minValue: number;\n}\n\nexport type SliderProps = {\n /**\n * The range that can be selected with two thumbs..\n */\n interval?: SliderInterval;\n /**\n * The maximum value of the slider.\n */\n maxValue: number;\n /**\n * The minimum value of the slider.\n */\n minValue: number;\n /**\n * Function that will be executed when the value is changed.\n */\n onChange?: (value?: number, interval?: SliderInterval) => void;\n /**\n * Whether the current value should be displayed inside the slider thumb.\n */\n shouldShowThumbLable?: boolean;\n /**\n * The steps of the slider.\n */\n steps?: number;\n /**\n * A function to format the thumb label.\n */\n thumbLabelFormatter?: (value: number) => string;\n /**\n * the Value that the slider should have.\n */\n value?: number;\n};\n\nconst Slider: FC<SliderProps> = ({\n maxValue,\n minValue,\n value,\n onChange,\n interval,\n thumbLabelFormatter,\n shouldShowThumbLable = false,\n steps = 1,\n}) => {\n const [fromValue, setFromValue] = useState(0);\n const [toValue, setToValue] = useState(maxValue);\n\n const fromSliderRef = useRef<HTMLInputElement>(null);\n const toSliderRef = useRef<HTMLInputElement>(null);\n const fromSliderThumbRef = useRef<HTMLDivElement>(null);\n const toSliderThumbRef = useRef<HTMLDivElement>(null);\n\n const theme = useTheme();\n\n /**\n * This function sets the value\n */\n useEffect(() => {\n if (typeof value !== 'number') {\n return;\n }\n\n if (value >= minValue && value <= maxValue) {\n setFromValue(value);\n }\n }, [maxValue, minValue, value]);\n\n useEffect(() => {\n if (fromValue > toValue) {\n setFromValue(toValue);\n }\n\n if (toValue < fromValue) {\n setToValue(fromValue);\n }\n }, [fromValue, toValue]);\n\n const handleControlFromSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!fromSliderRef.current || !toSliderRef.current) {\n return;\n }\n\n setFromValue(Number(event.target.value));\n\n const from = Number(fromSliderRef.current.value);\n const to = Number(toSliderRef.current.value);\n\n if (typeof onChange === 'function') {\n onChange(undefined, { maxValue: to, minValue: from });\n }\n\n fillSlider({\n toSlider: toSliderRef.current,\n fromSlider: fromSliderRef.current,\n theme,\n });\n\n if (from > to) {\n fromSliderRef.current.value = String(to);\n } else {\n fromSliderRef.current.value = String(from);\n }\n },\n [onChange, theme],\n );\n\n const handleControlToSlider = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!fromSliderRef.current || !toSliderRef.current) {\n return;\n }\n\n setToValue(Number(event.target.value));\n\n const from = Number(fromSliderRef.current.value);\n const to = Number(toSliderRef.current.value);\n\n if (typeof onChange === 'function') {\n onChange(undefined, { maxValue: to, minValue: from });\n }\n\n fillSlider({\n toSlider: toSliderRef.current,\n fromSlider: fromSliderRef.current,\n theme,\n });\n\n if (from <= to) {\n toSliderRef.current.value = String(to);\n } else {\n toSliderRef.current.value = String(from);\n }\n },\n [onChange, theme],\n );\n\n useEffect(() => {\n if (!fromSliderRef.current || !toSliderRef.current || !interval) {\n return;\n }\n\n setFromValue(interval.minValue);\n setToValue(interval.maxValue);\n\n fromSliderRef.current.value = String(interval.minValue);\n toSliderRef.current.value = String(interval.maxValue);\n\n fillSlider({\n fromSlider: fromSliderRef.current,\n toSlider: toSliderRef.current,\n theme,\n });\n // Note: interval can´t be in the deps because of rerender\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [theme]);\n\n /**\n * This function updates the value\n */\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const newValue = Number(event.target.value);\n\n if (interval) {\n handleControlFromSlider(event);\n\n return;\n }\n\n setFromValue(newValue);\n\n if (onChange) {\n onChange(newValue);\n }\n },\n [handleControlFromSlider, interval, onChange],\n );\n\n const fromSliderThumbPosition = useMemo(() => {\n if (fromSliderRef.current && fromSliderThumbRef.current) {\n return (\n ((fromValue - minValue) / (maxValue - minValue)) *\n (fromSliderRef.current.offsetWidth - fromSliderThumbRef.current.offsetWidth / 2)\n );\n }\n return 0;\n }, [fromValue, maxValue, minValue]);\n\n const toSliderThumbPosition = useMemo(() => {\n if (toSliderRef.current && toSliderThumbRef.current) {\n return (\n ((toValue - minValue) / (maxValue - minValue)) *\n (toSliderRef.current.offsetWidth - toSliderThumbRef.current.offsetWidth / 2)\n );\n }\n return 0;\n }, [toValue, maxValue, minValue]);\n\n return useMemo(\n () => (\n <StyledSlider>\n <StyledSliderInput\n ref={fromSliderRef}\n isInterval={!!interval}\n type=\"range\"\n value={fromValue}\n step={steps}\n max={maxValue}\n min={minValue}\n onChange={handleInputChange}\n />\n <StyledSliderThumb ref={fromSliderThumbRef} position={fromSliderThumbPosition}>\n {shouldShowThumbLable && (\n <StyledSliderThumbLable>\n {typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(fromValue)\n : fromValue}\n </StyledSliderThumbLable>\n )}\n </StyledSliderThumb>\n {interval && (\n <StyledSliderThumb ref={toSliderThumbRef} position={toSliderThumbPosition}>\n {shouldShowThumbLable && (\n <StyledSliderThumbLable>\n {typeof thumbLabelFormatter === 'function'\n ? thumbLabelFormatter(toValue)\n : toValue}\n </StyledSliderThumbLable>\n )}\n </StyledSliderThumb>\n )}\n {interval && (\n <StyledSliderInput\n ref={toSliderRef}\n isInterval={!!interval}\n type=\"range\"\n value={toValue}\n step={steps}\n max={maxValue}\n min={minValue}\n onChange={handleControlToSlider}\n />\n )}\n </StyledSlider>\n ),\n [\n steps,\n fromSliderThumbPosition,\n fromValue,\n handleControlToSlider,\n handleInputChange,\n interval,\n maxValue,\n minValue,\n shouldShowThumbLable,\n thumbLabelFormatter,\n toSliderThumbPosition,\n toValue,\n ],\n );\n};\n\nSlider.displayName = 'Slider';\n\nexport default Slider;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAA6C,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YA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ACrB7B,OAAO,CAEf,CAAC;AACL,CAAC;AAEDb,MAAM,CAACuD,WAAW,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAxE,OAAA,GAEfe,MAAM"}
package/lib/index.d.ts CHANGED
@@ -59,3 +59,5 @@ export { default as Signature } from './components/signature/Signature';
59
59
  export type { SignatureRef } from './components/signature/Signature';
60
60
  export { default as SliderButton } from './components/slider-button/SliderButton';
61
61
  export type { SliderButtonItem } from './types/slider-button';
62
+ export { default as OpeningTimes } from './components/opening-times/OpeningTimes';
63
+ export type { Weekday, OpeningTime } from './types/openingTimes';
package/lib/index.js CHANGED
@@ -171,6 +171,12 @@ Object.defineProperty(exports, "NumberInput", {
171
171
  return _NumberInput.default;
172
172
  }
173
173
  });
174
+ Object.defineProperty(exports, "OpeningTimes", {
175
+ enumerable: true,
176
+ get: function () {
177
+ return _OpeningTimes.default;
178
+ }
179
+ });
174
180
  Object.defineProperty(exports, "Popup", {
175
181
  enumerable: true,
176
182
  get: function () {
@@ -364,6 +370,7 @@ var _uploadFile = require("./utils/uploadFile");
364
370
  var _SelectButton = _interopRequireDefault(require("./components/select-button/SelectButton"));
365
371
  var _Signature = _interopRequireDefault(require("./components/signature/Signature"));
366
372
  var _SliderButton = _interopRequireDefault(require("./components/slider-button/SliderButton"));
373
+ var _OpeningTimes = _interopRequireDefault(require("./components/opening-times/OpeningTimes"));
367
374
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
368
375
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
369
376
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_Badge","_Button","_Checkbox","_CodeHighlighter","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_DateInfo","_FileInput","_FilterButtons","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_alignment","_MentionFinder","_NumberInput","_Popup","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SetupWizardItem","_SetupWizard","_SharingBar","_Slider","_SmallWaitCursor","_interopRequireWildcard","_TextArea","_Tooltip","_Truncation","_codeHighlighter","_comboBox","_fileDialog","_isTobitEmployee","_uploadFile","_SelectButton","_Signature","_SliderButton","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj"],"sources":["../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as CodeHighlighter } from './components/code-highlighter/CodeHighlighter';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport type { IComboBoxItem as ComboBoxItem } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport { default as DateInfo } from './components/date-info/DateInfo';\nexport { default as FileInput } from './components/file-input/FileInput';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport type {\n FilterButtonItemShape,\n FilterButtonSize,\n IFilterButtonItem as FilterButtonItem,\n} from './components/filter-buttons/types';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport { default as ListItem } from './components/list/list-item/ListItem';\nexport { MentionFinderPopupAlignment } from './components/mention-finder/constants/alignment';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as Popup } from './components/popup/Popup';\nexport type { PopupRef } from './components/popup/types';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { default as RadioButtonGroup } from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport type { ISearchBoxItem as SearchBoxItem } from './components/search-box/types';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { CodeHighlighterTheme } from './types/codeHighlighter';\nexport type { CodeHighlighterLanguage, HighlightedLines } from './types/codeHighlighter';\nexport { ComboBoxDirection } from './types/comboBox';\nexport type { FileItem, Image, Meta, Video } from './types/file';\nexport { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { uploadFile } from './utils/uploadFile';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport type { SelectButtonItem } from './components/select-button/types';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport type { SliderButtonItem } from './types/slider-button';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAA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CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAAA,SAAA5D,uBAAAwE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAhB,UAAA,GAAAgB,GAAA,KAAAf,OAAA,EAAAe,GAAA"}
1
+ {"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_Badge","_Button","_Checkbox","_CodeHighlighter","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_DateInfo","_FileInput","_FilterButtons","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_alignment","_MentionFinder","_NumberInput","_Popup","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SetupWizardItem","_SetupWizard","_SharingBar","_Slider","_SmallWaitCursor","_interopRequireWildcard","_TextArea","_Tooltip","_Truncation","_codeHighlighter","_comboBox","_fileDialog","_isTobitEmployee","_uploadFile","_SelectButton","_Signature","_SliderButton","_OpeningTimes","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj"],"sources":["../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as CodeHighlighter } from './components/code-highlighter/CodeHighlighter';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport type { IComboBoxItem as ComboBoxItem } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport { default as DateInfo } from './components/date-info/DateInfo';\nexport { default as FileInput } from './components/file-input/FileInput';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport type {\n FilterButtonItemShape,\n FilterButtonSize,\n IFilterButtonItem as FilterButtonItem,\n} from './components/filter-buttons/types';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport { default as ListItem } from './components/list/list-item/ListItem';\nexport { MentionFinderPopupAlignment } from './components/mention-finder/constants/alignment';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as Popup } from './components/popup/Popup';\nexport type { PopupRef } from './components/popup/types';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { default as RadioButtonGroup } from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport type { ISearchBoxItem as SearchBoxItem } from './components/search-box/types';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { CodeHighlighterTheme } from './types/codeHighlighter';\nexport type { CodeHighlighterLanguage, HighlightedLines } from './types/codeHighlighter';\nexport { ComboBoxDirection } from './types/comboBox';\nexport type { FileItem, Image, Meta, Video } from './types/file';\nexport { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { uploadFile } from './utils/uploadFile';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport type { SelectButtonItem } from './components/select-button/types';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { default as OpeningTimes } from './components/opening-times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AAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAAA,SAAA7D,uBAAAyE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAhB,UAAA,GAAAgB,GAAA,KAAAf,OAAA,EAAAe,GAAA"}
@@ -0,0 +1,19 @@
1
+ export interface Weekday {
2
+ name: string;
3
+ id: number;
4
+ }
5
+ export interface Time {
6
+ start: string;
7
+ end: string;
8
+ }
9
+ export interface OpeningTime {
10
+ weekdayId: Weekday['id'];
11
+ id: string;
12
+ isDisabled?: boolean;
13
+ times: Time[];
14
+ }
15
+ export declare enum OpeningTimesButtonType {
16
+ NONE = 0,
17
+ ADD = 1,
18
+ REMOVE = 2
19
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OpeningTimesButtonType = void 0;
7
+ let OpeningTimesButtonType = exports.OpeningTimesButtonType = /*#__PURE__*/function (OpeningTimesButtonType) {
8
+ OpeningTimesButtonType[OpeningTimesButtonType["NONE"] = 0] = "NONE";
9
+ OpeningTimesButtonType[OpeningTimesButtonType["ADD"] = 1] = "ADD";
10
+ OpeningTimesButtonType[OpeningTimesButtonType["REMOVE"] = 2] = "REMOVE";
11
+ return OpeningTimesButtonType;
12
+ }({});
13
+ //# sourceMappingURL=openingTimes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openingTimes.js","names":["OpeningTimesButtonType","exports"],"sources":["../../src/types/openingTimes.ts"],"sourcesContent":["export interface Weekday {\n name: string;\n id: number;\n}\n\nexport interface Time {\n start: string;\n end: string;\n}\n\nexport interface OpeningTime {\n weekdayId: Weekday['id'];\n id: string;\n isDisabled?: boolean;\n times: Time[];\n}\n\nexport enum OpeningTimesButtonType {\n NONE,\n ADD,\n REMOVE,\n}\n"],"mappings":";;;;;;IAiBYA,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,0BAAtBA,sBAAsB;EAAtBA,sBAAsB,CAAtBA,sBAAsB;EAAtBA,sBAAsB,CAAtBA,sBAAsB;EAAtBA,sBAAsB,CAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/core",
3
- "version": "5.0.0-beta.410",
3
+ "version": "5.0.0-beta.412",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "keywords": [
6
6
  "chayns",
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "371a9924f89df7c6504261c3efad1146bc2d501d"
73
+ "gitHead": "c916530aaf0263ed633b494d67f6c5e70bb10ee0"
74
74
  }