react-native-exp-fig 0.1.9 → 0.1.10
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/package.json +1 -1
- package/src/common/icons-svg/agent/index.tsx +40 -0
- package/src/common/icons-svg/bed/index.tsx +41 -0
- package/src/common/icons-svg/car/index.tsx +29 -0
- package/src/common/icons-svg/check-outline/index.tsx +42 -0
- package/src/common/icons-svg/coffee/index.tsx +43 -0
- package/src/common/icons-svg/constants/index.ts +63 -55
- package/src/common/icons-svg/index.tsx +255 -217
- package/src/common/icons-svg/pencil/index.tsx +32 -0
- package/src/common/icons-svg/refresh-ccw-dot/index.tsx +32 -0
- package/src/common/icons-svg/truck-activity/index.tsx +29 -0
- package/src/components/activities-daily/index.tsx +116 -0
- package/src/components/activities-daily/interface.d.ts +22 -0
- package/src/components/activities-progress/index.tsx +162 -0
- package/src/components/activities-progress/interface.d.ts +41 -0
- package/src/components/avatar-profile/index.tsx +95 -0
- package/src/components/avatar-profile/interface.d.ts +39 -0
- package/src/components/card-history/index.tsx +149 -150
- package/src/components/card-loading/index.tsx +16 -1
- package/src/components/card-work-session/index.tsx +187 -185
- package/src/components/check-box/index.tsx +94 -125
- package/src/components/check-box/interface.d.ts +31 -27
- package/src/components/coil/index.tsx +3 -3
- package/src/components/coil/interface.d.ts +1 -1
- package/src/components/filter-date-selector/index.tsx +101 -89
- package/src/components/history-details/index.tsx +100 -0
- package/src/components/history-details/interface.d.ts +18 -0
- package/src/components/image-capture-with-remove/index.tsx +8 -2
- package/src/components/image-capture-with-remove/interface.d.ts +3 -0
- package/src/components/notification-loading/index.tsx +18 -7
- package/src/components/notification-loading/interface.d.ts +4 -0
- package/src/components/profile-menu-option/index.tsx +65 -0
- package/src/components/profile-menu-option/interface.d.ts +42 -0
- package/src/components/step-indicator/index.tsx +164 -164
- package/src/components/step-indicator/interface.d.ts +34 -34
- package/src/components/user-profile/index.tsx +58 -70
- package/src/index.ts +42 -37
- package/src/stories/activities-daily/activities-daily.stories.tsx +40 -0
- package/src/stories/activities-progress/activities-progress.stories.tsx +61 -0
- package/src/stories/avatar-profile/avatar-profile.stories.tsx +32 -0
- package/src/stories/card-loading/card-loading.stories.tsx +2 -2
- package/src/stories/check-box/check-box.stories.tsx +81 -83
- package/src/stories/coil/coil.stories.tsx +26 -3
- package/src/stories/filter-date-selector/filter-date-selector.stories.tsx +122 -93
- package/src/stories/history-details/history-details.stories.tsx +36 -0
- package/src/stories/image-capture-with-remove/image-capture-with-remove.stories.tsx +10 -0
- package/src/stories/notification-loading/notification-loading.stories.tsx +15 -0
- package/src/stories/profile-menu-option/profile-menu-option.stories.tsx +70 -0
- package/src/stories/step-indicator/step-indicator.stories.tsx +124 -116
- package/src/styles/theme/theme.ts +2 -0
- package/src/utils/format-data/index.ts +66 -40
- package/src/utils/status-color/return-color.ts +12 -4
package/src/index.ts
CHANGED
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EXPORTS
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Components
|
|
6
|
-
export { Box } from "./components/box";
|
|
7
|
-
export { Button } from "./components/button";
|
|
8
|
-
export { StepIndicator } from "./components/step-indicator";
|
|
9
|
-
export { Typography } from "./components/typography";
|
|
10
|
-
export { Input } from "./components/input";
|
|
11
|
-
export { CapturePhoto } from "./components/capture-photo";
|
|
12
|
-
export { CardHours } from "./components/card-hours";
|
|
13
|
-
export { SelectOption } from "./components/selects/select-option";
|
|
14
|
-
export { Header } from "./components/header-profile";
|
|
15
|
-
export { ScheduledJourneyIndicators } from "./components/scheduled-journey-indicators";
|
|
16
|
-
export { CardScheduledJourney } from "./components/card-scheduled-journey";
|
|
17
|
-
export { UserProfile } from "./components/user-profile";
|
|
18
|
-
export { MenuItem } from "./components/menu-item";
|
|
19
|
-
export { CardLoading } from "./components/card-loading";
|
|
20
|
-
export { CardWorkSession } from "./components/card-work-session";
|
|
21
|
-
export { LoadingProgress } from "./components/loading-progress";
|
|
22
|
-
export { NoData } from "./components/no-data";
|
|
23
|
-
export { FilterJourney } from "./components/filter-journey";
|
|
24
|
-
export { Coil } from "./components/coil";
|
|
25
|
-
export { FilterDateSelector } from "./components/filter-date-selector";
|
|
26
|
-
export { CardHistory } from "./components/card-history";
|
|
27
|
-
export { NotificationLoading } from "./components/notification-loading";
|
|
28
|
-
export { CheckBox } from "./components/check-box";
|
|
29
|
-
export { ImageCaptureWithRemove } from "./components/image-capture-with-remove";
|
|
30
|
-
export { LoadingDetails } from "./components/loading-details";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
/**
|
|
2
|
+
* EXPORTS
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Components
|
|
6
|
+
export { Box } from "./components/box";
|
|
7
|
+
export { Button } from "./components/button";
|
|
8
|
+
export { StepIndicator } from "./components/step-indicator";
|
|
9
|
+
export { Typography } from "./components/typography";
|
|
10
|
+
export { Input } from "./components/input";
|
|
11
|
+
export { CapturePhoto } from "./components/capture-photo";
|
|
12
|
+
export { CardHours } from "./components/card-hours";
|
|
13
|
+
export { SelectOption } from "./components/selects/select-option";
|
|
14
|
+
export { Header } from "./components/header-profile";
|
|
15
|
+
export { ScheduledJourneyIndicators } from "./components/scheduled-journey-indicators";
|
|
16
|
+
export { CardScheduledJourney } from "./components/card-scheduled-journey";
|
|
17
|
+
export { UserProfile } from "./components/user-profile";
|
|
18
|
+
export { MenuItem } from "./components/menu-item";
|
|
19
|
+
export { CardLoading } from "./components/card-loading";
|
|
20
|
+
export { CardWorkSession } from "./components/card-work-session";
|
|
21
|
+
export { LoadingProgress } from "./components/loading-progress";
|
|
22
|
+
export { NoData } from "./components/no-data";
|
|
23
|
+
export { FilterJourney } from "./components/filter-journey";
|
|
24
|
+
export { Coil } from "./components/coil";
|
|
25
|
+
export { FilterDateSelector } from "./components/filter-date-selector";
|
|
26
|
+
export { CardHistory } from "./components/card-history";
|
|
27
|
+
export { NotificationLoading } from "./components/notification-loading";
|
|
28
|
+
export { CheckBox } from "./components/check-box";
|
|
29
|
+
export { ImageCaptureWithRemove } from "./components/image-capture-with-remove";
|
|
30
|
+
export { LoadingDetails } from "./components/loading-details";
|
|
31
|
+
export { AvatarProfile } from "./components/avatar-profile";
|
|
32
|
+
export { HistoryDetails } from "./components/history-details";
|
|
33
|
+
export { ActivitiesDaily } from "./components/activities-daily";
|
|
34
|
+
export { ActivitiesProgress } from "./components/activities-progress";
|
|
35
|
+
export { ProfileMenuOption } from "./components/profile-menu-option";
|
|
36
|
+
|
|
37
|
+
// Utilities
|
|
38
|
+
export { multiply } from "./utils/mutiply";
|
|
39
|
+
export { formatDate, getLastSevenDays, formHoursMinute } from "./utils/format-data";
|
|
40
|
+
|
|
41
|
+
// Styles
|
|
42
|
+
export { theme } from "./styles/theme/theme";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
import { ActivitiesDaily } from "../../components/activities-daily";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ActivitiesDaily> = {
|
|
6
|
+
title: "componente/ActivitiesDaily",
|
|
7
|
+
component: ActivitiesDaily,
|
|
8
|
+
args: {
|
|
9
|
+
handleActivity: (typeActivity) => {
|
|
10
|
+
return typeActivity;
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
parameters: {
|
|
14
|
+
notes: `
|
|
15
|
+
# ActivitiesDaily
|
|
16
|
+
|
|
17
|
+
Este é um componente de Card de atividades diárias.
|
|
18
|
+
Você usa assim:
|
|
19
|
+
\`\`\`tsx
|
|
20
|
+
<ActivitiesDaily
|
|
21
|
+
handleActivity={handleActivity}
|
|
22
|
+
/>
|
|
23
|
+
\`\`\`
|
|
24
|
+
`,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
|
|
32
|
+
export const ActivitiesDailySimples: Story = {
|
|
33
|
+
name: "activities-daily",
|
|
34
|
+
args: {
|
|
35
|
+
handleActivity: (typeActivity: any) => {
|
|
36
|
+
/* global alert */
|
|
37
|
+
alert(typeActivity);
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
import { ActivitiesProgress } from "../../components/activities-progress";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ActivitiesProgress> = {
|
|
6
|
+
title: "componente/ActivitiesProgress",
|
|
7
|
+
component: ActivitiesProgress,
|
|
8
|
+
args: {
|
|
9
|
+
data_fim: "11/05/2025",
|
|
10
|
+
duracao: "00:30",
|
|
11
|
+
data_inicio: "17:20",
|
|
12
|
+
titleLabel: "Descanso",
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
notes: `
|
|
16
|
+
# ActivitiesProgress
|
|
17
|
+
|
|
18
|
+
Este é um componente de progresso de atividades.
|
|
19
|
+
Você usa assim:
|
|
20
|
+
\`\`\`tsx
|
|
21
|
+
<ActivitiesProgress
|
|
22
|
+
data_fim="11/05/2025"
|
|
23
|
+
duracao="00:30"
|
|
24
|
+
data_inicio="17:20"
|
|
25
|
+
titleLabel="Descanso"
|
|
26
|
+
/>
|
|
27
|
+
\`\`\`
|
|
28
|
+
`,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
33
|
+
|
|
34
|
+
type Story = StoryObj<typeof meta>;
|
|
35
|
+
|
|
36
|
+
export const ActivitiesProgressPadrao: Story = {
|
|
37
|
+
name: "activities-progress-padrao",
|
|
38
|
+
args: {},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const ActivitiesProgressTrabalho: Story = {
|
|
42
|
+
name: "activities-progress-trabalho",
|
|
43
|
+
args: {
|
|
44
|
+
data_fim: "15/06/2023",
|
|
45
|
+
duracao: "01:45",
|
|
46
|
+
data_inicio: "14:30",
|
|
47
|
+
titleLabel: "Trabalho",
|
|
48
|
+
situation: true,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const ActivitiesProgressDescanso: Story = {
|
|
53
|
+
name: "activities-progress-descanso",
|
|
54
|
+
args: {
|
|
55
|
+
data_fim: "20/07/2023",
|
|
56
|
+
duracao: "00:15",
|
|
57
|
+
data_inicio: "12:00",
|
|
58
|
+
titleLabel: "Descanso",
|
|
59
|
+
situation: true,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { AvatarProfile } from "../../components/avatar-profile";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof AvatarProfile> = {
|
|
5
|
+
title: "Componente/AvatarProfile",
|
|
6
|
+
component: AvatarProfile,
|
|
7
|
+
args: {
|
|
8
|
+
name: "Everton",
|
|
9
|
+
avatar: "https://randomuser.me/api/portraits/men/1.jpg",
|
|
10
|
+
email: "teste@gmail.com",
|
|
11
|
+
isEdit: false,
|
|
12
|
+
handleTakePicker: () => {},
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
notes: ` AvatarProfile Componente de avatar de perfil com edição opcional.`,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
name: "default",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Editable: Story = {
|
|
28
|
+
name: "editable",
|
|
29
|
+
args: {
|
|
30
|
+
isEdit: true,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -50,7 +50,7 @@ export const CardLoadingAprovado: Story = {
|
|
|
50
50
|
prevision: "12:37 10/03/2025",
|
|
51
51
|
kg: 40,
|
|
52
52
|
qtdCoils: 15,
|
|
53
|
-
status: "
|
|
53
|
+
status: "Concluido",
|
|
54
54
|
handleNavigation: () => {},
|
|
55
55
|
},
|
|
56
56
|
};
|
|
@@ -79,7 +79,7 @@ export const CardLoadingReprovado: Story = {
|
|
|
79
79
|
prevision: "12:37 10/03/2025",
|
|
80
80
|
kg: 40,
|
|
81
81
|
qtdCoils: 15,
|
|
82
|
-
status: "
|
|
82
|
+
status: "Cancelado",
|
|
83
83
|
handleNavigation: () => {},
|
|
84
84
|
},
|
|
85
85
|
};
|
|
@@ -1,83 +1,81 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { StoryObj, Meta } from "@storybook/react";
|
|
3
|
-
|
|
4
|
-
import { CheckBox } from "../../components/check-box";
|
|
5
|
-
import { theme } from "../../styles/theme/theme";
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof CheckBox> = {
|
|
8
|
-
title: "componente/CheckBox",
|
|
9
|
-
component: CheckBox as React.FC,
|
|
10
|
-
args: {
|
|
11
|
-
onPress: () => {},
|
|
12
|
-
isChecked: false,
|
|
13
|
-
backgroundColorCheck: theme.colors.blue[375],
|
|
14
|
-
},
|
|
15
|
-
parameters: {
|
|
16
|
-
notes: `
|
|
17
|
-
# CheckBox
|
|
18
|
-
|
|
19
|
-
Componente de caixa de seleção customizável com ou sem texto.
|
|
20
|
-
|
|
21
|
-
Exemplo de uso:
|
|
22
|
-
|
|
23
|
-
\`\`\`tsx
|
|
24
|
-
<CheckBox
|
|
25
|
-
isChecked={false}
|
|
26
|
-
widthBoxCheckIcon={30}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
};
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import { CheckBox } from "../../components/check-box";
|
|
5
|
+
import { theme } from "../../styles/theme/theme";
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof CheckBox> = {
|
|
8
|
+
title: "componente/CheckBox",
|
|
9
|
+
component: CheckBox as React.FC,
|
|
10
|
+
args: {
|
|
11
|
+
onPress: () => {},
|
|
12
|
+
isChecked: false,
|
|
13
|
+
backgroundColorCheck: theme.colors.blue[375],
|
|
14
|
+
},
|
|
15
|
+
parameters: {
|
|
16
|
+
notes: `
|
|
17
|
+
# CheckBox
|
|
18
|
+
|
|
19
|
+
Componente de caixa de seleção customizável com ou sem texto.
|
|
20
|
+
|
|
21
|
+
Exemplo de uso:
|
|
22
|
+
|
|
23
|
+
\`\`\`tsx
|
|
24
|
+
<CheckBox
|
|
25
|
+
isChecked={false}
|
|
26
|
+
widthBoxCheckIcon={30}
|
|
27
|
+
backgroundColorCheck={theme.colors.blue[400]}
|
|
28
|
+
textSizeLabel={16}
|
|
29
|
+
textLabel="Eu concordo com a Política de privacidade da ExpFig e dou consentimento para a coleta, e processamento e uso dos meus dados pessoais."
|
|
30
|
+
colorTextLabel={theme.colors.gray[600]}
|
|
31
|
+
backgroundBoxCheckIcon={"transparent"}
|
|
32
|
+
/>
|
|
33
|
+
\`\`\`
|
|
34
|
+
`,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default meta;
|
|
39
|
+
|
|
40
|
+
type Story = StoryObj<typeof meta>;
|
|
41
|
+
|
|
42
|
+
export const CheckBoxDisable: Story = {
|
|
43
|
+
name: "checkbox-desmarcado",
|
|
44
|
+
args: {
|
|
45
|
+
isChecked: false,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const CheckBoxAble: Story = {
|
|
50
|
+
name: "checkbox-marcado",
|
|
51
|
+
args: {
|
|
52
|
+
widthBoxCheckIcon: 40,
|
|
53
|
+
isChecked: true,
|
|
54
|
+
backgroundColorCheck: theme.colors.blue[50],
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const CheckBoxDisableWithLabel: Story = {
|
|
59
|
+
name: "checkbox-desmarcado-com-label",
|
|
60
|
+
args: {
|
|
61
|
+
widthBoxCheckIcon: 30,
|
|
62
|
+
backgroundBoxCheckIcon: "transparent",
|
|
63
|
+
textLabel:
|
|
64
|
+
"Eu concordo com a Política de privacidade da ExpFig e dou consentimento para a coleta, e processamento e uso dos meus dados pessoais.",
|
|
65
|
+
textSizeLabel: 17,
|
|
66
|
+
colorTextLabel: theme.colors.neutral[25],
|
|
67
|
+
isChecked: false,
|
|
68
|
+
backgroundColorCheck: theme.colors.blue[375],
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const CheckBoxAbleWithLabel: Story = {
|
|
73
|
+
name: "checkbox-marcado-com-label",
|
|
74
|
+
args: {
|
|
75
|
+
textLabel: "Label Checked",
|
|
76
|
+
textSizeLabel: 17,
|
|
77
|
+
colorTextLabel: theme.colors.neutral[25],
|
|
78
|
+
isChecked: true,
|
|
79
|
+
backgroundColorCheck: theme.colors.blue[375],
|
|
80
|
+
},
|
|
81
|
+
};
|
|
@@ -10,6 +10,7 @@ const meta: Meta<typeof Coil> = {
|
|
|
10
10
|
title: "HUTY-9754",
|
|
11
11
|
description: "04 de 02 fotos pendentes",
|
|
12
12
|
handleNavigation: () => {},
|
|
13
|
+
status: "Cancelado",
|
|
13
14
|
},
|
|
14
15
|
parameters: {
|
|
15
16
|
notes: `
|
|
@@ -39,7 +40,7 @@ export const CoilPending: Story = {
|
|
|
39
40
|
title: "HUTY-9754",
|
|
40
41
|
description: "04 de 02 fotos pendentes",
|
|
41
42
|
handleNavigation: () => {},
|
|
42
|
-
status: "
|
|
43
|
+
status: "Pendente",
|
|
43
44
|
},
|
|
44
45
|
};
|
|
45
46
|
|
|
@@ -49,7 +50,7 @@ export const CoilApproved: Story = {
|
|
|
49
50
|
title: "HUTY-9754",
|
|
50
51
|
description: "04 de 02 fotos pendentes",
|
|
51
52
|
handleNavigation: () => {},
|
|
52
|
-
status: "
|
|
53
|
+
status: "Concluido",
|
|
53
54
|
},
|
|
54
55
|
};
|
|
55
56
|
|
|
@@ -59,7 +60,17 @@ export const CoilRecused: Story = {
|
|
|
59
60
|
title: "HUTY-9754",
|
|
60
61
|
description: "04 de 02 fotos pendentes",
|
|
61
62
|
handleNavigation: () => {},
|
|
62
|
-
status: "
|
|
63
|
+
status: "Cancelado",
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const CoilAndamento: Story = {
|
|
68
|
+
name: "coil-andamento",
|
|
69
|
+
args: {
|
|
70
|
+
title: "HUTY-9754",
|
|
71
|
+
description: "background color diferente",
|
|
72
|
+
handleNavigation: () => {},
|
|
73
|
+
status: "Andamento",
|
|
63
74
|
},
|
|
64
75
|
};
|
|
65
76
|
|
|
@@ -70,6 +81,18 @@ export const CoilNoStatus: Story = {
|
|
|
70
81
|
description: "background color diferente",
|
|
71
82
|
handleNavigation: () => {},
|
|
72
83
|
backgroundColor: "green",
|
|
84
|
+
status: "Andamento",
|
|
73
85
|
disabled: true,
|
|
74
86
|
},
|
|
75
87
|
};
|
|
88
|
+
|
|
89
|
+
export const CoilOff: Story = {
|
|
90
|
+
name: "coil-off",
|
|
91
|
+
args: {
|
|
92
|
+
title: "HUTY-9823",
|
|
93
|
+
description: "background color diferente",
|
|
94
|
+
handleNavigation: () => {},
|
|
95
|
+
status: "Pendente",
|
|
96
|
+
backgroundColorIcon: "#fff",
|
|
97
|
+
},
|
|
98
|
+
};
|
|
@@ -1,93 +1,122 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { StoryObj, Meta } from "@storybook/react";
|
|
3
|
-
import { FilterDateSelector } from "../../components/filter-date-selector";
|
|
4
|
-
import { getLastSevenDays } from "../../utils/format-data";
|
|
5
|
-
import { ISelectedDay } from "../../components/filter-date-selector/interface";
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof FilterDateSelector> = {
|
|
8
|
-
title: "componente/FilterDateSelector",
|
|
9
|
-
component: FilterDateSelector as React.FC,
|
|
10
|
-
args: {
|
|
11
|
-
selectedDay: {
|
|
12
|
-
date: "",
|
|
13
|
-
dayName: "",
|
|
14
|
-
fullDate: new Date(""),
|
|
15
|
-
},
|
|
16
|
-
handleSelectedDay: (date: ISelectedDay) => {
|
|
17
|
-
return date;
|
|
18
|
-
},
|
|
19
|
-
days: [],
|
|
20
|
-
},
|
|
21
|
-
parameters: {
|
|
22
|
-
notes: `
|
|
23
|
-
# FilterDateSelector
|
|
24
|
-
|
|
25
|
-
Este é um componente de filtro do dias .
|
|
26
|
-
Você usa assim:
|
|
27
|
-
\`\`\`tsx
|
|
28
|
-
<FilterDateSelector
|
|
29
|
-
selectedDay={selectedDay as any}
|
|
30
|
-
handleSelectedDay={setSelectedDay as any}
|
|
31
|
-
days={days as []}
|
|
32
|
-
isLoading={false}
|
|
33
|
-
/>
|
|
34
|
-
\`\`\`
|
|
35
|
-
`,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default meta;
|
|
40
|
-
|
|
41
|
-
type Story = StoryObj<typeof meta>;
|
|
42
|
-
|
|
43
|
-
export const FilterDateSelectorSimples: Story = {
|
|
44
|
-
name: "filter-journey",
|
|
45
|
-
render: () => {
|
|
46
|
-
const [isLoading, setIsLoading] = React.useState(false);
|
|
47
|
-
const [selectedDay, setSelectedDay] = React.useState<ISelectedDay>({
|
|
48
|
-
date: "",
|
|
49
|
-
dayName: "",
|
|
50
|
-
fullDate: new Date(""),
|
|
51
|
-
});
|
|
52
|
-
const days = getLastSevenDays();
|
|
53
|
-
|
|
54
|
-
React.useEffect(() => {
|
|
55
|
-
const today = new Date();
|
|
56
|
-
|
|
57
|
-
setSelectedDay(
|
|
58
|
-
days.find(
|
|
59
|
-
(day) => day.date === today.getDate() && day.fullDate.getMonth() === today.getMonth()
|
|
60
|
-
) as any
|
|
61
|
-
);
|
|
62
|
-
}, []);
|
|
63
|
-
|
|
64
|
-
const handleSelectedDay = (day: ISelectedDay) => {
|
|
65
|
-
setSelectedDay(day);
|
|
66
|
-
setIsLoading(true);
|
|
67
|
-
|
|
68
|
-
/* global setTimeout */
|
|
69
|
-
setTimeout(() => {
|
|
70
|
-
setIsLoading(false);
|
|
71
|
-
}, 1000);
|
|
72
|
-
};
|
|
73
|
-
return (
|
|
74
|
-
<FilterDateSelector
|
|
75
|
-
selectedDay={selectedDay as any}
|
|
76
|
-
handleSelectedDay={handleSelectedDay as any}
|
|
77
|
-
days={days as []}
|
|
78
|
-
isLoading={isLoading}
|
|
79
|
-
/>
|
|
80
|
-
);
|
|
81
|
-
},
|
|
82
|
-
args: {
|
|
83
|
-
selectedDay: {
|
|
84
|
-
date: "",
|
|
85
|
-
dayName: "",
|
|
86
|
-
fullDate: new Date(""),
|
|
87
|
-
},
|
|
88
|
-
handleSelectedDay: (date: ISelectedDay) => {
|
|
89
|
-
return date;
|
|
90
|
-
},
|
|
91
|
-
days: [],
|
|
92
|
-
},
|
|
93
|
-
};
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
3
|
+
import { FilterDateSelector } from "../../components/filter-date-selector";
|
|
4
|
+
import { getLastSevenDays } from "../../utils/format-data";
|
|
5
|
+
import { ISelectedDay } from "../../components/filter-date-selector/interface";
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof FilterDateSelector> = {
|
|
8
|
+
title: "componente/FilterDateSelector",
|
|
9
|
+
component: FilterDateSelector as React.FC,
|
|
10
|
+
args: {
|
|
11
|
+
selectedDay: {
|
|
12
|
+
date: "",
|
|
13
|
+
dayName: "",
|
|
14
|
+
fullDate: new Date(""),
|
|
15
|
+
},
|
|
16
|
+
handleSelectedDay: (date: ISelectedDay) => {
|
|
17
|
+
return date;
|
|
18
|
+
},
|
|
19
|
+
days: [],
|
|
20
|
+
},
|
|
21
|
+
parameters: {
|
|
22
|
+
notes: `
|
|
23
|
+
# FilterDateSelector
|
|
24
|
+
|
|
25
|
+
Este é um componente de filtro do dias .
|
|
26
|
+
Você usa assim:
|
|
27
|
+
\`\`\`tsx
|
|
28
|
+
<FilterDateSelector
|
|
29
|
+
selectedDay={selectedDay as any}
|
|
30
|
+
handleSelectedDay={setSelectedDay as any}
|
|
31
|
+
days={days as []}
|
|
32
|
+
isLoading={false}
|
|
33
|
+
/>
|
|
34
|
+
\`\`\`
|
|
35
|
+
`,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default meta;
|
|
40
|
+
|
|
41
|
+
type Story = StoryObj<typeof meta>;
|
|
42
|
+
|
|
43
|
+
export const FilterDateSelectorSimples: Story = {
|
|
44
|
+
name: "filter-journey",
|
|
45
|
+
render: () => {
|
|
46
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
47
|
+
const [selectedDay, setSelectedDay] = React.useState<ISelectedDay>({
|
|
48
|
+
date: "",
|
|
49
|
+
dayName: "",
|
|
50
|
+
fullDate: new Date(""),
|
|
51
|
+
});
|
|
52
|
+
const days = getLastSevenDays();
|
|
53
|
+
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
const today = new Date();
|
|
56
|
+
|
|
57
|
+
setSelectedDay(
|
|
58
|
+
days.find(
|
|
59
|
+
(day) => day.date === today.getDate() && day.fullDate.getMonth() === today.getMonth()
|
|
60
|
+
) as any
|
|
61
|
+
);
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
64
|
+
const handleSelectedDay = (day: ISelectedDay) => {
|
|
65
|
+
setSelectedDay(day);
|
|
66
|
+
setIsLoading(true);
|
|
67
|
+
|
|
68
|
+
/* global setTimeout */
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
setIsLoading(false);
|
|
71
|
+
}, 1000);
|
|
72
|
+
};
|
|
73
|
+
return (
|
|
74
|
+
<FilterDateSelector
|
|
75
|
+
selectedDay={selectedDay as any}
|
|
76
|
+
handleSelectedDay={handleSelectedDay as any}
|
|
77
|
+
days={days as []}
|
|
78
|
+
isLoading={isLoading}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
args: {
|
|
83
|
+
selectedDay: {
|
|
84
|
+
date: "",
|
|
85
|
+
dayName: "",
|
|
86
|
+
fullDate: new Date(""),
|
|
87
|
+
},
|
|
88
|
+
handleSelectedDay: (date: ISelectedDay) => {
|
|
89
|
+
return date;
|
|
90
|
+
},
|
|
91
|
+
days: [],
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const FilterDateSelectorTodos: Story = {
|
|
96
|
+
name: "filter-journey-todos",
|
|
97
|
+
render: () => {
|
|
98
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
99
|
+
|
|
100
|
+
const days = getLastSevenDays() as ISelectedDay[];
|
|
101
|
+
|
|
102
|
+
const [selectedDay, setSelectedDay] = React.useState<any>(days[0]);
|
|
103
|
+
|
|
104
|
+
// Função para lidar com a seleção de um dia
|
|
105
|
+
const handleSelectedDay = (day: ISelectedDay) => {
|
|
106
|
+
setSelectedDay(day);
|
|
107
|
+
setIsLoading(true);
|
|
108
|
+
// Simula um carregamento de 1 segundo
|
|
109
|
+
setTimeout(() => setIsLoading(false), 1000);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<FilterDateSelector
|
|
114
|
+
selectedDay={selectedDay}
|
|
115
|
+
handleSelectedDay={handleSelectedDay as any}
|
|
116
|
+
days={days}
|
|
117
|
+
isLoading={isLoading}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
},
|
|
121
|
+
args: {}, // <- NÃO defina selectedDay/days aqui
|
|
122
|
+
};
|