ar-design 0.1.13 → 0.1.14

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 (28) hide show
  1. package/dist/assets/css/components/data-display/card/card.css +15 -0
  2. package/dist/assets/css/components/data-display/typography/paragraph/core.css +1 -1
  3. package/dist/assets/css/components/data-display/typography/paragraph/size.css +8 -0
  4. package/dist/assets/css/components/data-display/typography/typography.css +1 -0
  5. package/dist/assets/css/components/form/switch/core/border.css +80 -0
  6. package/dist/assets/css/components/form/switch/switch.css +47 -0
  7. package/dist/assets/css/components/layout/grid-system/row/core.css +3 -0
  8. package/dist/assets/css/components/layout/layout.css +0 -6
  9. package/dist/assets/css/core/ar-core.css +7 -0
  10. package/dist/components/data-display/card/Types.d.ts +4 -0
  11. package/dist/components/data-display/card/Types.js +1 -0
  12. package/dist/components/data-display/card/index.d.ts +5 -0
  13. package/dist/components/data-display/card/index.js +11 -0
  14. package/dist/components/data-display/typography/paragraph/Paragraph.js +3 -1
  15. package/dist/components/data-display/typography/paragraph/Types.d.ts +1 -0
  16. package/dist/components/form/checkbox/index.js +16 -6
  17. package/dist/components/form/switch/Types.d.ts +8 -0
  18. package/dist/components/form/switch/Types.js +1 -0
  19. package/dist/components/form/switch/index.d.ts +5 -0
  20. package/dist/components/form/switch/index.js +34 -0
  21. package/dist/components/layout/LSider.js +4 -1
  22. package/dist/components/layout/RSider.js +4 -1
  23. package/dist/index.d.ts +3 -1
  24. package/dist/index.js +4 -2
  25. package/dist/libs/core/application/contexts/Layout.d.ts +3 -3
  26. package/dist/libs/core/application/contexts/Layout.js +11 -2
  27. package/dist/libs/core/application/hooks/useLayout.d.ts +6 -6
  28. package/package.json +1 -1
@@ -0,0 +1,15 @@
1
+ .ar-card {
2
+ background-color: var(--white);
3
+ border: solid 1px var(--gray-200);
4
+ border-radius: var(--border-radius-lg);
5
+ }
6
+ .ar-card > .title {
7
+ padding: 1rem;
8
+ border-bottom: solid 1px var(--gray-200);
9
+ }
10
+ .ar-card > .title > .ar-typography-title {
11
+ margin-bottom: 0 !important;
12
+ }
13
+ .ar-card > .content {
14
+ padding: 1rem;
15
+ }
@@ -1,5 +1,5 @@
1
1
  .ar-typography-paragraph {
2
- margin-bottom: 1rem;
2
+ margin-bottom: 0.25rem;
3
3
  color: var(--gray-900);
4
4
  font-family: var(--system);
5
5
  }
@@ -0,0 +1,8 @@
1
+ .ar-typography-paragraph.large {
2
+ font-size: 1.25rem;
3
+ }
4
+ .ar-typography-paragraph.normal {
5
+ }
6
+ .ar-typography-paragraph.small {
7
+ font-size: 0.75rem;
8
+ }
@@ -8,3 +8,4 @@
8
8
  @import url("./paragraph/core.css");
9
9
  @import url("./paragraph/color.css");
10
10
  @import url("./paragraph/align.css");
11
+ @import url("./paragraph/size.css");
@@ -0,0 +1,80 @@
1
+ /* #region Border Color -> PRIMARY */
2
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.primary {
3
+ box-shadow: 0 0 0 2.5px rgba(var(--primary-rgb), .1);
4
+ }
5
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.primary > .xxy {
6
+ box-shadow: 0 0 0 2.5px var(--primary);
7
+ }
8
+ /* #endregion */
9
+ /* Border Color -> PRIMARY */
10
+
11
+ /* #region Border Color -> SECONDARY */
12
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.secondary {
13
+ box-shadow: 0 0 0 2.5px rgba(var(--secondary-rgb), .1);
14
+ }
15
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.secondary > .xxy {
16
+ box-shadow: 0 0 0 2.5px var(--secondary);
17
+ }
18
+ /* #endregion */
19
+ /* Border Color -> SECONDARY */
20
+
21
+ /* #region Border Color -> SUCCESS */
22
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.success {
23
+ box-shadow: 0 0 0 2.5px rgba(var(--success-rgb), .1);
24
+ }
25
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.success > .xxy {
26
+ box-shadow: 0 0 0 2.5px var(--success);
27
+ }
28
+ /* #endregion */
29
+ /* Border Color -> SUCCESS */
30
+
31
+ /* #region Border Color -> WARNING */
32
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.warning {
33
+ box-shadow: 0 0 0 2.5px rgba(var(--warning-rgb), .1);
34
+ }
35
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.warning > .xxy {
36
+ box-shadow: 0 0 0 2.5px var(--warning);
37
+ }
38
+ /* #endregion */
39
+ /* Border Color -> WARNING */
40
+
41
+ /* #region Border Color -> DANGER */
42
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.danger {
43
+ box-shadow: 0 0 0 2.5px rgba(var(--danger-rgb), .1);
44
+ }
45
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.danger > .xxy {
46
+ box-shadow: 0 0 0 2.5px var(--danger);
47
+ }
48
+ /* #endregion */
49
+ /* Border Color -> DANGER */
50
+
51
+ /* #region Border Color -> INFORMATION */
52
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.information {
53
+ box-shadow: 0 0 0 2.5px rgba(var(--information-rgb), .1);
54
+ }
55
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.information > .xxy {
56
+ box-shadow: 0 0 0 2.5px var(--information);
57
+ }
58
+ /* #endregion */
59
+ /* Border Color -> INFORMATION */
60
+
61
+ /* #region Border Color -> DARK */
62
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.dark {
63
+ box-shadow: 0 0 0 2.5px rgba(var(--dark-rgb), .1);
64
+ }
65
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.dark > .xxy {
66
+ box-shadow: 0 0 0 2.5px var(--dark);
67
+ }
68
+ /* #endregion */
69
+ /* Border Color -> DARK */
70
+
71
+ /* #region Border Color -> LIGHT */
72
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.light {
73
+ box-shadow: 0 0 0 2.5px rgba(var(--light-rgb), .1);
74
+ }
75
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch.light > .xxy {
76
+ box-shadow: 0 0 0 2.5px var(--light);
77
+ }
78
+ /* #endregion */
79
+ /* Border Color -> LIGHT */
80
+
@@ -0,0 +1,47 @@
1
+ .ar-switch-wrapper {
2
+ display: flex;
3
+ flex-wrap: nowrap;
4
+ align-items: center;
5
+ width: 100%;
6
+ height: var(--input-height);
7
+ }
8
+ .ar-switch-wrapper > label {
9
+ display: flex;
10
+ flex-direction: row-reverse;
11
+ justify-content: space-between;
12
+ align-items: center;
13
+ gap: 0 0.5rem;
14
+ width: 100%;
15
+ user-select: none;
16
+ }
17
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]) {
18
+ display: none;
19
+ }
20
+
21
+ .ar-switch-wrapper > label > .ar-switch {
22
+ position: relative;
23
+ display: inline-block;
24
+ width: 2.25rem;
25
+ height: 1rem;
26
+ transition: box-shadow 250ms ease-in-out;
27
+ }
28
+
29
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]) + .ar-switch > .xxy {
30
+ position: absolute;
31
+ top: 50%;
32
+ left: 0.15rem;
33
+ transform: translateY(-50%);
34
+ display: inline-block;
35
+ content: "";
36
+ background-color: var(--white);
37
+ width: 0.75rem;
38
+ height: 0.75rem;
39
+ transition: left 150ms, width 150ms 350ms, height 150ms 350ms, box-shadow 150ms 500ms ease-in-out;
40
+ }
41
+ .ar-switch-wrapper > label > :is(input[type="checkbox"]):checked + .ar-switch > .xxy {
42
+ left: calc(2.25rem - 0.9rem);
43
+ width: 1rem;
44
+ height: 1rem;
45
+ }
46
+
47
+ @import url("./core/border.css");
@@ -6,6 +6,9 @@
6
6
  margin-top: -0.75rem;
7
7
  margin-left: -0.75rem;
8
8
  }
9
+ .row:has(+ .row) {
10
+ margin-bottom: 0.75rem;
11
+ }
9
12
  .row > * {
10
13
  padding-top: 0.75rem;
11
14
  padding-left: 0.75rem;
@@ -38,10 +38,4 @@
38
38
  min-width: calc(60% - 5%);
39
39
  }
40
40
 
41
- .ar-layout > main > aside.ar-aside.right {
42
- background-color: var(--white);
43
- padding: 1rem;
44
- border-radius: var(--border-radius-lg);
45
- }
46
-
47
41
  @import url("./header.css");
@@ -174,6 +174,13 @@
174
174
  color: var(--gray-500) !important;
175
175
  cursor: no-drop !important;
176
176
  }
177
+ :is(input, button):is(.outlined):disabled {
178
+ background-color: transparent !important;
179
+ }
180
+ :is(input, button):is(.dashed):disabled {
181
+ background-color: transparent !important;
182
+ border: dashed 1px var(--gray-500) !important;
183
+ }
177
184
  :is(input[type="checkbox"]):disabled + span > .ar-checkbox:is(.borderless) {
178
185
  background-color: var(--gray-100) !important;
179
186
  color: var(--gray-500) !important;
@@ -0,0 +1,4 @@
1
+ export type Props = {
2
+ children: React.JSX.Element | string;
3
+ title?: string;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { Props } from "./Types";
3
+ import "../../../assets/css/components/data-display/card/card.css";
4
+ declare const Card: React.FC<Props>;
5
+ export default Card;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import Typography from "../typography";
3
+ import "../../../assets/css/components/data-display/card/card.css";
4
+ const { Title } = Typography;
5
+ const Card = ({ children, title }) => {
6
+ return (React.createElement("div", { className: "ar-card" },
7
+ React.createElement("div", { className: "title" },
8
+ React.createElement(Title, { Level: "h4" }, title || "")),
9
+ React.createElement("div", { className: "content" }, children)));
10
+ };
11
+ export default Card;
@@ -1,12 +1,14 @@
1
1
  "use client";
2
2
  import React, { useRef } from "react";
3
- const Paragraph = ({ children, color, align = "left", upperCase = false }) => {
3
+ const Paragraph = ({ children, color, align = "left", size, upperCase = false, }) => {
4
4
  // refs
5
5
  let _className = useRef("ar-typography-paragraph").current;
6
6
  if (align)
7
7
  _className += ` ${align}`;
8
8
  if (color)
9
9
  _className += ` ${color}`;
10
+ if (size)
11
+ _className += ` ${size}`;
10
12
  return React.createElement("p", { className: _className }, upperCase ? children.toLocaleUpperCase() : children);
11
13
  };
12
14
  Paragraph.displayName = "Paragraph";
@@ -4,5 +4,6 @@ export type Props = {
4
4
  children: string;
5
5
  color?: ParagraphColors | Colors;
6
6
  align?: "left" | "center" | "right";
7
+ size?: "small" | "normal" | "large";
7
8
  upperCase?: boolean;
8
9
  };
@@ -3,22 +3,32 @@ import React, { useRef } from "react";
3
3
  import "../../../assets/css/components/form/checkbox/checkbox.css";
4
4
  const Checkbox = ({ label, variant = "outlined", status = "primary", border, ...attributes }) => {
5
5
  // refs
6
- let _wrapperClassName = useRef("ar-checkbox-wrapper").current;
7
- let _checkboxClassName = useRef("ar-checkbox").current;
6
+ let _checkbox = useRef(null);
7
+ let _wrapperClassName = "ar-checkbox-wrapper";
8
+ let _checkboxClassName = "ar-checkbox";
8
9
  // checkbox -> variant
9
10
  if (variant)
10
11
  _checkboxClassName += ` ${variant}`;
11
12
  // status
12
- if (status)
13
- _checkboxClassName += ` ${status}`;
13
+ _checkboxClassName += ` light`;
14
14
  // border
15
15
  _checkboxClassName += ` border-style-solid`;
16
16
  _checkboxClassName += ` border-radius-${border?.radius || "sm"}`;
17
17
  return (React.createElement("div", { className: _wrapperClassName },
18
18
  React.createElement("label", null,
19
- React.createElement("input", { type: attributes.type || "checkbox", ...attributes }),
19
+ React.createElement("input", { type: attributes.type || "checkbox", ...attributes, onChange: (event) => {
20
+ (() => {
21
+ const _current = _checkbox.current;
22
+ if (!_current)
23
+ return;
24
+ event.target.checked
25
+ ? _current.classList.replace("light", status)
26
+ : _current.classList.replace(status, "light");
27
+ })();
28
+ (() => attributes.onChange && attributes.onChange(event))();
29
+ } }),
20
30
  React.createElement("span", null,
21
- React.createElement("span", { className: _checkboxClassName }),
31
+ React.createElement("span", { ref: _checkbox, className: _checkboxClassName }),
22
32
  label && React.createElement("span", { className: "label" }, label)))));
23
33
  };
24
34
  Checkbox.displayName = "Checkbox";
@@ -0,0 +1,8 @@
1
+ import { Colors } from "../../../libs/types";
2
+ export type Props = {
3
+ label?: string;
4
+ status?: Colors;
5
+ border?: {
6
+ radius: "sm" | "pill";
7
+ };
8
+ } & React.InputHTMLAttributes<HTMLInputElement>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { Props } from "./Types";
3
+ import "../../../assets/css/components/form/switch/switch.css";
4
+ declare const Switch: React.FC<Props>;
5
+ export default Switch;
@@ -0,0 +1,34 @@
1
+ import React, { useRef } from "react";
2
+ import "../../../assets/css/components/form/switch/switch.css";
3
+ const Switch = ({ label, status = "primary", border, ...attributes }) => {
4
+ // refs
5
+ let _switch = useRef(null);
6
+ // variables
7
+ let _wrapperClassName = "ar-switch-wrapper";
8
+ let _switchClassName = `ar-switch filled`;
9
+ let _xxyClassName = `xxy`;
10
+ // status
11
+ _switchClassName += ` light`;
12
+ // border
13
+ _switchClassName += ` border-style-solid`;
14
+ _switchClassName += ` border-radius-${border?.radius || "pill"}`;
15
+ _xxyClassName += ` border-radius-${border?.radius || "pill"}`;
16
+ return (React.createElement("div", { className: _wrapperClassName },
17
+ React.createElement("label", null,
18
+ React.createElement("input", { type: attributes.type || "checkbox", ...attributes, onChange: (event) => {
19
+ (() => {
20
+ const _current = _switch.current;
21
+ if (!_current)
22
+ return;
23
+ event.target.checked
24
+ ? _current.classList.replace("light", status)
25
+ : _current.classList.replace(status, "light");
26
+ })();
27
+ (() => attributes.onChange && attributes.onChange(event))();
28
+ } }),
29
+ React.createElement("span", { ref: _switch, className: _switchClassName },
30
+ React.createElement("span", { className: _xxyClassName })),
31
+ label && React.createElement("span", { className: "label" }, label))));
32
+ };
33
+ Switch.displayName = "Switch";
34
+ export default Switch;
@@ -4,7 +4,10 @@ import useLayout from "../../libs/core/application/hooks/useLayout";
4
4
  const LSider = () => {
5
5
  // hooks
6
6
  const { options } = useLayout();
7
- return (options?.sider?.left?.active && (React.createElement("aside", { className: "ar-aside left" }, options?.sider?.left?.element)));
7
+ const sider = options?.sider?.left;
8
+ if (!sider?.active)
9
+ return null;
10
+ return React.createElement("aside", { className: "ar-aside left" }, sider.element);
8
11
  };
9
12
  LSider.displayName = "Layout.LSider";
10
13
  export default LSider;
@@ -4,7 +4,10 @@ import useLayout from "../../libs/core/application/hooks/useLayout";
4
4
  const RSider = () => {
5
5
  // hooks
6
6
  const { options } = useLayout();
7
- return (options?.sider?.right?.element && (React.createElement("aside", { className: "ar-aside right" }, options?.sider?.right?.element)));
7
+ const sider = options?.sider?.right;
8
+ if (!sider?.active)
9
+ return null;
10
+ return React.createElement("aside", { className: "ar-aside right" }, sider.element);
8
11
  };
9
12
  RSider.displayName = "Layout.RSider";
10
13
  export default RSider;
package/dist/index.d.ts CHANGED
@@ -4,7 +4,9 @@ import ButtonGroup from "./components/form/button-group";
4
4
  import Input from "./components/form/input";
5
5
  import Select from "./components/form/select";
6
6
  import Checkbox from "./components/form/checkbox";
7
+ import Switch from "./components/form/switch";
7
8
  import Radio from "./components/form/radio";
9
+ import Card from "./components/data-display/card";
8
10
  import Chip from "./components/data-display/chip";
9
11
  import Typography from "./components/data-display/typography";
10
12
  import Divider from "./components/data-display/divider";
@@ -14,4 +16,4 @@ import Menu from "./components/navigation/menu";
14
16
  import Grid from "./components/layout/grid-system";
15
17
  import Layout from "./components/layout";
16
18
  import useLayout from "./libs/core/application/hooks/useLayout";
17
- export { Button, ButtonGroup, Input, Select, Checkbox, Radio, Chip, Typography, Divider, Alert, Menu, Grid, Layout, useLayout, SyntaxHighlighter, };
19
+ export { Button, ButtonGroup, Input, Select, Switch, Checkbox, Radio, Card, Chip, Typography, Divider, Alert, Menu, Grid, Layout, useLayout, SyntaxHighlighter, };
package/dist/index.js CHANGED
@@ -5,8 +5,10 @@ import ButtonGroup from "./components/form/button-group";
5
5
  import Input from "./components/form/input";
6
6
  import Select from "./components/form/select";
7
7
  import Checkbox from "./components/form/checkbox";
8
+ import Switch from "./components/form/switch";
8
9
  import Radio from "./components/form/radio";
9
10
  // Data Display
11
+ import Card from "./components/data-display/card";
10
12
  import Chip from "./components/data-display/chip";
11
13
  import Typography from "./components/data-display/typography";
12
14
  import Divider from "./components/data-display/divider";
@@ -22,9 +24,9 @@ import useLayout from "./libs/core/application/hooks/useLayout";
22
24
  // Others
23
25
  export {
24
26
  // Form Elements
25
- Button, ButtonGroup, Input, Select, Checkbox, Radio,
27
+ Button, ButtonGroup, Input, Select, Switch, Checkbox, Radio,
26
28
  // Data Display
27
- Chip, Typography, Divider,
29
+ Card, Chip, Typography, Divider,
28
30
  // Feedback
29
31
  Alert,
30
32
  // Navigation
@@ -12,12 +12,12 @@ type LayoutOptions = {
12
12
  };
13
13
  };
14
14
  type LayoutContextProps = {
15
- options: Partial<LayoutOptions>;
16
- setOptions: React.Dispatch<React.SetStateAction<Partial<LayoutOptions>>>;
15
+ options: LayoutOptions;
16
+ setOptions: React.Dispatch<React.SetStateAction<LayoutOptions>>;
17
17
  };
18
18
  type LayoutProviderProps = {
19
19
  children: React.ReactNode;
20
20
  };
21
- declare const LayoutContext: React.Context<Partial<LayoutContextProps>>;
21
+ declare const LayoutContext: React.Context<LayoutContextProps>;
22
22
  declare const LayoutProvider: ({ children }: LayoutProviderProps) => React.JSX.Element;
23
23
  export { LayoutContext, LayoutProvider };
@@ -1,8 +1,17 @@
1
1
  "use client";
2
2
  import React, { createContext, useState } from "react";
3
- const LayoutContext = createContext({});
3
+ const defaultOptions = {
4
+ sider: {
5
+ left: { element: null, active: false },
6
+ right: { element: null, active: false },
7
+ },
8
+ };
9
+ const LayoutContext = createContext({
10
+ options: defaultOptions,
11
+ setOptions: () => { },
12
+ });
4
13
  const LayoutProvider = ({ children }) => {
5
- const [options, setOptions] = useState({});
14
+ const [options, setOptions] = useState(defaultOptions);
6
15
  return (React.createElement(LayoutContext.Provider, { value: { options, setOptions } }, children));
7
16
  };
8
17
  export { LayoutContext, LayoutProvider };
@@ -1,5 +1,5 @@
1
- declare const useLayout: () => Partial<{
2
- options: Partial<{
1
+ declare const useLayout: () => {
2
+ options: {
3
3
  sider: {
4
4
  left?: {
5
5
  element?: import("react").ReactNode;
@@ -10,8 +10,8 @@ declare const useLayout: () => Partial<{
10
10
  active: boolean;
11
11
  };
12
12
  };
13
- }>;
14
- setOptions: import("react").Dispatch<import("react").SetStateAction<Partial<{
13
+ };
14
+ setOptions: import("react").Dispatch<import("react").SetStateAction<{
15
15
  sider: {
16
16
  left?: {
17
17
  element?: import("react").ReactNode;
@@ -22,6 +22,6 @@ declare const useLayout: () => Partial<{
22
22
  active: boolean;
23
23
  };
24
24
  };
25
- }>>>;
26
- }>;
25
+ }>>;
26
+ };
27
27
  export default useLayout;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",