@soyfri/shared-library 2.0.0-beta8 → 2.0.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.
- package/Button-C17mExpd.cjs.map +1 -1
- package/Button-UkkP-bNw.js.map +1 -1
- package/README.md +182 -150
- package/components/ActionMenu/ActionMenu.cjs +52 -52
- package/components/ActionMenu/ActionMenu.cjs.map +1 -1
- package/components/ActionMenu/ActionMenu.d.ts +20 -36
- package/components/ActionMenu/ActionMenu.js +55 -55
- package/components/ActionMenu/ActionMenu.js.map +1 -1
- package/components/ActionMenu/index.d.ts +2 -2
- package/components/AppBar/AppBar.cjs +3 -220
- package/components/AppBar/AppBar.cjs.map +1 -1
- package/components/AppBar/AppBar.d.ts +6 -6
- package/components/AppBar/AppBar.js +6 -223
- package/components/AppBar/AppBar.js.map +1 -1
- package/components/AppBar/index.d.ts +0 -6
- package/components/Autocomplete/Autocomplete.cjs +310 -4
- package/components/Autocomplete/Autocomplete.cjs.map +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +29 -26
- package/components/Autocomplete/Autocomplete.definitions.d.ts +2 -1
- package/components/Autocomplete/Autocomplete.helpers.d.ts +12 -8
- package/components/Autocomplete/Autocomplete.js +310 -4
- package/components/Autocomplete/Autocomplete.js.map +1 -1
- package/components/Autocomplete/_parts/AutocompleteChips.d.ts +7 -6
- package/components/Autocomplete/_parts/AutocompleteOption.d.ts +10 -13
- package/components/Autocomplete/index.d.ts +1 -1
- package/components/Avatar/Avatar.cjs +159 -2
- package/components/Avatar/Avatar.cjs.map +1 -1
- package/components/Avatar/Avatar.js +159 -2
- package/components/Avatar/Avatar.js.map +1 -1
- package/components/Avatar/index.d.ts +1 -0
- package/components/Button/Button.d.ts +5 -5
- package/components/Button/index.d.ts +1 -0
- package/components/Card/Card.cjs +95 -7
- package/components/Card/Card.cjs.map +1 -1
- package/components/Card/Card.d.ts +3 -50
- package/components/Card/Card.js +95 -7
- package/components/Card/Card.js.map +1 -1
- package/components/Card/Card.sx.d.ts +3 -6
- package/components/Card/index.d.ts +1 -1
- package/{Switch-BIeobv6i.cjs → components/Checkbox/Checkbox.cjs} +30 -20
- package/components/Checkbox/Checkbox.cjs.map +1 -0
- package/components/Checkbox/Checkbox.d.ts +55 -0
- package/{Switch-DQEOxM2R.js → components/Checkbox/Checkbox.js} +29 -20
- package/components/Checkbox/Checkbox.js.map +1 -0
- package/components/Checkbox/Checkbox.sx.d.ts +13 -0
- package/components/Checkbox/index.d.ts +2 -0
- package/components/Checkbox.d.ts +6 -0
- package/components/Chip/Chip.cjs +73 -3
- package/components/Chip/Chip.cjs.map +1 -1
- package/components/Chip/Chip.js +72 -2
- package/components/Chip/Chip.js.map +1 -1
- package/components/Chip/index.d.ts +2 -1
- package/components/Chip.d.ts +4 -0
- package/components/Column/Column.cjs +1 -1
- package/components/Column/Column.cjs.map +1 -1
- package/components/Column/Column.d.ts +1 -1
- package/components/Column/Column.js +1 -1
- package/components/Column/Column.js.map +1 -1
- package/components/Column/index.d.ts +0 -1
- package/components/DatePicker/DatePicker.cjs +177 -3
- package/components/DatePicker/DatePicker.cjs.map +1 -1
- package/components/DatePicker/DatePicker.d.ts +1 -13
- package/components/DatePicker/DatePicker.js +177 -3
- package/components/DatePicker/DatePicker.js.map +1 -1
- package/components/DatePicker/index.d.ts +1 -1
- package/components/DateRangePicker/DateRangePicker.cjs +73 -2
- package/components/DateRangePicker/DateRangePicker.cjs.map +1 -1
- package/components/DateRangePicker/DateRangePicker.js +73 -2
- package/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/components/DateTimePicker/DateTimePicker.cjs +195 -3
- package/components/DateTimePicker/DateTimePicker.cjs.map +1 -1
- package/components/DateTimePicker/DateTimePicker.d.ts +9 -17
- package/components/DateTimePicker/DateTimePicker.definitions.d.ts +2 -0
- package/components/DateTimePicker/DateTimePicker.helpers.d.ts +4 -2
- package/components/DateTimePicker/DateTimePicker.js +195 -3
- package/components/DateTimePicker/DateTimePicker.js.map +1 -1
- package/components/DateTimePicker/index.d.ts +1 -1
- package/components/Drawer/Drawer.cjs +13 -7
- package/components/Drawer/Drawer.cjs.map +1 -1
- package/components/Drawer/Drawer.d.ts +3 -1
- package/components/Drawer/Drawer.js +14 -8
- package/components/Drawer/Drawer.js.map +1 -1
- package/components/Drawer/DrawerItem.d.ts +6 -1
- package/components/Gallery/Gallery.cjs +154 -79
- package/components/Gallery/Gallery.cjs.map +1 -1
- package/components/Gallery/Gallery.d.ts +25 -9
- package/components/Gallery/Gallery.js +154 -79
- package/components/Gallery/Gallery.js.map +1 -1
- package/components/Gallery/GalleryLightbox.d.ts +6 -10
- package/components/Gallery/GalleryMain.d.ts +3 -7
- package/components/Gallery/GalleryThumbnails.d.ts +7 -11
- package/components/Gallery/index.d.ts +2 -1
- package/components/Gallery.d.ts +4 -0
- package/components/Icon/Icon.cjs +6 -8
- package/components/Icon/Icon.cjs.map +1 -1
- package/components/Icon/Icon.d.ts +11 -17
- package/components/Icon/Icon.js +6 -8
- package/components/Icon/Icon.js.map +1 -1
- package/components/Icon/index.d.ts +2 -1
- package/components/Icon.d.ts +4 -0
- package/components/Input/Input.cjs +185 -3
- package/components/Input/Input.cjs.map +1 -1
- package/components/Input/Input.d.ts +9 -2
- package/components/Input/Input.helpers.d.ts +3 -3
- package/components/Input/Input.js +185 -3
- package/components/Input/Input.js.map +1 -1
- package/components/Input/index.d.ts +1 -1
- package/components/InputGroup/InputGroup.cjs +23 -22
- package/components/InputGroup/InputGroup.cjs.map +1 -1
- package/components/InputGroup/InputGroup.d.ts +4 -4
- package/components/InputGroup/InputGroup.js +22 -21
- package/components/InputGroup/InputGroup.js.map +1 -1
- package/components/InputGroup/index.d.ts +2 -1
- package/components/InputGroup.d.ts +4 -0
- package/components/Modal/Modal.cjs +345 -6
- package/components/Modal/Modal.cjs.map +1 -1
- package/components/Modal/Modal.d.ts +20 -5
- package/components/Modal/Modal.js +345 -6
- package/components/Modal/Modal.js.map +1 -1
- package/components/Modal/ModalBody.d.ts +6 -1
- package/components/Modal/ModalFooter.d.ts +4 -4
- package/components/Modal/ModalHeader.d.ts +6 -1
- package/components/Modal/index.d.ts +4 -3
- package/components/RadioGroup/RadioGroup.cjs +201 -3
- package/components/RadioGroup/RadioGroup.cjs.map +1 -1
- package/components/RadioGroup/RadioGroup.d.ts +9 -3
- package/components/RadioGroup/RadioGroup.js +201 -3
- package/components/RadioGroup/RadioGroup.js.map +1 -1
- package/components/RadioGroup/index.d.ts +1 -1
- package/components/Select/Select.cjs +310 -4
- package/components/Select/Select.cjs.map +1 -1
- package/components/Select/Select.d.ts +35 -20
- package/components/Select/Select.helpers.d.ts +6 -19
- package/components/Select/Select.js +310 -4
- package/components/Select/Select.js.map +1 -1
- package/components/Select/index.d.ts +1 -1
- package/components/Stat/Stat.cjs +83 -4
- package/components/Stat/Stat.cjs.map +1 -1
- package/components/Stat/Stat.js +82 -3
- package/components/Stat/Stat.js.map +1 -1
- package/components/Stat/index.d.ts +2 -1
- package/components/Stat.d.ts +4 -0
- package/components/StatusMessage/StatusMessage.cjs +105 -3
- package/components/StatusMessage/StatusMessage.cjs.map +1 -1
- package/components/StatusMessage/StatusMessage.d.ts +20 -36
- package/components/StatusMessage/StatusMessage.js +105 -3
- package/components/StatusMessage/StatusMessage.js.map +1 -1
- package/components/StatusMessage/StatusMessageContext.d.ts +16 -0
- package/components/StatusMessage/index.d.ts +2 -0
- package/components/Stepper/Stepper.cjs +324 -4
- package/components/Stepper/Stepper.cjs.map +1 -1
- package/components/Stepper/Stepper.d.ts +9 -8
- package/components/Stepper/Stepper.js +323 -3
- package/components/Stepper/Stepper.js.map +1 -1
- package/{hooks/Wizard/WizardContext.d.ts → components/Stepper/StepperContext.d.ts} +28 -22
- package/components/Stepper/_hooks/useHorizontalScroll.d.ts +19 -0
- package/components/Stepper/_parts/StepperScrollArrow.d.ts +19 -0
- package/components/Stepper/index.d.ts +6 -2
- package/components/Stepper.d.ts +4 -0
- package/components/Switch/Switch.cjs +181 -3
- package/components/Switch/Switch.cjs.map +1 -1
- package/components/Switch/Switch.d.ts +7 -2
- package/components/Switch/Switch.js +181 -3
- package/components/Switch/Switch.js.map +1 -1
- package/components/Table/Table.cjs +528 -2
- package/components/Table/Table.cjs.map +1 -1
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +528 -2
- package/components/Table/Table.js.map +1 -1
- package/components/Tabs/Tabs.cjs +110 -4
- package/components/Tabs/Tabs.cjs.map +1 -1
- package/components/Tabs/Tabs.d.ts +21 -16
- package/components/Tabs/Tabs.js +109 -3
- package/components/Tabs/Tabs.js.map +1 -1
- package/components/Tabs/index.d.ts +4 -2
- package/components/Tabs.d.ts +4 -0
- package/components/Timeline/Timeline.cjs +3 -2
- package/components/Timeline/Timeline.cjs.map +1 -1
- package/components/Timeline/Timeline.d.ts +4 -8
- package/components/Timeline/Timeline.js +3 -2
- package/components/Timeline/Timeline.js.map +1 -1
- package/components/Timeline/index.d.ts +4 -2
- package/components/Timeline.d.ts +4 -0
- package/components/_shared/mergeSx.d.ts +7 -0
- package/{formField.sx-DfVbMe0V.js → formField.sx-8_QRnKxv.js} +2 -11
- package/formField.sx-8_QRnKxv.js.map +1 -0
- package/{formField.sx-CQ1mbk9M.cjs → formField.sx-BAX7KwMR.cjs} +10 -19
- package/formField.sx-BAX7KwMR.cjs.map +1 -0
- package/index.cjs +63 -47
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -30
- package/index.js +25 -48
- package/index.js.map +1 -1
- package/mergeSx-BXoNZjB_.js +10 -0
- package/mergeSx-BXoNZjB_.js.map +1 -0
- package/mergeSx-Dbccoo_H.cjs +9 -0
- package/mergeSx-Dbccoo_H.cjs.map +1 -0
- package/mui.d.ts +4 -2
- package/package.json +8 -20
- package/{resolvePreset-K6_BfWHD.js → resolvePreset-B-IB0ehH.js} +3 -3
- package/{resolvePreset-K6_BfWHD.js.map → resolvePreset-B-IB0ehH.js.map} +1 -1
- package/{resolvePreset-CxTI6_Ln.cjs → resolvePreset-CT3kU-K2.cjs} +3 -3
- package/{resolvePreset-CxTI6_Ln.cjs.map → resolvePreset-CT3kU-K2.cjs.map} +1 -1
- package/theme/componentStyles.d.ts +1 -1
- package/tokens-BRrcP_p_.js +21 -0
- package/tokens-BRrcP_p_.js.map +1 -0
- package/tokens-jaWWNk39.cjs +20 -0
- package/tokens-jaWWNk39.cjs.map +1 -0
- package/utils/index.d.ts +2 -0
- package/{components/ScrollTopButton → utils}/scrollToTop.d.ts +6 -7
- package/Autocomplete-BA-cGASd.js +0 -316
- package/Autocomplete-BA-cGASd.js.map +0 -1
- package/Autocomplete-C2x-lBvZ.cjs +0 -315
- package/Autocomplete-C2x-lBvZ.cjs.map +0 -1
- package/Avatar-9L7YMxya.cjs +0 -162
- package/Avatar-9L7YMxya.cjs.map +0 -1
- package/Avatar-BJTr-PBd.js +0 -163
- package/Avatar-BJTr-PBd.js.map +0 -1
- package/Card-DG_crfkK.cjs +0 -185
- package/Card-DG_crfkK.cjs.map +0 -1
- package/Card-Ug-ttVSh.js +0 -186
- package/Card-Ug-ttVSh.js.map +0 -1
- package/Chip-OPYQ1uQ_.js +0 -74
- package/Chip-OPYQ1uQ_.js.map +0 -1
- package/Chip-qoJLDiva.cjs +0 -73
- package/Chip-qoJLDiva.cjs.map +0 -1
- package/DatePicker-8f_9bwhS.js +0 -202
- package/DatePicker-8f_9bwhS.js.map +0 -1
- package/DatePicker-DLSfkgGA.cjs +0 -201
- package/DatePicker-DLSfkgGA.cjs.map +0 -1
- package/DateRangePicker-BVpeJCHI.js +0 -76
- package/DateRangePicker-BVpeJCHI.js.map +0 -1
- package/DateRangePicker-B_hKQhbj.cjs +0 -75
- package/DateRangePicker-B_hKQhbj.cjs.map +0 -1
- package/DateTimePicker-CWNW09-O.cjs +0 -220
- package/DateTimePicker-CWNW09-O.cjs.map +0 -1
- package/DateTimePicker-D4L9GAod.js +0 -221
- package/DateTimePicker-D4L9GAod.js.map +0 -1
- package/Input-Cp911l23.js +0 -174
- package/Input-Cp911l23.js.map +0 -1
- package/Input-DI0jfq5X.cjs +0 -173
- package/Input-DI0jfq5X.cjs.map +0 -1
- package/Modal-Bm_HH9cv.cjs +0 -319
- package/Modal-Bm_HH9cv.cjs.map +0 -1
- package/Modal-Bnz6d9m9.js +0 -320
- package/Modal-Bnz6d9m9.js.map +0 -1
- package/RadioGroup-CxqDHap1.cjs +0 -200
- package/RadioGroup-CxqDHap1.cjs.map +0 -1
- package/RadioGroup-DMi9FvMP.js +0 -201
- package/RadioGroup-DMi9FvMP.js.map +0 -1
- package/Select-3CBOfM2H.js +0 -447
- package/Select-3CBOfM2H.js.map +0 -1
- package/Select-Bku4f4f8.cjs +0 -446
- package/Select-Bku4f4f8.cjs.map +0 -1
- package/Stat-BUcFCGrz.cjs +0 -83
- package/Stat-BUcFCGrz.cjs.map +0 -1
- package/Stat-C06A_izS.js +0 -84
- package/Stat-C06A_izS.js.map +0 -1
- package/StatusMessage-C5B6oGZ_.cjs +0 -78
- package/StatusMessage-C5B6oGZ_.cjs.map +0 -1
- package/StatusMessage-D1GlfQdz.js +0 -79
- package/StatusMessage-D1GlfQdz.js.map +0 -1
- package/Step-Dq0N72YB.js +0 -49
- package/Step-Dq0N72YB.js.map +0 -1
- package/Step-a8U8O-91.cjs +0 -48
- package/Step-a8U8O-91.cjs.map +0 -1
- package/Switch-BIeobv6i.cjs.map +0 -1
- package/Switch-DQEOxM2R.js.map +0 -1
- package/Tab-Co31KY2k.cjs +0 -95
- package/Tab-Co31KY2k.cjs.map +0 -1
- package/Tab-DiK62gRz.js +0 -96
- package/Tab-DiK62gRz.js.map +0 -1
- package/Table-C2LbW0B1.js +0 -531
- package/Table-C2LbW0B1.js.map +0 -1
- package/Table-C4OM6rrC.cjs +0 -530
- package/Table-C4OM6rrC.cjs.map +0 -1
- package/components/AppBar/AppBarBrand.d.ts +0 -31
- package/components/AppBar/AppBarUserMenu.d.ts +0 -65
- package/components/Autocomplete/Autocomplete.types.d.ts +0 -1
- package/components/DatePicker/DatePicker.types.d.ts +0 -1
- package/components/DateTimePicker/DateTimePicker.types.d.ts +0 -1
- package/components/Input/Input.types.d.ts +0 -1
- package/components/PageLoader/PageLoader.cjs +0 -61
- package/components/PageLoader/PageLoader.cjs.map +0 -1
- package/components/PageLoader/PageLoader.d.ts +0 -38
- package/components/PageLoader/PageLoader.js +0 -61
- package/components/PageLoader/PageLoader.js.map +0 -1
- package/components/PageLoader/index.d.ts +0 -2
- package/components/PageLoader.d.ts +0 -6
- package/components/RadioGroup/RadioGroup.types.d.ts +0 -1
- package/components/ScrollTopButton/ScrollTopButton.cjs +0 -79
- package/components/ScrollTopButton/ScrollTopButton.cjs.map +0 -1
- package/components/ScrollTopButton/ScrollTopButton.d.ts +0 -48
- package/components/ScrollTopButton/ScrollTopButton.js +0 -79
- package/components/ScrollTopButton/ScrollTopButton.js.map +0 -1
- package/components/ScrollTopButton/index.d.ts +0 -4
- package/components/ScrollTopButton.d.ts +0 -6
- package/components/Select/Select.definitions.d.ts +0 -17
- package/components/Select/Select.types.d.ts +0 -1
- package/components/Select/_parts/SelectSearchHeader.d.ts +0 -15
- package/components/Select/_parts/SelectValue.d.ts +0 -22
- package/formField.sx-CQ1mbk9M.cjs.map +0 -1
- package/formField.sx-DfVbMe0V.js.map +0 -1
- package/hooks/Wizard/Wizard.cjs +0 -7
- package/hooks/Wizard/Wizard.cjs.map +0 -1
- package/hooks/Wizard/Wizard.js +0 -7
- package/hooks/Wizard/Wizard.js.map +0 -1
- package/hooks/Wizard/index.d.ts +0 -3
- package/hooks/Wizard/useWizard.d.ts +0 -9
- package/hooks/Wizard.d.ts +0 -2
- package/useWizard-CWdIxZzX.cjs +0 -94
- package/useWizard-CWdIxZzX.cjs.map +0 -1
- package/useWizard-CWq--C3o.js +0 -95
- package/useWizard-CWq--C3o.js.map +0 -1
- /package/{styles.css → index.css} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../../src/components/Input/Input.helpers.ts","../../../src/components/Input/Input.sx.ts","../../../src/components/Input/Input.tsx"],"sourcesContent":["import type { InputHTMLAttributes } from 'react';\nimport type { TextFieldProps } from '@mui/material';\nimport type { InputType } from './Input';\n\n/**\n * Convierte el valor raw del evento al tipo apropiado.\n * Para type=\"number\" intenta parsear a número; si falla, devuelve el raw\n * (permite estados intermedios como \"\" o \"-\" mientras el usuario tipea).\n */\nexport const parseValue = (raw: string, type: InputType): string | number => {\n if (type !== 'number') return raw;\n if (raw === '' || raw === '-') return raw;\n const n = parseFloat(raw);\n return isNaN(n) ? raw : n;\n};\n\n/**\n * Construye los slotProps del TextField consolidando htmlInput + inputLabel.\n * Maneja los atributos min/max cuando type=\"number\", maxLength y readOnly.\n */\nexport const buildSlotProps = (\n type: InputType,\n min: number | undefined,\n max: number | undefined,\n maxLength: number | undefined,\n customSlotProps: TextFieldProps['slotProps'],\n customInputProps: InputHTMLAttributes<HTMLInputElement> | undefined,\n readOnly?: boolean,\n): TextFieldProps['slotProps'] => {\n const numberAttrs =\n type === 'number'\n ? { min: min ?? Number.NEGATIVE_INFINITY, ...(max !== undefined && { max }) }\n : {};\n\n return {\n ...customSlotProps,\n htmlInput: {\n ...customInputProps,\n ...(customSlotProps as any)?.htmlInput,\n ...numberAttrs,\n ...(maxLength !== undefined && { maxLength }),\n ...(readOnly && { readOnly: true }),\n },\n // Dejamos que MUI maneje el shrink nativamente (animación inside → up).\n // El consumidor puede forzar shrink con slotProps.inputLabel.shrink=true si lo necesita.\n inputLabel: {\n ...(customSlotProps as any)?.inputLabel,\n },\n };\n};\n","import type { TextFieldProps } from '@mui/material';\n\nimport { buildFormFieldSx } from '../_shared/formField.sx';\nimport { FIELD_INPUT_PADDING_Y } from '../../theme/tokens';\nimport type { LabelPosition } from './Input';\n\n/**\n * Builder de sx para el Input. Usa el builder compartido\n * `buildFormFieldSx` y añade overrides específicos de TextField\n * (padding del input base, filled, standard).\n */\nexport const buildInputSx = (\n borderRadius: number | string,\n labelPosition: LabelPosition,\n): TextFieldProps['sx'] => {\n const radius = typeof borderRadius === 'number' ? `${borderRadius}px` : borderRadius;\n\n return buildFormFieldSx({\n borderRadius,\n labelPosition,\n extraOutsideSx: {\n '& .MuiInputBase-input': {\n paddingTop: FIELD_INPUT_PADDING_Y,\n paddingBottom: FIELD_INPUT_PADDING_Y,\n },\n\n // Filled: quitar el padding-top reservado para el label flotante dentro.\n '& .MuiFilledInput-root': {\n paddingTop: 0,\n borderRadius: `${radius} ${radius} 0 0`,\n },\n '& .MuiFilledInput-input': {\n paddingTop: FIELD_INPUT_PADDING_Y,\n },\n\n // Standard: quitar el margin-top reservado para el label flotante.\n '& .MuiInput-root': {\n marginTop: 0,\n },\n },\n });\n};\n","import { TextField, type TextFieldProps } from '@mui/material';\nimport { useTheme } from '@mui/material/styles';\nimport { Controller, type Control, type RegisterOptions } from 'react-hook-form';\n\nimport { parseValue, buildSlotProps } from './Input.helpers';\nimport { buildInputSx } from './Input.sx';\nimport { resolvePreset } from '../_shared/resolvePreset';\n\n// ── Tipos de dominio ─────────────────────────────────────────────────────\nexport type InputType =\n | 'text' | 'number' | 'email' | 'password' | 'tel'\n | 'url' | 'search' | 'date' | 'datetime-local'\n | 'month' | 'week' | 'time' | 'color';\n\nexport type LabelPosition = 'outside' | 'floating';\n\n// ── Props base (todo lo común entre RHF y controlado) ────────────────────\nexport interface BaseInputProps\n extends Omit<TextFieldProps, 'value' | 'onChange' | 'type'> {\n type?: InputType;\n min?: number;\n max?: number;\n maxLength?: number;\n /** Border radius del input. Default: 10 */\n borderRadius?: number | string;\n /** \"outside\" = label arriba del campo (default). \"floating\" = label clásico MUI dentro del borde */\n labelPosition?: LabelPosition;\n readOnly?: boolean;\n /**\n * Nombre del preset de estilo registrado en `theme.styles.Input`.\n * - `\"default\"` (o ausente) = estilo built-in del paquete.\n * - Cualquier otro string = mergea el preset encima del estilo built-in.\n */\n preset?: string;\n}\n\n// ── Variantes discriminadas (RHF vs controlado) ──────────────────────────\nexport interface RHFInputProps extends BaseInputProps {\n name: string;\n // `any` plano (no `Control<any>`): RHF tipa `Control<T>` con generics en\n // posiciones tanto contravariantes como covariantes (ej. `_subjects.state`).\n // Cuando el componente o su uso involucra generics adicionales, TS se\n // confunde narroweando el discriminated union y `Control<any>` no logra\n // absorber `Control<MyForm>` en la comparación estructural profunda. El\n // `any` plano elimina ese ruido. RHF adentro sigue teniendo sus tipos\n // fuertes — solo degradamos la superficie del prop del componente.\n control: any;\n validation?: RegisterOptions;\n /**\n * Side-effect que corre después de que RHF actualiza el form state.\n * Útil para cascadas entre campos (ej. reset de municipio al cambiar\n * departamento). NO reemplaza al handler de RHF.\n */\n onValueChange?: (value: string | number) => void;\n value?: never;\n onChange?: never;\n}\n\nexport interface ControlledInputProps extends BaseInputProps {\n name?: string;\n control?: never;\n validation?: never;\n value: string | number;\n onChange: (value: string | number) => void;\n}\n\n// ── API pública final ────────────────────────────────────────────────────\nexport type InputProps = RHFInputProps | ControlledInputProps;\n\nexport const Input: React.FC<InputProps> = (props) => {\n const {\n type = 'text',\n variant = 'outlined',\n size = 'small',\n borderRadius = 10,\n labelPosition = 'outside',\n preset,\n min,\n max,\n maxLength,\n readOnly,\n inputProps,\n slotProps,\n sx,\n onBlur,\n ...rest\n } = props as ControlledInputProps & {\n control?: Control<any>;\n validation?: RegisterOptions;\n };\n\n const theme = useTheme();\n const presetSx = resolvePreset('Input', preset, theme);\n\n const finalSlotProps = buildSlotProps(\n type,\n min,\n max,\n maxLength,\n slotProps,\n inputProps,\n readOnly,\n );\n const mergedSx = [\n buildInputSx(borderRadius, labelPosition),\n ...(presetSx ? [presetSx] : []),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n if ('control' in props && props.control) {\n const { name, control, validation, onValueChange } = props as RHFInputProps;\n return (\n <Controller\n name={name}\n control={control}\n rules={validation}\n render={({ field, fieldState: { error } }) => (\n <TextField\n fullWidth\n {...rest}\n name={field.name}\n value={field.value ?? ''}\n onChange={(e) => {\n const parsed = parseValue(e.target.value, type);\n field.onChange(parsed);\n onValueChange?.(parsed);\n }}\n onBlur={(e) => {\n field.onBlur();\n onBlur?.(e);\n }}\n inputRef={field.ref}\n type={type}\n variant={variant}\n size={size}\n slotProps={finalSlotProps}\n sx={mergedSx}\n error={!!error || rest.error}\n helperText={error?.message ?? rest.helperText}\n />\n )}\n />\n );\n }\n\n const { value, onChange } = props as ControlledInputProps;\n return (\n <TextField\n fullWidth\n {...rest}\n value={value ?? ''}\n onChange={(e) => onChange(parseValue(e.target.value, type))}\n onBlur={onBlur}\n type={type}\n variant={variant}\n size={size}\n slotProps={finalSlotProps}\n sx={mergedSx}\n />\n );\n};\n\nexport default Input;\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,MAAM,aAAa,CAAC,KAAa,SAAqC;AAC3E,MAAI,SAAS,SAAU,QAAO;AAC9B,MAAI,QAAQ,MAAM,QAAQ,IAAK,QAAO;AACtC,QAAM,IAAI,WAAW,GAAG;AACxB,SAAO,MAAM,CAAC,IAAI,MAAM;AAC1B;AAMO,MAAM,iBAAiB,CAC5B,MACA,KACA,KACA,WACA,iBACA,kBACA,aACgC;AAChC,QAAM,cACJ,SAAS,WACL,iBAAE,KAAK,oBAAO,OAAO,qBAAuB,QAAQ,UAAa,EAAE,IAAA,KACnE,CAAA;AAEN,SAAO,iCACF,kBADE;AAAA,IAEL,WAAW,+EACN,mBACC,mDAAyB,YAC1B,cACC,cAAc,UAAa,EAAE,UAAA,IAC7B,YAAY,EAAE,UAAU,KAAA;AAAA;AAAA;AAAA,IAI9B,YAAY,mBACN,mDAAyB;AAAA,EAC/B;AAEJ;ACtCO,MAAM,eAAe,CAC1B,cACA,kBACyB;AACzB,QAAM,SAAS,OAAO,iBAAiB,WAAW,GAAG,YAAY,OAAO;AAExE,SAAO,iBAAiB;AAAA,IACtB;AAAA,IACA;AAAA,IAC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A,QACA;AAAA,QACA,OAAO;AAAA,QACP,QAAQ,CAAC,EAAE,OAAO,YAAY,EAAE,MAAA;;AAC9B;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAS;AAAA,eACL,OAFL;AAAA,cAGC,MAAM,MAAM;AAAA,cACZ,QAAOA,MAAA,MAAM,UAAN,OAAAA,MAAe;AAAA,cACtB,UAAU,CAAC,MAAM;AACf,sBAAM,SAAS,WAAW,EAAE,OAAO,OAAO,IAAI;AAC9C,sBAAM,SAAS,MAAM;AACrB,+DAAgB;AAAA,cAClB;AAAA,cACA,QAAQ,CAAC,MAAM;AACb,sBAAM,OAAA;AACN,iDAAS;AAAA,cACX;AAAA,cACA,UAAU,MAAM;AAAA,cAChB;AAAA,cACA;AAAA,cACA;AAAA,cACA,WAAW;AAAA,cACX,IAAI;AAAA,cACJ,OAAO,CAAC,CAAC,SAAS,KAAK;AAAA,cACvB,aAAY,oCAAO,YAAP,YAAkB,KAAK;AAAA,YAAA;AAAA,UAAA;AAAA;AAAA,MACrC;AAAA,IAAA;AAAA,EAIR;AAEA,QAAM,EAAE,OAAO,SAAA,IAAa;AAC5B,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAS;AAAA,OACL,OAFL;AAAA,MAGC,OAAO,wBAAS;AAAA,MAChB,UAAU,CAAC,MAAM,SAAS,WAAW,EAAE,OAAO,OAAO,IAAI,CAAC;AAAA,MAC1D;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,IAAI;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Input, default } from './Input';
|
|
2
|
-
export type { InputProps, BaseInputProps, RHFInputProps, ControlledInputProps, InputType, LabelPosition, } from './Input
|
|
2
|
+
export type { InputProps, BaseInputProps, RHFInputProps, ControlledInputProps, InputType, LabelPosition, } from './Input';
|
|
@@ -18,16 +18,12 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
return a;
|
|
19
19
|
};
|
|
20
20
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
Object.
|
|
21
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
22
22
|
const jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
const React = require("react");
|
|
24
24
|
const material = require("@mui/material");
|
|
25
|
-
const mergeSx = (
|
|
26
|
-
|
|
27
|
-
const baseArr = Array.isArray(base) ? base : [base];
|
|
28
|
-
const extraArr = Array.isArray(extra) ? extra : [extra];
|
|
29
|
-
return [...baseArr, ...extraArr];
|
|
30
|
-
};
|
|
25
|
+
const mergeSx = require("../../mergeSx-Dbccoo_H.cjs");
|
|
26
|
+
const tokens = require("../../tokens-jaWWNk39.cjs");
|
|
31
27
|
const InputGroup = ({
|
|
32
28
|
children,
|
|
33
29
|
sx,
|
|
@@ -44,7 +40,7 @@ const InputGroup = ({
|
|
|
44
40
|
// Respeta el label "outside" de Input/Select: los hijos pierden su marginTop
|
|
45
41
|
// (ver más abajo) y el grupo reserva el mismo espacio arriba para que los
|
|
46
42
|
// labels floten por encima del borde del grupo.
|
|
47
|
-
marginTop:
|
|
43
|
+
marginTop: tokens.LABEL_MARGIN_TOP,
|
|
48
44
|
display: "flex",
|
|
49
45
|
flexDirection: isHorizontal ? "row" : "column",
|
|
50
46
|
alignItems: "stretch",
|
|
@@ -61,7 +57,7 @@ const InputGroup = ({
|
|
|
61
57
|
pointerEvents: disabled ? "none" : "auto",
|
|
62
58
|
// Cancelar el marginTop que Input/Select reservan en labelPosition="outside".
|
|
63
59
|
// El grupo ya lo reservó en su nivel externo.
|
|
64
|
-
"& .MuiFormControl-root, & >
|
|
60
|
+
"& .MuiFormControl-root, & > [data-input-group-slot] > .MuiTextField-root, & > [data-input-group-slot] > .MuiFormControl-root": {
|
|
65
61
|
marginTop: 0
|
|
66
62
|
},
|
|
67
63
|
// Quitar el borde del notched outline interno: el borde visible es el del
|
|
@@ -82,7 +78,7 @@ const InputGroup = ({
|
|
|
82
78
|
border: "none"
|
|
83
79
|
},
|
|
84
80
|
// Slots: cada hijo vive en un slot neutro que lo centra verticalmente.
|
|
85
|
-
"& >
|
|
81
|
+
"& > [data-input-group-slot]": __spreadProps(__spreadValues({
|
|
86
82
|
flex: 1,
|
|
87
83
|
display: "flex",
|
|
88
84
|
alignItems: "center",
|
|
@@ -94,7 +90,7 @@ const InputGroup = ({
|
|
|
94
90
|
}
|
|
95
91
|
}),
|
|
96
92
|
// Esquinas redondeadas: primer slot (izquierda o arriba).
|
|
97
|
-
"& >
|
|
93
|
+
"& > [data-input-group-slot]:first-of-type .MuiInputBase-root, & > [data-input-group-slot]:first-of-type .MuiButton-root, & > [data-input-group-slot]:first-of-type .MuiChip-root": isHorizontal ? {
|
|
98
94
|
borderTopLeftRadius: radius,
|
|
99
95
|
borderBottomLeftRadius: radius
|
|
100
96
|
} : {
|
|
@@ -102,7 +98,7 @@ const InputGroup = ({
|
|
|
102
98
|
borderTopRightRadius: radius
|
|
103
99
|
},
|
|
104
100
|
// Esquinas redondeadas: último slot (derecha o abajo).
|
|
105
|
-
"& >
|
|
101
|
+
"& > [data-input-group-slot]:last-of-type .MuiInputBase-root, & > [data-input-group-slot]:last-of-type .MuiButton-root, & > [data-input-group-slot]:last-of-type .MuiChip-root": isHorizontal ? {
|
|
106
102
|
borderTopRightRadius: radius,
|
|
107
103
|
borderBottomRightRadius: radius
|
|
108
104
|
} : {
|
|
@@ -122,18 +118,23 @@ const InputGroup = ({
|
|
|
122
118
|
"data-testid": "input-group",
|
|
123
119
|
className,
|
|
124
120
|
"aria-disabled": disabled ? "true" : void 0,
|
|
125
|
-
sx: mergeSx(baseSx, sx),
|
|
126
|
-
children: slots.map((child, i) =>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
121
|
+
sx: mergeSx.mergeSx(baseSx, sx),
|
|
122
|
+
children: slots.map((child, i) => {
|
|
123
|
+
var _a;
|
|
124
|
+
const slotKey = (_a = child.key) != null ? _a : i;
|
|
125
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
126
|
+
material.Box,
|
|
127
|
+
{
|
|
128
|
+
"data-input-group-slot": true,
|
|
129
|
+
sx: mergeSx.mergeSx(baseSlotSx, slotSx),
|
|
130
|
+
children: child
|
|
131
|
+
},
|
|
132
|
+
slotKey
|
|
133
|
+
);
|
|
134
|
+
})
|
|
135
135
|
}
|
|
136
136
|
);
|
|
137
137
|
};
|
|
138
138
|
exports.InputGroup = InputGroup;
|
|
139
|
+
exports.default = InputGroup;
|
|
139
140
|
//# sourceMappingURL=InputGroup.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputGroup.cjs","sources":["../../../src/components/InputGroup/InputGroup.tsx"],"sourcesContent":["import React, { Children, isValidElement } from 'react';\nimport { Box, type SxProps, type Theme } from '@mui/material';\n\nexport interface InputGroupProps {\n children: React.ReactNode;\n /**\n * sx aplicado al contenedor raíz del grupo. Se mergea sobre los defaults.\n */\n sx?: SxProps<Theme>;\n /**\n * sx aplicado a cada slot individual. Útil para controlar flex/gap entre\n * los hijos del grupo.\n */\n slotSx?: SxProps<Theme>;\n /**\n * Radio del borde del grupo. Default: 10.\n */\n borderRadius?: number | string;\n /**\n * Desactiva visualmente el grupo (no cascada lógica — los hijos deben\n * manejar su propio `disabled`).\n */\n disabled?: boolean;\n /**\n * Orientación del grupo. Default: 'horizontal'.\n */\n orientation?: 'horizontal' | 'vertical';\n className?: string;\n}\n\
|
|
1
|
+
{"version":3,"file":"InputGroup.cjs","sources":["../../../src/components/InputGroup/InputGroup.tsx"],"sourcesContent":["import React, { Children, isValidElement } from 'react';\nimport { Box, type SxProps, type Theme } from '@mui/material';\n\nimport { mergeSx } from '../_shared/mergeSx';\nimport { LABEL_MARGIN_TOP } from '../../theme/tokens';\n\nexport interface InputGroupProps {\n children: React.ReactNode;\n /**\n * sx aplicado al contenedor raíz del grupo. Se mergea sobre los defaults.\n */\n sx?: SxProps<Theme>;\n /**\n * sx aplicado a cada slot individual. Útil para controlar flex/gap entre\n * los hijos del grupo.\n */\n slotSx?: SxProps<Theme>;\n /**\n * Radio del borde del grupo. Default: 10.\n */\n borderRadius?: number | string;\n /**\n * Desactiva visualmente el grupo (no cascada lógica — los hijos deben\n * manejar su propio `disabled`).\n */\n disabled?: boolean;\n /**\n * Orientación del grupo. Default: 'horizontal'.\n */\n orientation?: 'horizontal' | 'vertical';\n className?: string;\n}\n\n/**\n * Agrupa visualmente varios componentes de entrada (Input / Select / DatePicker /\n * Button, etc.) compartiendo un solo borde y con separadores internos.\n *\n * El grupo respeta el espacio que Input/Select reservan para su label `outside`\n * (`LABEL_MARGIN_TOP`) moviendo ese reservado al contenedor externo y\n * cancelándolo en los hijos. Los labels siguen flotando por encima del borde\n * del grupo con la misma animación que fuera del grupo.\n *\n * No inspecciona el tipo de cada hijo; aplica los overrides a través de\n * descendant selectors por CSS para funcionar con cualquier wrapper / memoizado.\n */\nexport const InputGroup: React.FC<InputGroupProps> = ({\n children,\n sx,\n slotSx,\n borderRadius = 10,\n disabled,\n orientation = 'horizontal',\n className,\n}) => {\n const radius = typeof borderRadius === 'number' ? `${borderRadius}px` : borderRadius;\n const slots = Children.toArray(children).filter(isValidElement);\n const isHorizontal = orientation === 'horizontal';\n\n const baseSx: SxProps<Theme> = {\n // Respeta el label \"outside\" de Input/Select: los hijos pierden su marginTop\n // (ver más abajo) y el grupo reserva el mismo espacio arriba para que los\n // labels floten por encima del borde del grupo.\n marginTop: LABEL_MARGIN_TOP,\n\n display: 'flex',\n flexDirection: isHorizontal ? 'row' : 'column',\n alignItems: 'stretch',\n width: '100%',\n border: (theme) => `1px solid ${theme.palette.divider}`,\n borderRadius: radius,\n backgroundColor: 'background.paper',\n transition:\n 'border-color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms, box-shadow 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms',\n '&:focus-within': {\n borderColor: 'primary.main',\n boxShadow: (theme) => `0 0 0 1px ${theme.palette.primary.main}`,\n },\n opacity: disabled ? 0.6 : 1,\n pointerEvents: disabled ? 'none' : 'auto',\n\n // Cancelar el marginTop que Input/Select reservan en labelPosition=\"outside\".\n // El grupo ya lo reservó en su nivel externo.\n '& .MuiFormControl-root, & > [data-input-group-slot] > .MuiTextField-root, & > [data-input-group-slot] > .MuiFormControl-root':\n {\n marginTop: 0,\n },\n\n // Quitar el borde del notched outline interno: el borde visible es el del\n // grupo, los separadores son los borderRight/borderBottom de cada slot.\n '& .MuiOutlinedInput-notchedOutline': {\n border: 'none',\n },\n\n // Forzar que todos los campos pinten sus esquinas cuadradas (las esquinas\n // redondeadas se aplican solo al primer/último slot más abajo).\n '& .MuiInputBase-root, & .MuiChip-root': {\n borderRadius: 0,\n },\n\n // Botones integrados: sin radius propio, altura completa, sin sombra.\n '& .MuiButton-root': {\n borderRadius: 0,\n height: '100%',\n boxShadow: 'none',\n border: 'none',\n },\n\n // Slots: cada hijo vive en un slot neutro que lo centra verticalmente.\n '& > [data-input-group-slot]': {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n minWidth: 0,\n // Separador entre slots (horizontal: borderRight / vertical: borderBottom),\n // usando el color de divider del theme.\n ...(isHorizontal\n ? { borderRight: (theme: Theme) => `1px solid ${theme.palette.divider}` }\n : { borderBottom: (theme: Theme) => `1px solid ${theme.palette.divider}` }),\n '&:last-of-type': {\n borderRight: 'none',\n borderBottom: 'none',\n },\n },\n\n // Esquinas redondeadas: primer slot (izquierda o arriba).\n '& > [data-input-group-slot]:first-of-type .MuiInputBase-root, & > [data-input-group-slot]:first-of-type .MuiButton-root, & > [data-input-group-slot]:first-of-type .MuiChip-root':\n isHorizontal\n ? {\n borderTopLeftRadius: radius,\n borderBottomLeftRadius: radius,\n }\n : {\n borderTopLeftRadius: radius,\n borderTopRightRadius: radius,\n },\n\n // Esquinas redondeadas: último slot (derecha o abajo).\n '& > [data-input-group-slot]:last-of-type .MuiInputBase-root, & > [data-input-group-slot]:last-of-type .MuiButton-root, & > [data-input-group-slot]:last-of-type .MuiChip-root':\n isHorizontal\n ? {\n borderTopRightRadius: radius,\n borderBottomRightRadius: radius,\n }\n : {\n borderBottomLeftRadius: radius,\n borderBottomRightRadius: radius,\n },\n };\n\n const baseSlotSx: SxProps<Theme> = {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n minWidth: 0,\n };\n\n return (\n <Box\n data-testid=\"input-group\"\n className={className}\n aria-disabled={disabled ? 'true' : undefined}\n sx={mergeSx(baseSx, sx)}\n >\n {slots.map((child, i) => {\n const slotKey = (child as React.ReactElement).key ?? i;\n return (\n <Box\n key={slotKey}\n data-input-group-slot\n sx={mergeSx(baseSlotSx, slotSx)}\n >\n {child}\n </Box>\n );\n })}\n </Box>\n );\n};\n\nexport default InputGroup;\n"],"names":["Children","isValidElement","LABEL_MARGIN_TOP","jsx","Box","mergeSx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6CO,MAAM,aAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA,cAAc;AAAA,EACd;AACF,MAAM;AACJ,QAAM,SAAS,OAAO,iBAAiB,WAAW,GAAG,YAAY,OAAO;AACxE,QAAM,QAAQA,MAAAA,SAAS,QAAQ,QAAQ,EAAE,OAAOC,oBAAc;AAC9D,QAAM,eAAe,gBAAgB;AAErC,QAAM,SAAyB;AAAA;AAAA;AAAA;AAAA,IAI7B,WAAWC,OAAAA;AAAAA,IAEX,SAAS;AAAA,IACT,eAAe,eAAe,QAAQ;AAAA,IACtC,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,CAAC,UAAU,aAAa,MAAM,QAAQ,OAAO;AAAA,IACrD,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,YACE;AAAA,IACF,kBAAkB;AAAA,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MACZ;AAAA,MACA,iBAAe,WAAW,SAAS;AAAA,MACnC,IAAIC,QAAAA,QAAQ,QAAQ,EAAE;AAAA,MAErB,UAAA,MAAM,IAAI,CAAC,OAAO,MAAM;;AACvB,cAAM,WAAW,WAA6B,QAA7B,YAAoC;AACrD,eACEF,2BAAAA;AAAAA,UAACC,SAAAA;AAAAA,UAAA;AAAA,YAEC,yBAAqB;AAAA,YACrB,IAAIC,QAAAA,QAAQ,YAAY,MAAM;AAAA,YAE7B,UAAA;AAAA,UAAA;AAAA,UAJI;AAAA,QAAA;AAAA,MAOX,CAAC;AAAA,IAAA;AAAA,EAAA;AAGP;;;"}
|
|
@@ -31,12 +31,12 @@ export interface InputGroupProps {
|
|
|
31
31
|
* Button, etc.) compartiendo un solo borde y con separadores internos.
|
|
32
32
|
*
|
|
33
33
|
* El grupo respeta el espacio que Input/Select reservan para su label `outside`
|
|
34
|
-
* (
|
|
35
|
-
* en los hijos. Los labels siguen flotando por encima del borde
|
|
36
|
-
* la misma animación que fuera del grupo.
|
|
34
|
+
* (`LABEL_MARGIN_TOP`) moviendo ese reservado al contenedor externo y
|
|
35
|
+
* cancelándolo en los hijos. Los labels siguen flotando por encima del borde
|
|
36
|
+
* del grupo con la misma animación que fuera del grupo.
|
|
37
37
|
*
|
|
38
38
|
* No inspecciona el tipo de cada hijo; aplica los overrides a través de
|
|
39
39
|
* descendant selectors por CSS para funcionar con cualquier wrapper / memoizado.
|
|
40
40
|
*/
|
|
41
|
-
declare const InputGroup: React.FC<InputGroupProps>;
|
|
41
|
+
export declare const InputGroup: React.FC<InputGroupProps>;
|
|
42
42
|
export default InputGroup;
|
|
@@ -20,12 +20,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20
20
|
import { jsx } from "react/jsx-runtime";
|
|
21
21
|
import { Children, isValidElement } from "react";
|
|
22
22
|
import { Box } from "@mui/material";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const baseArr = Array.isArray(base) ? base : [base];
|
|
26
|
-
const extraArr = Array.isArray(extra) ? extra : [extra];
|
|
27
|
-
return [...baseArr, ...extraArr];
|
|
28
|
-
};
|
|
23
|
+
import { m as mergeSx } from "../../mergeSx-BXoNZjB_.js";
|
|
24
|
+
import { L as LABEL_MARGIN_TOP } from "../../tokens-BRrcP_p_.js";
|
|
29
25
|
const InputGroup = ({
|
|
30
26
|
children,
|
|
31
27
|
sx,
|
|
@@ -42,7 +38,7 @@ const InputGroup = ({
|
|
|
42
38
|
// Respeta el label "outside" de Input/Select: los hijos pierden su marginTop
|
|
43
39
|
// (ver más abajo) y el grupo reserva el mismo espacio arriba para que los
|
|
44
40
|
// labels floten por encima del borde del grupo.
|
|
45
|
-
marginTop:
|
|
41
|
+
marginTop: LABEL_MARGIN_TOP,
|
|
46
42
|
display: "flex",
|
|
47
43
|
flexDirection: isHorizontal ? "row" : "column",
|
|
48
44
|
alignItems: "stretch",
|
|
@@ -59,7 +55,7 @@ const InputGroup = ({
|
|
|
59
55
|
pointerEvents: disabled ? "none" : "auto",
|
|
60
56
|
// Cancelar el marginTop que Input/Select reservan en labelPosition="outside".
|
|
61
57
|
// El grupo ya lo reservó en su nivel externo.
|
|
62
|
-
"& .MuiFormControl-root, & >
|
|
58
|
+
"& .MuiFormControl-root, & > [data-input-group-slot] > .MuiTextField-root, & > [data-input-group-slot] > .MuiFormControl-root": {
|
|
63
59
|
marginTop: 0
|
|
64
60
|
},
|
|
65
61
|
// Quitar el borde del notched outline interno: el borde visible es el del
|
|
@@ -80,7 +76,7 @@ const InputGroup = ({
|
|
|
80
76
|
border: "none"
|
|
81
77
|
},
|
|
82
78
|
// Slots: cada hijo vive en un slot neutro que lo centra verticalmente.
|
|
83
|
-
"& >
|
|
79
|
+
"& > [data-input-group-slot]": __spreadProps(__spreadValues({
|
|
84
80
|
flex: 1,
|
|
85
81
|
display: "flex",
|
|
86
82
|
alignItems: "center",
|
|
@@ -92,7 +88,7 @@ const InputGroup = ({
|
|
|
92
88
|
}
|
|
93
89
|
}),
|
|
94
90
|
// Esquinas redondeadas: primer slot (izquierda o arriba).
|
|
95
|
-
"& >
|
|
91
|
+
"& > [data-input-group-slot]:first-of-type .MuiInputBase-root, & > [data-input-group-slot]:first-of-type .MuiButton-root, & > [data-input-group-slot]:first-of-type .MuiChip-root": isHorizontal ? {
|
|
96
92
|
borderTopLeftRadius: radius,
|
|
97
93
|
borderBottomLeftRadius: radius
|
|
98
94
|
} : {
|
|
@@ -100,7 +96,7 @@ const InputGroup = ({
|
|
|
100
96
|
borderTopRightRadius: radius
|
|
101
97
|
},
|
|
102
98
|
// Esquinas redondeadas: último slot (derecha o abajo).
|
|
103
|
-
"& >
|
|
99
|
+
"& > [data-input-group-slot]:last-of-type .MuiInputBase-root, & > [data-input-group-slot]:last-of-type .MuiButton-root, & > [data-input-group-slot]:last-of-type .MuiChip-root": isHorizontal ? {
|
|
104
100
|
borderTopRightRadius: radius,
|
|
105
101
|
borderBottomRightRadius: radius
|
|
106
102
|
} : {
|
|
@@ -121,19 +117,24 @@ const InputGroup = ({
|
|
|
121
117
|
className,
|
|
122
118
|
"aria-disabled": disabled ? "true" : void 0,
|
|
123
119
|
sx: mergeSx(baseSx, sx),
|
|
124
|
-
children: slots.map((child, i) =>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
120
|
+
children: slots.map((child, i) => {
|
|
121
|
+
var _a;
|
|
122
|
+
const slotKey = (_a = child.key) != null ? _a : i;
|
|
123
|
+
return /* @__PURE__ */ jsx(
|
|
124
|
+
Box,
|
|
125
|
+
{
|
|
126
|
+
"data-input-group-slot": true,
|
|
127
|
+
sx: mergeSx(baseSlotSx, slotSx),
|
|
128
|
+
children: child
|
|
129
|
+
},
|
|
130
|
+
slotKey
|
|
131
|
+
);
|
|
132
|
+
})
|
|
133
133
|
}
|
|
134
134
|
);
|
|
135
135
|
};
|
|
136
136
|
export {
|
|
137
|
-
InputGroup
|
|
137
|
+
InputGroup,
|
|
138
|
+
InputGroup as default
|
|
138
139
|
};
|
|
139
140
|
//# sourceMappingURL=InputGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputGroup.js","sources":["../../../src/components/InputGroup/InputGroup.tsx"],"sourcesContent":["import React, { Children, isValidElement } from 'react';\nimport { Box, type SxProps, type Theme } from '@mui/material';\n\nexport interface InputGroupProps {\n children: React.ReactNode;\n /**\n * sx aplicado al contenedor raíz del grupo. Se mergea sobre los defaults.\n */\n sx?: SxProps<Theme>;\n /**\n * sx aplicado a cada slot individual. Útil para controlar flex/gap entre\n * los hijos del grupo.\n */\n slotSx?: SxProps<Theme>;\n /**\n * Radio del borde del grupo. Default: 10.\n */\n borderRadius?: number | string;\n /**\n * Desactiva visualmente el grupo (no cascada lógica — los hijos deben\n * manejar su propio `disabled`).\n */\n disabled?: boolean;\n /**\n * Orientación del grupo. Default: 'horizontal'.\n */\n orientation?: 'horizontal' | 'vertical';\n className?: string;\n}\n\
|
|
1
|
+
{"version":3,"file":"InputGroup.js","sources":["../../../src/components/InputGroup/InputGroup.tsx"],"sourcesContent":["import React, { Children, isValidElement } from 'react';\nimport { Box, type SxProps, type Theme } from '@mui/material';\n\nimport { mergeSx } from '../_shared/mergeSx';\nimport { LABEL_MARGIN_TOP } from '../../theme/tokens';\n\nexport interface InputGroupProps {\n children: React.ReactNode;\n /**\n * sx aplicado al contenedor raíz del grupo. Se mergea sobre los defaults.\n */\n sx?: SxProps<Theme>;\n /**\n * sx aplicado a cada slot individual. Útil para controlar flex/gap entre\n * los hijos del grupo.\n */\n slotSx?: SxProps<Theme>;\n /**\n * Radio del borde del grupo. Default: 10.\n */\n borderRadius?: number | string;\n /**\n * Desactiva visualmente el grupo (no cascada lógica — los hijos deben\n * manejar su propio `disabled`).\n */\n disabled?: boolean;\n /**\n * Orientación del grupo. Default: 'horizontal'.\n */\n orientation?: 'horizontal' | 'vertical';\n className?: string;\n}\n\n/**\n * Agrupa visualmente varios componentes de entrada (Input / Select / DatePicker /\n * Button, etc.) compartiendo un solo borde y con separadores internos.\n *\n * El grupo respeta el espacio que Input/Select reservan para su label `outside`\n * (`LABEL_MARGIN_TOP`) moviendo ese reservado al contenedor externo y\n * cancelándolo en los hijos. Los labels siguen flotando por encima del borde\n * del grupo con la misma animación que fuera del grupo.\n *\n * No inspecciona el tipo de cada hijo; aplica los overrides a través de\n * descendant selectors por CSS para funcionar con cualquier wrapper / memoizado.\n */\nexport const InputGroup: React.FC<InputGroupProps> = ({\n children,\n sx,\n slotSx,\n borderRadius = 10,\n disabled,\n orientation = 'horizontal',\n className,\n}) => {\n const radius = typeof borderRadius === 'number' ? `${borderRadius}px` : borderRadius;\n const slots = Children.toArray(children).filter(isValidElement);\n const isHorizontal = orientation === 'horizontal';\n\n const baseSx: SxProps<Theme> = {\n // Respeta el label \"outside\" de Input/Select: los hijos pierden su marginTop\n // (ver más abajo) y el grupo reserva el mismo espacio arriba para que los\n // labels floten por encima del borde del grupo.\n marginTop: LABEL_MARGIN_TOP,\n\n display: 'flex',\n flexDirection: isHorizontal ? 'row' : 'column',\n alignItems: 'stretch',\n width: '100%',\n border: (theme) => `1px solid ${theme.palette.divider}`,\n borderRadius: radius,\n backgroundColor: 'background.paper',\n transition:\n 'border-color 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms, box-shadow 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms',\n '&:focus-within': {\n borderColor: 'primary.main',\n boxShadow: (theme) => `0 0 0 1px ${theme.palette.primary.main}`,\n },\n opacity: disabled ? 0.6 : 1,\n pointerEvents: disabled ? 'none' : 'auto',\n\n // Cancelar el marginTop que Input/Select reservan en labelPosition=\"outside\".\n // El grupo ya lo reservó en su nivel externo.\n '& .MuiFormControl-root, & > [data-input-group-slot] > .MuiTextField-root, & > [data-input-group-slot] > .MuiFormControl-root':\n {\n marginTop: 0,\n },\n\n // Quitar el borde del notched outline interno: el borde visible es el del\n // grupo, los separadores son los borderRight/borderBottom de cada slot.\n '& .MuiOutlinedInput-notchedOutline': {\n border: 'none',\n },\n\n // Forzar que todos los campos pinten sus esquinas cuadradas (las esquinas\n // redondeadas se aplican solo al primer/último slot más abajo).\n '& .MuiInputBase-root, & .MuiChip-root': {\n borderRadius: 0,\n },\n\n // Botones integrados: sin radius propio, altura completa, sin sombra.\n '& .MuiButton-root': {\n borderRadius: 0,\n height: '100%',\n boxShadow: 'none',\n border: 'none',\n },\n\n // Slots: cada hijo vive en un slot neutro que lo centra verticalmente.\n '& > [data-input-group-slot]': {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n minWidth: 0,\n // Separador entre slots (horizontal: borderRight / vertical: borderBottom),\n // usando el color de divider del theme.\n ...(isHorizontal\n ? { borderRight: (theme: Theme) => `1px solid ${theme.palette.divider}` }\n : { borderBottom: (theme: Theme) => `1px solid ${theme.palette.divider}` }),\n '&:last-of-type': {\n borderRight: 'none',\n borderBottom: 'none',\n },\n },\n\n // Esquinas redondeadas: primer slot (izquierda o arriba).\n '& > [data-input-group-slot]:first-of-type .MuiInputBase-root, & > [data-input-group-slot]:first-of-type .MuiButton-root, & > [data-input-group-slot]:first-of-type .MuiChip-root':\n isHorizontal\n ? {\n borderTopLeftRadius: radius,\n borderBottomLeftRadius: radius,\n }\n : {\n borderTopLeftRadius: radius,\n borderTopRightRadius: radius,\n },\n\n // Esquinas redondeadas: último slot (derecha o abajo).\n '& > [data-input-group-slot]:last-of-type .MuiInputBase-root, & > [data-input-group-slot]:last-of-type .MuiButton-root, & > [data-input-group-slot]:last-of-type .MuiChip-root':\n isHorizontal\n ? {\n borderTopRightRadius: radius,\n borderBottomRightRadius: radius,\n }\n : {\n borderBottomLeftRadius: radius,\n borderBottomRightRadius: radius,\n },\n };\n\n const baseSlotSx: SxProps<Theme> = {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n minWidth: 0,\n };\n\n return (\n <Box\n data-testid=\"input-group\"\n className={className}\n aria-disabled={disabled ? 'true' : undefined}\n sx={mergeSx(baseSx, sx)}\n >\n {slots.map((child, i) => {\n const slotKey = (child as React.ReactElement).key ?? i;\n return (\n <Box\n key={slotKey}\n data-input-group-slot\n sx={mergeSx(baseSlotSx, slotSx)}\n >\n {child}\n </Box>\n );\n })}\n </Box>\n );\n};\n\nexport default InputGroup;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6CO,MAAM,aAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA,cAAc;AAAA,EACd;AACF,MAAM;AACJ,QAAM,SAAS,OAAO,iBAAiB,WAAW,GAAG,YAAY,OAAO;AACxE,QAAM,QAAQ,SAAS,QAAQ,QAAQ,EAAE,OAAO,cAAc;AAC9D,QAAM,eAAe,gBAAgB;AAErC,QAAM,SAAyB;AAAA;AAAA;AAAA;AAAA,IAI7B,WAAW;AAAA,IAEX,SAAS;AAAA,IACT,eAAe,eAAe,QAAQ;AAAA,IACtC,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,CAAC,UAAU,aAAa,MAAM,QAAQ,OAAO;AAAA,IACrD,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,YACE;AAAA,IACF,kBAAkB;AAAA,MAChB,aAAa;AAAA,MACb,WAAW,CAAC,UAAU,aAAa,MAAM,QAAQ,QAAQ,IAAI;AAAA,IAAA;AAAA,IAE/D,SAAS,WAAW,MAAM;AAAA,IAC1B,eAAe,WAAW,SAAS;AAAA;AAAA;AAAA,IAInC,gIACE;AAAA,MACE,WAAW;AAAA,IAAA;AAAA;AAAA;AAAA,IAKf,sCAAsC;AAAA,MACpC,QAAQ;AAAA,IAAA;AAAA;AAAA;AAAA,IAKV,yCAAyC;AAAA,MACvC,cAAc;AAAA,IAAA;AAAA;AAAA,IAIhB,qBAAqB;AAAA,MACnB,cAAc;AAAA,MACd,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,QAAQ;A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type { InputGroupProps } from './InputGroup';
|