@aglyn/shared-ui-jsx-forms 1.0.0-beta.143

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 (150) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +7 -0
  3. package/package.json +52 -0
  4. package/src/index.d.ts +17 -0
  5. package/src/index.js +18 -0
  6. package/src/index.js.map +1 -0
  7. package/src/lib/components/color-picker-tokens.d.ts +135 -0
  8. package/src/lib/components/color-picker-tokens.js +431 -0
  9. package/src/lib/components/color-picker-tokens.js.map +1 -0
  10. package/src/lib/components/color-picker.component.d.ts +64 -0
  11. package/src/lib/components/color-picker.component.js +322 -0
  12. package/src/lib/components/color-picker.component.js.map +1 -0
  13. package/src/lib/components/create-artifact-drawer.component.d.ts +100 -0
  14. package/src/lib/components/create-artifact-drawer.component.js +184 -0
  15. package/src/lib/components/create-artifact-drawer.component.js.map +1 -0
  16. package/src/lib/components/grid-form-template.component.d.ts +21 -0
  17. package/src/lib/components/grid-form-template.component.js +81 -0
  18. package/src/lib/components/grid-form-template.component.js.map +1 -0
  19. package/src/lib/components/icon-select.component.d.ts +52 -0
  20. package/src/lib/components/icon-select.component.js +453 -0
  21. package/src/lib/components/icon-select.component.js.map +1 -0
  22. package/src/lib/components/select.component.d.ts +58 -0
  23. package/src/lib/components/select.component.js +107 -0
  24. package/src/lib/components/select.component.js.map +1 -0
  25. package/src/lib/components/switch.component.d.ts +38 -0
  26. package/src/lib/components/switch.component.js +76 -0
  27. package/src/lib/components/switch.component.js.map +1 -0
  28. package/src/lib/components/text-field.component.d.ts +45 -0
  29. package/src/lib/components/text-field.component.js +77 -0
  30. package/src/lib/components/text-field.component.js.map +1 -0
  31. package/src/lib/components/textarea.component.d.ts +45 -0
  32. package/src/lib/components/textarea.component.js +61 -0
  33. package/src/lib/components/textarea.component.js.map +1 -0
  34. package/src/lib/components/toggle-button.component.d.ts +27 -0
  35. package/src/lib/components/toggle-button.component.js +116 -0
  36. package/src/lib/components/toggle-button.component.js.map +1 -0
  37. package/src/lib/constants/component-mappers.d.ts +42 -0
  38. package/src/lib/constants/component-mappers.js +70 -0
  39. package/src/lib/constants/component-mappers.js.map +1 -0
  40. package/src/lib/constants/dynamic-fields.d.ts +45 -0
  41. package/src/lib/constants/dynamic-fields.js +65 -0
  42. package/src/lib/constants/dynamic-fields.js.map +1 -0
  43. package/src/lib/constants/field-configurations.d.ts +53 -0
  44. package/src/lib/constants/field-configurations.js +121 -0
  45. package/src/lib/constants/field-configurations.js.map +1 -0
  46. package/src/lib/constants/flags.d.ts +72 -0
  47. package/src/lib/constants/flags.js +69 -0
  48. package/src/lib/constants/flags.js.map +1 -0
  49. package/src/lib/hocs/with-grid-item.d.ts +25 -0
  50. package/src/lib/hocs/with-grid-item.js +48 -0
  51. package/src/lib/hocs/with-grid-item.js.map +1 -0
  52. package/src/lib/jsx-forms.d.ts +41 -0
  53. package/src/lib/jsx-forms.js +42 -0
  54. package/src/lib/jsx-forms.js.map +1 -0
  55. package/src/lib/mapper/breakpoint-span.d.ts +73 -0
  56. package/src/lib/mapper/breakpoint-span.js +346 -0
  57. package/src/lib/mapper/breakpoint-span.js.map +1 -0
  58. package/src/lib/mapper/checkbox.d.ts +43 -0
  59. package/src/lib/mapper/checkbox.js +111 -0
  60. package/src/lib/mapper/checkbox.js.map +1 -0
  61. package/src/lib/mapper/css-border.d.ts +113 -0
  62. package/src/lib/mapper/css-border.js +410 -0
  63. package/src/lib/mapper/css-border.js.map +1 -0
  64. package/src/lib/mapper/css-dimension.d.ts +89 -0
  65. package/src/lib/mapper/css-dimension.js +327 -0
  66. package/src/lib/mapper/css-dimension.js.map +1 -0
  67. package/src/lib/mapper/css-gradient.d.ts +110 -0
  68. package/src/lib/mapper/css-gradient.js +720 -0
  69. package/src/lib/mapper/css-gradient.js.map +1 -0
  70. package/src/lib/mapper/data-table.d.ts +23 -0
  71. package/src/lib/mapper/data-table.js +296 -0
  72. package/src/lib/mapper/data-table.js.map +1 -0
  73. package/src/lib/mapper/date-picker.d.ts +26 -0
  74. package/src/lib/mapper/date-picker.js +69 -0
  75. package/src/lib/mapper/date-picker.js.map +1 -0
  76. package/src/lib/mapper/dual-list-select.d.ts +115 -0
  77. package/src/lib/mapper/dual-list-select.js +353 -0
  78. package/src/lib/mapper/dual-list-select.js.map +1 -0
  79. package/src/lib/mapper/field-array.d.ts +71 -0
  80. package/src/lib/mapper/field-array.js +326 -0
  81. package/src/lib/mapper/field-array.js.map +1 -0
  82. package/src/lib/mapper/form-field-grid.d.ts +155 -0
  83. package/src/lib/mapper/form-field-grid.js +194 -0
  84. package/src/lib/mapper/form-field-grid.js.map +1 -0
  85. package/src/lib/mapper/index.d.ts +50 -0
  86. package/src/lib/mapper/index.js +49 -0
  87. package/src/lib/mapper/index.js.map +1 -0
  88. package/src/lib/mapper/multiple-choice-list.d.ts +32 -0
  89. package/src/lib/mapper/multiple-choice-list.js +105 -0
  90. package/src/lib/mapper/multiple-choice-list.js.map +1 -0
  91. package/src/lib/mapper/plain-text.d.ts +31 -0
  92. package/src/lib/mapper/plain-text.js +48 -0
  93. package/src/lib/mapper/plain-text.js.map +1 -0
  94. package/src/lib/mapper/preset-choice.d.ts +106 -0
  95. package/src/lib/mapper/preset-choice.js +267 -0
  96. package/src/lib/mapper/preset-choice.js.map +1 -0
  97. package/src/lib/mapper/radio.d.ts +40 -0
  98. package/src/lib/mapper/radio.js +122 -0
  99. package/src/lib/mapper/radio.js.map +1 -0
  100. package/src/lib/mapper/select.d.ts +60 -0
  101. package/src/lib/mapper/select.js +203 -0
  102. package/src/lib/mapper/select.js.map +1 -0
  103. package/src/lib/mapper/slider.d.ts +45 -0
  104. package/src/lib/mapper/slider.js +119 -0
  105. package/src/lib/mapper/slider.js.map +1 -0
  106. package/src/lib/mapper/stored-field-value.d.ts +23 -0
  107. package/src/lib/mapper/stored-field-value.js +29 -0
  108. package/src/lib/mapper/stored-field-value.js.map +1 -0
  109. package/src/lib/mapper/sub-form.d.ts +39 -0
  110. package/src/lib/mapper/sub-form.js +108 -0
  111. package/src/lib/mapper/sub-form.js.map +1 -0
  112. package/src/lib/mapper/switch.d.ts +47 -0
  113. package/src/lib/mapper/switch.js +93 -0
  114. package/src/lib/mapper/switch.js.map +1 -0
  115. package/src/lib/mapper/tabs.d.ts +34 -0
  116. package/src/lib/mapper/tabs.js +64 -0
  117. package/src/lib/mapper/tabs.js.map +1 -0
  118. package/src/lib/mapper/text-field.d.ts +33 -0
  119. package/src/lib/mapper/text-field.js +88 -0
  120. package/src/lib/mapper/text-field.js.map +1 -0
  121. package/src/lib/mapper/textarea.d.ts +31 -0
  122. package/src/lib/mapper/textarea.js +68 -0
  123. package/src/lib/mapper/textarea.js.map +1 -0
  124. package/src/lib/mapper/theme-scale.d.ts +79 -0
  125. package/src/lib/mapper/theme-scale.js +162 -0
  126. package/src/lib/mapper/theme-scale.js.map +1 -0
  127. package/src/lib/mapper/time-picker.d.ts +26 -0
  128. package/src/lib/mapper/time-picker.js +69 -0
  129. package/src/lib/mapper/time-picker.js.map +1 -0
  130. package/src/lib/mapper/types.d.ts +43 -0
  131. package/src/lib/mapper/types.js +22 -0
  132. package/src/lib/mapper/types.js.map +1 -0
  133. package/src/lib/mapper/validation-error.d.ts +24 -0
  134. package/src/lib/mapper/validation-error.js +24 -0
  135. package/src/lib/mapper/validation-error.js.map +1 -0
  136. package/src/lib/mapper/wizard.d.ts +21 -0
  137. package/src/lib/mapper/wizard.js +203 -0
  138. package/src/lib/mapper/wizard.js.map +1 -0
  139. package/src/lib/types.d.ts +19 -0
  140. package/src/lib/types.js +18 -0
  141. package/src/lib/types.js.map +1 -0
  142. package/src/lib/utils/option-is-equal-to-value.d.ts +20 -0
  143. package/src/lib/utils/option-is-equal-to-value.js +21 -0
  144. package/src/lib/utils/option-is-equal-to-value.js.map +1 -0
  145. package/src/lib/utils/validation-message.d.ts +22 -0
  146. package/src/lib/utils/validation-message.js +24 -0
  147. package/src/lib/utils/validation-message.js.map +1 -0
  148. package/src/lib/vendor/data-driven-forms.d.ts +33 -0
  149. package/src/lib/vendor/data-driven-forms.js +29 -0
  150. package/src/lib/vendor/data-driven-forms.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/components/icon-select.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n DEFAULT_ICON,\n type Icon,\n mdiCheck,\n mdiChevronDown,\n mdiChevronUp,\n} from '@aglyn/shared-data-mdi'\nimport { CardListItem, MdiIcon } from '@aglyn/shared-ui-jsx'\nimport { useMdiIconsFuzzy } from '@aglyn/shared-ui-jsx/hooks/mdi-icon/use-mdi-icons-fuzzy'\nimport { GridList } from '@aglyn/shared-ui-jsx/components/grid-list'\nimport { generateComponentClassKeys, styled } from '@aglyn/shared-ui-theme'\nimport { useDebouncedCallback } from '@aglyn/shared-util-vendor/use-debounce'\nimport {\n Box,\n Button,\n ButtonBase,\n Collapse,\n Grid,\n Link as MuiLink,\n TextField as MuiTextField,\n Tooltip,\n Typography,\n} from '@mui/material'\n\nimport {\n forwardRef,\n type HTMLAttributes,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react'\nimport FormFieldGrid, { buildFieldClear } from '../mapper/form-field-grid'\nimport { validationMessage } from '../utils/validation-message'\n\nimport {\n useFieldApi,\n type UseFieldApiConfig,\n} from '../vendor/data-driven-forms'\n\nconst iconUnset = { ...DEFAULT_ICON, id: null, name: '(none)' }\nconst classKeys = generateComponentClassKeys('AglynIconSelect', [\n 'root',\n 'button',\n 'icon',\n 'label',\n 'selected',\n 'opener',\n 'preview',\n 'collapse',\n 'collapseInner',\n 'gridListWrapper',\n 'gridList',\n])\n\nconst StyledCollapse = styled(Collapse, {\n name: 'AglynIconSelectCollapse',\n})(({ theme }) => ({\n '& .MuiCollapse-wrapper': {\n height: 412,\n },\n '& .MuiCollapse-wrapperInner': {\n paddingTop: theme.spacing(1),\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 0,\n alignSelf: 'stretch',\n },\n}))\n\nconst GridListWrapper = styled('div', {\n name: 'AglynIconSelectListWrapper',\n})(({ theme }) => {\n const tv = (theme as any).vars || theme\n return {\n height: '100%',\n marginTop: theme.spacing(1),\n border: `1px solid ${tv.palette.divider}`,\n borderRadius: theme.shape.borderRadius,\n [`& .${classKeys.gridList}`]: {\n padding: theme.spacing(1),\n },\n }\n})\n\nexport interface IconSelectProps extends HTMLAttributes<HTMLDivElement> {\n initialValue?: string\n classes?: Partial<typeof classKeys>\n}\n\nexport interface IconSelectControlProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** Picked icon id, or empty for \"nothing chosen yet\". */\n value?: string\n onChange?: (iconId: string) => void\n label?: JSX.Node\n helperText?: JSX.Node\n GridListProps?: Record<string, unknown>\n classes?: Partial<typeof classKeys>\n}\n\n/**\n * The picker itself, with no form library attached (AGL-1193).\n *\n * Extracted so surfaces outside the designer can offer the SAME picker\n * rather than growing a second one: the console sets a reusable\n * component's icon from a plain dialog and a plain detail form, neither of\n * which runs inside a data-driven-forms tree. The field below is now a\n * thin adapter over this, so the two can't drift.\n */\nexport const IconSelectControl = forwardRef<any, IconSelectControlProps>(\n (props, ref) => {\n const {\n value: currentValue = '',\n onChange,\n label,\n helperText: helperContent,\n GridListProps,\n ...rest\n } = props\n const [open, setOpen] = useState(false)\n const [icons, allIcons, applyFilter, clearFilter] = useMdiIconsFuzzy()\n /**\n * The DRAFT pick (AGL-2486). Picking is two steps: clicking an icon only\n * moves this, and `Choose` is the one thing that reaches `onChange` and\n * therefore the canvas.\n */\n const [selected, setSelected] = useState(currentValue)\n /**\n * Re-seeded from the live value whenever the panel opens or the value\n * changes underneath. Without this an abandoned pick survived the panel\n * being closed, so the NEXT `Choose` applied an icon the author had\n * already walked away from.\n */\n useEffect(() => {\n setSelected(currentValue)\n }, [currentValue, open])\n\n // Rendering all ~6,600 icons at once froze the panel (AGL-340): cap the\n // grid and let search narrow the rest.\n const MAX_RENDERED_ICONS = 240\n const visibleIcons = useMemo(\n () =>\n icons.length > MAX_RENDERED_ICONS\n ? icons.slice(0, MAX_RENDERED_ICONS)\n : icons,\n [icons],\n )\n\n const [currentIcon, selectedIcon] = useMemo(() => {\n const findIcon = (id: string) => allIcons.find((icon) => icon.id === id)\n const currentIcon = (currentValue && findIcon(currentValue)) || iconUnset\n const selectedIcon = (selected && findIcon(selected)) || iconUnset\n return [currentIcon, selectedIcon]\n }, [currentValue, selected, allIcons])\n\n const handleButtonClick = useCallback(() => {\n setOpen((prev) => !prev)\n }, [setOpen])\n /** Nothing to confirm until the draft differs from what is applied. */\n const hasPendingPick = selected !== currentValue\n const handleCancelButtonClick = useCallback(() => {\n // Closing re-seeds the draft (the effect above), so this only has to\n // close — but it says so explicitly, because \"cancel leaves the canvas\n // alone\" is the guarantee, not an emergent property of an effect.\n setSelected(currentValue)\n setOpen(false)\n }, [currentValue])\n const handleChooseButtonClick = useCallback(() => {\n if (selected === currentValue) return\n onChange?.(selected)\n setOpen(false)\n }, [onChange, selected, currentValue])\n const updateFilter = useDebouncedCallback((value?: string) => {\n if (value) {\n applyFilter(value)\n } else {\n clearFilter()\n }\n }, 300)\n const handleFilterChange = useCallback(\n (e) => {\n const target = e.currentTarget\n if (target && target.value) {\n updateFilter(target.value)\n } else {\n updateFilter()\n }\n },\n [updateFilter],\n )\n const handleItemClick = useCallback(\n (e, item: Icon) => {\n setSelected(item.id)\n },\n [setSelected],\n )\n\n const renderItemContent = useCallback(\n function RenderItemContent(item: Icon, key: number) {\n const isSelected = Boolean(selected) && selected === item.id\n return (\n <Tooltip\n key={item.id ?? key}\n title={item.name}\n disableInteractive\n enterDelay={375}\n enterNextDelay={745}\n >\n <CardListItem\n item={item}\n selected={isSelected}\n // A real toggle, so the pick is announced and not only\n // painted (AGL-2486).\n role=\"button\"\n aria-pressed={isSelected}\n onClick={(e) => handleItemClick(e, item)}\n >\n <div>\n <MdiIcon fontSize=\"medium\" path={item.path} />\n </div>\n {isSelected ? (\n // Belt and braces on the fill: a tick reads as \"picked\"\n // even where the tint is subtle, and gives the state\n // something to assert against.\n <Box\n data-aglyn-icon-selected=\"\"\n sx={{\n position: 'absolute',\n top: 2,\n right: 2,\n lineHeight: 0,\n fontSize: 14,\n borderRadius: '50%',\n bgcolor: 'primary.contrastText',\n color: 'primary.main',\n }}\n >\n <MdiIcon fontSize=\"inherit\" path={mdiCheck.path} />\n </Box>\n ) : null}\n </CardListItem>\n </Tooltip>\n )\n },\n [selected, handleItemClick],\n )\n\n return (\n <Grid ref={ref} container>\n <Grid spacing={2} container sx={{\n alignItems: 'center'\n }}>\n <Grid>\n <ButtonBase\n onClick={handleButtonClick}\n disableRipple\n sx={(theme) => ({ fontSize: theme.typography.pxToRem(38) })}\n title={currentIcon.name || 'Choose icon'}\n >\n <MdiIcon fontSize=\"inherit\" path={currentIcon.path} />\n </ButtonBase>\n </Grid>\n <Grid\n size={{\n sm: \"grow\"\n }}>\n <Typography component=\"div\" variant=\"caption\">\n {label}\n </Typography>\n <MuiLink\n onClick={handleButtonClick}\n variant=\"button\"\n component=\"button\"\n color=\"primary\"\n sx={{\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'flex-start',\n }}\n >\n <span>\n <MdiIcon\n fontSize=\"inherit\"\n path={open ? mdiChevronUp.path : mdiChevronDown.path}\n />\n </span>\n <span>{currentIcon.name}</span>\n </MuiLink>\n </Grid>\n </Grid>\n <Grid size={12}>\n <StyledCollapse in={open}>\n <Grid spacing={2} container sx={{\n alignItems: \"center\"\n }}>\n <Grid size={12}>\n <MuiTextField\n onChange={handleFilterChange}\n placeholder=\"Search icons...\"\n size=\"small\"\n helperText={helperContent}\n fullWidth\n />\n </Grid>\n <Grid size=\"grow\">\n <Typography component=\"div\" variant=\"body2\">\n Selected icon: <b>{selectedIcon.name}</b>\n </Typography>\n <Typography\n component=\"div\"\n variant=\"caption\"\n color=\"text.secondary\"\n >\n {hasPendingPick\n ? `Not applied yet — press Choose to replace ${currentIcon.name}.`\n : 'Pick an icon, then press Choose to apply it.'}\n </Typography>\n </Grid>\n <Grid>\n <Button color=\"inherit\" onClick={handleCancelButtonClick}>\n Cancel\n </Button>\n </Grid>\n <Grid>\n <Button\n color=\"primary\"\n disabled={!hasPendingPick}\n onClick={handleChooseButtonClick}\n variant=\"contained\"\n >\n Choose\n </Button>\n </Grid>\n </Grid>\n\n <GridListWrapper>\n <GridList\n GridContainerProps={{ spacing: 1 }}\n GridItemProps={{ size: { xs: 2 } }}\n ListWrapperProps={{ className: classKeys.gridList }}\n items={visibleIcons}\n renderItemContent={renderItemContent}\n {...GridListProps}\n />\n {icons.length > visibleIcons.length ? (\n <Typography\n variant=\"caption\"\n color=\"text.secondary\"\n sx={{ display: 'block', px: 1, pb: 1 }}\n >\n {`Showing ${visibleIcons.length} of ${icons.length} icons — search to narrow down.`}\n </Typography>\n ) : null}\n {allIcons.length === 0 ? (\n <Typography\n variant=\"caption\"\n color=\"text.secondary\"\n sx={{ display: 'block', px: 1, pb: 1 }}\n >\n {'Loading icon catalog…'}\n </Typography>\n ) : null}\n </GridListWrapper>\n </StyledCollapse>\n </Grid>\n </Grid>\n )\n },\n)\nIconSelectControl.displayName = 'IconSelectControl'\n\n/**\n * The data-driven-forms field: everything form-shaped (validation message,\n * helper/description precedence, the final-form input) resolved here, and\n * the picking itself delegated to {@link IconSelectControl}.\n *\n * Sits in the same {@link FormFieldGrid} every other field does, so the corner\n * controls a schema asks for — the help tip, the opt-in clear, a caller's own\n * — are where they are on every other field rather than silently dropped.\n */\nconst IconSelectComponent = forwardRef<any, IconSelectProps>((props, ref) => {\n const {\n input,\n isReadOnly,\n isDisabled,\n placeholder,\n isRequired,\n label,\n helperText,\n description,\n validateOnMount,\n meta,\n inputProps,\n GridListProps,\n help,\n clearable,\n FormFieldGridProps = {},\n ...rest\n } = useFieldApi(props as UseFieldApiConfig)\n\n const invalidMessage = validationMessage(meta, validateOnMount)\n const helperContent = [\n invalidMessage,\n (meta.touched || validateOnMount) && meta.warning,\n helperText,\n description,\n ].find((i) => Boolean(i))\n\n // The picker can only ever choose an icon, so without this nothing takes\n // one back off again.\n const clear = buildFieldClear({\n clearable,\n label,\n hasValue: Boolean(input.value),\n locked: Boolean(isDisabled || isReadOnly),\n onClear: () => input.onChange(''),\n })\n\n return (\n <FormFieldGrid help={help} clear={clear} {...FormFieldGridProps}>\n <IconSelectControl\n ref={ref}\n value={input.value}\n onChange={input.onChange}\n label={label}\n helperText={helperContent}\n GridListProps={GridListProps}\n />\n </FormFieldGrid>\n )\n})\n\nIconSelectComponent.displayName = 'IconSelectComponent'\nIconSelectComponent.aglyn = true\n\nexport default IconSelectComponent\n"],"names":["DEFAULT_ICON","mdiCheck","mdiChevronDown","mdiChevronUp","CardListItem","MdiIcon","useMdiIconsFuzzy","GridList","generateComponentClassKeys","styled","useDebouncedCallback","Box","Button","ButtonBase","Collapse","Grid","Link","MuiLink","TextField","MuiTextField","Tooltip","Typography","forwardRef","useCallback","useEffect","useMemo","useState","FormFieldGrid","buildFieldClear","validationMessage","useFieldApi","iconUnset","id","name","classKeys","StyledCollapse","theme","height","paddingTop","spacing","display","flexDirection","flexGrow","flexShrink","alignSelf","GridListWrapper","tv","vars","marginTop","border","palette","divider","borderRadius","shape","gridList","padding","IconSelectControl","props","ref","value","currentValue","onChange","label","helperText","helperContent","GridListProps","rest","open","setOpen","icons","allIcons","applyFilter","clearFilter","selected","setSelected","MAX_RENDERED_ICONS","visibleIcons","length","slice","currentIcon","selectedIcon","findIcon","find","icon","handleButtonClick","prev","hasPendingPick","handleCancelButtonClick","handleChooseButtonClick","updateFilter","handleFilterChange","e","target","currentTarget","handleItemClick","item","renderItemContent","RenderItemContent","key","isSelected","Boolean","title","disableInteractive","enterDelay","enterNextDelay","role","aria-pressed","onClick","div","fontSize","path","data-aglyn-icon-selected","sx","position","top","right","lineHeight","bgcolor","color","container","alignItems","disableRipple","typography","pxToRem","size","sm","component","variant","justifyContent","span","in","placeholder","fullWidth","b","disabled","GridContainerProps","GridItemProps","xs","ListWrapperProps","className","items","px","pb","displayName","IconSelectComponent","input","isReadOnly","isDisabled","isRequired","description","validateOnMount","meta","inputProps","help","clearable","FormFieldGridProps","invalidMessage","touched","warning","i","clear","hasValue","locked","onClear","aglyn"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,YAAY,EAEZC,QAAQ,EACRC,cAAc,EACdC,YAAY,QACP,yBAAwB;AAC/B,SAASC,YAAY,EAAEC,OAAO,QAAQ,uBAAsB;AAC5D,SAASC,gBAAgB,QAAQ,0DAAyD;AAC1F,SAASC,QAAQ,QAAQ,4CAA2C;AACpE,SAASC,0BAA0B,EAAEC,MAAM,QAAQ,yBAAwB;AAC3E,SAASC,oBAAoB,QAAQ,yCAAwC;AAC7E,SACEC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVC,QAAQ,EACRC,IAAI,EACJC,QAAQC,OAAO,EACfC,aAAaC,YAAY,EACzBC,OAAO,EACPC,UAAU,QACL,gBAAe;AAEtB,SACEC,UAAU,EAEVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,QAAO;AACd,OAAOC,iBAAiBC,eAAe,QAAQ,+BAA2B;AAC1E,SAASC,iBAAiB,QAAQ,iCAA6B;AAE/D,SACEC,WAAW,QAEN,iCAA6B;AAEpC,MAAMC,YAAY,aAAK/B;IAAcgC,IAAI;IAAMC,MAAM;;AACrD,MAAMC,YAAY1B,2BAA2B,mBAAmB;IAC9D;IACA;IACA;IACA;IACA;IACA;IACA;IACA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Q9D,QAAQ+C,cAAcD;QAC9BiB,SAAS,IAAMlB,MAAMpF,QAAQ,CAAC;IAChC;IAEA,qBACE,KAAClC;QAAc8H,MAAMA;QAAMO,OAAOA;OAAWL;kBAC3C,cAAA,KAACnG;YACCE,KAAKA;YACLC,OAAOsF,MAAMtF,KAAK;YAClBE,UAAUoF,MAAMpF,QAAQ;YACxBC,OAAOA;YACPC,YAAYC;YACZC,eAAeA;;;AAIvB;AAEA+E,oBAAoBD,WAAW,GAAG;AAClCC,oBAAoBoB,KAAK,GAAG;AAE5B,eAAepB,oBAAmB"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type FormControlProps as MuiFormControlProps, type MenuItemProps as MuiMenuItemProps, type SelectProps as MuiSelectProps } from '@mui/material';
18
+ import { type UseFieldApiConfig } from '../vendor/data-driven-forms';
19
+ export type SelectBaseProps = MuiSelectProps & UseFieldApiConfig;
20
+ export type SelectProps = SelectBaseProps & {
21
+ isReadOnly?: boolean;
22
+ isDisabled?: boolean;
23
+ isRequired?: boolean;
24
+ description?: JSX.Node;
25
+ validateOnMount?: boolean;
26
+ FormControlProps?: Partial<MuiFormControlProps>;
27
+ disableDefaultOption?: boolean;
28
+ defaultOption?: MuiMenuItemProps;
29
+ };
30
+ export declare const SelectComponent: import("react").ForwardRefExoticComponent<(Omit<import("@mui/material").FilledSelectProps & import("@mui/material").BaseSelectProps<unknown> & UseFieldApiConfig & {
31
+ isReadOnly?: boolean;
32
+ isDisabled?: boolean;
33
+ isRequired?: boolean;
34
+ description?: JSX.Node;
35
+ validateOnMount?: boolean;
36
+ FormControlProps?: Partial<MuiFormControlProps>;
37
+ disableDefaultOption?: boolean;
38
+ defaultOption?: MuiMenuItemProps;
39
+ }, "ref"> | Omit<import("@mui/material").StandardSelectProps & import("@mui/material").BaseSelectProps<unknown> & UseFieldApiConfig & {
40
+ isReadOnly?: boolean;
41
+ isDisabled?: boolean;
42
+ isRequired?: boolean;
43
+ description?: JSX.Node;
44
+ validateOnMount?: boolean;
45
+ FormControlProps?: Partial<MuiFormControlProps>;
46
+ disableDefaultOption?: boolean;
47
+ defaultOption?: MuiMenuItemProps;
48
+ }, "ref"> | Omit<import("@mui/material").OutlinedSelectProps & import("@mui/material").BaseSelectProps<unknown> & UseFieldApiConfig & {
49
+ isReadOnly?: boolean;
50
+ isDisabled?: boolean;
51
+ isRequired?: boolean;
52
+ description?: JSX.Node;
53
+ validateOnMount?: boolean;
54
+ FormControlProps?: Partial<MuiFormControlProps>;
55
+ disableDefaultOption?: boolean;
56
+ defaultOption?: MuiMenuItemProps;
57
+ }, "ref">) & import("react").RefAttributes<any>>;
58
+ export default SelectComponent;
@@ -0,0 +1,107 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ /**
5
+ * @license
6
+ * Copyright 2023 Aglyn LLC
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */ import { mergeSxProps } from "@aglyn/shared-ui-theme";
20
+ import { FormControl as MuiFormControl, FormHelperText as MuiFormHelperText, InputLabel as MuiInputLabel, MenuItem as MuiMenuItem, Select as MuiSelect } from "@mui/material";
21
+ import { forwardRef } from "react";
22
+ import { validationMessage } from "../utils/validation-message.js";
23
+ import { useFieldApi } from "../vendor/data-driven-forms.js";
24
+ export const SelectComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
25
+ var _ref;
26
+ const _useFieldApi = useFieldApi(props), { input, isReadOnly, isDisabled, placeholder, isRequired, label, helperText, description, validateOnMount, meta, inputProps, options = [], variant, FormControlProps: _ref1 = {} } = _useFieldApi, { sx: formControlSx } = _ref1, formControlProps = _object_without_properties_loose(_ref1, [
27
+ "sx"
28
+ ]), { defaultOption, disableDefaultOption } = _useFieldApi, rest = _object_without_properties_loose(_useFieldApi, [
29
+ "input",
30
+ "isReadOnly",
31
+ "isDisabled",
32
+ "placeholder",
33
+ "isRequired",
34
+ "label",
35
+ "helperText",
36
+ "description",
37
+ "validateOnMount",
38
+ "meta",
39
+ "inputProps",
40
+ "options",
41
+ "variant",
42
+ "FormControlProps",
43
+ "defaultOption",
44
+ "disableDefaultOption"
45
+ ]);
46
+ const invalidMessage = validationMessage(meta, validateOnMount);
47
+ const helpText = invalidMessage || (meta.touched || validateOnMount) && meta.warning || helperText || description;
48
+ return /*#__PURE__*/ _jsxs(MuiFormControl, _extends({
49
+ ref: ref,
50
+ variant: variant,
51
+ size: "small",
52
+ sx: mergeSxProps({
53
+ width: '100%',
54
+ display: 'flex'
55
+ }, formControlSx)
56
+ }, formControlProps, {
57
+ children: [
58
+ /*#__PURE__*/ _jsx(MuiInputLabel, {
59
+ id: `field-select-${input.name}`,
60
+ children: label
61
+ }),
62
+ /*#__PURE__*/ _jsxs(MuiSelect, _extends({}, input, {
63
+ disabled: isDisabled,
64
+ error: Boolean(invalidMessage),
65
+ inputProps: _extends({
66
+ readOnly: isReadOnly
67
+ }, inputProps),
68
+ label: label,
69
+ labelId: `field-select-${input.name}`,
70
+ required: isRequired,
71
+ fullWidth: true
72
+ }, rest, {
73
+ children: [
74
+ disableDefaultOption ? null : /*#__PURE__*/ _jsx(MuiMenuItem, _extends({
75
+ value: ''
76
+ }, defaultOption, {
77
+ children: (_ref = defaultOption == null ? void 0 : defaultOption.children) != null ? _ref : 'None'
78
+ })),
79
+ options.map((_0, _1)=>{
80
+ let _ref = [
81
+ _0,
82
+ _1
83
+ ], [_ref1, ..._rest] = _ref, { children, label, value } = _ref1, item = _object_without_properties_loose(_ref1, [
84
+ "children",
85
+ "label",
86
+ "value"
87
+ ]), [key] = _rest;
88
+ var _ref2, _ref3, _item_key;
89
+ return /*#__PURE__*/ _jsx(MuiMenuItem, _extends({
90
+ value: value
91
+ }, item, {
92
+ children: children != null ? children : label
93
+ }), (_ref2 = (_ref3 = (_item_key = item.key) != null ? _item_key : item.id) != null ? _ref3 : value) != null ? _ref2 : key);
94
+ })
95
+ ]
96
+ })),
97
+ !helpText ? null : /*#__PURE__*/ _jsx(MuiFormHelperText, {
98
+ children: helpText
99
+ })
100
+ ]
101
+ }));
102
+ });
103
+ SelectComponent.displayName = 'SelectComponent';
104
+ SelectComponent.aglyn = true;
105
+ export default SelectComponent;
106
+
107
+ //# sourceMappingURL=select.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/components/select.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { mergeSxProps } from '@aglyn/shared-ui-theme'\nimport {\n FormControl as MuiFormControl,\n type FormControlProps as MuiFormControlProps,\n FormHelperText as MuiFormHelperText,\n InputLabel as MuiInputLabel,\n MenuItem as MuiMenuItem,\n type MenuItemProps as MuiMenuItemProps,\n Select as MuiSelect,\n type SelectProps as MuiSelectProps,\n} from '@mui/material'\nimport { forwardRef } from 'react'\nimport { validationMessage } from '../utils/validation-message'\nimport {\n useFieldApi,\n type UseFieldApiConfig,\n} from '../vendor/data-driven-forms'\n\nexport type SelectBaseProps = MuiSelectProps & UseFieldApiConfig\n\nexport type SelectProps = SelectBaseProps & {\n isReadOnly?: boolean\n isDisabled?: boolean\n isRequired?: boolean\n description?: JSX.Node\n validateOnMount?: boolean\n FormControlProps?: Partial<MuiFormControlProps>\n disableDefaultOption?: boolean\n defaultOption?: MuiMenuItemProps\n}\n\nexport const SelectComponent = forwardRef<any, SelectProps>((props, ref) => {\n const {\n input,\n isReadOnly,\n isDisabled,\n placeholder,\n isRequired,\n label,\n helperText,\n description,\n validateOnMount,\n meta,\n inputProps,\n options = [],\n variant,\n FormControlProps: { sx: formControlSx, ...formControlProps } = {},\n defaultOption,\n disableDefaultOption,\n ...rest\n } = useFieldApi(props as UseFieldApiConfig)\n const invalidMessage = validationMessage(meta, validateOnMount)\n const helpText =\n invalidMessage ||\n ((meta.touched || validateOnMount) && meta.warning) ||\n helperText ||\n description\n\n return (\n <MuiFormControl\n ref={ref}\n variant={variant}\n size=\"small\"\n sx={mergeSxProps({ width: '100%', display: 'flex' }, formControlSx)}\n {...formControlProps}\n >\n <MuiInputLabel id={`field-select-${input.name}`}>{label}</MuiInputLabel>\n <MuiSelect\n {...input}\n disabled={isDisabled}\n error={Boolean(invalidMessage)}\n inputProps={{\n readOnly: isReadOnly,\n ...inputProps,\n }}\n label={label}\n labelId={`field-select-${input.name}`}\n required={isRequired}\n fullWidth\n {...rest}\n >\n {disableDefaultOption ? null : (\n <MuiMenuItem value={''} {...defaultOption}>\n {defaultOption?.children ?? 'None'}\n </MuiMenuItem>\n )}\n {options.map(\n ({ children, label, value, ...item }: any, key: number) => (\n <MuiMenuItem\n key={item.key ?? item.id ?? value ?? key}\n value={value}\n {...item}\n >\n {children ?? label}\n </MuiMenuItem>\n ),\n )}\n </MuiSelect>\n {!helpText ? null : <MuiFormHelperText>{helpText}</MuiFormHelperText>}\n </MuiFormControl>\n )\n})\n\nSelectComponent.displayName = 'SelectComponent'\nSelectComponent.aglyn = true\n\nexport default SelectComponent\n"],"names":["mergeSxProps","FormControl","MuiFormControl","FormHelperText","MuiFormHelperText","InputLabel","MuiInputLabel","MenuItem","MuiMenuItem","Select","MuiSelect","forwardRef","validationMessage","useFieldApi","SelectComponent","props","ref","input","isReadOnly","isDisabled","placeholder","isRequired","label","helperText","description","validateOnMount","meta","inputProps","options","variant","FormControlProps","sx","formControlSx","formControlProps","defaultOption","disableDefaultOption","rest","invalidMessage","helpText","touched","warning","size","width","display","id","name","disabled","error","Boolean","readOnly","labelId","required","fullWidth","value","children","map","item","key","displayName","aglyn"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,YAAY,QAAQ,yBAAwB;AACrD,SACEC,eAAeC,cAAc,EAE7BC,kBAAkBC,iBAAiB,EACnCC,cAAcC,aAAa,EAC3BC,YAAYC,WAAW,EAEvBC,UAAUC,SAAS,QAEd,gBAAe;AACtB,SAASC,UAAU,QAAQ,QAAO;AAClC,SAASC,iBAAiB,QAAQ,iCAA6B;AAC/D,SACEC,WAAW,QAEN,iCAA6B;AAepC,OAAO,MAAMC,gCAAkBH,WAA6B,CAACI,OAAOC;;IAClE,MAkBIH,eAAAA,YAAYE,QAlBV,EACJE,KAAK,EACLC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,WAAW,EACXC,eAAe,EACfC,IAAI,EACJC,UAAU,EACVC,UAAU,EAAE,EACZC,OAAO,EACPC,kBAAkB,QAA6C,CAAC,CAAC,EAIlE,GAAGjB,cAJgB,E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BAAe"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type FormControlLabelProps as MuiFormControlLabelProps, type FormControlProps as MuiFormControlProps, type FormGroupProps as MuiFormGroupProps, type FormHelperTextProps as MuiFormHelperTextProps, type FormLabelProps as MuiFormLabelProps, type SwitchProps as MuiSwitchProps } from '@mui/material';
18
+ import { type UseFieldApiConfig } from '../vendor/data-driven-forms';
19
+ export type SwitchBaseProps = MuiSwitchProps & UseFieldApiConfig;
20
+ export interface SwitchProps extends SwitchBaseProps {
21
+ isReadOnly?: boolean;
22
+ isDisabled?: boolean;
23
+ isRequired?: boolean;
24
+ label?: JSX.Node;
25
+ helperText?: JSX.Node;
26
+ description?: JSX.Node;
27
+ validateOnMount?: boolean;
28
+ onText?: JSX.Node;
29
+ offText?: JSX.Node;
30
+ FormControlProps?: MuiFormControlProps;
31
+ FormGroupProps?: MuiFormGroupProps;
32
+ FormControlLabelProps?: MuiFormControlLabelProps;
33
+ SwitchProps?: MuiSwitchProps;
34
+ FormLabelProps?: MuiFormLabelProps;
35
+ FormHelperTextProps?: MuiFormHelperTextProps;
36
+ }
37
+ declare const SwitchComponent: import("react").ForwardRefExoticComponent<Omit<SwitchProps, "ref"> & import("react").RefAttributes<any>>;
38
+ export default SwitchComponent;
@@ -0,0 +1,76 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ /**
5
+ * @license
6
+ * Copyright 2022 Aglyn LLC
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */ import { FormControl as MuiFormControl, FormControlLabel as MuiFormControlLabel, FormGroup as MuiFormGroup, FormHelperText as MuiFormHelperText, FormLabel as MuiFormLabel, Switch as MuiSwitch } from "@mui/material";
20
+ import { forwardRef } from "react";
21
+ import { validationMessage } from "../utils/validation-message.js";
22
+ import { useFieldApi } from "../vendor/data-driven-forms.js";
23
+ const SwitchComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
24
+ const _useFieldApi = useFieldApi(_extends({}, props, {
25
+ type: 'checkbox'
26
+ })), { input, isReadOnly, isDisabled, isRequired, label, helperText, description, validateOnMount, meta, onText, offText, FormControlProps, FormGroupProps, FormControlLabelProps, SwitchProps, FormLabelProps, FormHelperTextProps } = _useFieldApi, rest = _object_without_properties_loose(_useFieldApi, [
27
+ "input",
28
+ "isReadOnly",
29
+ "isDisabled",
30
+ "isRequired",
31
+ "label",
32
+ "helperText",
33
+ "description",
34
+ "validateOnMount",
35
+ "meta",
36
+ "onText",
37
+ "offText",
38
+ "FormControlProps",
39
+ "FormGroupProps",
40
+ "FormControlLabelProps",
41
+ "SwitchProps",
42
+ "FormLabelProps",
43
+ "FormHelperTextProps"
44
+ ]);
45
+ const invalid = validationMessage(meta, validateOnMount);
46
+ const helpText = invalid || (meta.touched || validateOnMount) && meta.warning || helperText || description;
47
+ return /*#__PURE__*/ _jsx(MuiFormControl, _extends({
48
+ ref: ref,
49
+ required: isRequired,
50
+ error: !!invalid,
51
+ component: "fieldset"
52
+ }, FormControlProps, {
53
+ children: /*#__PURE__*/ _jsxs(MuiFormGroup, _extends({}, FormGroupProps, {
54
+ children: [
55
+ /*#__PURE__*/ _jsx(MuiFormControlLabel, _extends({
56
+ control: /*#__PURE__*/ _jsx(MuiSwitch, _extends({}, SwitchProps, rest, input, {
57
+ readOnly: isReadOnly,
58
+ disabled: isDisabled || isReadOnly,
59
+ onChange: ({ target: { checked } })=>input.onChange(checked)
60
+ })),
61
+ label: /*#__PURE__*/ _jsx(MuiFormLabel, _extends({}, FormLabelProps, {
62
+ children: input.checked ? onText || label : offText || label
63
+ }))
64
+ }, FormControlLabelProps)),
65
+ helpText && /*#__PURE__*/ _jsx(MuiFormHelperText, _extends({}, FormHelperTextProps, {
66
+ children: helpText
67
+ }))
68
+ ]
69
+ }))
70
+ }));
71
+ });
72
+ SwitchComponent.displayName = 'SwitchComponent';
73
+ SwitchComponent.aglyn = true;
74
+ export default SwitchComponent;
75
+
76
+ //# sourceMappingURL=switch.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/components/switch.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FormControl as MuiFormControl,\n FormControlLabel as MuiFormControlLabel,\n type FormControlLabelProps as MuiFormControlLabelProps,\n type FormControlProps as MuiFormControlProps,\n FormGroup as MuiFormGroup,\n type FormGroupProps as MuiFormGroupProps,\n FormHelperText as MuiFormHelperText,\n type FormHelperTextProps as MuiFormHelperTextProps,\n FormLabel as MuiFormLabel,\n type FormLabelProps as MuiFormLabelProps,\n Switch as MuiSwitch,\n type SwitchProps as MuiSwitchProps,\n} from '@mui/material'\nimport { forwardRef } from 'react'\nimport { validationMessage } from '../utils/validation-message'\nimport {\n useFieldApi,\n type UseFieldApiConfig,\n} from '../vendor/data-driven-forms'\n\nexport type SwitchBaseProps = MuiSwitchProps & UseFieldApiConfig\n\nexport interface SwitchProps extends SwitchBaseProps {\n isReadOnly?: boolean\n isDisabled?: boolean\n isRequired?: boolean\n label?: JSX.Node\n helperText?: JSX.Node\n description?: JSX.Node\n validateOnMount?: boolean\n onText?: JSX.Node\n offText?: JSX.Node\n FormControlProps?: MuiFormControlProps\n FormGroupProps?: MuiFormGroupProps\n FormControlLabelProps?: MuiFormControlLabelProps\n SwitchProps?: MuiSwitchProps\n FormLabelProps?: MuiFormLabelProps\n FormHelperTextProps?: MuiFormHelperTextProps\n}\n\nconst SwitchComponent = forwardRef<any, SwitchProps>((props, ref) => {\n const {\n input,\n isReadOnly,\n isDisabled,\n isRequired,\n label,\n helperText,\n description,\n validateOnMount,\n meta,\n onText,\n offText,\n FormControlProps,\n FormGroupProps,\n FormControlLabelProps,\n SwitchProps,\n FormLabelProps,\n FormHelperTextProps,\n ...rest\n } = useFieldApi({\n ...props,\n type: 'checkbox',\n } as unknown as UseFieldApiConfig)\n const invalid = validationMessage(meta, validateOnMount)\n const helpText =\n invalid ||\n ((meta.touched || validateOnMount) && meta.warning) ||\n helperText ||\n description\n\n return (\n <MuiFormControl\n ref={ref}\n required={isRequired}\n error={!!invalid}\n component=\"fieldset\"\n {...FormControlProps}\n >\n <MuiFormGroup {...FormGroupProps}>\n <MuiFormControlLabel\n control={\n <MuiSwitch\n {...SwitchProps}\n {...rest}\n {...input}\n readOnly={isReadOnly}\n disabled={isDisabled || isReadOnly}\n onChange={({ target: { checked } }) => input.onChange(checked)}\n />\n }\n label={\n <MuiFormLabel {...FormLabelProps}>\n {input.checked ? onText || label : offText || label}\n </MuiFormLabel>\n }\n {...FormControlLabelProps}\n />\n {helpText && (\n <MuiFormHelperText {...FormHelperTextProps}>\n {helpText}\n </MuiFormHelperText>\n )}\n </MuiFormGroup>\n </MuiFormControl>\n )\n})\n\nSwitchComponent.displayName = 'SwitchComponent'\nSwitchComponent.aglyn = true\n\nexport default SwitchComponent\n"],"names":["FormControl","MuiFormControl","FormControlLabel","MuiFormControlLabel","FormGroup","MuiFormGroup","FormHelperText","MuiFormHelperText","FormLabel","MuiFormLabel","Switch","MuiSwitch","forwardRef","validationMessage","useFieldApi","SwitchComponent","props","ref","type","input","isReadOnly","isDisabled","isRequired","label","helperText","description","validateOnMount","meta","onText","offText","FormControlProps","FormGroupProps","FormControlLabelProps","SwitchProps","FormLabelProps","FormHelperTextProps","rest","invalid","helpText","touched","warning","required","error","component","control","readOnly","disabled","onChange","target","checked","displayName","aglyn"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,eAAeC,cAAc,EAC7BC,oBAAoBC,mBAAmB,EAGvCC,aAAaC,YAAY,EAEzBC,kBAAkBC,iBAAiB,EAEnCC,aAAaC,YAAY,EAEzBC,UAAUC,SAAS,QAEd,gBAAe;AACtB,SAASC,UAAU,QAAQ,QAAO;AAClC,SAASC,iBAAiB,QAAQ,iCAA6B;AAC/D,SACEC,WAAW,QAEN,iCAA6B;AAsBpC,MAAMC,gCAAkBH,WAA6B,CAACI,OAAOC;IAC3D,MAmBIH,eAAAA,YAAY,aACXE;QACHE,MAAM;SArBF,EACJC,KAAK,EACLC,UAAU,EACVC,UAAU,EACVC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,WAAW,EACXC,eAAe,EACfC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,gBAAgB,EAChBC,cAAc,EACdC,qBAAqB,EACrBC,WAAW,EACXC,cAAc,EACdC,mBAAmB,EAEpB,GAAGrB,cADCsB,wCACDtB;;;;;;;;;;;;;;;;;;;IAIJ,MAAMuB,UAAUxB,kBAAkBc,MAAMD;IACxC,MAAMY,WACJD,WACC,AAACV,CAAAA,KAAKY,OAAO,IAAIb,eAAc,KAAMC,KAAKa,OAAO,IAClDhB,cACAC;IAEF,qBACE,KAACxB;QACCgB,KAAKA;QACLwB,UAAUnB;QACVoB,OAAO,CAAC,CAACL;QACTM,WAAU;OACNb;kBAEJ,cAAA,MAACzB,2BAAiB0B;;8BAChB,KAAC5B;oBACCyC,uBACE,KAACjC,wBACKsB,aACAG,MACAjB;wBACJ0B,UAAUzB;wBACV0B,UAAUzB,cAAcD;wBACxB2B,UAAU,CAAC,EAAEC,QAAQ,EAAEC,OAAO,EAAE,EAAE,GAAK9B,MAAM4B,QAAQ,CAACE;;oBAG1D1B,qBACE,KAACd,2BAAiByB;kCACff,MAAM8B,OAAO,GAAGrB,UAAUL,QAAQM,WAAWN;;mBAG9CS;gBAELM,0BACC,KAAC/B,gCAAsB4B;8BACpBG;;;;;AAMb;AAEAvB,gBAAgBmC,WAAW,GAAG;AAC9BnC,gBAAgBoC,KAAK,GAAG;AAExB,eAAepC,gBAAe"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type TextFieldProps as MuiTextFieldProps } from '@mui/material';
18
+ import { type UseFieldApiConfig } from '../vendor/data-driven-forms';
19
+ export type TextFieldProps = MuiTextFieldProps & UseFieldApiConfig & {
20
+ isReadOnly?: boolean;
21
+ isDisabled?: boolean;
22
+ isRequired?: boolean;
23
+ description?: JSX.Node;
24
+ validateOnMount?: boolean;
25
+ };
26
+ declare const TextFieldComponent: import("react").ForwardRefExoticComponent<(Omit<import("@mui/material").FilledTextFieldProps & UseFieldApiConfig & {
27
+ isReadOnly?: boolean;
28
+ isDisabled?: boolean;
29
+ isRequired?: boolean;
30
+ description?: JSX.Node;
31
+ validateOnMount?: boolean;
32
+ }, "ref"> | Omit<import("@mui/material").StandardTextFieldProps & UseFieldApiConfig & {
33
+ isReadOnly?: boolean;
34
+ isDisabled?: boolean;
35
+ isRequired?: boolean;
36
+ description?: JSX.Node;
37
+ validateOnMount?: boolean;
38
+ }, "ref"> | Omit<import("@mui/material").OutlinedTextFieldProps & UseFieldApiConfig & {
39
+ isReadOnly?: boolean;
40
+ isDisabled?: boolean;
41
+ isRequired?: boolean;
42
+ description?: JSX.Node;
43
+ validateOnMount?: boolean;
44
+ }, "ref">) & import("react").RefAttributes<any>>;
45
+ export default TextFieldComponent;
@@ -0,0 +1,77 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ /**
5
+ * @license
6
+ * Copyright 2022 Aglyn LLC
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */ import { TextField as MuiTextField } from "@mui/material";
20
+ import { forwardRef } from "react";
21
+ import { validationMessage } from "../utils/validation-message.js";
22
+ import { useFieldApi } from "../vendor/data-driven-forms.js";
23
+ const TextFieldComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
24
+ const _useFieldApi = useFieldApi(props), { input, isReadOnly, isDisabled, placeholder, isRequired, label, helperText, description, validateOnMount, meta, inputProps, type, slotProps } = _useFieldApi, rest = _object_without_properties_loose(_useFieldApi, [
25
+ "input",
26
+ "isReadOnly",
27
+ "isDisabled",
28
+ "placeholder",
29
+ "isRequired",
30
+ "label",
31
+ "helperText",
32
+ "description",
33
+ "validateOnMount",
34
+ "meta",
35
+ "inputProps",
36
+ "type",
37
+ "slotProps"
38
+ ]);
39
+ const invalidMessage = validationMessage(meta, validateOnMount);
40
+ /*
41
+ * A date, time or colour input paints its own placeholder whether or not it
42
+ * is focused, so a label left to float sits ON TOP of `mm/dd/yyyy` and both
43
+ * are unreadable. Shrinking is not a preference for these types, it is the
44
+ * only legible state — so it is decided here rather than at every call site,
45
+ * where forgetting it looks like a typo in the label.
46
+ */ const alwaysFilled = type === 'date' || type === 'time' || type === 'datetime-local' || type === 'month' || type === 'week' || type === 'color';
47
+ const helpText = invalidMessage || (meta.touched || validateOnMount) && meta.warning || helperText || description;
48
+ return /*#__PURE__*/ _jsx(MuiTextField, _extends({}, input, {
49
+ ref: ref,
50
+ disabled: isDisabled,
51
+ error: Boolean(invalidMessage),
52
+ helperText: helpText,
53
+ type: type,
54
+ /*
55
+ * Merged rather than overwritten: a caller passing `slotProps` for one
56
+ * slot must not silently drop the read-only flag on another.
57
+ */ slotProps: _extends({}, slotProps, {
58
+ htmlInput: _extends({
59
+ readOnly: isReadOnly
60
+ }, inputProps, slotProps == null ? void 0 : slotProps.htmlInput)
61
+ }, alwaysFilled ? {
62
+ inputLabel: _extends({
63
+ shrink: true
64
+ }, slotProps == null ? void 0 : slotProps.inputLabel)
65
+ } : {}),
66
+ label: label,
67
+ placeholder: placeholder,
68
+ required: isRequired,
69
+ size: "small",
70
+ fullWidth: true
71
+ }, rest));
72
+ });
73
+ TextFieldComponent.displayName = 'TextFieldComponent';
74
+ TextFieldComponent.aglyn = true;
75
+ export default TextFieldComponent;
76
+
77
+ //# sourceMappingURL=text-field.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/components/text-field.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n TextField as MuiTextField,\n type TextFieldProps as MuiTextFieldProps,\n} from '@mui/material'\nimport { forwardRef } from 'react'\nimport { validationMessage } from '../utils/validation-message'\nimport {\n useFieldApi,\n type UseFieldApiConfig,\n} from '../vendor/data-driven-forms'\n\nexport type TextFieldProps = MuiTextFieldProps &\n UseFieldApiConfig & {\n isReadOnly?: boolean\n isDisabled?: boolean\n isRequired?: boolean\n description?: JSX.Node\n validateOnMount?: boolean\n }\n\nconst TextFieldComponent = forwardRef<any, TextFieldProps>((props, ref) => {\n const {\n input,\n isReadOnly,\n isDisabled,\n placeholder,\n isRequired,\n label,\n helperText,\n description,\n validateOnMount,\n meta,\n inputProps,\n type,\n slotProps,\n ...rest\n } = useFieldApi(props as UseFieldApiConfig)\n const invalidMessage = validationMessage(meta, validateOnMount)\n /*\n * A date, time or colour input paints its own placeholder whether or not it\n * is focused, so a label left to float sits ON TOP of `mm/dd/yyyy` and both\n * are unreadable. Shrinking is not a preference for these types, it is the\n * only legible state — so it is decided here rather than at every call site,\n * where forgetting it looks like a typo in the label.\n */\n const alwaysFilled =\n type === 'date' ||\n type === 'time' ||\n type === 'datetime-local' ||\n type === 'month' ||\n type === 'week' ||\n type === 'color'\n const helpText =\n invalidMessage ||\n ((meta.touched || validateOnMount) && meta.warning) ||\n helperText ||\n description\n\n return (\n <MuiTextField\n {...input}\n ref={ref}\n disabled={isDisabled}\n error={Boolean(invalidMessage)}\n helperText={helpText}\n type={type}\n /*\n * Merged rather than overwritten: a caller passing `slotProps` for one\n * slot must not silently drop the read-only flag on another.\n */\n slotProps={{\n ...slotProps,\n htmlInput: {\n readOnly: isReadOnly,\n ...inputProps,\n ...(slotProps as any)?.htmlInput,\n },\n ...(alwaysFilled\n ? {\n inputLabel: {\n shrink: true,\n ...(slotProps as any)?.inputLabel,\n },\n }\n : {}),\n }}\n label={label}\n placeholder={placeholder}\n required={isRequired}\n size=\"small\"\n fullWidth\n {...rest}\n />\n )\n})\n\nTextFieldComponent.displayName = 'TextFieldComponent'\nTextFieldComponent.aglyn = true\n\nexport default TextFieldComponent\n"],"names":["TextField","MuiTextField","forwardRef","validationMessage","useFieldApi","TextFieldComponent","props","ref","input","isReadOnly","isDisabled","placeholder","isRequired","label","helperText","description","validateOnMount","meta","inputProps","type","slotProps","rest","invalidMessage","alwaysFilled","helpText","touched","warning","disabled","error","Boolean","htmlInput","readOnly","inputLabel","shrink","required","size","fullWidth","displayName","aglyn"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,aAAaC,YAAY,QAEpB,gBAAe;AACtB,SAASC,UAAU,QAAQ,QAAO;AAClC,SAASC,iBAAiB,QAAQ,iCAA6B;AAC/D,SACEC,WAAW,QAEN,iCAA6B;AAWpC,MAAMC,mCAAqBH,WAAgC,CAACI,OAAOC;IACjE,MAeIH,eAAAA,YAAYE,QAfV,EACJE,KAAK,EACLC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,WAAW,EACXC,eAAe,EACfC,IAAI,EACJC,UAAU,EACVC,IAAI,EACJC,SAAS,EAEV,GAAGhB,cADCiB,wCACDjB;;;;;;;;;;;;;;;IACJ,MAAMkB,iBAAiBnB,kBAAkBc,MAAMD;IAC/C;;;;;;GAMC,GACD,MAAMO,eACJJ,SAAS,UACTA,SAAS,UACTA,SAAS,oBACTA,SAAS,WACTA,SAAS,UACTA,SAAS;IACX,MAAMK,WACJF,kBACC,AAACL,CAAAA,KAAKQ,OAAO,IAAIT,eAAc,KAAMC,KAAKS,OAAO,IAClDZ,cACAC;IAEF,qBACE,KAACd,2BACKO;QACJD,KAAKA;QACLoB,UAAUjB;QACVkB,OAAOC,QAAQP;QACfR,YAAYU;QACZL,MAAMA;QACN;;;OAGC,GACDC,WAAW,aACNA;YACHU,WAAW;gBACTC,UAAUtB;eACPS,YACCE,6BAAD,AAACA,UAAmBU,SAAS;WAE9BP,eACA;YACES,YAAY;gBACVC,QAAQ;eACJb,6BAAD,AAACA,UAAmBY,UAAU;QAErC,IACA,CAAC;QAEPnB,OAAOA;QACPF,aAAaA;QACbuB,UAAUtB;QACVuB,MAAK;QACLC,SAAS;OACLf;AAGV;AAEAhB,mBAAmBgC,WAAW,GAAG;AACjChC,mBAAmBiC,KAAK,GAAG;AAE3B,eAAejC,mBAAkB"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type TextFieldProps as MuiTextFieldProps } from '@mui/material';
18
+ import { type UseFieldApiConfig } from '../vendor/data-driven-forms';
19
+ export type TextareaProps = MuiTextFieldProps & UseFieldApiConfig & {
20
+ isReadOnly?: boolean;
21
+ isDisabled?: boolean;
22
+ isRequired?: boolean;
23
+ description?: JSX.Node;
24
+ validateOnMount?: boolean;
25
+ };
26
+ declare const TextareaComponent: import("react").ForwardRefExoticComponent<(Omit<import("@mui/material").FilledTextFieldProps & UseFieldApiConfig & {
27
+ isReadOnly?: boolean;
28
+ isDisabled?: boolean;
29
+ isRequired?: boolean;
30
+ description?: JSX.Node;
31
+ validateOnMount?: boolean;
32
+ }, "ref"> | Omit<import("@mui/material").StandardTextFieldProps & UseFieldApiConfig & {
33
+ isReadOnly?: boolean;
34
+ isDisabled?: boolean;
35
+ isRequired?: boolean;
36
+ description?: JSX.Node;
37
+ validateOnMount?: boolean;
38
+ }, "ref"> | Omit<import("@mui/material").OutlinedTextFieldProps & UseFieldApiConfig & {
39
+ isReadOnly?: boolean;
40
+ isDisabled?: boolean;
41
+ isRequired?: boolean;
42
+ description?: JSX.Node;
43
+ validateOnMount?: boolean;
44
+ }, "ref">) & import("react").RefAttributes<any>>;
45
+ export default TextareaComponent;
@@ -0,0 +1,61 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ /**
5
+ * @license
6
+ * Copyright 2022 Aglyn LLC
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */ import { TextField as MuiTextField } from "@mui/material";
20
+ import { forwardRef } from "react";
21
+ import { validationMessage } from "../utils/validation-message.js";
22
+ import { useFieldApi } from "../vendor/data-driven-forms.js";
23
+ const TextareaComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
24
+ const _useFieldApi = useFieldApi(props), { input, isReadOnly, isDisabled, placeholder, isRequired, label, helperText, description, validateOnMount, meta, inputProps } = _useFieldApi, rest = _object_without_properties_loose(_useFieldApi, [
25
+ "input",
26
+ "isReadOnly",
27
+ "isDisabled",
28
+ "placeholder",
29
+ "isRequired",
30
+ "label",
31
+ "helperText",
32
+ "description",
33
+ "validateOnMount",
34
+ "meta",
35
+ "inputProps"
36
+ ]);
37
+ const invalidMessage = validationMessage(meta, validateOnMount);
38
+ const helpText = invalidMessage || (meta.touched || validateOnMount) && meta.warning || helperText || description;
39
+ return /*#__PURE__*/ _jsx(MuiTextField, _extends({}, input, {
40
+ ref: ref,
41
+ disabled: isDisabled,
42
+ error: Boolean(invalidMessage),
43
+ helperText: helpText,
44
+ slotProps: {
45
+ htmlInput: _extends({
46
+ readOnly: isReadOnly
47
+ }, inputProps)
48
+ },
49
+ label: label,
50
+ placeholder: placeholder,
51
+ required: isRequired,
52
+ size: "small",
53
+ fullWidth: true,
54
+ multiline: true
55
+ }, rest));
56
+ });
57
+ TextareaComponent.displayName = 'TextareaComponent';
58
+ TextareaComponent.aglyn = true;
59
+ export default TextareaComponent;
60
+
61
+ //# sourceMappingURL=textarea.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/components/textarea.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n TextField as MuiTextField,\n type TextFieldProps as MuiTextFieldProps,\n} from '@mui/material'\nimport { forwardRef } from 'react'\nimport { validationMessage } from '../utils/validation-message'\nimport {\n useFieldApi,\n type UseFieldApiConfig,\n} from '../vendor/data-driven-forms'\n\nexport type TextareaProps = MuiTextFieldProps &\n UseFieldApiConfig & {\n isReadOnly?: boolean\n isDisabled?: boolean\n isRequired?: boolean\n description?: JSX.Node\n validateOnMount?: boolean\n }\n\nconst TextareaComponent = forwardRef<any, TextareaProps>((props, ref) => {\n const {\n input,\n isReadOnly,\n isDisabled,\n placeholder,\n isRequired,\n label,\n helperText,\n description,\n validateOnMount,\n meta,\n inputProps,\n ...rest\n } = useFieldApi(props as UseFieldApiConfig)\n const invalidMessage = validationMessage(meta, validateOnMount)\n const helpText =\n invalidMessage ||\n ((meta.touched || validateOnMount) && meta.warning) ||\n helperText ||\n description\n\n return (\n <MuiTextField\n {...input}\n ref={ref}\n disabled={isDisabled}\n error={Boolean(invalidMessage)}\n helperText={helpText}\n slotProps={{ htmlInput: { readOnly: isReadOnly, ...inputProps } }}\n label={label}\n placeholder={placeholder}\n required={isRequired}\n size=\"small\"\n fullWidth\n multiline\n {...rest}\n />\n )\n})\n\nTextareaComponent.displayName = 'TextareaComponent'\nTextareaComponent.aglyn = true\n\nexport default TextareaComponent\n"],"names":["TextField","MuiTextField","forwardRef","validationMessage","useFieldApi","TextareaComponent","props","ref","input","isReadOnly","isDisabled","placeholder","isRequired","label","helperText","description","validateOnMount","meta","inputProps","rest","invalidMessage","helpText","touched","warning","disabled","error","Boolean","slotProps","htmlInput","readOnly","required","size","fullWidth","multiline","displayName","aglyn"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,aAAaC,YAAY,QAEpB,gBAAe;AACtB,SAASC,UAAU,QAAQ,QAAO;AAClC,SAASC,iBAAiB,QAAQ,iCAA6B;AAC/D,SACEC,WAAW,QAEN,iCAA6B;AAWpC,MAAMC,kCAAoBH,WAA+B,CAACI,OAAOC;IAC/D,MAaIH,eAAAA,YAAYE,QAbV,EACJE,KAAK,EACLC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,KAAK,EACLC,UAAU,EACVC,WAAW,EACXC,eAAe,EACfC,IAAI,EACJC,UAAU,EAEX,GAAGd,cADCe,wCACDf;;;;;;;;;;;;;IACJ,MAAMgB,iBAAiBjB,kBAAkBc,MAAMD;IAC/C,MAAMK,WACJD,kBACC,AAACH,CAAAA,KAAKK,OAAO,IAAIN,eAAc,KAAMC,KAAKM,OAAO,IAClDT,cACAC;IAEF,qBACE,KAACd,2BACKO;QACJD,KAAKA;QACLiB,UAAUd;QACVe,OAAOC,QAAQN;QACfN,YAAYO;QACZM,WAAW;YAAEC,WAAW;gBAAEC,UAAUpB;eAAeS;QAAa;QAChEL,OAAOA;QACPF,aAAaA;QACbmB,UAAUlB;QACVmB,MAAK;QACLC,SAAS;QACTC,SAAS;OACLd;AAGV;AAEAd,kBAAkB6B,WAAW,GAAG;AAChC7B,kBAAkB8B,KAAK,GAAG;AAE1B,eAAe9B,kBAAiB"}