dst-rg 1.0.2 → 1.0.4

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 (35) hide show
  1. package/dist/assets/index-BOTEqled.js +198 -0
  2. package/dist/assets/index-CFvpPuYw.css +1 -0
  3. package/dist/index.d.ts +4 -3
  4. package/dist/index.html +2 -2
  5. package/dist/index.js +16 -5
  6. package/dist/index.mjs +15 -4
  7. package/dist/style.css +1 -1
  8. package/package.json +5 -3
  9. package/src/components/Breadcrumbs/_.stories.tsx +1 -1
  10. package/src/components/Breadcrumbs/_.type.ts +1 -0
  11. package/src/components/Breadcrumbs/index.tsx +16 -9
  12. package/src/components/Input/_.stories.tsx +2 -7
  13. package/src/components/Input/_.style.ts +5 -9
  14. package/src/components/Input/_.test.tsx +8 -33
  15. package/src/components/Input/_.types.ts +1 -2
  16. package/src/components/Input/index.tsx +14 -14
  17. package/src/components/InputTags/_.stories.tsx +0 -6
  18. package/src/components/InputTags/_.style.ts +3 -3
  19. package/src/components/InputTags/_.test.tsx +4 -11
  20. package/src/components/InputTags/_.types.ts +1 -2
  21. package/src/components/InputTags/index.tsx +9 -10
  22. package/src/components/Select/_.stories.tsx +1 -1
  23. package/src/components/Select/_.types.ts +1 -1
  24. package/src/components/Select/index.tsx +4 -4
  25. package/src/components/TextArea/_.stories.tsx +3 -12
  26. package/src/components/TextArea/_.style.ts +3 -3
  27. package/src/components/TextArea/_.test.tsx +3 -5
  28. package/src/components/TextArea/_.types.ts +1 -2
  29. package/src/components/TextArea/index.tsx +7 -8
  30. package/src/components/developers/AmirHossein.tsx +4 -6
  31. package/src/components/developers/Rasoul.tsx +18 -1
  32. package/src/main.tsx +10 -3
  33. package/dist/assets/index-3jvN1gZ8.js +0 -186
  34. package/dist/assets/index-Mg-hjQGu.css +0 -1
  35. package/src/components/Breadcrumbs/_.test.tsx +0 -29
@@ -26,8 +26,7 @@ export type inputProps = {
26
26
  | "shaba";
27
27
  icon?: ComponentType<IconPropsType>;
28
28
  leadingTextValue?: string;
29
- destructive?: boolean;
30
- destructiveText?: string;
29
+ error?: string;
31
30
  dir?: "ltr" | "rtl";
32
31
  label?: string;
33
32
  required?: boolean;
@@ -1,6 +1,6 @@
1
1
  import {
2
- destructiveStyles,
3
2
  disableStyles,
3
+ errorStyles,
4
4
  iconShabaStyles,
5
5
  iconStyles,
6
6
  iconTrailingButtonStyles,
@@ -18,6 +18,7 @@ import { IconPropsType } from "@/icons/icons.type";
18
18
  import { cn } from "@/lib/utils";
19
19
  import { Copy, Eye, EyeOff } from "lucide-react";
20
20
  import React, { useState } from "react";
21
+ import { twMerge } from "tailwind-merge";
21
22
  import { Button } from "../Button";
22
23
  import { Select } from "../Select";
23
24
  import { TooltipWrapper } from "../Tooltip";
@@ -30,8 +31,7 @@ export const Input = ({
30
31
  id,
31
32
  label,
32
33
  required = false,
33
- destructive = false,
34
- destructiveText,
34
+ error,
35
35
  hintText,
36
36
  placeholder,
37
37
  helpIcon = false,
@@ -90,7 +90,7 @@ export const Input = ({
90
90
  aria-label="leadingText"
91
91
  className={`${leadingTextValueStyles} ${size === "sm" ? "pt-2" : "pt-2.5"
92
92
  }
93
- ${destructive === true
93
+ ${Boolean(error) === true
94
94
  ? "border-rborder-error"
95
95
  : "border-rborder-primary"
96
96
  }`}
@@ -112,8 +112,8 @@ export const Input = ({
112
112
  className={cn(
113
113
  inputVariants({ size, inputType }),
114
114
  className,
115
- destructive && "bg-rbg-disabled-subtle",
116
- destructive && destructiveStyles,
115
+ Boolean(error) && "bg-rbg-disabled-subtle",
116
+ Boolean(error) && errorStyles,
117
117
  disabled && disableStyles
118
118
  )}
119
119
  type={type === "password" && showPassword ? "text" : type}
@@ -142,7 +142,7 @@ export const Input = ({
142
142
  </div>
143
143
  )}
144
144
 
145
- {helpIcon && tooltipProps && destructive === false && (
145
+ {helpIcon && tooltipProps && Boolean(error) === false && (
146
146
  <TooltipWrapper
147
147
  content={tooltipProps?.text}
148
148
  description={tooltipProps?.description}
@@ -166,7 +166,7 @@ export const Input = ({
166
166
  </div>
167
167
  </TooltipWrapper>
168
168
  )}
169
- {/* {destructive && type !== "password" && (
169
+ {/* {error && type !== "password" && (
170
170
  <div
171
171
  className={`w-fit absolute top-1/2 -translate-y-1/2
172
172
  ${inputType == "trailingButton"
@@ -183,7 +183,7 @@ export const Input = ({
183
183
  <button
184
184
  aria-label="copyButton"
185
185
  onClick={() => copyHandler(String(value))}
186
- className={`${trailingButton} ${destructive === true
186
+ className={`${trailingButton} ${Boolean(error) === true
187
187
  ? "border-rborder-error"
188
188
  : "border-rborder-primary"
189
189
  }`}
@@ -200,7 +200,7 @@ export const Input = ({
200
200
  canSelectZero: true,
201
201
  name: "trailingDropdown",
202
202
  }}
203
- className="w-fit absolute rtl:left-0 ltr:right-0 top-0"
203
+ className={twMerge("w-fit absolute rtl:left-0 ltr:right-0 top-0", Boolean(error) && "border-2 border-error-500 rounded-xl")}
204
204
  />
205
205
  )}
206
206
  {inputType == "shaba" && (
@@ -209,7 +209,7 @@ export const Input = ({
209
209
  className={cn(
210
210
  trailingShabaLabelBase,
211
211
  trailingShabaLabelSizes[shabaLabelSize],
212
- destructive === true
212
+ Boolean(error) === true
213
213
  ? "border-rborder-error"
214
214
  : "border-rborder-primary"
215
215
  )}
@@ -218,12 +218,12 @@ export const Input = ({
218
218
  </div>
219
219
  )}
220
220
  </div>
221
- {destructive === false && hintText && (
221
+ {Boolean(error) === false && hintText && (
222
222
  <p className="text-sm text-rtext-tertiary-600">{hintText}</p>
223
223
  )}
224
- {destructive && destructiveText && (
224
+ {Boolean(error) && (
225
225
  <p className="text-sm text-rtext-error-primary-600">
226
- {destructiveText}
226
+ {error}
227
227
  </p>
228
228
  )}
229
229
  </div>
@@ -20,10 +20,6 @@ export default {
20
20
  control: { type: "radio" },
21
21
  options: ["sm", "md"],
22
22
  },
23
- destructive: {
24
- control: { type: "radio" },
25
- options: [true, false]
26
- },
27
23
  },
28
24
  args: {
29
25
  disabled: false,
@@ -33,8 +29,6 @@ export default {
33
29
  required: true,
34
30
  hintText: "This is a hint text to help user.",
35
31
  placeholder: "Enter your email",
36
- destructive: false,
37
- destructiveText: "error text",
38
32
  helpIcon: true,
39
33
  tooltipProps: {
40
34
  text: "This is a tooltip",
@@ -1,4 +1,4 @@
1
- import {cva} from "class-variance-authority";
1
+ import { cva } from "class-variance-authority";
2
2
 
3
3
  const baseStyles =
4
4
  "rounded-md px-2 shadow-xs bg-white border border-rborder-primary disabled:border-rborder-disabled flex flex-wrap " +
@@ -9,7 +9,7 @@ const sizeStyle = {
9
9
  md: "h-10 pt-2 pb-2.5",
10
10
  };
11
11
 
12
- const destructiveStyles = "!border-2 !border-rborder-error focus:!outline-0"
12
+ const errorStyles = "!border-2 !border-rborder-error focus:!outline-0"
13
13
 
14
14
  const disableStyles = "bg-rbg-disabled-subtle border-rborder-disabled"
15
15
 
@@ -25,4 +25,4 @@ const inputTagsVariants = cva(
25
25
  }
26
26
  )
27
27
 
28
- export {baseStyles, sizeStyle, destructiveStyles,disableStyles, inputTagsVariants};
28
+ export { baseStyles, disableStyles, errorStyles, inputTagsVariants, sizeStyle };
@@ -8,7 +8,6 @@ const createInputTagsProps = (overrides: Partial<inputTagsProps> = {}): inputTag
8
8
  label: "Email",
9
9
  id: "email-input",
10
10
  size: "sm",
11
- destructive: false,
12
11
  required: true,
13
12
  hintText: "This is a hint text to help user.",
14
13
  placeholder: "Enter your email",
@@ -76,16 +75,10 @@ describe("InputTags Component", () => {
76
75
  expect(screen.queryByText("tag1")).not.toBeInTheDocument();
77
76
  });
78
77
 
79
- it("renders destructive state with destructive text", () => {
80
- render(<InputTags {...createInputTagsProps({ destructive: true, destructiveText: "Destructive action" })} />);
81
- const destructiveText = screen.getByText("Destructive action");
82
- expect(destructiveText).toBeInTheDocument();
83
- });
84
-
85
- it("does not render destructive text when destructive is false", () => {
86
- render(<InputTags {...createInputTagsProps({ destructive: false })} />);
87
- const destructiveText = screen.queryByText("Destructive action");
88
- expect(destructiveText).not.toBeInTheDocument();
78
+ it("does not render error text when error is false", () => {
79
+ render(<InputTags {...createInputTagsProps()} />);
80
+ const errorText = screen.queryByText("error action");
81
+ expect(errorText).not.toBeInTheDocument();
89
82
  });
90
83
 
91
84
  it("adds a tag when 'Enter' key is pressed", () => {
@@ -10,8 +10,7 @@ export type inputTagsProps = {
10
10
  descriptionClassName?: string,
11
11
  };
12
12
  size?: "sm" | "md";
13
- destructive?: boolean;
14
- destructiveText?: string;
13
+ error?: string;
15
14
  dir?: "ltr" | "rtl";
16
15
  label?: string;
17
16
  required?: boolean;
@@ -1,4 +1,4 @@
1
- import { destructiveStyles, disableStyles, inputTagsVariants } from "@/components/InputTags/_.style";
1
+ import { disableStyles, errorStyles, inputTagsVariants } from "@/components/InputTags/_.style";
2
2
  import { inputTagsProps } from "@/components/InputTags/_.types";
3
3
  import { InputLabel } from "@/components/ui/input-component/input-label";
4
4
  import AttentionMark from "@/icons/general/attention-mark";
@@ -15,8 +15,7 @@ export const InputTags = (
15
15
  id,
16
16
  label,
17
17
  required = false,
18
- destructive = false,
19
- destructiveText,
18
+ error,
20
19
  hintText,
21
20
  placeholder,
22
21
  helpIcon = false,
@@ -66,10 +65,10 @@ export const InputTags = (
66
65
  className={cn(
67
66
  inputTagsVariants({ size }),
68
67
  className,
69
- destructive === true && destructiveStyles,
68
+ Boolean(error) === true && errorStyles,
70
69
  disabled && disableStyles,
71
70
  "group-focus-within:outline-2 group-focus-within:outline-rborder-brand",
72
- destructive && "bg-rbg-disabled-subtle border-rborder-disabled"
71
+ Boolean(error) && "bg-rbg-disabled-subtle border-rborder-disabled"
73
72
  )}
74
73
  >
75
74
  {
@@ -101,7 +100,7 @@ export const InputTags = (
101
100
  placeholder={tags?.length === 0 ? placeholder : ""}
102
101
  />
103
102
 
104
- {helpIcon && tooltipProps && destructive === false && (
103
+ {helpIcon && tooltipProps && Boolean(error) === false && (
105
104
  <TooltipWrapper
106
105
  content={tooltipProps?.text}
107
106
  description={tooltipProps?.description}
@@ -119,7 +118,7 @@ export const InputTags = (
119
118
  )}
120
119
 
121
120
  {
122
- destructive === true &&
121
+ Boolean(error) === true &&
123
122
  <div className="absolute top-1/2 -translate-y-1/2 ltr:right-2 rtl:left-2 w-fit">
124
123
  <AttentionMark />
125
124
  </div>
@@ -128,12 +127,12 @@ export const InputTags = (
128
127
  </div>
129
128
  </div>
130
129
  {
131
- (destructive === false && hintText) &&
130
+ (Boolean(error) === false && hintText) &&
132
131
  <p className="text-sm text-rtext-tertiary-600">{hintText}</p>
133
132
  }
134
133
  {
135
- (destructive && destructiveText) &&
136
- <p className="text-sm text-rtext-error-primary-600">{destructiveText}</p>
134
+ (Boolean(error)) &&
135
+ <p className="text-sm text-rtext-error-primary-600">{error}</p>
137
136
  }
138
137
  </div>
139
138
  );
@@ -127,7 +127,7 @@ export const WithError: Story = {
127
127
  name: "payment",
128
128
  isRequiredInput: true,
129
129
  canSelectZero: false,
130
- errorText: "Please select a payment method",
130
+ error: "Please select a payment method",
131
131
  },
132
132
  selectedValueLabel: "Select payment method",
133
133
  options: [
@@ -1,7 +1,7 @@
1
1
  type configProps = {
2
2
  label?: string,
3
3
  name: string,
4
- errorText?: string,
4
+ error?: string,
5
5
  hintText?: string,
6
6
  isRequiredInput?: boolean,
7
7
  canSelectZero?: boolean
@@ -24,7 +24,7 @@ const Select = ({
24
24
  const {
25
25
  label,
26
26
  name,
27
- errorText,
27
+ error,
28
28
  hintText,
29
29
  isRequiredInput = false,
30
30
  canSelectZero = false,
@@ -156,12 +156,12 @@ const Select = ({
156
156
  dangerouslySetInnerHTML={{ __html: tooltipTitle }}
157
157
  />
158
158
  )}
159
- {!errorText && hintText && (
159
+ {!error && hintText && (
160
160
  <p className="text-sm text-rtext-tertiary-600">{hintText}</p>
161
161
  )}
162
- {errorText && (
162
+ {error && (
163
163
  <p className="text-sm text-rtext-error-primary-600">
164
- {errorText}
164
+ {error}
165
165
  </p>
166
166
  )}
167
167
  </div>
@@ -11,15 +11,7 @@ export default {
11
11
  disabled: {
12
12
  control: { type: "radio" },
13
13
  options: [true, false]
14
- },
15
- destructive: {
16
- control: { type: "radio" },
17
- options: [true, false]
18
- },
19
- helpIcon: {
20
- control: { type: "radio" },
21
- options: [true, false]
22
- },
14
+ }
23
15
  },
24
16
  args: {
25
17
  row: 5,
@@ -28,8 +20,6 @@ export default {
28
20
  required: true,
29
21
  hintText: "This is a hint text to help user.",
30
22
  placeholder: "Enter a description...",
31
- destructive: false,
32
- destructiveText: "This is an error message.",
33
23
  helpIcon: true,
34
24
  tooltipProps: {
35
25
  text: "This is a tooltip",
@@ -57,6 +47,7 @@ export const InputAutoFocus: Story = {
57
47
  args: {
58
48
  label: "توضیحات",
59
49
  placeholder: "توضیحات را وارد کنید",
60
- autoFocus: true
50
+ autoFocus: true,
51
+ error: "This is an error message.",
61
52
  },
62
53
  };
@@ -1,11 +1,11 @@
1
- import {cva} from "class-variance-authority";
1
+ import { cva } from "class-variance-authority";
2
2
 
3
3
  const baseStyles =
4
4
  "rounded-md p-2 shadow-xs w-fit bg-white border border-rborder-primary" +
5
5
  " focus:outline-2 focus:outline-rborder-brand disabled:bg-rbg-disabled-subtle disabled:border-rborder-disabled w-full";
6
6
 
7
- const destructiveStyles = "!border-2 !border-rborder-error focus:!outline-0"
7
+ const errorStyles = "!border-2 !border-rborder-error focus:!outline-0"
8
8
 
9
9
  const textAreaVariants = cva(baseStyles)
10
10
 
11
- export {baseStyles,destructiveStyles,textAreaVariants};
11
+ export { baseStyles, errorStyles, textAreaVariants };
@@ -4,16 +4,15 @@ import { TextArea } from "./index";
4
4
 
5
5
  describe("TextArea component", () => {
6
6
  const defaultProps = {
7
- destructive: false,
8
7
  disabled: false,
9
- destructiveText: "This is an error message.",
8
+ error: "This is an error message.",
10
9
  label: "Description",
11
10
  helpIcon: true,
12
11
  required: true,
13
12
  hintText: "This is a hint text to help user.",
14
13
  placeholder: "Enter a description...",
15
14
  className: "w-fit",
16
- name:"description"
15
+ name: "description"
17
16
  };
18
17
 
19
18
  it("calls onChange handler", () => {
@@ -30,11 +29,10 @@ describe("TextArea component", () => {
30
29
  expect(textarea).toBeDisabled();
31
30
  });
32
31
 
33
- it("applies destructive styles when destructive is true", () => {
32
+ it("applies error styles when error is true", () => {
34
33
  render(
35
34
  <TextArea
36
35
  {...defaultProps}
37
- destructive={true}
38
36
  />
39
37
  );
40
38
  const textarea = screen.getByRole("textbox");
@@ -8,8 +8,7 @@ export type textAreaProps = {
8
8
  id?: string;
9
9
  value?: string;
10
10
  placeholder?: string;
11
- destructive?: boolean;
12
- destructiveText?: string;
11
+ error?: string;
13
12
  label?: string;
14
13
  required?: boolean;
15
14
  hintText?: string;
@@ -1,5 +1,5 @@
1
1
  import {
2
- destructiveStyles,
2
+ errorStyles,
3
3
  textAreaVariants,
4
4
  } from "@/components/TextArea/_.style";
5
5
  import { textAreaProps } from "@/components/TextArea/_.types";
@@ -12,9 +12,8 @@ const TextArea = ({
12
12
  row = 5,
13
13
  label,
14
14
  required = false,
15
- destructive = false,
16
15
  disabled = false,
17
- destructiveText,
16
+ error,
18
17
  hintText,
19
18
  placeholder,
20
19
  helpIcon = false,
@@ -61,18 +60,18 @@ const TextArea = ({
61
60
  className={cn(
62
61
  textAreaVariants(),
63
62
  className,
64
- destructive && destructiveStyles,
65
- destructive && "bg-rbg-disabled-subtle border-rborder-disabled"
63
+ Boolean(error) && errorStyles,
64
+ Boolean(error) && "bg-rbg-disabled-subtle border-rborder-disabled"
66
65
  )}
67
66
  autoFocus={autoFocus}
68
67
  {...props}
69
68
  />
70
- {destructive === false && hintText && (
69
+ {Boolean(error) === false && hintText && (
71
70
  <p className="text-sm text-rtext-tertiary-600">{hintText}</p>
72
71
  )}
73
- {destructive && destructiveText && (
72
+ {Boolean(error) && (
74
73
  <p className="text-sm text-rtext-error-primary-600">
75
- {destructiveText}
74
+ {error}
76
75
  </p>
77
76
  )}
78
77
  </div>
@@ -54,8 +54,7 @@ const MemoAmirHossein = () => {
54
54
  dir: "ltr",
55
55
  descriptionClassName: "max-w-[260px] w-full",
56
56
  }}
57
- destructive={false}
58
- destructiveText="error text"
57
+ error="error text"
59
58
  size="sm"
60
59
  type="text"
61
60
  inputType="trailingDropdown"
@@ -93,8 +92,8 @@ const MemoAmirHossein = () => {
93
92
  descriptionClassName: "max-w-[260px] w-full",
94
93
  }}
95
94
  // disabled={true}
96
- // destructive={true}
97
- destructiveText="This is an error message."
95
+ // error={true}
96
+ error="This is an error message."
98
97
  label="Description"
99
98
  helpIcon={true}
100
99
  required={true}
@@ -116,8 +115,7 @@ const MemoAmirHossein = () => {
116
115
  dir: "ltr",
117
116
  descriptionClassName: "max-w-[260px] w-full",
118
117
  }}
119
- destructive={false}
120
- destructiveText="error text"
118
+ error="error text"
121
119
  size="sm"
122
120
  label="Tags"
123
121
  required={true}
@@ -1,3 +1,4 @@
1
+ import { Breadcrumb } from "@/components/Breadcrumbs";
1
2
  import Activity from "@/icons/general/activity";
2
3
  import XClose from "@/icons/general/x-close";
3
4
  import { ArrowRight } from "lucide-react";
@@ -24,9 +25,25 @@ const MemoRasoul = () => {
24
25
  { title: "g", value: 7 },
25
26
  ];
26
27
 
28
+ const Breadcrumbs = [
29
+ { title: "دسته بندی", link: "/category" },
30
+ { title: "زیر دسته بندی ", link: "/subcategory" },
31
+ { title: "محصولات", link: "/product" },
32
+ ];
33
+
27
34
  return (
28
35
  <div className="w-full flex flex-col gap-4">
29
36
  <ToastContainer />
37
+ <Breadcrumb
38
+ breadCrumbLink={Breadcrumbs}
39
+ dir="ltr"
40
+ linkClassName="text-blue-500 hover:underline"
41
+ listClassName="list-none flex gap-x-2"
42
+ listItemClassName="text-lg font-semibold"
43
+ navClassName="bg-gray-100 p-4"
44
+ separatorClassName="text-gray-500"
45
+ type="chevron"
46
+ />
30
47
  <Select
31
48
  isLoading={false}
32
49
  onChange={(val) => setSelectedValue(val?.value)}
@@ -41,7 +58,7 @@ const MemoRasoul = () => {
41
58
  config={{
42
59
  name: "gio",
43
60
  canSelectZero: true,
44
- errorText: "gio error",
61
+ error: "gio error",
45
62
  isRequiredInput: true,
46
63
  label: "gio gio",
47
64
  }}
package/src/main.tsx CHANGED
@@ -1,5 +1,6 @@
1
1
  import { StrictMode } from "react";
2
2
  import { createRoot } from "react-dom/client";
3
+ import { createBrowserRouter, RouterProvider } from "react-router-dom";
3
4
  import { ToastContainer } from "./components";
4
5
  import AmirHossein from "./components/developers/AmirHossein";
5
6
  import Fardin from "./components/developers/Fardin";
@@ -25,9 +26,8 @@ const App = () => {
25
26
  onToggle={darkModeToggler}
26
27
  />
27
28
  </div>
28
-
29
- <AmirHossein />
30
29
  <Rasoul />
30
+ <AmirHossein />
31
31
  <Maryam />
32
32
  <Fardin />
33
33
  <Milad />
@@ -36,6 +36,13 @@ const App = () => {
36
36
  );
37
37
  };
38
38
 
39
+ const router = createBrowserRouter([
40
+ {
41
+ path: "/",
42
+ element: <App />,
43
+ },
44
+ ]);
45
+
39
46
  createRoot(document.getElementById("root")!).render(
40
47
  <StrictMode>
41
48
  <ToastContainer
@@ -45,6 +52,6 @@ createRoot(document.getElementById("root")!).render(
45
52
  animation="slide"
46
53
  showProgress={true}
47
54
  />
48
- <App />
55
+ <RouterProvider router={router} />
49
56
  </StrictMode>
50
57
  );