@mirohq/design-system-form 0.1.35 → 0.2.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 CHANGED
@@ -8,6 +8,8 @@ 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
+ var designSystemIcons = require('@mirohq/design-system-icons');
11
13
 
12
14
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
15
 
@@ -24,6 +26,11 @@ const StyledLabel = designSystemStitches.styled(designSystemPrimitive.Primitive.
24
26
  marginBottom: "$100",
25
27
  display: "block",
26
28
  variants: {
29
+ v1: {
30
+ true: {
31
+ marginBottom: "$50"
32
+ }
33
+ },
27
34
  visuallyHidden: {
28
35
  true: {
29
36
  // todo MDS-1003: replace with shared styles
@@ -44,14 +51,21 @@ const StyledAsterisk = designSystemStitches.styled(designSystemPrimitive.Primiti
44
51
  });
45
52
 
46
53
  const Label = React__default["default"].forwardRef(
47
- ({ floating = true, visuallyHidden = false, children, ...restProps }, forwardRef) => {
54
+ ({
55
+ floating: floatingProp = true,
56
+ visuallyHidden = false,
57
+ children,
58
+ ...restProps
59
+ }, forwardRef) => {
48
60
  const {
49
61
  setLabel,
50
62
  setIsFloatingLabel,
51
63
  setIsHiddenLabel,
52
64
  formElementId,
53
- required = false
65
+ required = false,
66
+ v1
54
67
  } = designSystemBaseForm.useFormFieldContext();
68
+ const floating = v1 ? false : floatingProp;
55
69
  const label = React.useMemo(
56
70
  () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
57
71
  children,
@@ -70,7 +84,7 @@ const Label = React__default["default"].forwardRef(
70
84
  () => setIsHiddenLabel(visuallyHidden),
71
85
  [setIsHiddenLabel, visuallyHidden]
72
86
  );
73
- if (floating) {
87
+ if (floating && !v1) {
74
88
  return null;
75
89
  }
76
90
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -80,6 +94,7 @@ const Label = React__default["default"].forwardRef(
80
94
  ...restProps,
81
95
  ref: forwardRef,
82
96
  visuallyHidden,
97
+ v1,
83
98
  children: label
84
99
  }
85
100
  );
@@ -99,17 +114,45 @@ const StyledHelper = designSystemStitches.styled(designSystemPrimitive.Primitive
99
114
  marginTop: "$50"
100
115
  });
101
116
 
117
+ const StyledMessage = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
118
+ fontSize: "$150",
119
+ lineHeight: 1.5,
120
+ marginTop: "$50",
121
+ display: "flex",
122
+ alignItems: "center",
123
+ gap: "$50",
124
+ variants: {
125
+ status: {
126
+ valid: {
127
+ color: "$text-success"
128
+ },
129
+ invalid: {
130
+ color: "$text-danger"
131
+ },
132
+ dirty: {},
133
+ pristine: {},
134
+ touched: {}
135
+ }
136
+ }
137
+ });
138
+
102
139
  const StyledField = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
103
140
  marginBottom: "$300",
104
141
  position: "relative",
105
142
  "&[data-disabled]": {
106
- ["".concat(StyledLabel, ", ").concat(StyledDescription, ", ").concat(StyledHelper)]: {
107
- color: "$text-neutrals-disabled"
143
+ ["".concat(StyledLabel, ", ").concat(StyledDescription, ", ").concat(StyledHelper, ", ").concat(StyledMessage)]: {
144
+ color: "$text-neutrals-disabled",
145
+ svg: {
146
+ color: "$icon-neutrals-disabled"
147
+ }
108
148
  }
109
149
  },
110
150
  "&[data-readonly]": {
111
- ["".concat(StyledLabel, ", ").concat(StyledDescription, ", ").concat(StyledHelper)]: {
112
- color: "$text-neutrals-subtle"
151
+ ["".concat(StyledLabel, ", ").concat(StyledDescription, ", ").concat(StyledHelper, ", ").concat(StyledMessage)]: {
152
+ color: "$text-neutrals-subtle",
153
+ svg: {
154
+ color: "$icon-neutrals-disabled"
155
+ }
113
156
  }
114
157
  }
115
158
  });
@@ -172,7 +215,10 @@ const Root = React__default["default"].forwardRef(
172
215
  );
173
216
  }
174
217
  );
175
- 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 }) }));
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
+ });
176
222
 
177
223
  const Helper = React__default["default"].forwardRef((props, forwardRef) => {
178
224
  var _a;
@@ -182,41 +228,34 @@ const Helper = React__default["default"].forwardRef((props, forwardRef) => {
182
228
  return /* @__PURE__ */ jsxRuntime.jsx(StyledHelper, { ...props, id, ref: forwardRef });
183
229
  });
184
230
 
185
- const StyledMessage = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
186
- fontSize: "$150",
187
- lineHeight: 1.5,
188
- marginTop: "$50",
189
- variants: {
190
- status: {
191
- valid: {
192
- color: "$text-success"
193
- },
194
- invalid: {
195
- color: "$text-danger"
196
- },
197
- dirty: {},
198
- pristine: {},
199
- touched: {}
200
- }
201
- }
202
- });
203
-
204
- const Message = React__default["default"].forwardRef((props, forwardRef) => {
231
+ const Message = React__default["default"].forwardRef(({ children, ...restProps }, forwardRef) => {
205
232
  var _a;
206
- const { messageId, setMessageId, status } = designSystemBaseForm.useFormFieldContext();
207
- const id = (_a = props.id) != null ? _a : messageId;
233
+ const { messageId, setMessageId, status, v1 } = designSystemBaseForm.useFormFieldContext();
234
+ const id = (_a = restProps.id) != null ? _a : messageId;
208
235
  React.useEffect(() => setMessageId(id), [setMessageId, id]);
209
236
  if (status !== designSystemBaseForm.FORM_FIELD_STATUS.invalid && status !== designSystemBaseForm.FORM_FIELD_STATUS.valid) {
210
237
  return null;
211
238
  }
212
- return /* @__PURE__ */ jsxRuntime.jsx(
239
+ return /* @__PURE__ */ jsxRuntime.jsxs(
213
240
  StyledMessage,
214
241
  {
215
242
  role: "alert",
216
- ...props,
243
+ ...restProps,
217
244
  id,
218
245
  status,
219
- ref: forwardRef
246
+ ref: forwardRef,
247
+ children: [
248
+ v1 && status === "valid" && /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconCheckMark, { size: "small", weight: "thin", color: "icon-success" }),
249
+ v1 && status === "invalid" && /* @__PURE__ */ jsxRuntime.jsx(
250
+ designSystemIcons.IconExclamationPointCircle,
251
+ {
252
+ size: "small",
253
+ weight: "thin",
254
+ color: "icon-danger"
255
+ }
256
+ ),
257
+ children
258
+ ]
220
259
  }
221
260
  );
222
261
  });
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 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,GAAi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,uBAAAL,cAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACJ,GAAG,KAAA;AAAA,MACJ,EAAA;AAAA,MACA,MAAA;AAAA,MACA,GAAK,EAAA,UAAA;AAAA,KAAA;AAAA,GACP,CAAA;AAEJ,CAAC,CAAA;;AC3BM,MAAM,WAAc,GAAAL,yBAAA,CAAM,UAG/B,CAAA,CAAC,OAAO,UAAe,KAAA;AAjBzB,EAAA,IAAA,EAAA,CAAA;AAkBE,EAAA,MAAM,EAAE,aAAA,EAAe,gBAAiB,EAAA,GAAIC,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;;;;"}
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,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,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,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;;ACPM,MAAM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AAA,CAAA;AAkBE,EAAA,MAAM,EAAE,aAAA,EAAe,gBAAiB,EAAA,GAAIC,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
@@ -4,6 +4,8 @@ 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
+ import { IconCheckMark, IconExclamationPointCircle } from '@mirohq/design-system-icons';
7
9
 
8
10
  const StyledForm = styled(Primitive.form, {
9
11
  all: "unset",
@@ -16,6 +18,11 @@ const StyledLabel = styled(Primitive.label, {
16
18
  marginBottom: "$100",
17
19
  display: "block",
18
20
  variants: {
21
+ v1: {
22
+ true: {
23
+ marginBottom: "$50"
24
+ }
25
+ },
19
26
  visuallyHidden: {
20
27
  true: {
21
28
  // todo MDS-1003: replace with shared styles
@@ -36,14 +43,21 @@ const StyledAsterisk = styled(Primitive.span, {
36
43
  });
37
44
 
38
45
  const Label = React.forwardRef(
39
- ({ floating = true, visuallyHidden = false, children, ...restProps }, forwardRef) => {
46
+ ({
47
+ floating: floatingProp = true,
48
+ visuallyHidden = false,
49
+ children,
50
+ ...restProps
51
+ }, forwardRef) => {
40
52
  const {
41
53
  setLabel,
42
54
  setIsFloatingLabel,
43
55
  setIsHiddenLabel,
44
56
  formElementId,
45
- required = false
57
+ required = false,
58
+ v1
46
59
  } = useFormFieldContext();
60
+ const floating = v1 ? false : floatingProp;
47
61
  const label = useMemo(
48
62
  () => /* @__PURE__ */ jsxs(Fragment, { children: [
49
63
  children,
@@ -62,7 +76,7 @@ const Label = React.forwardRef(
62
76
  () => setIsHiddenLabel(visuallyHidden),
63
77
  [setIsHiddenLabel, visuallyHidden]
64
78
  );
65
- if (floating) {
79
+ if (floating && !v1) {
66
80
  return null;
67
81
  }
68
82
  return /* @__PURE__ */ jsx(
@@ -72,6 +86,7 @@ const Label = React.forwardRef(
72
86
  ...restProps,
73
87
  ref: forwardRef,
74
88
  visuallyHidden,
89
+ v1,
75
90
  children: label
76
91
  }
77
92
  );
@@ -91,17 +106,45 @@ const StyledHelper = styled(Primitive.div, {
91
106
  marginTop: "$50"
92
107
  });
93
108
 
109
+ const StyledMessage = styled(Primitive.div, {
110
+ fontSize: "$150",
111
+ lineHeight: 1.5,
112
+ marginTop: "$50",
113
+ display: "flex",
114
+ alignItems: "center",
115
+ gap: "$50",
116
+ variants: {
117
+ status: {
118
+ valid: {
119
+ color: "$text-success"
120
+ },
121
+ invalid: {
122
+ color: "$text-danger"
123
+ },
124
+ dirty: {},
125
+ pristine: {},
126
+ touched: {}
127
+ }
128
+ }
129
+ });
130
+
94
131
  const StyledField = styled(Primitive.div, {
95
132
  marginBottom: "$300",
96
133
  position: "relative",
97
134
  "&[data-disabled]": {
98
- ["".concat(StyledLabel, ", ").concat(StyledDescription, ", ").concat(StyledHelper)]: {
99
- color: "$text-neutrals-disabled"
135
+ ["".concat(StyledLabel, ", ").concat(StyledDescription, ", ").concat(StyledHelper, ", ").concat(StyledMessage)]: {
136
+ color: "$text-neutrals-disabled",
137
+ svg: {
138
+ color: "$icon-neutrals-disabled"
139
+ }
100
140
  }
101
141
  },
102
142
  "&[data-readonly]": {
103
- ["".concat(StyledLabel, ", ").concat(StyledDescription, ", ").concat(StyledHelper)]: {
104
- color: "$text-neutrals-subtle"
143
+ ["".concat(StyledLabel, ", ").concat(StyledDescription, ", ").concat(StyledHelper, ", ").concat(StyledMessage)]: {
144
+ color: "$text-neutrals-subtle",
145
+ svg: {
146
+ color: "$icon-neutrals-disabled"
147
+ }
105
148
  }
106
149
  }
107
150
  });
@@ -164,7 +207,10 @@ const Root = React.forwardRef(
164
207
  );
165
208
  }
166
209
  );
167
- const Field = React.forwardRef(({ id, status, ...restProps }, forwardRef) => /* @__PURE__ */ jsx(FormFieldProvider, { status, id, children: /* @__PURE__ */ jsx(Root, { status, ...restProps, ref: forwardRef }) }));
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
+ });
168
214
 
169
215
  const Helper = React.forwardRef((props, forwardRef) => {
170
216
  var _a;
@@ -174,41 +220,34 @@ const Helper = React.forwardRef((props, forwardRef) => {
174
220
  return /* @__PURE__ */ jsx(StyledHelper, { ...props, id, ref: forwardRef });
175
221
  });
176
222
 
177
- const StyledMessage = styled(Primitive.div, {
178
- fontSize: "$150",
179
- lineHeight: 1.5,
180
- marginTop: "$50",
181
- variants: {
182
- status: {
183
- valid: {
184
- color: "$text-success"
185
- },
186
- invalid: {
187
- color: "$text-danger"
188
- },
189
- dirty: {},
190
- pristine: {},
191
- touched: {}
192
- }
193
- }
194
- });
195
-
196
- const Message = React.forwardRef((props, forwardRef) => {
223
+ const Message = React.forwardRef(({ children, ...restProps }, forwardRef) => {
197
224
  var _a;
198
- const { messageId, setMessageId, status } = useFormFieldContext();
199
- const id = (_a = props.id) != null ? _a : messageId;
225
+ const { messageId, setMessageId, status, v1 } = useFormFieldContext();
226
+ const id = (_a = restProps.id) != null ? _a : messageId;
200
227
  useEffect(() => setMessageId(id), [setMessageId, id]);
201
228
  if (status !== FORM_FIELD_STATUS.invalid && status !== FORM_FIELD_STATUS.valid) {
202
229
  return null;
203
230
  }
204
- return /* @__PURE__ */ jsx(
231
+ return /* @__PURE__ */ jsxs(
205
232
  StyledMessage,
206
233
  {
207
234
  role: "alert",
208
- ...props,
235
+ ...restProps,
209
236
  id,
210
237
  status,
211
- ref: forwardRef
238
+ ref: forwardRef,
239
+ children: [
240
+ v1 && status === "valid" && /* @__PURE__ */ jsx(IconCheckMark, { size: "small", weight: "thin", color: "icon-success" }),
241
+ v1 && status === "invalid" && /* @__PURE__ */ jsx(
242
+ IconExclamationPointCircle,
243
+ {
244
+ size: "small",
245
+ weight: "thin",
246
+ color: "icon-danger"
247
+ }
248
+ ),
249
+ children
250
+ ]
212
251
  }
213
252
  );
214
253
  });
@@ -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 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;A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A;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACJ,GAAG,KAAA;AAAA,MACJ,EAAA;AAAA,MACA,MAAA;AAAA,MACA,GAAK,EAAA,UAAA;AAAA,KAAA;AAAA,GACP,CAAA;AAEJ,CAAC,CAAA;;AC3BM,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: '$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,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;;ACPM,MAAM,QAAQ,KAAM,CAAA,UAAA;AAAA,EAIzB,CACE;AAAA,IACE,UAAU,YAAe,GAAA,IAAA;AAAA,IACzB,cAAiB,GAAA,KAAA;AAAA,IACjB,QAAA;AAAA,IACA,GAAG,SAAA;AAAA,KAEL,UACG,KAAA;A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AAG,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
@@ -3,19 +3,21 @@ import react__default, { ComponentPropsWithRef, ForwardRefExoticComponent } from
3
3
  import * as _stitches_react_types_styled_component from '@stitches/react/types/styled-component';
4
4
  import * as _mirohq_design_system_stitches from '@mirohq/design-system-stitches';
5
5
  import * as _mirohq_design_system_primitive from '@mirohq/design-system-primitive';
6
- import { FormFieldProviderProps, FormFieldStatus } from '@mirohq/design-system-base-form';
6
+ import { FormFieldProviderProps } from '@mirohq/design-system-base-form';
7
7
 
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
  declare 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">>>, "visuallyHidden"> & _stitches_react_types_styled_component.TransformProps<{
11
+ declare const StyledLabel: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"label">>>, "v1" | "visuallyHidden"> & _stitches_react_types_styled_component.TransformProps<{
12
+ v1?: boolean | "true" | undefined;
12
13
  visuallyHidden?: boolean | "true" | undefined;
13
14
  }, {}> & _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;
14
16
  visuallyHidden?: boolean | "true" | undefined;
15
17
  }, {}>;
16
18
  declare type StyledLabelProps = ComponentPropsWithRef<typeof StyledLabel>;
17
19
 
18
- interface LabelProps extends StyledLabelProps {
20
+ interface LabelProps extends Omit<StyledLabelProps, 'v1'> {
19
21
  /**
20
22
  * The content
21
23
  */
@@ -23,6 +25,7 @@ interface LabelProps extends StyledLabelProps {
23
25
  /**
24
26
  * Whether the label should float above the input
25
27
  * @default true
28
+ * @deprecated will be removed with Design Language release
26
29
  */
27
30
  floating?: boolean;
28
31
  /**
@@ -36,7 +39,7 @@ declare const Label: react__default.ForwardRefExoticComponent<Omit<LabelProps, "
36
39
  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">>, {}, {}>;
37
40
  declare type StyledFieldProps = ComponentPropsWithRef<typeof StyledField>;
38
41
 
39
- interface FieldProps extends StyledFieldProps, FormFieldProviderProps {
42
+ interface FieldProps extends Omit<StyledFieldProps, 'v1'>, Omit<FormFieldProviderProps, 'v1'> {
40
43
  }
41
44
  declare const Field: react__default.ForwardRefExoticComponent<Omit<FieldProps, "ref"> & react__default.RefAttributes<HTMLDivElement>>;
42
45
 
@@ -59,7 +62,6 @@ declare const StyledMessage: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_d
59
62
  declare type StyledMessageProps = ComponentPropsWithRef<typeof StyledMessage>;
60
63
 
61
64
  interface MessageProps extends Omit<StyledMessageProps, 'status'> {
62
- status?: FormFieldStatus;
63
65
  chidren?: react__default.ReactNode;
64
66
  }
65
67
  declare const Message: react__default.ForwardRefExoticComponent<Omit<MessageProps, "ref"> & react__default.RefAttributes<HTMLDivElement>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirohq/design-system-form",
3
- "version": "0.1.35",
3
+ "version": "0.2.0",
4
4
  "description": "",
5
5
  "author": "Miro",
6
6
  "source": "src/index.ts",
@@ -26,9 +26,11 @@
26
26
  "react": "^16.14 || ^17 || ^18"
27
27
  },
28
28
  "dependencies": {
29
- "@mirohq/design-system-base-form": "^0.2.32",
29
+ "@mirohq/design-system-experiments": "^0.2.0",
30
+ "@mirohq/design-system-base-form": "^0.3.0",
31
+ "@mirohq/design-system-icons": "^0.58.2",
30
32
  "@mirohq/design-system-primitive": "^1.1.2",
31
- "@mirohq/design-system-stitches": "^2.6.25",
33
+ "@mirohq/design-system-stitches": "^2.6.27",
32
34
  "@mirohq/design-system-utils": "^0.15.4"
33
35
  },
34
36
  "scripts": {