@bioturing/components 0.20.2 → 0.21.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.
@@ -1,31 +1,44 @@
1
1
  "use client";
2
- import { jsxs as t, jsx as r } from "react/jsx-runtime";
3
- import { isValidElement as l } from "react";
4
- import a from "antd/es/form/FormItem";
2
+ import { jsx as e } from "react/jsx-runtime";
3
+ import { isValidElement as a } from "react";
4
+ import i from "antd/es/form/FormItem";
5
5
  import { Question as c } from "@bioturing/assets";
6
6
  import { useCls as f } from "../utils/antdUtils.js";
7
- import { IconButton as d } from "../icon-button/component.js";
8
- const N = ({
9
- tooltip: e,
10
- label: o,
11
- optionalMark: m,
12
- ...s
7
+ import { IconButton as p } from "../icon-button/component.js";
8
+ const y = ({
9
+ tooltip: o,
10
+ label: t,
11
+ optionalMark: n,
12
+ requiredMark: m = !0,
13
+ ...r
13
14
  }) => {
14
- const n = f(), i = e || m ? /* @__PURE__ */ t("span", { className: n("form-item-label-inner"), children: [
15
- o,
16
- e && /* @__PURE__ */ r(
17
- d,
18
- {
19
- className: n("form-item-explaination-icon"),
20
- label: typeof e == "string" || l(e) ? e : void 0,
21
- children: /* @__PURE__ */ r(c, {})
22
- }
23
- ),
24
- m && /* @__PURE__ */ r("span", { className: n("form-item-label-optional-mark"), children: typeof m == "boolean" ? "(optional)" : m })
25
- ] }) : o;
26
- return /* @__PURE__ */ r(a, { label: i, ...s });
15
+ const l = f();
16
+ console.log(m);
17
+ const s = /* @__PURE__ */ e(
18
+ "span",
19
+ {
20
+ className: l(
21
+ "form-item-label-inner",
22
+ m && "form-item-label-with-required-mark"
23
+ ),
24
+ children: [
25
+ t,
26
+ o && /* @__PURE__ */ e(
27
+ p,
28
+ {
29
+ className: l("form-item-explaination-icon"),
30
+ label: typeof o == "string" || a(o) ? o : void 0,
31
+ children: /* @__PURE__ */ e(c, {})
32
+ }
33
+ ),
34
+ n && /* @__PURE__ */ e("span", { className: l("form-item-label-optional-mark"), children: typeof n == "boolean" ? "(optional)" : n }),
35
+ m !== !1 && /* @__PURE__ */ e("span", { className: l("form-item-label-required-mark"), children: typeof m == "boolean" ? "*" : m })
36
+ ]
37
+ }
38
+ );
39
+ return /* @__PURE__ */ e(i, { label: s, ...r });
27
40
  };
28
41
  export {
29
- N as FormItem
42
+ y as FormItem
30
43
  };
31
44
  //# sourceMappingURL=item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"item.js","sources":["../../../src/components/form/item.tsx"],"sourcesContent":["\"use client\";\nimport { isValidElement } from \"react\";\nimport {\n default as AntdFormItem,\n type FormItemProps as AntdFormItemProps,\n} from \"antd/es/form/FormItem\";\nimport { Question } from \"@bioturing/assets\";\nimport { IconButton } from \"../icon-button\";\nimport { useCls } from \"../utils\";\n\nexport interface FormItemProps<Values = unknown>\n extends AntdFormItemProps<Values> {\n // tooltip?: React.ReactNode | TooltipProps;\n /**\n * Whether the field is optional. If true, the label will be marked as optional.\n * @default false\n */\n optionalMark?: boolean | React.ReactNode;\n}\n\nexport const FormItem = <Values = unknown,>({\n tooltip,\n label,\n optionalMark,\n ...rest\n}: FormItemProps<Values>) => {\n const cls = useCls();\n const renderedLabel =\n tooltip || optionalMark ? (\n <span className={cls(\"form-item-label-inner\")}>\n {label}\n {tooltip && (\n <IconButton\n className={cls(\"form-item-explaination-icon\")}\n label={\n typeof tooltip == \"string\" || isValidElement(tooltip)\n ? tooltip\n : undefined\n }\n >\n <Question />\n </IconButton>\n )}\n {optionalMark && (\n <span className={cls(\"form-item-label-optional-mark\")}>\n {typeof optionalMark == \"boolean\" ? \"(optional)\" : optionalMark}\n </span>\n )}\n </span>\n ) : (\n label\n );\n return <AntdFormItem label={renderedLabel} {...rest} />;\n};\n"],"names":["FormItem","tooltip","label","optionalMark","rest","cls","useCls","renderedLabel","jsxs","jsx","IconButton","isValidElement","Question","AntdFormItem"],"mappings":";;;;;;;AAoBO,MAAMA,IAAW,CAAoB;AAAA,EAC1C,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,GAAGC;AACL,MAA6B;AAC3B,QAAMC,IAAMC,EAAO,GACbC,IACJN,KAAWE,IACT,gBAAAK,EAAC,UAAK,WAAWH,EAAI,uBAAuB,GACzC,UAAA;AAAA,IAAAH;AAAA,IACAD,KACC,gBAAAQ;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,WAAWL,EAAI,6BAA6B;AAAA,QAC5C,OACE,OAAOJ,KAAW,YAAYU,EAAeV,CAAO,IAChDA,IACA;AAAA,QAGN,4BAACW,GAAS,CAAA,CAAA;AAAA,MAAA;AAAA,IACZ;AAAA,IAEDT,KACE,gBAAAM,EAAA,QAAA,EAAK,WAAWJ,EAAI,+BAA+B,GACjD,UAAO,OAAAF,KAAgB,YAAY,eAAeA,EACrD,CAAA;AAAA,EAAA,EAAA,CAEJ,IAEAD;AAEJ,SAAQ,gBAAAO,EAAAI,GAAA,EAAa,OAAON,GAAgB,GAAGH,GAAM;AACvD;"}
1
+ {"version":3,"file":"item.js","sources":["../../../src/components/form/item.tsx"],"sourcesContent":["\"use client\";\nimport { isValidElement } from \"react\";\nimport {\n default as AntdFormItem,\n type FormItemProps as AntdFormItemProps,\n} from \"antd/es/form/FormItem\";\nimport { Question } from \"@bioturing/assets\";\nimport { IconButton } from \"../icon-button\";\nimport { useCls } from \"../utils\";\n\nexport interface FormItemProps<Values = unknown>\n extends AntdFormItemProps<Values> {\n // tooltip?: React.ReactNode | TooltipProps;\n /**\n * Whether the field is optional. If true, the label will be marked as optional.\n * @default false\n */\n optionalMark?: boolean | React.ReactNode;\n /**\n * Whether show the asterisk when the field is required\n * @default true\n */\n requiredMark?: boolean | React.ReactNode;\n}\n\nexport const FormItem = <Values = unknown,>({\n tooltip,\n label,\n optionalMark,\n requiredMark = true,\n ...rest\n}: FormItemProps<Values>) => {\n const cls = useCls();\n\n console.log(requiredMark);\n const renderedLabel = (\n <span\n className={cls(\n \"form-item-label-inner\",\n requiredMark && \"form-item-label-with-required-mark\"\n )}\n >\n {[\n label,\n tooltip && (\n <IconButton\n className={cls(\"form-item-explaination-icon\")}\n label={\n typeof tooltip == \"string\" || isValidElement(tooltip)\n ? tooltip\n : undefined\n }\n >\n <Question />\n </IconButton>\n ),\n optionalMark && (\n <span className={cls(\"form-item-label-optional-mark\")}>\n {typeof optionalMark == \"boolean\" ? \"(optional)\" : optionalMark}\n </span>\n ),\n requiredMark !== false && (\n <span className={cls(\"form-item-label-required-mark\")}>\n {typeof requiredMark == \"boolean\" ? \"*\" : requiredMark}\n </span>\n ),\n ]}\n </span>\n );\n\n return <AntdFormItem label={renderedLabel} {...rest} />;\n};\n"],"names":["FormItem","tooltip","label","optionalMark","requiredMark","rest","cls","useCls","renderedLabel","jsx","IconButton","isValidElement","Question","AntdFormItem"],"mappings":";;;;;;;AAyBO,MAAMA,IAAW,CAAoB;AAAA,EAC1C,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,GAAGC;AACL,MAA6B;AAC3B,QAAMC,IAAMC,EAAO;AAEnB,UAAQ,IAAIH,CAAY;AACxB,QAAMI,IACJ,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWH;AAAA,QACT;AAAA,QACAF,KAAgB;AAAA,MAClB;AAAA,MAEC,UAAA;AAAA,QACCF;AAAA,QACAD,KACE,gBAAAQ;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,WAAWJ,EAAI,6BAA6B;AAAA,YAC5C,OACE,OAAOL,KAAW,YAAYU,EAAeV,CAAO,IAChDA,IACA;AAAA,YAGN,4BAACW,GAAS,CAAA,CAAA;AAAA,UAAA;AAAA,QACZ;AAAA,QAEFT,KACG,gBAAAM,EAAA,QAAA,EAAK,WAAWH,EAAI,+BAA+B,GACjD,UAAO,OAAAH,KAAgB,YAAY,eAAeA,EACrD,CAAA;AAAA,QAEFC,MAAiB,MACd,gBAAAK,EAAA,QAAA,EAAK,WAAWH,EAAI,+BAA+B,GACjD,UAAO,OAAAF,KAAgB,YAAY,MAAMA,EAC5C,CAAA;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AAGF,SAAQ,gBAAAK,EAAAI,GAAA,EAAa,OAAOL,GAAgB,GAAGH,GAAM;AACvD;"}
@@ -1 +1 @@
1
- @layer components{.ds-form-item-label-inner{display:inline-flex;align-items:center;gap:.25rem}.ds-form-item-label-optional-mark{color:var(--ds-color-text-tertiary)}}
1
+ @layer components{.ds-form-item-label-inner{display:inline-flex;align-items:center;gap:.25rem}.ds-form-item-label-optional-mark{color:var(--ds-color-text-tertiary)}.ds-form-item-label-required-mark{display:none}:is(.ds-form-item .ds-form-item-label>label.ds-form-item-required):after{display:none}:is(.ds-form-item .ds-form-item-label>label.ds-form-item-required):before{display:none}:is(:is(.ds-form-item .ds-form-item-label>label.ds-form-item-required) .ds-form-item-label-inner.ds-form-item-label-with-required-mark) .ds-form-item-label-required-mark{display:inline-block;color:var(--ds-form-label-required-mark-color);font-size:var(--ds-font-size);font-family:Inter,sans-serif;line-height:1;content:"*"}.ds-form-item .ds-form-item-label>label:after{display:none}.ds-form-horizontal .ds-form-item .ds-form-item-label .ds-form-item-label-inner:after{content:":";position:relative;margin-block:0;margin-inline-start:var(--ds-form-label-colon-margin-inline-start);margin-inline-end:var(--ds-form-label-colon-margin-inline-end)}}
@@ -1,57 +1,63 @@
1
1
  "use client";
2
- import { jsx as m } from "react/jsx-runtime";
3
- import { useRef as v, useEffect as x, isValidElement as N } from "react";
4
- import { useRender as j } from "@base-ui-components/react/use-render";
5
- import { mergeProps as w } from "@base-ui-components/react/merge-props";
6
- import { useTransitionStatus as A } from "@base-ui-components/react/utils";
7
- import { useLatestRef as F, useAnimationsFinished as T } from "../hooks/base-ui.js";
8
- import { clsx as k } from "../utils/cn.js";
9
- function q(c) {
10
- const {
11
- children: n = /* @__PURE__ */ m("div", {}),
12
- className: l,
13
- starting: r,
14
- ending: i,
15
- show: t = !0,
16
- keepMounted: o = !1,
17
- onTransitionComplete: s,
18
- listenToChildAnimations: p = !1,
19
- asChild: g = !0,
20
- ...h
21
- } = c, { mounted: y, setMounted: a, transitionStatus: e } = A(t), u = F(t), R = k(
22
- l,
23
- e === "starting" && typeof r == "string" && r,
24
- e === "ending" && typeof i == "string" && i
25
- ), d = v(null), f = T(d, {
2
+ import { jsx as d } from "react/jsx-runtime";
3
+ import { useRef as x, useEffect as j, isValidElement as F } from "react";
4
+ import { useRender as N } from "@base-ui-components/react/use-render";
5
+ import { mergeProps as A } from "@base-ui-components/react/merge-props";
6
+ import { useTransitionStatus as E } from "@base-ui-components/react/utils";
7
+ import './style.css';/* empty css */
8
+ import { useLatestRef as S, useAnimationsFinished as D } from "../hooks/base-ui.js";
9
+ import { useCls as L } from "../utils/antdUtils.js";
10
+ import { clsx as O } from "../utils/cn.js";
11
+ function Q({
12
+ children: r = /* @__PURE__ */ d("div", {}),
13
+ className: p,
14
+ starting: s,
15
+ ending: i,
16
+ show: t = !0,
17
+ keepMounted: n = !1,
18
+ onTransitionComplete: o,
19
+ listenToChildAnimations: l = !1,
20
+ asChild: g = !0,
21
+ ...y
22
+ }) {
23
+ const { mounted: f, setMounted: u, transitionStatus: e } = E(t), m = S(t), R = L(), v = O(
24
+ p,
25
+ e === "starting" && typeof s == "string" && s,
26
+ e === "ending" && typeof i == "string" && i,
27
+ // hide by display: none when not mounted and keepMounted is true
28
+ f == !1 && n ? R("transition-hidden") : void 0
29
+ );
30
+ console.log(Date.now(), e, f, n);
31
+ const a = x(null), c = D(a, {
26
32
  waitForNextTick: t,
27
- subtree: p
28
- }), b = j({
29
- render: typeof n == "function" || g && N(n) ? n : /* @__PURE__ */ m("div", { children: n }),
30
- props: w(h, {
31
- ref: d,
32
- className: R,
33
+ subtree: l
34
+ }), b = N({
35
+ render: typeof r == "function" || g && F(r) ? r : /* @__PURE__ */ d("div", { children: r }),
36
+ props: A(y, {
37
+ ref: a,
38
+ className: v,
33
39
  "data-starting": e === "starting" ? "true" : void 0,
34
40
  "data-ending": e === "ending" ? "true" : void 0,
35
41
  style: {
36
- ...e === "starting" && typeof r == "object" ? r : {},
42
+ ...e === "starting" && typeof s == "object" ? s : {},
37
43
  ...e === "ending" && typeof i == "object" ? i : {}
38
44
  }
39
45
  })
40
46
  });
41
- return x(() => {
42
- f(() => {
43
- t === u.current && (o || a(t), s == null || s(t));
47
+ return j(() => {
48
+ c(() => {
49
+ t === m.current && (u(t), o == null || o(t));
44
50
  });
45
51
  }, [
46
52
  t,
47
- o,
48
- f,
49
- a,
53
+ n,
54
+ c,
50
55
  u,
51
- s
52
- ]), y ? b : null;
56
+ m,
57
+ o
58
+ ]), f || n ? b : null;
53
59
  }
54
60
  export {
55
- q as Transition
61
+ Q as Transition
56
62
  };
57
63
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../src/components/transition/component.tsx"],"sourcesContent":["\"use client\";\nimport { CSSProperties, isValidElement, useEffect, useRef } from \"react\";\nimport { useRender } from \"@base-ui-components/react/use-render\";\nimport { mergeProps } from \"@base-ui-components/react/merge-props\";\nimport { useTransitionStatus } from \"@base-ui-components/react/utils\";\nimport { clsx } from \"../utils\";\nimport { useAnimationsFinished, useLatestRef } from \"../hooks\";\n\nexport type TransitionProps = Omit<\n useRender.ComponentProps<\"div\">,\n \"render\" | \"children\"\n> & {\n /** Whether the component should be shown */\n show?: boolean;\n /** CSS classes to apply when the component is opened */\n starting?: string | CSSProperties;\n /** CSS classes to apply when the component is closed */\n ending?: string | CSSProperties;\n /** CSS classes to apply to the component */\n className?: string;\n /** Keep mounted */\n keepMounted?: boolean;\n /**\n * Callback function to be called when the transition ends\n */\n onTransitionComplete?: (show?: boolean) => void;\n /**\n * Whether to listen for animations in child elements\n */\n listenToChildAnimations?: boolean;\n /**\n * Whether to render the child as a child element\n * @default true\n */\n asChild?: boolean;\n children?: React.ReactNode | useRender.ComponentProps<\"div\">[\"render\"];\n};\n\nexport function Transition(props: TransitionProps) {\n const {\n children = <div />,\n className,\n starting,\n ending,\n show = true,\n keepMounted = false,\n onTransitionComplete,\n listenToChildAnimations = false,\n asChild = true,\n ...otherProps\n } = props;\n\n const { mounted, setMounted, transitionStatus } = useTransitionStatus(show);\n const showRef = useLatestRef(show);\n\n const combinedClassName = clsx(\n className,\n transitionStatus === \"starting\" && typeof starting == \"string\" && starting,\n transitionStatus === \"ending\" && typeof ending == \"string\" && ending\n );\n\n const ref = useRef<HTMLDivElement>(null);\n const runOnceAnimationsFinish = useAnimationsFinished(ref, {\n waitForNextTick: show,\n subtree: listenToChildAnimations,\n });\n\n const getRender = () => {\n if (typeof children === \"function\") {\n return children;\n }\n if (asChild && isValidElement(children)) {\n return children;\n }\n return <div>{children}</div>;\n };\n\n const rendered = useRender({\n render: getRender(),\n props: mergeProps<\"div\">(otherProps, {\n ref,\n className: combinedClassName,\n ...{\n \"data-starting\": transitionStatus === \"starting\" ? \"true\" : undefined,\n \"data-ending\": transitionStatus === \"ending\" ? \"true\" : undefined,\n },\n style: {\n ...(transitionStatus === \"starting\" && typeof starting === \"object\"\n ? starting\n : {}),\n ...(transitionStatus === \"ending\" && typeof ending === \"object\"\n ? ending\n : {}),\n },\n }),\n });\n\n useEffect(() => {\n runOnceAnimationsFinish(() => {\n if (show === showRef.current) {\n if (!keepMounted) setMounted(show);\n onTransitionComplete?.(show);\n }\n });\n }, [\n show,\n keepMounted,\n runOnceAnimationsFinish,\n setMounted,\n showRef,\n onTransitionComplete,\n ]);\n\n return mounted ? rendered : null;\n}\n"],"names":["Transition","props","children","className","starting","ending","show","keepMounted","onTransitionComplete","listenToChildAnimations","asChild","otherProps","mounted","setMounted","transitionStatus","useTransitionStatus","showRef","useLatestRef","combinedClassName","clsx","ref","useRef","runOnceAnimationsFinish","useAnimationsFinished","rendered","useRender","isValidElement","jsx","mergeProps","useEffect"],"mappings":";;;;;;;;AAsCO,SAASA,EAAWC,GAAwB;AAC3C,QAAA;AAAA,IACJ,UAAAC,sBAAY,OAAI,E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AAA,IACAC;AAAA,IACAe;AAAA,IACAT;AAAA,IACAG;AAAA,IACAR;AAAA,EAAA,CACD,GAEMI,IAAUY,IAAW;AAC9B;"}
1
+ {"version":3,"file":"component.js","sources":["../../../src/components/transition/component.tsx"],"sourcesContent":["\"use client\";\nimport { CSSProperties, isValidElement, useEffect, useRef } from \"react\";\nimport { useRender } from \"@base-ui-components/react/use-render\";\nimport { mergeProps } from \"@base-ui-components/react/merge-props\";\nimport { useTransitionStatus } from \"@base-ui-components/react/utils\";\nimport { clsx, useCls } from \"../utils\";\nimport { useAnimationsFinished, useLatestRef } from \"../hooks\";\n\nimport \"./style.css\";\n\nexport type TransitionProps = Omit<\n useRender.ComponentProps<\"div\">,\n \"render\" | \"children\"\n> & {\n /** Whether the component should be shown */\n show?: boolean;\n /** CSS classes to apply when the component is opened */\n starting?: string | CSSProperties;\n /** CSS classes to apply when the component is closed */\n ending?: string | CSSProperties;\n /** CSS classes to apply to the component */\n className?: string;\n /** Keep mounted */\n keepMounted?: boolean;\n /**\n * Callback function to be called when the transition ends\n */\n onTransitionComplete?: (show?: boolean) => void;\n /**\n * Whether to listen for animations in child elements\n */\n listenToChildAnimations?: boolean;\n /**\n * Whether to render the child as a child element\n * @default true\n */\n asChild?: boolean;\n children?: React.ReactNode | useRender.ComponentProps<\"div\">[\"render\"];\n};\n\nexport function Transition({\n children = <div />,\n className,\n starting,\n ending,\n show = true,\n keepMounted = false,\n onTransitionComplete,\n listenToChildAnimations = false,\n asChild = true,\n ...otherProps\n}: TransitionProps) {\n const { mounted, setMounted, transitionStatus } = useTransitionStatus(show);\n const showRef = useLatestRef(show);\n\n const cls = useCls();\n\n const combinedClassName = clsx(\n className,\n transitionStatus === \"starting\" && typeof starting == \"string\" && starting,\n transitionStatus === \"ending\" && typeof ending == \"string\" && ending,\n // hide by display: none when not mounted and keepMounted is true\n mounted == false && keepMounted ? cls(\"transition-hidden\") : undefined\n );\n\n console.log(Date.now(), transitionStatus, mounted, keepMounted);\n const ref = useRef<HTMLDivElement>(null);\n const runOnceAnimationsFinish = useAnimationsFinished(ref, {\n waitForNextTick: show,\n subtree: listenToChildAnimations,\n });\n\n const getRender = () => {\n if (typeof children === \"function\") {\n return children;\n }\n if (asChild && isValidElement(children)) {\n return children;\n }\n return <div>{children}</div>;\n };\n\n const rendered = useRender({\n render: getRender(),\n props: mergeProps<\"div\">(otherProps, {\n ref,\n className: combinedClassName,\n ...{\n \"data-starting\": transitionStatus === \"starting\" ? \"true\" : undefined,\n \"data-ending\": transitionStatus === \"ending\" ? \"true\" : undefined,\n },\n style: {\n ...(transitionStatus === \"starting\" && typeof starting === \"object\"\n ? starting\n : {}),\n ...(transitionStatus === \"ending\" && typeof ending === \"object\"\n ? ending\n : {}),\n },\n }),\n });\n\n useEffect(() => {\n runOnceAnimationsFinish(() => {\n if (show === showRef.current) {\n setMounted(show);\n onTransitionComplete?.(show);\n }\n });\n }, [\n show,\n keepMounted,\n runOnceAnimationsFinish,\n setMounted,\n showRef,\n onTransitionComplete,\n ]);\n\n return mounted || keepMounted ? rendered : null;\n}\n"],"names":["Transition","children","className","starting","ending","show","keepMounted","onTransitionComplete","listenToChildAnimations","asChild","otherProps","mounted","setMounted","transitionStatus","useTransitionStatus","showRef","useLatestRef","cls","useCls","combinedClassName","clsx","ref","useRef","runOnceAnimationsFinish","useAnimationsFinished","rendered","useRender","isValidElement","jsx","mergeProps","useEffect"],"mappings":";;;;;;;;;;AAwCO,SAASA,EAAW;AAAA,EACzB,UAAAC,sBAAY,OAAI,EAAA;AAAA,EAChB,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,aAAAC,IAAc;AAAA,EACd,sBAAAC;AAAA,EACA,yBAAAC,IAA0B;AAAA,EAC1B,SAAAC,IAAU;AAAA,EACV,GAAGC;AACL,GAAoB;AAClB,QAAM,EAAE,SAAAC,GAAS,YAAAC,GAAY,kBAAAC,EAAiB,IAAIC,EAAoBT,CAAI,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transition-hidden{display:none}}
package/dist/index.d.ts CHANGED
@@ -1718,7 +1718,7 @@ export declare const Form: (<Values = any>({ ...rest }: InternalFormProps<Values
1718
1718
  useForm: typeof useForm;
1719
1719
  useFormInstance: typeof default_9;
1720
1720
  useWatch: typeof useWatch;
1721
- Item: <Values = unknown>({ tooltip, label, optionalMark, ...rest }: FormItemProps<Values>) => JSX.Element;
1721
+ Item: <Values = unknown>({ tooltip, label, optionalMark, requiredMark, ...rest }: FormItemProps<Values>) => JSX.Element;
1722
1722
  List: React_2.FC<FormListProps>;
1723
1723
  ErrorList: React_2.FC<ErrorListProps>;
1724
1724
  Provider: React_2.FC<FormProviderProps>;
@@ -1732,6 +1732,11 @@ export declare interface FormItemProps<Values = unknown> extends FormItemProps_2
1732
1732
  * @default false
1733
1733
  */
1734
1734
  optionalMark?: boolean | React.ReactNode;
1735
+ /**
1736
+ * Whether show the asterisk when the field is required
1737
+ * @default true
1738
+ */
1739
+ requiredMark?: boolean | React.ReactNode;
1735
1740
  }
1736
1741
 
1737
1742
  export { FormListFieldData }
@@ -3247,7 +3252,7 @@ export { Transfer }
3247
3252
 
3248
3253
  export { TransferProps }
3249
3254
 
3250
- export declare function Transition(props: TransitionProps): null;
3255
+ export declare function Transition({ children, className, starting, ending, show, keepMounted, onTransitionComplete, listenToChildAnimations, asChild, ...otherProps }: TransitionProps): null;
3251
3256
 
3252
3257
  export declare type TransitionProps = Omit<useRender.ComponentProps<"div">, "render" | "children"> & {
3253
3258
  /** Whether the component should be shown */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bioturing/components",
3
- "version": "0.20.2",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "module": "./dist/index.js",
6
6
  "main": "./dist/index.js",