@mirohq/design-system-form 0.1.5-tag-component.0 → 0.1.6

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 CHANGED
@@ -22,35 +22,69 @@ const StyledLabel = designSystemStitches.styled(designSystemPrimitive.Primitive.
22
22
  fontSize: "$200",
23
23
  lineHeight: 1.5,
24
24
  marginBottom: "$100",
25
- display: "block"
25
+ display: "block",
26
+ variants: {
27
+ visuallyHidden: {
28
+ true: {
29
+ // todo MDS-1003: replace with shared styles
30
+ border: "0",
31
+ clip: "rect(0 0 0 0)",
32
+ height: "1px",
33
+ margin: "-1px",
34
+ overflow: "hidden",
35
+ padding: "0",
36
+ position: "absolute",
37
+ width: "1px"
38
+ }
39
+ }
40
+ }
26
41
  });
27
42
  const StyledAsterisk = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
28
43
  color: "$text-danger"
29
44
  });
30
45
 
31
- const Label = React__default["default"].forwardRef(({ floating = true, children, ...restProps }, forwardRef) => {
32
- const {
33
- setLabel,
34
- setIsFloatingLabel,
35
- formElementId,
36
- required = false
37
- } = designSystemBaseForm.useFormFieldContext();
38
- const label = React.useMemo(
39
- () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
40
- children,
41
- required && /* @__PURE__ */ jsxRuntime.jsx(StyledAsterisk, { children: "*" })
42
- ] }),
43
- [children, required]
44
- );
45
- React.useEffect(() => {
46
- setLabel(label);
47
- }, [setLabel, label]);
48
- React.useEffect(() => setIsFloatingLabel(floating), [setIsFloatingLabel, floating]);
49
- if (floating) {
50
- return null;
46
+ const Label = React__default["default"].forwardRef(
47
+ ({ floating = true, visuallyHidden = false, children, ...restProps }, forwardRef) => {
48
+ const {
49
+ setLabel,
50
+ setIsFloatingLabel,
51
+ setIsHiddenLabel,
52
+ formElementId,
53
+ required = false
54
+ } = designSystemBaseForm.useFormFieldContext();
55
+ const label = React.useMemo(
56
+ () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
57
+ children,
58
+ required && /* @__PURE__ */ jsxRuntime.jsx(StyledAsterisk, { children: "*" })
59
+ ] }),
60
+ [children, required]
61
+ );
62
+ React.useEffect(() => {
63
+ setLabel(label);
64
+ }, [setLabel, label]);
65
+ React.useEffect(
66
+ () => setIsFloatingLabel(floating),
67
+ [setIsFloatingLabel, floating]
68
+ );
69
+ React.useEffect(
70
+ () => setIsHiddenLabel(visuallyHidden),
71
+ [setIsHiddenLabel, visuallyHidden]
72
+ );
73
+ if (floating) {
74
+ return null;
75
+ }
76
+ return /* @__PURE__ */ jsxRuntime.jsx(
77
+ StyledLabel,
78
+ {
79
+ htmlFor: formElementId,
80
+ ...restProps,
81
+ ref: forwardRef,
82
+ visuallyHidden,
83
+ children: label
84
+ }
85
+ );
51
86
  }
52
- return /* @__PURE__ */ jsxRuntime.jsx(StyledLabel, { htmlFor: formElementId, ...restProps, ref: forwardRef, children: label });
53
- });
87
+ );
54
88
 
55
89
  const StyledDescription = designSystemStitches.styled(designSystemPrimitive.Primitive.p, {
56
90
  fontSize: "$175",
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/field.styled.tsx","../src/partials/field.tsx","../src/partials/helper.tsx","../src/partials/message.styled.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\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 * Whether the label should float above the input\n * @default true\n */\n floating?: boolean\n}\n\nexport const Label = React.forwardRef<\n ElementRef<typeof StyledLabel>,\n LabelProps\n>(({ floating = true, children, ...restProps }, forwardRef) => {\n const {\n setLabel,\n setIsFloatingLabel,\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(() => setIsFloatingLabel(floating), [setIsFloatingLabel, floating])\n\n // floating labels are managed in the form elements\n if (floating) {\n return null\n }\n\n return (\n <StyledLabel htmlFor={formElementId} {...restProps} ref={forwardRef}>\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\nimport { StyledLabel } from './label.styled'\nimport { StyledDescription } from './description.styled'\nimport { StyledHelper } from './helper.styled'\n\nexport const StyledField = styled(Primitive.div, {\n marginBottom: '$300',\n position: 'relative',\n '&[data-disabled]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}`]: {\n color: '$text-neutrals-disabled',\n },\n },\n '&[data-readonly]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}`]: {\n color: '$text-neutrals-subtle',\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 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 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 React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport {\n useFormFieldContext,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport type { FormFieldStatus } from '@mirohq/design-system-base-form'\n\nimport type { StyledMessageProps } from './message.styled'\nimport { StyledMessage } from './message.styled'\n\nexport interface MessageProps extends Omit<StyledMessageProps, 'status'> {\n status?: FormFieldStatus\n chidren?: React.ReactNode\n}\n\nexport const Message = React.forwardRef<\n ElementRef<typeof StyledMessage>,\n MessageProps\n>((props, forwardRef) => {\n const { messageId, setMessageId, status } = useFormFieldContext()\n\n const id = props.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 {...props}\n id={id}\n status={status}\n ref={forwardRef}\n />\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"],"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,MAAA;AAAA,EACd,OAAS,EAAA,OAAA;AACX,CAAC,CAAA,CAAA;AAEY,MAAA,cAAA,GAAiBD,2BAAO,CAAAC,+BAAA,CAAU,IAAM,EAAA;AAAA,EACnD,KAAO,EAAA,cAAA;AACT,CAAC,CAAA;;ACMY,MAAA,KAAA,GAAQC,yBAAM,CAAA,UAAA,CAGzB,CAAC,EAAE,QAAW,GAAA,IAAA,EAAM,QAAU,EAAA,GAAG,SAAU,EAAA,EAAG,UAAe,KAAA;AAC7D,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,kBAAA;AAAA,IACA,aAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,MACTC,wCAAoB,EAAA,CAAA;AAExB,EAAA,MAAM,KAAQ,GAAAC,aAAA;AAAA,IACZ,sBAEKC,eAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EAAA;AAAA,MAAA,QAAA;AAAA,MACA,QAAA,oBAAaC,cAAA,CAAA,cAAA,EAAA,EAAe,QAAC,EAAA,GAAA,E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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/field.styled.tsx","../src/partials/field.tsx","../src/partials/helper.tsx","../src/partials/message.styled.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 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 */\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 { floating = true, visuallyHidden = false, children, ...restProps },\n forwardRef\n ) => {\n const {\n setLabel,\n setIsFloatingLabel,\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 () => 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) {\n return null\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)\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\nimport { StyledLabel } from './label.styled'\nimport { StyledDescription } from './description.styled'\nimport { StyledHelper } from './helper.styled'\n\nexport const StyledField = styled(Primitive.div, {\n marginBottom: '$300',\n position: 'relative',\n '&[data-disabled]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}`]: {\n color: '$text-neutrals-disabled',\n },\n },\n '&[data-readonly]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}`]: {\n color: '$text-neutrals-subtle',\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 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 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 React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport {\n useFormFieldContext,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport type { FormFieldStatus } from '@mirohq/design-system-base-form'\n\nimport type { StyledMessageProps } from './message.styled'\nimport { StyledMessage } from './message.styled'\n\nexport interface MessageProps extends Omit<StyledMessageProps, 'status'> {\n status?: FormFieldStatus\n chidren?: React.ReactNode\n}\n\nexport const Message = React.forwardRef<\n ElementRef<typeof StyledMessage>,\n MessageProps\n>((props, forwardRef) => {\n const { messageId, setMessageId, status } = useFormFieldContext()\n\n const id = props.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 {...props}\n id={id}\n status={status}\n ref={forwardRef}\n />\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"],"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,MAAA;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;;ACHM,MAAM,QAAQC,yBAAM,CAAA,UAAA;AAAA,EAIzB,CACE,EAAE,QAAA,GAAW,IAAM,EAAA,cAAA,GAAiB,OAAO,QAAU,EAAA,GAAG,SAAU,EAAA,EAClE,UACG,KAAA;AACH,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,kBAAA;AAAA,MACA,gBAAA;AAAA,MACA,aAAA;AAAA,MACA,QAAW,GAAA,KAAA;AAAA,QACTC,wCA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IC,wCAAoB,EAAA,CAAA;AAEhE,EAAM,MAAA,EAAA,GAAA,CAAK,EAAM,GAAA,KAAA,CAAA,EAAA,KAAN,IAAY,GAAA,EAAA,GAAA,aAAA,CAAA;AACvB,EAAAK,eAAA,CAAU,MAAM,gBAAiB,CAAA,EAAE,GAAG,CAAC,gBAAA,EAAkB,EAAE,CAAC,CAAA,CAAA;AAE5D,EAAA,sCAAQ,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/module.js CHANGED
@@ -14,35 +14,69 @@ const StyledLabel = styled(Primitive.label, {
14
14
  fontSize: "$200",
15
15
  lineHeight: 1.5,
16
16
  marginBottom: "$100",
17
- display: "block"
17
+ display: "block",
18
+ variants: {
19
+ visuallyHidden: {
20
+ true: {
21
+ // todo MDS-1003: replace with shared styles
22
+ border: "0",
23
+ clip: "rect(0 0 0 0)",
24
+ height: "1px",
25
+ margin: "-1px",
26
+ overflow: "hidden",
27
+ padding: "0",
28
+ position: "absolute",
29
+ width: "1px"
30
+ }
31
+ }
32
+ }
18
33
  });
19
34
  const StyledAsterisk = styled(Primitive.span, {
20
35
  color: "$text-danger"
21
36
  });
22
37
 
23
- const Label = React.forwardRef(({ floating = true, children, ...restProps }, forwardRef) => {
24
- const {
25
- setLabel,
26
- setIsFloatingLabel,
27
- formElementId,
28
- required = false
29
- } = useFormFieldContext();
30
- const label = useMemo(
31
- () => /* @__PURE__ */ jsxs(Fragment, { children: [
32
- children,
33
- required && /* @__PURE__ */ jsx(StyledAsterisk, { children: "*" })
34
- ] }),
35
- [children, required]
36
- );
37
- useEffect(() => {
38
- setLabel(label);
39
- }, [setLabel, label]);
40
- useEffect(() => setIsFloatingLabel(floating), [setIsFloatingLabel, floating]);
41
- if (floating) {
42
- return null;
38
+ const Label = React.forwardRef(
39
+ ({ floating = true, visuallyHidden = false, children, ...restProps }, forwardRef) => {
40
+ const {
41
+ setLabel,
42
+ setIsFloatingLabel,
43
+ setIsHiddenLabel,
44
+ formElementId,
45
+ required = false
46
+ } = useFormFieldContext();
47
+ const label = useMemo(
48
+ () => /* @__PURE__ */ jsxs(Fragment, { children: [
49
+ children,
50
+ required && /* @__PURE__ */ jsx(StyledAsterisk, { children: "*" })
51
+ ] }),
52
+ [children, required]
53
+ );
54
+ useEffect(() => {
55
+ setLabel(label);
56
+ }, [setLabel, label]);
57
+ useEffect(
58
+ () => setIsFloatingLabel(floating),
59
+ [setIsFloatingLabel, floating]
60
+ );
61
+ useEffect(
62
+ () => setIsHiddenLabel(visuallyHidden),
63
+ [setIsHiddenLabel, visuallyHidden]
64
+ );
65
+ if (floating) {
66
+ return null;
67
+ }
68
+ return /* @__PURE__ */ jsx(
69
+ StyledLabel,
70
+ {
71
+ htmlFor: formElementId,
72
+ ...restProps,
73
+ ref: forwardRef,
74
+ visuallyHidden,
75
+ children: label
76
+ }
77
+ );
43
78
  }
44
- return /* @__PURE__ */ jsx(StyledLabel, { htmlFor: formElementId, ...restProps, ref: forwardRef, children: label });
45
- });
79
+ );
46
80
 
47
81
  const StyledDescription = styled(Primitive.p, {
48
82
  fontSize: "$175",
@@ -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/field.styled.tsx","../src/partials/field.tsx","../src/partials/helper.tsx","../src/partials/message.styled.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\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 * Whether the label should float above the input\n * @default true\n */\n floating?: boolean\n}\n\nexport const Label = React.forwardRef<\n ElementRef<typeof StyledLabel>,\n LabelProps\n>(({ floating = true, children, ...restProps }, forwardRef) => {\n const {\n setLabel,\n setIsFloatingLabel,\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(() => setIsFloatingLabel(floating), [setIsFloatingLabel, floating])\n\n // floating labels are managed in the form elements\n if (floating) {\n return null\n }\n\n return (\n <StyledLabel htmlFor={formElementId} {...restProps} ref={forwardRef}>\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\nimport { StyledLabel } from './label.styled'\nimport { StyledDescription } from './description.styled'\nimport { StyledHelper } from './helper.styled'\n\nexport const StyledField = styled(Primitive.div, {\n marginBottom: '$300',\n position: 'relative',\n '&[data-disabled]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}`]: {\n color: '$text-neutrals-disabled',\n },\n },\n '&[data-readonly]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}`]: {\n color: '$text-neutrals-subtle',\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 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 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 React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport {\n useFormFieldContext,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport type { FormFieldStatus } from '@mirohq/design-system-base-form'\n\nimport type { StyledMessageProps } from './message.styled'\nimport { StyledMessage } from './message.styled'\n\nexport interface MessageProps extends Omit<StyledMessageProps, 'status'> {\n status?: FormFieldStatus\n chidren?: React.ReactNode\n}\n\nexport const Message = React.forwardRef<\n ElementRef<typeof StyledMessage>,\n MessageProps\n>((props, forwardRef) => {\n const { messageId, setMessageId, status } = useFormFieldContext()\n\n const id = props.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 {...props}\n id={id}\n status={status}\n ref={forwardRef}\n />\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;AACX,CAAC,CAAA,CAAA;AAEY,MAAA,cAAA,GAAiB,MAAO,CAAA,SAAA,CAAU,IAAM,EAAA;AAAA,EACnD,KAAO,EAAA,cAAA;AACT,CAAC,CAAA;;ACMY,MAAA,KAAA,GAAQ,KAAM,CAAA,UAAA,CAGzB,CAAC,EAAE,QAAW,GAAA,IAAA,EAAM,QAAU,EAAA,GAAG,SAAU,EAAA,EAAG,UAAe,KAAA;AAC7D,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,kBAAA;AAAA,IACA,aAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,MACT,mBAAoB,EAAA,CAAA;AAExB,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACZ,sBA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E,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/field.styled.tsx","../src/partials/field.tsx","../src/partials/helper.tsx","../src/partials/message.styled.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 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 */\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 { floating = true, visuallyHidden = false, children, ...restProps },\n forwardRef\n ) => {\n const {\n setLabel,\n setIsFloatingLabel,\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 () => 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) {\n return null\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)\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\nimport { StyledLabel } from './label.styled'\nimport { StyledDescription } from './description.styled'\nimport { StyledHelper } from './helper.styled'\n\nexport const StyledField = styled(Primitive.div, {\n marginBottom: '$300',\n position: 'relative',\n '&[data-disabled]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}`]: {\n color: '$text-neutrals-disabled',\n },\n },\n '&[data-readonly]': {\n [`${StyledLabel}, ${StyledDescription}, ${StyledHelper}`]: {\n color: '$text-neutrals-subtle',\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 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 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 React, { useEffect } from 'react'\nimport type { ElementRef } from 'react'\nimport {\n useFormFieldContext,\n FORM_FIELD_STATUS,\n} from '@mirohq/design-system-base-form'\nimport type { FormFieldStatus } from '@mirohq/design-system-base-form'\n\nimport type { StyledMessageProps } from './message.styled'\nimport { StyledMessage } from './message.styled'\n\nexport interface MessageProps extends Omit<StyledMessageProps, 'status'> {\n status?: FormFieldStatus\n chidren?: React.ReactNode\n}\n\nexport const Message = React.forwardRef<\n ElementRef<typeof StyledMessage>,\n MessageProps\n>((props, forwardRef) => {\n const { messageId, setMessageId, status } = useFormFieldContext()\n\n const id = props.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 {...props}\n id={id}\n status={status}\n ref={forwardRef}\n />\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,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,GAAiB,MAAO,CAAA,SAAA,CAAU,IAAM,EAAA;AAAA,EACnD,KAAO,EAAA,cAAA;AACT,CAAC,CAAA;;ACHM,MAAM,QAAQ,KAAM,CAAA,UAAA;AAAA,EAIzB,CACE,EAAE,QAAA,GAAW,IAAM,EAAA,cAAA,GAAiB,OAAO,QAAU,EAAA,GAAG,SAAU,EAAA,EAClE,UACG,KAAA;AACH,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,kBAAA;AAAA,MACA,gBAAA;AAAA,MACA,aAAA;AAAA,MACA,QAAW,GAAA,KAAA;AAAA,QACT,mBAAoB,EAAA,CAAA;AAExB,IAAA,MAAM,KAAQ,GA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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
@@ -1067,7 +1067,11 @@ declare const StyledLabel: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_des
1067
1067
  _hover: (css: _stitches_react_types_css_util.CSSProperties) => {
1068
1068
  '&:hover, &[data-hovered]': _stitches_react_types_css_util.CSSProperties;
1069
1069
  };
1070
- }>>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLLabelElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"label">>, {}, {}>;
1070
+ }>>>, "visuallyHidden"> & _stitches_react_types_styled_component.TransformProps<{
1071
+ visuallyHidden?: boolean | "true" | undefined;
1072
+ }, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLLabelElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"label">>, {
1073
+ visuallyHidden?: boolean | "true" | undefined;
1074
+ }, {}>;
1071
1075
  declare type StyledLabelProps = ComponentPropsWithRef<typeof StyledLabel>;
1072
1076
 
1073
1077
  interface LabelProps extends StyledLabelProps {
@@ -1080,6 +1084,11 @@ interface LabelProps extends StyledLabelProps {
1080
1084
  * @default true
1081
1085
  */
1082
1086
  floating?: boolean;
1087
+ /**
1088
+ * To hide the label visually and still keep it accessible for screen readers and other assistive technology
1089
+ * @default false
1090
+ */
1091
+ visuallyHidden?: boolean;
1083
1092
  }
1084
1093
  declare const Label: react__default.ForwardRefExoticComponent<Omit<LabelProps, "ref"> & react__default.RefAttributes<HTMLLabelElement>>;
1085
1094
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirohq/design-system-form",
3
- "version": "0.1.5-tag-component.0",
3
+ "version": "0.1.6",
4
4
  "description": "",
5
5
  "author": "Miro",
6
6
  "source": "src/index.ts",
@@ -26,11 +26,11 @@
26
26
  "react": "^16.14 || ^17 || ^18"
27
27
  },
28
28
  "dependencies": {
29
+ "@mirohq/design-system-base-form": "^0.2.3",
29
30
  "@mirohq/design-system-primitive": "^1.1.2",
30
- "@mirohq/design-system-base-form": "^0.2.2-tag-component.0",
31
- "@mirohq/design-system-use-id": "^0.1.1",
32
- "@mirohq/design-system-stitches": "^2.6.2-tag-component.0",
33
- "@mirohq/design-system-utils": "^0.15.0"
31
+ "@mirohq/design-system-utils": "^0.15.0",
32
+ "@mirohq/design-system-stitches": "^2.6.2",
33
+ "@mirohq/design-system-use-id": "^0.1.1"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "rollup -c ../../../rollup.config.js",