colibri-ui 0.8.71 → 0.8.72
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/Accordion/index.d.ts +3 -9
- package/Accordion/index.js +3 -5
- package/Accordion/index.props.d.ts +7 -0
- package/Avatar/index.d.ts +1 -2
- package/Avatar/index.js +1 -3
- package/Badge/index.d.ts +1 -2
- package/Badge/index.js +1 -3
- package/Button/index.d.ts +1 -2
- package/Button/index.js +1 -3
- package/Calendar/Calendar.d.ts +2 -42
- package/Calendar/Calendar.js +5 -7
- package/Calendar/index.d.ts +2 -2
- package/Calendar/index.js +1 -4
- package/Calendar/index.props.d.ts +40 -0
- package/Card/Card.d.ts +1 -18
- package/Card/index.d.ts +1 -1
- package/Card/index.props.d.ts +18 -0
- package/Checkbox/index.d.ts +1 -2
- package/Checkbox/index.js +2 -4
- package/Chip/index.d.ts +1 -2
- package/Chip/index.js +1 -3
- package/ClickOutside/index.d.ts +3 -6
- package/ClickOutside/index.js +2 -4
- package/ClickOutside/index.props.d.ts +4 -0
- package/CodeField/CodeField.d.ts +2 -25
- package/CodeField/index.d.ts +2 -2
- package/CodeField/index.js +0 -3
- package/CodeField/index.props.d.ts +25 -0
- package/Counter/index.d.ts +1 -2
- package/Counter/index.js +5 -7
- package/Datepicker/components/DatePicker/index.d.ts +1 -2
- package/Datepicker/components/DatePicker/index.js +10 -12
- package/Datepicker/index.d.ts +1 -2
- package/Datepicker/index.js +2 -4
- package/DotsLoader/index.d.ts +2 -2
- package/DotsLoader/index.js +1 -3
- package/DotsLoader/index.props.d.ts +1 -0
- package/Drawer/Drawer.d.ts +1 -38
- package/Drawer/index.d.ts +1 -1
- package/Drawer/index.props.d.ts +38 -0
- package/Dropdown/index.d.ts +1 -2
- package/Dropdown/index.js +2 -4
- package/Dropzone/Dropzone.d.ts +1 -28
- package/Dropzone/index.d.ts +1 -1
- package/Dropzone/index.props.d.ts +28 -0
- package/Editable/Editable.d.ts +2 -17
- package/Editable/Editable.js +1 -1
- package/Editable/index.d.ts +2 -2
- package/Editable/index.js +0 -3
- package/Editable/index.props.d.ts +17 -0
- package/Grid/Item/index.d.ts +1 -2
- package/Grid/Item/index.js +1 -3
- package/Grid/index.d.ts +1 -2
- package/Grid/index.js +1 -3
- package/Icons/ArrowNext.d.ts +1 -2
- package/Icons/ArrowNext.js +3 -5
- package/Icons/Cart.d.ts +1 -2
- package/Icons/Cart.js +3 -5
- package/Icons/Check.d.ts +1 -2
- package/Icons/Check.js +3 -5
- package/Icons/Chevron.d.ts +1 -2
- package/Icons/Chevron.js +3 -5
- package/Icons/Close.d.ts +1 -2
- package/Icons/Close.js +3 -5
- package/Icons/Cross.d.ts +1 -2
- package/Icons/Cross.js +3 -5
- package/Icons/CrossFill.d.ts +1 -2
- package/Icons/CrossFill.js +3 -5
- package/Icons/Edit.d.ts +1 -2
- package/Icons/Edit.js +3 -5
- package/Icons/Exit.d.ts +1 -2
- package/Icons/Exit.js +3 -5
- package/Icons/EyeClosed.d.ts +1 -2
- package/Icons/EyeClosed.js +3 -5
- package/Icons/EyeOpen.d.ts +1 -2
- package/Icons/EyeOpen.js +3 -5
- package/Icons/Help.d.ts +1 -2
- package/Icons/Help.js +3 -5
- package/Icons/Info.d.ts +1 -2
- package/Icons/Info.js +3 -5
- package/Icons/Minus.d.ts +1 -2
- package/Icons/Minus.js +3 -5
- package/Icons/More.d.ts +1 -2
- package/Icons/More.js +3 -5
- package/Icons/Plus.d.ts +1 -2
- package/Icons/Plus.js +3 -5
- package/Icons/Setting.d.ts +1 -2
- package/Icons/Setting.js +3 -5
- package/Icons/Shield.d.ts +1 -2
- package/Icons/Shield.js +3 -5
- package/Icons/Trash.d.ts +1 -2
- package/Icons/Trash.js +3 -5
- package/Icons/User.d.ts +1 -2
- package/Icons/User.js +3 -5
- package/Icons/index.d.ts +20 -19
- package/Icons/index.js +21 -19
- package/Image/index.d.ts +1 -2
- package/Image/index.js +1 -3
- package/Input/index.d.ts +1 -2
- package/Input/index.js +4 -6
- package/InputRadio/index.d.ts +3 -23
- package/InputRadio/index.js +2 -4
- package/InputRadio/index.props.d.ts +20 -0
- package/Menu/components/MenuItem/index.d.ts +1 -2
- package/Menu/components/MenuItem/index.js +1 -3
- package/Menu/index.d.ts +1 -2
- package/Menu/index.js +1 -3
- package/Modal/components/Close/index.d.ts +2 -6
- package/Modal/components/Close/index.js +2 -4
- package/Modal/components/Close/index.props.d.ts +4 -0
- package/Modal/components/Content/index.d.ts +3 -3
- package/Modal/components/Content/index.js +1 -3
- package/Modal/components/Content/index.props.d.ts +2 -0
- package/Modal/components/Title/index.d.ts +3 -3
- package/Modal/components/Title/index.js +2 -4
- package/Modal/components/Title/index.props.d.ts +2 -0
- package/Modal/index.d.ts +1 -2
- package/Modal/index.js +8 -10
- package/MultiSelect/components/MenuOverlay/index.d.ts +2 -18
- package/MultiSelect/components/MenuOverlay/index.js +6 -8
- package/MultiSelect/components/MenuOverlay/index.props.d.ts +16 -0
- package/MultiSelect/components/MenuOverlayItem/index.d.ts +2 -12
- package/MultiSelect/components/MenuOverlayItem/index.js +3 -5
- package/MultiSelect/components/MenuOverlayItem/index.props.d.ts +11 -0
- package/MultiSelect/index.d.ts +1 -2
- package/MultiSelect/index.js +8 -10
- package/NumberInput/NumberInput.d.ts +3 -0
- package/NumberInput/NumberInput.js +188 -0
- package/NumberInput/NumberInput.module.css +31 -0
- package/NumberInput/index.d.ts +2 -0
- package/NumberInput/index.js +7 -0
- package/NumberInput/index.props.d.ts +28 -0
- package/NumberInput/package.json +9 -0
- package/Portal/index.d.ts +3 -5
- package/Portal/index.js +1 -3
- package/Portal/index.props.d.ts +4 -0
- package/Progress/Progress.d.ts +1 -18
- package/Progress/index.d.ts +1 -1
- package/Progress/index.props.d.ts +18 -0
- package/README.md +8 -3
- package/RadioGroup/Radio.d.ts +3 -19
- package/RadioGroup/Radio.js +2 -4
- package/RadioGroup/index.d.ts +2 -25
- package/RadioGroup/index.js +2 -4
- package/RadioGroup/index.props.d.ts +38 -0
- package/Rating/Rating.d.ts +1 -22
- package/Rating/Rating.js +0 -3
- package/Rating/index.d.ts +2 -2
- package/Rating/index.js +0 -3
- package/Rating/index.props.d.ts +21 -0
- package/Select/components/MenuOverlay/index.d.ts +2 -11
- package/Select/components/MenuOverlay/index.js +3 -5
- package/Select/components/MenuOverlay/index.props.d.ts +11 -0
- package/Select/components/MenuOverlayItem/index.d.ts +2 -15
- package/Select/components/MenuOverlayItem/index.js +3 -5
- package/Select/components/MenuOverlayItem/index.props.d.ts +14 -0
- package/Select/index.d.ts +1 -2
- package/Select/index.js +6 -8
- package/Separator/index.d.ts +2 -5
- package/Separator/index.js +1 -3
- package/Separator/index.props.d.ts +3 -0
- package/Slider/Slider.d.ts +3 -0
- package/Slider/Slider.js +211 -0
- package/Slider/Slider.module.css +314 -0
- package/Slider/index.d.ts +2 -0
- package/Slider/index.js +7 -0
- package/Slider/index.props.d.ts +47 -0
- package/Slider/package.json +9 -0
- package/Status/index.d.ts +1 -2
- package/Status/index.js +1 -3
- package/Switch/index.d.ts +1 -2
- package/Switch/index.js +2 -4
- package/TabsMenu/Tab/Tab.d.ts +2 -3
- package/TabsMenu/Tab/Tab.js +1 -3
- package/TabsMenu/index.d.ts +1 -2
- package/TabsMenu/index.js +2 -4
- package/TabsMenu/index.props.d.ts +1 -1
- package/TabsPanels/index.d.ts +1 -2
- package/TabsPanels/index.js +1 -3
- package/TextArea/index.d.ts +1 -2
- package/TextArea/index.js +3 -5
- package/TimeSelect/Label/index.d.ts +2 -7
- package/TimeSelect/Label/index.js +1 -3
- package/TimeSelect/Label/index.props.d.ts +5 -0
- package/TimeSelect/index.d.ts +2 -10
- package/TimeSelect/index.js +3 -5
- package/TimeSelect/index.props.d.ts +8 -0
- package/Tooltip/index.d.ts +1 -2
- package/Tooltip/index.js +1 -3
- package/Typography/index.d.ts +1 -2
- package/Typography/index.js +1 -3
- package/base/BaseInput/index.d.ts +1 -2
- package/base/BaseInput/index.js +1 -3
- package/base/FormField/index.d.ts +1 -2
- package/base/FormField/index.js +3 -5
- package/base/InputRoot/index.d.ts +1 -2
- package/base/InputRoot/index.js +1 -3
- package/esm/Accordion/index.d.ts +3 -9
- package/esm/Accordion/index.js +3 -3
- package/esm/Accordion/index.props.d.ts +7 -0
- package/esm/Avatar/index.d.ts +1 -2
- package/esm/Avatar/index.js +1 -1
- package/esm/Badge/index.d.ts +1 -2
- package/esm/Badge/index.js +1 -1
- package/esm/Button/index.d.ts +1 -2
- package/esm/Button/index.js +1 -1
- package/esm/Calendar/Calendar.d.ts +2 -42
- package/esm/Calendar/Calendar.js +3 -3
- package/esm/Calendar/index.d.ts +2 -2
- package/esm/Calendar/index.props.d.ts +40 -0
- package/esm/Card/Card.d.ts +1 -18
- package/esm/Card/index.d.ts +1 -1
- package/esm/Card/index.props.d.ts +18 -0
- package/esm/Checkbox/index.d.ts +1 -2
- package/esm/Checkbox/index.js +2 -2
- package/esm/Chip/index.d.ts +1 -2
- package/esm/Chip/index.js +1 -1
- package/esm/ClickOutside/index.d.ts +3 -6
- package/esm/ClickOutside/index.js +2 -2
- package/esm/ClickOutside/index.props.d.ts +4 -0
- package/esm/CodeField/CodeField.d.ts +2 -25
- package/esm/CodeField/CodeField.js +3 -1
- package/esm/CodeField/index.d.ts +2 -2
- package/esm/CodeField/index.props.d.ts +25 -0
- package/esm/Counter/index.d.ts +1 -2
- package/esm/Counter/index.js +6 -6
- package/esm/Datepicker/components/DatePicker/index.d.ts +1 -2
- package/esm/Datepicker/components/DatePicker/index.js +7 -7
- package/esm/Datepicker/index.d.ts +1 -2
- package/esm/Datepicker/index.js +2 -2
- package/esm/DotsLoader/index.d.ts +2 -2
- package/esm/DotsLoader/index.js +1 -1
- package/esm/DotsLoader/index.props.d.ts +1 -0
- package/esm/Drawer/Drawer.d.ts +1 -38
- package/esm/Drawer/index.d.ts +1 -1
- package/esm/Drawer/index.props.d.ts +38 -0
- package/esm/Dropdown/index.d.ts +1 -2
- package/esm/Dropdown/index.js +2 -2
- package/esm/Dropzone/Dropzone.d.ts +1 -28
- package/esm/Dropzone/index.d.ts +1 -1
- package/esm/Dropzone/index.props.d.ts +28 -0
- package/esm/Editable/Editable.d.ts +2 -17
- package/esm/Editable/Editable.js +1 -1
- package/esm/Editable/index.d.ts +2 -2
- package/esm/Editable/index.props.d.ts +17 -0
- package/esm/Grid/Item/index.d.ts +1 -2
- package/esm/Grid/Item/index.js +1 -1
- package/esm/Grid/index.d.ts +1 -2
- package/esm/Grid/index.js +1 -1
- package/esm/Icons/ArrowNext.d.ts +1 -2
- package/esm/Icons/ArrowNext.js +3 -3
- package/esm/Icons/Cart.d.ts +1 -2
- package/esm/Icons/Cart.js +3 -3
- package/esm/Icons/Check.d.ts +1 -2
- package/esm/Icons/Check.js +3 -3
- package/esm/Icons/Chevron.d.ts +1 -2
- package/esm/Icons/Chevron.js +3 -3
- package/esm/Icons/Close.d.ts +1 -2
- package/esm/Icons/Close.js +3 -3
- package/esm/Icons/Cross.d.ts +1 -2
- package/esm/Icons/Cross.js +3 -3
- package/esm/Icons/CrossFill.d.ts +1 -2
- package/esm/Icons/CrossFill.js +3 -3
- package/esm/Icons/Edit.d.ts +1 -2
- package/esm/Icons/Edit.js +3 -3
- package/esm/Icons/Exit.d.ts +1 -2
- package/esm/Icons/Exit.js +3 -3
- package/esm/Icons/EyeClosed.d.ts +1 -2
- package/esm/Icons/EyeClosed.js +3 -3
- package/esm/Icons/EyeOpen.d.ts +1 -2
- package/esm/Icons/EyeOpen.js +3 -3
- package/esm/Icons/Help.d.ts +1 -2
- package/esm/Icons/Help.js +3 -3
- package/esm/Icons/Info.d.ts +1 -2
- package/esm/Icons/Info.js +3 -3
- package/esm/Icons/Minus.d.ts +1 -2
- package/esm/Icons/Minus.js +3 -3
- package/esm/Icons/More.d.ts +1 -2
- package/esm/Icons/More.js +3 -3
- package/esm/Icons/Plus.d.ts +1 -2
- package/esm/Icons/Plus.js +3 -3
- package/esm/Icons/Setting.d.ts +1 -2
- package/esm/Icons/Setting.js +3 -3
- package/esm/Icons/Shield.d.ts +1 -2
- package/esm/Icons/Shield.js +3 -3
- package/esm/Icons/Trash.d.ts +1 -2
- package/esm/Icons/Trash.js +3 -3
- package/esm/Icons/User.d.ts +1 -2
- package/esm/Icons/User.js +3 -3
- package/esm/Icons/index.d.ts +20 -19
- package/esm/Image/index.d.ts +1 -2
- package/esm/Image/index.js +1 -1
- package/esm/Input/index.d.ts +1 -2
- package/esm/Input/index.js +4 -4
- package/esm/InputRadio/index.d.ts +3 -23
- package/esm/InputRadio/index.js +2 -2
- package/esm/InputRadio/index.props.d.ts +20 -0
- package/esm/Menu/components/MenuItem/index.d.ts +1 -2
- package/esm/Menu/components/MenuItem/index.js +1 -1
- package/esm/Menu/index.d.ts +1 -2
- package/esm/Menu/index.js +1 -1
- package/esm/Modal/components/Close/index.d.ts +2 -6
- package/esm/Modal/components/Close/index.js +3 -3
- package/esm/Modal/components/Close/index.props.d.ts +4 -0
- package/esm/Modal/components/Content/index.d.ts +3 -3
- package/esm/Modal/components/Content/index.js +1 -1
- package/esm/Modal/components/Content/index.props.d.ts +2 -0
- package/esm/Modal/components/Title/index.d.ts +3 -3
- package/esm/Modal/components/Title/index.js +2 -2
- package/esm/Modal/components/Title/index.props.d.ts +2 -0
- package/esm/Modal/index.d.ts +1 -2
- package/esm/Modal/index.js +8 -8
- package/esm/MultiSelect/components/MenuOverlay/index.d.ts +2 -18
- package/esm/MultiSelect/components/MenuOverlay/index.js +7 -7
- package/esm/MultiSelect/components/MenuOverlay/index.props.d.ts +16 -0
- package/esm/MultiSelect/components/MenuOverlayItem/index.d.ts +2 -12
- package/esm/MultiSelect/components/MenuOverlayItem/index.js +3 -3
- package/esm/MultiSelect/components/MenuOverlayItem/index.props.d.ts +11 -0
- package/esm/MultiSelect/index.d.ts +1 -2
- package/esm/MultiSelect/index.js +8 -8
- package/esm/NumberInput/NumberInput.d.ts +3 -0
- package/esm/NumberInput/NumberInput.js +179 -0
- package/esm/NumberInput/NumberInput.module.css +31 -0
- package/esm/NumberInput/index.d.ts +2 -0
- package/esm/NumberInput/index.props.d.ts +28 -0
- package/esm/Portal/index.d.ts +3 -5
- package/esm/Portal/index.js +1 -1
- package/esm/Portal/index.props.d.ts +4 -0
- package/esm/Progress/Progress.d.ts +1 -18
- package/esm/Progress/index.d.ts +1 -1
- package/esm/Progress/index.props.d.ts +18 -0
- package/esm/RadioGroup/Radio.d.ts +3 -19
- package/esm/RadioGroup/Radio.js +2 -2
- package/esm/RadioGroup/index.d.ts +2 -25
- package/esm/RadioGroup/index.js +2 -2
- package/esm/RadioGroup/index.props.d.ts +38 -0
- package/esm/Rating/Rating.d.ts +1 -22
- package/esm/Rating/Rating.js +1 -1
- package/esm/Rating/index.d.ts +2 -2
- package/esm/Rating/index.props.d.ts +21 -0
- package/esm/Select/components/MenuOverlay/index.d.ts +2 -11
- package/esm/Select/components/MenuOverlay/index.js +3 -3
- package/esm/Select/components/MenuOverlay/index.props.d.ts +11 -0
- package/esm/Select/components/MenuOverlayItem/index.d.ts +2 -15
- package/esm/Select/components/MenuOverlayItem/index.js +3 -3
- package/esm/Select/components/MenuOverlayItem/index.props.d.ts +14 -0
- package/esm/Select/index.d.ts +1 -2
- package/esm/Select/index.js +6 -6
- package/esm/Separator/index.d.ts +2 -5
- package/esm/Separator/index.js +1 -1
- package/esm/Separator/index.props.d.ts +3 -0
- package/esm/Slider/Slider.d.ts +3 -0
- package/esm/Slider/Slider.js +204 -0
- package/esm/Slider/Slider.module.css +314 -0
- package/esm/Slider/index.d.ts +2 -0
- package/esm/Slider/index.props.d.ts +47 -0
- package/esm/Status/index.d.ts +1 -2
- package/esm/Status/index.js +1 -1
- package/esm/Switch/index.d.ts +1 -2
- package/esm/Switch/index.js +2 -2
- package/esm/TabsMenu/Tab/Tab.d.ts +2 -3
- package/esm/TabsMenu/Tab/Tab.js +1 -1
- package/esm/TabsMenu/index.d.ts +1 -2
- package/esm/TabsMenu/index.js +2 -2
- package/esm/TabsMenu/index.props.d.ts +1 -1
- package/esm/TabsPanels/index.d.ts +1 -2
- package/esm/TabsPanels/index.js +1 -1
- package/esm/TextArea/index.d.ts +1 -2
- package/esm/TextArea/index.js +3 -3
- package/esm/TimeSelect/Label/index.d.ts +2 -7
- package/esm/TimeSelect/Label/index.js +1 -1
- package/esm/TimeSelect/Label/index.props.d.ts +5 -0
- package/esm/TimeSelect/index.d.ts +2 -10
- package/esm/TimeSelect/index.js +3 -3
- package/esm/TimeSelect/index.props.d.ts +8 -0
- package/esm/Tooltip/index.d.ts +1 -2
- package/esm/Tooltip/index.js +1 -1
- package/esm/Typography/index.d.ts +1 -2
- package/esm/Typography/index.js +1 -1
- package/esm/base/BaseInput/index.d.ts +1 -2
- package/esm/base/BaseInput/index.js +1 -1
- package/esm/base/FormField/index.d.ts +1 -2
- package/esm/base/FormField/index.js +2 -2
- package/esm/base/InputRoot/index.d.ts +1 -2
- package/esm/base/InputRoot/index.js +1 -1
- package/esm/hooks/useMediaSizes/index.d.ts +2 -2
- package/esm/hooks/useMediaSizes/index.js +1 -1
- package/esm/hooks/useOnClickOutside/index.d.ts +2 -2
- package/esm/hooks/useOnClickOutside/index.js +1 -1
- package/esm/hooks/useScrollLock/index.d.ts +1 -2
- package/esm/hooks/useScrollLock/index.js +1 -1
- package/esm/hooks/useTrapFocus/index.d.ts +1 -2
- package/esm/hooks/useTrapFocus/index.js +1 -1
- package/esm/index.d.ts +74 -37
- package/esm/index.js +56 -53
- package/hooks/useMediaSizes/index.d.ts +2 -2
- package/hooks/useMediaSizes/index.js +1 -3
- package/hooks/useOnClickOutside/index.d.ts +2 -2
- package/hooks/useOnClickOutside/index.js +1 -3
- package/hooks/useScrollLock/index.d.ts +1 -2
- package/hooks/useScrollLock/index.js +1 -3
- package/hooks/useTrapFocus/index.d.ts +1 -2
- package/hooks/useTrapFocus/index.js +1 -3
- package/index.d.ts +74 -37
- package/index.js +64 -53
- package/package.json +1 -1
- /package/TabsMenu/Tab/{Tab.props.d.ts → index.props.d.ts} +0 -0
- /package/esm/TabsMenu/Tab/{Tab.props.d.ts → index.props.d.ts} +0 -0
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
4
|
var tslib = require('tslib');
|
|
7
5
|
var React = require('react');
|
|
@@ -45,4 +43,4 @@ var MenuItem = function MenuItem(_a) {
|
|
|
45
43
|
}, props), children);
|
|
46
44
|
};
|
|
47
45
|
|
|
48
|
-
exports.
|
|
46
|
+
exports.MenuItem = MenuItem;
|
package/Menu/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Props } from "./index.props";
|
|
3
|
-
declare const Menu: ({ selected, variant, className, onClick, children, ref, }: Props) => React.JSX.Element;
|
|
4
|
-
export default Menu;
|
|
3
|
+
export declare const Menu: ({ selected, variant, className, onClick, children, ref, }: Props) => React.JSX.Element;
|
package/Menu/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var React = require('react');
|
|
6
4
|
var clsx = require('clsx');
|
|
7
5
|
var styles = require('./Menu.module.css');
|
|
@@ -43,4 +41,4 @@ var Menu = function Menu(_ref) {
|
|
|
43
41
|
}, renderChild);
|
|
44
42
|
};
|
|
45
43
|
|
|
46
|
-
exports.
|
|
44
|
+
exports.Menu = Menu;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
|
-
type CloseButtonProps
|
|
3
|
-
|
|
4
|
-
"aria-label"?: string;
|
|
5
|
-
};
|
|
6
|
-
declare const Close: FC<CloseButtonProps>;
|
|
7
|
-
export default Close;
|
|
2
|
+
import type { CloseButtonProps } from "./index.props";
|
|
3
|
+
export declare const Close: FC<CloseButtonProps>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var React = require('react');
|
|
6
4
|
require('../../../Icons/index.js');
|
|
7
5
|
var styles = require('./Close.module.css');
|
|
@@ -20,10 +18,10 @@ var Close = function Close(_ref) {
|
|
|
20
18
|
onClick: onClick,
|
|
21
19
|
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "Close",
|
|
22
20
|
className: styles__default.default["close-button"]
|
|
23
|
-
}, /*#__PURE__*/React__default.default.createElement(Close$1.
|
|
21
|
+
}, /*#__PURE__*/React__default.default.createElement(Close$1.Close, {
|
|
24
22
|
width: 18,
|
|
25
23
|
height: 18
|
|
26
24
|
}));
|
|
27
25
|
};
|
|
28
26
|
|
|
29
|
-
exports.
|
|
27
|
+
exports.Close = Close;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { FC
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { ContentProps } from "./index.props";
|
|
3
|
+
export declare const Content: FC<ContentProps>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var React = require('react');
|
|
6
4
|
var styles = require('./Content.module.css');
|
|
7
5
|
|
|
@@ -17,4 +15,4 @@ var Content = function Content(_ref) {
|
|
|
17
15
|
}, children);
|
|
18
16
|
};
|
|
19
17
|
|
|
20
|
-
exports.
|
|
18
|
+
exports.Content = Content;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { FC
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { TitleProps } from "./index.props";
|
|
3
|
+
export declare const Title: FC<TitleProps>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var React = require('react');
|
|
6
4
|
var index = require('../../../Typography/index.js');
|
|
7
5
|
var styles = require('./Title.module.css');
|
|
@@ -13,7 +11,7 @@ var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
|
13
11
|
|
|
14
12
|
var Title = function Title(_ref) {
|
|
15
13
|
var children = _ref.children;
|
|
16
|
-
return /*#__PURE__*/React__default.default.createElement(index.
|
|
14
|
+
return /*#__PURE__*/React__default.default.createElement(index.Typography, {
|
|
17
15
|
tag: "h3",
|
|
18
16
|
size: "h3",
|
|
19
17
|
className: styles__default.default.title
|
|
@@ -22,4 +20,4 @@ var Title = function Title(_ref) {
|
|
|
22
20
|
}, children));
|
|
23
21
|
};
|
|
24
22
|
|
|
25
|
-
exports.
|
|
23
|
+
exports.Title = Title;
|
package/Modal/index.d.ts
CHANGED
package/Modal/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
4
|
var React = require('react');
|
|
7
5
|
var clsx = require('clsx');
|
|
@@ -27,11 +25,11 @@ var Modal = function Modal(_ref) {
|
|
|
27
25
|
onClose = _ref.onClose,
|
|
28
26
|
title = _ref.title;
|
|
29
27
|
var modalRef = React.useRef(null);
|
|
30
|
-
var isDesktop = index.
|
|
28
|
+
var isDesktop = index.useMediaSizes(function (bp) {
|
|
31
29
|
return bp.up("md");
|
|
32
30
|
});
|
|
33
|
-
index$1.
|
|
34
|
-
index$2.
|
|
31
|
+
index$1.useScrollLock();
|
|
32
|
+
index$2.useTrapFocus(modalRef);
|
|
35
33
|
var handleClose = React.useCallback(function () {
|
|
36
34
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
37
35
|
}, [onClose]);
|
|
@@ -51,7 +49,7 @@ var Modal = function Modal(_ref) {
|
|
|
51
49
|
return document.removeEventListener("keydown", handleEscape);
|
|
52
50
|
};
|
|
53
51
|
}, [handleClose]);
|
|
54
|
-
return /*#__PURE__*/React__default.default.createElement(index$3.
|
|
52
|
+
return /*#__PURE__*/React__default.default.createElement(index$3.Portal, null, /*#__PURE__*/React__default.default.createElement("div", {
|
|
55
53
|
className: styles__default.default.root,
|
|
56
54
|
role: "dialog",
|
|
57
55
|
"aria-modal": "true",
|
|
@@ -65,15 +63,15 @@ var Modal = function Modal(_ref) {
|
|
|
65
63
|
ref: modalRef
|
|
66
64
|
}, title ? (/*#__PURE__*/React__default.default.createElement("div", {
|
|
67
65
|
className: styles__default.default["title-wrapper"]
|
|
68
|
-
}, /*#__PURE__*/React__default.default.createElement(index$4.
|
|
66
|
+
}, /*#__PURE__*/React__default.default.createElement(index$4.Title, null, title), /*#__PURE__*/React__default.default.createElement(index$5.Close, {
|
|
69
67
|
onClick: handleClose,
|
|
70
68
|
"aria-label": "Close modal"
|
|
71
69
|
}))) : (/*#__PURE__*/React__default.default.createElement("div", {
|
|
72
70
|
className: styles__default.default["close-wrapper"]
|
|
73
|
-
}, /*#__PURE__*/React__default.default.createElement(index$5.
|
|
71
|
+
}, /*#__PURE__*/React__default.default.createElement(index$5.Close, {
|
|
74
72
|
onClick: handleClose,
|
|
75
73
|
"aria-label": "Close modal"
|
|
76
|
-
}))), /*#__PURE__*/React__default.default.createElement(index$6.
|
|
74
|
+
}))), /*#__PURE__*/React__default.default.createElement(index$6.Content, null, children))));
|
|
77
75
|
};
|
|
78
76
|
|
|
79
|
-
exports.
|
|
77
|
+
exports.Modal = Modal;
|
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export interface IOption {
|
|
5
|
-
selected: boolean;
|
|
6
|
-
value: string;
|
|
7
|
-
label: ReactNode;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
}
|
|
10
|
-
type MenuOverlayGroup = Omit<GroupProps, "options" | "value"> & {
|
|
11
|
-
options: IOption[];
|
|
12
|
-
value: string;
|
|
13
|
-
};
|
|
14
|
-
type MenuOverlayProps = {
|
|
15
|
-
groups: MenuOverlayGroup[];
|
|
16
|
-
onChange: (key: string) => void;
|
|
17
|
-
};
|
|
18
|
-
declare const _default: React.MemoExoticComponent<({ groups, onChange }: MenuOverlayProps) => React.JSX.Element>;
|
|
19
|
-
export default _default;
|
|
2
|
+
import type { MenuOverlayProps } from "./index.props";
|
|
3
|
+
export declare const MenuOverlay: React.MemoExoticComponent<({ groups, onChange }: MenuOverlayProps) => React.JSX.Element>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
6
4
|
var React = require('react');
|
|
7
5
|
var index$2 = require('../../../Menu/index.js');
|
|
@@ -18,7 +16,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
18
16
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
19
17
|
|
|
20
18
|
var OFFSET_ITEMS_COUNT = 2;
|
|
21
|
-
var
|
|
19
|
+
var MenuOverlayBase = function MenuOverlayBase(_ref) {
|
|
22
20
|
var groups = _ref.groups,
|
|
23
21
|
onChange = _ref.onChange;
|
|
24
22
|
var refs = React.useRef({});
|
|
@@ -79,11 +77,11 @@ var MenuOverlay = function MenuOverlay(_ref) {
|
|
|
79
77
|
key: "item-".concat(index$5)
|
|
80
78
|
}, /*#__PURE__*/React__default.default.createElement("div", {
|
|
81
79
|
className: styles__default.default.title
|
|
82
|
-
}, /*#__PURE__*/React__default.default.createElement(index.
|
|
80
|
+
}, /*#__PURE__*/React__default.default.createElement(index.Typography, {
|
|
83
81
|
size: "s",
|
|
84
82
|
variant: "secondary"
|
|
85
|
-
}, group.title)), /*#__PURE__*/React__default.default.createElement(index$1.
|
|
86
|
-
return /*#__PURE__*/React__default.default.createElement(index$3.
|
|
83
|
+
}, group.title)), /*#__PURE__*/React__default.default.createElement(index$1.Separator, null), /*#__PURE__*/React__default.default.createElement(index$2.Menu, null, group.options.map(function (option, optionIndex) {
|
|
84
|
+
return /*#__PURE__*/React__default.default.createElement(index$3.SelectItem, {
|
|
87
85
|
ref: function ref(_ref3) {
|
|
88
86
|
var key = "group-".concat(group.value, "-option-").concat(option.value);
|
|
89
87
|
refs.current[key] = _ref3;
|
|
@@ -103,6 +101,6 @@ var MenuOverlay = function MenuOverlay(_ref) {
|
|
|
103
101
|
})));
|
|
104
102
|
}));
|
|
105
103
|
};
|
|
106
|
-
var MenuOverlay
|
|
104
|
+
var MenuOverlay = /*#__PURE__*/React.memo(MenuOverlayBase);
|
|
107
105
|
|
|
108
|
-
exports.
|
|
106
|
+
exports.MenuOverlay = MenuOverlay;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { GroupProps } from "../../index.props";
|
|
3
|
+
export interface IOption {
|
|
4
|
+
selected: boolean;
|
|
5
|
+
value: string;
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type MenuOverlayGroup = Omit<GroupProps, "options" | "value"> & {
|
|
10
|
+
options: IOption[];
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
export type MenuOverlayProps = {
|
|
14
|
+
groups: MenuOverlayGroup[];
|
|
15
|
+
onChange: (key: string) => void;
|
|
16
|
+
};
|
|
@@ -1,13 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
type SelectItemProps
|
|
3
|
-
|
|
4
|
-
value: string;
|
|
5
|
-
label: React.ReactNode;
|
|
6
|
-
selected: boolean;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
};
|
|
9
|
-
onClick?: () => void;
|
|
10
|
-
ref?: React.Ref<HTMLLIElement>;
|
|
11
|
-
};
|
|
12
|
-
declare const SelectItem: ({ option, onClick, ref }: SelectItemProps) => React.JSX.Element;
|
|
13
|
-
export default SelectItem;
|
|
2
|
+
import type { SelectItemProps } from "./index.props";
|
|
3
|
+
export declare const SelectItem: ({ option, onClick, ref }: SelectItemProps) => React.JSX.Element;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var React = require('react');
|
|
6
4
|
var index = require('../../../Menu/components/MenuItem/index.js');
|
|
7
5
|
var Check = require('../../../Icons/Check.js');
|
|
@@ -14,15 +12,15 @@ var SelectItem = function SelectItem(_ref) {
|
|
|
14
12
|
var option = _ref.option,
|
|
15
13
|
onClick = _ref.onClick,
|
|
16
14
|
ref = _ref.ref;
|
|
17
|
-
return /*#__PURE__*/React__default.default.createElement(index.
|
|
15
|
+
return /*#__PURE__*/React__default.default.createElement(index.MenuItem, {
|
|
18
16
|
ref: ref,
|
|
19
17
|
onClick: onClick,
|
|
20
18
|
isSelected: option.selected,
|
|
21
19
|
disabled: option.disabled
|
|
22
|
-
}, option.label, option.selected && /*#__PURE__*/React__default.default.createElement(Check.
|
|
20
|
+
}, option.label, option.selected && /*#__PURE__*/React__default.default.createElement(Check.Check, {
|
|
23
21
|
width: 16,
|
|
24
22
|
height: 16
|
|
25
23
|
}));
|
|
26
24
|
};
|
|
27
25
|
|
|
28
|
-
exports.
|
|
26
|
+
exports.SelectItem = SelectItem;
|
package/MultiSelect/index.d.ts
CHANGED
package/MultiSelect/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
4
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
7
5
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
@@ -107,13 +105,13 @@ var MultiSelect = function MultiSelect(_ref2) {
|
|
|
107
105
|
});
|
|
108
106
|
});
|
|
109
107
|
}, [preparedGroups]);
|
|
110
|
-
return /*#__PURE__*/React__default.default.createElement(index$1.
|
|
108
|
+
return /*#__PURE__*/React__default.default.createElement(index$1.FormField, {
|
|
111
109
|
className: clsx__default.default(styles__default.default["form-field"], _defineProperty__default.default({}, styles__default.default["full-width"], Boolean(fullWidth)), className),
|
|
112
110
|
required: required,
|
|
113
111
|
label: label,
|
|
114
112
|
hint: hint,
|
|
115
113
|
hasError: hasError
|
|
116
|
-
}, /*#__PURE__*/React__default.default.createElement(index$2.
|
|
114
|
+
}, /*#__PURE__*/React__default.default.createElement(index$2.Dropdown, {
|
|
117
115
|
placement: "bottom-start",
|
|
118
116
|
preventOverflow: true,
|
|
119
117
|
onVisibleChange: setIsOpen,
|
|
@@ -121,7 +119,7 @@ var MultiSelect = function MultiSelect(_ref2) {
|
|
|
121
119
|
zIndex: zIndex,
|
|
122
120
|
fontSize: fontSize,
|
|
123
121
|
disabled: disabled,
|
|
124
|
-
overlay: /*#__PURE__*/React__default.default.createElement(index$3.
|
|
122
|
+
overlay: /*#__PURE__*/React__default.default.createElement(index$3.MenuOverlay, {
|
|
125
123
|
groups: preparedGroups,
|
|
126
124
|
onChange: handleChange
|
|
127
125
|
}),
|
|
@@ -132,7 +130,7 @@ var MultiSelect = function MultiSelect(_ref2) {
|
|
|
132
130
|
style: {
|
|
133
131
|
width: fullWidth ? "100%" : "fit-content"
|
|
134
132
|
}
|
|
135
|
-
}, /*#__PURE__*/React__default.default.createElement(index$4.
|
|
133
|
+
}, /*#__PURE__*/React__default.default.createElement(index$4.InputRoot, {
|
|
136
134
|
hasError: hasError,
|
|
137
135
|
size: size,
|
|
138
136
|
active: isOpen && Boolean(!disabled),
|
|
@@ -140,7 +138,7 @@ var MultiSelect = function MultiSelect(_ref2) {
|
|
|
140
138
|
width: fullWidth ? "100%" : ""
|
|
141
139
|
}),
|
|
142
140
|
className: clsx__default.default(styles__default.default.root, _defineProperty__default.default({}, styles__default.default["root_auto"], preparedLabel.length)),
|
|
143
|
-
endIcon: /*#__PURE__*/React__default.default.createElement(Chevron.
|
|
141
|
+
endIcon: /*#__PURE__*/React__default.default.createElement(Chevron.Chevron, {
|
|
144
142
|
className: clsx__default.default(styles__default.default.icon, _defineProperty__default.default({}, styles__default.default["icon_isOpen"], isOpen && Boolean(!disabled)))
|
|
145
143
|
}),
|
|
146
144
|
disabled: Boolean(disabled)
|
|
@@ -151,10 +149,10 @@ var MultiSelect = function MultiSelect(_ref2) {
|
|
|
151
149
|
preparedLabel.map(function (_ref6) {
|
|
152
150
|
var label = _ref6.label,
|
|
153
151
|
key = _ref6.key;
|
|
154
|
-
return /*#__PURE__*/React__default.default.createElement(index$5.
|
|
152
|
+
return /*#__PURE__*/React__default.default.createElement(index$5.Chip, {
|
|
155
153
|
key: key,
|
|
156
154
|
size: "s",
|
|
157
|
-
iconEnd: /*#__PURE__*/React__default.default.createElement(CrossFill.
|
|
155
|
+
iconEnd: /*#__PURE__*/React__default.default.createElement(CrossFill.CrossFill, null),
|
|
158
156
|
"data-ignore-click": true,
|
|
159
157
|
onClickIcon: function onClickIcon() {
|
|
160
158
|
return handleChange(key);
|
|
@@ -170,4 +168,4 @@ var MultiSelect = function MultiSelect(_ref2) {
|
|
|
170
168
|
})))));
|
|
171
169
|
};
|
|
172
170
|
|
|
173
|
-
exports.
|
|
171
|
+
exports.MultiSelect = MultiSelect;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
+
var tslib = require('tslib');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var clsx = require('clsx');
|
|
7
|
+
var Cross = require('../Icons/Cross.js');
|
|
8
|
+
var index = require('../Input/index.js');
|
|
9
|
+
var styles = require('./NumberInput.module.css');
|
|
10
|
+
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
|
|
14
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
15
|
+
var clsx__default = /*#__PURE__*/_interopDefault(clsx);
|
|
16
|
+
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
17
|
+
|
|
18
|
+
var groupInteger = function groupInteger(integer, separator, style) {
|
|
19
|
+
if (!separator || style === "none") return integer;
|
|
20
|
+
var group = style === "wan" ? 4 : 3;
|
|
21
|
+
if (style !== "lakh") {
|
|
22
|
+
return integer.replace(new RegExp("\\B(?=(\\d{".concat(group, "})+(?!\\d))"), "g"), separator);
|
|
23
|
+
}
|
|
24
|
+
if (integer.length <= 3) return integer;
|
|
25
|
+
var tail = integer.slice(-3);
|
|
26
|
+
var head = integer.slice(0, -3).replace(/\B(?=(\d{2})+(?!\d))/g, separator);
|
|
27
|
+
return "".concat(head).concat(separator).concat(tail);
|
|
28
|
+
};
|
|
29
|
+
var normalize = function normalize(input, decimalSeparator, decimalScale, allowNegative, allowLeadingZeros) {
|
|
30
|
+
var negative = allowNegative && input.replace(/^\s+/, "").startsWith("-");
|
|
31
|
+
var escapedSeparator = decimalSeparator.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
32
|
+
var cleaned = input.replace(new RegExp("[^0-9".concat(escapedSeparator, "]"), "g"), "");
|
|
33
|
+
var separatorIndex = cleaned.indexOf(decimalSeparator);
|
|
34
|
+
var rawInteger = (separatorIndex < 0 ? cleaned : cleaned.slice(0, separatorIndex)) || (separatorIndex >= 0 ? "0" : "");
|
|
35
|
+
var fraction = separatorIndex < 0 ? "" : cleaned.slice(separatorIndex + decimalSeparator.length).replace(/\D/g, "").slice(0, decimalScale);
|
|
36
|
+
var integer = allowLeadingZeros ? rawInteger : rawInteger.replace(/^0+(?=\d)/, "");
|
|
37
|
+
var decimalEntered = separatorIndex >= 0 && decimalScale > 0;
|
|
38
|
+
return "".concat(negative ? "-" : "").concat(integer).concat(decimalEntered ? ".".concat(fraction) : "");
|
|
39
|
+
};
|
|
40
|
+
var format = function format(raw, thousandSeparator, decimalSeparator, groupStyle, decimalScale, fixedDecimalScale, prefix, suffix) {
|
|
41
|
+
if (!raw) return "";
|
|
42
|
+
var negative = raw.startsWith("-");
|
|
43
|
+
var unsigned = negative ? raw.slice(1) : raw;
|
|
44
|
+
var _unsigned$split = unsigned.split("."),
|
|
45
|
+
_unsigned$split2 = _slicedToArray__default.default(_unsigned$split, 2),
|
|
46
|
+
_unsigned$split2$ = _unsigned$split2[0],
|
|
47
|
+
integer = _unsigned$split2$ === void 0 ? "" : _unsigned$split2$,
|
|
48
|
+
_unsigned$split2$2 = _unsigned$split2[1],
|
|
49
|
+
fraction = _unsigned$split2$2 === void 0 ? "" : _unsigned$split2$2;
|
|
50
|
+
var shouldShowDecimal = decimalScale > 0 && (raw.includes(".") || fixedDecimalScale);
|
|
51
|
+
var decimals = fixedDecimalScale ? fraction.padEnd(decimalScale, "0").slice(0, decimalScale) : fraction.slice(0, decimalScale);
|
|
52
|
+
return "".concat(negative ? "-" : "").concat(prefix).concat(groupInteger(integer || "0", thousandSeparator, groupStyle)).concat(shouldShowDecimal ? decimalSeparator : "").concat(decimals).concat(suffix);
|
|
53
|
+
};
|
|
54
|
+
var NumberInput = /*#__PURE__*/React.forwardRef(function (props, forwardedRef) {
|
|
55
|
+
var value = props.value,
|
|
56
|
+
_props$defaultValue = props.defaultValue,
|
|
57
|
+
defaultValue = _props$defaultValue === void 0 ? "" : _props$defaultValue,
|
|
58
|
+
onValueChange = props.onValueChange,
|
|
59
|
+
_props$thousandSepara = props.thousandSeparator,
|
|
60
|
+
thousandSeparator = _props$thousandSepara === void 0 ? " " : _props$thousandSepara,
|
|
61
|
+
_props$decimalSeparat = props.decimalSeparator,
|
|
62
|
+
decimalSeparator = _props$decimalSeparat === void 0 ? "." : _props$decimalSeparat,
|
|
63
|
+
_props$thousandsGroup = props.thousandsGroupStyle,
|
|
64
|
+
thousandsGroupStyle = _props$thousandsGroup === void 0 ? "thousand" : _props$thousandsGroup,
|
|
65
|
+
_props$decimalScale = props.decimalScale,
|
|
66
|
+
decimalScale = _props$decimalScale === void 0 ? 3 : _props$decimalScale,
|
|
67
|
+
_props$fixedDecimalSc = props.fixedDecimalScale,
|
|
68
|
+
fixedDecimalScale = _props$fixedDecimalSc === void 0 ? false : _props$fixedDecimalSc,
|
|
69
|
+
_props$allowNegative = props.allowNegative,
|
|
70
|
+
allowNegative = _props$allowNegative === void 0 ? false : _props$allowNegative,
|
|
71
|
+
_props$allowLeadingZe = props.allowLeadingZeros,
|
|
72
|
+
allowLeadingZeros = _props$allowLeadingZe === void 0 ? false : _props$allowLeadingZe,
|
|
73
|
+
_props$prefix = props.prefix,
|
|
74
|
+
prefix = _props$prefix === void 0 ? "" : _props$prefix,
|
|
75
|
+
_props$suffix = props.suffix,
|
|
76
|
+
suffix = _props$suffix === void 0 ? "" : _props$suffix,
|
|
77
|
+
min = props.min,
|
|
78
|
+
max = props.max,
|
|
79
|
+
isAllowed = props.isAllowed,
|
|
80
|
+
_props$clearable = props.clearable,
|
|
81
|
+
clearable = _props$clearable === void 0 ? false : _props$clearable,
|
|
82
|
+
_props$clearLabel = props.clearLabel,
|
|
83
|
+
clearLabel = _props$clearLabel === void 0 ? "Clear" : _props$clearLabel,
|
|
84
|
+
className = props.className,
|
|
85
|
+
disabled = props.disabled,
|
|
86
|
+
readOnly = props.readOnly,
|
|
87
|
+
id = props.id,
|
|
88
|
+
inputRef = props.inputRef,
|
|
89
|
+
endIcon = props.endIcon,
|
|
90
|
+
onFocus = props.onFocus,
|
|
91
|
+
onBlur = props.onBlur,
|
|
92
|
+
inputProps = tslib.__rest(props, ["value", "defaultValue", "onValueChange", "thousandSeparator", "decimalSeparator", "thousandsGroupStyle", "decimalScale", "fixedDecimalScale", "allowNegative", "allowLeadingZeros", "prefix", "suffix", "min", "max", "isAllowed", "clearable", "clearLabel", "className", "disabled", "readOnly", "id", "inputRef", "endIcon", "onFocus", "onBlur"]);
|
|
93
|
+
var generatedId = React.useId();
|
|
94
|
+
var inputId = id !== null && id !== void 0 ? id : generatedId;
|
|
95
|
+
var controlled = value !== undefined;
|
|
96
|
+
var options = {
|
|
97
|
+
decimalSeparator: decimalSeparator,
|
|
98
|
+
decimalScale: Math.max(0, decimalScale),
|
|
99
|
+
allowNegative: allowNegative,
|
|
100
|
+
allowLeadingZeros: allowLeadingZeros
|
|
101
|
+
};
|
|
102
|
+
var normalizeValue = function normalizeValue(next) {
|
|
103
|
+
return normalize(next.replace(".", decimalSeparator), options.decimalSeparator, options.decimalScale, options.allowNegative, options.allowLeadingZeros);
|
|
104
|
+
};
|
|
105
|
+
var _useState = React.useState(function () {
|
|
106
|
+
return normalizeValue(defaultValue);
|
|
107
|
+
}),
|
|
108
|
+
_useState2 = _slicedToArray__default.default(_useState, 2),
|
|
109
|
+
internalValue = _useState2[0],
|
|
110
|
+
setInternalValue = _useState2[1];
|
|
111
|
+
var rawValue = controlled ? normalizeValue(value) : internalValue;
|
|
112
|
+
var localInputRef = React.useRef(null);
|
|
113
|
+
var setRef = function setRef(node) {
|
|
114
|
+
localInputRef.current = node;
|
|
115
|
+
if (typeof forwardedRef === "function") forwardedRef(node);else if (forwardedRef) forwardedRef.current = node;
|
|
116
|
+
if (typeof inputRef === "function") inputRef(node);else if (inputRef) inputRef.current = node;
|
|
117
|
+
};
|
|
118
|
+
var formattedValue = React.useMemo(function () {
|
|
119
|
+
return format(rawValue, thousandSeparator, decimalSeparator, thousandsGroupStyle, options.decimalScale, fixedDecimalScale, prefix, suffix);
|
|
120
|
+
}, [rawValue, thousandSeparator, decimalSeparator, thousandsGroupStyle, options.decimalScale, fixedDecimalScale, prefix, suffix]);
|
|
121
|
+
var emit = function emit(nextRaw) {
|
|
122
|
+
var nextFormatted = format(nextRaw, thousandSeparator, decimalSeparator, thousandsGroupStyle, options.decimalScale, fixedDecimalScale, prefix, suffix);
|
|
123
|
+
var numeric = nextRaw === "" || nextRaw === "-" || nextRaw.endsWith(".") ? Number(nextRaw.slice(0, -1)) : Number(nextRaw);
|
|
124
|
+
var values = {
|
|
125
|
+
value: nextRaw,
|
|
126
|
+
formattedValue: nextFormatted,
|
|
127
|
+
floatValue: nextRaw !== "" && nextRaw !== "-" && Number.isFinite(numeric) ? numeric : undefined
|
|
128
|
+
};
|
|
129
|
+
if (min !== undefined && values.floatValue !== undefined && values.floatValue < min || max !== undefined && values.floatValue !== undefined && values.floatValue > max || (isAllowed === null || isAllowed === void 0 ? void 0 : isAllowed(values)) === false) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (!controlled) setInternalValue(nextRaw);
|
|
133
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(values);
|
|
134
|
+
};
|
|
135
|
+
var handleChange = function handleChange(text, caret) {
|
|
136
|
+
var _a;
|
|
137
|
+
var beforeCaret = text.slice(0, caret !== null && caret !== void 0 ? caret : text.length);
|
|
138
|
+
var digitsBeforeCaret = ((_a = beforeCaret.match(/\d/g)) !== null && _a !== void 0 ? _a : []).length;
|
|
139
|
+
emit(normalize(text, decimalSeparator, options.decimalScale, allowNegative, allowLeadingZeros));
|
|
140
|
+
requestAnimationFrame(function () {
|
|
141
|
+
var node = localInputRef.current;
|
|
142
|
+
if (!node || document.activeElement !== node) return;
|
|
143
|
+
var digits = 0;
|
|
144
|
+
var position = prefix.length + (node.value.startsWith("-") ? 1 : 0);
|
|
145
|
+
for (; position < node.value.length && digits < digitsBeforeCaret; position += 1) {
|
|
146
|
+
if (/\d/.test(node.value[position])) digits += 1;
|
|
147
|
+
}
|
|
148
|
+
node.setSelectionRange(position, position);
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
var clearButton = clearable && rawValue && !disabled && !readOnly && (/*#__PURE__*/React__default.default.createElement("button", {
|
|
152
|
+
type: "button",
|
|
153
|
+
className: styles__default.default.clear,
|
|
154
|
+
"aria-label": clearLabel,
|
|
155
|
+
onMouseDown: function onMouseDown(event) {
|
|
156
|
+
return event.preventDefault();
|
|
157
|
+
},
|
|
158
|
+
onClick: function onClick() {
|
|
159
|
+
return emit("");
|
|
160
|
+
}
|
|
161
|
+
}, /*#__PURE__*/React__default.default.createElement(Cross.Cross, {
|
|
162
|
+
width: 20,
|
|
163
|
+
height: 20,
|
|
164
|
+
"aria-hidden": "true"
|
|
165
|
+
})));
|
|
166
|
+
var composedEndIcon = endIcon || clearButton ? (/*#__PURE__*/React__default.default.createElement("span", {
|
|
167
|
+
className: styles__default.default.end_content
|
|
168
|
+
}, endIcon, clearButton)) : undefined;
|
|
169
|
+
return /*#__PURE__*/React__default.default.createElement(index.Input, Object.assign({}, inputProps, {
|
|
170
|
+
id: inputId,
|
|
171
|
+
className: clsx__default.default(styles__default.default.field, className),
|
|
172
|
+
type: "text",
|
|
173
|
+
inputMode: options.decimalScale > 0 ? "decimal" : "numeric",
|
|
174
|
+
value: formattedValue,
|
|
175
|
+
disabled: disabled,
|
|
176
|
+
readOnly: readOnly,
|
|
177
|
+
inputRef: setRef,
|
|
178
|
+
endIcon: composedEndIcon,
|
|
179
|
+
onChange: function onChange(event) {
|
|
180
|
+
return handleChange(event.target.value, event.target.selectionStart);
|
|
181
|
+
},
|
|
182
|
+
onFocus: onFocus,
|
|
183
|
+
onBlur: onBlur
|
|
184
|
+
}));
|
|
185
|
+
});
|
|
186
|
+
NumberInput.displayName = "NumberInput";
|
|
187
|
+
|
|
188
|
+
exports.NumberInput = NumberInput;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.field {
|
|
2
|
+
width: 20rem;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.end_content {
|
|
6
|
+
align-items: center;
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
gap: var(--space-1);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.clear {
|
|
12
|
+
align-items: center;
|
|
13
|
+
background: transparent;
|
|
14
|
+
border: var(--space-0);
|
|
15
|
+
border-radius: var(--radius-xs);
|
|
16
|
+
color: var(--color-icon-secondary);
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
font-family: var(--font-family-ui);
|
|
20
|
+
font-size: var(--font-size-text-md);
|
|
21
|
+
height: var(--component-input-icon-size);
|
|
22
|
+
justify-content: center;
|
|
23
|
+
line-height: var(--line-height-text-sm);
|
|
24
|
+
padding: var(--space-0);
|
|
25
|
+
transition: color 0.15s ease, background-color 0.15s ease;
|
|
26
|
+
width: var(--component-input-icon-size);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.clear:hover {
|
|
30
|
+
color: var(--color-icon-primary);
|
|
31
|
+
}
|