@workday/canvas-kit-preview-react 6.0.7 → 6.1.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/index.d.ts +3 -0
- package/dist/commonjs/form-field/index.d.ts.map +1 -0
- package/dist/commonjs/form-field/index.js +7 -0
- package/dist/commonjs/form-field/lib/FormField.d.ts +31 -0
- package/dist/commonjs/form-field/lib/FormField.d.ts.map +1 -0
- package/dist/commonjs/form-field/lib/FormField.js +51 -0
- package/dist/commonjs/form-field/lib/FormFieldHint.d.ts +13 -0
- package/dist/commonjs/form-field/lib/FormFieldHint.d.ts.map +1 -0
- package/dist/commonjs/form-field/lib/FormFieldHint.js +45 -0
- package/dist/commonjs/form-field/lib/FormFieldInput.d.ts +8 -0
- package/dist/commonjs/form-field/lib/FormFieldInput.d.ts.map +1 -0
- package/dist/commonjs/form-field/lib/FormFieldInput.js +41 -0
- package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts +18 -0
- package/dist/commonjs/form-field/lib/FormFieldLabel.d.ts.map +1 -0
- package/dist/commonjs/form-field/lib/FormFieldLabel.js +51 -0
- package/dist/commonjs/form-field/lib/hooks/index.d.ts +6 -0
- package/dist/commonjs/form-field/lib/hooks/index.d.ts.map +1 -0
- package/dist/commonjs/form-field/lib/hooks/index.js +10 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts +15 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.js +13 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts +18 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.js +16 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts +15 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.js +13 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts +36 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.js +21 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.d.ts +9 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.d.ts.map +1 -0
- package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.js +24 -0
- package/dist/commonjs/index.d.ts +3 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +3 -0
- package/dist/commonjs/text-area/index.d.ts +2 -0
- package/dist/commonjs/text-area/index.d.ts.map +1 -0
- package/dist/commonjs/text-area/index.js +6 -0
- package/dist/commonjs/text-area/lib/TextArea.d.ts +22 -0
- package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -0
- package/dist/commonjs/text-area/lib/TextArea.js +52 -0
- package/dist/commonjs/text-area/lib/TextAreaField.d.ts +8 -0
- package/dist/commonjs/text-area/lib/TextAreaField.d.ts.map +1 -0
- package/dist/commonjs/text-area/lib/TextAreaField.js +65 -0
- package/dist/commonjs/text-area/lib/TextAreaHint.d.ts +5 -0
- package/dist/commonjs/text-area/lib/TextAreaHint.d.ts.map +1 -0
- package/dist/commonjs/text-area/lib/TextAreaHint.js +4 -0
- package/dist/commonjs/text-area/lib/TextAreaLabel.d.ts +5 -0
- package/dist/commonjs/text-area/lib/TextAreaLabel.d.ts.map +1 -0
- package/dist/commonjs/text-area/lib/TextAreaLabel.js +4 -0
- package/dist/commonjs/text-area/lib/hooks/index.d.ts +2 -0
- package/dist/commonjs/text-area/lib/hooks/index.d.ts.map +1 -0
- package/dist/commonjs/text-area/lib/hooks/index.js +6 -0
- package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts +8 -0
- package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts.map +1 -0
- package/dist/commonjs/text-area/lib/hooks/useTextAreaModel.js +4 -0
- package/dist/commonjs/text-input/index.d.ts +3 -0
- package/dist/commonjs/text-input/index.d.ts.map +1 -0
- package/dist/commonjs/text-input/index.js +7 -0
- package/dist/commonjs/text-input/lib/TextInput.d.ts +22 -0
- package/dist/commonjs/text-input/lib/TextInput.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/TextInput.js +52 -0
- package/dist/commonjs/text-input/lib/TextInputField.d.ts +8 -0
- package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/TextInputField.js +67 -0
- package/dist/commonjs/text-input/lib/TextInputHint.d.ts +5 -0
- package/dist/commonjs/text-input/lib/TextInputHint.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/TextInputHint.js +4 -0
- package/dist/commonjs/text-input/lib/TextInputLabel.d.ts +5 -0
- package/dist/commonjs/text-input/lib/TextInputLabel.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/TextInputLabel.js +4 -0
- package/dist/commonjs/text-input/lib/hooks/index.d.ts +3 -0
- package/dist/commonjs/text-input/lib/hooks/index.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/hooks/index.js +7 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +10 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +11 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +8 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.js +4 -0
- package/dist/es6/form-field/index.d.ts +3 -0
- package/dist/es6/form-field/index.d.ts.map +1 -0
- package/dist/es6/form-field/index.js +2 -0
- package/dist/es6/form-field/lib/FormField.d.ts +31 -0
- package/dist/es6/form-field/lib/FormField.d.ts.map +1 -0
- package/dist/es6/form-field/lib/FormField.js +46 -0
- package/dist/es6/form-field/lib/FormFieldHint.d.ts +13 -0
- package/dist/es6/form-field/lib/FormFieldHint.d.ts.map +1 -0
- package/dist/es6/form-field/lib/FormFieldHint.js +43 -0
- package/dist/es6/form-field/lib/FormFieldInput.d.ts +8 -0
- package/dist/es6/form-field/lib/FormFieldInput.d.ts.map +1 -0
- package/dist/es6/form-field/lib/FormFieldInput.js +36 -0
- package/dist/es6/form-field/lib/FormFieldLabel.d.ts +18 -0
- package/dist/es6/form-field/lib/FormFieldLabel.d.ts.map +1 -0
- package/dist/es6/form-field/lib/FormFieldLabel.js +49 -0
- package/dist/es6/form-field/lib/hooks/index.d.ts +6 -0
- package/dist/es6/form-field/lib/hooks/index.d.ts.map +1 -0
- package/dist/es6/form-field/lib/hooks/index.js +5 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts +15 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts.map +1 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.js +11 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts +18 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts.map +1 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.js +14 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts +15 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts.map +1 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.js +11 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts +36 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts.map +1 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.js +19 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.d.ts +9 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.d.ts.map +1 -0
- package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.js +22 -0
- package/dist/es6/index.d.ts +3 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +3 -0
- package/dist/es6/text-area/index.d.ts +2 -0
- package/dist/es6/text-area/index.d.ts.map +1 -0
- package/dist/es6/text-area/index.js +1 -0
- package/dist/es6/text-area/lib/TextArea.d.ts +22 -0
- package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -0
- package/dist/es6/text-area/lib/TextArea.js +47 -0
- package/dist/es6/text-area/lib/TextAreaField.d.ts +8 -0
- package/dist/es6/text-area/lib/TextAreaField.d.ts.map +1 -0
- package/dist/es6/text-area/lib/TextAreaField.js +63 -0
- package/dist/es6/text-area/lib/TextAreaHint.d.ts +5 -0
- package/dist/es6/text-area/lib/TextAreaHint.d.ts.map +1 -0
- package/dist/es6/text-area/lib/TextAreaHint.js +2 -0
- package/dist/es6/text-area/lib/TextAreaLabel.d.ts +5 -0
- package/dist/es6/text-area/lib/TextAreaLabel.d.ts.map +1 -0
- package/dist/es6/text-area/lib/TextAreaLabel.js +2 -0
- package/dist/es6/text-area/lib/hooks/index.d.ts +2 -0
- package/dist/es6/text-area/lib/hooks/index.d.ts.map +1 -0
- package/dist/es6/text-area/lib/hooks/index.js +1 -0
- package/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts +8 -0
- package/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts.map +1 -0
- package/dist/es6/text-area/lib/hooks/useTextAreaModel.js +2 -0
- package/dist/es6/text-input/index.d.ts +3 -0
- package/dist/es6/text-input/index.d.ts.map +1 -0
- package/dist/es6/text-input/index.js +2 -0
- package/dist/es6/text-input/lib/TextInput.d.ts +22 -0
- package/dist/es6/text-input/lib/TextInput.d.ts.map +1 -0
- package/dist/es6/text-input/lib/TextInput.js +47 -0
- package/dist/es6/text-input/lib/TextInputField.d.ts +8 -0
- package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -0
- package/dist/es6/text-input/lib/TextInputField.js +65 -0
- package/dist/es6/text-input/lib/TextInputHint.d.ts +5 -0
- package/dist/es6/text-input/lib/TextInputHint.d.ts.map +1 -0
- package/dist/es6/text-input/lib/TextInputHint.js +2 -0
- package/dist/es6/text-input/lib/TextInputLabel.d.ts +5 -0
- package/dist/es6/text-input/lib/TextInputLabel.d.ts.map +1 -0
- package/dist/es6/text-input/lib/TextInputLabel.js +2 -0
- package/dist/es6/text-input/lib/hooks/index.d.ts +3 -0
- package/dist/es6/text-input/lib/hooks/index.d.ts.map +1 -0
- package/dist/es6/text-input/lib/hooks/index.js +2 -0
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +10 -0
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts.map +1 -0
- package/dist/es6/text-input/lib/hooks/useTextInputField.js +9 -0
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +8 -0
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -0
- package/dist/es6/text-input/lib/hooks/useTextInputModel.js +2 -0
- package/form-field/LICENSE +52 -0
- package/form-field/README.md +8 -0
- package/form-field/index.ts +2 -0
- package/form-field/lib/FormField.tsx +56 -0
- package/form-field/lib/FormFieldHint.tsx +46 -0
- package/form-field/lib/FormFieldInput.tsx +21 -0
- package/form-field/lib/FormFieldLabel.tsx +70 -0
- package/form-field/lib/hooks/index.ts +5 -0
- package/form-field/lib/hooks/useFormFieldHint.tsx +12 -0
- package/form-field/lib/hooks/useFormFieldInput.tsx +15 -0
- package/form-field/lib/hooks/useFormFieldLabel.tsx +12 -0
- package/form-field/lib/hooks/useFormFieldModel.tsx +62 -0
- package/form-field/lib/hooks/useFormFieldOrientation.tsx +29 -0
- package/form-field/package.json +5 -0
- package/index.ts +3 -0
- package/package.json +6 -4
- package/text-area/LICENSE +52 -0
- package/text-area/README.md +7 -0
- package/text-area/index.ts +1 -0
- package/text-area/lib/TextArea.tsx +43 -0
- package/text-area/lib/TextAreaField.tsx +81 -0
- package/text-area/lib/TextAreaHint.tsx +6 -0
- package/text-area/lib/TextAreaLabel.tsx +6 -0
- package/text-area/lib/hooks/index.ts +1 -0
- package/text-area/lib/hooks/useTextAreaModel.ts +8 -0
- package/text-area/package.json +5 -0
- package/text-input/LICENSE +52 -0
- package/text-input/README.md +7 -0
- package/text-input/index.ts +2 -0
- package/text-input/lib/TextInput.tsx +43 -0
- package/text-input/lib/TextInputField.tsx +81 -0
- package/text-input/lib/TextInputHint.tsx +6 -0
- package/text-input/lib/TextInputLabel.tsx +6 -0
- package/text-input/lib/hooks/index.ts +2 -0
- package/text-input/lib/hooks/useTextInputField.tsx +10 -0
- package/text-input/lib/hooks/useTextInputModel.ts +8 -0
- package/text-input/package.json +5 -0
- package/ts3.5/dist/commonjs/form-field/index.d.ts +3 -0
- package/ts3.5/dist/commonjs/form-field/lib/FormField.d.ts +31 -0
- package/ts3.5/dist/commonjs/form-field/lib/FormFieldHint.d.ts +13 -0
- package/ts3.5/dist/commonjs/form-field/lib/FormFieldInput.d.ts +8 -0
- package/ts3.5/dist/commonjs/form-field/lib/FormFieldLabel.d.ts +18 -0
- package/ts3.5/dist/commonjs/form-field/lib/hooks/index.d.ts +6 -0
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldHint.d.ts +15 -0
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldInput.d.ts +18 -0
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.d.ts +15 -0
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldModel.d.ts +36 -0
- package/ts3.5/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.d.ts +9 -0
- package/ts3.5/dist/commonjs/index.d.ts +3 -0
- package/ts3.5/dist/commonjs/text-area/index.d.ts +2 -0
- package/ts3.5/dist/commonjs/text-area/lib/TextArea.d.ts +22 -0
- package/ts3.5/dist/commonjs/text-area/lib/TextAreaField.d.ts +8 -0
- package/ts3.5/dist/commonjs/text-area/lib/TextAreaHint.d.ts +5 -0
- package/ts3.5/dist/commonjs/text-area/lib/TextAreaLabel.d.ts +5 -0
- package/ts3.5/dist/commonjs/text-area/lib/hooks/index.d.ts +2 -0
- package/ts3.5/dist/commonjs/text-area/lib/hooks/useTextAreaModel.d.ts +8 -0
- package/ts3.5/dist/commonjs/text-input/index.d.ts +3 -0
- package/ts3.5/dist/commonjs/text-input/lib/TextInput.d.ts +22 -0
- package/ts3.5/dist/commonjs/text-input/lib/TextInputField.d.ts +8 -0
- package/ts3.5/dist/commonjs/text-input/lib/TextInputHint.d.ts +5 -0
- package/ts3.5/dist/commonjs/text-input/lib/TextInputLabel.d.ts +5 -0
- package/ts3.5/dist/commonjs/text-input/lib/hooks/index.d.ts +3 -0
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +10 -0
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +8 -0
- package/ts3.5/dist/es6/form-field/index.d.ts +3 -0
- package/ts3.5/dist/es6/form-field/lib/FormField.d.ts +31 -0
- package/ts3.5/dist/es6/form-field/lib/FormFieldHint.d.ts +13 -0
- package/ts3.5/dist/es6/form-field/lib/FormFieldInput.d.ts +8 -0
- package/ts3.5/dist/es6/form-field/lib/FormFieldLabel.d.ts +18 -0
- package/ts3.5/dist/es6/form-field/lib/hooks/index.d.ts +6 -0
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldHint.d.ts +15 -0
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldInput.d.ts +18 -0
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldLabel.d.ts +15 -0
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldModel.d.ts +36 -0
- package/ts3.5/dist/es6/form-field/lib/hooks/useFormFieldOrientation.d.ts +9 -0
- package/ts3.5/dist/es6/index.d.ts +3 -0
- package/ts3.5/dist/es6/text-area/index.d.ts +2 -0
- package/ts3.5/dist/es6/text-area/lib/TextArea.d.ts +22 -0
- package/ts3.5/dist/es6/text-area/lib/TextAreaField.d.ts +8 -0
- package/ts3.5/dist/es6/text-area/lib/TextAreaHint.d.ts +5 -0
- package/ts3.5/dist/es6/text-area/lib/TextAreaLabel.d.ts +5 -0
- package/ts3.5/dist/es6/text-area/lib/hooks/index.d.ts +2 -0
- package/ts3.5/dist/es6/text-area/lib/hooks/useTextAreaModel.d.ts +8 -0
- package/ts3.5/dist/es6/text-input/index.d.ts +3 -0
- package/ts3.5/dist/es6/text-input/lib/TextInput.d.ts +22 -0
- package/ts3.5/dist/es6/text-input/lib/TextInputField.d.ts +8 -0
- package/ts3.5/dist/es6/text-input/lib/TextInputHint.d.ts +5 -0
- package/ts3.5/dist/es6/text-input/lib/TextInputLabel.d.ts +5 -0
- package/ts3.5/dist/es6/text-input/lib/hooks/index.d.ts +3 -0
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +10 -0
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +8 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../form-field/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Stack, StackSpacing } from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
+
import { FormFieldModel, FormFieldModelConfig } from './hooks';
|
|
5
|
+
export declare const FormFieldModelContext: React.Context<import("@workday/canvas-kit-react/common").Model<{
|
|
6
|
+
hasError?: boolean | undefined;
|
|
7
|
+
id?: string | undefined;
|
|
8
|
+
isRequired?: boolean | undefined;
|
|
9
|
+
}, {}>>;
|
|
10
|
+
export interface FormFieldProps extends FormFieldModelConfig, Omit<ExtractProps<typeof Stack, never>, 'spacing'> {
|
|
11
|
+
model?: FormFieldModel;
|
|
12
|
+
/**
|
|
13
|
+
* Children of the Text Input. Should contain a `<FormField.Input>`, a `<FormField.Label>` and an optional `<FormField.Hint>`
|
|
14
|
+
*/
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* The direction the child elements should stack
|
|
18
|
+
*/
|
|
19
|
+
orientation: 'vertical' | 'horizontal';
|
|
20
|
+
/**
|
|
21
|
+
* Spacing between children elements
|
|
22
|
+
* @default xxxs when vertical l when orientation is horizontal
|
|
23
|
+
*/
|
|
24
|
+
spacing?: StackSpacing;
|
|
25
|
+
}
|
|
26
|
+
export declare const FormField: import("@workday/canvas-kit-react/common").Component<FormFieldProps> & {
|
|
27
|
+
Input: import("@workday/canvas-kit-react/common").ElementComponent<"input", import("./FormFieldInput").FormFieldInputProps>;
|
|
28
|
+
Label: import("@workday/canvas-kit-react/common").ElementComponent<"label", import("./FormFieldLabel").FormFieldLabelProps>;
|
|
29
|
+
Hint: import("@workday/canvas-kit-react/common").ElementComponent<"p", import("./FormFieldHint").FormFieldHintProps>;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=FormField.d.ts.map
|
|
@@ -0,0 +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,YAAY,EAAkB,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAC,KAAK,EAAE,YAAY,EAAC,MAAM,uCAAuC,CAAC;AAE1E,OAAO,EAEL,cAAc,EACd,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAKjB,eAAO,MAAM,qBAAqB;;;;OAAiD,CAAC;AAEpF,MAAM,WAAW,cAAe,SAAQ,oBAAoB,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO,KAAK,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAC9G,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,WAAW,EAAE,UAAU,GAAG,YAAY,CAAA;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAED,eAAO,MAAM,SAAS;;;;CAqBpB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
var react_1 = __importDefault(require("react"));
|
|
29
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
30
|
+
var layout_1 = require("@workday/canvas-kit-labs-react/layout");
|
|
31
|
+
var hooks_1 = require("./hooks");
|
|
32
|
+
var FormFieldInput_1 = require("./FormFieldInput");
|
|
33
|
+
var FormFieldLabel_1 = require("./FormFieldLabel");
|
|
34
|
+
var FormFieldHint_1 = require("./FormFieldHint");
|
|
35
|
+
exports.FormFieldModelContext = react_1.default.createContext({});
|
|
36
|
+
exports.FormField = common_1.createComponent()({
|
|
37
|
+
displayName: 'FormField',
|
|
38
|
+
Component: function (_a, ref) {
|
|
39
|
+
var children = _a.children, model = _a.model, spacing = _a.spacing, orientation = _a.orientation, props = __rest(_a, ["children", "model", "spacing", "orientation"]);
|
|
40
|
+
var hasError = props.hasError, id = props.id, isRequired = props.isRequired, elemProps = __rest(props, ["hasError", "id", "isRequired"]);
|
|
41
|
+
var value = common_1.useDefaultModel(model, { hasError: hasError, id: id, isRequired: isRequired }, hooks_1.useFormFieldModel);
|
|
42
|
+
var layoutProps = hooks_1.useFormFieldOrientation(orientation);
|
|
43
|
+
return (react_1.default.createElement(exports.FormFieldModelContext.Provider, { value: value },
|
|
44
|
+
react_1.default.createElement(layout_1.Stack, __assign({ ref: ref }, layoutProps, elemProps), children)));
|
|
45
|
+
},
|
|
46
|
+
subComponents: {
|
|
47
|
+
Input: FormFieldInput_1.FormFieldInput,
|
|
48
|
+
Label: FormFieldLabel_1.FormFieldLabel,
|
|
49
|
+
Hint: FormFieldHint_1.FormFieldHint,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Box } from '@workday/canvas-kit-labs-react/common';
|
|
4
|
+
import { FormFieldModel } from './hooks';
|
|
5
|
+
export interface FormFieldHintProps extends ExtractProps<typeof Box, never> {
|
|
6
|
+
model?: FormFieldModel;
|
|
7
|
+
/**
|
|
8
|
+
* Hint text to show to the user regarding the Error/Alert
|
|
9
|
+
*/
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const FormFieldHint: import("@workday/canvas-kit-react/common").ElementComponent<"p", FormFieldHintProps>;
|
|
13
|
+
//# sourceMappingURL=FormFieldHint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormFieldHint.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldHint.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,YAAY,EAA4B,MAAM,kCAAkC,CAAC;AAE1G,OAAO,EAAC,GAAG,EAAC,MAAM,uCAAuC,CAAC;AAG1D,OAAO,EAAC,cAAc,EAAmB,MAAM,SAAS,CAAC;AAEzD,MAAM,WAAW,kBAAmB,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IACzE,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,aAAa,sFA0BxB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
/** @jsx jsx */
|
|
26
|
+
var core_1 = require("@emotion/core");
|
|
27
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
28
|
+
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
29
|
+
var common_2 = require("@workday/canvas-kit-labs-react/common");
|
|
30
|
+
var FormField_1 = require("./FormField");
|
|
31
|
+
var hooks_1 = require("./hooks");
|
|
32
|
+
exports.FormFieldHint = common_1.createComponent('p')({
|
|
33
|
+
displayName: 'FormField.Hint',
|
|
34
|
+
Component: function (_a, ref, Element) {
|
|
35
|
+
var model = _a.model, children = _a.children, elemProps = __rest(_a, ["model", "children"]);
|
|
36
|
+
var localModel = common_1.useModelContext(FormField_1.FormFieldModelContext, model);
|
|
37
|
+
var props = hooks_1.useFormFieldHint(localModel, elemProps, ref);
|
|
38
|
+
var theme = common_1.useTheme();
|
|
39
|
+
if (!children) {
|
|
40
|
+
// If there is no hint text just skip rendering
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return (core_1.jsx(common_2.Box, __assign({ as: Element, css: __assign({}, tokens_1.type.levels.subtext.medium), color: localModel.state.hasError ? theme.canvas.palette.error.main : undefined, marginY: tokens_1.space.xxs }, props), children));
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { Box } from '@workday/canvas-kit-labs-react/common';
|
|
3
|
+
import { FormFieldModel } from './hooks';
|
|
4
|
+
export interface FormFieldInputProps extends ExtractProps<typeof Box, never> {
|
|
5
|
+
model?: FormFieldModel;
|
|
6
|
+
}
|
|
7
|
+
export declare const FormFieldInput: import("@workday/canvas-kit-react/common").ElementComponent<"input", FormFieldInputProps>;
|
|
8
|
+
//# sourceMappingURL=FormFieldInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormFieldInput.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,YAAY,EAAkB,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAC,GAAG,EAAC,MAAM,uCAAuC,CAAC;AAG1D,OAAO,EAAC,cAAc,EAAoB,MAAM,SAAS,CAAC;AAE1D,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IAC1E,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,eAAO,MAAM,cAAc,2FAQzB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
var react_1 = __importDefault(require("react"));
|
|
29
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
30
|
+
var common_2 = require("@workday/canvas-kit-labs-react/common");
|
|
31
|
+
var FormField_1 = require("./FormField");
|
|
32
|
+
var hooks_1 = require("./hooks");
|
|
33
|
+
exports.FormFieldInput = common_1.createComponent('input')({
|
|
34
|
+
displayName: 'FormField.Input',
|
|
35
|
+
Component: function (_a, ref, Element) {
|
|
36
|
+
var model = _a.model, elemProps = __rest(_a, ["model"]);
|
|
37
|
+
var localModel = common_1.useModelContext(FormField_1.FormFieldModelContext, model);
|
|
38
|
+
var props = hooks_1.useFormFieldInput(localModel, elemProps, ref);
|
|
39
|
+
return react_1.default.createElement(common_2.Box, __assign({ as: Element }, props));
|
|
40
|
+
},
|
|
41
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { HStack, StackSpacing } from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
+
import { FormFieldModel } from './hooks';
|
|
5
|
+
export interface FormFieldLabelProps extends Omit<ExtractProps<typeof HStack, never>, 'spacing'> {
|
|
6
|
+
model?: FormFieldModel;
|
|
7
|
+
/**
|
|
8
|
+
* The text of the label.
|
|
9
|
+
*/
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* When the input is required, this is spacing between label and asterisk.
|
|
13
|
+
* @default xxxs
|
|
14
|
+
*/
|
|
15
|
+
spacing?: StackSpacing;
|
|
16
|
+
}
|
|
17
|
+
export declare const FormFieldLabel: import("@workday/canvas-kit-react/common").ElementComponent<"label", FormFieldLabelProps>;
|
|
18
|
+
//# sourceMappingURL=FormFieldLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormFieldLabel.d.ts","sourceRoot":"","sources":["../../../../form-field/lib/FormFieldLabel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAEL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAC,MAAM,EAAE,YAAY,EAAC,MAAM,uCAAuC,CAAC;AAG3E,OAAO,EAAC,cAAc,EAAoB,MAAM,SAAS,CAAC;AAE1D,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAC9F,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAcD,eAAO,MAAM,cAAc,2FA2BzB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
/** @jsx jsx */
|
|
26
|
+
var core_1 = require("@emotion/core");
|
|
27
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
28
|
+
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
29
|
+
var layout_1 = require("@workday/canvas-kit-labs-react/layout");
|
|
30
|
+
var FormField_1 = require("./FormField");
|
|
31
|
+
var hooks_1 = require("./hooks");
|
|
32
|
+
var styles = {
|
|
33
|
+
label: __assign(__assign({}, tokens_1.type.levels.subtext.large), { fontWeight: tokens_1.type.properties.fontWeights.medium }),
|
|
34
|
+
asterisk: {
|
|
35
|
+
fontSize: tokens_1.type.properties.fontSizes[16],
|
|
36
|
+
fontWeight: tokens_1.type.properties.fontWeights.regular,
|
|
37
|
+
textDecoration: 'unset',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
exports.FormFieldLabel = common_1.createComponent('label')({
|
|
41
|
+
displayName: 'FormField.Label',
|
|
42
|
+
Component: function (_a, ref) {
|
|
43
|
+
var _b = _a.spacing, spacing = _b === void 0 ? 'xxxs' : _b, model = _a.model, children = _a.children, elemProps = __rest(_a, ["spacing", "model", "children"]);
|
|
44
|
+
var localModel = common_1.useModelContext(FormField_1.FormFieldModelContext, model);
|
|
45
|
+
var props = hooks_1.useFormFieldLabel(localModel, elemProps, ref);
|
|
46
|
+
var theme = common_1.useTheme();
|
|
47
|
+
return (core_1.jsx(layout_1.HStack, __assign({ as: "label", spacing: spacing, css: styles.label, minWidth: '180px' }, props),
|
|
48
|
+
core_1.jsx("span", null, children),
|
|
49
|
+
localModel.state.isRequired && (core_1.jsx("span", { css: [styles.asterisk, { color: theme.canvas.palette.error.main }], "aria-hidden": "true" }, "*"))));
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function __export(m) {
|
|
3
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
+
}
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
__export(require("./useFormFieldOrientation"));
|
|
7
|
+
__export(require("./useFormFieldHint"));
|
|
8
|
+
__export(require("./useFormFieldInput"));
|
|
9
|
+
__export(require("./useFormFieldModel"));
|
|
10
|
+
__export(require("./useFormFieldLabel"));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="@emotion/core" />
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Hint` component.
|
|
4
|
+
* Used by the FormField.Hint subcomponent and other input type components
|
|
5
|
+
*/
|
|
6
|
+
export declare const useFormFieldHint: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
|
|
7
|
+
hasError?: boolean | undefined;
|
|
8
|
+
id?: string | undefined;
|
|
9
|
+
isRequired?: boolean | undefined;
|
|
10
|
+
}, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
|
|
11
|
+
id: string;
|
|
12
|
+
} & P & (R extends HTMLOrSVGElement ? {
|
|
13
|
+
ref: import("react").Ref<R>;
|
|
14
|
+
} : {});
|
|
15
|
+
//# sourceMappingURL=useFormFieldHint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormFieldHint.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldHint.tsx"],"names":[],"mappings":";AAGA;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;OAI3B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
4
|
+
/**
|
|
5
|
+
* Adds the necessary props to a `Hint` component.
|
|
6
|
+
* Used by the FormField.Hint subcomponent and other input type components
|
|
7
|
+
*/
|
|
8
|
+
exports.useFormFieldHint = common_1.createHook(function (_a) {
|
|
9
|
+
var state = _a.state;
|
|
10
|
+
return {
|
|
11
|
+
id: "hint-" + state.id,
|
|
12
|
+
};
|
|
13
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="@emotion/core" />
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to an `Input` component.
|
|
4
|
+
* Used by the FormField.Input subcomponent and other input type components
|
|
5
|
+
*/
|
|
6
|
+
export declare const useFormFieldInput: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
|
|
7
|
+
hasError?: boolean | undefined;
|
|
8
|
+
id?: string | undefined;
|
|
9
|
+
isRequired?: boolean | undefined;
|
|
10
|
+
}, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
|
|
11
|
+
required: boolean | undefined;
|
|
12
|
+
'aria-invalid': boolean | undefined;
|
|
13
|
+
'aria-describedby': string;
|
|
14
|
+
id: string;
|
|
15
|
+
} & P & (R extends HTMLOrSVGElement ? {
|
|
16
|
+
ref: import("react").Ref<R>;
|
|
17
|
+
} : {});
|
|
18
|
+
//# sourceMappingURL=useFormFieldInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormFieldInput.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldInput.tsx"],"names":[],"mappings":";AAGA;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;OAO5B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
4
|
+
/**
|
|
5
|
+
* Adds the necessary props to an `Input` component.
|
|
6
|
+
* Used by the FormField.Input subcomponent and other input type components
|
|
7
|
+
*/
|
|
8
|
+
exports.useFormFieldInput = common_1.createHook(function (_a) {
|
|
9
|
+
var state = _a.state;
|
|
10
|
+
return {
|
|
11
|
+
required: state.isRequired ? true : undefined,
|
|
12
|
+
'aria-invalid': state.hasError ? true : undefined,
|
|
13
|
+
'aria-describedby': "hint-" + state.id,
|
|
14
|
+
id: "input-" + state.id,
|
|
15
|
+
};
|
|
16
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="@emotion/core" />
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Label` component.
|
|
4
|
+
* Used by the FormField.Label subcomponent and other input type components
|
|
5
|
+
*/
|
|
6
|
+
export declare const useFormFieldLabel: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
|
|
7
|
+
hasError?: boolean | undefined;
|
|
8
|
+
id?: string | undefined;
|
|
9
|
+
isRequired?: boolean | undefined;
|
|
10
|
+
}, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
|
|
11
|
+
htmlFor: string;
|
|
12
|
+
} & P & (R extends HTMLOrSVGElement ? {
|
|
13
|
+
ref: import("react").Ref<R>;
|
|
14
|
+
} : {});
|
|
15
|
+
//# sourceMappingURL=useFormFieldLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormFieldLabel.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldLabel.tsx"],"names":[],"mappings":";AAGA;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;OAI5B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
4
|
+
/**
|
|
5
|
+
* Adds the necessary props to a `Label` component.
|
|
6
|
+
* Used by the FormField.Label subcomponent and other input type components
|
|
7
|
+
*/
|
|
8
|
+
exports.useFormFieldLabel = common_1.createHook(function (_a) {
|
|
9
|
+
var state = _a.state;
|
|
10
|
+
return {
|
|
11
|
+
htmlFor: "input-" + state.id,
|
|
12
|
+
};
|
|
13
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Model, ToModelConfig } from '@workday/canvas-kit-react/common';
|
|
2
|
+
declare type FormFieldState = {
|
|
3
|
+
/**
|
|
4
|
+
* Optional flag to denote if this field has an error to display. When true the `FormField.Input` will have
|
|
5
|
+
* `required` set to true, and usually some subcomponents will have a error color applied.
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
hasError?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Optional `id` provided to `FormField`'s subcomponents as HTML attributes:
|
|
11
|
+
* - `FormField.Input` will set `aria-describedby` to `hint-${id}`
|
|
12
|
+
* - `FormField.Input` will set `id` to `input-${id}`
|
|
13
|
+
* - `FormField.Label` will set `htmlFor` to `input-${id}`
|
|
14
|
+
* - `FormField.Hint` will set `id` to `hint-${id}`
|
|
15
|
+
*
|
|
16
|
+
* If a value is not provided, a unique id will be automatically created by `useUniqueId()`.
|
|
17
|
+
* @default `useUniqueId()`
|
|
18
|
+
*/
|
|
19
|
+
id?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional flag to denote if this field is required. When true the `FormField.Input` will have
|
|
22
|
+
* `required` set to true, and an asterisk will be appended to the `FormField.Label`.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
isRequired?: boolean;
|
|
26
|
+
};
|
|
27
|
+
declare type FormFieldEvents = {};
|
|
28
|
+
export declare type FormFieldModel = Model<FormFieldState, FormFieldEvents>;
|
|
29
|
+
declare const formFieldEventMap: {
|
|
30
|
+
guards: {};
|
|
31
|
+
callbacks: {};
|
|
32
|
+
};
|
|
33
|
+
export declare type FormFieldModelConfig = FormFieldState & Partial<ToModelConfig<FormFieldState, FormFieldEvents, typeof formFieldEventMap>>;
|
|
34
|
+
export declare const useFormFieldModel: (config?: FormFieldModelConfig) => Model<FormFieldState, FormFieldEvents>;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=useFormFieldModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormFieldModel.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldModel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,aAAa,EAGd,MAAM,kCAAkC,CAAC;AAE1C,aAAK,cAAc,GAAG;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;;OASG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,aAAK,eAAe,GAAG,EAAE,CAAC;AAE1B,oBAAY,cAAc,GAAG,KAAK,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAEpE,QAAA,MAAM,iBAAiB;;;CAGrB,CAAC;AAEH,oBAAY,oBAAoB,GAAG,cAAc,GAC/C,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE,eAAe,EAAE,OAAO,iBAAiB,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,iBAAiB,2EAe7B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
4
|
+
var formFieldEventMap = common_1.createEventMap()({
|
|
5
|
+
guards: {},
|
|
6
|
+
callbacks: {},
|
|
7
|
+
});
|
|
8
|
+
exports.useFormFieldModel = function (config) {
|
|
9
|
+
if (config === void 0) { config = {}; }
|
|
10
|
+
var id = common_1.useUniqueId(config.id);
|
|
11
|
+
var state = {
|
|
12
|
+
hasError: config.hasError,
|
|
13
|
+
isRequired: config.isRequired,
|
|
14
|
+
id: id,
|
|
15
|
+
};
|
|
16
|
+
var events = common_1.useEventMap(formFieldEventMap, state, config, {});
|
|
17
|
+
return {
|
|
18
|
+
state: state,
|
|
19
|
+
events: events,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds the necessary layout props to a `FormField` component.
|
|
3
|
+
*/
|
|
4
|
+
export declare const useFormFieldOrientation: (orientation: "horizontal" | "vertical") => {
|
|
5
|
+
flexDirection: "row" | "column" | "column-reverse" | "row-reverse" | undefined;
|
|
6
|
+
alignItems: "center" | "inherit" | (string & {}) | "-moz-initial" | "initial" | "revert" | "unset" | "stretch" | "end" | "flex-end" | "flex-start" | "start" | "baseline" | "normal" | "self-end" | "self-start" | undefined;
|
|
7
|
+
spacing: number | "zero" | "s" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl" | (string & {});
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useFormFieldOrientation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormFieldOrientation.d.ts","sourceRoot":"","sources":["../../../../../form-field/lib/hooks/useFormFieldOrientation.tsx"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;CAsBnC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
4
|
+
/**
|
|
5
|
+
* Adds the necessary layout props to a `FormField` component.
|
|
6
|
+
*/
|
|
7
|
+
exports.useFormFieldOrientation = function (orientation) {
|
|
8
|
+
var layoutProps;
|
|
9
|
+
if (orientation === 'horizontal') {
|
|
10
|
+
layoutProps = {
|
|
11
|
+
flexDirection: 'row',
|
|
12
|
+
spacing: tokens_1.space.l,
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
layoutProps = {
|
|
18
|
+
flexDirection: 'column',
|
|
19
|
+
spacing: tokens_1.space.xxxs,
|
|
20
|
+
alignItems: 'flex-start',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return layoutProps;
|
|
24
|
+
};
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './breadcrumbs';
|
|
2
2
|
export * from './color-picker';
|
|
3
|
+
export * from './form-field';
|
|
3
4
|
export * from './menu';
|
|
4
5
|
export * from './select';
|
|
5
6
|
export * from './side-panel';
|
|
7
|
+
export * from './text-area';
|
|
8
|
+
export * from './text-input';
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -5,6 +5,9 @@ function __export(m) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
__export(require("./breadcrumbs"));
|
|
7
7
|
__export(require("./color-picker"));
|
|
8
|
+
__export(require("./form-field"));
|
|
8
9
|
__export(require("./menu"));
|
|
9
10
|
__export(require("./select"));
|
|
10
11
|
__export(require("./side-panel"));
|
|
12
|
+
__export(require("./text-area"));
|
|
13
|
+
__export(require("./text-input"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../text-area/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { FormField } from '@workday/canvas-kit-preview-react/form-field';
|
|
4
|
+
import { TextAreaModel } from './hooks';
|
|
5
|
+
export declare const TextAreaModelContext: React.Context<import("@workday/canvas-kit-react/common").Model<{
|
|
6
|
+
hasError?: boolean | undefined;
|
|
7
|
+
id?: string | undefined;
|
|
8
|
+
isRequired?: boolean | undefined;
|
|
9
|
+
}, {}>>;
|
|
10
|
+
export interface TextAreaProps extends ExtractProps<typeof FormField, never> {
|
|
11
|
+
model?: TextAreaModel;
|
|
12
|
+
/**
|
|
13
|
+
* Children of the Text Input. Should contain a `<TextArea.Field>`, a `<TextArea.Label>` and an optional `<TextArea.Hint>`
|
|
14
|
+
*/
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export declare const TextArea: import("@workday/canvas-kit-react/common").Component<TextAreaProps> & {
|
|
18
|
+
Field: import("@workday/canvas-kit-react/common").ElementComponent<"textarea", import("./TextAreaField").TextAreaFieldProps>;
|
|
19
|
+
Label: import("@workday/canvas-kit-react/common").ElementComponent<"label", import("../../form-field/lib/FormFieldLabel").FormFieldLabelProps>;
|
|
20
|
+
Hint: import("@workday/canvas-kit-react/common").ElementComponent<"p", import("../../form-field/lib/FormFieldHint").FormFieldHintProps>;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=TextArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../text-area/lib/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,YAAY,EAAkB,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAC,SAAS,EAAiD,MAAM,8CAA8C,CAAC;AAGvH,OAAO,EAAE,aAAa,EAAoB,MAAM,SAAS,CAAC;AAK1D,eAAO,MAAM,oBAAoB;;;;OAAwB,CAAC;AAE1D,MAAM,WAAW,aAAc,SAAQ,YAAY,CAAC,OAAO,SAAS,EAAE,KAAK,CAAC;IAC1E,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,QAAQ;;;;CAqBnB,CAAC"}
|