react-native-exp-fig 0.1.26 → 0.1.28
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/lib/commonjs/components/activity-timeline/components/activite-row/index.js +130 -0
- package/lib/commonjs/components/activity-timeline/components/activite-row/index.js.map +1 -0
- package/lib/commonjs/components/activity-timeline/index.js +78 -0
- package/lib/commonjs/components/activity-timeline/index.js.map +1 -0
- package/lib/commonjs/components/activity-timeline/interface.js +6 -0
- package/lib/commonjs/components/activity-timeline/interface.js.map +1 -0
- package/lib/commonjs/components/activity-timeline/styles.js +84 -0
- package/lib/commonjs/components/activity-timeline/styles.js.map +1 -0
- package/lib/commonjs/components/input-text-counter/index.js +66 -0
- package/lib/commonjs/components/input-text-counter/index.js.map +1 -0
- package/lib/commonjs/components/input-text-counter/interface.d.js.map +1 -0
- package/lib/commonjs/components/input-text-counter/styles.js +42 -0
- package/lib/commonjs/components/input-text-counter/styles.js.map +1 -0
- package/lib/commonjs/components/modal-create-activitie/index.js +202 -0
- package/lib/commonjs/components/modal-create-activitie/index.js.map +1 -0
- package/lib/commonjs/components/modal-create-activitie/interface.js +2 -0
- package/lib/commonjs/components/modal-create-activitie/interface.js.map +1 -0
- package/lib/commonjs/components/modal-create-activitie/styles.js +42 -0
- package/lib/commonjs/components/modal-create-activitie/styles.js.map +1 -0
- package/lib/commonjs/components/modal-journey-rectification/index.js +202 -0
- package/lib/commonjs/components/modal-journey-rectification/index.js.map +1 -0
- package/lib/commonjs/components/modal-journey-rectification/interface.d.js +2 -0
- package/lib/commonjs/components/modal-journey-rectification/interface.d.js.map +1 -0
- package/lib/commonjs/components/modal-journey-rectification/styles.js +42 -0
- package/lib/commonjs/components/modal-journey-rectification/styles.js.map +1 -0
- package/lib/commonjs/components/{modal-activities → modals/modal-activities}/data-activities/index.js +2 -2
- package/lib/commonjs/components/modals/modal-activities/data-activities/index.js.map +1 -0
- package/lib/commonjs/components/{modal-activities → modals/modal-activities}/index.js +8 -8
- package/lib/commonjs/components/modals/modal-activities/index.js.map +1 -0
- package/lib/commonjs/components/modals/modal-activities/interface.d.js +6 -0
- package/lib/commonjs/components/modals/modal-activities/interface.d.js.map +1 -0
- package/lib/commonjs/components/modals/modal-activity-reason/index.js +161 -0
- package/lib/commonjs/components/modals/modal-activity-reason/index.js.map +1 -0
- package/lib/commonjs/components/modals/modal-activity-reason/interface.d.js +2 -0
- package/lib/commonjs/components/modals/modal-activity-reason/interface.d.js.map +1 -0
- package/lib/commonjs/components/{modal-change-activity → modals/modal-change-activity}/index.js +7 -7
- package/lib/commonjs/components/modals/modal-change-activity/index.js.map +1 -0
- package/lib/commonjs/components/selects/select-date-and-hours/index.js +95 -0
- package/lib/commonjs/components/selects/select-date-and-hours/index.js.map +1 -0
- package/lib/commonjs/components/selects/select-date-and-hours/interface.js +6 -0
- package/lib/commonjs/components/selects/select-date-and-hours/interface.js.map +1 -0
- package/lib/commonjs/components/selects/select-date-and-hours/styles.js +33 -0
- package/lib/commonjs/components/selects/select-date-and-hours/styles.js.map +1 -0
- package/lib/commonjs/components/selects/select-option/index.js +41 -39
- package/lib/commonjs/components/selects/select-option/index.js.map +1 -1
- package/lib/commonjs/components/step-indicator/index.js +7 -7
- package/lib/commonjs/components/step-indicator/index.js.map +1 -1
- package/lib/commonjs/index.js +39 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/stories/activity-timeline/activity-timeline.stories.js +82 -0
- package/lib/commonjs/stories/activity-timeline/activity-timeline.stories.js.map +1 -0
- package/lib/commonjs/stories/input-text-counter/input-text-counter.stories.js +259 -0
- package/lib/commonjs/stories/input-text-counter/input-text-counter.stories.js.map +1 -0
- package/lib/commonjs/stories/modal-activities/modal-activities.stories.js +1 -1
- package/lib/commonjs/stories/modal-activities/modal-activities.stories.js.map +1 -1
- package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js +198 -0
- package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -0
- package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js +3 -3
- package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -1
- package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js +86 -0
- package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -0
- package/lib/commonjs/stories/modal-journey-rectification/modal-journey-rectification.stories.js +172 -0
- package/lib/commonjs/stories/modal-journey-rectification/modal-journey-rectification.stories.js.map +1 -0
- package/lib/commonjs/stories/select-option/select-option.stories.js +3 -2
- package/lib/commonjs/stories/select-option/select-option.stories.js.map +1 -1
- package/lib/commonjs/styles/theme/theme.js +18 -2
- package/lib/commonjs/styles/theme/theme.js.map +1 -1
- package/lib/commonjs/utils/options-activity/index.js +27 -0
- package/lib/commonjs/utils/options-activity/index.js.map +1 -0
- package/lib/commonjs/utils/text-limit/index.js +37 -0
- package/lib/commonjs/utils/text-limit/index.js.map +1 -0
- package/lib/module/components/activity-timeline/components/activite-row/index.js +123 -0
- package/lib/module/components/activity-timeline/components/activite-row/index.js.map +1 -0
- package/lib/module/components/activity-timeline/index.js +70 -0
- package/lib/module/components/activity-timeline/index.js.map +1 -0
- package/lib/module/components/activity-timeline/interface.js +2 -0
- package/lib/module/components/activity-timeline/interface.js.map +1 -0
- package/lib/module/components/activity-timeline/styles.js +78 -0
- package/lib/module/components/activity-timeline/styles.js.map +1 -0
- package/lib/module/components/input-text-counter/index.js +63 -0
- package/lib/module/components/input-text-counter/index.js.map +1 -0
- package/lib/module/components/input-text-counter/interface.d.js.map +1 -0
- package/lib/module/components/input-text-counter/styles.js +37 -0
- package/lib/module/components/input-text-counter/styles.js.map +1 -0
- package/lib/module/components/modal-create-activitie/index.js +192 -0
- package/lib/module/components/modal-create-activitie/index.js.map +1 -0
- package/lib/module/components/modal-create-activitie/interface.js +2 -0
- package/lib/module/components/modal-create-activitie/interface.js.map +1 -0
- package/lib/module/components/modal-create-activitie/styles.js +37 -0
- package/lib/module/components/modal-create-activitie/styles.js.map +1 -0
- package/lib/module/components/modal-journey-rectification/index.js +192 -0
- package/lib/module/components/modal-journey-rectification/index.js.map +1 -0
- package/lib/module/components/modal-journey-rectification/interface.d.js +2 -0
- package/lib/module/components/modal-journey-rectification/interface.d.js.map +1 -0
- package/lib/module/components/modal-journey-rectification/styles.js +37 -0
- package/lib/module/components/modal-journey-rectification/styles.js.map +1 -0
- package/lib/module/components/{modal-activities → modals/modal-activities}/data-activities/index.js +2 -2
- package/lib/module/components/modals/modal-activities/data-activities/index.js.map +1 -0
- package/lib/module/components/{modal-activities → modals/modal-activities}/index.js +8 -8
- package/lib/module/components/modals/modal-activities/index.js.map +1 -0
- package/lib/module/components/modals/modal-activities/interface.d.js +2 -0
- package/lib/module/components/modals/modal-activities/interface.d.js.map +1 -0
- package/lib/module/components/modals/modal-activity-reason/index.js +151 -0
- package/lib/module/components/modals/modal-activity-reason/index.js.map +1 -0
- package/lib/module/components/modals/modal-activity-reason/interface.d.js +2 -0
- package/lib/module/components/modals/modal-activity-reason/interface.d.js.map +1 -0
- package/lib/module/components/{modal-change-activity → modals/modal-change-activity}/index.js +6 -6
- package/lib/module/components/modals/modal-change-activity/index.js.map +1 -0
- package/lib/module/components/selects/select-date-and-hours/index.js +86 -0
- package/lib/module/components/selects/select-date-and-hours/index.js.map +1 -0
- package/lib/module/components/selects/select-date-and-hours/interface.js +2 -0
- package/lib/module/components/selects/select-date-and-hours/interface.js.map +1 -0
- package/lib/module/components/selects/select-date-and-hours/styles.js +28 -0
- package/lib/module/components/selects/select-date-and-hours/styles.js.map +1 -0
- package/lib/module/components/selects/select-option/index.js +41 -42
- package/lib/module/components/selects/select-option/index.js.map +1 -1
- package/lib/module/components/step-indicator/index.js +7 -7
- package/lib/module/components/step-indicator/index.js.map +1 -1
- package/lib/module/index.js +10 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/stories/activity-timeline/activity-timeline.stories.js +75 -0
- package/lib/module/stories/activity-timeline/activity-timeline.stories.js.map +1 -0
- package/lib/module/stories/input-text-counter/input-text-counter.stories.js +253 -0
- package/lib/module/stories/input-text-counter/input-text-counter.stories.js.map +1 -0
- package/lib/module/stories/modal-activities/modal-activities.stories.js +1 -1
- package/lib/module/stories/modal-activities/modal-activities.stories.js.map +1 -1
- package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js +193 -0
- package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -0
- package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js +3 -3
- package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -1
- package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js +78 -0
- package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -0
- package/lib/module/stories/modal-journey-rectification/modal-journey-rectification.stories.js +168 -0
- package/lib/module/stories/modal-journey-rectification/modal-journey-rectification.stories.js.map +1 -0
- package/lib/module/stories/select-option/select-option.stories.js +1 -1
- package/lib/module/stories/select-option/select-option.stories.js.map +1 -1
- package/lib/module/styles/theme/theme.js +18 -2
- package/lib/module/styles/theme/theme.js.map +1 -1
- package/lib/module/utils/options-activity/index.js +22 -0
- package/lib/module/utils/options-activity/index.js.map +1 -0
- package/lib/module/utils/text-limit/index.js +30 -0
- package/lib/module/utils/text-limit/index.js.map +1 -0
- package/lib/typescript/src/components/activity-timeline/components/activite-row/index.d.ts +10 -0
- package/lib/typescript/src/components/activity-timeline/index.d.ts +16 -0
- package/lib/typescript/src/components/activity-timeline/interface.d.ts +39 -0
- package/lib/typescript/src/components/activity-timeline/styles.d.ts +71 -0
- package/lib/typescript/src/components/input-text-counter/index.d.ts +33 -0
- package/lib/typescript/src/components/input-text-counter/styles.d.ts +34 -0
- package/lib/typescript/src/components/modal-create-activitie/index.d.ts +7 -0
- package/lib/typescript/src/components/modal-create-activitie/interface.d.ts +18 -0
- package/lib/typescript/src/components/modal-create-activitie/styles.d.ts +32 -0
- package/lib/typescript/src/components/modal-journey-rectification/index.d.ts +7 -0
- package/lib/typescript/src/components/modal-journey-rectification/styles.d.ts +32 -0
- package/lib/typescript/src/components/modals/modal-activity-reason/index.d.ts +7 -0
- package/lib/typescript/src/components/selects/select-date-and-hours/index.d.ts +12 -0
- package/lib/typescript/src/components/selects/select-date-and-hours/interface.d.ts +21 -0
- package/lib/typescript/src/components/selects/select-date-and-hours/styles.d.ts +24 -0
- package/lib/typescript/src/components/selects/select-option/index.d.ts +3 -6
- package/lib/typescript/src/index.d.ts +8 -3
- package/lib/typescript/src/stories/activity-timeline/activity-timeline.stories.d.ts +8 -0
- package/lib/typescript/src/stories/input-text-counter/input-text-counter.stories.d.ts +17 -0
- package/lib/typescript/src/stories/modal-activities/modal-activities.stories.d.ts +1 -1
- package/lib/typescript/src/stories/modal-activity-reason/modal-activity-reason.stories.d.ts +15 -0
- package/lib/typescript/src/stories/modal-change-activity/modal-change-activity.stories.d.ts +1 -1
- package/lib/typescript/src/stories/modal-create-activitie/modal-create-activitie.stories.d.ts +12 -0
- package/lib/typescript/src/stories/modal-journey-rectification/modal-journey-rectification.stories.d.ts +34 -0
- package/lib/typescript/src/stories/select-option/select-option.stories.d.ts +1 -1
- package/lib/typescript/src/styles/global/theme-provider.d.ts +16 -0
- package/lib/typescript/src/styles/theme/theme.d.ts +16 -0
- package/lib/typescript/src/utils/options-activity/index.d.ts +20 -0
- package/lib/typescript/src/utils/text-limit/index.d.ts +13 -0
- package/package.json +1 -1
- package/src/components/activity-timeline/components/activite-row/index.tsx +133 -0
- package/src/components/activity-timeline/index.tsx +72 -0
- package/src/components/activity-timeline/interface.ts +53 -0
- package/src/components/activity-timeline/styles.ts +69 -0
- package/src/components/input-text-counter/index.tsx +64 -0
- package/src/components/input-text-counter/interface.d.ts +41 -0
- package/src/components/input-text-counter/styles.ts +38 -0
- package/src/components/modal-create-activitie/index.tsx +211 -0
- package/src/components/modal-create-activitie/interface.ts +22 -0
- package/src/components/modal-create-activitie/styles.ts +24 -0
- package/src/components/modal-journey-rectification/index.tsx +211 -0
- package/src/components/modal-journey-rectification/interface.d.ts +22 -0
- package/src/components/modal-journey-rectification/styles.ts +24 -0
- package/src/components/{modal-activities → modals/modal-activities}/data-activities/index.ts +65 -65
- package/src/components/{modal-activities → modals/modal-activities}/index.tsx +137 -137
- package/src/components/{modal-activities → modals/modal-activities}/interface.d.ts +32 -32
- package/src/components/modals/modal-activity-reason/index.tsx +162 -0
- package/src/components/modals/modal-activity-reason/interface.d.ts +10 -0
- package/src/components/{modal-change-activity → modals/modal-change-activity}/index.tsx +6 -6
- package/src/components/selects/select-date-and-hours/index.tsx +97 -0
- package/src/components/selects/select-date-and-hours/interface.ts +31 -0
- package/src/components/selects/select-date-and-hours/styles.ts +24 -0
- package/src/components/selects/select-option/index.tsx +50 -41
- package/src/components/step-indicator/index.tsx +235 -235
- package/src/index.ts +50 -45
- package/src/stories/activity-timeline/activity-timeline.stories.tsx +90 -0
- package/src/stories/input-text-counter/input-text-counter.stories.tsx +232 -0
- package/src/stories/modal-activities/modal-activities.stories.tsx +64 -64
- package/src/stories/modal-activity-reason/modal-activity-reason.stories.tsx +192 -0
- package/src/stories/modal-change-activity/modal-change-activity.stories.tsx +49 -49
- package/src/stories/modal-create-activitie/modal-create-activitie.stories.tsx +82 -0
- package/src/stories/modal-journey-rectification/modal-journey-rectification.stories.tsx +161 -0
- package/src/stories/select-option/select-option.stories.tsx +1 -1
- package/src/styles/theme/theme.ts +17 -0
- package/src/utils/options-activity/index.ts +14 -0
- package/src/utils/text-limit/index.ts +28 -0
- package/lib/commonjs/components/modal-activities/data-activities/index.js.map +0 -1
- package/lib/commonjs/components/modal-activities/index.js.map +0 -1
- package/lib/commonjs/components/modal-activities/interface.d.js.map +0 -1
- package/lib/commonjs/components/modal-change-activity/index.js.map +0 -1
- package/lib/module/components/modal-activities/data-activities/index.js.map +0 -1
- package/lib/module/components/modal-activities/index.js.map +0 -1
- package/lib/module/components/modal-activities/interface.d.js.map +0 -1
- package/lib/module/components/modal-change-activity/index.js.map +0 -1
- /package/lib/commonjs/components/{modal-activities → input-text-counter}/interface.d.js +0 -0
- /package/lib/module/components/{modal-activities → input-text-counter}/interface.d.js +0 -0
- /package/lib/typescript/src/components/{modal-activities → modals/modal-activities}/data-activities/index.d.ts +0 -0
- /package/lib/typescript/src/components/{modal-activities → modals/modal-activities}/index.d.ts +0 -0
- /package/lib/typescript/src/components/{modal-change-activity → modals/modal-change-activity}/index.d.ts +0 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React, { useState } from "react";
|
|
5
|
+
import { View, Text } from "react-native";
|
|
6
|
+
|
|
7
|
+
// components
|
|
8
|
+
import InputTextCounter from "../../components/input-text-counter";
|
|
9
|
+
|
|
10
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* META
|
|
14
|
+
*/
|
|
15
|
+
const meta: Meta<typeof InputTextCounter> = {
|
|
16
|
+
title: "componente/InputTextCounter",
|
|
17
|
+
component: InputTextCounter as React.FC,
|
|
18
|
+
tags: ["autodocs"],
|
|
19
|
+
args: {
|
|
20
|
+
label: "Descreva o problema encontrado",
|
|
21
|
+
placeholder: "Ex: O caminhão apresentou falha no freio durante o trajeto...",
|
|
22
|
+
// props comuns de TextInput (assumindo que o componente as repasse):
|
|
23
|
+
maxLength: 150,
|
|
24
|
+
multiline: true,
|
|
25
|
+
},
|
|
26
|
+
argTypes: {
|
|
27
|
+
label: {
|
|
28
|
+
control: { type: "text" },
|
|
29
|
+
description: "Rótulo exibido acima do campo.",
|
|
30
|
+
table: { category: "Aparência" },
|
|
31
|
+
},
|
|
32
|
+
placeholder: {
|
|
33
|
+
control: { type: "text" },
|
|
34
|
+
description: "Texto de dica quando o campo está vazio.",
|
|
35
|
+
table: { category: "Aparência" },
|
|
36
|
+
},
|
|
37
|
+
maxLength: {
|
|
38
|
+
control: { type: "number", min: 50, max: 500, step: 10 },
|
|
39
|
+
description: "Limite máximo de caracteres (ex.: 150).",
|
|
40
|
+
table: { category: "Comportamento" },
|
|
41
|
+
},
|
|
42
|
+
multiline: {
|
|
43
|
+
control: { type: "boolean" },
|
|
44
|
+
description: "Habilita múltiplas linhas para textos longos.",
|
|
45
|
+
table: { category: "Comportamento" },
|
|
46
|
+
},
|
|
47
|
+
editable: {
|
|
48
|
+
control: { type: "boolean" },
|
|
49
|
+
description: "Se falso, o campo fica somente leitura (desabilitado).",
|
|
50
|
+
table: { category: "Comportamento" },
|
|
51
|
+
},
|
|
52
|
+
defaultValue: {
|
|
53
|
+
control: { type: "text" },
|
|
54
|
+
description: "Valor inicial não controlado (apenas na montagem).",
|
|
55
|
+
table: { category: "Valor" },
|
|
56
|
+
},
|
|
57
|
+
value: {
|
|
58
|
+
control: { type: "text" },
|
|
59
|
+
description: "Valor controlado do campo. Use junto de `onChangeText` (controlado).",
|
|
60
|
+
table: { category: "Valor" },
|
|
61
|
+
},
|
|
62
|
+
onChangeText: {
|
|
63
|
+
action: "onChangeText",
|
|
64
|
+
description: "Callback disparado a cada alteração de texto.",
|
|
65
|
+
table: { category: "Eventos" },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
parameters: {
|
|
69
|
+
controls: { expanded: true },
|
|
70
|
+
layout: "centered",
|
|
71
|
+
notes: `
|
|
72
|
+
# InputTextCounter
|
|
73
|
+
|
|
74
|
+
Campo de texto **multilinha** para descrição de manutenção com **contador de caracteres** e estilo seguindo o Figma.
|
|
75
|
+
|
|
76
|
+
## ✅ Recursos
|
|
77
|
+
- **Contador dinâmico** (ex.: \`85/150\`)
|
|
78
|
+
- **Limite configurável** via \`maxLength\` (padrão: 150)
|
|
79
|
+
- **Multilinha** para textos longos
|
|
80
|
+
- **Placeholder** claro com exemplo de preenchimento
|
|
81
|
+
|
|
82
|
+
## 🔧 Props principais
|
|
83
|
+
- \`label: string\` — título acima do campo
|
|
84
|
+
- \`placeholder: string\` — dica de preenchimento
|
|
85
|
+
- \`maxLength?: number\` — limite de caracteres (ex.: 150)
|
|
86
|
+
- \`multiline?: boolean\` — permite múltiplas linhas
|
|
87
|
+
- \`editable?: boolean\` — desabilita/ativa edição
|
|
88
|
+
- \`defaultValue?: string\` — valor inicial (não controlado)
|
|
89
|
+
- \`value?: string\`, \`onChangeText?: (t: string) => void\` — modo controlado
|
|
90
|
+
|
|
91
|
+
> Observação: se o componente estende \`TextInputProps\`, essas props já são suportadas.
|
|
92
|
+
|
|
93
|
+
## 🧩 Padrões de UX
|
|
94
|
+
- Mostre o **contador** sempre que houver \`maxLength\`.
|
|
95
|
+
- Use \`placeholder\` com **exemplo concreto** (melhora taxa de preenchimento).
|
|
96
|
+
- Em formulários longos, mantenha o campo **multilinha** com altura inicial confortável.
|
|
97
|
+
|
|
98
|
+
## 🧪 Testes (ideias)
|
|
99
|
+
- Renderiza label e placeholder corretos
|
|
100
|
+
- Respeita \`maxLength\` e exibe contador
|
|
101
|
+
- Dispara \`onChangeText\` ao digitar
|
|
102
|
+
- \`editable=false\` impede edição
|
|
103
|
+
|
|
104
|
+
## 💡 Uso básico
|
|
105
|
+
\`\`\`tsx
|
|
106
|
+
<InputTextCounter
|
|
107
|
+
label="Descreva o problema encontrado"
|
|
108
|
+
placeholder="Ex: O caminhão apresentou falha no freio durante o trajeto..."
|
|
109
|
+
maxLength={150}
|
|
110
|
+
multiline
|
|
111
|
+
/>
|
|
112
|
+
\`\`\`
|
|
113
|
+
`,
|
|
114
|
+
},
|
|
115
|
+
decorators: [
|
|
116
|
+
(Story) => (
|
|
117
|
+
<View
|
|
118
|
+
style={{
|
|
119
|
+
width: 360,
|
|
120
|
+
padding: 16,
|
|
121
|
+
backgroundColor: "#F7F7F7",
|
|
122
|
+
borderRadius: 12,
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
<Story />
|
|
126
|
+
</View>
|
|
127
|
+
),
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export default meta;
|
|
132
|
+
|
|
133
|
+
type Story = StoryObj<typeof meta>;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* STORIES
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
// 1) Padrão
|
|
140
|
+
export const InputDefault: Story = {
|
|
141
|
+
name: "input-descricao-default",
|
|
142
|
+
args: {
|
|
143
|
+
label: "Descrição da manutenção",
|
|
144
|
+
placeholder: "Ex: Vazamento de óleo no motor.",
|
|
145
|
+
maxLength: 150,
|
|
146
|
+
multiline: true,
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// 2) Valor inicial (não controlado)
|
|
151
|
+
export const ComValorInicial: Story = {
|
|
152
|
+
name: "com-valor-inicial",
|
|
153
|
+
args: {
|
|
154
|
+
defaultValue:
|
|
155
|
+
"Durante o trajeto na BR-262, notei ruído metálico vindo da roda traseira direita.",
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// 3) Perto do limite (simula campo quase cheio)
|
|
160
|
+
export const PertoDoLimite: Story = {
|
|
161
|
+
name: "perto-do-limite",
|
|
162
|
+
args: {
|
|
163
|
+
maxLength: 100,
|
|
164
|
+
defaultValue: "Barulho intermitente na transmissão ao reduzir de 4ª para 3ª em descida.",
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// 4) Desabilitado / Somente leitura
|
|
169
|
+
export const Desabilitado: Story = {
|
|
170
|
+
name: "desabilitado",
|
|
171
|
+
args: {
|
|
172
|
+
editable: false,
|
|
173
|
+
placeholder: "Campo indisponível no momento",
|
|
174
|
+
},
|
|
175
|
+
parameters: {
|
|
176
|
+
docs: {
|
|
177
|
+
description: {
|
|
178
|
+
story:
|
|
179
|
+
"Use `editable={false}` para estados de checklist revisado ou quando a OS estiver bloqueada.",
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// 5) Interativo controlado (demonstração de value + onChangeText)
|
|
186
|
+
export const ControladoInterativo: Story = {
|
|
187
|
+
name: "controlado-interativo",
|
|
188
|
+
render: (args) => {
|
|
189
|
+
const Wrapper = () => {
|
|
190
|
+
const [text, setText] = useState("Inicial: ruído ao frear levemente após 20min de uso.");
|
|
191
|
+
return (
|
|
192
|
+
<View>
|
|
193
|
+
<InputTextCounter
|
|
194
|
+
{...args}
|
|
195
|
+
label={args.label ?? "Descrição"}
|
|
196
|
+
value={text}
|
|
197
|
+
onChangeText={(t: string) => {
|
|
198
|
+
setText(t);
|
|
199
|
+
// Storybook action:
|
|
200
|
+
// @ts-ignore - vincula ao painel de ações se existir
|
|
201
|
+
args?.onChangeText?.(t);
|
|
202
|
+
}}
|
|
203
|
+
/>
|
|
204
|
+
<Text style={{ marginTop: 8, fontSize: 12, color: "#666" }}>
|
|
205
|
+
{text.length}/{args.maxLength ?? 150} caracteres
|
|
206
|
+
</Text>
|
|
207
|
+
</View>
|
|
208
|
+
);
|
|
209
|
+
};
|
|
210
|
+
return <Wrapper />;
|
|
211
|
+
},
|
|
212
|
+
args: {
|
|
213
|
+
maxLength: 200,
|
|
214
|
+
multiline: true,
|
|
215
|
+
},
|
|
216
|
+
parameters: {
|
|
217
|
+
docs: {
|
|
218
|
+
description: {
|
|
219
|
+
story: "Exemplo **controlado**: o estado vive no Story e é atualizado via `onChangeText`.",
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// 6) Placeholder extenso (orientação contextual)
|
|
226
|
+
export const PlaceholderOrientativo: Story = {
|
|
227
|
+
name: "placeholder-orientativo",
|
|
228
|
+
args: {
|
|
229
|
+
placeholder:
|
|
230
|
+
"Descreva quando ocorreu, o local no veículo e se o problema é constante ou intermitente.",
|
|
231
|
+
},
|
|
232
|
+
};
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { StoryObj, Meta } from "@storybook/react";
|
|
2
|
-
import { ModalActivities } from "../../components/modal-activities";
|
|
3
|
-
import { IActivity } from "../../components/modal-activities/interface";
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof ModalActivities> = {
|
|
6
|
-
title: "componente/ModalActivities",
|
|
7
|
-
component: ModalActivities,
|
|
8
|
-
args: {
|
|
9
|
-
width: 120,
|
|
10
|
-
onClose: () => {},
|
|
11
|
-
activityType: "trabalho",
|
|
12
|
-
isLoading: false,
|
|
13
|
-
handleActivity: (activity: IActivity) => {
|
|
14
|
-
return activity;
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
parameters: {
|
|
18
|
-
notes: `
|
|
19
|
-
# MenuItem
|
|
20
|
-
|
|
21
|
-
Este é um componente de MenuItem de menu.
|
|
22
|
-
Você usa assim:
|
|
23
|
-
\`\`\`tsx
|
|
24
|
-
<ModalActivities
|
|
25
|
-
{...args}
|
|
26
|
-
activityType={activity?.tipo || "trabalho"}
|
|
27
|
-
onClose={() => setIsVisible(false)}
|
|
28
|
-
handleActivity={handleActivity}
|
|
29
|
-
/>
|
|
30
|
-
\`\`\`
|
|
31
|
-
`,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default meta;
|
|
36
|
-
|
|
37
|
-
type Story = StoryObj<typeof meta>;
|
|
38
|
-
|
|
39
|
-
export const DefaultWork: Story = {
|
|
40
|
-
name: "modal-activities-work",
|
|
41
|
-
args: {
|
|
42
|
-
isLoading: false,
|
|
43
|
-
activityType: "trabalho",
|
|
44
|
-
onClose: () => {},
|
|
45
|
-
handleActivity: (activity: IActivity) => () => {
|
|
46
|
-
return activity;
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const DefaultRest: Story = {
|
|
52
|
-
name: "modal-activities-rest",
|
|
53
|
-
args: {
|
|
54
|
-
isLoading: false,
|
|
55
|
-
activityType: "descanso",
|
|
56
|
-
style: {
|
|
57
|
-
marginLeft: 0,
|
|
58
|
-
},
|
|
59
|
-
onClose: () => {},
|
|
60
|
-
handleActivity: (activity: IActivity) => () => {
|
|
61
|
-
return activity;
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
};
|
|
1
|
+
import { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
import { ModalActivities } from "../../components/modals/modal-activities";
|
|
3
|
+
import { IActivity } from "../../components/modals/modal-activities/interface";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ModalActivities> = {
|
|
6
|
+
title: "componente/ModalActivities",
|
|
7
|
+
component: ModalActivities,
|
|
8
|
+
args: {
|
|
9
|
+
width: 120,
|
|
10
|
+
onClose: () => {},
|
|
11
|
+
activityType: "trabalho",
|
|
12
|
+
isLoading: false,
|
|
13
|
+
handleActivity: (activity: IActivity) => {
|
|
14
|
+
return activity;
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
parameters: {
|
|
18
|
+
notes: `
|
|
19
|
+
# MenuItem
|
|
20
|
+
|
|
21
|
+
Este é um componente de MenuItem de menu.
|
|
22
|
+
Você usa assim:
|
|
23
|
+
\`\`\`tsx
|
|
24
|
+
<ModalActivities
|
|
25
|
+
{...args}
|
|
26
|
+
activityType={activity?.tipo || "trabalho"}
|
|
27
|
+
onClose={() => setIsVisible(false)}
|
|
28
|
+
handleActivity={handleActivity}
|
|
29
|
+
/>
|
|
30
|
+
\`\`\`
|
|
31
|
+
`,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
|
|
37
|
+
type Story = StoryObj<typeof meta>;
|
|
38
|
+
|
|
39
|
+
export const DefaultWork: Story = {
|
|
40
|
+
name: "modal-activities-work",
|
|
41
|
+
args: {
|
|
42
|
+
isLoading: false,
|
|
43
|
+
activityType: "trabalho",
|
|
44
|
+
onClose: () => {},
|
|
45
|
+
handleActivity: (activity: IActivity) => () => {
|
|
46
|
+
return activity;
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const DefaultRest: Story = {
|
|
52
|
+
name: "modal-activities-rest",
|
|
53
|
+
args: {
|
|
54
|
+
isLoading: false,
|
|
55
|
+
activityType: "descanso",
|
|
56
|
+
style: {
|
|
57
|
+
marginLeft: 0,
|
|
58
|
+
},
|
|
59
|
+
onClose: () => {},
|
|
60
|
+
handleActivity: (activity: IActivity) => () => {
|
|
61
|
+
return activity;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React, { useState } from "react";
|
|
5
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
6
|
+
import { View, Text, Button } from "react-native";
|
|
7
|
+
|
|
8
|
+
// components
|
|
9
|
+
import ModalActivityReason from "../../components/modals/modal-activity-reason";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* META
|
|
13
|
+
*/
|
|
14
|
+
const meta: Meta<typeof ModalActivityReason> = {
|
|
15
|
+
title: "componente/ModalActivityReason",
|
|
16
|
+
component: ModalActivityReason as React.FC,
|
|
17
|
+
tags: ["autodocs"],
|
|
18
|
+
args: {
|
|
19
|
+
visible: false,
|
|
20
|
+
textTitle: undefined,
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
visible: {
|
|
24
|
+
control: { type: "boolean" },
|
|
25
|
+
description: "Controla a visibilidade do modal.",
|
|
26
|
+
table: { category: "Comportamento" },
|
|
27
|
+
},
|
|
28
|
+
textTitle: {
|
|
29
|
+
control: { type: "text" },
|
|
30
|
+
description:
|
|
31
|
+
"Título exibido no cabeçalho do modal. Se não informado, usa 'Motivo da exclusão'.",
|
|
32
|
+
table: { category: "Aparência" },
|
|
33
|
+
},
|
|
34
|
+
onClose: {
|
|
35
|
+
action: "onClose",
|
|
36
|
+
description:
|
|
37
|
+
"Chamado ao fechar/cancelar o modal. Deve alternar `visible` para `false` no uso controlado.",
|
|
38
|
+
table: { category: "Eventos" },
|
|
39
|
+
},
|
|
40
|
+
modalConfirm: {
|
|
41
|
+
action: "modalConfirm",
|
|
42
|
+
description:
|
|
43
|
+
"Chamado ao confirmar a ação. Por padrão, o componente chama `modalConfirm(true)` e em seguida `onClose()`.",
|
|
44
|
+
table: { category: "Eventos" },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
parameters: {
|
|
48
|
+
controls: { expanded: true },
|
|
49
|
+
layout: "centered",
|
|
50
|
+
docs: {
|
|
51
|
+
description: {
|
|
52
|
+
component: `
|
|
53
|
+
### ModalActivityReason
|
|
54
|
+
|
|
55
|
+
Modal para solicitar **motivo/justificativa** antes de executar uma ação crítica (ex.: excluir atividade).
|
|
56
|
+
|
|
57
|
+
#### Recursos
|
|
58
|
+
- Título personalizável via \`textTitle\`
|
|
59
|
+
- Campo de texto (interno) para descrição do motivo
|
|
60
|
+
- Botões **CANCELAR** e **CONFIRMAR**
|
|
61
|
+
- Dispara \`onClose\` e \`modalConfirm\` conforme interação do usuário
|
|
62
|
+
|
|
63
|
+
#### Props
|
|
64
|
+
- \`visible: boolean\` — controla abertura/fechamento do modal
|
|
65
|
+
- \`onClose: () => void\` — chamado ao cancelar/fechar
|
|
66
|
+
- \`modalConfirm: (ok?: boolean) => void\` — chamado ao confirmar; o componente invoca \`modalConfirm(true)\` e depois \`onClose()\`
|
|
67
|
+
- \`textTitle?: string\` — título opcional do cabeçalho
|
|
68
|
+
|
|
69
|
+
> Caso \`textTitle\` não seja informado, o título padrão é **"Motivo da exclusão"**.
|
|
70
|
+
|
|
71
|
+
#### Padrão de Uso (controlado)
|
|
72
|
+
No consumo real, gerencie o estado \`visible\` fora do componente e passe callbacks:
|
|
73
|
+
\`\`\`tsx
|
|
74
|
+
const [open, setOpen] = useState(false);
|
|
75
|
+
|
|
76
|
+
<ModalActivityReason
|
|
77
|
+
visible={open}
|
|
78
|
+
onClose={() => setOpen(false)}
|
|
79
|
+
modalConfirm={() => {
|
|
80
|
+
// enviar justificativa para API (se o componente expuser)
|
|
81
|
+
setOpen(false);
|
|
82
|
+
}}
|
|
83
|
+
textTitle="Motivo da exclusão"
|
|
84
|
+
/>
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
#### Testes (ideias)
|
|
88
|
+
- Renderiza com \`visible=true\`
|
|
89
|
+
- Exibe título padrão e título customizado
|
|
90
|
+
- Dispara \`onClose\` ao cancelar
|
|
91
|
+
- Dispara \`modalConfirm\` ao confirmar (e fecha em seguida)
|
|
92
|
+
`,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
decorators: [
|
|
97
|
+
(Story) => (
|
|
98
|
+
<View
|
|
99
|
+
style={{
|
|
100
|
+
width: 360,
|
|
101
|
+
padding: 16,
|
|
102
|
+
backgroundColor: "#F7F7F7",
|
|
103
|
+
borderRadius: 12,
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
<Story />
|
|
107
|
+
</View>
|
|
108
|
+
),
|
|
109
|
+
],
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export default meta;
|
|
113
|
+
|
|
114
|
+
type Story = StoryObj<typeof meta>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* STORIES
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
// 1) Aberto (básico)
|
|
121
|
+
export const AbertoBasico: Story = {
|
|
122
|
+
name: "aberto-basico",
|
|
123
|
+
args: {
|
|
124
|
+
visible: true,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// 2) Fechado (estado inicial comum)
|
|
129
|
+
export const Fechado: Story = {
|
|
130
|
+
name: "fechado",
|
|
131
|
+
args: {
|
|
132
|
+
visible: false,
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// 3) Com título personalizado
|
|
137
|
+
export const TituloPersonalizado: Story = {
|
|
138
|
+
name: "titulo-personalizado",
|
|
139
|
+
args: {
|
|
140
|
+
visible: true,
|
|
141
|
+
textTitle: "Justifique a alteração da atividade",
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// 4) Interativo (controlado) — demonstra fluxo completo
|
|
146
|
+
export const ControladoInterativo: Story = {
|
|
147
|
+
name: "controlado-interativo",
|
|
148
|
+
render: (args) => {
|
|
149
|
+
const Wrapper = () => {
|
|
150
|
+
const [open, setOpen] = useState(false);
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<View>
|
|
154
|
+
<Button title="Abrir modal" onPress={() => setOpen(true)} />
|
|
155
|
+
<Text style={{ marginTop: 12, fontSize: 12, color: "#666" }}>
|
|
156
|
+
Clique para abrir e testar CANCELAR/CONFIRMAR.
|
|
157
|
+
</Text>
|
|
158
|
+
|
|
159
|
+
<ModalActivityReason
|
|
160
|
+
{...args}
|
|
161
|
+
visible={open}
|
|
162
|
+
onClose={() => {
|
|
163
|
+
// aciona painel de ações do Storybook
|
|
164
|
+
// @ts-ignore
|
|
165
|
+
args?.onClose?.();
|
|
166
|
+
setOpen(false);
|
|
167
|
+
}}
|
|
168
|
+
modalConfirm={(ok?: boolean) => {
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
args?.modalConfirm?.(ok);
|
|
171
|
+
setOpen(false);
|
|
172
|
+
}}
|
|
173
|
+
textTitle={args.textTitle ?? "Motivo da exclusão"}
|
|
174
|
+
/>
|
|
175
|
+
</View>
|
|
176
|
+
);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
return <Wrapper />;
|
|
180
|
+
},
|
|
181
|
+
args: {
|
|
182
|
+
visible: false,
|
|
183
|
+
},
|
|
184
|
+
parameters: {
|
|
185
|
+
docs: {
|
|
186
|
+
description: {
|
|
187
|
+
story:
|
|
188
|
+
"Exemplo **controlado**: o estado `visible` é gerenciado no Story para simular uso real.",
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
};
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTS
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
6
|
-
|
|
7
|
-
// component
|
|
8
|
-
import { ModalChangeActivity } from "../../components/modal-change-activity";
|
|
9
|
-
|
|
10
|
-
const meta: Meta<typeof ModalChangeActivity> = {
|
|
11
|
-
title: "Componente/ModalChangeActivity",
|
|
12
|
-
component: ModalChangeActivity,
|
|
13
|
-
args: {
|
|
14
|
-
visible: true,
|
|
15
|
-
descricao: "Repouso Noturno",
|
|
16
|
-
onClose: () => {},
|
|
17
|
-
modalConfirm: () => {},
|
|
18
|
-
},
|
|
19
|
-
parameters: {
|
|
20
|
-
docs: {
|
|
21
|
-
description: {
|
|
22
|
-
component: `
|
|
23
|
-
# ModalChangeActivity
|
|
24
|
-
|
|
25
|
-
Componente de modal para alterar a atividade do usuário.
|
|
26
|
-
|
|
27
|
-
## Uso
|
|
28
|
-
\`\`\`tsx
|
|
29
|
-
<ModalChangeActivity
|
|
30
|
-
visible
|
|
31
|
-
dataRegistro="07/03/2024"
|
|
32
|
-
descricao="Repouso Noturno"
|
|
33
|
-
modalConfirm={(data) => console.log(data)}
|
|
34
|
-
onClose={() => console.log("fechar modal")}
|
|
35
|
-
/>
|
|
36
|
-
\`\`\`
|
|
37
|
-
`,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default meta;
|
|
44
|
-
|
|
45
|
-
type Story = StoryObj<typeof meta>;
|
|
46
|
-
|
|
47
|
-
export const Default: Story = {
|
|
48
|
-
name: "Modal - Alterar Descanso",
|
|
49
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
6
|
+
|
|
7
|
+
// component
|
|
8
|
+
import { ModalChangeActivity } from "../../components/modals/modal-change-activity";
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof ModalChangeActivity> = {
|
|
11
|
+
title: "Componente/ModalChangeActivity",
|
|
12
|
+
component: ModalChangeActivity,
|
|
13
|
+
args: {
|
|
14
|
+
visible: true,
|
|
15
|
+
descricao: "Repouso Noturno",
|
|
16
|
+
onClose: () => {},
|
|
17
|
+
modalConfirm: () => {},
|
|
18
|
+
},
|
|
19
|
+
parameters: {
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component: `
|
|
23
|
+
# ModalChangeActivity
|
|
24
|
+
|
|
25
|
+
Componente de modal para alterar a atividade do usuário.
|
|
26
|
+
|
|
27
|
+
## Uso
|
|
28
|
+
\`\`\`tsx
|
|
29
|
+
<ModalChangeActivity
|
|
30
|
+
visible
|
|
31
|
+
dataRegistro="07/03/2024"
|
|
32
|
+
descricao="Repouso Noturno"
|
|
33
|
+
modalConfirm={(data) => console.log(data)}
|
|
34
|
+
onClose={() => console.log("fechar modal")}
|
|
35
|
+
/>
|
|
36
|
+
\`\`\`
|
|
37
|
+
`,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default meta;
|
|
44
|
+
|
|
45
|
+
type Story = StoryObj<typeof meta>;
|
|
46
|
+
|
|
47
|
+
export const Default: Story = {
|
|
48
|
+
name: "Modal - Alterar Descanso",
|
|
49
|
+
};
|