odaptos_design_system 2.0.95 → 2.0.97

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.
@@ -14,7 +14,6 @@ interface RatingScaleProps {
14
14
  disabled?: boolean;
15
15
  id?: string;
16
16
  helperText?: string;
17
- errorText?: string;
18
17
  error?: boolean;
19
18
  ratingStartText?: string;
20
19
  ratingEndText?: string;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ interface SingleSelectWithoutFilterProps {
3
+ label: string;
4
+ placeholder?: string;
5
+ name?: string;
6
+ className?: string;
7
+ id?: string;
8
+ inputId?: string;
9
+ topLabel?: string;
10
+ topLabelWeight?: 'semi-bold' | 'bold' | 'regular';
11
+ topLabelSize?: 'xs' | 'sm' | 'base' | 'lg' | 'xl' | 'xxl' | 'xxxl' | 'xxxxl';
12
+ disabled?: boolean;
13
+ required?: boolean;
14
+ error?: boolean;
15
+ helperText?: string;
16
+ errorText?: string;
17
+ canAddNewOption?: boolean;
18
+ defaultValue: any;
19
+ options: any[];
20
+ onChange: (value: any) => void;
21
+ onBlur?: () => void;
22
+ isLoading?: boolean;
23
+ fetchOptions?: (search: string) => void;
24
+ searchTerm: string;
25
+ setSearchTerm: (value: string) => void;
26
+ }
27
+ /**
28
+ * Use this component for single selection !!
29
+ */
30
+ export declare const SingleSelectWithoutFilter: ({ options, label, placeholder, name, className, onChange, disabled, defaultValue, topLabel, topLabelWeight, topLabelSize, id, inputId, required, error, helperText, errorText, canAddNewOption, onBlur, fetchOptions, isLoading, searchTerm, setSearchTerm, ...props }: SingleSelectWithoutFilterProps) => React.JSX.Element;
31
+ export {};
@@ -11,6 +11,7 @@ export interface TimePickerProps {
11
11
  disabled?: boolean;
12
12
  locale?: string | 'en' | 'en-gb' | 'fr' | 'it' | 'de' | 'es';
13
13
  required?: boolean;
14
+ error?: boolean;
14
15
  errorText?: string;
15
16
  helperText?: string;
16
17
  onChange?: (date: Date | Dayjs | null) => void;
package/dist/index.d.ts CHANGED
@@ -47,6 +47,7 @@ export * from './Atoms/Radio/Radio';
47
47
  export * from './Organisms/RatingScale/RatingScale';
48
48
  export * from './Atoms/Search/Search';
49
49
  export * from './Organisms/SingleSelect/SingleSelect';
50
+ export * from './Organisms/SingleSelect/SingleSelectWithoutFilter';
50
51
  export * from './Molecules/StarRating/StarRating';
51
52
  export * from './Atoms/Switch/Switch';
52
53
  export * from './Organisms/Table/TableFooter';
@@ -11844,6 +11844,7 @@ const DatePicker = ({
11844
11844
  maxDate,
11845
11845
  minDate,
11846
11846
  required,
11847
+ error,
11847
11848
  errorText,
11848
11849
  helperText,
11849
11850
  views = ['day', 'month', 'year'],
@@ -11904,7 +11905,7 @@ const DatePicker = ({
11904
11905
  console.error('Error in onChange function: ', error);
11905
11906
  }
11906
11907
  }
11907
- }), errorText && /*#__PURE__*/React__default.createElement(Text, {
11908
+ }), error && errorText && /*#__PURE__*/React__default.createElement(Text, {
11908
11909
  size: "xs",
11909
11910
  color: "#F54C4C",
11910
11911
  italic: true,
@@ -13678,7 +13679,7 @@ const MultiSelect = ({
13678
13679
  }
13679
13680
  return filtered;
13680
13681
  }
13681
- }, props)), errorText && /*#__PURE__*/React__default.createElement(Text, {
13682
+ }, props)), error && errorText && /*#__PURE__*/React__default.createElement(Text, {
13682
13683
  size: "xs",
13683
13684
  color: "#F54C4C",
13684
13685
  italic: true,
@@ -13952,7 +13953,7 @@ const MultiSelectWithCategories = ({
13952
13953
  }
13953
13954
  return filtered;
13954
13955
  }
13955
- }, props)), errorText && /*#__PURE__*/React__default.createElement(Text, {
13956
+ }, props)), error && errorText && /*#__PURE__*/React__default.createElement(Text, {
13956
13957
  size: "xs",
13957
13958
  color: "#F54C4C",
13958
13959
  italic: true,
@@ -14202,7 +14203,7 @@ const MultiSelectWithoutFilter = ({
14202
14203
  fill: "black",
14203
14204
  className: `${styles$B.icon}`
14204
14205
  })
14205
- }, props)), errorText && /*#__PURE__*/React__default.createElement(Text, {
14206
+ }, props)), errorText && error && /*#__PURE__*/React__default.createElement(Text, {
14206
14207
  size: "xs",
14207
14208
  color: "#F54C4C",
14208
14209
  italic: true,
@@ -15641,7 +15642,229 @@ const SingleSelect = ({
15641
15642
  }
15642
15643
  return filtered;
15643
15644
  }
15644
- }, props)), errorText && /*#__PURE__*/React__default.createElement(Text, {
15645
+ }, props)), error && errorText && /*#__PURE__*/React__default.createElement(Text, {
15646
+ size: "xs",
15647
+ color: "#F54C4C",
15648
+ italic: true,
15649
+ text: errorText,
15650
+ className: styles$K.text_below
15651
+ }), helperText && /*#__PURE__*/React__default.createElement(Text, {
15652
+ size: "xs",
15653
+ italic: true,
15654
+ text: helperText,
15655
+ className: styles$K.text_below
15656
+ }));
15657
+ };
15658
+
15659
+ const filter$3 = /*#__PURE__*/Autocomplete.createFilterOptions();
15660
+ const CssTextField$8 = /*#__PURE__*/styles$16.styled(material.TextField)({
15661
+ '& .MuiInputBase-input': {
15662
+ color: '#26292E',
15663
+ fontFamily: `'Open Sans' !important`,
15664
+ fontSize: '1rem'
15665
+ },
15666
+ '& .MuiInputBase-input.Mui-disabled': {
15667
+ color: '#26292E',
15668
+ fontFamily: `'Open Sans' !important`,
15669
+ fontSize: '1rem'
15670
+ },
15671
+ '& .MuiInputBase-input.MuiOutlinedInput-input.Mui-disabled': {
15672
+ WebkitTextFillColor: colors.neutral_600
15673
+ },
15674
+ '& .Mui-error': {
15675
+ color: '#26292E'
15676
+ },
15677
+ '& .MuiFormHelperText-root': {
15678
+ color: '#F54C4C'
15679
+ },
15680
+ '& .MuiFormLabel-asterisk': {
15681
+ color: '#F54C4C'
15682
+ },
15683
+ '& .MuiOutlinedInput-root.Mui-disabled': {
15684
+ cursor: 'not-allowed',
15685
+ color: '#26292E',
15686
+ fieldset: {
15687
+ borderColor: '#BCBDBE'
15688
+ },
15689
+ '&:hover fieldset': {
15690
+ borderColor: '#BCBDBE'
15691
+ }
15692
+ },
15693
+ '& label': {
15694
+ color: '#26292E',
15695
+ fontFamily: `'Open Sans' !important`,
15696
+ fontSize: '1rem'
15697
+ },
15698
+ '& label.Mui-disabled.Mui-error': {
15699
+ color: '#26292E',
15700
+ opacity: 0.5,
15701
+ fontFamily: `'Open Sans' !important`,
15702
+ fontSize: '1rem'
15703
+ },
15704
+ '& label.Mui-focused': {
15705
+ color: '#26292E',
15706
+ fontFamily: `'Open Sans' !important`,
15707
+ fontSize: '1rem',
15708
+ backgroundColor: 'transparent',
15709
+ marginRight: 5,
15710
+ paddingRight: 5
15711
+ },
15712
+ '& .MuiOutlinedInput-root': {
15713
+ fontFamily: `'Open Sans' !important`,
15714
+ '& fieldset': {
15715
+ borderColor: '#96989A'
15716
+ },
15717
+ '& input::-webkit-outer-spin-button, & input::-webkit-inner-spin-button': {
15718
+ display: 'none'
15719
+ },
15720
+ '& input[type=number]': {
15721
+ MozAppearance: 'textfield'
15722
+ },
15723
+ '&:hover fieldset': {
15724
+ borderColor: '#0077FF'
15725
+ },
15726
+ '&.Mui-focused fieldset': {
15727
+ borderColor: '#0077FF'
15728
+ },
15729
+ '&.Mui-error fieldset': {
15730
+ borderColor: '#F54C4C'
15731
+ },
15732
+ '&.Mui-disabled .Mui-focused fieldset': {
15733
+ borderColor: 'rgba(0, 119, 255, 0.5)'
15734
+ },
15735
+ '& .MuiAutocomplete-endAdornment': {
15736
+ height: '99%',
15737
+ marginTop: '-0.20rem',
15738
+ '& .MuiButtonBase-root': {
15739
+ height: '99%',
15740
+ '&:hover': {
15741
+ background: 'transparent'
15742
+ }
15743
+ }
15744
+ }
15745
+ }
15746
+ });
15747
+ /**
15748
+ * Use this component for single selection !!
15749
+ */
15750
+ const SingleSelectWithoutFilter = ({
15751
+ options,
15752
+ label,
15753
+ placeholder,
15754
+ name,
15755
+ className,
15756
+ onChange,
15757
+ disabled,
15758
+ defaultValue,
15759
+ topLabel,
15760
+ topLabelWeight,
15761
+ topLabelSize,
15762
+ id,
15763
+ inputId,
15764
+ required,
15765
+ error,
15766
+ helperText,
15767
+ errorText,
15768
+ canAddNewOption,
15769
+ onBlur,
15770
+ fetchOptions,
15771
+ isLoading,
15772
+ searchTerm,
15773
+ setSearchTerm,
15774
+ ...props
15775
+ }) => {
15776
+ const [value, setValue] = React.useState(defaultValue === undefined ? null : defaultValue);
15777
+ React.useEffect(() => {
15778
+ setValue(defaultValue === undefined ? null : defaultValue);
15779
+ }, [defaultValue]);
15780
+ React.useEffect(() => {
15781
+ // Call API only if searchTerm and fetchOptions are defined
15782
+ if (searchTerm.length >= 3 && fetchOptions) {
15783
+ fetchOptions(searchTerm);
15784
+ }
15785
+ }, [searchTerm]);
15786
+ return /*#__PURE__*/React__default.createElement("div", {
15787
+ className: `${className && className}`,
15788
+ style: {
15789
+ width: '100%'
15790
+ },
15791
+ id: id
15792
+ }, topLabel && /*#__PURE__*/React__default.createElement(Text, {
15793
+ text: `${topLabel ? topLabel : ''}`,
15794
+ weight: topLabelWeight || 'bold',
15795
+ size: topLabelSize || 'base',
15796
+ className: styles$K.input_top_label,
15797
+ required: required
15798
+ }), /*#__PURE__*/React__default.createElement(Autocomplete__default, Object.assign({
15799
+ id: inputId,
15800
+ value: value,
15801
+ onInputChange: (_event, value) => setSearchTerm(value),
15802
+ onChange: (_event, newValue) => {
15803
+ const e = {
15804
+ target: {
15805
+ name: name,
15806
+ value: newValue
15807
+ }
15808
+ };
15809
+ setValue(newValue);
15810
+ onChange(e);
15811
+ },
15812
+ options: options,
15813
+ multiple: false,
15814
+ autoComplete: options.length > 10,
15815
+ size: "small",
15816
+ fullWidth: true,
15817
+ disabled: disabled,
15818
+ getOptionLabel: option => {
15819
+ return option.label;
15820
+ },
15821
+ isOptionEqualToValue: (option, value) => {
15822
+ if (value._id && option._id) return option._id === value._id;else if (value && value !== '') return option.value === value.value;else return false;
15823
+ },
15824
+ renderInput: params => /*#__PURE__*/React__default.createElement(CssTextField$8, Object.assign({}, params, {
15825
+ variant: "outlined",
15826
+ fullWidth: true,
15827
+ label: `${label && topLabel === undefined ? label : ''}`,
15828
+ placeholder: placeholder,
15829
+ size: "small",
15830
+ required: required,
15831
+ error: error,
15832
+ onBlur: onBlur
15833
+ })),
15834
+ clearIcon: /*#__PURE__*/React__default.createElement(RemoveCircledIcon, {
15835
+ fill: "black",
15836
+ className: `${styles$K.icon}`
15837
+ }),
15838
+ popupIcon: /*#__PURE__*/React__default.createElement(ArrowLineDowIcon, {
15839
+ fill: "black",
15840
+ className: `${styles$K.icon}`
15841
+ }),
15842
+ className: `${styles$K.newAutocomplete}`,
15843
+ renderOption: (props, option) => {
15844
+ return /*#__PURE__*/React__default.createElement("li", Object.assign({}, props, {
15845
+ key: option.value,
15846
+ id: option.value
15847
+ }), /*#__PURE__*/React__default.createElement(TextForButton, {
15848
+ text: option.label,
15849
+ size: "sm"
15850
+ }));
15851
+ },
15852
+ filterOptions: (options, params) => {
15853
+ const filtered = filter$3(options, params);
15854
+ const {
15855
+ inputValue
15856
+ } = params;
15857
+ // Suggest the creation of a new value
15858
+ const isExisting = options.some(option => inputValue === option.title);
15859
+ if (inputValue !== '' && !isExisting) {
15860
+ if (canAddNewOption) filtered.push({
15861
+ value: inputValue,
15862
+ label: inputValue
15863
+ });
15864
+ }
15865
+ return filtered;
15866
+ }
15867
+ }, props)), error && errorText && /*#__PURE__*/React__default.createElement(Text, {
15645
15868
  size: "xs",
15646
15869
  color: "#F54C4C",
15647
15870
  italic: true,
@@ -16372,7 +16595,7 @@ var css_248z$V = ".TextInput-modules_input__Ky9uR{font-family:var(--sdFontFamily
16372
16595
  var styles$V = {"input":"TextInput-modules_input__Ky9uR","text_below":"TextInput-modules_text_below__oT18E","MuiInputBase-root-MuiOutlinedInput-root":"TextInput-modules_MuiInputBase-root-MuiOutlinedInput-root__Kq7D9","input_top_label":"TextInput-modules_input_top_label__Xj8GH","MuiInputBase-input":"TextInput-modules_MuiInputBase-input__beBli"};
16373
16596
  styleInject(css_248z$V);
16374
16597
 
16375
- const CssTextField$8 = /*#__PURE__*/styles$16.styled(material.TextField)({
16598
+ const CssTextField$9 = /*#__PURE__*/styles$16.styled(material.TextField)({
16376
16599
  '& .MuiInputBase-input': {
16377
16600
  color: '#26292E',
16378
16601
  fontFamily: `'Open Sans' !important`,
@@ -16535,7 +16758,7 @@ const TextInput = props => {
16535
16758
  size: topLabelSize || 'base',
16536
16759
  className: styles$V.input_top_label,
16537
16760
  required: required
16538
- }), /*#__PURE__*/React__default.createElement(CssTextField$8, {
16761
+ }), /*#__PURE__*/React__default.createElement(CssTextField$9, {
16539
16762
  fullWidth: true,
16540
16763
  size: "small",
16541
16764
  InputProps: {
@@ -17059,7 +17282,7 @@ var css_248z$Z = ".TimePicker-modules_time_picker__CxeB5{min-width:13rem;width:1
17059
17282
  var styles$Z = {"time_picker":"TimePicker-modules_time_picker__CxeB5","MuiAutocomplete-endAdornment":"TimePicker-modules_MuiAutocomplete-endAdornment__CbeSn","input_top_label":"TimePicker-modules_input_top_label__LPXU-","MuiOutlinedInput-root":"TimePicker-modules_MuiOutlinedInput-root__ItBpg","MuiInputBase-root":"TimePicker-modules_MuiInputBase-root__4d1Fn","MuiInputBase-formControl":"TimePicker-modules_MuiInputBase-formControl__2hrJo","text_below":"TimePicker-modules_text_below__lm0u-","icon":"TimePicker-modules_icon__IiT8p"};
17060
17283
  styleInject(css_248z$Z);
17061
17284
 
17062
- const CssTextField$9 = /*#__PURE__*/styles$16.styled(material.TextField)({
17285
+ const CssTextField$a = /*#__PURE__*/styles$16.styled(material.TextField)({
17063
17286
  '& .MuiInputBase-input': {
17064
17287
  color: '#26292E',
17065
17288
  fontFamily: `'Open Sans' !important`,
@@ -17147,7 +17370,7 @@ const CssTextField$9 = /*#__PURE__*/styles$16.styled(material.TextField)({
17147
17370
  }
17148
17371
  });
17149
17372
  dayjs.extend(utc);
17150
- const TimePickerStyledComponent = params => /*#__PURE__*/React__default.createElement(CssTextField$9, Object.assign({}, params, {
17373
+ const TimePickerStyledComponent = params => /*#__PURE__*/React__default.createElement(CssTextField$a, Object.assign({}, params, {
17151
17374
  variant: "outlined",
17152
17375
  fullWidth: true,
17153
17376
  label: `${params.label && params.topLabel === undefined ? params.label : ''}`,
@@ -17176,6 +17399,7 @@ const TimePicker = ({
17176
17399
  disabled,
17177
17400
  locale = 'en',
17178
17401
  required,
17402
+ error,
17179
17403
  errorText,
17180
17404
  helperText,
17181
17405
  onChange,
@@ -17219,7 +17443,7 @@ const TimePicker = ({
17219
17443
  },
17220
17444
  disabled: disabled,
17221
17445
  onChange: onChange
17222
- }), errorText && /*#__PURE__*/React__default.createElement(Text, {
17446
+ }), error && errorText && /*#__PURE__*/React__default.createElement(Text, {
17223
17447
  size: "xs",
17224
17448
  color: "#F54C4C",
17225
17449
  italic: true,
@@ -17752,6 +17976,7 @@ exports.SettingsCircledIcon = SettingsCircledIcon;
17752
17976
  exports.SettingsSliderIcon = SettingsSliderIcon;
17753
17977
  exports.ShareIcon = ShareIcon;
17754
17978
  exports.SingleSelect = SingleSelect;
17979
+ exports.SingleSelectWithoutFilter = SingleSelectWithoutFilter;
17755
17980
  exports.SmartBrainIcon = SmartBrainIcon;
17756
17981
  exports.SortingIcon = SortingIcon;
17757
17982
  exports.SquareText = SquareText;