master-components-react-ts 2.1.9 → 2.1.10

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 (67) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +1 -8
  2. package/dist/_virtual/customParseFormat.js +1 -4
  3. package/dist/assets/Icons/IconArrowUp.js +1 -13
  4. package/dist/assets/Icons/IconCalendar.js +1 -32
  5. package/dist/assets/Icons/IconCheck.js +1 -15
  6. package/dist/assets/Icons/IconCheckCircle.js +1 -16
  7. package/dist/assets/Icons/IconCheckmark.js +1 -15
  8. package/dist/assets/Icons/IconCircularLoading.js +1 -36
  9. package/dist/assets/Icons/IconClose.js +1 -31
  10. package/dist/assets/Icons/IconCloseBackground.js +1 -15
  11. package/dist/assets/Icons/IconCloseCircle.js +1 -15
  12. package/dist/assets/Icons/IconErrorDash.js +1 -15
  13. package/dist/assets/Icons/IconExclamation.js +1 -15
  14. package/dist/assets/Icons/IconLeft.js +1 -13
  15. package/dist/assets/Icons/IconLoading.js +1 -22
  16. package/dist/assets/Icons/IconMinus.js +1 -7
  17. package/dist/assets/Icons/IconRadioChecked.js +1 -19
  18. package/dist/assets/Icons/IconRadioCheckedDisabled.js +1 -19
  19. package/dist/assets/Icons/IconRadioUnchecked.js +1 -16
  20. package/dist/assets/Icons/IconRadioUncheckedDisabled.js +1 -16
  21. package/dist/assets/Icons/IconRight.js +1 -13
  22. package/dist/assets/Icons/IconSave.js +1 -16
  23. package/dist/assets/Icons/IconSearch.js +1 -26
  24. package/dist/assets/Icons/IconSuccess.js +1 -15
  25. package/dist/assets/Icons/IconTrash.js +1 -16
  26. package/dist/components/ActionDropdown/ActionDropdown.js +1 -74
  27. package/dist/components/ActionDropdown/ActionDropdown.module.scss.js +1 -29
  28. package/dist/components/Checkbox/Checkbox.js +1 -54
  29. package/dist/components/Checkbox/Checkbox.module.scss.js +1 -26
  30. package/dist/components/DatePicker/Calendar.js +15 -437
  31. package/dist/components/DatePicker/Calendar.module.scss.js +1 -83
  32. package/dist/components/DatePicker/DatePicker.js +1 -211
  33. package/dist/components/DatePicker/Datepicker.module.scss.js +1 -17
  34. package/dist/components/Dropdown/Dropdown.js +1 -337
  35. package/dist/components/Dropdown/Dropdown.module.scss.js +1 -74
  36. package/dist/components/FormInput/FormInput.js +1 -151
  37. package/dist/components/FormInput/FormInput.module.scss.js +1 -62
  38. package/dist/components/InlineLoading/InlineLoading.js +1 -24
  39. package/dist/components/InlineLoading/InlineLoading.module.scss.js +1 -11
  40. package/dist/components/MainButton/MainButton.js +1 -72
  41. package/dist/components/MainButton/MainButton.module.scss.js +1 -56
  42. package/dist/components/NotificationToast/NotificationContext.js +1 -57
  43. package/dist/components/NotificationToast/NotificationToast.js +1 -66
  44. package/dist/components/NotificationToast/NotificationToast.module.scss.js +1 -59
  45. package/dist/components/NotificationToast/createNotificationToast.js +1 -10
  46. package/dist/components/Popup/Popup.js +8 -115
  47. package/dist/components/Popup/Popup.module.scss.js +1 -41
  48. package/dist/components/Radio/Radio.js +1 -46
  49. package/dist/components/Radio/Radio.module.scss.js +1 -8
  50. package/dist/components/Skeleton/Skeleton.js +1 -8
  51. package/dist/components/Skeleton/Skeleton.module.scss.js +1 -20
  52. package/dist/components/Textarea/Textarea.js +1 -149
  53. package/dist/components/Textarea/Textarea.module.scss.js +1 -41
  54. package/dist/components/TimePicker/TimePicker.js +1 -172
  55. package/dist/components/TimePicker/TimePicker.module.scss.js +1 -50
  56. package/dist/components/Toggle/Toggle.js +1 -20
  57. package/dist/components/Toggle/Toggle.module.scss.js +1 -29
  58. package/dist/components/Tooltip/Tooltip.js +1 -153
  59. package/dist/components/Tooltip/Tooltip.module.scss.js +1 -35
  60. package/dist/context/NamespaceContext.js +1 -7
  61. package/dist/index.js +2 -2294
  62. package/dist/node_modules/dayjs/plugin/customParseFormat.js +1 -129
  63. package/dist/utils/Helpers.js +1 -15
  64. package/package.json +2 -2
  65. package/dist/assets/Inter_24pt-Medium-C1cYvkz2.woff2 +0 -0
  66. package/dist/assets/Inter_24pt-Regular-C7SEt4-L.woff2 +0 -0
  67. package/dist/assets/Inter_24pt-SemiBold-DIQUEucn.woff2 +0 -0
@@ -1,151 +1 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import style from "./FormInput.module.scss.js";
3
- import { useRef, useState, useEffect } from "react";
4
- import { IconSearch } from "../../assets/Icons/IconSearch.js";
5
- import { IconCloseCircle } from "../../assets/Icons/IconCloseCircle.js";
6
- const FormInput = ({
7
- label,
8
- placeholder,
9
- helperText,
10
- required = false,
11
- disabled = false,
12
- readOnly = false,
13
- withFocus = true,
14
- withActive = true,
15
- searchComponent = false,
16
- size = "md",
17
- toggleFocus = false,
18
- rightSlot,
19
- leftSlot,
20
- helperSlot,
21
- type = "text",
22
- value,
23
- maxLength,
24
- forDropdown = false,
25
- customFocus = null,
26
- focus = false,
27
- inputState = { error: false, success: false, loading: false },
28
- inputSlot,
29
- onChange,
30
- onFocus,
31
- onBlur,
32
- onEnter,
33
- onFocusChange,
34
- formInputWrapperStyle,
35
- inputWrapperStyle,
36
- formInputStyle,
37
- helperTextStyle,
38
- labelStyle,
39
- inputSlotStyle
40
- }) => {
41
- const InputRef = useRef(null);
42
- const [SearchValue, setSearchValue] = useState(value ?? "");
43
- const [Focused, setFocused] = useState(false);
44
- const [Active, setActive] = useState(false);
45
- const Change = (event) => {
46
- if (searchComponent) {
47
- setSearchValue(event.target.value);
48
- }
49
- onChange?.(event.target.value);
50
- };
51
- const Focus = () => {
52
- onFocus?.();
53
- if (forDropdown) return;
54
- setFocused(true);
55
- };
56
- const Blur = () => {
57
- if (!toggleFocus) {
58
- setFocused(false);
59
- } else {
60
- setFocused(customFocus ?? false);
61
- }
62
- onBlur?.();
63
- };
64
- const handleKeyDown = (event) => {
65
- const input = event.currentTarget.value;
66
- const isFirstCharacter = input.length === 0;
67
- if (type === "number") {
68
- if (event.keyCode === 69 || !isFirstCharacter && (event.keyCode === 187 || event.keyCode === 107 || event.keyCode === 189 || event.keyCode === 109)) {
69
- event.preventDefault();
70
- }
71
- }
72
- if (event.key === "Enter" && input && input.length > 0) {
73
- onEnter?.();
74
- }
75
- };
76
- const getSlot = (slot) => {
77
- return slot;
78
- };
79
- const HandleSearch = () => {
80
- if (!searchComponent) return;
81
- setSearchValue("");
82
- onChange?.("");
83
- };
84
- useEffect(() => {
85
- onFocusChange?.(Focused);
86
- }, [Focused]);
87
- useEffect(() => {
88
- if (customFocus !== void 0 && customFocus !== null) {
89
- setFocused(customFocus);
90
- }
91
- }, [customFocus]);
92
- return /* @__PURE__ */ jsxs("div", { className: `${style.inputWrapper} ${disabled ? style.disabled : ""} ${style[size]}`, style: inputWrapperStyle ?? {}, children: [
93
- label && /* @__PURE__ */ jsxs("div", { className: style.formInputLabelWrapper, children: [
94
- /* @__PURE__ */ jsxs("label", { style: labelStyle ?? {}, className: style.formInputLabel, children: [
95
- label,
96
- " ",
97
- typeof label === "string" && required && /* @__PURE__ */ jsx("span", { className: style.formInputRequired, children: "*" })
98
- ] }),
99
- helperSlot && /* @__PURE__ */ jsx("div", { className: style.formInputHelperSlot, children: getSlot(helperSlot) })
100
- ] }),
101
- /* @__PURE__ */ jsxs(
102
- "div",
103
- {
104
- className: `${style.formInputWrapper} ${inputState.error ? style.errorState : ""} ${withFocus && Focused ? !inputState.error ? style.focused : style.errorFocused : ""} ${withActive && Active ? !inputState.error ? style.active : style.errorActive : ""} ${inputState.error ? style.error : ""} ${inputState.success ? style.success : ""}`,
105
- style: formInputWrapperStyle ?? {},
106
- onClick: () => toggleFocus && setFocused((state) => !state),
107
- children: [
108
- leftSlot && /* @__PURE__ */ jsx("div", { className: style.formInputSlot, children: getSlot(leftSlot) }),
109
- searchComponent && /* @__PURE__ */ jsx("div", { className: style.formInputSlot, children: getSlot(/* @__PURE__ */ jsx(IconSearch, {})) }),
110
- inputSlot ? /* @__PURE__ */ jsx("div", { className: style.formInputSlot, style: inputSlotStyle ?? {}, children: getSlot(inputSlot) }) : /* @__PURE__ */ jsx(
111
- "input",
112
- {
113
- className: style.formInput,
114
- ref: InputRef,
115
- style: formInputStyle ?? {},
116
- type: type ?? "text",
117
- value: searchComponent ? SearchValue : value,
118
- onChange: (event) => Change(event),
119
- onMouseDown: () => !forDropdown && setActive(true),
120
- onMouseUp: () => !forDropdown && setActive(false),
121
- onMouseLeave: () => !forDropdown && setActive(false),
122
- onFocus: Focus,
123
- onBlur: Blur,
124
- disabled,
125
- required,
126
- onKeyDown: handleKeyDown,
127
- readOnly,
128
- spellCheck: false,
129
- placeholder: placeholder ?? "",
130
- autoComplete: "off",
131
- maxLength
132
- }
133
- ),
134
- rightSlot && /* @__PURE__ */ jsx("div", { style: searchComponent ? { cursor: "pointer" } : {}, className: style.formInputSlot, children: getSlot(rightSlot) }),
135
- searchComponent && /* @__PURE__ */ jsx("div", { className: style.formInputSlot, children: /* @__PURE__ */ jsx("div", { onClick: HandleSearch, style: searchComponent ? { cursor: "pointer" } : {}, className: style.formInputSlot, children: SearchValue?.length > 0 ? getSlot(/* @__PURE__ */ jsx(IconCloseCircle, {})) : null }) })
136
- ]
137
- }
138
- ),
139
- helperText && /* @__PURE__ */ jsx(
140
- "p",
141
- {
142
- style: helperTextStyle ?? {},
143
- className: `${style.formInputHelperText} ${inputState.error ? style.errorHelperText : inputState.success ? style.successHelperText : ""}`,
144
- children: helperText
145
- }
146
- )
147
- ] });
148
- };
149
- export {
150
- FormInput as default
151
- };
1
+ import{jsxs as n,jsx as s}from"react/jsx-runtime";import e from"./FormInput.module.scss.js";import{useRef as _,useState as p,useEffect as L}from"react";import{IconSearch as ee}from"../../assets/Icons/IconSearch.js";import{IconCloseCircle as re}from"../../assets/Icons/IconCloseCircle.js";const fe=({label:u,placeholder:M,helperText:y,required:I=!1,disabled:h=!1,readOnly:R=!1,withFocus:T=!0,withActive:W=!0,searchComponent:l=!1,size:b="md",toggleFocus:N=!1,rightSlot:v,leftSlot:$,helperSlot:k,type:g="text",value:x,maxLength:j,forDropdown:f=!1,customFocus:o=null,focus:se=!1,inputState:a={error:!1,success:!1,loading:!1},inputSlot:C,onChange:H,onFocus:B,onBlur:E,onEnter:F,onFocusChange:K,formInputWrapperStyle:V,inputWrapperStyle:D,formInputStyle:U,helperTextStyle:q,labelStyle:w,inputSlotStyle:z})=>{const G=_(null),[S,A]=p(x??""),[i,t]=p(!1),[J,d]=p(!1),O=r=>{l&&A(r.target.value),H?.(r.target.value)},P=()=>{B?.(),!f&&t(!0)},Q=()=>{t(N?o??!1:!1),E?.()},X=r=>{const m=r.currentTarget.value,Z=m.length===0;g==="number"&&(r.keyCode===69||!Z&&(r.keyCode===187||r.keyCode===107||r.keyCode===189||r.keyCode===109))&&r.preventDefault(),r.key==="Enter"&&m&&m.length>0&&F?.()},c=r=>r,Y=()=>{l&&(A(""),H?.(""))};return L(()=>{K?.(i)},[i]),L(()=>{o!=null&&t(o)},[o]),n("div",{className:`${e.inputWrapper} ${h?e.disabled:""} ${e[b]}`,style:D??{},children:[u&&n("div",{className:e.formInputLabelWrapper,children:[n("label",{style:w??{},className:e.formInputLabel,children:[u," ",typeof u=="string"&&I&&s("span",{className:e.formInputRequired,children:"*"})]}),k&&s("div",{className:e.formInputHelperSlot,children:c(k)})]}),n("div",{className:`${e.formInputWrapper} ${a.error?e.errorState:""} ${T&&i?a.error?e.errorFocused:e.focused:""} ${W&&J?a.error?e.errorActive:e.active:""} ${a.error?e.error:""} ${a.success?e.success:""}`,style:V??{},onClick:()=>N&&t(r=>!r),children:[$&&s("div",{className:e.formInputSlot,children:c($)}),l&&s("div",{className:e.formInputSlot,children:c(s(ee,{}))}),C?s("div",{className:e.formInputSlot,style:z??{},children:c(C)}):s("input",{className:e.formInput,ref:G,style:U??{},type:g??"text",value:l?S:x,onChange:r=>O(r),onMouseDown:()=>!f&&d(!0),onMouseUp:()=>!f&&d(!1),onMouseLeave:()=>!f&&d(!1),onFocus:P,onBlur:Q,disabled:h,required:I,onKeyDown:X,readOnly:R,spellCheck:!1,placeholder:M??"",autoComplete:"off",maxLength:j}),v&&s("div",{style:l?{cursor:"pointer"}:{},className:e.formInputSlot,children:c(v)}),l&&s("div",{className:e.formInputSlot,children:s("div",{onClick:Y,style:l?{cursor:"pointer"}:{},className:e.formInputSlot,children:S?.length>0?c(s(re,{})):null})})]}),y&&s("p",{style:q??{},className:`${e.formInputHelperText} ${a.error?e.errorHelperText:a.success?e.successHelperText:""}`,children:y})]})};export{fe as default};
@@ -1,62 +1 @@
1
- const inputWrapper = "FormInput-module__inputWrapper";
2
- const sm = "FormInput-module__sm";
3
- const formInputWrapper = "FormInput-module__formInputWrapper";
4
- const md = "FormInput-module__md";
5
- const disabled = "FormInput-module__disabled";
6
- const formInputLabel = "FormInput-module__formInputLabel";
7
- const formInput = "FormInput-module__formInput";
8
- const formInputHelperText = "FormInput-module__formInputHelperText";
9
- const formInputLabelWrapper = "FormInput-module__formInputLabelWrapper";
10
- const formInputRequired = "FormInput-module__formInputRequired";
11
- const formInputHelperSlot = "FormInput-module__formInputHelperSlot";
12
- const errorState = "FormInput-module__errorState";
13
- const focused = "FormInput-module__focused";
14
- const active = "FormInput-module__active";
15
- const errorFocused = "FormInput-module__errorFocused";
16
- const errorActive = "FormInput-module__errorActive";
17
- const formInputSlot = "FormInput-module__formInputSlot";
18
- const errorHelperText = "FormInput-module__errorHelperText";
19
- const successHelperText = "FormInput-module__successHelperText";
20
- const style = {
21
- inputWrapper,
22
- sm,
23
- formInputWrapper,
24
- md,
25
- disabled,
26
- formInputLabel,
27
- formInput,
28
- formInputHelperText,
29
- formInputLabelWrapper,
30
- formInputRequired,
31
- formInputHelperSlot,
32
- errorState,
33
- focused,
34
- active,
35
- errorFocused,
36
- errorActive,
37
- formInputSlot,
38
- errorHelperText,
39
- successHelperText
40
- };
41
- export {
42
- active,
43
- style as default,
44
- disabled,
45
- errorActive,
46
- errorFocused,
47
- errorHelperText,
48
- errorState,
49
- focused,
50
- formInput,
51
- formInputHelperSlot,
52
- formInputHelperText,
53
- formInputLabel,
54
- formInputLabelWrapper,
55
- formInputRequired,
56
- formInputSlot,
57
- formInputWrapper,
58
- inputWrapper,
59
- md,
60
- sm,
61
- successHelperText
62
- };
1
+ const r="FormInput-module__inputWrapper",e="FormInput-module__sm",o="FormInput-module__formInputWrapper",t="FormInput-module__md",u="FormInput-module__disabled",p="FormInput-module__formInputLabel",m="FormInput-module__formInput",n="FormInput-module__formInputHelperText",l="FormInput-module__formInputLabelWrapper",s="FormInput-module__formInputRequired",I="FormInput-module__formInputHelperSlot",c="FormInput-module__errorState",d="FormInput-module__focused",_="FormInput-module__active",f="FormInput-module__errorFocused",a="FormInput-module__errorActive",F="FormInput-module__formInputSlot",i="FormInput-module__errorHelperText",H="FormInput-module__successHelperText",x={inputWrapper:r,sm:e,formInputWrapper:o,md:t,disabled:u,formInputLabel:p,formInput:m,formInputHelperText:n,formInputLabelWrapper:l,formInputRequired:s,formInputHelperSlot:I,errorState:c,focused:d,active:_,errorFocused:f,errorActive:a,formInputSlot:F,errorHelperText:i,successHelperText:H};export{_ as active,x as default,u as disabled,a as errorActive,f as errorFocused,i as errorHelperText,c as errorState,d as focused,m as formInput,I as formInputHelperSlot,n as formInputHelperText,p as formInputLabel,l as formInputLabelWrapper,s as formInputRequired,F as formInputSlot,o as formInputWrapper,r as inputWrapper,t as md,e as sm,H as successHelperText};
@@ -1,24 +1 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import style from "./InlineLoading.module.scss.js";
3
- import { IconErrorDash } from "../../assets/Icons/IconErrorDash.js";
4
- import { IconLoading } from "../../assets/Icons/IconLoading.js";
5
- import { IconSuccess } from "../../assets/Icons/IconSuccess.js";
6
- const InlineLoading = ({ loading, success, error, msg }) => {
7
- return /* @__PURE__ */ jsxs("div", { className: `${style.inlineLoadingWrapper}`, children: [
8
- loading?.state && /* @__PURE__ */ jsxs("div", { className: style.loading, children: [
9
- /* @__PURE__ */ jsx(IconLoading, { color1: loading?.color1 ?? "#BCC1C2", color2: loading?.color2, size: loading?.size }),
10
- /* @__PURE__ */ jsx("span", { style: msg?.style ?? {}, children: msg?.text ?? "" })
11
- ] }),
12
- !loading?.state && success?.state && /* @__PURE__ */ jsxs("div", { children: [
13
- /* @__PURE__ */ jsx(IconSuccess, { size: success?.size, color: success?.color }),
14
- /* @__PURE__ */ jsx("span", { style: msg?.style ?? {}, children: msg?.text ?? "" })
15
- ] }),
16
- !loading?.state && error?.state && /* @__PURE__ */ jsxs("div", { children: [
17
- /* @__PURE__ */ jsx(IconErrorDash, { size: error?.size, color: error?.color }),
18
- /* @__PURE__ */ jsx("span", { style: msg?.style ?? {}, children: msg?.text ?? "" })
19
- ] })
20
- ] });
21
- };
22
- export {
23
- InlineLoading as default
24
- };
1
+ import{jsxs as r,jsx as o}from"react/jsx-runtime";import s from"./InlineLoading.module.scss.js";import{IconErrorDash as c}from"../../assets/Icons/IconErrorDash.js";import{IconLoading as n}from"../../assets/Icons/IconLoading.js";import{IconSuccess as a}from"../../assets/Icons/IconSuccess.js";const f=({loading:e,success:i,error:l,msg:t})=>r("div",{className:`${s.inlineLoadingWrapper}`,children:[e?.state&&r("div",{className:s.loading,children:[o(n,{color1:e?.color1??"#BCC1C2",color2:e?.color2,size:e?.size}),o("span",{style:t?.style??{},children:t?.text??""})]}),!e?.state&&i?.state&&r("div",{children:[o(a,{size:i?.size,color:i?.color}),o("span",{style:t?.style??{},children:t?.text??""})]}),!e?.state&&l?.state&&r("div",{children:[o(c,{size:l?.size,color:l?.color}),o("span",{style:t?.style??{},children:t?.text??""})]})]});export{f as default};
@@ -1,11 +1 @@
1
- const inlineLoadingWrapper = "InlineLoading-module__inlineLoadingWrapper";
2
- const loading = "InlineLoading-module__loading";
3
- const style = {
4
- inlineLoadingWrapper,
5
- loading
6
- };
7
- export {
8
- style as default,
9
- inlineLoadingWrapper,
10
- loading
11
- };
1
+ const n="InlineLoading-module__inlineLoadingWrapper",i="InlineLoading-module__loading",o={inlineLoadingWrapper:n,loading:i};export{o as default,n as inlineLoadingWrapper,i as loading};
@@ -1,72 +1 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import style from "./MainButton.module.scss.js";
3
- import { useState, useRef, useEffect } from "react";
4
- import IconCircularLoading from "../../assets/Icons/IconCircularLoading.js";
5
- const MainButton = ({
6
- label,
7
- size = "md",
8
- leftSlot,
9
- rightSlot,
10
- buttonSlot,
11
- type = "button",
12
- colorType = "neutral",
13
- buttonType = "primary",
14
- withFocus = false,
15
- customFocus,
16
- disabled,
17
- loading = false,
18
- spaceBetween = false,
19
- buttonStyle,
20
- mainButtonContentStyle,
21
- mainButtonLabelStyle,
22
- leftSlotStyle,
23
- rightSlotStyle,
24
- onClick
25
- }) => {
26
- const [Focused, setFocused] = useState(customFocus || false);
27
- const ButtonRef = useRef(null);
28
- const Click = (e) => {
29
- if (disabled || loading) return;
30
- if (withFocus) {
31
- setFocused((state) => !state);
32
- }
33
- onClick?.(e);
34
- };
35
- const getLoadingColor = () => {
36
- let color = "#ffffff";
37
- if (colorType === "neutral" && buttonType !== "primary") color = "#0058FF";
38
- if (colorType === "positive" && buttonType !== "primary") color = "#328707";
39
- if (colorType === "negative" && buttonType !== "primary") color = "#E3292F";
40
- return color;
41
- };
42
- useEffect(() => {
43
- const ClickHandler = (event) => {
44
- if (!ButtonRef.current || disabled) return;
45
- if (event.composedPath().includes(ButtonRef.current)) return;
46
- setFocused(false);
47
- };
48
- document.addEventListener("click", ClickHandler);
49
- return () => {
50
- document.removeEventListener("click", ClickHandler);
51
- };
52
- }, []);
53
- return /* @__PURE__ */ jsx(
54
- "button",
55
- {
56
- ref: ButtonRef,
57
- style: buttonStyle,
58
- type,
59
- disabled,
60
- className: `${style.mainButton} ${style[size]} ${loading ? style.loading : ""} ${Focused ? style.focused : ""} ${style[buttonType]} ${style[colorType]} ${disabled ? style.disabled : ""}`,
61
- onClick: Click,
62
- children: loading ? /* @__PURE__ */ jsx(IconCircularLoading, { size: 20, stroke: getLoadingColor() }) : buttonSlot || /* @__PURE__ */ jsxs("div", { className: style.mainButtonContent, style: { ...mainButtonContentStyle, justifyContent: spaceBetween ? "space-between" : "center" }, children: [
63
- leftSlot && /* @__PURE__ */ jsx("div", { className: style.leftSlot, style: leftSlotStyle, children: leftSlot }),
64
- /* @__PURE__ */ jsx("p", { className: style.mainButtonLabel, style: mainButtonLabelStyle, children: label }),
65
- rightSlot && /* @__PURE__ */ jsx("div", { className: style.rightSlot, style: rightSlotStyle, children: rightSlot })
66
- ] })
67
- }
68
- );
69
- };
70
- export {
71
- MainButton as default
72
- };
1
+ import{jsx as n,jsxs as x}from"react/jsx-runtime";import e from"./MainButton.module.scss.js";import{useState as R,useRef as w,useEffect as z}from"react";import H from"../../assets/Icons/IconCircularLoading.js";const q=({label:m,size:d="md",leftSlot:o,rightSlot:f,buttonSlot:v,type:p="button",colorType:r="neutral",buttonType:s="primary",withFocus:C=!1,customFocus:$,disabled:i,loading:c=!1,spaceBetween:h=!1,buttonStyle:k,mainButtonContentStyle:y,mainButtonLabelStyle:B,leftSlotStyle:F,rightSlotStyle:L,onClick:N})=>{const[E,u]=R($||!1),a=w(null),g=t=>{i||c||(C&&u(l=>!l),N?.(t))},j=()=>{let t="#ffffff";return r==="neutral"&&s!=="primary"&&(t="#0058FF"),r==="positive"&&s!=="primary"&&(t="#328707"),r==="negative"&&s!=="primary"&&(t="#E3292F"),t};return z(()=>{const t=l=>{!a.current||i||l.composedPath().includes(a.current)||u(!1)};return document.addEventListener("click",t),()=>{document.removeEventListener("click",t)}},[]),n("button",{ref:a,style:k,type:p,disabled:i,className:`${e.mainButton} ${e[d]} ${c?e.loading:""} ${E?e.focused:""} ${e[s]} ${e[r]} ${i?e.disabled:""}`,onClick:g,children:c?n(H,{size:20,stroke:j()}):v||x("div",{className:e.mainButtonContent,style:{...y,justifyContent:h?"space-between":"center"},children:[o&&n("div",{className:e.leftSlot,style:F,children:o}),n("p",{className:e.mainButtonLabel,style:B,children:m}),f&&n("div",{className:e.rightSlot,style:L,children:f})]})})};export{q as default};
@@ -1,56 +1 @@
1
- const mainButton = "MainButton-module__mainButton";
2
- const sm = "MainButton-module__sm";
3
- const md = "MainButton-module__md";
4
- const lg = "MainButton-module__lg";
5
- const mainButtonContent = "MainButton-module__mainButtonContent";
6
- const mainButtonLabel = "MainButton-module__mainButtonLabel";
7
- const primary = "MainButton-module__primary";
8
- const neutral = "MainButton-module__neutral";
9
- const loading = "MainButton-module__loading";
10
- const disabled = "MainButton-module__disabled";
11
- const focused = "MainButton-module__focused";
12
- const positive = "MainButton-module__positive";
13
- const negative = "MainButton-module__negative";
14
- const secondary = "MainButton-module__secondary";
15
- const tertiary = "MainButton-module__tertiary";
16
- const tertiaryV2 = "MainButton-module__tertiaryV2";
17
- const tertiaryV3 = "MainButton-module__tertiaryV3";
18
- const style = {
19
- mainButton,
20
- sm,
21
- md,
22
- lg,
23
- mainButtonContent,
24
- mainButtonLabel,
25
- primary,
26
- neutral,
27
- loading,
28
- disabled,
29
- focused,
30
- positive,
31
- negative,
32
- secondary,
33
- tertiary,
34
- tertiaryV2,
35
- tertiaryV3
36
- };
37
- export {
38
- style as default,
39
- disabled,
40
- focused,
41
- lg,
42
- loading,
43
- mainButton,
44
- mainButtonContent,
45
- mainButtonLabel,
46
- md,
47
- negative,
48
- neutral,
49
- positive,
50
- primary,
51
- secondary,
52
- sm,
53
- tertiary,
54
- tertiaryV2,
55
- tertiaryV3
56
- };
1
+ const t="MainButton-module__mainButton",n="MainButton-module__sm",o="MainButton-module__md",a="MainButton-module__lg",e="MainButton-module__mainButtonContent",i="MainButton-module__mainButtonLabel",u="MainButton-module__primary",d="MainButton-module__neutral",m="MainButton-module__loading",s="MainButton-module__disabled",l="MainButton-module__focused",_="MainButton-module__positive",r="MainButton-module__negative",B="MainButton-module__secondary",c="MainButton-module__tertiary",M="MainButton-module__tertiaryV2",y="MainButton-module__tertiaryV3",g={mainButton:t,sm:n,md:o,lg:a,mainButtonContent:e,mainButtonLabel:i,primary:u,neutral:d,loading:m,disabled:s,focused:l,positive:_,negative:r,secondary:B,tertiary:c,tertiaryV2:M,tertiaryV3:y};export{g as default,s as disabled,l as focused,a as lg,m as loading,t as mainButton,e as mainButtonContent,i as mainButtonLabel,o as md,r as negative,d as neutral,_ as positive,u as primary,B as secondary,n as sm,c as tertiary,M as tertiaryV2,y as tertiaryV3};
@@ -1,57 +1 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { createContext, useState, useCallback } from "react";
3
- import NotificationToast from "./NotificationToast.js";
4
- import style from "./NotificationToast.module.scss.js";
5
- const ToastContext = createContext(null);
6
- let idCounter = 0;
7
- const ToastProvider = ({ children }) => {
8
- const [toasts, setToasts] = useState([]);
9
- const showToast = (props) => {
10
- setToasts((prev) => {
11
- const max = props.max ?? Infinity;
12
- if (prev.length >= max) return prev;
13
- const id = idCounter++;
14
- setTimeout(() => {
15
- setToasts((prev2) => prev2.filter((t) => t.id !== id));
16
- }, props.timeout || 4e3);
17
- return [...prev, { id, props }];
18
- });
19
- };
20
- const getPosition = useCallback(() => {
21
- if (toasts.length > 0) {
22
- switch (toasts[0]?.props?.position) {
23
- case "top-left":
24
- return { top: "20px", left: "20px" };
25
- case "top-right":
26
- return { top: "20px", right: "20px" };
27
- case "bottom-left":
28
- return { bottom: "20px", left: "20px" };
29
- case "bottom-right":
30
- return { bottom: "20px", right: "20px" };
31
- case "top-center":
32
- return { top: "20px", left: "50%", transform: "translateX(-50%)" };
33
- case "bottom-center":
34
- return { bottom: "20px", left: "50%", transform: "translateX(-50%)" };
35
- default:
36
- return {};
37
- }
38
- }
39
- }, [toasts.length]);
40
- return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: { showToast }, children: [
41
- children,
42
- /* @__PURE__ */ jsx("div", { className: style.toastContainer, style: getPosition(), children: toasts.map(({ id, props }) => /* @__PURE__ */ jsx(
43
- NotificationToast,
44
- {
45
- ...props,
46
- onClose: () => {
47
- setToasts((prev) => prev.filter((t) => t.id !== id));
48
- }
49
- },
50
- id
51
- )) })
52
- ] });
53
- };
54
- export {
55
- ToastContext,
56
- ToastProvider as default
57
- };
1
+ import{jsxs as p,jsx as a}from"react/jsx-runtime";import{createContext as u,useState as x,useCallback as h}from"react";import d from"./NotificationToast.js";import g from"./NotificationToast.module.scss.js";const b=u(null);let C=0;const v=({children:i})=>{const[o,s]=x([]),l=t=>{s(e=>{const n=t.max??1/0;if(e.length>=n)return e;const r=C++;return setTimeout(()=>{s(m=>m.filter(f=>f.id!==r))},t.timeout||4e3),[...e,{id:r,props:t}]})},c=h(()=>{if(o.length>0)switch(o[0]?.props?.position){case"top-left":return{top:"20px",left:"20px"};case"top-right":return{top:"20px",right:"20px"};case"bottom-left":return{bottom:"20px",left:"20px"};case"bottom-right":return{bottom:"20px",right:"20px"};case"top-center":return{top:"20px",left:"50%",transform:"translateX(-50%)"};case"bottom-center":return{bottom:"20px",left:"50%",transform:"translateX(-50%)"};default:return{}}},[o.length]);return p(b.Provider,{value:{showToast:l},children:[i,a("div",{className:g.toastContainer,style:c(),children:o.map(({id:t,props:e})=>a(d,{...e,onClose:()=>{s(n=>n.filter(r=>r.id!==t))}},t))})]})};export{b as ToastContext,v as default};
@@ -1,66 +1 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { IconCloseBlack } from "../../assets/Icons/IconClose.js";
3
- import style from "./NotificationToast.module.scss.js";
4
- import { useState, useEffect } from "react";
5
- import { IconExclamation } from "../../assets/Icons/IconExclamation.js";
6
- import { IconCheck } from "../../assets/Icons/IconCheck.js";
7
- const NotificationToast = ({
8
- title,
9
- colorType = "neutral",
10
- filled = false,
11
- withClose = false,
12
- withUndo = false,
13
- withInfoIcon = true,
14
- description,
15
- customAction,
16
- timeout = 4e3,
17
- children,
18
- onUndo,
19
- onClose
20
- }) => {
21
- const [animationClass, setAnimationClass] = useState("fadeIn");
22
- useEffect(() => {
23
- const duration = timeout;
24
- const fadeDuration = 300;
25
- const hideTimeout = setTimeout(() => {
26
- setAnimationClass("fadeOut");
27
- setTimeout(() => {
28
- onClose?.();
29
- }, fadeDuration);
30
- }, duration);
31
- return () => {
32
- clearTimeout(hideTimeout);
33
- };
34
- }, [onClose]);
35
- return /* @__PURE__ */ jsx(
36
- "div",
37
- {
38
- className: `${style.notificationToast} ${style[colorType]} ${filled ? style.filled : ""} ${style[animationClass]}`,
39
- style: description ? { padding: "12px" } : {},
40
- children: /* @__PURE__ */ jsxs("div", { className: style.notificationToastContent, style: description ? { alignItems: "flex-start" } : {}, children: [
41
- /* @__PURE__ */ jsxs("div", { className: style.notificationToastContentLeft, style: description ? { alignItems: "flex-start" } : {}, children: [
42
- withInfoIcon && /* @__PURE__ */ jsx("div", { className: style.notificationToastContentInfoIcon, children: colorType === "success" ? /* @__PURE__ */ jsx(IconCheck, { color: filled ? "#328707" : "#fff" }) : /* @__PURE__ */ jsx(IconExclamation, { color: filled ? colorType === "neutral" ? "#131314" : colorType === "error" ? "#E3292F" : "#0058FF" : "#fff" }) }),
43
- /* @__PURE__ */ jsxs("div", { className: style.notificationToastContentLeftText, children: [
44
- title && /* @__PURE__ */ jsx("p", { className: style.notificationToastContentLeftTextTitle, children: title }),
45
- description && /* @__PURE__ */ jsx("p", { className: style.notificationToastContentLeftTextDescription, children: description }),
46
- children && children
47
- ] })
48
- ] }),
49
- /* @__PURE__ */ jsx("div", { className: style.notificationToastContentDescription }),
50
- /* @__PURE__ */ jsxs("div", { className: style.notificationToastContentRight, children: [
51
- customAction && customAction,
52
- !description && withUndo && /* @__PURE__ */ jsx("p", { className: style.notificationToastContentRightUndoText, onClick: () => onUndo?.(), children: "Undo" }),
53
- withClose && /* @__PURE__ */ jsx("div", { className: style.notificationToastContentRightClose, style: description || !withUndo ? { border: "none" } : {}, onClick: () => onClose?.(), children: /* @__PURE__ */ jsx(
54
- IconCloseBlack,
55
- {
56
- color: filled ? colorType === "neutral" ? "#131314" : colorType === "error" ? "#E3292F" : colorType === "info" ? "#0058FF" : "#328707" : "#fff"
57
- }
58
- ) })
59
- ] })
60
- ] })
61
- }
62
- );
63
- };
64
- export {
65
- NotificationToast as default
66
- };
1
+ import{jsx as n,jsxs as i}from"react/jsx-runtime";import{IconCloseBlack as I}from"../../assets/Icons/IconClose.js";import t from"./NotificationToast.module.scss.js";import{useState as g,useEffect as F}from"react";import{IconExclamation as k}from"../../assets/Icons/IconExclamation.js";import{IconCheck as E}from"../../assets/Icons/IconCheck.js";const b=({title:f,colorType:a="neutral",filled:e=!1,withClose:m=!1,withUndo:c=!1,withInfoIcon:d=!0,description:o,customAction:l,timeout:u=4e3,children:r,onUndo:C,onClose:s})=>{const[T,h]=g("fadeIn");return F(()=>{const N=u,x=300,v=setTimeout(()=>{h("fadeOut"),setTimeout(()=>{s?.()},x)},N);return()=>{clearTimeout(v)}},[s]),n("div",{className:`${t.notificationToast} ${t[a]} ${e?t.filled:""} ${t[T]}`,style:o?{padding:"12px"}:{},children:i("div",{className:t.notificationToastContent,style:o?{alignItems:"flex-start"}:{},children:[i("div",{className:t.notificationToastContentLeft,style:o?{alignItems:"flex-start"}:{},children:[d&&n("div",{className:t.notificationToastContentInfoIcon,children:a==="success"?n(E,{color:e?"#328707":"#fff"}):n(k,{color:e?a==="neutral"?"#131314":a==="error"?"#E3292F":"#0058FF":"#fff"})}),i("div",{className:t.notificationToastContentLeftText,children:[f&&n("p",{className:t.notificationToastContentLeftTextTitle,children:f}),o&&n("p",{className:t.notificationToastContentLeftTextDescription,children:o}),r&&r]})]}),n("div",{className:t.notificationToastContentDescription}),i("div",{className:t.notificationToastContentRight,children:[l&&l,!o&&c&&n("p",{className:t.notificationToastContentRightUndoText,onClick:()=>C?.(),children:"Undo"}),m&&n("div",{className:t.notificationToastContentRightClose,style:o||!c?{border:"none"}:{},onClick:()=>s?.(),children:n(I,{color:e?a==="neutral"?"#131314":a==="error"?"#E3292F":a==="info"?"#0058FF":"#328707":"#fff"})})]})]})})};export{b as default};
@@ -1,59 +1 @@
1
- const toastContainer = "NotificationToast-module__toastContainer";
2
- const notificationToast = "NotificationToast-module__notificationToast";
3
- const fadeIn = "NotificationToast-module__fadeIn";
4
- const fadeOut = "NotificationToast-module__fadeOut";
5
- const neutral = "NotificationToast-module__neutral";
6
- const filled = "NotificationToast-module__filled";
7
- const notificationToastContentLeftTextTitle = "NotificationToast-module__notificationToastContentLeftTextTitle";
8
- const notificationToastContentRightUndoText = "NotificationToast-module__notificationToastContentRightUndoText";
9
- const notificationToastContentLeftTextDescription = "NotificationToast-module__notificationToastContentLeftTextDescription";
10
- const info = "NotificationToast-module__info";
11
- const error = "NotificationToast-module__error";
12
- const success = "NotificationToast-module__success";
13
- const notificationToastContent = "NotificationToast-module__notificationToastContent";
14
- const notificationToastContentLeft = "NotificationToast-module__notificationToastContentLeft";
15
- const notificationToastContentInfoIcon = "NotificationToast-module__notificationToastContentInfoIcon";
16
- const notificationToastContentLeftText = "NotificationToast-module__notificationToastContentLeftText";
17
- const notificationToastContentRight = "NotificationToast-module__notificationToastContentRight";
18
- const notificationToastContentRightClose = "NotificationToast-module__notificationToastContentRightClose";
19
- const style = {
20
- toastContainer,
21
- notificationToast,
22
- fadeIn,
23
- fadeOut,
24
- neutral,
25
- filled,
26
- notificationToastContentLeftTextTitle,
27
- notificationToastContentRightUndoText,
28
- notificationToastContentLeftTextDescription,
29
- info,
30
- error,
31
- success,
32
- notificationToastContent,
33
- notificationToastContentLeft,
34
- notificationToastContentInfoIcon,
35
- notificationToastContentLeftText,
36
- notificationToastContentRight,
37
- notificationToastContentRightClose
38
- };
39
- export {
40
- style as default,
41
- error,
42
- fadeIn,
43
- fadeOut,
44
- filled,
45
- info,
46
- neutral,
47
- notificationToast,
48
- notificationToastContent,
49
- notificationToastContentInfoIcon,
50
- notificationToastContentLeft,
51
- notificationToastContentLeftText,
52
- notificationToastContentLeftTextDescription,
53
- notificationToastContentLeftTextTitle,
54
- notificationToastContentRight,
55
- notificationToastContentRightClose,
56
- notificationToastContentRightUndoText,
57
- success,
58
- toastContainer
59
- };
1
+ const t="NotificationToast-module__toastContainer",o="NotificationToast-module__notificationToast",n="NotificationToast-module__fadeIn",i="NotificationToast-module__fadeOut",a="NotificationToast-module__neutral",e="NotificationToast-module__filled",s="NotificationToast-module__notificationToastContentLeftTextTitle",c="NotificationToast-module__notificationToastContentRightUndoText",f="NotificationToast-module__notificationToastContentLeftTextDescription",T="NotificationToast-module__info",_="NotificationToast-module__error",l="NotificationToast-module__success",C="NotificationToast-module__notificationToastContent",d="NotificationToast-module__notificationToastContentLeft",u="NotificationToast-module__notificationToastContentInfoIcon",r="NotificationToast-module__notificationToastContentLeftText",m="NotificationToast-module__notificationToastContentRight",N="NotificationToast-module__notificationToastContentRightClose",x={toastContainer:t,notificationToast:o,fadeIn:n,fadeOut:i,neutral:a,filled:e,notificationToastContentLeftTextTitle:s,notificationToastContentRightUndoText:c,notificationToastContentLeftTextDescription:f,info:T,error:_,success:l,notificationToastContent:C,notificationToastContentLeft:d,notificationToastContentInfoIcon:u,notificationToastContentLeftText:r,notificationToastContentRight:m,notificationToastContentRightClose:N};export{x as default,_ as error,n as fadeIn,i as fadeOut,e as filled,T as info,a as neutral,o as notificationToast,C as notificationToastContent,u as notificationToastContentInfoIcon,d as notificationToastContentLeft,r as notificationToastContentLeftText,f as notificationToastContentLeftTextDescription,s as notificationToastContentLeftTextTitle,m as notificationToastContentRight,N as notificationToastContentRightClose,c as notificationToastContentRightUndoText,l as success,t as toastContainer};
@@ -1,10 +1 @@
1
- import { ToastContext } from "./NotificationContext.js";
2
- import { useContext } from "react";
3
- const createNotificationToast = () => {
4
- const context = useContext(ToastContext);
5
- if (!context) throw new Error("createNotificationToast must be used within ToastProvider");
6
- return context.showToast;
7
- };
8
- export {
9
- createNotificationToast as default
10
- };
1
+ import{ToastContext as o}from"./NotificationContext.js";import{useContext as e}from"react";const s=()=>{const t=e(o);if(!t)throw new Error("createNotificationToast must be used within ToastProvider");return t.showToast};export{s as default};