@fluentui/react-field 0.0.0-nightly-20221007-1237.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +362 -0
- package/CHANGELOG.md +96 -0
- package/LICENSE +15 -0
- package/README.md +5 -0
- package/Spec.md +354 -0
- package/dist/index.d.ts +243 -0
- package/lib/CheckboxField.js +2 -0
- package/lib/CheckboxField.js.map +1 -0
- package/lib/ComboboxField.js +2 -0
- package/lib/ComboboxField.js.map +1 -0
- package/lib/Field.js +2 -0
- package/lib/Field.js.map +1 -0
- package/lib/InputField.js +2 -0
- package/lib/InputField.js.map +1 -0
- package/lib/ProgressField.js +2 -0
- package/lib/ProgressField.js.map +1 -0
- package/lib/RadioGroupField.js +2 -0
- package/lib/RadioGroupField.js.map +1 -0
- package/lib/SelectField.js +2 -0
- package/lib/SelectField.js.map +1 -0
- package/lib/SliderField.js +2 -0
- package/lib/SliderField.js.map +1 -0
- package/lib/SpinButtonField.js +2 -0
- package/lib/SpinButtonField.js.map +1 -0
- package/lib/SwitchField.js +2 -0
- package/lib/SwitchField.js.map +1 -0
- package/lib/TextareaField.js +2 -0
- package/lib/TextareaField.js.map +1 -0
- package/lib/components/CheckboxField/CheckboxField.js +32 -0
- package/lib/components/CheckboxField/CheckboxField.js.map +1 -0
- package/lib/components/CheckboxField/index.js +2 -0
- package/lib/components/CheckboxField/index.js.map +1 -0
- package/lib/components/ComboboxField/ComboboxField.js +14 -0
- package/lib/components/ComboboxField/ComboboxField.js.map +1 -0
- package/lib/components/ComboboxField/index.js +2 -0
- package/lib/components/ComboboxField/index.js.map +1 -0
- package/lib/components/Field/Field.types.js +2 -0
- package/lib/components/Field/Field.types.js.map +1 -0
- package/lib/components/Field/SlotComponent.types.js +2 -0
- package/lib/components/Field/SlotComponent.types.js.map +1 -0
- package/lib/components/Field/index.js +5 -0
- package/lib/components/Field/index.js.map +1 -0
- package/lib/components/Field/renderField.js +20 -0
- package/lib/components/Field/renderField.js.map +1 -0
- package/lib/components/Field/useField.js +139 -0
- package/lib/components/Field/useField.js.map +1 -0
- package/lib/components/Field/useFieldStyles.js +121 -0
- package/lib/components/Field/useFieldStyles.js.map +1 -0
- package/lib/components/InputField/InputField.js +14 -0
- package/lib/components/InputField/InputField.js.map +1 -0
- package/lib/components/InputField/index.js +2 -0
- package/lib/components/InputField/index.js.map +1 -0
- package/lib/components/ProgressField/ProgressField.js +15 -0
- package/lib/components/ProgressField/ProgressField.js.map +1 -0
- package/lib/components/ProgressField/index.js +2 -0
- package/lib/components/ProgressField/index.js.map +1 -0
- package/lib/components/RadioGroupField/RadioGroupField.js +15 -0
- package/lib/components/RadioGroupField/RadioGroupField.js.map +1 -0
- package/lib/components/RadioGroupField/index.js +2 -0
- package/lib/components/RadioGroupField/index.js.map +1 -0
- package/lib/components/SelectField/SelectField.js +14 -0
- package/lib/components/SelectField/SelectField.js.map +1 -0
- package/lib/components/SelectField/index.js +2 -0
- package/lib/components/SelectField/index.js.map +1 -0
- package/lib/components/SliderField/SliderField.js +14 -0
- package/lib/components/SliderField/SliderField.js.map +1 -0
- package/lib/components/SliderField/index.js +2 -0
- package/lib/components/SliderField/index.js.map +1 -0
- package/lib/components/SpinButtonField/SpinButtonField.js +14 -0
- package/lib/components/SpinButtonField/SpinButtonField.js.map +1 -0
- package/lib/components/SpinButtonField/index.js +2 -0
- package/lib/components/SpinButtonField/index.js.map +1 -0
- package/lib/components/SwitchField/SwitchField.js +14 -0
- package/lib/components/SwitchField/SwitchField.js.map +1 -0
- package/lib/components/SwitchField/index.js +2 -0
- package/lib/components/SwitchField/index.js.map +1 -0
- package/lib/components/TextareaField/TextareaField.js +14 -0
- package/lib/components/TextareaField/TextareaField.js.map +1 -0
- package/lib/components/TextareaField/index.js +2 -0
- package/lib/components/TextareaField/index.js.map +1 -0
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -0
- package/lib-commonjs/CheckboxField.js +10 -0
- package/lib-commonjs/CheckboxField.js.map +1 -0
- package/lib-commonjs/ComboboxField.js +10 -0
- package/lib-commonjs/ComboboxField.js.map +1 -0
- package/lib-commonjs/Field.js +10 -0
- package/lib-commonjs/Field.js.map +1 -0
- package/lib-commonjs/InputField.js +10 -0
- package/lib-commonjs/InputField.js.map +1 -0
- package/lib-commonjs/ProgressField.js +10 -0
- package/lib-commonjs/ProgressField.js.map +1 -0
- package/lib-commonjs/RadioGroupField.js +10 -0
- package/lib-commonjs/RadioGroupField.js.map +1 -0
- package/lib-commonjs/SelectField.js +10 -0
- package/lib-commonjs/SelectField.js.map +1 -0
- package/lib-commonjs/SliderField.js +10 -0
- package/lib-commonjs/SliderField.js.map +1 -0
- package/lib-commonjs/SpinButtonField.js +10 -0
- package/lib-commonjs/SpinButtonField.js.map +1 -0
- package/lib-commonjs/SwitchField.js +10 -0
- package/lib-commonjs/SwitchField.js.map +1 -0
- package/lib-commonjs/TextareaField.js +10 -0
- package/lib-commonjs/TextareaField.js.map +1 -0
- package/lib-commonjs/components/CheckboxField/CheckboxField.js +42 -0
- package/lib-commonjs/components/CheckboxField/CheckboxField.js.map +1 -0
- package/lib-commonjs/components/CheckboxField/index.js +10 -0
- package/lib-commonjs/components/CheckboxField/index.js.map +1 -0
- package/lib-commonjs/components/ComboboxField/ComboboxField.js +24 -0
- package/lib-commonjs/components/ComboboxField/ComboboxField.js.map +1 -0
- package/lib-commonjs/components/ComboboxField/index.js +10 -0
- package/lib-commonjs/components/ComboboxField/index.js.map +1 -0
- package/lib-commonjs/components/Field/Field.types.js +6 -0
- package/lib-commonjs/components/Field/Field.types.js.map +1 -0
- package/lib-commonjs/components/Field/SlotComponent.types.js +6 -0
- package/lib-commonjs/components/Field/SlotComponent.types.js.map +1 -0
- package/lib-commonjs/components/Field/index.js +16 -0
- package/lib-commonjs/components/Field/index.js.map +1 -0
- package/lib-commonjs/components/Field/renderField.js +31 -0
- package/lib-commonjs/components/Field/renderField.js.map +1 -0
- package/lib-commonjs/components/Field/useField.js +154 -0
- package/lib-commonjs/components/Field/useField.js.map +1 -0
- package/lib-commonjs/components/Field/useFieldStyles.js +134 -0
- package/lib-commonjs/components/Field/useFieldStyles.js.map +1 -0
- package/lib-commonjs/components/InputField/InputField.js +24 -0
- package/lib-commonjs/components/InputField/InputField.js.map +1 -0
- package/lib-commonjs/components/InputField/index.js +10 -0
- package/lib-commonjs/components/InputField/index.js.map +1 -0
- package/lib-commonjs/components/ProgressField/ProgressField.js +25 -0
- package/lib-commonjs/components/ProgressField/ProgressField.js.map +1 -0
- package/lib-commonjs/components/ProgressField/index.js +10 -0
- package/lib-commonjs/components/ProgressField/index.js.map +1 -0
- package/lib-commonjs/components/RadioGroupField/RadioGroupField.js +25 -0
- package/lib-commonjs/components/RadioGroupField/RadioGroupField.js.map +1 -0
- package/lib-commonjs/components/RadioGroupField/index.js +10 -0
- package/lib-commonjs/components/RadioGroupField/index.js.map +1 -0
- package/lib-commonjs/components/SelectField/SelectField.js +24 -0
- package/lib-commonjs/components/SelectField/SelectField.js.map +1 -0
- package/lib-commonjs/components/SelectField/index.js +10 -0
- package/lib-commonjs/components/SelectField/index.js.map +1 -0
- package/lib-commonjs/components/SliderField/SliderField.js +24 -0
- package/lib-commonjs/components/SliderField/SliderField.js.map +1 -0
- package/lib-commonjs/components/SliderField/index.js +10 -0
- package/lib-commonjs/components/SliderField/index.js.map +1 -0
- package/lib-commonjs/components/SpinButtonField/SpinButtonField.js +24 -0
- package/lib-commonjs/components/SpinButtonField/SpinButtonField.js.map +1 -0
- package/lib-commonjs/components/SpinButtonField/index.js +10 -0
- package/lib-commonjs/components/SpinButtonField/index.js.map +1 -0
- package/lib-commonjs/components/SwitchField/SwitchField.js +24 -0
- package/lib-commonjs/components/SwitchField/SwitchField.js.map +1 -0
- package/lib-commonjs/components/SwitchField/index.js +10 -0
- package/lib-commonjs/components/SwitchField/index.js.map +1 -0
- package/lib-commonjs/components/TextareaField/TextareaField.js +24 -0
- package/lib-commonjs/components/TextareaField/TextareaField.js.map +1 -0
- package/lib-commonjs/components/TextareaField/index.js +10 -0
- package/lib-commonjs/components/TextareaField/index.js.map +1 -0
- package/lib-commonjs/index.js +184 -0
- package/lib-commonjs/index.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchField.js","sourceRoot":"","sources":["../src/SwitchField.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC","sourcesContent":["export * from './components/SwitchField/index';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextareaField.js","sourceRoot":"","sources":["../src/TextareaField.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC","sourcesContent":["export * from './components/TextareaField/index';\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Checkbox } from '@fluentui/react-checkbox';
|
|
3
|
+
import { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';
|
|
4
|
+
export const checkboxFieldClassNames = /*#__PURE__*/getFieldClassNames('CheckboxField');
|
|
5
|
+
export const CheckboxField = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
6
|
+
const {
|
|
7
|
+
fieldLabel,
|
|
8
|
+
required,
|
|
9
|
+
label,
|
|
10
|
+
control,
|
|
11
|
+
...restOfProps
|
|
12
|
+
} = props;
|
|
13
|
+
props = {
|
|
14
|
+
// Use the fieldLabel prop as the Field's label
|
|
15
|
+
label: fieldLabel,
|
|
16
|
+
// Use the label prop as the Checkbox's label
|
|
17
|
+
control: {
|
|
18
|
+
label,
|
|
19
|
+
required,
|
|
20
|
+
...control
|
|
21
|
+
},
|
|
22
|
+
...restOfProps
|
|
23
|
+
};
|
|
24
|
+
const state = useField_unstable(props, ref, {
|
|
25
|
+
component: Checkbox,
|
|
26
|
+
classNames: checkboxFieldClassNames
|
|
27
|
+
});
|
|
28
|
+
useFieldStyles_unstable(state);
|
|
29
|
+
return renderField_unstable(state);
|
|
30
|
+
});
|
|
31
|
+
CheckboxField.displayName = 'CheckboxField';
|
|
32
|
+
//# sourceMappingURL=CheckboxField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/CheckboxField/CheckboxField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,SAAS,QAAT,QAAyB,0BAAzB;AAGA,SAAS,kBAAT,EAA6B,oBAA7B,EAAmD,uBAAnD,EAA4E,iBAA5E,QAAqG,aAArG;AAeA,OAAO,MAAM,uBAAuB,gBAAG,kBAAkB,CAAC,eAAD,CAAlD;AAEP,OAAO,MAAM,aAAa,gBAA4C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM;IAAE,UAAF;IAAc,QAAd;IAAwB,KAAxB;IAA+B,OAA/B;IAAwC,GAAG;EAA3C,IAA2D,KAAjE;EAEA,KAAK,GAAG;IACN;IACA,KAAK,EAAE,UAFD;IAGN;IACA,OAAO,EAAE;MAAE,KAAF;MAAS,QAAT;MAAmB,GAAG;IAAtB,CAJH;IAKN,GAAG;EALG,CAAR;EAQA,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,EAAa;IAAE,SAAS,EAAE,QAAb;IAAuB,UAAU,EAAE;EAAnC,CAAb,CAA/B;EACA,uBAAuB,CAAC,KAAD,CAAvB;EACA,OAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CAdqE,CAA/D;AAgBP,aAAa,CAAC,WAAd,GAA4B,eAA5B","sourcesContent":["import * as React from 'react';\nimport type { CheckboxProps } from '@fluentui/react-checkbox';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from '../../Field';\nimport { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';\n\nexport type CheckboxFieldProps = Omit<FieldProps<typeof Checkbox>, 'label'> & {\n /**\n * The Checkbox's label.\n */\n label?: CheckboxProps['label'];\n\n /**\n * The label for the CheckboxField, which appears above or before the Checkbox, depending on the `orientation` prop.\n * It is recommended to only set the `label` prop, and not `fieldLabel`.\n */\n fieldLabel?: FieldProps<typeof Checkbox>['label'];\n};\n\nexport const checkboxFieldClassNames = getFieldClassNames('CheckboxField');\n\nexport const CheckboxField: ForwardRefComponent<CheckboxFieldProps> = React.forwardRef((props, ref) => {\n const { fieldLabel, required, label, control, ...restOfProps } = props;\n\n props = {\n // Use the fieldLabel prop as the Field's label\n label: fieldLabel,\n // Use the label prop as the Checkbox's label\n control: { label, required, ...control },\n ...restOfProps,\n };\n\n const state = useField_unstable(props, ref, { component: Checkbox, classNames: checkboxFieldClassNames });\n useFieldStyles_unstable(state);\n return renderField_unstable(state);\n});\n\nCheckboxField.displayName = 'CheckboxField';\n"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CheckboxField/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './CheckboxField';\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Combobox } from '@fluentui/react-combobox';
|
|
3
|
+
import { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';
|
|
4
|
+
export const comboboxFieldClassNames = /*#__PURE__*/getFieldClassNames('ComboboxField');
|
|
5
|
+
export const ComboboxField = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
6
|
+
const state = useField_unstable(props, ref, {
|
|
7
|
+
component: Combobox,
|
|
8
|
+
classNames: comboboxFieldClassNames
|
|
9
|
+
});
|
|
10
|
+
useFieldStyles_unstable(state);
|
|
11
|
+
return renderField_unstable(state);
|
|
12
|
+
});
|
|
13
|
+
ComboboxField.displayName = 'ComboboxField';
|
|
14
|
+
//# sourceMappingURL=ComboboxField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ComboboxField/ComboboxField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,0BAAzB;AAGA,SAAS,kBAAT,EAA6B,oBAA7B,EAAmD,uBAAnD,EAA4E,iBAA5E,QAAqG,aAArG;AAIA,OAAO,MAAM,uBAAuB,gBAAG,kBAAkB,CAAC,eAAD,CAAlD;AAEP,OAAO,MAAM,aAAa,gBAA4C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,EAAa;IAAE,SAAS,EAAE,QAAb;IAAuB,UAAU,EAAE;EAAnC,CAAb,CAA/B;EACA,uBAAuB,CAAC,KAAD,CAAvB;EACA,OAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CAJqE,CAA/D;AAMP,aAAa,CAAC,WAAd,GAA4B,eAA5B","sourcesContent":["import * as React from 'react';\nimport { Combobox } from '@fluentui/react-combobox';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from '../../Field';\nimport { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';\n\nexport type ComboboxFieldProps = FieldProps<typeof Combobox>;\n\nexport const comboboxFieldClassNames = getFieldClassNames('ComboboxField');\n\nexport const ComboboxField: ForwardRefComponent<ComboboxFieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref, { component: Combobox, classNames: comboboxFieldClassNames });\n useFieldStyles_unstable(state);\n return renderField_unstable(state);\n});\n\nComboboxField.displayName = 'ComboboxField';\n"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ComboboxField/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './ComboboxField';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.types.js","sourceRoot":"","sources":["../../../src/components/Field/Field.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot, SlotClassNames } from '@fluentui/react-utilities';\nimport type { SlotComponent } from './SlotComponent.types';\n\n/**\n * The minimum requirement for a component used by Field.\n *\n * Note: the use of VoidFunctionComponent means that component is not *required* to have a children prop,\n * but it is still allowed to have a children prop.\n */\nexport type FieldComponent = React.VoidFunctionComponent<\n Pick<\n React.HTMLAttributes<HTMLElement>,\n 'id' | 'className' | 'style' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'aria-errormessage'\n >\n>;\n\n/**\n * Slots added by Field\n */\nexport type FieldSlots<T extends FieldComponent> = {\n root: NonNullable<Slot<'div'>>;\n\n /**\n * The underlying component wrapped by this field.\n */\n control: SlotComponent<T>;\n\n /**\n * The label associated with the field.\n */\n label?: Slot<typeof Label>;\n\n /**\n * A message about the validation state. The appearance of the `validationMessage` depends on `validationState`.\n */\n validationMessage?: Slot<'span'>;\n\n /**\n * The icon associated with the `validationMessage`. If the `validationState` prop is set, this will default to an\n * icon corresponding to that state.\n *\n * This will only be displayed if `validationMessage` is set.\n */\n validationMessageIcon?: Slot<'span'>;\n\n /**\n * Additional hint text below the field.\n */\n hint?: Slot<'span'>;\n};\n\n/**\n * Field Props\n */\nexport type FieldProps<T extends FieldComponent> = ComponentProps<Partial<FieldSlots<T>>, 'control'> & {\n /**\n * The orientation of the label relative to the field component.\n * This only affects the label, and not the validationMessage or hint (which always appear below the field component).\n *\n * @default vertical\n */\n orientation?: 'vertical' | 'horizontal';\n\n /**\n * The `validationState` affects the color of the `validationMessage`, the `validationMessageIcon`, and for some\n * field components, an `validationState=\"error\"` causes the border to become red.\n *\n * @default undefined\n */\n validationState?: 'error' | 'warning' | 'success';\n};\n\n/**\n * FieldProps plus extra optional props that are supported by useField_unstable, but not required to be part of the\n * API of every Field component.\n *\n * This allows Field to forward the required and size props to the label if the underlying component supports them,\n * but doesn't add them to the public API of fields that don't support them.\n */\nexport type FieldPropsWithOptionalComponentProps<T extends FieldComponent> = FieldProps<T> & {\n /**\n * Whether the field label should be marked as required.\n */\n required?: boolean;\n\n /**\n * Size of the field label.\n *\n * Number sizes will be ignored, but are allowed because the HTML `<input>` element has a prop `size?: number`.\n */\n size?: 'small' | 'medium' | 'large' | number;\n};\n\n/**\n * Configuration parameters for a Field class, passed to useField_unstable\n */\nexport type FieldConfig<T extends FieldComponent> = {\n /**\n * The underlying input component that this field is wrapping.\n */\n component: T;\n\n /**\n * Class names for this component, created by `getFieldClassNames`.\n */\n classNames: SlotClassNames<FieldSlots<T>>;\n\n /**\n * How the label be connected to the control.\n * * htmlFor - Set the Label's htmlFor prop to the component's ID (and generate an ID if not provided).\n * This is the preferred method for components that use the underlying <input> tag.\n * * aria-labelledby - Set the component's aria-labelledby prop to the Label's ID. Use this for components\n * that are not directly <input> elements (such as RadioGroup).\n *\n * @default htmlFor\n */\n labelConnection?: 'htmlFor' | 'aria-labelledby';\n};\n\n/**\n * State used in rendering Field\n */\nexport type FieldState<T extends FieldComponent> = ComponentState<Required<FieldSlots<T>>> &\n Pick<FieldProps<T>, 'orientation' | 'validationState'> & {\n classNames: SlotClassNames<FieldSlots<T>>;\n };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlotComponent.types.js","sourceRoot":"","sources":["../../../src/components/Field/SlotComponent.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { SlotShorthandValue, SlotRenderFunction } from '@fluentui/react-utilities';\n\n//\n// TEMPORARY definition of the SlotComponent type, until it is available from react-utilities\n//\n\nexport type SlotComponent<Type extends React.ComponentType | React.VoidFunctionComponent> = WithSlotShorthandValue<\n Type extends React.ComponentType<infer Props>\n ? // If this is a VoidFunctionComponent that doesn't allow children, add { children?: never }\n WithSlotRenderFunction<Props extends { children?: unknown } ? Props : Props & { children?: never }>\n : never\n>;\n\n//\n// TEMPORARY copied versions of the non-exported helper types from react-utilities\n//\n\ntype WithSlotShorthandValue<Props extends { children?: unknown }> =\n | Props\n | Extract<SlotShorthandValue, Props['children']>;\n\ntype WithSlotRenderFunction<Props extends { children?: unknown }> = Props & {\n children?: Props['children'] | SlotRenderFunction<Props>;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Field/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './Field.types';\nexport * from './renderField';\nexport * from './useField';\nexport * from './useFieldStyles';\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getSlots } from '@fluentui/react-utilities';
|
|
3
|
+
/**
|
|
4
|
+
* Render the final JSX of Field
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const renderField_unstable = state => {
|
|
8
|
+
const {
|
|
9
|
+
slots,
|
|
10
|
+
slotProps
|
|
11
|
+
} = getSlots(state);
|
|
12
|
+
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
|
13
|
+
}, slots.label && /*#__PURE__*/React.createElement(slots.label, { ...slotProps.label
|
|
14
|
+
}), slots.control && /*#__PURE__*/React.createElement(slots.control, { ...slotProps.control
|
|
15
|
+
}), slots.validationMessage && /*#__PURE__*/React.createElement(slots.validationMessage, { ...slotProps.validationMessage
|
|
16
|
+
}, slots.validationMessageIcon && /*#__PURE__*/React.createElement(slots.validationMessageIcon, { ...slotProps.validationMessageIcon
|
|
17
|
+
}), slotProps.validationMessage.children), slots.hint && /*#__PURE__*/React.createElement(slots.hint, { ...slotProps.hint
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=renderField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Field/renderField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,oBAAoB,GAA8B,KAA3B,IAAmD;EACrF,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAA6B,KAA7B,CAArC;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,KAAK,CAAC,KAAN,iBAAe,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CADlB,EAGG,KAAK,CAAC,OAAN,iBAAiB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAM,SAAS,CAAC;EAAhB,CAAd,CAHpB,EAIG,KAAK,CAAC,iBAAN,iBACC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,iBAAP,EAAwB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAxB,EACG,KAAK,CAAC,qBAAN,iBAA+B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,qBAAP,EAA4B,EAAA,GAAK,SAAS,CAAC;EAAf,CAA5B,CADlC,EAEG,SAAS,CAAC,iBAAV,CAA4B,QAF/B,CALJ,EAUG,KAAK,CAAC,IAAN,iBAAc,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CAVjB,CADF;AAcD,CAjBM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { FieldComponent, FieldSlots, FieldState } from './Field.types';\n\n/**\n * Render the final JSX of Field\n */\nexport const renderField_unstable = <T extends FieldComponent>(state: FieldState<T>) => {\n const { slots, slotProps } = getSlots<FieldSlots<FieldComponent>>(state as FieldState<FieldComponent>);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.label && <slots.label {...slotProps.label} />}\n {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}\n {slots.control && <slots.control {...(slotProps.control as any)} />}\n {slots.validationMessage && (\n <slots.validationMessage {...slotProps.validationMessage}>\n {slots.validationMessageIcon && <slots.validationMessageIcon {...slotProps.validationMessageIcon} />}\n {slotProps.validationMessage.children}\n </slots.validationMessage>\n )}\n {slots.hint && <slots.hint {...slotProps.hint} />}\n </slots.root>\n );\n};\n"],"sourceRoot":""}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CheckmarkCircle12Filled, ErrorCircle12Filled, Warning12Filled } from '@fluentui/react-icons';
|
|
3
|
+
import { Label } from '@fluentui/react-label';
|
|
4
|
+
import { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';
|
|
5
|
+
const validationMessageIcons = {
|
|
6
|
+
error: /*#__PURE__*/React.createElement(ErrorCircle12Filled, null),
|
|
7
|
+
warning: /*#__PURE__*/React.createElement(Warning12Filled, null),
|
|
8
|
+
success: /*#__PURE__*/React.createElement(CheckmarkCircle12Filled, null)
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Merge two possibly-undefined IDs for aria-describedby. If both IDs are defined, combines
|
|
12
|
+
* them into a string separated by a space. Otherwise, returns just the defined ID (if any).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const mergeAriaDescribedBy = (a, b) => a && b ? `${a} ${b}` : a || b;
|
|
16
|
+
/**
|
|
17
|
+
* Partition the props used by the Field itself, from the props that are passed to the underlying field component.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export const getPartitionedFieldProps = props => {
|
|
22
|
+
const {
|
|
23
|
+
className,
|
|
24
|
+
control,
|
|
25
|
+
hint,
|
|
26
|
+
label,
|
|
27
|
+
orientation,
|
|
28
|
+
root,
|
|
29
|
+
style,
|
|
30
|
+
validationMessage,
|
|
31
|
+
validationMessageIcon,
|
|
32
|
+
validationState,
|
|
33
|
+
...restOfProps
|
|
34
|
+
} = props;
|
|
35
|
+
const fieldProps = {
|
|
36
|
+
className,
|
|
37
|
+
control,
|
|
38
|
+
hint,
|
|
39
|
+
label,
|
|
40
|
+
orientation,
|
|
41
|
+
root,
|
|
42
|
+
style,
|
|
43
|
+
validationMessage,
|
|
44
|
+
validationMessageIcon,
|
|
45
|
+
validationState
|
|
46
|
+
};
|
|
47
|
+
return [fieldProps, restOfProps];
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Create the state required to render Field.
|
|
51
|
+
*
|
|
52
|
+
* The returned state can be modified with hooks such as useFieldStyles_unstable,
|
|
53
|
+
* before being passed to renderField_unstable.
|
|
54
|
+
*
|
|
55
|
+
* @param props - Props passed to this field
|
|
56
|
+
* @param ref - Ref to the control slot (primary slot)
|
|
57
|
+
* @param params - Configuration parameters for this Field
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
export const useField_unstable = (props, ref, params) => {
|
|
61
|
+
const [fieldProps, controlProps] = getPartitionedFieldProps(props);
|
|
62
|
+
const baseId = useId('field-');
|
|
63
|
+
const {
|
|
64
|
+
orientation = 'vertical',
|
|
65
|
+
validationState
|
|
66
|
+
} = fieldProps;
|
|
67
|
+
const root = resolveShorthand(fieldProps.root, {
|
|
68
|
+
required: true,
|
|
69
|
+
defaultProps: getNativeElementProps('div', fieldProps)
|
|
70
|
+
});
|
|
71
|
+
const label = resolveShorthand(fieldProps.label, {
|
|
72
|
+
defaultProps: {
|
|
73
|
+
id: baseId + '__label',
|
|
74
|
+
required: controlProps.required,
|
|
75
|
+
size: typeof controlProps.size === 'string' ? controlProps.size : undefined // htmlFor is set below
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const validationMessage = resolveShorthand(fieldProps.validationMessage, {
|
|
80
|
+
defaultProps: {
|
|
81
|
+
id: baseId + '__validationMessage'
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const hint = resolveShorthand(fieldProps.hint, {
|
|
85
|
+
defaultProps: {
|
|
86
|
+
id: baseId + '__hint'
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
const validationMessageIcon = resolveShorthand(fieldProps.validationMessageIcon, {
|
|
90
|
+
required: !!validationState,
|
|
91
|
+
defaultProps: {
|
|
92
|
+
children: validationState ? validationMessageIcons[validationState] : undefined
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const {
|
|
96
|
+
labelConnection = 'htmlFor'
|
|
97
|
+
} = params;
|
|
98
|
+
const hasError = validationState === 'error';
|
|
99
|
+
const control = resolveShorthand(fieldProps.control, {
|
|
100
|
+
required: true,
|
|
101
|
+
defaultProps: {
|
|
102
|
+
ref,
|
|
103
|
+
// Add a default ID only if required for label's htmlFor prop
|
|
104
|
+
id: label && labelConnection === 'htmlFor' ? baseId + '__control' : undefined,
|
|
105
|
+
// Add aria-labelledby only if not using the label's htmlFor
|
|
106
|
+
'aria-labelledby': labelConnection !== 'htmlFor' ? label === null || label === void 0 ? void 0 : label.id : undefined,
|
|
107
|
+
'aria-describedby': hasError ? hint === null || hint === void 0 ? void 0 : hint.id : mergeAriaDescribedBy(validationMessage === null || validationMessage === void 0 ? void 0 : validationMessage.id, hint === null || hint === void 0 ? void 0 : hint.id),
|
|
108
|
+
'aria-errormessage': hasError ? validationMessage === null || validationMessage === void 0 ? void 0 : validationMessage.id : undefined,
|
|
109
|
+
'aria-invalid': hasError ? true : undefined,
|
|
110
|
+
...controlProps
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
if (labelConnection === 'htmlFor' && label && !label.htmlFor) {
|
|
115
|
+
label.htmlFor = control.id;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const state = {
|
|
119
|
+
orientation,
|
|
120
|
+
validationState,
|
|
121
|
+
classNames: params.classNames,
|
|
122
|
+
components: {
|
|
123
|
+
root: 'div',
|
|
124
|
+
control: params.component,
|
|
125
|
+
label: Label,
|
|
126
|
+
validationMessage: 'span',
|
|
127
|
+
validationMessageIcon: 'span',
|
|
128
|
+
hint: 'span'
|
|
129
|
+
},
|
|
130
|
+
root,
|
|
131
|
+
control,
|
|
132
|
+
label,
|
|
133
|
+
validationMessageIcon,
|
|
134
|
+
validationMessage,
|
|
135
|
+
hint
|
|
136
|
+
};
|
|
137
|
+
return state;
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=useField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Field/useField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,uBAAT,EAAkC,mBAAlC,EAAuD,eAAvD,QAA8E,uBAA9E;AACA,SAAS,KAAT,QAAsB,uBAAtB;AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,KAAlD,QAA+D,2BAA/D;AASA,MAAM,sBAAsB,GAAG;EAC7B,KAAK,eAAE,KAAA,CAAA,aAAA,CAAC,mBAAD,EAAoB,IAApB,CADsB;EAE7B,OAAO,eAAE,KAAA,CAAA,aAAA,CAAC,eAAD,EAAgB,IAAhB,CAFoB;EAG7B,OAAO,eAAE,KAAA,CAAA,aAAA,CAAC,uBAAD,EAAwB,IAAxB;AAHoB,CAA/B;AAMA;;;AAGG;;AACH,MAAM,oBAAoB,GAAG,CAAC,CAAD,EAAa,CAAb,KAA6B,CAAC,IAAI,CAAL,GAAS,GAAG,CAAC,IAAI,CAAC,EAAlB,GAAuB,CAAC,IAAI,CAAtF;AAEA;;AAEG;;;AACH,OAAO,MAAM,wBAAwB,GAA8C,KAA3C,IAA2D;EACjG,MAAM;IACJ,SADI;IAEJ,OAFI;IAGJ,IAHI;IAIJ,KAJI;IAKJ,WAL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GAAiB,KAAA,CAAjB,GAAA,iBAAiB,CAAE,EAAtB,GAA2B,SAP5C;MAQZ,gBAAgB,QAAQ,GAAG,IAAH,GAAU,SARtB;MASZ,GAAG;IATS;EAFqC,CAArB,CAAhC;;EAeA,IAAI,eAAe,KAAK,SAApB,IAAiC,KAAjC,IAA0C,CAAC,KAAK,CAAC,OAArD,EAA8D;IAC5D,KAAK,CAAC,OAAN,GAAgB,OAAO,CAAC,EAAxB;EACD;;EAED,MAAM,KAAK,GAA+B;IACxC,WADwC;IAExC,eAFwC;IAGxC,UAAU,EAAE,MAAM,CAAC,UAHqB;IAIxC,UAAU,EAAE;MACV,IAAI,EAAE,KADI;MAEV,OAAO,EAAE,MAAM,CAAC,SAFN;MAGV,KAAK,EAAE,KAHG;MAIV,iBAAiB,EAAE,MAJT;MAKV,qBAAqB,EAAE,MALb;MAMV,IAAI,EAAE;IANI,CAJ4B;IAYxC,IAZwC;IAaxC,OAbwC;IAcxC,KAdwC;IAexC,qBAfwC;IAgBxC,iBAhBwC;IAiBxC;EAjBwC,CAA1C;EAoBA,OAAO,KAAP;AACD,CAvFM","sourcesContent":["import * as React from 'react';\nimport { CheckmarkCircle12Filled, ErrorCircle12Filled, Warning12Filled } from '@fluentui/react-icons';\nimport { Label } from '@fluentui/react-label';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport type {\n FieldComponent,\n FieldConfig,\n FieldProps,\n FieldPropsWithOptionalComponentProps,\n FieldState,\n} from './Field.types';\n\nconst validationMessageIcons = {\n error: <ErrorCircle12Filled />,\n warning: <Warning12Filled />,\n success: <CheckmarkCircle12Filled />,\n} as const;\n\n/**\n * Merge two possibly-undefined IDs for aria-describedby. If both IDs are defined, combines\n * them into a string separated by a space. Otherwise, returns just the defined ID (if any).\n */\nconst mergeAriaDescribedBy = (a?: string, b?: string) => (a && b ? `${a} ${b}` : a || b);\n\n/**\n * Partition the props used by the Field itself, from the props that are passed to the underlying field component.\n */\nexport const getPartitionedFieldProps = <Props extends FieldProps<FieldComponent>>(props: Props) => {\n const {\n className,\n control,\n hint,\n label,\n orientation,\n root,\n style,\n validationMessage,\n validationMessageIcon,\n validationState,\n ...restOfProps\n } = props;\n\n const fieldProps = {\n className,\n control,\n hint,\n label,\n orientation,\n root,\n style,\n validationMessage,\n validationMessageIcon,\n validationState,\n };\n\n return [fieldProps, restOfProps] as const;\n};\n\n/**\n * Create the state required to render Field.\n *\n * The returned state can be modified with hooks such as useFieldStyles_unstable,\n * before being passed to renderField_unstable.\n *\n * @param props - Props passed to this field\n * @param ref - Ref to the control slot (primary slot)\n * @param params - Configuration parameters for this Field\n */\nexport const useField_unstable = <T extends FieldComponent>(\n props: FieldPropsWithOptionalComponentProps<T>,\n ref: React.Ref<HTMLElement>,\n params: FieldConfig<T>,\n): FieldState<T> => {\n const [fieldProps, controlProps] = getPartitionedFieldProps(props);\n\n const baseId = useId('field-');\n\n const { orientation = 'vertical', validationState } = fieldProps;\n\n const root = resolveShorthand(fieldProps.root, {\n required: true,\n defaultProps: getNativeElementProps('div', fieldProps),\n });\n\n const label = resolveShorthand(fieldProps.label, {\n defaultProps: {\n id: baseId + '__label',\n required: controlProps.required,\n size: typeof controlProps.size === 'string' ? controlProps.size : undefined,\n // htmlFor is set below\n },\n });\n\n const validationMessage = resolveShorthand(fieldProps.validationMessage, {\n defaultProps: {\n id: baseId + '__validationMessage',\n },\n });\n\n const hint = resolveShorthand(fieldProps.hint, {\n defaultProps: {\n id: baseId + '__hint',\n },\n });\n\n const validationMessageIcon = resolveShorthand(fieldProps.validationMessageIcon, {\n required: !!validationState,\n defaultProps: {\n children: validationState ? validationMessageIcons[validationState] : undefined,\n },\n });\n\n const { labelConnection = 'htmlFor' } = params;\n const hasError = validationState === 'error';\n\n const control = resolveShorthand(fieldProps.control, {\n required: true,\n defaultProps: {\n ref,\n // Add a default ID only if required for label's htmlFor prop\n id: label && labelConnection === 'htmlFor' ? baseId + '__control' : undefined,\n // Add aria-labelledby only if not using the label's htmlFor\n 'aria-labelledby': labelConnection !== 'htmlFor' ? label?.id : undefined,\n 'aria-describedby': hasError ? hint?.id : mergeAriaDescribedBy(validationMessage?.id, hint?.id),\n 'aria-errormessage': hasError ? validationMessage?.id : undefined,\n 'aria-invalid': hasError ? true : undefined,\n ...controlProps,\n },\n });\n\n if (labelConnection === 'htmlFor' && label && !label.htmlFor) {\n label.htmlFor = control.id;\n }\n\n const state: FieldState<FieldComponent> = {\n orientation,\n validationState,\n classNames: params.classNames,\n components: {\n root: 'div',\n control: params.component,\n label: Label,\n validationMessage: 'span',\n validationMessageIcon: 'span',\n hint: 'span',\n },\n root,\n control,\n label,\n validationMessageIcon,\n validationMessage,\n hint,\n };\n\n return state as FieldState<T>;\n};\n"],"sourceRoot":""}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { __styles, mergeClasses } from '@griffel/react';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui/react-theme';
|
|
3
|
+
export const getFieldClassNames = name => ({
|
|
4
|
+
root: `fui-${name}`,
|
|
5
|
+
control: `fui-${name}__control`,
|
|
6
|
+
label: `fui-${name}__label`,
|
|
7
|
+
validationMessage: `fui-${name}__validationMessage`,
|
|
8
|
+
validationMessageIcon: `fui-${name}__validationMessageIcon`,
|
|
9
|
+
hint: `fui-${name}__hint`
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Styles for the root slot
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const useRootStyles = /*#__PURE__*/__styles({
|
|
16
|
+
"base": {
|
|
17
|
+
"mc9l5x": "fwk3njj",
|
|
18
|
+
"Bxotwcr": "f14np9u9",
|
|
19
|
+
"B7hvi0a": "f1m2n5bn"
|
|
20
|
+
},
|
|
21
|
+
"horizontal": {
|
|
22
|
+
"wkccdc": "fai812u",
|
|
23
|
+
"Budl1dq": "fckz59x"
|
|
24
|
+
},
|
|
25
|
+
"secondColumn": {
|
|
26
|
+
"Br312pm": "fd46tj4"
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
"d": [".fwk3njj{display:inline-grid;}", ".f14np9u9{grid-auto-flow:row;}", ".f1m2n5bn{justify-items:start;}", ".fai812u{grid-template-rows:auto auto auto auto;}", ".fckz59x{grid-template-columns:1fr 2fr;}", ".fd46tj4{grid-column-start:2;}"]
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const useLabelStyles = /*#__PURE__*/__styles({
|
|
33
|
+
"base": {
|
|
34
|
+
"B6of3ja": "fg30ohd",
|
|
35
|
+
"jrapky": "fyacil5"
|
|
36
|
+
},
|
|
37
|
+
"horizontal": {
|
|
38
|
+
"Ijaq50": "f16hsg94",
|
|
39
|
+
"nk6f5a": "f1nzqi2z",
|
|
40
|
+
"t21cq0": ["fkujibs", "f199hnxi"],
|
|
41
|
+
"qb2dma": "f9h729m",
|
|
42
|
+
"Bdqf98w": "fhb5wj7"
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
"d": [".fg30ohd{margin-top:var(--spacingVerticalXXS);}", ".fyacil5{margin-bottom:var(--spacingVerticalXXS);}", ".f16hsg94{grid-row-start:1;}", ".f1nzqi2z{grid-row-end:-1;}", ".fkujibs{margin-right:var(--spacingHorizontalM);}", ".f199hnxi{margin-left:var(--spacingHorizontalM);}", ".f9h729m{-webkit-align-self:start;-ms-flex-item-align:start;align-self:start;}", ".fhb5wj7{justify-self:stretch;}"]
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const useSecondaryTextStyles = /*#__PURE__*/__styles({
|
|
49
|
+
"base": {
|
|
50
|
+
"B6of3ja": "fg30ohd",
|
|
51
|
+
"sj55zd": "f11d4kpn",
|
|
52
|
+
"Bahqtrf": "fk6fouc",
|
|
53
|
+
"Be2twd7": "fy9rknc",
|
|
54
|
+
"Bhrd7zp": "figsok6",
|
|
55
|
+
"Bg96gwp": "fwrc4pm"
|
|
56
|
+
},
|
|
57
|
+
"error": {
|
|
58
|
+
"sj55zd": "f1hcrxcs"
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
"d": [".fg30ohd{margin-top:var(--spacingVerticalXXS);}", ".f11d4kpn{color:var(--colorNeutralForeground3);}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".f1hcrxcs{color:var(--colorPaletteRedForeground1);}"]
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const useValidationMessageIconStyles = /*#__PURE__*/__styles({
|
|
65
|
+
"base": {
|
|
66
|
+
"Be2twd7": "f1ugzwwg",
|
|
67
|
+
"Bg96gwp": "fp4gqsa",
|
|
68
|
+
"ha4doy": "fmrv4ls",
|
|
69
|
+
"t21cq0": ["fm0x6gh", "fbyavb5"]
|
|
70
|
+
},
|
|
71
|
+
"error": {
|
|
72
|
+
"sj55zd": "f1hcrxcs"
|
|
73
|
+
},
|
|
74
|
+
"warning": {
|
|
75
|
+
"sj55zd": "f1k5f75o"
|
|
76
|
+
},
|
|
77
|
+
"success": {
|
|
78
|
+
"sj55zd": "ffmvakt"
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
"d": [".f1ugzwwg{font-size:12px;}", ".fp4gqsa{line-height:12px;}", ".fmrv4ls{vertical-align:middle;}", ".fm0x6gh{margin-right:var(--spacingHorizontalXS);}", ".fbyavb5{margin-left:var(--spacingHorizontalXS);}", ".f1hcrxcs{color:var(--colorPaletteRedForeground1);}", ".f1k5f75o{color:var(--colorPaletteDarkOrangeForeground1);}", ".ffmvakt{color:var(--colorPaletteGreenForeground1);}"]
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Apply styling to the Field slots based on the state
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
export const useFieldStyles_unstable = state => {
|
|
89
|
+
const classNames = state.classNames;
|
|
90
|
+
const validationState = state.validationState;
|
|
91
|
+
const horizontal = state.orientation === 'horizontal';
|
|
92
|
+
const rootStyles = useRootStyles();
|
|
93
|
+
state.root.className = mergeClasses(classNames.root, rootStyles.base, horizontal && rootStyles.horizontal, state.root.className);
|
|
94
|
+
|
|
95
|
+
if (state.control) {
|
|
96
|
+
state.control.className = mergeClasses(classNames.control, horizontal && rootStyles.secondColumn, state.control.className);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const labelStyles = useLabelStyles();
|
|
100
|
+
|
|
101
|
+
if (state.label) {
|
|
102
|
+
state.label.className = mergeClasses(classNames.label, labelStyles.base, horizontal && labelStyles.horizontal, state.label.className);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const validationMessageIconStyles = useValidationMessageIconStyles();
|
|
106
|
+
|
|
107
|
+
if (state.validationMessageIcon) {
|
|
108
|
+
state.validationMessageIcon.className = mergeClasses(classNames.validationMessageIcon, validationMessageIconStyles.base, !!validationState && validationMessageIconStyles[validationState], state.validationMessageIcon.className);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const secondaryTextStyles = useSecondaryTextStyles();
|
|
112
|
+
|
|
113
|
+
if (state.validationMessage) {
|
|
114
|
+
state.validationMessage.className = mergeClasses(classNames.validationMessage, secondaryTextStyles.base, horizontal && rootStyles.secondColumn, validationState === 'error' && secondaryTextStyles.error, state.validationMessage.className);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (state.hint) {
|
|
118
|
+
state.hint.className = mergeClasses(classNames.hint, secondaryTextStyles.base, horizontal && rootStyles.secondColumn, state.hint.className);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=useFieldStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Field/useFieldStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AAGA,SAAS,MAAT,EAAiB,gBAAjB,QAAyC,uBAAzC;AAEA,OAAO,MAAM,kBAAkB,GAAI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,UAAU,CAAC,YAHQ,EAIjC,KAAK,CAAC,IAAN,CAAW,SAJsB,CAAnC;EAMD;AACF,CA5DM","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport type { FieldComponent, FieldProps, FieldSlots, FieldState } from './Field.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n\nexport const getFieldClassNames = (name: string): SlotClassNames<FieldSlots<FieldComponent>> => ({\n root: `fui-${name}`,\n control: `fui-${name}__control`,\n label: `fui-${name}__label`,\n validationMessage: `fui-${name}__validationMessage`,\n validationMessageIcon: `fui-${name}__validationMessageIcon`,\n hint: `fui-${name}__hint`,\n});\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n display: 'inline-grid',\n gridAutoFlow: 'row',\n justifyItems: 'start',\n },\n\n horizontal: {\n gridTemplateRows: 'auto auto auto auto',\n gridTemplateColumns: '1fr 2fr',\n },\n\n secondColumn: {\n gridColumnStart: '2',\n },\n});\n\nconst useLabelStyles = makeStyles({\n base: {\n marginTop: tokens.spacingVerticalXXS,\n marginBottom: tokens.spacingVerticalXXS,\n },\n\n horizontal: {\n gridRowStart: '1',\n gridRowEnd: '-1',\n marginRight: tokens.spacingHorizontalM,\n alignSelf: 'start',\n justifySelf: 'stretch',\n },\n});\n\nconst useSecondaryTextStyles = makeStyles({\n base: {\n marginTop: tokens.spacingVerticalXXS,\n color: tokens.colorNeutralForeground3,\n ...typographyStyles.caption1,\n },\n\n error: {\n color: tokens.colorPaletteRedForeground1,\n },\n});\n\nconst useValidationMessageIconStyles = makeStyles({\n base: {\n fontSize: '12px',\n lineHeight: '12px',\n verticalAlign: 'middle',\n marginRight: tokens.spacingHorizontalXS,\n },\n\n error: {\n color: tokens.colorPaletteRedForeground1,\n },\n warning: {\n color: tokens.colorPaletteDarkOrangeForeground1,\n },\n success: {\n color: tokens.colorPaletteGreenForeground1,\n },\n});\n\n/**\n * Apply styling to the Field slots based on the state\n */\nexport const useFieldStyles_unstable = <T extends FieldComponent>(state: FieldState<T>) => {\n const classNames = state.classNames;\n const validationState: FieldProps<FieldComponent>['validationState'] = state.validationState;\n const horizontal = state.orientation === 'horizontal';\n\n const rootStyles = useRootStyles();\n state.root.className = mergeClasses(\n classNames.root,\n rootStyles.base,\n horizontal && rootStyles.horizontal,\n state.root.className,\n );\n\n if (state.control) {\n state.control.className = mergeClasses(\n classNames.control,\n horizontal && rootStyles.secondColumn,\n state.control.className,\n );\n }\n\n const labelStyles = useLabelStyles();\n if (state.label) {\n state.label.className = mergeClasses(\n classNames.label,\n labelStyles.base,\n horizontal && labelStyles.horizontal,\n state.label.className,\n );\n }\n\n const validationMessageIconStyles = useValidationMessageIconStyles();\n if (state.validationMessageIcon) {\n state.validationMessageIcon.className = mergeClasses(\n classNames.validationMessageIcon,\n validationMessageIconStyles.base,\n !!validationState && validationMessageIconStyles[validationState],\n state.validationMessageIcon.className,\n );\n }\n\n const secondaryTextStyles = useSecondaryTextStyles();\n if (state.validationMessage) {\n state.validationMessage.className = mergeClasses(\n classNames.validationMessage,\n secondaryTextStyles.base,\n horizontal && rootStyles.secondColumn,\n validationState === 'error' && secondaryTextStyles.error,\n state.validationMessage.className,\n );\n }\n\n if (state.hint) {\n state.hint.className = mergeClasses(\n classNames.hint,\n secondaryTextStyles.base,\n horizontal && rootStyles.secondColumn,\n state.hint.className,\n );\n }\n};\n"],"sourceRoot":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Input } from '@fluentui/react-input';
|
|
3
|
+
import { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';
|
|
4
|
+
export const inputFieldClassNames = /*#__PURE__*/getFieldClassNames('InputField');
|
|
5
|
+
export const InputField = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
6
|
+
const state = useField_unstable(props, ref, {
|
|
7
|
+
component: Input,
|
|
8
|
+
classNames: inputFieldClassNames
|
|
9
|
+
});
|
|
10
|
+
useFieldStyles_unstable(state);
|
|
11
|
+
return renderField_unstable(state);
|
|
12
|
+
});
|
|
13
|
+
InputField.displayName = 'InputField';
|
|
14
|
+
//# sourceMappingURL=InputField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/InputField/InputField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,KAAT,QAAsB,uBAAtB;AAGA,SAAS,kBAAT,EAA6B,oBAA7B,EAAmD,uBAAnD,EAA4E,iBAA5E,QAAqG,aAArG;AAIA,OAAO,MAAM,oBAAoB,gBAAG,kBAAkB,CAAC,YAAD,CAA/C;AAEP,OAAO,MAAM,UAAU,gBAAyC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAC9F,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,EAAa;IAAE,SAAS,EAAE,KAAb;IAAoB,UAAU,EAAE;EAAhC,CAAb,CAA/B;EACA,uBAAuB,CAAC,KAAD,CAAvB;EACA,OAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CAJ+D,CAAzD;AAMP,UAAU,CAAC,WAAX,GAAyB,YAAzB","sourcesContent":["import * as React from 'react';\nimport { Input } from '@fluentui/react-input';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from '../../Field';\nimport { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';\n\nexport type InputFieldProps = FieldProps<typeof Input>;\n\nexport const inputFieldClassNames = getFieldClassNames('InputField');\n\nexport const InputField: ForwardRefComponent<InputFieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref, { component: Input, classNames: inputFieldClassNames });\n useFieldStyles_unstable(state);\n return renderField_unstable(state);\n});\n\nInputField.displayName = 'InputField';\n"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/InputField/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC","sourcesContent":["export * from './InputField';\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Progress } from '@fluentui/react-progress';
|
|
3
|
+
import { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';
|
|
4
|
+
export const progressFieldClassNames = /*#__PURE__*/getFieldClassNames('ProgressField');
|
|
5
|
+
export const ProgressField = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
6
|
+
const state = useField_unstable(props, ref, {
|
|
7
|
+
component: Progress,
|
|
8
|
+
classNames: progressFieldClassNames,
|
|
9
|
+
labelConnection: 'aria-labelledby'
|
|
10
|
+
});
|
|
11
|
+
useFieldStyles_unstable(state);
|
|
12
|
+
return renderField_unstable(state);
|
|
13
|
+
});
|
|
14
|
+
ProgressField.displayName = 'ProgressField';
|
|
15
|
+
//# sourceMappingURL=ProgressField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressField/ProgressField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,0BAAzB;AAGA,SAAS,kBAAT,EAA6B,oBAA7B,EAAmD,uBAAnD,EAA4E,iBAA5E,QAAqG,aAArG;AAIA,OAAO,MAAM,uBAAuB,gBAAG,kBAAkB,CAAC,eAAD,CAAlD;AAEP,OAAO,MAAM,aAAa,gBAA4C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,EAAa;IAC1C,SAAS,EAAE,QAD+B;IAE1C,UAAU,EAAE,uBAF8B;IAG1C,eAAe,EAAE;EAHyB,CAAb,CAA/B;EAKA,uBAAuB,CAAC,KAAD,CAAvB;EACA,OAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CARqE,CAA/D;AAUP,aAAa,CAAC,WAAd,GAA4B,eAA5B","sourcesContent":["import * as React from 'react';\nimport { Progress } from '@fluentui/react-progress';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from '../../Field';\nimport { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';\n\nexport type ProgressFieldProps = FieldProps<typeof Progress>;\n\nexport const progressFieldClassNames = getFieldClassNames('ProgressField');\n\nexport const ProgressField: ForwardRefComponent<ProgressFieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref, {\n component: Progress,\n classNames: progressFieldClassNames,\n labelConnection: 'aria-labelledby',\n });\n useFieldStyles_unstable(state);\n return renderField_unstable(state);\n});\n\nProgressField.displayName = 'ProgressField';\n"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ProgressField/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './ProgressField';\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RadioGroup } from '@fluentui/react-radio';
|
|
3
|
+
import { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';
|
|
4
|
+
export const radioGroupFieldClassNames = /*#__PURE__*/getFieldClassNames('RadioGroupField');
|
|
5
|
+
export const RadioGroupField = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
6
|
+
const state = useField_unstable(props, ref, {
|
|
7
|
+
component: RadioGroup,
|
|
8
|
+
classNames: radioGroupFieldClassNames,
|
|
9
|
+
labelConnection: 'aria-labelledby'
|
|
10
|
+
});
|
|
11
|
+
useFieldStyles_unstable(state);
|
|
12
|
+
return renderField_unstable(state);
|
|
13
|
+
});
|
|
14
|
+
RadioGroupField.displayName = 'RadioGroupField';
|
|
15
|
+
//# sourceMappingURL=RadioGroupField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/RadioGroupField/RadioGroupField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,UAAT,QAA2B,uBAA3B;AAGA,SAAS,kBAAT,EAA6B,oBAA7B,EAAmD,uBAAnD,EAA4E,iBAA5E,QAAqG,aAArG;AAIA,OAAO,MAAM,yBAAyB,gBAAG,kBAAkB,CAAC,iBAAD,CAApD;AAEP,OAAO,MAAM,eAAe,gBAA8C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACxG,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,EAAa;IAC1C,SAAS,EAAE,UAD+B;IAE1C,UAAU,EAAE,yBAF8B;IAG1C,eAAe,EAAE;EAHyB,CAAb,CAA/B;EAKA,uBAAuB,CAAC,KAAD,CAAvB;EACA,OAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CARyE,CAAnE;AAUP,eAAe,CAAC,WAAhB,GAA8B,iBAA9B","sourcesContent":["import * as React from 'react';\nimport { RadioGroup } from '@fluentui/react-radio';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from '../../Field';\nimport { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';\n\nexport type RadioGroupFieldProps = FieldProps<typeof RadioGroup>;\n\nexport const radioGroupFieldClassNames = getFieldClassNames('RadioGroupField');\n\nexport const RadioGroupField: ForwardRefComponent<RadioGroupFieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref, {\n component: RadioGroup,\n classNames: radioGroupFieldClassNames,\n labelConnection: 'aria-labelledby',\n });\n useFieldStyles_unstable(state);\n return renderField_unstable(state);\n});\n\nRadioGroupField.displayName = 'RadioGroupField';\n"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/RadioGroupField/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from './RadioGroupField';\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Select } from '@fluentui/react-select';
|
|
3
|
+
import { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';
|
|
4
|
+
export const selectFieldClassNames = /*#__PURE__*/getFieldClassNames('SelectField');
|
|
5
|
+
export const SelectField = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
6
|
+
const state = useField_unstable(props, ref, {
|
|
7
|
+
component: Select,
|
|
8
|
+
classNames: selectFieldClassNames
|
|
9
|
+
});
|
|
10
|
+
useFieldStyles_unstable(state);
|
|
11
|
+
return renderField_unstable(state);
|
|
12
|
+
});
|
|
13
|
+
SelectField.displayName = 'SelectField';
|
|
14
|
+
//# sourceMappingURL=SelectField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SelectField/SelectField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AAGA,SAAS,kBAAT,EAA6B,oBAA7B,EAAmD,uBAAnD,EAA4E,iBAA5E,QAAqG,aAArG;AAIA,OAAO,MAAM,qBAAqB,gBAAG,kBAAkB,CAAC,aAAD,CAAhD;AAEP,OAAO,MAAM,WAAW,gBAA0C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAChG,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,EAAa;IAAE,SAAS,EAAE,MAAb;IAAqB,UAAU,EAAE;EAAjC,CAAb,CAA/B;EACA,uBAAuB,CAAC,KAAD,CAAvB;EACA,OAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CAJiE,CAA3D;AAMP,WAAW,CAAC,WAAZ,GAA0B,aAA1B","sourcesContent":["import * as React from 'react';\nimport { Select } from '@fluentui/react-select';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from '../../Field';\nimport { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';\n\nexport type SelectFieldProps = FieldProps<typeof Select>;\n\nexport const selectFieldClassNames = getFieldClassNames('SelectField');\n\nexport const SelectField: ForwardRefComponent<SelectFieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref, { component: Select, classNames: selectFieldClassNames });\n useFieldStyles_unstable(state);\n return renderField_unstable(state);\n});\n\nSelectField.displayName = 'SelectField';\n"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SelectField/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC","sourcesContent":["export * from './SelectField';\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Slider } from '@fluentui/react-slider';
|
|
3
|
+
import { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';
|
|
4
|
+
export const sliderFieldClassNames = /*#__PURE__*/getFieldClassNames('SliderField');
|
|
5
|
+
export const SliderField = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
6
|
+
const state = useField_unstable(props, ref, {
|
|
7
|
+
component: Slider,
|
|
8
|
+
classNames: sliderFieldClassNames
|
|
9
|
+
});
|
|
10
|
+
useFieldStyles_unstable(state);
|
|
11
|
+
return renderField_unstable(state);
|
|
12
|
+
});
|
|
13
|
+
SliderField.displayName = 'SliderField';
|
|
14
|
+
//# sourceMappingURL=SliderField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SliderField/SliderField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AAGA,SAAS,kBAAT,EAA6B,oBAA7B,EAAmD,uBAAnD,EAA4E,iBAA5E,QAAqG,aAArG;AAIA,OAAO,MAAM,qBAAqB,gBAAG,kBAAkB,CAAC,aAAD,CAAhD;AAEP,OAAO,MAAM,WAAW,gBAA0C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAChG,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,EAAa;IAAE,SAAS,EAAE,MAAb;IAAqB,UAAU,EAAE;EAAjC,CAAb,CAA/B;EACA,uBAAuB,CAAC,KAAD,CAAvB;EACA,OAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CAJiE,CAA3D;AAMP,WAAW,CAAC,WAAZ,GAA0B,aAA1B","sourcesContent":["import * as React from 'react';\nimport { Slider } from '@fluentui/react-slider';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { FieldProps } from '../../Field';\nimport { getFieldClassNames, renderField_unstable, useFieldStyles_unstable, useField_unstable } from '../../Field';\n\nexport type SliderFieldProps = FieldProps<typeof Slider>;\n\nexport const sliderFieldClassNames = getFieldClassNames('SliderField');\n\nexport const SliderField: ForwardRefComponent<SliderFieldProps> = React.forwardRef((props, ref) => {\n const state = useField_unstable(props, ref, { component: Slider, classNames: sliderFieldClassNames });\n useFieldStyles_unstable(state);\n return renderField_unstable(state);\n});\n\nSliderField.displayName = 'SliderField';\n"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SliderField/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC","sourcesContent":["export * from './SliderField';\n"]}
|