ding-react-admin 2.0.0 → 2.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 (169) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +254 -195
  3. package/dist/index.css +2 -0
  4. package/dist/index.js +1772 -1169
  5. package/dist/src/components/NavMenuLabel.d.ts +8 -0
  6. package/dist/src/components/NavMenuLabel.d.ts.map +1 -0
  7. package/dist/src/components/NavMenuSearch.d.ts +9 -0
  8. package/dist/src/components/NavMenuSearch.d.ts.map +1 -0
  9. package/dist/src/components/ScrollableArea.d.ts +10 -0
  10. package/dist/src/components/ScrollableArea.d.ts.map +1 -0
  11. package/dist/src/components/index.d.ts +3 -0
  12. package/dist/src/components/index.d.ts.map +1 -1
  13. package/dist/src/context/AuthProvider.d.ts +2 -0
  14. package/dist/src/context/AuthProvider.d.ts.map +1 -1
  15. package/dist/src/crud/FormGlobalErrorsAlert.d.ts +5 -0
  16. package/dist/src/crud/FormGlobalErrorsAlert.d.ts.map +1 -0
  17. package/dist/src/crud/ResourceForm.d.ts +1 -4
  18. package/dist/src/crud/ResourceForm.d.ts.map +1 -1
  19. package/dist/src/crud/ResourceFormModal.d.ts +7 -1
  20. package/dist/src/crud/ResourceFormModal.d.ts.map +1 -1
  21. package/dist/src/crud/ResourceRecordForm.d.ts +27 -0
  22. package/dist/src/crud/ResourceRecordForm.d.ts.map +1 -0
  23. package/dist/src/crud/fields/ReferenceField.d.ts +12 -2
  24. package/dist/src/crud/fields/ReferenceField.d.ts.map +1 -1
  25. package/dist/src/crud/fields/ReferenceInputActions.d.ts +16 -0
  26. package/dist/src/crud/fields/ReferenceInputActions.d.ts.map +1 -0
  27. package/dist/src/crud/fields/ReferenceManyField.d.ts +10 -1
  28. package/dist/src/crud/fields/ReferenceManyField.d.ts.map +1 -1
  29. package/dist/src/crud/filters/ReferenceFilter.d.ts +1 -1
  30. package/dist/src/crud/filters/ReferenceFilter.d.ts.map +1 -1
  31. package/dist/src/crud/index.d.ts +5 -0
  32. package/dist/src/crud/index.d.ts.map +1 -1
  33. package/dist/src/crud/types.d.ts +12 -0
  34. package/dist/src/crud/types.d.ts.map +1 -1
  35. package/dist/src/crud/utils/choiceSelectionUtils.d.ts +10 -0
  36. package/dist/src/crud/utils/choiceSelectionUtils.d.ts.map +1 -0
  37. package/dist/src/crud/utils/choiceSelectionUtils.test.d.ts +2 -0
  38. package/dist/src/crud/utils/choiceSelectionUtils.test.d.ts.map +1 -0
  39. package/dist/src/crud/utils/formErrors.d.ts +18 -7
  40. package/dist/src/crud/utils/formErrors.d.ts.map +1 -1
  41. package/dist/src/crud/utils/formErrors.test.d.ts +2 -0
  42. package/dist/src/crud/utils/formErrors.test.d.ts.map +1 -0
  43. package/dist/src/crud/utils/prepareFormSubmitBody.d.ts +1 -0
  44. package/dist/src/crud/utils/prepareFormSubmitBody.d.ts.map +1 -1
  45. package/dist/src/crud/utils/referenceSelectNotFoundContent.d.ts +4 -0
  46. package/dist/src/crud/utils/referenceSelectNotFoundContent.d.ts.map +1 -0
  47. package/dist/src/crud/utils/toFormData.d.ts +1 -1
  48. package/dist/src/crud/utils/toFormData.d.ts.map +1 -1
  49. package/dist/src/crud/utils/uploadReferenceUtils.d.ts +5 -0
  50. package/dist/src/crud/utils/uploadReferenceUtils.d.ts.map +1 -0
  51. package/dist/src/crud/utils/useChoices.d.ts +27 -1
  52. package/dist/src/crud/utils/useChoices.d.ts.map +1 -1
  53. package/dist/src/crud/utils/useFormRecord.d.ts +9 -7
  54. package/dist/src/crud/utils/useFormRecord.d.ts.map +1 -1
  55. package/dist/src/data/parseFormErrorHelpers.d.ts +6 -27
  56. package/dist/src/data/parseFormErrorHelpers.d.ts.map +1 -1
  57. package/dist/src/index.d.ts +2 -2
  58. package/dist/src/index.d.ts.map +1 -1
  59. package/dist/src/layouts/AdminLayout.d.ts +1 -1
  60. package/dist/src/layouts/AdminLayout.d.ts.map +1 -1
  61. package/dist/src/layouts/AuthPageLayout.d.ts.map +1 -1
  62. package/dist/src/layouts/navFilter.d.ts +5 -0
  63. package/dist/src/layouts/navFilter.d.ts.map +1 -0
  64. package/dist/src/layouts/navMenuItems.d.ts +6 -0
  65. package/dist/src/layouts/navMenuItems.d.ts.map +1 -0
  66. package/dist/src/types.d.ts +12 -0
  67. package/dist/src/types.d.ts.map +1 -1
  68. package/package.json +79 -59
  69. package/src/app/AdminApp.tsx +34 -34
  70. package/src/components/AuthAlternateLink.tsx +23 -23
  71. package/src/components/DensitySwitch.tsx +31 -31
  72. package/src/components/NavMenuLabel.tsx +26 -0
  73. package/src/components/NavMenuSearch.tsx +76 -0
  74. package/src/components/ScrollableArea.tsx +46 -0
  75. package/src/components/ThemeSwitch.tsx +28 -28
  76. package/src/components/ThemeToolbar.tsx +34 -34
  77. package/src/components/index.ts +7 -4
  78. package/src/components/navMenu.css +21 -0
  79. package/src/components/scrollable.css +28 -0
  80. package/src/context/AppThemeProvider.tsx +128 -128
  81. package/src/context/AuthProvider.tsx +89 -77
  82. package/src/context/DataProvider.tsx +30 -30
  83. package/src/context/PermissionsProvider.tsx +57 -57
  84. package/src/crud/FilterBar.tsx +36 -36
  85. package/src/crud/FormGlobalErrorsAlert.tsx +36 -0
  86. package/src/crud/FormSteps.tsx +135 -135
  87. package/src/crud/FormTabs.tsx +126 -126
  88. package/src/crud/InlineFormSet.tsx +162 -162
  89. package/src/crud/ListActionsBar.tsx +106 -106
  90. package/src/crud/ResourceForm.tsx +83 -160
  91. package/src/crud/ResourceFormModal.tsx +75 -133
  92. package/src/crud/ResourceRecordForm.tsx +166 -0
  93. package/src/crud/columns/BooleanColumn.tsx +32 -32
  94. package/src/crud/columns/CustomColumn.tsx +33 -33
  95. package/src/crud/columns/DateColumn.tsx +28 -28
  96. package/src/crud/columns/ImageColumn.tsx +58 -58
  97. package/src/crud/columns/NumberColumn.tsx +31 -31
  98. package/src/crud/columns/ReferenceColumn.tsx +85 -85
  99. package/src/crud/columns/ReferenceManyColumn.tsx +67 -67
  100. package/src/crud/columns/TextColumn.tsx +38 -38
  101. package/src/crud/context/FilterContext.tsx +71 -71
  102. package/src/crud/context/FormContext.tsx +39 -39
  103. package/src/crud/context/FormSectionContext.tsx +22 -22
  104. package/src/crud/context/InlineFieldsRegistry.tsx +61 -61
  105. package/src/crud/context/ListContext.tsx +93 -93
  106. package/src/crud/fields/BooleanField.tsx +38 -38
  107. package/src/crud/fields/DateField.tsx +53 -53
  108. package/src/crud/fields/FileField.tsx +123 -123
  109. package/src/crud/fields/ImageField.tsx +120 -120
  110. package/src/crud/fields/NumberField.tsx +52 -52
  111. package/src/crud/fields/PasswordField.tsx +99 -99
  112. package/src/crud/fields/ReferenceField.tsx +237 -96
  113. package/src/crud/fields/ReferenceInputActions.tsx +106 -0
  114. package/src/crud/fields/ReferenceManyField.tsx +200 -76
  115. package/src/crud/fields/SelectField.tsx +48 -48
  116. package/src/crud/fields/TextField.tsx +46 -46
  117. package/src/crud/fields/uploadFieldUtils.ts +21 -21
  118. package/src/crud/fields/useUploadPreviewUrl.ts +20 -20
  119. package/src/crud/filters/BooleanFilter.tsx +38 -38
  120. package/src/crud/filters/DateFilter.tsx +35 -35
  121. package/src/crud/filters/NumberFilter.tsx +33 -33
  122. package/src/crud/filters/ReferenceFilter.tsx +192 -173
  123. package/src/crud/filters/SelectFilter.tsx +44 -44
  124. package/src/crud/filters/TextFilter.tsx +36 -36
  125. package/src/crud/index.ts +99 -94
  126. package/src/crud/types.ts +146 -134
  127. package/src/crud/utils/buildFormPayload.ts +24 -24
  128. package/src/crud/utils/buildInlineRowsPayload.ts +37 -37
  129. package/src/crud/utils/buildResourceFormSubmitBody.ts +29 -29
  130. package/src/crud/utils/choiceSelectionUtils.test.ts +45 -0
  131. package/src/crud/utils/choiceSelectionUtils.ts +116 -0
  132. package/src/crud/utils/formErrors.test.ts +168 -0
  133. package/src/crud/utils/formErrors.ts +138 -42
  134. package/src/crud/utils/formSectionErrors.ts +85 -85
  135. package/src/crud/utils/getFormValue.ts +13 -13
  136. package/src/crud/utils/hasUploadValues.ts +9 -9
  137. package/src/crud/utils/nestedFieldPath.ts +8 -8
  138. package/src/crud/utils/prepareFormSubmitBody.ts +22 -17
  139. package/src/crud/utils/referenceSelectNotFoundContent.tsx +7 -0
  140. package/src/crud/utils/setFormValue.ts +18 -18
  141. package/src/crud/utils/sortQueryParam.ts +37 -37
  142. package/src/crud/utils/toFormData.ts +79 -81
  143. package/src/crud/utils/uploadReferenceUtils.ts +44 -0
  144. package/src/crud/utils/useAbortableEffect.ts +17 -17
  145. package/src/crud/utils/useChoices.ts +330 -182
  146. package/src/crud/utils/useFormRecord.ts +179 -156
  147. package/src/crud/utils/useListQueryState.ts +191 -191
  148. package/src/data/abortError.test.ts +19 -19
  149. package/src/data/abortError.ts +10 -10
  150. package/src/data/createMemoryResourceHandlers.ts +78 -78
  151. package/src/data/createRestResourceHandlers.ts +63 -63
  152. package/src/data/dataUtils.test.ts +228 -220
  153. package/src/data/inMemoryList.ts +97 -97
  154. package/src/data/parseFormErrorHelpers.test.ts +201 -138
  155. package/src/data/parseFormErrorHelpers.ts +376 -311
  156. package/src/data/sortHelpers.ts +48 -48
  157. package/src/index.ts +211 -207
  158. package/src/layouts/AdminLayout.tsx +530 -382
  159. package/src/layouts/AuthPageLayout.tsx +87 -81
  160. package/src/layouts/navFilter.ts +49 -0
  161. package/src/layouts/navMenuItems.tsx +44 -0
  162. package/src/pages/LoginPage.tsx +80 -80
  163. package/src/pages/PlaceholderPage.tsx +9 -9
  164. package/src/permissions/resourcePermissions.ts +47 -47
  165. package/src/router/createAdminRouter.tsx +64 -64
  166. package/src/router/guards.tsx +63 -63
  167. package/src/router/routeAccess.ts +89 -89
  168. package/src/types.ts +10 -0
  169. package/src/vite-env.d.ts +1 -1
@@ -1,42 +1,29 @@
1
1
  import { FormValidationErrors, ParseFormErrorContext } from './dataProviderTypes';
2
+ export declare const EXPECTED_VALIDATION_BODY_HINT = "Expected HTTP 400 with a JSON object such as `{ \"field_name\": [\"message\"] }` or `{ \"non_field_errors\": [\"message\"] }`.";
2
3
  export declare function asStringMessages(value: unknown): string[];
4
+ export declare function describeNonStandardValidationBody(body: Record<string, unknown> | null, options?: {
5
+ hint?: string;
6
+ }): string;
7
+ export declare function getValidationErrorStatus(error: unknown): number | null;
8
+ export declare function getErrorResponseContentType(error: unknown): string | null;
3
9
  /**
4
-
5
10
  * Read a parsed JSON validation body when it is already available on the error.
6
-
7
11
  *
8
-
9
12
  * Supported transport shapes (sync only):
10
-
11
13
  * - `{ body: { email: ["…"] } }` — explicit throw from a handler
12
-
13
14
  * - `{ response: { data: { email: ["…"] } } }` — axios-style wrappers
14
-
15
15
  * - `{ data: { email: ["…"] } }` — some HTTP clients attach parsed JSON here
16
-
17
16
  *
18
-
19
17
  * For fetch / OpenAPI clients that only expose a `Response`, use `resolveErrorBody`.
20
-
21
18
  */
22
19
  export declare function getErrorBody(error: unknown): Record<string, unknown> | null;
23
- /**
24
-
25
- * Resolve a validation JSON body from any common HTTP client error shape.
26
-
27
- * Falls back to reading `response.json()` for fetch / OpenAPI `ResponseError`.
28
-
29
- */
30
20
  export declare function resolveErrorBody(error: unknown): Promise<Record<string, unknown> | null>;
31
21
  /** Map `{ lines: [{ label: ["…"] }] }` → `{ "lines.0.label": "…" }`. */
32
22
  export declare function flattenNestedArrayErrors(arrayKey: string, rows: unknown[], fields: Record<string, string | string[]>): void;
33
23
  export declare function finalizeFormErrors(fields: Record<string, string | string[]>, global: string[]): FormValidationErrors;
34
24
  /**
35
-
36
25
  * Django REST framework validation body:
37
-
38
26
  * `{ "email": ["Invalid"], "non_field_errors": ["…"] }`
39
-
40
27
  */
41
28
  export declare function parseDjangoDRFFormErrors(error: unknown, _ctx: ParseFormErrorContext): FormValidationErrors | null;
42
29
  export type DotNetFormErrorOptions = {
@@ -48,26 +35,18 @@ export type DotNetFormErrorOptions = {
48
35
  includeSummary?: boolean;
49
36
  };
50
37
  /**
51
-
52
38
  * ASP.NET Core `ValidationProblemDetails`:
53
-
54
39
  * `{ "errors": { "Email": ["The Email field is required."] } }`
55
-
56
40
  */
57
41
  export declare function parseDotNetFormErrors(error: unknown, _ctx: ParseFormErrorContext, options?: DotNetFormErrorOptions): FormValidationErrors | null;
58
42
  export type NodeFormErrorOptions = {
59
43
  fieldMap?: Record<string, string>;
60
44
  };
61
45
  /**
62
-
63
46
  * Common Node / Express shapes:
64
-
65
47
  * - `{ errors: { email: ["Invalid"] } }`
66
-
67
48
  * - `{ errors: [{ path: "email", msg: "Invalid" }] }` (express-validator)
68
-
69
49
  * - `{ details: [{ message: "…", path: ["email"] }] }` (Joi)
70
-
71
50
  */
72
51
  export declare function parseNodeFormErrors(error: unknown, _ctx: ParseFormErrorContext, options?: NodeFormErrorOptions): FormValidationErrors | null;
73
52
  //# sourceMappingURL=parseFormErrorHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseFormErrorHelpers.d.ts","sourceRoot":"","sources":["../../../src/data/parseFormErrorHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,oBAAoB,EAEpB,qBAAqB,EAEtB,MAAM,qBAAqB,CAAC;AAI7B,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAczD;AA8CD;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CA0C3E;AAID;;;;;;GAMG;AAEH,wBAAsB,gBAAgB,CAEpC,KAAK,EAAE,OAAO,GAEb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAsCzC;AA8BD,wEAAwE;AAExE,wBAAgB,wBAAwB,CAEtC,QAAQ,EAAE,MAAM,EAEhB,IAAI,EAAE,OAAO,EAAE,EAEf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC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;IACnF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,sBAAsB,GAC/B,oBAAoB,GAAG,IAAI,CA0B7B;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,oBAAoB,GAAG,IAAI,CAyD7B"}
@@ -7,7 +7,7 @@ export { AppThemeProvider, useThemeMode, } from './context/AppThemeProvider';
7
7
  export type { CreateResult, DataProvider as DataProviderContract, DeleteResult, GetListParams, GetListResult, GetOneParams, GetOneResult, Identifier, PaginationParams, SortOrder, SortSpec, UpdateParams, UpdateResult, FormMutation, FormMutationBody, FormValidationErrors, ParseFormError, ParseFormErrorContext, } from './data/dataProviderTypes';
8
8
  export { combineResourceHandlers } from './data/resourceHandlers';
9
9
  export { isAbortError } from './data/abortError';
10
- export { parseDjangoDRFFormErrors, parseDotNetFormErrors, parseNodeFormErrors, getErrorBody, resolveErrorBody, flattenNestedArrayErrors, asStringMessages, finalizeFormErrors, } from './data/parseFormErrorHelpers';
10
+ export { parseDjangoDRFFormErrors, parseDotNetFormErrors, parseNodeFormErrors, getErrorBody, resolveErrorBody, flattenNestedArrayErrors, asStringMessages, finalizeFormErrors, describeNonStandardValidationBody, EXPECTED_VALIDATION_BODY_HINT, } from './data/parseFormErrorHelpers';
11
11
  export type { DotNetFormErrorOptions, NodeFormErrorOptions, } from './data/parseFormErrorHelpers';
12
12
  export { createMemoryResourceHandlers } from './data/createMemoryResourceHandlers';
13
13
  export { createRestResourceHandlers } from './data/createRestResourceHandlers';
@@ -28,5 +28,5 @@ export { createAdminRouter } from './router/createAdminRouter';
28
28
  export { deriveAuthPaths, getRouteAccess, partitionAdminRoutes, } from './router/routeAccess';
29
29
  export type { AdminAppProps, AdminLayoutProps, AdminRouteChild, AppThemeProviderProps, AuthAdapter, LoginCredentials, AuthRedirects, CreateAdminRouterOptions, AuthAlternateLinkProps, AuthPageLayoutProps, LoginPageProps, NavItem, RouteAccess, ThemeDensity, ThemeMode, } from './types';
30
30
  export { ResourceList, FilterBar, ResourceForm, ResourceFormModal, InlineFormSet, InlineFormSetStacked, FormTabs, FormTab, FormSteps, FormStep, TextField, NumberField, BooleanField, DateField, SelectField, PasswordField, ReferenceField, ReferenceManyField, ImageField, FileField, FieldWrapper, TextColumn, NumberColumn, BooleanColumn, DateColumn, ReferenceColumn, ReferenceManyColumn, ImageColumn, CustomColumn, TextFilter, NumberFilter, BooleanFilter, DateFilter, SelectFilter, ReferenceFilter, ReferenceManyFilter, useListQueryState, useChoices, useAbortableEffect, getFormValue, setFormValue, buildFormPayload, buildInlineRowsPayload, buildResourceFormSubmitBody, prepareFormSubmitBody, toFormData, hasUploadValues, nestedFieldPath, useResourceListContext, useRegisterPayloadField, useRegisterSectionField, } from './crud';
31
- export type { ResourceFormProps, ResourceFormModalProps, InlineFormSetProps, InlineFormSetStackedProps, FormTabsProps, FormTabProps, FormStepsProps, FormStepProps, InlineFormSetLayout, ResourceListProps, BaseSourceProps, ChoiceOption, ChoicesLoader, ReferenceProps, DisplayProps, EditMode, FieldRules, InlineCellContext, InlineColumnDef, InlineFormSetBaseProps, InlineRowContext, InlineFieldRegistration, FieldWrapperProps, ImageFieldProps, FileFieldProps, UploadFieldValue, ToFormDataOptions, PrepareFormSubmitBodyOptions, ResourceListBuiltInActions, ResourceListBulkAction, ResourceListBulkActionHelpers, ResourceListRowActionsHelpers, ListQueryState, ListQueryActions, } from './crud';
31
+ export type { ResourceFormProps, ResourceFormModalProps, InlineFormSetProps, InlineFormSetStackedProps, FormTabsProps, FormTabProps, FormStepsProps, FormStepProps, InlineFormSetLayout, ResourceListProps, BaseSourceProps, ChoiceOption, ChoicesLoader, UseChoicesOptions, ReferenceFieldProps, ReferenceManyFieldProps, DisplayProps, EditMode, FieldRules, InlineCellContext, InlineColumnDef, InlineFormSetBaseProps, InlineRowContext, InlineFieldRegistration, FieldWrapperProps, ImageFieldProps, FileFieldProps, UploadFieldValue, ToFormDataOptions, PrepareFormSubmitBodyOptions, ResourceListBuiltInActions, ResourceListBulkAction, ResourceListBulkActionHelpers, ResourceListRowActionsHelpers, ListQueryState, ListQueryActions, } from './crud';
32
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,+BAA+B,EAC/B,OAAO,EACP,KAAK,iBAAiB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,KAAK,iBAAiB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,EACN,cAAc,EACd,KAAK,wBAAwB,GAC9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,YAAY,GACb,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,YAAY,EACZ,YAAY,IAAI,oBAAoB,EACpC,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,uBAAuB,EA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ACd,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,6BAA6B,EAC7B,6BAA6B,EAC7B,cAAc,EACd,gBAAgB,GACjB,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,+BAA+B,EAC/B,OAAO,EACP,KAAK,iBAAiB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,KAAK,iBAAiB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,EACN,cAAc,EACd,KAAK,wBAAwB,GAC9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,YAAY,GACb,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,YAAY,EACZ,YAAY,IAAI,oBAAoB,EACpC,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EAC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AAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,6BAA6B,EAC7B,6BAA6B,EAC7B,cAAc,EACd,gBAAgB,GACjB,MAAM,QAAQ,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { AdminLayoutProps } from '../types';
2
- export declare function AdminLayout({ navItems, brand, collapsedBrand, mobileDrawerTitle, headerExtras, userMenuItems, onUserMenuClick, loginPath, siderCollapsedStorageKey, }: AdminLayoutProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function AdminLayout({ navItems, brand, collapsedBrand, mobileDrawerTitle, headerExtras, userMenuItems, onUserMenuClick, loginPath, siderCollapsedStorageKey, navSearch, }: AdminLayoutProps): import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=AdminLayout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminLayout.d.ts","sourceRoot":"","sources":["../../../src/layouts/AdminLayout.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,gBAAgB,EAAW,MAAM,UAAU,CAAC;AAyG1D,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,KAAe,EACf,cAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,SAAoB,EACpB,wBAA4C,GAC7C,EAAE,gBAAgB,2CAkPlB"}
1
+ {"version":3,"file":"AdminLayout.d.ts","sourceRoot":"","sources":["../../../src/layouts/AdminLayout.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,gBAAgB,EAAW,MAAM,UAAU,CAAC;AAC1D,OAAO,2BAA2B,CAAC;AA4InC,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,KAAe,EACf,cAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,SAAoB,EACpB,wBAA4C,EAC5C,SAAgB,GACjB,EAAE,gBAAgB,2CA0VlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"AuthPageLayout.d.ts","sourceRoot":"","sources":["../../../src/layouts/AuthPageLayout.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,EACL,MAAM,EACN,gBAAuB,GACxB,EAAE,mBAAmB,2CA8DrB"}
1
+ {"version":3,"file":"AuthPageLayout.d.ts","sourceRoot":"","sources":["../../../src/layouts/AuthPageLayout.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,EACL,MAAM,EACN,gBAAuB,GACxB,EAAE,mBAAmB,2CAmErB"}
@@ -0,0 +1,5 @@
1
+ import { NavItem } from '../types';
2
+ export declare function getNavItemLabel(item: NavItem): string;
3
+ export declare function filterNavItems(items: NavItem[], query: string): NavItem[];
4
+ export declare function collectSubmenuKeys(items: NavItem[]): string[];
5
+ //# sourceMappingURL=navFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navFilter.d.ts","sourceRoot":"","sources":["../../../src/layouts/navFilter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAKrD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,CAyBzE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAY7D"}
@@ -0,0 +1,6 @@
1
+ import { MenuProps } from 'antd';
2
+ import { NavItem } from '../types';
3
+ export declare function navItemsToAntdItems(items: NavItem[], options?: {
4
+ showLabelTooltip?: boolean;
5
+ }): NonNullable<MenuProps["items"]>;
6
+ //# sourceMappingURL=navMenuItems.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navMenuItems.d.ts","sourceRoot":"","sources":["../../../src/layouts/navMenuItems.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxC,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EAAE,EAChB,OAAO,CAAC,EAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,GACvC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAmCjC"}
@@ -30,6 +30,11 @@ export type AuthAdapter = {
30
30
  logout: () => void;
31
31
  /** Synchronous read of session (e.g. token). Used after mount and after login/logout. */
32
32
  getToken: () => string | null;
33
+ /**
34
+ * Label for the account menu in `AdminLayout` (top-right button).
35
+ * Return `null` when no user is loaded. Defaults to `"User"` when omitted.
36
+ */
37
+ getUserLabel?: () => string | null;
33
38
  };
34
39
  /** How a route participates in auth when using `AdminApp` / `createAdminRouter`. */
35
40
  export type RouteAccess =
@@ -68,6 +73,13 @@ export type AdminLayoutProps = {
68
73
  loginPath?: string;
69
74
  /** localStorage key for sider collapsed state. Default `ding-react-admin-sider-collapsed`. */
70
75
  siderCollapsedStorageKey?: string;
76
+ /**
77
+ * Sidebar menu search. Enabled by default; pass `false` to hide.
78
+ * Use an object to customize the placeholder.
79
+ */
80
+ navSearch?: boolean | {
81
+ placeholder?: string;
82
+ };
71
83
  };
72
84
  export type { AuthPageLayoutProps } from './layouts/AuthPageLayout';
73
85
  export type { AuthAlternateLinkProps } from './components/AuthAlternateLink';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,SAAS,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,wGAAwG;IACxG,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC3B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAEF,wFAAwF;AACxF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,CAAC,WAAW,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAA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eAAe,EAAE,CAAC;IAC1B,2FAA2F;IAC3F,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CACb,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,GAAG,mBAAmB,CAAC,CACpE,CAAC;CACH,CAAC"}
package/package.json CHANGED
@@ -1,59 +1,79 @@
1
- {
2
- "name": "ding-react-admin",
3
- "version": "2.0.0",
4
- "type": "module",
5
- "license": "MIT",
6
- "description": "Composable admin shell (Ant Design + React Router): quick-start AdminApp or build your own layout.",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/Muhammadinaam/ding-react-admin.git"
10
- },
11
- "main": "./dist/index.js",
12
- "module": "./dist/index.js",
13
- "types": "./dist/index.d.ts",
14
- "exports": {
15
- ".": {
16
- "types": "./dist/index.d.ts",
17
- "import": "./dist/index.js"
18
- }
19
- },
20
- "files": [
21
- "dist",
22
- "src",
23
- "docs/assets"
24
- ],
25
- "scripts": {
26
- "build": "vite build && node -e \"require('fs').writeFileSync('dist/index.d.ts','export * from \\\"./src/index\\\";\\n')\"",
27
- "dev:example": "yarn --cwd examples/playground dev",
28
- "build:example": "yarn --cwd examples/playground build",
29
- "build:example:gh-pages": "yarn --cwd examples/playground build:gh-pages",
30
- "test": "vitest run",
31
- "prepublishOnly": "yarn build"
32
- },
33
- "peerDependencies": {
34
- "@ant-design/icons": ">=6",
35
- "antd": ">=6",
36
- "dayjs": ">=1",
37
- "react": ">=18",
38
- "react-dom": ">=18",
39
- "react-hook-form": ">=7",
40
- "react-router-dom": ">=6"
41
- },
42
- "devDependencies": {
43
- "@ant-design/icons": "^6.0.0",
44
- "@types/react": "^19.2.14",
45
- "@types/react-dom": "^19.2.3",
46
- "@vitejs/plugin-react": "^6.0.1",
47
- "antd": "^6.0.0",
48
- "dayjs": "^1.11.13",
49
- "react": "^19.2.5",
50
- "react-dom": "^19.2.5",
51
- "react-hook-form": "^7.56.4",
52
- "react-router-dom": "^7.14.2",
53
- "typescript": "~6.0.2",
54
- "vite": "^8.0.9",
55
- "vite-plugin-dts": "^4.5.4",
56
- "vitest": "^3.2.4"
57
- },
58
- "dependencies": {}
59
- }
1
+ {
2
+ "name": "ding-react-admin",
3
+ "version": "2.0.4",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "description": "Composable admin shell (Ant Design + React Router): quick-start AdminApp or build your own layout.",
7
+ "keywords": [
8
+ "react",
9
+ "admin",
10
+ "dashboard",
11
+ "antd",
12
+ "ant-design",
13
+ "crud",
14
+ "react-router",
15
+ "react-hook-form",
16
+ "data-grid",
17
+ "forms",
18
+ "typescript"
19
+ ],
20
+ "homepage": "https://muhammadinaam.github.io/ding-react-admin/",
21
+ "bugs": {
22
+ "url": "https://github.com/Muhammadinaam/ding-react-admin/issues"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/Muhammadinaam/ding-react-admin.git"
27
+ },
28
+ "publishConfig": {
29
+ "provenance": true
30
+ },
31
+ "main": "./dist/index.js",
32
+ "module": "./dist/index.js",
33
+ "types": "./dist/index.d.ts",
34
+ "exports": {
35
+ ".": {
36
+ "types": "./dist/index.d.ts",
37
+ "import": "./dist/index.js"
38
+ }
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "src",
43
+ "docs/assets"
44
+ ],
45
+ "scripts": {
46
+ "build": "vite build && node -e \"require('fs').writeFileSync('dist/index.d.ts','export * from \\\"./src/index\\\";\\n')\"",
47
+ "dev:example": "yarn --cwd examples/playground dev",
48
+ "build:example": "yarn --cwd examples/playground build",
49
+ "build:example:gh-pages": "yarn --cwd examples/playground build:gh-pages",
50
+ "test": "vitest run",
51
+ "prepublishOnly": "yarn build"
52
+ },
53
+ "peerDependencies": {
54
+ "@ant-design/icons": ">=6",
55
+ "antd": ">=6",
56
+ "dayjs": ">=1",
57
+ "react": ">=18",
58
+ "react-dom": ">=18",
59
+ "react-hook-form": ">=7",
60
+ "react-router-dom": ">=6"
61
+ },
62
+ "devDependencies": {
63
+ "@ant-design/icons": "^6.0.0",
64
+ "@types/react": "^19.2.14",
65
+ "@types/react-dom": "^19.2.3",
66
+ "@vitejs/plugin-react": "^6.0.1",
67
+ "antd": "^6.0.0",
68
+ "dayjs": "^1.11.13",
69
+ "react": "^19.2.5",
70
+ "react-dom": "^19.2.5",
71
+ "react-hook-form": "^7.56.4",
72
+ "react-router-dom": "^7.14.2",
73
+ "typescript": "~6.0.2",
74
+ "vite": "^8.0.9",
75
+ "vite-plugin-dts": "^4.5.4",
76
+ "vitest": "^3.2.4"
77
+ },
78
+ "dependencies": {}
79
+ }
@@ -1,34 +1,34 @@
1
- import { useMemo } from "react";
2
- import { RouterProvider } from "react-router-dom";
3
- import { AppThemeProvider } from "../context/AppThemeProvider";
4
- import { createAdminRouter } from "../router/createAdminRouter";
5
- import type { AdminAppProps } from "../types";
6
-
7
- /**
8
- * Declarative admin shell: theme, router, and layout from your route list.
9
- * Wrap in `<AuthProvider adapter={...}>` — auth is not configured on this component.
10
- */
11
- export function AdminApp({
12
- navItems,
13
- routes,
14
- authRedirects,
15
- layoutProps,
16
- theme: themeKeys,
17
- }: AdminAppProps) {
18
- const router = useMemo(
19
- () =>
20
- createAdminRouter({
21
- navItems,
22
- children: routes,
23
- layoutProps,
24
- redirects: authRedirects,
25
- }),
26
- [navItems, routes, layoutProps, authRedirects],
27
- );
28
-
29
- return (
30
- <AppThemeProvider {...themeKeys}>
31
- <RouterProvider router={router} />
32
- </AppThemeProvider>
33
- );
34
- }
1
+ import { useMemo } from "react";
2
+ import { RouterProvider } from "react-router-dom";
3
+ import { AppThemeProvider } from "../context/AppThemeProvider";
4
+ import { createAdminRouter } from "../router/createAdminRouter";
5
+ import type { AdminAppProps } from "../types";
6
+
7
+ /**
8
+ * Declarative admin shell: theme, router, and layout from your route list.
9
+ * Wrap in `<AuthProvider adapter={...}>` — auth is not configured on this component.
10
+ */
11
+ export function AdminApp({
12
+ navItems,
13
+ routes,
14
+ authRedirects,
15
+ layoutProps,
16
+ theme: themeKeys,
17
+ }: AdminAppProps) {
18
+ const router = useMemo(
19
+ () =>
20
+ createAdminRouter({
21
+ navItems,
22
+ children: routes,
23
+ layoutProps,
24
+ redirects: authRedirects,
25
+ }),
26
+ [navItems, routes, layoutProps, authRedirects],
27
+ );
28
+
29
+ return (
30
+ <AppThemeProvider {...themeKeys}>
31
+ <RouterProvider router={router} />
32
+ </AppThemeProvider>
33
+ );
34
+ }
@@ -1,23 +1,23 @@
1
- import { Typography } from "antd";
2
- import { Link } from "react-router-dom";
3
-
4
- export type AuthAlternateLinkProps = {
5
- prompt: string;
6
- linkText: string;
7
- to: string;
8
- };
9
-
10
- export function AuthAlternateLink({
11
- prompt,
12
- linkText,
13
- to,
14
- }: AuthAlternateLinkProps) {
15
- return (
16
- <Typography.Paragraph
17
- type="secondary"
18
- style={{ textAlign: "center", marginBottom: 0 }}
19
- >
20
- {prompt} <Link to={to}>{linkText}</Link>
21
- </Typography.Paragraph>
22
- );
23
- }
1
+ import { Typography } from "antd";
2
+ import { Link } from "react-router-dom";
3
+
4
+ export type AuthAlternateLinkProps = {
5
+ prompt: string;
6
+ linkText: string;
7
+ to: string;
8
+ };
9
+
10
+ export function AuthAlternateLink({
11
+ prompt,
12
+ linkText,
13
+ to,
14
+ }: AuthAlternateLinkProps) {
15
+ return (
16
+ <Typography.Paragraph
17
+ type="secondary"
18
+ style={{ textAlign: "center", marginBottom: 0 }}
19
+ >
20
+ {prompt} <Link to={to}>{linkText}</Link>
21
+ </Typography.Paragraph>
22
+ );
23
+ }
@@ -1,31 +1,31 @@
1
- import { ColumnHeightOutlined, LayoutOutlined } from "@ant-design/icons";
2
- import { Segmented } from "antd";
3
- import type { SegmentedProps } from "antd";
4
- import { useThemeMode } from "../context/AppThemeProvider";
5
- import type { ThemeDensity } from "../types";
6
-
7
- const OPTIONS: SegmentedProps["options"] = [
8
- {
9
- label: "Comfortable",
10
- value: "comfortable",
11
- icon: <LayoutOutlined />,
12
- },
13
- {
14
- label: "Compact",
15
- value: "compact",
16
- icon: <ColumnHeightOutlined />,
17
- },
18
- ];
19
-
20
- export function DensitySwitch() {
21
- const { density, setDensity } = useThemeMode();
22
-
23
- return (
24
- <Segmented
25
- size="small"
26
- value={density}
27
- options={OPTIONS}
28
- onChange={(v) => setDensity(v as ThemeDensity)}
29
- />
30
- );
31
- }
1
+ import { ColumnHeightOutlined, LayoutOutlined } from "@ant-design/icons";
2
+ import { Segmented } from "antd";
3
+ import type { SegmentedProps } from "antd";
4
+ import { useThemeMode } from "../context/AppThemeProvider";
5
+ import type { ThemeDensity } from "../types";
6
+
7
+ const OPTIONS: SegmentedProps["options"] = [
8
+ {
9
+ label: "Comfortable",
10
+ value: "comfortable",
11
+ icon: <LayoutOutlined />,
12
+ },
13
+ {
14
+ label: "Compact",
15
+ value: "compact",
16
+ icon: <ColumnHeightOutlined />,
17
+ },
18
+ ];
19
+
20
+ export function DensitySwitch() {
21
+ const { density, setDensity } = useThemeMode();
22
+
23
+ return (
24
+ <Segmented
25
+ size="small"
26
+ value={density}
27
+ options={OPTIONS}
28
+ onChange={(v) => setDensity(v as ThemeDensity)}
29
+ />
30
+ );
31
+ }
@@ -0,0 +1,26 @@
1
+ import { Tooltip } from "antd";
2
+ import type { ReactNode } from "react";
3
+ import "./navMenu.css";
4
+
5
+ export type NavMenuLabelProps = {
6
+ label: ReactNode;
7
+ /** Plain-text tooltip shown on hover. */
8
+ title: string;
9
+ };
10
+
11
+ export function NavMenuLabel({ label, title }: NavMenuLabelProps) {
12
+ if (!title) {
13
+ return <span className="ding-admin-menu-label">{label}</span>;
14
+ }
15
+
16
+ return (
17
+ <Tooltip
18
+ title={title}
19
+ placement="right"
20
+ mouseEnterDelay={1}
21
+ destroyOnHidden
22
+ >
23
+ <span className="ding-admin-menu-label">{label}</span>
24
+ </Tooltip>
25
+ );
26
+ }
@@ -0,0 +1,76 @@
1
+ import { SearchOutlined } from "@ant-design/icons";
2
+ import { ConfigProvider, Input, theme } from "antd";
3
+ import type { ChangeEvent } from "react";
4
+
5
+ export type NavMenuSearchProps = {
6
+ value: string;
7
+ onChange: (value: string) => void;
8
+ placeholder?: string;
9
+ /** Lighter styling for the classic dark navy sidebar. */
10
+ variant?: "on-dark" | "app";
11
+ };
12
+
13
+ export function NavMenuSearch({
14
+ value,
15
+ onChange,
16
+ placeholder = "Search menu…",
17
+ variant = "on-dark",
18
+ }: NavMenuSearchProps) {
19
+ const { token } = theme.useToken();
20
+ const onDark = variant === "on-dark";
21
+
22
+ const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
23
+ onChange(event.target.value);
24
+ };
25
+
26
+ return (
27
+ <div
28
+ style={{
29
+ flexShrink: 0,
30
+ paddingInline: token.paddingSM,
31
+ paddingBlock: token.paddingXS,
32
+ }}
33
+ >
34
+ <ConfigProvider
35
+ theme={
36
+ onDark
37
+ ? { token: { colorTextPlaceholder: "rgba(255, 255, 255, 0.45)" } }
38
+ : undefined
39
+ }
40
+ >
41
+ <Input
42
+ allowClear
43
+ size="small"
44
+ value={value}
45
+ onChange={handleChange}
46
+ placeholder={placeholder}
47
+ prefix={
48
+ <SearchOutlined
49
+ style={{
50
+ color: onDark
51
+ ? "rgba(255, 255, 255, 0.45)"
52
+ : token.colorTextDescription,
53
+ }}
54
+ />
55
+ }
56
+ aria-label={placeholder}
57
+ styles={{
58
+ input: onDark
59
+ ? { color: "rgba(255, 255, 255, 0.88)" }
60
+ : undefined,
61
+ clear: onDark
62
+ ? { color: "rgba(255, 255, 255, 0.45)" }
63
+ : undefined,
64
+ }}
65
+ style={{
66
+ background: onDark
67
+ ? "rgba(255, 255, 255, 0.08)"
68
+ : token.colorFillTertiary,
69
+ borderColor: "transparent",
70
+ boxShadow: "none",
71
+ }}
72
+ />
73
+ </ConfigProvider>
74
+ </div>
75
+ );
76
+ }