@dt-dds/react-form 1.0.0-beta.27

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/CHANGELOG.md ADDED
@@ -0,0 +1,266 @@
1
+ # @dt-ui/react-form
2
+
3
+ ## 1.0.0-beta.27
4
+
5
+ ### Major Changes
6
+
7
+ - refactor!: rename pkg and publish to npmjs
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @dt-dds/react-core@1.0.0-beta.41
13
+ - @dt-dds/react-tooltip@1.0.0-beta.49
14
+ - @dt-dds/react-typography@1.0.0-beta.32
15
+
16
+ ## 0.1.0-beta.26
17
+
18
+ ### Minor Changes
19
+
20
+ - feat: add text field hover and focus
21
+
22
+ ### Patch Changes
23
+
24
+ - refactor: theme typography values
25
+ - Updated dependencies
26
+ - @dt-ui/react-core@0.1.0-beta.40
27
+ - @dt-ui/react-tooltip@0.1.0-beta.48
28
+ - @dt-ui/react-typography@0.1.0-beta.31
29
+
30
+ ## 0.1.0-beta.25
31
+
32
+ ### Minor Changes
33
+
34
+ - feat: update shadow theme values
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies
39
+ - @dt-ui/react-core@0.1.0-beta.39
40
+ - @dt-ui/react-tooltip@0.1.0-beta.47
41
+ - @dt-ui/react-typography@0.1.0-beta.30
42
+
43
+ ## 0.1.0-beta.24
44
+
45
+ ### Patch Changes
46
+
47
+ - chore: update theme font-styles
48
+ - Updated dependencies
49
+ - @dt-ui/react-core@0.1.0-beta.38
50
+ - @dt-ui/react-tooltip@0.1.0-beta.46
51
+ - @dt-ui/react-typography@0.1.0-beta.29
52
+
53
+ ## 0.1.0-beta.23
54
+
55
+ ### Patch Changes
56
+
57
+ - chore: review OSS files
58
+ - Updated dependencies
59
+ - @dt-ui/react-core@0.1.0-beta.37
60
+ - @dt-ui/react-tooltip@0.1.0-beta.45
61
+ - @dt-ui/react-typography@0.1.0-beta.28
62
+
63
+ ## 0.1.0-beta.22
64
+
65
+ ### Patch Changes
66
+
67
+ - chore: update contextual colors
68
+ - Updated dependencies
69
+ - @dt-ui/react-core@0.1.0-beta.36
70
+ - @dt-ui/react-tooltip@0.1.0-beta.44
71
+ - @dt-ui/react-typography@0.1.0-beta.27
72
+
73
+ ## 0.1.0-beta.21
74
+
75
+ ### Minor Changes
76
+
77
+ - feat: implement IconButton contrast and size
78
+
79
+ ### Patch Changes
80
+
81
+ - Updated dependencies
82
+ - @dt-ui/react-tooltip@0.1.0-beta.43
83
+
84
+ ## 0.1.0-beta.20
85
+
86
+ ### Patch Changes
87
+
88
+ - fix: circular dependencies
89
+ - Updated dependencies
90
+ - @dt-ui/react-tooltip@0.1.0-beta.42
91
+
92
+ ## 0.1.0-beta.19
93
+
94
+ ### Patch Changes
95
+
96
+ - fix: change content.light contextual color
97
+ - Updated dependencies
98
+ - @dt-ui/react-core@0.1.0-beta.35
99
+ - @dt-ui/react-tooltip@0.1.0-beta.41
100
+ - @dt-ui/react-typography@0.1.0-beta.26
101
+
102
+ ## 0.1.0-beta.18
103
+
104
+ ### Minor Changes
105
+
106
+ - feat: move icon-button to independent
107
+
108
+ ### Patch Changes
109
+
110
+ - Updated dependencies
111
+ - @dt-ui/react-tooltip@0.1.0-beta.40
112
+
113
+ ## 0.1.0-beta.17
114
+
115
+ ### Patch Changes
116
+
117
+ - fix: add accent to colors type
118
+ - Updated dependencies
119
+ - @dt-ui/react-core@0.1.0-beta.34
120
+ - @dt-ui/react-tooltip@0.1.0-beta.39
121
+ - @dt-ui/react-typography@0.1.0-beta.25
122
+
123
+ ## 0.1.0-beta.16
124
+
125
+ ### Patch Changes
126
+
127
+ - fix: change button text according to ux
128
+ - Updated dependencies
129
+ - @dt-ui/react-core@0.1.0-beta.33
130
+ - @dt-ui/react-tooltip@0.1.0-beta.38
131
+ - @dt-ui/react-typography@0.1.0-beta.24
132
+
133
+ ## 0.1.0-beta.15
134
+
135
+ ### Patch Changes
136
+
137
+ - fix: text field border style
138
+
139
+ ## 0.1.0-beta.14
140
+
141
+ ### Patch Changes
142
+
143
+ - chore: update contexual colors
144
+ - Updated dependencies
145
+ - @dt-ui/react-core@0.1.0-beta.32
146
+ - @dt-ui/react-typography@0.1.0-beta.23
147
+ - @dt-ui/react-tooltip@0.1.0-beta.37
148
+
149
+ ## 0.1.0-beta.13
150
+
151
+ ### Patch Changes
152
+
153
+ - fix: form group responsiveness
154
+
155
+ ## 0.1.0-beta.12
156
+
157
+ ### Patch Changes
158
+
159
+ - style: update responsive font styles
160
+ - Updated dependencies
161
+ - @dt-ui/react-core@0.1.0-beta.31
162
+ - @dt-ui/react-tooltip@0.1.0-beta.36
163
+ - @dt-ui/react-typography@0.1.0-beta.22
164
+
165
+ ## 0.1.0-beta.11
166
+
167
+ ### Minor Changes
168
+
169
+ - feat: add spinner size 'extra-small' & update specs
170
+
171
+ ### Patch Changes
172
+
173
+ - Updated dependencies
174
+ - @dt-ui/react-core@0.1.0-beta.30
175
+ - @dt-ui/react-tooltip@0.1.0-beta.35
176
+ - @dt-ui/react-typography@0.1.0-beta.21
177
+
178
+ ## 0.1.0-beta.10
179
+
180
+ ### Minor Changes
181
+
182
+ - feat: add backgroundFill
183
+
184
+ ## 0.1.0-beta.9
185
+
186
+ ### Patch Changes
187
+
188
+ - chore: add theme breakpoints
189
+ - Updated dependencies
190
+ - @dt-ui/react-core@0.1.0-beta.29
191
+ - @dt-ui/react-tooltip@0.1.0-beta.34
192
+ - @dt-ui/react-typography@0.1.0-beta.20
193
+
194
+ ## 0.1.0-beta.8
195
+
196
+ ### Patch Changes
197
+
198
+ - fix(DOMRect API): prevent breaking consumers CI/CD pipeline
199
+ - Updated dependencies
200
+ - @dt-ui/react-tooltip@0.1.0-beta.33
201
+
202
+ ## 0.1.0-beta.7
203
+
204
+ ### Patch Changes
205
+
206
+ - fix(tooltip): avoid browser window crop
207
+ - Updated dependencies
208
+ - @dt-ui/react-tooltip@0.1.0-beta.32
209
+
210
+ ## 0.1.0-beta.6
211
+
212
+ ### Minor Changes
213
+
214
+ - feat: add id to base props
215
+
216
+ ### Patch Changes
217
+
218
+ - Updated dependencies
219
+ - @dt-ui/react-core@0.1.0-beta.28
220
+ - @dt-ui/react-typography@0.1.0-beta.19
221
+ - @dt-ui/react-tooltip@0.1.0-beta.31
222
+
223
+ ## 0.1.0-beta.5
224
+
225
+ ### Minor Changes
226
+
227
+ - feat: change breakpoints values
228
+
229
+ ### Patch Changes
230
+
231
+ - Updated dependencies
232
+ - @dt-ui/react-core@0.1.0-beta.27
233
+ - @dt-ui/react-tooltip@0.1.0-beta.30
234
+ - @dt-ui/react-typography@0.1.0-beta.18
235
+
236
+ ## 0.1.0-beta.4
237
+
238
+ ### Patch Changes
239
+
240
+ - fix: replace body to correct one
241
+ - Updated dependencies
242
+ - @dt-ui/react-core@0.1.0-beta.26
243
+ - @dt-ui/react-tooltip@0.1.0-beta.29
244
+ - @dt-ui/react-typography@0.1.0-beta.17
245
+
246
+ ## 0.1.0-beta.3
247
+
248
+ ### Patch Changes
249
+
250
+ - chore: add theme colors missing types
251
+ - Updated dependencies
252
+ - @dt-ui/react-core@0.1.0-beta.25
253
+ - @dt-ui/react-tooltip@0.1.0-beta.28
254
+ - @dt-ui/react-typography@0.1.0-beta.16
255
+
256
+ ## 0.1.0-beta.2
257
+
258
+ ### Minor Changes
259
+
260
+ - feat: add search functionality to text-field
261
+
262
+ ## 0.1.0-beta.1
263
+
264
+ ### Minor Changes
265
+
266
+ - feat: reinstate the form component
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Daimler Truck AG.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # Form
2
+
3
+ The Form component is used to gather user input and submit it to the backend. It supports various form controls and can group multiple fields using Form.Group. Each group can have a title, be disabled, and include a tooltip for extra information. The form's onSubmit function handles form submissions, and additional customization can be applied through the style and dataTestId properties.
4
+
5
+ ## Usage
6
+
7
+ ```jsx
8
+ import { Form, TextField } from '@dt-dds/react';
9
+
10
+ export const App = () => {
11
+ return (
12
+ <Form>
13
+ <TextField label='label 1' />
14
+ </Form>
15
+ );
16
+ };
17
+ ```
18
+
19
+ Also, you can use form groups to group a bunch of fields.
20
+
21
+ ```jsx
22
+ import { Form, TextField } from '@dt-dds/react';
23
+
24
+ export const App = () => {
25
+ return (
26
+ <Form>
27
+ <Form.FormGroup>
28
+ <TextField label='label 1' />
29
+ <TextField label='label 2' />
30
+ </Form.FormGroup>
31
+ </Form>
32
+ );
33
+ };
34
+ ```
35
+
36
+ ## API
37
+
38
+ ### Form
39
+
40
+ | Property | Type | Default | Description |
41
+ | ------------ | ---------------------------------------------- | ------- | ------------------------------- |
42
+ | `children` | `ReactNode` | - | Child components to be rendered |
43
+ | `dataTestId` | `string` | toggle | Toggle test identifier |
44
+ | `style` | `React.CSSProperties` | - | Gives the Form css properties |
45
+ | `onSubmit` | `(event: FormEvent<HTMLFormElement>) => void;` | - | The HTML form submit handler. |
46
+
47
+ ### Form.Group
48
+
49
+ | Property | Type | Default | Description |
50
+ | ---------- | ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
51
+ | `children` | `ReactNode` | - | Child components to be rendered |
52
+ | `title` | `string` | - | Title to be shown at the top of the group |
53
+ | `disabled` | `boolean` | - | If group is disabled, a opacity is set and the pointer events set to none |
54
+ | `tooltip` | `string` | - | If a string is passed to this prop, a info svg will be rendered wrapped in a tooltip. The tooltip content will be the value of this prop. |
55
+
56
+ ## &copy; License
57
+
58
+ Licensed under [MIT License](LICENSE.md)
@@ -0,0 +1,23 @@
1
+ import { BaseProps, Theme } from '@dt-dds/react-core';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { ReactNode, FormEvent } from 'react';
4
+
5
+ interface GroupProps extends BaseProps {
6
+ isDisabled?: boolean;
7
+ title?: string;
8
+ tooltip?: ReactNode;
9
+ }
10
+ interface FormProps extends BaseProps {
11
+ onSubmit?: (event: FormEvent<HTMLFormElement>) => void;
12
+ }
13
+ declare const Form: {
14
+ ({ children, dataTestId, style, onSubmit, }: FormProps): react_jsx_runtime.JSX.Element;
15
+ Group({ children, isDisabled, title, tooltip }: GroupProps): react_jsx_runtime.JSX.Element;
16
+ };
17
+
18
+ declare module '@emotion/react' {
19
+ interface Theme extends Theme {
20
+ }
21
+ }
22
+
23
+ export { Form, FormProps, GroupProps };
package/dist/index.js ADDED
@@ -0,0 +1,330 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __export = (target, all) => {
26
+ for (var name in all)
27
+ __defProp(target, name, { get: all[name], enumerable: true });
28
+ };
29
+ var __copyProps = (to, from, except, desc) => {
30
+ if (from && typeof from === "object" || typeof from === "function") {
31
+ for (let key of __getOwnPropNames(from))
32
+ if (!__hasOwnProp.call(to, key) && key !== except)
33
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
+ }
35
+ return to;
36
+ };
37
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
+ // If the importer is in node compatibility mode or this is not an ESM
39
+ // file that has been converted to a CommonJS file using a Babel-
40
+ // compatible transform (i.e. "__esModule" has not been set), then set
41
+ // "default" to the CommonJS "module.exports" for node compatibility.
42
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
+ mod
44
+ ));
45
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
+
47
+ // index.ts
48
+ var form_exports = {};
49
+ __export(form_exports, {
50
+ Form: () => Form
51
+ });
52
+ module.exports = __toCommonJS(form_exports);
53
+
54
+ // src/Form.tsx
55
+ var import_react_tooltip = require("@dt-dds/react-tooltip");
56
+ var import_react_typography = require("@dt-dds/react-typography");
57
+
58
+ // ../../dt-dds-react/core/assets/svgs/AllOut.tsx
59
+ var import_jsx_runtime = require("react/jsx-runtime");
60
+
61
+ // ../../dt-dds-react/core/assets/svgs/Apis.tsx
62
+ var import_jsx_runtime2 = require("react/jsx-runtime");
63
+
64
+ // ../../dt-dds-react/core/assets/svgs/Apps.tsx
65
+ var import_jsx_runtime3 = require("react/jsx-runtime");
66
+
67
+ // ../../dt-dds-react/core/assets/svgs/ArrowDropDown.tsx
68
+ var import_jsx_runtime4 = require("react/jsx-runtime");
69
+
70
+ // ../../dt-dds-react/core/assets/svgs/ArrowDropUp.tsx
71
+ var import_jsx_runtime5 = require("react/jsx-runtime");
72
+
73
+ // ../../dt-dds-react/core/assets/svgs/ArrowLeft.tsx
74
+ var import_jsx_runtime6 = require("react/jsx-runtime");
75
+
76
+ // ../../dt-dds-react/core/assets/svgs/ArrowRight.tsx
77
+ var import_jsx_runtime7 = require("react/jsx-runtime");
78
+
79
+ // ../../dt-dds-react/core/assets/svgs/AvatarThumbnail.tsx
80
+ var import_jsx_runtime8 = require("react/jsx-runtime");
81
+
82
+ // ../../dt-dds-react/core/assets/svgs/Bolt.tsx
83
+ var import_jsx_runtime9 = require("react/jsx-runtime");
84
+
85
+ // ../../dt-dds-react/core/assets/svgs/CalendarMonth.tsx
86
+ var import_jsx_runtime10 = require("react/jsx-runtime");
87
+
88
+ // ../../dt-dds-react/core/assets/svgs/Cancel.tsx
89
+ var import_jsx_runtime11 = require("react/jsx-runtime");
90
+
91
+ // ../../dt-dds-react/core/assets/svgs/Check.tsx
92
+ var import_jsx_runtime12 = require("react/jsx-runtime");
93
+
94
+ // ../../dt-dds-react/core/assets/svgs/CheckCircle.tsx
95
+ var import_jsx_runtime13 = require("react/jsx-runtime");
96
+
97
+ // ../../dt-dds-react/core/assets/svgs/CheckCircleOutline.tsx
98
+ var import_jsx_runtime14 = require("react/jsx-runtime");
99
+
100
+ // ../../dt-dds-react/core/assets/svgs/Close.tsx
101
+ var import_jsx_runtime15 = require("react/jsx-runtime");
102
+
103
+ // ../../dt-dds-react/core/assets/svgs/Copy.tsx
104
+ var import_jsx_runtime16 = require("react/jsx-runtime");
105
+
106
+ // ../../dt-dds-react/core/assets/svgs/Delete.tsx
107
+ var import_jsx_runtime17 = require("react/jsx-runtime");
108
+
109
+ // ../../dt-dds-react/core/assets/svgs/Edit.tsx
110
+ var import_jsx_runtime18 = require("react/jsx-runtime");
111
+
112
+ // ../../dt-dds-react/core/assets/svgs/Email.tsx
113
+ var import_jsx_runtime19 = require("react/jsx-runtime");
114
+
115
+ // ../../dt-dds-react/core/assets/svgs/EmailSend.tsx
116
+ var import_jsx_runtime20 = require("react/jsx-runtime");
117
+
118
+ // ../../dt-dds-react/core/assets/svgs/Error.tsx
119
+ var import_react = require("@emotion/react");
120
+ var import_jsx_runtime21 = require("react/jsx-runtime");
121
+
122
+ // ../../dt-dds-react/core/assets/svgs/ErrorOutline.tsx
123
+ var import_jsx_runtime22 = require("react/jsx-runtime");
124
+
125
+ // ../../dt-dds-react/core/assets/svgs/EVStation.tsx
126
+ var import_jsx_runtime23 = require("react/jsx-runtime");
127
+
128
+ // ../../dt-dds-react/core/assets/svgs/Info.tsx
129
+ var import_jsx_runtime24 = require("react/jsx-runtime");
130
+ var Info = (props) => {
131
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
132
+ "svg",
133
+ __spreadProps(__spreadValues({
134
+ fill: "currentColor",
135
+ height: "24",
136
+ viewBox: "0 0 24 24",
137
+ width: "24",
138
+ xmlns: "http://www.w3.org/2000/svg"
139
+ }, props), {
140
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM13 17H11V11H13V17ZM13 9H11V7H13V9Z" })
141
+ })
142
+ );
143
+ };
144
+ var Info_default = Info;
145
+
146
+ // ../../dt-dds-react/core/assets/svgs/InfoOutline.tsx
147
+ var import_jsx_runtime25 = require("react/jsx-runtime");
148
+
149
+ // ../../dt-dds-react/core/assets/svgs/Input.tsx
150
+ var import_jsx_runtime26 = require("react/jsx-runtime");
151
+
152
+ // ../../dt-dds-react/core/assets/svgs/Language.tsx
153
+ var import_jsx_runtime27 = require("react/jsx-runtime");
154
+
155
+ // ../../dt-dds-react/core/assets/svgs/LocationOn.tsx
156
+ var import_jsx_runtime28 = require("react/jsx-runtime");
157
+
158
+ // ../../dt-dds-react/core/assets/svgs/LocationSearching.tsx
159
+ var import_jsx_runtime29 = require("react/jsx-runtime");
160
+
161
+ // ../../dt-dds-react/core/assets/svgs/MenuCompact.tsx
162
+ var import_jsx_runtime30 = require("react/jsx-runtime");
163
+
164
+ // ../../dt-dds-react/core/assets/svgs/MenuExpand.tsx
165
+ var import_jsx_runtime31 = require("react/jsx-runtime");
166
+
167
+ // ../../dt-dds-react/core/assets/svgs/Menu.tsx
168
+ var import_jsx_runtime32 = require("react/jsx-runtime");
169
+
170
+ // ../../dt-dds-react/core/assets/svgs/MoreHorizontal.tsx
171
+ var import_jsx_runtime33 = require("react/jsx-runtime");
172
+
173
+ // ../../dt-dds-react/core/assets/svgs/MoreVertical.tsx
174
+ var import_jsx_runtime34 = require("react/jsx-runtime");
175
+
176
+ // ../../dt-dds-react/core/assets/svgs/NoData.tsx
177
+ var import_react2 = require("@emotion/react");
178
+ var import_jsx_runtime35 = require("react/jsx-runtime");
179
+
180
+ // ../../dt-dds-react/core/assets/svgs/NotFound.tsx
181
+ var import_jsx_runtime36 = require("react/jsx-runtime");
182
+
183
+ // ../../dt-dds-react/core/assets/svgs/OutlinedArrowDropDown.tsx
184
+ var import_jsx_runtime37 = require("react/jsx-runtime");
185
+
186
+ // ../../dt-dds-react/core/assets/svgs/OutlinedArrowDropUp.tsx
187
+ var import_jsx_runtime38 = require("react/jsx-runtime");
188
+
189
+ // ../../dt-dds-react/core/assets/svgs/PhoneOutlined.tsx
190
+ var import_jsx_runtime39 = require("react/jsx-runtime");
191
+
192
+ // ../../dt-dds-react/core/assets/svgs/Payments.tsx
193
+ var import_jsx_runtime40 = require("react/jsx-runtime");
194
+
195
+ // ../../dt-dds-react/core/assets/svgs/Products.tsx
196
+ var import_jsx_runtime41 = require("react/jsx-runtime");
197
+
198
+ // ../../dt-dds-react/core/assets/svgs/RemoveCircleOutline.tsx
199
+ var import_jsx_runtime42 = require("react/jsx-runtime");
200
+
201
+ // ../../dt-dds-react/core/assets/svgs/Share.tsx
202
+ var import_jsx_runtime43 = require("react/jsx-runtime");
203
+
204
+ // ../../dt-dds-react/core/assets/svgs/Signout.tsx
205
+ var import_jsx_runtime44 = require("react/jsx-runtime");
206
+
207
+ // ../../dt-dds-react/core/assets/svgs/Teams.tsx
208
+ var import_jsx_runtime45 = require("react/jsx-runtime");
209
+
210
+ // ../../dt-dds-react/core/assets/svgs/Timeline.tsx
211
+ var import_jsx_runtime46 = require("react/jsx-runtime");
212
+
213
+ // ../../dt-dds-react/core/assets/svgs/Topic.tsx
214
+ var import_jsx_runtime47 = require("react/jsx-runtime");
215
+
216
+ // ../../dt-dds-react/core/assets/svgs/UnfoldLess.tsx
217
+ var import_jsx_runtime48 = require("react/jsx-runtime");
218
+
219
+ // ../../dt-dds-react/core/assets/svgs/UnfoldMore.tsx
220
+ var import_jsx_runtime49 = require("react/jsx-runtime");
221
+
222
+ // ../../dt-dds-react/core/assets/svgs/Username.tsx
223
+ var import_jsx_runtime50 = require("react/jsx-runtime");
224
+
225
+ // ../../dt-dds-react/core/assets/svgs/ViewAgenda.tsx
226
+ var import_jsx_runtime51 = require("react/jsx-runtime");
227
+
228
+ // ../../dt-dds-react/core/assets/svgs/Visibility.tsx
229
+ var import_jsx_runtime52 = require("react/jsx-runtime");
230
+
231
+ // ../../dt-dds-react/core/assets/svgs/VisibilityOff.tsx
232
+ var import_jsx_runtime53 = require("react/jsx-runtime");
233
+
234
+ // ../../dt-dds-react/core/assets/svgs/WarningOutline.tsx
235
+ var import_jsx_runtime54 = require("react/jsx-runtime");
236
+
237
+ // ../../dt-dds-react/core/assets/svgs/Warning.tsx
238
+ var import_jsx_runtime55 = require("react/jsx-runtime");
239
+
240
+ // ../../dt-dds-react/core/assets/svgs/Wifi.tsx
241
+ var import_jsx_runtime56 = require("react/jsx-runtime");
242
+
243
+ // ../../dt-dds-react/core/assets/svgs/Settings.tsx
244
+ var import_jsx_runtime57 = require("react/jsx-runtime");
245
+
246
+ // src/Form.styled.ts
247
+ var import_styled = __toESM(require("@emotion/styled"));
248
+ var FormStyled = import_styled.default.form`
249
+ display: flex;
250
+ flex-direction: column;
251
+ width: 100%;
252
+ row-gap: ${({ theme }) => theme.spacing.medium};
253
+ `;
254
+ var GroupStyled = import_styled.default.div`
255
+ ${({ theme }) => `
256
+ row-gap: ${theme.spacing.xmedium};
257
+ display: flex;
258
+ flex-direction: column;
259
+ width: 100%;
260
+ color: ${theme.palette.content.default};
261
+ `}
262
+ `;
263
+ var LabelStyled = import_styled.default.div`
264
+ display: flex;
265
+ flex-direction: row;
266
+ column-gap: 10px;
267
+ align-items: center;
268
+ `;
269
+ var GroupItemsStyled = import_styled.default.div`
270
+ ${({ theme, disabled }) => `
271
+ display: flex;
272
+ gap: ${theme.spacing.xmedium};
273
+ justify-content: stretch;
274
+ align-items: start;
275
+ flex-direction: column;
276
+
277
+ @media only screen and (min-width: ${theme.breakpoints.mq3}px) {
278
+ flex-direction: row;
279
+ }
280
+
281
+ ${disabled && `
282
+ opacity: 0.5;
283
+ pointer-events: none;
284
+ `}
285
+ `}
286
+ `;
287
+
288
+ // src/Form.tsx
289
+ var import_jsx_runtime58 = require("react/jsx-runtime");
290
+ var DEFAULT_ON_SUBMIT = (event) => event.preventDefault();
291
+ var Form = ({
292
+ children,
293
+ dataTestId,
294
+ style,
295
+ onSubmit = DEFAULT_ON_SUBMIT
296
+ }) => {
297
+ const testId = dataTestId != null ? dataTestId : "test-form";
298
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(FormStyled, { "data-testid": testId, onSubmit, style, children });
299
+ };
300
+ Form.Group = ({ children, isDisabled, title, tooltip }) => {
301
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(GroupStyled, { children: [
302
+ title ? /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(LabelStyled, { children: [
303
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
304
+ import_react_typography.Typography,
305
+ {
306
+ color: "primary.default",
307
+ fontStyles: "h6",
308
+ style: { textTransform: "uppercase" },
309
+ children: title
310
+ }
311
+ ),
312
+ tooltip ? /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_react_tooltip.Tooltip, { children: [
313
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Info_default, { height: "16", width: "16" }),
314
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
315
+ import_react_tooltip.Tooltip.Content,
316
+ {
317
+ direction: import_react_tooltip.OTooltipDirection.Right,
318
+ style: { maxWidth: 250 },
319
+ children: tooltip
320
+ }
321
+ )
322
+ ] }) : null
323
+ ] }) : null,
324
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(GroupItemsStyled, { disabled: isDisabled, children })
325
+ ] });
326
+ };
327
+ // Annotate the CommonJS export names for ESM import in node:
328
+ 0 && (module.exports = {
329
+ Form
330
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,296 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+
21
+ // src/Form.tsx
22
+ import { OTooltipDirection, Tooltip } from "@dt-dds/react-tooltip";
23
+ import { Typography } from "@dt-dds/react-typography";
24
+
25
+ // ../../dt-dds-react/core/assets/svgs/AllOut.tsx
26
+ import { jsx, jsxs } from "react/jsx-runtime";
27
+
28
+ // ../../dt-dds-react/core/assets/svgs/Apis.tsx
29
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
30
+
31
+ // ../../dt-dds-react/core/assets/svgs/Apps.tsx
32
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
33
+
34
+ // ../../dt-dds-react/core/assets/svgs/ArrowDropDown.tsx
35
+ import { jsx as jsx4 } from "react/jsx-runtime";
36
+
37
+ // ../../dt-dds-react/core/assets/svgs/ArrowDropUp.tsx
38
+ import { jsx as jsx5 } from "react/jsx-runtime";
39
+
40
+ // ../../dt-dds-react/core/assets/svgs/ArrowLeft.tsx
41
+ import { jsx as jsx6 } from "react/jsx-runtime";
42
+
43
+ // ../../dt-dds-react/core/assets/svgs/ArrowRight.tsx
44
+ import { jsx as jsx7 } from "react/jsx-runtime";
45
+
46
+ // ../../dt-dds-react/core/assets/svgs/AvatarThumbnail.tsx
47
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
48
+
49
+ // ../../dt-dds-react/core/assets/svgs/Bolt.tsx
50
+ import { jsx as jsx9 } from "react/jsx-runtime";
51
+
52
+ // ../../dt-dds-react/core/assets/svgs/CalendarMonth.tsx
53
+ import { jsx as jsx10 } from "react/jsx-runtime";
54
+
55
+ // ../../dt-dds-react/core/assets/svgs/Cancel.tsx
56
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
57
+
58
+ // ../../dt-dds-react/core/assets/svgs/Check.tsx
59
+ import { jsx as jsx12 } from "react/jsx-runtime";
60
+
61
+ // ../../dt-dds-react/core/assets/svgs/CheckCircle.tsx
62
+ import { jsx as jsx13 } from "react/jsx-runtime";
63
+
64
+ // ../../dt-dds-react/core/assets/svgs/CheckCircleOutline.tsx
65
+ import { jsx as jsx14 } from "react/jsx-runtime";
66
+
67
+ // ../../dt-dds-react/core/assets/svgs/Close.tsx
68
+ import { jsx as jsx15 } from "react/jsx-runtime";
69
+
70
+ // ../../dt-dds-react/core/assets/svgs/Copy.tsx
71
+ import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
72
+
73
+ // ../../dt-dds-react/core/assets/svgs/Delete.tsx
74
+ import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
75
+
76
+ // ../../dt-dds-react/core/assets/svgs/Edit.tsx
77
+ import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
78
+
79
+ // ../../dt-dds-react/core/assets/svgs/Email.tsx
80
+ import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
81
+
82
+ // ../../dt-dds-react/core/assets/svgs/EmailSend.tsx
83
+ import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
84
+
85
+ // ../../dt-dds-react/core/assets/svgs/Error.tsx
86
+ import { useTheme } from "@emotion/react";
87
+ import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
88
+
89
+ // ../../dt-dds-react/core/assets/svgs/ErrorOutline.tsx
90
+ import { jsx as jsx22 } from "react/jsx-runtime";
91
+
92
+ // ../../dt-dds-react/core/assets/svgs/EVStation.tsx
93
+ import { jsx as jsx23 } from "react/jsx-runtime";
94
+
95
+ // ../../dt-dds-react/core/assets/svgs/Info.tsx
96
+ import { jsx as jsx24 } from "react/jsx-runtime";
97
+ var Info = (props) => {
98
+ return /* @__PURE__ */ jsx24(
99
+ "svg",
100
+ __spreadProps(__spreadValues({
101
+ fill: "currentColor",
102
+ height: "24",
103
+ viewBox: "0 0 24 24",
104
+ width: "24",
105
+ xmlns: "http://www.w3.org/2000/svg"
106
+ }, props), {
107
+ children: /* @__PURE__ */ jsx24("path", { d: "M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM13 17H11V11H13V17ZM13 9H11V7H13V9Z" })
108
+ })
109
+ );
110
+ };
111
+ var Info_default = Info;
112
+
113
+ // ../../dt-dds-react/core/assets/svgs/InfoOutline.tsx
114
+ import { jsx as jsx25 } from "react/jsx-runtime";
115
+
116
+ // ../../dt-dds-react/core/assets/svgs/Input.tsx
117
+ import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
118
+
119
+ // ../../dt-dds-react/core/assets/svgs/Language.tsx
120
+ import { jsx as jsx27 } from "react/jsx-runtime";
121
+
122
+ // ../../dt-dds-react/core/assets/svgs/LocationOn.tsx
123
+ import { jsx as jsx28, jsxs as jsxs13 } from "react/jsx-runtime";
124
+
125
+ // ../../dt-dds-react/core/assets/svgs/LocationSearching.tsx
126
+ import { jsx as jsx29 } from "react/jsx-runtime";
127
+
128
+ // ../../dt-dds-react/core/assets/svgs/MenuCompact.tsx
129
+ import { jsx as jsx30 } from "react/jsx-runtime";
130
+
131
+ // ../../dt-dds-react/core/assets/svgs/MenuExpand.tsx
132
+ import { jsx as jsx31 } from "react/jsx-runtime";
133
+
134
+ // ../../dt-dds-react/core/assets/svgs/Menu.tsx
135
+ import { jsx as jsx32 } from "react/jsx-runtime";
136
+
137
+ // ../../dt-dds-react/core/assets/svgs/MoreHorizontal.tsx
138
+ import { jsx as jsx33 } from "react/jsx-runtime";
139
+
140
+ // ../../dt-dds-react/core/assets/svgs/MoreVertical.tsx
141
+ import { jsx as jsx34 } from "react/jsx-runtime";
142
+
143
+ // ../../dt-dds-react/core/assets/svgs/NoData.tsx
144
+ import { useTheme as useTheme2 } from "@emotion/react";
145
+ import { jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
146
+
147
+ // ../../dt-dds-react/core/assets/svgs/NotFound.tsx
148
+ import { jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
149
+
150
+ // ../../dt-dds-react/core/assets/svgs/OutlinedArrowDropDown.tsx
151
+ import { jsx as jsx37 } from "react/jsx-runtime";
152
+
153
+ // ../../dt-dds-react/core/assets/svgs/OutlinedArrowDropUp.tsx
154
+ import { jsx as jsx38 } from "react/jsx-runtime";
155
+
156
+ // ../../dt-dds-react/core/assets/svgs/PhoneOutlined.tsx
157
+ import { jsx as jsx39 } from "react/jsx-runtime";
158
+
159
+ // ../../dt-dds-react/core/assets/svgs/Payments.tsx
160
+ import { jsx as jsx40 } from "react/jsx-runtime";
161
+
162
+ // ../../dt-dds-react/core/assets/svgs/Products.tsx
163
+ import { jsx as jsx41, jsxs as jsxs16 } from "react/jsx-runtime";
164
+
165
+ // ../../dt-dds-react/core/assets/svgs/RemoveCircleOutline.tsx
166
+ import { jsx as jsx42 } from "react/jsx-runtime";
167
+
168
+ // ../../dt-dds-react/core/assets/svgs/Share.tsx
169
+ import { jsx as jsx43, jsxs as jsxs17 } from "react/jsx-runtime";
170
+
171
+ // ../../dt-dds-react/core/assets/svgs/Signout.tsx
172
+ import { jsx as jsx44 } from "react/jsx-runtime";
173
+
174
+ // ../../dt-dds-react/core/assets/svgs/Teams.tsx
175
+ import { jsx as jsx45, jsxs as jsxs18 } from "react/jsx-runtime";
176
+
177
+ // ../../dt-dds-react/core/assets/svgs/Timeline.tsx
178
+ import { jsx as jsx46, jsxs as jsxs19 } from "react/jsx-runtime";
179
+
180
+ // ../../dt-dds-react/core/assets/svgs/Topic.tsx
181
+ import { jsx as jsx47, jsxs as jsxs20 } from "react/jsx-runtime";
182
+
183
+ // ../../dt-dds-react/core/assets/svgs/UnfoldLess.tsx
184
+ import { jsx as jsx48 } from "react/jsx-runtime";
185
+
186
+ // ../../dt-dds-react/core/assets/svgs/UnfoldMore.tsx
187
+ import { jsx as jsx49 } from "react/jsx-runtime";
188
+
189
+ // ../../dt-dds-react/core/assets/svgs/Username.tsx
190
+ import { jsx as jsx50, jsxs as jsxs21 } from "react/jsx-runtime";
191
+
192
+ // ../../dt-dds-react/core/assets/svgs/ViewAgenda.tsx
193
+ import { jsx as jsx51, jsxs as jsxs22 } from "react/jsx-runtime";
194
+
195
+ // ../../dt-dds-react/core/assets/svgs/Visibility.tsx
196
+ import { jsx as jsx52, jsxs as jsxs23 } from "react/jsx-runtime";
197
+
198
+ // ../../dt-dds-react/core/assets/svgs/VisibilityOff.tsx
199
+ import { jsx as jsx53, jsxs as jsxs24 } from "react/jsx-runtime";
200
+
201
+ // ../../dt-dds-react/core/assets/svgs/WarningOutline.tsx
202
+ import { jsx as jsx54 } from "react/jsx-runtime";
203
+
204
+ // ../../dt-dds-react/core/assets/svgs/Warning.tsx
205
+ import { jsx as jsx55 } from "react/jsx-runtime";
206
+
207
+ // ../../dt-dds-react/core/assets/svgs/Wifi.tsx
208
+ import { jsx as jsx56 } from "react/jsx-runtime";
209
+
210
+ // ../../dt-dds-react/core/assets/svgs/Settings.tsx
211
+ import { jsx as jsx57 } from "react/jsx-runtime";
212
+
213
+ // src/Form.styled.ts
214
+ import styled from "@emotion/styled";
215
+ var FormStyled = styled.form`
216
+ display: flex;
217
+ flex-direction: column;
218
+ width: 100%;
219
+ row-gap: ${({ theme }) => theme.spacing.medium};
220
+ `;
221
+ var GroupStyled = styled.div`
222
+ ${({ theme }) => `
223
+ row-gap: ${theme.spacing.xmedium};
224
+ display: flex;
225
+ flex-direction: column;
226
+ width: 100%;
227
+ color: ${theme.palette.content.default};
228
+ `}
229
+ `;
230
+ var LabelStyled = styled.div`
231
+ display: flex;
232
+ flex-direction: row;
233
+ column-gap: 10px;
234
+ align-items: center;
235
+ `;
236
+ var GroupItemsStyled = styled.div`
237
+ ${({ theme, disabled }) => `
238
+ display: flex;
239
+ gap: ${theme.spacing.xmedium};
240
+ justify-content: stretch;
241
+ align-items: start;
242
+ flex-direction: column;
243
+
244
+ @media only screen and (min-width: ${theme.breakpoints.mq3}px) {
245
+ flex-direction: row;
246
+ }
247
+
248
+ ${disabled && `
249
+ opacity: 0.5;
250
+ pointer-events: none;
251
+ `}
252
+ `}
253
+ `;
254
+
255
+ // src/Form.tsx
256
+ import { jsx as jsx58, jsxs as jsxs25 } from "react/jsx-runtime";
257
+ var DEFAULT_ON_SUBMIT = (event) => event.preventDefault();
258
+ var Form = ({
259
+ children,
260
+ dataTestId,
261
+ style,
262
+ onSubmit = DEFAULT_ON_SUBMIT
263
+ }) => {
264
+ const testId = dataTestId != null ? dataTestId : "test-form";
265
+ return /* @__PURE__ */ jsx58(FormStyled, { "data-testid": testId, onSubmit, style, children });
266
+ };
267
+ Form.Group = ({ children, isDisabled, title, tooltip }) => {
268
+ return /* @__PURE__ */ jsxs25(GroupStyled, { children: [
269
+ title ? /* @__PURE__ */ jsxs25(LabelStyled, { children: [
270
+ /* @__PURE__ */ jsx58(
271
+ Typography,
272
+ {
273
+ color: "primary.default",
274
+ fontStyles: "h6",
275
+ style: { textTransform: "uppercase" },
276
+ children: title
277
+ }
278
+ ),
279
+ tooltip ? /* @__PURE__ */ jsxs25(Tooltip, { children: [
280
+ /* @__PURE__ */ jsx58(Info_default, { height: "16", width: "16" }),
281
+ /* @__PURE__ */ jsx58(
282
+ Tooltip.Content,
283
+ {
284
+ direction: OTooltipDirection.Right,
285
+ style: { maxWidth: 250 },
286
+ children: tooltip
287
+ }
288
+ )
289
+ ] }) : null
290
+ ] }) : null,
291
+ /* @__PURE__ */ jsx58(GroupItemsStyled, { disabled: isDisabled, children })
292
+ ] });
293
+ };
294
+ export {
295
+ Form
296
+ };
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@dt-dds/react-form",
3
+ "version": "1.0.0-beta.27",
4
+ "license": "MIT",
5
+ "exports": {
6
+ ".": "./dist/index.js"
7
+ },
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.mjs",
10
+ "types": "./dist/index.d.ts",
11
+ "files": [
12
+ "dist/**"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsup",
16
+ "dev": "tsup --watch",
17
+ "lint": "eslint --cache .",
18
+ "test": "jest",
19
+ "test:report": "open ./jest-coverage/lcov-report/index.html",
20
+ "test:update:snapshot": "jest -u"
21
+ },
22
+ "dependencies": {
23
+ "@dt-dds/react-core": "1.0.0-beta.41",
24
+ "@dt-dds/react-tooltip": "1.0.0-beta.49",
25
+ "@dt-dds/react-typography": "1.0.0-beta.32"
26
+ },
27
+ "devDependencies": {
28
+ "@babel/core": "^7.22.9",
29
+ "@babel/preset-env": "^7.22.9",
30
+ "@babel/preset-react": "^7.22.5",
31
+ "@babel/preset-typescript": "^7.23.3",
32
+ "@emotion/babel-plugin": "^11.11.0",
33
+ "@emotion/css": "^11.7.1",
34
+ "@emotion/jest": "^11.10.0",
35
+ "@emotion/react": "^11.8.2",
36
+ "@emotion/styled": "^11.8.1",
37
+ "@types/react": "^18.0.9",
38
+ "@types/react-dom": "^18.0.4",
39
+ "babel-loader": "^8.3.0",
40
+ "eslint-config-custom": "*",
41
+ "eslint-plugin-storybook": "^9.1.0",
42
+ "jest-config": "*",
43
+ "react": "^18.1.0",
44
+ "react-dom": "^18.2.0",
45
+ "tsconfig": "*",
46
+ "tsup": "^6.6.3",
47
+ "typescript": "^4.5.3"
48
+ },
49
+ "peerDependencies": {
50
+ "@emotion/css": "^11.7.1",
51
+ "@emotion/react": "^11.8.2",
52
+ "@emotion/styled": "^11.8.1",
53
+ "react": ">=17.0.2",
54
+ "react-dom": ">=17.0.2"
55
+ }
56
+ }