@soyfri/shared-library 1.5.0 → 2.0.0-beta.0
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/dist/components/ActionMenu/ActionMenu.cjs +107 -0
- package/dist/components/ActionMenu/ActionMenu.cjs.map +1 -0
- package/dist/components/ActionMenu/ActionMenu.d.ts +60 -0
- package/dist/components/ActionMenu/ActionMenu.js +107 -0
- package/dist/components/ActionMenu/ActionMenu.js.map +1 -0
- package/dist/components/ActionMenu/index.d.ts +2 -0
- package/dist/components/ActionMenu.d.ts +6 -0
- package/dist/components/AppBar/AppBar.cjs +346 -0
- package/dist/components/AppBar/AppBar.cjs.map +1 -0
- package/dist/components/AppBar/AppBar.d.ts +55 -0
- package/dist/components/AppBar/AppBar.js +346 -0
- package/dist/components/AppBar/AppBar.js.map +1 -0
- package/dist/components/AppBar/AppBar.sx.d.ts +12 -0
- package/dist/components/AppBar/AppBarBrand.d.ts +31 -0
- package/dist/components/AppBar/AppBarContext.d.ts +18 -0
- package/dist/components/AppBar/AppBarMenuToggle.d.ts +39 -0
- package/dist/components/AppBar/AppBarUserMenu.d.ts +65 -0
- package/dist/components/AppBar/index.d.ts +12 -0
- package/dist/components/AppBar.d.ts +6 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +259 -54
- package/dist/components/Autocomplete/Autocomplete.cjs.map +1 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +64 -9
- package/dist/components/Autocomplete/Autocomplete.definitions.d.ts +6 -0
- package/dist/components/Autocomplete/Autocomplete.helpers.d.ts +18 -0
- package/dist/components/Autocomplete/Autocomplete.js +261 -56
- package/dist/components/Autocomplete/Autocomplete.js.map +1 -1
- package/dist/components/Autocomplete/Autocomplete.sx.d.ts +7 -0
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +1 -0
- package/dist/components/Autocomplete/_parts/AutocompleteChips.d.ts +19 -0
- package/dist/components/Autocomplete/_parts/AutocompleteLoader.d.ts +9 -0
- package/dist/components/Autocomplete/_parts/AutocompleteOption.d.ts +19 -0
- package/dist/components/Autocomplete/index.d.ts +2 -1
- package/dist/components/Autocomplete.d.ts +4 -0
- package/dist/components/Avatar/Avatar.cjs +116 -79
- package/dist/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts +16 -2
- package/dist/components/Avatar/Avatar.definitions.d.ts +11 -0
- package/dist/components/Avatar/Avatar.js +117 -80
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Card/Card.cjs +168 -9
- package/dist/components/Card/Card.cjs.map +1 -1
- package/dist/components/Card/Card.d.ts +78 -8
- package/dist/components/Card/Card.js +170 -11
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Card/Card.sx.d.ts +17 -0
- package/dist/components/Card/index.d.ts +4 -1
- package/dist/components/Card.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.cjs +201 -3
- package/dist/components/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +47 -9
- package/dist/components/DatePicker/DatePicker.definitions.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.helpers.d.ts +7 -0
- package/dist/components/DatePicker/DatePicker.js +200 -2
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.sx.d.ts +9 -0
- package/dist/components/DatePicker/DatePicker.types.d.ts +1 -0
- package/dist/components/DatePicker/index.d.ts +2 -1
- package/dist/components/DatePicker.d.ts +4 -0
- package/dist/components/DateTimePicker/DateTimePicker.cjs +152 -138
- package/dist/components/DateTimePicker/DateTimePicker.cjs.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +46 -9
- package/dist/components/DateTimePicker/DateTimePicker.definitions.d.ts +1 -0
- package/dist/components/DateTimePicker/DateTimePicker.helpers.d.ts +11 -0
- package/dist/components/DateTimePicker/DateTimePicker.js +152 -138
- package/dist/components/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.sx.d.ts +7 -0
- package/dist/components/DateTimePicker/DateTimePicker.types.d.ts +1 -0
- package/dist/components/DateTimePicker/index.d.ts +2 -1
- package/dist/components/DateTimePicker.d.ts +4 -0
- package/dist/components/Drawer/Drawer.cjs +271 -0
- package/dist/components/Drawer/Drawer.cjs.map +1 -0
- package/dist/components/Drawer/Drawer.d.ts +51 -0
- package/dist/components/Drawer/Drawer.js +271 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/Drawer/Drawer.sx.d.ts +23 -0
- package/dist/components/Drawer/DrawerContext.d.ts +18 -0
- package/dist/components/Drawer/DrawerItem.d.ts +35 -0
- package/dist/components/Drawer/index.d.ts +6 -0
- package/dist/components/Drawer.d.ts +6 -0
- package/dist/components/Icon/Icon.cjs +44 -3
- package/dist/components/Icon/Icon.cjs.map +1 -1
- package/dist/components/Icon/Icon.d.ts +34 -1
- package/dist/components/Icon/Icon.js +44 -3
- package/dist/components/Icon/Icon.js.map +1 -1
- package/dist/components/Input/Input.cjs +173 -3
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.d.ts +20 -15
- package/dist/components/Input/Input.definitions.d.ts +5 -2
- package/dist/components/Input/Input.helpers.d.ts +14 -0
- package/dist/components/Input/Input.js +172 -2
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/Input.sx.d.ts +8 -0
- package/dist/components/Input/Input.types.d.ts +1 -0
- package/dist/components/Input/index.d.ts +2 -1
- package/dist/components/Input.d.ts +4 -0
- package/dist/components/InputGroup/InputGroup.cjs +104 -91
- package/dist/components/InputGroup/InputGroup.cjs.map +1 -1
- package/dist/components/InputGroup/InputGroup.d.ts +37 -1
- package/dist/components/InputGroup/InputGroup.definitions.d.ts +6 -0
- package/dist/components/InputGroup/InputGroup.js +106 -93
- package/dist/components/InputGroup/InputGroup.js.map +1 -1
- package/dist/components/Modal/Modal.cjs +226 -116
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.d.ts +38 -2
- package/dist/components/Modal/Modal.js +227 -117
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/ModalFooter.d.ts +9 -1
- package/dist/components/Modal/index.d.ts +5 -0
- package/dist/components/PageLoader/PageLoader.cjs +61 -0
- package/dist/components/PageLoader/PageLoader.cjs.map +1 -0
- package/dist/components/PageLoader/PageLoader.d.ts +38 -0
- package/dist/components/PageLoader/PageLoader.js +61 -0
- package/dist/components/PageLoader/PageLoader.js.map +1 -0
- package/dist/components/PageLoader/index.d.ts +2 -0
- package/dist/components/PageLoader.d.ts +6 -0
- package/dist/components/ScrollTopButton/ScrollTopButton.cjs +79 -0
- package/dist/components/ScrollTopButton/ScrollTopButton.cjs.map +1 -0
- package/dist/components/ScrollTopButton/ScrollTopButton.d.ts +48 -0
- package/dist/components/ScrollTopButton/ScrollTopButton.js +79 -0
- package/dist/components/ScrollTopButton/ScrollTopButton.js.map +1 -0
- package/dist/components/ScrollTopButton/index.d.ts +4 -0
- package/dist/components/ScrollTopButton/scrollToTop.d.ts +29 -0
- package/dist/components/ScrollTopButton.d.ts +6 -0
- package/dist/components/Select/Select.cjs +446 -4
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.d.ts +33 -13
- package/dist/components/Select/Select.definitions.d.ts +3 -0
- package/dist/components/Select/Select.helpers.d.ts +28 -0
- package/dist/components/Select/Select.js +445 -3
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/Select.sx.d.ts +7 -0
- package/dist/components/Select/Select.types.d.ts +1 -0
- package/dist/components/Select/_parts/SelectMenuItem.d.ts +20 -0
- package/dist/components/Select/_parts/SelectSearchHeader.d.ts +15 -0
- package/dist/components/Select/_parts/SelectValue.d.ts +22 -0
- package/dist/components/Select/index.d.ts +2 -1
- package/dist/components/Select.d.ts +4 -0
- package/dist/components/Stat/Stat.cjs +1 -1
- package/dist/components/Stat/Stat.js +1 -1
- package/dist/components/Stepper/Stepper.cjs +4 -1
- package/dist/components/Stepper/Stepper.cjs.map +1 -1
- package/dist/components/Stepper/Stepper.d.ts +5 -0
- package/dist/components/Stepper/Stepper.js +4 -1
- package/dist/components/Stepper/Stepper.js.map +1 -1
- package/dist/components/_shared/formField.sx.d.ts +33 -0
- package/dist/components/_shared/resolvePreset.d.ts +18 -0
- package/dist/formField.sx-CQ1mbk9M.cjs +76 -0
- package/dist/formField.sx-CQ1mbk9M.cjs.map +1 -0
- package/dist/formField.sx-DfVbMe0V.js +77 -0
- package/dist/formField.sx-DfVbMe0V.js.map +1 -0
- package/dist/hooks/Wizard/Wizard.cjs +7 -0
- package/dist/hooks/Wizard/Wizard.cjs.map +1 -0
- package/dist/hooks/Wizard/Wizard.js +7 -0
- package/dist/hooks/Wizard/Wizard.js.map +1 -0
- package/dist/hooks/Wizard/WizardContext.d.ts +67 -0
- package/dist/hooks/Wizard/index.d.ts +3 -0
- package/dist/hooks/Wizard/useWizard.d.ts +9 -0
- package/dist/hooks/Wizard.d.ts +2 -0
- package/dist/index.cjs +99 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +31 -2
- package/dist/index.js.map +1 -1
- package/dist/mui.d.ts +5 -0
- package/dist/resolvePreset-B-IB0ehH.js +15 -0
- package/dist/resolvePreset-B-IB0ehH.js.map +1 -0
- package/dist/resolvePreset-CT3kU-K2.cjs +14 -0
- package/dist/resolvePreset-CT3kU-K2.cjs.map +1 -0
- package/dist/styles.css +3 -112
- package/dist/theme/componentStyles.d.ts +32 -0
- package/dist/theme/tokens.d.ts +28 -0
- package/dist/useWizard-CWdIxZzX.cjs +94 -0
- package/dist/useWizard-CWdIxZzX.cjs.map +1 -0
- package/dist/useWizard-CWq--C3o.js +95 -0
- package/dist/useWizard-CWq--C3o.js.map +1 -0
- package/package.json +1 -1
- package/src/components/ActionMenu/ActionMenu.stories.tsx +230 -0
- package/src/components/ActionMenu/ActionMenu.tsx +174 -0
- package/src/components/ActionMenu/index.ts +2 -0
- package/src/components/AppBar/AppBar.stories.tsx +272 -0
- package/src/components/AppBar/AppBar.sx.ts +32 -0
- package/src/components/AppBar/AppBar.tsx +123 -0
- package/src/components/AppBar/AppBarBrand.tsx +120 -0
- package/src/components/AppBar/AppBarContext.ts +25 -0
- package/src/components/AppBar/AppBarMenuToggle.tsx +90 -0
- package/src/components/AppBar/AppBarUserMenu.tsx +217 -0
- package/src/components/AppBar/index.ts +25 -0
- package/src/components/Autocomplete/Autocomplete.definitions.ts +223 -0
- package/src/components/Autocomplete/Autocomplete.helpers.ts +60 -0
- package/src/components/Autocomplete/Autocomplete.stories.tsx +363 -2
- package/src/components/Autocomplete/Autocomplete.sx.ts +30 -0
- package/src/components/Autocomplete/Autocomplete.tsx +312 -90
- package/src/components/Autocomplete/Autocomplete.types.ts +13 -0
- package/src/components/Autocomplete/_parts/AutocompleteChips.tsx +55 -0
- package/src/components/Autocomplete/_parts/AutocompleteLoader.tsx +17 -0
- package/src/components/Autocomplete/_parts/AutocompleteOption.tsx +31 -0
- package/src/components/Autocomplete/index.ts +12 -1
- package/src/components/Avatar/Avatar.definitions.ts +162 -0
- package/src/components/Avatar/Avatar.stories.tsx +205 -1
- package/src/components/Avatar/Avatar.tsx +166 -103
- package/src/components/Card/Card.stories.tsx +205 -16
- package/src/components/Card/Card.sx.ts +104 -0
- package/src/components/Card/Card.tsx +191 -35
- package/src/components/Card/index.ts +9 -1
- package/src/components/DatePicker/DatePicker.definitions.ts +24 -1
- package/src/components/DatePicker/DatePicker.helpers.ts +24 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +29 -2
- package/src/components/DatePicker/DatePicker.sx.ts +33 -0
- package/src/components/DatePicker/DatePicker.tsx +163 -139
- package/src/components/DatePicker/DatePicker.types.ts +10 -0
- package/src/components/DatePicker/index.ts +9 -1
- package/src/components/DateTimePicker/DateTimePicker.definitions.ts +24 -0
- package/src/components/DateTimePicker/DateTimePicker.helpers.ts +38 -0
- package/src/components/DateTimePicker/DateTimePicker.stories.tsx +29 -1
- package/src/components/DateTimePicker/DateTimePicker.sx.ts +30 -0
- package/src/components/DateTimePicker/DateTimePicker.tsx +200 -166
- package/src/components/DateTimePicker/DateTimePicker.types.ts +10 -0
- package/src/components/DateTimePicker/index.ts +9 -1
- package/src/components/Drawer/Drawer.stories.tsx +270 -0
- package/src/components/Drawer/Drawer.sx.ts +106 -0
- package/src/components/Drawer/Drawer.tsx +214 -0
- package/src/components/Drawer/DrawerContext.ts +26 -0
- package/src/components/Drawer/DrawerItem.tsx +110 -0
- package/src/components/Drawer/index.ts +10 -0
- package/src/components/Flyout/Flyout.stories.tsx +26 -18
- package/src/components/Icon/Icon.stories.tsx +68 -1
- package/src/components/Icon/Icon.tsx +87 -6
- package/src/components/Input/Input.definitions.ts +74 -2
- package/src/components/Input/Input.helpers.ts +49 -0
- package/src/components/Input/Input.stories.tsx +116 -4
- package/src/components/Input/Input.sx.ts +42 -0
- package/src/components/Input/Input.tsx +117 -162
- package/src/components/Input/Input.types.ts +10 -0
- package/src/components/Input/index.ts +9 -1
- package/src/components/InputGroup/InputGroup.definitions.ts +158 -0
- package/src/components/InputGroup/InputGroup.stories.tsx +159 -28
- package/src/components/InputGroup/InputGroup.tsx +159 -116
- package/src/components/Modal/Modal.stories.tsx +434 -6
- package/src/components/Modal/Modal.tsx +303 -121
- package/src/components/Modal/ModalFooter.tsx +22 -12
- package/src/components/Modal/index.ts +6 -1
- package/src/components/PageLoader/PageLoader.stories.tsx +217 -0
- package/src/components/PageLoader/PageLoader.tsx +96 -0
- package/src/components/PageLoader/index.ts +2 -0
- package/src/components/ScrollTopButton/ScrollTopButton.stories.tsx +158 -0
- package/src/components/ScrollTopButton/ScrollTopButton.tsx +135 -0
- package/src/components/ScrollTopButton/index.ts +8 -0
- package/src/components/ScrollTopButton/scrollToTop.ts +37 -0
- package/src/components/Select/Select.definitions.ts +114 -0
- package/src/components/Select/Select.helpers.ts +71 -0
- package/src/components/Select/Select.stories.tsx +126 -8
- package/src/components/Select/Select.sx.ts +14 -0
- package/src/components/Select/Select.tsx +246 -285
- package/src/components/Select/Select.types.ts +15 -0
- package/src/components/Select/_parts/SelectMenuItem.tsx +40 -0
- package/src/components/Select/_parts/SelectSearchHeader.tsx +51 -0
- package/src/components/Select/_parts/SelectValue.tsx +96 -0
- package/src/components/Select/index.ts +14 -1
- package/src/components/Stepper/Stepper.tsx +17 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +15 -3
- package/src/components/_shared/formField.sx.ts +118 -0
- package/src/components/_shared/resolvePreset.ts +35 -0
- package/src/hooks/Wizard/Wizard.stories.tsx +301 -0
- package/src/hooks/Wizard/WizardContext.tsx +166 -0
- package/src/hooks/Wizard/index.ts +6 -0
- package/src/hooks/Wizard/useWizard.ts +13 -0
- package/src/index.ts +17 -1
- package/src/mui.ts +44 -0
- package/src/theme/componentStyles.ts +47 -0
- package/src/theme/tokens.ts +43 -0
- package/dist/DatePicker-BSNboVhN.js +0 -201
- package/dist/DatePicker-BSNboVhN.js.map +0 -1
- package/dist/DatePicker-BoqxWAhj.cjs +0 -200
- package/dist/DatePicker-BoqxWAhj.cjs.map +0 -1
- package/dist/Input-DFHs7cJ_.js +0 -171
- package/dist/Input-DFHs7cJ_.js.map +0 -1
- package/dist/Input-c8MwNNPg.cjs +0 -170
- package/dist/Input-c8MwNNPg.cjs.map +0 -1
- package/dist/Select-BO2N56sm.cjs +0 -411
- package/dist/Select-BO2N56sm.cjs.map +0 -1
- package/dist/Select-BcLkyHSE.js +0 -412
- package/dist/Select-BcLkyHSE.js.map +0 -1
- package/dist/index.css +0 -3
|
@@ -21,6 +21,9 @@ import {
|
|
|
21
21
|
InputVariantsDefinition,
|
|
22
22
|
InputSizesDefinition,
|
|
23
23
|
FullWidthInputDefinition,
|
|
24
|
+
LabelPositionFloatingDefinition,
|
|
25
|
+
CustomBorderRadiusDefinition,
|
|
26
|
+
CustomStylingDefinition,
|
|
24
27
|
} from './Input.definitions';
|
|
25
28
|
|
|
26
29
|
// =============================================================================
|
|
@@ -63,7 +66,18 @@ const meta: Meta<typeof Input> = {
|
|
|
63
66
|
control: 'radio',
|
|
64
67
|
options: ['small', 'medium'],
|
|
65
68
|
description: 'El tamaño del campo de entrada.',
|
|
66
|
-
defaultValue: '
|
|
69
|
+
defaultValue: 'small',
|
|
70
|
+
},
|
|
71
|
+
labelPosition: {
|
|
72
|
+
control: 'radio',
|
|
73
|
+
options: ['outside', 'floating'],
|
|
74
|
+
description: '"outside" (default): label arriba del input. "floating": label clásico de MUI dentro del notched outline.',
|
|
75
|
+
defaultValue: 'outside',
|
|
76
|
+
},
|
|
77
|
+
borderRadius: {
|
|
78
|
+
control: { type: 'number' },
|
|
79
|
+
description: 'Border radius del input en px (o string CSS). Default: 10.',
|
|
80
|
+
defaultValue: 10,
|
|
67
81
|
},
|
|
68
82
|
fullWidth: { control: 'boolean', description: 'Si es verdadero, el campo de entrada ocupará todo el ancho disponible.', defaultValue: false },
|
|
69
83
|
},
|
|
@@ -362,13 +376,13 @@ export const FullWidthInput: Story = {
|
|
|
362
376
|
}
|
|
363
377
|
};
|
|
364
378
|
|
|
365
|
-
export const StandardVariant
|
|
379
|
+
export const StandardVariant: Story = {
|
|
366
380
|
render: () => {
|
|
367
381
|
const [value, setValue] = useState('Ocupa todo el ancho');
|
|
368
382
|
return (
|
|
369
383
|
<Box sx={{ width: '100%' }}>
|
|
370
384
|
<Input
|
|
371
|
-
|
|
385
|
+
|
|
372
386
|
value={value.toString()}
|
|
373
387
|
variant='standard'
|
|
374
388
|
onChange={(value) => setValue(value.toString())}
|
|
@@ -382,6 +396,104 @@ export const StandardVariant : Story = {
|
|
|
382
396
|
docs: {
|
|
383
397
|
story: "Un campo de entrada que ocupa todo el ancho disponible de su contenedor."
|
|
384
398
|
},
|
|
385
|
-
|
|
399
|
+
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
export const LabelPositionFloating: Story = {
|
|
404
|
+
render: () => {
|
|
405
|
+
const [valueOutside, setValueOutside] = useState('Outside (default)');
|
|
406
|
+
const [valueFloating, setValueFloating] = useState('Floating');
|
|
407
|
+
return (
|
|
408
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, width: 300 }}>
|
|
409
|
+
<Input
|
|
410
|
+
label="Label outside"
|
|
411
|
+
value={valueOutside.toString()}
|
|
412
|
+
onChange={(value) => setValueOutside(value.toString())}
|
|
413
|
+
labelPosition="outside"
|
|
414
|
+
/>
|
|
415
|
+
<Input
|
|
416
|
+
label="Label floating (MUI clásico)"
|
|
417
|
+
value={valueFloating.toString()}
|
|
418
|
+
onChange={(value) => setValueFloating(value.toString())}
|
|
419
|
+
labelPosition="floating"
|
|
420
|
+
/>
|
|
421
|
+
</Box>
|
|
422
|
+
);
|
|
423
|
+
},
|
|
424
|
+
parameters: {
|
|
425
|
+
docs: {
|
|
426
|
+
description: {
|
|
427
|
+
story: "Compara `labelPosition='outside'` (default, label arriba del input) vs `labelPosition='floating'` (label flotante clásico de MUI dentro del notched outline)."
|
|
428
|
+
},
|
|
429
|
+
source: { code: LabelPositionFloatingDefinition.trim() }
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
export const CustomBorderRadius: Story = {
|
|
435
|
+
render: () => {
|
|
436
|
+
const [v0, setV0] = useState('Sin radius');
|
|
437
|
+
const [v4, setV4] = useState('Radius 4px');
|
|
438
|
+
const [v10, setV10] = useState('Radius 10px (default)');
|
|
439
|
+
const [v24, setV24] = useState('Radius 24px (pill)');
|
|
440
|
+
return (
|
|
441
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, width: 300 }}>
|
|
442
|
+
<Input label="borderRadius={0}" value={v0} onChange={(v) => setV0(v.toString())} borderRadius={0} />
|
|
443
|
+
<Input label="borderRadius={4}" value={v4} onChange={(v) => setV4(v.toString())} borderRadius={4} />
|
|
444
|
+
<Input label="borderRadius={10} (default)" value={v10} onChange={(v) => setV10(v.toString())} />
|
|
445
|
+
<Input label="borderRadius={24}" value={v24} onChange={(v) => setV24(v.toString())} borderRadius={24} />
|
|
446
|
+
</Box>
|
|
447
|
+
);
|
|
448
|
+
},
|
|
449
|
+
parameters: {
|
|
450
|
+
docs: {
|
|
451
|
+
description: {
|
|
452
|
+
story: "El prop `borderRadius` acepta un número (px) o un string CSS. Override directo del default `10`."
|
|
453
|
+
},
|
|
454
|
+
source: { code: CustomBorderRadiusDefinition.trim() }
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
export const CustomStyling: Story = {
|
|
460
|
+
render: () => {
|
|
461
|
+
const [bg, setBg] = useState('Fondo gris claro');
|
|
462
|
+
const [color, setColor] = useState('Borde rojo');
|
|
463
|
+
const [combined, setCombined] = useState('Custom completo');
|
|
464
|
+
return (
|
|
465
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, width: 300 }}>
|
|
466
|
+
<Input
|
|
467
|
+
label="Override de background"
|
|
468
|
+
value={bg}
|
|
469
|
+
onChange={(v) => setBg(v.toString())}
|
|
470
|
+
sx={{ '& .MuiOutlinedInput-root': { bgcolor: '#f5f5f5' } }}
|
|
471
|
+
/>
|
|
472
|
+
<Input
|
|
473
|
+
label="Override de borderColor"
|
|
474
|
+
value={color}
|
|
475
|
+
onChange={(v) => setColor(v.toString())}
|
|
476
|
+
sx={{ '& .MuiOutlinedInput-notchedOutline': { borderColor: 'red' } }}
|
|
477
|
+
/>
|
|
478
|
+
<Input
|
|
479
|
+
label="Combinado: bg + borderColor + label color"
|
|
480
|
+
value={combined}
|
|
481
|
+
onChange={(v) => setCombined(v.toString())}
|
|
482
|
+
sx={{
|
|
483
|
+
'& .MuiInputLabel-root': { color: 'primary.main' },
|
|
484
|
+
'& .MuiOutlinedInput-root': { bgcolor: '#fff7e6' },
|
|
485
|
+
'& .MuiOutlinedInput-notchedOutline': { borderColor: 'warning.main', borderWidth: 2 },
|
|
486
|
+
}}
|
|
487
|
+
/>
|
|
488
|
+
</Box>
|
|
489
|
+
);
|
|
490
|
+
},
|
|
491
|
+
parameters: {
|
|
492
|
+
docs: {
|
|
493
|
+
description: {
|
|
494
|
+
story: "Demuestra que el prop `sx` se mergea al final y siempre gana sobre los defaults internos. Antes esto no funcionaba por culpa del `styled()` interno."
|
|
495
|
+
},
|
|
496
|
+
source: { code: CustomStylingDefinition.trim() }
|
|
497
|
+
}
|
|
386
498
|
}
|
|
387
499
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { TextFieldProps } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
import { buildFormFieldSx } from '../_shared/formField.sx';
|
|
4
|
+
import { FIELD_INPUT_PADDING_Y } from '../../theme/tokens';
|
|
5
|
+
import type { LabelPosition } from './Input';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Builder de sx para el Input. Usa el builder compartido
|
|
9
|
+
* `buildFormFieldSx` y añade overrides específicos de TextField
|
|
10
|
+
* (padding del input base, filled, standard).
|
|
11
|
+
*/
|
|
12
|
+
export const buildInputSx = (
|
|
13
|
+
borderRadius: number | string,
|
|
14
|
+
labelPosition: LabelPosition,
|
|
15
|
+
): TextFieldProps['sx'] => {
|
|
16
|
+
const radius = typeof borderRadius === 'number' ? `${borderRadius}px` : borderRadius;
|
|
17
|
+
|
|
18
|
+
return buildFormFieldSx({
|
|
19
|
+
borderRadius,
|
|
20
|
+
labelPosition,
|
|
21
|
+
extraOutsideSx: {
|
|
22
|
+
'& .MuiInputBase-input': {
|
|
23
|
+
paddingTop: FIELD_INPUT_PADDING_Y,
|
|
24
|
+
paddingBottom: FIELD_INPUT_PADDING_Y,
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
// Filled: quitar el padding-top reservado para el label flotante dentro.
|
|
28
|
+
'& .MuiFilledInput-root': {
|
|
29
|
+
paddingTop: 0,
|
|
30
|
+
borderRadius: `${radius} ${radius} 0 0`,
|
|
31
|
+
},
|
|
32
|
+
'& .MuiFilledInput-input': {
|
|
33
|
+
paddingTop: FIELD_INPUT_PADDING_Y,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
// Standard: quitar el margin-top reservado para el label flotante.
|
|
37
|
+
'& .MuiInput-root': {
|
|
38
|
+
marginTop: 0,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
};
|
|
@@ -1,186 +1,141 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { TextField, type TextFieldProps } from '@mui/material';
|
|
2
|
+
import { useTheme } from '@mui/material/styles';
|
|
3
|
+
import { Controller, type Control, type RegisterOptions } from 'react-hook-form';
|
|
4
|
+
|
|
5
|
+
import { parseValue, buildSlotProps } from './Input.helpers';
|
|
6
|
+
import { buildInputSx } from './Input.sx';
|
|
7
|
+
import { resolvePreset } from '../_shared/resolvePreset';
|
|
8
|
+
|
|
9
|
+
// ── Tipos de dominio ─────────────────────────────────────────────────────
|
|
10
|
+
export type InputType =
|
|
11
|
+
| 'text' | 'number' | 'email' | 'password' | 'tel'
|
|
12
|
+
| 'url' | 'search' | 'date' | 'datetime-local'
|
|
13
|
+
| 'month' | 'week' | 'time' | 'color';
|
|
14
|
+
|
|
15
|
+
export type LabelPosition = 'outside' | 'floating';
|
|
16
|
+
|
|
17
|
+
// ── Props base (todo lo común entre RHF y controlado) ────────────────────
|
|
18
|
+
export interface BaseInputProps
|
|
19
|
+
extends Omit<TextFieldProps, 'value' | 'onChange' | 'type'> {
|
|
20
|
+
type?: InputType;
|
|
12
21
|
min?: number;
|
|
13
22
|
max?: number;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
/** Border radius del input. Default: 10 */
|
|
24
|
+
borderRadius?: number | string;
|
|
25
|
+
/** "outside" = label arriba del campo (default). "floating" = label clásico MUI dentro del borde */
|
|
26
|
+
labelPosition?: LabelPosition;
|
|
17
27
|
readOnly?: boolean;
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Nombre del preset de estilo registrado en `theme.styles.Input`.
|
|
30
|
+
* - `"default"` (o ausente) = estilo built-in del paquete.
|
|
31
|
+
* - Cualquier otro string = mergea el preset encima del estilo built-in.
|
|
32
|
+
*/
|
|
33
|
+
preset?: string;
|
|
20
34
|
}
|
|
21
35
|
|
|
22
|
-
|
|
36
|
+
// ── Variantes discriminadas (RHF vs controlado) ──────────────────────────
|
|
37
|
+
export interface RHFInputProps extends BaseInputProps {
|
|
23
38
|
name: string;
|
|
24
39
|
control: Control<any>;
|
|
25
40
|
validation?: RegisterOptions;
|
|
26
|
-
value?:
|
|
27
|
-
onChange?:
|
|
41
|
+
value?: never;
|
|
42
|
+
onChange?: never;
|
|
28
43
|
}
|
|
29
44
|
|
|
30
|
-
interface
|
|
31
|
-
name?: string;
|
|
45
|
+
export interface ControlledInputProps extends BaseInputProps {
|
|
46
|
+
name?: string;
|
|
32
47
|
control?: never;
|
|
33
48
|
validation?: never;
|
|
34
49
|
value: string | number;
|
|
35
50
|
onChange: (value: string | number) => void;
|
|
36
51
|
}
|
|
37
52
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
transform: 'translate(1px, -200%) scale(0.75)',
|
|
62
|
-
fontSize: '16px !important',
|
|
63
|
-
'> legend': {
|
|
64
|
-
display: 'none',
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
'& .MuiInputLabel-root.Mui-error': {
|
|
69
|
-
top: '25%'
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
'& .MuiInputBase-root > fieldset > legend':{
|
|
73
|
-
display: 'none',
|
|
74
|
-
},
|
|
75
|
-
'& .MuiOutlinedInput-notchedOutline': {
|
|
76
|
-
border: '0.7px solid',
|
|
77
|
-
borderColor: '#e0e0e0',
|
|
78
|
-
},
|
|
79
|
-
}));
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export const Input = forwardRef<HTMLInputElement, InputProps>(({
|
|
83
|
-
type = 'text',
|
|
84
|
-
variant = 'outlined',
|
|
85
|
-
min,
|
|
86
|
-
max,
|
|
87
|
-
inputProps: customInputProps,
|
|
88
|
-
slotProps: customSlotProps,
|
|
89
|
-
|
|
90
|
-
value,
|
|
91
|
-
onChange,
|
|
92
|
-
...rest
|
|
93
|
-
}, ref) => {
|
|
94
|
-
const isRHFMode = 'control' in rest && rest.control !== undefined;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const htmlInputProps: React.InputHTMLAttributes<HTMLInputElement> = {
|
|
98
|
-
...customInputProps,
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
if (type === 'number') {
|
|
102
|
-
htmlInputProps.min = min !== undefined ? min : Number.NEGATIVE_INFINITY;
|
|
103
|
-
if (max !== undefined) {
|
|
104
|
-
htmlInputProps.max = max;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const finalSlotProps: TextFieldProps['slotProps'] = {
|
|
110
|
-
...customSlotProps,
|
|
111
|
-
htmlInput: {
|
|
112
|
-
...customSlotProps?.htmlInput,
|
|
113
|
-
...htmlInputProps,
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const handleChangeInternal = (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>, rhfOnChange?: (...event: any[]) => void) => {
|
|
119
|
-
const rawValue = event.target.value;
|
|
120
|
-
let newValue: string | number;
|
|
121
|
-
|
|
122
|
-
if (type === 'number') {
|
|
123
|
-
newValue = rawValue === '' || rawValue === '-' ? rawValue : parseFloat(rawValue);
|
|
124
|
-
|
|
125
|
-
if (isNaN(newValue as number) && rawValue !== '' && rawValue !== '-') newValue = rawValue;
|
|
126
|
-
} else {
|
|
127
|
-
newValue = rawValue;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (isRHFMode) {
|
|
131
|
-
rhfOnChange?.(newValue);
|
|
132
|
-
} else {
|
|
133
|
-
|
|
134
|
-
(onChange as (value: string | number) => void)?.(newValue);
|
|
135
|
-
}
|
|
53
|
+
// ── API pública final ────────────────────────────────────────────────────
|
|
54
|
+
export type InputProps = RHFInputProps | ControlledInputProps;
|
|
55
|
+
|
|
56
|
+
export const Input: React.FC<InputProps> = (props) => {
|
|
57
|
+
const {
|
|
58
|
+
type = 'text',
|
|
59
|
+
variant = 'outlined',
|
|
60
|
+
size = 'small',
|
|
61
|
+
borderRadius = 10,
|
|
62
|
+
labelPosition = 'outside',
|
|
63
|
+
preset,
|
|
64
|
+
min,
|
|
65
|
+
max,
|
|
66
|
+
readOnly,
|
|
67
|
+
inputProps,
|
|
68
|
+
slotProps,
|
|
69
|
+
sx,
|
|
70
|
+
...rest
|
|
71
|
+
} = props as ControlledInputProps & {
|
|
72
|
+
control?: Control<any>;
|
|
73
|
+
validation?: RegisterOptions;
|
|
74
|
+
readOnly?: boolean;
|
|
75
|
+
preset?: string;
|
|
136
76
|
};
|
|
137
77
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
78
|
+
const theme = useTheme();
|
|
79
|
+
const presetSx = resolvePreset('Input', preset, theme);
|
|
80
|
+
|
|
81
|
+
const finalSlotProps = buildSlotProps(
|
|
82
|
+
type,
|
|
83
|
+
min,
|
|
84
|
+
max,
|
|
85
|
+
slotProps,
|
|
86
|
+
inputProps,
|
|
87
|
+
labelPosition,
|
|
88
|
+
readOnly,
|
|
89
|
+
);
|
|
90
|
+
const mergedSx = [
|
|
91
|
+
buildInputSx(borderRadius, labelPosition),
|
|
92
|
+
...(presetSx ? [presetSx] : []),
|
|
93
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
if ('control' in props && props.control) {
|
|
97
|
+
const { name, control, validation } = props as RHFInputProps;
|
|
141
98
|
return (
|
|
142
99
|
<Controller
|
|
143
|
-
name={
|
|
144
|
-
control={
|
|
145
|
-
rules={
|
|
146
|
-
render={({ field, fieldState: { error } }) =>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
);
|
|
165
|
-
} else {
|
|
166
|
-
|
|
167
|
-
const standardProps = rest as StandardInputPropsWithOptionalName;
|
|
168
|
-
return (
|
|
169
|
-
<StyledTextField
|
|
170
|
-
fullWidth={true}
|
|
171
|
-
name={standardProps.name}
|
|
172
|
-
value={value ?? ''}
|
|
173
|
-
onChange={(e) => handleChangeInternal(e)}
|
|
174
|
-
type={type}
|
|
175
|
-
variant={variant}
|
|
176
|
-
slotProps={finalSlotProps}
|
|
177
|
-
inputRef={ref}
|
|
178
|
-
error={standardProps.error}
|
|
179
|
-
helperText={standardProps.helperText}
|
|
180
|
-
{...rest}
|
|
100
|
+
name={name}
|
|
101
|
+
control={control}
|
|
102
|
+
rules={validation}
|
|
103
|
+
render={({ field, fieldState: { error } }) => (
|
|
104
|
+
<TextField
|
|
105
|
+
fullWidth
|
|
106
|
+
{...rest}
|
|
107
|
+
name={field.name}
|
|
108
|
+
value={field.value ?? ''}
|
|
109
|
+
onChange={(e) => field.onChange(parseValue(e.target.value, type))}
|
|
110
|
+
onBlur={field.onBlur}
|
|
111
|
+
inputRef={field.ref}
|
|
112
|
+
type={type}
|
|
113
|
+
variant={variant}
|
|
114
|
+
size={size}
|
|
115
|
+
slotProps={finalSlotProps}
|
|
116
|
+
sx={mergedSx}
|
|
117
|
+
error={!!error || rest.error}
|
|
118
|
+
helperText={error?.message ?? rest.helperText}
|
|
119
|
+
/>
|
|
120
|
+
)}
|
|
181
121
|
/>
|
|
182
122
|
);
|
|
183
123
|
}
|
|
184
|
-
});
|
|
185
124
|
|
|
186
|
-
|
|
125
|
+
const { value, onChange } = props as ControlledInputProps;
|
|
126
|
+
return (
|
|
127
|
+
<TextField
|
|
128
|
+
fullWidth
|
|
129
|
+
{...rest}
|
|
130
|
+
value={value ?? ''}
|
|
131
|
+
onChange={(e) => onChange(parseValue(e.target.value, type))}
|
|
132
|
+
type={type}
|
|
133
|
+
variant={variant}
|
|
134
|
+
size={size}
|
|
135
|
+
slotProps={finalSlotProps}
|
|
136
|
+
sx={mergedSx}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export default Input;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
export const BasicInputGroupDefinition = `
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Box, Typography } from '@mui/material';
|
|
4
|
+
import InputGroup from './InputGroup';
|
|
5
|
+
import { Input } from '../Input';
|
|
6
|
+
import { Button } from '../Button';
|
|
7
|
+
|
|
8
|
+
export const BasicInputGroupExample = () => {
|
|
9
|
+
const [text, setText] = useState('');
|
|
10
|
+
return (
|
|
11
|
+
<Box>
|
|
12
|
+
<Typography variant="h6" sx={{ mb: 2 }}>
|
|
13
|
+
Grupo de entrada básico
|
|
14
|
+
</Typography>
|
|
15
|
+
<InputGroup>
|
|
16
|
+
<Input label="Buscar" value={text} onChange={(val) => setText(val as string)} />
|
|
17
|
+
<Button variant="outlined">Buscar</Button>
|
|
18
|
+
</InputGroup>
|
|
19
|
+
</Box>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const CombinedInputGroupDefinition = `
|
|
25
|
+
import { useState } from 'react';
|
|
26
|
+
import { Box, Typography } from '@mui/material';
|
|
27
|
+
import InputGroup from './InputGroup';
|
|
28
|
+
import { Input } from '../Input';
|
|
29
|
+
import Select, { SelectOption } from '../Select/Select';
|
|
30
|
+
import { Button } from '../Button';
|
|
31
|
+
|
|
32
|
+
const basicOptions: SelectOption[] = [
|
|
33
|
+
{ value: '10', label: '10' },
|
|
34
|
+
{ value: '25', label: '25' },
|
|
35
|
+
{ value: '50', label: '50' },
|
|
36
|
+
{ value: '100', label: '100' },
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
export const CombinedInputGroupExample = () => {
|
|
40
|
+
const [text, setText] = useState('');
|
|
41
|
+
const [selectValue, setSelectValue] = useState('25');
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Box>
|
|
45
|
+
<Typography variant="h6" sx={{ mb: 2 }}>
|
|
46
|
+
Grupo de entrada combinado
|
|
47
|
+
</Typography>
|
|
48
|
+
<InputGroup>
|
|
49
|
+
<Select
|
|
50
|
+
label="Registros"
|
|
51
|
+
options={basicOptions}
|
|
52
|
+
value={selectValue}
|
|
53
|
+
onChange={(val) => setSelectValue(val as string)}
|
|
54
|
+
/>
|
|
55
|
+
<Input
|
|
56
|
+
label="Filtrar por nombre"
|
|
57
|
+
value={text}
|
|
58
|
+
onChange={(val) => setText(val as string)}
|
|
59
|
+
/>
|
|
60
|
+
<Button variant="contained">Aplicar</Button>
|
|
61
|
+
</InputGroup>
|
|
62
|
+
</Box>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
export const DatePickerInputGroupDefinition = `
|
|
68
|
+
import { useState } from 'react';
|
|
69
|
+
import { Box, Typography } from '@mui/material';
|
|
70
|
+
import dayjs, { Dayjs } from 'dayjs';
|
|
71
|
+
import InputGroup from './InputGroup';
|
|
72
|
+
import { DatePicker } from '../DatePicker';
|
|
73
|
+
import { Button } from '../Button';
|
|
74
|
+
|
|
75
|
+
export const DatePickerInputGroupExample = () => {
|
|
76
|
+
const [selectedDate, setSelectedDate] = useState<Dayjs | null>(dayjs());
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Box>
|
|
80
|
+
<Typography variant="h6" sx={{ mb: 2 }}>
|
|
81
|
+
Grupo de entrada con DatePicker
|
|
82
|
+
</Typography>
|
|
83
|
+
<InputGroup>
|
|
84
|
+
<DatePicker
|
|
85
|
+
label="Fecha de inicio"
|
|
86
|
+
selectedDate={selectedDate}
|
|
87
|
+
onDateChange={(date) => setSelectedDate(date)}
|
|
88
|
+
/>
|
|
89
|
+
<Button variant="contained">Ver calendario</Button>
|
|
90
|
+
</InputGroup>
|
|
91
|
+
</Box>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
export const VerticalInputGroupDefinition = `
|
|
97
|
+
import { useState } from 'react';
|
|
98
|
+
import { Box } from '@mui/material';
|
|
99
|
+
import InputGroup from './InputGroup';
|
|
100
|
+
import { Input } from '../Input';
|
|
101
|
+
|
|
102
|
+
export const VerticalInputGroupExample = () => {
|
|
103
|
+
const [nombre, setNombre] = useState('');
|
|
104
|
+
const [email, setEmail] = useState('');
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<Box sx={{ width: 320 }}>
|
|
108
|
+
<InputGroup orientation="vertical">
|
|
109
|
+
<Input label="Nombre" value={nombre} onChange={(val) => setNombre(val as string)} />
|
|
110
|
+
<Input label="Email" value={email} onChange={(val) => setEmail(val as string)} />
|
|
111
|
+
</InputGroup>
|
|
112
|
+
</Box>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
export const CustomStylingInputGroupDefinition = `
|
|
118
|
+
import { useState } from 'react';
|
|
119
|
+
import { Box } from '@mui/material';
|
|
120
|
+
import InputGroup from './InputGroup';
|
|
121
|
+
import { Input } from '../Input';
|
|
122
|
+
import { Button } from '../Button';
|
|
123
|
+
|
|
124
|
+
export const CustomStylingInputGroupExample = () => {
|
|
125
|
+
const [q, setQ] = useState('');
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Box sx={{ width: 500 }}>
|
|
129
|
+
<InputGroup
|
|
130
|
+
borderRadius={999}
|
|
131
|
+
sx={{
|
|
132
|
+
bgcolor: 'action.hover',
|
|
133
|
+
borderColor: 'primary.main',
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
<Input label="Búsqueda avanzada" value={q} onChange={(val) => setQ(val as string)} />
|
|
137
|
+
<Button variant="contained" color="primary">Buscar</Button>
|
|
138
|
+
</InputGroup>
|
|
139
|
+
</Box>
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
`;
|
|
143
|
+
|
|
144
|
+
export const DisabledInputGroupDefinition = `
|
|
145
|
+
import { Box } from '@mui/material';
|
|
146
|
+
import InputGroup from './InputGroup';
|
|
147
|
+
import { Input } from '../Input';
|
|
148
|
+
import { Button } from '../Button';
|
|
149
|
+
|
|
150
|
+
export const DisabledInputGroupExample = () => (
|
|
151
|
+
<Box sx={{ width: 400 }}>
|
|
152
|
+
<InputGroup disabled>
|
|
153
|
+
<Input label="Búsqueda" value="" onChange={() => {}} disabled />
|
|
154
|
+
<Button variant="outlined" disabled>Buscar</Button>
|
|
155
|
+
</InputGroup>
|
|
156
|
+
</Box>
|
|
157
|
+
);
|
|
158
|
+
`;
|