@utilitywarehouse/hearth-react-native 0.16.0 → 0.16.1
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +67 -4
- package/CHANGELOG.md +6 -0
- package/build/components/Avatar/Avatar.js +0 -2
- package/build/components/Banner/Banner.d.ts +1 -1
- package/build/components/Banner/Banner.js +3 -1
- package/build/components/Carousel/Carousel.js +1 -1
- package/build/components/DateInput/DateInput.js +1 -0
- package/build/components/DateInput/DateInputSegment.js +2 -2
- package/build/components/DatePicker/DatePicker.js +8 -4
- package/build/components/DatePicker/DatePickerHeader/DatePickerHeader.props.d.ts +0 -1
- package/build/components/DatePicker/DatePickerHeader/index.js +1 -1
- package/build/components/DatePicker/index.d.ts +1 -0
- package/build/components/DatePicker/polyfill.js +3 -3
- package/build/components/DatePicker/time-picker/wheel-web.js +1 -3
- package/build/components/DatePickerInput/DatePickerInput.js +1 -2
- package/build/components/DescriptionList/DescriptionList.d.ts +1 -1
- package/build/components/DescriptionList/DescriptionList.js +2 -2
- package/build/components/DescriptionList/DescriptionList.props.d.ts +1 -0
- package/build/components/DescriptionList/DescriptionListItem.d.ts +1 -1
- package/build/components/DescriptionList/DescriptionListItem.js +3 -2
- package/build/components/DescriptionList/DescriptionListItem.props.d.ts +1 -0
- package/build/components/Input/Input.js +1 -1
- package/build/components/Switch/Switch.js +1 -1
- package/build/components/Tabs/Tabs.d.ts +1 -1
- package/build/components/Tabs/Tabs.js +1 -1
- package/build/components/Textarea/Textarea.js +3 -0
- package/build/components/Toast/ToastItem.js +1 -1
- package/build/components/ToggleButton/ToggleButtonIcon.js +1 -1
- package/build/components/ToggleButton/ToggleButtonRoot.js +0 -2
- package/build/components/UnstyledIconButton/UnstyledIconButtonIcon.js +1 -1
- package/build/utils/coloursAsArray.js +1 -1
- package/docs/components/AllComponents.web.tsx +16 -18
- package/docs/components/UsageWrap.tsx +17 -20
- package/eslint.config.js +5 -1
- package/package.json +10 -10
- package/src/components/Accordion/Accordion.figma.tsx +15 -17
- package/src/components/Accordion/AccordionItem.figma.tsx +27 -0
- package/src/components/Avatar/Avatar.figma.tsx +11 -21
- package/src/components/Avatar/Avatar.tsx +0 -2
- package/src/components/Badge/Badge.figma.tsx +45 -54
- package/src/components/Banner/Banner.figma.tsx +21 -13
- package/src/components/Banner/Banner.stories.tsx +4 -4
- package/src/components/Banner/Banner.tsx +2 -1
- package/src/components/Button/Button.figma.tsx +118 -46
- package/src/components/Card/Card.figma.tsx +27 -43
- package/src/components/Card/Card.stories.tsx +1 -1
- package/src/components/Carousel/Carousel.figma.tsx +20 -17
- package/src/components/Carousel/Carousel.tsx +1 -1
- package/src/components/Checkbox/Checkbox.figma.tsx +15 -18
- package/src/components/Checkbox/Checkbox.stories.tsx +2 -2
- package/src/components/Checkbox/CheckboxGroup.figma.tsx +48 -15
- package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +24 -27
- package/src/components/CurrencyInput/CurrencyInput.figma.tsx +65 -49
- package/src/components/DateInput/DateInput.figma.tsx +58 -45
- package/src/components/DateInput/DateInput.tsx +1 -0
- package/src/components/DateInput/DateInputSegment.tsx +2 -2
- package/src/components/DatePicker/DatePicker.figma.tsx +47 -0
- package/src/components/DatePicker/DatePicker.tsx +8 -4
- package/src/components/DatePicker/DatePickerHeader/DatePickerHeader.props.ts +0 -2
- package/src/components/DatePicker/DatePickerHeader/index.tsx +2 -2
- package/src/components/DatePicker/index.ts +2 -0
- package/src/components/DatePicker/polyfill.ts +3 -3
- package/src/components/DatePicker/time-picker/wheel-web.tsx +0 -1
- package/src/components/DatePickerInput/DatePickerInput.figma.tsx +18 -46
- package/src/components/DatePickerInput/DatePickerInput.tsx +0 -2
- package/src/components/DescriptionList/DescriptionList.docs.mdx +16 -14
- package/src/components/DescriptionList/DescriptionList.figma.tsx +41 -17
- package/src/components/DescriptionList/DescriptionList.props.ts +1 -0
- package/src/components/DescriptionList/DescriptionList.stories.tsx +24 -0
- package/src/components/DescriptionList/DescriptionList.tsx +2 -0
- package/src/components/DescriptionList/DescriptionListItem.figma.tsx +42 -0
- package/src/components/DescriptionList/DescriptionListItem.props.ts +1 -0
- package/src/components/DescriptionList/DescriptionListItem.tsx +7 -0
- package/src/components/Divider/Divider.figma.tsx +10 -23
- package/src/components/Input/Input.tsx +0 -1
- package/src/components/List/List.stories.tsx +1 -4
- package/src/components/Radio/Radio.stories.tsx +1 -1
- package/src/components/Switch/Switch.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +0 -1
- package/src/components/Textarea/Textarea.tsx +3 -0
- package/src/components/ThemedImage/ThemedImage.stories.tsx +14 -14
- package/src/components/Toast/ToastItem.tsx +1 -1
- package/src/components/ToggleButton/ToggleButtonIcon.tsx +1 -1
- package/src/components/ToggleButton/ToggleButtonRoot.tsx +0 -2
- package/src/components/UnstyledIconButton/UnstyledIconButtonIcon.tsx +1 -1
- package/src/utils/coloursAsArray.ts +1 -1
- package/tsconfig.eslint.json +13 -0
- package/src/components/Accordion/AccordionItemRoot.figma.tsx +0 -47
- package/src/components/DatePicker/DatePickerCalendar.figma.tsx +0 -34
package/.turbo/turbo-build.log
CHANGED
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
|
|
2
|
-
> @utilitywarehouse/hearth-react-native@0.16.
|
|
3
|
-
> TIMING=1 eslint
|
|
2
|
+
> @utilitywarehouse/hearth-react-native@0.16.1 lint /home/runner/work/hearth/hearth/packages/react-native
|
|
3
|
+
> TIMING=1 eslint .
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/Carousel/Carousel.context.tsx
|
|
7
|
+
6:14 warning Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components react-refresh/only-export-components
|
|
8
|
+
|
|
9
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/Carousel/Carousel.tsx
|
|
10
|
+
146:6 warning React Hook useMemo has a missing dependency: 'hasCarouselControlsInTree'. Either include it or remove the dependency array react-hooks/exhaustive-deps
|
|
11
|
+
|
|
12
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/DatePicker/DatePicker.tsx
|
|
13
|
+
109:6 warning React Hook useCallback has an unnecessary dependency: 'modalRef.current'. Either exclude it or remove the dependency array. Mutable values like 'modalRef.current' aren't valid dependencies because mutating them doesn't re-render the component react-hooks/exhaustive-deps
|
|
14
|
+
259:6 warning React Hook useEffect has a missing dependency: 'initialState'. Either include it or remove the dependency array react-hooks/exhaustive-deps
|
|
15
|
+
346:6 warning React Hook useEffect has a missing dependency: 'onChange'. Either include it or remove the dependency array react-hooks/exhaustive-deps
|
|
16
|
+
468:5 warning React Hook useCallback has a missing dependency: 'onChange'. Either include it or remove the dependency array react-hooks/exhaustive-deps
|
|
17
|
+
536:6 warning React Hook useEffect has a missing dependency: 'onSelectMonth'. Either include it or remove the dependency array react-hooks/exhaustive-deps
|
|
18
|
+
542:6 warning React Hook useEffect has a missing dependency: 'onSelectYear'. Either include it or remove the dependency array react-hooks/exhaustive-deps
|
|
19
|
+
|
|
20
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/DatePicker/DatePickerDay.tsx
|
|
21
|
+
76:6 warning React Hook useMemo has an unnecessary dependency: 'styles.rangeRoot'. Either exclude it or remove the dependency array. Outer scope values like 'styles.rangeRoot' aren't valid dependencies because mutating them doesn't re-render the component react-hooks/exhaustive-deps
|
|
22
|
+
84:6 warning React Hook useMemo has a missing dependency: 'isSelected'. Either include it or remove the dependency array react-hooks/exhaustive-deps
|
|
23
|
+
|
|
24
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/DatePicker/DatePickerDays.tsx
|
|
25
|
+
179:6 warning React Hook useMemo has unnecessary dependencies: 'month' and 'year'. Either exclude them or remove the dependency array react-hooks/exhaustive-deps
|
|
26
|
+
|
|
27
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/DatePicker/DatePickerYears.tsx
|
|
28
|
+
52:6 warning React Hook useCallback has a missing dependency: 'containerHeight'. Either include it or remove the dependency array. Outer scope values like 'styles' aren't valid dependencies because mutating them doesn't re-render the component react-hooks/exhaustive-deps
|
|
29
|
+
|
|
30
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/Input/Input.tsx
|
|
31
|
+
75:8 warning React Hook useEffect has a missing dependency: 'formFieldContext'. Either include it or remove the dependency array react-hooks/exhaustive-deps
|
|
32
|
+
|
|
33
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/Modal/Modal.tsx
|
|
34
|
+
72:6 warning React Hook useCallback has an unnecessary dependency: 'Platform.OS'. Either exclude it or remove the dependency array. Outer scope values like 'Platform.OS' aren't valid dependencies because mutating them doesn't re-render the component react-hooks/exhaustive-deps
|
|
35
|
+
268:5 warning React Hook useCallback has a missing dependency: 'footer'. Either include it or remove the dependency array react-hooks/exhaustive-deps
|
|
36
|
+
|
|
37
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/Modal/Modal.web.tsx
|
|
38
|
+
65:6 warning React Hook useCallback has an unnecessary dependency: 'Platform.OS'. Either exclude it or remove the dependency array. Outer scope values like 'Platform.OS' aren't valid dependencies because mutating them doesn't re-render the component react-hooks/exhaustive-deps
|
|
39
|
+
|
|
40
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/PillGroup/PillGroup.tsx
|
|
41
|
+
17:9 warning The 'normalizedValue' conditional could make the dependencies of useMemo Hook (at line 33) change on every render. Move it inside the useMemo callback. Alternatively, wrap the initialization of 'normalizedValue' in its own useMemo() Hook react-hooks/exhaustive-deps
|
|
42
|
+
|
|
43
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/Tabs/Tabs.tsx
|
|
44
|
+
53:6 warning React Hook useEffect has a missing dependency: 'tabValues'. Either include it or remove the dependency array react-hooks/exhaustive-deps
|
|
45
|
+
53:7 warning React Hook useEffect has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked react-hooks/exhaustive-deps
|
|
46
|
+
104:5 warning React Hook useMemo has an unnecessary dependency: 'tabValues'. Either exclude it or remove the dependency array react-hooks/exhaustive-deps
|
|
47
|
+
127:62 warning React Hook useEffect has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked react-hooks/exhaustive-deps
|
|
48
|
+
|
|
49
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/Textarea/Textarea.tsx
|
|
50
|
+
45:6 warning React Hook useEffect has a missing dependency: 'formFieldContext'. Either include it or remove the dependency array react-hooks/exhaustive-deps
|
|
51
|
+
|
|
52
|
+
/home/runner/work/hearth/hearth/packages/react-native/src/components/Toast/Toast.context.tsx
|
|
53
|
+
9:14 warning Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components react-refresh/only-export-components
|
|
54
|
+
94:14 warning Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components react-refresh/only-export-components
|
|
55
|
+
|
|
56
|
+
✖ 24 problems (0 errors, 24 warnings)
|
|
57
|
+
|
|
58
|
+
Rule | Time (ms) | Relative
|
|
59
|
+
:-----------------------------------------|----------:|--------:
|
|
60
|
+
@typescript-eslint/no-unused-vars | 1453.557 | 63.1%
|
|
61
|
+
react-hooks/exhaustive-deps | 117.512 | 5.1%
|
|
62
|
+
no-global-assign | 117.462 | 5.1%
|
|
63
|
+
react-hooks/rules-of-hooks | 75.475 | 3.3%
|
|
64
|
+
no-unexpected-multiline | 45.705 | 2.0%
|
|
65
|
+
@typescript-eslint/ban-ts-comment | 35.030 | 1.5%
|
|
66
|
+
@typescript-eslint/triple-slash-reference | 30.235 | 1.3%
|
|
67
|
+
no-misleading-character-class | 27.369 | 1.2%
|
|
68
|
+
no-loss-of-precision | 26.374 | 1.1%
|
|
69
|
+
no-useless-escape | 25.969 | 1.1%
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @utilitywarehouse/hearth-react-native
|
|
2
2
|
|
|
3
|
+
## 0.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#817](https://github.com/utilitywarehouse/hearth/pull/817) [`fb4f4d0`](https://github.com/utilitywarehouse/hearth/commit/fb4f4d034e5b67b0c75dc093f7fdd8d3ab26edde) Thanks [@jordmccord](https://github.com/jordmccord)! - 🐛 [FIX]: `DateInput` height issue
|
|
8
|
+
|
|
3
9
|
## 0.16.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -3,13 +3,11 @@ import { UserMediumIcon, UserSmallIcon } from '@utilitywarehouse/hearth-react-na
|
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import { Image, View } from 'react-native';
|
|
5
5
|
import { StyleSheet } from 'react-native-unistyles';
|
|
6
|
-
import { useTheme } from '../../hooks';
|
|
7
6
|
import { getInitials } from '../../utils';
|
|
8
7
|
import BodyText from '../BodyText/BodyText';
|
|
9
8
|
const Avatar = ({ src, name, size = 'md', delayMs = 0, onLoadingStatusChange, style, ...props }) => {
|
|
10
9
|
const [status, setStatus] = useState('idle');
|
|
11
10
|
const [isDelayed, setIsDelayed] = useState(delayMs > 0);
|
|
12
|
-
const { components } = useTheme();
|
|
13
11
|
useEffect(() => {
|
|
14
12
|
if (!src) {
|
|
15
13
|
setStatus('idle');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type BannerProps from './Banner.props';
|
|
2
2
|
declare const Banner: {
|
|
3
|
-
({ icon, iconContainerVariant, iconContainerSize, iconContainerColor, illustration, image, heading, description, direction, link, button, onPress, onClose, variant, colorScheme, style, ...props }: BannerProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ icon, iconContainerVariant, iconContainerSize, iconContainerColor, illustration, image, heading, description, direction, link, button, onPress, onClose, variant, colorScheme: _, style, ...props }: BannerProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default Banner;
|
|
@@ -9,7 +9,9 @@ import { Heading } from '../Heading';
|
|
|
9
9
|
import { IconContainer } from '../IconContainer';
|
|
10
10
|
import { UnstyledIconButton } from '../UnstyledIconButton';
|
|
11
11
|
import BannerContext from './Banner.context';
|
|
12
|
-
const Banner = ({ icon, iconContainerVariant = 'subtle', iconContainerSize = 'md', iconContainerColor = 'pig', illustration, image, heading, description, direction = 'horizontal', link, button, onPress, onClose, variant = 'subtle',
|
|
12
|
+
const Banner = ({ icon, iconContainerVariant = 'subtle', iconContainerSize = 'md', iconContainerColor = 'pig', illustration, image, heading, description, direction = 'horizontal', link, button, onPress, onClose, variant = 'subtle',
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
|
+
colorScheme: _, style, ...props }) => {
|
|
13
15
|
const hasIllustration = Boolean(illustration);
|
|
14
16
|
styles.useVariants({ direction, hasIllustration });
|
|
15
17
|
const context = useMemo(() => ({
|
|
@@ -7,7 +7,7 @@ import { CarouselControls } from './CarouselControls';
|
|
|
7
7
|
import { CarouselItem } from './CarouselItem';
|
|
8
8
|
const Carousel = ({ centered = false, children, disabled = false, inactiveItemOpacity = 1, itemWidth, onSnapToItem, showOverflow = false, style, width, itemsStyle, activeIndex: initialActiveIndex = 0, showControls = true, showNavigation = false, controlsStyle, controlsItemStyle, controlsActiveItemStyle, controlsAccessibilityHidden = true, inverted = false, ref, ...props }) => {
|
|
9
9
|
const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
|
|
10
|
-
const [
|
|
10
|
+
const [, setNumItems] = useState(0);
|
|
11
11
|
const scrollViewRef = useRef(null);
|
|
12
12
|
const flatListRef = useRef(null);
|
|
13
13
|
const isWeb = Platform.OS === 'web';
|
|
@@ -12,7 +12,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
12
12
|
container: {
|
|
13
13
|
flex: 1,
|
|
14
14
|
gap: theme.components.input.gap,
|
|
15
|
-
maxWidth: 96,
|
|
15
|
+
// maxWidth: 96,
|
|
16
16
|
},
|
|
17
17
|
label: {
|
|
18
18
|
variants: {
|
|
@@ -24,7 +24,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
input: {
|
|
27
|
-
|
|
27
|
+
// maxWidth: 96,
|
|
28
28
|
},
|
|
29
29
|
}));
|
|
30
30
|
export default DateInputSegment;
|
|
@@ -21,6 +21,7 @@ dayjs.extend(utc);
|
|
|
21
21
|
dayjs.extend(timezone);
|
|
22
22
|
dayjs.extend(duration);
|
|
23
23
|
const DateTimePicker = (props) => {
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/prefer-as-const
|
|
24
25
|
const numerals = 'latn';
|
|
25
26
|
const { mode = 'single', timeZone, showOutsideDays = true, timePicker = false, firstDayOfWeek = 1,
|
|
26
27
|
// startYear,
|
|
@@ -119,26 +120,29 @@ const DateTimePicker = (props) => {
|
|
|
119
120
|
...prevState,
|
|
120
121
|
currentYear: action.payload,
|
|
121
122
|
};
|
|
122
|
-
case CalendarActionKind.CHANGE_SELECTED_DATE:
|
|
123
|
+
case CalendarActionKind.CHANGE_SELECTED_DATE: {
|
|
123
124
|
const { date: selectedDate } = action.payload;
|
|
124
125
|
return {
|
|
125
126
|
...prevState,
|
|
126
127
|
date: selectedDate,
|
|
127
128
|
currentDate: selectedDate,
|
|
128
129
|
};
|
|
129
|
-
|
|
130
|
+
}
|
|
131
|
+
case CalendarActionKind.CHANGE_SELECTED_RANGE: {
|
|
130
132
|
const { startDate: start, endDate: end } = action.payload;
|
|
131
133
|
return {
|
|
132
134
|
...prevState,
|
|
133
135
|
startDate: start,
|
|
134
136
|
endDate: end,
|
|
135
137
|
};
|
|
136
|
-
|
|
138
|
+
}
|
|
139
|
+
case CalendarActionKind.CHANGE_SELECTED_MULTIPLE: {
|
|
137
140
|
const { dates: selectedDates } = action.payload;
|
|
138
141
|
return {
|
|
139
142
|
...prevState,
|
|
140
143
|
dates: selectedDates,
|
|
141
144
|
};
|
|
145
|
+
}
|
|
142
146
|
case CalendarActionKind.RESET_STATE:
|
|
143
147
|
return action.payload;
|
|
144
148
|
default:
|
|
@@ -245,7 +249,7 @@ const DateTimePicker = (props) => {
|
|
|
245
249
|
}
|
|
246
250
|
else if (mode === 'range') {
|
|
247
251
|
// set time to 00:00:00
|
|
248
|
-
|
|
252
|
+
const start = removeTime(stateRef.current.startDate, timeZone);
|
|
249
253
|
let end = removeTime(stateRef.current.endDate, timeZone);
|
|
250
254
|
const selected = removeTime(selectedDate, timeZone);
|
|
251
255
|
let isStart = true;
|
|
@@ -5,7 +5,7 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
5
5
|
import NextButton from './DatePickerNextButton';
|
|
6
6
|
import PrevButton from './DatePickerPrevButton';
|
|
7
7
|
import Selectors from './DatePickerSelectors';
|
|
8
|
-
const NavigationButtons = (
|
|
8
|
+
const NavigationButtons = () => (_jsxs(View, { style: styles.navigation, children: [_jsx(PrevButton, {}), _jsx(NextButton, {})] }));
|
|
9
9
|
const Header = ({ navigationPosition = 'around' }) => (_jsx(View, { style: [styles.headerContainer], children: _jsx(View, { style: styles.container, children: navigationPosition === 'left' ? (_jsxs(_Fragment, { children: [_jsx(NavigationButtons, {}), _jsx(Selectors, { position: "left" })] })) : navigationPosition === 'right' ? (_jsxs(_Fragment, { children: [_jsx(Selectors, { position: "right" }), _jsx(NavigationButtons, {})] })) : (_jsxs(_Fragment, { children: [_jsx(PrevButton, {}), _jsx(Selectors, { position: "around" }), _jsx(NextButton, {})] })) }) }));
|
|
10
10
|
const styles = StyleSheet.create(theme => ({
|
|
11
11
|
headerContainer: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import 'dayjs/locale/en';
|
|
2
2
|
import './polyfill';
|
|
3
|
+
export type { BottomSheetMethods as DatePickerMethods } from '@gorhom/bottom-sheet/lib/typescript/types';
|
|
3
4
|
export type { CalendarDay, CalendarMode, CalendarMonth, CalendarWeek, CalendarYear, DateType, } from './DatePicker.props';
|
|
4
5
|
export { default as DatePicker } from './DatePicker';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// @ts-
|
|
2
|
+
// @ts-expect-error - Polyfill for Date.toLocaleString to support timeZone option in React Native environment.
|
|
3
3
|
Date.prototype._toLocaleString = Date.prototype.toLocaleString;
|
|
4
|
-
// @ts-
|
|
4
|
+
// @ts-expect-error - Polyfill for Date.toLocaleString to support timeZone option in React Native environment.
|
|
5
5
|
Date.prototype.toLocaleString = function (a, b) {
|
|
6
6
|
if (b && Object.keys(b).length === 1 && 'timeZone' in b && a === 'en-US') {
|
|
7
7
|
return Intl.DateTimeFormat('en-us', {
|
|
@@ -17,6 +17,6 @@ Date.prototype.toLocaleString = function (a, b) {
|
|
|
17
17
|
.format(this)
|
|
18
18
|
.replace(/(\d{2})\/(\d{2})\/(\d{4}),/g, '$3-$1-$2');
|
|
19
19
|
}
|
|
20
|
-
// @ts-
|
|
20
|
+
// @ts-expect-error - Polyfill for Date.toLocaleString to support timeZone option in React Native environment.
|
|
21
21
|
return this._toLocaleString(a, b);
|
|
22
22
|
};
|
|
@@ -98,9 +98,7 @@ const WheelWeb = ({ value, setValue = () => { }, items }) => {
|
|
|
98
98
|
},
|
|
99
99
|
] }), displayValues?.map((displayValue, index) => {
|
|
100
100
|
const animatedAngle = animatedAngles[index];
|
|
101
|
-
return (_jsx(Animated.View, {
|
|
102
|
-
// eslint-disable-next-line react-native/no-inline-styles
|
|
103
|
-
style: {
|
|
101
|
+
return (_jsx(Animated.View, { style: {
|
|
104
102
|
position: 'absolute',
|
|
105
103
|
height: ITEM_HEIGHT - 10,
|
|
106
104
|
transform: animatedAngle
|
|
@@ -21,7 +21,6 @@ const maskDefaultFormat = (value) => {
|
|
|
21
21
|
};
|
|
22
22
|
const DatePickerInput = ({ validationStatus = 'initial', disabled, focused, readonly, placeholder, inBottomSheet = false, format = DEFAULT_FORMAT, openButtonLabel = 'Open date picker', autoCloseOnSelect = true, label, labelVariant, helperText, helperIcon, validText, invalidText, required = true, onChange, onChangeText, onBlur, onFocus, value, datePickerProps, onClear, ...rest }) => {
|
|
23
23
|
const formFieldContext = useFormFieldContext();
|
|
24
|
-
const validationStatusFromContext = formFieldContext?.validationStatus ?? validationStatus;
|
|
25
24
|
const isDisabled = formFieldContext?.disabled ?? disabled;
|
|
26
25
|
const isReadonly = formFieldContext?.readonly ?? readonly;
|
|
27
26
|
const pickerRef = useRef(null);
|
|
@@ -97,7 +96,7 @@ const DatePickerInput = ({ validationStatus = 'initial', disabled, focused, read
|
|
|
97
96
|
onFocus?.(event);
|
|
98
97
|
}, [onFocus]);
|
|
99
98
|
const { onCancel: pickerOnCancel, ...restDatePickerProps } = datePickerProps ?? {};
|
|
100
|
-
const { style: inputStyle, keyboardType: keyboardTypeProp, inputMode: inputModeProp, accessibilityHint: accessibilityHintProp, accessibilityLabel: accessibilityLabelProp, accessible: accessibleProp,
|
|
99
|
+
const { style: inputStyle, keyboardType: keyboardTypeProp, inputMode: inputModeProp, accessibilityHint: accessibilityHintProp, accessibilityLabel: accessibilityLabelProp, accessible: accessibleProp, importantForAccessibility: importantForAccessibilityProp, ...textInputProps } = rest;
|
|
101
100
|
const resolvedKeyboardType = keyboardTypeProp ?? (isDefaultFormat ? 'number-pad' : undefined);
|
|
102
101
|
const resolvedInputMode = inputModeProp ?? (isDefaultFormat ? 'numeric' : undefined);
|
|
103
102
|
const resolvedAccessibilityHint = accessibilityHintProp ?? `Enter the date in ${format} format`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type DescriptionListProps from './DescriptionList.props';
|
|
2
2
|
declare const DescriptionList: {
|
|
3
|
-
({ direction, itemHeadingWidth, heading, helperText, headerTrailingContent, children, style, ...props }: DescriptionListProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ direction, itemHeadingWidth, heading, helperText, headerTrailingContent, children, style, invalidText, ...props }: DescriptionListProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default DescriptionList;
|
|
@@ -4,10 +4,10 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { SectionHeader } from '../SectionHeader';
|
|
6
6
|
import { DescriptionListContext } from './DescriptionList.context';
|
|
7
|
-
const DescriptionList = ({ direction = 'column', itemHeadingWidth, heading, helperText, headerTrailingContent, children, style, ...props }) => {
|
|
7
|
+
const DescriptionList = ({ direction = 'column', itemHeadingWidth, heading, helperText, headerTrailingContent, children, style, invalidText, ...props }) => {
|
|
8
8
|
styles.useVariants({ direction });
|
|
9
9
|
const value = useMemo(() => ({ direction, itemHeadingWidth }), [direction, itemHeadingWidth]);
|
|
10
|
-
return (_jsx(DescriptionListContext.Provider, { value: value, children: _jsxs(View, { accessibilityRole: "list", ...props, style: [styles.container, style], children: [heading ? (_jsx(SectionHeader, { heading: heading, helperText: helperText, trailingContent: headerTrailingContent })) : null, children] }) }));
|
|
10
|
+
return (_jsx(DescriptionListContext.Provider, { value: value, children: _jsxs(View, { accessibilityRole: "list", ...props, style: [styles.container, style], children: [heading ? (_jsx(SectionHeader, { heading: heading, helperText: helperText, trailingContent: headerTrailingContent, invalidText: invalidText })) : null, children] }) }));
|
|
11
11
|
};
|
|
12
12
|
DescriptionList.displayName = 'DescriptionList';
|
|
13
13
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type DescriptionListItemProps from './DescriptionListItem.props';
|
|
2
2
|
declare const DescriptionListItem: {
|
|
3
|
-
({ heading, description, headingWidth, trailingContent, invalidText, style, ...props }: DescriptionListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ heading, description, headingWidth, trailingContent, invalidText, numericValue, style, ...props }: DescriptionListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default DescriptionListItem;
|
|
@@ -4,9 +4,10 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { useTheme } from '../../hooks';
|
|
6
6
|
import { BodyText } from '../BodyText';
|
|
7
|
+
import { DetailText } from '../DetailText';
|
|
7
8
|
import Helper from '../Helper/Helper';
|
|
8
9
|
import { useDescriptionListContext } from './DescriptionList.context';
|
|
9
|
-
const DescriptionListItem = ({ heading, description, headingWidth, trailingContent, invalidText, style, ...props }) => {
|
|
10
|
+
const DescriptionListItem = ({ heading, description, headingWidth, trailingContent, invalidText, numericValue, style, ...props }) => {
|
|
10
11
|
const { components } = useTheme();
|
|
11
12
|
const { direction, itemHeadingWidth = components.descriptionList.item.row.headingWidth } = useDescriptionListContext();
|
|
12
13
|
styles.useVariants({ direction });
|
|
@@ -14,7 +15,7 @@ const DescriptionListItem = ({ heading, description, headingWidth, trailingConte
|
|
|
14
15
|
const descIsText = typeof description === 'string' || typeof description === 'number';
|
|
15
16
|
const combinedLabel = headingIsText && descIsText ? `${heading}: ${description}` : undefined;
|
|
16
17
|
const hideDescendants = !!combinedLabel;
|
|
17
|
-
return (_jsxs(View, { accessibilityRole: "text", accessible: !!combinedLabel, accessibilityLabel: combinedLabel, ...props, style: [styles.item, style], children: [_jsxs(View, { style: styles.textWrap, importantForAccessibility: hideDescendants ? 'no-hide-descendants' : undefined, accessibilityElementsHidden: hideDescendants || undefined, children: [_jsx(View, { style: [direction === 'row' && { width: headingWidth || itemHeadingWidth }], children: headingIsText ? _jsx(BodyText, { style: styles.headingText, children: heading }) : heading }), _jsxs(View, { style: styles.descriptionWrapper, children: [descIsText ? _jsx(BodyText, { children: description }) : description, !!invalidText && (_jsx(Helper, { validationStatus: "invalid", showIcon: true, icon: ErrorCircleSmallIcon, text: invalidText || '' }))] })] }), trailingContent ? trailingContent : null] }));
|
|
18
|
+
return (_jsxs(View, { accessibilityRole: "text", accessible: !!combinedLabel, accessibilityLabel: combinedLabel, ...props, style: [styles.item, style], children: [_jsxs(View, { style: styles.textWrap, importantForAccessibility: hideDescendants ? 'no-hide-descendants' : undefined, accessibilityElementsHidden: hideDescendants || undefined, children: [_jsx(View, { style: [direction === 'row' && { width: headingWidth || itemHeadingWidth }], children: headingIsText ? _jsx(BodyText, { style: styles.headingText, children: heading }) : heading }), _jsxs(View, { style: styles.descriptionWrapper, children: [descIsText ? _jsx(BodyText, { children: description }) : description, !!invalidText && (_jsx(Helper, { validationStatus: "invalid", showIcon: true, icon: ErrorCircleSmallIcon, text: invalidText || '' }))] }), numericValue ? (_jsx(View, { style: styles.descriptionWrapper, children: _jsx(DetailText, { size: "lg", children: numericValue }) })) : null] }), trailingContent ? trailingContent : null] }));
|
|
18
19
|
};
|
|
19
20
|
DescriptionListItem.displayName = 'DescriptionListItem';
|
|
20
21
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -19,7 +19,7 @@ export const InputComponent = createInput({
|
|
|
19
19
|
export const InputSlot = InputComponent.Slot;
|
|
20
20
|
export const InputField = InputComponent.Input;
|
|
21
21
|
export const InputIcon = InputComponent.Icon;
|
|
22
|
-
const Input = forwardRef(({ validationStatus = 'initial', children, disabled, focused, readonly, leadingIcon, trailingIcon, type, showPasswordToggle = true, onClear,
|
|
22
|
+
const Input = forwardRef(({ validationStatus = 'initial', children, disabled, focused, readonly, leadingIcon, trailingIcon, type, showPasswordToggle = true, onClear, loading, clearable = false, required = true, inBottomSheet = false, style, label, labelVariant, helperText, helperIcon, validText, invalidText, ...props }, ref) => {
|
|
23
23
|
const formFieldContext = useFormFieldContext();
|
|
24
24
|
const inputLabel = label ?? formFieldContext?.label;
|
|
25
25
|
const inputHelperText = helperText ?? formFieldContext?.helperText;
|
|
@@ -8,7 +8,7 @@ import { useAnimatedTheme } from 'react-native-unistyles/reanimated';
|
|
|
8
8
|
import { useTheme } from '../../hooks';
|
|
9
9
|
import { Icon } from '../Icon';
|
|
10
10
|
const CustomSwitch = ({ value = false, onValueChange, disabled = false, size = 'medium', ...accessibilityProps }) => {
|
|
11
|
-
const { components
|
|
11
|
+
const { components } = useTheme();
|
|
12
12
|
const theme = useAnimatedTheme();
|
|
13
13
|
const SWITCH_WIDTH = size === 'medium' ? components.switch.md.width : components.switch.sm.width;
|
|
14
14
|
const THUMB_SIZE = size === 'medium' ? components.switch.md.circle.size : components.switch.sm.circle.size;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type TabsProps from './Tabs.props';
|
|
2
2
|
declare const Tabs: {
|
|
3
|
-
({ value: controlledValue, defaultValue, onValueChange, size, disabled, children,
|
|
3
|
+
({ value: controlledValue, defaultValue, onValueChange, size, disabled, children, ...props }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default Tabs;
|
|
@@ -3,7 +3,7 @@ import { Children, isValidElement, useCallback, useEffect, useMemo, useRef, useS
|
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import { Easing, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
5
5
|
import { TabsContext } from './Tabs.context';
|
|
6
|
-
const Tabs = ({ value: controlledValue, defaultValue, onValueChange, size = 'md', disabled, children,
|
|
6
|
+
const Tabs = ({ value: controlledValue, defaultValue, onValueChange, size = 'md', disabled, children, ...props }) => {
|
|
7
7
|
// Collect child tab values
|
|
8
8
|
const tabValues = useMemo(() => {
|
|
9
9
|
const vals = [];
|
|
@@ -36,6 +36,9 @@ const Textarea = ({ validationStatus = 'initial', children, disabled, focused, r
|
|
|
36
36
|
};
|
|
37
37
|
const getAccessibilityHint = () => {
|
|
38
38
|
let accessibilityHint = '';
|
|
39
|
+
if (textareaHelperText) {
|
|
40
|
+
accessibilityHint = accessibilityHint + textareaHelperText;
|
|
41
|
+
}
|
|
39
42
|
if (textareaValidationStatus !== 'initial') {
|
|
40
43
|
if (accessibilityHint.length > 0) {
|
|
41
44
|
accessibilityHint = accessibilityHint + ', ';
|
|
@@ -26,7 +26,7 @@ const ToastItem = forwardRef(({ toast, onClose }, ref) => {
|
|
|
26
26
|
AccessibilityInfo.announceForAccessibility(announcement);
|
|
27
27
|
}, 100);
|
|
28
28
|
return () => clearTimeout(timer);
|
|
29
|
-
}, [toast.text, toast.actionText]);
|
|
29
|
+
}, [toast.text, toast.actionText, translateY, opacity]);
|
|
30
30
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
31
31
|
transform: [{ translateY: translateY.value + gestureTranslateY.value }],
|
|
32
32
|
opacity: opacity.value,
|
|
@@ -7,7 +7,7 @@ const ButtonIcon = ({ children, toggled, as = TickSmallIcon, ...props }) => {
|
|
|
7
7
|
styles.useVariants({ toggled });
|
|
8
8
|
const IconAny = Icon;
|
|
9
9
|
return (_jsx(IconAny, { as: as, ...props, style: Platform.OS === 'web'
|
|
10
|
-
? // @ts-
|
|
10
|
+
? // @ts-expect-error - Spread types may only be created from object types.
|
|
11
11
|
{ ...styles.icon, ...props.style }
|
|
12
12
|
: [styles.icon, props.style], children: children }));
|
|
13
13
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Pressable } from 'react-native';
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
-
import { useCardPressHandlerContext } from '../Card';
|
|
5
4
|
const ButtonRoot = ({ children, onToggle, toggled, states, onPress, ...props }) => {
|
|
6
5
|
const { active } = states || {};
|
|
7
|
-
const { pressed } = useCardPressHandlerContext();
|
|
8
6
|
styles.useVariants({
|
|
9
7
|
toggled,
|
|
10
8
|
active,
|
|
@@ -7,7 +7,7 @@ const UnstyledIconButtonIcon = ({ children, ...props }) => {
|
|
|
7
7
|
const { active, inverted, size } = useUnstyledIconButtonContext();
|
|
8
8
|
styles.useVariants({ active, inverted, size });
|
|
9
9
|
return (_jsx(Icon, { ...props, style: Platform.OS === 'web'
|
|
10
|
-
? // @ts-
|
|
10
|
+
? // @ts-expect-error - Spread types may only be created from object types.
|
|
11
11
|
{ ...styles.icon, ...props.style }
|
|
12
12
|
: [styles.icon, props.style], children: children }));
|
|
13
13
|
};
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
ShareSmallIcon,
|
|
14
14
|
TrashSmallIcon,
|
|
15
15
|
} from '@utilitywarehouse/hearth-react-native-icons';
|
|
16
|
-
// @ts-
|
|
16
|
+
// @ts-expect-error - Module missing type declarations
|
|
17
17
|
import SpotBillingDark from '@utilitywarehouse/hearth-svg-assets/lib/spot-billing-dark.svg';
|
|
18
|
-
// @ts-
|
|
18
|
+
// @ts-expect-error - Module missing type declarations
|
|
19
19
|
import SpotBillingLight from '@utilitywarehouse/hearth-svg-assets/lib/spot-billing-light.svg';
|
|
20
20
|
import { Pressable, ScrollView, View, ViewProps } from 'react-native';
|
|
21
21
|
import { StyleSheet } from 'react-native-unistyles';
|
|
@@ -176,6 +176,7 @@ const AllComponents: React.FC = () => {
|
|
|
176
176
|
const handleMenuOpenPress = useCallback(() => {
|
|
177
177
|
menuRef.current?.present();
|
|
178
178
|
}, []);
|
|
179
|
+
const [pillValue, setPillValue] = React.useState<string[]>(['energy', 'mobile']);
|
|
179
180
|
|
|
180
181
|
const [colorMode] = useColorMode();
|
|
181
182
|
const isDark = colorMode === 'dark';
|
|
@@ -648,22 +649,19 @@ const AllComponents: React.FC = () => {
|
|
|
648
649
|
</ComponentWrapper>
|
|
649
650
|
<ComponentWrapper name="Pill Group" link="/?path=/docs/components-pill-group--docs">
|
|
650
651
|
<Center flex={1} p="200">
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
</PillGroup>
|
|
665
|
-
);
|
|
666
|
-
})()}
|
|
652
|
+
(
|
|
653
|
+
<PillGroup
|
|
654
|
+
value={pillValue}
|
|
655
|
+
onChange={v => setPillValue(v as string[])}
|
|
656
|
+
wrap={false}
|
|
657
|
+
multiple
|
|
658
|
+
>
|
|
659
|
+
<Pill value="all" label="All" />
|
|
660
|
+
<Pill value="energy" label="Energy" icon={ElectricityMediumIcon} />
|
|
661
|
+
<Pill value="broadband" label="Broadband" icon={BroadbandMediumIcon} />
|
|
662
|
+
<Pill value="mobile" label="Mobile" icon={MobileMediumIcon} />
|
|
663
|
+
</PillGroup>
|
|
664
|
+
);
|
|
667
665
|
</Center>
|
|
668
666
|
</ComponentWrapper>
|
|
669
667
|
<ComponentWrapper
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import { BottomSheetModalProvider, Box
|
|
2
|
+
import { BottomSheetModalProvider, Box } from '../../src';
|
|
3
3
|
|
|
4
|
-
const UsageWrap: FC<PropsWithChildren> = ({ children }) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</div>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
4
|
+
const UsageWrap: FC<PropsWithChildren> = ({ children }) => (
|
|
5
|
+
<div className="sb-unstyled">
|
|
6
|
+
<Box
|
|
7
|
+
mt="300"
|
|
8
|
+
p="200"
|
|
9
|
+
bg="backgroundPrimary"
|
|
10
|
+
borderRadius="md"
|
|
11
|
+
borderWidth="1"
|
|
12
|
+
borderColor="borderSubtle"
|
|
13
|
+
width="100%"
|
|
14
|
+
position="relative"
|
|
15
|
+
>
|
|
16
|
+
<BottomSheetModalProvider>{children}</BottomSheetModalProvider>
|
|
17
|
+
</Box>
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
23
20
|
|
|
24
21
|
export default UsageWrap;
|
package/eslint.config.js
CHANGED
|
@@ -8,13 +8,17 @@ import globals from 'globals';
|
|
|
8
8
|
import tseslint from 'typescript-eslint';
|
|
9
9
|
|
|
10
10
|
export default tseslint.config(
|
|
11
|
-
{ ignores: ['build', 'dist', 'storybook-static'] },
|
|
11
|
+
{ ignores: ['build', 'dist', 'storybook-static', '**/*.figma.tsx'] },
|
|
12
12
|
{
|
|
13
13
|
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
14
14
|
files: ['**/*.{ts,tsx}'],
|
|
15
15
|
languageOptions: {
|
|
16
16
|
ecmaVersion: 2020,
|
|
17
17
|
globals: globals.browser,
|
|
18
|
+
parserOptions: {
|
|
19
|
+
project: './tsconfig.eslint.json',
|
|
20
|
+
tsconfigRootDir: import.meta.dirname,
|
|
21
|
+
},
|
|
18
22
|
},
|
|
19
23
|
plugins: {
|
|
20
24
|
'react-hooks': reactHooks,
|