@alveole/components 1.8.2 → 1.8.4
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/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/ui/Autocomplete/Autocomplete.js +1 -1
- package/dist/ui/Autocomplete/Autocomplete.stories.d.ts +2 -10
- package/dist/ui/Autocomplete/Autocomplete.stories.d.ts.map +1 -1
- package/dist/ui/Autocomplete/Autocomplete.styles.d.ts +2 -10
- package/dist/ui/Autocomplete/Autocomplete.styles.d.ts.map +1 -1
- package/dist/ui/Autocomplete/Autocomplete.styles.js +2 -10
- package/dist/ui/Autocomplete/Autocomplete.web.d.ts.map +1 -1
- package/dist/ui/Autocomplete/Autocomplete.web.js +15 -9
- package/dist/ui/Checkbox/Checkbox.js +1 -1
- package/dist/ui/DateInput/DateInput.ios.js +1 -1
- package/dist/ui/DateInput/DateInput.js +1 -1
- package/dist/ui/DateInput/DateInput.web.js +1 -1
- package/dist/ui/DurationInput/DurationInput.js +1 -1
- package/dist/ui/EmailField/EmailField.js +1 -1
- package/dist/ui/FileField/FileField.js +1 -1
- package/dist/ui/FormControl/FormControlDateInput.d.ts.map +1 -1
- package/dist/ui/FormControl/FormControlDateInput.js +12 -2
- package/dist/ui/FormControl/FormControlHint.js +1 -1
- package/dist/ui/FormControl/FormControlLabel.js +2 -2
- package/dist/ui/FormControl/FormControlNumberInput.d.ts.map +1 -1
- package/dist/ui/FormControl/FormControlNumberInput.js +12 -2
- package/dist/ui/NumberField/NumberField.js +1 -1
- package/dist/ui/NumberField/NumberField.web.js +1 -1
- package/dist/ui/OtpField/OtpField.js +1 -1
- package/dist/ui/PasswordField/PasswordField.js +1 -1
- package/dist/ui/PhoneField/PhoneField.js +1 -1
- package/dist/ui/RadioGroup/RadioGroup.js +1 -1
- package/dist/ui/Select/Select.js +1 -1
- package/dist/ui/SelectMultiple/SelectMultiple.stories.d.ts +0 -6
- package/dist/ui/SelectMultiple/SelectMultiple.stories.d.ts.map +1 -1
- package/dist/ui/SelectMultiple/SelectMultiple.styles.d.ts +0 -6
- package/dist/ui/SelectMultiple/SelectMultiple.styles.d.ts.map +1 -1
- package/dist/ui/SelectMultiple/SelectMultiple.styles.js +0 -6
- package/dist/ui/SelectMultiple/SelectMultiple.web.d.ts.map +1 -1
- package/dist/ui/SelectMultiple/SelectMultiple.web.js +16 -13
- package/dist/ui/Switch/Switch.js +1 -1
- package/dist/ui/TextField/TextField.js +1 -1
- package/dist/ui/TextareaField/TextareaField.js +1 -1
- package/dist/ui/TimeInput/TimeInput.js +1 -1
- package/dist/ui/TimeInput/TimeInput.web.js +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ALVEOLE_COMPONENTS_VERSION: "1.8.
|
|
1
|
+
export declare const ALVEOLE_COMPONENTS_VERSION: "1.8.4";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ALVEOLE_COMPONENTS_VERSION = "1.8.
|
|
1
|
+
export const ALVEOLE_COMPONENTS_VERSION = "1.8.4";
|
|
@@ -116,7 +116,7 @@ export const Autocomplete = (props) => {
|
|
|
116
116
|
setSyncedValueKey(currentValueKey);
|
|
117
117
|
setSelected(value ?? []);
|
|
118
118
|
}
|
|
119
|
-
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(Pressable, { onPress: onPressInput, disabled: disabled, style: styles.input, children: _jsxs(Box, { style: styles.inputInner, children: [selected.length === 0 ? (_jsx(Typography, { style: styles.inputPlaceholder, children: placeholder })) : (_jsx(Box, { display: "flex", flexDirection: "row", gap: '050', flexWrap: "wrap", children: selected.map(renderChipConstrained) })), _jsx(LucideIcon, { name: "ChevronDown", size: "sm", style: styles.autocompleteIcon })] }) }), (error || success) && _jsx(FormControlCaption, { error: error, success: success }), _jsx(Modal, { visible: open, animationType: "fade", transparent: true, onRequestClose: () => setOpen(false), children: _jsx(KeyboardAvoidingView, { behavior: Platform.select({ ios: 'padding', android: undefined }), style: { ...styles.modalOverlay, flex: 1, paddingTop: top }, children: _jsxs(Box, { style: { ...styles.modalContent }, children: [_jsxs(Box, { tag: "modal-header", style: styles.modalHeader, children: [_jsx(Typography, { style: styles.nativeLabel, children: label ?? 'Sélection' }), _jsx(Box, { ml: 'auto', mr: "100", children: _jsx(ButtonIcon, { icon: "Check", variant: "primary", onPress: () => setOpen(false) }) })] }), _jsx(Divider, { mt: '050', mb: '050' }), !isMulti && (_jsx(Box, { pl: "100", pr: "100", children: selected.length > 0 && (_jsxs(Box, { mt: 'auto', children: [_jsxs(Box, { display: "flex", pl: '100', flexDirection: "row", gap: '050', children: [_jsx(LucideIcon, { name: "Check", size: "md", style: { margin: 'auto' } }), _jsx(Typography, { mr: 48, mt: 4, style: styles.nativeSimpleValue, children: selected[0]?.label })] }), allowEmpty && (_jsxs(_Fragment, { children: [_jsx(Box, { display: "flex", flexDirection: "row", justify: 'flex-end', mt: '050', children: _jsx(Button, { noPadding: true, title: "Effacer", size: "md", variant: "tertiary", endIcon: 'Trash', onPress: () => commit([]) }) }), disabledSearch && _jsx(Divider, { mt: '050' })] }))] })) })), !disabledSearch && (_jsx(Box, { pl: "100", pr: "100", pb: "100", children: _jsx(TextField, { ref: searchRef, label: "", value: query, onChangeText: handleSearchChange, placeholder: placeholder ?? 'Rechercher…', editable: !disabledFilterSearch }) })), allowCreate && query.trim().length > 0 && !hasExactLabel && (_jsx(Pressable, { onPress: handleCreateFromQuery, style: styles.nativeItem, children: _jsxs(Box, { display: "flex", flexDirection: "row", gap: '050', children: [_jsx(LucideIcon, { name: "Plus", size: "md" }), _jsx(Typography, { style: styles.nativeItemTextNew, children: createOptionLabel(query.trim()) })] }) })), filteredOptions.length === 0 ? (allowCreate && query.trim().length > 0 && !hasExactLabel ? null : (_jsx(Box, { pl: "100", pr: "100", children: _jsx(Typography, { children: "Aucun r\u00E9sultat" }) }))) : (_jsx(FlashList, { data: filteredOptions, keyExtractor: item => item.value, keyboardShouldPersistTaps: "handled", ItemSeparatorComponent: Divider, contentContainerStyle: { paddingBottom: bottom }, renderItem: ({ item, index }) => {
|
|
119
|
+
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(Pressable, { onPress: onPressInput, disabled: disabled, style: styles.input, children: _jsxs(Box, { style: styles.inputInner, children: [selected.length === 0 ? (_jsx(Typography, { style: styles.inputPlaceholder, children: placeholder })) : (_jsx(Box, { display: "flex", flexDirection: "row", gap: '050', flexWrap: "wrap", children: selected.map(renderChipConstrained) })), _jsx(LucideIcon, { name: "ChevronDown", size: "sm", style: styles.autocompleteIcon })] }) }), (error || success) && _jsx(FormControlCaption, { error: error, success: success }), _jsx(Modal, { visible: open, animationType: "fade", transparent: true, onRequestClose: () => setOpen(false), children: _jsx(KeyboardAvoidingView, { behavior: Platform.select({ ios: 'padding', android: undefined }), style: { ...styles.modalOverlay, flex: 1, paddingTop: top }, children: _jsxs(Box, { style: { ...styles.modalContent }, children: [_jsxs(Box, { tag: "modal-header", style: styles.modalHeader, children: [_jsx(Typography, { style: styles.nativeLabel, children: label ?? 'Sélection' }), _jsx(Box, { ml: 'auto', mr: "100", children: _jsx(ButtonIcon, { icon: "Check", variant: "primary", onPress: () => setOpen(false) }) })] }), _jsx(Divider, { mt: '050', mb: '050' }), !isMulti && (_jsx(Box, { pl: "100", pr: "100", children: selected.length > 0 && (_jsxs(Box, { mt: 'auto', children: [_jsxs(Box, { display: "flex", pl: '100', flexDirection: "row", gap: '050', children: [_jsx(LucideIcon, { name: "Check", size: "md", style: { margin: 'auto' } }), _jsx(Typography, { mr: 48, mt: 4, style: styles.nativeSimpleValue, children: selected[0]?.label })] }), allowEmpty && (_jsxs(_Fragment, { children: [_jsx(Box, { display: "flex", flexDirection: "row", justify: 'flex-end', mt: '050', children: _jsx(Button, { noPadding: true, title: "Effacer", size: "md", variant: "tertiary", endIcon: 'Trash', onPress: () => commit([]) }) }), disabledSearch && _jsx(Divider, { mt: '050' })] }))] })) })), !disabledSearch && (_jsx(Box, { pl: "100", pr: "100", pb: "100", children: _jsx(TextField, { ref: searchRef, label: "", value: query, onChangeText: handleSearchChange, placeholder: placeholder ?? 'Rechercher…', editable: !disabledFilterSearch }) })), allowCreate && query.trim().length > 0 && !hasExactLabel && (_jsx(Pressable, { onPress: handleCreateFromQuery, style: styles.nativeItem, children: _jsxs(Box, { display: "flex", flexDirection: "row", gap: '050', children: [_jsx(LucideIcon, { name: "Plus", size: "md" }), _jsx(Typography, { style: styles.nativeItemTextNew, children: createOptionLabel(query.trim()) })] }) })), filteredOptions.length === 0 ? (allowCreate && query.trim().length > 0 && !hasExactLabel ? null : (_jsx(Box, { pl: "100", pr: "100", children: _jsx(Typography, { children: "Aucun r\u00E9sultat" }) }))) : (_jsx(FlashList, { data: filteredOptions, keyExtractor: item => item.value, keyboardShouldPersistTaps: "handled", ItemSeparatorComponent: Divider, contentContainerStyle: { paddingBottom: bottom }, renderItem: ({ item, index }) => {
|
|
120
120
|
const isSelected = selectedIndexByValue.has(item.value);
|
|
121
121
|
const prevItem = filteredOptions[index - 1];
|
|
122
122
|
const showGroupHeader = isAutocompleteOptionWithGroup(item) &&
|
|
@@ -77,18 +77,9 @@ declare const _default: {
|
|
|
77
77
|
display: "none";
|
|
78
78
|
};
|
|
79
79
|
dropdownIndicator: {
|
|
80
|
-
color: string;
|
|
81
80
|
padding: string | number;
|
|
82
81
|
};
|
|
83
|
-
dropdownIndicatorDisabled: {
|
|
84
|
-
display: "none";
|
|
85
|
-
};
|
|
86
|
-
separatorIndicator: {
|
|
87
|
-
color: string;
|
|
88
|
-
};
|
|
89
|
-
indicatorSeparatorDisabled: {
|
|
90
|
-
display: "none";
|
|
91
|
-
};
|
|
82
|
+
dropdownIndicatorDisabled: {};
|
|
92
83
|
clearIndicator: {
|
|
93
84
|
color: string;
|
|
94
85
|
padding: string | number;
|
|
@@ -165,6 +156,7 @@ declare const _default: {
|
|
|
165
156
|
position: "absolute";
|
|
166
157
|
right: string | number;
|
|
167
158
|
top: string;
|
|
159
|
+
color: string;
|
|
168
160
|
};
|
|
169
161
|
modalOverlay: {
|
|
170
162
|
flex: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/Autocomplete/Autocomplete.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAiE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC
|
|
1
|
+
{"version":3,"file":"Autocomplete.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/Autocomplete/Autocomplete.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAiE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGlH,wBAOkB;AAUlB,eAAO,MAAM,OAAO,yBAanB,CAAC;AAEF,eAAO,MAAM,WAAW,yBAevB,CAAC;AAEF,eAAO,MAAM,UAAU,yBA0BtB,CAAC;AAEF,eAAO,MAAM,UAAU,yBAmBtB,CAAC;AAEF,eAAO,MAAM,WAAW,yBAcvB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,gCAAgC,CAAC"}
|
|
@@ -69,18 +69,9 @@ export declare const useStyles: () => {
|
|
|
69
69
|
display: "none";
|
|
70
70
|
};
|
|
71
71
|
dropdownIndicator: {
|
|
72
|
-
color: string;
|
|
73
72
|
padding: string | number;
|
|
74
73
|
};
|
|
75
|
-
dropdownIndicatorDisabled: {
|
|
76
|
-
display: "none";
|
|
77
|
-
};
|
|
78
|
-
separatorIndicator: {
|
|
79
|
-
color: string;
|
|
80
|
-
};
|
|
81
|
-
indicatorSeparatorDisabled: {
|
|
82
|
-
display: "none";
|
|
83
|
-
};
|
|
74
|
+
dropdownIndicatorDisabled: {};
|
|
84
75
|
clearIndicator: {
|
|
85
76
|
color: string;
|
|
86
77
|
padding: string | number;
|
|
@@ -157,6 +148,7 @@ export declare const useStyles: () => {
|
|
|
157
148
|
position: "absolute";
|
|
158
149
|
right: string | number;
|
|
159
150
|
top: string;
|
|
151
|
+
color: string;
|
|
160
152
|
};
|
|
161
153
|
modalOverlay: {
|
|
162
154
|
flex: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/Autocomplete/Autocomplete.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"Autocomplete.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/Autocomplete/Autocomplete.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoKnB,CAAC"}
|
|
@@ -67,18 +67,9 @@ export const useStyles = makeStyles(({ text, color, spacing, radius }) => ({
|
|
|
67
67
|
display: 'none',
|
|
68
68
|
},
|
|
69
69
|
dropdownIndicator: {
|
|
70
|
-
color: color.text['default-grey'],
|
|
71
70
|
padding: spacing('025'),
|
|
72
71
|
},
|
|
73
|
-
dropdownIndicatorDisabled: {
|
|
74
|
-
display: 'none',
|
|
75
|
-
},
|
|
76
|
-
separatorIndicator: {
|
|
77
|
-
color: color.text['default-grey'],
|
|
78
|
-
},
|
|
79
|
-
indicatorSeparatorDisabled: {
|
|
80
|
-
display: 'none',
|
|
81
|
-
},
|
|
72
|
+
dropdownIndicatorDisabled: {},
|
|
82
73
|
clearIndicator: {
|
|
83
74
|
color: color.text['default-grey'],
|
|
84
75
|
padding: spacing('025'),
|
|
@@ -131,6 +122,7 @@ export const useStyles = makeStyles(({ text, color, spacing, radius }) => ({
|
|
|
131
122
|
position: 'absolute',
|
|
132
123
|
right: spacing('100'),
|
|
133
124
|
top: '50%',
|
|
125
|
+
color: color.light.text['default-grey'],
|
|
134
126
|
},
|
|
135
127
|
modalOverlay: {
|
|
136
128
|
flex: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.web.d.ts","sourceRoot":"","sources":["../../../src/ui/Autocomplete/Autocomplete.web.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Autocomplete.web.d.ts","sourceRoot":"","sources":["../../../src/ui/Autocomplete/Autocomplete.web.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAqB,MAAM,gBAAgB,CAAC;AAGvE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;iDAkDnB,CAAH;;;;;;;;;;6BAgID,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, FormControl, FormControlCaption, FormControlHint, FormControlLabel, InputHeading, } from '@alveole/components';
|
|
2
|
+
import { Box, FormControl, FormControlCaption, FormControlHint, FormControlLabel, InputHeading, LucideIcon, } from '@alveole/components';
|
|
3
3
|
import { useTheme } from '@alveole/theme';
|
|
4
4
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
5
|
-
import ReactSelect from 'react-select';
|
|
5
|
+
import ReactSelect, { components } from 'react-select';
|
|
6
6
|
import { useStyles } from './Autocomplete.styles';
|
|
7
7
|
export const Autocomplete = React.forwardRef(function Select(props, ref) {
|
|
8
8
|
const { value, disabledFilterSearch, label, labelRight, hint, error, success, placeholder, disabled, isMulti, isSearchable, onChange, onSearchChange, } = props;
|
|
@@ -36,6 +36,10 @@ export const Autocomplete = React.forwardRef(function Select(props, ref) {
|
|
|
36
36
|
...s,
|
|
37
37
|
...styles.control,
|
|
38
38
|
...(p.isDisabled ? styles.controlDisabled : {}),
|
|
39
|
+
boxShadow: 'none',
|
|
40
|
+
outline: p.isFocused ? `2px solid ${color.light.system.focus}` : 'none',
|
|
41
|
+
outlineOffset: 2,
|
|
42
|
+
':hover': { borderColor: styles.control.borderColor },
|
|
39
43
|
}),
|
|
40
44
|
multiValue: (s, p) => ({
|
|
41
45
|
...s,
|
|
@@ -56,13 +60,13 @@ export const Autocomplete = React.forwardRef(function Select(props, ref) {
|
|
|
56
60
|
...styles.dropdownIndicator,
|
|
57
61
|
...(p.isDisabled ? styles.dropdownIndicatorDisabled : {}),
|
|
58
62
|
}),
|
|
59
|
-
indicatorSeparator: (
|
|
63
|
+
indicatorSeparator: () => ({ display: 'none' }),
|
|
64
|
+
placeholder: s => ({ ...s, color: color.light.text['mention-grey'] }),
|
|
65
|
+
clearIndicator: s => ({ ...s, ...styles.clearIndicator }),
|
|
66
|
+
valueContainer: s => ({
|
|
60
67
|
...s,
|
|
61
|
-
...
|
|
62
|
-
...(p.isDisabled ? styles.indicatorSeparatorDisabled : {}),
|
|
68
|
+
...(isMulti !== false ? { padding: '0 8px' } : {}),
|
|
63
69
|
}),
|
|
64
|
-
clearIndicator: s => ({ ...s, ...styles.clearIndicator }),
|
|
65
|
-
valueContainer: s => ({ ...s }),
|
|
66
70
|
group: s => ({ ...s, paddingTop: 0, paddingBottom: 0 }),
|
|
67
71
|
groupHeading: () => ({
|
|
68
72
|
backgroundColor: color.light.background['disabled-grey'],
|
|
@@ -75,6 +79,8 @@ export const Autocomplete = React.forwardRef(function Select(props, ref) {
|
|
|
75
79
|
letterSpacing: 0.5,
|
|
76
80
|
}),
|
|
77
81
|
};
|
|
82
|
+
const MultiValueRemove = (props) => (_jsx(components.MultiValueRemove, { ...props, children: _jsx(LucideIcon, { name: "X", size: "xs", color: color.light.text['default-grey'] }) }));
|
|
83
|
+
const DropdownIndicator = (props) => (_jsx(components.DropdownIndicator, { ...props, children: _jsx(LucideIcon, { name: "ChevronDown", size: "sm", color: props.isDisabled ? color.light.text['disabled-grey'] : color.light.text['default-grey'] }) }));
|
|
78
84
|
const clearValues = () => {
|
|
79
85
|
setSelectedOptions([]);
|
|
80
86
|
onChange?.([]);
|
|
@@ -101,12 +107,12 @@ export const Autocomplete = React.forwardRef(function Select(props, ref) {
|
|
|
101
107
|
};
|
|
102
108
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
103
109
|
}, [searchValue]);
|
|
104
|
-
return (_jsxs(FormControl, { style: styles.select, children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(Box, { tag: "form-control-select-input", style: styles.inputContainer, children: _jsx(Box, { style: { ...(disabled ? styles.inputDisabled : {}) }, children: _jsx(ReactSelect, { ref: ref, value: selectedOptions, styles: selectStyles, isMulti: true, placeholder: placeholder, options: options, filterOption: disabledFilterSearch ? () => true : undefined, isSearchable: isSearchable, onInputChange: inputValue => setSearchValue(inputValue), noOptionsMessage: () => 'Aucun résultat', onChange: options => {
|
|
110
|
+
return (_jsxs(FormControl, { style: styles.select, children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(Box, { tag: "form-control-select-input", style: styles.inputContainer, children: _jsx(Box, { style: { ...(disabled ? styles.inputDisabled : {}) }, children: _jsx(ReactSelect, { ref: ref, value: selectedOptions, styles: selectStyles, isMulti: true, placeholder: placeholder, options: options, filterOption: disabledFilterSearch ? () => true : undefined, isSearchable: isSearchable, onInputChange: inputValue => setSearchValue(inputValue), noOptionsMessage: () => 'Aucun résultat', onChange: options => {
|
|
105
111
|
const lastOption = Array.isArray(options) ? options[options.length - 1] : undefined;
|
|
106
112
|
if (isMulti === false && lastOption)
|
|
107
113
|
return onSingleChange(lastOption);
|
|
108
114
|
if (Array.isArray(options))
|
|
109
115
|
return onMultiChange(options);
|
|
110
116
|
return clearValues();
|
|
111
|
-
}, isDisabled: disabled }) }) }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
117
|
+
}, isDisabled: disabled, components: { DropdownIndicator, MultiValueRemove } }) }) }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
112
118
|
});
|
|
@@ -13,5 +13,5 @@ export const Checkbox = React.forwardRef(function Checkbox(props, ref) {
|
|
|
13
13
|
const styles = useStyles();
|
|
14
14
|
const uniqId = useId();
|
|
15
15
|
const id = `checkbox--${variant}--${uniqId}`;
|
|
16
|
-
return (_jsxs(Box, { tag: "check-box-container", gap: error || success ? spacingValue('050') : 0, style: styles.checkboxContainer, children: [_jsxs(Box, { tag: "check-box", style: styles.container, children: [_jsx(CheckboxContainer, { id: id, ref: ref, ...props, children: _jsx(CheckboxIndicator, { ...baseProps, indeterminate: props.checked === 'indeterminate' }) }), label && _jsx(CheckboxLabel, { htmlFor: id, ...baseProps })] }), (error ?? success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
16
|
+
return (_jsxs(Box, { tag: "check-box-container", gap: error || success ? spacingValue('050') : 0, style: styles.checkboxContainer, children: [_jsxs(Box, { tag: "check-box", style: styles.container, children: [_jsx(CheckboxContainer, { id: id, ref: ref, ...props, children: _jsx(CheckboxIndicator, { ...baseProps, indeterminate: props.checked === 'indeterminate' }) }), !!label && _jsx(CheckboxLabel, { htmlFor: id, ...baseProps })] }), (error ?? success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
17
17
|
});
|
|
@@ -41,5 +41,5 @@ export const DateInput = React.forwardRef(function DateInput(props, ref) {
|
|
|
41
41
|
}
|
|
42
42
|
return '';
|
|
43
43
|
}, [type]);
|
|
44
|
-
return (_jsxs(Box, { tag: "date-input", onPress: handleOpen, children: [_jsx(FormControlModal, { open: open, onClose: () => setOpen(false), submitLabel: "Valider", onSubmit: handleValidate, children: _jsx(Box, { style: { marginTop: 'auto' }, children: _jsx(DateTimePicker, { value: toDate(date), mode: type === 'month' ? 'date' : type, locale: 'fr', maximumDate: maximumDate, minimumDate: minimumDate, is24Hour: is24Hour, minuteInterval: minuteInterval, themeVariant: "light", display: Platform.OS === 'ios' ? 'spinner' : 'default', onChange: handleChange }) }) }), _jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, placeholder: "JJ/MM/AAAA", value: displayValue(value), ...inputProps, caretHidden: true, inputMode: "none", onPress: handleOpen, readOnly: true }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] })] }));
|
|
44
|
+
return (_jsxs(Box, { tag: "date-input", onPress: handleOpen, children: [_jsx(FormControlModal, { open: open, onClose: () => setOpen(false), submitLabel: "Valider", onSubmit: handleValidate, children: _jsx(Box, { style: { marginTop: 'auto' }, children: _jsx(DateTimePicker, { value: toDate(date), mode: type === 'month' ? 'date' : type, locale: 'fr', maximumDate: maximumDate, minimumDate: minimumDate, is24Hour: is24Hour, minuteInterval: minuteInterval, themeVariant: "light", display: Platform.OS === 'ios' ? 'spinner' : 'default', onChange: handleChange }) }) }), _jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, placeholder: "JJ/MM/AAAA", value: displayValue(value), ...inputProps, caretHidden: true, inputMode: "none", onPress: handleOpen, readOnly: true }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] })] }));
|
|
45
45
|
});
|
|
@@ -66,5 +66,5 @@ export const DateInput = React.forwardRef(function DateInput({ label, labelRight
|
|
|
66
66
|
return 'JJ/MM/AAAA';
|
|
67
67
|
return displayDate(selectedDate, { format: DateFormats.DateSlash });
|
|
68
68
|
}, [selectedDate, type]);
|
|
69
|
-
return (_jsx(Box, { tag: "date-input", onPress: handleOpen, children: _jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, placeholder: "JJ/MM/AAAA", value: displayValue(value), ...props, readOnly: true, onPress: handleOpen, caretHidden: true, inputMode: "none" }), showPicker && (_jsx(DateTimePicker, { value: selectedDate, mode: mode, locale: 'fr', display: display ?? 'default', maximumDate: maximumDate, minimumDate: minimumDate, onChange: handleChange, is24Hour: is24Hour, minuteInterval: minuteInterval })), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }) }));
|
|
69
|
+
return (_jsx(Box, { tag: "date-input", onPress: handleOpen, children: _jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, placeholder: "JJ/MM/AAAA", value: displayValue(value), ...props, readOnly: true, onPress: handleOpen, caretHidden: true, inputMode: "none" }), !!showPicker && (_jsx(DateTimePicker, { value: selectedDate, mode: mode, locale: 'fr', display: display ?? 'default', maximumDate: maximumDate, minimumDate: minimumDate, onChange: handleChange, is24Hour: is24Hour, minuteInterval: minuteInterval })), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }) }));
|
|
70
70
|
});
|
|
@@ -5,5 +5,5 @@ import { useStyles } from './DateInput.styles';
|
|
|
5
5
|
export const DateInput = React.forwardRef(function DateInput(props, ref) {
|
|
6
6
|
const { label, hint, disabled, error, success } = props;
|
|
7
7
|
const styles = useStyles();
|
|
8
|
-
return (_jsxs(FormControl, { style: styles.dateInput, children: [_jsxs(InputHeading, { children: [label && _jsx(FormControlLabel, { label: label, disabled: disabled, error: error, success: success }), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(FormControlDateInput, { ref: ref, ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
8
|
+
return (_jsxs(FormControl, { style: styles.dateInput, children: [_jsxs(InputHeading, { children: [!!label && _jsx(FormControlLabel, { label: label, disabled: disabled, error: error, success: success }), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(FormControlDateInput, { ref: ref, ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
9
9
|
});
|
|
@@ -18,5 +18,5 @@ export const DurationInput = React.forwardRef(function DurationInput({ label, la
|
|
|
18
18
|
onChange?.(localValue);
|
|
19
19
|
onBlur?.();
|
|
20
20
|
};
|
|
21
|
-
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, placeholder: "HH:MM", value: localValue, onChangeText: handleChangeText, onBlur: handleBlur, disabled: disabled, inputMode: "numeric", maxLength: 5 }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
21
|
+
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, placeholder: "HH:MM", value: localValue, onChangeText: handleChangeText, onBlur: handleBlur, disabled: disabled, inputMode: "numeric", maxLength: 5 }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
22
22
|
});
|
|
@@ -4,5 +4,5 @@ import React from 'react';
|
|
|
4
4
|
import { EmailInput } from '../EmailInput';
|
|
5
5
|
export const EmailField = React.forwardRef(function EmailField(props, ref) {
|
|
6
6
|
const { label, labelRight, hint, error, success, disabled, onChange } = props;
|
|
7
|
-
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(EmailInput, { ref: ref, onChangeText: onChange, ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
7
|
+
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(EmailInput, { ref: ref, onChangeText: onChange, ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
8
8
|
});
|
|
@@ -23,5 +23,5 @@ export const FileField = (props) => {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
return (_jsxs(FormControl, { style: styles.fileInput, children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(FormControlFileInput, { ...props, onChange: onValueChange }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
26
|
+
return (_jsxs(FormControl, { style: styles.fileInput, children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(FormControlFileInput, { ...props, onChange: onValueChange }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
27
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControlDateInput.d.ts","sourceRoot":"","sources":["../../../src/ui/FormControl/FormControlDateInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,2BAA2B,GAAG,gBAAgB,CAAC;AAC3D,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAaF,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"FormControlDateInput.d.ts","sourceRoot":"","sources":["../../../src/ui/FormControl/FormControlDateInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,2BAA2B,GAAG,gBAAgB,CAAC;AAC3D,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAaF,eAAO,MAAM,oBAAoB,oGAwDhC,CAAC"}
|
|
@@ -18,6 +18,15 @@ function formatForInput(value, type) {
|
|
|
18
18
|
export const FormControlDateInput = React.forwardRef(function DateInput(props, ref) {
|
|
19
19
|
const { value, type, onChange, ...inputProps } = props;
|
|
20
20
|
const styles = useStyles();
|
|
21
|
+
const [focus, setFocus] = React.useState(false);
|
|
22
|
+
const handleFocus = () => {
|
|
23
|
+
if (!props.disabled && !props.readOnly)
|
|
24
|
+
setFocus(true);
|
|
25
|
+
};
|
|
26
|
+
const handleBlur = () => {
|
|
27
|
+
if (!props.disabled && !props.readOnly)
|
|
28
|
+
setFocus(false);
|
|
29
|
+
};
|
|
21
30
|
const parsed = React.useMemo(() => {
|
|
22
31
|
if (value == null)
|
|
23
32
|
return value;
|
|
@@ -34,13 +43,14 @@ export const FormControlDateInput = React.forwardRef(function DateInput(props, r
|
|
|
34
43
|
return formatForInput(value, 'month');
|
|
35
44
|
return value;
|
|
36
45
|
}, [type, value]);
|
|
37
|
-
return (_jsx(Box, { tag: "form-control-
|
|
46
|
+
return (_jsx(Box, { tag: "form-control-date-input", style: styles.inputContainer, children: _jsx(Box, { tag: "form-control-date-input-inner", style: {
|
|
38
47
|
...styles.inputInner,
|
|
39
48
|
...(props.disabled ? styles.inputDisabled : {}),
|
|
49
|
+
...(focus ? styles.inputFocused : {}),
|
|
40
50
|
}, children: _jsx("input", { ref: ref, onChange: e => {
|
|
41
51
|
const newDate = e.target.value;
|
|
42
52
|
if (type === 'month')
|
|
43
53
|
return onChange?.(newDate + '-01');
|
|
44
54
|
return onChange?.(newDate);
|
|
45
|
-
}, autoComplete: undefined, style: { ...styles.input, ...styles.inputWeb }, type: type === 'datetime' ? 'datetime-local' : (type ?? 'date'), ...inputProps, value: parsed }) }) }));
|
|
55
|
+
}, autoComplete: undefined, style: { ...styles.input, ...styles.inputWeb }, type: type === 'datetime' ? 'datetime-local' : (type ?? 'date'), ...inputProps, value: parsed, onFocus: handleFocus, onBlur: handleBlur }) }) }));
|
|
46
56
|
});
|
|
@@ -4,5 +4,5 @@ import { useStyles } from './FormControl.styles';
|
|
|
4
4
|
export const FormControlHint = (props) => {
|
|
5
5
|
const { hint, disabled } = props;
|
|
6
6
|
const styles = useStyles();
|
|
7
|
-
return (_jsx(Box, { style: styles.hintContainer, children: _jsx(Typography, { style: { ...styles.hint, ...(disabled ? styles.hintDisabled : {}) }, children: hint }) }));
|
|
7
|
+
return (_jsx(Box, { tag: "form-control-hint", style: styles.hintContainer, children: _jsx(Typography, { style: { ...styles.hint, ...(disabled ? styles.hintDisabled : {}) }, children: hint }) }));
|
|
8
8
|
};
|
|
@@ -4,10 +4,10 @@ import { useStyles } from './FormControl.styles';
|
|
|
4
4
|
export const FormControlLabel = (props) => {
|
|
5
5
|
const { label, labelRight, optional = false, optionalText = '(optionnel)', disabled, error, success } = props;
|
|
6
6
|
const styles = useStyles();
|
|
7
|
-
return (_jsxs(Box, { style: styles.labelContainer, children: [_jsx(Typography, { style: {
|
|
7
|
+
return (_jsxs(Box, { tag: "form-control-label", style: styles.labelContainer, children: [_jsx(Typography, { style: {
|
|
8
8
|
...styles.label,
|
|
9
9
|
...(error ? styles.errorText : {}),
|
|
10
10
|
...(success ? styles.successText : {}),
|
|
11
11
|
...(disabled ? styles.labelDisabled : {}),
|
|
12
|
-
}, children: label }), optional && _jsx(Typography, { style: styles.optionalText, children: optionalText }), label && (_jsx(Box, { mt: 'auto', mb: 'auto', ml: 'auto', children: labelRight }))] }));
|
|
12
|
+
}, children: label }), !!optional && _jsx(Typography, { style: styles.optionalText, children: optionalText }), !!label && (_jsx(Box, { mt: 'auto', mb: 'auto', ml: 'auto', children: labelRight }))] }));
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControlNumberInput.d.ts","sourceRoot":"","sources":["../../../src/ui/FormControl/FormControlNumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,6BAA6B,GAAG,gBAAgB,CAAC;AAC7D,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"FormControlNumberInput.d.ts","sourceRoot":"","sources":["../../../src/ui/FormControl/FormControlNumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,6BAA6B,GAAG,gBAAgB,CAAC;AAC7D,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,sBAAsB,sGAoDlC,CAAC"}
|
|
@@ -5,9 +5,19 @@ import { useStyles } from './FormControl.styles';
|
|
|
5
5
|
export const FormControlNumberInput = React.forwardRef(function DateInput(props, ref) {
|
|
6
6
|
const { value, onChange, startAdornment, endAdornment, ...inputProps } = props;
|
|
7
7
|
const styles = useStyles();
|
|
8
|
-
|
|
8
|
+
const [focus, setFocus] = React.useState(false);
|
|
9
|
+
const handleFocus = () => {
|
|
10
|
+
if (!props.disabled && !props.readOnly)
|
|
11
|
+
setFocus(true);
|
|
12
|
+
};
|
|
13
|
+
const handleBlur = () => {
|
|
14
|
+
if (!props.disabled && !props.readOnly)
|
|
15
|
+
setFocus(false);
|
|
16
|
+
};
|
|
17
|
+
return (_jsx(Box, { tag: "form-control-number-input", style: styles.inputContainer, children: _jsxs(Box, { tag: "form-control-number-input-inner", style: {
|
|
9
18
|
...styles.inputInner,
|
|
10
19
|
...(props.disabled ? styles.inputDisabled : {}),
|
|
20
|
+
...(focus ? styles.inputFocused : {}),
|
|
11
21
|
...(endAdornment ? { paddingRight: 0 } : {}),
|
|
12
22
|
...(startAdornment ? { paddingLeft: 0 } : {}),
|
|
13
23
|
}, children: [startAdornment, _jsx("input", { ref: ref, value: value ?? '', onChange: e => {
|
|
@@ -18,5 +28,5 @@ export const FormControlNumberInput = React.forwardRef(function DateInput(props,
|
|
|
18
28
|
...styles.inputWeb,
|
|
19
29
|
...(endAdornment && startAdornment ? { textAlign: 'center' } : {}),
|
|
20
30
|
...(endAdornment ? { minWidth: 0 } : {}),
|
|
21
|
-
}, ...inputProps }), endAdornment] }) }));
|
|
31
|
+
}, ...inputProps, onFocus: handleFocus, onBlur: handleBlur }), endAdornment] }) }));
|
|
22
32
|
});
|
|
@@ -7,7 +7,7 @@ export const NumberField = React.forwardRef(function NumberField(props, ref) {
|
|
|
7
7
|
const { value, label, labelRight, hint, error, success, disabled, onChange } = props;
|
|
8
8
|
const { value: _v, onChange: _e, ...inputProps } = props;
|
|
9
9
|
const styles = useStyles();
|
|
10
|
-
return (_jsxs(FormControl, { style: styles.textInput, children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, ...inputProps, startAdornment: props.controlButton ? (_jsx(NumberFieldControlButton, { action: "moins", step: props.step, disabled: value === 0 || (props.min != null && props.min === value), onPress: add => onChange?.((value ?? 0) + add) })) : (props.startAdornment), endAdornment: props.controlButton ? (_jsx(NumberFieldControlButton, { action: "plus", step: props.step, onPress: add => onChange?.((value ?? 0) + add) })) : (props.endAdornment), value: value ? String(value) : '0', onChangeText: e => {
|
|
10
|
+
return (_jsxs(FormControl, { style: styles.textInput, children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, ...inputProps, startAdornment: props.controlButton ? (_jsx(NumberFieldControlButton, { action: "moins", step: props.step, disabled: value === 0 || (props.min != null && props.min === value), onPress: add => onChange?.((value ?? 0) + add) })) : (props.startAdornment), endAdornment: props.controlButton ? (_jsx(NumberFieldControlButton, { action: "plus", step: props.step, onPress: add => onChange?.((value ?? 0) + add) })) : (props.endAdornment), value: value ? String(value) : '0', onChangeText: e => {
|
|
11
11
|
onChange?.(e === '' ? 0 : Number(e));
|
|
12
12
|
}, keyboardType: 'number-pad', inputMode: 'numeric' }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
13
13
|
});
|
|
@@ -6,5 +6,5 @@ import { NumberFieldControlButton } from './NumberFieldControlButton';
|
|
|
6
6
|
export const NumberField = React.forwardRef(function NumberField(props, ref) {
|
|
7
7
|
const { label, labelRight, hint, error, success, disabled, onChange } = props;
|
|
8
8
|
const styles = useStyles();
|
|
9
|
-
return (_jsxs(FormControl, { style: styles.textInput, children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(FormControlNumberInput, { ref: ref, onChange: onChange, ...props, startAdornment: props.controlButton ? (_jsx(NumberFieldControlButton, { action: "moins", step: props.step, disabled: props.value === 0 || (props.min != null && props.min === props.value), onPress: add => onChange?.((props.value ?? 0) + add) })) : (props.startAdornment), endAdornment: props.controlButton ? (_jsx(NumberFieldControlButton, { action: "plus", step: props.step, onPress: add => onChange?.((props.value ?? 0) + add) })) : (props.endAdornment) }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
9
|
+
return (_jsxs(FormControl, { style: styles.textInput, children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(FormControlNumberInput, { ref: ref, onChange: onChange, ...props, startAdornment: props.controlButton ? (_jsx(NumberFieldControlButton, { action: "moins", step: props.step, disabled: props.value === 0 || (props.min != null && props.min === props.value), onPress: add => onChange?.((props.value ?? 0) + add) })) : (props.startAdornment), endAdornment: props.controlButton ? (_jsx(NumberFieldControlButton, { action: "plus", step: props.step, onPress: add => onChange?.((props.value ?? 0) + add) })) : (props.endAdornment) }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
10
10
|
});
|
|
@@ -5,7 +5,7 @@ import { useStyles } from './OtpField.styles';
|
|
|
5
5
|
export const OtpField = React.forwardRef(function OtpField(props, ref) {
|
|
6
6
|
const { label, labelRight, hint, error, success, disabled, onChange } = props;
|
|
7
7
|
const styles = useStyles();
|
|
8
|
-
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(FormControlOtpInput, { ref: ref, theme: {
|
|
8
|
+
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(FormControlOtpInput, { ref: ref, theme: {
|
|
9
9
|
containerStyle: styles.containerStyle,
|
|
10
10
|
pinCodeContainerStyle: {
|
|
11
11
|
...styles.pinCodeContainerStyle,
|
|
@@ -6,5 +6,5 @@ export const PasswordField = React.forwardRef(function PasswordField(props, ref)
|
|
|
6
6
|
const { label, labelRight, hint, error, success, disabled, onChange } = props;
|
|
7
7
|
const styles = useStyles();
|
|
8
8
|
const [visibilityOff, setVisibilityOff] = React.useState(true);
|
|
9
|
-
return (_jsxs(FormControl, { style: styles.passwordInput, children: [label && (_jsx(FormControlLabel, { label: label, labelRight: labelRight, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled }), _jsx(TextInput, { ref: ref, secureTextEntry: visibilityOff, endAdornment: _jsx(ButtonIcon, { size: "sm", variant: "tertiary", style: styles.visibilityButton, icon: visibilityOff ? 'EyeClosed' : 'Eye', onPress: () => setVisibilityOff(initial => !initial) }), onChangeText: onChange, textContentType: "password", autoComplete: "password", autoCapitalize: "none", inputMode: "text", ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
9
|
+
return (_jsxs(FormControl, { style: styles.passwordInput, children: [!!label && (_jsx(FormControlLabel, { label: label, labelRight: labelRight, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled }), _jsx(TextInput, { ref: ref, secureTextEntry: visibilityOff, endAdornment: _jsx(ButtonIcon, { size: "sm", variant: "tertiary", style: styles.visibilityButton, icon: visibilityOff ? 'EyeClosed' : 'Eye', onPress: () => setVisibilityOff(initial => !initial) }), onChangeText: onChange, textContentType: "password", autoComplete: "password", autoCapitalize: "none", inputMode: "text", ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
10
10
|
});
|
|
@@ -4,5 +4,5 @@ import React from 'react';
|
|
|
4
4
|
import { PhoneInput } from '../PhoneInput';
|
|
5
5
|
export const PhoneField = React.forwardRef(function PhoneField(props, ref) {
|
|
6
6
|
const { label, labelRight, hint, error, success, disabled, onChange } = props;
|
|
7
|
-
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(PhoneInput, { ref: ref, onChangeText: onChange, ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
7
|
+
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(PhoneInput, { ref: ref, onChangeText: onChange, ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
8
8
|
});
|
|
@@ -7,5 +7,5 @@ import { RadioGroupContext } from './RadioGroupContext';
|
|
|
7
7
|
export const RadioGroup = React.forwardRef(function RadioGroup(props, ref) {
|
|
8
8
|
const { children, value, label, labelRight, hint, error, success, disabled, onChange, variant = 'default', ...groupProps } = props;
|
|
9
9
|
const styles = useStyles();
|
|
10
|
-
return (_jsx(RadioGroupContext.Provider, { value: { value, onChange }, children: _jsxs(Box, { tag: "radio-group", style: styles.container, children: [_jsxs(Box, { tag: "radio-group-heading", children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(Box, { width: '100%', children: _jsx(TamaguiRadioGroup, { orientation: "vertical", ref: ref, value: value, onValueChange: onChange, style: [styles.group, variant === 'card' ? styles.groupCard : styles.groupItem], width: "100%", ...groupProps, minWidth: '100%', children: children }) }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }) }));
|
|
10
|
+
return (_jsx(RadioGroupContext.Provider, { value: { value, onChange }, children: _jsxs(Box, { tag: "radio-group", style: styles.container, children: [_jsxs(Box, { tag: "radio-group-heading", children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(Box, { width: '100%', children: _jsx(TamaguiRadioGroup, { orientation: "vertical", ref: ref, value: value, onValueChange: onChange, style: [styles.group, variant === 'card' ? styles.groupCard : styles.groupItem], width: "100%", ...groupProps, minWidth: '100%', children: children }) }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }) }));
|
|
11
11
|
});
|
package/dist/ui/Select/Select.js
CHANGED
|
@@ -18,7 +18,7 @@ export const Select = React.forwardRef(function Select(props, ref) {
|
|
|
18
18
|
setFocus(false);
|
|
19
19
|
onBlur?.(e);
|
|
20
20
|
};
|
|
21
|
-
return (_jsxs(FormControl, { style: styles.pickerContainer, children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(Box, { tag: "form-control-text-input", style: styles.inputContainer, children: _jsxs(Box, { tag: "form-control-text-input-inner", style: {
|
|
21
|
+
return (_jsxs(FormControl, { style: styles.pickerContainer, children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(Box, { tag: "form-control-text-input", style: styles.inputContainer, children: _jsxs(Box, { tag: "form-control-text-input-inner", style: {
|
|
22
22
|
...styles.inputInner,
|
|
23
23
|
...(disabled ? styles.inputDisabled : {}),
|
|
24
24
|
...(focus ? styles.inputFocused : {}),
|
|
@@ -59,12 +59,6 @@ declare const _default: {
|
|
|
59
59
|
dropdownIndicator: {
|
|
60
60
|
padding: string | number;
|
|
61
61
|
};
|
|
62
|
-
dropdownIndicatorDisabled: {
|
|
63
|
-
display: "none";
|
|
64
|
-
};
|
|
65
|
-
indicatorSeparatorDisabled: {
|
|
66
|
-
display: "none";
|
|
67
|
-
};
|
|
68
62
|
clearIndicator: {
|
|
69
63
|
padding: string | number;
|
|
70
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMultiple.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/SelectMultiple/SelectMultiple.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectMultiple.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/SelectMultiple/SelectMultiple.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBAOkB;AASlB,eAAO,MAAM,OAAO,mCAOnB,CAAC;AAEF,eAAO,MAAM,MAAM,mCAMlB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,kCAAkC,CAAC"}
|
|
@@ -53,12 +53,6 @@ export declare const useStyles: () => {
|
|
|
53
53
|
dropdownIndicator: {
|
|
54
54
|
padding: string | number;
|
|
55
55
|
};
|
|
56
|
-
dropdownIndicatorDisabled: {
|
|
57
|
-
display: "none";
|
|
58
|
-
};
|
|
59
|
-
indicatorSeparatorDisabled: {
|
|
60
|
-
display: "none";
|
|
61
|
-
};
|
|
62
56
|
clearIndicator: {
|
|
63
57
|
padding: string | number;
|
|
64
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMultiple.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/SelectMultiple/SelectMultiple.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"SelectMultiple.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/SelectMultiple/SelectMultiple.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DnB,CAAC"}
|
|
@@ -54,12 +54,6 @@ export const useStyles = makeStyles(({ color, spacing }) => ({
|
|
|
54
54
|
dropdownIndicator: {
|
|
55
55
|
padding: spacing('025'),
|
|
56
56
|
},
|
|
57
|
-
dropdownIndicatorDisabled: {
|
|
58
|
-
display: 'none',
|
|
59
|
-
},
|
|
60
|
-
indicatorSeparatorDisabled: {
|
|
61
|
-
display: 'none',
|
|
62
|
-
},
|
|
63
57
|
clearIndicator: {
|
|
64
58
|
padding: spacing('025'),
|
|
65
59
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMultiple.web.d.ts","sourceRoot":"","sources":["../../../src/ui/SelectMultiple/SelectMultiple.web.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectMultiple.web.d.ts","sourceRoot":"","sources":["../../../src/ui/SelectMultiple/SelectMultiple.web.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,oBAAoB,EAAuB,MAAM,kBAAkB,CAAC;AAGlF,eAAO,MAAM,cAAc;;;;;;;;;;;;6BA6FzB,CAAC"}
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, FormControl, FormControlCaption, FormControlHint, FormControlLabel, InputHeading, } from '@alveole/components';
|
|
2
|
+
import { Box, FormControl, FormControlCaption, FormControlHint, FormControlLabel, InputHeading, LucideIcon, } from '@alveole/components';
|
|
3
|
+
import { useTheme } from '@alveole/theme';
|
|
3
4
|
import React from 'react';
|
|
4
|
-
import ReactSelect from 'react-select';
|
|
5
|
+
import ReactSelect, { components } from 'react-select';
|
|
5
6
|
import { useStyles } from './SelectMultiple.styles';
|
|
6
7
|
export const SelectMultiple = React.forwardRef(function SelectMultiple(props, ref) {
|
|
7
8
|
const { value, label, labelRight, hint, error, success, placeholder = '', disabled, options, onChange } = props;
|
|
8
9
|
const styles = useStyles();
|
|
10
|
+
const { color } = useTheme();
|
|
9
11
|
const selectStyles = {
|
|
10
12
|
control: (s, p) => ({
|
|
11
13
|
...s,
|
|
12
14
|
...styles.control,
|
|
13
15
|
...(p.isDisabled ? styles.controlDisabled : {}),
|
|
16
|
+
boxShadow: 'none',
|
|
17
|
+
outline: p.isFocused ? `2px solid ${color.light.system.focus}` : 'none',
|
|
18
|
+
outlineOffset: 2,
|
|
19
|
+
':hover': { borderColor: styles.control.borderColor },
|
|
14
20
|
}),
|
|
15
21
|
valueContainer: s => ({
|
|
16
22
|
...s,
|
|
17
23
|
...styles.valueContainer,
|
|
24
|
+
padding: '0 8px',
|
|
18
25
|
}),
|
|
26
|
+
placeholder: s => ({ ...s, color: color.light.text['mention-grey'] }),
|
|
19
27
|
multiValue: (s, p) => ({
|
|
20
28
|
...s,
|
|
21
29
|
...styles.multiValue,
|
|
@@ -26,24 +34,19 @@ export const SelectMultiple = React.forwardRef(function SelectMultiple(props, re
|
|
|
26
34
|
':hover': styles.multiValueRemoveHover,
|
|
27
35
|
...(p.isDisabled ? styles.multiValueRemoveDisabled : {}),
|
|
28
36
|
}),
|
|
29
|
-
dropdownIndicator:
|
|
30
|
-
|
|
31
|
-
...styles.dropdownIndicator,
|
|
32
|
-
...(p.isDisabled ? styles.dropdownIndicatorDisabled : {}),
|
|
33
|
-
}),
|
|
34
|
-
indicatorSeparator: (s, p) => ({
|
|
35
|
-
...s,
|
|
36
|
-
...(p.isDisabled ? styles.indicatorSeparatorDisabled : {}),
|
|
37
|
-
}),
|
|
37
|
+
dropdownIndicator: s => ({ ...s, ...styles.dropdownIndicator }),
|
|
38
|
+
indicatorSeparator: () => ({ display: 'none' }),
|
|
38
39
|
clearIndicator: s => ({ ...s, ...styles.clearIndicator }),
|
|
39
40
|
};
|
|
41
|
+
const MultiValueRemove = (props) => (_jsx(components.MultiValueRemove, { ...props, children: _jsx(LucideIcon, { name: "X", size: "xs", color: color.light.text['default-grey'] }) }));
|
|
42
|
+
const DropdownIndicator = (props) => (_jsx(components.DropdownIndicator, { ...props, children: _jsx(LucideIcon, { name: "ChevronDown", size: "sm", color: props.isDisabled ? color.light.text['disabled-grey'] : color.light.text['default-grey'] }) }));
|
|
40
43
|
const displayValue = React.useMemo(() => options?.filter(option => Array.isArray(value) && value.some(v => `${v}` === `${option.value}`)), [options, value]);
|
|
41
|
-
return (_jsxs(FormControl, { style: styles.select, children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(Box, { tag: "form-control-select-input", style: styles.inputContainer, children: _jsx(Box, { style: { ...(disabled ? styles.inputDisabled : {}) }, children: _jsx(ReactSelect, { ref: ref, value: displayValue, styles: selectStyles, isMulti: true, placeholder: placeholder, options: options, noOptionsMessage: () => 'Aucun résultat', onChange: selectedOptions => {
|
|
44
|
+
return (_jsxs(FormControl, { style: styles.select, children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(Box, { tag: "form-control-select-input", style: styles.inputContainer, children: _jsx(Box, { style: { ...(disabled ? styles.inputDisabled : {}) }, children: _jsx(ReactSelect, { ref: ref, value: displayValue, styles: selectStyles, isMulti: true, placeholder: placeholder, options: options, noOptionsMessage: () => 'Aucun résultat', onChange: selectedOptions => {
|
|
42
45
|
if (Array.isArray(selectedOptions)) {
|
|
43
46
|
onChange?.(selectedOptions.map(o => String(o.value)));
|
|
44
47
|
}
|
|
45
48
|
else {
|
|
46
49
|
onChange?.([]);
|
|
47
50
|
}
|
|
48
|
-
}, isDisabled: disabled }) }) }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
51
|
+
}, isDisabled: disabled, components: { DropdownIndicator, MultiValueRemove } }) }) }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
49
52
|
});
|
package/dist/ui/Switch/Switch.js
CHANGED
|
@@ -37,6 +37,6 @@ export const Switch = React.forwardRef(function Switch(props, ref) {
|
|
|
37
37
|
...(noPadding ? { padding: 0, marginRight: 0 } : {}),
|
|
38
38
|
};
|
|
39
39
|
const Toggle = (_jsx(TamaguiSwitch, { id: id, ref: ref, borderWidth: 1, checked: value, onCheckedChange: onChange, style: switchButtonStyles, disabled: disabled, ...switchProps, children: _jsx(TamaguiSwitch.Thumb, { animation: "quicker", style: switchThumbStyles }) }));
|
|
40
|
-
const ToggleWithLabel = (_jsxs(_Fragment, { children: [_jsx(Label, { unstyled: true, htmlFor: id, width: '100%', children: _jsxs(Box, { tag: "switch", style: styles.switch, children: [Toggle, label && (_jsx(Typography, { htmlFor: id, style: switchLabelStyles, children: label }))] }) }), (error ?? success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
40
|
+
const ToggleWithLabel = (_jsxs(_Fragment, { children: [_jsx(Label, { unstyled: true, htmlFor: id, width: '100%', children: _jsxs(Box, { tag: "switch", style: styles.switch, children: [Toggle, !!label && (_jsx(Typography, { htmlFor: id, style: switchLabelStyles, children: label }))] }) }), (error ?? success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
41
41
|
return (_jsx(Box, { tag: "switch", gap: error || success ? spacingValue('050') : 0, style: styles.switchContainer, children: !label ? Toggle : ToggleWithLabel }));
|
|
42
42
|
});
|
|
@@ -10,5 +10,5 @@ export const TextField = React.forwardRef(function TextField(props, ref) {
|
|
|
10
10
|
const autoCapitalize = 'sentences';
|
|
11
11
|
const autoComplete = 'off';
|
|
12
12
|
const inputMode = 'text';
|
|
13
|
-
return (_jsxs(FormControl, { style: styles.textField, children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, keyboardType: keyboardType, textContentType: textContentType, autoCapitalize: autoCapitalize, autoComplete: autoComplete, inputMode: inputMode, onChangeText: onChange, ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
13
|
+
return (_jsxs(FormControl, { style: styles.textField, children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, keyboardType: keyboardType, textContentType: textContentType, autoCapitalize: autoCapitalize, autoComplete: autoComplete, inputMode: inputMode, onChangeText: onChange, ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
14
14
|
});
|
|
@@ -4,5 +4,5 @@ import React from 'react';
|
|
|
4
4
|
import { TextareaInput } from '../TextareaInput';
|
|
5
5
|
export const TextareaField = React.forwardRef(function TextareaField(props, ref) {
|
|
6
6
|
const { label, labelRight, hint, error, success, disabled, onChange, onModalSubmit, onFocus } = props;
|
|
7
|
-
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextareaInput, { ref: ref, onChangeText: onChange, onModalSubmit: onModalSubmit, onFocus: onFocus, ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
7
|
+
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextareaInput, { ref: ref, onChangeText: onChange, onModalSubmit: onModalSubmit, onFocus: onFocus, ...props }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
8
8
|
});
|
|
@@ -28,5 +28,5 @@ export const TimeInput = React.forwardRef(function TimeInput({ label, labelRight
|
|
|
28
28
|
onChange?.(localValue);
|
|
29
29
|
onBlur?.();
|
|
30
30
|
};
|
|
31
|
-
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, placeholder: "HH:MM", value: localValue, onChangeText: handleChangeText, onBlur: handleBlur, disabled: disabled, keyboardType: "number-pad", maxLength: 5 }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
31
|
+
return (_jsxs(FormControl, { children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(TextInput, { ref: ref, placeholder: "HH:MM", value: localValue, onChangeText: handleChangeText, onBlur: handleBlur, disabled: disabled, keyboardType: "number-pad", maxLength: 5 }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
32
32
|
});
|
|
@@ -5,5 +5,5 @@ import { useStyles } from './TimeInput.styles';
|
|
|
5
5
|
export const TimeInput = React.forwardRef(function TimeInput(props, ref) {
|
|
6
6
|
const { label, labelRight, hint, disabled, error, success } = props;
|
|
7
7
|
const styles = useStyles();
|
|
8
|
-
return (_jsxs(FormControl, { style: styles.timeInput, children: [_jsxs(InputHeading, { children: [label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(FormControlDateInput, { ref: ref, ...props, type: "time" }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
8
|
+
return (_jsxs(FormControl, { style: styles.timeInput, children: [_jsxs(InputHeading, { children: [!!label && (_jsx(FormControlLabel, { labelRight: labelRight, label: label, disabled: disabled, error: error, success: success })), !!hint && _jsx(FormControlHint, { hint: hint, disabled: disabled })] }), _jsx(FormControlDateInput, { ref: ref, ...props, type: "time" }), (error || success) && _jsx(FormControlCaption, { error: error, success: success })] }));
|
|
9
9
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alveole/components",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"description": "Shared UI components.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"react-markdown": "8.0.7",
|
|
72
|
-
"remark-gfm": "
|
|
72
|
+
"remark-gfm": "3.0.1",
|
|
73
73
|
"zod": "4.4.3"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|