@sqrzro/admin 2.1.0-bz.0 → 2.1.0-bz.11

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 (117) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +8 -5
  3. package/dist/components/AppLayout/index.d.ts +4 -1
  4. package/dist/components/AppLayout/index.js +7 -4
  5. package/dist/components/AppNavigation/index.js +4 -3
  6. package/dist/components/Auth/index.d.ts +5 -0
  7. package/dist/components/Auth/index.js +12 -0
  8. package/dist/components/Badge/index.d.ts +8 -0
  9. package/dist/components/Badge/index.js +11 -0
  10. package/dist/components/Dashboard/index.js +1 -1
  11. package/dist/components/DateFilter/index.js +0 -1
  12. package/dist/components/FilterBar/index.d.ts +4 -3
  13. package/dist/components/FilterBar/index.js +12 -3
  14. package/dist/components/FilterBarItem/index.d.ts +2 -1
  15. package/dist/components/FilterBarItem/index.js +2 -2
  16. package/dist/components/GridList/index.d.ts +2 -2
  17. package/dist/components/GridList/index.js +1 -1
  18. package/dist/components/GridListItem/index.d.ts +1 -1
  19. package/dist/components/GridListItem/index.js +3 -2
  20. package/dist/components/InfoPanel/index.d.ts +8 -0
  21. package/dist/components/InfoPanel/index.js +10 -0
  22. package/dist/components/List/index.d.ts +12 -10
  23. package/dist/components/List/index.js +7 -5
  24. package/dist/components/ListActions/index.js +1 -1
  25. package/dist/components/ListItem/index.d.ts +9 -6
  26. package/dist/components/ListItem/index.js +8 -4
  27. package/dist/components/MeActions/index.js +3 -10
  28. package/dist/components/MePanel/index.d.ts +6 -1
  29. package/dist/components/MePanel/index.js +2 -5
  30. package/dist/components/Page/index.d.ts +1 -1
  31. package/dist/components/Page/index.js +2 -2
  32. package/dist/components/Panel/index.d.ts +1 -1
  33. package/dist/components/Panel/index.js +1 -1
  34. package/dist/components/RootLayout/index.d.ts +2 -1
  35. package/dist/components/RootLayout/index.js +12 -5
  36. package/dist/components/SettingsForm/index.d.ts +2 -0
  37. package/dist/components/SettingsForm/index.js +9 -0
  38. package/dist/components/SettingsPage/index.d.ts +2 -0
  39. package/dist/components/SettingsPage/index.js +7 -0
  40. package/dist/components/Table/index.d.ts +2 -2
  41. package/dist/components/TableClientComponent/index.d.ts +4 -4
  42. package/dist/components/TableClientComponent/index.js +17 -4
  43. package/dist/components/Tabs/index.js +20 -2
  44. package/dist/components/index.d.ts +12 -4
  45. package/dist/components/index.js +6 -2
  46. package/dist/services/ConfigService.d.ts +3 -1
  47. package/dist/services/ConfigService.js +5 -5
  48. package/dist/styles/config.js +94 -35
  49. package/dist/styles/postcss.d.ts +6 -0
  50. package/dist/styles/postcss.js +4 -0
  51. package/dist/styles/tailwind.d.ts +10 -0
  52. package/dist/styles/tailwind.js +72 -0
  53. package/package.json +66 -76
  54. package/postcss.js +3 -0
  55. package/tailwind.d.ts +1 -0
  56. package/tailwind.js +1 -0
  57. package/.babelrc.json +0 -16
  58. package/.eslintignore +0 -6
  59. package/.eslintrc +0 -5
  60. package/.sqrzrorc +0 -5
  61. package/.storybook/main.js +0 -11
  62. package/.storybook/preview-head.html +0 -3
  63. package/.storybook/preview.js +0 -1
  64. package/.turbo/turbo-build.log +0 -20
  65. package/.turbo/turbo-prettier.log +0 -43
  66. package/COMPONENTS.md +0 -45
  67. package/dist/components/LoginForm/index.d.ts +0 -6
  68. package/dist/components/LoginForm/index.js +0 -7
  69. package/dist/styles.css +0 -1723
  70. package/dist/utility/formatters.d.ts +0 -1
  71. package/dist/utility/formatters.js +0 -8
  72. package/next-env.d.ts +0 -5
  73. package/postcss.config.js +0 -3
  74. package/prettier.config.js +0 -1
  75. package/src/components/AppLayout/index.tsx +0 -32
  76. package/src/components/AppNavigation/index.tsx +0 -39
  77. package/src/components/BooleanFilter/index.tsx +0 -28
  78. package/src/components/Config/index.tsx +0 -17
  79. package/src/components/Dashboard/index.tsx +0 -15
  80. package/src/components/DateFilter/index.tsx +0 -49
  81. package/src/components/DropdownFilter/index.tsx +0 -19
  82. package/src/components/FilterBar/index.tsx +0 -35
  83. package/src/components/FilterBarItem/index.tsx +0 -126
  84. package/src/components/GridList/index.tsx +0 -11
  85. package/src/components/GridListItem/index.tsx +0 -31
  86. package/src/components/Icon/index.tsx +0 -33
  87. package/src/components/List/index.tsx +0 -70
  88. package/src/components/ListAction/index.tsx +0 -25
  89. package/src/components/ListActions/index.tsx +0 -43
  90. package/src/components/ListItem/index.tsx +0 -56
  91. package/src/components/LoginForm/index.tsx +0 -34
  92. package/src/components/MeActions/index.tsx +0 -21
  93. package/src/components/MePanel/index.tsx +0 -21
  94. package/src/components/Page/index.tsx +0 -60
  95. package/src/components/PageActions/index.tsx +0 -22
  96. package/src/components/Panel/Panel.spec.tsx +0 -10
  97. package/src/components/Panel/Panel.stories.tsx +0 -9
  98. package/src/components/Panel/index.tsx +0 -15
  99. package/src/components/RootLayout/index.tsx +0 -39
  100. package/src/components/Table/index.tsx +0 -34
  101. package/src/components/TableClientComponent/index.tsx +0 -112
  102. package/src/components/Tabs/index.tsx +0 -25
  103. package/src/components/index.ts +0 -68
  104. package/src/icons/ErrorIcon/index.tsx +0 -19
  105. package/src/icons/InfoIcon/index.tsx +0 -19
  106. package/src/icons/SuccessIcon/index.tsx +0 -19
  107. package/src/icons/WarningIcon/index.tsx +0 -19
  108. package/src/index.ts +0 -3
  109. package/src/interfaces.ts +0 -3
  110. package/src/react.d.ts +0 -12
  111. package/src/services/ConfigService.ts +0 -24
  112. package/src/styles/config.ts +0 -95
  113. package/src/styles/tailwind.css +0 -47
  114. package/src/utility/formatters.ts +0 -9
  115. package/tailwind.config.js +0 -16
  116. package/tsconfig.build.json +0 -4
  117. package/tsconfig.json +0 -18
@@ -1,8 +1,7 @@
1
1
  'use client';
2
2
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
- import clsx from 'clsx';
5
- import { Link } from '@sqrzro/components';
4
+ import { Link, tw } from '@sqrzro/components';
6
5
  import { usePathname, useSearchParams } from 'next/navigation';
7
6
  function toggleArrayItem(array, item) {
8
7
  if (array.includes(item)) {
@@ -33,12 +32,26 @@ function getSortIconProps(searchParams, sort) {
33
32
  }
34
33
  return { dir: null };
35
34
  }
35
+ function isStringArray(array) {
36
+ return array.every((item) => typeof item === 'string');
37
+ }
38
+ function parseColumns(columns) {
39
+ if (columns.length === 0) {
40
+ return [];
41
+ }
42
+ if (isStringArray(columns)) {
43
+ return columns.map((key) => ({ key }));
44
+ }
45
+ return columns;
46
+ }
36
47
  function TableClientComponent({ columns, data, }) {
37
48
  const pathname = usePathname();
38
49
  const searchParams = useSearchParams();
39
50
  const [selected, setSelected] = useState([]);
40
- return (_jsx("div", { className: "bg-white shadow-sm", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsx("tr", { children: columns.map((column) => (_jsx("th", { className: "p-4 text-left", children: _jsxs(Link, { href: createSortLink(pathname, searchParams, column.key), children: [column.title, ' '] }) }, column.key))) }) }), _jsx("tbody", { children: data.map((item) => (_jsx("tr", { className: "odd:bg-slate-100", children: columns.map((column) => (_jsx("td", { className: clsx('border-x border-transparent p-4', getSortIconProps(searchParams, column.key).dir
51
+ const parsedColumns = parseColumns(columns);
52
+ const hasTitles = parsedColumns.some((column) => column.title);
53
+ return (_jsx("div", { className: "bg-white shadow-sm", children: _jsxs("table", { className: "w-full", children: [hasTitles ? (_jsx("thead", { children: _jsx("tr", { children: parsedColumns.map((column) => (_jsx("th", { className: tw('p-4', column.type === 'number' ? 'text-right' : 'text-left'), children: column.title ? (_jsxs(Link, { href: createSortLink(pathname, searchParams, column.key), children: [column.title, ' '] })) : null }, column.key))) }) })) : null, _jsx("tbody", { children: data.map((item) => (_jsx("tr", { className: "odd:bg-slate-100", children: parsedColumns.map((column) => (_jsx("td", { className: tw('border-x border-transparent p-4', getSortIconProps(searchParams, column.key).dir
41
54
  ? 'border-sky-300 bg-sky-300/10'
42
- : ''), children: item[column.key] }, column.key))) }, item.id))) })] }) }));
55
+ : '', column.type === 'number' ? 'text-right' : 'text-left'), children: item[column.key] }, column.key))) }, item.id))) })] }) }));
43
56
  }
44
57
  export default TableClientComponent;
@@ -1,6 +1,24 @@
1
+ 'use client';
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Link } from '@sqrzro/components';
3
+ import { Link, tw } from '@sqrzro/components';
4
+ import { useNavigation } from '@sqrzro/hooks';
3
5
  function Tabs({ basePath = '', data }) {
4
- return (_jsx("nav", { className: "border-y border-gray-700", children: _jsx("ul", { className: "flex gap-4 font-semibold", children: data.map(({ href, label }) => (_jsx("li", { children: _jsx(Link, { className: "block py-2 text-white", href: `${basePath}${href || ''}`, children: label }) }, href))) }) }));
6
+ const navigation = useNavigation([basePath, data]);
7
+ return (_jsx("nav", { className: "border-b border-slate-700", children: _jsx("ul", { className: "flex gap-4", children: navigation.map(({ href, isActive, label }) => (_jsx("li", { children: _jsx(Link, { className: tw('block px-1 pb-2 font-semibold', isActive
8
+ ? 'border-primary border-b-4 text-white'
9
+ : 'text-white/80 hover:text-white'), href: href, children: label }) }, href))) }) }));
10
+ // return (
11
+ // <nav className="border-y border-slate-700">
12
+ // <ul className="flex gap-4 font-semibold">
13
+ // {data.map(({ href, label }) => (
14
+ // <li key={href}>
15
+ // <Link className="block py-2 text-white" href={`${basePath}${href || ''}`}>
16
+ // {label}
17
+ // </Link>
18
+ // </li>
19
+ // ))}
20
+ // </ul>
21
+ // </nav>
22
+ // );
5
23
  }
6
24
  export default Tabs;
@@ -1,24 +1,32 @@
1
- export { Button, CalendarInput, ConnectedDropdown, DateFormField, DateInput, Dropdown, EditableDateFormField, EditableDropdownFormField, EditableForm, EditableFormField, EditableMultiFormField, EditableNumberFormField, EditableSwitchFormField, EditableTextFormField, Fieldset, Form, FormField, FormSubmit, ImageInput, ImageFormField, Link, ModalForm, NumberInput, Switch, TextFormField, TextInput, Toaster, } from '@sqrzro/components';
1
+ export { Button, CalendarInput, ConnectedDropdown, DateFormField, DateInput, Dropdown, DropdownFormField, EditableDateFormField, EditableDropdownFormField, EditableForm, EditableFormField, EditableMultiFormField, EditableNumberFormField, EditableSwitchFormField, EditableTextFormField, Fieldset, Form, FormField, FormSubmit, ImageInput, ImageFormField, Link, ModalForm, MultiFormField, NumberFormField, NumberInput, Switch, SwitchFormField, TextFormField, TextInput, Toaster, } from '@sqrzro/components';
2
2
  export type { AppLayoutProps } from './AppLayout';
3
3
  export { default as AppLayout } from './AppLayout';
4
+ export type { AuthProps } from './Auth';
5
+ export { default as Auth } from './Auth';
6
+ export type { BadgeProps } from './Badge';
7
+ export { default as Badge } from './Badge';
4
8
  export type { DashboardProps } from './Dashboard';
5
9
  export { default as Dashboard } from './Dashboard';
6
- export type { FilterBarProps } from './FilterBar';
10
+ export type { FilterBarProps, FilterObject } from './FilterBar';
7
11
  export { default as FilterBar } from './FilterBar';
8
12
  export type { GridListProps } from './GridList';
9
13
  export { default as GridList } from './GridList';
14
+ export type { InfoPanelProps } from './InfoPanel';
15
+ export { default as InfoPanel } from './InfoPanel';
10
16
  export type { ListComponentProps, ListProps } from './List';
11
17
  export { default as List } from './List';
12
18
  export type { ListObject } from './ListItem';
13
19
  export type { ListActionsProps } from './ListActions';
14
20
  export { default as ListActions } from './ListActions';
15
- export type { LoginFormProps } from './LoginForm';
16
- export { default as LoginForm } from './LoginForm';
17
21
  export type { PageProps } from './Page';
18
22
  export { default as Page } from './Page';
23
+ export type { PanelProps } from './Panel';
24
+ export { default as Panel } from './Panel';
19
25
  export type { PageActionsProps } from './PageActions';
20
26
  export { default as PageActions } from './PageActions';
21
27
  export type { RootLayoutProps } from './RootLayout';
22
28
  export { default as RootLayout } from './RootLayout';
29
+ export { default as SettingsPage } from './SettingsPage';
30
+ export type { TableColumnObject } from './TableClientComponent';
23
31
  export type { TableProps } from './Table';
24
32
  export { default as Table } from './Table';
@@ -1,13 +1,17 @@
1
1
  // Exported from @sqrzro/components
2
- export { Button, CalendarInput, ConnectedDropdown, DateFormField, DateInput, Dropdown, EditableDateFormField, EditableDropdownFormField, EditableForm, EditableFormField, EditableMultiFormField, EditableNumberFormField, EditableSwitchFormField, EditableTextFormField, Fieldset, Form, FormField, FormSubmit, ImageInput, ImageFormField, Link, ModalForm, NumberInput, Switch, TextFormField, TextInput, Toaster, } from '@sqrzro/components';
2
+ export { Button, CalendarInput, ConnectedDropdown, DateFormField, DateInput, Dropdown, DropdownFormField, EditableDateFormField, EditableDropdownFormField, EditableForm, EditableFormField, EditableMultiFormField, EditableNumberFormField, EditableSwitchFormField, EditableTextFormField, Fieldset, Form, FormField, FormSubmit, ImageInput, ImageFormField, Link, ModalForm, MultiFormField, NumberFormField, NumberInput, Switch, SwitchFormField, TextFormField, TextInput, Toaster, } from '@sqrzro/components';
3
3
  export { default as AppLayout } from './AppLayout';
4
+ export { default as Auth } from './Auth';
5
+ export { default as Badge } from './Badge';
4
6
  export { default as Dashboard } from './Dashboard';
5
7
  export { default as FilterBar } from './FilterBar';
6
8
  export { default as GridList } from './GridList';
9
+ export { default as InfoPanel } from './InfoPanel';
7
10
  export { default as List } from './List';
8
11
  export { default as ListActions } from './ListActions';
9
- export { default as LoginForm } from './LoginForm';
10
12
  export { default as Page } from './Page';
13
+ export { default as Panel } from './Panel';
11
14
  export { default as PageActions } from './PageActions';
12
15
  export { default as RootLayout } from './RootLayout';
16
+ export { default as SettingsPage } from './SettingsPage';
13
17
  export { default as Table } from './Table';
@@ -1,9 +1,11 @@
1
+ /// <reference types="react" />
1
2
  export interface Config {
2
3
  app: {
3
4
  name: string;
4
5
  url: string;
5
6
  };
7
+ logo?: () => React.ReactElement;
6
8
  navigation: Record<string, string>;
7
9
  }
8
- export declare function setConfig(config: Config): Config;
10
+ export declare function setConfig(cfg: Config, logo?: () => React.ReactElement): Config;
9
11
  export declare function getConfig(): Config;
@@ -1,14 +1,14 @@
1
- let cachedConfig = {
1
+ let config = {
2
2
  app: {
3
3
  name: 'Square Zero',
4
4
  url: 'http://localhost:8080',
5
5
  },
6
6
  navigation: {},
7
7
  };
8
- export function setConfig(config) {
9
- cachedConfig = config;
10
- return cachedConfig;
8
+ export function setConfig(cfg, logo) {
9
+ config = { ...cfg, logo };
10
+ return config;
11
11
  }
12
12
  export function getConfig() {
13
- return cachedConfig;
13
+ return config;
14
14
  }
@@ -1,82 +1,141 @@
1
1
  'use client';
2
- import clsx from 'clsx';
3
- const classNames = {
2
+ import { tw, twx } from '@sqrzro/components';
3
+ const classNames = twx({
4
+ actionList: () => ({
5
+ root: 'flex gap-2',
6
+ }),
4
7
  button: (props) => ({
5
8
  root: {
6
- danger: 'bg-red-500 border-red-500 text-white',
7
- default: clsx('bg-white h-10 px-5 rounded-md text-md text-slate-600 border border-slate-300', props?.isFullWidth ? 'w-full' : null),
8
- primary: 'bg-primary font-semibold text-white border-none shadow-[inset_rgba(255,255,255,0.1)_0_20px]',
9
+ danger: 'border-red-500 bg-red-500 text-white',
10
+ default: tw('text-md h-10 rounded border border-slate-300 bg-white px-5 text-slate-600', props?.isFullWidth ? 'w-full' : null),
11
+ primary: 'bg-button-bg text-button-text border-none font-semibold', // shadow-[inset_rgba(255,255,255,0.2)_0_20px]
9
12
  },
10
13
  }),
11
14
  calendar: () => ({
12
- root: 'text-sm text-slate-600 p-4 pb-3',
13
- head: 'text-xs text-center pb-2 text-slate-400',
15
+ root: 'p-4 pb-3 text-sm text-slate-600',
16
+ head: 'pb-2 text-center text-xs text-slate-400',
14
17
  month: 'w-full table-fixed',
15
18
  day: {
16
- default: 'h-10 border border-gray-200',
17
- highlighted: 'bg-red-300',
18
- selected: 'bg-blue-400',
19
+ default: 'h-10 border border-slate-200',
20
+ highlighted: 'bg-slate-100',
21
+ selected: 'bg-slate-200',
19
22
  },
20
23
  }),
21
24
  calendarNavigation: () => ({
22
- root: 'flex justify-between items-center mb-6',
23
- title: 'font-semibold text-base',
24
- control: 'h-6 w-6 bg-red-300',
25
+ root: 'mb-6 flex items-center justify-between',
26
+ title: 'text-base font-semibold',
27
+ control: 'h-6 w-6 rounded-full border border-slate-300',
25
28
  previous: '-order-1',
26
29
  }),
30
+ codeInput: () => ({
31
+ input: {
32
+ default: 'focus:border-primary h-10 rounded border border-slate-300 text-center',
33
+ error: 'border-red-700',
34
+ },
35
+ }),
36
+ editableFieldset: () => ({
37
+ root: 'bg-panel grid grid-cols-[30%_1fr] rounded p-8 shadow',
38
+ title: 'mb-8 text-lg font-semibold leading-none text-slate-700',
39
+ actions: 'flex justify-end gap-2 border-t border-slate-200 pt-4',
40
+ }),
41
+ editableFormField: () => ({
42
+ root: 'grid grid-cols-[25%_1fr] border-t border-slate-200 py-4',
43
+ label: 'flex items-center font-semibold leading-none',
44
+ field: 'flex min-h-10 items-center',
45
+ }),
27
46
  emptyMessage: () => ({
28
- root: 'text-center text-slate-500 my-24',
29
- title: 'text-2xl font-semibold mb-2',
47
+ root: 'relative mx-auto mt-4 w-full max-w-xl rounded bg-white py-16 text-center text-slate-500 shadow before:pointer-events-none before:absolute before:inset-2 before:border-2 before:border-dashed',
48
+ title: 'mb-2 text-xl font-semibold leading-none',
49
+ action: 'mt-6 flex justify-center',
30
50
  }),
31
51
  dropdown: () => ({
32
- item: { default: 'text-gray-700 block px-3 py-2 text-sm', selected: 'bg-red-400' },
52
+ item: { default: 'block p-3 text-sm text-slate-700', selected: 'bg-slate-100' },
53
+ title: 'block leading-none',
54
+ meta: 'mt-0.5 block text-xs leading-none text-slate-500',
33
55
  }),
34
- fieldset: (props) => ({
35
- root: clsx('bg-white p-8 shadow rounded-md', props?.isEditable ? 'grid grid-cols-[30%_1fr]' : ''),
36
- title: 'mb-8 text-xl font-semibold leading-none text-gray-700',
56
+ fieldset: () => ({
57
+ root: 'rounded bg-white p-8 shadow',
58
+ title: 'mb-8 text-lg font-semibold leading-none text-slate-700',
59
+ }),
60
+ form: () => ({
61
+ root: 'flex flex-col gap-6',
37
62
  }),
38
63
  formField: (props) => ({
39
64
  root: {
40
65
  default: props?.isEditable
41
66
  ? 'grid grid-cols-[25%_1fr] border-t border-slate-200 py-4'
42
- : 'mb-6',
67
+ : '',
43
68
  },
44
- label: clsx('font-semibold', props?.isEditable ? 'flex items-center' : 'block mb-2'),
45
- optional: 'pl-2 text-base text-grey-dark font-normal',
46
- error: 'flex gap-2 items-center mt-2 text-red-700 before:h-4 before:w-4 before:bg-[url(/images/icons/error.svg)] before:rounded-full',
69
+ label: tw('flex font-semibold leading-none', props?.isEditable ? 'items-center' : 'mb-2 justify-between'),
70
+ details: 'mb-2 text-xs font-normal leading-none text-slate-500',
71
+ optional: 'pl-2 text-xs font-normal leading-none text-slate-500',
72
+ error: 'mt-2 flex items-center gap-2 text-red-700 before:h-4 before:w-4 before:rounded-full before:bg-[url(/images/icons/error.svg)]',
73
+ }),
74
+ imageInput: () => ({
75
+ root: 'h-64 rounded border border-slate-300 bg-slate-50 p-8',
76
+ icon: 'mx-auto mb-2 block h-12 w-12 rounded-full border-2 border-slate-300',
77
+ title: 'mb-1 font-semibold',
78
+ description: 'text-xs italic text-slate-700',
47
79
  }),
48
80
  inputPanel: () => ({
49
- root: 'bg-white border border-slate-300 shadow-md',
81
+ root: 'show mt-1 origin-top rounded border border-slate-300 bg-white shadow-md',
50
82
  }),
51
83
  modal: () => ({
52
- root: {
53
- default: 'bg-white rounded-lg w-full max-w-2xl backdrop:bg-slate-800/60 backdrop:backdrop-blur-sm transition-opacity opacity-0 open:opacity-100 duration-200',
84
+ root: 'open:backdrop:fade py-16 backdrop:bg-slate-700/50 backdrop:backdrop-blur-sm',
85
+ panel: 'show bg-panel row-start-2 mx-auto w-full max-w-lg rounded p-6 text-left shadow-xl',
86
+ title: 'mb-6 text-lg font-semibold',
87
+ actions: 'flex justify-end',
88
+ }),
89
+ multiInput: () => ({
90
+ root: 'flex flex-col gap-2',
91
+ row: 'grid grid-cols-[1fr_auto] has-[>_button]:gap-2',
92
+ }),
93
+ passwordInput: () => ({
94
+ action: {
95
+ default: 'mr-2 h-6 w-6 overflow-hidden bg-[url(/admin/images/eye.svg)] bg-no-repeat indent-12',
96
+ selected: 'bg-bottom',
54
97
  },
55
- title: 'text-2xl font-semibold text-center p-4 border-b border-slate-200 text-slate-700',
56
- content: 'p-4',
57
- actions: 'flex justify-end p-4 border-t border-slate-200',
58
98
  }),
59
99
  staticTextInput: () => ({
60
- root: { default: 'bg-white border border-gray-300 h-10 px-3 rounded-sm text-md' },
100
+ root: {
101
+ default: 'text-md h-10 rounded border border-slate-300 bg-white px-3',
102
+ error: 'border-red-700',
103
+ },
61
104
  }),
62
105
  switch: () => ({
63
- root: {
64
- default: 'cursor-pointer w-10 h-6 bg-slate-300 rounded-full p-1 transition-colors my-2',
106
+ root: 'flex gap-4',
107
+ input: {
108
+ default: 'h-6 w-10 flex-none cursor-pointer rounded-full bg-slate-300 p-1 transition-colors',
65
109
  checked: 'bg-green-500',
66
110
  },
67
111
  control: {
68
- default: 'w-4 h-4 bg-white rounded-full shadow-md transform translate-x-0 transition-transform',
112
+ default: 'h-4 w-4 translate-x-0 transform rounded-full bg-white shadow-md transition-transform',
69
113
  checked: 'translate-x-full',
70
114
  },
115
+ label: 'font-semibold',
116
+ details: 'block text-xs text-slate-500',
117
+ }),
118
+ textArea: () => ({
119
+ root: {
120
+ default: 'text-md focus:border-primary rounded border border-slate-300 px-3 py-2',
121
+ error: 'border-red-700',
122
+ },
71
123
  }),
72
124
  textButton: () => ({
73
125
  root: { danger: 'text-red-600' },
74
126
  }),
75
127
  textInput: () => ({
76
128
  root: {
77
- default: 'border border-gray-300 h-10 px-3 rounded-sm text-md focus:border-primary',
129
+ default: 'text-md focus:border-primary h-10 rounded border border-slate-300 px-3',
78
130
  error: 'border-red-700',
79
131
  },
80
132
  }),
81
- };
133
+ toast: () => ({
134
+ root: {
135
+ default: 'rounded border px-4 py-2',
136
+ success: 'border-green-300 bg-green-100 text-green-700',
137
+ error: 'border-red-300 bg-red-100 text-red-700',
138
+ },
139
+ }),
140
+ });
82
141
  export default classNames;
@@ -0,0 +1,6 @@
1
+ declare const config: {
2
+ plugins: {
3
+ tailwindcss: {};
4
+ };
5
+ };
6
+ export default config;
@@ -0,0 +1,4 @@
1
+ const config = {
2
+ plugins: { tailwindcss: {} },
3
+ };
4
+ export default config;
@@ -0,0 +1,10 @@
1
+ interface Theme {
2
+ colors?: Partial<{
3
+ 'button-bg': string;
4
+ 'button-text': string;
5
+ link: string;
6
+ primary: string;
7
+ }>;
8
+ }
9
+ declare function config(resolves: string[], customization?: Theme): Record<string, unknown>;
10
+ export default config;
@@ -0,0 +1,72 @@
1
+ import path from 'path';
2
+ import plugin from 'tailwindcss/plugin';
3
+ function config(resolves, customization) {
4
+ return {
5
+ content: [
6
+ './app/**/*.tsx',
7
+ './src/**/*.tsx',
8
+ ...resolves.map((item) => path.join(item, '**/*.js')),
9
+ ],
10
+ darkMode: 'class',
11
+ mode: 'jit',
12
+ theme: {
13
+ extend: {
14
+ colors: {
15
+ 'button-bg': 'var(--color-button-bg)',
16
+ 'button-text': 'var(--color-button-text)',
17
+ link: 'var(--color-link)',
18
+ panel: 'var(--color-panel)',
19
+ primary: 'var(--color-primary)',
20
+ },
21
+ fontFamily: {
22
+ sans: ['var(--font-inter)'],
23
+ },
24
+ },
25
+ },
26
+ plugins: [
27
+ plugin(({ addBase, addUtilities, theme }) => {
28
+ addBase({
29
+ body: {
30
+ '--color-button-bg': customization?.colors?.['button-bg'] ||
31
+ customization?.colors?.primary ||
32
+ theme('colors.indigo.800'),
33
+ '--color-button-text': customization?.colors?.['button-text'] || theme('colors.white'),
34
+ '--color-link': customization?.colors?.link || theme('colors.indigo.800'),
35
+ '--color-panel': theme('colors.white'),
36
+ '--color-primary': customization?.colors?.primary || theme('colors.indigo.800'),
37
+ },
38
+ 'body.dark': {
39
+ '--color-panel': theme('colors.gray.700'),
40
+ },
41
+ });
42
+ addUtilities({
43
+ '@keyframes show': {
44
+ from: {
45
+ opacity: '0',
46
+ transform: 'scale3d(.9,.9,.9)',
47
+ },
48
+ to: {
49
+ opacity: '1',
50
+ transform: 'scale3d(1,1,1)',
51
+ },
52
+ },
53
+ '.show': {
54
+ animation: 'show 0.1s ease-in-out',
55
+ },
56
+ '@keyframes fade': {
57
+ from: {
58
+ opacity: '0',
59
+ },
60
+ to: {
61
+ opacity: '1',
62
+ },
63
+ },
64
+ '.fade': {
65
+ animation: 'fade 0.2s ease-in-out',
66
+ },
67
+ });
68
+ }),
69
+ ],
70
+ };
71
+ }
72
+ export default config;
package/package.json CHANGED
@@ -1,77 +1,67 @@
1
1
  {
2
- "name": "@sqrzro/admin",
3
- "version": "2.1.0-bz.0",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
6
- "exports": {
7
- ".": "./dist/index.js",
8
- "./styles.css": "./dist/styles.css"
9
- },
10
- "license": "ISC",
11
- "dependencies": {
12
- "@heroicons/react": "^2.0.15",
13
- "@sqrzro/components": "workspace:bz",
14
- "@sqrzro/hooks": "workspace:bz",
15
- "@sqrzro/interfaces": "workspace:bz",
16
- "@sqrzro/server": "workspace:bz",
17
- "@sqrzro/utility": "workspace:bz",
18
- "bcrypt": "^5.1.1",
19
- "clsx": "^1.2.1",
20
- "date-fns": "^2.29.3",
21
- "joi": "^17.11.0",
22
- "jose": "^4.15.4",
23
- "next": "^14.0.0",
24
- "react": "^18.2.0",
25
- "react-dom": "^18.2.0",
26
- "use-deep-compare-effect": "^1.8.1"
27
- },
28
- "devDependencies": {
29
- "@babel/core": "^7.20.12",
30
- "@babel/preset-env": "^7.21.4",
31
- "@babel/preset-react": "^7.18.6",
32
- "@babel/preset-typescript": "^7.21.4",
33
- "@sqrzro/eslint-plugin": "workspace:bz",
34
- "@sqrzro/prettier-config": "workspace:bz",
35
- "@sqrzro/tailwind-plugin": "workspace:bz",
36
- "@storybook/addon-actions": "^7.0.7",
37
- "@storybook/addon-essentials": "^7.0.7",
38
- "@storybook/addon-interactions": "^7.0.7",
39
- "@storybook/addon-links": "^7.0.7",
40
- "@storybook/addon-mdx-gfm": "7.0.7",
41
- "@storybook/react": "^7.0.7",
42
- "@storybook/react-webpack5": "7.0.7",
43
- "@storybook/testing-library": "^0.1.0",
44
- "@testing-library/dom": "^8.20.0",
45
- "@testing-library/jest-dom": "^5.16.5",
46
- "@testing-library/react": "^13.4.0",
47
- "@testing-library/user-event": "^14.4.3",
48
- "@types/bcrypt": "^5.0.1",
49
- "@types/react": "^18.2.32",
50
- "babel-loader": "^8.3.0",
51
- "concurrently": "^7.6.0",
52
- "eslint": "^8.55.0",
53
- "jest": "^29.5.0",
54
- "mockdate": "^3.0.5",
55
- "prettier": "^2.8.4",
56
- "rimraf": "^4.1.2",
57
- "storybook": "^7.0.7",
58
- "tailwindcss": "^3.2.6",
59
- "typescript": "^5.2.2"
60
- },
61
- "scripts": {
62
- "build:css": "tailwindcss -i \"./src/styles/tailwind.css\" -o \"./dist/styles.css\"",
63
- "build:ts": "tsc -p tsconfig.build.json",
64
- "build": "pnpm clean && pnpm build:css && pnpm build:ts",
65
- "clean": "rimraf ./dist",
66
- "dev:css": "tailwindcss -i \"./src/styles/tailwind.css\" -o \"./dist/styles.css\" --watch",
67
- "dev:storybook": "storybook dev -p 6006",
68
- "dev:ts": "tsc -p tsconfig.build.json -w",
69
- "dev": "concurrently \"pnpm:dev:css\" \"pnpm:dev:ts\"",
70
- "docs": "concurrently \"pnpm:dev:css\" \"pnpm:dev:storybook\"",
71
- "lint": "tsc --noEmit && eslint \"./src/**/*.tsx\" \"./src/**/*.ts\"",
72
- "prepublishOnly": "pnpm build",
73
- "prettier": "prettier --write \"./src/**/*.tsx\" \"./src/**/*.ts\"",
74
- "start": "pnpm dev",
75
- "test": "jest"
76
- }
77
- }
2
+ "name": "@sqrzro/admin",
3
+ "version": "2.1.0-bz.11",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "license": "ISC",
7
+ "files": [
8
+ "dist",
9
+ "postcss.js",
10
+ "tailwind.js",
11
+ "tailwind.d.ts"
12
+ ],
13
+ "dependencies": {
14
+ "@sqrzro/components": "bz",
15
+ "@sqrzro/hooks": "bz",
16
+ "@sqrzro/interfaces": "bz",
17
+ "next": "^14.1.0",
18
+ "react": "^18.2.0",
19
+ "react-dom": "^18.2.0"
20
+ },
21
+ "devDependencies": {
22
+ "@babel/core": "^7.23.9",
23
+ "@babel/preset-env": "^7.23.9",
24
+ "@babel/preset-react": "^7.23.3",
25
+ "@babel/preset-typescript": "^7.23.3",
26
+ "@sqrzro/eslint-plugin": "bz",
27
+ "@sqrzro/prettier-config": "bz",
28
+ "@sqrzro/tailwind-plugin": "bz",
29
+ "@storybook/addon-actions": "^7.6.17",
30
+ "@storybook/addon-essentials": "^7.6.17",
31
+ "@storybook/addon-interactions": "^7.6.17",
32
+ "@storybook/addon-links": "^7.6.17",
33
+ "@storybook/addon-mdx-gfm": "7.0.7",
34
+ "@storybook/react": "^7.6.17",
35
+ "@storybook/react-webpack5": "7.0.7",
36
+ "@storybook/testing-library": "^0.1.0",
37
+ "@testing-library/dom": "^8.20.1",
38
+ "@testing-library/jest-dom": "^5.17.0",
39
+ "@testing-library/react": "^13.4.0",
40
+ "@testing-library/user-event": "^14.5.2",
41
+ "@types/bcrypt": "^5.0.2",
42
+ "@types/jest": "^29.5.12",
43
+ "@types/node": "18.14.6",
44
+ "@types/react": "^18.2.57",
45
+ "babel-loader": "^8.3.0",
46
+ "concurrently": "^7.6.0",
47
+ "eslint": "^8.56.0",
48
+ "jest": "^29.7.0",
49
+ "mockdate": "^3.0.5",
50
+ "prettier": "^3.2.5",
51
+ "rimraf": "^4.4.1",
52
+ "storybook": "^7.6.17",
53
+ "tailwindcss": "^3.4.1",
54
+ "typescript": "^5.3.3"
55
+ },
56
+ "scripts": {
57
+ "build": "pnpm clean && tsc -p tsconfig.build.json",
58
+ "clean": "rimraf ./dist",
59
+ "dev": "tsc -p tsconfig.build.json -w",
60
+ "docs": "storybook dev -p 6006",
61
+ "lint": "tsc --noEmit && eslint \"./src/**/*.tsx\" \"./src/**/*.ts\"",
62
+ "prettier": "prettier --write \"./src/**/*.tsx\" \"./src/**/*.ts\"",
63
+ "start": "pnpm dev",
64
+ "test": "jest",
65
+ "test:coverage": "jest --coverage"
66
+ }
67
+ }
package/postcss.js ADDED
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ plugins: { tailwindcss: {} },
3
+ };
package/tailwind.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/styles/tailwind';
package/tailwind.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/styles/tailwind');
package/.babelrc.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "sourceType": "unambiguous",
3
- "presets": [
4
- [
5
- "@babel/preset-env",
6
- {
7
- "targets": {
8
- "chrome": 100
9
- }
10
- }
11
- ],
12
- "@babel/preset-typescript",
13
- "@babel/preset-react"
14
- ],
15
- "plugins": []
16
- }
package/.eslintignore DELETED
@@ -1,6 +0,0 @@
1
- dist
2
- jest.config.js
3
- node_modules
4
- prettier.config.js
5
- scripts/*.js
6
- tailwind.config.js
package/.eslintrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "root": true,
3
- "plugins": ["@sqrzro"],
4
- "extends": ["plugin:@sqrzro/react"]
5
- }