ar-design 0.2.75 → 0.2.76

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.
@@ -1,6 +1,6 @@
1
1
  .ar-card {
2
2
  background-color: var(--white);
3
- border: solid 1px var(--gray-200);
3
+ border: solid 1px var(--light);
4
4
  border-radius: var(--border-radius-lg);
5
5
  overflow: hidden;
6
6
  }
@@ -9,10 +9,12 @@
9
9
  flex-direction: row;
10
10
  justify-content: space-between;
11
11
  align-items: center;
12
- background-color: var(--gray-100);
12
+ /* background-color: var(--gray-100); */
13
13
  padding: 0 1rem;
14
14
  height: 3rem;
15
- border-bottom: solid 1px var(--gray-200);
15
+ border-bottom: solid 1px var(--light);
16
+ border-bottom-left-radius: 0 !important;
17
+ border-bottom-right-radius: 0 !important;
16
18
  }
17
19
  .ar-card > .title > .ar-typography-title {
18
20
  margin-bottom: 0 !important;
@@ -0,0 +1,24 @@
1
+ .ar-button-action {
2
+ position: relative;
3
+ }
4
+
5
+ .ar-action-buttons {
6
+ position: absolute;
7
+ display: flex;
8
+ flex-direction: column;
9
+ background-color: var(--white);
10
+ padding: 0.25rem;
11
+ border: solid 1px var(--gray-200);
12
+ border-radius: var(--border-radius-sm);
13
+ box-shadow: 0 0 15px -2.5px rgba(var(--black-rgb), 0.1);
14
+ z-index: 1051;
15
+ transition: visibility 250ms, opacity 250ms;
16
+ }
17
+ .ar-action-buttons::after {
18
+ position: absolute;
19
+ top: 0.5rem;
20
+ left: 100%;
21
+ content: "";
22
+ border: solid 10px transparent;
23
+ border-left-color: var(--gray-200);
24
+ }
@@ -6,7 +6,7 @@ const Pie = ({ title, data, size }) => {
6
6
  // const _randomIndex = useRef<number[]>([]);
7
7
  // state
8
8
  const [conic, setConic] = useState([]);
9
- // variable/s
9
+ // variables
10
10
  const conicColors = [
11
11
  ["#fff35e", "#000"], // Sarı
12
12
  ["#ffc752", "#000"], // Açık Sarı
@@ -1,5 +1,5 @@
1
- import { IChildren } from "../../../libs/types/IGlobalProps";
2
- interface IProps extends IChildren {
1
+ import { IChildren, IStatus } from "../../../libs/types/IGlobalProps";
2
+ interface IProps extends IChildren, IStatus {
3
3
  /**
4
4
  * Kart başlığı.
5
5
  *
@@ -1,10 +1,14 @@
1
1
  import React from "react";
2
2
  import Typography from "../typography";
3
3
  import "../../../assets/css/components/data-display/card/styles.css";
4
+ import Utils from "../../../libs/infrastructure/shared/Utils";
4
5
  const { Title } = Typography;
5
- const Card = ({ children, title = "", actions }) => {
6
+ const Card = ({ children, title = "", actions, status }) => {
7
+ // variables
8
+ const _titleClassName = ["title"];
9
+ _titleClassName.push(...Utils.GetClassName(undefined, status, undefined, undefined, undefined, undefined));
6
10
  return (React.createElement("div", { className: "ar-card" },
7
- title && (React.createElement("div", { className: "title" },
11
+ title && (React.createElement("div", { className: _titleClassName.map((c) => c).join(" ") },
8
12
  React.createElement(Title, { Level: "h4" }, title),
9
13
  React.createElement("div", null, actions))),
10
14
  React.createElement("div", { className: "content" }, children)));
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import Utils from "../../../libs/infrastructure/shared/Utils";
3
3
  import "../../../assets/css/components/feedback/progress/progress.css";
4
4
  const Progress = ({ value, reverse, isVisibleValue = false }) => {
5
- // variable/s
5
+ // variables
6
6
  let _status = undefined;
7
7
  const _arProgressClassName = [];
8
8
  if (value >= 0 && value <= 25)
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import "../../../assets/css/components/form/button-action/button-action.css";
2
+ import "../../../assets/css/components/form/button-action/styles.css";
3
3
  import IProps from "./IProps";
4
4
  declare const ButtonAction: React.FC<IProps>;
5
5
  export default ButtonAction;
@@ -1,19 +1,19 @@
1
1
  "use client";
2
2
  import React, { useEffect, useRef, useState } from "react";
3
- import "../../../assets/css/components/form/button-action/button-action.css";
3
+ import "../../../assets/css/components/form/button-action/styles.css";
4
4
  import Button from "../button";
5
+ import ReactDOM from "react-dom";
5
6
  const ButtonAction = ({ buttons }) => {
6
7
  // refs
7
- const _arButtonAction = useRef(null);
8
+ const _wrapper = useRef(null);
9
+ const _button = useRef(null);
8
10
  const _list = useRef(null);
9
11
  // states
10
12
  const [open, setOpen] = useState(false);
11
- const [coordinateX, setCoordinatX] = useState(0);
12
- const [coordinateY, setCoordinatY] = useState(0);
13
13
  // methods
14
14
  const handleClickOutSide = (event) => {
15
15
  const target = event.target;
16
- if (_arButtonAction.current && !_arButtonAction.current.contains(target))
16
+ if (_wrapper.current && !_wrapper.current.contains(target))
17
17
  setOpen(false);
18
18
  };
19
19
  const handleKeys = (event) => {
@@ -21,31 +21,48 @@ const ButtonAction = ({ buttons }) => {
21
21
  if (key === "Escape")
22
22
  setOpen(false);
23
23
  };
24
+ const handlePosition = () => {
25
+ if (_wrapper.current && _button.current && _list.current) {
26
+ const elementRect = _button.current.getBoundingClientRect();
27
+ const popoverRect = _list.current.getBoundingClientRect();
28
+ if (elementRect) {
29
+ const screenCenterX = window.innerWidth / 2;
30
+ const screenCenterY = window.innerHeight / 2;
31
+ const sx = window.scrollX || document.documentElement.scrollLeft;
32
+ const sy = window.scrollY || document.documentElement.scrollTop;
33
+ _list.current.style.visibility = "visible";
34
+ _list.current.style.opacity = "1";
35
+ _list.current.style.top = `${(elementRect.top > screenCenterY
36
+ ? elementRect.top - popoverRect.height + elementRect.height
37
+ : elementRect.top) + sy}px`;
38
+ _list.current.style.left = `${(elementRect.left > screenCenterX
39
+ ? elementRect.right - (elementRect.width + 7.5) - popoverRect.width
40
+ : elementRect.left + elementRect.width + 7.5) + sx}px`;
41
+ }
42
+ }
43
+ };
24
44
  const handleResizeEvent = () => setOpen(false);
25
45
  // useEffects
26
46
  useEffect(() => {
27
47
  if (open) {
48
+ setTimeout(() => handlePosition(), 0);
49
+ window.addEventListener("blur", () => setOpen(false));
50
+ window.addEventListener("resize", handleResizeEvent);
28
51
  document.addEventListener("click", handleClickOutSide);
29
52
  document.addEventListener("keydown", handleKeys);
30
- window.addEventListener("resize", handleResizeEvent);
31
53
  }
32
54
  return () => {
55
+ window.removeEventListener("blur", () => setOpen(false));
56
+ window.removeEventListener("resize", handleResizeEvent);
33
57
  document.removeEventListener("click", handleClickOutSide);
34
58
  document.removeEventListener("keydown", handleKeys);
35
- window.removeEventListener("resize", handleResizeEvent);
36
59
  };
37
60
  }, [open]);
38
- return (React.createElement("div", { ref: _arButtonAction, className: "ar-button-action" },
39
- React.createElement(Button, { variant: "borderless", status: "information", border: { radius: "none" }, icon: { element: React.createElement("span", { className: "dotted" }) }, onClick: () => {
40
- if (!_arButtonAction.current || !_list.current)
41
- return;
42
- const wrapper = _arButtonAction.current.getBoundingClientRect();
43
- const confirm = _list.current.getBoundingClientRect();
44
- setCoordinatX(wrapper.left - confirm.width - 60);
45
- setCoordinatY(wrapper.top);
46
- setOpen((prev) => !prev);
47
- } }),
48
- React.createElement("span", { ref: _list, className: `list ${open ? "opened" : "closed"}`, style: { top: coordinateY, left: coordinateX } }, buttons.map((button) => (React.createElement(Button, { variant: "borderless", status: "dark", onClick: button.onClick }, button.text))))));
61
+ return (React.createElement("div", { ref: _wrapper, className: "ar-button-action" },
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) })),
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)));
49
66
  };
50
67
  ButtonAction.displayName = "ButtonAction";
51
68
  export default ButtonAction;
@@ -6,7 +6,7 @@ import Utils from "../../../libs/infrastructure/shared/Utils";
6
6
  const Input = forwardRef(({ variant = "outlined", status = "light", size = "normal", icon, border = { radius: "sm" }, button, addon, upperCase, validation, ...attributes }, ref) => {
7
7
  // states
8
8
  const [value, setValue] = useState("");
9
- // variable/s
9
+ // variables
10
10
  const _wrapperClassName = ["ar-input-wrapper"];
11
11
  const _addonBeforeClassName = ["addon-before"];
12
12
  const _addonAfterClassName = ["addon-after"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.2.75",
3
+ "version": "0.2.76",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,39 +0,0 @@
1
- .ar-button-action {
2
- position: relative;
3
- }
4
- .ar-button-action > .list {
5
- position: fixed;
6
- display: flex;
7
- flex-direction: column;
8
- background-color: rgba(var(--white-rgb), 0.75);
9
- backdrop-filter: blur(10px);
10
- border: solid 1px var(--gray-200);
11
- border-radius: var(--border-radius-sm);
12
- box-shadow: 0 0 15px -2.5px rgba(var(--black-rgb), 0.1);
13
- }
14
- .ar-button-action > .list::after {
15
- position: absolute;
16
- top: 0.5rem;
17
- left: 100%;
18
- content: "";
19
- border: solid 10px transparent;
20
- border-left-color: var(--gray-200);
21
- }
22
-
23
- /* #region Open or Close */
24
- .ar-button-action > .list:is(.opened) {
25
- visibility: visible;
26
- opacity: 1;
27
- transform: scale(1);
28
- transition: visibility 250ms, opacity 250ms, transform 250ms ease-in-out;
29
- z-index: 100;
30
- }
31
- .ar-button-action > .list:is(.closed) {
32
- visibility: hidden;
33
- opacity: 0;
34
- transform: scale(0.8);
35
- transition: visibility 250ms, opacity 250ms, transform 250ms ease-in-out;
36
- z-index: 99;
37
- }
38
- /* #endregion */
39
- /* Open or Close */