react-native-exp-fig 0.1.37 → 0.1.39
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/modal-create-activitie/index.js +13 -11
- package/lib/commonjs/components/modal-create-activitie/index.js.map +1 -1
- package/lib/commonjs/components/modal-create-activitie/interface.js.map +1 -1
- package/lib/commonjs/components/modal-journey-rectification/index.js +10 -10
- package/lib/commonjs/components/modal-journey-rectification/index.js.map +1 -1
- package/lib/commonjs/components/modals/modal-activities/data-activities/index.js +25 -1
- package/lib/commonjs/components/modals/modal-activities/data-activities/index.js.map +1 -1
- package/lib/commonjs/components/modals/modal-activity-reason/index.js +6 -5
- package/lib/commonjs/components/modals/modal-activity-reason/index.js.map +1 -1
- package/lib/commonjs/components/modals/modal-activity-reason/interface.d.js.map +1 -1
- package/lib/commonjs/components/modals/modal-change-activity/index.js.map +1 -1
- package/lib/commonjs/components/selects/select-option/index.js +4 -4
- package/lib/commonjs/components/selects/select-option/index.js.map +1 -1
- package/lib/commonjs/components/selects/select-option/interface.d.js.map +1 -1
- package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js +8 -8
- package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -1
- package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js +5 -1
- package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -1
- package/lib/module/components/modal-create-activitie/index.js +13 -11
- package/lib/module/components/modal-create-activitie/index.js.map +1 -1
- package/lib/module/components/modal-create-activitie/interface.js.map +1 -1
- package/lib/module/components/modal-journey-rectification/index.js +10 -10
- package/lib/module/components/modal-journey-rectification/index.js.map +1 -1
- package/lib/module/components/modals/modal-activities/data-activities/index.js +24 -0
- package/lib/module/components/modals/modal-activities/data-activities/index.js.map +1 -1
- package/lib/module/components/modals/modal-activity-reason/index.js +6 -5
- package/lib/module/components/modals/modal-activity-reason/index.js.map +1 -1
- package/lib/module/components/modals/modal-activity-reason/interface.d.js.map +1 -1
- package/lib/module/components/modals/modal-change-activity/index.js.map +1 -1
- package/lib/module/components/selects/select-option/index.js +4 -4
- package/lib/module/components/selects/select-option/index.js.map +1 -1
- package/lib/module/components/selects/select-option/interface.d.js.map +1 -1
- package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js +8 -8
- package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -1
- package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js +5 -1
- package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -1
- package/lib/typescript/src/components/modals/modal-activities/data-activities/index.d.ts +7 -0
- package/package.json +4 -8
- package/src/components/modal-create-activitie/index.tsx +215 -211
- package/src/components/modal-create-activitie/interface.ts +22 -22
- package/src/components/modal-journey-rectification/index.tsx +213 -211
- package/src/components/modals/modal-activities/data-activities/index.ts +31 -0
- package/src/components/modals/modal-activity-reason/index.tsx +163 -162
- package/src/components/modals/modal-activity-reason/interface.d.ts +10 -10
- package/src/components/modals/modal-change-activity/index.tsx +1 -1
- package/src/components/selects/select-option/index.tsx +124 -124
- package/src/components/selects/select-option/interface.d.ts +18 -18
- package/src/stories/modal-activity-reason/modal-activity-reason.stories.tsx +192 -192
- package/src/stories/modal-create-activitie/modal-create-activitie.stories.tsx +4 -0
|
@@ -1,192 +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={(
|
|
169
|
-
// @ts-ignore
|
|
170
|
-
args?.modalConfirm?.(
|
|
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
|
+
/**
|
|
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={(value?: string) => {
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
args?.modalConfirm?.(value);
|
|
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,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-undef */
|
|
1
2
|
/**
|
|
2
3
|
* IMPORTS
|
|
3
4
|
*/
|
|
@@ -78,5 +79,8 @@ export const Aberto: Story = {
|
|
|
78
79
|
args: {
|
|
79
80
|
visible: true,
|
|
80
81
|
textTitle: "Incluir atividade",
|
|
82
|
+
onPressConfirm: (payload) => {
|
|
83
|
+
console.log("payload", payload);
|
|
84
|
+
},
|
|
81
85
|
},
|
|
82
86
|
};
|