@harjs/react-ui 1.1.8 → 1.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 (43) hide show
  1. package/dist/assets/css/components/data-display/chip/css.cjs +2 -2
  2. package/dist/assets/css/components/data-display/chip/size.css +6 -6
  3. package/dist/assets/css/components/data-display/typography/paragraph/css.cjs +2 -2
  4. package/dist/assets/css/components/data-display/typography/paragraph/size.css +6 -6
  5. package/dist/assets/css/components/data-display/typography/title/core.css +1 -1
  6. package/dist/assets/css/components/data-display/typography/typography.css +0 -1
  7. package/dist/assets/css/components/feedback/drawer/css.cjs +13 -8
  8. package/dist/assets/css/components/feedback/drawer/size.css +31 -6
  9. package/dist/assets/css/components/feedback/modal/css.cjs +3 -6
  10. package/dist/assets/css/components/feedback/modal/size.css +6 -6
  11. package/dist/assets/css/components/form/button/css.cjs +2 -2
  12. package/dist/assets/css/components/form/button/size.css +6 -6
  13. package/dist/assets/css/components/form/checkbox/css.cjs +1 -1
  14. package/dist/assets/css/components/form/checkbox/size.css +3 -3
  15. package/dist/assets/css/components/form/input/css.cjs +2 -136
  16. package/dist/assets/css/components/form/input/size.css +6 -6
  17. package/dist/assets/css/components/form/switch/color.css +721 -0
  18. package/dist/assets/css/components/form/switch/css.cjs +40 -0
  19. package/dist/assets/css/components/form/switch/radius.css +42 -0
  20. package/dist/assets/css/components/form/switch/size.css +28 -0
  21. package/dist/assets/css/components/form/switch/styles.css +7 -5
  22. package/dist/assets/css/components/form/switch/templates/color.template.css +71 -0
  23. package/dist/assets/css/components/form/switch/templates/radius.template.css +3 -0
  24. package/dist/assets/css/components/form/switch/templates/size.template.css +8 -0
  25. package/dist/components/data-display/table/IProps.d.ts +1 -1
  26. package/dist/components/data-display/table/body/TBody.d.ts +3 -0
  27. package/dist/components/data-display/table/body/TBody.js +7 -4
  28. package/dist/components/data-display/table/index.js +20 -0
  29. package/dist/components/data-display/typography/paragraph/Paragraph.js +1 -1
  30. package/dist/components/data-display/typography/title/IProps.d.ts +0 -1
  31. package/dist/components/data-display/typography/title/Title.js +5 -7
  32. package/dist/components/feedback/drawer/IProps.d.ts +4 -3
  33. package/dist/components/feedback/drawer/index.js +2 -2
  34. package/dist/components/form/checkbox/Props.d.ts +2 -3
  35. package/dist/components/form/checkbox/index.d.ts +1 -2
  36. package/dist/components/form/switch/index.js +5 -5
  37. package/dist/components/navigation/wizard/IProps.d.ts +3 -3
  38. package/dist/libs/infrastructure/shared/Utils.js +1 -1
  39. package/dist/libs/infrastructure/types/IGlobalProps.d.ts +1 -15
  40. package/dist/libs/infrastructure/types/index.d.ts +2 -1
  41. package/package.json +1 -1
  42. package/dist/assets/css/components/data-display/typography/title/size.css +0 -41
  43. package/dist/assets/css/components/form/switch/core/border.css +0 -208
@@ -0,0 +1,40 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const { execSync } = require("child_process");
4
+
5
+ const colors = ["blue", "purple", "pink", "red", "orange", "yellow", "green", "teal", "cyan", "gray"];
6
+ const radiuses = ["0", "2", "4", "6", "8", "12", "16", "20", "40", "full"];
7
+ const sizes = [
8
+ { name: "xs", "w/h": "1rem", fontSize: "0.75rem" },
9
+ { name: "sm", "w/h": "1.25rem", fontSize: "1rem" },
10
+ { name: "md", "w/h": "1.5rem", fontSize: "1.25rem" },
11
+ ];
12
+
13
+ const colorTemplate = fs.readFileSync("templates/color.template.css", "utf-8");
14
+ const radiusTemplate = fs.readFileSync("templates/radius.template.css", "utf-8");
15
+ const sizeTemplate = fs.readFileSync("templates/size.template.css", "utf-8");
16
+
17
+ let colorOutput = `.har-switch {${colors.map((color) => colorTemplate.replace(/__COLOR__/g, color)).join("\n")}}`;
18
+ let radiusOutput = `.har-switch, .har-switch > .handle {${radiuses.map((radius) => radiusTemplate.replace(/__RADIUS__/g, radius)).join("\n")}}`;
19
+ let sizeOutput = `.har-switch {${sizes
20
+ .map((size) =>
21
+ sizeTemplate
22
+ .replace(/__SIZE__/g, `size-${size.name}`)
23
+ .replace(/__SIZE_NUMBER__/g, size["w/h"])
24
+ .replace(/__FONT_SIZE__/g, size.fontSize),
25
+ )
26
+ .join("\n")}}`;
27
+
28
+ fs.writeFileSync("color.css", colorOutput);
29
+ fs.writeFileSync("radius.css", radiusOutput);
30
+ fs.writeFileSync("size.css", sizeOutput);
31
+
32
+ try {
33
+ execSync(`npx prettier --write color.css`, { stdio: "inherit" });
34
+ execSync(`npx prettier --write radius.css`, { stdio: "inherit" });
35
+ execSync(`npx prettier --write size.css`, { stdio: "inherit" });
36
+
37
+ execSync("npm run no-css-build", { stdio: "inherit" });
38
+ } catch (err) {
39
+ console.error("⚠️ Prettier çalıştırılamadı:", err.message);
40
+ }
@@ -0,0 +1,42 @@
1
+ .har-switch,
2
+ .har-switch > .handle {
3
+ &.radius-0 {
4
+ border-radius: var(--radius-0);
5
+ }
6
+
7
+ &.radius-2 {
8
+ border-radius: var(--radius-2);
9
+ }
10
+
11
+ &.radius-4 {
12
+ border-radius: var(--radius-4);
13
+ }
14
+
15
+ &.radius-6 {
16
+ border-radius: var(--radius-6);
17
+ }
18
+
19
+ &.radius-8 {
20
+ border-radius: var(--radius-8);
21
+ }
22
+
23
+ &.radius-12 {
24
+ border-radius: var(--radius-12);
25
+ }
26
+
27
+ &.radius-16 {
28
+ border-radius: var(--radius-16);
29
+ }
30
+
31
+ &.radius-20 {
32
+ border-radius: var(--radius-20);
33
+ }
34
+
35
+ &.radius-40 {
36
+ border-radius: var(--radius-40);
37
+ }
38
+
39
+ &.radius-full {
40
+ border-radius: var(--radius-full);
41
+ }
42
+ }
@@ -0,0 +1,28 @@
1
+ .har-switch {
2
+ &.size-xs {
3
+ width: 1rem;
4
+ height: 1rem;
5
+
6
+ + .label {
7
+ font-size: 0.75rem;
8
+ }
9
+ }
10
+
11
+ &.size-sm {
12
+ width: 1.25rem;
13
+ height: 1.25rem;
14
+
15
+ + .label {
16
+ font-size: 1rem;
17
+ }
18
+ }
19
+
20
+ &.size-md {
21
+ width: 1.5rem;
22
+ height: 1.5rem;
23
+
24
+ + .label {
25
+ font-size: 1.25rem;
26
+ }
27
+ }
28
+ }
@@ -1,6 +1,8 @@
1
- @import url("./core/border.css");
1
+ @import url("./color.css");
2
+ @import url("./size.css");
3
+ @import url("./radius.css");
2
4
 
3
- .ar-switch-wrapper {
5
+ .har-switch-wrapper {
4
6
  display: flex;
5
7
  flex-wrap: nowrap;
6
8
  align-items: center;
@@ -18,7 +20,7 @@
18
20
  > input[type="checkbox"] {
19
21
  display: none;
20
22
 
21
- + .ar-switch {
23
+ + .har-switch {
22
24
  > .handle {
23
25
  position: absolute;
24
26
  top: 50%;
@@ -40,7 +42,7 @@
40
42
  }
41
43
 
42
44
  &.checked {
43
- + .ar-switch {
45
+ + .har-switch {
44
46
  > .handle {
45
47
  left: calc(2.25rem - 1rem);
46
48
  border: none;
@@ -50,7 +52,7 @@
50
52
  }
51
53
  }
52
54
 
53
- > .ar-switch {
55
+ > .har-switch {
54
56
  position: relative;
55
57
  display: inline-block;
56
58
  width: 2.25rem;
@@ -0,0 +1,71 @@
1
+ &.__COLOR__ {
2
+ &.filled {
3
+ background-color: var(--__COLOR__-500);
4
+
5
+ &:hover {
6
+ background-color: var(--__COLOR__-400);
7
+ }
8
+
9
+ &:active {
10
+ background-color: var(--__COLOR__-600);
11
+ }
12
+ }
13
+
14
+ &.surface {
15
+ background-color: var(--__COLOR__-300);
16
+ border: solid var(--stroke-1) var(--__COLOR__-200);
17
+ color: var(--__COLOR__-700);
18
+
19
+ &:hover {
20
+ background-color: var(--__COLOR__-200);
21
+ }
22
+
23
+ &:active {
24
+ background-color: var(--__COLOR__-300);
25
+ border: solid var(--stroke-1) var(--__COLOR__-300);
26
+ }
27
+ }
28
+
29
+ &.surface-borderless {
30
+ background-color: var(--__COLOR__-100);
31
+ border: solid var(--stroke-1) transparent;
32
+ color: var(--__COLOR__-700);
33
+
34
+ &:hover {
35
+ background-color: var(--__COLOR__-200);
36
+ }
37
+
38
+ &:active {
39
+ background-color: var(--__COLOR__-300);
40
+ border: solid var(--stroke-1) var(--__COLOR__-300);
41
+ }
42
+ }
43
+
44
+ &.outlined {
45
+ border: solid var(--stroke-1) var(--__COLOR__-500);
46
+ color: var(--__COLOR__-700);
47
+
48
+ &:hover {
49
+ background-color: var(--__COLOR__-100);
50
+ }
51
+
52
+ &:active {
53
+ background-color: var(--__COLOR__-200);
54
+ }
55
+ }
56
+
57
+ &.dashed {
58
+ border: dashed var(--stroke-1) var(--__COLOR__-500);
59
+ color: var(--__COLOR__-700);
60
+
61
+ &:hover {
62
+ border: dashed var(--stroke-1) var(--__COLOR__-300);
63
+ color: var(--__COLOR__-300);
64
+ }
65
+
66
+ &:active {
67
+ border: dashed var(--stroke-1) var(--__COLOR__-500);
68
+ color: var(--__COLOR__-700);
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,3 @@
1
+ &.radius-__RADIUS__ {
2
+ border-radius: var(--radius-__RADIUS__);
3
+ }
@@ -0,0 +1,8 @@
1
+ &.__SIZE__ {
2
+ width: __SIZE_NUMBER__;
3
+ height: __SIZE_NUMBER__;
4
+
5
+ + .label {
6
+ font-size: __FONT_SIZE__;
7
+ }
8
+ }
@@ -34,7 +34,7 @@ export type Config<T extends object> = {
34
34
  button?: boolean;
35
35
  render?: {
36
36
  styles: React.CSSProperties;
37
- element: (item: T[]) => React.JSX.Element;
37
+ element: (parentItem: T, subItem: unknown) => React.JSX.Element;
38
38
  };
39
39
  };
40
40
  dnd?: {
@@ -9,6 +9,9 @@ interface IProps<T extends object> {
9
9
  _selectionItems: React.MutableRefObject<T[]>;
10
10
  };
11
11
  states: {
12
+ columnNumber: {
13
+ get: number;
14
+ };
12
15
  setSelectAll: {
13
16
  get: boolean;
14
17
  set: Dispatch<SetStateAction<boolean>>;
@@ -6,14 +6,17 @@ import Editable from "./Editable";
6
6
  import TableTR from "../../../../libs/core/application/locales/table/tr";
7
7
  import TableEN from "../../../../libs/core/application/locales/table/en";
8
8
  import { useTranslation } from "@harjs/translation";
9
- const SubitemList = ({ items, columns, depth, level = 1, parentKey = "", config, methods, states, renderCell, }) => {
9
+ const SubitemList = ({ parentItem, items, columns, depth, level = 1, parentKey = "", config, methods, states, renderCell, }) => {
10
10
  const _subrowSelector = config.subrow?.selector ?? "subitems";
11
11
  const _subrowButton = config.subrow?.button ?? true;
12
12
  if (config.subrow?.render) {
13
13
  return (React.createElement("tr", { className: `subrow-item ${_subrowButton ? "type-b" : "type-a"}`, "data-level": level },
14
14
  methods.selections && React.createElement("td", { className: "sticky sticky-left", "data-sticky-position": "left" }),
15
15
  _subrowButton && React.createElement("td", { className: "sticky sticky-left", "data-sticky-position": "left" }),
16
- React.createElement("td", { colSpan: columns.length || 1, style: { ...config.subrow.render.styles, padding: "7.5px 7.5px 7.5px 0" } }, config.subrow?.render.element(items) ?? React.createElement(React.Fragment, null))));
16
+ React.createElement("td", { colSpan: states.columnNumber.get || columns.length || 1, style: {
17
+ ...config.subrow.render.styles,
18
+ padding: "var(--space-8)",
19
+ }, ...(states.columnNumber.get > 0 ? { className: "sticky sticky-left", "data-sticky-position": "left" } : {}) }, config.subrow?.render.element(parentItem, items) ?? React.createElement(React.Fragment, null))));
17
20
  }
18
21
  return (React.createElement(React.Fragment, null, items.map((subitem, subindex) => {
19
22
  const id = methods.trackBy?.(subitem) ?? `sub-${subindex}`;
@@ -40,7 +43,7 @@ const SubitemList = ({ items, columns, depth, level = 1, parentKey = "", config,
40
43
  height: 0,
41
44
  isSubrows: true,
42
45
  }))),
43
- states.showSubitems.get[key] && _subitem && (React.createElement(SubitemList, { items: _subitem, columns: columns, depth: depth + 0.75, level: level + 1, parentKey: key, config: config, methods: methods, states: states, renderCell: renderCell }))));
46
+ states.showSubitems.get[key] && _subitem && (React.createElement(SubitemList, { parentItem: subitem, items: _subitem, columns: columns, depth: depth + 0.75, level: level + 1, parentKey: key, config: config, methods: methods, states: states, renderCell: renderCell }))));
44
47
  })));
45
48
  };
46
49
  function TBody({ data, columns, refs, methods, states, config }) {
@@ -147,7 +150,7 @@ function TBody({ data, columns, refs, methods, states, config }) {
147
150
  level: 0,
148
151
  height: currentRowHeight,
149
152
  }))),
150
- states.showSubitems.get[key] && _subitem && (React.createElement(SubitemList, { items: _subitem, columns: columns, depth: 1.5, parentKey: key, config: config, methods: methods, states: states, renderCell: renderCell }))));
153
+ states.showSubitems.get[key] && _subitem && (React.createElement(SubitemList, { parentItem: item, items: _subitem, columns: columns, depth: 1.5, parentKey: key, config: config, methods: methods, states: states, renderCell: renderCell }))));
151
154
  };
152
155
  // useEffects
153
156
  useEffect(() => {
@@ -24,6 +24,7 @@ import TableTR from "../../../libs/core/application/locales/table/tr";
24
24
  import TableEN from "../../../libs/core/application/locales/table/en";
25
25
  const { Row, Column } = Grid;
26
26
  const Table = forwardRef(({ children, trackBy, title, description, data, columns, actions, rowBackgroundColor, selections, selectionDisabled, previousSelections, sortedParams, searchedParams, onEditable, onDnD, pagination, config = { isSearchable: false }, }, ref) => {
27
+ // refs
27
28
  const _innerRef = useRef(null);
28
29
  const _tableWrapper = useRef(null);
29
30
  const _tableContent = useRef(null);
@@ -41,6 +42,8 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
41
42
  const _subrowSelector = config.subrow?.selector ?? "subitems";
42
43
  const _subrowButton = config.subrow?.button ?? false;
43
44
  const _tableClassName = ["ar-table", "scroll"];
45
+ // states
46
+ const [columnNumber, setColumnNumber] = useState(0);
44
47
  const [selectAll, setSelectAll] = useState(false);
45
48
  const [showSubitems, setShowSubitems] = useState({});
46
49
  const [createTrigger, setCreateTrigger] = useState(false);
@@ -323,6 +326,22 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
323
326
  setTimeout(() => handleScroll(), 0);
324
327
  return _data;
325
328
  }, [data, searchedText, currentPage, selectedPerPage, sortConfig, config.isServerSide]);
329
+ useEffect(() => {
330
+ if (columns.length === 0 && config.subrow?.render)
331
+ return;
332
+ const _tableW = _tableWrapper.current;
333
+ if (!_tableW)
334
+ return;
335
+ const { right } = _tableW?.getBoundingClientRect();
336
+ const _th = _tableW.querySelectorAll("thead > tr > th");
337
+ let i = 0;
338
+ _th?.forEach((th) => {
339
+ const thRect = th.getBoundingClientRect();
340
+ if (thRect.left < right)
341
+ i++;
342
+ });
343
+ setColumnNumber(i - 1);
344
+ }, [columns]);
326
345
  useEffect(() => {
327
346
  if (!previousSelections || previousSelections.length === 0) {
328
347
  _selectionItems.current = [];
@@ -604,6 +623,7 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
604
623
  })))),
605
624
  React.createElement("tbody", { ref: _tBody },
606
625
  React.createElement(TBody, { data: getData, columns: columns, refs: { _checkboxItems: _checkboxItems, _selectionItems: _selectionItems }, states: {
626
+ columnNumber: { get: columnNumber },
607
627
  setSelectAll: { get: selectAll, set: setSelectAll },
608
628
  showSubitems: { get: showSubitems, set: setShowSubitems },
609
629
  }, methods: {
@@ -7,7 +7,7 @@ const Paragraph = ({ children, color, align = "left", size = "md", upperCase = f
7
7
  if (color)
8
8
  _className.push(color);
9
9
  if (size)
10
- _className.push(size);
10
+ _className.push(`size-${size}`);
11
11
  return (React.createElement("p", { className: _className.map((c) => c).join(" ") }, typeof children === "string" && upperCase ? children.toLocaleUpperCase() : children));
12
12
  };
13
13
  Paragraph.displayName = "Paragraph";
@@ -2,6 +2,5 @@ import { IChildrenProps, IUpperCaseProps } from "../../../../libs/infrastructure
2
2
  interface IProps extends IChildrenProps, IUpperCaseProps, React.HTMLAttributes<HTMLHeadingElement> {
3
3
  Level: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
4
4
  align?: "left" | "center" | "right";
5
- size?: "xx-small" | "x-small" | "small" | "medium" | "large" | "x-large" | "xx-large" | "xxx-large" | "smaller" | "larger";
6
5
  }
7
6
  export default IProps;
@@ -1,13 +1,11 @@
1
1
  "use client";
2
- import React, { useRef } from "react";
3
- const Title = ({ children, Level, align = "left", size, upperCase = false, ...attributes }) => {
2
+ import React from "react";
3
+ const Title = ({ children, Level, align = "left", upperCase = false, ...attributes }) => {
4
4
  // refs
5
- let _className = useRef("ar-typography-title").current;
5
+ let _className = ["har-typography-title"];
6
6
  if (align)
7
- _className += ` ${align}`;
8
- if (size)
9
- _className += ` ${size}`;
10
- return (React.createElement(Level, { className: _className, ...attributes }, typeof children === "string" && upperCase ? children.toLocaleUpperCase() : children));
7
+ _className.push(align);
8
+ return (React.createElement(Level, { className: _className.map((c) => c).join(" "), ...attributes }, typeof children === "string" && upperCase ? children.toLocaleUpperCase() : children));
11
9
  };
12
10
  Title.displayName = "Title";
13
11
  export default Title;
@@ -1,7 +1,8 @@
1
- import { TabProps, ValidationProps } from "../../../libs/infrastructure/types";
2
- import { IChildrenProps, ISizeProps } from "../../../libs/infrastructure/types/IGlobalProps";
3
- interface IProps<T extends object> extends IChildrenProps, ISizeProps {
1
+ import { DrawerSizes, TabProps, ValidationProps } from "../../../libs/infrastructure/types";
2
+ import { IChildrenProps } from "../../../libs/infrastructure/types/IGlobalProps";
3
+ interface IProps<T extends object> extends IChildrenProps {
4
4
  title?: string;
5
+ size?: DrawerSizes;
5
6
  tabs: TabProps[];
6
7
  activeTab?: number;
7
8
  open: {
@@ -4,11 +4,11 @@ import Typography from "../../data-display/typography";
4
4
  import "../../../assets/css/components/feedback/drawer/styles.css";
5
5
  import { useValidation } from "../../../libs/core/application/hooks";
6
6
  const { Title } = Typography;
7
- const Drawer = function ({ title, tabs = [], activeTab, open, size = "xxl", onChange, validation, config, }) {
7
+ const Drawer = function ({ title, tabs = [], activeTab, open, size = "2xl", onChange, validation, config, }) {
8
8
  // refs
9
9
  const _drawer = useRef(null);
10
10
  const _drawerWrapperClassName = ["har-drawer-wrapper"];
11
- const _drawerClassName = ["har-drawer", size];
11
+ const _drawerClassName = ["har-drawer", `size-${size}`];
12
12
  if (Object.keys(open).length > 0 && open.get)
13
13
  _drawerWrapperClassName.push("opened");
14
14
  else
@@ -1,8 +1,7 @@
1
- import { IBorderProps, IColorProps, IUpperCaseProps, IValidationProps, IVariantProps } from "../../../libs/infrastructure/types/IGlobalProps";
1
+ import { IBorderProps, IColorProps, ISizeProps, IUpperCaseProps, IValidationProps, IVariantProps } from "../../../libs/infrastructure/types/IGlobalProps";
2
2
  type Props = {
3
3
  label?: string;
4
- size?: "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
5
4
  } & IVariantProps<{
6
5
  component: "checkbox";
7
- }> & IColorProps & IBorderProps & IUpperCaseProps & IValidationProps & Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size" | "color">;
6
+ }> & IColorProps & IBorderProps & ISizeProps & IUpperCaseProps & IValidationProps & Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "size" | "color">;
8
7
  export default Props;
@@ -2,8 +2,7 @@ import React from "react";
2
2
  import "../../../assets/css/components/form/checkbox/styles.css";
3
3
  declare const Checkbox: React.ForwardRefExoticComponent<{
4
4
  label?: string;
5
- size?: "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
6
5
  } & import("../../../libs/infrastructure/types/IGlobalProps").IVariantProps<{
7
6
  component: "checkbox";
8
- }> & import("../../../libs/infrastructure/types/IGlobalProps").IColorProps & import("../../../libs/infrastructure/types/IGlobalProps").IBorderProps & import("../../../libs/infrastructure/types/IGlobalProps").IUpperCaseProps & import("../../../libs/infrastructure/types/IGlobalProps").IValidationProps & Omit<React.InputHTMLAttributes<HTMLInputElement>, "color" | "children" | "size"> & React.RefAttributes<HTMLInputElement>>;
7
+ }> & import("../../../libs/infrastructure/types/IGlobalProps").IColorProps & import("../../../libs/infrastructure/types/IGlobalProps").IBorderProps & import("../../../libs/infrastructure/types/IGlobalProps").ISizeProps & import("../../../libs/infrastructure/types/IGlobalProps").IUpperCaseProps & import("../../../libs/infrastructure/types/IGlobalProps").IValidationProps & Omit<React.InputHTMLAttributes<HTMLInputElement>, "color" | "children" | "size"> & React.RefAttributes<HTMLInputElement>>;
9
8
  export default Checkbox;
@@ -2,16 +2,16 @@
2
2
  import React, { forwardRef, useEffect, useImperativeHandle, 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 = forwardRef(({ label, color, border = { radius: "full" }, ...attributes }, ref) => {
5
+ const Switch = forwardRef(({ label, variant = "filled", color = "blue", border = { radius: "full" }, ...attributes }, ref) => {
6
6
  // refs
7
7
  let _switchInput = useRef(null);
8
8
  let _switch = useRef(null);
9
9
  const _inputClassName = [];
10
- const _switchClassName = ["ar-switch"];
10
+ const _switchClassName = ["har-switch"];
11
11
  // states
12
12
  const [checked, setChecked] = useState(attributes.checked ?? false);
13
13
  _inputClassName.push(attributes.checked ? "checked" : "unchecked");
14
- _switchClassName.push(...Utils.GetClassName(undefined, undefined, attributes.checked ? color : "gray", border, undefined, undefined, attributes.className));
14
+ _switchClassName.push(...Utils.GetClassName(variant, undefined, attributes.checked ? color : "gray", border, undefined, undefined, attributes.className));
15
15
  // hooks
16
16
  // Dışarıdan gelen ref'i _innerRef'e bağla.
17
17
  useImperativeHandle(ref, () => _switchInput.current);
@@ -19,7 +19,7 @@ const Switch = forwardRef(({ label, color, border = { radius: "full" }, ...attri
19
19
  useEffect(() => {
20
20
  setChecked(attributes.checked ?? false);
21
21
  }, [attributes.checked]);
22
- return (React.createElement("div", { className: "ar-switch-wrapper" },
22
+ return (React.createElement("div", { className: "har-switch-wrapper" },
23
23
  React.createElement("label", null,
24
24
  React.createElement("input", { ref: _switchInput, type: "checkbox", ...attributes, className: _inputClassName.map((c) => c).join(" "), checked: checked, size: 0, onChange: (event) => {
25
25
  event.stopPropagation();
@@ -29,7 +29,7 @@ const Switch = forwardRef(({ label, color, border = { radius: "full" }, ...attri
29
29
  (() => attributes.onChange && attributes.onChange(event))();
30
30
  } }),
31
31
  React.createElement("span", { ref: _switch, className: _switchClassName.map((c) => c).join(" ") },
32
- React.createElement("span", { className: "handle border-radius-pill" })),
32
+ React.createElement("span", { className: `handle ${border.radius ? `radius-${border.radius}` : "radius-full"}` })),
33
33
  label && React.createElement("span", { className: "label" }, label))));
34
34
  });
35
35
  Switch.displayName = "Switch";
@@ -1,8 +1,7 @@
1
1
  import { ComponentProps, Dispatch, SetStateAction } from "react";
2
- import { StepProps, ValidationProps } from "../../../libs/infrastructure/types";
3
- import { ISizeProps } from "../../../libs/infrastructure/types/IGlobalProps";
2
+ import { DrawerSizes, StepProps, ValidationProps } from "../../../libs/infrastructure/types";
4
3
  import Wizard from ".";
5
- export interface IProps<TData extends object> extends ISizeProps {
4
+ export interface IProps<TData extends object> {
6
5
  data: {
7
6
  get: Partial<TData>;
8
7
  set: Dispatch<SetStateAction<Partial<TData>>>;
@@ -10,6 +9,7 @@ export interface IProps<TData extends object> extends ISizeProps {
10
9
  name: string;
11
10
  title?: string;
12
11
  description?: string;
12
+ size?: DrawerSizes;
13
13
  steps: StepProps[];
14
14
  currentStep?: number;
15
15
  onChange: (currentStep: number) => void;
@@ -10,7 +10,7 @@ class Utils {
10
10
  if (border)
11
11
  classNames.push(`radius-${border.radius}`);
12
12
  if (size)
13
- classNames.push(size);
13
+ classNames.push(`size-${size}`);
14
14
  if (icon && icon.element) {
15
15
  classNames.push("icon");
16
16
  classNames.push(`icon-${icon.position || "start"}`);
@@ -70,7 +70,7 @@ export interface IBorderProps {
70
70
  * - `sm`: Small radius.
71
71
  * - `lg`: Large radius.
72
72
  * - `xl`: Extra-large radius.
73
- * - `xxl`: Double extra-large radius.
73
+ * - `2xl`: Double extra-large radius.
74
74
  * - `pill`: Fully rounded capsule shape.
75
75
  * - `none`: Sharp corners (no radius).
76
76
  *
@@ -108,20 +108,6 @@ export interface IIconProps {
108
108
  icon?: Icon;
109
109
  }
110
110
  export interface ISizeProps {
111
- /**
112
- * Defines the overall scale and sizing of the component.
113
- *
114
- * - `large`: Scaled-up layout for prominence.
115
- * - `normal`: Standard layout size (Default).
116
- * - `small`: Compact layout for tight spaces.
117
- *
118
- * @example
119
- * ```jsx
120
- * <Component size="large">
121
- * Large Layout
122
- * </Component>
123
- * ```
124
- */
125
111
  size?: Sizes;
126
112
  }
127
113
  export interface IUpperCaseProps {
@@ -9,7 +9,8 @@ export type Border = {
9
9
  radius: BorderRadiuses;
10
10
  };
11
11
  export type BorderRadiuses = "0" | "2" | "4" | "6" | "8" | "12" | "16" | "20" | "40" | "full";
12
- export type Sizes = "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
12
+ export type Sizes = "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
13
+ export type DrawerSizes = Sizes | "3xl" | "4xl" | "5xl" | "6xl" | "full";
13
14
  export type Icon = {
14
15
  element: React.JSX.Element;
15
16
  position?: "start" | "end";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harjs/react-ui",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,41 +0,0 @@
1
- & {
2
- &.xx-small {
3
- font-size: 0.8rem; /* 12.8px (0.8 * 16) */
4
- }
5
-
6
- &.x-small {
7
- font-size: 1rem; /* 16px */
8
- }
9
-
10
- &.small {
11
- font-size: 1.3rem; /* 20.8px (1.3 * 16) */
12
- }
13
-
14
- &.medium {
15
- font-size: 1.6rem; /* 25.6px (1.6 * 16) */
16
- }
17
-
18
- &.large {
19
- font-size: 2rem; /* 32px (2 * 16) */
20
- }
21
-
22
- &.x-large {
23
- font-size: 2.5rem; /* 40px (2.5 * 16) */
24
- }
25
-
26
- &.xx-large {
27
- font-size: 3rem; /* 48px (3 * 16) */
28
- }
29
-
30
- &.xxx-large {
31
- font-size: 4rem; /* 64px (4 * 16) */
32
- }
33
-
34
- &.smaller {
35
- font-size: smaller;
36
- }
37
-
38
- &.larger {
39
- font-size: larger;
40
- }
41
- }