@workday/canvas-kit-preview-react 7.0.0-alpha.89-next.16 → 7.0.0-alpha.90-next.17
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 +46 -12
- package/dist/commonjs/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormField.js +7 -11
- package/dist/commonjs/form-field/lib/FormFieldHint.d.ts +8 -12
- package/dist/commonjs/form-field/lib/FormFieldHint.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormFieldHint.js +11 -13
- package/dist/commonjs/form-field/lib/FormFieldInput.d.ts +8 -7
- package/dist/commonjs/form-field/lib/FormFieldInput.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormFieldInput.js +5 -19
- package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts +8 -3
- package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormFieldLabel.js +9 -11
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts +8 -5
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.js +2 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts +8 -5
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.js +2 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts +8 -5
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.js +2 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts +77 -15
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.js +41 -15
- package/dist/commonjs/menu/lib/Menu.js +1 -1
- package/dist/commonjs/text-area/lib/TextArea.d.ts +52 -11
- package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextArea.js +9 -15
- package/dist/commonjs/text-area/lib/TextAreaField.d.ts +15 -7
- package/dist/commonjs/text-area/lib/TextAreaField.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextAreaField.js +16 -17
- package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts +27 -7
- package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/TextInput.d.ts +59 -11
- package/dist/commonjs/text-input/lib/TextInput.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/TextInput.js +9 -15
- package/dist/commonjs/text-input/lib/TextInputField.d.ts +15 -7
- package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/TextInputField.js +15 -29
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +8 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +2 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +27 -7
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormField.d.ts +46 -12
- package/dist/es6/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormField.js +8 -12
- package/dist/es6/form-field/lib/FormFieldHint.d.ts +8 -12
- package/dist/es6/form-field/lib/FormFieldHint.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormFieldHint.js +13 -15
- package/dist/es6/form-field/lib/FormFieldInput.d.ts +8 -7
- package/dist/es6/form-field/lib/FormFieldInput.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormFieldInput.js +7 -21
- package/dist/es6/form-field/lib/FormFieldLabel.d.ts +8 -3
- package/dist/es6/form-field/lib/FormFieldLabel.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormFieldLabel.js +11 -13
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts +8 -5
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.js +3 -2
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts +8 -5
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.js +3 -2
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts +8 -5
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.js +3 -2
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts +77 -15
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -1
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.js +42 -15
- package/dist/es6/menu/lib/Menu.js +1 -1
- package/dist/es6/text-area/lib/TextArea.d.ts +52 -11
- package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextArea.js +10 -16
- package/dist/es6/text-area/lib/TextAreaField.d.ts +15 -7
- package/dist/es6/text-area/lib/TextAreaField.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextAreaField.js +17 -18
- package/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts +27 -7
- package/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts.map +1 -1
- package/dist/es6/text-input/lib/TextInput.d.ts +59 -11
- package/dist/es6/text-input/lib/TextInput.d.ts.map +1 -1
- package/dist/es6/text-input/lib/TextInput.js +10 -16
- package/dist/es6/text-input/lib/TextInputField.d.ts +15 -7
- package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -1
- package/dist/es6/text-input/lib/TextInputField.js +17 -31
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +8 -1
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts.map +1 -1
- package/dist/es6/text-input/lib/hooks/useTextInputField.js +3 -2
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +27 -7
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -1
- package/form-field/lib/FormField.tsx +13 -28
- package/form-field/lib/FormFieldHint.tsx +21 -32
- package/form-field/lib/FormFieldInput.tsx +7 -14
- package/form-field/lib/FormFieldLabel.tsx +17 -21
- package/form-field/lib/hooks/useFormFieldHint.tsx +3 -3
- package/form-field/lib/hooks/useFormFieldInput.tsx +3 -3
- package/form-field/lib/hooks/useFormFieldLabel.tsx +3 -3
- package/form-field/lib/hooks/useFormFieldModel.tsx +32 -53
- package/menu/lib/Menu.tsx +1 -1
- package/package.json +7 -16
- package/text-area/lib/TextArea.tsx +15 -29
- package/text-area/lib/TextAreaField.tsx +30 -44
- package/text-area/lib/hooks/useTextAreaModel.ts +1 -3
- package/text-input/lib/TextInput.tsx +15 -29
- package/text-input/lib/TextInputField.tsx +31 -43
- package/text-input/lib/hooks/useTextInputField.tsx +3 -2
- package/text-input/lib/hooks/useTextInputModel.ts +1 -3
- package/dist/commonjs/text-area/lib/TextAreaHint.d.ts +0 -5
- package/dist/commonjs/text-area/lib/TextAreaHint.d.ts.map +0 -1
- package/dist/commonjs/text-area/lib/TextAreaHint.js +0 -5
- package/dist/commonjs/text-area/lib/TextAreaLabel.d.ts +0 -5
- package/dist/commonjs/text-area/lib/TextAreaLabel.d.ts.map +0 -1
- package/dist/commonjs/text-area/lib/TextAreaLabel.js +0 -5
- package/dist/commonjs/text-input/lib/TextInputHint.d.ts +0 -5
- package/dist/commonjs/text-input/lib/TextInputHint.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/TextInputHint.js +0 -5
- package/dist/commonjs/text-input/lib/TextInputLabel.d.ts +0 -5
- package/dist/commonjs/text-input/lib/TextInputLabel.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/TextInputLabel.js +0 -5
- package/dist/es6/text-area/lib/TextAreaHint.d.ts +0 -5
- package/dist/es6/text-area/lib/TextAreaHint.d.ts.map +0 -1
- package/dist/es6/text-area/lib/TextAreaHint.js +0 -2
- package/dist/es6/text-area/lib/TextAreaLabel.d.ts +0 -5
- package/dist/es6/text-area/lib/TextAreaLabel.d.ts.map +0 -1
- package/dist/es6/text-area/lib/TextAreaLabel.js +0 -2
- package/dist/es6/text-input/lib/TextInputHint.d.ts +0 -5
- package/dist/es6/text-input/lib/TextInputHint.d.ts.map +0 -1
- package/dist/es6/text-input/lib/TextInputHint.js +0 -2
- package/dist/es6/text-input/lib/TextInputLabel.d.ts +0 -5
- package/dist/es6/text-input/lib/TextInputLabel.d.ts.map +0 -1
- package/dist/es6/text-input/lib/TextInputLabel.js +0 -2
- package/text-area/lib/TextAreaHint.tsx +0 -6
- package/text-area/lib/TextAreaLabel.tsx +0 -6
- package/text-input/lib/TextInputHint.tsx +0 -6
- package/text-input/lib/TextInputLabel.tsx +0 -6
- package/ts3.5/dist/commonjs/breadcrumbs/index.d.ts +0 -5
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +0 -20
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -38
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts +0 -14
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +0 -13
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts +0 -8
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts +0 -16
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts +0 -11
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts +0 -19
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -4
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +0 -19
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +0 -4
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +0 -3
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/Nav.d.ts +0 -11
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/hooks.d.ts +0 -5
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/index.d.ts +0 -9
- package/ts3.5/dist/commonjs/breadcrumbs/lib/Breadcrumbs/types.d.ts +0 -8
- package/ts3.5/dist/commonjs/color-picker/index.d.ts +0 -2
- package/ts3.5/dist/commonjs/color-picker/lib/ColorPicker.d.ts +0 -55
- package/ts3.5/dist/commonjs/color-picker/lib/parts/ColorReset.d.ts +0 -7
- package/ts3.5/dist/commonjs/color-picker/lib/parts/SwatchBook.d.ts +0 -7
- package/ts3.5/dist/commonjs/form-field/index.d.ts +0 -3
- package/ts3.5/dist/commonjs/form-field/lib/FormField.d.ts +0 -31
- package/ts3.5/dist/commonjs/form-field/lib/FormFieldHint.d.ts +0 -13
- package/ts3.5/dist/commonjs/form-field/lib/FormFieldInput.d.ts +0 -8
- package/ts3.5/dist/commonjs/form-field/lib/FormFieldLabel.d.ts +0 -18
- package/ts3.5/dist/commonjs/form-field/lib/hooks/index.d.ts +0 -6
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts +0 -14
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts +0 -17
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts +0 -14
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts +0 -36
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.d.ts +0 -10
- package/ts3.5/dist/commonjs/index.d.ts +0 -9
- package/ts3.5/dist/commonjs/menu/index.d.ts +0 -6
- package/ts3.5/dist/commonjs/menu/lib/Menu.d.ts +0 -61
- package/ts3.5/dist/commonjs/menu/lib/MenuItem.d.ts +0 -53
- package/ts3.5/dist/commonjs/select/index.d.ts +0 -6
- package/ts3.5/dist/commonjs/select/lib/Select.d.ts +0 -25
- package/ts3.5/dist/commonjs/select/lib/SelectBase.d.ts +0 -123
- package/ts3.5/dist/commonjs/select/lib/SelectMenu.d.ts +0 -42
- package/ts3.5/dist/commonjs/select/lib/SelectOption.d.ts +0 -33
- package/ts3.5/dist/commonjs/select/lib/scrolling.d.ts +0 -2
- package/ts3.5/dist/commonjs/select/lib/types.d.ts +0 -33
- package/ts3.5/dist/commonjs/select/lib/utils.d.ts +0 -4
- package/ts3.5/dist/commonjs/side-panel/index.d.ts +0 -6
- package/ts3.5/dist/commonjs/side-panel/lib/SidePanel.d.ts +0 -86
- package/ts3.5/dist/commonjs/side-panel/lib/hooks.d.ts +0 -80
- package/ts3.5/dist/commonjs/text-area/index.d.ts +0 -2
- package/ts3.5/dist/commonjs/text-area/lib/TextArea.d.ts +0 -22
- package/ts3.5/dist/commonjs/text-area/lib/TextAreaField.d.ts +0 -8
- package/ts3.5/dist/commonjs/text-area/lib/TextAreaHint.d.ts +0 -5
- package/ts3.5/dist/commonjs/text-area/lib/TextAreaLabel.d.ts +0 -5
- package/ts3.5/dist/commonjs/text-area/lib/hooks/index.d.ts +0 -2
- package/ts3.5/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts +0 -8
- package/ts3.5/dist/commonjs/text-input/index.d.ts +0 -3
- package/ts3.5/dist/commonjs/text-input/lib/TextInput.d.ts +0 -22
- package/ts3.5/dist/commonjs/text-input/lib/TextInputField.d.ts +0 -8
- package/ts3.5/dist/commonjs/text-input/lib/TextInputHint.d.ts +0 -5
- package/ts3.5/dist/commonjs/text-input/lib/TextInputLabel.d.ts +0 -5
- package/ts3.5/dist/commonjs/text-input/lib/hooks/index.d.ts +0 -3
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +0 -9
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +0 -8
- package/ts3.5/dist/es6/breadcrumbs/index.d.ts +0 -5
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Button.d.ts +0 -20
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/Menu.d.ts +0 -38
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/MenuItemLink.d.ts +0 -14
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/hooks.d.ts +0 -13
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Dropdown/index.d.ts +0 -8
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Collapsible.d.ts +0 -16
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/CurrentItem.d.ts +0 -11
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/Link.d.ts +0 -19
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/ListItem.d.ts +0 -4
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/hooks.d.ts +0 -19
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/index.d.ts +0 -4
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/List/styles.d.ts +0 -3
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/Nav.d.ts +0 -11
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/hooks.d.ts +0 -5
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/index.d.ts +0 -9
- package/ts3.5/dist/es6/breadcrumbs/lib/Breadcrumbs/types.d.ts +0 -8
- package/ts3.5/dist/es6/color-picker/index.d.ts +0 -2
- package/ts3.5/dist/es6/color-picker/lib/ColorPicker.d.ts +0 -55
- package/ts3.5/dist/es6/color-picker/lib/parts/ColorReset.d.ts +0 -7
- package/ts3.5/dist/es6/color-picker/lib/parts/SwatchBook.d.ts +0 -7
- package/ts3.5/dist/es6/form-field/index.d.ts +0 -3
- package/ts3.5/dist/es6/form-field/lib/FormField.d.ts +0 -31
- package/ts3.5/dist/es6/form-field/lib/FormFieldHint.d.ts +0 -13
- package/ts3.5/dist/es6/form-field/lib/FormFieldInput.d.ts +0 -8
- package/ts3.5/dist/es6/form-field/lib/FormFieldLabel.d.ts +0 -18
- package/ts3.5/dist/es6/form-field/lib/hooks/index.d.ts +0 -6
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts +0 -14
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts +0 -17
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts +0 -14
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts +0 -36
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldOrientation.d.ts +0 -10
- package/ts3.5/dist/es6/index.d.ts +0 -9
- package/ts3.5/dist/es6/menu/index.d.ts +0 -6
- package/ts3.5/dist/es6/menu/lib/Menu.d.ts +0 -61
- package/ts3.5/dist/es6/menu/lib/MenuItem.d.ts +0 -53
- package/ts3.5/dist/es6/select/index.d.ts +0 -6
- package/ts3.5/dist/es6/select/lib/Select.d.ts +0 -25
- package/ts3.5/dist/es6/select/lib/SelectBase.d.ts +0 -123
- package/ts3.5/dist/es6/select/lib/SelectMenu.d.ts +0 -42
- package/ts3.5/dist/es6/select/lib/SelectOption.d.ts +0 -33
- package/ts3.5/dist/es6/select/lib/scrolling.d.ts +0 -2
- package/ts3.5/dist/es6/select/lib/types.d.ts +0 -33
- package/ts3.5/dist/es6/select/lib/utils.d.ts +0 -4
- package/ts3.5/dist/es6/side-panel/index.d.ts +0 -6
- package/ts3.5/dist/es6/side-panel/lib/SidePanel.d.ts +0 -86
- package/ts3.5/dist/es6/side-panel/lib/hooks.d.ts +0 -80
- package/ts3.5/dist/es6/text-area/index.d.ts +0 -2
- package/ts3.5/dist/es6/text-area/lib/TextArea.d.ts +0 -22
- package/ts3.5/dist/es6/text-area/lib/TextAreaField.d.ts +0 -8
- package/ts3.5/dist/es6/text-area/lib/TextAreaHint.d.ts +0 -5
- package/ts3.5/dist/es6/text-area/lib/TextAreaLabel.d.ts +0 -5
- package/ts3.5/dist/es6/text-area/lib/hooks/index.d.ts +0 -2
- package/ts3.5/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts +0 -8
- package/ts3.5/dist/es6/text-input/index.d.ts +0 -3
- package/ts3.5/dist/es6/text-input/lib/TextInput.d.ts +0 -22
- package/ts3.5/dist/es6/text-input/lib/TextInputField.d.ts +0 -8
- package/ts3.5/dist/es6/text-input/lib/TextInputHint.d.ts +0 -5
- package/ts3.5/dist/es6/text-input/lib/TextInputLabel.d.ts +0 -5
- package/ts3.5/dist/es6/text-input/lib/hooks/index.d.ts +0 -3
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +0 -9
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +0 -8
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {createContainer, ExtractProps} from '@workday/canvas-kit-react/common';
|
|
4
4
|
import {Stack, StackSpacing} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
useFormFieldModel,
|
|
8
|
-
FormFieldModel,
|
|
9
|
-
FormFieldModelConfig,
|
|
10
|
-
useFormFieldOrientation,
|
|
11
|
-
} from './hooks';
|
|
6
|
+
import {useFormFieldModel, useFormFieldOrientation} from './hooks';
|
|
12
7
|
import {FormFieldInput} from './FormFieldInput';
|
|
13
8
|
import {FormFieldLabel} from './FormFieldLabel';
|
|
14
9
|
import {FormFieldHint} from './FormFieldHint';
|
|
15
10
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
export interface FormFieldProps
|
|
19
|
-
extends FormFieldModelConfig,
|
|
20
|
-
Omit<ExtractProps<typeof Stack, never>, 'spacing'> {
|
|
21
|
-
model?: FormFieldModel;
|
|
11
|
+
export interface FormFieldProps extends Omit<ExtractProps<typeof Stack, never>, 'spacing'> {
|
|
22
12
|
/**
|
|
23
13
|
* Children of the Text Input. Should contain a `<FormField.Input>`, a `<FormField.Label>` and an optional `<FormField.Hint>`
|
|
24
14
|
*/
|
|
@@ -34,25 +24,20 @@ export interface FormFieldProps
|
|
|
34
24
|
spacing?: StackSpacing;
|
|
35
25
|
}
|
|
36
26
|
|
|
37
|
-
export const FormField =
|
|
27
|
+
export const FormField = createContainer('div')({
|
|
38
28
|
displayName: 'FormField',
|
|
39
|
-
|
|
40
|
-
const {hasError, id, isRequired, ...elemProps} = props;
|
|
41
|
-
const value = useDefaultModel(model, {hasError, id, isRequired}, useFormFieldModel);
|
|
42
|
-
|
|
43
|
-
const layoutProps = useFormFieldOrientation(orientation);
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<FormFieldModelContext.Provider value={value}>
|
|
47
|
-
<Stack ref={ref} {...layoutProps} {...elemProps}>
|
|
48
|
-
{children}
|
|
49
|
-
</Stack>
|
|
50
|
-
</FormFieldModelContext.Provider>
|
|
51
|
-
);
|
|
52
|
-
},
|
|
29
|
+
modelHook: useFormFieldModel,
|
|
53
30
|
subComponents: {
|
|
54
31
|
Input: FormFieldInput,
|
|
55
32
|
Label: FormFieldLabel,
|
|
56
33
|
Hint: FormFieldHint,
|
|
57
34
|
},
|
|
35
|
+
})<FormFieldProps>(({children, orientation, ...elemProps}, Element) => {
|
|
36
|
+
const layoutProps = useFormFieldOrientation(orientation);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Stack as={Element} {...layoutProps} {...elemProps}>
|
|
40
|
+
{children}
|
|
41
|
+
</Stack>
|
|
42
|
+
);
|
|
58
43
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
createSubcomponent,
|
|
4
4
|
ExtractProps,
|
|
5
|
-
useModelContext,
|
|
6
5
|
useTheme,
|
|
7
6
|
styled,
|
|
8
7
|
StyledType,
|
|
@@ -10,42 +9,32 @@ import {
|
|
|
10
9
|
import {space, type} from '@workday/canvas-kit-react/tokens';
|
|
11
10
|
import {Box, BoxProps} from '@workday/canvas-kit-react/layout';
|
|
12
11
|
|
|
13
|
-
import {
|
|
14
|
-
import {FormFieldModel, useFormFieldHint} from './hooks';
|
|
15
|
-
|
|
16
|
-
export interface FormFieldHintProps extends ExtractProps<typeof Box, never> {
|
|
17
|
-
model?: FormFieldModel;
|
|
18
|
-
/**
|
|
19
|
-
* Hint text to show to the user regarding the Error/Alert
|
|
20
|
-
*/
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
}
|
|
12
|
+
import {useFormFieldHint, useFormFieldModel} from './hooks';
|
|
23
13
|
|
|
24
14
|
const StyledHint = styled(Box)<StyledType & BoxProps>({
|
|
25
15
|
...type.levels.subtext.medium,
|
|
26
16
|
});
|
|
27
17
|
|
|
28
|
-
export const FormFieldHint =
|
|
18
|
+
export const FormFieldHint = createSubcomponent('p')({
|
|
29
19
|
displayName: 'FormField.Hint',
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
modelHook: useFormFieldModel,
|
|
21
|
+
elemPropsHook: useFormFieldHint,
|
|
22
|
+
})<ExtractProps<typeof Box, never>>(({children, ...elemProps}, Element, model) => {
|
|
23
|
+
const theme = useTheme();
|
|
34
24
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
25
|
+
if (!children) {
|
|
26
|
+
// If there is no hint text just skip rendering
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
30
|
+
return (
|
|
31
|
+
<StyledHint
|
|
32
|
+
as={Element}
|
|
33
|
+
color={model.state.hasError ? theme.canvas.palette.error.main : undefined}
|
|
34
|
+
marginY={space.xxs}
|
|
35
|
+
{...elemProps}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</StyledHint>
|
|
39
|
+
);
|
|
51
40
|
});
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {createSubcomponent, ExtractProps} from '@workday/canvas-kit-react/common';
|
|
4
4
|
import {Box} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {FormFieldModel, useFormFieldInput} from './hooks';
|
|
6
|
+
import {useFormFieldInput, useFormFieldModel} from './hooks';
|
|
8
7
|
|
|
9
|
-
export
|
|
10
|
-
model?: FormFieldModel;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const FormFieldInput = createComponent('input')({
|
|
8
|
+
export const FormFieldInput = createSubcomponent('input')({
|
|
14
9
|
displayName: 'FormField.Input',
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return <Box as={Element} {...props} />;
|
|
20
|
-
},
|
|
10
|
+
modelHook: useFormFieldModel,
|
|
11
|
+
elemPropsHook: useFormFieldInput,
|
|
12
|
+
})<ExtractProps<typeof Box, never>>((elemProps, Element) => {
|
|
13
|
+
return <Box as={Element} {...elemProps} />;
|
|
21
14
|
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
createSubcomponent,
|
|
5
5
|
ExtractProps,
|
|
6
|
-
useModelContext,
|
|
7
6
|
useTheme,
|
|
8
7
|
styled,
|
|
9
8
|
StyledType,
|
|
@@ -11,11 +10,9 @@ import {
|
|
|
11
10
|
import {Box, HStack, StackSpacing} from '@workday/canvas-kit-react/layout';
|
|
12
11
|
import {type} from '@workday/canvas-kit-react/tokens';
|
|
13
12
|
|
|
14
|
-
import {
|
|
15
|
-
import {FormFieldModel, useFormFieldLabel} from './hooks';
|
|
13
|
+
import {useFormFieldLabel, useFormFieldModel} from './hooks';
|
|
16
14
|
|
|
17
15
|
export interface FormFieldLabelProps extends Omit<ExtractProps<typeof HStack, never>, 'spacing'> {
|
|
18
|
-
model?: FormFieldModel;
|
|
19
16
|
/**
|
|
20
17
|
* The text of the label.
|
|
21
18
|
*/
|
|
@@ -38,22 +35,21 @@ const StyledAsterisk = styled(Box)<StyledType>({
|
|
|
38
35
|
textDecoration: 'unset',
|
|
39
36
|
});
|
|
40
37
|
|
|
41
|
-
export const FormFieldLabel =
|
|
38
|
+
export const FormFieldLabel = createSubcomponent('label')({
|
|
42
39
|
displayName: 'FormField.Label',
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
modelHook: useFormFieldModel,
|
|
41
|
+
elemPropsHook: useFormFieldLabel,
|
|
42
|
+
})<FormFieldLabelProps>(({spacing = 'xxxs', children, ...elemProps}, Element, model) => {
|
|
43
|
+
const theme = useTheme();
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
45
|
+
return (
|
|
46
|
+
<HStack as={Element} spacing={spacing} minWidth="180px" {...elemProps}>
|
|
47
|
+
<StyledFormFieldLabel>{children}</StyledFormFieldLabel>
|
|
48
|
+
{model.state.isRequired && (
|
|
49
|
+
<StyledAsterisk as="span" color={theme.canvas.palette.error.main} aria-hidden="true">
|
|
50
|
+
*
|
|
51
|
+
</StyledAsterisk>
|
|
52
|
+
)}
|
|
53
|
+
</HStack>
|
|
54
|
+
);
|
|
59
55
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {createElemPropsHook} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {useFormFieldModel} from './useFormFieldModel';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Adds the necessary props to a `Hint` component.
|
|
6
6
|
* Used by the FormField.Hint subcomponent and other input type components
|
|
7
7
|
*/
|
|
8
|
-
export const useFormFieldHint =
|
|
8
|
+
export const useFormFieldHint = createElemPropsHook(useFormFieldModel)(({state}) => {
|
|
9
9
|
return {
|
|
10
10
|
id: `hint-${state.id}`,
|
|
11
11
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {createElemPropsHook} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {useFormFieldModel} from './useFormFieldModel';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Adds the necessary props to an `Input` component.
|
|
6
6
|
* Used by the FormField.Input subcomponent and other input type components
|
|
7
7
|
*/
|
|
8
|
-
export const useFormFieldInput =
|
|
8
|
+
export const useFormFieldInput = createElemPropsHook(useFormFieldModel)(({state}) => {
|
|
9
9
|
return {
|
|
10
10
|
required: state.isRequired ? true : undefined,
|
|
11
11
|
'aria-invalid': state.hasError ? true : undefined,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {createElemPropsHook} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {useFormFieldModel} from './useFormFieldModel';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Adds the necessary props to a `Label` component.
|
|
6
6
|
* Used by the FormField.Label subcomponent and other input type components
|
|
7
7
|
*/
|
|
8
|
-
export const useFormFieldLabel =
|
|
8
|
+
export const useFormFieldLabel = createElemPropsHook(useFormFieldModel)(({state}) => {
|
|
9
9
|
return {
|
|
10
10
|
htmlFor: `input-${state.id}`,
|
|
11
11
|
};
|
|
@@ -1,62 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
isRequired?: boolean;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
type FormFieldEvents = {};
|
|
36
|
-
|
|
37
|
-
export type FormFieldModel = Model<FormFieldState, FormFieldEvents>;
|
|
38
|
-
|
|
39
|
-
const formFieldEventMap = createEventMap<FormFieldEvents>()({
|
|
40
|
-
guards: {},
|
|
41
|
-
callbacks: {},
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export type FormFieldModelConfig = FormFieldState &
|
|
45
|
-
Partial<ToModelConfig<FormFieldState, FormFieldEvents, typeof formFieldEventMap>>;
|
|
46
|
-
|
|
47
|
-
export const useFormFieldModel = (config: FormFieldModelConfig = {}): FormFieldModel => {
|
|
1
|
+
import {createModelHook, useUniqueId} from '@workday/canvas-kit-react/common';
|
|
2
|
+
|
|
3
|
+
export const useFormFieldModel = createModelHook({
|
|
4
|
+
defaultConfig: {
|
|
5
|
+
/**
|
|
6
|
+
* Optional flag to denote if this field has an error to display. When true the `FormField.Input` will have
|
|
7
|
+
* `required` set to true, and usually some subcomponents will have a error color applied.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
hasError: false,
|
|
11
|
+
/**
|
|
12
|
+
* Optional `id` provided to `FormField`'s subcomponents as HTML attributes:
|
|
13
|
+
* - `FormField.Input` will set `aria-describedby` to `hint-${id}`
|
|
14
|
+
* - `FormField.Input` will set `id` to `input-${id}`
|
|
15
|
+
* - `FormField.Label` will set `htmlFor` to `input-${id}`
|
|
16
|
+
* - `FormField.Hint` will set `id` to `hint-${id}`
|
|
17
|
+
*
|
|
18
|
+
* If a value is not provided, a unique id will be automatically created by `useUniqueId()`.
|
|
19
|
+
* @default `useUniqueId()`
|
|
20
|
+
*/
|
|
21
|
+
id: '',
|
|
22
|
+
/**
|
|
23
|
+
* Optional flag to denote if this field is required. When true the `FormField.Input` will have
|
|
24
|
+
* `required` set to true, and an asterisk will be appended to the `FormField.Label`.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
isRequired: false,
|
|
28
|
+
},
|
|
29
|
+
})(config => {
|
|
48
30
|
const id = useUniqueId(config.id);
|
|
49
31
|
|
|
50
32
|
const state = {
|
|
51
|
-
|
|
52
|
-
isRequired: config.isRequired,
|
|
33
|
+
...config,
|
|
53
34
|
id,
|
|
54
35
|
};
|
|
55
36
|
|
|
56
|
-
const events = useEventMap(formFieldEventMap, state, config, {});
|
|
57
|
-
|
|
58
37
|
return {
|
|
59
38
|
state,
|
|
60
|
-
events,
|
|
39
|
+
events: {},
|
|
61
40
|
};
|
|
62
|
-
};
|
|
41
|
+
});
|
package/menu/lib/Menu.tsx
CHANGED
|
@@ -121,7 +121,7 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
|
|
|
121
121
|
const cardWidth = grow ? '100%' : width;
|
|
122
122
|
|
|
123
123
|
return (
|
|
124
|
-
<Card
|
|
124
|
+
<Card display="inline-block" padding={space.zero} width={cardWidth} depth={3}>
|
|
125
125
|
<Card.Body>
|
|
126
126
|
<List
|
|
127
127
|
role="menu"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-preview-react",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.90-next.17+1c0258d7",
|
|
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",
|
|
@@ -17,25 +17,16 @@
|
|
|
17
17
|
"*/lib/*",
|
|
18
18
|
"*/index.ts",
|
|
19
19
|
"dist/",
|
|
20
|
-
"index.ts"
|
|
21
|
-
"ts3.5/**/*"
|
|
20
|
+
"index.ts"
|
|
22
21
|
],
|
|
23
|
-
"typesVersions": {
|
|
24
|
-
"<=3.5": {
|
|
25
|
-
"*": [
|
|
26
|
-
"ts3.5/*"
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
22
|
"scripts": {
|
|
31
23
|
"watch": "yarn build:es6 -w",
|
|
32
24
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
33
|
-
"clean": "rimraf dist && rimraf
|
|
25
|
+
"clean": "rimraf dist && rimraf .build-info && mkdirp dist",
|
|
34
26
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
35
27
|
"build:es6": "tsc -p tsconfig.es6.json",
|
|
36
28
|
"build:rebuild": "npm-run-all clean build",
|
|
37
|
-
"build
|
|
38
|
-
"build": "npm-run-all --parallel build:cjs build:es6 --sequential build:downlevel-dts",
|
|
29
|
+
"build": "npm-run-all --parallel build:cjs build:es6",
|
|
39
30
|
"prepack": "node ../../utils/publish.js pre preview-react",
|
|
40
31
|
"postpack": "node ../../utils/publish.js post preview-react",
|
|
41
32
|
"depcheck": "node ../../utils/check-dependencies-exist.js",
|
|
@@ -54,15 +45,15 @@
|
|
|
54
45
|
"dependencies": {
|
|
55
46
|
"@emotion/react": "^11.7.1",
|
|
56
47
|
"@emotion/styled": "^11.6.0",
|
|
57
|
-
"@workday/canvas-kit-react": "^7.0.0-alpha.
|
|
48
|
+
"@workday/canvas-kit-react": "^7.0.0-alpha.90-next.17+1c0258d7",
|
|
58
49
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
59
50
|
"@workday/design-assets-types": "^0.2.4"
|
|
60
51
|
},
|
|
61
52
|
"devDependencies": {
|
|
62
53
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
63
|
-
"@workday/canvas-kit-labs-react": "^7.0.0-alpha.
|
|
54
|
+
"@workday/canvas-kit-labs-react": "^7.0.0-alpha.90-next.17+1c0258d7",
|
|
64
55
|
"formik": "^2.2.9",
|
|
65
56
|
"yup": "^0.31.1"
|
|
66
57
|
},
|
|
67
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "1c0258d72c737b6a42791bad140183c01d736c03"
|
|
68
59
|
}
|
|
@@ -1,47 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
FormField,
|
|
6
|
-
FormFieldModelContext,
|
|
7
|
-
useFormFieldOrientation,
|
|
8
|
-
} from '@workday/canvas-kit-preview-react/form-field';
|
|
3
|
+
import {createContainer, ExtractProps} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {FormField, useFormFieldOrientation} from '@workday/canvas-kit-preview-react/form-field';
|
|
9
5
|
import {Stack} from '@workday/canvas-kit-react/layout';
|
|
10
6
|
|
|
11
|
-
import {
|
|
7
|
+
import {useTextAreaModel} from './hooks';
|
|
12
8
|
import {TextAreaField} from './TextAreaField';
|
|
13
|
-
import {TextAreaLabel} from './TextAreaLabel';
|
|
14
|
-
import {TextAreaHint} from './TextAreaHint';
|
|
15
|
-
|
|
16
|
-
export const TextAreaModelContext = FormFieldModelContext;
|
|
17
9
|
|
|
18
10
|
export interface TextAreaProps extends ExtractProps<typeof FormField, never> {
|
|
19
|
-
model?: TextAreaModel;
|
|
20
11
|
/**
|
|
21
12
|
* Children of the Text Input. Should contain a `<TextArea.Field>`, a `<TextArea.Label>` and an optional `<TextArea.Hint>`
|
|
22
13
|
*/
|
|
23
14
|
children: React.ReactNode;
|
|
24
15
|
}
|
|
25
16
|
|
|
26
|
-
export const TextArea =
|
|
17
|
+
export const TextArea = createContainer('div')({
|
|
27
18
|
displayName: 'TextArea',
|
|
28
|
-
|
|
29
|
-
const {hasError, id, isRequired, ...elemProps} = props;
|
|
30
|
-
const value = useDefaultModel(model, {hasError, id, isRequired}, useTextAreaModel);
|
|
31
|
-
|
|
32
|
-
const layoutProps = useFormFieldOrientation(orientation);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<TextAreaModelContext.Provider value={value}>
|
|
36
|
-
<Stack ref={ref} {...layoutProps} {...elemProps}>
|
|
37
|
-
{children}
|
|
38
|
-
</Stack>
|
|
39
|
-
</TextAreaModelContext.Provider>
|
|
40
|
-
);
|
|
41
|
-
},
|
|
19
|
+
modelHook: useTextAreaModel,
|
|
42
20
|
subComponents: {
|
|
43
21
|
Field: TextAreaField,
|
|
44
|
-
Label:
|
|
45
|
-
Hint:
|
|
22
|
+
Label: FormField.Label,
|
|
23
|
+
Hint: FormField.Hint,
|
|
46
24
|
},
|
|
25
|
+
})<TextAreaProps>(({children, orientation, ...elemProps}, Element) => {
|
|
26
|
+
const layoutProps = useFormFieldOrientation(orientation);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Stack as={Element} {...layoutProps} {...elemProps}>
|
|
30
|
+
{children}
|
|
31
|
+
</Stack>
|
|
32
|
+
);
|
|
47
33
|
});
|
|
@@ -9,21 +9,10 @@ import {
|
|
|
9
9
|
spaceNumbers,
|
|
10
10
|
type,
|
|
11
11
|
} from '@workday/canvas-kit-react/tokens';
|
|
12
|
-
import {
|
|
13
|
-
createComponent,
|
|
14
|
-
ExtractProps,
|
|
15
|
-
useModelContext,
|
|
16
|
-
useTheme,
|
|
17
|
-
} from '@workday/canvas-kit-react/common';
|
|
12
|
+
import {createSubcomponent, ExtractProps, useTheme} from '@workday/canvas-kit-react/common';
|
|
18
13
|
import {useThemedRing} from '@workday/canvas-kit-labs-react/common';
|
|
19
14
|
import {FormField} from '@workday/canvas-kit-preview-react/form-field';
|
|
20
|
-
|
|
21
|
-
import {TextAreaModelContext} from './TextArea';
|
|
22
|
-
import {TextAreaModel} from './hooks';
|
|
23
|
-
|
|
24
|
-
export interface TextAreaFieldProps extends ExtractProps<typeof FormField.Input, never> {
|
|
25
|
-
model?: TextAreaModel;
|
|
26
|
-
}
|
|
15
|
+
import {useTextInputModel} from '@workday/canvas-kit-preview-react/text-input';
|
|
27
16
|
|
|
28
17
|
const baseStyles: CSSProperties = {
|
|
29
18
|
...type.levels.subtext.large,
|
|
@@ -51,38 +40,35 @@ const baseStyles: CSSProperties = {
|
|
|
51
40
|
},
|
|
52
41
|
};
|
|
53
42
|
|
|
54
|
-
export const TextAreaField =
|
|
43
|
+
export const TextAreaField = createSubcomponent('textarea')({
|
|
55
44
|
displayName: 'TextArea.Field',
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
modelHook: useTextInputModel,
|
|
46
|
+
})<ExtractProps<typeof FormField.Input, never>>(({...elemProps}, Element, model) => {
|
|
47
|
+
const theme = useTheme();
|
|
48
|
+
const errorRing = useThemedRing('error');
|
|
58
49
|
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
const focusStyles = model.state.hasError
|
|
51
|
+
? errorRing
|
|
52
|
+
: {
|
|
53
|
+
'&:focus:not([disabled])': {
|
|
54
|
+
borderColor: theme.canvas.palette.common.focusOutline,
|
|
55
|
+
boxShadow: `inset 0 0 0 1px ${theme.canvas.palette.common.focusOutline}`,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
61
58
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
border={`1px solid ${inputColors.border}`}
|
|
78
|
-
display="block"
|
|
79
|
-
backgroundColor={inputColors.background}
|
|
80
|
-
borderRadius={borderRadius.m}
|
|
81
|
-
minHeight={64}
|
|
82
|
-
minWidth={280}
|
|
83
|
-
padding={spaceNumbers.xxs} // Compensate for border
|
|
84
|
-
margin={0} // Fix Safari
|
|
85
|
-
/>
|
|
86
|
-
);
|
|
87
|
-
},
|
|
59
|
+
return (
|
|
60
|
+
<FormField.Input
|
|
61
|
+
as={Element}
|
|
62
|
+
css={[baseStyles, focusStyles]}
|
|
63
|
+
{...elemProps}
|
|
64
|
+
border={`1px solid ${inputColors.border}`}
|
|
65
|
+
display="block"
|
|
66
|
+
backgroundColor={inputColors.background}
|
|
67
|
+
borderRadius={borderRadius.m}
|
|
68
|
+
minHeight={64}
|
|
69
|
+
minWidth={280}
|
|
70
|
+
padding={spaceNumbers.xxs} // Compensate for border
|
|
71
|
+
margin={0} // Fix Safari
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
88
74
|
});
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {useFormFieldModel
|
|
1
|
+
import {useFormFieldModel} from '@workday/canvas-kit-preview-react/form-field';
|
|
2
2
|
|
|
3
3
|
export const useTextAreaModel = useFormFieldModel;
|
|
4
|
-
|
|
5
|
-
export type TextAreaModel = FormFieldModel;
|