odaptos_design_system 1.4.76 → 1.4.78

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.76",
2
+ "version": "1.4.78",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -41,7 +41,7 @@ const BpCheckedIcon = styled(BpIcon)({
41
41
  interface RadioProps {
42
42
  label?: string;
43
43
  leftLabel?: string;
44
- onChange: () => void;
44
+ onChange?: () => void;
45
45
  onBlur?: () => void;
46
46
  checked: boolean;
47
47
  disabled?: boolean;
@@ -0,0 +1,19 @@
1
+ .ratingScale {
2
+
3
+ .formControl {
4
+
5
+ .radioGroup {
6
+ display: flex;
7
+ flex-direction: row;
8
+ flex-wrap: wrap;
9
+
10
+ .radioContainer {
11
+ display: flex;
12
+ gap: 0.25rem;
13
+
14
+ .radio {
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { FormControl, RadioGroup } from '@mui/material';
3
+ import { Text } from '../Typography/Text';
4
+ import { Radio } from '../Radio/Radio';
5
+
6
+ import styles from './RatingScale.module.scss';
7
+
8
+ interface RatingScaleProps {
9
+ className?: string;
10
+ topLabel?: string | undefined;
11
+ topLabelWeight?: 'semi-bold' | 'bold' | 'regular';
12
+ topLabelSize?: 'xs' | 'sm' | 'base' | 'lg' | 'xl' | 'xxl' | 'xxxl' | 'xxxxl';
13
+ required?: boolean | undefined;
14
+ name?: string;
15
+ options: string[];
16
+ value: string | number | null;
17
+ onChange: (event: any) => void;
18
+ onBlur?: (event: any) => void;
19
+ onKeyDown?: () => void;
20
+ disabled?: boolean;
21
+ id?: string;
22
+ helperText?: string;
23
+ errorText?: string;
24
+ error?: boolean;
25
+ otherProps?: any;
26
+ }
27
+
28
+ const RatingScale = (props: RatingScaleProps) => {
29
+ const {
30
+ className,
31
+ topLabel,
32
+ topLabelWeight,
33
+ topLabelSize,
34
+ required = false,
35
+ name,
36
+ options,
37
+ value,
38
+ id,
39
+ onChange,
40
+ onBlur,
41
+ disabled,
42
+ error,
43
+ otherProps,
44
+ } = props;
45
+
46
+ return (
47
+ <div className={styles.ratingScale + ' ' + className}>
48
+ <Text
49
+ text={`${topLabel ? topLabel : ''}`}
50
+ weight={topLabelWeight || 'bold'}
51
+ size={topLabelSize || 'base'}
52
+ className={styles.topLabel}
53
+ required={required}
54
+ />
55
+
56
+ <FormControl
57
+ component="fieldset"
58
+ className={styles.formControl}
59
+ error={error}
60
+ >
61
+ <RadioGroup
62
+ className={styles.radioGroup}
63
+ aria-label="rating"
64
+ name={name}
65
+ value={value}
66
+ onChange={onChange}
67
+ onBlur={onBlur}
68
+ disabled={disabled}
69
+ id={id}
70
+ {...otherProps}
71
+ >
72
+ {options.map((option, index) => (
73
+ <Radio
74
+ key={`${option}-${index}`}
75
+ value={option}
76
+ label={option}
77
+ checked={value === option}
78
+ disabled={disabled}
79
+ />
80
+ ))}
81
+ </RadioGroup>
82
+ </FormControl>
83
+ </div>
84
+ );
85
+ };
86
+
87
+ export default RatingScale;
@@ -2,13 +2,19 @@ import React from 'react';
2
2
  import { SearchCircledIcon } from '../Icons';
3
3
  import { TextInput } from '../TextInput/TextInput';
4
4
 
5
- interface RadioProps {
5
+ interface SearchProps {
6
6
  searchInput: string | number;
7
7
  placeholder?: string;
8
+ id?: string;
8
9
  onChange: (e: any) => void;
9
10
  }
10
11
 
11
- export const Search = ({ searchInput, onChange, placeholder }: RadioProps) => {
12
+ export const Search = ({
13
+ searchInput,
14
+ onChange,
15
+ placeholder,
16
+ id,
17
+ }: SearchProps) => {
12
18
  return (
13
19
  <TextInput
14
20
  value={searchInput}
@@ -21,6 +27,7 @@ export const Search = ({ searchInput, onChange, placeholder }: RadioProps) => {
21
27
  />
22
28
  }
23
29
  onChange={onChange}
30
+ id={id}
24
31
  />
25
32
  );
26
33
  };