abrplus-ui-kit 0.2.9
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.
- package/README.md +159 -0
- package/dist/antOverrides.cjs.js +127 -0
- package/dist/antOverrides.es.js +127 -0
- package/dist/atoms.cjs.js +391 -0
- package/dist/atoms.es.js +392 -0
- package/dist/colors-CztsZ6e_.js +2213 -0
- package/dist/colors-TPZkyKI4.cjs +2212 -0
- package/dist/deepMerge-CG1he8ZD.js +20 -0
- package/dist/deepMerge-Cn27K7-s.cjs +19 -0
- package/dist/index-2Q5IExhU.cjs +89 -0
- package/dist/index-BOfdgXvN.cjs +265 -0
- package/dist/index-BnnlMHRY.cjs +27 -0
- package/dist/index-BzahloOb.js +28 -0
- package/dist/index-C24zbKLS.js +350 -0
- package/dist/index-CCvWoynu.cjs +12 -0
- package/dist/index-CQKRmQkW.js +543 -0
- package/dist/index-CW9vyiq6.cjs +349 -0
- package/dist/index-D8BknfUe.js +266 -0
- package/dist/index-DCP3xelB.cjs +1629 -0
- package/dist/index-DCojd1ld.js +90 -0
- package/dist/index-DLUd_0LP.js +13 -0
- package/dist/index-WgcaHHjH.js +1630 -0
- package/dist/index-keKfh9ZW.cjs +542 -0
- package/dist/index.cjs.js +109 -0
- package/dist/index.css +1519 -0
- package/dist/index.es.js +109 -0
- package/dist/index2.css +3 -0
- package/dist/molecules.cjs.js +7823 -0
- package/dist/molecules.es.js +7825 -0
- package/dist/organisms.cjs.js +940 -0
- package/dist/organisms.es.js +940 -0
- package/dist/provider.cjs.js +48 -0
- package/dist/provider.es.js +48 -0
- package/dist/sortable.esm-CwrpjqII.cjs +3872 -0
- package/dist/sortable.esm-DfJu5xWT.js +3873 -0
- package/dist/theme.css +102 -0
- package/dist/types/antOverrides.d.ts +2 -0
- package/dist/types/assets/fonts/icomoon/selection.json.d.ts +3 -0
- package/dist/types/atoms.d.ts +2 -0
- package/dist/types/components/antOverrides/alert/index.d.ts +2 -0
- package/dist/types/components/antOverrides/avatar/index.d.ts +15 -0
- package/dist/types/components/antOverrides/breadcrumb/index.d.ts +4 -0
- package/dist/types/components/antOverrides/dropdown/index.d.ts +4 -0
- package/dist/types/components/antOverrides/flex/index.d.ts +4 -0
- package/dist/types/components/antOverrides/image/index.d.ts +7 -0
- package/dist/types/components/antOverrides/index.d.ts +18 -0
- package/dist/types/components/antOverrides/infiniteLoader/index.d.ts +12 -0
- package/dist/types/components/antOverrides/loading/index.d.ts +14 -0
- package/dist/types/components/antOverrides/menu/index.d.ts +8 -0
- package/dist/types/components/antOverrides/pagination/index.d.ts +3 -0
- package/dist/types/components/antOverrides/progress/index.d.ts +3 -0
- package/dist/types/components/antOverrides/segmented/index.d.ts +4 -0
- package/dist/types/components/antOverrides/skeleton/index.d.ts +10 -0
- package/dist/types/components/antOverrides/slider/index.d.ts +5 -0
- package/dist/types/components/antOverrides/steps/index.d.ts +11 -0
- package/dist/types/components/antOverrides/switch/index.d.ts +3 -0
- package/dist/types/components/antOverrides/text/index.d.ts +31 -0
- package/dist/types/components/antOverrides/timeline/index.d.ts +4 -0
- package/dist/types/components/antOverrides/tooltip/index.d.ts +8 -0
- package/dist/types/components/antOverrides/upload/index.d.ts +7 -0
- package/dist/types/components/atoms/badge/index.d.ts +3 -0
- package/dist/types/components/atoms/behavioralAtoms/index.d.ts +2 -0
- package/dist/types/components/atoms/behavioralAtoms/portalContainer/index.d.ts +7 -0
- package/dist/types/components/atoms/behavioralAtoms/render/index.d.ts +14 -0
- package/dist/types/components/atoms/borderedTitle/index.d.ts +9 -0
- package/dist/types/components/atoms/box/index.d.ts +7 -0
- package/dist/types/components/atoms/breadcrumbs/index.d.ts +5 -0
- package/dist/types/components/atoms/card/index.d.ts +5 -0
- package/dist/types/components/atoms/checkbox/index.d.ts +7 -0
- package/dist/types/components/atoms/clickAwayListener/index.d.ts +11 -0
- package/dist/types/components/atoms/collapse/index.d.ts +6 -0
- package/dist/types/components/atoms/datePicker/index.d.ts +16 -0
- package/dist/types/components/atoms/empty/index.d.ts +5 -0
- package/dist/types/components/atoms/fallback/index.d.ts +4 -0
- package/dist/types/components/atoms/horizontalLine/index.d.ts +9 -0
- package/dist/types/components/atoms/icon/constants/iconNames.d.ts +1 -0
- package/dist/types/components/atoms/icon/constants/iconsContent.d.ts +808 -0
- package/dist/types/components/atoms/icon/iconPack/index.d.ts +2 -0
- package/dist/types/components/atoms/icon/index.d.ts +26 -0
- package/dist/types/components/atoms/index.d.ts +24 -0
- package/dist/types/components/atoms/navigationTabs/index.d.ts +35 -0
- package/dist/types/components/atoms/popover/index.d.ts +14 -0
- package/dist/types/components/atoms/popover/link.d.ts +6 -0
- package/dist/types/components/atoms/radio/index.d.ts +7 -0
- package/dist/types/components/atoms/rangePicker/index.d.ts +14 -0
- package/dist/types/components/atoms/separator/index.d.ts +5 -0
- package/dist/types/components/atoms/tab/index.d.ts +9 -0
- package/dist/types/components/atoms/tooltip/index.d.ts +7 -0
- package/dist/types/components/atoms/tooltip/titleTooltip.d.ts +5 -0
- package/dist/types/components/atoms/upload/index.d.ts +11 -0
- package/dist/types/components/atoms/verticalLine/index.d.ts +7 -0
- package/dist/types/components/atoms/view/helper.d.ts +20 -0
- package/dist/types/components/atoms/view/index.d.ts +26 -0
- package/dist/types/components/index.d.ts +4 -0
- package/dist/types/components/molecules/accordion/index.d.ts +20 -0
- package/dist/types/components/molecules/actionHeader/index.d.ts +11 -0
- package/dist/types/components/molecules/audioVisualizer/index.d.ts +15 -0
- package/dist/types/components/molecules/avatarUpload/index.d.ts +15 -0
- package/dist/types/components/molecules/button/action/index.d.ts +5 -0
- package/dist/types/components/molecules/button/icon/index.d.ts +11 -0
- package/dist/types/components/molecules/button/index.d.ts +18 -0
- package/dist/types/components/molecules/button/negative/index.d.ts +5 -0
- package/dist/types/components/molecules/button/primary/index.d.ts +3 -0
- package/dist/types/components/molecules/button/secondary/index.d.ts +3 -0
- package/dist/types/components/molecules/button/secondaryQuiet/index.d.ts +3 -0
- package/dist/types/components/molecules/button/shared.d.ts +23 -0
- package/dist/types/components/molecules/button/tertiary/index.d.ts +3 -0
- package/dist/types/components/molecules/button/text/index.d.ts +10 -0
- package/dist/types/components/molecules/catch/index.d.ts +9 -0
- package/dist/types/components/molecules/chevronIcon/index.d.ts +6 -0
- package/dist/types/components/molecules/copyButton/index.d.ts +8 -0
- package/dist/types/components/molecules/index.d.ts +24 -0
- package/dist/types/components/molecules/input/TextArea/index.d.ts +25 -0
- package/dist/types/components/molecules/input/default/index.d.ts +23 -0
- package/dist/types/components/molecules/input/emojiPicker/index.d.ts +21 -0
- package/dist/types/components/molecules/input/ghost/index.d.ts +25 -0
- package/dist/types/components/molecules/input/index.d.ts +19 -0
- package/dist/types/components/molecules/input/number/index.d.ts +28 -0
- package/dist/types/components/molecules/input/search/index.d.ts +7 -0
- package/dist/types/components/molecules/input/tag/index.d.ts +13 -0
- package/dist/types/components/molecules/inputDatePicker/index.d.ts +17 -0
- package/dist/types/components/molecules/inputErrorMessage/index.d.ts +9 -0
- package/dist/types/components/molecules/inputRangePicker/index.d.ts +16 -0
- package/dist/types/components/molecules/logo/index.d.ts +25 -0
- package/dist/types/components/molecules/noResult/index.d.ts +8 -0
- package/dist/types/components/molecules/notification/index.d.ts +13 -0
- package/dist/types/components/molecules/select/components/clearIcon.d.ts +2 -0
- package/dist/types/components/molecules/select/components/index.d.ts +5 -0
- package/dist/types/components/molecules/select/components/label.d.ts +6 -0
- package/dist/types/components/molecules/select/components/notFound.d.ts +5 -0
- package/dist/types/components/molecules/select/components/placeholder.d.ts +7 -0
- package/dist/types/components/molecules/select/components/suffix.d.ts +10 -0
- package/dist/types/components/molecules/select/index.d.ts +13 -0
- package/dist/types/components/molecules/select/multiple/index.d.ts +5 -0
- package/dist/types/components/molecules/select/single/index.d.ts +5 -0
- package/dist/types/components/molecules/select/style.d.ts +8 -0
- package/dist/types/components/molecules/select/treeSelect/index.d.ts +2 -0
- package/dist/types/components/molecules/select/types.d.ts +108 -0
- package/dist/types/components/molecules/sortableList/index.d.ts +19 -0
- package/dist/types/components/molecules/spliter/index.d.ts +8 -0
- package/dist/types/components/molecules/tag/index.d.ts +17 -0
- package/dist/types/components/molecules/tagCollectionView/index.d.ts +14 -0
- package/dist/types/components/molecules/tagInput/components/notFoundAddItem.d.ts +4 -0
- package/dist/types/components/molecules/tagInput/index.d.ts +6 -0
- package/dist/types/components/molecules/tagInput/style.d.ts +9 -0
- package/dist/types/components/molecules/tagInput/types.d.ts +66 -0
- package/dist/types/components/molecules/timePicker/index.d.ts +6 -0
- package/dist/types/components/molecules/titleBox/index.d.ts +8 -0
- package/dist/types/components/molecules/titleBox/status.d.ts +5 -0
- package/dist/types/components/molecules/titleBox/title.d.ts +7 -0
- package/dist/types/components/molecules/tree/index.d.ts +29 -0
- package/dist/types/components/molecules/tree/searchBar/index.d.ts +7 -0
- package/dist/types/components/molecules/verticalTabs/index.d.ts +19 -0
- package/dist/types/components/organisms/avatarGroup/index.d.ts +25 -0
- package/dist/types/components/organisms/drawer/components/footer.d.ts +3 -0
- package/dist/types/components/organisms/drawer/components/headerTitle.d.ts +8 -0
- package/dist/types/components/organisms/drawer/index.d.ts +24 -0
- package/dist/types/components/organisms/index.d.ts +4 -0
- package/dist/types/components/organisms/modal/base.d.ts +6 -0
- package/dist/types/components/organisms/modal/confirm.d.ts +6 -0
- package/dist/types/components/organisms/modal/delete.d.ts +4 -0
- package/dist/types/components/organisms/modal/error.d.ts +4 -0
- package/dist/types/components/organisms/modal/index.d.ts +14 -0
- package/dist/types/components/organisms/modal/info.d.ts +4 -0
- package/dist/types/components/organisms/modal/type.d.ts +11 -0
- package/dist/types/components/organisms/table/column.d.ts +20 -0
- package/dist/types/components/organisms/table/components/cell/currencyCell.d.ts +7 -0
- package/dist/types/components/organisms/table/components/cell/dateCell.d.ts +6 -0
- package/dist/types/components/organisms/table/components/cell/index.d.ts +10 -0
- package/dist/types/components/organisms/table/components/cell/status.d.ts +8 -0
- package/dist/types/components/organisms/table/components/expandIcon.d.ts +7 -0
- package/dist/types/components/organisms/table/components/headerTitle.d.ts +10 -0
- package/dist/types/components/organisms/table/config.d.ts +8 -0
- package/dist/types/components/organisms/table/dndSort/context.d.ts +6 -0
- package/dist/types/components/organisms/table/dndSort/dragHandle.d.ts +1 -0
- package/dist/types/components/organisms/table/dndSort/index.d.ts +3 -0
- package/dist/types/components/organisms/table/dndSort/provider.d.ts +10 -0
- package/dist/types/components/organisms/table/dndSort/row.d.ts +6 -0
- package/dist/types/components/organisms/table/index.d.ts +30 -0
- package/dist/types/components/organisms/table/pagination/components.d.ts +18 -0
- package/dist/types/components/organisms/table/pagination/usePagination.d.ts +22 -0
- package/dist/types/configs/constructors/AbrplusUIKit.d.ts +17 -0
- package/dist/types/configs/constructors/index.d.ts +1 -0
- package/dist/types/configs/index.d.ts +6 -0
- package/dist/types/configs/locales/en.d.ts +1030 -0
- package/dist/types/configs/locales/fa.d.ts +1031 -0
- package/dist/types/configs/locales/i18nextTFunction.d.ts +5 -0
- package/dist/types/configs/locales/index.d.ts +10 -0
- package/dist/types/configs/providers/AbrplusUIKitProvider.d.ts +11 -0
- package/dist/types/configs/providers/index.d.ts +1 -0
- package/dist/types/configs/tailwindcss/index.d.ts +103 -0
- package/dist/types/configs/theme/colors.d.ts +114 -0
- package/dist/types/configs/theme/index.d.ts +1 -0
- package/dist/types/configs/types/index.d.ts +98 -0
- package/dist/types/constants/chartColors.d.ts +1 -0
- package/dist/types/constants/datepickerColors.d.ts +2 -0
- package/dist/types/constants/dimantions.d.ts +12 -0
- package/dist/types/constants/enum.d.ts +5 -0
- package/dist/types/constants/index.d.ts +3 -0
- package/dist/types/constants/variables.d.ts +2 -0
- package/dist/types/hooks/index.d.ts +6 -0
- package/dist/types/hooks/useAntConfig.d.ts +24 -0
- package/dist/types/hooks/useDebounce.d.ts +1 -0
- package/dist/types/hooks/useInteractions.d.ts +15 -0
- package/dist/types/hooks/useLocalStorageState.d.ts +3 -0
- package/dist/types/hooks/useObserveWindow.d.ts +9 -0
- package/dist/types/hooks/useWindowDimensions.d.ts +16 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/main.d.ts +3 -0
- package/dist/types/molecules.d.ts +2 -0
- package/dist/types/organisms.d.ts +2 -0
- package/dist/types/provider.d.ts +2 -0
- package/dist/types/theme.d.ts +1 -0
- package/dist/types/utilities/batch.d.ts +9 -0
- package/dist/types/utilities/createIcomoonIconSet.d.ts +9 -0
- package/dist/types/utilities/deepMerge.d.ts +1 -0
- package/dist/types/utilities/getErrorMessage.d.ts +1 -0
- package/dist/types/utilities/index.d.ts +7 -0
- package/dist/types/utilities/isPersian.d.ts +1 -0
- package/dist/types/utilities/mmss.d.ts +1 -0
- package/dist/types/utilities/testUtils/index.d.ts +3 -0
- package/dist/types/utilities/testUtils/withReactQuery.d.ts +2 -0
- package/dist/types/utilities/testUtils/withReactRouter.d.ts +2 -0
- package/package.json +195 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const antd = require("antd");
|
|
4
|
+
const tailwindMerge = require("tailwind-merge");
|
|
5
|
+
const Avatar = ({ className, ...props }) => {
|
|
6
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { ...props, className: tailwindMerge.twMerge("bg-light-7 border-primary-light-3", className) });
|
|
7
|
+
};
|
|
8
|
+
const Group = ({ className, max, ...props }) => {
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar.Group, { max, ...props, className: tailwindMerge.twMerge(className) });
|
|
10
|
+
};
|
|
11
|
+
Avatar.Group = Group;
|
|
12
|
+
exports.Avatar = Avatar;
|
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { F as Flex, T as Text, I as Icon, a as Tooltip$1, R as Render, L as Loading } from "./index-C24zbKLS.js";
|
|
3
|
+
import { c as colors, A as AbrplusUIKit } from "./colors-CztsZ6e_.js";
|
|
4
|
+
import { twMerge } from "tailwind-merge";
|
|
5
|
+
function uncapitalize(value) {
|
|
6
|
+
return value.slice(0, 1).toLowerCase() + value.slice(1);
|
|
7
|
+
}
|
|
8
|
+
function batch(components) {
|
|
9
|
+
const assignees = Object.assign({}, { ...components });
|
|
10
|
+
return new Proxy(assignees, {
|
|
11
|
+
get(target, property) {
|
|
12
|
+
const safeTarget = Object.freeze({
|
|
13
|
+
...target,
|
|
14
|
+
[Symbol.toPrimitive]() {
|
|
15
|
+
return "Error: Attempted to render object as a JSX";
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
if (property in safeTarget) {
|
|
19
|
+
return safeTarget[property];
|
|
20
|
+
}
|
|
21
|
+
const origProperty = uncapitalize(property);
|
|
22
|
+
if (origProperty in safeTarget) {
|
|
23
|
+
return safeTarget[origProperty];
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const TooltipTitle = ({ title, iconName }) => /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 8, children: [
|
|
30
|
+
/* @__PURE__ */ jsx(Text, { size: 14, color: colors.white_ff, children: title }),
|
|
31
|
+
iconName && /* @__PURE__ */ jsx(Icon, { name: iconName })
|
|
32
|
+
] });
|
|
33
|
+
const Tooltip = ({ children, title, iconName, ...rest }) => {
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
Tooltip$1,
|
|
36
|
+
{
|
|
37
|
+
title: typeof title === "string" ? /* @__PURE__ */ jsx(TooltipTitle, { title, iconName }) : title,
|
|
38
|
+
...rest,
|
|
39
|
+
children
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
const fontSizePicker = {
|
|
44
|
+
block: "text-[16px]",
|
|
45
|
+
medium: "text-[16px]",
|
|
46
|
+
small: "text-[12px]"
|
|
47
|
+
};
|
|
48
|
+
const paddingPicker = (hasIcon) => ({
|
|
49
|
+
start: {
|
|
50
|
+
block: `pe-4 ${hasIcon ? "ps-3" : "ps-4"} `,
|
|
51
|
+
medium: `pe-4 ${hasIcon ? "ps-3" : "ps-4"} `,
|
|
52
|
+
small: `pe-3 ps-[8px]`
|
|
53
|
+
},
|
|
54
|
+
end: {
|
|
55
|
+
block: `ps-4 pe-3`,
|
|
56
|
+
medium: `ps-4 pe-3`,
|
|
57
|
+
small: `ps-4 pe-3`
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const buttonDefaultClasses = "flex relative select-none w-fit appearance-none flex-row items-center justify-center gap-2 whitespace-nowrap rounded text-center outline-none";
|
|
61
|
+
const ActionButton = ({
|
|
62
|
+
style,
|
|
63
|
+
height,
|
|
64
|
+
mode,
|
|
65
|
+
children,
|
|
66
|
+
iconName,
|
|
67
|
+
disabled,
|
|
68
|
+
className,
|
|
69
|
+
iconPosition = "start",
|
|
70
|
+
isLoading,
|
|
71
|
+
lang = "fa",
|
|
72
|
+
...rest
|
|
73
|
+
}) => {
|
|
74
|
+
const appName = AbrplusUIKit.config().getAppName();
|
|
75
|
+
const getColor = () => {
|
|
76
|
+
if ((disabled || isLoading) && appName) {
|
|
77
|
+
if (appName === "home" || appName === "sandbox" || appName === "bi" || appName === "storybook")
|
|
78
|
+
return colors["sales"]["action_light_2"];
|
|
79
|
+
return colors[appName]["action_light_2"];
|
|
80
|
+
}
|
|
81
|
+
return colors.white_ff;
|
|
82
|
+
};
|
|
83
|
+
const getColorClass = () => {
|
|
84
|
+
if (!appName) return;
|
|
85
|
+
const data = {
|
|
86
|
+
bi: twMerge("bg-sales-action hover:bg-sales-action-light-1 active:bg-sales-action-dark-1"),
|
|
87
|
+
call: twMerge("bg-call-action hover:bg-call-action-light-1 active:bg-call-action-dark-1"),
|
|
88
|
+
club: twMerge("bg-club-action hover:bg-club-action-light-1 active:bg-club-action-dark-1"),
|
|
89
|
+
marketing: twMerge(
|
|
90
|
+
"bg-marketing-action hover:bg-marketing-action-light-1 active:bg-marketing-action-dark-1"
|
|
91
|
+
),
|
|
92
|
+
sales: twMerge("bg-sales-action hover:bg-sales-action-light-1 active:bg-sales-action-dark-1"),
|
|
93
|
+
team: twMerge("bg-team-action hover:bg-team-action-light-1 active:bg-team-action-dark-1"),
|
|
94
|
+
rayan: twMerge("bg-rayan-action hover:bg-rayan-action-light-1 active:bg-rayan-action-dark-1")
|
|
95
|
+
};
|
|
96
|
+
return data?.[appName] || data["sales"];
|
|
97
|
+
};
|
|
98
|
+
return /* @__PURE__ */ jsxs(
|
|
99
|
+
"button",
|
|
100
|
+
{
|
|
101
|
+
lang,
|
|
102
|
+
style: {
|
|
103
|
+
height: height || 34,
|
|
104
|
+
...style
|
|
105
|
+
},
|
|
106
|
+
className: twMerge(
|
|
107
|
+
"bg-repo disabled:bg-light-6 ",
|
|
108
|
+
getColorClass(),
|
|
109
|
+
paddingPicker(!!iconName)[iconPosition][mode || "block"],
|
|
110
|
+
fontSizePicker[mode || "block"],
|
|
111
|
+
buttonDefaultClasses,
|
|
112
|
+
mode === "block" && "w-full",
|
|
113
|
+
(disabled || isLoading) && "cursor-not-allowed border-light-6",
|
|
114
|
+
className
|
|
115
|
+
),
|
|
116
|
+
disabled: disabled || isLoading,
|
|
117
|
+
...rest,
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ jsx(Render, { when: isLoading, children: /* @__PURE__ */ jsx(Flex, { className: "absolute", children: /* @__PURE__ */ jsx(Loading, { isLoading: true, size: 16 }) }) }),
|
|
120
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) }),
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
|
+
Text,
|
|
123
|
+
{
|
|
124
|
+
lang,
|
|
125
|
+
weight: "medium",
|
|
126
|
+
className: fontSizePicker[mode || "block"],
|
|
127
|
+
color: getColor(),
|
|
128
|
+
children
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
const IconButton = ({
|
|
137
|
+
style,
|
|
138
|
+
height = 34,
|
|
139
|
+
iconName,
|
|
140
|
+
disabled,
|
|
141
|
+
className,
|
|
142
|
+
iconPosition = "start",
|
|
143
|
+
iconProps,
|
|
144
|
+
color,
|
|
145
|
+
...rest
|
|
146
|
+
}) => {
|
|
147
|
+
return /* @__PURE__ */ jsx(
|
|
148
|
+
"button",
|
|
149
|
+
{
|
|
150
|
+
style: {
|
|
151
|
+
height,
|
|
152
|
+
...style
|
|
153
|
+
},
|
|
154
|
+
className: twMerge(
|
|
155
|
+
buttonDefaultClasses,
|
|
156
|
+
"h-[34px] w-[34px] p-4",
|
|
157
|
+
"bg-light-1 border-primary-light-3 border",
|
|
158
|
+
"hover:bg-white-ff hover:border-primary-light-2",
|
|
159
|
+
"active:bg-light-6 active:border-primary-light-2",
|
|
160
|
+
"disabled:text-primary-light-2 disabled:bg-light-6 disabled:border-light-6",
|
|
161
|
+
disabled && "border-light-6 cursor-not-allowed",
|
|
162
|
+
className
|
|
163
|
+
),
|
|
164
|
+
disabled,
|
|
165
|
+
...rest,
|
|
166
|
+
children: iconProps?.renderIcon ? iconProps.renderIcon : /* @__PURE__ */ jsx(
|
|
167
|
+
Icon,
|
|
168
|
+
{
|
|
169
|
+
name: iconName,
|
|
170
|
+
color: disabled ? colors.primary_light_3 : color ?? colors.primary,
|
|
171
|
+
...iconProps
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
const NegativeButton = ({
|
|
178
|
+
style,
|
|
179
|
+
height,
|
|
180
|
+
mode,
|
|
181
|
+
children,
|
|
182
|
+
iconName,
|
|
183
|
+
disabled,
|
|
184
|
+
className,
|
|
185
|
+
iconPosition = "start",
|
|
186
|
+
isLoading,
|
|
187
|
+
lang = "fa",
|
|
188
|
+
variant = "outline",
|
|
189
|
+
// Default variant
|
|
190
|
+
...rest
|
|
191
|
+
}) => {
|
|
192
|
+
const getColor = () => {
|
|
193
|
+
if (disabled || isLoading) {
|
|
194
|
+
return colors.primary_light_2;
|
|
195
|
+
} else if (variant === "contain") {
|
|
196
|
+
return colors.white_ff;
|
|
197
|
+
}
|
|
198
|
+
return colors.negative;
|
|
199
|
+
};
|
|
200
|
+
const outlineClasses = "hover:bg-negative-light-1 active:bg-negative-dark-1 [&_p]:hover:!text-white-ff [&_*]:hover:fill-white-ff disabled:bg-light-6 bg-transparent border-negative hover:border-negative-light-1 active:border-negative-dark-1 disabled:light-6 border-[2px] border-solid";
|
|
201
|
+
const containClasses = "bg-negative hover:bg-negative-light-1 active:bg-negative-dark-1 disabled:bg-light-6 border-transparent";
|
|
202
|
+
const buttonVariantClasses = variant === "contain" ? containClasses : outlineClasses;
|
|
203
|
+
return /* @__PURE__ */ jsxs(
|
|
204
|
+
"button",
|
|
205
|
+
{
|
|
206
|
+
lang,
|
|
207
|
+
style: {
|
|
208
|
+
height: height || 34,
|
|
209
|
+
...style
|
|
210
|
+
},
|
|
211
|
+
className: twMerge(
|
|
212
|
+
buttonDefaultClasses,
|
|
213
|
+
buttonVariantClasses,
|
|
214
|
+
paddingPicker(!!iconName)[iconPosition][mode || "block"],
|
|
215
|
+
fontSizePicker[mode || "block"],
|
|
216
|
+
(disabled || isLoading) && "cursor-not-allowed",
|
|
217
|
+
className
|
|
218
|
+
),
|
|
219
|
+
disabled: disabled || isLoading,
|
|
220
|
+
...rest,
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ jsx(Render, { when: isLoading, children: /* @__PURE__ */ jsx(Flex, { className: "absolute", children: /* @__PURE__ */ jsx(Loading, { isLoading: true, size: 16 }) }) }),
|
|
223
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(
|
|
224
|
+
Icon,
|
|
225
|
+
{
|
|
226
|
+
name: iconName,
|
|
227
|
+
className: twMerge(fontSizePicker[mode || "block"]),
|
|
228
|
+
color: getColor()
|
|
229
|
+
}
|
|
230
|
+
) }),
|
|
231
|
+
/* @__PURE__ */ jsx(Text, { weight: "medium", size: 16, color: getColor(), lang, children }),
|
|
232
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
};
|
|
237
|
+
const PrimaryButton = ({
|
|
238
|
+
style,
|
|
239
|
+
height = 34,
|
|
240
|
+
mode,
|
|
241
|
+
children,
|
|
242
|
+
iconName,
|
|
243
|
+
disabled,
|
|
244
|
+
className,
|
|
245
|
+
iconPosition = "start",
|
|
246
|
+
isLoading,
|
|
247
|
+
lang = "fa",
|
|
248
|
+
textSize,
|
|
249
|
+
...rest
|
|
250
|
+
}) => {
|
|
251
|
+
const getColor = () => {
|
|
252
|
+
if (disabled || isLoading) {
|
|
253
|
+
return colors.primary_light_2;
|
|
254
|
+
}
|
|
255
|
+
return colors.white_ff;
|
|
256
|
+
};
|
|
257
|
+
return /* @__PURE__ */ jsxs(
|
|
258
|
+
"button",
|
|
259
|
+
{
|
|
260
|
+
lang,
|
|
261
|
+
style: { height, ...style },
|
|
262
|
+
className: twMerge(
|
|
263
|
+
"bg-primary hover:bg-primary-light-1 active:bg-primary-dark-1 disabled:bg-light-6",
|
|
264
|
+
paddingPicker(!!iconName)[iconPosition][mode || "block"],
|
|
265
|
+
fontSizePicker[mode || "block"],
|
|
266
|
+
buttonDefaultClasses,
|
|
267
|
+
mode === "block" && "w-full",
|
|
268
|
+
(disabled || isLoading) && "cursor-not-allowed border-light-6",
|
|
269
|
+
className
|
|
270
|
+
),
|
|
271
|
+
disabled: disabled || isLoading,
|
|
272
|
+
...rest,
|
|
273
|
+
children: [
|
|
274
|
+
/* @__PURE__ */ jsx(Render, { when: isLoading, children: /* @__PURE__ */ jsx(Flex, { className: "absolute", children: /* @__PURE__ */ jsx(Loading, { isLoading: true, size: 16 }) }) }),
|
|
275
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) }),
|
|
276
|
+
/* @__PURE__ */ jsx(
|
|
277
|
+
Text,
|
|
278
|
+
{
|
|
279
|
+
lang,
|
|
280
|
+
weight: "medium",
|
|
281
|
+
className: twMerge(
|
|
282
|
+
"text-white-ff",
|
|
283
|
+
(disabled || isLoading) && "text-primary-light-2",
|
|
284
|
+
fontSizePicker[mode || "block"]
|
|
285
|
+
),
|
|
286
|
+
size: textSize,
|
|
287
|
+
children
|
|
288
|
+
}
|
|
289
|
+
),
|
|
290
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
};
|
|
295
|
+
const SecondaryButton = ({
|
|
296
|
+
style,
|
|
297
|
+
height = 34,
|
|
298
|
+
mode,
|
|
299
|
+
children,
|
|
300
|
+
iconName,
|
|
301
|
+
disabled,
|
|
302
|
+
className,
|
|
303
|
+
iconPosition = "start",
|
|
304
|
+
isLoading,
|
|
305
|
+
lang = "fa",
|
|
306
|
+
...rest
|
|
307
|
+
}) => {
|
|
308
|
+
const getColor = () => {
|
|
309
|
+
if (disabled || isLoading) {
|
|
310
|
+
return colors.primary_light_2;
|
|
311
|
+
}
|
|
312
|
+
return colors.primary;
|
|
313
|
+
};
|
|
314
|
+
return /* @__PURE__ */ jsxs(
|
|
315
|
+
"button",
|
|
316
|
+
{
|
|
317
|
+
lang,
|
|
318
|
+
style: { height, ...style },
|
|
319
|
+
className: twMerge(
|
|
320
|
+
"bg-transparent hover:bg-primary-light-1 active:bg-primary-dark-1 disabled:bg-light-6 [&_p]:text-primary [&_p]:hover:text-white-ff [&_svg]:hover:!fill-white-ff",
|
|
321
|
+
"border-[2px] border-solid border-primary hover:border-primary-light-1 active:border-primary-dark-1 disabled:bg-light-6",
|
|
322
|
+
paddingPicker(!!iconName)[iconPosition][mode || "block"],
|
|
323
|
+
fontSizePicker[mode || "block"],
|
|
324
|
+
buttonDefaultClasses,
|
|
325
|
+
(disabled || isLoading) && "cursor-not-allowed",
|
|
326
|
+
className
|
|
327
|
+
),
|
|
328
|
+
disabled: disabled || isLoading,
|
|
329
|
+
...rest,
|
|
330
|
+
children: [
|
|
331
|
+
/* @__PURE__ */ jsx(Render, { when: isLoading, children: /* @__PURE__ */ jsx(Flex, { className: "absolute", children: /* @__PURE__ */ jsx(Loading, { isLoading: true, size: 16 }) }) }),
|
|
332
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) }),
|
|
333
|
+
/* @__PURE__ */ jsx(Text, { lang, weight: "medium", className: fontSizePicker[mode || "block"], children }),
|
|
334
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
|
|
335
|
+
]
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
};
|
|
339
|
+
const SecondaryQuietButton = ({
|
|
340
|
+
style,
|
|
341
|
+
height,
|
|
342
|
+
mode,
|
|
343
|
+
children,
|
|
344
|
+
iconName,
|
|
345
|
+
disabled,
|
|
346
|
+
className,
|
|
347
|
+
iconPosition = "start",
|
|
348
|
+
isLoading,
|
|
349
|
+
lang = "fa",
|
|
350
|
+
...rest
|
|
351
|
+
}) => {
|
|
352
|
+
const getColor = () => {
|
|
353
|
+
if (disabled || isLoading) {
|
|
354
|
+
return colors.primary_light_2;
|
|
355
|
+
}
|
|
356
|
+
return colors.primary;
|
|
357
|
+
};
|
|
358
|
+
return /* @__PURE__ */ jsxs(
|
|
359
|
+
"button",
|
|
360
|
+
{
|
|
361
|
+
lang,
|
|
362
|
+
style: {
|
|
363
|
+
height: height || 34,
|
|
364
|
+
...style
|
|
365
|
+
},
|
|
366
|
+
className: twMerge(
|
|
367
|
+
"hover:bg-light-6 active:bg-light-7 disabled:light-6 bg-transparent",
|
|
368
|
+
paddingPicker(!!iconName)[iconPosition][mode || "block"],
|
|
369
|
+
fontSizePicker[mode || "block"],
|
|
370
|
+
buttonDefaultClasses,
|
|
371
|
+
(disabled || isLoading) && "cursor-not-allowed ",
|
|
372
|
+
className
|
|
373
|
+
),
|
|
374
|
+
disabled: disabled || isLoading,
|
|
375
|
+
...rest,
|
|
376
|
+
children: [
|
|
377
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) }),
|
|
378
|
+
/* @__PURE__ */ jsx(
|
|
379
|
+
Text,
|
|
380
|
+
{
|
|
381
|
+
lang,
|
|
382
|
+
weight: "medium",
|
|
383
|
+
className: fontSizePicker[mode || "block"],
|
|
384
|
+
color: getColor(),
|
|
385
|
+
children
|
|
386
|
+
}
|
|
387
|
+
),
|
|
388
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
|
|
389
|
+
]
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
};
|
|
393
|
+
const TertiaryButton = ({
|
|
394
|
+
style,
|
|
395
|
+
height,
|
|
396
|
+
mode,
|
|
397
|
+
children,
|
|
398
|
+
iconName,
|
|
399
|
+
disabled,
|
|
400
|
+
className,
|
|
401
|
+
iconPosition = "start",
|
|
402
|
+
isLoading,
|
|
403
|
+
lang = "fa",
|
|
404
|
+
...rest
|
|
405
|
+
}) => {
|
|
406
|
+
const getColor = () => {
|
|
407
|
+
if (disabled || isLoading) {
|
|
408
|
+
return colors.primary_light_2;
|
|
409
|
+
}
|
|
410
|
+
return colors.primary_dark_1;
|
|
411
|
+
};
|
|
412
|
+
return /* @__PURE__ */ jsxs(
|
|
413
|
+
"button",
|
|
414
|
+
{
|
|
415
|
+
lang,
|
|
416
|
+
style: {
|
|
417
|
+
height: height || 34,
|
|
418
|
+
...style
|
|
419
|
+
},
|
|
420
|
+
className: twMerge(
|
|
421
|
+
"bg-light-1 hover:bg-white-ff active:light-6 disabled:light-6",
|
|
422
|
+
"border-primary-light-3 hover:border-primary-light-2 active:bg-primary-light-2 disabled:light-6 border-[1px] border-solid",
|
|
423
|
+
paddingPicker(!!iconName)[iconPosition][mode || "block"],
|
|
424
|
+
fontSizePicker[mode || "block"],
|
|
425
|
+
buttonDefaultClasses,
|
|
426
|
+
(disabled || isLoading) && "cursor-not-allowed",
|
|
427
|
+
className
|
|
428
|
+
),
|
|
429
|
+
disabled: disabled || isLoading,
|
|
430
|
+
...rest,
|
|
431
|
+
children: [
|
|
432
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) }),
|
|
433
|
+
/* @__PURE__ */ jsx(
|
|
434
|
+
Text,
|
|
435
|
+
{
|
|
436
|
+
lang,
|
|
437
|
+
weight: "medium",
|
|
438
|
+
className: fontSizePicker[mode || "block"],
|
|
439
|
+
color: getColor(),
|
|
440
|
+
children
|
|
441
|
+
}
|
|
442
|
+
),
|
|
443
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(Icon, { name: iconName, className: fontSizePicker[mode || "block"], color: getColor() }) })
|
|
444
|
+
]
|
|
445
|
+
}
|
|
446
|
+
);
|
|
447
|
+
};
|
|
448
|
+
const TextButton = ({
|
|
449
|
+
style,
|
|
450
|
+
height = 34,
|
|
451
|
+
mode,
|
|
452
|
+
children,
|
|
453
|
+
iconName,
|
|
454
|
+
disabled,
|
|
455
|
+
className,
|
|
456
|
+
iconPosition = "start",
|
|
457
|
+
isLoading,
|
|
458
|
+
lang = "fa",
|
|
459
|
+
underline,
|
|
460
|
+
textProps,
|
|
461
|
+
startIconSize,
|
|
462
|
+
endIconSize,
|
|
463
|
+
...rest
|
|
464
|
+
}) => {
|
|
465
|
+
const getColor = () => {
|
|
466
|
+
if (disabled || isLoading) {
|
|
467
|
+
return colors.primary_light_2;
|
|
468
|
+
}
|
|
469
|
+
return colors.black;
|
|
470
|
+
};
|
|
471
|
+
return /* @__PURE__ */ jsxs(
|
|
472
|
+
"button",
|
|
473
|
+
{
|
|
474
|
+
lang,
|
|
475
|
+
style: { height, ...style },
|
|
476
|
+
className: twMerge(
|
|
477
|
+
"disabled:bg-light-6 border-none hover:bg-none focus:bg-none",
|
|
478
|
+
paddingPicker(!!iconName)[iconPosition][mode || "block"],
|
|
479
|
+
fontSizePicker[mode || "block"],
|
|
480
|
+
buttonDefaultClasses,
|
|
481
|
+
mode === "block" && "w-full",
|
|
482
|
+
(disabled || isLoading) && "border-light-6 cursor-not-allowed",
|
|
483
|
+
className
|
|
484
|
+
),
|
|
485
|
+
disabled: disabled || isLoading,
|
|
486
|
+
...rest,
|
|
487
|
+
children: [
|
|
488
|
+
/* @__PURE__ */ jsx(Render, { when: isLoading, children: /* @__PURE__ */ jsx(Flex, { className: "absolute", children: /* @__PURE__ */ jsx(Loading, { isLoading: true, size: 16 }) }) }),
|
|
489
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "start", children: iconName && /* @__PURE__ */ jsx(
|
|
490
|
+
Icon,
|
|
491
|
+
{
|
|
492
|
+
size: startIconSize,
|
|
493
|
+
name: iconName,
|
|
494
|
+
className: fontSizePicker[mode || "block"],
|
|
495
|
+
color: getColor()
|
|
496
|
+
}
|
|
497
|
+
) }),
|
|
498
|
+
/* @__PURE__ */ jsx(
|
|
499
|
+
Text,
|
|
500
|
+
{
|
|
501
|
+
lang,
|
|
502
|
+
weight: "medium",
|
|
503
|
+
className: twMerge(
|
|
504
|
+
(disabled || isLoading) && "text-primary-light-2",
|
|
505
|
+
fontSizePicker[mode || "block"],
|
|
506
|
+
underline && "underline"
|
|
507
|
+
),
|
|
508
|
+
...textProps,
|
|
509
|
+
children
|
|
510
|
+
}
|
|
511
|
+
),
|
|
512
|
+
/* @__PURE__ */ jsx(Render, { when: iconPosition === "end", children: iconName && /* @__PURE__ */ jsx(
|
|
513
|
+
Icon,
|
|
514
|
+
{
|
|
515
|
+
size: endIconSize,
|
|
516
|
+
name: iconName,
|
|
517
|
+
className: fontSizePicker[mode || "block"],
|
|
518
|
+
color: getColor()
|
|
519
|
+
}
|
|
520
|
+
) })
|
|
521
|
+
]
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
};
|
|
525
|
+
const Button = batch({
|
|
526
|
+
Primary: PrimaryButton,
|
|
527
|
+
Secondary: SecondaryButton,
|
|
528
|
+
Tertiary: TertiaryButton,
|
|
529
|
+
SecondaryQuiet: SecondaryQuietButton,
|
|
530
|
+
Icon: IconButton,
|
|
531
|
+
Negative: NegativeButton,
|
|
532
|
+
Action: ActionButton,
|
|
533
|
+
Text: TextButton
|
|
534
|
+
});
|
|
535
|
+
export {
|
|
536
|
+
Button as B,
|
|
537
|
+
IconButton as I,
|
|
538
|
+
Tooltip as T,
|
|
539
|
+
buttonDefaultClasses as a,
|
|
540
|
+
batch as b,
|
|
541
|
+
fontSizePicker as f,
|
|
542
|
+
paddingPicker as p
|
|
543
|
+
};
|