@workday/canvas-kit-preview-react 11.0.0-alpha.633-next.0 → 11.0.0-alpha.635-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.
Files changed (112) hide show
  1. package/color-picker/lib/ColorPicker.tsx +5 -3
  2. package/dist/commonjs/color-picker/lib/ColorPicker.d.ts.map +1 -1
  3. package/dist/commonjs/color-picker/lib/ColorPicker.js +4 -3
  4. package/dist/commonjs/form-field/lib/FormField.d.ts +76 -12
  5. package/dist/commonjs/form-field/lib/FormField.d.ts.map +1 -1
  6. package/dist/commonjs/form-field/lib/FormField.js +69 -3
  7. package/dist/commonjs/form-field/lib/FormFieldContainer.d.ts +11 -0
  8. package/dist/commonjs/form-field/lib/FormFieldContainer.d.ts.map +1 -0
  9. package/dist/commonjs/form-field/lib/FormFieldContainer.js +20 -0
  10. package/dist/commonjs/form-field/lib/FormFieldHint.d.ts +2 -1
  11. package/dist/commonjs/form-field/lib/FormFieldHint.d.ts.map +1 -1
  12. package/dist/commonjs/form-field/lib/FormFieldHint.js +1 -1
  13. package/dist/commonjs/form-field/lib/FormFieldInput.d.ts +2 -1
  14. package/dist/commonjs/form-field/lib/FormFieldInput.d.ts.map +1 -1
  15. package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts +2 -1
  16. package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts.map +1 -1
  17. package/dist/commonjs/form-field/lib/FormFieldLabel.js +19 -1
  18. package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts +2 -1
  19. package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -1
  20. package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts +3 -1
  21. package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -1
  22. package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.js +2 -1
  23. package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts +2 -1
  24. package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -1
  25. package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts +45 -15
  26. package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -1
  27. package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.js +9 -3
  28. package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.js +1 -1
  29. package/dist/commonjs/radio/lib/RadioGroup.d.ts +2 -2
  30. package/dist/commonjs/radio/lib/RadioGroup.d.ts.map +1 -1
  31. package/dist/commonjs/radio/lib/RadioGroup.js +7 -9
  32. package/dist/commonjs/text-area/lib/TextArea.d.ts +18 -6
  33. package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -1
  34. package/dist/commonjs/text-area/lib/TextArea.js +6 -2
  35. package/dist/commonjs/text-area/lib/TextAreaField.d.ts +7 -2
  36. package/dist/commonjs/text-area/lib/TextAreaField.d.ts.map +1 -1
  37. package/dist/commonjs/text-area/lib/TextAreaField.js +4 -1
  38. package/dist/commonjs/text-input/lib/TextInput.d.ts +20 -7
  39. package/dist/commonjs/text-input/lib/TextInput.d.ts.map +1 -1
  40. package/dist/commonjs/text-input/lib/TextInput.js +4 -1
  41. package/dist/commonjs/text-input/lib/TextInputField.d.ts +7 -2
  42. package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -1
  43. package/dist/commonjs/text-input/lib/TextInputField.js +5 -2
  44. package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +4 -1
  45. package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts.map +1 -1
  46. package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +2 -0
  47. package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +13 -6
  48. package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -1
  49. package/dist/commonjs/text-input/lib/hooks/useTextInputModel.js +3 -1
  50. package/dist/es6/color-picker/lib/ColorPicker.d.ts.map +1 -1
  51. package/dist/es6/color-picker/lib/ColorPicker.js +4 -3
  52. package/dist/es6/form-field/lib/FormField.d.ts +76 -12
  53. package/dist/es6/form-field/lib/FormField.d.ts.map +1 -1
  54. package/dist/es6/form-field/lib/FormField.js +70 -4
  55. package/dist/es6/form-field/lib/FormFieldContainer.d.ts +11 -0
  56. package/dist/es6/form-field/lib/FormFieldContainer.d.ts.map +1 -0
  57. package/dist/es6/form-field/lib/FormFieldContainer.js +14 -0
  58. package/dist/es6/form-field/lib/FormFieldHint.d.ts +2 -1
  59. package/dist/es6/form-field/lib/FormFieldHint.d.ts.map +1 -1
  60. package/dist/es6/form-field/lib/FormFieldHint.js +1 -1
  61. package/dist/es6/form-field/lib/FormFieldInput.d.ts +2 -1
  62. package/dist/es6/form-field/lib/FormFieldInput.d.ts.map +1 -1
  63. package/dist/es6/form-field/lib/FormFieldLabel.d.ts +2 -1
  64. package/dist/es6/form-field/lib/FormFieldLabel.d.ts.map +1 -1
  65. package/dist/es6/form-field/lib/FormFieldLabel.js +20 -2
  66. package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts +2 -1
  67. package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -1
  68. package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts +3 -1
  69. package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -1
  70. package/dist/es6/form-field/lib/hooks/useFormFieldInput.js +2 -1
  71. package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts +2 -1
  72. package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -1
  73. package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts +45 -15
  74. package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -1
  75. package/dist/es6/form-field/lib/hooks/useFormFieldModel.js +9 -3
  76. package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.js +1 -1
  77. package/dist/es6/radio/lib/RadioGroup.d.ts +2 -2
  78. package/dist/es6/radio/lib/RadioGroup.d.ts.map +1 -1
  79. package/dist/es6/radio/lib/RadioGroup.js +7 -9
  80. package/dist/es6/text-area/lib/TextArea.d.ts +18 -6
  81. package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -1
  82. package/dist/es6/text-area/lib/TextArea.js +7 -3
  83. package/dist/es6/text-area/lib/TextAreaField.d.ts +7 -2
  84. package/dist/es6/text-area/lib/TextAreaField.d.ts.map +1 -1
  85. package/dist/es6/text-area/lib/TextAreaField.js +4 -1
  86. package/dist/es6/text-input/lib/TextInput.d.ts +20 -7
  87. package/dist/es6/text-input/lib/TextInput.d.ts.map +1 -1
  88. package/dist/es6/text-input/lib/TextInput.js +4 -1
  89. package/dist/es6/text-input/lib/TextInputField.d.ts +7 -2
  90. package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -1
  91. package/dist/es6/text-input/lib/TextInputField.js +7 -4
  92. package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +4 -1
  93. package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts.map +1 -1
  94. package/dist/es6/text-input/lib/hooks/useTextInputField.js +2 -0
  95. package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +13 -6
  96. package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -1
  97. package/dist/es6/text-input/lib/hooks/useTextInputModel.js +3 -1
  98. package/form-field/lib/FormField.tsx +70 -11
  99. package/form-field/lib/FormFieldContainer.tsx +18 -0
  100. package/form-field/lib/FormFieldHint.tsx +1 -1
  101. package/form-field/lib/FormFieldLabel.tsx +24 -2
  102. package/form-field/lib/hooks/useFormFieldInput.tsx +2 -1
  103. package/form-field/lib/hooks/useFormFieldModel.tsx +9 -3
  104. package/form-field/lib/hooks/useFormFieldOrientation.tsx +1 -1
  105. package/package.json +4 -4
  106. package/radio/lib/RadioGroup.tsx +8 -12
  107. package/text-area/lib/TextArea.tsx +10 -8
  108. package/text-area/lib/TextAreaField.tsx +12 -8
  109. package/text-input/lib/TextInput.tsx +16 -9
  110. package/text-input/lib/TextInputField.tsx +15 -11
  111. package/text-input/lib/hooks/useTextInputField.tsx +2 -0
  112. package/text-input/lib/hooks/useTextInputModel.ts +3 -1
@@ -3,7 +3,7 @@ import {checkIcon} from '@workday/canvas-system-icons-web';
3
3
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
4
4
  import {SecondaryButton} from '@workday/canvas-kit-react/button';
5
5
  import * as React from 'react';
6
- import {FormField} from '@workday/canvas-kit-react/form-field';
6
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
7
7
  import styled from '@emotion/styled';
8
8
 
9
9
  import {ResetButton} from './parts/ColorReset';
@@ -204,8 +204,10 @@ export const ColorPicker = ({
204
204
  <SwatchBook colors={colorSet} onSelect={onColorChange} value={value} />
205
205
  {showCustomHexInput && (
206
206
  <ColorInputWrapper onSubmit={onSubmit}>
207
- <ColorInputAndLabel label={customHexInputLabel}>
208
- <HexColorInput
207
+ <ColorInputAndLabel>
208
+ <FormField.Label>{customHexInputLabel}</FormField.Label>
209
+ <FormField.Input
210
+ as={HexColorInput}
209
211
  onChange={onCustomHexChange}
210
212
  onValidColorChange={onValidCustomHexChange}
211
213
  value={customHexValue}
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../../color-picker/lib/ColorPicker.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5E;;OAEG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IACjD;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAsGD,eAAO,MAAM,WAAW;kKAYrB,gBAAgB;;CAoDlB,CAAC"}
1
+ {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../../color-picker/lib/ColorPicker.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5E;;OAEG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IACjD;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAsGD,eAAO,MAAM,WAAW;kKAYrB,gBAAgB;;CAsDlB,CAAC"}
@@ -28,7 +28,7 @@ const canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
28
28
  const color_picker_1 = require("@workday/canvas-kit-react/color-picker");
29
29
  const button_1 = require("@workday/canvas-kit-react/button");
30
30
  const React = __importStar(require("react"));
31
- const form_field_1 = require("@workday/canvas-kit-react/form-field");
31
+ const form_field_1 = require("@workday/canvas-kit-preview-react/form-field");
32
32
  const styled_1 = __importDefault(require("@emotion/styled"));
33
33
  const ColorReset_1 = require("./parts/ColorReset");
34
34
  const SwatchBook_1 = require("./parts/SwatchBook");
@@ -142,8 +142,9 @@ const ColorPicker = ({ colorSet = defaultColorSet, customHexInputLabel = 'Custom
142
142
  onColorReset && resetColor && (React.createElement(ColorReset_1.ResetButton, { onClick: onColorReset, resetColor: resetColor, label: resetLabel })),
143
143
  React.createElement(SwatchBook_1.SwatchBook, { colors: colorSet, onSelect: onColorChange, value: value }),
144
144
  showCustomHexInput && (React.createElement(ColorInputWrapper, { onSubmit: onSubmit },
145
- React.createElement(ColorInputAndLabel, { label: customHexInputLabel },
146
- React.createElement(HexColorInput, { onChange: onCustomHexChange, onValidColorChange: onValidCustomHexChange, value: customHexValue, showCheck: value === validHexValue || value === customHexValue })),
145
+ React.createElement(ColorInputAndLabel, null,
146
+ React.createElement(form_field_1.FormField.Label, null, customHexInputLabel),
147
+ React.createElement(form_field_1.FormField.Input, { as: HexColorInput, onChange: onCustomHexChange, onValidColorChange: onValidCustomHexChange, value: customHexValue, showCheck: value === validHexValue || value === customHexValue })),
147
148
  React.createElement(CheckButton, { "aria-label": submitLabel, icon: canvas_system_icons_web_1.checkIcon, type: "submit", disabled: disabled })))));
148
149
  };
149
150
  exports.ColorPicker = ColorPicker;
@@ -1,47 +1,111 @@
1
1
  import React from 'react';
2
2
  import { FlexProps } from '@workday/canvas-kit-react/layout';
3
3
  export interface FormFieldProps extends FlexProps {
4
- /**
5
- * Children of the Text Input. Should contain a `<FormField.Input>`, a `<FormField.Label>` and an optional `<FormField.Hint>`
6
- */
7
4
  children: React.ReactNode;
8
- /**
9
- * The direction the child elements should stack
10
- */
11
- orientation: 'vertical' | 'horizontal';
12
5
  }
6
+ /**
7
+ * Use `FormField` to wrap input components to make them accessible. You can customize the field
8
+ * by passing in `TextInput`, `Select`, `RadioGroup` and other form elements to `FormField.Input`.
9
+ *
10
+ * ```tsx
11
+ * <FormField>
12
+ * <FormField.Label>First Name</FormField.Label>
13
+ * <FormField.Input as={TextInput} value={value} onChange={(e) => console.log(e)} />
14
+ * </FormField>
15
+ * ```
16
+ */
13
17
  export declare const FormField: import("@workday/canvas-kit-react/common").ElementComponentM<"div", FormFieldProps & Partial<{
14
- hasError: boolean;
18
+ error: "alert" | "error" | undefined;
19
+ orientation: "horizontal" | "vertical";
15
20
  id: string;
16
21
  isRequired: boolean;
17
22
  }> & {} & {}, {
18
23
  state: {
19
24
  id: string;
20
- hasError: boolean;
25
+ error: "alert" | "error" | undefined;
26
+ orientation: "horizontal" | "vertical";
21
27
  isRequired: boolean;
22
28
  };
23
29
  events: {};
24
30
  }> & {
31
+ /**
32
+ * `FormField.Input` will render any `inputs` passed to it including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
33
+ * `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`.
34
+ *
35
+ * ```tsx
36
+ * <FormField id='my-unique-id'>
37
+ * <FormField.Label>My Label Text</FormField.Label>
38
+ * <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
39
+ * <FormField>
40
+ * ```
41
+ */
25
42
  Input: import("@workday/canvas-kit-react/common").ElementComponentM<"input", import("@workday/canvas-kit-react/layout").BackgroundStyleProps & import("@workday/canvas-kit-react/layout/lib/utils/border/color").BorderColorStyleProps & import("@workday/canvas-kit-react/layout/lib/utils/border/lineStyle").BorderLineStyleProps & import("@workday/canvas-kit-react/layout/lib/utils/border/radius").BorderRadiusStyleProps & import("@workday/canvas-kit-react/layout/lib/utils/border/shorthand").BorderShorthandStyleProps & import("@workday/canvas-kit-react/layout/lib/utils/border/width").BorderWidthStyleProps & import("@workday/canvas-kit-react/layout").ColorStyleProps & import("@workday/canvas-kit-react/layout").DepthStyleProps & import("@workday/canvas-kit-react/layout").FlexItemStyleProps & import("@workday/canvas-kit-react/layout").GridItemStyleProps & import("@workday/canvas-kit-react/layout").LayoutStyleProps & import("@workday/canvas-kit-react/layout").OtherStyleProps & import("@workday/canvas-kit-react/layout").PositionStyleProps & import("@workday/canvas-kit-react/layout").SpaceStyleProps & import("@workday/canvas-kit-react/layout").TextStyleProps & import("@workday/canvas-kit-styling").CSProps, {
26
43
  state: {
27
44
  id: string;
28
- hasError: boolean;
45
+ error: "alert" | "error" | undefined;
46
+ orientation: "horizontal" | "vertical";
29
47
  isRequired: boolean;
30
48
  };
31
49
  events: {};
32
50
  }>;
51
+ /**
52
+ * `FormField.Label` will render a `label` element that has a matching `id` to the `FormField.Input`.
53
+ *
54
+ * ```tsx
55
+ * <FormField>
56
+ * <FormField.Label>First Name</FormField.Label>
57
+ * <FormField.Input as={TextInput} value={value} onChange={(e) => console.log(e)} />
58
+ * </FormField>
59
+ * ```
60
+ */
33
61
  Label: import("@workday/canvas-kit-react/common").ElementComponentM<import("@workday/canvas-kit-react/common").ElementComponent<"label", import("@workday/canvas-kit-react/text").TypeLabelProps>, import("./FormFieldLabel").FormFieldLabelProps, {
34
62
  state: {
35
63
  id: string;
36
- hasError: boolean;
64
+ error: "alert" | "error" | undefined;
65
+ orientation: "horizontal" | "vertical";
37
66
  isRequired: boolean;
38
67
  };
39
68
  events: {};
40
69
  }>;
70
+ /**
71
+ * `FormField.Hint` will render any additional information you want to provide to the `FormField.Input`. If you
72
+ * set the `orientation` prop to `horizontal` you should use `FormField.Container` to properly align the hint with your `FormField.Input`.
73
+ *
74
+ * ```tsx
75
+ * <FormField>
76
+ * <FormField.Label>First Name</FormField.Label>
77
+ * <FormField.Input as={TextInput} value={value} onChange={(e) => console.log(e)} />
78
+ * <FormField.Hint>This is your hint text</FormField.Hint>
79
+ * </FormField>
80
+ * ```
81
+ */
41
82
  Hint: import("@workday/canvas-kit-react/common").ElementComponentM<"p", Omit<import("@workday/canvas-kit-react/text").TypeLevelProps, "size">, {
42
83
  state: {
43
84
  id: string;
44
- hasError: boolean;
85
+ error: "alert" | "error" | undefined;
86
+ orientation: "horizontal" | "vertical";
87
+ isRequired: boolean;
88
+ };
89
+ events: {};
90
+ }>;
91
+ /**
92
+ * `FormField.Container` allows you to properly center `FormField.Label` when the `orientation` is set to `horizontal` and there is hint text..
93
+ *
94
+ * ```tsx
95
+ * <FormField orientation="horizontal">
96
+ * <FormField.Label>First Name</FormField.Label>
97
+ * <FormField.Container>
98
+ * <FormField.Input as={TextInput} value={value} onChange={(e) => console.log(e)} />
99
+ * <FormField.Hint>This is your hint text</FormField.Hint>
100
+ * </FormField.Container>
101
+ * </FormField>
102
+ * ```
103
+ */
104
+ Container: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("@workday/canvas-kit-styling").CSProps, {
105
+ state: {
106
+ id: string;
107
+ error: "alert" | "error" | undefined;
108
+ orientation: "horizontal" | "vertical";
45
109
  isRequired: boolean;
46
110
  };
47
111
  events: {};
@@ -1 +1 @@
1
- {"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAO,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAOjE,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,WAAW,EAAE,UAAU,GAAG,YAAY,CAAC;CACxC;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBpB,CAAC"}
1
+ {"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAO,SAAS,EAAc,MAAM,kCAAkC,CAAC;AAU9E,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAOD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;IAIlB;;;;;;;;;;OAUG;;;;;;;;;;IAEH;;;;;;;;;OASG;;;;;;;;;;IAEH;;;;;;;;;;;OAWG;;;;;;;;;;IAEH;;;;;;;;;;;;OAYG;;;;;;;;;;CAWL,CAAC"}
@@ -7,19 +7,85 @@ exports.FormField = void 0;
7
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
+ const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
11
+ const tokens_1 = require("@workday/canvas-kit-react/tokens");
10
12
  const hooks_1 = require("./hooks");
11
13
  const FormFieldInput_1 = require("./FormFieldInput");
12
14
  const FormFieldLabel_1 = require("./FormFieldLabel");
13
15
  const FormFieldHint_1 = require("./FormFieldHint");
16
+ const FormFieldContainer_1 = require("./FormFieldContainer");
17
+ const formFieldBaseStyles = canvas_kit_styling_1.createStyles({
18
+ border: 'none',
19
+ padding: 0,
20
+ margin: `0 0 ${tokens_1.space.m}`,
21
+ });
22
+ /**
23
+ * Use `FormField` to wrap input components to make them accessible. You can customize the field
24
+ * by passing in `TextInput`, `Select`, `RadioGroup` and other form elements to `FormField.Input`.
25
+ *
26
+ * ```tsx
27
+ * <FormField>
28
+ * <FormField.Label>First Name</FormField.Label>
29
+ * <FormField.Input as={TextInput} value={value} onChange={(e) => console.log(e)} />
30
+ * </FormField>
31
+ * ```
32
+ */
14
33
  exports.FormField = common_1.createContainer('div')({
15
34
  displayName: 'FormField',
16
35
  modelHook: hooks_1.useFormFieldModel,
17
36
  subComponents: {
37
+ /**
38
+ * `FormField.Input` will render any `inputs` passed to it including `TextInput`, `Select`, `Switch`, `TextArea`, `RadioGroup` or any custom input.
39
+ * `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`.
40
+ *
41
+ * ```tsx
42
+ * <FormField id='my-unique-id'>
43
+ * <FormField.Label>My Label Text</FormField.Label>
44
+ * <FormField.Input as={TextInput} onChange={(e) => console.log(e)} />
45
+ * <FormField>
46
+ * ```
47
+ */
18
48
  Input: FormFieldInput_1.FormFieldInput,
49
+ /**
50
+ * `FormField.Label` will render a `label` element that has a matching `id` to the `FormField.Input`.
51
+ *
52
+ * ```tsx
53
+ * <FormField>
54
+ * <FormField.Label>First Name</FormField.Label>
55
+ * <FormField.Input as={TextInput} value={value} onChange={(e) => console.log(e)} />
56
+ * </FormField>
57
+ * ```
58
+ */
19
59
  Label: FormFieldLabel_1.FormFieldLabel,
60
+ /**
61
+ * `FormField.Hint` will render any additional information you want to provide to the `FormField.Input`. If you
62
+ * set the `orientation` prop to `horizontal` you should use `FormField.Container` to properly align the hint with your `FormField.Input`.
63
+ *
64
+ * ```tsx
65
+ * <FormField>
66
+ * <FormField.Label>First Name</FormField.Label>
67
+ * <FormField.Input as={TextInput} value={value} onChange={(e) => console.log(e)} />
68
+ * <FormField.Hint>This is your hint text</FormField.Hint>
69
+ * </FormField>
70
+ * ```
71
+ */
20
72
  Hint: FormFieldHint_1.FormFieldHint,
73
+ /**
74
+ * `FormField.Container` allows you to properly center `FormField.Label` when the `orientation` is set to `horizontal` and there is hint text..
75
+ *
76
+ * ```tsx
77
+ * <FormField orientation="horizontal">
78
+ * <FormField.Label>First Name</FormField.Label>
79
+ * <FormField.Container>
80
+ * <FormField.Input as={TextInput} value={value} onChange={(e) => console.log(e)} />
81
+ * <FormField.Hint>This is your hint text</FormField.Hint>
82
+ * </FormField.Container>
83
+ * </FormField>
84
+ * ```
85
+ */
86
+ Container: FormFieldContainer_1.FormFieldContainer,
21
87
  },
22
- })(({ children, orientation, ...elemProps }, Element) => {
23
- const layoutProps = hooks_1.useFormFieldOrientation(orientation);
24
- return (react_1.default.createElement(layout_1.Flex, Object.assign({ as: Element }, layoutProps, elemProps), children));
88
+ })(({ children, ...elemProps }, Element, model) => {
89
+ const layoutProps = hooks_1.useFormFieldOrientation(model.state.orientation);
90
+ return (react_1.default.createElement(layout_1.Flex, Object.assign({ as: Element }, layoutProps, layout_1.mergeStyles(elemProps, formFieldBaseStyles)), children));
25
91
  });
@@ -0,0 +1,11 @@
1
+ import { CSProps } from '@workday/canvas-kit-styling';
2
+ export declare const FormFieldContainer: import("@workday/canvas-kit-react/common").ElementComponentM<"div", CSProps, {
3
+ state: {
4
+ id: string;
5
+ error: "alert" | "error" | undefined;
6
+ orientation: "horizontal" | "vertical";
7
+ isRequired: boolean;
8
+ };
9
+ events: {};
10
+ }>;
11
+ //# sourceMappingURL=FormFieldContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldContainer.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldContainer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA6B,OAAO,EAAC,MAAM,6BAA6B,CAAC;AAShF,eAAO,MAAM,kBAAkB;;;;;;;;EAK7B,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FormFieldContainer = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const common_1 = require("@workday/canvas-kit-react/common");
9
+ const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
10
+ const hooks_1 = require("./hooks");
11
+ const containerBaseStyles = canvas_kit_styling_1.createStyles({
12
+ display: 'flex',
13
+ flexDirection: 'column',
14
+ });
15
+ exports.FormFieldContainer = common_1.createSubcomponent('div')({
16
+ displayName: 'FormField.Container',
17
+ modelHook: hooks_1.useFormFieldModel,
18
+ })((elemProps, Element) => {
19
+ return react_1.default.createElement(Element, Object.assign({}, canvas_kit_styling_1.handleCsProp(elemProps, [containerBaseStyles])));
20
+ });
@@ -1,7 +1,8 @@
1
1
  export declare const FormFieldHint: import("@workday/canvas-kit-react/common").ElementComponentM<"p", Omit<import("@workday/canvas-kit-react/text").TypeLevelProps, "size">, {
2
2
  state: {
3
3
  id: string;
4
- hasError: boolean;
4
+ error: "alert" | "error" | undefined;
5
+ orientation: "horizontal" | "vertical";
5
6
  isRequired: boolean;
6
7
  };
7
8
  events: {};
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldHint.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldHint.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa;;;;;;;EAyBzB,CAAC"}
1
+ {"version":3,"file":"FormFieldHint.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldHint.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa;;;;;;;;EAyBzB,CAAC"}
@@ -19,5 +19,5 @@ exports.FormFieldHint = common_1.createSubcomponent('p')({
19
19
  // If there is no hint text just skip rendering
20
20
  return null;
21
21
  }
22
- return (react_1.default.createElement(text_1.Subtext, Object.assign({ as: Element, size: "medium", color: model.state.hasError ? theme.canvas.palette.error.main : undefined, marginY: tokens_1.space.xxs }, elemProps), children));
22
+ return (react_1.default.createElement(text_1.Subtext, Object.assign({ as: Element, size: "medium", color: model.state.error === 'error' ? theme.canvas.palette.error.main : undefined, marginY: tokens_1.space.xxs }, elemProps), children));
23
23
  });
@@ -1,7 +1,8 @@
1
1
  export declare const FormFieldInput: import("@workday/canvas-kit-react/common").ElementComponentM<"input", import("@workday/canvas-kit-react/layout").BackgroundStyleProps & import("@workday/canvas-kit-react/layout/lib/utils/border/color").BorderColorStyleProps & import("@workday/canvas-kit-react/layout/lib/utils/border/lineStyle").BorderLineStyleProps & import("@workday/canvas-kit-react/layout/lib/utils/border/radius").BorderRadiusStyleProps & import("@workday/canvas-kit-react/layout/lib/utils/border/shorthand").BorderShorthandStyleProps & import("@workday/canvas-kit-react/layout/lib/utils/border/width").BorderWidthStyleProps & import("@workday/canvas-kit-react/layout").ColorStyleProps & import("@workday/canvas-kit-react/layout").DepthStyleProps & import("@workday/canvas-kit-react/layout").FlexItemStyleProps & import("@workday/canvas-kit-react/layout").GridItemStyleProps & import("@workday/canvas-kit-react/layout").LayoutStyleProps & import("@workday/canvas-kit-react/layout").OtherStyleProps & import("@workday/canvas-kit-react/layout").PositionStyleProps & import("@workday/canvas-kit-react/layout").SpaceStyleProps & import("@workday/canvas-kit-react/layout").TextStyleProps & import("@workday/canvas-kit-styling").CSProps, {
2
2
  state: {
3
3
  id: string;
4
- hasError: boolean;
4
+ error: "alert" | "error" | undefined;
5
+ orientation: "horizontal" | "vertical";
5
6
  isRequired: boolean;
6
7
  };
7
8
  events: {};
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldInput.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldInput.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;;;;;;EAMzB,CAAC"}
1
+ {"version":3,"file":"FormFieldInput.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldInput.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;;;;;;;EAMzB,CAAC"}
@@ -10,7 +10,8 @@ export interface FormFieldLabelProps extends ExtractProps<typeof LabelText, neve
10
10
  export declare const FormFieldLabel: import("@workday/canvas-kit-react/common").ElementComponentM<import("@workday/canvas-kit-react/common").ElementComponent<"label", import("@workday/canvas-kit-react/text").TypeLabelProps>, FormFieldLabelProps, {
11
11
  state: {
12
12
  id: string;
13
- hasError: boolean;
13
+ error: "alert" | "error" | undefined;
14
+ orientation: "horizontal" | "vertical";
14
15
  isRequired: boolean;
15
16
  };
16
17
  events: {};
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldLabel.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAqB,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAC,SAAS,EAAO,MAAM,gCAAgC,CAAC;AAM/D,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,OAAO,SAAS,EAAE,KAAK,CAAC;IAChF;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAeD,eAAO,MAAM,cAAc;;;;;;;EAezB,CAAC"}
1
+ {"version":3,"file":"FormFieldLabel.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAqB,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAC,SAAS,EAAO,MAAM,gCAAgC,CAAC;AAM/D,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,OAAO,SAAS,EAAE,KAAK,CAAC;IAChF;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AA+BD,eAAO,MAAM,cAAc;;;;;;;;EAqBzB,CAAC"}
@@ -14,6 +14,10 @@ const layout_1 = require("@workday/canvas-kit-react/layout");
14
14
  const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
15
15
  const labelStyles = canvas_kit_styling_1.createStyles({
16
16
  fontWeight: tokens_1.type.properties.fontWeights.medium,
17
+ paddingInlineStart: 0,
18
+ marginBottom: tokens_1.space.xxxs,
19
+ display: 'flex',
20
+ alignItems: 'center',
17
21
  minWidth: '180px',
18
22
  });
19
23
  const asteriskStyles = canvas_kit_styling_1.createStyles({
@@ -23,12 +27,26 @@ const asteriskStyles = canvas_kit_styling_1.createStyles({
23
27
  textDecoration: 'unset',
24
28
  color: canvas_kit_styling_1.cssVar(canvas_tokens_web_1.brand.error.base, '#de2e21'),
25
29
  });
30
+ const labelModifiers = canvas_kit_styling_1.createModifiers({
31
+ orientation: {
32
+ horizontal: canvas_kit_styling_1.createStyles({
33
+ float: 'left',
34
+ maxHeight: tokens_1.space.xl,
35
+ }),
36
+ vertical: canvas_kit_styling_1.createStyles({
37
+ width: 'auto',
38
+ }),
39
+ },
40
+ });
26
41
  exports.FormFieldLabel = common_1.createSubcomponent(text_1.LabelText)({
27
42
  displayName: 'FormField.Label',
28
43
  modelHook: hooks_1.useFormFieldModel,
29
44
  elemPropsHook: hooks_1.useFormFieldLabel,
30
45
  })(({ children, ...elemProps }, Element, model) => {
31
- return (react_1.default.createElement(text_1.LabelText, Object.assign({ as: Element }, layout_1.mergeStyles(elemProps, [labelStyles])),
46
+ return (react_1.default.createElement(text_1.LabelText, Object.assign({ as: Element }, layout_1.mergeStyles(elemProps, [
47
+ labelStyles,
48
+ labelModifiers({ orientation: model.state.orientation }),
49
+ ])),
32
50
  children,
33
51
  model.state.isRequired && (react_1.default.createElement(text_1.Text, { cs: asteriskStyles, "aria-hidden": "true" }, "*"))));
34
52
  });
@@ -5,7 +5,8 @@
5
5
  export declare const useFormFieldHint: import("@workday/canvas-kit-react/common").BehaviorHook<{
6
6
  state: {
7
7
  id: string;
8
- hasError: boolean;
8
+ error: "alert" | "error" | undefined;
9
+ orientation: "horizontal" | "vertical";
9
10
  isRequired: boolean;
10
11
  };
11
12
  events: {};
@@ -1 +1 @@
1
- {"version":3,"file":"useFormFieldHint.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldHint.tsx"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;EAI3B,CAAC"}
1
+ {"version":3,"file":"useFormFieldHint.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldHint.tsx"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;EAI3B,CAAC"}
@@ -5,7 +5,8 @@
5
5
  export declare const useFormFieldInput: import("@workday/canvas-kit-react/common").BehaviorHook<{
6
6
  state: {
7
7
  id: string;
8
- hasError: boolean;
8
+ error: "alert" | "error" | undefined;
9
+ orientation: "horizontal" | "vertical";
9
10
  isRequired: boolean;
10
11
  };
11
12
  events: {};
@@ -14,5 +15,6 @@ export declare const useFormFieldInput: import("@workday/canvas-kit-react/common
14
15
  'aria-invalid': boolean | undefined;
15
16
  'aria-describedby': string | undefined;
16
17
  id: string | undefined;
18
+ error: "alert" | "error" | undefined;
17
19
  }>;
18
20
  //# sourceMappingURL=useFormFieldInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFormFieldInput.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldInput.tsx"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAO5B,CAAC"}
1
+ {"version":3,"file":"useFormFieldInput.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldInput.tsx"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;EAQ5B,CAAC"}
@@ -10,8 +10,9 @@ const useFormFieldModel_1 = require("./useFormFieldModel");
10
10
  exports.useFormFieldInput = common_1.createElemPropsHook(useFormFieldModel_1.useFormFieldModel)(({ state }) => {
11
11
  return {
12
12
  required: state.isRequired ? true : undefined,
13
- 'aria-invalid': state.hasError ? true : undefined,
13
+ 'aria-invalid': state.error === 'error' ? true : undefined,
14
14
  'aria-describedby': state.id ? `hint-${state.id}` : undefined,
15
15
  id: state.id ? `input-${state.id}` : undefined,
16
+ error: state.error,
16
17
  };
17
18
  });
@@ -5,7 +5,8 @@
5
5
  export declare const useFormFieldLabel: import("@workday/canvas-kit-react/common").BehaviorHook<{
6
6
  state: {
7
7
  id: string;
8
- hasError: boolean;
8
+ error: "alert" | "error" | undefined;
9
+ orientation: "horizontal" | "vertical";
9
10
  isRequired: boolean;
10
11
  };
11
12
  events: {};
@@ -1 +1 @@
1
- {"version":3,"file":"useFormFieldLabel.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldLabel.tsx"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;EAI5B,CAAC"}
1
+ {"version":3,"file":"useFormFieldLabel.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldLabel.tsx"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;EAI5B,CAAC"}
@@ -1,9 +1,15 @@
1
1
  export declare const useFormFieldModel: (<TT_Special_Generic>(config?: (Partial<{
2
2
  /**
3
- * Optional flag to denote if this field has an error to display. When true the `FormField.Input` will have
4
- * `required` set to true, and usually some subcomponents will have a error color applied.
3
+ * Optional flag to denote if this field has an error or warning to display.
4
+ * If value is `error`: `aria-invalid` is added to the `FormField.Input` and the red error ring is added.
5
+ * If value is `alert`: A visual orange warning ring is added to the `FormField.Input`.
5
6
  */
6
- hasError: boolean;
7
+ error: "alert" | "error" | undefined;
8
+ /**
9
+ * The direction the child elements should stack
10
+ * @default vertical
11
+ */
12
+ orientation: "horizontal" | "vertical";
7
13
  /**
8
14
  * Optional `id` provided to `FormField`'s subcomponents as HTML attributes:
9
15
  * - `FormField.Input` will set `aria-describedby` to `hint-${id}`
@@ -24,10 +30,16 @@ export declare const useFormFieldModel: (<TT_Special_Generic>(config?: (Partial<
24
30
  state: {
25
31
  id: string;
26
32
  /**
27
- * Optional flag to denote if this field has an error to display. When true the `FormField.Input` will have
28
- * `required` set to true, and usually some subcomponents will have a error color applied.
33
+ * Optional flag to denote if this field has an error or warning to display.
34
+ * If value is `error`: `aria-invalid` is added to the `FormField.Input` and the red error ring is added.
35
+ * If value is `alert`: A visual orange warning ring is added to the `FormField.Input`.
29
36
  */
30
- hasError: boolean;
37
+ error: "alert" | "error" | undefined;
38
+ /**
39
+ * The direction the child elements should stack
40
+ * @default vertical
41
+ */
42
+ orientation: "horizontal" | "vertical";
31
43
  /**
32
44
  * Optional flag to denote if this field is required. When true the `FormField.Input` will have
33
45
  * `required` set to true, and an asterisk will be appended to the `FormField.Label`.
@@ -37,10 +49,16 @@ export declare const useFormFieldModel: (<TT_Special_Generic>(config?: (Partial<
37
49
  events: {};
38
50
  }) & import("@workday/canvas-kit-react/common").ModelExtras<{
39
51
  /**
40
- * Optional flag to denote if this field has an error to display. When true the `FormField.Input` will have
41
- * `required` set to true, and usually some subcomponents will have a error color applied.
52
+ * Optional flag to denote if this field has an error or warning to display.
53
+ * If value is `error`: `aria-invalid` is added to the `FormField.Input` and the red error ring is added.
54
+ * If value is `alert`: A visual orange warning ring is added to the `FormField.Input`.
55
+ */
56
+ error: "alert" | "error" | undefined;
57
+ /**
58
+ * The direction the child elements should stack
59
+ * @default vertical
42
60
  */
43
- hasError: boolean;
61
+ orientation: "horizontal" | "vertical";
44
62
  /**
45
63
  * Optional `id` provided to `FormField`'s subcomponents as HTML attributes:
46
64
  * - `FormField.Input` will set `aria-describedby` to `hint-${id}`
@@ -60,10 +78,16 @@ export declare const useFormFieldModel: (<TT_Special_Generic>(config?: (Partial<
60
78
  }, {}, {
61
79
  id: string;
62
80
  /**
63
- * Optional flag to denote if this field has an error to display. When true the `FormField.Input` will have
64
- * `required` set to true, and usually some subcomponents will have a error color applied.
81
+ * Optional flag to denote if this field has an error or warning to display.
82
+ * If value is `error`: `aria-invalid` is added to the `FormField.Input` and the red error ring is added.
83
+ * If value is `alert`: A visual orange warning ring is added to the `FormField.Input`.
84
+ */
85
+ error: "alert" | "error" | undefined;
86
+ /**
87
+ * The direction the child elements should stack
88
+ * @default vertical
65
89
  */
66
- hasError: boolean;
90
+ orientation: "horizontal" | "vertical";
67
91
  /**
68
92
  * Optional flag to denote if this field is required. When true the `FormField.Input` will have
69
93
  * `required` set to true, and an asterisk will be appended to the `FormField.Label`.
@@ -73,10 +97,16 @@ export declare const useFormFieldModel: (<TT_Special_Generic>(config?: (Partial<
73
97
  state: {
74
98
  id: string;
75
99
  /**
76
- * Optional flag to denote if this field has an error to display. When true the `FormField.Input` will have
77
- * `required` set to true, and usually some subcomponents will have a error color applied.
100
+ * Optional flag to denote if this field has an error or warning to display.
101
+ * If value is `error`: `aria-invalid` is added to the `FormField.Input` and the red error ring is added.
102
+ * If value is `alert`: A visual orange warning ring is added to the `FormField.Input`.
103
+ */
104
+ error: "alert" | "error" | undefined;
105
+ /**
106
+ * The direction the child elements should stack
107
+ * @default vertical
78
108
  */
79
- hasError: boolean;
109
+ orientation: "horizontal" | "vertical";
80
110
  /**
81
111
  * Optional flag to denote if this field is required. When true the `FormField.Input` will have
82
112
  * `required` set to true, and an asterisk will be appended to the `FormField.Label`.
@@ -1 +1 @@
1
- {"version":3,"file":"useFormFieldModel.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldModel.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;IAE1B;;;OAGG;;IAEH;;;;;;;;;OASG;;IAEH;;;OAGG;;;;;QAnBH;;;WAGG;;QAaH;;;WAGG;;;;;IAnBH;;;OAGG;;IAEH;;;;;;;;;OASG;;IAEH;;;OAGG;;;;IAnBH;;;OAGG;;IAaH;;;OAGG;;;;;QAnBH;;;WAGG;;QAaH;;;WAGG;;;;EAeL,CAAC"}
1
+ {"version":3,"file":"useFormFieldModel.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldModel.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;IAE1B;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;;;;;;;OASG;;IAEH;;;OAGG;;;;;QAzBH;;;;WAIG;;QAEH;;;WAGG;;QAaH;;;WAGG;;;;;IAzBH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;;;;;;;OASG;;IAEH;;;OAGG;;;;IAzBH;;;;OAIG;;IAEH;;;OAGG;;IAaH;;;OAGG;;;;;QAzBH;;;;WAIG;;QAEH;;;WAGG;;QAaH;;;WAGG;;;;EAeL,CAAC"}
@@ -5,10 +5,16 @@ const common_1 = require("@workday/canvas-kit-react/common");
5
5
  exports.useFormFieldModel = common_1.createModelHook({
6
6
  defaultConfig: {
7
7
  /**
8
- * Optional flag to denote if this field has an error to display. When true the `FormField.Input` will have
9
- * `required` set to true, and usually some subcomponents will have a error color applied.
8
+ * Optional flag to denote if this field has an error or warning to display.
9
+ * If value is `error`: `aria-invalid` is added to the `FormField.Input` and the red error ring is added.
10
+ * If value is `alert`: A visual orange warning ring is added to the `FormField.Input`.
10
11
  */
11
- hasError: false,
12
+ error: undefined,
13
+ /**
14
+ * The direction the child elements should stack
15
+ * @default vertical
16
+ */
17
+ orientation: 'vertical',
12
18
  /**
13
19
  * Optional `id` provided to `FormField`'s subcomponents as HTML attributes:
14
20
  * - `FormField.Input` will set `aria-describedby` to `hint-${id}`
@@ -11,7 +11,7 @@ const useFormFieldOrientation = (orientation) => {
11
11
  layoutProps = {
12
12
  flexDirection: 'row',
13
13
  gap: tokens_1.space.l,
14
- alignItems: 'center',
14
+ alignItems: undefined,
15
15
  };
16
16
  }
17
17
  else {
@@ -35,8 +35,8 @@ export declare const RadioGroup: import("@workday/canvas-kit-react/common").Elem
35
35
  events: {};
36
36
  }> & {
37
37
  /**
38
- * `RadioGroup.Radio` renders an `<input type="radio" />` and its associated `<label>` (using `children` as the label's contents).
39
- * This component should satisfy most use cases; use `RadioGroup.Label` if you require more flexibility.
38
+ * `RadioGroup.RadioButton` renders an `<input type="radio" />` and its associated `<label>` (using `children` as the label's contents).
39
+ * This component should satisfy most use cases; use `RadioGroup.Label` and its sub components if you require more flexibility.
40
40
  *
41
41
  * ```tsx
42
42
  * <RadioGroup name="pizza-crust" value="thin">