@payloadcms/ui 3.89.0 → 3.90.1

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 (82) hide show
  1. package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts +1 -1
  2. package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts.map +1 -1
  3. package/dist/elements/BulkUpload/FormsManager/createFormData.js +7 -3
  4. package/dist/elements/BulkUpload/FormsManager/createFormData.js.map +1 -1
  5. package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
  6. package/dist/elements/BulkUpload/FormsManager/index.js +4 -2
  7. package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
  8. package/dist/elements/Spinner/index.d.ts +19 -0
  9. package/dist/elements/Spinner/index.d.ts.map +1 -0
  10. package/dist/elements/Spinner/index.js +51 -0
  11. package/dist/elements/Spinner/index.js.map +1 -0
  12. package/dist/elements/Spinner/index.scss +23 -0
  13. package/dist/exports/client/index.d.ts +4 -1
  14. package/dist/exports/client/index.d.ts.map +1 -1
  15. package/dist/exports/client/index.js +12 -12
  16. package/dist/exports/client/index.js.map +4 -4
  17. package/dist/fields/Tabs/index.d.ts.map +1 -1
  18. package/dist/fields/Tabs/index.js +109 -234
  19. package/dist/fields/Tabs/index.js.map +1 -1
  20. package/dist/fields/Tabs/resolveRestoredTabIndex.d.ts +19 -0
  21. package/dist/fields/Tabs/resolveRestoredTabIndex.d.ts.map +1 -0
  22. package/dist/fields/Tabs/resolveRestoredTabIndex.js +20 -0
  23. package/dist/fields/Tabs/resolveRestoredTabIndex.js.map +1 -0
  24. package/dist/fields/Tabs/resolveRestoredTabIndex.spec.js +53 -0
  25. package/dist/fields/Tabs/resolveRestoredTabIndex.spec.js.map +1 -0
  26. package/dist/forms/Form/index.d.ts.map +1 -1
  27. package/dist/forms/Form/index.js +6 -2
  28. package/dist/forms/Form/index.js.map +1 -1
  29. package/dist/forms/fieldSchemasToFormState/renderField.d.ts.map +1 -1
  30. package/dist/forms/fieldSchemasToFormState/renderField.js +3 -2
  31. package/dist/forms/fieldSchemasToFormState/renderField.js.map +1 -1
  32. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts +12 -0
  33. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts.map +1 -0
  34. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js +32 -0
  35. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js.map +1 -0
  36. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts +8 -6
  37. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts.map +1 -1
  38. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js +25 -9
  39. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js.map +1 -1
  40. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.js +179 -0
  41. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.js.map +1 -0
  42. package/dist/forms/fieldSchemasToFormState/types.d.ts +1 -0
  43. package/dist/forms/fieldSchemasToFormState/types.d.ts.map +1 -1
  44. package/dist/forms/fieldSchemasToFormState/types.js.map +1 -1
  45. package/dist/icons/Eye/index.scss +1 -1
  46. package/dist/icons/Refresh/index.d.ts +7 -0
  47. package/dist/icons/Refresh/index.d.ts.map +1 -0
  48. package/dist/icons/Refresh/index.js +35 -0
  49. package/dist/icons/Refresh/index.js.map +1 -0
  50. package/dist/icons/Refresh/index.scss +11 -0
  51. package/dist/icons/Spinner/index.d.ts +8 -0
  52. package/dist/icons/Spinner/index.d.ts.map +1 -0
  53. package/dist/icons/Spinner/index.js +34 -0
  54. package/dist/icons/Spinner/index.js.map +1 -0
  55. package/dist/icons/Spinner/index.scss +12 -0
  56. package/dist/styles.css +1 -1
  57. package/dist/utilities/buildFormState.d.ts.map +1 -1
  58. package/dist/utilities/buildFormState.js +6 -2
  59. package/dist/utilities/buildFormState.js.map +1 -1
  60. package/dist/utilities/schedulePublishHandler.d.ts.map +1 -1
  61. package/dist/utilities/schedulePublishHandler.js +4 -1
  62. package/dist/utilities/schedulePublishHandler.js.map +1 -1
  63. package/dist/views/Edit/Auth/APIKey.d.ts +1 -1
  64. package/dist/views/Edit/Auth/APIKey.d.ts.map +1 -1
  65. package/dist/views/Edit/Auth/APIKey.js +216 -59
  66. package/dist/views/Edit/Auth/APIKey.js.map +1 -1
  67. package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts +11 -0
  68. package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts.map +1 -0
  69. package/dist/views/Edit/Auth/APIKeyGenerationModal.js +113 -0
  70. package/dist/views/Edit/Auth/APIKeyGenerationModal.js.map +1 -0
  71. package/dist/views/Edit/Auth/index.d.ts.map +1 -1
  72. package/dist/views/Edit/Auth/index.js +10 -30
  73. package/dist/views/Edit/Auth/index.js.map +1 -1
  74. package/dist/views/Edit/Auth/index.scss +73 -36
  75. package/dist/views/Edit/Auth/types.d.ts +1 -1
  76. package/dist/views/Edit/Auth/types.d.ts.map +1 -1
  77. package/dist/views/Edit/Auth/types.js.map +1 -1
  78. package/package.json +5 -5
  79. package/dist/elements/GenerateConfirmation/index.d.ts +0 -7
  80. package/dist/elements/GenerateConfirmation/index.d.ts.map +0 -1
  81. package/dist/elements/GenerateConfirmation/index.js +0 -95
  82. package/dist/elements/GenerateConfirmation/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"renderFieldServerFn.js","names":["deepMerge","UnauthorizedError","getClientConfig","getClientSchemaMap","getSchemaMap","renderField","_internal_renderFieldHandler","field","fieldArg","initialValue","path","req","schemaPath","user","entityType","entitySlug","fieldPath","split","schemaMap","collectionSlug","undefined","config","payload","globalSlug","i18n","clientSchemaMap","importMap","targetField","get","join","Error","clone","data","name","fieldState","clientFieldSchemaMap","fieldConfig","fieldSchemaMap","formState","indexPath","lastRenderedPath","operation","parentPath","parentSchemaPath","permissions","preferences","fields","forceCreateClientField","previousFieldState","renderAllFields","siblingData","customComponents"],"sources":["../../../../src/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.ts"],"sourcesContent":["import {\n deepMerge,\n type Field,\n type FieldState,\n type ServerFunction,\n UnauthorizedError,\n} from 'payload'\n\nimport { getClientConfig } from '../../../utilities/getClientConfig.js'\nimport { getClientSchemaMap } from '../../../utilities/getClientSchemaMap.js'\nimport { getSchemaMap } from '../../../utilities/getSchemaMap.js'\nimport { renderField } from '../renderField.js'\n\nexport type RenderFieldServerFnArgs<TField = Field> = {\n /**\n * Override field config pulled from schemaPath lookup\n */\n field?: Partial<TField>\n /**\n * Pass the value this field will receive when rendering it on the server.\n * For richText, this helps provide initial state for sub-fields that are immediately rendered (like blocks)\n * so that we can avoid multiple waterfall requests for each block that renders on the client.\n */\n initialValue?: unknown\n /**\n * Path to the field to render\n * @default field name\n */\n path?: string\n /**\n * Dot schema path to a richText field declared in your config.\n * Format:\n * \"collection.<collectionSlug>.<fieldPath>\"\n * \"global.<globalSlug>.<fieldPath>\"\n *\n * Examples:\n * \"collection.posts.richText\"\n * \"global.siteSettings.content\"\n */\n schemaPath: string\n}\nexport type RenderFieldServerFnReturnType = {} & FieldState['customComponents']\n\n/**\n * @experimental - may break in minor releases\n */\nexport const _internal_renderFieldHandler: ServerFunction<\n RenderFieldServerFnArgs,\n Promise<RenderFieldServerFnReturnType>\n // eslint-disable-next-line @typescript-eslint/require-await\n> = async ({ field: fieldArg, initialValue, path, req, schemaPath }) => {\n if (!req.user) {\n throw new UnauthorizedError()\n }\n\n const [entityType, entitySlug, ...fieldPath] = schemaPath.split('.')\n\n const schemaMap = getSchemaMap({\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n config: req.payload.config,\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n i18n: req.i18n,\n })\n\n // Provide client schema map as it would have been provided if the target editor field would have been rendered.\n // For lexical, only then will it contain all the lexical-internal entries\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n config: getClientConfig({\n config: req.payload.config,\n i18n: req.i18n,\n importMap: req.payload.importMap,\n user: req.user,\n }),\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n i18n: req.i18n,\n payload: req.payload,\n schemaMap,\n })\n\n const targetField = schemaMap.get(`${entitySlug}.${fieldPath.join('.')}`) as Field | undefined\n\n if (!targetField) {\n throw new Error(`Could not find target field at schemaPath: ${schemaPath}`)\n }\n\n const field: Field = fieldArg ? deepMerge(targetField, fieldArg, { clone: false }) : targetField\n\n let data = {}\n if (typeof initialValue !== 'undefined') {\n if ('name' in field) {\n data[field.name] = initialValue\n } else {\n data = initialValue\n }\n }\n\n const fieldState: FieldState = {}\n renderField({\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug: entityType === 'collection' && entitySlug ? entitySlug : '-',\n data,\n fieldConfig: field,\n fieldSchemaMap: schemaMap,\n fieldState, // TODO,\n formState: {}, // TODO,\n indexPath: '',\n lastRenderedPath: '',\n operation: 'create',\n parentPath: '',\n parentSchemaPath: '',\n path: path ?? ('name' in field ? field.name : ''),\n permissions: true,\n preferences: {\n fields: {},\n },\n // If we are passed a field override, we want to ensure we create a new client field based on that override\n forceCreateClientField: fieldArg ? true : false,\n previousFieldState: undefined,\n renderAllFields: true,\n req,\n schemaPath: `${entitySlug}.${fieldPath.join('.')}`,\n siblingData: data,\n })\n\n return fieldState.customComponents ?? {}\n}\n"],"mappings":"AAAA,SACEA,SAAS,EAITC,iBAAiB,QACZ;AAEP,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,QAAQ;AAC7B,SAASC,WAAW,QAAQ;AAgC5B;;;AAGA,OAAO,MAAMC,4BAAA,GAIT,MAAAA,CAAO;EAAEC,KAAA,EAAOC,QAAQ;EAAEC,YAAY;EAAEC,IAAI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AO;EAAM,KAAKJ,WAAA;EAErF,IAAIK,IAAA,GAAO,CAAC;EACZ,IAAI,OAAOvB,YAAA,KAAiB,aAAa;IACvC,IAAI,UAAUF,KAAA,EAAO;MACnByB,IAAI,CAACzB,KAAA,CAAM0B,IAAI,CAAC,GAAGxB,YAAA;IACrB,OAAO;MACLuB,IAAA,GAAOvB,YAAA;IACT;EACF;EAEA,MAAMyB,UAAA,GAAyB,CAAC;EAChC7B,WAAA,CAAY;IACV8B,oBAAA,EAAsBV,eAAA;IACtBN,cAAA,EAAgBL,UAAA,KAAe,gBAAgBC,UAAA,GAAaA,UAAA,GAAa;IACzEiB,IAAA;IACAI,WAAA,EAAa7B,KAAA;IACb8B,cAAA,EAAgBnB,SAAA;IAChBgB,UAAA;IACAI,SAAA,EAAW,CAAC;IACZC,SAAA,EAAW;IACXC,gBAAA,EAAkB;IAClBC,SAAA,EAAW;IACXC,UAAA,EAAY;IACZC,gBAAA,EAAkB;IAClBjC,IAAA,EAAMA,IAAA,KAAS,UAAUH,KAAA,GAAQA,KAAA,CAAM0B,IAAI,GAAG,EAAC;IAC/CW,WAAA,EAAa;IACbC,WAAA,EAAa;MACXC,MAAA,EAAQ,CAAC;IACX;IACA;IACAC,sBAAA,EAAwBvC,QAAA,GAAW,OAAO;IAC1CwC,kBAAA,EAAoB5B,SAAA;IACpB6B,eAAA,EAAiB;IACjBtC,GAAA;IACAC,UAAA,EAAY,GAAGG,UAAA,IAAcC,SAAA,CAAUa,IAAI,CAAC,MAAM;IAClDqB,WAAA,EAAalB;EACf;EAEA,OAAOE,UAAA,CAAWiB,gBAAgB,IAAI,CAAC;AACzC","ignoreList":[]}
1
+ {"version":3,"file":"renderFieldServerFn.js","names":["canAccessAdmin","UnauthorizedError","getClientConfig","getClientSchemaMap","getSchemaMap","renderField","mergeAllowedFieldOverrides","_internal_renderFieldHandler","name","hidden","initialValue","label","path","req","schemaPath","user","entityType","entitySlug","fieldPath","split","schemaMap","collectionSlug","undefined","config","payload","globalSlug","i18n","clientSchemaMap","importMap","targetField","get","join","Error","field","overrides","admin","hasPropOverrides","data","fieldState","clientFieldSchemaMap","fieldConfig","fieldSchemaMap","formState","indexPath","lastRenderedPath","operation","parentPath","parentSchemaPath","permissions","preferences","fields","forceCreateClientField","previousFieldState","renderAllFields","siblingData","customComponents"],"sources":["../../../../src/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.ts"],"sourcesContent":["import {\n canAccessAdmin,\n type Field,\n type FieldState,\n type ServerFunction,\n UnauthorizedError,\n} from 'payload'\n\nimport { getClientConfig } from '../../../utilities/getClientConfig.js'\nimport { getClientSchemaMap } from '../../../utilities/getClientSchemaMap.js'\nimport { getSchemaMap } from '../../../utilities/getSchemaMap.js'\nimport { renderField } from '../renderField.js'\nimport { mergeAllowedFieldOverrides } from './mergeAllowedFieldOverrides.js'\n\nexport type RenderFieldServerFnArgs = {\n /** Overrides admin.hidden from the schemaPath lookup. */\n hidden?: boolean\n /**\n * Pass the value this field will receive when rendering it on the server.\n * For richText, this helps provide initial state for sub-fields that are immediately rendered (like blocks)\n * so that we can avoid multiple waterfall requests for each block that renders on the client.\n */\n initialValue?: unknown\n /** Overrides the label from the schemaPath lookup. Use false to hide it. */\n label?: false | Record<string, string> | string\n /** Overrides the form field name from the schemaPath lookup. */\n name?: string\n /**\n * Path to the field to render\n * @default field name\n */\n path?: string\n /**\n * Dot schema path to a richText field declared in your config.\n * Format:\n * \"collection.<collectionSlug>.<fieldPath>\"\n * \"global.<globalSlug>.<fieldPath>\"\n *\n * Examples:\n * \"collection.posts.richText\"\n * \"global.siteSettings.content\"\n */\n schemaPath: string\n}\nexport type RenderFieldServerFnReturnType = {} & FieldState['customComponents']\n\n/**\n * @experimental - may break in minor releases\n */\nexport const _internal_renderFieldHandler: ServerFunction<\n RenderFieldServerFnArgs,\n Promise<RenderFieldServerFnReturnType>\n> = async ({ name, hidden, initialValue, label, path, req, schemaPath, user }) => {\n if (!req.user) {\n throw new UnauthorizedError()\n }\n\n await canAccessAdmin({ req })\n\n const [entityType, entitySlug, ...fieldPath] = schemaPath.split('.')\n\n const schemaMap = getSchemaMap({\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n config: req.payload.config,\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n i18n: req.i18n,\n })\n\n // Provide client schema map as it would have been provided if the target editor field would have been rendered.\n // For lexical, only then will it contain all the lexical-internal entries\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n config: getClientConfig({\n config: req.payload.config,\n i18n: req.i18n,\n importMap: req.payload.importMap,\n user: req.user,\n }),\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n i18n: req.i18n,\n payload: req.payload,\n schemaMap,\n })\n\n const targetField = schemaMap.get(`${entitySlug}.${fieldPath.join('.')}`) as Field | undefined\n\n if (!targetField) {\n throw new Error(`Could not find target field at schemaPath: ${schemaPath}`)\n }\n\n const field: Field = mergeAllowedFieldOverrides({\n overrides: { name, admin: { hidden }, label },\n targetField,\n })\n const hasPropOverrides = name !== undefined || label !== undefined || hidden !== undefined\n\n let data = {}\n if (typeof initialValue !== 'undefined') {\n if ('name' in field) {\n data[field.name] = initialValue\n } else {\n data = initialValue\n }\n }\n\n const fieldState: FieldState = {}\n renderField({\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug: entityType === 'collection' && entitySlug ? entitySlug : '-',\n data,\n fieldConfig: field,\n fieldSchemaMap: schemaMap,\n fieldState, // TODO,\n formState: {}, // TODO,\n indexPath: '',\n lastRenderedPath: '',\n operation: 'create',\n parentPath: '',\n parentSchemaPath: '',\n path: path ?? ('name' in field ? field.name : ''),\n permissions: true,\n preferences: {\n fields: {},\n },\n // Create a new client field when presentation values differ from the schema config.\n forceCreateClientField: hasPropOverrides,\n previousFieldState: undefined,\n renderAllFields: true,\n req,\n schemaPath: `${entitySlug}.${fieldPath.join('.')}`,\n siblingData: data,\n user,\n })\n\n return fieldState.customComponents ?? {}\n}\n"],"mappings":"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,sBAAA,EAAwBf,gBAAA;IACxBgB,kBAAA,EAAoB9B,SAAA;IACpB+B,eAAA,EAAiB;IACjBxC,GAAA;IACAC,UAAA,EAAY,GAAGG,UAAA,IAAcC,SAAA,CAAUa,IAAI,CAAC,MAAM;IAClDuB,WAAA,EAAajB,IAAA;IACbtB;EACF;EAEA,OAAOuB,UAAA,CAAWiB,gBAAgB,IAAI,CAAC;AACzC","ignoreList":[]}
@@ -0,0 +1,179 @@
1
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
2
+ import { _internal_renderFieldHandler } from './renderFieldServerFn.js';
3
+ const mocks = vi.hoisted(() => ({
4
+ canAccessAdmin: vi.fn(),
5
+ getClientConfig: vi.fn(),
6
+ getClientSchemaMap: vi.fn(),
7
+ getSchemaMap: vi.fn(),
8
+ renderField: vi.fn()
9
+ }));
10
+ vi.mock('payload', () => ({
11
+ canAccessAdmin: mocks.canAccessAdmin,
12
+ UnauthorizedError: class extends Error {}
13
+ }));
14
+ vi.mock('../../../utilities/getClientConfig.js', () => ({
15
+ getClientConfig: mocks.getClientConfig
16
+ }));
17
+ vi.mock('../../../utilities/getClientSchemaMap.js', () => ({
18
+ getClientSchemaMap: mocks.getClientSchemaMap
19
+ }));
20
+ vi.mock('../../../utilities/getSchemaMap.js', () => ({
21
+ getSchemaMap: mocks.getSchemaMap
22
+ }));
23
+ vi.mock('../renderField.js', () => ({
24
+ renderField: mocks.renderField
25
+ }));
26
+ const args = {
27
+ req: {
28
+ user: {
29
+ collection: 'users'
30
+ },
31
+ payload: {
32
+ config: {},
33
+ importMap: {}
34
+ }
35
+ },
36
+ schemaPath: 'collection.posts.content'
37
+ };
38
+ describe('renderFieldServerFn', () => {
39
+ beforeEach(() => {
40
+ vi.resetAllMocks();
41
+ });
42
+ it('should accept allowed field props', async () => {
43
+ const targetField = {
44
+ name: 'content',
45
+ type: 'richText',
46
+ admin: {
47
+ hidden: true
48
+ }
49
+ };
50
+ mocks.getSchemaMap.mockReturnValue(new Map([['posts.content', targetField]]));
51
+ await _internal_renderFieldHandler({
52
+ ...args,
53
+ name: 'editor',
54
+ label: 'Editor',
55
+ hidden: false,
56
+ initialValue: 'Initial text'
57
+ });
58
+ expect(mocks.canAccessAdmin).toHaveBeenCalledWith({
59
+ req: args.req
60
+ });
61
+ expect(mocks.renderField).toHaveBeenCalledWith(expect.objectContaining({
62
+ fieldConfig: {
63
+ name: 'editor',
64
+ label: 'Editor',
65
+ type: 'richText',
66
+ admin: {
67
+ hidden: false
68
+ }
69
+ },
70
+ data: {
71
+ editor: 'Initial text'
72
+ },
73
+ path: 'editor',
74
+ schemaPath: 'posts.content',
75
+ forceCreateClientField: true
76
+ }));
77
+ expect(targetField).toEqual({
78
+ name: 'content',
79
+ type: 'richText',
80
+ admin: {
81
+ hidden: true
82
+ }
83
+ });
84
+ });
85
+ it('should reject disallowed field props', async () => {
86
+ const components = {
87
+ Field: {
88
+ path: './ConfiguredField',
89
+ serverProps: {
90
+ heading: 'Configured heading'
91
+ }
92
+ }
93
+ };
94
+ const targetField = {
95
+ name: 'content',
96
+ type: 'richText',
97
+ admin: {
98
+ components,
99
+ hidden: true
100
+ }
101
+ };
102
+ mocks.getSchemaMap.mockReturnValue(new Map([['posts.content', targetField]]));
103
+ const request = {
104
+ ...args,
105
+ field: {
106
+ admin: {
107
+ components: {
108
+ Field: {
109
+ path: './OtherField',
110
+ serverProps: {
111
+ heading: 'Other heading'
112
+ }
113
+ }
114
+ }
115
+ }
116
+ },
117
+ initialValue: 'Initial text'
118
+ };
119
+ await _internal_renderFieldHandler(request);
120
+ expect(mocks.canAccessAdmin).toHaveBeenCalledWith({
121
+ req: args.req
122
+ });
123
+ expect(mocks.renderField).toHaveBeenCalledWith(expect.objectContaining({
124
+ fieldConfig: {
125
+ ...targetField,
126
+ admin: {
127
+ components: {
128
+ Field: {
129
+ path: './ConfiguredField',
130
+ serverProps: {
131
+ heading: 'Configured heading'
132
+ }
133
+ }
134
+ },
135
+ hidden: true
136
+ }
137
+ },
138
+ data: {
139
+ content: 'Initial text'
140
+ },
141
+ path: 'content',
142
+ schemaPath: 'posts.content',
143
+ forceCreateClientField: false
144
+ }));
145
+ expect(targetField).toEqual({
146
+ name: 'content',
147
+ type: 'richText',
148
+ admin: {
149
+ components: {
150
+ Field: {
151
+ path: './ConfiguredField',
152
+ serverProps: {
153
+ heading: 'Configured heading'
154
+ }
155
+ }
156
+ },
157
+ hidden: true
158
+ }
159
+ });
160
+ });
161
+ it('should deny when admin access is denied', async () => {
162
+ mocks.canAccessAdmin.mockRejectedValue(new Error('Admin access denied'));
163
+ await expect(_internal_renderFieldHandler(args)).rejects.toThrow('Admin access denied');
164
+ expect(mocks.getSchemaMap).not.toHaveBeenCalled();
165
+ expect(mocks.renderField).not.toHaveBeenCalled();
166
+ });
167
+ it('should deny when no user is on the request', async () => {
168
+ await expect(_internal_renderFieldHandler({
169
+ ...args,
170
+ req: {
171
+ ...args.req,
172
+ user: null
173
+ }
174
+ })).rejects.toThrow();
175
+ expect(mocks.canAccessAdmin).not.toHaveBeenCalled();
176
+ expect(mocks.renderField).not.toHaveBeenCalled();
177
+ });
178
+ });
179
+ //# sourceMappingURL=renderFieldServerFn.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderFieldServerFn.spec.js","names":["beforeEach","describe","expect","it","vi","_internal_renderFieldHandler","mocks","hoisted","canAccessAdmin","fn","getClientConfig","getClientSchemaMap","getSchemaMap","renderField","mock","UnauthorizedError","Error","args","req","user","collection","payload","config","importMap","schemaPath","resetAllMocks","targetField","name","type","admin","hidden","mockReturnValue","Map","label","initialValue","toHaveBeenCalledWith","objectContaining","fieldConfig","data","editor","path","forceCreateClientField","toEqual","components","Field","serverProps","heading","request","field","content","mockRejectedValue","rejects","toThrow","not","toHaveBeenCalled"],"sources":["../../../../src/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.ts"],"sourcesContent":["import { beforeEach, describe, expect, it, vi } from 'vitest'\n\nimport { _internal_renderFieldHandler } from './renderFieldServerFn.js'\n\nconst mocks = vi.hoisted(() => ({\n canAccessAdmin: vi.fn(),\n getClientConfig: vi.fn(),\n getClientSchemaMap: vi.fn(),\n getSchemaMap: vi.fn(),\n renderField: vi.fn(),\n}))\n\nvi.mock('payload', () => ({\n canAccessAdmin: mocks.canAccessAdmin,\n UnauthorizedError: class extends Error {},\n}))\nvi.mock('../../../utilities/getClientConfig.js', () => ({\n getClientConfig: mocks.getClientConfig,\n}))\nvi.mock('../../../utilities/getClientSchemaMap.js', () => ({\n getClientSchemaMap: mocks.getClientSchemaMap,\n}))\nvi.mock('../../../utilities/getSchemaMap.js', () => ({ getSchemaMap: mocks.getSchemaMap }))\nvi.mock('../renderField.js', () => ({ renderField: mocks.renderField }))\n\ntype HandlerArgs = Parameters<typeof _internal_renderFieldHandler>[0]\n\nconst args = {\n req: { user: { collection: 'users' }, payload: { config: {}, importMap: {} } },\n schemaPath: 'collection.posts.content',\n} as HandlerArgs\n\ndescribe('renderFieldServerFn', () => {\n beforeEach(() => {\n vi.resetAllMocks()\n })\n\n it('should accept allowed field props', async () => {\n const targetField = { name: 'content', type: 'richText', admin: { hidden: true } }\n\n mocks.getSchemaMap.mockReturnValue(new Map([['posts.content', targetField]]))\n\n await _internal_renderFieldHandler({\n ...args,\n name: 'editor',\n label: 'Editor',\n hidden: false,\n initialValue: 'Initial text',\n })\n\n expect(mocks.canAccessAdmin).toHaveBeenCalledWith({ req: args.req })\n expect(mocks.renderField).toHaveBeenCalledWith(\n expect.objectContaining({\n fieldConfig: {\n name: 'editor',\n label: 'Editor',\n type: 'richText',\n admin: { hidden: false },\n },\n data: { editor: 'Initial text' },\n path: 'editor',\n schemaPath: 'posts.content',\n forceCreateClientField: true,\n }),\n )\n expect(targetField).toEqual({ name: 'content', type: 'richText', admin: { hidden: true } })\n })\n\n it('should reject disallowed field props', async () => {\n const components = {\n Field: { path: './ConfiguredField', serverProps: { heading: 'Configured heading' } },\n }\n const targetField = { name: 'content', type: 'richText', admin: { components, hidden: true } }\n\n mocks.getSchemaMap.mockReturnValue(new Map([['posts.content', targetField]]))\n\n const request = {\n ...args,\n field: {\n admin: {\n components: {\n Field: {\n path: './OtherField',\n serverProps: { heading: 'Other heading' },\n },\n },\n },\n },\n initialValue: 'Initial text',\n }\n\n await _internal_renderFieldHandler(request)\n\n expect(mocks.canAccessAdmin).toHaveBeenCalledWith({ req: args.req })\n expect(mocks.renderField).toHaveBeenCalledWith(\n expect.objectContaining({\n fieldConfig: {\n ...targetField,\n admin: {\n components: {\n Field: {\n path: './ConfiguredField',\n serverProps: { heading: 'Configured heading' },\n },\n },\n hidden: true,\n },\n },\n data: { content: 'Initial text' },\n path: 'content',\n schemaPath: 'posts.content',\n forceCreateClientField: false,\n }),\n )\n expect(targetField).toEqual({\n name: 'content',\n type: 'richText',\n admin: {\n components: {\n Field: {\n path: './ConfiguredField',\n serverProps: { heading: 'Configured heading' },\n },\n },\n hidden: true,\n },\n })\n })\n\n it('should deny when admin access is denied', async () => {\n mocks.canAccessAdmin.mockRejectedValue(new Error('Admin access denied'))\n\n await expect(_internal_renderFieldHandler(args)).rejects.toThrow('Admin access denied')\n expect(mocks.getSchemaMap).not.toHaveBeenCalled()\n expect(mocks.renderField).not.toHaveBeenCalled()\n })\n\n it('should deny when no user is on the request', async () => {\n await expect(\n _internal_renderFieldHandler({ ...args, req: { ...args.req, user: null } }),\n ).rejects.toThrow()\n expect(mocks.canAccessAdmin).not.toHaveBeenCalled()\n expect(mocks.renderField).not.toHaveBeenCalled()\n })\n})\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ;AAErD,SAASC,4BAA4B,QAAQ;AAE7C,MAAMC,KAAA,GAAQF,EAAA,CAAGG,OAAO,CAAC,OAAO;EAC9BC,cAAA,EAAgBJ,EAAA,CAAGK,EAAE;EACrBC,eAAA,EAAiBN,EAAA,CAAGK,EAAE;EACtBE,kBAAA,EAAoBP,EAAA,CA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AAKC,GAAG;QAAEC,IAAA,EAAM;MAAK;IAAE,IACzEgC,OAAO,CAACC,OAAO;IACjBlD,MAAA,CAAOI,KAAA,CAAME,cAAc,EAAE6C,GAAG,CAACC,gBAAgB;IACjDpD,MAAA,CAAOI,KAAA,CAAMO,WAAW,EAAEwC,GAAG,CAACC,gBAAgB;EAChD;AACF","ignoreList":[]}
@@ -29,6 +29,7 @@ export type RenderFieldArgs = {
29
29
  req: PayloadRequest;
30
30
  schemaPath: string;
31
31
  siblingData: Data;
32
+ user?: PayloadRequest['user'];
32
33
  };
33
34
  export type RenderFieldMethod = (args: RenderFieldArgs) => void;
34
35
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forms/fieldSchemasToFormState/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,IAAI,EACJ,mBAAmB,EACnB,KAAK,EACL,cAAc,EACd,UAAU,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,eAAe,GAAG;IAC5B,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;IAC3C,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,IAAI,CAAA;IACV,WAAW,EAAE,KAAK,CAAA;IAClB,cAAc,EAAE,cAAc,CAAA;IAC9B,UAAU,EAAE,UAAU,CAAA;IACtB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,SAAS,EAAE,SAAS,CAAA;IACpB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,SAAS,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;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;IACtC,WAAW,EAAE,mBAAmB,CAAA;IAChC,kBAAkB,EAAE,UAAU,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,OAAO,CAAA;IACxB,GAAG,EAAE,cAAc,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,IAAI,CAAA;IACjB,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/forms/fieldSchemasToFormState/types.ts"],"sourcesContent":["import type {\n ClientFieldSchemaMap,\n Data,\n DocumentPreferences,\n Field,\n FieldSchemaMap,\n FieldState,\n FormState,\n Operation,\n PayloadRequest,\n SanitizedFieldPermissions,\n} from 'payload'\n\nexport type RenderFieldArgs = {\n clientFieldSchemaMap?: ClientFieldSchemaMap\n collectionSlug: string\n data: Data\n fieldConfig: Field\n fieldSchemaMap: FieldSchemaMap\n fieldState: FieldState\n /**\n * If set to true, it will force creating a clientField based on the passed fieldConfig instead of pulling\n * the client field from the clientFieldSchemaMap. This is useful if the passed fieldConfig differs from the one in the schema map,\n * e.g. when calling the render-field server function and passing a field config override.\n */\n forceCreateClientField?: boolean\n formState: FormState\n id?: number | string\n indexPath: string\n lastRenderedPath: string\n mockRSCs?: boolean\n operation: Operation\n parentPath: string\n parentSchemaPath: string\n path: string\n permissions: SanitizedFieldPermissions\n preferences: DocumentPreferences\n previousFieldState: FieldState\n readOnly?: boolean\n renderAllFields: boolean\n req: PayloadRequest\n schemaPath: string\n siblingData: Data\n}\n\nexport type RenderFieldMethod = (args: RenderFieldArgs) => void\n"],"mappings":"AA6CA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/forms/fieldSchemasToFormState/types.ts"],"sourcesContent":["import type {\n ClientFieldSchemaMap,\n Data,\n DocumentPreferences,\n Field,\n FieldSchemaMap,\n FieldState,\n FormState,\n Operation,\n PayloadRequest,\n SanitizedFieldPermissions,\n} from 'payload'\n\nexport type RenderFieldArgs = {\n clientFieldSchemaMap?: ClientFieldSchemaMap\n collectionSlug: string\n data: Data\n fieldConfig: Field\n fieldSchemaMap: FieldSchemaMap\n fieldState: FieldState\n /**\n * If set to true, it will force creating a clientField based on the passed fieldConfig instead of pulling\n * the client field from the clientFieldSchemaMap. This is useful if the passed fieldConfig differs from the one in the schema map,\n * e.g. when calling the render-field server function and passing a field config override.\n */\n forceCreateClientField?: boolean\n formState: FormState\n id?: number | string\n indexPath: string\n lastRenderedPath: string\n mockRSCs?: boolean\n operation: Operation\n parentPath: string\n parentSchemaPath: string\n path: string\n permissions: SanitizedFieldPermissions\n preferences: DocumentPreferences\n previousFieldState: FieldState\n readOnly?: boolean\n renderAllFields: boolean\n req: PayloadRequest\n schemaPath: string\n siblingData: Data\n user?: PayloadRequest['user']\n}\n\nexport type RenderFieldMethod = (args: RenderFieldArgs) => void\n"],"mappings":"AA8CA","ignoreList":[]}
@@ -10,7 +10,7 @@
10
10
  .stroke {
11
11
  fill: none;
12
12
  stroke: currentColor;
13
- stroke-width: 0.75;
13
+ stroke-width: $style-stroke-width-s;
14
14
  }
15
15
 
16
16
  .fill {
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import './index.scss';
3
+ export declare const RefreshIcon: React.FC<{
4
+ readonly className?: string;
5
+ readonly size?: 16 | 24;
6
+ }>;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/Refresh/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAYrB,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAA;CACxB,CAmBA,CAAA"}
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import './index.scss';
4
+ const paths = {
5
+ 16: {
6
+ fill: 'M8 3.5a4.5 4.5 0 0 0-4.473 4c-.03.275-.25.5-.527.5a.467.467 0 0 1-.478-.5 5.5 5.5 0 0 1 9.758-2.954.467.467 0 0 1-.12.68c-.23.154-.538.09-.715-.122A4.49 4.49 0 0 0 8 3.5m-4.16 7.274a.467.467 0 0 0-.12.68A5.5 5.5 0 0 0 13.478 8.5.467.467 0 0 0 13 8c-.276 0-.497.225-.527.5a4.5 4.5 0 0 1-7.918 2.396c-.177-.212-.486-.276-.715-.123',
7
+ stroke: 'M12.5 3v2.5H10m-4 5H3.5V13'
8
+ },
9
+ 24: {
10
+ fill: 'M17.523 12.036a.5.5 0 0 1 .449.546A5.999 5.999 0 0 1 7 15.315V17.5a.5.5 0 0 1-1 0v-3a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1H8.002q.066.089.137.175a5 5 0 0 0 8.838-2.69.5.5 0 0 1 .546-.45M17.5 6a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1 0-1h1.498a5 5 0 0 0-8.975 2.515.5.5 0 1 1-.995-.097A6 6 0 0 1 17 8.684V6.5a.5.5 0 0 1 .5-.5'
11
+ }
12
+ };
13
+ export const RefreshIcon = ({
14
+ className,
15
+ size = 16
16
+ }) => /*#__PURE__*/_jsxs("svg", {
17
+ className: ['icon', 'icon--refresh', className].filter(Boolean).join(' '),
18
+ fill: "none",
19
+ height: size,
20
+ viewBox: `0 0 ${size} ${size}`,
21
+ width: size,
22
+ xmlns: "http://www.w3.org/2000/svg",
23
+ children: [size === 16 && paths[16].stroke && /*#__PURE__*/_jsx("path", {
24
+ d: paths[16].stroke,
25
+ stroke: "currentColor",
26
+ strokeLinecap: "round",
27
+ strokeLinejoin: "round"
28
+ }), /*#__PURE__*/_jsx("path", {
29
+ clipRule: "evenodd",
30
+ d: paths[size].fill,
31
+ fill: "currentColor",
32
+ fillRule: "evenodd"
33
+ })]
34
+ });
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["React","paths","fill","stroke","RefreshIcon","className","size","_jsxs","filter","Boolean","join","height","viewBox","width","xmlns","_jsx","d","strokeLinecap","strokeLinejoin","clipRule","fillRule"],"sources":["../../../src/icons/Refresh/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst paths = {\n 16: {\n fill: 'M8 3.5a4.5 4.5 0 0 0-4.473 4c-.03.275-.25.5-.527.5a.467.467 0 0 1-.478-.5 5.5 5.5 0 0 1 9.758-2.954.467.467 0 0 1-.12.68c-.23.154-.538.09-.715-.122A4.49 4.49 0 0 0 8 3.5m-4.16 7.274a.467.467 0 0 0-.12.68A5.5 5.5 0 0 0 13.478 8.5.467.467 0 0 0 13 8c-.276 0-.497.225-.527.5a4.5 4.5 0 0 1-7.918 2.396c-.177-.212-.486-.276-.715-.123',\n stroke: 'M12.5 3v2.5H10m-4 5H3.5V13',\n },\n 24: {\n fill: 'M17.523 12.036a.5.5 0 0 1 .449.546A5.999 5.999 0 0 1 7 15.315V17.5a.5.5 0 0 1-1 0v-3a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1H8.002q.066.089.137.175a5 5 0 0 0 8.838-2.69.5.5 0 0 1 .546-.45M17.5 6a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1 0-1h1.498a5 5 0 0 0-8.975 2.515.5.5 0 1 1-.995-.097A6 6 0 0 1 17 8.684V6.5a.5.5 0 0 1 .5-.5',\n },\n}\n\nexport const RefreshIcon: React.FC<{\n readonly className?: string\n readonly size?: 16 | 24\n}> = ({ className, size = 16 }) => (\n <svg\n className={['icon', 'icon--refresh', className].filter(Boolean).join(' ')}\n fill=\"none\"\n height={size}\n viewBox={`0 0 ${size} ${size}`}\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {size === 16 && paths[16].stroke && (\n <path\n d={paths[16].stroke}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n )}\n <path clipRule=\"evenodd\" d={paths[size].fill} fill=\"currentColor\" fillRule=\"evenodd\" />\n </svg>\n)\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AAElB,OAAO;AAEP,MAAMC,KAAA,GAAQ;EACZ,IAAI;IACFC,IAAA,EAAM;IACNC,MAAA,EAAQ;EACV;EACA,IAAI;IACFD,IAAA,EAAM;EACR;AACF;AAEA,OAAO,MAAME,WAAA,GAGRA,CAAC;EAAEC,SAAS;EAAEC,IAAA,GAAO;AAAE,CAAE,kBAC5BC,KAAA,CAAC;EACCF,SAAA,EAAW,CAAC,QAAQ,iBAAiBA,SAAA,CAAU,CAACG,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;EACrER,IAAA,EAAK;EACLS,MAAA,EAAQL,IAAA;EACRM,OAAA,EAAS,OAAON,IAAA,IAAQA,IAAA,EAAM;EAC9BO,KAAA,EAAOP,IAAA;EACPQ,KAAA,EAAM;aAELR,IAAA,KAAS,MAAML,KAAK,CAAC,GAAG,CAACE,MAAM,iBAC9BY,IAAA,CAAC;IACCC,CAAA,EAAGf,KAAK,CAAC,GAAG,CAACE,MAAM;IACnBA,MAAA,EAAO;IACPc,aAAA,EAAc;IACdC,cAAA,EAAe;mBAGnBH,IAAA,CAAC;IAAKI,QAAA,EAAS;IAAUH,CAAA,EAAGf,KAAK,CAACK,IAAA,CAAK,CAACJ,IAAI;IAAEA,IAAA,EAAK;IAAekB,QAAA,EAAS","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ @layer payload-default {
2
+ .icon--refresh {
3
+ .stroke {
4
+ stroke: currentColor;
5
+ }
6
+
7
+ .fill {
8
+ fill: currentColor;
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import './index.scss';
3
+ export type SpinnerIconProps = {
4
+ readonly className?: string;
5
+ readonly size?: 'lg' | 'md' | 'sm';
6
+ };
7
+ export declare const SpinnerIcon: React.FC<SpinnerIconProps>;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/Spinner/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAUrB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CACnC,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAelD,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import './index.scss';
4
+ const paths = {
5
+ lg: 'M16.445 5.348A8 8 0 0 0 12.5 4.016.525.525 0 0 1 12 3.5a.48.48 0 0 1 .5-.486A9 9 0 1 1 3.014 12.5.48.48 0 0 1 3.5 12c.276 0 .498.224.516.5a8 8 0 1 0 12.429-7.152',
6
+ md: 'M15.333 7.011a6 6 0 0 0-2.834-.99A.534.534 0 0 1 12 5.5c0-.276.224-.502.5-.482A7 7 0 1 1 5.018 12.5.473.473 0 0 1 5.5 12c.276 0 .498.224.52.5a6 6 0 1 0 9.313-5.489',
7
+ sm: 'M10.778 3.842a5 5 0 0 0-2.279-.817A.54.54 0 0 1 8 2.5a.47.47 0 0 1 .5-.48A6 6 0 1 1 2.02 8.5.47.47 0 0 1 2.5 8c.276 0 .497.224.525.499a5 5 0 1 0 7.753-4.657'
8
+ };
9
+ const sizes = {
10
+ lg: 24,
11
+ md: 24,
12
+ sm: 16
13
+ };
14
+ export const SpinnerIcon = ({
15
+ className,
16
+ size = 'sm'
17
+ }) => {
18
+ const dimension = sizes[size];
19
+ return /*#__PURE__*/_jsx("svg", {
20
+ className: ['icon icon--spinner', className].filter(Boolean).join(' '),
21
+ fill: "none",
22
+ height: dimension,
23
+ viewBox: `0 0 ${dimension} ${dimension}`,
24
+ width: dimension,
25
+ xmlns: "http://www.w3.org/2000/svg",
26
+ children: /*#__PURE__*/_jsx("path", {
27
+ clipRule: "evenodd",
28
+ d: paths[size],
29
+ fill: "currentColor",
30
+ fillRule: "evenodd"
31
+ })
32
+ });
33
+ };
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["React","paths","lg","md","sm","sizes","SpinnerIcon","className","size","dimension","_jsx","filter","Boolean","join","fill","height","viewBox","width","xmlns","clipRule","d","fillRule"],"sources":["../../../src/icons/Spinner/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst paths = {\n lg: 'M16.445 5.348A8 8 0 0 0 12.5 4.016.525.525 0 0 1 12 3.5a.48.48 0 0 1 .5-.486A9 9 0 1 1 3.014 12.5.48.48 0 0 1 3.5 12c.276 0 .498.224.516.5a8 8 0 1 0 12.429-7.152',\n md: 'M15.333 7.011a6 6 0 0 0-2.834-.99A.534.534 0 0 1 12 5.5c0-.276.224-.502.5-.482A7 7 0 1 1 5.018 12.5.473.473 0 0 1 5.5 12c.276 0 .498.224.52.5a6 6 0 1 0 9.313-5.489',\n sm: 'M10.778 3.842a5 5 0 0 0-2.279-.817A.54.54 0 0 1 8 2.5a.47.47 0 0 1 .5-.48A6 6 0 1 1 2.02 8.5.47.47 0 0 1 2.5 8c.276 0 .497.224.525.499a5 5 0 1 0 7.753-4.657',\n}\n\nconst sizes = { lg: 24, md: 24, sm: 16 }\n\nexport type SpinnerIconProps = {\n readonly className?: string\n readonly size?: 'lg' | 'md' | 'sm'\n}\n\nexport const SpinnerIcon: React.FC<SpinnerIconProps> = ({ className, size = 'sm' }) => {\n const dimension = sizes[size]\n\n return (\n <svg\n className={['icon icon--spinner', className].filter(Boolean).join(' ')}\n fill=\"none\"\n height={dimension}\n viewBox={`0 0 ${dimension} ${dimension}`}\n width={dimension}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path clipRule=\"evenodd\" d={paths[size]} fill=\"currentColor\" fillRule=\"evenodd\" />\n </svg>\n )\n}\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AAElB,OAAO;AAEP,MAAMC,KAAA,GAAQ;EACZC,EAAA,EAAI;EACJC,EAAA,EAAI;EACJC,EAAA,EAAI;AACN;AAEA,MAAMC,KAAA,GAAQ;EAAEH,EAAA,EAAI;EAAIC,EAAA,EAAI;EAAIC,EAAA,EAAI;AAAG;AAOvC,OAAO,MAAME,WAAA,GAA0CA,CAAC;EAAEC,SAAS;EAAEC,IAAA,GAAO;AAAI,CAAE;EAChF,MAAMC,SAAA,GAAYJ,KAAK,CAACG,IAAA,CAAK;EAE7B,oBACEE,IAAA,CAAC;IACCH,SAAA,EAAW,CAAC,sBAAsBA,SAAA,CAAU,CAACI,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;IAClEC,IAAA,EAAK;IACLC,MAAA,EAAQN,SAAA;IACRO,OAAA,EAAS,OAAOP,SAAA,IAAaA,SAAA,EAAW;IACxCQ,KAAA,EAAOR,SAAA;IACPS,KAAA,EAAM;cAEN,aAAAR,IAAA,CAAC;MAAKS,QAAA,EAAS;MAAUC,CAAA,EAAGnB,KAAK,CAACO,IAAA,CAAK;MAAEM,IAAA,EAAK;MAAeO,QAAA,EAAS;;;AAG5E","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ @layer payload-default {
2
+ .icon--spinner {
3
+ color: currentColor;
4
+ animation: spinner-spin 1s linear infinite;
5
+ }
6
+
7
+ @keyframes spinner-spin {
8
+ to {
9
+ transform: rotate(360deg);
10
+ }
11
+ }
12
+ }