@sustaina/shared-ui 1.1.8 → 1.2.0
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.
- package/README.md +166 -0
- package/dist/index.d.mts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +230 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +232 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,135 @@ To use `@sustaina/shared-ui` in your project, follow these steps carefully.
|
|
|
10
10
|
|
|
11
11
|
Make sure you've installed [TailwindCSS](https://tailwindcss.com/docs/installation) and [shadcn/ui](https://ui.shadcn.com/docs/installation/manual) before installing our library. **Don’t skip this.**
|
|
12
12
|
|
|
13
|
+
### 1. Place shadcn/ui styles
|
|
14
|
+
|
|
15
|
+
```css
|
|
16
|
+
@import "tailwindcss";
|
|
17
|
+
@import "tw-animate-css";
|
|
18
|
+
@custom-variant dark (&:is(.dark *));
|
|
19
|
+
|
|
20
|
+
:root {
|
|
21
|
+
--background: oklch(1 0 0);
|
|
22
|
+
--foreground: oklch(0.145 0 0);
|
|
23
|
+
--card: oklch(1 0 0);
|
|
24
|
+
--card-foreground: oklch(0.145 0 0);
|
|
25
|
+
--popover: oklch(1 0 0);
|
|
26
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
27
|
+
--primary: oklch(0.205 0 0);
|
|
28
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
29
|
+
--secondary: oklch(0.97 0 0);
|
|
30
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
31
|
+
--muted: oklch(0.97 0 0);
|
|
32
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
33
|
+
--accent: oklch(0.97 0 0);
|
|
34
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
35
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
36
|
+
--destructive-foreground: oklch(0.577 0.245 27.325);
|
|
37
|
+
--border: oklch(0.922 0 0);
|
|
38
|
+
--input: oklch(0.922 0 0);
|
|
39
|
+
--ring: oklch(0.708 0 0);
|
|
40
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
41
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
42
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
43
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
44
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
45
|
+
--radius: 0.625rem;
|
|
46
|
+
--sidebar: oklch(0.985 0 0);
|
|
47
|
+
--sidebar-foreground: oklch(0.145 0 0);
|
|
48
|
+
--sidebar-primary: oklch(0.205 0 0);
|
|
49
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
50
|
+
--sidebar-accent: oklch(0.97 0 0);
|
|
51
|
+
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
52
|
+
--sidebar-border: oklch(0.922 0 0);
|
|
53
|
+
--sidebar-ring: oklch(0.708 0 0);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dark {
|
|
57
|
+
--background: oklch(0.145 0 0);
|
|
58
|
+
--foreground: oklch(0.985 0 0);
|
|
59
|
+
--card: oklch(0.145 0 0);
|
|
60
|
+
--card-foreground: oklch(0.985 0 0);
|
|
61
|
+
--popover: oklch(0.145 0 0);
|
|
62
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
63
|
+
--primary: oklch(0.985 0 0);
|
|
64
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
65
|
+
--secondary: oklch(0.269 0 0);
|
|
66
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
67
|
+
--muted: oklch(0.269 0 0);
|
|
68
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
69
|
+
--accent: oklch(0.269 0 0);
|
|
70
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
71
|
+
--destructive: oklch(0.396 0.141 25.723);
|
|
72
|
+
--destructive-foreground: oklch(0.637 0.237 25.331);
|
|
73
|
+
--border: oklch(0.269 0 0);
|
|
74
|
+
--input: oklch(0.269 0 0);
|
|
75
|
+
--ring: oklch(0.439 0 0);
|
|
76
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
77
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
78
|
+
--chart-3: oklch(0.769 0.188 70.08);
|
|
79
|
+
--chart-4: oklch(0.627 0.265 303.9);
|
|
80
|
+
--chart-5: oklch(0.645 0.246 16.439);
|
|
81
|
+
--sidebar: oklch(0.205 0 0);
|
|
82
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
83
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
84
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
85
|
+
--sidebar-accent: oklch(0.269 0 0);
|
|
86
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
87
|
+
--sidebar-border: oklch(0.269 0 0);
|
|
88
|
+
--sidebar-ring: oklch(0.439 0 0);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@theme inline {
|
|
92
|
+
--color-background: var(--background);
|
|
93
|
+
--color-foreground: var(--foreground);
|
|
94
|
+
--color-card: var(--card);
|
|
95
|
+
--color-card-foreground: var(--card-foreground);
|
|
96
|
+
--color-popover: var(--popover);
|
|
97
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
98
|
+
--color-primary: var(--primary);
|
|
99
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
100
|
+
--color-secondary: var(--secondary);
|
|
101
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
102
|
+
--color-muted: var(--muted);
|
|
103
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
104
|
+
--color-accent: var(--accent);
|
|
105
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
106
|
+
--color-destructive: var(--destructive);
|
|
107
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
108
|
+
--color-border: var(--border);
|
|
109
|
+
--color-input: var(--input);
|
|
110
|
+
--color-ring: var(--ring);
|
|
111
|
+
--color-chart-1: var(--chart-1);
|
|
112
|
+
--color-chart-2: var(--chart-2);
|
|
113
|
+
--color-chart-3: var(--chart-3);
|
|
114
|
+
--color-chart-4: var(--chart-4);
|
|
115
|
+
--color-chart-5: var(--chart-5);
|
|
116
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
117
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
118
|
+
--radius-lg: var(--radius);
|
|
119
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
120
|
+
--color-sidebar: var(--sidebar);
|
|
121
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
122
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
123
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
124
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
125
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
126
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
127
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@layer base {
|
|
131
|
+
* {
|
|
132
|
+
@apply border-border outline-ring/50;
|
|
133
|
+
}
|
|
134
|
+
body {
|
|
135
|
+
@apply bg-background text-foreground;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 2. Install library
|
|
141
|
+
|
|
13
142
|
```bash
|
|
14
143
|
npm install @sustaina/shared-ui
|
|
15
144
|
```
|
|
@@ -45,8 +174,10 @@ Supported versions:
|
|
|
45
174
|
To make styling work with our components, add this to your `index.css` or root CSS file:
|
|
46
175
|
|
|
47
176
|
```css
|
|
177
|
+
... omit code
|
|
48
178
|
@import "@sustaina/shared-ui/styles.css"; /* this include styles/theme.css already */
|
|
49
179
|
@source "../../node_modules/@sustaina/shared-ui/dist"; /* depend your root CSS file locate. */
|
|
180
|
+
... omit code
|
|
50
181
|
```
|
|
51
182
|
|
|
52
183
|
---
|
|
@@ -67,6 +198,28 @@ export default function MyComponent() {
|
|
|
67
198
|
|
|
68
199
|
# Developer Notes
|
|
69
200
|
|
|
201
|
+
## Git Flow
|
|
202
|
+
|
|
203
|
+
### How to developed
|
|
204
|
+
|
|
205
|
+
We follow a **`feature/xxx` → `dev` → `prod`** workflow:
|
|
206
|
+
|
|
207
|
+
- Developed on `feature/xxx` or `bugfix/xxx` or any what you want. Then **merge request** to `dev`
|
|
208
|
+
- Only `prod` branch triggers **npm package publishing**.
|
|
209
|
+
- To publish a new version:
|
|
210
|
+
- Create a **merge request from `dev` to `prod`**, or
|
|
211
|
+
- Contact your lead developer or maintainer to perform the merge.
|
|
212
|
+
|
|
213
|
+
### Versioning & Commits
|
|
214
|
+
|
|
215
|
+
We use **semantic versioning**:
|
|
216
|
+
|
|
217
|
+
- `patch` → bug fixes (`fix: description`)
|
|
218
|
+
- `minor` → new features (`feat: description`)
|
|
219
|
+
- All other commit types (e.g., `docs`, `chore`, `refactor`) **do not trigger a version change**.
|
|
220
|
+
|
|
221
|
+
**<em>no major change for now just use `patch` and `minor`</em>**
|
|
222
|
+
|
|
70
223
|
## CSS and Custom Styling
|
|
71
224
|
|
|
72
225
|
- **Prefer Tailwind classes inline** whenever possible.
|
|
@@ -104,4 +257,17 @@ export default function MyComponent() {
|
|
|
104
257
|
- `"append"` → add content at the end of the destination file.
|
|
105
258
|
- `"prepend"` → add content at the beginning of the destination file.
|
|
106
259
|
- This script handles copying files into the `dist` folder during the build process.
|
|
260
|
+
- After copying files, you can export them for consumers.
|
|
261
|
+
- Add `exports` your file in `package.json`
|
|
262
|
+
```json
|
|
263
|
+
"exports": {
|
|
264
|
+
".": {
|
|
265
|
+
"require": "./dist/index.js",
|
|
266
|
+
"import": "./dist/index.mjs",
|
|
267
|
+
"types": "./dist/index.d.ts"
|
|
268
|
+
},
|
|
269
|
+
"./styles.css": "./dist/index.css",
|
|
270
|
+
"./helpers": "./dist/helpers.js"
|
|
271
|
+
}
|
|
272
|
+
```
|
|
107
273
|
- **Note:** This will happen automatically when you run `npm run build`.
|
package/dist/index.d.mts
CHANGED
|
@@ -351,6 +351,23 @@ interface AdvanceSearchProps {
|
|
|
351
351
|
|
|
352
352
|
declare const AdvanceSearch: React__default.FC<AdvanceSearchProps>;
|
|
353
353
|
|
|
354
|
+
type ConfirmDialogProps = {
|
|
355
|
+
dialogData: {
|
|
356
|
+
state: boolean;
|
|
357
|
+
title?: string;
|
|
358
|
+
description?: string;
|
|
359
|
+
btn?: string;
|
|
360
|
+
variantBtn?: string;
|
|
361
|
+
btnState?: boolean;
|
|
362
|
+
onClickBtn?: () => void;
|
|
363
|
+
variant?: "default" | "success" | "error";
|
|
364
|
+
showCloseBtn?: boolean;
|
|
365
|
+
};
|
|
366
|
+
setDialog: (data: any) => void;
|
|
367
|
+
onClose?: () => void;
|
|
368
|
+
};
|
|
369
|
+
declare function ConfirmDialog({ dialogData, setDialog, onClose }: ConfirmDialogProps): react_jsx_runtime.JSX.Element;
|
|
370
|
+
|
|
354
371
|
/**
|
|
355
372
|
* Utility function to intelligently combine class names using `clsx`
|
|
356
373
|
* and resolve Tailwind CSS class conflicts using `tailwind-merge`.
|
|
@@ -454,4 +471,4 @@ type Breakpoints = {
|
|
|
454
471
|
};
|
|
455
472
|
declare const useScreenSize: (breakpoints?: Breakpoints) => UseScreenSizeResult;
|
|
456
473
|
|
|
457
|
-
export { AdvanceSearch, type Breakpoints, Button, type Column, type ContentSlot, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, type FieldSchema, FormErrorMessage, type FormErrorMessageProps, FormField, FormFieldContext, type FormFieldContextValue, type FormFieldProps, FormItem, FormItemContext, type FormItemContextValue, type FormItemProps, FormLabel, type FormLabelProps, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, _default as Navbar, type NavbarProps, NumberInput, type NumberInputProps, type SorterProps, TextInput, type TextInputProps, type UseFormFieldOptions, type UseFormFieldReturn, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UseScreenSizeResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, getColumnIdFromTable, renderContentSlot, selectValueToBoolean, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, useScreenSize };
|
|
474
|
+
export { AdvanceSearch, type Breakpoints, Button, type Column, type ContentSlot, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, ConfirmDialog as Dialog, type FieldSchema, FormErrorMessage, type FormErrorMessageProps, FormField, FormFieldContext, type FormFieldContextValue, type FormFieldProps, FormItem, FormItemContext, type FormItemContextValue, type FormItemProps, FormLabel, type FormLabelProps, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, _default as Navbar, type NavbarProps, NumberInput, type NumberInputProps, type SorterProps, TextInput, type TextInputProps, type UseFormFieldOptions, type UseFormFieldReturn, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UseScreenSizeResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, getColumnIdFromTable, renderContentSlot, selectValueToBoolean, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, useScreenSize };
|
package/dist/index.d.ts
CHANGED
|
@@ -351,6 +351,23 @@ interface AdvanceSearchProps {
|
|
|
351
351
|
|
|
352
352
|
declare const AdvanceSearch: React__default.FC<AdvanceSearchProps>;
|
|
353
353
|
|
|
354
|
+
type ConfirmDialogProps = {
|
|
355
|
+
dialogData: {
|
|
356
|
+
state: boolean;
|
|
357
|
+
title?: string;
|
|
358
|
+
description?: string;
|
|
359
|
+
btn?: string;
|
|
360
|
+
variantBtn?: string;
|
|
361
|
+
btnState?: boolean;
|
|
362
|
+
onClickBtn?: () => void;
|
|
363
|
+
variant?: "default" | "success" | "error";
|
|
364
|
+
showCloseBtn?: boolean;
|
|
365
|
+
};
|
|
366
|
+
setDialog: (data: any) => void;
|
|
367
|
+
onClose?: () => void;
|
|
368
|
+
};
|
|
369
|
+
declare function ConfirmDialog({ dialogData, setDialog, onClose }: ConfirmDialogProps): react_jsx_runtime.JSX.Element;
|
|
370
|
+
|
|
354
371
|
/**
|
|
355
372
|
* Utility function to intelligently combine class names using `clsx`
|
|
356
373
|
* and resolve Tailwind CSS class conflicts using `tailwind-merge`.
|
|
@@ -454,4 +471,4 @@ type Breakpoints = {
|
|
|
454
471
|
};
|
|
455
472
|
declare const useScreenSize: (breakpoints?: Breakpoints) => UseScreenSizeResult;
|
|
456
473
|
|
|
457
|
-
export { AdvanceSearch, type Breakpoints, Button, type Column, type ContentSlot, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, type FieldSchema, FormErrorMessage, type FormErrorMessageProps, FormField, FormFieldContext, type FormFieldContextValue, type FormFieldProps, FormItem, FormItemContext, type FormItemContextValue, type FormItemProps, FormLabel, type FormLabelProps, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, _default as Navbar, type NavbarProps, NumberInput, type NumberInputProps, type SorterProps, TextInput, type TextInputProps, type UseFormFieldOptions, type UseFormFieldReturn, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UseScreenSizeResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, getColumnIdFromTable, renderContentSlot, selectValueToBoolean, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, useScreenSize };
|
|
474
|
+
export { AdvanceSearch, type Breakpoints, Button, type Column, type ContentSlot, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, ConfirmDialog as Dialog, type FieldSchema, FormErrorMessage, type FormErrorMessageProps, FormField, FormFieldContext, type FormFieldContextValue, type FormFieldProps, FormItem, FormItemContext, type FormItemContextValue, type FormItemProps, FormLabel, type FormLabelProps, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, _default as Navbar, type NavbarProps, NumberInput, type NumberInputProps, type SorterProps, TextInput, type TextInputProps, type UseFormFieldOptions, type UseFormFieldReturn, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UseScreenSizeResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, getColumnIdFromTable, renderContentSlot, selectValueToBoolean, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, useScreenSize };
|