Package not found. Please check the package name and try again.
@workday/canvas-kit-preview-react 11.0.0-alpha.668-next.0 → 11.0.0-alpha.669-next.0
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/dist/commonjs/form-field/lib/FormField.d.ts +5 -65
- package/dist/commonjs/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormField.js +2 -2
- package/dist/commonjs/form-field/lib/FormFieldHint.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormFieldHint.js +17 -3
- package/dist/es6/form-field/lib/FormField.d.ts +5 -65
- package/dist/es6/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormField.js +2 -2
- package/dist/es6/form-field/lib/FormFieldHint.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormFieldHint.js +18 -4
- package/form-field/lib/FormField.tsx +2 -2
- package/form-field/lib/FormFieldHint.tsx +19 -7
- package/package.json +3 -3
|
@@ -27,19 +27,7 @@ export declare const FormField: import("@workday/canvas-kit-react/common").Eleme
|
|
|
27
27
|
orientation: "horizontal" | "vertical";
|
|
28
28
|
isRequired: boolean;
|
|
29
29
|
};
|
|
30
|
-
events: {};
|
|
31
|
-
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
32
|
-
* `FromField.Input` will be associated with `FormField.Label` and `FormField.Hint` by a generated `id`. You can customize this `id` by passing `id` to `FormField`.
|
|
33
|
-
*
|
|
34
|
-
* **Note: If you pass in a custom input that is *not* as Canvas Kit input, you will have to handle the `error` prop, validation and styling. For a custom approach, reference our Custom storybook example.**
|
|
35
|
-
*
|
|
36
|
-
* ```tsx
|
|
37
|
-
* <FormField id='my-unique-id'>
|
|
38
|
-
* <FormField.Label>My Label Text</FormField.Label>
|
|
39
|
-
* <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
|
|
40
|
-
* <FormField>
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
30
|
+
events: {};
|
|
43
31
|
}> & {
|
|
44
32
|
/**
|
|
45
33
|
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
@@ -61,19 +49,7 @@ export declare const FormField: import("@workday/canvas-kit-react/common").Eleme
|
|
|
61
49
|
orientation: "horizontal" | "vertical";
|
|
62
50
|
isRequired: boolean;
|
|
63
51
|
};
|
|
64
|
-
events: {};
|
|
65
|
-
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
66
|
-
* `FromField.Input` will be associated with `FormField.Label` and `FormField.Hint` by a generated `id`. You can customize this `id` by passing `id` to `FormField`.
|
|
67
|
-
*
|
|
68
|
-
* **Note: If you pass in a custom input that is *not* as Canvas Kit input, you will have to handle the `error` prop, validation and styling. For a custom approach, reference our Custom storybook example.**
|
|
69
|
-
*
|
|
70
|
-
* ```tsx
|
|
71
|
-
* <FormField id='my-unique-id'>
|
|
72
|
-
* <FormField.Label>My Label Text</FormField.Label>
|
|
73
|
-
* <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
|
|
74
|
-
* <FormField>
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
52
|
+
events: {};
|
|
77
53
|
}>;
|
|
78
54
|
/**
|
|
79
55
|
* `FormField.Label` will render a `label` element that has a matching `id` to the `FormField.Input`.
|
|
@@ -92,19 +68,7 @@ export declare const FormField: import("@workday/canvas-kit-react/common").Eleme
|
|
|
92
68
|
orientation: "horizontal" | "vertical";
|
|
93
69
|
isRequired: boolean;
|
|
94
70
|
};
|
|
95
|
-
events: {};
|
|
96
|
-
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
97
|
-
* `FromField.Input` will be associated with `FormField.Label` and `FormField.Hint` by a generated `id`. You can customize this `id` by passing `id` to `FormField`.
|
|
98
|
-
*
|
|
99
|
-
* **Note: If you pass in a custom input that is *not* as Canvas Kit input, you will have to handle the `error` prop, validation and styling. For a custom approach, reference our Custom storybook example.**
|
|
100
|
-
*
|
|
101
|
-
* ```tsx
|
|
102
|
-
* <FormField id='my-unique-id'>
|
|
103
|
-
* <FormField.Label>My Label Text</FormField.Label>
|
|
104
|
-
* <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
|
|
105
|
-
* <FormField>
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
71
|
+
events: {};
|
|
108
72
|
}>;
|
|
109
73
|
/**
|
|
110
74
|
* `FormField.Hint` will render any additional information you want to provide to the `FormField.Input`. If you
|
|
@@ -125,19 +89,7 @@ export declare const FormField: import("@workday/canvas-kit-react/common").Eleme
|
|
|
125
89
|
orientation: "horizontal" | "vertical";
|
|
126
90
|
isRequired: boolean;
|
|
127
91
|
};
|
|
128
|
-
events: {};
|
|
129
|
-
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
130
|
-
* `FromField.Input` will be associated with `FormField.Label` and `FormField.Hint` by a generated `id`. You can customize this `id` by passing `id` to `FormField`.
|
|
131
|
-
*
|
|
132
|
-
* **Note: If you pass in a custom input that is *not* as Canvas Kit input, you will have to handle the `error` prop, validation and styling. For a custom approach, reference our Custom storybook example.**
|
|
133
|
-
*
|
|
134
|
-
* ```tsx
|
|
135
|
-
* <FormField id='my-unique-id'>
|
|
136
|
-
* <FormField.Label>My Label Text</FormField.Label>
|
|
137
|
-
* <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
|
|
138
|
-
* <FormField>
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
92
|
+
events: {};
|
|
141
93
|
}>;
|
|
142
94
|
/**
|
|
143
95
|
* `FormField.Container` allows you to properly center `FormField.Label` when the `orientation` is set to `horizontal` and there is hint text..
|
|
@@ -159,19 +111,7 @@ export declare const FormField: import("@workday/canvas-kit-react/common").Eleme
|
|
|
159
111
|
orientation: "horizontal" | "vertical";
|
|
160
112
|
isRequired: boolean;
|
|
161
113
|
};
|
|
162
|
-
events: {};
|
|
163
|
-
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
164
|
-
* `FromField.Input` will be associated with `FormField.Label` and `FormField.Hint` by a generated `id`. You can customize this `id` by passing `id` to `FormField`.
|
|
165
|
-
*
|
|
166
|
-
* **Note: If you pass in a custom input that is *not* as Canvas Kit input, you will have to handle the `error` prop, validation and styling. For a custom approach, reference our Custom storybook example.**
|
|
167
|
-
*
|
|
168
|
-
* ```tsx
|
|
169
|
-
* <FormField id='my-unique-id'>
|
|
170
|
-
* <FormField.Label>My Label Text</FormField.Label>
|
|
171
|
-
* <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
|
|
172
|
-
* <FormField>
|
|
173
|
-
* ```
|
|
174
|
-
*/
|
|
114
|
+
events: {};
|
|
175
115
|
}>;
|
|
176
116
|
};
|
|
177
117
|
//# sourceMappingURL=FormField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,cAAc,EAAC,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAO,SAAS,EAAc,MAAM,kCAAkC,CAAC;AAU9E,MAAM,WAAW,cAAe,SAAQ,SAAS,EAAE,cAAc;IAC/D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAmBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,cAAc,EAAC,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAO,SAAS,EAAc,MAAM,kCAAkC,CAAC;AAU9E,MAAM,WAAW,cAAe,SAAQ,SAAS,EAAE,cAAc;IAC/D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAmBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;IAIlB;;;;;;;;;;;;OAYG;;;;;;;;;;IAEH;;;;;;;;;OASG;;;;;;;;;;IAEH;;;;;;;;;;;OAWG;;;;;;;;;;IAEH;;;;;;;;;;;;OAYG;;;;;;;;;;CAeL,CAAC"}
|
|
@@ -8,7 +8,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
9
|
const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
10
10
|
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
11
|
-
const
|
|
11
|
+
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
12
12
|
const hooks_1 = require("./hooks");
|
|
13
13
|
const FormFieldInput_1 = require("./FormFieldInput");
|
|
14
14
|
const FormFieldLabel_1 = require("./FormFieldLabel");
|
|
@@ -18,7 +18,7 @@ const formFieldStencil = canvas_kit_styling_1.createStencil({
|
|
|
18
18
|
base: {
|
|
19
19
|
border: 'none',
|
|
20
20
|
padding: 0,
|
|
21
|
-
margin: `0 0 ${
|
|
21
|
+
margin: `0 0 ${canvas_tokens_web_1.system.space.x6}`,
|
|
22
22
|
},
|
|
23
23
|
modifiers: {
|
|
24
24
|
grow: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldHint.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldHint.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormFieldHint.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldHint.tsx"],"names":[],"mappings":"AAuBA,eAAO,MAAM,aAAa;;;;;;;;EAqBzB,CAAC"}
|
|
@@ -6,18 +6,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.FormFieldHint = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
|
-
const
|
|
9
|
+
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
10
|
+
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
10
11
|
const hooks_1 = require("./hooks");
|
|
11
12
|
const text_1 = require("@workday/canvas-kit-react/text");
|
|
13
|
+
const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
14
|
+
const formFieldHintStencil = canvas_kit_styling_1.createStencil({
|
|
15
|
+
base: {
|
|
16
|
+
margin: `${canvas_tokens_web_1.system.space.x2} 0 0`,
|
|
17
|
+
},
|
|
18
|
+
modifiers: {
|
|
19
|
+
error: {
|
|
20
|
+
error: {
|
|
21
|
+
color: canvas_tokens_web_1.brand.error.base,
|
|
22
|
+
},
|
|
23
|
+
alert: {},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
12
27
|
exports.FormFieldHint = common_1.createSubcomponent('p')({
|
|
13
28
|
displayName: 'FormField.Hint',
|
|
14
29
|
modelHook: hooks_1.useFormFieldModel,
|
|
15
30
|
elemPropsHook: hooks_1.useFormFieldHint,
|
|
16
31
|
})(({ children, ...elemProps }, Element, model) => {
|
|
17
|
-
const theme = common_1.useTheme();
|
|
18
32
|
if (!children) {
|
|
19
33
|
// If there is no hint text just skip rendering
|
|
20
34
|
return null;
|
|
21
35
|
}
|
|
22
|
-
return (react_1.default.createElement(text_1.Subtext, Object.assign({ as: Element, size: "medium",
|
|
36
|
+
return (react_1.default.createElement(text_1.Subtext, Object.assign({ as: Element, size: "medium" }, layout_1.mergeStyles(elemProps, formFieldHintStencil({ error: model.state.error }))), children));
|
|
23
37
|
});
|
|
@@ -27,19 +27,7 @@ export declare const FormField: import("@workday/canvas-kit-react/common").Eleme
|
|
|
27
27
|
orientation: "horizontal" | "vertical";
|
|
28
28
|
isRequired: boolean;
|
|
29
29
|
};
|
|
30
|
-
events: {};
|
|
31
|
-
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
32
|
-
* `FromField.Input` will be associated with `FormField.Label` and `FormField.Hint` by a generated `id`. You can customize this `id` by passing `id` to `FormField`.
|
|
33
|
-
*
|
|
34
|
-
* **Note: If you pass in a custom input that is *not* as Canvas Kit input, you will have to handle the `error` prop, validation and styling. For a custom approach, reference our Custom storybook example.**
|
|
35
|
-
*
|
|
36
|
-
* ```tsx
|
|
37
|
-
* <FormField id='my-unique-id'>
|
|
38
|
-
* <FormField.Label>My Label Text</FormField.Label>
|
|
39
|
-
* <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
|
|
40
|
-
* <FormField>
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
30
|
+
events: {};
|
|
43
31
|
}> & {
|
|
44
32
|
/**
|
|
45
33
|
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
@@ -61,19 +49,7 @@ export declare const FormField: import("@workday/canvas-kit-react/common").Eleme
|
|
|
61
49
|
orientation: "horizontal" | "vertical";
|
|
62
50
|
isRequired: boolean;
|
|
63
51
|
};
|
|
64
|
-
events: {};
|
|
65
|
-
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
66
|
-
* `FromField.Input` will be associated with `FormField.Label` and `FormField.Hint` by a generated `id`. You can customize this `id` by passing `id` to `FormField`.
|
|
67
|
-
*
|
|
68
|
-
* **Note: If you pass in a custom input that is *not* as Canvas Kit input, you will have to handle the `error` prop, validation and styling. For a custom approach, reference our Custom storybook example.**
|
|
69
|
-
*
|
|
70
|
-
* ```tsx
|
|
71
|
-
* <FormField id='my-unique-id'>
|
|
72
|
-
* <FormField.Label>My Label Text</FormField.Label>
|
|
73
|
-
* <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
|
|
74
|
-
* <FormField>
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
52
|
+
events: {};
|
|
77
53
|
}>;
|
|
78
54
|
/**
|
|
79
55
|
* `FormField.Label` will render a `label` element that has a matching `id` to the `FormField.Input`.
|
|
@@ -92,19 +68,7 @@ export declare const FormField: import("@workday/canvas-kit-react/common").Eleme
|
|
|
92
68
|
orientation: "horizontal" | "vertical";
|
|
93
69
|
isRequired: boolean;
|
|
94
70
|
};
|
|
95
|
-
events: {};
|
|
96
|
-
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
97
|
-
* `FromField.Input` will be associated with `FormField.Label` and `FormField.Hint` by a generated `id`. You can customize this `id` by passing `id` to `FormField`.
|
|
98
|
-
*
|
|
99
|
-
* **Note: If you pass in a custom input that is *not* as Canvas Kit input, you will have to handle the `error` prop, validation and styling. For a custom approach, reference our Custom storybook example.**
|
|
100
|
-
*
|
|
101
|
-
* ```tsx
|
|
102
|
-
* <FormField id='my-unique-id'>
|
|
103
|
-
* <FormField.Label>My Label Text</FormField.Label>
|
|
104
|
-
* <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
|
|
105
|
-
* <FormField>
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
71
|
+
events: {};
|
|
108
72
|
}>;
|
|
109
73
|
/**
|
|
110
74
|
* `FormField.Hint` will render any additional information you want to provide to the `FormField.Input`. If you
|
|
@@ -125,19 +89,7 @@ export declare const FormField: import("@workday/canvas-kit-react/common").Eleme
|
|
|
125
89
|
orientation: "horizontal" | "vertical";
|
|
126
90
|
isRequired: boolean;
|
|
127
91
|
};
|
|
128
|
-
events: {};
|
|
129
|
-
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
130
|
-
* `FromField.Input` will be associated with `FormField.Label` and `FormField.Hint` by a generated `id`. You can customize this `id` by passing `id` to `FormField`.
|
|
131
|
-
*
|
|
132
|
-
* **Note: If you pass in a custom input that is *not* as Canvas Kit input, you will have to handle the `error` prop, validation and styling. For a custom approach, reference our Custom storybook example.**
|
|
133
|
-
*
|
|
134
|
-
* ```tsx
|
|
135
|
-
* <FormField id='my-unique-id'>
|
|
136
|
-
* <FormField.Label>My Label Text</FormField.Label>
|
|
137
|
-
* <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
|
|
138
|
-
* <FormField>
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
92
|
+
events: {};
|
|
141
93
|
}>;
|
|
142
94
|
/**
|
|
143
95
|
* `FormField.Container` allows you to properly center `FormField.Label` when the `orientation` is set to `horizontal` and there is hint text..
|
|
@@ -159,19 +111,7 @@ export declare const FormField: import("@workday/canvas-kit-react/common").Eleme
|
|
|
159
111
|
orientation: "horizontal" | "vertical";
|
|
160
112
|
isRequired: boolean;
|
|
161
113
|
};
|
|
162
|
-
events: {};
|
|
163
|
-
* `FormField.Input` will render any `inputs` passed to it via the `as` prop, including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
|
|
164
|
-
* `FromField.Input` will be associated with `FormField.Label` and `FormField.Hint` by a generated `id`. You can customize this `id` by passing `id` to `FormField`.
|
|
165
|
-
*
|
|
166
|
-
* **Note: If you pass in a custom input that is *not* as Canvas Kit input, you will have to handle the `error` prop, validation and styling. For a custom approach, reference our Custom storybook example.**
|
|
167
|
-
*
|
|
168
|
-
* ```tsx
|
|
169
|
-
* <FormField id='my-unique-id'>
|
|
170
|
-
* <FormField.Label>My Label Text</FormField.Label>
|
|
171
|
-
* <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
|
|
172
|
-
* <FormField>
|
|
173
|
-
* ```
|
|
174
|
-
*/
|
|
114
|
+
events: {};
|
|
175
115
|
}>;
|
|
176
116
|
};
|
|
177
117
|
//# sourceMappingURL=FormField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,cAAc,EAAC,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAO,SAAS,EAAc,MAAM,kCAAkC,CAAC;AAU9E,MAAM,WAAW,cAAe,SAAQ,SAAS,EAAE,cAAc;IAC/D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAmBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,cAAc,EAAC,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAO,SAAS,EAAc,MAAM,kCAAkC,CAAC;AAU9E,MAAM,WAAW,cAAe,SAAQ,SAAS,EAAE,cAAc;IAC/D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAmBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;IAIlB;;;;;;;;;;;;OAYG;;;;;;;;;;IAEH;;;;;;;;;OASG;;;;;;;;;;IAEH;;;;;;;;;;;OAWG;;;;;;;;;;IAEH;;;;;;;;;;;;OAYG;;;;;;;;;;CAeL,CAAC"}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { createContainer } from '@workday/canvas-kit-react/common';
|
|
3
3
|
import { Flex, mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
4
4
|
import { createStencil } from '@workday/canvas-kit-styling';
|
|
5
|
-
import {
|
|
5
|
+
import { system } from '@workday/canvas-tokens-web';
|
|
6
6
|
import { useFormFieldModel, useFormFieldOrientation } from './hooks';
|
|
7
7
|
import { FormFieldInput } from './FormFieldInput';
|
|
8
8
|
import { FormFieldLabel } from './FormFieldLabel';
|
|
@@ -12,7 +12,7 @@ const formFieldStencil = createStencil({
|
|
|
12
12
|
base: {
|
|
13
13
|
border: 'none',
|
|
14
14
|
padding: 0,
|
|
15
|
-
margin: `0 0 ${space.
|
|
15
|
+
margin: `0 0 ${system.space.x6}`,
|
|
16
16
|
},
|
|
17
17
|
modifiers: {
|
|
18
18
|
grow: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldHint.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldHint.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormFieldHint.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldHint.tsx"],"names":[],"mappings":"AAuBA,eAAO,MAAM,aAAa;;;;;;;;EAqBzB,CAAC"}
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { createSubcomponent
|
|
3
|
-
import {
|
|
2
|
+
import { createSubcomponent } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { system, brand } from '@workday/canvas-tokens-web';
|
|
4
|
+
import { createStencil } from '@workday/canvas-kit-styling';
|
|
4
5
|
import { useFormFieldHint, useFormFieldModel } from './hooks';
|
|
5
6
|
import { Subtext } from '@workday/canvas-kit-react/text';
|
|
7
|
+
import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
8
|
+
const formFieldHintStencil = createStencil({
|
|
9
|
+
base: {
|
|
10
|
+
margin: `${system.space.x2} 0 0`,
|
|
11
|
+
},
|
|
12
|
+
modifiers: {
|
|
13
|
+
error: {
|
|
14
|
+
error: {
|
|
15
|
+
color: brand.error.base,
|
|
16
|
+
},
|
|
17
|
+
alert: {},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
6
21
|
export const FormFieldHint = createSubcomponent('p')({
|
|
7
22
|
displayName: 'FormField.Hint',
|
|
8
23
|
modelHook: useFormFieldModel,
|
|
9
24
|
elemPropsHook: useFormFieldHint,
|
|
10
25
|
})(({ children, ...elemProps }, Element, model) => {
|
|
11
|
-
const theme = useTheme();
|
|
12
26
|
if (!children) {
|
|
13
27
|
// If there is no hint text just skip rendering
|
|
14
28
|
return null;
|
|
15
29
|
}
|
|
16
|
-
return (React.createElement(Subtext, Object.assign({ as: Element, size: "medium",
|
|
30
|
+
return (React.createElement(Subtext, Object.assign({ as: Element, size: "medium" }, mergeStyles(elemProps, formFieldHintStencil({ error: model.state.error }))), children));
|
|
17
31
|
});
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import {createContainer, GrowthBehavior} from '@workday/canvas-kit-react/common';
|
|
4
4
|
import {Flex, FlexProps, mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
import {createStencil} from '@workday/canvas-kit-styling';
|
|
6
|
-
import {
|
|
6
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
7
7
|
|
|
8
8
|
import {useFormFieldModel, useFormFieldOrientation} from './hooks';
|
|
9
9
|
import {FormFieldInput} from './FormFieldInput';
|
|
@@ -19,7 +19,7 @@ const formFieldStencil = createStencil({
|
|
|
19
19
|
base: {
|
|
20
20
|
border: 'none',
|
|
21
21
|
padding: 0,
|
|
22
|
-
margin: `0 0 ${space.
|
|
22
|
+
margin: `0 0 ${system.space.x6}`,
|
|
23
23
|
},
|
|
24
24
|
modifiers: {
|
|
25
25
|
grow: {
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {createSubcomponent, ExtractProps
|
|
3
|
-
import {
|
|
2
|
+
import {createSubcomponent, ExtractProps} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {system, brand} from '@workday/canvas-tokens-web';
|
|
4
|
+
import {createStencil} from '@workday/canvas-kit-styling';
|
|
4
5
|
|
|
5
6
|
import {useFormFieldHint, useFormFieldModel} from './hooks';
|
|
6
7
|
import {Subtext} from '@workday/canvas-kit-react/text';
|
|
8
|
+
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
9
|
+
|
|
10
|
+
const formFieldHintStencil = createStencil({
|
|
11
|
+
base: {
|
|
12
|
+
margin: `${system.space.x2} 0 0`,
|
|
13
|
+
},
|
|
14
|
+
modifiers: {
|
|
15
|
+
error: {
|
|
16
|
+
error: {
|
|
17
|
+
color: brand.error.base,
|
|
18
|
+
},
|
|
19
|
+
alert: {},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
7
23
|
|
|
8
24
|
export const FormFieldHint = createSubcomponent('p')({
|
|
9
25
|
displayName: 'FormField.Hint',
|
|
@@ -11,8 +27,6 @@ export const FormFieldHint = createSubcomponent('p')({
|
|
|
11
27
|
elemPropsHook: useFormFieldHint,
|
|
12
28
|
})<Omit<ExtractProps<typeof Subtext, never>, 'size'>>(
|
|
13
29
|
({children, ...elemProps}, Element, model) => {
|
|
14
|
-
const theme = useTheme();
|
|
15
|
-
|
|
16
30
|
if (!children) {
|
|
17
31
|
// If there is no hint text just skip rendering
|
|
18
32
|
return null;
|
|
@@ -22,9 +36,7 @@ export const FormFieldHint = createSubcomponent('p')({
|
|
|
22
36
|
<Subtext
|
|
23
37
|
as={Element}
|
|
24
38
|
size="medium"
|
|
25
|
-
|
|
26
|
-
marginY={space.xxs}
|
|
27
|
-
{...elemProps}
|
|
39
|
+
{...mergeStyles(elemProps, formFieldHintStencil({error: model.state.error}))}
|
|
28
40
|
>
|
|
29
41
|
{children}
|
|
30
42
|
</Subtext>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-preview-react",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.669-next.0",
|
|
4
4
|
"description": "Canvas Kit Preview is made up of components that have the full design and a11y review, are part of the DS ecosystem and are approved for use in product. The API's could be subject to change, but not without strong communication and migration strategies.",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@emotion/css": "^11.7.1",
|
|
48
48
|
"@emotion/react": "^11.7.1",
|
|
49
49
|
"@emotion/styled": "^11.6.0",
|
|
50
|
-
"@workday/canvas-kit-react": "^11.0.0-alpha.
|
|
50
|
+
"@workday/canvas-kit-react": "^11.0.0-alpha.669-next.0",
|
|
51
51
|
"@workday/canvas-kit-styling": "^10.3.1",
|
|
52
52
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
53
53
|
"@workday/canvas-tokens-web": "^1.0.2",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"react-hook-form": "7.36.1",
|
|
60
60
|
"yup": "^0.32.11"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "61dca4fd454434a6e3d7d6d691a700c704b14c51"
|
|
63
63
|
}
|