@mirohq/design-system-form 0.2.30 → 1.0.0-pdl-removing-ffs.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/main.js +36 -63
- package/dist/main.js.map +1 -1
- package/dist/module.js +36 -63
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +3 -6
- package/package.json +6 -7
package/dist/main.js
CHANGED
|
@@ -8,7 +8,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
8
8
|
var React = require('react');
|
|
9
9
|
var designSystemBaseForm = require('@mirohq/design-system-base-form');
|
|
10
10
|
var designSystemUtils = require('@mirohq/design-system-utils');
|
|
11
|
-
var designSystemExperiments = require('@mirohq/design-system-experiments');
|
|
12
11
|
var designSystemIcons = require('@mirohq/design-system-icons');
|
|
13
12
|
|
|
14
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -23,14 +22,9 @@ const StyledForm = designSystemStitches.styled(designSystemPrimitive.Primitive.f
|
|
|
23
22
|
const StyledLabel = designSystemStitches.styled(designSystemPrimitive.Primitive.label, {
|
|
24
23
|
fontSize: "$200",
|
|
25
24
|
lineHeight: 1.5,
|
|
26
|
-
marginBottom: "$
|
|
25
|
+
marginBottom: "$50",
|
|
27
26
|
display: "block",
|
|
28
27
|
variants: {
|
|
29
|
-
v1: {
|
|
30
|
-
true: {
|
|
31
|
-
marginBottom: "$50"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
28
|
visuallyHidden: {
|
|
35
29
|
true: {
|
|
36
30
|
// todo MDS-1003: replace with shared styles
|
|
@@ -50,56 +44,38 @@ const StyledAsterisk = designSystemStitches.styled(designSystemPrimitive.Primiti
|
|
|
50
44
|
color: "$text-danger"
|
|
51
45
|
});
|
|
52
46
|
|
|
53
|
-
const Label = React__default["default"].forwardRef(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
);
|
|
83
|
-
React.useEffect(
|
|
84
|
-
() => setIsHiddenLabel(visuallyHidden),
|
|
85
|
-
[setIsHiddenLabel, visuallyHidden]
|
|
86
|
-
);
|
|
87
|
-
if (floating && !v1) {
|
|
88
|
-
return null;
|
|
47
|
+
const Label = React__default["default"].forwardRef(({ visuallyHidden = false, children, ...restProps }, forwardRef) => {
|
|
48
|
+
const {
|
|
49
|
+
setLabel,
|
|
50
|
+
setIsHiddenLabel,
|
|
51
|
+
formElementId,
|
|
52
|
+
required = false
|
|
53
|
+
} = designSystemBaseForm.useFormFieldContext();
|
|
54
|
+
const label = React.useMemo(
|
|
55
|
+
() => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
56
|
+
children,
|
|
57
|
+
required && /* @__PURE__ */ jsxRuntime.jsx(StyledAsterisk, { children: "*" })
|
|
58
|
+
] }),
|
|
59
|
+
[children, required]
|
|
60
|
+
);
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
setLabel(label);
|
|
63
|
+
}, [setLabel, label]);
|
|
64
|
+
React.useEffect(
|
|
65
|
+
() => setIsHiddenLabel(visuallyHidden),
|
|
66
|
+
[setIsHiddenLabel, visuallyHidden]
|
|
67
|
+
);
|
|
68
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
+
StyledLabel,
|
|
70
|
+
{
|
|
71
|
+
htmlFor: formElementId,
|
|
72
|
+
...restProps,
|
|
73
|
+
ref: forwardRef,
|
|
74
|
+
visuallyHidden,
|
|
75
|
+
children: label
|
|
89
76
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
{
|
|
93
|
-
htmlFor: formElementId,
|
|
94
|
-
...restProps,
|
|
95
|
-
ref: forwardRef,
|
|
96
|
-
visuallyHidden,
|
|
97
|
-
v1,
|
|
98
|
-
children: label
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
);
|
|
77
|
+
);
|
|
78
|
+
});
|
|
103
79
|
|
|
104
80
|
const StyledDescription = designSystemStitches.styled(designSystemPrimitive.Primitive.p, {
|
|
105
81
|
fontSize: "$175",
|
|
@@ -215,10 +191,7 @@ const Root = React__default["default"].forwardRef(
|
|
|
215
191
|
);
|
|
216
192
|
}
|
|
217
193
|
);
|
|
218
|
-
const Field = React__default["default"].forwardRef(({ id, status, ...restProps }, forwardRef) => {
|
|
219
|
-
const [v1] = designSystemExperiments.useNewDesignLanguage();
|
|
220
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystemBaseForm.FormFieldProvider, { status, id, v1, children: /* @__PURE__ */ jsxRuntime.jsx(Root, { status, ...restProps, ref: forwardRef }) });
|
|
221
|
-
});
|
|
194
|
+
const Field = React__default["default"].forwardRef(({ id, status, ...restProps }, forwardRef) => /* @__PURE__ */ jsxRuntime.jsx(designSystemBaseForm.FormFieldProvider, { status, id, children: /* @__PURE__ */ jsxRuntime.jsx(Root, { status, ...restProps, ref: forwardRef }) }));
|
|
222
195
|
|
|
223
196
|
const Helper = React__default["default"].forwardRef((props, forwardRef) => {
|
|
224
197
|
var _a;
|
|
@@ -230,7 +203,7 @@ const Helper = React__default["default"].forwardRef((props, forwardRef) => {
|
|
|
230
203
|
|
|
231
204
|
const Message = React__default["default"].forwardRef(({ children, ...restProps }, forwardRef) => {
|
|
232
205
|
var _a;
|
|
233
|
-
const { messageId, setMessageId, status
|
|
206
|
+
const { messageId, setMessageId, status } = designSystemBaseForm.useFormFieldContext();
|
|
234
207
|
const id = (_a = restProps.id) != null ? _a : messageId;
|
|
235
208
|
React.useEffect(() => setMessageId(id), [setMessageId, id]);
|
|
236
209
|
if (status !== designSystemBaseForm.FORM_FIELD_STATUS.invalid && status !== designSystemBaseForm.FORM_FIELD_STATUS.valid) {
|
|
@@ -245,8 +218,8 @@ const Message = React__default["default"].forwardRef(({ children, ...restProps }
|
|
|
245
218
|
status,
|
|
246
219
|
ref: forwardRef,
|
|
247
220
|
children: [
|
|
248
|
-
|
|
249
|
-
|
|
221
|
+
status === "valid" && /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconCheckMark, { size: "small", weight: "thin", color: "icon-success" }),
|
|
222
|
+
status === "invalid" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
250
223
|
designSystemIcons.IconExclamationPointCircle,
|
|
251
224
|
{
|
|
252
225
|
size: "small",
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":["../src/form.styled.tsx","../src/partials/label.styled.tsx","../src/partials/label.tsx","../src/partials/description.styled.tsx","../src/partials/helper.styled.tsx","../src/partials/message.styled.tsx","../src/partials/field.styled.tsx","../src/partials/field.tsx","../src/partials/helper.tsx","../src/partials/message.tsx","../src/partials/description.tsx","../src/form.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledForm = styled(Primitive.form, {\n all: 'unset',\n width: '100%',\n})\n\nexport type StyledFormProps = ComponentPropsWithRef<typeof StyledForm>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledLabel = styled(Primitive.label, {\n fontSize: '$200',\n lineHeight: 1.5,\n marginBottom: '$100',\n display: 'block',\n\n variants: {\n v1: {\n true: {\n marginBottom: '$50',\n },\n },\n visuallyHidden: {\n true: {\n // todo MDS-1003: replace with shared styles\n border: '0',\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px',\n },\n },\n },\n})\n\nexport const StyledAsterisk = styled(Primitive.span, {\n color: '$text-danger',\n})\n\nexport type StyledLabelProps = ComponentPropsWithRef<typeof StyledLabel>\n","import React, { useMemo, useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport { StyledAsterisk, StyledLabel } from './label.styled'\nimport type { StyledLabelProps } from './label.styled'\n\nexport interface LabelProps extends Omit<StyledLabelProps, 'v1'> {\n /**\n * The content\n */\n children: React.ReactNode\n\n /**\n * Whether the label should float above the input\n * @default true\n * @deprecated will be removed with Design Language release\n */\n floating?: boolean\n\n /**\n * To hide the label visually and still keep it accessible for screen readers and other assistive technology\n * @default false\n */\n visuallyHidden?: boolean\n}\n\nexport const Label = React.forwardRef<\n ElementRef<typeof StyledLabel>,\n LabelProps\n>(\n (\n {\n floating: floatingProp = true,\n visuallyHidden = false,\n children,\n ...restProps\n },\n forwardRef\n ) => {\n const {\n setLabel,\n setIsFloatingLabel,\n setIsHiddenLabel,\n formElementId,\n required = false,\n v1,\n } = useFormFieldContext()\n\n const floating = v1 ? false : floatingProp\n\n const label = useMemo(\n () => (\n <>\n {children}\n {required && <StyledAsterisk>*</StyledAsterisk>}\n </>\n ),\n [children, required]\n )\n\n useEffect(() => {\n setLabel(label)\n }, [setLabel, label])\n\n useEffect(\n () => setIsFloatingLabel(floating),\n [setIsFloatingLabel, floating]\n )\n useEffect(\n () => setIsHiddenLabel(visuallyHidden),\n [setIsHiddenLabel, visuallyHidden]\n )\n\n // floating labels are managed in the form elements\n if (floating && !v1) {\n return null\n }\n\n return (\n <StyledLabel\n htmlFor={formElementId}\n {...restProps}\n ref={forwardRef}\n visuallyHidden={visuallyHidden}\n v1={v1}\n >\n {label}\n </StyledLabel>\n )\n }\n)\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledDescription = styled(Primitive.p, {\n fontSize: '$175',\n lineHeight: 1.5,\n margin: 0,\n marginBottom: '$150',\n})\n\nexport type StyledDescriptionProps = ComponentPropsWithRef<\n typeof StyledDescription\n>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledHelper = styled(Primitive.div, {\n fontSize: '$150',\n lineHeight: 1.5,\n marginTop: '$50',\n})\n\nexport type StyledHelperProps = ComponentPropsWithRef<typeof StyledHelper>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledMessage = styled(Primitive.div, {\n fontSize: '$150',\n lineHeight: 1.5,\n marginTop: '$50',\n display: 'flex',\n alignItems: 'center',\n gap: '$50',\n variants: {\n status: {\n valid: {\n color: '$text-success',\n },\n invalid: {\n color: '$text-danger',\n },\n dirty: {},\n pristine: {},\n touched: {},\n },\n },\n})\n\nexport type StyledMessageProps = ComponentPropsWithRef<typeof StyledMessage>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nimport { StyledLabel } from './label.styled'\nimport { StyledDescription } from './description.styled'\nimport { StyledHelper } from './helper.styled'\nimport { StyledMessage } from './message.styled'\n\nexport const StyledField = styled(Primitive.div, {\n marginBottom: '$300',\n position: 'relative',\n '&[data-disabled]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}, ${StyledMessage}`]:\n {\n color: '$text-neutrals-disabled',\n svg: {\n color: '$icon-neutrals-disabled',\n },\n },\n },\n '&[data-readonly]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}, ${StyledMessage}`]:\n {\n color: '$text-neutrals-subtle',\n svg: {\n color: '$icon-neutrals-disabled',\n },\n },\n },\n})\n\nexport type StyledFieldProps = ComponentPropsWithRef<typeof StyledField>\n","import React, { useEffect, useRef } from 'react'\nimport type { ElementRef } from 'react'\nimport { booleanishAttrValue } from '@mirohq/design-system-utils'\nimport {\n useFormFieldContext,\n FormFieldProvider,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport type { FormFieldProviderProps } from '@mirohq/design-system-base-form'\nimport { useNewDesignLanguage } from '@mirohq/design-system-experiments'\n\nimport type { StyledFieldProps } from './field.styled'\nimport { StyledField } from './field.styled'\n\nexport interface FieldProps\n extends Omit<StyledFieldProps, 'v1'>,\n Omit<FormFieldProviderProps, 'v1'> {}\n\nconst Root = React.forwardRef<ElementRef<typeof StyledField>, FieldProps>(\n ({ onFocus, onBlur, status: statusProps, ...restProps }, forwardRef) => {\n const {\n id,\n status: formFieldStatus,\n setStatus,\n required,\n focused,\n setFocused,\n disabled,\n ariaDisabled,\n readOnly,\n formElementRef,\n } = useFormFieldContext()\n\n const status = statusProps ?? formFieldStatus\n const initialValueRef = useRef<string>()\n\n if (\n formElementRef.current?.value !== undefined &&\n initialValueRef.current === undefined\n ) {\n initialValueRef.current = formElementRef.current.value\n }\n\n useEffect(() => {\n if (statusProps !== undefined) {\n setStatus(statusProps)\n }\n }, [statusProps, setStatus])\n\n return (\n <StyledField\n data-status={status}\n data-required={booleanishAttrValue(required)}\n data-focused={booleanishAttrValue(focused)}\n data-disabled={booleanishAttrValue(\n disabled === true || ariaDisabled === true\n )}\n data-readonly={booleanishAttrValue(readOnly)}\n onFocus={e => {\n setFocused(true)\n onFocus?.(e)\n }}\n onBlur={e => {\n if (statusProps === undefined) {\n setStatus(\n initialValueRef.current !== formElementRef.current?.value\n ? FORM_FIELD_STATUS.dirty\n : FORM_FIELD_STATUS.touched\n )\n } else {\n setStatus(statusProps)\n }\n\n setFocused(false)\n onBlur?.(e)\n }}\n {...restProps}\n id={id}\n ref={forwardRef}\n />\n )\n }\n)\n\nexport const Field = React.forwardRef<\n ElementRef<typeof StyledField>,\n FieldProps\n>(({ id, status, ...restProps }, forwardRef) => {\n const [v1] = useNewDesignLanguage()\n\n return (\n <FormFieldProvider status={status} id={id} v1={v1}>\n {/* explicit use status as props because the provider will add a default */}\n <Root status={status} {...restProps} ref={forwardRef} />\n </FormFieldProvider>\n )\n})\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport type { StyledHelperProps } from './helper.styled'\nimport { StyledHelper } from './helper.styled'\n\nexport interface HelperProps extends StyledHelperProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Helper = React.forwardRef<\n ElementRef<typeof StyledHelper>,\n HelperProps\n>((props, forwardRef) => {\n const { helperId, setHelperId } = useFormFieldContext()\n\n const id = props.id ?? helperId\n useEffect(() => setHelperId(id), [setHelperId, id])\n\n return <StyledHelper {...props} id={id} ref={forwardRef} />\n})\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport {\n useFormFieldContext,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport {\n IconExclamationPointCircle,\n IconCheckMark,\n} from '@mirohq/design-system-icons'\n\nimport type { StyledMessageProps } from './message.styled'\nimport { StyledMessage } from './message.styled'\n\nexport interface MessageProps extends Omit<StyledMessageProps, 'status'> {\n chidren?: React.ReactNode\n}\n\nexport const Message = React.forwardRef<\n ElementRef<typeof StyledMessage>,\n MessageProps\n>(({ children, ...restProps }, forwardRef) => {\n const { messageId, setMessageId, status, v1 } = useFormFieldContext()\n\n const id = restProps.id ?? messageId\n useEffect(() => setMessageId(id), [setMessageId, id])\n\n if (\n status !== FORM_FIELD_STATUS.invalid &&\n status !== FORM_FIELD_STATUS.valid\n ) {\n return null\n }\n\n return (\n <StyledMessage\n role='alert'\n {...restProps}\n id={id}\n status={status}\n ref={forwardRef}\n >\n {v1 && status === 'valid' && (\n <IconCheckMark size='small' weight='thin' color='icon-success' />\n )}\n {v1 && status === 'invalid' && (\n <IconExclamationPointCircle\n size='small'\n weight='thin'\n color='icon-danger'\n />\n )}\n {children}\n </StyledMessage>\n )\n})\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport type { StyledDescriptionProps } from './description.styled'\nimport { StyledDescription } from './description.styled'\n\nexport interface DescriptionProps extends StyledDescriptionProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Description = React.forwardRef<\n ElementRef<typeof StyledDescription>,\n DescriptionProps\n>((props, forwardRef) => {\n const { descriptionId, setDescriptionId } = useFormFieldContext()\n\n const id = props.id ?? descriptionId\n useEffect(() => setDescriptionId(id), [setDescriptionId, id])\n\n return <StyledDescription {...props} id={id} ref={forwardRef} />\n})\n","import type { ForwardRefExoticComponent } from 'react'\n\nimport { StyledForm } from './form.styled'\nimport type { StyledFormProps } from './form.styled'\nimport { Label } from './partials/label'\nimport { Field } from './partials/field'\nimport { Helper } from './partials/helper'\nimport { Message } from './partials/message'\nimport { Description } from './partials/description'\n\nexport interface FormProps extends StyledFormProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Form = StyledForm as any as ForwardRefExoticComponent<FormProps> &\n Partials\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Label: typeof Label\n Field: typeof Field\n Helper: typeof Helper\n Message: typeof Message\n Description: typeof Description\n}\n\nForm.Label = Label\nForm.Field = Field\nForm.Helper = Helper\nForm.Message = Message\nForm.Description = Description\n"],"names":["styled","Primitive","React","useFormFieldContext","useMemo","jsxs","Fragment","jsx","useEffect","useRef","booleanishAttrValue","_a","FORM_FIELD_STATUS","useNewDesignLanguage","FormFieldProvider","IconCheckMark","IconExclamationPointCircle"],"mappings":";;;;;;;;;;;;;;;;;AAIa,MAAA,UAAA,GAAaA,2BAAO,CAAAC,+BAAA,CAAU,IAAM,EAAA;AAAA,EAC/C,GAAK,EAAA,OAAA;AAAA,EACL,KAAO,E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M,MAAM,IAAO,GAAA,WAAA;AAcpB,IAAA,CAAK,KAAQ,GAAA,KAAA,CAAA;AACb,IAAA,CAAK,KAAQ,GAAA,KAAA,CAAA;AACb,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AACd,IAAA,CAAK,OAAU,GAAA,OAAA,CAAA;AACf,IAAA,CAAK,WAAc,GAAA,WAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../src/form.styled.tsx","../src/partials/label.styled.tsx","../src/partials/label.tsx","../src/partials/description.styled.tsx","../src/partials/helper.styled.tsx","../src/partials/message.styled.tsx","../src/partials/field.styled.tsx","../src/partials/field.tsx","../src/partials/helper.tsx","../src/partials/message.tsx","../src/partials/description.tsx","../src/form.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledForm = styled(Primitive.form, {\n all: 'unset',\n width: '100%',\n})\n\nexport type StyledFormProps = ComponentPropsWithRef<typeof StyledForm>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledLabel = styled(Primitive.label, {\n fontSize: '$200',\n lineHeight: 1.5,\n marginBottom: '$50',\n display: 'block',\n\n variants: {\n visuallyHidden: {\n true: {\n // todo MDS-1003: replace with shared styles\n border: '0',\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px',\n },\n },\n },\n})\n\nexport const StyledAsterisk = styled(Primitive.span, {\n color: '$text-danger',\n})\n\nexport type StyledLabelProps = ComponentPropsWithRef<typeof StyledLabel>\n","import React, { useMemo, useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport { StyledAsterisk, StyledLabel } from './label.styled'\nimport type { StyledLabelProps } from './label.styled'\n\nexport interface LabelProps extends StyledLabelProps {\n /**\n * The content\n */\n children: React.ReactNode\n\n /**\n * Whether the label should float above the input\n * @default true\n * @deprecated will be removed with Design Language release\n */\n\n /**\n * To hide the label visually and still keep it accessible for screen readers and other assistive technology\n * @default false\n */\n visuallyHidden?: boolean\n}\n\nexport const Label = React.forwardRef<\n ElementRef<typeof StyledLabel>,\n LabelProps\n>(({ visuallyHidden = false, children, ...restProps }, forwardRef) => {\n const {\n setLabel,\n setIsHiddenLabel,\n formElementId,\n required = false,\n } = useFormFieldContext()\n\n const label = useMemo(\n () => (\n <>\n {children}\n {required && <StyledAsterisk>*</StyledAsterisk>}\n </>\n ),\n [children, required]\n )\n\n useEffect(() => {\n setLabel(label)\n }, [setLabel, label])\n\n useEffect(\n () => setIsHiddenLabel(visuallyHidden),\n [setIsHiddenLabel, visuallyHidden]\n )\n\n return (\n <StyledLabel\n htmlFor={formElementId}\n {...restProps}\n ref={forwardRef}\n visuallyHidden={visuallyHidden}\n >\n {label}\n </StyledLabel>\n )\n})\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledDescription = styled(Primitive.p, {\n fontSize: '$175',\n lineHeight: 1.5,\n margin: 0,\n marginBottom: '$150',\n})\n\nexport type StyledDescriptionProps = ComponentPropsWithRef<\n typeof StyledDescription\n>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledHelper = styled(Primitive.div, {\n fontSize: '$150',\n lineHeight: 1.5,\n marginTop: '$50',\n})\n\nexport type StyledHelperProps = ComponentPropsWithRef<typeof StyledHelper>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledMessage = styled(Primitive.div, {\n fontSize: '$150',\n lineHeight: 1.5,\n marginTop: '$50',\n display: 'flex',\n alignItems: 'center',\n gap: '$50',\n variants: {\n status: {\n valid: {\n color: '$text-success',\n },\n invalid: {\n color: '$text-danger',\n },\n dirty: {},\n pristine: {},\n touched: {},\n },\n },\n})\n\nexport type StyledMessageProps = ComponentPropsWithRef<typeof StyledMessage>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nimport { StyledLabel } from './label.styled'\nimport { StyledDescription } from './description.styled'\nimport { StyledHelper } from './helper.styled'\nimport { StyledMessage } from './message.styled'\n\nexport const StyledField = styled(Primitive.div, {\n marginBottom: '$300',\n position: 'relative',\n '&[data-disabled]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}, ${StyledMessage}`]:\n {\n color: '$text-neutrals-disabled',\n svg: {\n color: '$icon-neutrals-disabled',\n },\n },\n },\n '&[data-readonly]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}, ${StyledMessage}`]:\n {\n color: '$text-neutrals-subtle',\n svg: {\n color: '$icon-neutrals-disabled',\n },\n },\n },\n})\n\nexport type StyledFieldProps = ComponentPropsWithRef<typeof StyledField>\n","import React, { useEffect, useRef } from 'react'\nimport type { ElementRef } from 'react'\nimport { booleanishAttrValue } from '@mirohq/design-system-utils'\nimport {\n useFormFieldContext,\n FormFieldProvider,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport type { FormFieldProviderProps } from '@mirohq/design-system-base-form'\n\nimport type { StyledFieldProps } from './field.styled'\nimport { StyledField } from './field.styled'\n\nexport interface FieldProps extends StyledFieldProps, FormFieldProviderProps {}\n\nconst Root = React.forwardRef<ElementRef<typeof StyledField>, FieldProps>(\n ({ onFocus, onBlur, status: statusProps, ...restProps }, forwardRef) => {\n const {\n id,\n status: formFieldStatus,\n setStatus,\n required,\n focused,\n setFocused,\n disabled,\n ariaDisabled,\n readOnly,\n formElementRef,\n } = useFormFieldContext()\n\n const status = statusProps ?? formFieldStatus\n const initialValueRef = useRef<string>()\n\n if (\n formElementRef.current?.value !== undefined &&\n initialValueRef.current === undefined\n ) {\n initialValueRef.current = formElementRef.current.value\n }\n\n useEffect(() => {\n if (statusProps !== undefined) {\n setStatus(statusProps)\n }\n }, [statusProps, setStatus])\n\n return (\n <StyledField\n data-status={status}\n data-required={booleanishAttrValue(required)}\n data-focused={booleanishAttrValue(focused)}\n data-disabled={booleanishAttrValue(\n disabled === true || ariaDisabled === true\n )}\n data-readonly={booleanishAttrValue(readOnly)}\n onFocus={e => {\n setFocused(true)\n onFocus?.(e)\n }}\n onBlur={e => {\n if (statusProps === undefined) {\n setStatus(\n initialValueRef.current !== formElementRef.current?.value\n ? FORM_FIELD_STATUS.dirty\n : FORM_FIELD_STATUS.touched\n )\n } else {\n setStatus(statusProps)\n }\n\n setFocused(false)\n onBlur?.(e)\n }}\n {...restProps}\n id={id}\n ref={forwardRef}\n />\n )\n }\n)\n\nexport const Field = React.forwardRef<\n ElementRef<typeof StyledField>,\n FieldProps\n>(({ id, status, ...restProps }, forwardRef) => (\n <FormFieldProvider status={status} id={id}>\n {/* explicit use status as props because the provider will add a default */}\n <Root status={status} {...restProps} ref={forwardRef} />\n </FormFieldProvider>\n))\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport type { StyledHelperProps } from './helper.styled'\nimport { StyledHelper } from './helper.styled'\n\nexport interface HelperProps extends StyledHelperProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Helper = React.forwardRef<\n ElementRef<typeof StyledHelper>,\n HelperProps\n>((props, forwardRef) => {\n const { helperId, setHelperId } = useFormFieldContext()\n\n const id = props.id ?? helperId\n useEffect(() => setHelperId(id), [setHelperId, id])\n\n return <StyledHelper {...props} id={id} ref={forwardRef} />\n})\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport {\n useFormFieldContext,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport {\n IconExclamationPointCircle,\n IconCheckMark,\n} from '@mirohq/design-system-icons'\n\nimport type { StyledMessageProps } from './message.styled'\nimport { StyledMessage } from './message.styled'\n\nexport interface MessageProps extends Omit<StyledMessageProps, 'status'> {\n chidren?: React.ReactNode\n}\n\nexport const Message = React.forwardRef<\n ElementRef<typeof StyledMessage>,\n MessageProps\n>(({ children, ...restProps }, forwardRef) => {\n const { messageId, setMessageId, status } = useFormFieldContext()\n\n const id = restProps.id ?? messageId\n useEffect(() => setMessageId(id), [setMessageId, id])\n\n if (\n status !== FORM_FIELD_STATUS.invalid &&\n status !== FORM_FIELD_STATUS.valid\n ) {\n return null\n }\n\n return (\n <StyledMessage\n role='alert'\n {...restProps}\n id={id}\n status={status}\n ref={forwardRef}\n >\n {status === 'valid' && (\n <IconCheckMark size='small' weight='thin' color='icon-success' />\n )}\n {status === 'invalid' && (\n <IconExclamationPointCircle\n size='small'\n weight='thin'\n color='icon-danger'\n />\n )}\n {children}\n </StyledMessage>\n )\n})\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport type { StyledDescriptionProps } from './description.styled'\nimport { StyledDescription } from './description.styled'\n\nexport interface DescriptionProps extends StyledDescriptionProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Description = React.forwardRef<\n ElementRef<typeof StyledDescription>,\n DescriptionProps\n>((props, forwardRef) => {\n const { descriptionId, setDescriptionId } = useFormFieldContext()\n\n const id = props.id ?? descriptionId\n useEffect(() => setDescriptionId(id), [setDescriptionId, id])\n\n return <StyledDescription {...props} id={id} ref={forwardRef} />\n})\n","import type { ForwardRefExoticComponent } from 'react'\n\nimport { StyledForm } from './form.styled'\nimport type { StyledFormProps } from './form.styled'\nimport { Label } from './partials/label'\nimport { Field } from './partials/field'\nimport { Helper } from './partials/helper'\nimport { Message } from './partials/message'\nimport { Description } from './partials/description'\n\nexport interface FormProps extends StyledFormProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Form = StyledForm as any as ForwardRefExoticComponent<FormProps> &\n Partials\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Label: typeof Label\n Field: typeof Field\n Helper: typeof Helper\n Message: typeof Message\n Description: typeof Description\n}\n\nForm.Label = Label\nForm.Field = Field\nForm.Helper = Helper\nForm.Message = Message\nForm.Description = Description\n"],"names":["styled","Primitive","React","useFormFieldContext","useMemo","jsxs","Fragment","jsx","useEffect","useRef","booleanishAttrValue","_a","FORM_FIELD_STATUS","FormFieldProvider","IconCheckMark","IconExclamationPointCircle"],"mappings":";;;;;;;;;;;;;;;;AAIa,MAAA,UAAA,GAAaA,2BAAO,CAAAC,+BAAA,CAAU,IAAM,EAAA;AAAA,EAC/C,GAAK,EAAA,OAAA;AAAA,EACL,KAAO,EAAA,MAAA;AACT,CAAC,CAAA;;ACHY,MAAA,WAAA,GAAcD,2BAAO,CAAAC,+BAAA,CAAU,KAAO,EAAA;AAAA,EACjD,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,YAAc,EAAA,KAAA;AAAA,EACd,OAAS,EAAA,OAAA;AAAA,EAET,QAAU,EAAA;AAAA,IACR,cAAgB,EAAA;AAAA,MACd,IAAM,EAAA;AAAA;AAAA,QAEJ,MAAQ,EAAA,GAAA;AAAA,QACR,IAAM,EAAA,eAAA;AAAA,QACN,MAAQ,EAAA,KAAA;AAAA,QACR,MAAQ,EAAA,MAAA;AAAA,QACR,QAAU,EAAA,QAAA;AAAA,QACV,OAAS,EAAA,GAAA;AAAA,QACT,QAAU,EAAA,UAAA;AAAA,QACV,KAAO,EAAA,KAAA;AAAA,OACT;AAAA,KACF;AAAA,GACF;AACF,CAAC,CAAA,CAAA;AAEY,MAAA,cAAA,GAAiBD,2BAAO,CAAAC,+BAAA,CAAU,IAAM,EAAA;AAAA,EACnD,KAAO,EAAA,cAAA;AACT,CAAC,CAAA;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AA;AACb,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AACd,IAAA,CAAK,OAAU,GAAA,OAAA,CAAA;AACf,IAAA,CAAK,WAAc,GAAA,WAAA;;;;"}
|
package/dist/module.js
CHANGED
|
@@ -4,7 +4,6 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import React, { useMemo, useEffect, useRef } from 'react';
|
|
5
5
|
import { useFormFieldContext, FORM_FIELD_STATUS, FormFieldProvider } from '@mirohq/design-system-base-form';
|
|
6
6
|
import { booleanishAttrValue } from '@mirohq/design-system-utils';
|
|
7
|
-
import { useNewDesignLanguage } from '@mirohq/design-system-experiments';
|
|
8
7
|
import { IconCheckMark, IconExclamationPointCircle } from '@mirohq/design-system-icons';
|
|
9
8
|
|
|
10
9
|
const StyledForm = styled(Primitive.form, {
|
|
@@ -15,14 +14,9 @@ const StyledForm = styled(Primitive.form, {
|
|
|
15
14
|
const StyledLabel = styled(Primitive.label, {
|
|
16
15
|
fontSize: "$200",
|
|
17
16
|
lineHeight: 1.5,
|
|
18
|
-
marginBottom: "$
|
|
17
|
+
marginBottom: "$50",
|
|
19
18
|
display: "block",
|
|
20
19
|
variants: {
|
|
21
|
-
v1: {
|
|
22
|
-
true: {
|
|
23
|
-
marginBottom: "$50"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
20
|
visuallyHidden: {
|
|
27
21
|
true: {
|
|
28
22
|
// todo MDS-1003: replace with shared styles
|
|
@@ -42,56 +36,38 @@ const StyledAsterisk = styled(Primitive.span, {
|
|
|
42
36
|
color: "$text-danger"
|
|
43
37
|
});
|
|
44
38
|
|
|
45
|
-
const Label = React.forwardRef(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
);
|
|
75
|
-
useEffect(
|
|
76
|
-
() => setIsHiddenLabel(visuallyHidden),
|
|
77
|
-
[setIsHiddenLabel, visuallyHidden]
|
|
78
|
-
);
|
|
79
|
-
if (floating && !v1) {
|
|
80
|
-
return null;
|
|
39
|
+
const Label = React.forwardRef(({ visuallyHidden = false, children, ...restProps }, forwardRef) => {
|
|
40
|
+
const {
|
|
41
|
+
setLabel,
|
|
42
|
+
setIsHiddenLabel,
|
|
43
|
+
formElementId,
|
|
44
|
+
required = false
|
|
45
|
+
} = useFormFieldContext();
|
|
46
|
+
const label = useMemo(
|
|
47
|
+
() => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
+
children,
|
|
49
|
+
required && /* @__PURE__ */ jsx(StyledAsterisk, { children: "*" })
|
|
50
|
+
] }),
|
|
51
|
+
[children, required]
|
|
52
|
+
);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
setLabel(label);
|
|
55
|
+
}, [setLabel, label]);
|
|
56
|
+
useEffect(
|
|
57
|
+
() => setIsHiddenLabel(visuallyHidden),
|
|
58
|
+
[setIsHiddenLabel, visuallyHidden]
|
|
59
|
+
);
|
|
60
|
+
return /* @__PURE__ */ jsx(
|
|
61
|
+
StyledLabel,
|
|
62
|
+
{
|
|
63
|
+
htmlFor: formElementId,
|
|
64
|
+
...restProps,
|
|
65
|
+
ref: forwardRef,
|
|
66
|
+
visuallyHidden,
|
|
67
|
+
children: label
|
|
81
68
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
{
|
|
85
|
-
htmlFor: formElementId,
|
|
86
|
-
...restProps,
|
|
87
|
-
ref: forwardRef,
|
|
88
|
-
visuallyHidden,
|
|
89
|
-
v1,
|
|
90
|
-
children: label
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
);
|
|
69
|
+
);
|
|
70
|
+
});
|
|
95
71
|
|
|
96
72
|
const StyledDescription = styled(Primitive.p, {
|
|
97
73
|
fontSize: "$175",
|
|
@@ -207,10 +183,7 @@ const Root = React.forwardRef(
|
|
|
207
183
|
);
|
|
208
184
|
}
|
|
209
185
|
);
|
|
210
|
-
const Field = React.forwardRef(({ id, status, ...restProps }, forwardRef) => {
|
|
211
|
-
const [v1] = useNewDesignLanguage();
|
|
212
|
-
return /* @__PURE__ */ jsx(FormFieldProvider, { status, id, v1, children: /* @__PURE__ */ jsx(Root, { status, ...restProps, ref: forwardRef }) });
|
|
213
|
-
});
|
|
186
|
+
const Field = React.forwardRef(({ id, status, ...restProps }, forwardRef) => /* @__PURE__ */ jsx(FormFieldProvider, { status, id, children: /* @__PURE__ */ jsx(Root, { status, ...restProps, ref: forwardRef }) }));
|
|
214
187
|
|
|
215
188
|
const Helper = React.forwardRef((props, forwardRef) => {
|
|
216
189
|
var _a;
|
|
@@ -222,7 +195,7 @@ const Helper = React.forwardRef((props, forwardRef) => {
|
|
|
222
195
|
|
|
223
196
|
const Message = React.forwardRef(({ children, ...restProps }, forwardRef) => {
|
|
224
197
|
var _a;
|
|
225
|
-
const { messageId, setMessageId, status
|
|
198
|
+
const { messageId, setMessageId, status } = useFormFieldContext();
|
|
226
199
|
const id = (_a = restProps.id) != null ? _a : messageId;
|
|
227
200
|
useEffect(() => setMessageId(id), [setMessageId, id]);
|
|
228
201
|
if (status !== FORM_FIELD_STATUS.invalid && status !== FORM_FIELD_STATUS.valid) {
|
|
@@ -237,8 +210,8 @@ const Message = React.forwardRef(({ children, ...restProps }, forwardRef) => {
|
|
|
237
210
|
status,
|
|
238
211
|
ref: forwardRef,
|
|
239
212
|
children: [
|
|
240
|
-
|
|
241
|
-
|
|
213
|
+
status === "valid" && /* @__PURE__ */ jsx(IconCheckMark, { size: "small", weight: "thin", color: "icon-success" }),
|
|
214
|
+
status === "invalid" && /* @__PURE__ */ jsx(
|
|
242
215
|
IconExclamationPointCircle,
|
|
243
216
|
{
|
|
244
217
|
size: "small",
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../src/form.styled.tsx","../src/partials/label.styled.tsx","../src/partials/label.tsx","../src/partials/description.styled.tsx","../src/partials/helper.styled.tsx","../src/partials/message.styled.tsx","../src/partials/field.styled.tsx","../src/partials/field.tsx","../src/partials/helper.tsx","../src/partials/message.tsx","../src/partials/description.tsx","../src/form.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledForm = styled(Primitive.form, {\n all: 'unset',\n width: '100%',\n})\n\nexport type StyledFormProps = ComponentPropsWithRef<typeof StyledForm>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledLabel = styled(Primitive.label, {\n fontSize: '$200',\n lineHeight: 1.5,\n marginBottom: '$100',\n display: 'block',\n\n variants: {\n v1: {\n true: {\n marginBottom: '$50',\n },\n },\n visuallyHidden: {\n true: {\n // todo MDS-1003: replace with shared styles\n border: '0',\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px',\n },\n },\n },\n})\n\nexport const StyledAsterisk = styled(Primitive.span, {\n color: '$text-danger',\n})\n\nexport type StyledLabelProps = ComponentPropsWithRef<typeof StyledLabel>\n","import React, { useMemo, useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport { StyledAsterisk, StyledLabel } from './label.styled'\nimport type { StyledLabelProps } from './label.styled'\n\nexport interface LabelProps extends Omit<StyledLabelProps, 'v1'> {\n /**\n * The content\n */\n children: React.ReactNode\n\n /**\n * Whether the label should float above the input\n * @default true\n * @deprecated will be removed with Design Language release\n */\n floating?: boolean\n\n /**\n * To hide the label visually and still keep it accessible for screen readers and other assistive technology\n * @default false\n */\n visuallyHidden?: boolean\n}\n\nexport const Label = React.forwardRef<\n ElementRef<typeof StyledLabel>,\n LabelProps\n>(\n (\n {\n floating: floatingProp = true,\n visuallyHidden = false,\n children,\n ...restProps\n },\n forwardRef\n ) => {\n const {\n setLabel,\n setIsFloatingLabel,\n setIsHiddenLabel,\n formElementId,\n required = false,\n v1,\n } = useFormFieldContext()\n\n const floating = v1 ? false : floatingProp\n\n const label = useMemo(\n () => (\n <>\n {children}\n {required && <StyledAsterisk>*</StyledAsterisk>}\n </>\n ),\n [children, required]\n )\n\n useEffect(() => {\n setLabel(label)\n }, [setLabel, label])\n\n useEffect(\n () => setIsFloatingLabel(floating),\n [setIsFloatingLabel, floating]\n )\n useEffect(\n () => setIsHiddenLabel(visuallyHidden),\n [setIsHiddenLabel, visuallyHidden]\n )\n\n // floating labels are managed in the form elements\n if (floating && !v1) {\n return null\n }\n\n return (\n <StyledLabel\n htmlFor={formElementId}\n {...restProps}\n ref={forwardRef}\n visuallyHidden={visuallyHidden}\n v1={v1}\n >\n {label}\n </StyledLabel>\n )\n }\n)\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledDescription = styled(Primitive.p, {\n fontSize: '$175',\n lineHeight: 1.5,\n margin: 0,\n marginBottom: '$150',\n})\n\nexport type StyledDescriptionProps = ComponentPropsWithRef<\n typeof StyledDescription\n>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledHelper = styled(Primitive.div, {\n fontSize: '$150',\n lineHeight: 1.5,\n marginTop: '$50',\n})\n\nexport type StyledHelperProps = ComponentPropsWithRef<typeof StyledHelper>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledMessage = styled(Primitive.div, {\n fontSize: '$150',\n lineHeight: 1.5,\n marginTop: '$50',\n display: 'flex',\n alignItems: 'center',\n gap: '$50',\n variants: {\n status: {\n valid: {\n color: '$text-success',\n },\n invalid: {\n color: '$text-danger',\n },\n dirty: {},\n pristine: {},\n touched: {},\n },\n },\n})\n\nexport type StyledMessageProps = ComponentPropsWithRef<typeof StyledMessage>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nimport { StyledLabel } from './label.styled'\nimport { StyledDescription } from './description.styled'\nimport { StyledHelper } from './helper.styled'\nimport { StyledMessage } from './message.styled'\n\nexport const StyledField = styled(Primitive.div, {\n marginBottom: '$300',\n position: 'relative',\n '&[data-disabled]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}, ${StyledMessage}`]:\n {\n color: '$text-neutrals-disabled',\n svg: {\n color: '$icon-neutrals-disabled',\n },\n },\n },\n '&[data-readonly]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}, ${StyledMessage}`]:\n {\n color: '$text-neutrals-subtle',\n svg: {\n color: '$icon-neutrals-disabled',\n },\n },\n },\n})\n\nexport type StyledFieldProps = ComponentPropsWithRef<typeof StyledField>\n","import React, { useEffect, useRef } from 'react'\nimport type { ElementRef } from 'react'\nimport { booleanishAttrValue } from '@mirohq/design-system-utils'\nimport {\n useFormFieldContext,\n FormFieldProvider,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport type { FormFieldProviderProps } from '@mirohq/design-system-base-form'\nimport { useNewDesignLanguage } from '@mirohq/design-system-experiments'\n\nimport type { StyledFieldProps } from './field.styled'\nimport { StyledField } from './field.styled'\n\nexport interface FieldProps\n extends Omit<StyledFieldProps, 'v1'>,\n Omit<FormFieldProviderProps, 'v1'> {}\n\nconst Root = React.forwardRef<ElementRef<typeof StyledField>, FieldProps>(\n ({ onFocus, onBlur, status: statusProps, ...restProps }, forwardRef) => {\n const {\n id,\n status: formFieldStatus,\n setStatus,\n required,\n focused,\n setFocused,\n disabled,\n ariaDisabled,\n readOnly,\n formElementRef,\n } = useFormFieldContext()\n\n const status = statusProps ?? formFieldStatus\n const initialValueRef = useRef<string>()\n\n if (\n formElementRef.current?.value !== undefined &&\n initialValueRef.current === undefined\n ) {\n initialValueRef.current = formElementRef.current.value\n }\n\n useEffect(() => {\n if (statusProps !== undefined) {\n setStatus(statusProps)\n }\n }, [statusProps, setStatus])\n\n return (\n <StyledField\n data-status={status}\n data-required={booleanishAttrValue(required)}\n data-focused={booleanishAttrValue(focused)}\n data-disabled={booleanishAttrValue(\n disabled === true || ariaDisabled === true\n )}\n data-readonly={booleanishAttrValue(readOnly)}\n onFocus={e => {\n setFocused(true)\n onFocus?.(e)\n }}\n onBlur={e => {\n if (statusProps === undefined) {\n setStatus(\n initialValueRef.current !== formElementRef.current?.value\n ? FORM_FIELD_STATUS.dirty\n : FORM_FIELD_STATUS.touched\n )\n } else {\n setStatus(statusProps)\n }\n\n setFocused(false)\n onBlur?.(e)\n }}\n {...restProps}\n id={id}\n ref={forwardRef}\n />\n )\n }\n)\n\nexport const Field = React.forwardRef<\n ElementRef<typeof StyledField>,\n FieldProps\n>(({ id, status, ...restProps }, forwardRef) => {\n const [v1] = useNewDesignLanguage()\n\n return (\n <FormFieldProvider status={status} id={id} v1={v1}>\n {/* explicit use status as props because the provider will add a default */}\n <Root status={status} {...restProps} ref={forwardRef} />\n </FormFieldProvider>\n )\n})\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport type { StyledHelperProps } from './helper.styled'\nimport { StyledHelper } from './helper.styled'\n\nexport interface HelperProps extends StyledHelperProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Helper = React.forwardRef<\n ElementRef<typeof StyledHelper>,\n HelperProps\n>((props, forwardRef) => {\n const { helperId, setHelperId } = useFormFieldContext()\n\n const id = props.id ?? helperId\n useEffect(() => setHelperId(id), [setHelperId, id])\n\n return <StyledHelper {...props} id={id} ref={forwardRef} />\n})\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport {\n useFormFieldContext,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport {\n IconExclamationPointCircle,\n IconCheckMark,\n} from '@mirohq/design-system-icons'\n\nimport type { StyledMessageProps } from './message.styled'\nimport { StyledMessage } from './message.styled'\n\nexport interface MessageProps extends Omit<StyledMessageProps, 'status'> {\n chidren?: React.ReactNode\n}\n\nexport const Message = React.forwardRef<\n ElementRef<typeof StyledMessage>,\n MessageProps\n>(({ children, ...restProps }, forwardRef) => {\n const { messageId, setMessageId, status, v1 } = useFormFieldContext()\n\n const id = restProps.id ?? messageId\n useEffect(() => setMessageId(id), [setMessageId, id])\n\n if (\n status !== FORM_FIELD_STATUS.invalid &&\n status !== FORM_FIELD_STATUS.valid\n ) {\n return null\n }\n\n return (\n <StyledMessage\n role='alert'\n {...restProps}\n id={id}\n status={status}\n ref={forwardRef}\n >\n {v1 && status === 'valid' && (\n <IconCheckMark size='small' weight='thin' color='icon-success' />\n )}\n {v1 && status === 'invalid' && (\n <IconExclamationPointCircle\n size='small'\n weight='thin'\n color='icon-danger'\n />\n )}\n {children}\n </StyledMessage>\n )\n})\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport type { StyledDescriptionProps } from './description.styled'\nimport { StyledDescription } from './description.styled'\n\nexport interface DescriptionProps extends StyledDescriptionProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Description = React.forwardRef<\n ElementRef<typeof StyledDescription>,\n DescriptionProps\n>((props, forwardRef) => {\n const { descriptionId, setDescriptionId } = useFormFieldContext()\n\n const id = props.id ?? descriptionId\n useEffect(() => setDescriptionId(id), [setDescriptionId, id])\n\n return <StyledDescription {...props} id={id} ref={forwardRef} />\n})\n","import type { ForwardRefExoticComponent } from 'react'\n\nimport { StyledForm } from './form.styled'\nimport type { StyledFormProps } from './form.styled'\nimport { Label } from './partials/label'\nimport { Field } from './partials/field'\nimport { Helper } from './partials/helper'\nimport { Message } from './partials/message'\nimport { Description } from './partials/description'\n\nexport interface FormProps extends StyledFormProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Form = StyledForm as any as ForwardRefExoticComponent<FormProps> &\n Partials\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Label: typeof Label\n Field: typeof Field\n Helper: typeof Helper\n Message: typeof Message\n Description: typeof Description\n}\n\nForm.Label = Label\nForm.Field = Field\nForm.Helper = Helper\nForm.Message = Message\nForm.Description = Description\n"],"names":["_a"],"mappings":";;;;;;;;;AAIa,MAAA,UAAA,GAAa,MAAO,CAAA,SAAA,CAAU,IAAM,EAAA;AAAA,EAC/C,GAAK,EAAA,OAAA;AAAA,EACL,KAAO,EAAA,MAAA;AACT,CAAC,CAAA;;ACHY,MAAA,WAAA,GAAc,MAAO,CAAA,SAAA,CAAU,KAAO,EAAA;AAAA,EACjD,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,YAAc,EAAA,MAAA;AAAA,EACd,OAAS,EAAA,OAAA;AAAA,EAET,QAAU,EAAA;AAAA,IACR,EAAI,EAAA;AAAA,MACF,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,KAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,IAAM,EAAA;AAAA;AAAA,QAEJ,MAAQ,EAAA,GAAA;AAAA,QACR,IAAM,EAAA,eAAA;AAAA,QACN,MAAQ,EAAA,KAAA;AAAA,QACR,MAAQ,EAAA,MAAA;AAAA,QACR,QAAU,EAAA,QAAA;AAAA,QACV,OAAS,EA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QAED,QAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GACH,CAAA;AAEJ,CAAC,CAAA;;ACzCM,MAAM,WAAc,GAAA,KAAA,CAAM,UAG/B,CAAA,CAAC,OAAO,UAAe,KAAA;AAjBzB,EAAA,IAAA,EAAA,CAAA;AAkBE,EAAA,MAAM,EAAE,aAAA,EAAe,gBAAiB,EAAA,GAAI,mBAAoB,EAAA,CAAA;AAEhE,EAAM,MAAA,EAAA,GAAA,CAAK,EAAM,GAAA,KAAA,CAAA,EAAA,KAAN,IAAY,GAAA,EAAA,GAAA,aAAA,CAAA;AACvB,EAAA,SAAA,CAAU,MAAM,gBAAiB,CAAA,EAAE,GAAG,CAAC,gBAAA,EAAkB,EAAE,CAAC,CAAA,CAAA;AAE5D,EAAA,2BAAQ,iBAAmB,EAAA,EAAA,GAAG,KAAO,EAAA,EAAA,EAAQ,KAAK,UAAY,EAAA,CAAA,CAAA;AAChE,CAAC,CAAA;;ACPM,MAAM,IAAO,GAAA,WAAA;AAcpB,IAAA,CAAK,KAAQ,GAAA,KAAA,CAAA;AACb,IAAA,CAAK,KAAQ,GAAA,KAAA,CAAA;AACb,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AACd,IAAA,CAAK,OAAU,GAAA,OAAA,CAAA;AACf,IAAA,CAAK,WAAc,GAAA,WAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../src/form.styled.tsx","../src/partials/label.styled.tsx","../src/partials/label.tsx","../src/partials/description.styled.tsx","../src/partials/helper.styled.tsx","../src/partials/message.styled.tsx","../src/partials/field.styled.tsx","../src/partials/field.tsx","../src/partials/helper.tsx","../src/partials/message.tsx","../src/partials/description.tsx","../src/form.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledForm = styled(Primitive.form, {\n all: 'unset',\n width: '100%',\n})\n\nexport type StyledFormProps = ComponentPropsWithRef<typeof StyledForm>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledLabel = styled(Primitive.label, {\n fontSize: '$200',\n lineHeight: 1.5,\n marginBottom: '$50',\n display: 'block',\n\n variants: {\n visuallyHidden: {\n true: {\n // todo MDS-1003: replace with shared styles\n border: '0',\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px',\n },\n },\n },\n})\n\nexport const StyledAsterisk = styled(Primitive.span, {\n color: '$text-danger',\n})\n\nexport type StyledLabelProps = ComponentPropsWithRef<typeof StyledLabel>\n","import React, { useMemo, useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport { StyledAsterisk, StyledLabel } from './label.styled'\nimport type { StyledLabelProps } from './label.styled'\n\nexport interface LabelProps extends StyledLabelProps {\n /**\n * The content\n */\n children: React.ReactNode\n\n /**\n * Whether the label should float above the input\n * @default true\n * @deprecated will be removed with Design Language release\n */\n\n /**\n * To hide the label visually and still keep it accessible for screen readers and other assistive technology\n * @default false\n */\n visuallyHidden?: boolean\n}\n\nexport const Label = React.forwardRef<\n ElementRef<typeof StyledLabel>,\n LabelProps\n>(({ visuallyHidden = false, children, ...restProps }, forwardRef) => {\n const {\n setLabel,\n setIsHiddenLabel,\n formElementId,\n required = false,\n } = useFormFieldContext()\n\n const label = useMemo(\n () => (\n <>\n {children}\n {required && <StyledAsterisk>*</StyledAsterisk>}\n </>\n ),\n [children, required]\n )\n\n useEffect(() => {\n setLabel(label)\n }, [setLabel, label])\n\n useEffect(\n () => setIsHiddenLabel(visuallyHidden),\n [setIsHiddenLabel, visuallyHidden]\n )\n\n return (\n <StyledLabel\n htmlFor={formElementId}\n {...restProps}\n ref={forwardRef}\n visuallyHidden={visuallyHidden}\n >\n {label}\n </StyledLabel>\n )\n})\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledDescription = styled(Primitive.p, {\n fontSize: '$175',\n lineHeight: 1.5,\n margin: 0,\n marginBottom: '$150',\n})\n\nexport type StyledDescriptionProps = ComponentPropsWithRef<\n typeof StyledDescription\n>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledHelper = styled(Primitive.div, {\n fontSize: '$150',\n lineHeight: 1.5,\n marginTop: '$50',\n})\n\nexport type StyledHelperProps = ComponentPropsWithRef<typeof StyledHelper>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledMessage = styled(Primitive.div, {\n fontSize: '$150',\n lineHeight: 1.5,\n marginTop: '$50',\n display: 'flex',\n alignItems: 'center',\n gap: '$50',\n variants: {\n status: {\n valid: {\n color: '$text-success',\n },\n invalid: {\n color: '$text-danger',\n },\n dirty: {},\n pristine: {},\n touched: {},\n },\n },\n})\n\nexport type StyledMessageProps = ComponentPropsWithRef<typeof StyledMessage>\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nimport { StyledLabel } from './label.styled'\nimport { StyledDescription } from './description.styled'\nimport { StyledHelper } from './helper.styled'\nimport { StyledMessage } from './message.styled'\n\nexport const StyledField = styled(Primitive.div, {\n marginBottom: '$300',\n position: 'relative',\n '&[data-disabled]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}, ${StyledMessage}`]:\n {\n color: '$text-neutrals-disabled',\n svg: {\n color: '$icon-neutrals-disabled',\n },\n },\n },\n '&[data-readonly]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}, ${StyledMessage}`]:\n {\n color: '$text-neutrals-subtle',\n svg: {\n color: '$icon-neutrals-disabled',\n },\n },\n },\n})\n\nexport type StyledFieldProps = ComponentPropsWithRef<typeof StyledField>\n","import React, { useEffect, useRef } from 'react'\nimport type { ElementRef } from 'react'\nimport { booleanishAttrValue } from '@mirohq/design-system-utils'\nimport {\n useFormFieldContext,\n FormFieldProvider,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport type { FormFieldProviderProps } from '@mirohq/design-system-base-form'\n\nimport type { StyledFieldProps } from './field.styled'\nimport { StyledField } from './field.styled'\n\nexport interface FieldProps extends StyledFieldProps, FormFieldProviderProps {}\n\nconst Root = React.forwardRef<ElementRef<typeof StyledField>, FieldProps>(\n ({ onFocus, onBlur, status: statusProps, ...restProps }, forwardRef) => {\n const {\n id,\n status: formFieldStatus,\n setStatus,\n required,\n focused,\n setFocused,\n disabled,\n ariaDisabled,\n readOnly,\n formElementRef,\n } = useFormFieldContext()\n\n const status = statusProps ?? formFieldStatus\n const initialValueRef = useRef<string>()\n\n if (\n formElementRef.current?.value !== undefined &&\n initialValueRef.current === undefined\n ) {\n initialValueRef.current = formElementRef.current.value\n }\n\n useEffect(() => {\n if (statusProps !== undefined) {\n setStatus(statusProps)\n }\n }, [statusProps, setStatus])\n\n return (\n <StyledField\n data-status={status}\n data-required={booleanishAttrValue(required)}\n data-focused={booleanishAttrValue(focused)}\n data-disabled={booleanishAttrValue(\n disabled === true || ariaDisabled === true\n )}\n data-readonly={booleanishAttrValue(readOnly)}\n onFocus={e => {\n setFocused(true)\n onFocus?.(e)\n }}\n onBlur={e => {\n if (statusProps === undefined) {\n setStatus(\n initialValueRef.current !== formElementRef.current?.value\n ? FORM_FIELD_STATUS.dirty\n : FORM_FIELD_STATUS.touched\n )\n } else {\n setStatus(statusProps)\n }\n\n setFocused(false)\n onBlur?.(e)\n }}\n {...restProps}\n id={id}\n ref={forwardRef}\n />\n )\n }\n)\n\nexport const Field = React.forwardRef<\n ElementRef<typeof StyledField>,\n FieldProps\n>(({ id, status, ...restProps }, forwardRef) => (\n <FormFieldProvider status={status} id={id}>\n {/* explicit use status as props because the provider will add a default */}\n <Root status={status} {...restProps} ref={forwardRef} />\n </FormFieldProvider>\n))\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport type { StyledHelperProps } from './helper.styled'\nimport { StyledHelper } from './helper.styled'\n\nexport interface HelperProps extends StyledHelperProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Helper = React.forwardRef<\n ElementRef<typeof StyledHelper>,\n HelperProps\n>((props, forwardRef) => {\n const { helperId, setHelperId } = useFormFieldContext()\n\n const id = props.id ?? helperId\n useEffect(() => setHelperId(id), [setHelperId, id])\n\n return <StyledHelper {...props} id={id} ref={forwardRef} />\n})\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport {\n useFormFieldContext,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport {\n IconExclamationPointCircle,\n IconCheckMark,\n} from '@mirohq/design-system-icons'\n\nimport type { StyledMessageProps } from './message.styled'\nimport { StyledMessage } from './message.styled'\n\nexport interface MessageProps extends Omit<StyledMessageProps, 'status'> {\n chidren?: React.ReactNode\n}\n\nexport const Message = React.forwardRef<\n ElementRef<typeof StyledMessage>,\n MessageProps\n>(({ children, ...restProps }, forwardRef) => {\n const { messageId, setMessageId, status } = useFormFieldContext()\n\n const id = restProps.id ?? messageId\n useEffect(() => setMessageId(id), [setMessageId, id])\n\n if (\n status !== FORM_FIELD_STATUS.invalid &&\n status !== FORM_FIELD_STATUS.valid\n ) {\n return null\n }\n\n return (\n <StyledMessage\n role='alert'\n {...restProps}\n id={id}\n status={status}\n ref={forwardRef}\n >\n {status === 'valid' && (\n <IconCheckMark size='small' weight='thin' color='icon-success' />\n )}\n {status === 'invalid' && (\n <IconExclamationPointCircle\n size='small'\n weight='thin'\n color='icon-danger'\n />\n )}\n {children}\n </StyledMessage>\n )\n})\n","import React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport { useFormFieldContext } from '@mirohq/design-system-base-form'\n\nimport type { StyledDescriptionProps } from './description.styled'\nimport { StyledDescription } from './description.styled'\n\nexport interface DescriptionProps extends StyledDescriptionProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Description = React.forwardRef<\n ElementRef<typeof StyledDescription>,\n DescriptionProps\n>((props, forwardRef) => {\n const { descriptionId, setDescriptionId } = useFormFieldContext()\n\n const id = props.id ?? descriptionId\n useEffect(() => setDescriptionId(id), [setDescriptionId, id])\n\n return <StyledDescription {...props} id={id} ref={forwardRef} />\n})\n","import type { ForwardRefExoticComponent } from 'react'\n\nimport { StyledForm } from './form.styled'\nimport type { StyledFormProps } from './form.styled'\nimport { Label } from './partials/label'\nimport { Field } from './partials/field'\nimport { Helper } from './partials/helper'\nimport { Message } from './partials/message'\nimport { Description } from './partials/description'\n\nexport interface FormProps extends StyledFormProps {\n /**\n * The content\n */\n children: React.ReactNode\n}\n\nexport const Form = StyledForm as any as ForwardRefExoticComponent<FormProps> &\n Partials\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n Label: typeof Label\n Field: typeof Field\n Helper: typeof Helper\n Message: typeof Message\n Description: typeof Description\n}\n\nForm.Label = Label\nForm.Field = Field\nForm.Helper = Helper\nForm.Message = Message\nForm.Description = Description\n"],"names":["_a"],"mappings":";;;;;;;;AAIa,MAAA,UAAA,GAAa,MAAO,CAAA,SAAA,CAAU,IAAM,EAAA;AAAA,EAC/C,GAAK,EAAA,OAAA;AAAA,EACL,KAAO,EAAA,MAAA;AACT,CAAC,CAAA;;ACHY,MAAA,WAAA,GAAc,MAAO,CAAA,SAAA,CAAU,KAAO,EAAA;AAAA,EACjD,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,YAAc,EAAA,KAAA;AAAA,EACd,OAAS,EAAA,OAAA;AAAA,EAET,QAAU,EAAA;AAA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AAN,IAAY,GAAA,EAAA,GAAA,aAAA,CAAA;AACvB,EAAA,SAAA,CAAU,MAAM,gBAAiB,CAAA,EAAE,GAAG,CAAC,gBAAA,EAAkB,EAAE,CAAC,CAAA,CAAA;AAE5D,EAAA,2BAAQ,iBAAmB,EAAA,EAAA,GAAG,KAAO,EAAA,EAAA,EAAQ,KAAK,UAAY,EAAA,CAAA,CAAA;AAChE,CAAC,CAAA;;ACPM,MAAM,IAAO,GAAA,WAAA;AAcpB,IAAA,CAAK,KAAQ,GAAA,KAAA,CAAA;AACb,IAAA,CAAK,KAAQ,GAAA,KAAA,CAAA;AACb,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AACd,IAAA,CAAK,OAAU,GAAA,OAAA,CAAA;AACf,IAAA,CAAK,WAAc,GAAA,WAAA;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -8,16 +8,14 @@ import { FormFieldProviderProps } from '@mirohq/design-system-base-form';
|
|
|
8
8
|
declare const StyledForm: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"form">>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLFormElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"form">>, {}, {}>;
|
|
9
9
|
type StyledFormProps = ComponentPropsWithRef<typeof StyledForm>;
|
|
10
10
|
|
|
11
|
-
declare const StyledLabel: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"label">>>, "
|
|
12
|
-
v1?: boolean | "true" | undefined;
|
|
11
|
+
declare const StyledLabel: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"label">>>, "visuallyHidden"> & _stitches_react_types_styled_component.TransformProps<{
|
|
13
12
|
visuallyHidden?: boolean | "true" | undefined;
|
|
14
13
|
}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLLabelElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"label">>, {
|
|
15
|
-
v1?: boolean | "true" | undefined;
|
|
16
14
|
visuallyHidden?: boolean | "true" | undefined;
|
|
17
15
|
}, {}>;
|
|
18
16
|
type StyledLabelProps = ComponentPropsWithRef<typeof StyledLabel>;
|
|
19
17
|
|
|
20
|
-
interface LabelProps extends
|
|
18
|
+
interface LabelProps extends StyledLabelProps {
|
|
21
19
|
/**
|
|
22
20
|
* The content
|
|
23
21
|
*/
|
|
@@ -27,7 +25,6 @@ interface LabelProps extends Omit<StyledLabelProps, 'v1'> {
|
|
|
27
25
|
* @default true
|
|
28
26
|
* @deprecated will be removed with Design Language release
|
|
29
27
|
*/
|
|
30
|
-
floating?: boolean;
|
|
31
28
|
/**
|
|
32
29
|
* To hide the label visually and still keep it accessible for screen readers and other assistive technology
|
|
33
30
|
* @default false
|
|
@@ -39,7 +36,7 @@ declare const Label: react__default.ForwardRefExoticComponent<Omit<LabelProps, "
|
|
|
39
36
|
declare const StyledField: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>, {}, {}>;
|
|
40
37
|
type StyledFieldProps = ComponentPropsWithRef<typeof StyledField>;
|
|
41
38
|
|
|
42
|
-
interface FieldProps extends
|
|
39
|
+
interface FieldProps extends StyledFieldProps, FormFieldProviderProps {
|
|
43
40
|
}
|
|
44
41
|
declare const Field: react__default.ForwardRefExoticComponent<Omit<FieldProps, "ref"> & react__default.RefAttributes<HTMLDivElement>>;
|
|
45
42
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirohq/design-system-form",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-pdl-removing-ffs.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Miro",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -26,12 +26,11 @@
|
|
|
26
26
|
"react": "^16.14 || ^17 || ^18"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@mirohq/design-system-base-form": "^0.
|
|
30
|
-
"@mirohq/design-system-
|
|
31
|
-
"@mirohq/design-system-
|
|
32
|
-
"@mirohq/design-system-utils": "^0.
|
|
33
|
-
"@mirohq/design-system-
|
|
34
|
-
"@mirohq/design-system-primitive": "^1.1.2"
|
|
29
|
+
"@mirohq/design-system-base-form": "^1.0.0-pdl-removing-ffs.0",
|
|
30
|
+
"@mirohq/design-system-primitive": "^2.0.0-pdl-removing-ffs.0",
|
|
31
|
+
"@mirohq/design-system-icons": "^1.0.0-pdl-removing-ffs.0",
|
|
32
|
+
"@mirohq/design-system-utils": "^1.0.0-pdl-removing-ffs.0",
|
|
33
|
+
"@mirohq/design-system-stitches": "^3.0.0-pdl-removing-ffs.0"
|
|
35
34
|
},
|
|
36
35
|
"scripts": {
|
|
37
36
|
"build": "rollup -c ../../../rollup.config.js",
|