ar-design 0.2.80 → 0.2.82

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 (54) hide show
  1. package/dist/assets/css/components/data-display/chip/chip.css +1 -3
  2. package/dist/assets/css/components/form/checkbox/core/border.css +106 -74
  3. package/dist/assets/css/components/form/select/styles.css +1 -1
  4. package/dist/assets/css/components/form/switch/core/border.css +178 -59
  5. package/dist/assets/css/components/form/switch/styles.css +4 -8
  6. package/dist/assets/css/components/form/upload/preview-selected-files.css +5 -1
  7. package/dist/assets/css/core/ar-core.css +10 -2
  8. package/dist/assets/css/core/color-palette.css +111 -0
  9. package/dist/assets/css/core/variants/animation.css +90 -60
  10. package/dist/assets/css/core/variants/borderless/borderless.css +325 -122
  11. package/dist/assets/css/core/variants/dashed/dashed.css +323 -147
  12. package/dist/assets/css/core/variants/filled/styles.css +439 -0
  13. package/dist/assets/css/core/variants/outlined/styles.css +406 -0
  14. package/dist/assets/css/core/variants/surface/styles.css +263 -0
  15. package/dist/components/data-display/card/index.js +1 -1
  16. package/dist/components/data-display/chip/IProps.d.ts +2 -2
  17. package/dist/components/data-display/chip/index.js +2 -2
  18. package/dist/components/data-display/table/IProps.d.ts +2 -2
  19. package/dist/components/data-display/table/index.js +7 -7
  20. package/dist/components/feedback/popover/index.js +2 -2
  21. package/dist/components/feedback/popup/index.js +6 -6
  22. package/dist/components/feedback/progress/index.js +1 -1
  23. package/dist/components/form/button/IProps.d.ts +2 -2
  24. package/dist/components/form/button/index.js +2 -2
  25. package/dist/components/form/button-action/index.js +2 -2
  26. package/dist/components/form/checkbox/IProps.d.ts +2 -2
  27. package/dist/components/form/checkbox/index.js +2 -2
  28. package/dist/components/form/date-picker/Props.d.ts +1 -1
  29. package/dist/components/form/date-picker/index.js +2 -2
  30. package/dist/components/form/input/IProps.d.ts +2 -2
  31. package/dist/components/form/input/index.js +3 -3
  32. package/dist/components/form/input-tag/IProps.d.ts +1 -1
  33. package/dist/components/form/radio/IProps.d.ts +2 -2
  34. package/dist/components/form/radio/index.js +2 -2
  35. package/dist/components/form/select/Props.d.ts +5 -5
  36. package/dist/components/form/select/index.js +8 -6
  37. package/dist/components/form/switch/IProps.d.ts +2 -2
  38. package/dist/components/form/switch/index.js +2 -2
  39. package/dist/components/form/text-editor/IProps.d.ts +2 -2
  40. package/dist/components/form/text-editor/index.d.ts +1 -1
  41. package/dist/components/form/text-editor/index.js +3 -3
  42. package/dist/components/form/upload/PreviewSelectedFile.js +12 -2
  43. package/dist/components/form/upload/PreviewSelectedFiles.js +19 -7
  44. package/dist/components/form/upload/Props.d.ts +2 -3
  45. package/dist/components/form/upload/index.js +2 -3
  46. package/dist/components/icons/Compiler.js +37 -0
  47. package/dist/components/navigation/steps/index.js +1 -1
  48. package/dist/libs/infrastructure/shared/Utils.d.ts +10 -2
  49. package/dist/libs/infrastructure/shared/Utils.js +263 -2
  50. package/dist/libs/types/IGlobalProps.d.ts +13 -1
  51. package/dist/libs/types/index.d.ts +5 -3
  52. package/package.json +1 -1
  53. package/dist/assets/css/core/variants/filled/filled.css +0 -260
  54. package/dist/assets/css/core/variants/outlined/outlined.css +0 -206
@@ -220,7 +220,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
220
220
  ?.map((filter, fIndex) => {
221
221
  const name = typeof c.key !== "object" ? String(c.key) : String(c.key.field);
222
222
  return (React.createElement("div", null,
223
- React.createElement(Checkbox, { ref: (element) => (_filterCheckboxItems.current[fIndex] = element), label: filter.text, name: name, status: "primary", value: filter.value, checked: Array.isArray(checkboxSelectedParams?.[name]) &&
223
+ React.createElement(Checkbox, { ref: (element) => (_filterCheckboxItems.current[fIndex] = element), label: filter.text, name: name, color: "blue", value: filter.value, checked: Array.isArray(checkboxSelectedParams?.[name]) &&
224
224
  checkboxSelectedParams?.[name]?.some((f) => String(f.value) === String(filter.value)), onChange: async (event) => await handleCheckboxChange(event) })));
225
225
  }))));
226
226
  default:
@@ -347,7 +347,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
347
347
  return (React.createElement(Fragment, { key: `row-${index}` },
348
348
  React.createElement("tr", { key: `row-${index}` },
349
349
  selections && (React.createElement("td", { className: "sticky-left", "data-sticky-position": "left" },
350
- React.createElement(Checkbox, { ref: (element) => (_checkboxItems.current[index] = element), status: "primary", checked: selectionItems.some((selectionItem) => JSON.stringify(selectionItem) === JSON.stringify(item)), onChange: (event) => {
350
+ React.createElement(Checkbox, { ref: (element) => (_checkboxItems.current[index] = element), color: "blue", checked: selectionItems.some((selectionItem) => JSON.stringify(selectionItem) === JSON.stringify(item)), onChange: (event) => {
351
351
  if (event.target.checked)
352
352
  setSelectionItems((prev) => [...prev, item]);
353
353
  else
@@ -510,15 +510,15 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
510
510
  if (actions.import && actions.import.onClick)
511
511
  actions.import.onClick(formData, files);
512
512
  }, config: { buttons: { okay: "Yükle", cancel: "İptal" } }, windowBlur: true },
513
- React.createElement(Button, { variant: "outlined", status: "success", icon: { element: React.createElement(ARIcon, { icon: "Import", size: 16 }) }, tooltip: { text: actions.import.tooltip, direction: "top" } }))),
514
- actions.create && (React.createElement(Button, { variant: "outlined", status: "dark", icon: { element: React.createElement(ARIcon, { icon: "Add", size: 16 }) }, tooltip: { text: actions.create.tooltip, direction: "top" }, onClick: actions.create.onClick }))))))),
513
+ React.createElement(Button, { variant: "outlined", color: "green", icon: { element: React.createElement(ARIcon, { icon: "Import", size: 16 }) }, tooltip: { text: actions.import.tooltip, direction: "top" } }))),
514
+ actions.create && (React.createElement(Button, { variant: "outlined", icon: { element: React.createElement(ARIcon, { icon: "Add", size: 16 }) }, tooltip: { text: actions.create.tooltip, direction: "top" }, onClick: actions.create.onClick }))))))),
515
515
  React.createElement("div", { ref: _tableContent, className: "content", onScroll: handleScroll },
516
516
  React.createElement("table", { ref: ref },
517
517
  React.createElement("thead", null,
518
518
  React.createElement("tr", { key: "selection" },
519
519
  data.some((item) => _subrowSelector in item) && _subrowButton && (React.createElement("td", { style: { width: 0, minWidth: 0 } })),
520
520
  selections && (React.createElement("th", { className: "selection-col sticky-left", "data-sticky-position": "left" },
521
- React.createElement(Checkbox, { variant: "filled", status: "primary", checked: selectAll, onChange: (event) => {
521
+ React.createElement(Checkbox, { variant: "filled", color: "blue", checked: selectAll, onChange: (event) => {
522
522
  if (_checkboxItems.current.length > 0) {
523
523
  setSelectAll(event.target.checked);
524
524
  _checkboxItems.current.forEach((item) => {
@@ -551,7 +551,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
551
551
  }), ...(c.config?.sticky && {
552
552
  "data-sticky-position": c.config.sticky,
553
553
  }) }, c.key && (React.createElement("div", { className: "filter-field" },
554
- React.createElement(Input, { ref: (element) => (_searchTextInputs.current[cIndex] = element), variant: c.key && !c.filters ? "outlined" : "filled", status: "light", style: { height: "2rem" }, value: (config.isServerSide ? ssrValue : csrValue) ?? "", name: key, onInput: handleSearch, disabled: !c.key || !!c.filters }),
554
+ React.createElement(Input, { ref: (element) => (_searchTextInputs.current[cIndex] = element), variant: c.key && !c.filters ? "outlined" : "filled", style: { height: "2rem" }, value: (config.isServerSide ? ssrValue : csrValue) ?? "", name: key, onInput: handleSearch, disabled: !c.key || !!c.filters }),
555
555
  React.createElement("span", { ref: (element) => (_filterButton.current[cIndex] = element), onClick: (event) => {
556
556
  event.stopPropagation();
557
557
  // Temizlik...
@@ -574,7 +574,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
574
574
  setFilterCurrentIndex(cIndex);
575
575
  handleFilterPopupContent(c, dataType, cIndex);
576
576
  } },
577
- React.createElement(Button, { variant: "borderless", status: "dark", icon: {
577
+ React.createElement(Button, { variant: "borderless", icon: {
578
578
  element: (React.createElement(ARIcon, { viewBox: "0 0 16 16", size: 24, icon: "Filter", fill: "var(--dark)", strokeWidth: 0 })),
579
579
  } }))))));
580
580
  })))),
@@ -68,11 +68,11 @@ const Popover = ({ children, title, message, content, onConfirm, windowBlur, ful
68
68
  message && React.createElement("p", { className: "message" }, message),
69
69
  content && React.createElement("div", { className: "content" }, content),
70
70
  onConfirm && (React.createElement("div", { className: "footer" },
71
- React.createElement(Button, { status: "success", size: "small", onClick: () => {
71
+ React.createElement(Button, { color: "green", size: "small", onClick: () => {
72
72
  onConfirm(true);
73
73
  setOpen(false);
74
74
  } }, config?.buttons.okay ?? "Evet"),
75
- React.createElement(Button, { status: "light", size: "small", onClick: () => {
75
+ React.createElement(Button, { size: "small", onClick: () => {
76
76
  onConfirm(false);
77
77
  setOpen(false);
78
78
  } }, config?.buttons.cancel ?? "Hayır")))), document.body),
@@ -15,16 +15,16 @@ const Popup = ({ title, message, status, isOpen, buttons }) => {
15
15
  const _notificaitonPopupWrapperClassName = ["ar-notification-popup-wrapper"];
16
16
  const [className, setClassName] = useState(["ar-notification-popup", ""]);
17
17
  // methods
18
- const buttonStatus = () => {
18
+ const buttonColor = () => {
19
19
  switch (status) {
20
20
  case "success":
21
- return "success";
21
+ return "green";
22
22
  case "warning":
23
- return "warning";
23
+ return "orange";
24
24
  case "information":
25
- return "information";
25
+ return "teal";
26
26
  case "error":
27
- return "danger";
27
+ return "red";
28
28
  default:
29
29
  return "light";
30
30
  }
@@ -74,7 +74,7 @@ const Popup = ({ title, message, status, isOpen, buttons }) => {
74
74
  title,
75
75
  "!"),
76
76
  React.createElement("span", { className: "message" }, message)),
77
- React.createElement(Button, { variant: "filled", status: buttonStatus(), onClick: () => {
77
+ React.createElement(Button, { variant: "filled", color: buttonColor(), onClick: () => {
78
78
  (() => buttons?.okay?.onClick && buttons.okay?.onClick())();
79
79
  (() => {
80
80
  setIsPopupOpen && setIsPopupOpen((prev) => !prev);
@@ -13,7 +13,7 @@ const Progress = ({ value, reverse, isVisibleValue = false }) => {
13
13
  _status = !reverse ? "primary" : "warning";
14
14
  else if (value >= 76 && value <= 100)
15
15
  _status = !reverse ? "success" : "danger";
16
- _arProgressClassName.push(...Utils.GetClassName("filled", _status, { radius: "pill" }, undefined, undefined, undefined));
16
+ _arProgressClassName.push(...Utils.GetClassName("filled", _status, undefined, { radius: "pill" }, undefined, undefined, undefined));
17
17
  return (React.createElement("div", { className: "ar-progress" },
18
18
  React.createElement("div", { className: `ar-progress-bar ${_arProgressClassName.map((c) => c).join(" ")}` }),
19
19
  React.createElement("div", { className: `ar-progress-value ${_arProgressClassName.map((c) => c).join(" ")}`, style: {
@@ -1,5 +1,5 @@
1
- import { IBorder, IIcon, ISize, IStatus, IUpperCase, IVariant } from "../../../libs/types/IGlobalProps";
2
- interface IProps extends IVariant, IStatus, IBorder, IIcon, ISize, IUpperCase, React.ButtonHTMLAttributes<HTMLButtonElement> {
1
+ import { IBorder, IColors, IIcon, ISize, IUpperCase, IVariant } from "../../../libs/types/IGlobalProps";
2
+ interface IProps extends IVariant, IColors, IBorder, IIcon, ISize, IUpperCase, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color"> {
3
3
  /**
4
4
  * Bileşenin şekil varyantını belirtir ve genellikle sadece ikon için kullanılmalıdır.
5
5
  * İki seçenekten biri olabilir: "circle" veya "square".
@@ -3,11 +3,11 @@ import React, { useRef } from "react";
3
3
  import "../../../assets/css/components/form/button/styles.css";
4
4
  import Utils from "../../../libs/infrastructure/shared/Utils";
5
5
  import Tooltip from "../../feedback/tooltip";
6
- const Button = ({ children, variant = "filled", shape, status = "primary", border, size = "normal", tooltip, position, fullWidth, icon, upperCase, ...attributes }) => {
6
+ const Button = ({ children, variant = "filled", shape, color = "light", border = { radius: "sm" }, size = "normal", tooltip, position, fullWidth, icon, upperCase, ...attributes }) => {
7
7
  // refs
8
8
  const _button = useRef(null);
9
9
  const _arButtonClassName = ["ar-button"];
10
- _arButtonClassName.push(...Utils.GetClassName(variant, status, border, size, icon, attributes.className));
10
+ _arButtonClassName.push(...Utils.GetClassName(variant, undefined, color, border, size, icon, attributes.className));
11
11
  if (!children)
12
12
  _arButtonClassName.push("no-content");
13
13
  if (fullWidth)
@@ -60,9 +60,9 @@ const ButtonAction = ({ buttons }) => {
60
60
  }, [open]);
61
61
  return (React.createElement("div", { ref: _wrapper, className: "ar-button-action" },
62
62
  React.createElement("span", { ref: _button },
63
- React.createElement(Button, { variant: "borderless", status: "information", border: { radius: "none" }, icon: { element: React.createElement("span", { className: "dotted" }) }, onClick: () => setOpen((prev) => !prev) })),
63
+ React.createElement(Button, { variant: "borderless", color: "teal", border: { radius: "none" }, icon: { element: React.createElement("span", { className: "dotted" }) }, onClick: () => setOpen((prev) => !prev) })),
64
64
  open &&
65
- ReactDOM.createPortal(React.createElement("span", { ref: _list, className: "ar-action-buttons" }, buttons.map((button) => (React.createElement(Button, { variant: "borderless", status: "dark", onClick: button.onClick }, button.text)))), document.body)));
65
+ ReactDOM.createPortal(React.createElement("span", { ref: _list, className: "ar-action-buttons" }, buttons.map((button) => (React.createElement(Button, { variant: "borderless", onClick: button.onClick }, button.text)))), document.body)));
66
66
  };
67
67
  ButtonAction.displayName = "ButtonAction";
68
68
  export default ButtonAction;
@@ -1,5 +1,5 @@
1
- import { IBorder, ISize, IStatus, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
2
- interface IProps extends IVariant, IStatus, IBorder, ISize, IUpperCase, IValidation, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "type" | "size"> {
1
+ import { IBorder, IColors, ISize, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
2
+ interface IProps extends IVariant, IColors, IBorder, ISize, IUpperCase, IValidation, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "type" | "size" | "color"> {
3
3
  /**
4
4
  * Bileşenin başlığı veya etiket metnidir.
5
5
  *
@@ -2,12 +2,12 @@
2
2
  import Utils from "../../../libs/infrastructure/shared/Utils";
3
3
  import React, { forwardRef, useRef } from "react";
4
4
  import "../../../assets/css/components/form/checkbox/checkbox.css";
5
- const Checkbox = forwardRef(({ label, size = "normal", status, border = { radius: "sm" }, upperCase, ...attributes }, ref) => {
5
+ const Checkbox = forwardRef(({ label, size = "normal", color, border = { radius: "sm" }, upperCase, ...attributes }, ref) => {
6
6
  // refs
7
7
  const _checkbox = useRef(null);
8
8
  const _checkboxClassName = ["ar-checkbox"];
9
9
  const isChecked = attributes.checked ?? false;
10
- _checkboxClassName.push(...Utils.GetClassName("filled", isChecked ? status : "light", border, size, undefined, attributes.className));
10
+ _checkboxClassName.push(...Utils.GetClassName("filled", undefined, isChecked ? color : "light", border, size, undefined, attributes.className));
11
11
  return (React.createElement("div", { className: "ar-checkbox-wrapper" },
12
12
  React.createElement("label", null,
13
13
  React.createElement("input", { ref: ref, type: "checkbox", ...attributes, size: 0, onChange: (event) => {
@@ -37,5 +37,5 @@ type Props = {
37
37
  * ```
38
38
  */
39
39
  onChange: (value: string) => void;
40
- } & IVariant & IStatus & IBorder & ISize & IValidation & Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "onChange" | "size">;
40
+ } & IVariant & IStatus & IBorder & ISize & IValidation & Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "onChange" | "size" | "color">;
41
41
  export default Props;
@@ -132,7 +132,7 @@ const DatePicker = ({ onChange, isClock, validation, ...attributes }) => {
132
132
  onChange(inputDate.toISOString());
133
133
  };
134
134
  const okayButton = () => {
135
- return (React.createElement(Button, { variant: "borderless", status: "success", onClick: () => handleOk() }, "Tamam"));
135
+ return (React.createElement(Button, { variant: "borderless", color: "green", onClick: () => handleOk() }, "Tamam"));
136
136
  };
137
137
  const closeCalendar = () => {
138
138
  const { year, month, day, hours, minutes } = DATE.Parse(String(attributes.value), isClock);
@@ -249,7 +249,7 @@ const DatePicker = ({ onChange, isClock, validation, ...attributes }) => {
249
249
  attributes.placeholder && attributes.placeholder.length > 0 && (React.createElement("label", null,
250
250
  validation ? "* " : "",
251
251
  attributes.placeholder)),
252
- React.createElement(Input, { ref: _beginDate, ...attributes, value: DATE.ParseValue(String(attributes.value), isClock), type: isClock ? "datetime-local" : "date", onKeyDown: (event) => {
252
+ React.createElement(Input, { ref: _beginDate, value: DATE.ParseValue(String(attributes.value), isClock), type: isClock ? "datetime-local" : "date", ...attributes, onKeyDown: (event) => {
253
253
  if (event.code === "Space")
254
254
  event.preventDefault();
255
255
  else if (event.code === "Enter")
@@ -1,7 +1,7 @@
1
1
  import IButtonProps from "../button/IProps";
2
2
  import { Variants } from "../../../libs/types";
3
- import { IBorder, IIcon, ISize, IStatus, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
4
- interface IProps extends IVariant, IStatus, IBorder, IIcon, ISize, IUpperCase, IValidation, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size"> {
3
+ import { IBorder, IColors, IIcon, ISize, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
4
+ interface IProps extends IVariant, IColors, IBorder, IIcon, ISize, IUpperCase, IValidation, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size" | "color"> {
5
5
  /**
6
6
  * Bileşene entegre bir buton özelliği eklemek için kullanılır.
7
7
  *
@@ -3,7 +3,7 @@ import React, { forwardRef, useEffect, useState } from "react";
3
3
  import "../../../assets/css/components/form/input/input.css";
4
4
  import Button from "../button";
5
5
  import Utils from "../../../libs/infrastructure/shared/Utils";
6
- const Input = forwardRef(({ variant = "outlined", status = "light", size = "normal", icon, border = { radius: "sm" }, button, addon, upperCase, validation, ...attributes }, ref) => {
6
+ const Input = forwardRef(({ variant = "outlined", color = "light", size = "normal", icon, border = { radius: "sm" }, button, addon, upperCase, validation, ...attributes }, ref) => {
7
7
  // states
8
8
  const [value, setValue] = useState("");
9
9
  // variables
@@ -11,7 +11,7 @@ const Input = forwardRef(({ variant = "outlined", status = "light", size = "norm
11
11
  const _addonBeforeClassName = ["addon-before"];
12
12
  const _addonAfterClassName = ["addon-after"];
13
13
  const _inputClassName = [];
14
- _inputClassName.push(...Utils.GetClassName(variant, !Utils.IsNullOrEmpty(validation?.text) ? "danger" : status, border, size, icon, attributes.className));
14
+ _inputClassName.push(...Utils.GetClassName(variant, undefined, !Utils.IsNullOrEmpty(validation?.text) ? "red" : color, border, size, icon, attributes.className));
15
15
  // addon className
16
16
  if (addon) {
17
17
  _wrapperClassName.push("addon");
@@ -83,7 +83,7 @@ const Input = forwardRef(({ variant = "outlined", status = "light", size = "norm
83
83
  } }),
84
84
  validation?.text && React.createElement("span", { className: "validation" }, validation.text)),
85
85
  addon?.after && React.createElement("span", { className: _addonAfterClassName.map((c) => c).join(" ") }, addon?.after),
86
- button && (React.createElement(Button, { ...button, status: status, border: { radius: border.radius }, disabled: attributes.disabled }))));
86
+ button && React.createElement(Button, { ...button, border: { radius: border.radius }, disabled: attributes.disabled })));
87
87
  });
88
88
  Input.displayName = "Input";
89
89
  export default Input;
@@ -1,4 +1,4 @@
1
1
  import { IBorder, IIcon, ISize, IStatus, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
2
- interface IProps extends IVariant, IStatus, IBorder, IIcon, ISize, IUpperCase, IValidation, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size"> {
2
+ interface IProps extends IVariant, IStatus, IBorder, IIcon, ISize, IUpperCase, IValidation, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size" | "color"> {
3
3
  }
4
4
  export default IProps;
@@ -1,6 +1,6 @@
1
- import { IBorder, IIcon, ISize, IStatus, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
1
+ import { IBorder, IColors, IIcon, ISize, IStatus, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
2
2
  import { Status } from "../../../libs/types";
3
- interface IProps extends IVariant, IStatus, IBorder, IIcon, ISize, IUpperCase, IValidation, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size"> {
3
+ interface IProps extends IVariant, IStatus, IColors, IBorder, IIcon, ISize, IUpperCase, IValidation, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size" | "color"> {
4
4
  /**
5
5
  * Bileşenin başlığı veya etiket metnidir.
6
6
  *
@@ -2,12 +2,12 @@
2
2
  import React, { forwardRef, useRef } from "react";
3
3
  import "../../../assets/css/components/form/radio/radio.css";
4
4
  import Utils from "../../../libs/infrastructure/shared/Utils";
5
- const Radio = forwardRef(({ label, size = "normal", status, border = { radius: "sm" }, trace, upperCase, ...attributes }, ref) => {
5
+ const Radio = forwardRef(({ label, size = "normal", status, color, border = { radius: "sm" }, trace, upperCase, ...attributes }, ref) => {
6
6
  // refs
7
7
  const _checkbox = useRef(null);
8
8
  const _checkboxClassName = ["ar-radio"];
9
9
  const _traceClassName = ["trace", "filled"];
10
- _checkboxClassName.push(...Utils.GetClassName("filled", status, border, size, undefined, attributes.className));
10
+ _checkboxClassName.push(...Utils.GetClassName("filled", status, color, border, size, undefined, attributes.className));
11
11
  if (trace && Object.keys(trace).length > 0)
12
12
  _traceClassName.push(trace.color);
13
13
  return (React.createElement("div", { className: "ar-radio-wrapper" },
@@ -1,5 +1,5 @@
1
- import { Variants, Option, Status } from "../../../libs/types";
2
- import { IBorder, IDisabled, IIcon, ISize, IStatus, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
1
+ import { Variants, Option, Status, Color } from "../../../libs/types";
2
+ import { IBorder, IDisabled, IIcon, ISize, IColors, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
3
3
  export interface IMultiple {
4
4
  /**
5
5
  * Bileşenin durum (status) ayarlarını belirtir.
@@ -24,10 +24,10 @@ export interface IMultiple {
24
24
  * ```
25
25
  */
26
26
  status?: {
27
- color?: Status;
27
+ color?: Color;
28
28
  selected?: {
29
29
  variant?: Variants;
30
- color?: Status;
30
+ color?: Color;
31
31
  };
32
32
  };
33
33
  /**
@@ -138,4 +138,4 @@ export type Props = {
138
138
  * ```
139
139
  */
140
140
  placeholder?: string;
141
- } & (IMultiple | ISingle) & IVariant & IStatus & IBorder & IIcon & ISize & IUpperCase & IValidation & IDisabled;
141
+ } & (IMultiple | ISingle) & IVariant & IColors & IBorder & IIcon & ISize & IUpperCase & IValidation & IDisabled;
@@ -6,7 +6,7 @@ import Chip from "../../data-display/chip";
6
6
  import Checkbox from "../checkbox";
7
7
  import Utils from "../../../libs/infrastructure/shared/Utils";
8
8
  import ReactDOM from "react-dom";
9
- const Select = ({ variant = "outlined", status, border = { radius: "sm" }, options, value, onChange, onSearch, onClick, onCreate, multiple, placeholder, validation, upperCase, disabled, }) => {
9
+ const Select = ({ variant = "outlined", status, color, border = { radius: "sm" }, options, value, onChange, onSearch, onClick, onCreate, multiple, placeholder, validation, upperCase, disabled, }) => {
10
10
  const _selectionClassName = ["selections"];
11
11
  // refs
12
12
  const _arSelect = useRef(null);
@@ -25,7 +25,7 @@ const Select = ({ variant = "outlined", status, border = { radius: "sm" }, optio
25
25
  const [searchText, setSearchText] = useState("");
26
26
  const [singleInputText, setSingleInputText] = useState("");
27
27
  const [navigationIndex, setNavigationIndex] = useState(0);
28
- _selectionClassName.push(...Utils.GetClassName(variant, validation?.text ? "danger" : "light", border, undefined, undefined, undefined));
28
+ _selectionClassName.push(...Utils.GetClassName(variant, undefined, validation?.text ? "red" : "light", border, undefined, undefined, undefined));
29
29
  // methods
30
30
  const handleClickOutSide = (event) => {
31
31
  const target = event.target;
@@ -259,9 +259,11 @@ const Select = ({ variant = "outlined", status, border = { radius: "sm" }, optio
259
259
  setOptionsOpen((prev) => !prev);
260
260
  })();
261
261
  } },
262
- React.createElement("div", { className: "items" }, value.length > 0 ? (value.map((_value, index) => (React.createElement(Chip, { key: index, variant: status?.selected?.variant || "filled", status: status?.selected?.color || status?.color, text: _value.text })))) : (React.createElement("span", { className: "placeholder" },
262
+ React.createElement("div", { className: "items" }, value.length > 0 ? (value.map((_value, index) => (React.createElement(Chip, { key: index, variant: status?.selected?.variant || "filled", color: status?.selected?.color || status?.color, text: _value.text })))) : (React.createElement("span", { className: "placeholder" },
263
263
  validation ? "* " : "",
264
- placeholder))))) : (React.createElement(Input, { ref: _singleInput, variant: variant, status: !Utils.IsNullOrEmpty(validation?.text) ? "danger" : status, border: { radius: border.radius }, value: singleInputText, onClick: () => {
264
+ placeholder))))) : (React.createElement(Input, { ref: _singleInput, variant: variant, color: !Utils.IsNullOrEmpty(validation?.text) ? "red" : color,
265
+ // status={!Utils.IsNullOrEmpty(validation?.text) ? "danger" : status}
266
+ border: { radius: border.radius }, value: singleInputText, onClick: () => {
265
267
  onClick && onClick();
266
268
  (() => {
267
269
  setOptionsOpen((prev) => !prev);
@@ -290,7 +292,7 @@ const Select = ({ variant = "outlined", status, border = { radius: "sm" }, optio
290
292
  optionsOpen &&
291
293
  ReactDOM.createPortal(React.createElement("div", { ref: _options, className: "ar-select-options" },
292
294
  multiple && (React.createElement("div", { className: "search-field" },
293
- React.createElement(Input, { ref: _searchField, variant: "outlined", status: "light", placeholder: "Search...", value: searchText, onChange: (event) => setSearchText(event.target.value), onClick: (event) => event.stopPropagation() }))),
295
+ React.createElement(Input, { ref: _searchField, variant: "outlined", placeholder: "Search...", value: searchText, onChange: (event) => setSearchText(event.target.value), onClick: (event) => event.stopPropagation() }))),
294
296
  filteredOptions.length > 0 ? (React.createElement("ul", null,
295
297
  onCreate && !isSearchTextEqual && searchText.length > 0 && React.createElement("li", null, createField()),
296
298
  filteredOptions.map((option, index) => {
@@ -299,7 +301,7 @@ const Select = ({ variant = "outlined", status, border = { radius: "sm" }, optio
299
301
  event.stopPropagation();
300
302
  handleItemSelected(option);
301
303
  } },
302
- multiple && React.createElement(Checkbox, { checked: isItem, status: isItem ? "primary" : "light", disabled: true }),
304
+ multiple && React.createElement(Checkbox, { checked: isItem, color: isItem ? "blue" : "light", disabled: true }),
303
305
  React.createElement("span", null, option.text)));
304
306
  }))) : !onCreate ? (React.createElement("div", { className: "no-options-field" },
305
307
  React.createElement("span", { className: "text" }, "Herhangi bir kay\u0131t bulunumad\u0131."))) : (createField())), document.body)));
@@ -1,5 +1,5 @@
1
- import { IBorder, IDisabled, IIcon, ISize, IStatus, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
2
- interface IProps extends IVariant, IStatus, IBorder, IIcon, ISize, IUpperCase, IValidation, IDisabled, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size"> {
1
+ import { IBorder, IColors, IDisabled, IIcon, ISize, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
2
+ interface IProps extends IVariant, IColors, IBorder, IIcon, ISize, IUpperCase, IValidation, IDisabled, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size" | "color"> {
3
3
  /**
4
4
  * Bileşenin başlığı veya etiket metnidir.
5
5
  *
@@ -2,7 +2,7 @@
2
2
  import React, { useEffect, useRef, useState } from "react";
3
3
  import "../../../assets/css/components/form/switch/styles.css";
4
4
  import Utils from "../../../libs/infrastructure/shared/Utils";
5
- const Switch = ({ label, status = "primary", border = { radius: "pill" }, ...attributes }) => {
5
+ const Switch = ({ label, color, border = { radius: "pill" }, ...attributes }) => {
6
6
  // refs
7
7
  let _switch = useRef(null);
8
8
  const _inputClassName = [];
@@ -10,7 +10,7 @@ const Switch = ({ label, status = "primary", border = { radius: "pill" }, ...att
10
10
  // states
11
11
  const [checked, setChecked] = useState(attributes.checked ?? false);
12
12
  _inputClassName.push(attributes.checked ? "checked" : "unchecked");
13
- _switchClassName.push(...Utils.GetClassName("filled", attributes.checked ? status : "light", border, undefined, undefined, attributes.className));
13
+ _switchClassName.push(...Utils.GetClassName(undefined, undefined, attributes.checked ? color : "light", border, undefined, undefined, attributes.className));
14
14
  // useEffects
15
15
  useEffect(() => {
16
16
  setChecked(attributes.checked ?? false);
@@ -1,5 +1,5 @@
1
- import { IValidation } from "../../../libs/types/IGlobalProps";
2
- export interface IProps<T> extends IValidation {
1
+ import { IColors, IValidation } from "../../../libs/types/IGlobalProps";
2
+ export interface IProps<T> extends IValidation, IColors {
3
3
  /**
4
4
  * Bileşenin isim (name) değeridir.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import "../../../assets/css/components/form/text-editor/styles.css";
2
2
  import IProps from "./IProps";
3
3
  import React from "react";
4
- declare const TextEditor: <T extends object>({ name, value, onChange, dynamicList, height, validation, }: IProps<T>) => React.JSX.Element;
4
+ declare const TextEditor: <T extends object>({ color, name, value, onChange, dynamicList, height, validation, }: IProps<T>) => React.JSX.Element;
5
5
  export default TextEditor;
@@ -5,7 +5,7 @@ import Button from "../button";
5
5
  import React, { useEffect, useRef, useState } from "react";
6
6
  import Utils from "../../../libs/infrastructure/shared/Utils";
7
7
  import ReactDOM from "react-dom";
8
- const TextEditor = ({ name, value, onChange, dynamicList,
8
+ const TextEditor = ({ color = "light", name, value, onChange, dynamicList,
9
9
  // placeholder,
10
10
  height,
11
11
  // multilang,
@@ -38,7 +38,7 @@ validation, }) => {
38
38
  { command: "justifyRight", icon: "TextAlingRight", tooltip: "Align Right" },
39
39
  ];
40
40
  const _iframeClassName = [];
41
- _iframeClassName.push(...Utils.GetClassName("outlined", !Utils.IsNullOrEmpty(validation?.text) ? "danger" : "light", { radius: "sm" }, undefined, undefined, undefined));
41
+ _iframeClassName.push(...Utils.GetClassName("outlined", undefined, !Utils.IsNullOrEmpty(validation?.text) ? "red" : color, { radius: "sm" }, undefined, undefined, undefined));
42
42
  // methods
43
43
  const execCommand = (command) => {
44
44
  if (!_arIframe.current)
@@ -212,7 +212,7 @@ validation, }) => {
212
212
  }, []);
213
213
  return (React.createElement("div", { ref: _container, className: "ar-text-editor" },
214
214
  React.createElement("iframe", { ref: _arIframe, name: name, className: _iframeClassName.map((c) => c).join(" "), height: height }),
215
- React.createElement("div", { className: "toolbar" }, toolbarButtons.map(({ command, icon, tooltip }) => (React.createElement(Button, { key: command, type: "button", variant: "borderless", status: "secondary", border: { radius: "none" }, icon: { element: React.createElement(ARIcon, { icon: icon, size: 18, fill: "transparent" }) }, tooltip: {
215
+ React.createElement("div", { className: "toolbar" }, toolbarButtons.map(({ command, icon, tooltip }) => (React.createElement(Button, { key: command, type: "button", variant: "borderless", color: "teal", border: { radius: "none" }, icon: { element: React.createElement(ARIcon, { icon: icon, size: 18, fill: "transparent" }) }, tooltip: {
216
216
  text: tooltip,
217
217
  }, onClick: () => execCommand(command) })))),
218
218
  React.createElement("div", { className: "resize", onMouseDown: handleMouseDown }),
@@ -15,12 +15,22 @@ const PreviewSelectedFile = ({ selectedFile, handleFileToBase64, handleFileRemov
15
15
  return (selectedFile && (React.createElement("div", { className: "preview" },
16
16
  React.createElement("div", { className: "buttons" },
17
17
  React.createElement("div", null,
18
- React.createElement(Button, { variant: "borderless", icon: { element: React.createElement(ARIcon, { variant: "fill", icon: "Eye", fill: "currentColor" }) }, onClick: (event) => {
18
+ React.createElement(Button, { variant: "borderless", type: "button", icon: { element: React.createElement(ARIcon, { icon: "Download", fill: "currentColor" }) }, onClick: (event) => {
19
+ event.stopPropagation();
20
+ const url = window.URL.createObjectURL(selectedFile);
21
+ const a = document.createElement("a");
22
+ a.href = url;
23
+ a.download = selectedFile.name;
24
+ a.click();
25
+ // Belleği temizle
26
+ window.URL.revokeObjectURL(url);
27
+ } }),
28
+ React.createElement(Button, { variant: "borderless", type: "button", icon: { element: React.createElement(ARIcon, { variant: "fill", icon: "Eye", fill: "currentColor" }) }, onClick: (event) => {
19
29
  event.stopPropagation();
20
30
  const newTab = window.open();
21
31
  newTab?.document.write(`<img src="${selectedFileBase64}" title="${selectedFile.name}" alt="${selectedFile.name}" />`);
22
32
  } }),
23
- React.createElement(Button, { variant: "borderless", status: "danger", icon: { element: React.createElement(ARIcon, { variant: "fill", icon: "Trash", fill: "currentColor" }) }, onClick: (event) => {
33
+ React.createElement(Button, { variant: "borderless", color: "red", type: "button", icon: { element: React.createElement(ARIcon, { variant: "fill", icon: "Trash", fill: "currentColor" }) }, onClick: (event) => {
24
34
  event.stopPropagation();
25
35
  handleFileRemove(selectedFile);
26
36
  } }))),
@@ -1,6 +1,7 @@
1
1
  import React, { memo, useEffect, useState } from "react";
2
2
  import Button from "../button";
3
3
  import { ARIcon } from "../../icons";
4
+ import Utils from "../../../libs/infrastructure/shared/Utils";
4
5
  const PreviewSelectedFiles = ({ selectedFiles, validationErrors, handleFileToBase64, handleFileRemove }) => {
5
6
  // states
6
7
  const [items, setItems] = useState([]);
@@ -10,9 +11,10 @@ const PreviewSelectedFiles = ({ selectedFiles, validationErrors, handleFileToBas
10
11
  useEffect(() => {
11
12
  (async () => {
12
13
  const items = await Promise.all(selectedFiles.map(async (selectedFile) => {
14
+ const fileInformation = Utils.GetFileTypeInformation(selectedFile.type);
13
15
  const _selectedFileBase64 = await handleFileToBase64(selectedFile);
14
16
  const message = validationErrors.find((validationError) => validationError.fileName === selectedFile.name)?.message;
15
- return (React.createElement("div", { className: "item", onClick: (event) => event.stopPropagation(), onMouseOver: async (event) => {
17
+ return (React.createElement("div", { className: "item", style: { backgroundColor: fileInformation.color }, onClick: (event) => event.stopPropagation(), onMouseOver: async (event) => {
16
18
  event.stopPropagation();
17
19
  setSelectedFileBase64(await handleFileToBase64(selectedFile));
18
20
  setSelectedFile(selectedFile);
@@ -22,16 +24,26 @@ const PreviewSelectedFiles = ({ selectedFiles, validationErrors, handleFileToBas
22
24
  React.createElement("span", null, message))),
23
25
  React.createElement("div", { className: "buttons" },
24
26
  React.createElement("div", null,
25
- React.createElement(Button, { variant: "borderless", icon: { element: React.createElement(ARIcon, { variant: "fill", icon: "Eye", fill: "currentColor" }) }, onClick: (event) => {
27
+ React.createElement(Button, { variant: "borderless", type: "button", icon: { element: React.createElement(ARIcon, { icon: "Download", fill: "currentColor" }) }, onClick: (event) => {
28
+ event.stopPropagation();
29
+ const url = window.URL.createObjectURL(selectedFile);
30
+ const a = document.createElement("a");
31
+ a.href = url;
32
+ a.download = selectedFile.name;
33
+ a.click();
34
+ // Belleği temizle
35
+ window.URL.revokeObjectURL(url);
36
+ } }),
37
+ selectedFile.type.includes("image") && (React.createElement(Button, { variant: "borderless", type: "button", icon: { element: React.createElement(ARIcon, { variant: "fill", icon: "Eye", fill: "currentColor" }) }, onClick: (event) => {
26
38
  event.stopPropagation();
27
39
  const newTab = window.open();
28
40
  newTab?.document.write(`<img src="${_selectedFileBase64}" title="${selectedFile.name}" alt="${selectedFile.name}" />`);
29
- } }),
30
- React.createElement(Button, { variant: "borderless", status: "danger", icon: { element: React.createElement(ARIcon, { variant: "fill", icon: "Trash", fill: "currentColor" }) }, onClick: (event) => {
41
+ } })),
42
+ React.createElement(Button, { variant: "borderless", color: "red", type: "button", icon: { element: React.createElement(ARIcon, { variant: "fill", icon: "Trash", fill: "currentColor" }) }, onClick: (event) => {
31
43
  event.stopPropagation();
32
44
  handleFileRemove(selectedFile);
33
45
  } }))),
34
- React.createElement("img", { src: _selectedFileBase64 })));
46
+ selectedFile.type.includes("image") ? (React.createElement("img", { src: _selectedFileBase64 })) : (React.createElement(ARIcon, { icon: fileInformation.icon ?? "Document", fill: "var(--white)", size: 32 }))));
35
47
  }));
36
48
  setItems(items);
37
49
  setSelectedFileBase64(await handleFileToBase64(selectedFiles[0]));
@@ -40,14 +52,14 @@ const PreviewSelectedFiles = ({ selectedFiles, validationErrors, handleFileToBas
40
52
  }, [selectedFiles, validationErrors]);
41
53
  return (selectedFiles.length > 0 && (React.createElement(React.Fragment, null,
42
54
  React.createElement("div", { className: "preview" },
43
- React.createElement("img", { src: selectedFileBase64, className: "selected-image" }),
55
+ selectedFile?.type.includes("image") ? (React.createElement("img", { src: selectedFileBase64, className: "selected-image" })) : ("Önizleme Yok."),
44
56
  selectedFile && (React.createElement("div", { className: "informations" },
45
57
  React.createElement("span", { className: "file-name" }, selectedFile.name),
46
58
  React.createElement("div", null,
47
59
  React.createElement("span", { className: "file-size" },
48
60
  (selectedFile.size / 1024).toFixed(3),
49
61
  React.createElement("span", { className: "size-type" }, "KB")),
50
- React.createElement("span", { className: "file-type" }, selectedFile.type.split("/")[1].toLocaleUpperCase()))))),
62
+ React.createElement("span", { className: "file-type" }, Utils.GetFileTypeInformation(selectedFile.type).readableType))))),
51
63
  React.createElement("div", { className: "items" }, items))));
52
64
  };
53
65
  export default memo(PreviewSelectedFiles);
@@ -1,4 +1,4 @@
1
- import { AllowedTypes } from "../../../libs/types";
1
+ import { MimeTypes } from "../../../libs/types";
2
2
  import { IDisabled, IValidation } from "../../../libs/types/IGlobalProps";
3
3
  interface IMultiple {
4
4
  /**
@@ -97,8 +97,7 @@ type Props = {
97
97
  * <Upload allowedTypes={["image/png", "application/pdf"]} />
98
98
  * ```
99
99
  */
100
- allowedTypes?: AllowedTypes[];
101
- uploadType?: "image" | "application-file";
100
+ allowedTypes?: MimeTypes[];
102
101
  /**
103
102
  * Kabul edilen maksimum dosya boyutu (byte cinsinden).
104
103
  *
@@ -3,7 +3,7 @@ import "../../../assets/css/components/form/upload/styles.css";
3
3
  import { ARIcon } from "../../icons";
4
4
  import PreviewSelectedFile from "./PreviewSelectedFile";
5
5
  import PreviewSelectedFiles from "./PreviewSelectedFiles";
6
- const Upload = ({ text, file, onChange, allowedTypes, uploadType = "application-file", maxSize, multiple, }) => {
6
+ const Upload = ({ text, file, onChange, allowedTypes, maxSize, multiple }) => {
7
7
  // refs
8
8
  const _firstLoad = useRef(false);
9
9
  const _input = useRef(null);
@@ -186,8 +186,7 @@ const Upload = ({ text, file, onChange, allowedTypes, uploadType = "application-
186
186
  if (_input.current)
187
187
  _input.current.click();
188
188
  } },
189
- uploadType === "image" &&
190
- (multiple ? (React.createElement(PreviewSelectedFiles, { selectedFiles: selectedFiles, validationErrors: validationErrors, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove })) : (React.createElement(PreviewSelectedFile, { selectedFile: selectedFile, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }))),
189
+ multiple ? (React.createElement(PreviewSelectedFiles, { selectedFiles: selectedFiles, validationErrors: validationErrors, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove })) : (React.createElement(PreviewSelectedFile, { selectedFile: selectedFile, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove })),
191
190
  !selectedFile && selectedFiles.length === 0 && (React.createElement(React.Fragment, null,
192
191
  React.createElement("div", { className: "upload" },
193
192
  React.createElement(ARIcon, { variant: "fill", icon: "CloudUpload", size: 32 }),