-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathControlWrapper.stories.ts
More file actions
150 lines (142 loc) · 4.11 KB
/
ControlWrapper.stories.ts
File metadata and controls
150 lines (142 loc) · 4.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import type { Meta, StoryObj } from '@storybook/react-vite';
import ControlWrapper from '../ControlWrapper';
const meta = {
component: ControlWrapper,
title: 'ControlWrapper',
parameters: {
snapshots: {
height: 300,
},
},
} satisfies Meta<typeof ControlWrapper>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Base: Story = {
args: {
utilityFuncts: {
utilCustomFunctions: {
setState: () => {},
setErrorFieldMsg: () => {},
clearAllErrorMsg: (state) => state,
setErrorMsg: () => {},
},
handleChange: () => {},
addCustomValidator: () => {},
},
value: '',
display: true,
error: false,
entity: {
type: 'file',
label: 'Upload File',
help: "Upload service account's certificate",
field: 'single_certificate',
options: {
fileSupportMessage: 'Here is the support message',
supportedFileTypes: ['json'],
},
encrypted: true,
required: true,
defaultValue: undefined,
},
serviceName: 'settings',
mode: 'config',
disabled: false,
dependencyValues: null,
fileNameToDisplay: 'Previous File',
},
};
export const WithModifications: Story = {
args: {
...Base.args,
entity: {
field: 'url',
label: 'URL',
type: 'text',
help: 'Enter the URL, for example',
required: true,
encrypted: false,
},
modifiedEntitiesData: { required: false, label: 'Modified URL', help: 'Modified help' },
},
};
export const WithModificationsMakeRequired: Story = {
args: {
...Base.args,
entity: {
field: 'url',
label: 'URL',
type: 'text',
help: 'Enter the URL, for example',
required: false,
encrypted: false,
},
modifiedEntitiesData: {
required: true,
label: 'Modified URL',
help: 'Modified help required',
},
},
};
export const MultiLineHelpText: Story = {
args: {
...Base.args,
entity: {
field: 'url',
label: 'URL',
type: 'text',
help: 'Enter the URL, for example\nhttps://splunk.github.io/addonfactory-ucc-generator/\nhttps://github.com/splunk/addonfactory-ucc-generator',
required: false,
encrypted: false,
},
},
};
export const MultiLineHelpTextWithLinks: Story = {
args: {
...Base.args,
entity: {
field: 'url',
label: 'URL',
type: 'text',
help: {
text: 'Check [[link]] to learn more about UCC\n Also you can check this \n[[repository]]\n to view UCC generator repository',
links: [
{
slug: 'link',
link: 'https://splunk.github.io/addonfactory-ucc-generator/',
linkText: 'documentation',
},
{
slug: 'repository',
link: 'https://github.com/splunk/addonfactory-ucc-generator',
linkText: 'link',
},
],
},
required: false,
encrypted: false,
},
},
};
export const HelpWithLink: Story = {
args: {
...Base.args,
entity: {
field: 'url',
label: 'URL',
type: 'text',
help: {
text: 'Check [[link]] to learn more about UCC',
links: [
{
slug: 'link',
link: 'https://splunk.github.io/addonfactory-ucc-generator/',
linkText: 'documentation',
},
],
},
required: false,
encrypted: false,
},
},
};