@innovaccer/design-system 2.13.4-3 → 2.13.4-5
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/.all-contributorsrc +36 -0
- package/README.md +6 -3
- package/core/components/atoms/breadcrumbs/Breadcrumbs.tsx +2 -0
- package/core/components/atoms/checkbox/Checkbox.tsx +5 -1
- package/core/components/atoms/dropdown/DropdownList.tsx +35 -24
- package/core/components/atoms/dropdown/__stories__/MenuWithInfo.story.jsx +35 -0
- package/core/components/atoms/dropdown/__stories__/WithCheckboxAndSubInfo.story.jsx +1 -1
- package/core/components/atoms/dropdown/option/CheckboxOption.tsx +2 -1
- package/core/components/atoms/dropdown/option/index.tsx +16 -2
- package/core/components/atoms/metricInput/MetricInput.tsx +16 -27
- package/core/components/atoms/metricInput/__tests__/__snapshots__/MetricInput.test.tsx.snap +124 -60
- package/core/components/atoms/toast/Toast.tsx +1 -1
- package/core/components/atoms/toast/__tests__/__snapshots__/Toast.test.tsx.snap +3 -3
- package/core/components/molecules/dropzone/Dropzone.tsx +3 -8
- package/core/components/molecules/dropzone/DropzoneActive.tsx +3 -8
- package/core/components/molecules/dropzone/DropzoneError.tsx +3 -8
- package/core/components/molecules/dropzone/DropzoneIcon.tsx +43 -0
- package/core/components/molecules/dropzone/FileSelectorUtils.tsx +112 -3
- package/core/components/molecules/dropzone/__tests__/__snapshots__/Dropzone.test.tsx.snap +64 -48
- package/core/components/molecules/inputMask/InputMask.tsx +1 -1
- package/core/components/molecules/pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +31 -15
- package/core/components/molecules/verificationCodeInput/VerificationCodeInput.tsx +5 -0
- package/core/components/molecules/verificationCodeInput/__tests__/VerificationCodeInput.test.tsx +48 -9
- package/core/components/molecules/verificationCodeInput/__tests__/__snapshots__/VerificationCodeInput.test.tsx.snap +2996 -1
- package/core/components/organisms/datePicker/Trigger.tsx +1 -0
- package/core/components/organisms/datePicker/__tests__/DatePicker.test.tsx +8 -0
- package/core/components/organisms/dateRangePicker/__stories__/variants/monthsInView.story.jsx +2 -2
- package/core/components/organisms/grid/Cell.tsx +29 -1
- package/core/components/organisms/table/__tests__/Table.test.tsx +18 -0
- package/core/components/organisms/table/__tests__/__snapshots__/Table.test.tsx.snap +256 -0
- package/css/dist/MaterialIcons-Regular.ttf +0 -0
- package/css/dist/MaterialIconsOutlined-Regular.otf +0 -0
- package/css/dist/MaterialIconsRound-Regular.otf +0 -0
- package/css/dist/MaterialIconsSharp-Regular.otf +0 -0
- package/css/dist/MaterialIconsTwoTone-Regular.otf +0 -0
- package/css/dist/index.css +54 -44
- package/css/dist/index.css.map +1 -1
- package/css/material-design-icons/iconfont/MaterialIcons-Regular.ttf +0 -0
- package/css/material-design-icons/iconfont/MaterialIconsOutlined-Regular.otf +0 -0
- package/css/material-design-icons/iconfont/MaterialIconsRound-Regular.otf +0 -0
- package/css/material-design-icons/iconfont/MaterialIconsSharp-Regular.otf +0 -0
- package/css/material-design-icons/iconfont/MaterialIconsTwoTone-Regular.otf +0 -0
- package/css/src/components/breadcrumbs.css +8 -0
- package/css/src/components/dropdown.css +10 -1
- package/css/src/components/dropzone.css +10 -12
- package/css/src/components/grid.css +14 -2
- package/css/src/components/metricInput.css +12 -29
- package/dist/core/components/atoms/checkbox/Checkbox.d.ts +1 -0
- package/dist/core/components/atoms/dropdown/option/index.d.ts +2 -0
- package/dist/core/components/molecules/dropzone/DropzoneIcon.d.ts +7 -0
- package/dist/core/components/molecules/verificationCodeInput/VerificationCodeInput.d.ts +4 -0
- package/dist/core/components/organisms/grid/Cell.d.ts +1 -0
- package/dist/index.esm.js +126 -77
- package/dist/index.js +132 -94
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.br +0 -0
- package/dist/index.umd.js.gz +0 -0
- package/docs/src/components/LeftNav/LeftNav.js +24 -20
- package/docs/src/components/Tile/Tile.css +17 -0
- package/docs/src/components/Tile/Tile.js +20 -0
- package/docs/src/data/home-resources.yaml +5 -5
- package/docs/src/pages/404.js +9 -3
- package/docs/src/pages/components/table/images/table-1.png +0 -0
- package/docs/src/pages/components/table/images/table-2.png +0 -0
- package/docs/src/pages/components/table/usage.mdx +41 -92
- package/docs/src/pages/components/tabs/images/tabs-10.png +0 -0
- package/docs/src/pages/components/tabs/images/tabs-11.png +0 -0
- package/docs/src/pages/components/tabs/images/tabs-9.png +0 -0
- package/docs/src/pages/components/tabs/usage.mdx +37 -28
- package/docs/src/pages/home/HomeBanner.png +0 -0
- package/docs/src/pages/home/HomeCard.js +63 -0
- package/docs/src/pages/home/homepage.css +33 -5
- package/docs/src/pages/index.js +43 -74
- package/docs/static/images/figma.png +0 -0
- package/docs/static/images/github.png +0 -0
- package/docs/static/images/storybook.png +0 -0
- package/package.json +1 -1
- package/docs/static/images/designtoken.png +0 -0
package/.all-contributorsrc
CHANGED
|
@@ -164,6 +164,42 @@
|
|
|
164
164
|
"contributions": [
|
|
165
165
|
"code"
|
|
166
166
|
]
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"login": "Rashi-Gupta-2000",
|
|
170
|
+
"name": "Rashi Gupta",
|
|
171
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/99866103?v=4",
|
|
172
|
+
"profile": "https://github.com/Rashi-Gupta-2000",
|
|
173
|
+
"contributions": [
|
|
174
|
+
"code"
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"login": "varnikajain15",
|
|
179
|
+
"name": "Varnika Jain",
|
|
180
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/55780559?v=4",
|
|
181
|
+
"profile": "https://github.com/varnikajain15",
|
|
182
|
+
"contributions": [
|
|
183
|
+
"code"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"login": "aman2000verma",
|
|
188
|
+
"name": "Aman Verma",
|
|
189
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/45339091?v=4",
|
|
190
|
+
"profile": "https://github.com/aman2000verma",
|
|
191
|
+
"contributions": [
|
|
192
|
+
"code"
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"login": "samyak3009",
|
|
197
|
+
"name": "SAMYAK JAIN",
|
|
198
|
+
"avatar_url": "https://avatars.githubusercontent.com/u/56395892?v=4",
|
|
199
|
+
"profile": "https://github.com/samyak3009",
|
|
200
|
+
"contributions": [
|
|
201
|
+
"code"
|
|
202
|
+
]
|
|
167
203
|
}
|
|
168
204
|
],
|
|
169
205
|
"contributorsPerLine": 7
|
package/README.md
CHANGED
|
@@ -46,14 +46,11 @@ For more details see our [styling](#styling) section
|
|
|
46
46
|
import '@innovaccer/design-system/css';
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
49
|
If you want to try out `@innovaccer/design-system`, you can also use
|
|
52
50
|
[CodeSandbox](https://codesandbox.io/s/focused-germain-shbcw).
|
|
53
51
|
|
|
54
52
|
[](https://codesandbox.io/s/focused-germain-shbcw)
|
|
55
53
|
|
|
56
|
-
|
|
57
54
|
## Usage
|
|
58
55
|
|
|
59
56
|
```js
|
|
@@ -127,7 +124,9 @@ For css variables to work on IE we use a polyfill at runtime to achieve dynamic
|
|
|
127
124
|
```
|
|
128
125
|
|
|
129
126
|
## :card_file_box: Repos
|
|
127
|
+
|
|
130
128
|
Here are the supporting repositories.
|
|
129
|
+
|
|
131
130
|
- **[MDS Rich Text Editor](https://github.com/innovaccer/mds-rich-text-editor)** - Feature-rich WYSIWYG (What You See Is What You Get) HTML editor and WYSIWYG Markdown editor. It is used to create blogs, notes sections, comment sections etc. It has a variety of tools to edit and format rich content.
|
|
132
131
|
- **[MDS Docs](https://github.com/innovaccer/mds-docs)** - Documentation site for Masala design system.
|
|
133
132
|
- **[MDS Helpers](https://github.com/innovaccer/mds-helpers)** - Alert Service.
|
|
@@ -178,6 +177,10 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
178
177
|
<td align="center"><a href="https://github.com/atifzaidi92"><img src="https://avatars.githubusercontent.com/u/54103064?v=4?s=100" width="100px;" alt=""/><br /><sub><b>atifzaidi92</b></sub></a><br /><a href="https://github.com/innovaccer/design-system/commits?author=atifzaidi92" title="Code">💻</a></td>
|
|
179
178
|
<td align="center"><a href="https://github.com/Sumit2399"><img src="https://avatars.githubusercontent.com/u/66456021?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sumit Dhyani</b></sub></a><br /><a href="https://github.com/innovaccer/design-system/commits?author=Sumit2399" title="Code">💻</a></td>
|
|
180
179
|
<td align="center"><a href="https://tanmay-portfolio.herokuapp.com/"><img src="https://avatars.githubusercontent.com/u/36269283?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tanmay Sharma</b></sub></a><br /><a href="https://github.com/innovaccer/design-system/commits?author=927tanmay" title="Code">💻</a></td>
|
|
180
|
+
<td align="center"><a href="https://github.com/Rashi-Gupta-2000"><img src="https://avatars.githubusercontent.com/u/99866103?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Rashi Gupta</b></sub></a><br /><a href="https://github.com/innovaccer/design-system/commits?author=Rashi-Gupta-2000" title="Code">💻</a></td>
|
|
181
|
+
<td align="center"><a href="https://github.com/varnikajain15"><img src="https://avatars.githubusercontent.com/u/55780559?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Varnika Jain</b></sub></a><br /><a href="https://github.com/innovaccer/design-system/commits?author=varnikajain15" title="Code">💻</a></td>
|
|
182
|
+
<td align="center"><a href="https://github.com/aman2000verma"><img src="https://avatars.githubusercontent.com/u/45339091?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aman Verma</b></sub></a><br /><a href="https://github.com/innovaccer/design-system/commits?author=aman2000verma" title="Code">💻</a></td>
|
|
183
|
+
<td align="center"><a href="https://github.com/samyak3009"><img src="https://avatars.githubusercontent.com/u/56395892?v=4?s=100" width="100px;" alt=""/><br /><sub><b>SAMYAK JAIN</b></sub></a><br /><a href="https://github.com/innovaccer/design-system/commits?author=samyak3009" title="Code">💻</a></td>
|
|
181
184
|
</tr>
|
|
182
185
|
</table>
|
|
183
186
|
|
|
@@ -56,6 +56,8 @@ const renderDropdown = (list: BreadcrumbsProps['list'], onClick: BreadcrumbsProp
|
|
|
56
56
|
size="tiny"
|
|
57
57
|
appearance="transparent"
|
|
58
58
|
icon="more_horiz_filled"
|
|
59
|
+
largeIcon={true}
|
|
60
|
+
className="Breadcrumbs-Button"
|
|
59
61
|
data-test="DesignSystem-Breadcrumbs--Button"
|
|
60
62
|
/>
|
|
61
63
|
);
|
|
@@ -54,6 +54,10 @@ export interface CheckboxProps extends BaseProps, OmitNativeProps<HTMLInputEleme
|
|
|
54
54
|
* Callback function called when user the selects an option
|
|
55
55
|
*/
|
|
56
56
|
onChange?: (event: ChangeEvent) => void;
|
|
57
|
+
/**
|
|
58
|
+
* htmlFor label id for checkbox
|
|
59
|
+
*/
|
|
60
|
+
id?: string;
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
/**
|
|
@@ -75,6 +79,7 @@ export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>((props
|
|
|
75
79
|
className,
|
|
76
80
|
checked: checkedProp,
|
|
77
81
|
helpText,
|
|
82
|
+
id = `${name}-${label}-${uidGenerator()}`,
|
|
78
83
|
...rest
|
|
79
84
|
} = props;
|
|
80
85
|
|
|
@@ -134,7 +139,6 @@ export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>((props
|
|
|
134
139
|
}
|
|
135
140
|
if (onChange) onChange(e);
|
|
136
141
|
};
|
|
137
|
-
const id = `${name}-${label}-${uidGenerator()}`;
|
|
138
142
|
const IconName = indeterminate ? 'remove' : checked ? 'check' : '';
|
|
139
143
|
const IconSize = size === 'tiny' ? 12 : 16;
|
|
140
144
|
|
|
@@ -8,6 +8,7 @@ import classNames from 'classnames';
|
|
|
8
8
|
import Loading from './Loading';
|
|
9
9
|
import { BaseProps, extractBaseProps } from '@/utils/types';
|
|
10
10
|
import { ChangeEvent } from '@/common.type';
|
|
11
|
+
import uidGenerator from '@/utils/uidGenerator';
|
|
11
12
|
|
|
12
13
|
export type DropdownAlign = 'left' | 'right';
|
|
13
14
|
export type OptionType = 'DEFAULT' | 'WITH_ICON' | 'WITH_META' | 'ICON_WITH_META';
|
|
@@ -295,6 +296,7 @@ const DropdownList = (props: OptionsProps) => {
|
|
|
295
296
|
const getDropdownClass = (index: number, isGroup: boolean) => {
|
|
296
297
|
const Dropdown = classNames({
|
|
297
298
|
['Dropdown--border']: isGroup && index !== 0,
|
|
299
|
+
['Option-checkboxWrapper']: true,
|
|
298
300
|
});
|
|
299
301
|
|
|
300
302
|
return Dropdown;
|
|
@@ -320,9 +322,9 @@ const DropdownList = (props: OptionsProps) => {
|
|
|
320
322
|
});
|
|
321
323
|
|
|
322
324
|
const SelectAllClass = classNames({
|
|
323
|
-
['Option-checkbox']: true,
|
|
324
325
|
['Option-checkbox--active']: cursor === 0,
|
|
325
|
-
['
|
|
326
|
+
['Option-checkboxWrapper']: true,
|
|
327
|
+
['Option-checkbox']: true,
|
|
326
328
|
});
|
|
327
329
|
|
|
328
330
|
const onToggleDropdown = (open: boolean, type?: string) => {
|
|
@@ -463,17 +465,21 @@ const DropdownList = (props: OptionsProps) => {
|
|
|
463
465
|
const { selectAllLabel = 'Select All', selectAll, onSelectAll } = props;
|
|
464
466
|
|
|
465
467
|
const label = selectAllLabel.trim() ? selectAllLabel.trim() : 'Select All';
|
|
468
|
+
const [id] = React.useState(() => uidGenerator());
|
|
466
469
|
|
|
467
470
|
return (
|
|
468
471
|
<div className={SelectAllClass} onMouseEnter={() => updateActiveOption(0, true)}>
|
|
469
|
-
<Checkbox
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
472
|
+
<label htmlFor={id} className="Checkbox-label">
|
|
473
|
+
<Checkbox
|
|
474
|
+
label={label}
|
|
475
|
+
onChange={onSelectAll}
|
|
476
|
+
checked={selectAll.checked}
|
|
477
|
+
indeterminate={selectAll.indeterminate}
|
|
478
|
+
tabIndex={-1}
|
|
479
|
+
className="OptionCheckbox"
|
|
480
|
+
id={id}
|
|
481
|
+
/>
|
|
482
|
+
</label>
|
|
477
483
|
</div>
|
|
478
484
|
);
|
|
479
485
|
};
|
|
@@ -488,21 +494,26 @@ const DropdownList = (props: OptionsProps) => {
|
|
|
488
494
|
|
|
489
495
|
const active = selectAllPresent ? index + 1 === cursor : index === cursor;
|
|
490
496
|
const optionIsSelected = tempSelected.findIndex((option) => option.value === item.value) !== -1;
|
|
497
|
+
const id = `Checkbox-option-${index}-${item.value}`;
|
|
498
|
+
|
|
491
499
|
return (
|
|
492
|
-
<
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
500
|
+
<label htmlFor={id}>
|
|
501
|
+
<Option
|
|
502
|
+
optionData={item}
|
|
503
|
+
truncateOption={truncateOption}
|
|
504
|
+
selected={optionIsSelected}
|
|
505
|
+
index={index}
|
|
506
|
+
updateActiveOption={updateActiveOption}
|
|
507
|
+
optionRenderer={optionRenderer}
|
|
508
|
+
active={active}
|
|
509
|
+
checkboxes={withCheckbox}
|
|
510
|
+
menu={menu}
|
|
511
|
+
onClick={() => optionClickHandler(item)}
|
|
512
|
+
onChange={(e) => props.onSelect(item, e.target.checked)}
|
|
513
|
+
optionType={props.optionType}
|
|
514
|
+
id={id}
|
|
515
|
+
/>
|
|
516
|
+
</label>
|
|
506
517
|
);
|
|
507
518
|
};
|
|
508
519
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Dropdown from '../Dropdown';
|
|
3
|
+
import { Uncontrolled, Controlled } from './_common_/types';
|
|
4
|
+
|
|
5
|
+
// CSF format story
|
|
6
|
+
export const dropdownAsMenuWithSubinfo = () => {
|
|
7
|
+
const options = [
|
|
8
|
+
{ label: 'Below 18', subInfo: 'People below 18 years old', value: 'below_18', optionType: 'WITH_META' },
|
|
9
|
+
{ label: '19 - 35', subInfo: 'People 19-35 years old', value: '19-35', optionType: 'WITH_META' },
|
|
10
|
+
{ label: '36 - 55', subInfo: 'People 36-55 years old', value: '36-55', optionType: 'WITH_META' },
|
|
11
|
+
{ label: '56 and above', subInfo: 'People above 56 years old', value: '56_above', optionType: 'WITH_META' },
|
|
12
|
+
];
|
|
13
|
+
return (
|
|
14
|
+
<div className="d-flex w-50">
|
|
15
|
+
<Dropdown options={options} menu={true} className="mr-5" align="right" />
|
|
16
|
+
<Dropdown options={options} menu={true} className="mr-5" align="right" />
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
title: 'Components/Dropdown/Dropdown As Menu With Subinfo',
|
|
23
|
+
component: Dropdown,
|
|
24
|
+
parameters: {
|
|
25
|
+
docs: {
|
|
26
|
+
docPage: {
|
|
27
|
+
title: 'Dropdown',
|
|
28
|
+
props: {
|
|
29
|
+
components: { Uncontrolled, Controlled },
|
|
30
|
+
exclude: ['showHead'],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -5,7 +5,7 @@ import { Text, MetaList } from '@/index';
|
|
|
5
5
|
import { MetaListProps } from '@/index.type';
|
|
6
6
|
|
|
7
7
|
const CheckboxOption = (props: OptionTypeProps) => {
|
|
8
|
-
const { className, selected, optionData, onChangeHandler, onUpdateActiveOption, dataTest } = props;
|
|
8
|
+
const { className, selected, optionData, onChangeHandler, onUpdateActiveOption, dataTest, id = '' } = props;
|
|
9
9
|
const { subInfo, label, disabled } = optionData;
|
|
10
10
|
|
|
11
11
|
const renderSubInfo = (subInfo: string | MetaListProps) => {
|
|
@@ -48,6 +48,7 @@ const CheckboxOption = (props: OptionTypeProps) => {
|
|
|
48
48
|
tabIndex={-1}
|
|
49
49
|
className={`OptionCheckbox ${subInfo ? 'pb-0' : ''}`}
|
|
50
50
|
data-test={`${dataTest}--Checkbox`}
|
|
51
|
+
id={id}
|
|
51
52
|
/>
|
|
52
53
|
{subInfo && <div className="pl-8 ml-3">{renderSubInfo(subInfo)}</div>}
|
|
53
54
|
</div>
|
|
@@ -56,6 +56,7 @@ export interface OptionTypeProps {
|
|
|
56
56
|
onClickHandler?: (event: ClickEvent) => void;
|
|
57
57
|
onChangeHandler?: (event: ChangeEvent) => void;
|
|
58
58
|
renderSubInfo: (subInfo: string | MetaListProps) => React.ReactElement;
|
|
59
|
+
id?: string;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
interface OptionProps extends OptionRendererProps {
|
|
@@ -69,6 +70,7 @@ interface OptionProps extends OptionRendererProps {
|
|
|
69
70
|
onClick?: () => void;
|
|
70
71
|
onChange?: (event: ChangeEvent) => void;
|
|
71
72
|
updateActiveOption?: (index: number) => void;
|
|
73
|
+
id?: string;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
const OptionTypeMapping: { [key: string]: (props: OptionTypeProps) => JSX.Element } = {
|
|
@@ -80,7 +82,18 @@ const OptionTypeMapping: { [key: string]: (props: OptionTypeProps) => JSX.Elemen
|
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
const Option = (props: OptionProps) => {
|
|
83
|
-
const {
|
|
85
|
+
const {
|
|
86
|
+
optionData,
|
|
87
|
+
selected,
|
|
88
|
+
onClick,
|
|
89
|
+
updateActiveOption,
|
|
90
|
+
onChange,
|
|
91
|
+
active,
|
|
92
|
+
index,
|
|
93
|
+
checkboxes,
|
|
94
|
+
menu,
|
|
95
|
+
id = '',
|
|
96
|
+
} = props;
|
|
84
97
|
|
|
85
98
|
const { optionType = 'DEFAULT' } = optionData.optionType ? optionData : props;
|
|
86
99
|
const { disabled } = optionData;
|
|
@@ -150,7 +163,7 @@ const Option = (props: OptionProps) => {
|
|
|
150
163
|
}
|
|
151
164
|
|
|
152
165
|
const renderSubInfo = (subInfo: string | MetaListProps) => {
|
|
153
|
-
const labelAppearance = disabled ? 'disabled' : selected ? 'white' : 'subtle';
|
|
166
|
+
const labelAppearance = disabled ? 'disabled' : selected && !menu ? 'white' : 'subtle';
|
|
154
167
|
const iconAppearance = selected ? 'white' : 'disabled';
|
|
155
168
|
|
|
156
169
|
if (typeof subInfo === 'string') {
|
|
@@ -195,6 +208,7 @@ const Option = (props: OptionProps) => {
|
|
|
195
208
|
onUpdateActiveOption,
|
|
196
209
|
dataTest: `DesignSystem-DropdownOption--${type}`,
|
|
197
210
|
className: checkboxes ? CheckboxClassName : OptionClassName,
|
|
211
|
+
id,
|
|
198
212
|
});
|
|
199
213
|
};
|
|
200
214
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { Icon, Text } from '@/index';
|
|
3
|
+
import { Button, Icon, Text } from '@/index';
|
|
4
4
|
import { BaseHtmlProps, BaseProps, extractBaseProps } from '@/utils/types';
|
|
5
5
|
import { AutoComplete } from '@/common.type';
|
|
6
6
|
|
|
@@ -168,12 +168,10 @@ export const MetricInput = React.forwardRef<HTMLInputElement, MetricInputProps>(
|
|
|
168
168
|
[`MetricInput-icon--${size}`]: size,
|
|
169
169
|
});
|
|
170
170
|
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
[`MetricInput-arrowIcon--${direction}`]: direction,
|
|
176
|
-
});
|
|
171
|
+
const actionButton = classNames({
|
|
172
|
+
['p-0']: true,
|
|
173
|
+
[`MetricInput-arrowIcon--${size}`]: size,
|
|
174
|
+
});
|
|
177
175
|
|
|
178
176
|
const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
179
177
|
if (isUncontrolled) {
|
|
@@ -226,17 +224,10 @@ export const MetricInput = React.forwardRef<HTMLInputElement, MetricInputProps>(
|
|
|
226
224
|
}
|
|
227
225
|
};
|
|
228
226
|
|
|
229
|
-
const
|
|
227
|
+
const actionButtonSize = size === 'large' ? 'regular' : 'tiny';
|
|
230
228
|
|
|
231
229
|
return (
|
|
232
|
-
<div
|
|
233
|
-
data-test="DesignSystem-MetricInputWrapper"
|
|
234
|
-
className={classes}
|
|
235
|
-
onClick={() => ref.current?.focus()}
|
|
236
|
-
onFocus={() => ref.current?.focus()}
|
|
237
|
-
onKeyDown={() => {}}
|
|
238
|
-
role="presentation"
|
|
239
|
-
>
|
|
230
|
+
<div data-test="DesignSystem-MetricInputWrapper" className={classes} onKeyDown={() => {}} role="presentation">
|
|
240
231
|
{icon && (
|
|
241
232
|
<Icon
|
|
242
233
|
data-test="DesignSystem-MetricInput--icon"
|
|
@@ -286,20 +277,18 @@ export const MetricInput = React.forwardRef<HTMLInputElement, MetricInputProps>(
|
|
|
286
277
|
</Text>
|
|
287
278
|
)}
|
|
288
279
|
|
|
289
|
-
<div
|
|
290
|
-
<
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
name="keyboard_arrow_up"
|
|
280
|
+
<div>
|
|
281
|
+
<Button
|
|
282
|
+
icon="keyboard_arrow_up"
|
|
283
|
+
size={actionButtonSize}
|
|
284
|
+
className={`${actionButton} mb-2`}
|
|
295
285
|
onClick={(e) => onArrowClick(e, 'up')}
|
|
296
286
|
data-test="DesignSystem-MetricInput--upIcon"
|
|
297
287
|
/>
|
|
298
|
-
<
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
name="keyboard_arrow_down"
|
|
288
|
+
<Button
|
|
289
|
+
icon="keyboard_arrow_down"
|
|
290
|
+
size={actionButtonSize}
|
|
291
|
+
className={actionButton}
|
|
303
292
|
onClick={(e) => onArrowClick(e, 'down')}
|
|
304
293
|
data-test="DesignSystem-MetricInput--downIcon"
|
|
305
294
|
/>
|
|
@@ -24,27 +24,43 @@ exports[`MetricInput component
|
|
|
24
24
|
type="number"
|
|
25
25
|
value="10"
|
|
26
26
|
/>
|
|
27
|
-
<div
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<i
|
|
31
|
-
class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--regular MetricInput-arrowIcon--up"
|
|
27
|
+
<div>
|
|
28
|
+
<button
|
|
29
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular mb-2"
|
|
32
30
|
data-test="DesignSystem-MetricInput--upIcon"
|
|
33
|
-
role="button"
|
|
34
|
-
style="font-size: 12px; width: 12px;"
|
|
35
31
|
tabindex="0"
|
|
36
32
|
>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
<div
|
|
34
|
+
class="Button-icon"
|
|
35
|
+
>
|
|
36
|
+
<i
|
|
37
|
+
class="material-icons material-icons-round Icon Icon--default"
|
|
38
|
+
data-test="DesignSystem-Button--Icon"
|
|
39
|
+
role="button"
|
|
40
|
+
style="font-size: 12px; width: 12px;"
|
|
41
|
+
>
|
|
42
|
+
keyboard_arrow_up_round
|
|
43
|
+
</i>
|
|
44
|
+
</div>
|
|
45
|
+
</button>
|
|
46
|
+
<button
|
|
47
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular"
|
|
41
48
|
data-test="DesignSystem-MetricInput--downIcon"
|
|
42
|
-
role="button"
|
|
43
|
-
style="font-size: 12px; width: 12px;"
|
|
44
49
|
tabindex="0"
|
|
45
50
|
>
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
<div
|
|
52
|
+
class="Button-icon"
|
|
53
|
+
>
|
|
54
|
+
<i
|
|
55
|
+
class="material-icons material-icons-round Icon Icon--default"
|
|
56
|
+
data-test="DesignSystem-Button--Icon"
|
|
57
|
+
role="button"
|
|
58
|
+
style="font-size: 12px; width: 12px;"
|
|
59
|
+
>
|
|
60
|
+
keyboard_arrow_down_round
|
|
61
|
+
</i>
|
|
62
|
+
</div>
|
|
63
|
+
</button>
|
|
48
64
|
</div>
|
|
49
65
|
</div>
|
|
50
66
|
</div>
|
|
@@ -75,27 +91,43 @@ exports[`MetricInput component
|
|
|
75
91
|
type="number"
|
|
76
92
|
value="10"
|
|
77
93
|
/>
|
|
78
|
-
<div
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<i
|
|
82
|
-
class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--regular MetricInput-arrowIcon--up"
|
|
94
|
+
<div>
|
|
95
|
+
<button
|
|
96
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular mb-2"
|
|
83
97
|
data-test="DesignSystem-MetricInput--upIcon"
|
|
84
|
-
role="button"
|
|
85
|
-
style="font-size: 12px; width: 12px;"
|
|
86
98
|
tabindex="0"
|
|
87
99
|
>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
100
|
+
<div
|
|
101
|
+
class="Button-icon"
|
|
102
|
+
>
|
|
103
|
+
<i
|
|
104
|
+
class="material-icons material-icons-round Icon Icon--default"
|
|
105
|
+
data-test="DesignSystem-Button--Icon"
|
|
106
|
+
role="button"
|
|
107
|
+
style="font-size: 12px; width: 12px;"
|
|
108
|
+
>
|
|
109
|
+
keyboard_arrow_up_round
|
|
110
|
+
</i>
|
|
111
|
+
</div>
|
|
112
|
+
</button>
|
|
113
|
+
<button
|
|
114
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular"
|
|
92
115
|
data-test="DesignSystem-MetricInput--downIcon"
|
|
93
|
-
role="button"
|
|
94
|
-
style="font-size: 12px; width: 12px;"
|
|
95
116
|
tabindex="0"
|
|
96
117
|
>
|
|
97
|
-
|
|
98
|
-
|
|
118
|
+
<div
|
|
119
|
+
class="Button-icon"
|
|
120
|
+
>
|
|
121
|
+
<i
|
|
122
|
+
class="material-icons material-icons-round Icon Icon--default"
|
|
123
|
+
data-test="DesignSystem-Button--Icon"
|
|
124
|
+
role="button"
|
|
125
|
+
style="font-size: 12px; width: 12px;"
|
|
126
|
+
>
|
|
127
|
+
keyboard_arrow_down_round
|
|
128
|
+
</i>
|
|
129
|
+
</div>
|
|
130
|
+
</button>
|
|
99
131
|
</div>
|
|
100
132
|
</div>
|
|
101
133
|
</div>
|
|
@@ -131,27 +163,43 @@ exports[`MetricInput component
|
|
|
131
163
|
>
|
|
132
164
|
kg
|
|
133
165
|
</span>
|
|
134
|
-
<div
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
<i
|
|
138
|
-
class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--large MetricInput-arrowIcon--up"
|
|
166
|
+
<div>
|
|
167
|
+
<button
|
|
168
|
+
class="Button Button--regular Button--regularSquare Button--basic p-0 MetricInput-arrowIcon--large mb-2"
|
|
139
169
|
data-test="DesignSystem-MetricInput--upIcon"
|
|
140
|
-
role="button"
|
|
141
|
-
style="font-size: 16px; width: 16px;"
|
|
142
170
|
tabindex="0"
|
|
143
171
|
>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
172
|
+
<div
|
|
173
|
+
class="Button-icon"
|
|
174
|
+
>
|
|
175
|
+
<i
|
|
176
|
+
class="material-icons material-icons-round Icon Icon--default"
|
|
177
|
+
data-test="DesignSystem-Button--Icon"
|
|
178
|
+
role="button"
|
|
179
|
+
style="font-size: 16px; width: 16px;"
|
|
180
|
+
>
|
|
181
|
+
keyboard_arrow_up_round
|
|
182
|
+
</i>
|
|
183
|
+
</div>
|
|
184
|
+
</button>
|
|
185
|
+
<button
|
|
186
|
+
class="Button Button--regular Button--regularSquare Button--basic p-0 MetricInput-arrowIcon--large"
|
|
148
187
|
data-test="DesignSystem-MetricInput--downIcon"
|
|
149
|
-
role="button"
|
|
150
|
-
style="font-size: 16px; width: 16px;"
|
|
151
188
|
tabindex="0"
|
|
152
189
|
>
|
|
153
|
-
|
|
154
|
-
|
|
190
|
+
<div
|
|
191
|
+
class="Button-icon"
|
|
192
|
+
>
|
|
193
|
+
<i
|
|
194
|
+
class="material-icons material-icons-round Icon Icon--default"
|
|
195
|
+
data-test="DesignSystem-Button--Icon"
|
|
196
|
+
role="button"
|
|
197
|
+
style="font-size: 16px; width: 16px;"
|
|
198
|
+
>
|
|
199
|
+
keyboard_arrow_down_round
|
|
200
|
+
</i>
|
|
201
|
+
</div>
|
|
202
|
+
</button>
|
|
155
203
|
</div>
|
|
156
204
|
</div>
|
|
157
205
|
</div>
|
|
@@ -187,27 +235,43 @@ exports[`MetricInput component
|
|
|
187
235
|
>
|
|
188
236
|
kg
|
|
189
237
|
</span>
|
|
190
|
-
<div
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
<i
|
|
194
|
-
class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--regular MetricInput-arrowIcon--up"
|
|
238
|
+
<div>
|
|
239
|
+
<button
|
|
240
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular mb-2"
|
|
195
241
|
data-test="DesignSystem-MetricInput--upIcon"
|
|
196
|
-
role="button"
|
|
197
|
-
style="font-size: 12px; width: 12px;"
|
|
198
242
|
tabindex="0"
|
|
199
243
|
>
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
244
|
+
<div
|
|
245
|
+
class="Button-icon"
|
|
246
|
+
>
|
|
247
|
+
<i
|
|
248
|
+
class="material-icons material-icons-round Icon Icon--default"
|
|
249
|
+
data-test="DesignSystem-Button--Icon"
|
|
250
|
+
role="button"
|
|
251
|
+
style="font-size: 12px; width: 12px;"
|
|
252
|
+
>
|
|
253
|
+
keyboard_arrow_up_round
|
|
254
|
+
</i>
|
|
255
|
+
</div>
|
|
256
|
+
</button>
|
|
257
|
+
<button
|
|
258
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular"
|
|
204
259
|
data-test="DesignSystem-MetricInput--downIcon"
|
|
205
|
-
role="button"
|
|
206
|
-
style="font-size: 12px; width: 12px;"
|
|
207
260
|
tabindex="0"
|
|
208
261
|
>
|
|
209
|
-
|
|
210
|
-
|
|
262
|
+
<div
|
|
263
|
+
class="Button-icon"
|
|
264
|
+
>
|
|
265
|
+
<i
|
|
266
|
+
class="material-icons material-icons-round Icon Icon--default"
|
|
267
|
+
data-test="DesignSystem-Button--Icon"
|
|
268
|
+
role="button"
|
|
269
|
+
style="font-size: 12px; width: 12px;"
|
|
270
|
+
>
|
|
271
|
+
keyboard_arrow_down_round
|
|
272
|
+
</i>
|
|
273
|
+
</div>
|
|
274
|
+
</button>
|
|
211
275
|
</div>
|
|
212
276
|
</div>
|
|
213
277
|
</div>
|