@bioturing/components 0.41.1 → 0.42.0-beta.1

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.
Files changed (43) hide show
  1. package/dist/base.d.ts +1 -0
  2. package/dist/base.d.ts.map +1 -1
  3. package/dist/base.js +1 -0
  4. package/dist/base.js.map +1 -1
  5. package/dist/components/dropdown-menu/component.d.ts.map +1 -1
  6. package/dist/components/dropdown-menu/component.js +153 -155
  7. package/dist/components/dropdown-menu/component.js.map +1 -1
  8. package/dist/components/dropdown-menu/style.css +1 -1
  9. package/dist/components/form/FormItem/FormItemInput.d.ts +50 -0
  10. package/dist/components/form/FormItem/FormItemInput.d.ts.map +1 -0
  11. package/dist/components/form/FormItem/FormItemInput.js +137 -0
  12. package/dist/components/form/FormItem/FormItemInput.js.map +1 -0
  13. package/dist/components/form/FormItem/FormItemLabel.d.ts +48 -0
  14. package/dist/components/form/FormItem/FormItemLabel.d.ts.map +1 -0
  15. package/dist/components/form/FormItem/FormItemLabel.js +80 -0
  16. package/dist/components/form/FormItem/FormItemLabel.js.map +1 -0
  17. package/dist/components/form/FormItem/ItemHolder.d.ts +33 -0
  18. package/dist/components/form/FormItem/ItemHolder.d.ts.map +1 -0
  19. package/dist/components/form/FormItem/ItemHolder.js +168 -0
  20. package/dist/components/form/FormItem/ItemHolder.js.map +1 -0
  21. package/dist/components/form/FormItem/index.d.ts +106 -0
  22. package/dist/components/form/FormItem/index.d.ts.map +1 -0
  23. package/dist/components/form/FormItem/index.js +234 -0
  24. package/dist/components/form/FormItem/index.js.map +1 -0
  25. package/dist/components/form/component.d.ts +7 -1
  26. package/dist/components/form/component.d.ts.map +1 -1
  27. package/dist/components/form/component.js +4 -4
  28. package/dist/components/form/item.d.ts +27 -23
  29. package/dist/components/form/item.d.ts.map +1 -1
  30. package/dist/components/form/label.d.ts.map +1 -1
  31. package/dist/components/form/label.js +33 -31
  32. package/dist/components/form/label.js.map +1 -1
  33. package/dist/components/form/style.css +1 -1
  34. package/dist/components/toast/function.d.ts +1 -1
  35. package/dist/components/toast/function.d.ts.map +1 -1
  36. package/dist/components/utils/renderProp.d.ts +1 -1
  37. package/dist/components/utils/renderProp.d.ts.map +1 -1
  38. package/dist/components/utils/renderProp.js +16 -10
  39. package/dist/components/utils/renderProp.js.map +1 -1
  40. package/dist/stats.html +1 -1
  41. package/package.json +4 -3
  42. package/dist/components/form/item.js +0 -43
  43. package/dist/components/form/item.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/FormItem/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAc1D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEvF,OAAO,iBAAiB,MAAM,sCAAsC,CAAC;AAkBrE,QAAA,MAAM,iBAAiB,4DAA6D,CAAC;AACrF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,KAAK,cAAc,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;AACpF,KAAK,YAAY,CAAC,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC;AACvE,KAAK,YAAY,CAAC,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;AAE3E,MAAM,M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react/jsx-runtime";
3
+ import * as d from "react";
4
+ import { FieldContext as ue, ListContext as ce, Field as fe } from "rc-field-form";
5
+ import ge from "rc-util/es/hooks/useState";
6
+ import { supportRef as pe } from "rc-util/es/ref";
7
+ import { cloneElement as he } from "antd/es/_util/reactNode";
8
+ import { devUseWarning as ye } from "antd/es/_util/warning";
9
+ import { ConfigContext as Ce } from "antd/es/config-provider";
10
+ import Se from "antd/es/config-provider/hooks/useCSSVarCls";
11
+ import { FormContext as Ie, NoStyleItemContext as ve } from "antd/es/form/context";
12
+ import we from "antd/es/form/hooks/useChildren";
13
+ import be from "antd/es/form/hooks/useFormItemStatus";
14
+ import Fe from "antd/es/form/hooks/useFrameState";
15
+ import Pe from "antd/es/form/hooks/useItemRef";
16
+ import xe from "antd/es/form/style";
17
+ import { toArray as A, getFieldId as Ne } from "antd/es/form/util";
18
+ import Ve from "antd/es/form/FormItem/StatusProvider";
19
+ import Ee from "./ItemHolder.js";
20
+ import { clsx as Ae } from "../../utils/cn.js";
21
+ const Re = "__SPLIT__";
22
+ function ke(r, o) {
23
+ const m = Object.keys(r), y = Object.keys(o);
24
+ return m.length === y.length && m.every((a) => {
25
+ const w = r[a], c = o[a];
26
+ return w === c || typeof w == "function" || typeof c == "function";
27
+ });
28
+ }
29
+ const _e = d.memo(
30
+ ({ children: r }) => r,
31
+ (r, o) => ke(r.control, o.control) && r.update === o.update && r.childProps.length === o.childProps.length && r.childProps.every((m, y) => m === o.childProps[y])
32
+ );
33
+ function $() {
34
+ return {
35
+ errors: [],
36
+ warnings: [],
37
+ touched: !1,
38
+ validating: !1,
39
+ name: [],
40
+ validated: !1
41
+ };
42
+ }
43
+ function je(r) {
44
+ const {
45
+ name: o,
46
+ noStyle: m,
47
+ className: y,
48
+ dependencies: a,
49
+ prefixCls: w,
50
+ shouldUpdate: c,
51
+ rules: z,
52
+ children: D,
53
+ required: R,
54
+ label: k,
55
+ messageVariables: _,
56
+ trigger: j = "onChange",
57
+ validateTrigger: q,
58
+ hidden: H,
59
+ help: x,
60
+ layout: Y,
61
+ // ============ BioTuring Custom: Extract custom props ============
62
+ classNames: G,
63
+ optionalMark: J,
64
+ requiredMark: Q,
65
+ labelRender: X
66
+ // ============ End Custom ============
67
+ } = r, { getPrefixCls: Z } = d.useContext(Ce), { name: ee } = d.useContext(Ie), s = we(D), b = typeof s == "function", T = d.useContext(ve), { validateTrigger: te } = d.useContext(ue), L = q !== void 0 ? q : te, p = o != null, F = Z("form", w), O = Se(F), [K, re, oe] = xe(F, O), u = ye("Form.Item");
68
+ process.env.NODE_ENV !== "production" && u(o !== null, "usage", "`null` is passed as `name` property");
69
+ const ne = d.useContext(ce), U = d.useRef(null), [M, se] = Fe({}), [h, ie] = ge(() => $()), ae = (e) => {
70
+ const i = ne?.getKey(e.name);
71
+ if (ie(e.destroy ? $() : e, !0), m && x !== !1 && T) {
72
+ let n = e.name;
73
+ if (e.destroy)
74
+ n = U.current || n;
75
+ else if (i !== void 0) {
76
+ const [l, f] = i;
77
+ n = [l, ...f], U.current = n;
78
+ }
79
+ T(e, n);
80
+ }
81
+ }, le = (e, i) => {
82
+ se((n) => {
83
+ const l = {
84
+ ...n
85
+ }, I = [...e.name.slice(0, -1), ...i].join(Re);
86
+ return e.destroy ? delete l[I] : l[I] = e, l;
87
+ });
88
+ }, [C, N] = d.useMemo(() => {
89
+ const e = [...h.errors], i = [...h.warnings];
90
+ return Object.values(M).forEach((n) => {
91
+ e.push(...n.errors || []), i.push(...n.warnings || []);
92
+ }), [e, i];
93
+ }, [M, h.errors, h.warnings]), de = Pe();
94
+ function B(e, i, n) {
95
+ return m && !H ? /* @__PURE__ */ P(
96
+ Ve,
97
+ {
98
+ prefixCls: F,
99
+ hasFeedback: r.hasFeedback,
100
+ validateStatus: r.validateStatus,
101
+ meta: h,
102
+ errors: C,
103
+ warnings: N,
104
+ noStyle: !0,
105
+ name: o,
106
+ children: e
107
+ }
108
+ ) : /* @__PURE__ */ P(
109
+ Ee,
110
+ {
111
+ ...r,
112
+ className: Ae(y, oe, O, re),
113
+ prefixCls: F,
114
+ fieldId: i,
115
+ isRequired: n,
116
+ errors: C,
117
+ warnings: N,
118
+ meta: h,
119
+ onSubItemMetaChange: le,
120
+ layout: Y,
121
+ name: o,
122
+ classNames: G,
123
+ optionalMark: J,
124
+ requiredMark: Q,
125
+ labelRender: X,
126
+ children: e
127
+ },
128
+ "row"
129
+ );
130
+ }
131
+ if (!p && !b && !a)
132
+ return K(B(s));
133
+ let S = {};
134
+ return typeof k == "string" ? S.label = k : o && (S.label = String(o)), _ && (S = { ...S, ..._ }), K(
135
+ /* @__PURE__ */ P(
136
+ fe,
137
+ {
138
+ ...r,
139
+ messageVariables: S,
140
+ trigger: j,
141
+ validateTrigger: L,
142
+ onMetaChange: ae,
143
+ children: (e, i, n) => {
144
+ const l = A(o).length && i ? i.name : [], f = Ne(l, ee), I = R !== void 0 ? R : !!z?.some((t) => {
145
+ if (t && typeof t == "object" && t.required && !t.warningOnly)
146
+ return !0;
147
+ if (typeof t == "function") {
148
+ const E = t(n);
149
+ return E?.required && !E?.warningOnly;
150
+ }
151
+ return !1;
152
+ }), V = {
153
+ ...e
154
+ };
155
+ let v = null;
156
+ if (u(
157
+ !(c && a),
158
+ "usage",
159
+ "`shouldUpdate` and `dependencies` shouldn't be used together. See https://u.ant.design/form-deps."
160
+ ), Array.isArray(s) && p)
161
+ u(
162
+ !1,
163
+ "usage",
164
+ "A `Form.Item` with a `name` prop must have a single child element. For information on how to render more complex form items, see https://u.ant.design/complex-form-item."
165
+ ), v = s;
166
+ else if (b && (!(c || a) || p))
167
+ u(
168
+ !!(c || a),
169
+ "usage",
170
+ "A `Form.Item` with a render function must have either `shouldUpdate` or `dependencies`."
171
+ ), u(
172
+ !p,
173
+ "usage",
174
+ "A `Form.Item` with a render function cannot be a field, and thus cannot have a `name` prop."
175
+ );
176
+ else if (a && !b && !p)
177
+ u(
178
+ !1,
179
+ "usage",
180
+ "Must set `name` or use a render function when `dependencies` is set."
181
+ );
182
+ else if (d.isValidElement(s)) {
183
+ u(
184
+ s.props.defaultValue === void 0,
185
+ "usage",
186
+ "`defaultValue` will not work on controlled Field. You should use `initialValues` of Form instead."
187
+ );
188
+ const t = {
189
+ ...s.props,
190
+ ...V
191
+ };
192
+ if (t.id || (t.id = f), x || C.length > 0 || N.length > 0 || r.extra) {
193
+ const g = [];
194
+ (x || C.length > 0) && g.push(`${f}_help`), r.extra && g.push(`${f}_extra`), t["aria-describedby"] = g.join(" ");
195
+ }
196
+ C.length > 0 && (t["aria-invalid"] = "true"), I && (t["aria-required"] = "true"), pe(s) && (t.ref = de(l, s)), (/* @__PURE__ */ new Set([
197
+ ...A(j),
198
+ ...A(L)
199
+ ])).forEach((g) => {
200
+ t[g] = (...W) => {
201
+ V[g]?.(...W), s.props[g]?.(...W);
202
+ };
203
+ });
204
+ const me = [
205
+ t["aria-required"],
206
+ t["aria-invalid"],
207
+ t["aria-describedby"]
208
+ ];
209
+ v = /* @__PURE__ */ P(
210
+ _e,
211
+ {
212
+ control: V,
213
+ update: s,
214
+ childProps: me,
215
+ children: he(s, t)
216
+ }
217
+ );
218
+ } else b && (c || a) && !p ? v = s(n) : (u(
219
+ !l.length || !!m,
220
+ "usage",
221
+ "`name` is only used for validate React element. If you are using Form.Item as layout display, please remove `name` instead."
222
+ ), v = s);
223
+ return B(v, f, I);
224
+ }
225
+ }
226
+ )
227
+ );
228
+ }
229
+ const qe = je;
230
+ qe.useStatus = be;
231
+ export {
232
+ qe as default
233
+ };
234
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/form/FormItem/index.tsx"],"sourcesContent":["/**\n * This file is copied from Ant Design 5.x-stable\n * Source: https://github.com/ant-design/ant-design/blob/5.x-stable/components/form/FormItem/index.tsx\n * \n * Customizations for @bioturing/components:\n * - Added `classNames` prop for styling sub-elements (root, row, label, control, etc.)\n * - Added `optionalMark` prop to show optional indicator\n * - Added enhanced `requiredMark` support (boolean | ReactNode)\n * - Added `labelRender` prop for custom label rendering\n * \n * Last synced with antd version: 5.x-stable (2025-02-04)\n */\n\n\"use client\";\n\nimport * as React from 'react';\nimport type { JSX } from 'react';\nimport { Field, FieldContext, ListContext } from 'rc-field-form';\nimport type { FieldProps } from 'rc-field-form/lib/Field';\nimport type { InternalNamePath, Meta } from 'rc-field-form/lib/interface';\nimport useState from 'rc-util/es/hooks/useState';\nimport { supportRef } from 'rc-util/es/ref';\n\n// ============ BioTuring Utils ============\nimport { clsx as classNames } from '../../utils';\n\n// ============ Ant Design Imports (from antd/es) ============\nimport { cloneElement } from 'antd/es/_util/reactNode';\nimport { devUseWarning } from 'antd/es/_util/warning';\nimport { ConfigContext } from 'antd/es/config-provider';\nimport useCSSVarCls from 'antd/es/config-provider/hooks/useCSSVarCls';\nimport { FormContext, NoStyleItemContext } from 'antd/es/form/context';\nimport type { FormInstance, FormItemLayout } from 'antd/es/form/Form';\nimport type { FormItemInputProps } from 'antd/es/form/FormItemInput';\nimport type { FormItemLabelProps, LabelTooltipType } from 'antd/es/form/FormItemLabel';\nimport useChildren from 'antd/es/form/hooks/useChildren';\nimport useFormItemStatus from 'antd/es/form/hooks/useFormItemStatus';\nimport useFrameState from 'antd/es/form/hooks/useFrameState';\nimport useItemRef from 'antd/es/form/hooks/useItemRef';\nimport useStyle from 'antd/es/form/style';\nimport { getFieldId, toArray } from 'antd/es/form/util';\nimport StatusProvider from 'antd/es/form/FormItem/StatusProvider';\n\n// ============ BioTuring Custom Imports ============\nimport ItemHolder from './ItemHolder';\nimport type { ItemHolderProps } from './ItemHolder';\n\nconst NAME_SPLIT = '__SPLIT__';\n\ninterface FieldError {\n errors: string[];\n warnings: string[];\n}\n\nconst _ValidateStatuses = ['success', 'warning', 'error', 'validating', ''] as const;\nexport type ValidateStatus = (typeof _ValidateStatuses)[number];\n\ntype RenderChildren<Values = any> = (form: FormInstance<Values>) => React.ReactNode;\ntype RcFieldProps<Values = any> = Omit<FieldProps<Values>, 'children'>;\ntype ChildrenType<Values = any> = RenderChildren<Values> | React.ReactNode;\n\nexport type FeedbackIcons = (itemStatus: {\n status: ValidateStatus;\n errors?: React.ReactNode[];\n warnings?: React.ReactNode[];\n}) => { [key in ValidateStatus]?: React.ReactNode };\n\ninterface MemoInputProps {\n control: object;\n update: any;\n children: React.ReactNode;\n childProps: any[];\n}\n\n// https://github.com/ant-design/ant-design/issues/46417\n// `getValueProps` may modify the value props name,\n// we should check if the control is similar.\nfunction isSimilarControl(a: object, b: object) {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n\n return (\n keysA.length === keysB.length &&\n keysA.every((key) => {\n const propValueA = (a as any)[key];\n const propValueB = (b as any)[key];\n\n return (\n propValueA === propValueB ||\n typeof propValueA === 'function' ||\n typeof propValueB === 'function'\n );\n })\n );\n}\n\nconst MemoInput = React.memo(\n ({ children }: MemoInputProps) => children as JSX.Element,\n (prev, next) =>\n isSimilarControl(prev.control, next.control) &&\n prev.update === next.update &&\n prev.childProps.length === next.childProps.length &&\n prev.childProps.every((value, index) => value === next.childProps[index]),\n);\n\nexport interface FormItemProps<Values = any>\n extends Omit<FormItemLabelProps, 'requiredMark'>,\n FormItemInputProps,\n RcFieldProps<Values> {\n prefixCls?: string;\n noStyle?: boolean;\n style?: React.CSSProperties;\n className?: string;\n rootClassName?: string;\n children?: ChildrenType<Values>;\n id?: string;\n hasFeedback?: boolean | { icons: FeedbackIcons };\n validateStatus?: ValidateStatus;\n required?: boolean;\n hidden?: boolean;\n initialValue?: any;\n messageVariables?: Record<string, string>;\n tooltip?: LabelTooltipType;\n /** @deprecated No need anymore */\n fieldKey?: React.Key | React.Key[];\n layout?: FormItemLayout;\n \n // ============ BioTuring Custom Props ============\n /**\n * Custom class names for different parts of the form item\n * @custom BioTuring addition\n */\n classNames?: {\n /** Class name for the form item root wrapper */\n root?: string;\n /** Class name for the row container */\n row?: string;\n /** Class name for the label column wrapper */\n label?: string;\n /** Class name for the label text element */\n labelText?: string;\n /** Class name for the label tooltip icon */\n labelIcon?: string;\n /** Class name for the control/input wrapper column */\n control?: string;\n /** Class name for the control input wrapper */\n controlInput?: string;\n /** Class name for the control input content */\n controlInputContent?: string;\n /** Class name for the additional wrapper (errors + extra) */\n additional?: string;\n /** Class name for the error/help message wrapper */\n explain?: string;\n /** Class name for the extra text wrapper */\n extra?: string;\n /** Class name for the feedback icon */\n feedbackIcon?: string;\n };\n \n /**\n * Whether to show the optional mark\n * @default false\n * @custom BioTuring addition\n */\n optionalMark?: boolean | React.ReactNode;\n \n /**\n * Custom required mark (enhanced from antd to support ReactNode)\n * @default true\n * @custom BioTuring addition - enhanced to support ReactNode\n */\n requiredMark?: boolean | React.ReactNode;\n \n /**\n * Custom render function for the label\n * @custom BioTuring addition\n */\n labelRender?: (label: React.ReactElement) => React.ReactElement;\n // ============ End Custom Props ============\n}\n\nfunction genEmptyMeta(): Meta {\n return {\n errors: [],\n warnings: [],\n touched: false,\n validating: false,\n name: [],\n validated: false,\n };\n}\n\nfunction InternalFormItem<Values = any>(props: FormItemProps<Values>): React.ReactElement {\n const {\n name,\n noStyle,\n className,\n dependencies,\n prefixCls: customizePrefixCls,\n shouldUpdate,\n rules,\n children,\n required,\n label,\n messageVariables,\n trigger = 'onChange',\n validateTrigger,\n hidden,\n help,\n layout,\n // ============ BioTuring Custom: Extract custom props ============\n classNames: customClassNames,\n optionalMark,\n requiredMark,\n labelRender,\n // ============ End Custom ============\n } = props;\n const { getPrefixCls } = React.useContext(ConfigContext);\n const { name: formName } = React.useContext(FormContext);\n\n const mergedChildren = useChildren(children);\n\n const isRenderProps = typeof mergedChildren === 'function';\n const notifyParentMetaChange = React.useContext(NoStyleItemContext);\n\n const { validateTrigger: contextValidateTrigger } = React.useContext(FieldContext);\n const mergedValidateTrigger =\n validateTrigger !== undefined ? validateTrigger : contextValidateTrigger;\n\n const hasName = !(name === undefined || name === null);\n\n const prefixCls = getPrefixCls('form', customizePrefixCls);\n\n // Style\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n\n // ========================= Warn =========================\n const warning = devUseWarning('Form.Item');\n\n if (process.env.NODE_ENV !== 'production') {\n warning(name !== null, 'usage', '`null` is passed as `name` property');\n }\n\n // ========================= MISC =========================\n // Get `noStyle` required info\n const listContext = React.useContext(ListContext);\n const fieldKeyPathRef = React.useRef<InternalNamePath>(null);\n\n // ======================== Errors ========================\n // >>>>> Collect sub field errors\n const [subFieldErrors, setSubFieldErrors] = useFrameState<Record<string, FieldError>>({});\n\n // >>>>> Current field errors\n const [meta, setMeta] = useState<Meta>(() => genEmptyMeta());\n\n const onMetaChange = (nextMeta: Meta & { destroy?: boolean }) => {\n // This keyInfo is not correct when field is removed\n // Since origin keyManager no longer keep the origin key anymore\n // Which means we need cache origin one and reuse when removed\n const keyInfo = listContext?.getKey(nextMeta.name);\n\n // Destroy will reset all the meta\n setMeta(nextMeta.destroy ? genEmptyMeta() : nextMeta, true);\n\n // Bump to parent since noStyle\n if (noStyle && help !== false && notifyParentMetaChange) {\n let namePath = nextMeta.name;\n\n if (!nextMeta.destroy) {\n if (keyInfo !== undefined) {\n const [fieldKey, restPath] = keyInfo;\n namePath = [fieldKey, ...restPath];\n fieldKeyPathRef.current = namePath;\n }\n } else {\n // Use origin cache data\n namePath = fieldKeyPathRef.current || namePath;\n }\n notifyParentMetaChange(nextMeta, namePath);\n }\n };\n\n // >>>>> Collect noStyle Field error to the top FormItem\n const onSubItemMetaChange: ItemHolderProps['onSubItemMetaChange'] = (subMeta, uniqueKeys) => {\n // Only `noStyle` sub item will trigger\n setSubFieldErrors((prevSubFieldErrors) => {\n const clone = {\n ...prevSubFieldErrors,\n };\n\n // name: ['user', 1] + key: [4] = ['user', 4]\n const mergedNamePath = [...subMeta.name.slice(0, -1), ...uniqueKeys];\n const mergedNameKey = mergedNamePath.join(NAME_SPLIT);\n\n if ((subMeta as any).destroy) {\n // Remove\n delete clone[mergedNameKey];\n } else {\n // Update\n clone[mergedNameKey] = subMeta;\n }\n\n return clone;\n });\n };\n\n // >>>>> Get merged errors\n const [mergedErrors, mergedWarnings] = React.useMemo(() => {\n const errorList: string[] = [...meta.errors];\n const warningList: string[] = [...meta.warnings];\n\n Object.values(subFieldErrors).forEach((subFieldError) => {\n errorList.push(...(subFieldError.errors || []));\n warningList.push(...(subFieldError.warnings || []));\n });\n\n return [errorList, warningList];\n }, [subFieldErrors, meta.errors, meta.warnings]);\n\n // ===================== Children Ref =====================\n const getItemRef = useItemRef();\n\n // ======================== Render ========================\n function renderLayout(\n baseChildren: React.ReactNode,\n fieldId?: string,\n isRequired?: boolean,\n ): React.ReactNode {\n if (noStyle && !hidden) {\n return (\n <StatusProvider\n prefixCls={prefixCls}\n hasFeedback={props.hasFeedback}\n validateStatus={props.validateStatus}\n meta={meta}\n errors={mergedErrors}\n warnings={mergedWarnings}\n noStyle\n name={name}\n >\n {baseChildren}\n </StatusProvider>\n );\n }\n\n // ============ BioTuring Custom: Pass custom props to ItemHolder ============\n return (\n <ItemHolder\n key=\"row\"\n {...props}\n className={classNames(className, cssVarCls, rootCls, hashId)}\n prefixCls={prefixCls}\n fieldId={fieldId}\n isRequired={isRequired}\n errors={mergedErrors}\n warnings={mergedWarnings}\n meta={meta}\n onSubItemMetaChange={onSubItemMetaChange}\n layout={layout}\n name={name}\n classNames={customClassNames}\n optionalMark={optionalMark}\n requiredMark={requiredMark}\n labelRender={labelRender}\n >\n {baseChildren}\n </ItemHolder>\n );\n // ============ End Custom ============\n }\n\n if (!hasName && !isRenderProps && !dependencies) {\n return wrapCSSVar(renderLayout(mergedChildren) as JSX.Element);\n }\n\n let variables: Record<string, string> = {};\n if (typeof label === 'string') {\n variables.label = label;\n } else if (name) {\n variables.label = String(name);\n }\n if (messageVariables) {\n variables = { ...variables, ...messageVariables };\n }\n\n // >>>>> With Field\n return wrapCSSVar(\n <Field\n {...props}\n messageVariables={variables}\n trigger={trigger}\n validateTrigger={mergedValidateTrigger}\n onMetaChange={onMetaChange}\n >\n {(control, renderMeta, context) => {\n const mergedName = toArray(name).length && renderMeta ? renderMeta.name : [];\n const fieldId = getFieldId(mergedName, formName);\n\n const isRequired =\n required !== undefined\n ? required\n : !!rules?.some((rule) => {\n if (rule && typeof rule === 'object' && rule.required && !rule.warningOnly) {\n return true;\n }\n if (typeof rule === 'function') {\n const ruleEntity = rule(context);\n return ruleEntity?.required && !ruleEntity?.warningOnly;\n }\n return false;\n });\n\n // ======================= Children =======================\n const mergedControl: typeof control = {\n ...control,\n };\n\n let childNode: React.ReactNode = null;\n\n warning(\n !(shouldUpdate && dependencies),\n 'usage',\n \"`shouldUpdate` and `dependencies` shouldn't be used together. See https://u.ant.design/form-deps.\",\n );\n if (Array.isArray(mergedChildren) && hasName) {\n warning(\n false,\n 'usage',\n 'A `Form.Item` with a `name` prop must have a single child element. For information on how to render more complex form items, see https://u.ant.design/complex-form-item.',\n );\n childNode = mergedChildren;\n } else if (isRenderProps && (!(shouldUpdate || dependencies) || hasName)) {\n warning(\n !!(shouldUpdate || dependencies),\n 'usage',\n 'A `Form.Item` with a render function must have either `shouldUpdate` or `dependencies`.',\n );\n warning(\n !hasName,\n 'usage',\n 'A `Form.Item` with a render function cannot be a field, and thus cannot have a `name` prop.',\n );\n } else if (dependencies && !isRenderProps && !hasName) {\n warning(\n false,\n 'usage',\n 'Must set `name` or use a render function when `dependencies` is set.',\n );\n } else if (React.isValidElement<{ defaultValue?: any }>(mergedChildren)) {\n warning(\n mergedChildren.props.defaultValue === undefined,\n 'usage',\n '`defaultValue` will not work on controlled Field. You should use `initialValues` of Form instead.',\n );\n\n const childProps: React.ReactElement<any>['props'] = {\n ...mergedChildren.props,\n ...mergedControl,\n };\n\n if (!childProps.id) {\n childProps.id = fieldId;\n }\n\n if (help || mergedErrors.length > 0 || mergedWarnings.length > 0 || props.extra) {\n const describedbyArr = [];\n if (help || mergedErrors.length > 0) {\n describedbyArr.push(`${fieldId}_help`);\n }\n if (props.extra) {\n describedbyArr.push(`${fieldId}_extra`);\n }\n childProps['aria-describedby'] = describedbyArr.join(' ');\n }\n\n if (mergedErrors.length > 0) {\n childProps['aria-invalid'] = 'true';\n }\n\n if (isRequired) {\n childProps['aria-required'] = 'true';\n }\n\n if (supportRef(mergedChildren)) {\n childProps.ref = getItemRef(mergedName, mergedChildren);\n }\n\n // We should keep user origin event handler\n const triggers = new Set<string>([\n ...toArray(trigger),\n ...toArray(mergedValidateTrigger),\n ]);\n\n triggers.forEach((eventName) => {\n childProps[eventName] = (...args: any[]) => {\n mergedControl[eventName]?.(...args);\n (mergedChildren as React.ReactElement<any>).props[eventName]?.(...args);\n };\n });\n\n // List of props that need to be watched for changes -> if changes are detected in MemoInput -> rerender\n const watchingChildProps = [\n childProps['aria-required'],\n childProps['aria-invalid'],\n childProps['aria-describedby'],\n ];\n\n childNode = (\n <MemoInput\n control={mergedControl}\n update={mergedChildren}\n childProps={watchingChildProps}\n >\n {cloneElement(mergedChildren, childProps)}\n </MemoInput>\n );\n } else if (isRenderProps && (shouldUpdate || dependencies) && !hasName) {\n childNode = mergedChildren(context as any);\n } else {\n warning(\n !mergedName.length || !!noStyle,\n 'usage',\n '`name` is only used for validate React element. If you are using Form.Item as layout display, please remove `name` instead.',\n );\n childNode = mergedChildren as React.ReactNode;\n }\n\n return renderLayout(childNode, fieldId, isRequired);\n }}\n </Field>,\n );\n}\n\ntype InternalFormItemType = typeof InternalFormItem;\n\ntype CompoundedComponent = InternalFormItemType & {\n useStatus: typeof useFormItemStatus;\n};\n\nconst FormItem = InternalFormItem as CompoundedComponent;\nFormItem.useStatus = useFormItemStatus;\n\nexport default FormItem;\n"],"names":["NAME_SPLIT","isSimilarControl","a","b","keysA","keysB","key","propValueA","propValueB","MemoInput","React","children","prev","next","value","index","genEmptyMeta","InternalFormItem","props","name","noStyle","className","dependencies","customizePrefixCls","shouldUpdate","rules","required","label","messageVariables","trigger","validateTrigger","hidden","help","layout","customClassNames","optionalMark","requiredMark","labelRender","getPrefixCls","ConfigContext","formName","FormContext","mergedChildren","useChildren","isRenderProps","notifyParentMetaChange","NoStyleItemContext","contextValidateTrigger","FieldContext","mergedValidateTrigger","hasName","prefixCls","rootCls","useCSSVarCls","wrapCSSVar","hashId","cssVarCls","useStyle","warning","devUseWarning","listContext","ListContext","fieldKeyPathRef","subFieldErrors","setSubFieldErrors","useFrameState","meta","setMeta","useState","onMetaChange","nextMeta","keyInfo","namePath","fieldKey","restPath","onSubItemMetaChange","subMeta","uniqueKeys","prevSubFieldErrors","clone","mergedNameKey","mergedErrors","mergedWarnings","errorList","warningList","subFieldError","getItemRef","useItemRef","renderLayout","baseChildren","fieldId","isRequired","jsx","StatusProvider","ItemHolder","classNames","variables","Field","control","renderMeta","context","mergedName","toArray","getFieldId","rule","ruleEntity","mergedControl","childNode","childProps","describedbyArr","supportRef","eventName","args","watchingChildProps","cloneElement","FormItem","useFormItemStatus"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+CA,MAAMA,KAAa;AA8BnB,SAASC,GAAiBC,GAAWC,GAAW;AAC9C,QAAMC,IAAQ,OAAO,KAAKF,CAAC,GACrBG,IAAQ,OAAO,KAAKF,CAAC;AAE3B,SACEC,EAAM,WAAWC,EAAM,UACvBD,EAAM,MAAM,CAACE,MAAQ;AACnB,UAAMC,IAAcL,EAAUI,CAAG,GAC3BE,IAAcL,EAAUG,CAAG;AAEjC,WACEC,MAAeC,KACf,OAAOD,KAAe,cACtB,OAAOC,KAAe;AAAA,EAE1B,CAAC;AAEL;AAEA,MAAMC,KAAYC,EAAM;AAAA,EACtB,CAAC,EAAE,UAAAC,EAAA,MAA+BA;AAAA,EAClC,CAACC,GAAMC,MACLZ,GAAiBW,EAAK,SAASC,EAAK,OAAO,KAC3CD,EAAK,WAAWC,EAAK,UACrBD,EAAK,WAAW,WAAWC,EAAK,WAAW,UAC3CD,EAAK,WAAW,MAAM,CAACE,GAAOC,MAAUD,MAAUD,EAAK,WAAWE,CAAK,CAAC;AAC5E;AA8EA,SAASC,IAAqB;AAC5B,S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EzC1C;AAAA,YACE,CAAC2C,EAAW,UAAU,CAAC,CAACjF;AAAA,YACxB;AAAA,YACA;AAAA,UAAA,GAEFuF,IAAYjE;AAGd,iBAAO8C,EAAamB,GAAWjB,GAASC,CAAU;AAAA,QACpD;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAQA,MAAMwB,KAAWlG;AACjBkG,GAAS,YAAYC;"}
@@ -10,7 +10,13 @@ export declare const Form: (<Values = unknown>({ ...rest }: InternalFormProps<Va
10
10
  useForm: typeof useForm;
11
11
  useFormInstance: typeof useFormInstance;
12
12
  useWatch: typeof useWatch;
13
- Item: <Values = unknown>({ tooltip, label, optionalMark, requiredMark, labelRender, required, rules, children, ...rest }: FormItemProps<Values>) => import("react/jsx-runtime").JSX.Element;
13
+ Item: (<Values = any>(props: FormItemProps<Values>) => React.ReactElement) & {
14
+ useStatus: () => {
15
+ status?: import('antd/es/form/FormItem').ValidateStatus;
16
+ errors: React.ReactNode[];
17
+ warnings: React.ReactNode[];
18
+ };
19
+ };
14
20
  List: React.FC<import('antd/es/form').FormListProps>;
15
21
  ErrorList: React.FC<import('antd/es/form').ErrorListProps>;
16
22
  Provider: React.FC<import('antd/es/form/context').FormProviderProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/form/component.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,IAAI,aAAa,EAC1B,OAAO,IAAI,gBAAgB,EAC3B,OAAO,EACP,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAG3B,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAItD,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,SAAS,CAAC,MAAM,GAAG,OAAO,CAAE,SAAQ,aAAa,CAAC,MAAM,CAAC;CAAG;AAE7E,UAAU,iBAAiB,CAAC,MAAM,GAAG,OAAO,CAC1C,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;CAAG;AAQlE,eAAO,MAAM,IAAI,IANK,MAAM,yBAEzB,iBAAiB,CAAC,MAAM,CAAC;;;;;;;;;WAgB2iD,CAAC;;CAHtkD,CAAC;AAEH,YAAY,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/form/component.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,IAAI,aAAa,EAC1B,OAAO,IAAI,gBAAgB,EAC3B,OAAO,EACP,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAG3B,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAItD,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,SAAS,CAAC,MAAM,GAAG,OAAO,CAAE,SAAQ,aAAa,CAAC,MAAM,CAAC;CAAG;AAE7E,UAAU,iBAAiB,CAAC,MAAM,GAAG,OAAO,CAC1C,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;CAAG;AAQlE,eAAO,MAAM,IAAI,IANK,MAAM,yBAEzB,iBAAiB,CAAC,MAAM,CAAC;;;;;;kBApBxB,CAAC;;;;;;;;;WAoCiqD,CAAC;;CAHrqD,CAAC;AAEH,YAAY,EAAE,aAAa,EAAE,CAAC"}
@@ -5,20 +5,20 @@ import t, { useWatch as e, useForm as i } from "antd/es/form/Form";
5
5
  import s from "antd/es/form/FormList";
6
6
  import { FormProvider as n } from "antd/es/form/context";
7
7
  import p from "antd/es/form/hooks/useFormInstance";
8
- import { FormItem as F } from "./item.js";
9
- import { FormLabel as f } from "./label.js";
8
+ import { FormLabel as F } from "./label.js";
10
9
  import './style.css';/* empty css */
10
+ import f from "./FormItem/index.js";
11
11
  const a = ({
12
12
  ...r
13
13
  }) => /* @__PURE__ */ o(t, { ...r }), x = Object.assign(a, {
14
14
  useForm: i,
15
15
  useFormInstance: p,
16
16
  useWatch: e,
17
- Item: F,
17
+ Item: f,
18
18
  List: s,
19
19
  ErrorList: m,
20
20
  Provider: n,
21
- Label: f
21
+ Label: F
22
22
  });
23
23
  export {
24
24
  x as Form
@@ -1,24 +1,28 @@
1
- import { FormItemProps as AntdFormItemProps } from 'antd/es/form/FormItem';
2
- import { default as React } from 'react';
3
- export interface FormItemProps<Values = unknown> extends Omit<AntdFormItemProps<Values>, "children"> {
4
- /**
5
- * Whether show the optional mark. By default, optional item will not show the optional mark.
6
- * @default false
7
- */
8
- optionalMark?: boolean | React.ReactNode;
9
- /**
10
- * Whether show the asterisk when the field is required
11
- * @default true
12
- */
13
- requiredMark?: boolean | React.ReactNode;
14
- /**
15
- * Custom render function for the label
16
- */
17
- labelRender?: (label: React.ReactElement) => React.ReactElement;
18
- /**
19
- * Form item children - can be React nodes or render functions
20
- */
21
- children?: AntdFormItemProps<Values>["children"];
22
- }
23
- export declare const FormItem: <Values = unknown>({ tooltip, label, optionalMark, requiredMark, labelRender, required, rules, children, ...rest }: FormItemProps<Values>) => import("react/jsx-runtime").JSX.Element;
1
+ /**
2
+ * FormItem - Full Ant Design implementation with BioTuring customizations
3
+ *
4
+ * This component provides the complete Ant Design FormItem functionality with additional
5
+ * customization options including:
6
+ *
7
+ * Features:
8
+ * - Custom classNames prop for styling sub-elements (root, row, label, control, input, etc.)
9
+ * - optionalMark prop to show optional field indicator
10
+ * - Enhanced requiredMark prop (supports boolean | ReactNode)
11
+ * - labelRender prop for custom label rendering
12
+ * - Full Ant Design validation, error handling, and form field features
13
+ *
14
+ * Integration:
15
+ * - Uses custom FormLabel component (from ./label.tsx) for consistent styling
16
+ * - FormLabel can also be used standalone outside of Form.Item
17
+ * - Maintains 100% backward compatibility with existing code
18
+ *
19
+ * Implementation:
20
+ * - See ./FormItem/index.tsx for main FormItem logic
21
+ * - See ./FormItem/ItemHolder.tsx for layout wrapper
22
+ * - See ./FormItem/FormItemInput.tsx for input/control wrapper
23
+ * - See ./FormItem/FormItemLabel.tsx for label wrapper with FormLabel integration
24
+ *
25
+ * Last updated: 2025-02-04
26
+ */
27
+ export { default as FormItem, type FormItemProps } from './FormItem';
24
28
  //# sourceMappingURL=item.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/components/form/item.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,aAAa,IAAI,iBAAiB,EACxC,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,aAAa,CAAC,MAAM,GAAG,OAAO,CAC7C,SAAQ,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAEnD;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC;IACzC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC;IACzC;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC,YAAY,CAAC;IAChE;;OAEG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,QAAQ,GAAI,MAAM,GAAG,OAAO,EAAG,iGAUzC,aAAa,CAAC,MAAM,CAAC,4CA0BvB,CAAC"}
1
+ {"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/components/form/item.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/components/form/label.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAEZ,KAAK,WAAW,EAChB,KAAK,GAAG,EACR,qBAAqB,EAEtB,MAAM,OAAO,CAAC;AACf,OAAO,EAEL,mBAAmB,EAEnB,oBAAoB,EAErB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,OAAO,IACxD,mBAAmB,CAAC,CAAC,CAAC,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,mBAAmB,CAAC;IAChD;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC;IACzC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC;CAC1C,CAAC;AAEJ;;GAEG;AACH,QAAA,MAAM,aAAa,GAAI,CAAC,SAAS,WAAW,GAAG,OAAO,EACpD,gFASG,cAAc,CAAC,CAAC,CAAC,EACpB,KAAK,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,4CAqDlC,CAAC;AAGF,eAAO,MAAM,SAAS,EAAgC,CACpD,CAAC,SAAS,WAAW,GAAG,OAAO,EAE/B,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;CAAE,KACjE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/components/form/label.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAEZ,KAAK,WAAW,EAChB,KAAK,GAAG,EACR,qBAAqB,EAEtB,MAAM,OAAO,CAAC;AACf,OAAO,EAEL,mBAAmB,EAEnB,oBAAoB,EAErB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,OAAO,IACxD,mBAAmB,CAAC,CAAC,CAAC,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,mBAAmB,CAAC;IAChD;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC;IACzC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC;CAC1C,CAAC;AAEJ;;GAEG;AACH,QAAA,MAAM,aAAa,GAAI,CAAC,SAAS,WAAW,GAAG,OAAO,EACpD,gFASG,cAAc,CAAC,CAAC,CAAC,EACpB,KAAK,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,4CAuDlC,CAAC;AAGF,eAAO,MAAM,SAAS,EAAgC,CACpD,CAAC,SAAS,WAAW,GAAG,OAAO,EAE/B,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;CAAE,KACjE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -1,58 +1,60 @@
1
1
  "use client";
2
- import { jsx as o } from "react/jsx-runtime";
3
- import { forwardRef as b, isValidElement as d } from "react";
4
- import { QuestionIcon as h } from "@bioturing/assets";
5
- import { useCls as u } from "../utils/antdUtils.js";
6
- import { IconButton as y } from "../icon-button/component.js";
7
- import { cn as N } from "../utils/cn.js";
8
- import { WithRenderProp as x } from "../utils/WithRenderProp.js";
2
+ import { jsx as e } from "react/jsx-runtime";
3
+ import b, { forwardRef as d, isValidElement as h } from "react";
4
+ import { QuestionIcon as u } from "@bioturing/assets";
5
+ import { useCls as y } from "../utils/antdUtils.js";
6
+ import { IconButton as N } from "../icon-button/component.js";
7
+ import { cn as x } from "../utils/cn.js";
8
+ import { WithRenderProp as F } from "../utils/WithRenderProp.js";
9
9
  const I = ({
10
- label: n,
10
+ label: t,
11
11
  tooltip: m,
12
- optionalMark: l,
13
- requiredMark: e,
14
- className: t,
15
- as: i,
16
- render: a,
12
+ optionalMark: r,
13
+ requiredMark: o,
14
+ className: n,
15
+ as: a,
16
+ render: i,
17
17
  ...s
18
18
  }, c) => {
19
- const r = u(), f = [
20
- n,
21
- m && /* @__PURE__ */ o(
22
- y,
19
+ const l = y(), f = [
20
+ /* @__PURE__ */ e(b.Fragment, { children: t }, "label"),
21
+ m && /* @__PURE__ */ e(
22
+ N,
23
23
  {
24
- className: r("form-item-explaination-icon"),
25
- label: typeof m == "string" || d(m) ? m : void 0,
26
- children: /* @__PURE__ */ o(h, {})
24
+ className: l("form-item-explaination-icon"),
25
+ render: /* @__PURE__ */ e("span", {}),
26
+ label: typeof m == "string" || h(m) ? m : void 0,
27
+ title: "",
28
+ children: /* @__PURE__ */ e(u, {})
27
29
  },
28
30
  "tooltip"
29
31
  ),
30
- l && /* @__PURE__ */ o("span", { className: r("form-item-label-optional-mark"), children: typeof l == "boolean" ? "(optional)" : l }, "optional"),
31
- e && /* @__PURE__ */ o(
32
+ r && /* @__PURE__ */ e("span", { className: l("form-item-label-optional-mark"), children: typeof r == "boolean" ? "(optional)" : r }, "optional"),
33
+ o && /* @__PURE__ */ e(
32
34
  "span",
33
35
  {
34
- className: r(
36
+ className: l(
35
37
  "form-item-label-required-mark",
36
- typeof e == "boolean" ? "form-item-label-required-mark-asterisk" : ""
38
+ typeof o == "boolean" ? "form-item-label-required-mark-asterisk" : ""
37
39
  ),
38
- children: typeof e == "boolean" ? "*" : e
40
+ children: typeof o == "boolean" ? "*" : o
39
41
  },
40
42
  "required"
41
43
  )
42
44
  ], p = {
43
45
  ref: c,
44
- className: N(
45
- r(
46
+ className: x(
47
+ l(
46
48
  "form-item-label-inner",
47
- e && "form-item-label-with-required-mark"
49
+ o && "form-item-label-with-required-mark"
48
50
  ),
49
- t
51
+ n
50
52
  ),
51
53
  children: f,
52
54
  ...s
53
55
  };
54
- return /* @__PURE__ */ o(x, { as: i || "span", render: a, ...p });
55
- }, j = b(I);
56
+ return /* @__PURE__ */ e(F, { as: a || "span", render: i, ...p });
57
+ }, j = d(I);
56
58
  export {
57
59
  j as FormLabel
58
60
  };
@@ -1 +1 @@
1
- {"version":3,"file":"label.js","sources":["../../../src/components/form/label.tsx"],"sourcesContent":["\"use client\";\nimport React, {\n forwardRef,\n type ElementType,\n type Ref,\n ComponentPropsWithRef,\n isValidElement,\n} from \"react\";\nimport {\n useCls,\n WithRenderPropProps,\n WithRenderProp,\n ElementTypeToDOMType,\n cn,\n} from \"../utils\";\nimport { IconButton } from \"../icon-button\";\nimport { QuestionIcon } from \"@bioturing/assets\";\nimport { WrapperTooltipProps } from \"antd/es/form/FormItemLabel\";\n\nexport type FormLabelProps<E extends ElementType = \"label\"> =\n WithRenderPropProps<E> & {\n /**\n * Label content to display\n */\n label: React.ReactNode;\n /**\n * Optional tooltip to display next to the label\n */\n tooltip?: React.ReactNode | WrapperTooltipProps;\n /**\n * Whether to show optional mark or custom optional mark content\n * @default false\n */\n optionalMark?: boolean | React.ReactNode;\n /**\n * Whether to show required mark or custom required mark content\n * @default true\n */\n requiredMark?: boolean | React.ReactNode;\n };\n\n/**\n * Implementation of the FormLabel component\n */\nconst FormLabelImpl = <E extends ElementType = \"label\">(\n {\n label,\n tooltip,\n optionalMark,\n requiredMark,\n className,\n as,\n render,\n ...rest\n }: FormLabelProps<E>,\n ref: Ref<ElementTypeToDOMType<E>>\n) => {\n const cls = useCls();\n\n const labelContent = [\n label,\n tooltip && (\n <IconButton\n key=\"tooltip\"\n className={cls(\"form-item-explaination-icon\")}\n label={\n typeof tooltip === \"string\" || isValidElement(tooltip)\n ? tooltip\n : undefined\n }\n >\n <QuestionIcon />\n </IconButton>\n ),\n optionalMark && (\n <span key=\"optional\" className={cls(\"form-item-label-optional-mark\")}>\n {typeof optionalMark === \"boolean\" ? \"(optional)\" : optionalMark}\n </span>\n ),\n requiredMark && (\n <span\n key=\"required\"\n className={cls(\n \"form-item-label-required-mark\",\n typeof requiredMark === \"boolean\"\n ? \"form-item-label-required-mark-asterisk\"\n : \"\"\n )}\n >\n {typeof requiredMark === \"boolean\" ? \"*\" : requiredMark}\n </span>\n ),\n ];\n\n const elementProps = {\n ref,\n className: cn(\n cls(\n \"form-item-label-inner\",\n requiredMark && \"form-item-label-with-required-mark\"\n ),\n className\n ),\n children: labelContent,\n ...rest,\n };\n\n return <WithRenderProp as={as || \"span\"} render={render} {...elementProps} />;\n};\n\n// Export with correct typing\nexport const FormLabel = forwardRef(FormLabelImpl) as <\n E extends ElementType = \"label\"\n>(\n props: FormLabelProps<E> & { ref?: ComponentPropsWithRef<E>[\"ref\"] }\n) => ReturnType<typeof FormLabelImpl>;\n"],"names":["FormLabelImpl","label","tooltip","optionalMark","requiredMark","className","as","render","rest","ref","cls","useCls","labelContent","jsx","IconButton","isValidElement","QuestionIcon","elementProps","cn","WithRenderProp","FormLabel","forwardRef"],"mappings":";;;;;;;;AA4CA,MAAMA,IAAgB,CACpB;AAAA,EACE,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC;AAAA,EACA,QAAAC;AAAA,EACA,GAAGC;AACL,GACAC,MACG;AACH,QAAMC,IAAMC,EAAA,GAENC,IAAe;AAAA,IACnBX;AAAA,IACAC,KACE,gBAAAW;AAAA,MAACC;AAAA,MAAA;AAAA,QAEC,WAAWJ,EAAI,6BAA6B;AAAA,QAC5C,OACE,OAAOR,KAAY,YAAYa,EAAeb,CAAO,IACjDA,IACA;AAAA,QAGN,4BAACc,GAAA,CAAA,CAAa;AAAA,MAAA;AAAA,MARV;AAAA,IAAA;AAAA,IAWRb,KACE,gBAAAU,EAAC,QAAA,EAAoB,WAAWH,EAAI,+BAA+B,GAChE,UAAA,OAAOP,KAAiB,YAAY,eAAeA,EAAA,GAD5C,UAEV;AAAA,IAEFC,KACE,gBAAAS;AAAA,MAAC;AAAA,MAAA;AAAA,QAEC,WAAWH;AAAA,UACT;AAAA,UACA,OAAON,KAAiB,YACpB,2CACA;AAAA,QAAA;AAAA,QAGL,UAAA,OAAOA,KAAiB,YAAY,MAAMA;AAAA,MAAA;AAAA,MARvC;AAAA,IAAA;AAAA,EASN,GAIEa,IAAe;AAAA,IACnB,KAAAR;AAAA,IACA,WAAWS;AAAA,MACTR;AAAA,QACE;AAAA,QACAN,KAAgB;AAAA,MAAA;AAAA,MAElBC;AAAA,IAAA;AAAA,IAEF,UAAUO;AAAA,IACV,GAAGJ;AAAA,EAAA;AAGL,2BAAQW,GAAA,EAAe,IAAIb,KAAM,QAAQ,QAAAC,GAAiB,GAAGU,GAAc;AAC7E,GAGaG,IAAYC,EAAWrB,CAAa;"}
1
+ {"version":3,"file":"label.js","sources":["../../../src/components/form/label.tsx"],"sourcesContent":["\"use client\";\nimport React, {\n forwardRef,\n type ElementType,\n type Ref,\n ComponentPropsWithRef,\n isValidElement,\n} from \"react\";\nimport {\n useCls,\n WithRenderPropProps,\n WithRenderProp,\n ElementTypeToDOMType,\n cn,\n} from \"../utils\";\nimport { IconButton } from \"../icon-button\";\nimport { QuestionIcon } from \"@bioturing/assets\";\nimport { WrapperTooltipProps } from \"antd/es/form/FormItemLabel\";\n\nexport type FormLabelProps<E extends ElementType = \"label\"> =\n WithRenderPropProps<E> & {\n /**\n * Label content to display\n */\n label: React.ReactNode;\n /**\n * Optional tooltip to display next to the label\n */\n tooltip?: React.ReactNode | WrapperTooltipProps;\n /**\n * Whether to show optional mark or custom optional mark content\n * @default false\n */\n optionalMark?: boolean | React.ReactNode;\n /**\n * Whether to show required mark or custom required mark content\n * @default true\n */\n requiredMark?: boolean | React.ReactNode;\n };\n\n/**\n * Implementation of the FormLabel component\n */\nconst FormLabelImpl = <E extends ElementType = \"label\">(\n {\n label,\n tooltip,\n optionalMark,\n requiredMark,\n className,\n as,\n render,\n ...rest\n }: FormLabelProps<E>,\n ref: Ref<ElementTypeToDOMType<E>>,\n) => {\n const cls = useCls();\n\n const labelContent = [\n <React.Fragment key=\"label\">{label}</React.Fragment>,\n tooltip && (\n <IconButton\n key=\"tooltip\"\n className={cls(\"form-item-explaination-icon\")}\n render={<span />}\n label={\n typeof tooltip === \"string\" || isValidElement(tooltip)\n ? tooltip\n : undefined\n }\n title=\"\"\n >\n <QuestionIcon />\n </IconButton>\n ),\n optionalMark && (\n <span key=\"optional\" className={cls(\"form-item-label-optional-mark\")}>\n {typeof optionalMark === \"boolean\" ? \"(optional)\" : optionalMark}\n </span>\n ),\n requiredMark && (\n <span\n key=\"required\"\n className={cls(\n \"form-item-label-required-mark\",\n typeof requiredMark === \"boolean\"\n ? \"form-item-label-required-mark-asterisk\"\n : \"\",\n )}\n >\n {typeof requiredMark === \"boolean\" ? \"*\" : requiredMark}\n </span>\n ),\n ];\n\n const elementProps = {\n ref,\n className: cn(\n cls(\n \"form-item-label-inner\",\n requiredMark && \"form-item-label-with-required-mark\",\n ),\n className,\n ),\n children: labelContent,\n ...rest,\n };\n\n return <WithRenderProp as={as || \"span\"} render={render} {...elementProps} />;\n};\n\n// Export with correct typing\nexport const FormLabel = forwardRef(FormLabelImpl) as <\n E extends ElementType = \"label\",\n>(\n props: FormLabelProps<E> & { ref?: ComponentPropsWithRef<E>[\"ref\"] },\n) => ReturnType<typeof FormLabelImpl>;\n"],"names":["FormLabelImpl","label","tooltip","optionalMark","requiredMark","className","as","render","rest","ref","cls","useCls","labelContent","jsx","React","IconButton","isValidElement","QuestionIcon","elementProps","cn","WithRenderProp","FormLabel","forwardRef"],"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.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>label.ds-form-item-required:after{display:none}.ds-form-item-label>label.ds-form-item-required:before{display:none}.ds-form-item-label-required-mark{display:inline-block;font-size:var(--ds-font-size);font-family:Inter,sans-serif;line-height:1;content:"*"}.ds-form-item-label-required-mark.ds-form-item-label-required-mark-asterisk{color:var(--ds-form-label-required-mark-color)}.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)}.ds-form-item-explain{margin-top:.25rem}.ds-form-item-margin-offset{margin:0!important}.ds-form-item-label{overflow:visible}.ds-form-item-row .ds-form-item-label label{width:100%}}
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>label.ds-form-item-required:before{display:none}.ds-form-item-label-required-mark{display:inline-block;font-size:var(--ds-font-size);font-family:Inter,sans-serif;line-height:1;content:"*"}.ds-form-item-label-required-mark.ds-form-item-label-required-mark-asterisk{color:var(--ds-form-label-required-mark-color)}.ds-form-item-explain{margin-top:.25rem}.ds-form-item-margin-offset{margin:0!important}.ds-form-item-label{overflow:visible}.ds-form-item-row .ds-form-item-label label{width:100%}.ds-form-item .ds-form-item-label>label.ds-form-item-no-colon:after,.ds-form-item-vertical .ds-form-item-label>label:after{display:none}.ds-form-item-explaination-icon{cursor:help}}
@@ -1,6 +1,6 @@
1
1
  import { ToastManagerAddOptions } from '@base-ui/react';
2
2
  import { ToastData } from './types';
3
- export declare const toastManager: import('@base-ui/react').ToastManager;
3
+ export declare const toastManager: import('@base-ui/react').ToastManager<any>;
4
4
  export declare const toast: ((message: string, options?: Omit<ToastManagerAddOptions<ToastData>, "data" | "description">) => string) & {
5
5
  info: (message: string, options?: Omit<ToastManagerAddOptions<ToastData>, "data" | "description">) => string;
6
6
  success: (message: string, options?: Omit<ToastManagerAddOptions<ToastData>, "data" | "description">) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/components/toast/function.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,YAAY,uCAAiC,CAAC;AAoB3D,eAAO,MAAM,KAAK,aAhBL,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;oBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;uBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;qBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;uBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;wBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CAqB3E,CAAC"}
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/components/toast/function.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,YAAY,4CAAiC,CAAC;AAoB3D,eAAO,MAAM,KAAK,aAhBL,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;oBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;uBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;qBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;uBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;wBADhE,MAAM,YACL,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CAqB3E,CAAC"}
@@ -20,5 +20,5 @@ import { default as React } from 'react';
20
20
  * <button>Click me</button>
21
21
  * </Component>
22
22
  */
23
- export declare function createRenderProp<TProps extends object = object, TState = unknown>(children: ((props: TProps, state: TState) => React.ReactElement) | React.ReactElement, props: TProps, state?: TState): React.ReactElement;
23
+ export declare function createRenderProp<TProps extends object = object, TState = unknown, TElement = Element>(children: ((props: TProps, state: TState) => React.ReactElement) | React.ReactElement, props: TProps, state?: TState): React.ReactElement;
24
24
  //# sourceMappingURL=renderProp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderProp.d.ts","sourceRoot":"","sources":["../../../src/components/utils/renderProp.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,SAAS,MAAM,GAAG,MAAM,EAC9B,MAAM,GAAG,OAAO,EAEhB,QAAQ,EACJ,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,YAAY,CAAC,GACtD,KAAK,CAAC,YAAY,EACtB,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GACb,KAAK,CAAC,YAAY,CA0BpB"}
1
+ {"version":3,"file":"renderProp.d.ts","sourceRoot":"","sources":["../../../src/components/utils/renderProp.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,SAAS,MAAM,GAAG,MAAM,EAC9B,MAAM,GAAG,OAAO,EAChB,QAAQ,GAAG,OAAO,EAElB,QAAQ,EACJ,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,YAAY,CAAC,GACtD,KAAK,CAAC,YAAY,EACtB,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GACb,KAAK,CAAC,YAAY,CAgDpB"}
@@ -1,19 +1,25 @@
1
1
  "use client";
2
- import n from "react";
3
- import { clsx as r } from "./cn.js";
4
- function f(s, e, t) {
2
+ import i from "react";
3
+ import { clsx as N } from "./cn.js";
4
+ import d from "merge-refs";
5
+ function P(s, r, c) {
5
6
  if (typeof s == "function")
6
- return s(e, t);
7
+ return s(r, c);
7
8
  {
8
- const a = s, l = "className" in e ? e.className : void 0, o = r(l, a.props.className), { className: N, ...c } = e, { className: i, ...m } = a.props;
9
- return n.cloneElement(a, {
10
- ...c,
11
- ...m,
12
- className: o
9
+ const e = s, o = r, l = o.className, t = o.ref, m = N(l, e.props.className), a = e.ref, n = t && a ? d(a, t) : t || a, {
10
+ className: R,
11
+ ref: u,
12
+ ...p
13
+ } = o, { className: C, ...f } = e.props;
14
+ return i.cloneElement(e, {
15
+ ...p,
16
+ ...f,
17
+ className: m,
18
+ ref: n
13
19
  });
14
20
  }
15
21
  }
16
22
  export {
17
- f as createRenderProp
23
+ P as createRenderProp
18
24
  };
19
25
  //# sourceMappingURL=renderProp.js.map