colibri-ui 0.8.84 → 0.8.87
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/Accordion.module.css +4 -0
- package/Accordion/index.js +15 -23
- package/Autocomplete/Autocomplete.js +101 -132
- package/Avatar/Avatar.module.css +6 -0
- package/Avatar/index.js +102 -89
- package/Badge/Badge.module.css +2 -1
- package/Badge/Control/index.js +5 -3
- package/Badge/index.js +16 -16
- package/Button/index.js +23 -20
- package/Button/tokens.js +2 -2
- package/Calendar/Calendar.js +171 -269
- package/Card/Card.js +26 -32
- package/Checkbox/index.js +46 -43
- package/Chip/Chip.module.css +2 -1
- package/Chip/index.js +15 -15
- package/ClickOutside/index.js +10 -13
- package/CodeField/CodeField.js +113 -170
- package/Counter/Counter.module.css +2 -1
- package/Counter/index.js +21 -20
- package/Datepicker/components/DatePicker/index.js +81 -102
- package/Datepicker/index.js +17 -16
- package/DotsLoader/index.js +23 -15
- package/Drawer/Drawer.js +84 -98
- package/Drawer/Drawer.module.css +2 -1
- package/Drawer/index.props.d.ts +2 -0
- package/Dropdown/index.js +55 -68
- package/Dropzone/Dropzone.js +78 -168
- package/Dropzone/Dropzone.module.css +2 -1
- package/Editable/Editable.js +44 -57
- package/Grid/Item/index.js +11 -13
- package/Grid/index.js +15 -21
- package/Icons/ArrowNext.js +7 -8
- package/Icons/Cart.js +7 -8
- package/Icons/Check.js +7 -8
- package/Icons/Chevron.js +7 -8
- package/Icons/Close.js +6 -6
- package/Icons/Copy.js +7 -8
- package/Icons/Cross.js +6 -6
- package/Icons/CrossFill.js +7 -8
- package/Icons/Edit.js +7 -8
- package/Icons/Exit.js +7 -8
- package/Icons/EyeClosed.js +7 -8
- package/Icons/EyeOpen.js +7 -8
- package/Icons/Help.js +6 -6
- package/Icons/Info.js +7 -8
- package/Icons/Minus.js +7 -8
- package/Icons/More.js +7 -8
- package/Icons/Plus.js +7 -8
- package/Icons/Setting.js +7 -8
- package/Icons/Shield.js +7 -8
- package/Icons/Trash.js +7 -8
- package/Icons/User.js +7 -8
- package/Image/Image.module.css +4 -0
- package/Image/index.d.ts +1 -1
- package/Image/index.js +44 -37
- package/Input/index.d.ts +1 -1
- package/Input/index.js +37 -25
- package/Input/index.props.d.ts +1 -1
- package/InputRadio/index.js +32 -24
- package/List/List.js +81 -76
- package/Menu/Menu.module.css +2 -1
- package/Menu/components/MenuItem/index.js +17 -14
- package/Menu/index.js +22 -23
- package/Modal/components/Body/index.js +9 -8
- package/Modal/components/Close/Close.module.css +4 -0
- package/Modal/components/Close/index.js +13 -14
- package/Modal/components/Content/index.js +5 -6
- package/Modal/components/Footer/index.js +5 -3
- package/Modal/components/Header/index.js +13 -12
- package/Modal/components/Title/index.js +10 -9
- package/Modal/context.js +3 -3
- package/Modal/index.js +46 -68
- package/MultiSelect/components/MenuOverlay/index.js +48 -61
- package/MultiSelect/components/MenuOverlayItem/index.js +13 -14
- package/MultiSelect/index.js +72 -100
- package/MultiSelect/index.module.css +2 -1
- package/MultiSelect/utils/index.js +8 -18
- package/NumberInput/NumberInput.js +80 -112
- package/Portal/index.js +6 -10
- package/Progress/Progress.js +45 -58
- package/RadioGroup/Radio.js +29 -32
- package/RadioGroup/index.js +43 -46
- package/Rating/Rating.js +50 -63
- package/Select/components/MenuOverlay/index.js +16 -25
- package/Select/components/MenuOverlayItem/index.js +13 -11
- package/Select/index.js +39 -48
- package/Select/index.module.css +2 -1
- package/Separator/index.js +5 -6
- package/Sheet/Sheet.js +98 -122
- package/Sheet/Sheet.module.css +4 -2
- package/Sheet/index.props.d.ts +2 -0
- package/Skeleton/index.js +25 -30
- package/Slider/Slider.js +83 -119
- package/Status/index.js +17 -18
- package/Switch/Switch.module.css +2 -1
- package/Switch/index.js +22 -15
- package/TabsMenu/Tab/Tab.js +14 -10
- package/TabsMenu/Tab/Tab.module.css +2 -1
- package/TabsMenu/index.js +25 -26
- package/TabsPanels/Panel/index.js +6 -4
- package/TabsPanels/index.js +13 -10
- package/TextArea/index.d.ts +1 -1
- package/TextArea/index.js +30 -19
- package/Theme/breakpoints.js +5 -11
- package/Theme/colors/theme_buenos_aires.js +14 -14
- package/Theme/colors/theme_jaipur.js +14 -14
- package/Theme/global.css +0 -1
- package/Theme/index.js +1 -1
- package/TimeSelect/Label/index.js +11 -13
- package/TimeSelect/helpers.js +23 -42
- package/TimeSelect/index.js +32 -38
- package/Tooltip/index.js +36 -42
- package/Typography/Typography.module.css +1365 -0
- package/Typography/index.js +24 -13
- package/Typography/index.props.d.ts +13 -1
- package/base/BaseInput/index.js +10 -8
- package/base/FormField/index.d.ts +1 -1
- package/base/FormField/index.js +27 -22
- package/base/FormField/index.props.d.ts +4 -0
- package/base/InputRoot/index.js +27 -27
- package/esm/Accordion/Accordion.module.css +4 -0
- package/esm/Accordion/index.js +15 -21
- package/esm/Autocomplete/Autocomplete.js +101 -130
- package/esm/Avatar/Avatar.module.css +6 -0
- package/esm/Avatar/index.js +102 -88
- package/esm/Badge/Badge.module.css +2 -1
- package/esm/Badge/Control/index.js +5 -3
- package/esm/Badge/index.js +16 -15
- package/esm/Button/index.js +23 -19
- package/esm/Button/tokens.js +2 -2
- package/esm/Calendar/Calendar.js +171 -267
- package/esm/Card/Card.js +26 -32
- package/esm/Checkbox/index.js +46 -42
- package/esm/Chip/Chip.module.css +2 -1
- package/esm/Chip/index.js +15 -14
- package/esm/ClickOutside/index.js +10 -13
- package/esm/CodeField/CodeField.js +113 -169
- package/esm/Counter/Counter.module.css +2 -1
- package/esm/Counter/index.js +21 -19
- package/esm/Datepicker/components/DatePicker/index.js +81 -101
- package/esm/Datepicker/index.js +17 -16
- package/esm/DotsLoader/index.js +23 -14
- package/esm/Drawer/Drawer.js +84 -97
- package/esm/Drawer/Drawer.module.css +2 -1
- package/esm/Drawer/index.props.d.ts +2 -0
- package/esm/Dropdown/index.js +55 -66
- package/esm/Dropzone/Dropzone.js +78 -165
- package/esm/Dropzone/Dropzone.module.css +2 -1
- package/esm/Editable/Editable.js +44 -56
- package/esm/Grid/Item/index.js +11 -12
- package/esm/Grid/index.js +15 -21
- package/esm/Icons/ArrowNext.js +7 -8
- package/esm/Icons/Cart.js +7 -8
- package/esm/Icons/Check.js +7 -8
- package/esm/Icons/Chevron.js +7 -8
- package/esm/Icons/Close.js +6 -6
- package/esm/Icons/Copy.js +7 -8
- package/esm/Icons/Cross.js +6 -6
- package/esm/Icons/CrossFill.js +7 -8
- package/esm/Icons/Edit.js +7 -8
- package/esm/Icons/Exit.js +7 -8
- package/esm/Icons/EyeClosed.js +7 -8
- package/esm/Icons/EyeOpen.js +7 -8
- package/esm/Icons/Help.js +6 -6
- package/esm/Icons/Info.js +7 -8
- package/esm/Icons/Minus.js +7 -8
- package/esm/Icons/More.js +7 -8
- package/esm/Icons/Plus.js +7 -8
- package/esm/Icons/Setting.js +7 -8
- package/esm/Icons/Shield.js +7 -8
- package/esm/Icons/Trash.js +7 -8
- package/esm/Icons/User.js +7 -8
- package/esm/Image/Image.module.css +4 -0
- package/esm/Image/index.d.ts +1 -1
- package/esm/Image/index.js +44 -36
- package/esm/Input/index.d.ts +1 -1
- package/esm/Input/index.js +38 -26
- package/esm/Input/index.props.d.ts +1 -1
- package/esm/InputRadio/index.js +32 -23
- package/esm/List/List.js +81 -75
- package/esm/Menu/Menu.module.css +2 -1
- package/esm/Menu/components/MenuItem/index.js +17 -13
- package/esm/Menu/index.js +22 -23
- package/esm/Modal/components/Body/index.js +9 -7
- package/esm/Modal/components/Close/Close.module.css +4 -0
- package/esm/Modal/components/Close/index.js +13 -14
- package/esm/Modal/components/Content/index.js +5 -6
- package/esm/Modal/components/Footer/index.js +5 -3
- package/esm/Modal/components/Header/index.js +13 -11
- package/esm/Modal/components/Title/index.js +10 -9
- package/esm/Modal/context.js +3 -3
- package/esm/Modal/index.js +50 -70
- package/esm/MultiSelect/components/MenuOverlay/index.js +48 -60
- package/esm/MultiSelect/components/MenuOverlayItem/index.js +13 -14
- package/esm/MultiSelect/index.js +72 -97
- package/esm/MultiSelect/index.module.css +2 -1
- package/esm/MultiSelect/utils/index.js +8 -14
- package/esm/NumberInput/NumberInput.js +80 -111
- package/esm/Portal/index.js +6 -9
- package/esm/Progress/Progress.js +45 -58
- package/esm/RadioGroup/Radio.js +29 -32
- package/esm/RadioGroup/index.js +43 -45
- package/esm/Rating/Rating.js +50 -63
- package/esm/Select/components/MenuOverlay/index.js +16 -24
- package/esm/Select/components/MenuOverlayItem/index.js +13 -11
- package/esm/Select/index.js +39 -46
- package/esm/Select/index.module.css +2 -1
- package/esm/Separator/index.js +5 -6
- package/esm/Sheet/Sheet.js +98 -120
- package/esm/Sheet/Sheet.module.css +4 -2
- package/esm/Sheet/index.props.d.ts +2 -0
- package/esm/Skeleton/index.js +25 -30
- package/esm/Slider/Slider.js +83 -119
- package/esm/Status/index.js +17 -17
- package/esm/Switch/Switch.module.css +2 -1
- package/esm/Switch/index.js +22 -14
- package/esm/TabsMenu/Tab/Tab.js +14 -9
- package/esm/TabsMenu/Tab/Tab.module.css +2 -1
- package/esm/TabsMenu/index.js +25 -26
- package/esm/TabsPanels/Panel/index.js +6 -4
- package/esm/TabsPanels/index.js +13 -10
- package/esm/TextArea/index.d.ts +1 -1
- package/esm/TextArea/index.js +31 -20
- package/esm/Theme/breakpoints.js +5 -11
- package/esm/Theme/colors/theme_buenos_aires.js +14 -14
- package/esm/Theme/colors/theme_jaipur.js +14 -14
- package/esm/Theme/global.css +0 -1
- package/esm/Theme/index.js +1 -1
- package/esm/TimeSelect/Label/index.js +11 -13
- package/esm/TimeSelect/helpers.js +22 -37
- package/esm/TimeSelect/index.js +32 -38
- package/esm/Tooltip/index.js +36 -41
- package/esm/Typography/Typography.module.css +1365 -0
- package/esm/Typography/index.js +24 -12
- package/esm/Typography/index.props.d.ts +13 -1
- package/esm/base/BaseInput/index.js +10 -8
- package/esm/base/FormField/index.d.ts +1 -1
- package/esm/base/FormField/index.js +27 -21
- package/esm/base/FormField/index.props.d.ts +4 -0
- package/esm/base/InputRoot/index.js +27 -26
- package/esm/helpers/date/index.js +4 -8
- package/esm/hooks/useMediaSizes/index.js +9 -15
- package/esm/hooks/useModalStack/index.js +6 -9
- package/esm/hooks/useOnClickOutside/index.js +6 -6
- package/esm/hooks/useScrollLock/index.js +10 -9
- package/esm/hooks/useTrapFocus/index.js +8 -10
- package/esm/index.d.ts +1 -1
- package/esm/lib/keyboard.js +2 -4
- package/helpers/date/index.js +21 -32
- package/hooks/useMediaSizes/index.js +9 -15
- package/hooks/useModalStack/index.js +6 -9
- package/hooks/useOnClickOutside/index.js +6 -6
- package/hooks/useScrollLock/index.js +10 -9
- package/hooks/useTrapFocus/index.js +8 -10
- package/index.d.ts +1 -1
- package/lib/keyboard.js +2 -4
- package/package.json +5 -1
package/esm/TextArea/index.js
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import { __rest } from 'tslib';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useId } from 'react';
|
|
3
3
|
import TextareaAutosize from 'react-textarea-autosize';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { FormField } from '../base/FormField/index.js';
|
|
6
6
|
import { InputRoot } from '../base/InputRoot/index.js';
|
|
7
7
|
import styles from './TextArea.module.css';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
const TextArea = _a => {
|
|
10
|
+
var _b;
|
|
11
|
+
var {
|
|
12
|
+
className,
|
|
13
|
+
value = "",
|
|
14
|
+
minRows = 3,
|
|
15
|
+
maxRows = 6,
|
|
16
|
+
onChange,
|
|
17
|
+
label,
|
|
18
|
+
required,
|
|
19
|
+
hasError,
|
|
20
|
+
hint,
|
|
21
|
+
disabled,
|
|
22
|
+
inputRef,
|
|
23
|
+
ref,
|
|
24
|
+
id
|
|
25
|
+
} = _a,
|
|
26
|
+
props = __rest(_a, ["className", "value", "minRows", "maxRows", "onChange", "label", "required", "hasError", "hint", "disabled", "inputRef", "ref", "id"]);
|
|
27
|
+
const generatedId = useId();
|
|
28
|
+
const textareaId = id !== null && id !== void 0 ? id : generatedId;
|
|
29
|
+
const hintId = hint ? `${textareaId}-hint` : undefined;
|
|
30
|
+
const onChangeHandler = event => {
|
|
27
31
|
if (onChange) onChange(event.target.value, event);
|
|
28
32
|
};
|
|
29
33
|
return /*#__PURE__*/React.createElement(FormField, {
|
|
@@ -31,7 +35,9 @@ var TextArea = function TextArea(_a) {
|
|
|
31
35
|
className: clsx(className),
|
|
32
36
|
required: required,
|
|
33
37
|
label: label,
|
|
38
|
+
htmlFor: textareaId,
|
|
34
39
|
hint: hint,
|
|
40
|
+
hintId: hintId,
|
|
35
41
|
hasError: hasError
|
|
36
42
|
}, /*#__PURE__*/React.createElement(InputRoot, {
|
|
37
43
|
disabled: !!disabled,
|
|
@@ -45,7 +51,12 @@ var TextArea = function TextArea(_a) {
|
|
|
45
51
|
value: value,
|
|
46
52
|
className: clsx(styles.textarea, className),
|
|
47
53
|
onChange: onChangeHandler
|
|
48
|
-
}, props
|
|
54
|
+
}, props, {
|
|
55
|
+
id: textareaId,
|
|
56
|
+
required: required,
|
|
57
|
+
"aria-invalid": (_b = props["aria-invalid"]) !== null && _b !== void 0 ? _b : hasError || undefined,
|
|
58
|
+
"aria-describedby": clsx(props["aria-describedby"], hintId) || undefined
|
|
59
|
+
}))));
|
|
49
60
|
};
|
|
50
61
|
|
|
51
62
|
export { TextArea };
|
package/esm/Theme/breakpoints.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Breakpoints shared with the apps that use the kit.
|
|
3
3
|
* The values match the Tailwind CSS defaults on purpose; Tailwind is not a dependency.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
const BREAKPOINTS = {
|
|
6
6
|
sm: "40rem",
|
|
7
7
|
md: "48rem",
|
|
8
8
|
lg: "64rem",
|
|
@@ -10,16 +10,10 @@ var BREAKPOINTS = {
|
|
|
10
10
|
"2xl": "96rem"
|
|
11
11
|
};
|
|
12
12
|
/** Bare media queries, usable in `window.matchMedia`. Prefix with `@media ` in CSS-in-JS. */
|
|
13
|
-
|
|
14
|
-
up:
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
down: function down(name) {
|
|
18
|
-
return "(width < ".concat(BREAKPOINTS[name], ")");
|
|
19
|
-
},
|
|
20
|
-
between: function between(from, to) {
|
|
21
|
-
return "(".concat(BREAKPOINTS[from], " <= width < ").concat(BREAKPOINTS[to], ")");
|
|
22
|
-
}
|
|
13
|
+
const media = {
|
|
14
|
+
up: name => `(width >= ${BREAKPOINTS[name]})`,
|
|
15
|
+
down: name => `(width < ${BREAKPOINTS[name]})`,
|
|
16
|
+
between: (from, to) => `(${BREAKPOINTS[from]} <= width < ${BREAKPOINTS[to]})`
|
|
23
17
|
};
|
|
24
18
|
|
|
25
19
|
export { BREAKPOINTS, media };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
const BrandBA = {
|
|
2
2
|
BRAND_BA_LIME: "#9FE870",
|
|
3
3
|
BRAND_BA_FOREST: "#163300",
|
|
4
4
|
BRAND_BA_INK: "#0D1F12",
|
|
5
5
|
BRAND_BA_CANVAS: "#F5F7F2",
|
|
6
6
|
BRAND_BA_WHITE: "#FFFFFF"
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
const NeutralBA = {
|
|
9
9
|
NEUTRAL_BA_0: "#FFFFFF",
|
|
10
10
|
NEUTRAL_BA_50: "#F5F7F2",
|
|
11
11
|
NEUTRAL_BA_100: "#EDF0EA",
|
|
@@ -19,7 +19,7 @@ var NeutralBA = {
|
|
|
19
19
|
NEUTRAL_BA_900: "#203025",
|
|
20
20
|
NEUTRAL_BA_950: "#0D1F12"
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
const LimeBA = {
|
|
23
23
|
LIME_BA_50: "#F4FFEC",
|
|
24
24
|
LIME_BA_100: "#E4FFD2",
|
|
25
25
|
LIME_BA_200: "#D0FBAF",
|
|
@@ -32,7 +32,7 @@ var LimeBA = {
|
|
|
32
32
|
LIME_BA_900: "#163300",
|
|
33
33
|
LIME_BA_950: "#0D1F12"
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
const BlueBA = {
|
|
36
36
|
BLUE_BA_50: "#EFFBFB",
|
|
37
37
|
BLUE_BA_100: "#DDF7F7",
|
|
38
38
|
BLUE_BA_200: "#BCECEF",
|
|
@@ -44,7 +44,7 @@ var BlueBA = {
|
|
|
44
44
|
BLUE_BA_800: "#185159",
|
|
45
45
|
BLUE_BA_900: "#123B40"
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
const PinkBA = {
|
|
48
48
|
PINK_BA_50: "#FFF5F8",
|
|
49
49
|
PINK_BA_100: "#FFE7F0",
|
|
50
50
|
PINK_BA_200: "#FFD2E3",
|
|
@@ -56,7 +56,7 @@ var PinkBA = {
|
|
|
56
56
|
PINK_BA_800: "#702645",
|
|
57
57
|
PINK_BA_900: "#541B35"
|
|
58
58
|
};
|
|
59
|
-
|
|
59
|
+
const OrangeBA = {
|
|
60
60
|
ORANGE_BA_50: "#FFF7F1",
|
|
61
61
|
ORANGE_BA_100: "#FFE8D7",
|
|
62
62
|
ORANGE_BA_200: "#FFD0AD",
|
|
@@ -68,7 +68,7 @@ var OrangeBA = {
|
|
|
68
68
|
ORANGE_BA_800: "#6D2E13",
|
|
69
69
|
ORANGE_BA_900: "#542610"
|
|
70
70
|
};
|
|
71
|
-
|
|
71
|
+
const YellowBA = {
|
|
72
72
|
YELLOW_BA_50: "#FFFBEB",
|
|
73
73
|
YELLOW_BA_100: "#FFF4BD",
|
|
74
74
|
YELLOW_BA_200: "#FFE982",
|
|
@@ -80,7 +80,7 @@ var YellowBA = {
|
|
|
80
80
|
YELLOW_BA_800: "#59470C",
|
|
81
81
|
YELLOW_BA_900: "#3C3609"
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
const PurpleBA = {
|
|
84
84
|
PURPLE_BA_50: "#F8F6FF",
|
|
85
85
|
PURPLE_BA_100: "#EAE4FF",
|
|
86
86
|
PURPLE_BA_200: "#D6CAFF",
|
|
@@ -92,7 +92,7 @@ var PurpleBA = {
|
|
|
92
92
|
PURPLE_BA_800: "#402E78",
|
|
93
93
|
PURPLE_BA_900: "#30215C"
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
const StatusBA = {
|
|
96
96
|
STATUS_BA_SUCCESS: "#244F18",
|
|
97
97
|
STATUS_BA_SUCCESS_BG: "#E4FFD2",
|
|
98
98
|
STATUS_BA_SUCCESS_BG_HOVER: LimeBA.LIME_BA_200,
|
|
@@ -105,7 +105,7 @@ var StatusBA = {
|
|
|
105
105
|
STATUS_BA_INFO: "#123B40",
|
|
106
106
|
STATUS_BA_INFO_BG: "#DDF7F7"
|
|
107
107
|
};
|
|
108
|
-
|
|
108
|
+
const PromoBA = {
|
|
109
109
|
PROMO_SILVER: "#EDF0EA",
|
|
110
110
|
PROMO_GOLD: "#FFF4BD",
|
|
111
111
|
PROMO_ASPHALT: "#E2E7DF",
|
|
@@ -115,27 +115,27 @@ var PromoBA = {
|
|
|
115
115
|
PROMO_SKY: "#DDF7F7",
|
|
116
116
|
PROMO_NEON: "#EAE4FF"
|
|
117
117
|
};
|
|
118
|
-
|
|
118
|
+
const PrimaryBA = {
|
|
119
119
|
PRIMARY_BA_1: LimeBA.LIME_BA_100,
|
|
120
120
|
PRIMARY_BA_2: LimeBA.LIME_BA_200,
|
|
121
121
|
PRIMARY_BA_3: LimeBA.LIME_BA_300,
|
|
122
122
|
PRIMARY_BA_4: LimeBA.LIME_BA_400,
|
|
123
123
|
PRIMARY_BA_5: LimeBA.LIME_BA_500
|
|
124
124
|
};
|
|
125
|
-
|
|
125
|
+
const SecondaryBA = {
|
|
126
126
|
SECONDARY_BA_1: NeutralBA.NEUTRAL_BA_100,
|
|
127
127
|
SECONDARY_BA_2: NeutralBA.NEUTRAL_BA_300,
|
|
128
128
|
SECONDARY_BA_3: NeutralBA.NEUTRAL_BA_700,
|
|
129
129
|
SECONDARY_BA_4: BrandBA.BRAND_BA_FOREST,
|
|
130
130
|
SECONDARY_BA_5: BrandBA.BRAND_BA_INK
|
|
131
131
|
};
|
|
132
|
-
|
|
132
|
+
const TretiaryBA = {
|
|
133
133
|
TRETIARY_BA_1: BlueBA.BLUE_BA_50,
|
|
134
134
|
TRETIARY_BA_2: BlueBA.BLUE_BA_100,
|
|
135
135
|
TRETIARY_BA_3: BlueBA.BLUE_BA_300,
|
|
136
136
|
TRETIARY_BA_4: BlueBA.BLUE_BA_500,
|
|
137
137
|
TRETIARY_BA_5: BlueBA.BLUE_BA_700
|
|
138
138
|
};
|
|
139
|
-
|
|
139
|
+
const Color = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BrandBA), NeutralBA), LimeBA), BlueBA), PinkBA), OrangeBA), YellowBA), PurpleBA), StatusBA), PromoBA), PrimaryBA), SecondaryBA), TretiaryBA);
|
|
140
140
|
|
|
141
141
|
export { BlueBA, BrandBA, LimeBA, NeutralBA, OrangeBA, PinkBA, PrimaryBA, PromoBA, PurpleBA, SecondaryBA, StatusBA, TretiaryBA, YellowBA, Color as default };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
const BrandJP = {
|
|
2
2
|
BRAND_JP_PINK: "#FFA8CD",
|
|
3
3
|
BRAND_JP_EGGPLANT: "#2C2242",
|
|
4
4
|
BRAND_JP_INK: "#0B051D",
|
|
5
5
|
BRAND_JP_CANVAS: "#F9F8F5",
|
|
6
6
|
BRAND_JP_WHITE: "#FFFFFF"
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
const NeutralJP = {
|
|
9
9
|
NEUTRAL_JP_0: "#FFFFFF",
|
|
10
10
|
NEUTRAL_JP_50: "#F9F8F5",
|
|
11
11
|
NEUTRAL_JP_100: "#F2F1EE",
|
|
@@ -19,7 +19,7 @@ var NeutralJP = {
|
|
|
19
19
|
NEUTRAL_JP_900: "#211A31",
|
|
20
20
|
NEUTRAL_JP_950: "#0B051D"
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
const PinkJP = {
|
|
23
23
|
PINK_JP_50: "#FFF5F9",
|
|
24
24
|
PINK_JP_100: "#FFE8F2",
|
|
25
25
|
PINK_JP_200: "#FFD3E5",
|
|
@@ -32,7 +32,7 @@ var PinkJP = {
|
|
|
32
32
|
PINK_JP_900: "#5C2042",
|
|
33
33
|
PINK_JP_950: "#351126"
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
const PurpleJP = {
|
|
36
36
|
PURPLE_JP_50: "#F8F5FA",
|
|
37
37
|
PURPLE_JP_100: "#EEE7F1",
|
|
38
38
|
PURPLE_JP_200: "#DED1E3",
|
|
@@ -45,7 +45,7 @@ var PurpleJP = {
|
|
|
45
45
|
PURPLE_JP_900: "#2C2242",
|
|
46
46
|
PURPLE_JP_950: "#171022"
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
const LimeJP = {
|
|
49
49
|
LIME_JP_50: "#FBFFF2",
|
|
50
50
|
LIME_JP_100: "#F5FFDD",
|
|
51
51
|
LIME_JP_200: "#EEFFC6",
|
|
@@ -57,7 +57,7 @@ var LimeJP = {
|
|
|
57
57
|
LIME_JP_800: "#526820",
|
|
58
58
|
LIME_JP_900: "#374715"
|
|
59
59
|
};
|
|
60
|
-
|
|
60
|
+
const BlueJP = {
|
|
61
61
|
BLUE_JP_50: "#F3F7FF",
|
|
62
62
|
BLUE_JP_100: "#E4EDFF",
|
|
63
63
|
BLUE_JP_200: "#CDDCFF",
|
|
@@ -69,7 +69,7 @@ var BlueJP = {
|
|
|
69
69
|
BLUE_JP_800: "#303F6C",
|
|
70
70
|
BLUE_JP_900: "#252F50"
|
|
71
71
|
};
|
|
72
|
-
|
|
72
|
+
const OrangeJP = {
|
|
73
73
|
ORANGE_JP_50: "#FFF8F3",
|
|
74
74
|
ORANGE_JP_100: "#FFEBDD",
|
|
75
75
|
ORANGE_JP_200: "#FFD8BE",
|
|
@@ -81,7 +81,7 @@ var OrangeJP = {
|
|
|
81
81
|
ORANGE_JP_800: "#713721",
|
|
82
82
|
ORANGE_JP_900: "#51291B"
|
|
83
83
|
};
|
|
84
|
-
|
|
84
|
+
const YellowJP = {
|
|
85
85
|
YELLOW_JP_50: "#FFFDF2",
|
|
86
86
|
YELLOW_JP_100: "#FFF8D8",
|
|
87
87
|
YELLOW_JP_200: "#FFF0AD",
|
|
@@ -93,7 +93,7 @@ var YellowJP = {
|
|
|
93
93
|
YELLOW_JP_800: "#624D15",
|
|
94
94
|
YELLOW_JP_900: "#443612"
|
|
95
95
|
};
|
|
96
|
-
|
|
96
|
+
const StatusJP = {
|
|
97
97
|
STATUS_JP_SUCCESS: "#46591B",
|
|
98
98
|
STATUS_JP_SUCCESS_BG: "#E6FFA9",
|
|
99
99
|
STATUS_JP_SUCCESS_BG_HOVER: LimeJP.LIME_JP_200,
|
|
@@ -106,7 +106,7 @@ var StatusJP = {
|
|
|
106
106
|
STATUS_JP_INFO: "#303F6C",
|
|
107
107
|
STATUS_JP_INFO_BG: "#E4EDFF"
|
|
108
108
|
};
|
|
109
|
-
|
|
109
|
+
const PromoJP = {
|
|
110
110
|
PROMO_SILVER: "#F2F1EE",
|
|
111
111
|
PROMO_GOLD: "#FFF0AD",
|
|
112
112
|
PROMO_ASPHALT: "#E4E3DF",
|
|
@@ -116,27 +116,27 @@ var PromoJP = {
|
|
|
116
116
|
PROMO_SKY: "#E4EDFF",
|
|
117
117
|
PROMO_NEON: "#EEE7F1"
|
|
118
118
|
};
|
|
119
|
-
|
|
119
|
+
const PrimaryJP = {
|
|
120
120
|
PRIMARY_JP_1: PinkJP.PINK_JP_100,
|
|
121
121
|
PRIMARY_JP_2: PinkJP.PINK_JP_200,
|
|
122
122
|
PRIMARY_JP_3: PinkJP.PINK_JP_300,
|
|
123
123
|
PRIMARY_JP_4: PinkJP.PINK_JP_400,
|
|
124
124
|
PRIMARY_JP_5: PinkJP.PINK_JP_500
|
|
125
125
|
};
|
|
126
|
-
|
|
126
|
+
const SecondaryJP = {
|
|
127
127
|
SECONDARY_JP_1: NeutralJP.NEUTRAL_JP_100,
|
|
128
128
|
SECONDARY_JP_2: NeutralJP.NEUTRAL_JP_300,
|
|
129
129
|
SECONDARY_JP_3: NeutralJP.NEUTRAL_JP_700,
|
|
130
130
|
SECONDARY_JP_4: BrandJP.BRAND_JP_EGGPLANT,
|
|
131
131
|
SECONDARY_JP_5: BrandJP.BRAND_JP_INK
|
|
132
132
|
};
|
|
133
|
-
|
|
133
|
+
const TretiaryJP = {
|
|
134
134
|
TRETIARY_JP_1: PurpleJP.PURPLE_JP_50,
|
|
135
135
|
TRETIARY_JP_2: PurpleJP.PURPLE_JP_100,
|
|
136
136
|
TRETIARY_JP_3: PurpleJP.PURPLE_JP_300,
|
|
137
137
|
TRETIARY_JP_4: PurpleJP.PURPLE_JP_500,
|
|
138
138
|
TRETIARY_JP_5: PurpleJP.PURPLE_JP_700
|
|
139
139
|
};
|
|
140
|
-
|
|
140
|
+
const Color = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BrandJP), NeutralJP), PinkJP), PurpleJP), LimeJP), BlueJP), OrangeJP), YellowJP), StatusJP), PromoJP), PrimaryJP), SecondaryJP), TretiaryJP);
|
|
141
141
|
|
|
142
142
|
export { BlueJP, BrandJP, LimeJP, NeutralJP, OrangeJP, PinkJP, PrimaryJP, PromoJP, PurpleJP, SecondaryJP, StatusJP, TretiaryJP, YellowJP, Color as default };
|
package/esm/Theme/global.css
CHANGED
package/esm/Theme/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import theme_jaipur from './themes/jaipur.js';
|
|
|
3
3
|
import THEME_BA from './themes/buenos_aires.js';
|
|
4
4
|
export { BREAKPOINTS, media } from './breakpoints.js';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const THEMES = {
|
|
7
7
|
JAIPUR: Object.assign(Object.assign({}, theme_jaipur), BUTTON_TOKENS),
|
|
8
8
|
BA: Object.assign(Object.assign({}, THEME_BA), BUTTON_TOKENS)
|
|
9
9
|
};
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
15
|
-
};
|
|
3
|
+
const OptionLabel = ({
|
|
4
|
+
time,
|
|
5
|
+
onClick,
|
|
6
|
+
onMouseEnter
|
|
7
|
+
}) => (
|
|
8
|
+
/*#__PURE__*/
|
|
9
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
10
|
+
React.createElement("span", {
|
|
11
|
+
onClick: onClick,
|
|
12
|
+
onMouseEnter: onMouseEnter
|
|
13
|
+
}, time));
|
|
16
14
|
|
|
17
15
|
export { OptionLabel };
|
|
@@ -1,54 +1,39 @@
|
|
|
1
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
1
|
import { addMinutes, parse, isBefore, format } from 'date-fns';
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
const day = new Date();
|
|
5
4
|
day.setHours(24, 0, 0, 0);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
time: formatTime(date)
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
var checkIsBeforeNow = function checkIsBeforeNow(time, currentDate) {
|
|
5
|
+
const formatTime = date => format(date, "HH:mm");
|
|
6
|
+
const generateSuggest = (interval = 15) => new Array(24 * 60 / interval).fill(null).map((_, index) => {
|
|
7
|
+
const date = addMinutes(day, index * interval);
|
|
8
|
+
return {
|
|
9
|
+
time: formatTime(date)
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
const checkIsBeforeNow = (time, currentDate) => {
|
|
19
13
|
if (!currentDate) return false;
|
|
20
|
-
|
|
14
|
+
const baseDate = new Date(currentDate);
|
|
21
15
|
baseDate.setHours(0, 0, 0, 0);
|
|
22
|
-
|
|
16
|
+
const parsedTime = parse(time, "HH:mm", baseDate);
|
|
23
17
|
return isBefore(parsedTime, currentDate);
|
|
24
18
|
};
|
|
25
|
-
|
|
19
|
+
const checkIsBeforeSelectedDate = (time, interval, date) => {
|
|
26
20
|
if (date) {
|
|
27
|
-
|
|
21
|
+
const selectedDate = new Date(date);
|
|
28
22
|
selectedDate.setMinutes(selectedDate.getMinutes() + interval);
|
|
29
|
-
|
|
23
|
+
const baseDate = new Date(date);
|
|
30
24
|
baseDate.setHours(0, 0, 0, 0);
|
|
31
|
-
|
|
25
|
+
const parsedTime = parse(time, "HH:mm", baseDate);
|
|
32
26
|
return isBefore(parsedTime, selectedDate);
|
|
33
27
|
}
|
|
34
28
|
return false;
|
|
35
29
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_range$start$split$ma2 = _slicedToArray(_range$start$split$ma, 2),
|
|
44
|
-
startHours = _range$start$split$ma2[0],
|
|
45
|
-
startMinutes = _range$start$split$ma2[1];
|
|
46
|
-
var startTotalMinutes = startHours * 60 + startMinutes;
|
|
47
|
-
var _range$end$split$map = range.end.split(":").map(Number),
|
|
48
|
-
_range$end$split$map2 = _slicedToArray(_range$end$split$map, 2),
|
|
49
|
-
endHours = _range$end$split$map2[0],
|
|
50
|
-
endMinutes = _range$end$split$map2[1];
|
|
51
|
-
var endTotalMinutes = endHours * 60 + endMinutes;
|
|
30
|
+
const isTimeInRange = (timeString, range) => {
|
|
31
|
+
const [hours, minutes] = timeString.split(":").map(Number);
|
|
32
|
+
const totalMinutes = hours * 60 + minutes;
|
|
33
|
+
const [startHours, startMinutes] = range.start.split(":").map(Number);
|
|
34
|
+
const startTotalMinutes = startHours * 60 + startMinutes;
|
|
35
|
+
const [endHours, endMinutes] = range.end.split(":").map(Number);
|
|
36
|
+
const endTotalMinutes = endHours * 60 + endMinutes;
|
|
52
37
|
return totalMinutes >= startTotalMinutes && totalMinutes <= endTotalMinutes;
|
|
53
38
|
};
|
|
54
39
|
|
package/esm/TimeSelect/index.js
CHANGED
|
@@ -3,45 +3,39 @@ import { Select } from '../Select/index.js';
|
|
|
3
3
|
import { generateSuggest, isTimeInRange, checkIsBeforeSelectedDate, checkIsBeforeNow } from './helpers.js';
|
|
4
4
|
import { OptionLabel } from './Label/index.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
6
|
+
const TimeSelect = ({
|
|
7
|
+
value,
|
|
8
|
+
name,
|
|
9
|
+
className,
|
|
10
|
+
currentDate,
|
|
11
|
+
selectedDate,
|
|
12
|
+
label,
|
|
13
|
+
interval = 15,
|
|
14
|
+
onChange,
|
|
15
|
+
disabled,
|
|
16
|
+
allowedTimeRange,
|
|
17
|
+
placeholder,
|
|
18
|
+
fullWidth,
|
|
19
|
+
customInputRoot,
|
|
20
|
+
fontSize,
|
|
21
|
+
required,
|
|
22
|
+
size,
|
|
23
|
+
zIndex,
|
|
24
|
+
hasError,
|
|
25
|
+
hint
|
|
26
|
+
}) => {
|
|
27
|
+
const baseOptions = useMemo(() => generateSuggest(interval).map(item => ({
|
|
28
|
+
value: item.time,
|
|
29
|
+
label: /*#__PURE__*/React.createElement(OptionLabel, {
|
|
30
|
+
time: item.time
|
|
31
|
+
})
|
|
32
|
+
})), [interval]);
|
|
33
|
+
const options = useMemo(() => baseOptions.map(option => {
|
|
34
|
+
const isDisabled = !!allowedTimeRange && !isTimeInRange(option.value, allowedTimeRange) || !!selectedDate && checkIsBeforeSelectedDate(option.value, interval, selectedDate) || !!currentDate && checkIsBeforeNow(option.value, currentDate);
|
|
35
|
+
return Object.assign(Object.assign({}, option), {
|
|
36
|
+
disabled: isDisabled
|
|
35
37
|
});
|
|
36
|
-
}, [interval]);
|
|
37
|
-
var options = useMemo(function () {
|
|
38
|
-
return baseOptions.map(function (option) {
|
|
39
|
-
var isDisabled = !!allowedTimeRange && !isTimeInRange(option.value, allowedTimeRange) || !!selectedDate && checkIsBeforeSelectedDate(option.value, interval, selectedDate) || !!currentDate && checkIsBeforeNow(option.value, currentDate);
|
|
40
|
-
return Object.assign(Object.assign({}, option), {
|
|
41
|
-
disabled: isDisabled
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}, [baseOptions, currentDate, selectedDate, allowedTimeRange, interval]);
|
|
38
|
+
}), [baseOptions, currentDate, selectedDate, allowedTimeRange, interval]);
|
|
45
39
|
return /*#__PURE__*/React.createElement(Select, {
|
|
46
40
|
className: className,
|
|
47
41
|
customInputRoot: customInputRoot,
|
package/esm/Tooltip/index.js
CHANGED
|
@@ -1,62 +1,57 @@
|
|
|
1
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
1
|
import React, { useState, useRef, useMemo, cloneElement } from 'react';
|
|
3
2
|
import { useFloating, offset, flip, shift, arrow, useHover, useDismiss, useRole, useInteractions, FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
4
|
import styles from './Tooltip.module.css';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}),
|
|
35
|
-
refs = _useFloating.refs,
|
|
36
|
-
context = _useFloating.context,
|
|
37
|
-
floatingStyles = _useFloating.floatingStyles;
|
|
38
|
-
var hover = useHover(context, {
|
|
6
|
+
const Tooltip = ({
|
|
7
|
+
children,
|
|
8
|
+
content,
|
|
9
|
+
zIndex = 1000,
|
|
10
|
+
withTail = false,
|
|
11
|
+
placement = "bottom",
|
|
12
|
+
strategy = "absolute",
|
|
13
|
+
className
|
|
14
|
+
}) => {
|
|
15
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
16
|
+
const arrowRef = useRef(null);
|
|
17
|
+
const {
|
|
18
|
+
refs,
|
|
19
|
+
context,
|
|
20
|
+
floatingStyles
|
|
21
|
+
} = useFloating({
|
|
22
|
+
placement,
|
|
23
|
+
strategy,
|
|
24
|
+
open: isOpen,
|
|
25
|
+
onOpenChange: setIsOpen,
|
|
26
|
+
middleware: [offset(8), flip(), shift({
|
|
27
|
+
padding: 8
|
|
28
|
+
}), arrow({
|
|
29
|
+
element: arrowRef
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
const hover = useHover(context, {
|
|
39
33
|
move: false,
|
|
40
34
|
delay: {
|
|
41
35
|
open: 100,
|
|
42
36
|
close: 100
|
|
43
37
|
}
|
|
44
38
|
});
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
const dismiss = useDismiss(context);
|
|
40
|
+
const role = useRole(context, {
|
|
47
41
|
role: "tooltip"
|
|
48
42
|
});
|
|
49
|
-
|
|
50
|
-
getReferenceProps
|
|
51
|
-
getFloatingProps
|
|
52
|
-
|
|
43
|
+
const {
|
|
44
|
+
getReferenceProps,
|
|
45
|
+
getFloatingProps
|
|
46
|
+
} = useInteractions([hover, dismiss, role]);
|
|
47
|
+
const reference = useMemo(() => {
|
|
53
48
|
if (!children) return null;
|
|
54
49
|
if (typeof children === "string") {
|
|
55
50
|
return /*#__PURE__*/React.createElement("span", null, children);
|
|
56
51
|
}
|
|
57
52
|
return children;
|
|
58
53
|
}, [children]);
|
|
59
|
-
|
|
54
|
+
const trigger = reference ? /*#__PURE__*/cloneElement(reference, Object.assign({
|
|
60
55
|
ref: refs.setReference
|
|
61
56
|
}, getReferenceProps())) : null;
|
|
62
57
|
return /*#__PURE__*/React.createElement(React.Fragment, null, trigger, isOpen && (/*#__PURE__*/React.createElement(FloatingPortal, null, /*#__PURE__*/React.createElement("div", Object.assign({
|
|
@@ -64,7 +59,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
64
59
|
}, getFloatingProps(), {
|
|
65
60
|
className: clsx(styles.tooltip, className),
|
|
66
61
|
style: Object.assign(Object.assign({}, floatingStyles), {
|
|
67
|
-
zIndex
|
|
62
|
+
zIndex
|
|
68
63
|
})
|
|
69
64
|
}), /*#__PURE__*/React.createElement("div", {
|
|
70
65
|
className: styles.content
|