@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
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import figma from '@figma/code-connect';
|
|
2
|
-
import Carousel from '
|
|
2
|
+
import { Carousel, CarouselItem } from '../';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
figma.connect(
|
|
5
|
+
Carousel,
|
|
6
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=5191-3220&m=dev',
|
|
7
|
+
{
|
|
8
|
+
props: {
|
|
9
|
+
inverted: figma.boolean('Inverted?'),
|
|
10
|
+
showNavigation: figma.boolean('Arrows?'),
|
|
11
|
+
},
|
|
12
|
+
example: props => (
|
|
13
|
+
// Example usage of the Carousel component
|
|
14
|
+
// See https://hearth.prod.uw.systems/react-native/?path=/docs/components-carousel--docs
|
|
15
|
+
<Carousel width={300} inverted={props.inverted} showNavigation={props.showNavigation}>
|
|
16
|
+
<CarouselItem>Item 1</CarouselItem>
|
|
17
|
+
<CarouselItem>Item 2</CarouselItem>
|
|
18
|
+
<CarouselItem>Item 3</CarouselItem>
|
|
19
|
+
</Carousel>
|
|
20
|
+
),
|
|
21
|
+
}
|
|
22
|
+
);
|
|
@@ -49,7 +49,7 @@ const Carousel = ({
|
|
|
49
49
|
...props
|
|
50
50
|
}: CarouselProps) => {
|
|
51
51
|
const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
|
|
52
|
-
const [
|
|
52
|
+
const [, setNumItems] = useState(0);
|
|
53
53
|
|
|
54
54
|
const scrollViewRef = useRef<ScrollView>(null);
|
|
55
55
|
const flatListRef = useRef<FlatList>(null);
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import figma from '@figma/code-connect';
|
|
2
2
|
import { Checkbox } from './Checkbox';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
* -- This file was auto-generated by Code Connect --
|
|
6
|
-
* `props` includes a mapping from your code props to Figma properties.
|
|
7
|
-
* You should check this is correct, and update the `example` function
|
|
8
|
-
* to return the code example you'd like to see in Figma
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
figma.connect(Checkbox, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3087%3A7316', {
|
|
4
|
+
figma.connect(Checkbox, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3087-7316', {
|
|
12
5
|
props: {
|
|
13
|
-
// These props were automatically mapped based on your linked code:
|
|
14
6
|
disabled: figma.enum('State', {
|
|
15
7
|
Disabled: true,
|
|
16
8
|
}),
|
|
17
9
|
checked: figma.boolean('Checked?'),
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
label: figma.string('Label'),
|
|
11
|
+
helperText: figma.boolean('Helper text?', {
|
|
12
|
+
true: figma.string('Helper text'),
|
|
13
|
+
false: undefined,
|
|
20
14
|
}),
|
|
21
|
-
|
|
22
|
-
// "label": figma.string('Label'),
|
|
23
|
-
// "helperText": figma.string('Helper text'),
|
|
24
|
-
// "helperText": figma.boolean('Helper text?'),
|
|
25
|
-
// "validationText": figma.string('Validation text'),
|
|
26
|
-
// "image": figma.boolean('Image?')
|
|
15
|
+
validationText: figma.string('Validation text'),
|
|
27
16
|
},
|
|
28
|
-
example: props =>
|
|
17
|
+
example: props => (
|
|
18
|
+
<Checkbox
|
|
19
|
+
disabled={props.disabled}
|
|
20
|
+
checked={props.checked}
|
|
21
|
+
label={props.label}
|
|
22
|
+
helperText={props.helperText}
|
|
23
|
+
invalidText={props.validationText}
|
|
24
|
+
/>
|
|
25
|
+
),
|
|
29
26
|
});
|
|
@@ -76,7 +76,7 @@ type Story = StoryObj<typeof meta>;
|
|
|
76
76
|
|
|
77
77
|
export const Playground: Story = {
|
|
78
78
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
79
|
-
render: ({ checked: checkedArg = false, value,
|
|
79
|
+
render: ({ checked: checkedArg = false, value, onChange, ...args }) => {
|
|
80
80
|
const [checked, setChecked] = React.useState(checkedArg);
|
|
81
81
|
useEffect(() => {
|
|
82
82
|
setChecked(checkedArg);
|
|
@@ -95,7 +95,7 @@ export const Playground: Story = {
|
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
export const WithImage: Story = {
|
|
98
|
-
render: ({
|
|
98
|
+
render: ({ ...args }) => (
|
|
99
99
|
<CheckboxGroup aria-label="Checkbox Group" nativeID="checkbox-group">
|
|
100
100
|
<Checkbox
|
|
101
101
|
aria-label="Visa"
|
|
@@ -1,20 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
import CheckboxGroup from
|
|
3
|
-
import figma from "@figma/code-connect"
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { CheckboxGroup } from '../';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
const props = {
|
|
5
|
+
label: figma.string('Group label'),
|
|
6
|
+
helperText: figma.boolean('Helper text?', {
|
|
7
|
+
true: figma.string('Helper text'),
|
|
8
|
+
false: undefined,
|
|
9
|
+
}),
|
|
10
|
+
direction: figma.enum('Direction', {
|
|
11
|
+
Column: undefined,
|
|
12
|
+
Row: 'row',
|
|
13
|
+
}),
|
|
14
|
+
tiles: figma.children('Checkbox Tile'),
|
|
15
|
+
checkboxes: figma.children('Checkbox'),
|
|
16
|
+
};
|
|
12
17
|
|
|
13
18
|
figma.connect(
|
|
14
19
|
CheckboxGroup,
|
|
15
|
-
|
|
20
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=3141-4275&m=dev',
|
|
16
21
|
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
variant: {
|
|
23
|
+
Content: 'Checkbox Tile',
|
|
24
|
+
},
|
|
25
|
+
props,
|
|
26
|
+
example: props => (
|
|
27
|
+
<CheckboxGroup
|
|
28
|
+
type="tile"
|
|
29
|
+
label={props.label}
|
|
30
|
+
helperText={props.helperText}
|
|
31
|
+
direction={props.direction}
|
|
32
|
+
>
|
|
33
|
+
{props.tiles}
|
|
34
|
+
</CheckboxGroup>
|
|
35
|
+
),
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
figma.connect(
|
|
40
|
+
CheckboxGroup,
|
|
41
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=3141-4275&m=dev',
|
|
42
|
+
{
|
|
43
|
+
variant: {
|
|
44
|
+
Content: 'Checkbox',
|
|
45
|
+
},
|
|
46
|
+
props,
|
|
47
|
+
example: props => (
|
|
48
|
+
<CheckboxGroup label={props.label} helperText={props.helperText} direction={props.direction}>
|
|
49
|
+
{props.checkboxes}
|
|
50
|
+
</CheckboxGroup>
|
|
51
|
+
),
|
|
52
|
+
}
|
|
53
|
+
);
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import figma from "@figma/code-connect"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* -- This file was auto-generated by Code Connect --
|
|
7
|
-
* None of your props could be automatically mapped to Figma properties.
|
|
8
|
-
* You should update the `props` object to include a mapping from your
|
|
9
|
-
* code props to Figma properties, and update the `example` function to
|
|
10
|
-
* return the code example you'd like to see in Figma
|
|
11
|
-
*/
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { Checkbox } from './Checkbox';
|
|
12
3
|
|
|
13
4
|
figma.connect(
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
Checkbox,
|
|
6
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=4961-23797&m=dev',
|
|
16
7
|
{
|
|
17
8
|
props: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// }),
|
|
28
|
-
// "checked": figma.boolean('Checked?')
|
|
9
|
+
disabled: figma.enum('State', {
|
|
10
|
+
Disabled: true,
|
|
11
|
+
}),
|
|
12
|
+
checked: figma.boolean('Checked?'),
|
|
13
|
+
label: figma.string('Label'),
|
|
14
|
+
helperText: figma.boolean('Helper text?', {
|
|
15
|
+
true: figma.string('Helper text'),
|
|
16
|
+
false: undefined,
|
|
17
|
+
}),
|
|
29
18
|
},
|
|
30
|
-
example:
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
example: props => (
|
|
20
|
+
<Checkbox
|
|
21
|
+
type="tile"
|
|
22
|
+
disabled={props.disabled}
|
|
23
|
+
checked={props.checked}
|
|
24
|
+
label={props.label}
|
|
25
|
+
helperText={props.helperText}
|
|
26
|
+
/>
|
|
27
|
+
),
|
|
28
|
+
}
|
|
29
|
+
);
|
|
@@ -1,56 +1,72 @@
|
|
|
1
|
-
import
|
|
2
|
-
import CurrencyInput from
|
|
3
|
-
import figma from "@figma/code-connect"
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { CurrencyInput, FormField } from '../';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const props = {
|
|
5
|
+
placeholder: figma.string('Value'),
|
|
6
|
+
value: figma.string('Value'),
|
|
7
|
+
label: figma.string('Label'),
|
|
8
|
+
helperText: figma.boolean('Helper text?', {
|
|
9
|
+
true: figma.string('Helper text'),
|
|
10
|
+
false: undefined,
|
|
11
|
+
}),
|
|
12
|
+
invalidText: figma.enum('State', {
|
|
13
|
+
Default: undefined,
|
|
14
|
+
Invalid: figma.string('Validation'),
|
|
15
|
+
}),
|
|
16
|
+
validationStatus: figma.enum('State', {
|
|
17
|
+
Default: undefined,
|
|
18
|
+
Invalid: 'invalid',
|
|
19
|
+
}),
|
|
20
|
+
// "labelVariant": figma.enum('Label variant', {
|
|
21
|
+
// "Body": "body",
|
|
22
|
+
// "Heading": "heading"
|
|
23
|
+
// })
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const onChangeHandler = () => {
|
|
27
|
+
// Placeholder for onChange handler
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const value = 'some value';
|
|
31
|
+
|
|
32
|
+
figma.connect(
|
|
33
|
+
CurrencyInput,
|
|
34
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2161%3A1336',
|
|
35
|
+
{
|
|
36
|
+
props,
|
|
37
|
+
variant: {
|
|
38
|
+
'Value type': 'Filled',
|
|
39
|
+
},
|
|
40
|
+
example: props => (
|
|
41
|
+
<FormField
|
|
42
|
+
label={props.label}
|
|
43
|
+
helperText={props.helperText}
|
|
44
|
+
invalidText={props.invalidText}
|
|
45
|
+
validationStatus={props.validationStatus}
|
|
46
|
+
>
|
|
47
|
+
<CurrencyInput value={props.value} onChange={onChangeHandler} />
|
|
48
|
+
</FormField>
|
|
49
|
+
),
|
|
50
|
+
}
|
|
51
|
+
);
|
|
11
52
|
|
|
12
53
|
figma.connect(
|
|
13
54
|
CurrencyInput,
|
|
14
|
-
|
|
55
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2161%3A1336',
|
|
15
56
|
{
|
|
16
|
-
props
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
placeholder: figma.string("Label"),
|
|
20
|
-
autoFocus: figma.boolean("Focus?"),
|
|
21
|
-
defaultValue: figma.string("Value"),
|
|
22
|
-
value: figma.string("Value"),
|
|
23
|
-
focusable: figma.boolean("Focus?"),
|
|
24
|
-
hasTVPreferredFocus: figma.boolean("Focus?"),
|
|
25
|
-
// No matching props could be found for these Figma properties:
|
|
26
|
-
// "validation": figma.string('Validation'),
|
|
27
|
-
// "helperText": figma.string('Helper text'),
|
|
28
|
-
// "label": figma.string('Label'),
|
|
29
|
-
// "value": figma.string('Value'),
|
|
30
|
-
// "helperText": figma.boolean('Helper text?'),
|
|
31
|
-
// "state": figma.enum('State', {
|
|
32
|
-
// "Default": "default",
|
|
33
|
-
// "Invalid": "invalid"
|
|
34
|
-
// }),
|
|
35
|
-
// "valueType": figma.enum('Value type', {
|
|
36
|
-
// "Placeholder": "placeholder",
|
|
37
|
-
// "Filled": "filled"
|
|
38
|
-
// }),
|
|
39
|
-
// "labelVariant": figma.enum('Label variant', {
|
|
40
|
-
// "Body": "body",
|
|
41
|
-
// "Heading": "heading"
|
|
42
|
-
// })
|
|
57
|
+
props,
|
|
58
|
+
variant: {
|
|
59
|
+
'Value type': 'Placeholder',
|
|
43
60
|
},
|
|
44
|
-
example:
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/>
|
|
61
|
+
example: props => (
|
|
62
|
+
<FormField
|
|
63
|
+
label={props.label}
|
|
64
|
+
helperText={props.helperText}
|
|
65
|
+
invalidText={props.invalidText}
|
|
66
|
+
validationStatus={props.validationStatus}
|
|
67
|
+
>
|
|
68
|
+
<CurrencyInput placeholder={props.placeholder} value={value} onChange={onChangeHandler} />
|
|
69
|
+
</FormField>
|
|
54
70
|
),
|
|
55
|
-
}
|
|
56
|
-
)
|
|
71
|
+
}
|
|
72
|
+
);
|
|
@@ -1,60 +1,72 @@
|
|
|
1
|
-
import
|
|
2
|
-
import DateInput from
|
|
3
|
-
import figma from "@figma/code-connect"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* -- This file was auto-generated by Code Connect --
|
|
7
|
-
* `props` includes a mapping from your code props to Figma properties.
|
|
8
|
-
* You should check this is correct, and update the `example` function
|
|
9
|
-
* to return the code example you'd like to see in Figma
|
|
10
|
-
*/
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { DateInput } from '../';
|
|
11
3
|
|
|
12
4
|
figma.connect(
|
|
13
5
|
DateInput,
|
|
14
|
-
|
|
6
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2277%3A14708',
|
|
15
7
|
{
|
|
16
8
|
props: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
hideDay: figma.boolean('Day?', {
|
|
10
|
+
true: false,
|
|
11
|
+
false: true,
|
|
12
|
+
}),
|
|
13
|
+
hideMonth: figma.boolean('Month?', {
|
|
14
|
+
true: false,
|
|
15
|
+
false: true,
|
|
16
|
+
}),
|
|
17
|
+
// hideYear: figma.boolean('Year?'),
|
|
18
|
+
monthPlaceholder: figma.enum('Value type', {
|
|
19
|
+
Placeholder: figma.boolean('Month?', {
|
|
20
|
+
true: figma.string('Month value'),
|
|
21
|
+
}),
|
|
22
|
+
}),
|
|
23
|
+
yearPlaceholder: figma.enum('Value type', {
|
|
24
|
+
Placeholder: figma.string('Year value'),
|
|
25
|
+
}),
|
|
26
|
+
dayPlaceholder: figma.enum('Value type', {
|
|
27
|
+
Placeholder: figma.boolean('Day?', {
|
|
28
|
+
true: figma.string('Day value'),
|
|
29
|
+
}),
|
|
30
|
+
}),
|
|
31
|
+
dayValue: figma.enum('Value type', {
|
|
32
|
+
Filled: figma.boolean('Day?', {
|
|
33
|
+
true: figma.string('Day value'),
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
monthValue: figma.enum('Value type', {
|
|
37
|
+
Filled: figma.boolean('Month?', {
|
|
38
|
+
true: figma.string('Month value'),
|
|
39
|
+
}),
|
|
40
|
+
}),
|
|
41
|
+
yearValue: figma.enum('Value type', {
|
|
42
|
+
Filled: figma.string('Year value'),
|
|
43
|
+
}),
|
|
44
|
+
disabled: figma.enum('State', {
|
|
26
45
|
Disabled: true,
|
|
27
46
|
}),
|
|
28
|
-
readonly: figma.enum(
|
|
29
|
-
|
|
47
|
+
readonly: figma.enum('State', {
|
|
48
|
+
'Read-only': true,
|
|
49
|
+
}),
|
|
50
|
+
label: figma.string('Label'),
|
|
51
|
+
helperText: figma.string('Helper text'),
|
|
52
|
+
validText: figma.enum('State', {
|
|
53
|
+
Valid: figma.string('Validation'),
|
|
54
|
+
}),
|
|
55
|
+
invalidText: figma.enum('State', {
|
|
56
|
+
Invalid: figma.string('Validation'),
|
|
57
|
+
}),
|
|
58
|
+
validationStatus: figma.enum('State', {
|
|
59
|
+
Default: undefined,
|
|
60
|
+
Valid: 'valid',
|
|
61
|
+
Invalid: 'invalid',
|
|
30
62
|
}),
|
|
31
|
-
label: figma.string("Label"),
|
|
32
|
-
helperText: figma.string("Helper text"),
|
|
33
|
-
validText: figma.string("Validation"),
|
|
34
|
-
invalidText: figma.string("Helper text"),
|
|
35
63
|
// No matching props could be found for these Figma properties:
|
|
36
|
-
// "helperText": figma.boolean('Helper text?'),
|
|
37
|
-
// "label": figma.string('Label'),
|
|
38
|
-
// "validation": figma.string('Validation'),
|
|
39
|
-
// "helperText": figma.string('Helper text'),
|
|
40
|
-
// "dayValue": figma.string('Day value'),
|
|
41
|
-
// "day": figma.boolean('Day?'),
|
|
42
|
-
// "month": figma.boolean('Month?'),
|
|
43
|
-
// "monthValue": figma.string('Month value'),
|
|
44
|
-
// "yearValue": figma.string('Year value'),
|
|
45
|
-
// "optional": figma.boolean('Optional?'),
|
|
46
|
-
// "valueType": figma.enum('Value type', {
|
|
47
|
-
// "Empty": "empty",
|
|
48
|
-
// "Placeholder": "placeholder",
|
|
49
|
-
// "Filled": "filled"
|
|
50
|
-
// }),
|
|
51
|
-
// "focus": figma.boolean('Focus?'),
|
|
52
64
|
// "labelVariant": figma.enum('Label variant', {
|
|
53
65
|
// "Body": "body",
|
|
54
66
|
// "Heading": "heading"
|
|
55
67
|
// })
|
|
56
68
|
},
|
|
57
|
-
example:
|
|
69
|
+
example: props => (
|
|
58
70
|
<DateInput
|
|
59
71
|
hideDay={props.hideDay}
|
|
60
72
|
hideMonth={props.hideMonth}
|
|
@@ -69,7 +81,8 @@ figma.connect(
|
|
|
69
81
|
helperText={props.helperText}
|
|
70
82
|
validText={props.validText}
|
|
71
83
|
invalidText={props.invalidText}
|
|
84
|
+
validationStatus={props.validationStatus}
|
|
72
85
|
/>
|
|
73
86
|
),
|
|
74
|
-
}
|
|
75
|
-
)
|
|
87
|
+
}
|
|
88
|
+
);
|
|
@@ -63,7 +63,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
63
63
|
container: {
|
|
64
64
|
flex: 1,
|
|
65
65
|
gap: theme.components.input.gap,
|
|
66
|
-
maxWidth: 96,
|
|
66
|
+
// maxWidth: 96,
|
|
67
67
|
},
|
|
68
68
|
label: {
|
|
69
69
|
variants: {
|
|
@@ -75,7 +75,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
75
75
|
},
|
|
76
76
|
},
|
|
77
77
|
input: {
|
|
78
|
-
maxWidth: 96,
|
|
78
|
+
// maxWidth: 96,
|
|
79
79
|
},
|
|
80
80
|
}));
|
|
81
81
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { DatePicker } from '../';
|
|
3
|
+
|
|
4
|
+
const selectedDate = '';
|
|
5
|
+
const handlePickerChange = () => {
|
|
6
|
+
// Placeholder for onChange handler
|
|
7
|
+
};
|
|
8
|
+
const handleCancel = () => {
|
|
9
|
+
// Placeholder for onCancel handler
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const pickerRef = () => null;
|
|
13
|
+
|
|
14
|
+
figma.connect(
|
|
15
|
+
DatePicker,
|
|
16
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR/Hearth-Components---Tokens?node-id=3797-6383&m=dev',
|
|
17
|
+
{
|
|
18
|
+
props: {
|
|
19
|
+
// "grabber": figma.boolean('Grabber?'),
|
|
20
|
+
header: figma.boolean('Header?', {
|
|
21
|
+
true: false,
|
|
22
|
+
false: true,
|
|
23
|
+
}),
|
|
24
|
+
footer: figma.boolean('Footer?', {
|
|
25
|
+
true: false,
|
|
26
|
+
false: true,
|
|
27
|
+
}),
|
|
28
|
+
initialView: figma.enum('Type', {
|
|
29
|
+
Day: undefined,
|
|
30
|
+
Month: 'month',
|
|
31
|
+
Year: 'year',
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
example: props => (
|
|
35
|
+
<DatePicker
|
|
36
|
+
ref={pickerRef}
|
|
37
|
+
mode="single"
|
|
38
|
+
date={selectedDate}
|
|
39
|
+
hideFooter={props.footer}
|
|
40
|
+
hideHeader={props.header}
|
|
41
|
+
initialView={props.initialView}
|
|
42
|
+
onChange={handlePickerChange}
|
|
43
|
+
onCancel={handleCancel}
|
|
44
|
+
/>
|
|
45
|
+
),
|
|
46
|
+
}
|
|
47
|
+
);
|
|
@@ -52,6 +52,7 @@ export interface DatePickerMultipleProps extends DatePickerBaseProps {
|
|
|
52
52
|
const DateTimePicker = (
|
|
53
53
|
props: DatePickerSingleProps | DatePickerRangeProps | DatePickerMultipleProps
|
|
54
54
|
) => {
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/prefer-as-const
|
|
55
56
|
const numerals: 'latn' = 'latn';
|
|
56
57
|
const {
|
|
57
58
|
mode = 'single',
|
|
@@ -216,26 +217,29 @@ const DateTimePicker = (
|
|
|
216
217
|
...prevState,
|
|
217
218
|
currentYear: action.payload,
|
|
218
219
|
};
|
|
219
|
-
case CalendarActionKind.CHANGE_SELECTED_DATE:
|
|
220
|
+
case CalendarActionKind.CHANGE_SELECTED_DATE: {
|
|
220
221
|
const { date: selectedDate } = action.payload;
|
|
221
222
|
return {
|
|
222
223
|
...prevState,
|
|
223
224
|
date: selectedDate,
|
|
224
225
|
currentDate: selectedDate,
|
|
225
226
|
};
|
|
226
|
-
|
|
227
|
+
}
|
|
228
|
+
case CalendarActionKind.CHANGE_SELECTED_RANGE: {
|
|
227
229
|
const { startDate: start, endDate: end } = action.payload;
|
|
228
230
|
return {
|
|
229
231
|
...prevState,
|
|
230
232
|
startDate: start,
|
|
231
233
|
endDate: end,
|
|
232
234
|
};
|
|
233
|
-
|
|
235
|
+
}
|
|
236
|
+
case CalendarActionKind.CHANGE_SELECTED_MULTIPLE: {
|
|
234
237
|
const { dates: selectedDates } = action.payload;
|
|
235
238
|
return {
|
|
236
239
|
...prevState,
|
|
237
240
|
dates: selectedDates,
|
|
238
241
|
};
|
|
242
|
+
}
|
|
239
243
|
case CalendarActionKind.RESET_STATE:
|
|
240
244
|
return action.payload;
|
|
241
245
|
default:
|
|
@@ -363,7 +367,7 @@ const DateTimePicker = (
|
|
|
363
367
|
});
|
|
364
368
|
} else if (mode === 'range') {
|
|
365
369
|
// set time to 00:00:00
|
|
366
|
-
|
|
370
|
+
const start = removeTime(stateRef.current.startDate, timeZone);
|
|
367
371
|
let end = removeTime(stateRef.current.endDate, timeZone);
|
|
368
372
|
const selected = removeTime(selectedDate, timeZone);
|
|
369
373
|
let isStart: boolean = true;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
-
import type { HeaderProps
|
|
4
|
+
import type { HeaderProps } from './DatePickerHeader.props';
|
|
5
5
|
import NextButton from './DatePickerNextButton';
|
|
6
6
|
import PrevButton from './DatePickerPrevButton';
|
|
7
7
|
import Selectors from './DatePickerSelectors';
|
|
8
8
|
|
|
9
|
-
const NavigationButtons = (
|
|
9
|
+
const NavigationButtons = () => (
|
|
10
10
|
<View style={styles.navigation}>
|
|
11
11
|
<PrevButton />
|
|
12
12
|
<NextButton />
|