@mittwald/flow-react-components 0.2.0-alpha.530 → 0.2.0-alpha.531

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.
@@ -38,6 +38,13 @@ const Switch = flowComponent("Switch", (props) => {
38
38
  localInputRef.current?.focus();
39
39
  });
40
40
  const { FieldErrorView, fieldPropsContext, fieldProps } = useFieldComponent(props);
41
+ const propsContext = {
42
+ ...fieldPropsContext,
43
+ Label: {
44
+ ...fieldPropsContext.Label,
45
+ optional: false
46
+ }
47
+ };
41
48
  return /* @__PURE__ */ jsxs("div", { ...fieldProps, children: [
42
49
  /* @__PURE__ */ jsx(
43
50
  Aria.Switch,
@@ -46,7 +53,7 @@ const Switch = flowComponent("Switch", (props) => {
46
53
  className: rootClassName,
47
54
  ref: localSwitchRef,
48
55
  inputRef: localInputRef,
49
- children: ({ isSelected }) => /* @__PURE__ */ jsxs(PropsContextProvider, { props: fieldPropsContext, children: [
56
+ children: ({ isSelected }) => /* @__PURE__ */ jsxs(PropsContextProvider, { props: propsContext, children: [
50
57
  /* @__PURE__ */ jsx("div", { className: styles.track, children: /* @__PURE__ */ jsx("div", { className: styles.handle, children: isSelected ? /* @__PURE__ */ jsx(IconCheck, { size: "s" }) : /* @__PURE__ */ jsx(IconClose, { size: "s" }) }) }),
51
58
  /* @__PURE__ */ jsx("div", { className: styles$1.label, children })
52
59
  ] })
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.mjs","sources":["../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Switch.module.scss\";\nimport clsx from \"clsx\";\nimport { IconCheck, IconClose } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport labelStyles from \"../Label/Label.module.scss\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface SwitchProps\n extends PropsWithChildren<Omit<Aria.SwitchProps, \"children\">>,\n FlowComponentProps<HTMLLabelElement> {\n /**\n * Whether the label should appear before or after the switch. @default\n * \"trailing\"\n */\n labelPosition?: \"leading\" | \"trailing\";\n}\n\n/** @flr-generate all */\nexport const Switch = flowComponent(\"Switch\", (props) => {\n const {\n children,\n className,\n labelPosition = \"trailing\",\n ref,\n inputRef,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.switch,\n className,\n styles[`label-${labelPosition}`],\n );\n\n const localSwitchRef = useObjectRef(ref);\n const localInputRef = useObjectRef(inputRef);\n\n useMakeFocusable(localSwitchRef, () => {\n localInputRef.current?.focus();\n });\n\n const { FieldErrorView, fieldPropsContext, fieldProps } =\n useFieldComponent(props);\n\n return (\n <div {...fieldProps}>\n <Aria.Switch\n {...rest}\n className={rootClassName}\n ref={localSwitchRef}\n inputRef={localInputRef}\n >\n {({ isSelected }) => (\n <PropsContextProvider props={fieldPropsContext}>\n <div className={styles.track}>\n <div className={styles.handle}>\n {isSelected ? <IconCheck size=\"s\" /> : <IconClose size=\"s\" />}\n </div>\n </div>\n <div className={labelStyles.label}>{children}</div>\n </PropsContextProvider>\n )}\n </Aria.Switch>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Switch;\n"],"names":["labelStyles"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,MAAM,MAAA,GAAS,aAAA,CAAc,QAAA,EAAU,CAAC,KAAA,KAAU;AACvD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,aAAA,GAAgB,UAAA;AAAA,IAChB,GAAA;AAAA,IACA,QAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,aAAA,GAAgB,IAAA;AAA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1
+ {"version":3,"file":"Switch.mjs","sources":["../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Switch.module.scss\";\nimport clsx from \"clsx\";\nimport { IconCheck, IconClose } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport labelStyles from \"../Label/Label.module.scss\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface SwitchProps\n extends PropsWithChildren<Omit<Aria.SwitchProps, \"children\">>,\n FlowComponentProps<HTMLLabelElement> {\n /**\n * Whether the label should appear before or after the switch. @default\n * \"trailing\"\n */\n labelPosition?: \"leading\" | \"trailing\";\n}\n\n/** @flr-generate all */\nexport const Switch = flowComponent(\"Switch\", (props) => {\n const {\n children,\n className,\n labelPosition = \"trailing\",\n ref,\n inputRef,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.switch,\n className,\n styles[`label-${labelPosition}`],\n );\n\n const localSwitchRef = useObjectRef(ref);\n const localInputRef = useObjectRef(inputRef);\n\n useMakeFocusable(localSwitchRef, () => {\n localInputRef.current?.focus();\n });\n\n const { FieldErrorView, fieldPropsContext, fieldProps } =\n useFieldComponent(props);\n\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n ...fieldPropsContext.Label,\n optional: false,\n },\n };\n\n return (\n <div {...fieldProps}>\n <Aria.Switch\n {...rest}\n className={rootClassName}\n ref={localSwitchRef}\n inputRef={localInputRef}\n >\n {({ isSelected }) => (\n <PropsContextProvider props={propsContext}>\n <div className={styles.track}>\n <div className={styles.handle}>\n {isSelected ? <IconCheck size=\"s\" /> : <IconClose size=\"s\" />}\n </div>\n </div>\n <div className={labelStyles.label}>{children}</div>\n </PropsContextProvider>\n )}\n </Aria.Switch>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Switch;\n"],"names":["labelStyles"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,MAAM,MAAA,GAAS,aAAA,CAAc,QAAA,EAAU,CAAC,KAAA,KAAU;AACvD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,aAAA,GAAgB,UAAA;AAAA,IAChB,GAAA;AAAA,IACA,QAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,aAAA,GAAgB,IAAA;AAAA,IACpB,MAAA,CAAO,MAAA;AAAA,IACP,SAAA;AAAA,IACA,MAAA,CAAO,CAAA,MAAA,EAAS,aAAa,CAAA,CAAE;AAAA,GACjC;AAEA,EAAA,MAAM,cAAA,GAAiB,aAAa,GAAG,CAAA;AACvC,EAAA,MAAM,aAAA,GAAgB,aAAa,QAAQ,CAAA;AAE3C,EAAA,gBAAA,CAAiB,gBAAgB,MAAM;AACrC,IAAA,aAAA,CAAc,SAAS,KAAA,EAAM;AAAA,EAC/B,CAAC,CAAA;AAED,EAAA,MAAM,EAAE,cAAA,EAAgB,iBAAA,EAAmB,UAAA,EAAW,GACpD,kBAAkB,KAAK,CAAA;AAEzB,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,GAAG,iBAAA;AAAA,IACH,KAAA,EAAO;AAAA,MACL,GAAG,iBAAA,CAAkB,KAAA;AAAA,MACrB,QAAA,EAAU;AAAA;AACZ,GACF;AAEA,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAK,GAAG,UAAA,EACP,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,IAAA,CAAK,MAAA;AAAA,MAAL;AAAA,QACE,GAAG,IAAA;AAAA,QACJ,SAAA,EAAW,aAAA;AAAA,QACX,GAAA,EAAK,cAAA;AAAA,QACL,QAAA,EAAU,aAAA;AAAA,QAET,WAAC,EAAE,UAAA,uBACF,IAAA,CAAC,oBAAA,EAAA,EAAqB,OAAO,YAAA,EAC3B,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,KAAA,EAAA,EAAI,WAAW,MAAA,CAAO,KAAA,EACrB,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAO,MAAA,EACpB,QAAA,EAAA,UAAA,uBAAc,SAAA,EAAA,EAAU,IAAA,EAAK,KAAI,CAAA,mBAAK,GAAA,CAAC,aAAU,IAAA,EAAK,GAAA,EAAI,GAC7D,CAAA,EACF,CAAA;AAAA,0BACA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAWA,QAAA,CAAY,OAAQ,QAAA,EAAS;AAAA,SAAA,EAC/C;AAAA;AAAA,KAEJ;AAAA,wBACC,cAAA,EAAA,EAAe;AAAA,GAAA,EAClB,CAAA;AAEJ,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAI9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAQ/E,MAAM,WAAW,WACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,EAC3D,kBAAkB,CAAC,gBAAgB,CAAC;IACtC;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;CACxC;AAED,wBAAwB;AACxB,eAAO,MAAM,MAAM,kGAgDjB,CAAC;AAEH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAI9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAQ/E,MAAM,WAAW,WACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,EAC3D,kBAAkB,CAAC,gBAAgB,CAAC;IACtC;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;CACxC;AAED,wBAAwB;AACxB,eAAO,MAAM,MAAM,kGAwDjB,CAAC;AAEH,eAAe,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-react-components",
3
- "version": "0.2.0-alpha.530",
3
+ "version": "0.2.0-alpha.531",
4
4
  "type": "module",
5
5
  "description": "A React implementation of Flow, mittwald’s design system",
6
6
  "homepage": "https://mittwald.github.io/flow",
@@ -58,7 +58,7 @@
58
58
  "dependencies": {
59
59
  "@internationalized/string-compiler": "^3.2.6",
60
60
  "@mittwald/password-tools-js": "3.0.0-alpha.18",
61
- "@mittwald/react-tunnel": "0.2.0-alpha.530",
61
+ "@mittwald/react-tunnel": "0.2.0-alpha.531",
62
62
  "@mittwald/react-use-promise": "^4.2.2",
63
63
  "@react-aria/form": "^3.1.2",
64
64
  "@react-aria/live-announcer": "^3.4.4",
@@ -101,7 +101,7 @@
101
101
  "@faker-js/faker": "^10.1.0",
102
102
  "@internationalized/date": "^3.10.0",
103
103
  "@mittwald/flow-core": "",
104
- "@mittwald/flow-design-tokens": "0.2.0-alpha.530",
104
+ "@mittwald/flow-design-tokens": "0.2.0-alpha.531",
105
105
  "@mittwald/react-use-promise": "^4.2.2",
106
106
  "@mittwald/remote-dom-react": "1.2.2-mittwald.10",
107
107
  "@mittwald/typescript-config": "",
@@ -174,5 +174,5 @@
174
174
  "optional": true
175
175
  }
176
176
  },
177
- "gitHead": "3b0a0e35e0a6f3cb6d8ab0b3f2b3d5713542ddf5"
177
+ "gitHead": "1ed1dc260cf05fbbde46bdf2a3baf890b3a1eaf5"
178
178
  }