dgrcorrientes-modulos 1.0.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/.nvmrc +1 -0
- package/.prettierrc.cjs +8 -0
- package/.storybook/main.cjs +11 -0
- package/.storybook/manager-head.html +2 -0
- package/.storybook/manager.cjs +6 -0
- package/.storybook/preview-head.html +3 -0
- package/.storybook/preview.cjs +11 -0
- package/.storybook/themes.cjs +14 -0
- package/README.md +21 -0
- package/StoryBook.txt +19 -0
- package/dist-config.cjs +57 -0
- package/index.html +13 -0
- package/package.json +60 -0
- package/public/elevation.ico +0 -0
- package/public/elevationImage.png +0 -0
- package/public/vite.svg +1 -0
- package/src/App.scss +36 -0
- package/src/App.tsx +34 -0
- package/src/assets/react.svg +1 -0
- package/src/index.js +70 -0
- package/src/index.scss +63 -0
- package/src/index.ts +108 -0
- package/src/main.tsx +11 -0
- package/src/sass/base/_base.scss +50 -0
- package/src/sass/base/_controls.scss +90 -0
- package/src/sass/base/_datepicker.scss +114 -0
- package/src/sass/base/_typo.scss +71 -0
- package/src/sass/base/fonts/SFUIText-Bold.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-BoldItalic.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-Heavy.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-HeavyItalic.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-Light.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-LightItalic.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-Medium.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-MediumItalic.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-Regular.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-RegularItalic.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-Semibold.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-SemiboldItalic.ttf +0 -0
- package/src/sass/bulma/bulma-changes.scss +19 -0
- package/src/sass/bulma/extensions/extensions.sass +1 -0
- package/src/sass/bulma/extensions/steps/bulma-steps.sass +3 -0
- package/src/sass/bulma/extensions/steps/index.sass +421 -0
- package/src/sass/bulma/variables/_variables-bulma.sass +16 -0
- package/src/sass/bulma/variables/components/card.sass +20 -0
- package/src/sass/bulma/variables/components/navbar.sass +50 -0
- package/src/sass/bulma/variables/components/tabs.sass +28 -0
- package/src/sass/bulma/variables/elements/button.sass +46 -0
- package/src/sass/bulma/variables/elements/notification.sass +8 -0
- package/src/sass/bulma/variables/elements/title.sass +20 -0
- package/src/sass/bulma/variables/grid/column.sass +2 -0
- package/src/sass/main.sass +16 -0
- package/src/sass/utilities/_bulma-variables.sass +20 -0
- package/src/sass/utilities/_derived-variables.scss +68 -0
- package/src/sass/utilities/_helpers.scss +70 -0
- package/src/sass/utilities/_variables.scss +147 -0
- package/src/stories/Changelog.stories.tsx +73 -0
- package/src/stories/Components/AssistanceDiary/AssistanceDiary.scss +19 -0
- package/src/stories/Components/AssistanceDiary/AssistanceDiary.stories.tsx +25 -0
- package/src/stories/Components/AssistanceDiary/AssistanceDiary.tsx +57 -0
- package/src/stories/Components/AverageAttended/AverageAttended.scss +39 -0
- package/src/stories/Components/AverageAttended/AverageAttended.stories.tsx +71 -0
- package/src/stories/Components/AverageAttended/AverageAttended.tsx +311 -0
- package/src/stories/Components/Breadcrumb/Breadcrumb.stories.tsx +45 -0
- package/src/stories/Components/Breadcrumb/Breadcrumb.tsx +68 -0
- package/src/stories/Components/Breadcrumb/breadcrumb.scss +82 -0
- package/src/stories/Components/CTA/CTA.scss +76 -0
- package/src/stories/Components/CTA/CTA.stories.tsx +46 -0
- package/src/stories/Components/CTA/CTA.tsx +70 -0
- package/src/stories/Components/Cards/Card CTA/CardCta.stories.tsx +34 -0
- package/src/stories/Components/Cards/Card CTA/CardCta.tsx +81 -0
- package/src/stories/Components/Cards/Card CTA/cardCta.scss +71 -0
- package/src/stories/Components/Cards/Card Expiration/cardExpiration.scss +105 -0
- package/src/stories/Components/Cards/Card Expiration/cardExpiration.stories.tsx +40 -0
- package/src/stories/Components/Cards/Card Expiration/cardExpiration.tsx +95 -0
- package/src/stories/Components/Cards/Card Vertical/CardVertical.stories.tsx +43 -0
- package/src/stories/Components/Cards/Card Vertical/CardVertical.tsx +106 -0
- package/src/stories/Components/Cards/Card Vertical/cardVertical.scss +130 -0
- package/src/stories/Components/Cards/CardActivity/cardActivity.scss +31 -0
- package/src/stories/Components/Cards/CardActivity/cardActivity.stories.tsx +20 -0
- package/src/stories/Components/Cards/CardActivity/cardActivity.tsx +48 -0
- package/src/stories/Components/Cards/CardHorizontal/CardHorizontal.stories.tsx +96 -0
- package/src/stories/Components/Cards/CardHorizontal/CardHorizontal.tsx +94 -0
- package/src/stories/Components/Cards/CardHorizontal/cardHorizontal.scss +65 -0
- package/src/stories/Components/Cards/CardUser/CardUser.stories.tsx +135 -0
- package/src/stories/Components/Cards/CardUser/CardUser.tsx +122 -0
- package/src/stories/Components/Cards/CardUser/cardUser.scss +115 -0
- package/src/stories/Components/Cart/Cart.scss +279 -0
- package/src/stories/Components/Cart/Cart.stories.tsx +350 -0
- package/src/stories/Components/Cart/Cart.tsx +277 -0
- package/src/stories/Components/Collapse/Collapse.scss +339 -0
- package/src/stories/Components/Collapse/Collapse.stories.tsx +766 -0
- package/src/stories/Components/Collapse/Collapse.tsx +451 -0
- package/src/stories/Components/CollapseEdit/CollapseEdit.scss +128 -0
- package/src/stories/Components/CollapseEdit/CollapseEdit.stories.tsx +29 -0
- package/src/stories/Components/CollapseEdit/CollapseEdit.tsx +185 -0
- package/src/stories/Components/CompleteDiary/CompleteDiary.scss +165 -0
- package/src/stories/Components/CompleteDiary/CompleteDiary.stories.tsx +219 -0
- package/src/stories/Components/CompleteDiary/CompleteDiary.tsx +394 -0
- package/src/stories/Components/Dropdown/Dropdown.scss +60 -0
- package/src/stories/Components/Dropdown/Dropdown.stories.tsx +19 -0
- package/src/stories/Components/Dropdown/Dropdown.tsx +99 -0
- package/src/stories/Components/EmptyState/EmptyState.stories.tsx +46 -0
- package/src/stories/Components/EmptyState/EmptyState.tsx +44 -0
- package/src/stories/Components/EmptyState/emptyState.scss +75 -0
- package/src/stories/Components/ErrorPage/ErrorPage.scss +65 -0
- package/src/stories/Components/ErrorPage/ErrorPage.stories.tsx +164 -0
- package/src/stories/Components/ErrorPage/ErrorPage.tsx +107 -0
- package/src/stories/Components/IncomingCall/IncomingCall.scss +27 -0
- package/src/stories/Components/IncomingCall/IncomingCall.stories.tsx +43 -0
- package/src/stories/Components/IncomingCall/IncomingCall.tsx +76 -0
- package/src/stories/Components/ModalConfirm/ModalConfirm.scss +30 -0
- package/src/stories/Components/ModalConfirm/ModalConfirm.stories.tsx +21 -0
- package/src/stories/Components/ModalConfirm/ModalConfirm.tsx +118 -0
- package/src/stories/Components/Pagination/Pagination.scss +42 -0
- package/src/stories/Components/Pagination/Pagination.stories.tsx +25 -0
- package/src/stories/Components/Pagination/Pagination.tsx +143 -0
- package/src/stories/Components/PerformanceAssessment/PerformanceAssessment.scss +26 -0
- package/src/stories/Components/PerformanceAssessment/PerformanceAssessment.stories.tsx +27 -0
- package/src/stories/Components/PerformanceAssessment/PerformanceAssessment.tsx +108 -0
- package/src/stories/Components/ShiftDiary/ShiftDiary.scss +45 -0
- package/src/stories/Components/ShiftDiary/ShiftDiary.stories.tsx +32 -0
- package/src/stories/Components/ShiftDiary/ShiftDiary.tsx +92 -0
- package/src/stories/Components/Stepper/Stepper.stories.tsx +26 -0
- package/src/stories/Components/Stepper/Stepper.tsx +102 -0
- package/src/stories/Components/Stepper/stepper.scss +59 -0
- package/src/stories/Components/Tabs/Tabs.stories.tsx +76 -0
- package/src/stories/Components/Tabs/Tabs.tsx +111 -0
- package/src/stories/Components/Tabs/tabs.scss +118 -0
- package/src/stories/Components/Tooltip/Tooltip.scss +235 -0
- package/src/stories/Components/Tooltip/Tooltip.stories.tsx +125 -0
- package/src/stories/Components/Tooltip/Tooltip.tsx +222 -0
- package/src/stories/Elements/Alert/Alert.stories.tsx +65 -0
- package/src/stories/Elements/Alert/Alert.tsx +49 -0
- package/src/stories/Elements/Alert/alert.scss +189 -0
- package/src/stories/Elements/Badge/Badge.stories.tsx +15 -0
- package/src/stories/Elements/Badge/Badge.tsx +21 -0
- package/src/stories/Elements/Badge/badge.scss +24 -0
- package/src/stories/Elements/Button/Button.stories.tsx +54 -0
- package/src/stories/Elements/Button/Button.tsx +118 -0
- package/src/stories/Elements/Button/button.scss +102 -0
- package/src/stories/Elements/Icon/Icon.stories.tsx +33 -0
- package/src/stories/Elements/Icon/Icon.tsx +57 -0
- package/src/stories/Elements/Icon/icon.scss +15 -0
- package/src/stories/Elements/Icon/icono.svg +1 -0
- package/src/stories/Elements/ProgressBar/ProgressBar.scss +26 -0
- package/src/stories/Elements/ProgressBar/ProgressBar.stories.tsx +19 -0
- package/src/stories/Elements/ProgressBar/ProgressBar.tsx +35 -0
- package/src/stories/Form/Autocomplete/Autocomplete.stories.tsx +55 -0
- package/src/stories/Form/Autocomplete/Autocomplete.tsx +160 -0
- package/src/stories/Form/Autocomplete/autocomplete.scss +311 -0
- package/src/stories/Form/Autocomplete-Prueba/Autocomplete.stories.tsx +50 -0
- package/src/stories/Form/Autocomplete-Prueba/AutocompletePrueba.tsx +83 -0
- package/src/stories/Form/Checkbox/Checkbox.stories.tsx +26 -0
- package/src/stories/Form/Checkbox/Checkbox.tsx +89 -0
- package/src/stories/Form/Checkbox/checkbox.scss +41 -0
- package/src/stories/Form/DatePicker/DatePickerExample.stories.tsx +27 -0
- package/src/stories/Form/DatePicker/DatePickerExample.tsx +65 -0
- package/src/stories/Form/DatePickerComponent/DatePickerComponent.scss +116 -0
- package/src/stories/Form/DatePickerComponent/DatePickerComponent.stories.tsx +37 -0
- package/src/stories/Form/DatePickerComponent/DatePickerComponent.tsx +97 -0
- package/src/stories/Form/Filters/Filters.stories.tsx +84 -0
- package/src/stories/Form/Filters/Filters.tsx +230 -0
- package/src/stories/Form/Filters/filters.scss +261 -0
- package/src/stories/Form/Input/Input.stories.tsx +25 -0
- package/src/stories/Form/Input/Input.tsx +86 -0
- package/src/stories/Form/Input/InputVar.sass +26 -0
- package/src/stories/Form/Input/input.scss +19 -0
- package/src/stories/Form/InputFormControl/Input-form-control.stories.tsx +26 -0
- package/src/stories/Form/InputFormControl/Input-form-control.tsx +48 -0
- package/src/stories/Form/InputFormControl/input-form-control.scss +34 -0
- package/src/stories/Form/Radio/Radio.stories.tsx +19 -0
- package/src/stories/Form/Radio/Radio.tsx +84 -0
- package/src/stories/Form/Radio/radio.scss +19 -0
- package/src/stories/Form/Search/Search.scss +50 -0
- package/src/stories/Form/Search/Search.stories.tsx +26 -0
- package/src/stories/Form/Search/Search.tsx +84 -0
- package/src/stories/Form/Select/Select.stories.tsx +55 -0
- package/src/stories/Form/Select/Select.tsx +121 -0
- package/src/stories/Form/Select/select.scss +303 -0
- package/src/stories/Form/Switch/Switch.stories.tsx +17 -0
- package/src/stories/Form/Switch/Switch.tsx +36 -0
- package/src/stories/Form/Switch/switch.scss +123 -0
- package/src/stories/Form/Textarea/Textarea.stories.tsx +19 -0
- package/src/stories/Form/Textarea/Textarea.tsx +52 -0
- package/src/stories/Form/Textarea/textarea.scss +25 -0
- package/src/stories/Form/UploadFileItem/UploadFileItem.scss +49 -0
- package/src/stories/Form/UploadFileItem/UploadFileItem.stories.tsx +18 -0
- package/src/stories/Form/UploadFileItem/UploadFileItem.tsx +89 -0
- package/src/stories/Form/UploadFiles/UploadFiles.scss +17 -0
- package/src/stories/Form/UploadFiles/UploadFiles.stories.tsx +32 -0
- package/src/stories/Form/UploadFiles/UploadFiles.tsx +177 -0
- package/src/stories/Layout/Footer/Footer.scss +129 -0
- package/src/stories/Layout/Footer/Footer.stories.tsx +101 -0
- package/src/stories/Layout/Footer/Footer.tsx +81 -0
- package/src/stories/Layout/Header/Header.scss +190 -0
- package/src/stories/Layout/Header/Header.stories.tsx +223 -0
- package/src/stories/Layout/Header/Header.tsx +278 -0
- package/src/stories/Layout/HeaderTable/HeaderTable.scss +21 -0
- package/src/stories/Layout/HeaderTable/HeaderTable.stories.tsx +112 -0
- package/src/stories/Layout/HeaderTable/HeaderTable.tsx +72 -0
- package/src/stories/Layout/Sidebar/Sidebar.scss +50 -0
- package/src/stories/Layout/Sidebar/Sidebar.stories.tsx +744 -0
- package/src/stories/Layout/Sidebar/Sidebar.tsx +129 -0
- package/src/stories/Layout/SidebarEmpty/SidebarEmpty.scss +64 -0
- package/src/stories/Layout/SidebarEmpty/SidebarEmpty.stories.tsx +26 -0
- package/src/stories/Layout/SidebarEmpty/SidebarEmpty.tsx +100 -0
- package/src/stories/Layout/Subtitle/Subtitle.scss +88 -0
- package/src/stories/Layout/Subtitle/Subtitle.stories.tsx +46 -0
- package/src/stories/Layout/Subtitle/Subtitle.tsx +108 -0
- package/src/stories/Layout/Title/Title.scss +79 -0
- package/src/stories/Layout/Title/Title.stories.tsx +86 -0
- package/src/stories/Layout/Title/Title.tsx +96 -0
- package/src/stories/Welcome.stories.tsx +111 -0
- package/src/stories/assets/404 Page Not Found _Two Color (1).png +0 -0
- package/src/stories/assets/404 Page Not Found _Two Color.png +0 -0
- package/src/stories/assets/Empty Inbox _Two Color.png +0 -0
- package/src/stories/assets/Loading _Two Color.png +0 -0
- package/src/stories/assets/Notifications_Two Color 1.png +0 -0
- package/src/stories/assets/Online protection_Two Color.png +0 -0
- package/src/stories/assets/Under Constructions _Two Color.png +0 -0
- package/src/stories/assets/bulma.png +0 -0
- package/src/stories/assets/burger.svg +5 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/decor-bg.png +0 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/e-isologo.svg +4 -0
- package/src/stories/assets/e-isotype.svg +4 -0
- package/src/stories/assets/e-logo_negative.svg +14 -0
- package/src/stories/assets/e-logotype.svg +14 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/logo_gobierno_corrientes.svg +9 -0
- package/src/stories/assets/logo_rentas_corrientes.svg +10 -0
- package/src/stories/assets/logo_rentas_corrientes_compacto.svg +10 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/stories/assets/storybook.svg +13 -0
- package/src/stories/assets/thumbnail-black.jpg +0 -0
- package/src/stories/assets/thumbnail-black[2].jpg +0 -0
- package/src/stories/assets/thumbnail.jpg +0 -0
- package/src/stories/assets/thumbnail[2].jpg +0 -0
- package/src/stories/changelog.ts +389 -0
- package/src/utils/functions.ts +57 -0
- package/src/vite-env.d.ts +2 -0
- package/static/e-isologo-192.jpg +0 -0
- package/static/e-isologo.svg +4 -0
- package/static/e-logotype.svg +14 -0
- package/static/favicon.ico +0 -0
- package/tsconfig.json +22 -0
- package/tsconfig.node.json +9 -0
- package/vite.config.ts +22 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {useEffect, useRef} from 'react';
|
|
2
|
+
import {IInput, Input} from '../Input/Input';
|
|
3
|
+
import './input-form-control.scss';
|
|
4
|
+
|
|
5
|
+
export interface IInputForm extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
6
|
+
// base
|
|
7
|
+
input: IInput;
|
|
8
|
+
label: string;
|
|
9
|
+
helperText?: string;
|
|
10
|
+
defaultValue: string;
|
|
11
|
+
maxLength: number;
|
|
12
|
+
|
|
13
|
+
// boolean
|
|
14
|
+
error?: boolean;
|
|
15
|
+
|
|
16
|
+
// events
|
|
17
|
+
|
|
18
|
+
// react
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const InputForm = ({input, label, helperText, defaultValue, maxLength, error, className, ...props}: IInputForm) => {
|
|
23
|
+
return (
|
|
24
|
+
<div className={['elv-component', ' elv-form-control'].join('')} {...props}>
|
|
25
|
+
<div className={`e-input-form ${className ? className : ''}`}>
|
|
26
|
+
<div>{label}</div>
|
|
27
|
+
<Input {...input} />
|
|
28
|
+
<div>
|
|
29
|
+
<span
|
|
30
|
+
className={[
|
|
31
|
+
'helper',
|
|
32
|
+
`${error ? `text--error` : ''}`,
|
|
33
|
+
`${defaultValue.length > maxLength ? `text--error` : ''}`,
|
|
34
|
+
`${className ? className : ''}`,
|
|
35
|
+
].join(' ')}
|
|
36
|
+
>
|
|
37
|
+
{helperText}
|
|
38
|
+
</span>
|
|
39
|
+
{defaultValue.length && maxLength ? (
|
|
40
|
+
<span className={['length', ,].join(' ')}>
|
|
41
|
+
{defaultValue.length}/{maxLength}
|
|
42
|
+
</span>
|
|
43
|
+
) : null}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@import '/src/sass/utilities/variables';
|
|
2
|
+
|
|
3
|
+
.elv-form-control {
|
|
4
|
+
label {
|
|
5
|
+
display: block;
|
|
6
|
+
margin-bottom: 6px;
|
|
7
|
+
color: #737373;
|
|
8
|
+
font-size: 14px;
|
|
9
|
+
font-weight: 500;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.helper {
|
|
13
|
+
// width: 50%;
|
|
14
|
+
display: block;
|
|
15
|
+
margin-top: 6px;
|
|
16
|
+
color: #737373;
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
|
|
20
|
+
&.text--error {
|
|
21
|
+
color: #dc2626;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.length {
|
|
26
|
+
width: 50%;
|
|
27
|
+
display: inline-block;
|
|
28
|
+
margin-top: 6px;
|
|
29
|
+
color: #737373;
|
|
30
|
+
font-size: 14px;
|
|
31
|
+
font-weight: 400;
|
|
32
|
+
text-align: end;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {ComponentStory, ComponentMeta} from '@storybook/react';
|
|
2
|
+
import {Radio} from './Radio';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Form/Radio',
|
|
6
|
+
component: Radio,
|
|
7
|
+
args: {
|
|
8
|
+
size: 'md',
|
|
9
|
+
disabled: false,
|
|
10
|
+
label: 'Radio button',
|
|
11
|
+
name: 'label',
|
|
12
|
+
value: 'value',
|
|
13
|
+
error: false,
|
|
14
|
+
},
|
|
15
|
+
} as ComponentMeta<typeof Radio>;
|
|
16
|
+
|
|
17
|
+
const Template: ComponentStory<typeof Radio> = args => <Radio {...args} />;
|
|
18
|
+
|
|
19
|
+
export const Standard = Template.bind({});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {useRef, useState} from 'react';
|
|
2
|
+
import './radio.scss';
|
|
3
|
+
import '/src/sass/base/_controls.scss';
|
|
4
|
+
|
|
5
|
+
export interface IRadio extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
6
|
+
// base
|
|
7
|
+
size?: 'sm' | 'md' | 'lg';
|
|
8
|
+
label?: string;
|
|
9
|
+
value: string;
|
|
10
|
+
name: string;
|
|
11
|
+
|
|
12
|
+
// boolean
|
|
13
|
+
defaultChecked?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
error?: boolean;
|
|
16
|
+
|
|
17
|
+
// events
|
|
18
|
+
onCheck?: () => void;
|
|
19
|
+
|
|
20
|
+
// react
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const Radio = ({
|
|
25
|
+
size = 'md',
|
|
26
|
+
disabled = false,
|
|
27
|
+
label = 'radio',
|
|
28
|
+
name,
|
|
29
|
+
value,
|
|
30
|
+
defaultChecked,
|
|
31
|
+
onCheck,
|
|
32
|
+
error,
|
|
33
|
+
className,
|
|
34
|
+
...props
|
|
35
|
+
}: IRadio) => {
|
|
36
|
+
const radioRef = useRef<HTMLInputElement>(null);
|
|
37
|
+
|
|
38
|
+
const toggleChecked = () => {
|
|
39
|
+
if (radioRef.current) {
|
|
40
|
+
if (radioRef.current.checked) {
|
|
41
|
+
onCheck && onCheck();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className="elv-component elv-radio elv-control" {...props}>
|
|
48
|
+
<label
|
|
49
|
+
className={[
|
|
50
|
+
'e-control e-radio',
|
|
51
|
+
` e-control--${size} e-radio--${size}`,
|
|
52
|
+
`${error ? ` e-control--error e-radio--error` : ''}`,
|
|
53
|
+
`${disabled ? ` e-control--disabled e-radio--disabled` : ''}`,
|
|
54
|
+
' is-relative',
|
|
55
|
+
' is-flex is-flex-direction-row-reverse is-justify-content-flex-end',
|
|
56
|
+
' has-text-dark',
|
|
57
|
+
' is-clickable',
|
|
58
|
+
`${className ? ' ' + className : ''}`,
|
|
59
|
+
].join('')}
|
|
60
|
+
>
|
|
61
|
+
<input
|
|
62
|
+
type="radio"
|
|
63
|
+
defaultChecked={defaultChecked}
|
|
64
|
+
id={value}
|
|
65
|
+
name={name}
|
|
66
|
+
value={value}
|
|
67
|
+
className={['e-control__input e-radio__input', 'm-0', 'is-clickable'].join('')}
|
|
68
|
+
onChange={() => {
|
|
69
|
+
toggleChecked();
|
|
70
|
+
}}
|
|
71
|
+
disabled={disabled}
|
|
72
|
+
ref={radioRef}
|
|
73
|
+
/>
|
|
74
|
+
{label && <span className="label-text is-flex is-align-items-center">{label}</span>}
|
|
75
|
+
<span
|
|
76
|
+
className={[
|
|
77
|
+
'e-control__checkmark e-radio__checkmark',
|
|
78
|
+
' is-flex is-align-items-center is-justify-content-center is-relative',
|
|
79
|
+
].join('')}
|
|
80
|
+
/>
|
|
81
|
+
</label>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import '/src/sass/utilities/variables';
|
|
2
|
+
|
|
3
|
+
.elv-radio {
|
|
4
|
+
.e-radio {
|
|
5
|
+
&__checkmark {
|
|
6
|
+
border-radius: 50%;
|
|
7
|
+
|
|
8
|
+
&:after {
|
|
9
|
+
top: 50%;
|
|
10
|
+
left: 50%;
|
|
11
|
+
transform: translate(-50%, -50%);
|
|
12
|
+
background-color: $primary-600;
|
|
13
|
+
width: 75%;
|
|
14
|
+
height: 75%;
|
|
15
|
+
border-radius: 50%;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@import '/src/sass/utilities/variables';
|
|
2
|
+
|
|
3
|
+
.search-container {
|
|
4
|
+
border-radius: 12px;
|
|
5
|
+
border: 1px solid $text-300;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
min-width: 150px;
|
|
10
|
+
|
|
11
|
+
&__input {
|
|
12
|
+
width: 100%;
|
|
13
|
+
border: 0px;
|
|
14
|
+
padding: 12px 16px;
|
|
15
|
+
background-color: transparent;
|
|
16
|
+
|
|
17
|
+
&:focus {
|
|
18
|
+
outline: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&::placeholder {
|
|
22
|
+
color: $text-400;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.is-disabled {
|
|
26
|
+
opacity: 0.5 !important;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__button-search {
|
|
31
|
+
padding: 5px;
|
|
32
|
+
|
|
33
|
+
.button {
|
|
34
|
+
padding-left: 10px;
|
|
35
|
+
padding-right: 10px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&--sm {
|
|
40
|
+
input {
|
|
41
|
+
font-size: 12px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&--md {
|
|
46
|
+
input {
|
|
47
|
+
font-size: 14px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {ComponentStory, ComponentMeta} from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import {Search} from './Search';
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Form/Search',
|
|
6
|
+
component: Search,
|
|
7
|
+
args: {
|
|
8
|
+
size: 'normal',
|
|
9
|
+
placeholder: 'Buscar...',
|
|
10
|
+
backgroundColor: '#F5F5F5',
|
|
11
|
+
buttonSearch: {
|
|
12
|
+
label: 'Buscar',
|
|
13
|
+
fill: 'solid',
|
|
14
|
+
icon: 'fa-solid fa-magnifying-glass',
|
|
15
|
+
type: 'button',
|
|
16
|
+
onClick: () => console.log('Button Clicked'),
|
|
17
|
+
},
|
|
18
|
+
onChange: value => console.log('Valor al cambiar input: ', value),
|
|
19
|
+
onSearch: value => console.log('Se buscó el texto: ' + value),
|
|
20
|
+
},
|
|
21
|
+
} as ComponentMeta<typeof Search>;
|
|
22
|
+
|
|
23
|
+
const Template: ComponentStory<typeof Search> = args => <Search {...args} />;
|
|
24
|
+
|
|
25
|
+
export const Standard = Template.bind({});
|
|
26
|
+
Standard.args = {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, {useRef, useState} from 'react';
|
|
2
|
+
import './Search.scss';
|
|
3
|
+
import {Button, IButton} from '../../Elements/Button/Button';
|
|
4
|
+
|
|
5
|
+
export interface ISearch extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
6
|
+
// base
|
|
7
|
+
size: 'small' | 'normal' | 'medium' | 'large';
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
buttonSearch?: IButton;
|
|
12
|
+
name?: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
|
|
15
|
+
// bool
|
|
16
|
+
isDisabled?: boolean;
|
|
17
|
+
|
|
18
|
+
// events
|
|
19
|
+
onChangeInput?: (label: string) => void;
|
|
20
|
+
onSearch?: (label: string) => void;
|
|
21
|
+
|
|
22
|
+
// react
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const Search = ({
|
|
27
|
+
size,
|
|
28
|
+
backgroundColor,
|
|
29
|
+
placeholder,
|
|
30
|
+
defaultValue,
|
|
31
|
+
buttonSearch,
|
|
32
|
+
name,
|
|
33
|
+
id,
|
|
34
|
+
isDisabled,
|
|
35
|
+
onChangeInput,
|
|
36
|
+
onSearch,
|
|
37
|
+
className,
|
|
38
|
+
...props
|
|
39
|
+
}: ISearch) => {
|
|
40
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
41
|
+
|
|
42
|
+
const handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
|
43
|
+
if (event.key === 'Enter') {
|
|
44
|
+
searchAction();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const searchAction = () => {
|
|
49
|
+
const searchText = inputRef.current?.value;
|
|
50
|
+
|
|
51
|
+
onSearch && onSearch(searchText ? searchText : '');
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div className={`elv-component elv-search`} {...props}>
|
|
56
|
+
<div
|
|
57
|
+
className={`elv-component search-container search-container--${size} ${className ? className : ''}`}
|
|
58
|
+
style={{backgroundColor: backgroundColor}}
|
|
59
|
+
>
|
|
60
|
+
<input
|
|
61
|
+
className={`search-container__input + ${isDisabled ? 'is-disabled' : ''}`}
|
|
62
|
+
type="text"
|
|
63
|
+
name={name}
|
|
64
|
+
id={id}
|
|
65
|
+
placeholder={placeholder}
|
|
66
|
+
onChange={e => onChangeInput && onChangeInput(e.target.value)}
|
|
67
|
+
defaultValue={defaultValue}
|
|
68
|
+
ref={inputRef}
|
|
69
|
+
disabled={isDisabled}
|
|
70
|
+
onKeyDown={handleKeyPress}
|
|
71
|
+
/>
|
|
72
|
+
<span className="search-container__button-search">
|
|
73
|
+
<Button
|
|
74
|
+
{...buttonSearch}
|
|
75
|
+
size={size}
|
|
76
|
+
onClick={() => {
|
|
77
|
+
searchAction();
|
|
78
|
+
}}
|
|
79
|
+
></Button>
|
|
80
|
+
</span>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {ComponentStory, ComponentMeta} from '@storybook/react';
|
|
2
|
+
import {Select} from './Select';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Form/Select',
|
|
6
|
+
component: Select,
|
|
7
|
+
args: {
|
|
8
|
+
size: 'md',
|
|
9
|
+
fill: 'outline',
|
|
10
|
+
disabled: false,
|
|
11
|
+
error: false,
|
|
12
|
+
placeholder: 'Default Select',
|
|
13
|
+
defaultValue: '2',
|
|
14
|
+
maxCharacter: 20,
|
|
15
|
+
options: [
|
|
16
|
+
{value: '1', label: 'Option 1', icon: 'fa fa-house'},
|
|
17
|
+
{value: '2', label: 'Option 2'},
|
|
18
|
+
{value: '3', label: 'Option 3'},
|
|
19
|
+
{value: '4', label: 'Option 4', icon: 'fa fa-house'},
|
|
20
|
+
{value: '5', label: 'Option 5'},
|
|
21
|
+
{value: '6', label: 'Option 6'},
|
|
22
|
+
{value: '7', label: 'Option 7'},
|
|
23
|
+
{value: '8', label: 'Option 8'},
|
|
24
|
+
],
|
|
25
|
+
onChange: () => {
|
|
26
|
+
console.log('Select changed');
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
} as ComponentMeta<typeof Select>;
|
|
30
|
+
|
|
31
|
+
const Template: ComponentStory<typeof Select> = args => <Select {...args} />;
|
|
32
|
+
|
|
33
|
+
export const Outline = Template.bind({});
|
|
34
|
+
Outline.args = {
|
|
35
|
+
fill: 'outline',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Rounded = Template.bind({});
|
|
39
|
+
Rounded.args = {
|
|
40
|
+
fill: 'rounded',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const Underline = Template.bind({});
|
|
44
|
+
Underline.args = {
|
|
45
|
+
fill: 'underline',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Unstyled = Template.bind({});
|
|
49
|
+
Unstyled.args = {
|
|
50
|
+
fill: 'unstyled',
|
|
51
|
+
};
|
|
52
|
+
export const Background = Template.bind({});
|
|
53
|
+
Background.args = {
|
|
54
|
+
fill: 'background',
|
|
55
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {SetStateAction, useEffect, useState} from 'react';
|
|
2
|
+
import './select.scss';
|
|
3
|
+
import {shortenText} from '../../../utils/functions';
|
|
4
|
+
|
|
5
|
+
export interface ISelect extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
6
|
+
// base
|
|
7
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
8
|
+
fill?: 'outline' | 'rounded' | 'underline' | 'unstyled' | 'background';
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
options: {
|
|
12
|
+
value: string;
|
|
13
|
+
label: string;
|
|
14
|
+
icon?: string;
|
|
15
|
+
}[];
|
|
16
|
+
minWidth?: string;
|
|
17
|
+
maxCharacters?: number;
|
|
18
|
+
|
|
19
|
+
// boolean
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
error?: boolean;
|
|
22
|
+
|
|
23
|
+
// events
|
|
24
|
+
onChangeSelect?: (value: string) => void;
|
|
25
|
+
|
|
26
|
+
// react
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Select = ({
|
|
31
|
+
size = 'md',
|
|
32
|
+
fill = 'outline',
|
|
33
|
+
disabled = false,
|
|
34
|
+
placeholder,
|
|
35
|
+
error,
|
|
36
|
+
options,
|
|
37
|
+
defaultValue,
|
|
38
|
+
minWidth,
|
|
39
|
+
maxCharacters = 30,
|
|
40
|
+
onChangeSelect,
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}: ISelect) => {
|
|
44
|
+
const [selectedValue, setSelectedValue] = useState('');
|
|
45
|
+
const [selectedLabel, setSelectedLabel] = useState(placeholder || '');
|
|
46
|
+
const [visibleDropdown, setVisibleDropdown] = useState(false);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (defaultValue && options) {
|
|
50
|
+
const defaultOption = options.find(option => option.value === defaultValue);
|
|
51
|
+
if (defaultOption) {
|
|
52
|
+
setSelectedValue(defaultOption.value);
|
|
53
|
+
setSelectedLabel(defaultOption.label);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, [defaultValue, options]);
|
|
57
|
+
|
|
58
|
+
function closeDrop(): React.MouseEventHandler<HTMLDivElement> {
|
|
59
|
+
return (event: React.MouseEvent<HTMLDivElement>) => {
|
|
60
|
+
setVisibleDropdown(false);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function changeDrop(): React.MouseEventHandler<HTMLDivElement> {
|
|
65
|
+
return (event: React.MouseEvent<HTMLDivElement>) => {
|
|
66
|
+
setVisibleDropdown(!visibleDropdown);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function setActiveLabel(value: string, label: string): React.MouseEventHandler<HTMLLIElement> {
|
|
71
|
+
return (event: React.MouseEvent<HTMLLIElement>) => {
|
|
72
|
+
if (onChangeSelect) {
|
|
73
|
+
onChangeSelect(value);
|
|
74
|
+
}
|
|
75
|
+
setSelectedValue(value);
|
|
76
|
+
setSelectedLabel(label);
|
|
77
|
+
setVisibleDropdown(false);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div className="elv-component elv-select" style={{minWidth: minWidth}} {...props}>
|
|
83
|
+
<div className={`select-container ${className ? className : ''}`} onMouseLeave={closeDrop()}>
|
|
84
|
+
<div
|
|
85
|
+
className={[
|
|
86
|
+
'select-container__select',
|
|
87
|
+
`select--${fill}`,
|
|
88
|
+
`select--${size}`,
|
|
89
|
+
`${error ? `select--error` : ''} ${disabled ? `select--disabled` : ''}`,
|
|
90
|
+
,
|
|
91
|
+
].join(' ')}
|
|
92
|
+
onClick={changeDrop()}
|
|
93
|
+
>
|
|
94
|
+
{defaultValue !== undefined || !defaultValue ? (
|
|
95
|
+
selectedLabel && <span>{shortenText(selectedLabel, maxCharacters)}</span>
|
|
96
|
+
) : (
|
|
97
|
+
<span>{shortenText(placeholder || '', maxCharacters)}</span>
|
|
98
|
+
)}
|
|
99
|
+
</div>
|
|
100
|
+
<div className={`select-container__dropdown select--${size} ${visibleDropdown ? 'select-container__dropdown--active' : ''}`}>
|
|
101
|
+
<ul className="dropdown__list">
|
|
102
|
+
{placeholder && (
|
|
103
|
+
<li
|
|
104
|
+
className={`list__item list__item--default ${selectedValue == placeholder ? 'list__item--active' : ''}`}
|
|
105
|
+
onClick={() => setActiveLabel('', placeholder)}
|
|
106
|
+
>
|
|
107
|
+
{shortenText(placeholder, maxCharacters)}
|
|
108
|
+
</li>
|
|
109
|
+
)}
|
|
110
|
+
{options?.map((item, index) => (
|
|
111
|
+
<li key={index} className={`list__item`} onClick={setActiveLabel(item.value, item.label)}>
|
|
112
|
+
{item.icon && <i className={`item__icon ${item.icon}`}></i>}
|
|
113
|
+
{shortenText(item.label, maxCharacters)}
|
|
114
|
+
</li>
|
|
115
|
+
))}
|
|
116
|
+
</ul>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
};
|