@activecollab/components 2.0.127 → 2.0.129

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 (41) hide show
  1. package/dist/cjs/components/SelectTime/SelectTime.js +62 -0
  2. package/dist/cjs/components/SelectTime/SelectTime.js.map +1 -0
  3. package/dist/cjs/components/SelectTime/index.js +17 -0
  4. package/dist/cjs/components/SelectTime/index.js.map +1 -0
  5. package/dist/cjs/components/Textarea/Styles.js +23 -2
  6. package/dist/cjs/components/Textarea/Styles.js.map +1 -1
  7. package/dist/cjs/components/Textarea/Textarea.js +52 -6
  8. package/dist/cjs/components/Textarea/Textarea.js.map +1 -1
  9. package/dist/cjs/components/index.js +11 -0
  10. package/dist/cjs/components/index.js.map +1 -1
  11. package/dist/cjs/utils/timeUtils.js +4 -1
  12. package/dist/cjs/utils/timeUtils.js.map +1 -1
  13. package/dist/esm/components/SelectTime/SelectTime.d.ts +19 -0
  14. package/dist/esm/components/SelectTime/SelectTime.d.ts.map +1 -0
  15. package/dist/esm/components/SelectTime/SelectTime.js +54 -0
  16. package/dist/esm/components/SelectTime/SelectTime.js.map +1 -0
  17. package/dist/esm/components/SelectTime/index.d.ts +2 -0
  18. package/dist/esm/components/SelectTime/index.d.ts.map +1 -0
  19. package/dist/esm/components/SelectTime/index.js +2 -0
  20. package/dist/esm/components/SelectTime/index.js.map +1 -0
  21. package/dist/esm/components/Textarea/Styles.d.ts +2 -0
  22. package/dist/esm/components/Textarea/Styles.d.ts.map +1 -1
  23. package/dist/esm/components/Textarea/Styles.js +22 -1
  24. package/dist/esm/components/Textarea/Styles.js.map +1 -1
  25. package/dist/esm/components/Textarea/Textarea.d.ts +5 -1
  26. package/dist/esm/components/Textarea/Textarea.d.ts.map +1 -1
  27. package/dist/esm/components/Textarea/Textarea.js +41 -7
  28. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  29. package/dist/esm/components/index.d.ts +1 -0
  30. package/dist/esm/components/index.d.ts.map +1 -1
  31. package/dist/esm/components/index.js +1 -0
  32. package/dist/esm/components/index.js.map +1 -1
  33. package/dist/esm/utils/timeUtils.d.ts +1 -0
  34. package/dist/esm/utils/timeUtils.d.ts.map +1 -1
  35. package/dist/esm/utils/timeUtils.js +3 -0
  36. package/dist/esm/utils/timeUtils.js.map +1 -1
  37. package/dist/index.js +361 -251
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.min.js +1 -1
  40. package/dist/index.min.js.map +1 -1
  41. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectTime.js","names":["React","moment","isValidTime","Select","SelectTrigger","SelectTime","_ref","mode","selected","min","max","onChange","target","triggerMode","rest","generateTimeOptions","minTime","maxTime","options","currentTime","clone","isSameOrBefore","push","id","format","name","add","timeOptions","displaySelectedTime","createElement","disabledInternalSort","disableSearch","keepSameOptionsOrder","_extends","renderOption","_ref2","forceCloseMenu"],"sources":["../../../../src/components/SelectTime/SelectTime.tsx"],"sourcesContent":["import React from \"react\";\n\nimport moment from \"moment\";\n\nimport { isValidTime } from \"../../utils/timeUtils\";\nimport { InputMode } from \"../Input/types\";\nimport { IOptionItemProps } from \"../Select/Option\";\nimport { ElementWithRef, Select } from \"../Select/Select\";\nimport { SelectTrigger, SelectTriggerProps } from \"../SelectTrigger\";\n\nexport type Time24HourFormat = `${string}:${string}` | undefined;\n\nexport interface SelectTimeProps extends Omit<SelectTriggerProps, \"mode\"> {\n mode?: \"12\" | \"24\";\n selected?: Time24HourFormat;\n min?: Time24HourFormat;\n max?: Time24HourFormat;\n onChange?: () => void;\n target?: ElementWithRef<Element>;\n className?: string;\n triggerMode?: InputMode;\n locale?: string;\n trigger?: string;\n}\n\nexport const SelectTime: React.FC<SelectTimeProps> = ({\n mode = \"24\",\n selected = \"12:00\",\n min,\n max,\n onChange,\n target,\n triggerMode,\n ...rest\n}) => {\n const generateTimeOptions = (): IOptionItemProps[] => {\n const minTime = moment(isValidTime(min) ? min : \"00:00\", \"HH:mm\");\n const maxTime = moment(isValidTime(max) ? max : \"23:45\", \"HH:mm\");\n const options: IOptionItemProps[] = [];\n\n const currentTime = minTime.clone();\n while (currentTime.isSameOrBefore(maxTime)) {\n options.push({\n id: currentTime.format(\"HH:mm\"),\n name: currentTime.format(mode === \"12\" ? \"hh:mm A\" : \"HH:mm\"),\n });\n currentTime.add(15, \"minutes\");\n }\n\n return options;\n };\n\n const timeOptions = generateTimeOptions();\n\n const displaySelectedTime = moment(selected, \"HH:mm\").format(\n mode === \"12\" ? \"hh:mm A\" : \"HH:mm\"\n );\n\n return (\n <Select\n options={timeOptions}\n disabledInternalSort\n selected={selected}\n disableSearch\n keepSameOptionsOrder\n target={\n target ? (\n target\n ) : (\n <SelectTrigger mode={triggerMode} {...rest}>\n {displaySelectedTime}\n </SelectTrigger>\n )\n }\n mode=\"tiny\"\n renderOption={({ name }) => <div>{name}</div>}\n onChange={onChange}\n forceCloseMenu\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,MAAM,MAAM,QAAQ;AAE3B,SAASC,WAAW,QAAQ,uBAAuB;AAGnD,SAAyBC,MAAM,QAAQ,kBAAkB;AACzD,SAASC,aAAa,QAA4B,kBAAkB;AAiBpE,OAAO,MAAMC,UAAqC,GAAGC,IAAA,IAS/C;EAAA,IATgD;IACpDC,IAAI,GAAG,IAAI;IACXC,QAAQ,GAAG,OAAO;IAClBC,GAAG;IACHC,GAAG;IACHC,QAAQ;IACRC,MAAM;IACNC,WAAW;IACX,GAAGC;EACL,CAAC,GAAAR,IAAA;EACC,MAAMS,mBAAmB,GAAGA,CAAA,KAA0B;IACpD,MAAMC,OAAO,GAAGf,MAAM,CAACC,WAAW,CAACO,GAAG,CAAC,GAAGA,GAAG,GAAG,OAAO,EAAE,OAAO,CAAC;IACjE,MAAMQ,OAAO,GAAGhB,MAAM,CAACC,WAAW,CAACQ,GAAG,CAAC,GAAGA,GAAG,GAAG,OAAO,EAAE,OAAO,CAAC;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@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/SelectTime/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./SelectTime";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/SelectTime/index.ts"],"sourcesContent":["export * from \"./SelectTime\";\n"],"mappings":"AAAA,cAAc,cAAc"}
@@ -5,5 +5,7 @@ interface StyledTextareaProps {
5
5
  $mode: InputMode;
6
6
  }
7
7
  export declare const StyledTextarea: import("styled-components").StyledComponent<"textarea", any, StyledTextareaProps, never>;
8
+ export declare const StyledTextAreaWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
9
+ export declare const StyledProgressRingWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
8
10
  export {};
9
11
  //# sourceMappingURL=Styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Textarea/Styles.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,eAAO,MAAM,cAAc,0FAgE1B,CAAC"}
1
+ {"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Textarea/Styles.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,eAAO,MAAM,cAAc,0FAiE1B,CAAC;AAEF,eAAO,MAAM,qBAAqB,oEAEjC,CAAC;AAEF,eAAO,MAAM,yBAAyB,oEAErC,CAAC"}
@@ -4,7 +4,7 @@ import { FontStyle } from "../FontStyle";
4
4
  export const StyledTextarea = styled.textarea.withConfig({
5
5
  displayName: "Styles__StyledTextarea",
6
6
  componentId: "sc-m6jqw8-0"
7
- })(["", " ", " ", " ", " ", " border-width:1px;border-style:solid;background-color:var(--input-background-color);", " border-radius:8px;padding:4px 8px 6px 8px;height:auto;transition:all 0.3s ease;width:360px;min-height:90px;outline:none;", " ", " ", " ", " ", " &::placeholder{", "}", " ", ""], {
7
+ })(["", " ", " ", " ", " ", " ", " border-width:1px;border-style:solid;background-color:var(--input-background-color);", " border-radius:8px;padding:4px 8px 6px 8px;height:auto;transition:all 0.3s ease;width:360px;min-height:90px;outline:none;", " ", " ", " ", " ", " &::placeholder{", "}", " ", ""], {
8
8
  "fontSize": "0.875rem"
9
9
  }, {
10
10
  "color": "var(--color-theme-900)"
@@ -14,6 +14,8 @@ export const StyledTextarea = styled.textarea.withConfig({
14
14
  "letterSpacing": "0.02em"
15
15
  }, {
16
16
  "fontWeight": "400"
17
+ }, {
18
+ "resize": "none"
17
19
  }, {
18
20
  "borderColor": "var(--color-theme-500)"
19
21
  }, FontStyle, BoxSizingStyle, props => props.$mode === "flat" && css(["border:none;background-color:transparent;"]), props => props.disabled && css(["", ""], {
@@ -26,5 +28,24 @@ export const StyledTextarea = styled.textarea.withConfig({
26
28
  }, props => !props.disabled && props.$invalid && props.$mode === "outlined" && css(["", ""], {
27
29
  "borderColor": "var(--red-alert)"
28
30
  }), props => !props.disabled && props.$invalid && props.$mode === "flat" && css(["color:var(--red-alert);"]));
31
+ export const StyledTextAreaWrapper = styled.div.withConfig({
32
+ displayName: "Styles__StyledTextAreaWrapper",
33
+ componentId: "sc-m6jqw8-1"
34
+ })(["", ""], {
35
+ "position": "relative",
36
+ "display": "flex",
37
+ "width": "fit-content"
38
+ });
39
+ export const StyledProgressRingWrapper = styled.div.withConfig({
40
+ displayName: "Styles__StyledProgressRingWrapper",
41
+ componentId: "sc-m6jqw8-2"
42
+ })(["", ""], {
43
+ "position": "absolute",
44
+ "bottom": "0.5rem",
45
+ "right": "0.5rem",
46
+ "display": "flex"
47
+ });
29
48
  StyledTextarea.displayName = "StyledTextarea";
49
+ StyledTextAreaWrapper.displayName = "StyledTextAreaWrapper";
50
+ StyledProgressRingWrapper.displayName = "StyledProgressRingWrapper";
30
51
  //# sourceMappingURL=Styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","StyledTextarea","textarea","withConfig","displayName","componentId","props","$mode","disabled","$invalid"],"sources":["../../../../src/components/Textarea/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\nimport { InputMode } from \"../Input/types\";\n\ninterface StyledTextareaProps {\n disabled: boolean;\n $invalid: boolean;\n $mode: InputMode;\n}\n\nexport const StyledTextarea = styled.textarea<StyledTextareaProps>`\n ${tw`tw-text-body-2`}\n ${tw`tw-text-theme-900`}\n ${tw`tw-leading-regular`}\n ${tw`tw-tracking-regular`}\n ${tw`tw-font-regular`}\n border-width: 1px;\n border-style: solid;\n background-color: var(--input-background-color);\n ${tw`tw-border-theme-500`}\n border-radius: 8px;\n padding: 4px 8px 6px 8px;\n height: auto;\n transition: all 0.3s ease;\n width: 360px;\n min-height: 90px;\n outline: none;\n ${FontStyle}\n ${BoxSizingStyle}\n\n ${(props) =>\n props.$mode === \"flat\" &&\n css`\n border: none;\n background-color: transparent;\n `}\n\n ${(props) =>\n props.disabled &&\n css`\n ${tw`tw-cursor-not-allowed tw-opacity-50`}\n `}\n\n ${(props) =>\n !props.disabled &&\n !props.$invalid &&\n props.$mode === \"outlined\" &&\n css`\n &:active,\n &:focus,\n &:hover {\n ${tw`tw-border-primary`}\n }\n `}\n\n &::placeholder {\n ${tw`tw-text-theme-transparent-500`}\n }\n\n ${(props) =>\n !props.disabled &&\n props.$invalid &&\n props.$mode === \"outlined\" &&\n css`\n ${tw`tw-border-alert`}\n `}\n\n ${(props) =>\n !props.disabled &&\n props.$invalid &&\n props.$mode === \"flat\" &&\n css`\n color: var(--red-alert);\n `}\n`;\n\nStyledTextarea.displayName = \"StyledTextarea\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AASxC,OAAO,MAAMC,cAAc,GAAGJ,MAAM,CAACK,QAAQ,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wSACvC;EAAA;AAAe,CAAC,EAChB;EAAA;AAAkB,CAAC,EACnB;EAAA;AAAmB,CAAC,EACpB;EAAA;AAAoB,CAAC,EACrB;EAAA;AAAgB,CAAC,EAIjB;EAAA;AAAoB,CAAC,EAQvBL,SAAS,EACTD,cAAc,EAEbO,KAAK,IACNA,KAAK,CAACC,KAAK,KAAK,MAAM,IACtBT,GAAG,+CAGF,EAEAQ,KAAK,IACNA,KAAK,CAACE,QAAQ,IACdV,GAAG,WACG;EAAA;EAAA;AAAoC,CAAC,CAC1C,EAEAQ,KAAK,IACN,CAACA,KAAK,CAACE,QAAQ,IACf,CAACF,KAAK,CAACG,QAAQ,IACfH,KAAK,CAACC,KAAK,KAAK,UAAU,IAC1BT,GAAG,qCAIK;EAAA;AAAkB,CAAC,CAE1B,EAGG;EAAA;AAA8B,CAAC,EAGlCQ,KAAK,IACN,CAACA,KAAK,CAACE,QAAQ,IACfF,KAAK,CAACG,QAAQ,IACdH,KAAK,CAACC,KAAK,KAAK,UAAU,IAC1BT,GAAG,WACG;EAAA;AAAgB,CAAC,CACtB,EAEAQ,KAAK,IACN,CAACA,KAAK,CAACE,QAAQ,IACfF,KAAK,CAACG,QAAQ,IACdH,KAAK,CAACC,KAAK,KAAK,MAAM,IACtBT,GAAG,6BAEF,CACJ;AAEDG,cAAc,CAACG,WAAW,GAAG,gBAAgB"}
1
+ {"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","StyledTextarea","textarea","withConfig","displayName","componentId","props","$mode","disabled","$invalid","StyledTextAreaWrapper","div","StyledProgressRingWrapper"],"sources":["../../../../src/components/Textarea/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\nimport { InputMode } from \"../Input/types\";\n\ninterface StyledTextareaProps {\n disabled: boolean;\n $invalid: boolean;\n $mode: InputMode;\n}\n\nexport const StyledTextarea = styled.textarea<StyledTextareaProps>`\n ${tw`tw-text-body-2`}\n ${tw`tw-text-theme-900`}\n ${tw`tw-leading-regular`}\n ${tw`tw-tracking-regular`}\n ${tw`tw-font-regular`}\n ${tw`tw-resize-none`}\n border-width: 1px;\n border-style: solid;\n background-color: var(--input-background-color);\n ${tw`tw-border-theme-500`}\n border-radius: 8px;\n padding: 4px 8px 6px 8px;\n height: auto;\n transition: all 0.3s ease;\n width: 360px;\n min-height: 90px;\n outline: none;\n ${FontStyle}\n ${BoxSizingStyle}\n\n ${(props) =>\n props.$mode === \"flat\" &&\n css`\n border: none;\n background-color: transparent;\n `}\n\n ${(props) =>\n props.disabled &&\n css`\n ${tw`tw-cursor-not-allowed tw-opacity-50`}\n `}\n\n ${(props) =>\n !props.disabled &&\n !props.$invalid &&\n props.$mode === \"outlined\" &&\n css`\n &:active,\n &:focus,\n &:hover {\n ${tw`tw-border-primary`}\n }\n `}\n\n &::placeholder {\n ${tw`tw-text-theme-transparent-500`}\n }\n\n ${(props) =>\n !props.disabled &&\n props.$invalid &&\n props.$mode === \"outlined\" &&\n css`\n ${tw`tw-border-alert`}\n `}\n\n ${(props) =>\n !props.disabled &&\n props.$invalid &&\n props.$mode === \"flat\" &&\n css`\n color: var(--red-alert);\n `}\n`;\n\nexport const StyledTextAreaWrapper = styled.div`\n ${tw`tw-w-fit tw-relative tw-flex`}\n`;\n\nexport const StyledProgressRingWrapper = styled.div`\n ${tw`tw-absolute tw-right-2 tw-bottom-2 tw-flex`}\n`;\n\nStyledTextarea.displayName = \"StyledTextarea\";\nStyledTextAreaWrapper.displayName = \"StyledTextAreaWrapper\";\nStyledProgressRingWrapper.displayName = \"StyledProgressRingWrapper\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AASxC,OAAO,MAAMC,cAAc,GAAGJ,MAAM,CAACK,QAAQ,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,6SACvC;EAAA;AAAe,CAAC,EAChB;EAAA;AAAkB,CAAC,EACnB;EAAA;AAAmB,CAAC,EACpB;EAAA;AAAoB,CAAC,EACrB;EAAA;AAAgB,CAAC,EACjB;EAAA;AAAe,CAAC,EAIhB;EAAA;AAAoB,CAAC,EAQvBL,SAAS,EACTD,cAAc,EAEbO,KAAK,IACNA,KAAK,CAACC,KAAK,KAAK,MAAM,IACtBT,GAAG,+CAGF,EAEAQ,KAAK,IACNA,KAAK,CAACE,QAAQ,IACdV,GAAG,WACG;EAAA;EAAA;AAAoC,CAAC,CAC1C,EAEAQ,KAAK,IACN,CAACA,KAAK,CAACE,QAAQ,IACf,CAACF,KAAK,CAACG,QAAQ,IACfH,KAAK,CAACC,KAAK,KAAK,UAAU,IAC1BT,GAAG,qCAIK;EAAA;AAAkB,CAAC,CAE1B,EAGG;EAAA;AAA8B,CAAC,EAGlCQ,KAAK,IACN,CAACA,KAAK,CAACE,QAAQ,IACfF,KAAK,CAACG,QAAQ,IACdH,KAAK,CAACC,KAAK,KAAK,UAAU,IAC1BT,GAAG,WACG;EAAA;AAAgB,CAAC,CACtB,EAEAQ,KAAK,IACN,CAACA,KAAK,CAACE,QAAQ,IACfF,KAAK,CAACG,QAAQ,IACdH,KAAK,CAACC,KAAK,KAAK,MAAM,IACtBT,GAAG,6BAEF,CACJ;AAED,OAAO,MAAMY,qBAAqB,GAAGb,MAAM,CAACc,GAAG,CAAAR,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,aACzC;EAAA;EAAA;EAAA;AAA6B,CAAC,CACnC;AAED,OAAO,MAAMO,yBAAyB,GAAGf,MAAM,CAACc,GAAG,CAAAR,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,aAC7C;EAAA;EAAA;EAAA;EAAA;AAA2C,CAAC,CACjD;AAEDJ,cAAc,CAACG,WAAW,GAAG,gBAAgB;AAC7CM,qBAAqB,CAACN,WAAW,GAAG,uBAAuB;AAC3DQ,yBAAyB,CAACR,WAAW,GAAG,2BAA2B"}
@@ -1,8 +1,12 @@
1
- import React from "react";
1
+ import React, { ChangeEvent } from "react";
2
2
  import { InputMode } from "../Input/types";
3
3
  export interface TextareaProps {
4
4
  invalid?: boolean;
5
5
  mode?: InputMode;
6
+ maxLength?: number;
7
+ value?: string;
8
+ hideProgress?: boolean;
9
+ onChange?: (e: ChangeEvent<HTMLTextAreaElement>) => void;
6
10
  }
7
11
  export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & Omit<Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, keyof TextareaProps> & React.RefAttributes<HTMLTextAreaElement>>;
8
12
  //# sourceMappingURL=Textarea.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../../src/components/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAK/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,eAAO,MAAM,QAAQ,qOA4BpB,CAAC"}
1
+ {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../../src/components/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAoC,MAAM,OAAO,CAAC;AAU7E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;CAC1D;AAED,eAAO,MAAM,QAAQ,qOA+EpB,CAAC"}
@@ -1,25 +1,59 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import React, { forwardRef } from "react";
2
+ import React, { forwardRef, useMemo, useRef } from "react";
3
3
  import classnames from "classnames";
4
- import { StyledTextarea } from "./Styles";
4
+ import { StyledProgressRingWrapper, StyledTextarea, StyledTextAreaWrapper } from "./Styles";
5
+ import { useForkRef } from "../../utils";
6
+ import { ProgressRing } from "../ProgressRing";
5
7
  export const Textarea = /*#__PURE__*/forwardRef((_ref, ref) => {
8
+ var _value$length;
6
9
  let {
7
10
  className,
8
11
  disabled = false,
9
12
  invalid = false,
10
13
  mode = "outlined",
14
+ maxLength,
15
+ value,
16
+ hideProgress = false,
17
+ onChange,
11
18
  ...rest
12
19
  } = _ref;
13
- return /*#__PURE__*/React.createElement(StyledTextarea, _extends({}, rest, {
20
+ const innerRef = useRef(null);
21
+ const handleRef = useForkRef(ref, innerRef);
22
+ const [currentLength, setCurrentLength] = React.useState((_value$length = value == null ? void 0 : value.length) != null ? _value$length : 0);
23
+ const warningGauge = useMemo(() => 75 * Number(maxLength) / 100, [maxLength]);
24
+ const progressColor = useMemo(() => {
25
+ if (currentLength >= Number(maxLength)) {
26
+ return "var(--red-alert)";
27
+ }
28
+ if (currentLength > warningGauge && currentLength < Number(maxLength)) {
29
+ return "var(--warning)";
30
+ }
31
+ return "var(--color-sucess-green)";
32
+ }, [currentLength, maxLength, warningGauge]);
33
+ const max = Number(maxLength != null ? maxLength : 1);
34
+ const progress = Math.min(currentLength / max * 100, 100);
35
+ const handleChange = e => {
36
+ setCurrentLength(e.target.value.length);
37
+ if (onChange) {
38
+ onChange(e);
39
+ }
40
+ };
41
+ return /*#__PURE__*/React.createElement(StyledTextAreaWrapper, null, /*#__PURE__*/React.createElement(StyledTextarea, _extends({}, rest, {
42
+ value: value,
14
43
  $invalid: invalid,
15
- ref: ref,
44
+ ref: handleRef,
16
45
  $mode: mode,
17
46
  disabled: disabled,
18
47
  "aria-invalid": invalid,
19
48
  className: classnames("c-textarea", {
20
49
  "c-textarea__disabled": disabled
21
- }, className)
22
- }));
50
+ }, className),
51
+ onChange: handleChange
52
+ })), maxLength && !hideProgress && /*#__PURE__*/React.createElement(StyledProgressRingWrapper, null, /*#__PURE__*/React.createElement(ProgressRing, {
53
+ progress: progress,
54
+ radius: 10,
55
+ stroke: 1.5,
56
+ progressColor: progressColor
57
+ })));
23
58
  });
24
- Textarea.displayName = "Textarea";
25
59
  //# sourceMappingURL=Textarea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","names":["React","forwardRef","classnames","StyledTextarea","Textarea","_ref","ref","className","disabled","invalid","mode","rest","createElement","_extends","$invalid","$mode","displayName"],"sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import React, { forwardRef, Ref } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledTextarea } from \"./Styles\";\nimport { InputMode } from \"../Input/types\";\n\nexport interface TextareaProps {\n invalid?: boolean;\n mode?: InputMode;\n}\n\nexport const Textarea = forwardRef(\n (\n {\n className,\n disabled = false,\n invalid = false,\n mode = \"outlined\",\n ...rest\n }: TextareaProps &\n Omit<React.ComponentPropsWithoutRef<\"textarea\">, keyof TextareaProps>,\n ref: Ref<HTMLTextAreaElement> | null | undefined\n ) => {\n return (\n <StyledTextarea\n {...rest}\n $invalid={invalid}\n ref={ref}\n $mode={mode}\n disabled={disabled}\n aria-invalid={invalid}\n className={classnames(\n \"c-textarea\",\n { \"c-textarea__disabled\": disabled },\n className\n )}\n />\n );\n }\n);\n\nTextarea.displayName = \"Textarea\";\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAa,OAAO;AAE9C,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,cAAc,QAAQ,UAAU;AAQzC,OAAO,MAAMC,QAAQ,gBAAGH,UAAU,CAChC,CAAAI,IAAA,EASEC,GAAgD,KAC7C;EAAA,IATH;IACEC,SAAS;IACTC,QAAQ,GAAG,KAAK;IAChBC,OAAO,GAAG,KAAK;IACfC,IAAI,GAAG,UAAU;IACjB,GAAGC;EAEiE,CAAC,GAAAN,IAAA;EAGvE,oBACEL,KAAA,CAAAY,aAAA,CAACT,cAAc,EAAAU,QAAA,KACTF,IAAI;IACRG,QAAQ,EAAEL,OAAQ;IAClBH,GAAG,EAAEA,GAAI;IACTS,KAAK,EAAEL,IAAK;IACZF,QAAQ,EAAEA,QAAS;IACnB,gBAAcC,OAAQ;IACtBF,SAAS,EAAEL,UAAU,CACnB,YAAY,EACZ;MAAE,sBAAsB,EAAEM;IAAS,CAAC,EACpCD,SACF;EAAE,EACH,CAAC;AAEN,CACF,CAAC;AAEDH,QAAQ,CAACY,WAAW,GAAG,UAAU"}
1
+ {"version":3,"file":"Textarea.js","names":["React","forwardRef","useMemo","useRef","classnames","StyledProgressRingWrapper","StyledTextarea","StyledTextAreaWrapper","useForkRef","ProgressRing","Textarea","_ref","ref","_value$length","className","disabled","invalid","mode","maxLength","value","hideProgress","onChange","rest","innerRef","handleRef","currentLength","setCurrentLength","useState","length","warningGauge","Number","progressColor","max","progress","Math","min","handleChange","e","target","createElement","_extends","$invalid","$mode","radius","stroke"],"sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import React, { ChangeEvent, forwardRef, Ref, useMemo, useRef } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport {\n StyledProgressRingWrapper,\n StyledTextarea,\n StyledTextAreaWrapper,\n} from \"./Styles\";\nimport { useForkRef } from \"../../utils\";\nimport { InputMode } from \"../Input/types\";\nimport { ProgressRing } from \"../ProgressRing\";\n\nexport interface TextareaProps {\n invalid?: boolean;\n mode?: InputMode;\n maxLength?: number;\n value?: string;\n hideProgress?: boolean;\n onChange?: (e: ChangeEvent<HTMLTextAreaElement>) => void;\n}\n\nexport const Textarea = forwardRef(\n (\n {\n className,\n disabled = false,\n invalid = false,\n mode = \"outlined\",\n maxLength,\n value,\n hideProgress = false,\n onChange,\n ...rest\n }: TextareaProps &\n Omit<React.ComponentPropsWithoutRef<\"textarea\">, keyof TextareaProps>,\n ref: Ref<HTMLTextAreaElement> | null | undefined\n ) => {\n const innerRef = useRef<HTMLTextAreaElement>(null);\n const handleRef = useForkRef(ref, innerRef);\n\n const [currentLength, setCurrentLength] = React.useState<number>(\n value?.length ?? 0\n );\n\n const warningGauge = useMemo(\n () => (75 * Number(maxLength)) / 100,\n [maxLength]\n );\n\n const progressColor = useMemo(() => {\n if (currentLength >= Number(maxLength)) {\n return \"var(--red-alert)\";\n }\n if (currentLength > warningGauge && currentLength < Number(maxLength)) {\n return \"var(--warning)\";\n }\n return \"var(--color-sucess-green)\";\n }, [currentLength, maxLength, warningGauge]);\n\n const max = Number(maxLength ?? 1);\n\n const progress = Math.min((currentLength / max) * 100, 100);\n\n const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setCurrentLength(e.target.value.length);\n if (onChange) {\n onChange(e);\n }\n };\n\n return (\n <StyledTextAreaWrapper>\n <StyledTextarea\n {...rest}\n value={value}\n $invalid={invalid}\n ref={handleRef}\n $mode={mode}\n disabled={disabled}\n aria-invalid={invalid}\n className={classnames(\n \"c-textarea\",\n { \"c-textarea__disabled\": disabled },\n className\n )}\n onChange={handleChange}\n />\n {maxLength && !hideProgress && (\n <StyledProgressRingWrapper>\n <ProgressRing\n progress={progress}\n radius={10}\n stroke={1.5}\n progressColor={progressColor}\n />\n </StyledProgressRingWrapper>\n )}\n </StyledTextAreaWrapper>\n );\n }\n);\n"],"mappings":";AAAA,OAAOA,KAAK,IAAiBC,UAAU,EAAOC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAE5E,OAAOC,UAAU,MAAM,YAAY;AAEnC,SACEC,yBAAyB,EACzBC,cAAc,EACdC,qBAAqB,QAChB,UAAU;AACjB,SAASC,UAAU,QAAQ,aAAa;AAExC,SAASC,YAAY,QAAQ,iBAAiB;AAW9C,OAAO,MAAMC,QAAQ,gBAAGT,UAAU,CAChC,CAAAU,IAAA,EAaEC,GAAgD,KAC7C;EAAA,IAAAC,aAAA;EAAA,IAbH;IACEC,SAAS;IACTC,QAAQ,GAAG,KAAK;IAChBC,OAAO,GAAG,KAAK;IACfC,IAAI,GAAG,UAAU;IACjBC,SAAS;IACTC,KAAK;IACLC,YAAY,GAAG,KAAK;IACpBC,QAAQ;IACR,GAAGC;EAEiE,CAAC,GAAAX,IAAA;EAGvE,MAAMY,QAAQ,GAAGpB,MAAM,CAAsB,IAAI,CAAC;EAClD,MAAMqB,SAAS,GAAGhB,UAAU,CAACI,GAAG,EAAEW,QAAQ,CAAC;EAE3C,MAAM,CAACE,aAAa,EAAEC,gBAAgB,CAAC,GAAG1B,KAAK,CAAC2B,QAAQ,EAAAd,aAAA,GACtDM,KAAK,oBAALA,KAAK,CAAES,MAAM,YAAAf,aAAA,GAAI,CACnB,CAAC;EAED,MAAMgB,YAAY,GAAG3B,OAAO,CAC1B,MAAO,EAAE,GAAG4B,MAAM,CAACZ,SAAS,CAAC,GAAI,GAAG,EACpC,CAACA,SAAS,CACZ,CAAC;EAED,MAAMa,aAA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,QAAS;IACnBU,MAAM,EAAE,EAAG;IACXC,MAAM,EAAE,GAAI;IACZb,aAAa,EAAEA;EAAc,CAC9B,CACwB,CAER,CAAC;AAE5B,CACF,CAAC"}
@@ -44,6 +44,7 @@ export * from "./Window";
44
44
  export * from "./ValueButton";
45
45
  export * from "./Select";
46
46
  export * from "./SelectTrigger";
47
+ export * from "./SelectTime";
47
48
  export * from "./Dialog";
48
49
  export * from "./ConfirmDialog";
49
50
  export * from "./Checkbox";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAA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C;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
@@ -44,6 +44,7 @@ export * from "./Window";
44
44
  export * from "./ValueButton";
45
45
  export * from "./Select";
46
46
  export * from "./SelectTrigger";
47
+ export * from "./SelectTime";
47
48
  export * from "./Dialog";
48
49
  export * from "./ConfirmDialog";
49
50
  export * from "./Checkbox";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from \"./Button\";\nexport * from \"./ButtonGroup\";\nexport * from \"./Breadcrumbs\";\nexport * from \"./CounterButton\";\nexport * from \"./Steppers\";\nexport * from \"./Tables\";\nexport * from \"./CompleteCheckbox\";\nexport * from \"./Paper\";\nexport * from \"./ScaleBar\";\nexport * from \"./Card\";\nexport * from \"./EntityCard\";\nexport * from \"./Signifier\";\nexport * from \"./Avatar\";\nexport * from \"./Tag\";\nexport * from \"./Loaders\";\nexport * from \"./Nav\";\nexport * from \"./Bubble\";\nexport * from \"./Input\";\nexport * from \"./Menu\";\nexport * from \"./Expanders\";\nexport * from \"./Pickers\";\nexport * from \"./DatePicker\";\nexport * from \"./List\";\nexport * from \"./MenuSelector\";\nexport * from \"./MultiAvatar\";\nexport * from \"./RadioButton\";\nexport * from \"./ScrollShadow\";\nexport * from \"./Icons\";\nexport * from \"./Textarea\";\nexport * from \"./Modal\";\nexport * from \"./Sheet\";\nexport * from \"./Header\";\nexport * from \"./AutoResizeTextarea\";\nexport * from \"./Overlay\";\nexport * from \"./Accordion\";\nexport * from \"./Choose\";\nexport * from \"./Links\";\nexport * from \"./SelectDate\";\nexport * from \"./Popper\";\nexport * from \"./ToastMessage\";\nexport * from \"./Tooltip\";\nexport * from \"./Transitions\";\nexport * from \"./Window\";\nexport * from \"./ValueButton\";\nexport * from \"./Select\";\nexport * from \"./SelectTrigger\";\nexport * from \"./Dialog\";\nexport * from \"./ConfirmDialog\";\nexport * from \"./Checkbox\";\nexport * from \"./Toggle\";\nexport * from \"./Typography\";\nexport * from \"./Autocomplete\";\nexport * from \"./ComboBox\";\nexport * from \"./Button/AddToListButton\";\nexport * from \"./ProgressBar\";\nexport * from \"./ProgressPie\";\nexport * from \"./Reactions\";\nexport * from \"./Label\";\nexport * from \"./GlobalStyle\";\nexport * from \"./ProgressRing\";\nexport * from \"./EditableContent\";\nexport * from \"./EditableText\";\nexport * from \"./EditableHours\";\nexport * from \"./EditableCurrency\";\nexport * from \"./Folder\";\nexport * from \"./Chip\";\nexport * from \"./Trigger\";\nexport * from \"./Dot\";\nexport * from \"./Entity\";\nexport * from \"./Filter\";\nexport * from \"./Wizard\";\nexport * from \"./IconButton\";\nexport * from \"./Typography\";\nexport * from \"./Badge\";\nexport * from \"./AvatarGroup\";\nexport * from \"./CommandPalette\";\nexport * from \"./EmptySlate\";\nexport * from \"./Toolbar\";\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,eAAe;AAC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ACtB,cAAc,WAAW;AACzB,cAAc,OAAO;AACrB,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,cAAc,cAAc;AAC5B,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,cAAc;AAC5B,cAAc,WAAW"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from \"./Button\";\nexport * from \"./ButtonGroup\";\nexport * from \"./Breadcrumbs\";\nexport * from \"./CounterButton\";\nexport * from \"./Steppers\";\nexport * from \"./Tables\";\nexport * from \"./CompleteCheckbox\";\nexport * from \"./Paper\";\nexport * from \"./ScaleBar\";\nexport * from \"./Card\";\nexport * from \"./EntityCard\";\nexport * from \"./Signifier\";\nexport * from \"./Avatar\";\nexport * from \"./Tag\";\nexport * from \"./Loaders\";\nexport * from \"./Nav\";\nexport * from \"./Bubble\";\nexport * from \"./Input\";\nexport * from \"./Menu\";\nexport * from \"./Expanders\";\nexport * from \"./Pickers\";\nexport * from \"./DatePicker\";\nexport * from \"./List\";\nexport * from \"./MenuSelector\";\nexport * from \"./MultiAvatar\";\nexport * from \"./RadioButton\";\nexport * from \"./ScrollShadow\";\nexport * from \"./Icons\";\nexport * from \"./Textarea\";\nexport * from \"./Modal\";\nexport * from \"./Sheet\";\nexport * from \"./Header\";\nexport * from \"./AutoResizeTextarea\";\nexport * from \"./Overlay\";\nexport * from \"./Accordion\";\nexport * from \"./Choose\";\nexport * from \"./Links\";\nexport * from \"./SelectDate\";\nexport * from \"./Popper\";\nexport * from \"./ToastMessage\";\nexport * from \"./Tooltip\";\nexport * from \"./Transitions\";\nexport * from \"./Window\";\nexport * from \"./ValueButton\";\nexport * from \"./Select\";\nexport * from \"./SelectTrigger\";\nexport * from \"./SelectTime\";\nexport * from \"./Dialog\";\nexport * from \"./ConfirmDialog\";\nexport * from \"./Checkbox\";\nexport * from \"./Toggle\";\nexport * from \"./Typography\";\nexport * from \"./Autocomplete\";\nexport * from \"./ComboBox\";\nexport * from \"./Button/AddToListButton\";\nexport * from \"./ProgressBar\";\nexport * from \"./ProgressPie\";\nexport * from \"./Reactions\";\nexport * from \"./Label\";\nexport * from \"./GlobalStyle\";\nexport * from \"./ProgressRing\";\nexport * from \"./EditableContent\";\nexport * from \"./EditableText\";\nexport * from \"./EditableHours\";\nexport * from \"./EditableCurrency\";\nexport * from \"./Folder\";\nexport * from \"./Chip\";\nexport * from \"./Trigger\";\nexport * from \"./Dot\";\nexport * from \"./Entity\";\nexport * from \"./Filter\";\nexport * from \"./Wizard\";\nexport * from \"./IconButton\";\nexport * from \"./Typography\";\nexport * from \"./Badge\";\nexport * from \"./AvatarGroup\";\nexport * from \"./CommandPalette\";\nexport * from \"./EmptySlate\";\nexport * from \"./Toolbar\";\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,oBAAoB;AAClC,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,cAAc;AAC5B,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,OAAO;AACrB,cAAc,WAAW;AACzB,cAAc,OAAO;AACrB,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,QAAQ;AACtB,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,sBAAsB;AACpC,cAAc,WAAW;AACzB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,cAAc,0BAA0B;AACxC,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,aAAa;AAC3B,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,oBAAoB;AAClC,cAAc,UAAU;AACxB,cAAc,QAAQ;AACtB,cAAc,WAAW;AACzB,cAAc,OAAO;AACrB,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,cAAc,cAAc;AAC5B,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,cAAc;AAC5B,cAAc,WAAW"}
@@ -17,4 +17,5 @@
17
17
  export declare const formatHours: (num: number | string | undefined, withLeadingZeroHours?: boolean) => string;
18
18
  export declare const withLeadingZero: (num: string | number, size?: number) => string;
19
19
  export declare const isDecimal: (num: number) => boolean;
20
+ export declare const isValidTime: (time: string | undefined) => boolean;
20
21
  //# sourceMappingURL=timeUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timeUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/timeUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,QACjB,MAAM,GAAG,MAAM,GAAG,SAAS,qCAE/B,MAkDF,CAAC;AAEF,eAAO,MAAM,eAAe,QAAS,MAAM,GAAG,MAAM,0BAInD,CAAC;AAEF,eAAO,MAAM,SAAS,QAAS,MAAM,KAAG,OAEvC,CAAC"}
1
+ {"version":3,"file":"timeUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/timeUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,QACjB,MAAM,GAAG,MAAM,GAAG,SAAS,qCAE/B,MAkDF,CAAC;AAEF,eAAO,MAAM,eAAe,QAAS,MAAM,GAAG,MAAM,0BAInD,CAAC;AAEF,eAAO,MAAM,SAAS,QAAS,MAAM,KAAG,OAEvC,CAAC;AAEF,eAAO,MAAM,WAAW,SAAU,MAAM,GAAG,SAAS,KAAG,OAEtD,CAAC"}
@@ -74,4 +74,7 @@ export const withLeadingZero = function (num, size) {
74
74
  export const isDecimal = num => {
75
75
  return !Number.isInteger(num);
76
76
  };
77
+ export const isValidTime = time => {
78
+ return time === undefined || /^([01]\d|2[0-3]):([0-5]\d)$/.test(time);
79
+ };
77
80
  //# sourceMappingURL=timeUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"timeUtils.js","names":["formatHours","num","withLeadingZeroHours","indexOf","_hours","_minutes","split","length","Number","withLeadingZero","replace","input","parseFloat","isDecimal","decimal","toFixed","time","toString","hours","minutes","minutes_formatted","Math","round","parseInt","size","s","isInteger"],"sources":["../../../src/utils/timeUtils.ts"],"sourcesContent":["/**\n * @function formatHours\n * @description\n * Formats a decimal number representing hours into a formatted string (HH:MM).\n * The input can be a number, string, or undefined. The function handles various formats\n * and can optionally add a leading zero to the hours component.\n *\n * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.\n * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.\n *\n * @returns {string} - A formatted time string in HH:MM format.\n *\n * @example\n * formatHours(1.5) // \"1:30\"\n * formatHours(\"3.5\", true) // \"03:30\"\n */\nexport const formatHours = (\n num: number | string | undefined,\n withLeadingZeroHours = false\n): string => {\n if (!num) {\n return \"\";\n }\n if (typeof num === \"string\" && !num) {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n if (typeof num === \"string\" && num.indexOf(\":\") >= 0) {\n //eslint-disable-next-line\n let [_hours, _minutes] = num.split(\":\");\n if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {\n _minutes = `${Number(_minutes)}0`;\n }\n if (_hours && _minutes) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(_hours)}:${_minutes}`;\n }\n return `${_hours}:${_minutes}`;\n } else if (!_hours && _minutes) {\n return withLeadingZeroHours ? `00:${_minutes}` : `0:${_minutes}`;\n } else if (!_minutes && _hours) {\n return withLeadingZeroHours\n ? `${withLeadingZero(_hours)}:00`\n : `${_hours}:00`;\n } else {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n }\n if (typeof num === \"string\" && num.indexOf(\",\") >= 0) {\n num = num.replace(\",\", \".\");\n }\n const input = typeof num === \"string\" ? parseFloat(num) : num;\n\n if (!isDecimal(input)) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(input)}:00`;\n }\n return `${input}:00`;\n }\n\n const decimal = input.toFixed(2);\n const time = decimal.toString().split(\".\");\n let hours: string = time[0];\n if (withLeadingZeroHours) {\n hours = withLeadingZero(hours);\n }\n const minutes: string = time[1];\n const minutes_formatted = Math.round((parseInt(minutes, 10) / 100) * 60);\n\n return `${hours}:${withLeadingZero(minutes_formatted)}`;\n};\n\nexport const withLeadingZero = (num: string | number, size = 2) => {\n let s = `${num}`;\n while (s.length < size) s = `0` + s;\n return s;\n};\n\nexport const isDecimal = (num: number): boolean => {\n return !Number.isInteger(num);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG,SAAAA,CACzBC,GAAgC,EAChCC,oBAAoB,EAC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AAG,KAAK,QAAQ,GAAGW,UAAU,CAACX,GAAG,CAAC,GAAGA,GAAG;EAE7D,IAAI,CAACY,SAAS,CAACF,KAAK,CAAC,EAAE;IACrB,IAAIT,oBAAoB,EAAE;MACxB,OAAUO,eAAe,CAACE,KAAK,CAAC;IAClC;IACA,OAAUA,KAAK;EACjB;EAEA,MAAMG,OAAO,GAAGH,KAAK,CAACI,OAAO,CAAC,CAAC,CAAC;EAChC,MAAMC,IAAI,GAAGF,OAAO,CAACG,QAAQ,CAAC,CAAC,CAACX,KAAK,CAAC,GAAG,CAAC;EAC1C,IAAIY,KAAa,GAAGF,IAAI,CAAC,CAAC,CAAC;EAC3B,IAAId,oBAAoB,EAAE;IACxBgB,KAAK,GAAGT,eAAe,CAACS,KAAK,CAAC;EAChC;EACA,MAAMC,OAAe,GAAGH,IAAI,CAAC,CAAC,CAAC;EAC/B,MAAMI,iBAAiB,GAAGC,IAAI,CAACC,KAAK,CAAEC,QAAQ,CAACJ,OAAO,EAAE,EAAE,CAAC,GAAG,GAAG,GAAI,EAAE,CAAC;EAExE,OAAUD,KAAK,SAAIT,eAAe,CAACW,iBAAiB,CAAC;AACvD,CAAC;AAED,OAAO,MAAMX,eAAe,GAAG,SAAAA,CAACR,GAAoB,EAAEuB,IAAI,EAAS;EAAA,IAAbA,IAAI;IAAJA,IAAI,GAAG,CAAC;EAAA;EAC5D,IAAIC,CAAC,QAAMxB,GAAK;EAChB,OAAOwB,CAAC,CAAClB,MAAM,GAAGiB,IAAI,EAAEC,CAAC,GAAG,MAAMA,CAAC;EACnC,OAAOA,CAAC;AACV,CAAC;AAED,OAAO,MAAMZ,SAAS,GAAIZ,GAAW,IAAc;EACjD,OAAO,CAACO,MAAM,CAACkB,SAAS,CAACzB,GAAG,CAAC;AAC/B,CAAC"}
1
+ {"version":3,"file":"timeUtils.js","names":["formatHours","num","withLeadingZeroHours","indexOf","_hours","_minutes","split","length","Number","withLeadingZero","replace","input","parseFloat","isDecimal","decimal","toFixed","time","toString","hours","minutes","minutes_formatted","Math","round","parseInt","size","s","isInteger","isValidTime","undefined","test"],"sources":["../../../src/utils/timeUtils.ts"],"sourcesContent":["/**\n * @function formatHours\n * @description\n * Formats a decimal number representing hours into a formatted string (HH:MM).\n * The input can be a number, string, or undefined. The function handles various formats\n * and can optionally add a leading zero to the hours component.\n *\n * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.\n * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.\n *\n * @returns {string} - A formatted time string in HH:MM format.\n *\n * @example\n * formatHours(1.5) // \"1:30\"\n * formatHours(\"3.5\", true) // \"03:30\"\n */\nexport const formatHours = (\n num: number | string | undefined,\n withLeadingZeroHours = false\n): string => {\n if (!num) {\n return \"\";\n }\n if (typeof num === \"string\" && !num) {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n if (typeof num === \"string\" && num.indexOf(\":\") >= 0) {\n //eslint-disable-next-line\n let [_hours, _minutes] = num.split(\":\");\n if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {\n _minutes = `${Number(_minutes)}0`;\n }\n if (_hours && _minutes) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(_hours)}:${_minutes}`;\n }\n return `${_hours}:${_minutes}`;\n } else if (!_hours && _minutes) {\n return withLeadingZeroHours ? `00:${_minutes}` : `0:${_minutes}`;\n } else if (!_minutes && _hours) {\n return withLeadingZeroHours\n ? `${withLeadingZero(_hours)}:00`\n : `${_hours}:00`;\n } else {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n }\n if (typeof num === \"string\" && num.indexOf(\",\") >= 0) {\n num = num.replace(\",\", \".\");\n }\n const input = typeof num === \"string\" ? parseFloat(num) : num;\n\n if (!isDecimal(input)) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(input)}:00`;\n }\n return `${input}:00`;\n }\n\n const decimal = input.toFixed(2);\n const time = decimal.toString().split(\".\");\n let hours: string = time[0];\n if (withLeadingZeroHours) {\n hours = withLeadingZero(hours);\n }\n const minutes: string = time[1];\n const minutes_formatted = Math.round((parseInt(minutes, 10) / 100) * 60);\n\n return `${hours}:${withLeadingZero(minutes_formatted)}`;\n};\n\nexport const withLeadingZero = (num: string | number, size = 2) => {\n let s = `${num}`;\n while (s.length < size) s = `0` + s;\n return s;\n};\n\nexport const isDecimal = (num: number): boolean => {\n return !Number.isInteger(num);\n};\n\nexport const isValidTime = (time: string | undefined): boolean => {\n return time === undefined || /^([01]\\d|2[0-3]):([0-5]\\d)$/.test(time);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG,SAAAA,CACzBC,GAAgC,EAChCC,oBAAoB,EACT;EAAA,IADXA,oBAAoB;IAApBA,oBAAoB,GAAG,KAAK;EAAA;EAE5B,IAAI,CAACD,GAAG,EAAE;IACR,OAAO,EAAE;EACX;EACA,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAI,CAACA,GAAG,EAAE;IACnC,OAAOC,oBAAoB,aAAa,MAAM;EAChD;EACA,IAAI,OAAOD,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;IACpD;IACA,IAAI,CAACC,MAAM,EAAEC,QAAQ,CAAC,GAAGJ,GAAG,CAACK,KAAK,CAAC,GAAG,CAAC;IACvC,IAAID,QAAQ,IAAIA,QAAQ,CAACE,MAAM,KAAK,CAAC,IAAIC,MAAM,CAACH,QAAQ,CAAC,GAAG,EAAE,EAAE;MAC9DA,QAAQ,GAAMG,MAAM,CAACH,QAAQ,CAAC,MAAG;IACnC;IACA,IAAID,MAAM,IAAIC,QAAQ,EAAE;MACtB,IAAIH,oBAAoB,EAAE;QACxB,OAAUO,eAAe,CAACL,MAAM,CAAC,SAAIC,QAAQ;MAC/C;MACA,OAAUD,MAAM,SAAIC,QAAQ;IAC9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