| 21 | * @public |
| 22 | */ |
| 23 | export function createClasses( |
| 24 | propertyKey: string, |
| 25 | node: FormKitNode, |
| 26 | sectionClassList?: FormKitClasses | string | Record<string, boolean> |
| 27 | ): Record<string, boolean> { |
| 28 | if (!sectionClassList) return {} |
| 29 | if (typeof sectionClassList === 'string') { |
| 30 | const classKeys = sectionClassList.split(' ') |
| 31 | return classKeys.reduce( |
| 32 | (obj, key) => Object.assign(obj, { [key]: true }), |
| 33 | {} |
| 34 | ) |
| 35 | } else if (typeof sectionClassList === 'function') { |
| 36 | return createClasses( |
| 37 | propertyKey, |
| 38 | node, |
| 39 | sectionClassList(node, propertyKey) |
| 40 | ) |
| 41 | } |
| 42 | return sectionClassList |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Combines multiple class lists into a single list. |