@joelbarron/react-web-dev-kit 0.1.8 → 0.1.10

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 CHANGED
@@ -1,24 +1,23 @@
1
1
  # @joelbarron/react-web-dev-kit
2
2
 
3
- Core reusable para apps web React.
3
+ [![npm version](https://img.shields.io/npm/v/%40joelbarron%2Freact-web-dev-kit?label=npm&color=cb3837)](https://www.npmjs.com/package/@joelbarron/react-web-dev-kit)
4
+ [![npm downloads](https://img.shields.io/npm/dm/%40joelbarron%2Freact-web-dev-kit?label=downloads)](https://www.npmjs.com/package/@joelbarron/react-web-dev-kit)
5
+ [![CI](https://img.shields.io/github/actions/workflow/status/joelbarron/jb-react-web-dev-kit/ci.yml?branch=main&label=CI)](https://github.com/joelbarron/jb-react-web-dev-kit/actions/workflows/ci.yml)
6
+ [![Release](https://img.shields.io/github/actions/workflow/status/joelbarron/jb-react-web-dev-kit/release.yml?branch=main&label=release)](https://github.com/joelbarron/jb-react-web-dev-kit/actions/workflows/release.yml)
4
7
 
5
- Incluye:
6
- - `auth` (`createAuthClient` para `jb-drf-auth`)
7
- - `config` (`createJBWebConfig`, overrides por stage/env)
8
- - `forms` (`JBTextField`, `JBSelectField`, `JBCheckboxField`, `JBSwitchField`, `JBRadioGroupField`, `JBDatePickerField`, `JBTimePickerField`)
9
- - `grid` (`JBGrid`, `JBGridHeader`, providers)
10
- - `hooks` y `utils`
8
+ Libreria reusable para apps web React con piezas listas para autenticacion, formularios, grillas, config por ambiente y utilidades comunes.
11
9
 
12
- ## Documentacion por secciones
10
+ ## Que incluye
13
11
 
14
- - [Indice docs](./docs/README.md)
15
- - [Auth](./docs/auth.md)
16
- - [Config](./docs/config.md)
17
- - [Forms](./docs/forms.md)
18
- - [Grid](./docs/grid.md)
19
- - [Query](./docs/query.md)
20
- - [Hooks](./docs/hooks.md)
21
- - [Utils](./docs/utils.md)
12
+ | Modulo | Que aporta | Docs |
13
+ | --- | --- | --- |
14
+ | `auth` | Cliente para `jb-drf-auth`, provider, hooks y rutas de auth | [docs/auth.md](./docs/auth.md) |
15
+ | `config` | Config global por stage y helpers de URL/API | [docs/config.md](./docs/config.md) |
16
+ | `forms` | Campos base sobre React Hook Form + MUI | [docs/forms.md](./docs/forms.md) |
17
+ | `grid` | `JBGrid`, header y providers para tablas | [docs/grid.md](./docs/grid.md) |
18
+ | `query` | QueryClient preconfigurado para React Query | [docs/query.md](./docs/query.md) |
19
+ | `hooks` | Hooks compartidos para casos de app | [docs/hooks.md](./docs/hooks.md) |
20
+ | `utils` | Helpers generales reutilizables | [docs/utils.md](./docs/utils.md) |
22
21
 
23
22
  ## Instalacion
24
23
 
@@ -26,37 +25,35 @@ Incluye:
26
25
  npm i @joelbarron/react-web-dev-kit
27
26
  ```
28
27
 
29
- ## Auth
28
+ Peer deps principales (segun `package.json`):
29
+ - `react >= 19`
30
+ - `react-dom >= 19`
31
+ - `@tanstack/react-query >= 5`
32
+ - `react-hook-form >= 7`
33
+ - `@mui/material >= 5`
34
+
35
+ ## Inicio rapido
36
+
37
+ ### Auth client
30
38
 
31
39
  ```ts
32
- import { createAuthClient } from '@joelbarron/react-web-dev-kit';
40
+ import { createAuthClient } from '@joelbarron/react-web-dev-kit/auth';
33
41
 
34
42
  export const authClient = createAuthClient({
35
43
  apiBaseUrl: import.meta.env.VITE_API_URL,
36
44
  onUnauthorized: () => {
37
- // ejemplo: limpiar estado y redirigir
45
+ window.location.href = '/sign-in';
38
46
  }
39
47
  });
40
-
41
- await authClient.loginBasic({
42
- login: 'demo@mail.com',
43
- password: 'secret',
44
- client: 'web'
45
- });
46
-
47
- const me = await authClient.getMe();
48
48
  ```
49
49
 
50
- ### Auth Provider + Hook
50
+ ### Auth Provider
51
51
 
52
52
  ```tsx
53
- import { JBAuthProvider, useJBAuth, createAuthClient } from '@joelbarron/react-web-dev-kit/auth';
54
-
55
- const authClient = createAuthClient({
56
- apiBaseUrl: import.meta.env.VITE_API_URL
57
- });
53
+ import { JBAuthProvider } from '@joelbarron/react-web-dev-kit/auth';
54
+ import { authClient } from './authClient';
58
55
 
59
- function Root() {
56
+ export function Root() {
60
57
  return (
61
58
  <JBAuthProvider authClient={authClient}>
62
59
  <App />
@@ -65,63 +62,19 @@ function Root() {
65
62
  }
66
63
  ```
67
64
 
68
- ### Auth Routes Factory
69
-
70
- ```tsx
71
- import { createAuthRoutes } from '@joelbarron/react-web-dev-kit/auth';
72
-
73
- const authRoutes = createAuthRoutes({
74
- pages: {
75
- signIn: SignInPage,
76
- signUp: SignUpPage,
77
- forgotPassword: ForgotPasswordPage,
78
- resetPassword: ResetPasswordPage,
79
- signOut: SignOutPage
80
- },
81
- pageComponent: ({ children }) => <AuthLayout>{children}</AuthLayout>,
82
- routeMeta: {
83
- signIn: { auth: ['guest'] },
84
- signUp: { auth: ['guest'] }
85
- }
86
- });
87
- ```
88
-
89
- ### Auth Query Hooks (TanStack Query)
90
-
91
- ```ts
92
- import { createAuthClient, createAuthQueryHooks } from '@joelbarron/react-web-dev-kit/auth';
93
-
94
- const authClient = createAuthClient({
95
- apiBaseUrl: import.meta.env.VITE_API_URL
96
- });
97
-
98
- export const authQueryHooks = createAuthQueryHooks(authClient);
99
- ```
100
-
101
- ## Query Client
65
+ ### Query client
102
66
 
103
67
  ```ts
104
68
  import { createReactWebQueryClient } from '@joelbarron/react-web-dev-kit/query';
105
69
 
106
- const queryClient = createReactWebQueryClient({
70
+ export const queryClient = createReactWebQueryClient({
107
71
  onUnauthorized: () => {
108
72
  window.location.href = '/sign-in';
109
73
  }
110
74
  });
111
75
  ```
112
76
 
113
- ### Auth Forms Base
114
-
115
- Tambien incluye formularios base para auth:
116
- - `AuthPasswordSignInForm`
117
- - `AuthForgotPasswordForm`
118
- - `AuthResetPasswordForm`
119
-
120
- ```tsx
121
- import { AuthPasswordSignInForm } from '@joelbarron/react-web-dev-kit/auth';
122
- ```
123
-
124
- ## Config Global (overrideable)
77
+ ### Config por ambiente
125
78
 
126
79
  ```ts
127
80
  import { createJBWebConfigFromEnv, getApiBaseUrl } from '@joelbarron/react-web-dev-kit/config';
@@ -142,95 +95,47 @@ const appConfig = createJBWebConfigFromEnv(
142
95
  import.meta.env as Record<string, string | undefined>
143
96
  );
144
97
 
145
- const apiBaseUrl = getApiBaseUrl(appConfig);
98
+ export const apiBaseUrl = getApiBaseUrl(appConfig);
146
99
  ```
147
100
 
148
- ## Forms (React Hook Form + MUI)
101
+ ### Forms y Grid
149
102
 
150
103
  ```tsx
151
- import { Controller, useForm } from 'react-hook-form';
152
- import { JBDatePickerField, JBSelectField, JBTextField } from '@joelbarron/react-web-dev-kit';
104
+ import { JBTextField, JBSelectField, JBDatePickerField, JBGrid, JBGridHeader } from '@joelbarron/react-web-dev-kit';
105
+ ```
153
106
 
154
- type FormValues = {
155
- name: string;
156
- status: string;
157
- birthday: Date | null;
158
- };
107
+ Tambien incluye formularios listos de auth:
108
+ - `AuthPasswordSignInForm`
109
+ - `AuthForgotPasswordForm`
110
+ - `AuthResetPasswordForm`
159
111
 
160
- const options = [
161
- { label: 'Active', value: 'ACTIVE' },
162
- { label: 'Inactive', value: 'INACTIVE' }
163
- ];
112
+ ## Versionado y release
164
113
 
165
- function ExampleForm() {
166
- const { control } = useForm<FormValues>({
167
- defaultValues: { name: '', status: '', birthday: null }
168
- });
114
+ Canales publicados en npm:
115
+ - `latest`: versiones estables desde `main`
116
+ - `next`: prereleases (`-rc.x`) desde `next`
169
117
 
170
- return (
171
- <>
172
- <JBTextField
173
- control={control}
174
- name="name"
175
- label="Name"
176
- fullWidth
177
- />
178
- <JBSelectField
179
- control={control}
180
- name="status"
181
- label="Status"
182
- options={options}
183
- fullWidth
184
- />
185
- <JBDatePickerField
186
- control={control}
187
- name="birthday"
188
- label="Birthday"
189
- />
190
- </>
191
- );
192
- }
118
+ Consulta rapida de version y dist-tags:
119
+
120
+ ```bash
121
+ npm view @joelbarron/react-web-dev-kit version dist-tags --json
193
122
  ```
194
123
 
195
- ## Grid
124
+ Guia completa de release automation:
125
+ - [docs/release.md](./docs/release.md)
196
126
 
197
- ```tsx
198
- import { JBGrid, JBGridHeader, JBGridConfig } from '@joelbarron/react-web-dev-kit';
199
- import { useState } from 'react';
200
-
201
- const gridConfig: JBGridConfig = {
202
- columns: [
203
- { name: 'id', title: 'ID' },
204
- { name: 'name', title: 'Name' }
205
- ],
206
- columnsWidths: [
207
- { columnName: 'id', width: 120 },
208
- { columnName: 'name', width: 320 }
209
- ],
210
- defaults: {
211
- pageSize: 10,
212
- allowSelection: true
213
- }
214
- };
127
+ ## Documentacion
215
128
 
216
- function ExampleGrid({ service }: { service: { list: Function } }) {
217
- const [searchText, setSearchText] = useState('');
129
+ - [Indice docs](./docs/README.md)
130
+ - [Auth](./docs/auth.md)
131
+ - [Config](./docs/config.md)
132
+ - [Forms](./docs/forms.md)
133
+ - [Grid](./docs/grid.md)
134
+ - [Query](./docs/query.md)
135
+ - [Hooks](./docs/hooks.md)
136
+ - [Utils](./docs/utils.md)
137
+ - [Release](./docs/release.md)
218
138
 
219
- return (
220
- <>
221
- <JBGridHeader
222
- title="Users"
223
- searchText={searchText}
224
- onSearchTextChange={setSearchText}
225
- />
226
- <JBGrid
227
- gridConfig={gridConfig}
228
- service={service as any}
229
- searchText={searchText}
230
- onSearchTextChange={setSearchText}
231
- onRowSelected={(row) => console.log(row)}
232
- />
233
- </>
234
- );
235
- }
236
- ```
139
+ ## Changelog
140
+
141
+ - [CHANGELOG.md](./CHANGELOG.md)
@@ -17,7 +17,20 @@ export declare const fuseAuthRoles: {
17
17
  readonly onlyGuest: readonly [];
18
18
  };
19
19
  export type FuseAuthRolesMap = Record<string, string[]>;
20
+ type FuseProfileRoleLike = {
21
+ value?: string | null;
22
+ };
23
+ type FuseJBWebConfigLike = {
24
+ auth?: {
25
+ profileRoles?: FuseProfileRoleLike[] | null;
26
+ } | null;
27
+ };
20
28
  export declare function createFuseAuthRoles(customRoles?: FuseAuthRolesMap): FuseAuthRolesMap;
29
+ export declare function resolveAuthenticatedAuthRoles(jbWebConfig?: FuseJBWebConfigLike, fallbackAuthenticatedRoles?: string[]): string[];
30
+ export declare function createFuseAuthRolesFromJBWebConfig(jbWebConfig?: FuseJBWebConfigLike, customRoles?: FuseAuthRolesMap, options?: {
31
+ authenticatedRoleKey?: string;
32
+ fallbackAuthenticatedRoles?: string[];
33
+ }): FuseAuthRolesMap;
21
34
  export declare function createFuseUserModel<TUser extends FuseUser>(): (data?: Partial<TUser>) => TUser;
22
35
  type CreateFuseUseUserOptions<TUser extends FuseUser> = {
23
36
  useAuth: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"fuseIntegration.d.ts","sourceRoot":"","sources":["../../../src/auth/fuse/fuseIntegration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAKvC,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAExD,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAwBpF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,QAAQ,MAChD,OAAO,OAAO,CAAC,KAA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,WAAW,EAAE,MAAM,eAAe,IAET,WAAW,KAAK,CAAC,aAAa,CAAC,MAAM,GAAG,eAAe,CAAC,MAC9C,OAAO,MAAM,6CAUjD;AAED,KAAK,+BAA+B,CAAC,KAAK,SAAS,QAAQ,IAAI;IAC7D,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC;QACpC,SAAS,EAAE,KAAK,CAAC;YACf,IAAI,EAAE,MAAM,CAAC;YACb,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC;SAC3E,CAAC,CAAC;QACH,QAAQ,EAAE,CAAC,SAAS,EAAE;YAAE,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,KAAK,SAAS,CAAC;KACpE,CAAC,CAAC;IACH,iBAAiB,EAAE,KAAK,CAAC,aAAa,CAAC;QACrC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;QACpC,QAAQ,EAAE,SAAS,CAAC;KACrB,CAAC,CAAC;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,KAAK,SAAS,QAAQ,EAAE,OAAO,EAAE,+BAA+B,CAAC,KAAK,CAAC,IAW/E,OAAO;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,6CAY9D"}
@@ -26,6 +26,24 @@ export function createFuseAuthRoles(customRoles) {
26
26
  });
27
27
  return mergedRoles;
28
28
  }
29
+ export function resolveAuthenticatedAuthRoles(jbWebConfig, fallbackAuthenticatedRoles = ['admin', 'staff', 'doctor', 'patient']) {
30
+ const configuredAuthenticatedAuthRoles = (jbWebConfig?.auth?.profileRoles ?? [])
31
+ .map((profileRole) => String(profileRole?.value ?? '').trim().toLowerCase())
32
+ .filter(Boolean);
33
+ const source = configuredAuthenticatedAuthRoles.length
34
+ ? configuredAuthenticatedAuthRoles
35
+ : fallbackAuthenticatedRoles;
36
+ return Array.from(new Set(source));
37
+ }
38
+ export function createFuseAuthRolesFromJBWebConfig(jbWebConfig, customRoles, options) {
39
+ const authenticatedRoleKey = options?.authenticatedRoleKey ?? 'authenticated';
40
+ const fallbackAuthenticatedRoles = options?.fallbackAuthenticatedRoles ?? ['admin', 'staff', 'doctor', 'patient'];
41
+ const authenticatedAuthRoles = resolveAuthenticatedAuthRoles(jbWebConfig, fallbackAuthenticatedRoles);
42
+ return createFuseAuthRoles({
43
+ ...(customRoles ?? {}),
44
+ [authenticatedRoleKey]: authenticatedAuthRoles
45
+ });
46
+ }
29
47
  export function createFuseUserModel() {
30
48
  return (data) => {
31
49
  const userData = data || {};
@@ -1 +1 @@
1
- {"version":3,"file":"JBDatePickerField.d.ts","sourceRoot":"","sources":["../../src/forms/JBDatePickerField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAwB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG9C,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5D,MAAM,MAAM,sBAAsB,CAChC,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,UAAU,GAAG,WAAW,CAAC,GAAG;IAC7D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAyCJ,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,sBAAsB,CAAC,YAAY,EAAE,KAAK,CAAC,2CAmCnD"}
1
+ {"version":3,"file":"JBDatePickerField.d.ts","sourceRoot":"","sources":["../../src/forms/JBDatePickerField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAwB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG9C,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5D,MAAM,MAAM,sBAAsB,CAChC,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,UAAU,GAAG,WAAW,CAAC,GAAG;IAC7D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAyCJ,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,sBAAsB,CAAC,YAAY,EAAE,KAAK,CAAC,2CAqDnD"}
@@ -38,10 +38,28 @@ const formatDateValue = (value) => {
38
38
  export function JBDatePickerField(props) {
39
39
  const { control, name, rules, textFieldProps, storeAsDateString = false, ...datePickerProps } = props;
40
40
  const { size = 'medium', ...resolvedTextFieldProps } = textFieldProps ?? {};
41
+ const mergedTextFieldSx = Array.isArray(resolvedTextFieldProps.sx)
42
+ ? [
43
+ {
44
+ '& .MuiOutlinedInput-root, & .MuiPickersOutlinedInput-root': {
45
+ backgroundColor: 'common.background'
46
+ }
47
+ },
48
+ ...resolvedTextFieldProps.sx
49
+ ]
50
+ : [
51
+ {
52
+ '& .MuiOutlinedInput-root, & .MuiPickersOutlinedInput-root': {
53
+ backgroundColor: 'common.background'
54
+ }
55
+ },
56
+ resolvedTextFieldProps.sx
57
+ ];
41
58
  return (_jsx(Controller, { control: control, name: name, rules: rules, render: ({ field, fieldState }) => (_jsx(LocalizationProvider, { dateAdapter: AdapterDateFns, children: _jsx(DatePicker, { ...datePickerProps, value: storeAsDateString ? asDateValue(field.value) : field.value ?? null, onChange: (value) => field.onChange(storeAsDateString ? formatDateValue(value) : value), slotProps: {
42
59
  textField: {
43
60
  ...resolvedTextFieldProps,
44
61
  size,
62
+ sx: mergedTextFieldSx,
45
63
  error: !!fieldState.error,
46
64
  helperText: getJBFieldErrorMessage(fieldState.error) ?? resolvedTextFieldProps.helperText
47
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"JBTimePickerField.d.ts","sourceRoot":"","sources":["../../src/forms/JBTimePickerField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAwB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG9C,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5D,MAAM,MAAM,sBAAsB,CAChC,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,UAAU,GAAG,WAAW,CAAC,GAAG;IAC7D,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEJ,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,sBAAsB,CAAC,YAAY,EAAE,KAAK,CAAC,2CA4BnD"}
1
+ {"version":3,"file":"JBTimePickerField.d.ts","sourceRoot":"","sources":["../../src/forms/JBTimePickerField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAwB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG9C,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5D,MAAM,MAAM,sBAAsB,CAChC,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,UAAU,GAAG,WAAW,CAAC,GAAG;IAC7D,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEJ,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,sBAAsB,CAAC,YAAY,EAAE,KAAK,CAAC,2CA8CnD"}
@@ -6,10 +6,28 @@ import { getJBFieldErrorMessage } from './utils';
6
6
  export function JBTimePickerField(props) {
7
7
  const { control, name, rules, textFieldProps, ...timePickerProps } = props;
8
8
  const { size = 'medium', ...resolvedTextFieldProps } = textFieldProps ?? {};
9
+ const mergedTextFieldSx = Array.isArray(resolvedTextFieldProps.sx)
10
+ ? [
11
+ {
12
+ '& .MuiOutlinedInput-root, & .MuiPickersOutlinedInput-root': {
13
+ backgroundColor: 'common.background'
14
+ }
15
+ },
16
+ ...resolvedTextFieldProps.sx
17
+ ]
18
+ : [
19
+ {
20
+ '& .MuiOutlinedInput-root, & .MuiPickersOutlinedInput-root': {
21
+ backgroundColor: 'common.background'
22
+ }
23
+ },
24
+ resolvedTextFieldProps.sx
25
+ ];
9
26
  return (_jsx(Controller, { control: control, name: name, rules: rules, render: ({ field, fieldState }) => (_jsx(LocalizationProvider, { dateAdapter: AdapterDateFns, children: _jsx(TimePicker, { ...timePickerProps, value: field.value ?? null, onChange: (value) => field.onChange(value), slotProps: {
10
27
  textField: {
11
28
  ...resolvedTextFieldProps,
12
29
  size,
30
+ sx: mergedTextFieldSx,
13
31
  error: !!fieldState.error,
14
32
  helperText: getJBFieldErrorMessage(fieldState.error) ?? resolvedTextFieldProps.helperText
15
33
  }
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@joelbarron/react-web-dev-kit",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/joelbarron/jb-react-web-dev-kit.git"
12
+ },
9
13
  "exports": {
10
14
  ".": {
11
15
  "types": "./dist/index.d.ts",
@@ -61,10 +65,15 @@
61
65
  "build": "tsc -p tsconfig.json",
62
66
  "clean": "rm -rf dist",
63
67
  "typecheck": "tsc -p tsconfig.json --noEmit",
68
+ "prepack": "npm run clean && npm run build",
69
+ "pack:verify": "node ./scripts/verify-pack.cjs",
64
70
  "check:release": "npm run typecheck && npm run clean && npm run build",
65
71
  "changeset": "changeset",
72
+ "release:stable": "bash ./scripts/release-stable.sh",
73
+ "release:rc": "bash ./scripts/release-rc.sh",
66
74
  "release:version": "changeset version",
67
- "release:publish": "changeset publish"
75
+ "release:publish": "changeset publish",
76
+ "release:publish:next": "changeset publish --tag next"
68
77
  },
69
78
  "peerDependencies": {
70
79
  "react": ">=19",