@react-form-builder/components-rsuite 7.8.0 → 7.10.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/README.md +1 -0
- package/dist/InputCell-BDyUJFGm.js +21 -0
- package/dist/{InputCell-f4236002.js.map → InputCell-BDyUJFGm.js.map} +1 -1
- package/dist/{Labeled-751c2353.js → Labeled-BWYRwMiY.js} +1 -1
- package/dist/{Labeled-751c2353.js.map → Labeled-BWYRwMiY.js.map} +1 -1
- package/dist/WrappedInput-BRkBjl0z.js +11 -0
- package/dist/{WrappedInput-bc5a6d33.js.map → WrappedInput-BRkBjl0z.js.map} +1 -1
- package/dist/autocomplete.d.ts +2 -2
- package/dist/autocomplete.js +12 -15
- package/dist/autocomplete.js.map +1 -1
- package/dist/breadcrumb.d.ts +2 -2
- package/dist/breadcrumb.js +31 -31
- package/dist/breadcrumb.js.map +1 -1
- package/dist/builder-view-with-css.js +5 -61
- package/dist/builder-view-with-css.js.map +1 -1
- package/dist/button.d.ts +1 -1
- package/dist/button.js +7 -7
- package/dist/button.js.map +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +9 -12
- package/dist/calendar.js.map +1 -1
- package/dist/card.d.ts +1 -1
- package/dist/card.js +10 -10
- package/dist/card.js.map +1 -1
- package/dist/{categories-7064b279.js → categories-_98lyB3C.js} +3 -3
- package/dist/{categories-7064b279.js.map → categories-_98lyB3C.js.map} +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js +19 -23
- package/dist/checkbox.js.map +1 -1
- package/dist/{commonProperties-d849cd5b.js → commonProperties-ETOgvhCH.js} +7 -7
- package/dist/{commonProperties-d849cd5b.js.map → commonProperties-ETOgvhCH.js.map} +1 -1
- package/dist/components-descriptions.d.ts +2 -2
- package/dist/components-descriptions.js +1 -1
- package/dist/container.js +4 -4
- package/dist/container.js.map +1 -1
- package/dist/css/formengine-rsuite.css +13 -12
- package/dist/css-loader.js +3 -3
- package/dist/css-loader.js.map +1 -1
- package/dist/date-picker.d.ts +1 -1
- package/dist/date-picker.js +25 -29
- package/dist/date-picker.js.map +1 -1
- package/dist/dateTimeUtils-C2AEniv5.js +25 -0
- package/dist/{dateTimeUtils-b07ce438.js.map → dateTimeUtils-C2AEniv5.js.map} +1 -1
- package/dist/definitions.js +2 -55
- package/dist/definitions.js.map +1 -1
- package/dist/divider.js +6 -6
- package/dist/divider.js.map +1 -1
- package/dist/dropdown.d.ts +3 -3
- package/dist/dropdown.js +10 -11
- package/dist/dropdown.js.map +1 -1
- package/dist/error-message.d.ts +1 -1
- package/dist/error-message.js +2 -2
- package/dist/error-message.js.map +1 -1
- package/dist/formengine-rsuite.css-B1zD3_ue.js +5 -0
- package/dist/formengine-rsuite.css-B1zD3_ue.js.map +1 -0
- package/dist/header.d.ts +6 -6
- package/dist/header.js +2 -2
- package/dist/header.js.map +1 -1
- package/dist/hooks-DMVtrI-b.js +50 -0
- package/dist/hooks-DMVtrI-b.js.map +1 -0
- package/dist/image.d.ts +1 -1
- package/dist/image.js +8 -8
- package/dist/image.js.map +1 -1
- package/dist/index.d.ts +1526 -36
- package/dist/index.js +95 -116
- package/dist/index.js.map +1 -1
- package/dist/input.d.ts +1 -1
- package/dist/input.js +11 -13
- package/dist/input.js.map +1 -1
- package/dist/label.js +2 -2
- package/dist/label.js.map +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.js +7 -7
- package/dist/link.js.map +1 -1
- package/dist/localization-wrapper.d.ts +1 -1
- package/dist/localization-wrapper.js +67 -193
- package/dist/localization-wrapper.js.map +1 -1
- package/dist/menu.d.ts +2 -2
- package/dist/menu.js +20 -21
- package/dist/menu.js.map +1 -1
- package/dist/message.d.ts +2 -2
- package/dist/message.js +4 -4
- package/dist/modal-layout.d.ts +1 -1
- package/dist/modal-layout.js +2 -2
- package/dist/modal-layout.js.map +1 -1
- package/dist/modal.d.ts +1 -1
- package/dist/modal.js +13 -13
- package/dist/modal.js.map +1 -1
- package/dist/models.js +2 -56
- package/dist/models.js.map +1 -1
- package/dist/number-format.d.ts +2 -2
- package/dist/number-format.js +22 -25
- package/dist/number-format.js.map +1 -1
- package/dist/pattern-format.d.ts +2 -2
- package/dist/pattern-format.js +22 -25
- package/dist/pattern-format.js.map +1 -1
- package/dist/placeholder.js +3 -3
- package/dist/placeholder.js.map +1 -1
- package/dist/progress.js +6 -6
- package/dist/progress.js.map +1 -1
- package/dist/r-suite-components.d.ts +1 -1
- package/dist/r-suite-components.js +5 -22
- package/dist/r-suite-components.js.map +1 -1
- package/dist/rSuiteComponentsDescriptions-lX1mwx9_.js +67 -0
- package/dist/rSuiteComponentsDescriptions-lX1mwx9_.js.map +1 -0
- package/dist/radio-group.d.ts +1 -1
- package/dist/radio-group.js +10 -13
- package/dist/radio-group.js.map +1 -1
- package/dist/{rsuite-no-reset-rtl.min-af106e5c.js → rsuite-no-reset-rtl.min.css-B0vQWI16.js} +1 -1
- package/dist/rsuite-no-reset-rtl.min.css-B0vQWI16.js.map +1 -0
- package/dist/{rsuite-no-reset.min-3caeeea0.js → rsuite-no-reset.min.css-bW1P11UK.js} +1 -1
- package/dist/rsuite-no-reset.min.css-bW1P11UK.js.map +1 -0
- package/dist/search.d.ts +3 -3
- package/dist/search.js +33 -38
- package/dist/search.js.map +1 -1
- package/dist/static-content.js +4 -4
- package/dist/static-content.js.map +1 -1
- package/dist/stats.html +4 -0
- package/dist/tab.d.ts +2 -2
- package/dist/tab.js +29 -33
- package/dist/tab.js.map +1 -1
- package/dist/tag-picker.d.ts +1 -1
- package/dist/tag-picker.js +28 -31
- package/dist/tag-picker.js.map +1 -1
- package/dist/text-area.d.ts +1 -1
- package/dist/text-area.js +10 -13
- package/dist/text-area.js.map +1 -1
- package/dist/time-picker.d.ts +2 -2
- package/dist/time-picker.js +39 -41
- package/dist/time-picker.js.map +1 -1
- package/dist/toggle.d.ts +2 -2
- package/dist/toggle.js +17 -20
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.d.ts +2 -2
- package/dist/tooltip.js +6 -6
- package/dist/tooltip.js.map +1 -1
- package/dist/uploader.d.ts +1 -1
- package/dist/uploader.js +30 -33
- package/dist/uploader.js.map +1 -1
- package/dist/useTouchOnEvent-BPYbKiku.js +12 -0
- package/dist/{useTouchOnEvent-2be3c60d.js.map → useTouchOnEvent-BPYbKiku.js.map} +1 -1
- package/dist/view-with-css.js +5 -62
- package/dist/view-with-css.js.map +1 -1
- package/dist/view.js +3 -57
- package/dist/view.js.map +1 -1
- package/dist/wizard.d.ts +4 -6
- package/dist/wizard.js +145 -162
- package/dist/wizard.js.map +1 -1
- package/package.json +6 -3
- package/dist/InputCell-f4236002.js +0 -21
- package/dist/WrappedInput-bc5a6d33.js +0 -11
- package/dist/dateTimeUtils-b07ce438.js +0 -26
- package/dist/formengine-rsuite-cbc1d3ae.js +0 -5
- package/dist/formengine-rsuite-cbc1d3ae.js.map +0 -1
- package/dist/hooks-ff273a8a.js +0 -53
- package/dist/hooks-ff273a8a.js.map +0 -1
- package/dist/rSuiteComponentsDescriptions-d616cdc1.js +0 -17911
- package/dist/rSuiteComponentsDescriptions-d616cdc1.js.map +0 -1
- package/dist/rsuite-no-reset-rtl.min-af106e5c.js.map +0 -1
- package/dist/rsuite-no-reset.min-3caeeea0.js.map +0 -1
- package/dist/useTouchOnEvent-2be3c60d.js +0 -12
package/dist/tab.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { define as
|
|
1
|
+
import { jsxs as d, Fragment as p, jsx as n } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import b from "@emotion/styled";
|
|
3
|
+
import { define as v, node as f, boolean as y, array as h, toLabeledValues as g, useComponentData as K } from "@react-form-builder/core";
|
|
4
4
|
import { useCallback as C } from "react";
|
|
5
5
|
import { Nav as i } from "rsuite";
|
|
6
|
-
import { n as I } from "./commonProperties-
|
|
7
|
-
import {
|
|
8
|
-
const x =
|
|
6
|
+
import { n as I } from "./commonProperties-ETOgvhCH.js";
|
|
7
|
+
import { s as T } from "./categories-_98lyB3C.js";
|
|
8
|
+
const x = b(i)({
|
|
9
9
|
".builder & .rs-nav-item": {
|
|
10
10
|
zIndex: 7
|
|
11
11
|
},
|
|
@@ -15,45 +15,41 @@ const x = v(i)({
|
|
|
15
15
|
appearance: "none",
|
|
16
16
|
backgroundColor: "transparent"
|
|
17
17
|
}
|
|
18
|
-
}),
|
|
19
|
-
pane:
|
|
20
|
-
onSelect:
|
|
21
|
-
showNavigation:
|
|
22
|
-
items:
|
|
23
|
-
...
|
|
18
|
+
}), D = ({
|
|
19
|
+
pane: t,
|
|
20
|
+
onSelect: l,
|
|
21
|
+
showNavigation: c,
|
|
22
|
+
items: a,
|
|
23
|
+
...s
|
|
24
24
|
}) => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
if (!
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(o, t) => /* @__PURE__ */ l(
|
|
25
|
+
const r = K(), u = C((e, o) => {
|
|
26
|
+
r.userDefinedProps ??= {}, r.userDefinedProps.activeKey = e, l?.(e, o);
|
|
27
|
+
}, [r, l]);
|
|
28
|
+
if (!a?.length) return null;
|
|
29
|
+
const m = s.activeKey ?? a?.[0].value;
|
|
30
|
+
return /* @__PURE__ */ d(p, { children: [
|
|
31
|
+
c === !0 && /* @__PURE__ */ n(x, { onSelect: u, activeKey: m, ...s, children: a.map(
|
|
32
|
+
(e, o) => /* @__PURE__ */ n(
|
|
34
33
|
i.Item,
|
|
35
34
|
{
|
|
36
|
-
eventKey:
|
|
35
|
+
eventKey: e.value,
|
|
37
36
|
role: "tab",
|
|
38
37
|
as: "button",
|
|
39
38
|
type: "button",
|
|
40
|
-
children:
|
|
39
|
+
children: e.label
|
|
41
40
|
},
|
|
42
|
-
|
|
41
|
+
o
|
|
43
42
|
)
|
|
44
43
|
) }),
|
|
45
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ n("div", { children: t })
|
|
46
45
|
] });
|
|
47
|
-
},
|
|
46
|
+
}, z = v(D, "RsTab").name("Tab").category(T).props({
|
|
48
47
|
...I,
|
|
49
|
-
items:
|
|
50
|
-
showNavigation:
|
|
51
|
-
pane:
|
|
52
|
-
var e;
|
|
53
|
-
return `return parentProps.activeKey === '${((e = n.activeKey) == null ? void 0 : e.value) ?? n.activeKey}'`;
|
|
54
|
-
}).calculable(!1)
|
|
48
|
+
items: h.default(g(["Item1", "Item2", "Item3"])),
|
|
49
|
+
showNavigation: y.default(!0),
|
|
50
|
+
pane: f.withSlotConditionBuilder((t) => `return parentProps.activeKey === '${t.activeKey?.value ?? t.activeKey}'`).calculable(!1)
|
|
55
51
|
});
|
|
56
52
|
export {
|
|
57
|
-
|
|
53
|
+
z as rsTab
|
|
58
54
|
};
|
|
59
55
|
//# sourceMappingURL=tab.js.map
|
package/dist/tab.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.js","sources":["../src/components/RsTab.tsx"],"sourcesContent":["import styled from '@emotion/styled'\nimport {array, boolean, define, node, toLabeledValues, useComponentData} from '@react-form-builder/core'\nimport type {ReactNode, SyntheticEvent} from 'react'\nimport {useCallback} from 'react'\nimport type {NavProps} from 'rsuite'\nimport {Nav} from 'rsuite'\nimport {navProps} from '../commonProperties'\nimport {structureCategory} from './categories'\n\n/**\n * Tab item for RsTab component.\n */\nexport type RsTabItem = {\n /**\n * Label for the tab item.\n */\n label: string\n /**\n * Value for the tab item.\n */\n value: string\n}\n\n/**\n * Props for the RsTab component.\n */\nexport interface RsTabProps extends NavProps {\n /**\n * Items for the tab.\n */\n items?: RsTabItem[]\n /**\n * Whether to show navigation.\n */\n showNavigation?: boolean\n /**\n * Pane content for the tab.\n */\n pane: ReactNode\n}\n\nconst STabs = styled(Nav)({\n '.builder & .rs-nav-item': {\n zIndex: 7,\n },\n '.rs-nav-item': {\n border: 'none',\n outline: 'none',\n appearance: 'none',\n backgroundColor: 'transparent'\n }\n})\n\n/**\n * Tab component with navigation and pane support.\n * @param props the component props.\n * @param props.pane the pane content for the tab.\n * @param props.onSelect the callback when tab is selected.\n * @param props.showNavigation whether to show navigation.\n * @param props.items the items for the tab.\n * @param props.props the additional tab props.\n * @returns the React element.\n */\nconst RsTab = ({\n pane,\n onSelect,\n showNavigation,\n items,\n ...props\n }: RsTabProps) => {\n const componentData = useComponentData()\n\n const onNavSelect = useCallback((eventKey: string, event: SyntheticEvent) => {\n componentData.userDefinedProps ??= {}\n componentData.userDefinedProps.activeKey = eventKey\n onSelect?.(eventKey, event)\n }, [componentData, onSelect])\n\n if (!items?.length) return null\n\n const activeKey = props.activeKey ?? items?.[0].value\n\n return <>\n {showNavigation === true &&\n <STabs onSelect={onNavSelect} activeKey={activeKey} {...props}>\n {items.map((item, index) => <Nav.Item key={index}\n eventKey={item.value}\n role=\"tab\"\n as=\"button\"\n type=\"button\">\n {item.label}\n </Nav.Item>\n )}\n </STabs>\n }\n <div>{pane}</div>\n </>\n}\n\nexport const rsTab = define(RsTab, 'RsTab')\n .name('Tab')\n .category(structureCategory)\n .props({\n ...navProps,\n items: array.default(toLabeledValues(['Item1', 'Item2', 'Item3'])),\n showNavigation: boolean.default(true),\n pane: node\n .withSlotConditionBuilder(props => `return parentProps.activeKey === '${props.activeKey?.value ?? props.activeKey}'`)\n .calculable(false),\n })\n"],"names":["STabs","styled","Nav","RsTab","pane","onSelect","showNavigation","items","props","componentData","useComponentData","onNavSelect","useCallback","eventKey","event","activeKey","jsxs","Fragment","item","index","jsx","rsTab","define","structureCategory","navProps","array","toLabeledValues","boolean","node"
|
|
1
|
+
{"version":3,"file":"tab.js","sources":["../src/components/RsTab.tsx"],"sourcesContent":["import styled from '@emotion/styled'\nimport {array, boolean, define, node, toLabeledValues, useComponentData} from '@react-form-builder/core'\nimport type {ReactNode, SyntheticEvent} from 'react'\nimport {useCallback} from 'react'\nimport type {NavProps} from 'rsuite'\nimport {Nav} from 'rsuite'\nimport {navProps} from '../commonProperties'\nimport {structureCategory} from './categories'\n\n/**\n * Tab item for RsTab component.\n */\nexport type RsTabItem = {\n /**\n * Label for the tab item.\n */\n label: string\n /**\n * Value for the tab item.\n */\n value: string\n}\n\n/**\n * Props for the RsTab component.\n */\nexport interface RsTabProps extends NavProps {\n /**\n * Items for the tab.\n */\n items?: RsTabItem[]\n /**\n * Whether to show navigation.\n */\n showNavigation?: boolean\n /**\n * Pane content for the tab.\n */\n pane: ReactNode\n}\n\nconst STabs = styled(Nav)({\n '.builder & .rs-nav-item': {\n zIndex: 7,\n },\n '.rs-nav-item': {\n border: 'none',\n outline: 'none',\n appearance: 'none',\n backgroundColor: 'transparent'\n }\n})\n\n/**\n * Tab component with navigation and pane support.\n * @param props the component props.\n * @param props.pane the pane content for the tab.\n * @param props.onSelect the callback when tab is selected.\n * @param props.showNavigation whether to show navigation.\n * @param props.items the items for the tab.\n * @param props.props the additional tab props.\n * @returns the React element.\n */\nconst RsTab = ({\n pane,\n onSelect,\n showNavigation,\n items,\n ...props\n }: RsTabProps) => {\n const componentData = useComponentData()\n\n const onNavSelect = useCallback((eventKey: string, event: SyntheticEvent) => {\n componentData.userDefinedProps ??= {}\n componentData.userDefinedProps.activeKey = eventKey\n onSelect?.(eventKey, event)\n }, [componentData, onSelect])\n\n if (!items?.length) return null\n\n const activeKey = props.activeKey ?? items?.[0].value\n\n return <>\n {showNavigation === true &&\n <STabs onSelect={onNavSelect} activeKey={activeKey} {...props}>\n {items.map((item, index) => <Nav.Item key={index}\n eventKey={item.value}\n role=\"tab\"\n as=\"button\"\n type=\"button\">\n {item.label}\n </Nav.Item>\n )}\n </STabs>\n }\n <div>{pane}</div>\n </>\n}\n\nexport const rsTab = define(RsTab, 'RsTab')\n .name('Tab')\n .category(structureCategory)\n .props({\n ...navProps,\n items: array.default(toLabeledValues(['Item1', 'Item2', 'Item3'])),\n showNavigation: boolean.default(true),\n pane: node\n .withSlotConditionBuilder(props => `return parentProps.activeKey === '${props.activeKey?.value ?? props.activeKey}'`)\n .calculable(false),\n })\n"],"names":["STabs","styled","Nav","RsTab","pane","onSelect","showNavigation","items","props","componentData","useComponentData","onNavSelect","useCallback","eventKey","event","activeKey","jsxs","Fragment","item","index","jsx","rsTab","define","structureCategory","navProps","array","toLabeledValues","boolean","node"],"mappings":";;;;;;;AAyCA,MAAMA,IAAQC,EAAOC,CAAG,EAAE;AAAA,EACxB,2BAA2B;AAAA,IACzB,QAAQ;AAAA,EAAA;AAAA,EAEV,gBAAgB;AAAA,IACd,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,iBAAiB;AAAA,EAAA;AAErB,CAAC,GAYKC,IAAQ,CAAC;AAAA,EACE,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,MAAkB;AAC/B,QAAMC,IAAgBC,EAAA,GAEhBC,IAAcC,EAAY,CAACC,GAAkBC,MAA0B;AAC3E,IAAAL,EAAc,qBAAqB,CAAA,GACnCA,EAAc,iBAAiB,YAAYI,GAC3CR,IAAWQ,GAAUC,CAAK;AAAA,EAC5B,GAAG,CAACL,GAAeJ,CAAQ,CAAC;AAE5B,MAAI,CAACE,GAAO,OAAQ,QAAO;AAE3B,QAAMQ,IAAYP,EAAM,aAAaD,IAAQ,CAAC,EAAE;AAEhD,SAAO,gBAAAS,EAAAC,GAAA,EACJ,UAAA;AAAA,IAAAX,MAAmB,wBACjBN,GAAA,EAAM,UAAUW,GAAa,WAAAI,GAAuB,GAAGP,GACrD,UAAAD,EAAM;AAAA,MAAI,CAACW,GAAMC,MAAU,gBAAAC;AAAA,QAAClB,EAAI;AAAA,QAAJ;AAAA,UACS,UAAUgB,EAAK;AAAA,UACf,MAAK;AAAA,UACL,IAAG;AAAA,UACH,MAAK;AAAA,UACtC,UAAAA,EAAK;AAAA,QAAA;AAAA,QALiCC;AAAA,MAAA;AAAA,IAMzC,GAEJ;AAAA,IAEF,gBAAAC,EAAC,SAAK,UAAAhB,EAAA,CAAK;AAAA,EAAA,GACb;AACF,GAEaiB,IAAQC,EAAOnB,GAAO,OAAO,EACvC,KAAK,KAAK,EACV,SAASoB,CAAiB,EAC1B,MAAM;AAAA,EACL,GAAGC;AAAA,EACH,OAAOC,EAAM,QAAQC,EAAgB,CAAC,SAAS,SAAS,OAAO,CAAC,CAAC;AAAA,EACjE,gBAAgBC,EAAQ,QAAQ,EAAI;AAAA,EACpC,MAAMC,EACH,yBAAyB,CAAApB,MAAS,qCAAqCA,EAAM,WAAW,SAASA,EAAM,SAAS,GAAG,EACnH,WAAW,EAAK;AACrB,CAAC;"}
|
package/dist/tag-picker.d.ts
CHANGED
package/dist/tag-picker.js
CHANGED
|
@@ -1,42 +1,39 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { define as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { TagPicker as
|
|
5
|
-
import { b as
|
|
6
|
-
import { s as
|
|
7
|
-
import { f as
|
|
8
|
-
import { u as
|
|
9
|
-
import { L as
|
|
10
|
-
|
|
11
|
-
import "@emotion/styled";
|
|
12
|
-
const L = ({ value: e, label: r }) => ({
|
|
1
|
+
import { jsx as o } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { define as p, array as s, toLabeledValues as i } from "@react-form-builder/core";
|
|
3
|
+
import { useRef as d, useEffect as g, useMemo as P } from "react";
|
|
4
|
+
import { TagPicker as T } from "rsuite";
|
|
5
|
+
import { b as n } from "./commonProperties-ETOgvhCH.js";
|
|
6
|
+
import { s as b } from "./hooks-DMVtrI-b.js";
|
|
7
|
+
import { f as k } from "./categories-_98lyB3C.js";
|
|
8
|
+
import { u as h } from "./useTouchOnEvent-BPYbKiku.js";
|
|
9
|
+
import { L as v } from "./Labeled-BWYRwMiY.js";
|
|
10
|
+
const y = ({ value: e, label: r }) => ({
|
|
13
11
|
value: e ?? "",
|
|
14
12
|
label: r ?? ""
|
|
15
|
-
}),
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
h(d);
|
|
13
|
+
}), E = [], L = ({ data: e, label: r, value: c, className: l, ...t }) => {
|
|
14
|
+
const a = d(null), m = h(t, "onClean");
|
|
15
|
+
g(() => {
|
|
16
|
+
const f = a.current?.root?.querySelector(".rs-picker-search-input input");
|
|
17
|
+
b(f);
|
|
21
18
|
}, []);
|
|
22
|
-
const
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
|
|
19
|
+
const u = P(() => i(e ?? []).map(y), [e]);
|
|
20
|
+
return /* @__PURE__ */ o(v, { label: r, className: l, passAriaToChildren: !0, children: /* @__PURE__ */ o(
|
|
21
|
+
T,
|
|
25
22
|
{
|
|
26
|
-
value:
|
|
27
|
-
data:
|
|
28
|
-
onClean:
|
|
23
|
+
value: c ?? E,
|
|
24
|
+
data: u,
|
|
25
|
+
onClean: m,
|
|
29
26
|
...t,
|
|
30
|
-
ref:
|
|
27
|
+
ref: a
|
|
31
28
|
}
|
|
32
29
|
) });
|
|
33
|
-
}, { disableVirtualized:
|
|
34
|
-
...
|
|
35
|
-
value:
|
|
36
|
-
label:
|
|
37
|
-
data:
|
|
30
|
+
}, { disableVirtualized: q, onLoadData: z, ...x } = n, H = p(L, "RsTagPicker").name("TagPicker").category(k).props({
|
|
31
|
+
...x,
|
|
32
|
+
value: s.valued.ofString,
|
|
33
|
+
label: n.label.default("Select"),
|
|
34
|
+
data: s.default(i(["a", "b", "c"]))
|
|
38
35
|
});
|
|
39
36
|
export {
|
|
40
|
-
|
|
37
|
+
H as rsTagPicker
|
|
41
38
|
};
|
|
42
39
|
//# sourceMappingURL=tag-picker.js.map
|
package/dist/tag-picker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag-picker.js","sources":["../src/components/RsTagPicker.tsx"],"sourcesContent":["import type {LabeledValue} from '@react-form-builder/core'\nimport {array, define, toLabeledValues} from '@react-form-builder/core'\nimport {useEffect, useMemo, useRef} from 'react'\nimport type {PickerHandle, TagPickerProps} from 'rsuite'\nimport {TagPicker} from 'rsuite'\nimport {pickerProps} from '../commonProperties'\nimport {setAriaHiddenIfNotExists} from '../hooks'\nimport {fieldsCategory} from './categories'\nimport {useTouchOnEvent} from './hooks/useTouchOnEvent'\nimport {Labeled} from './internal/Labeled'\n\n/**\n * Props for the RsTagPicker component.\n */\nexport interface RsTagPickerProps extends TagPickerProps {\n /**\n * Label for the tag picker.\n */\n label: string\n /**\n * Called after the value has been changed.\n * @param value the value.\n */\n onChange?: (value: any) => void\n}\n\nconst fixEmptyItem = ({value, label}: LabeledValue) => ({\n value: value ?? '',\n label: label ?? ''\n})\n\nconst EMPTY_LIST = [] as const\n\n/**\n * Tag picker component with label support.\n * @param props the component props.\n * @param props.data the data for the tag picker.\n * @param props.label the label for the tag picker.\n * @param props.value the value of the tag picker.\n * @param props.className the CSS class name.\n * @param props.props the additional tag picker props.\n * @returns the React element.\n */\nconst RsTagPicker = ({data, label, value, className, ...props}: RsTagPickerProps) => {\n const inputRef = useRef<PickerHandle>(null)\n const onClean = useTouchOnEvent(props, 'onClean')\n\n useEffect(() => {\n const searchInput = inputRef.current?.root?.querySelector('.rs-picker-search-input input')\n setAriaHiddenIfNotExists(searchInput)\n }, [])\n\n const transformedData = useMemo(() => {\n return toLabeledValues((data ?? []) as Array<string | LabeledValue>).map(fixEmptyItem)\n }, [data])\n\n return (\n <Labeled label={label} className={className} passAriaToChildren={true}>\n <TagPicker\n value={value ?? EMPTY_LIST}\n data={transformedData}\n onClean={onClean}\n {...props}\n ref={inputRef}\n />\n </Labeled>\n )\n}\n\nconst {disableVirtualized, onLoadData, ...tagPickerProps} = pickerProps\n\nexport const rsTagPicker = define(RsTagPicker, 'RsTagPicker')\n .name('TagPicker')\n .category(fieldsCategory)\n .props({\n ...tagPickerProps,\n value: array.valued.ofString,\n label: pickerProps.label.default('Select'),\n data: array.default(toLabeledValues(['a', 'b', 'c']))\n })\n"],"names":["fixEmptyItem","value","label","EMPTY_LIST","RsTagPicker","data","className","props","inputRef","useRef","onClean","useTouchOnEvent","useEffect","searchInput","
|
|
1
|
+
{"version":3,"file":"tag-picker.js","sources":["../src/components/RsTagPicker.tsx"],"sourcesContent":["import type {LabeledValue} from '@react-form-builder/core'\nimport {array, define, toLabeledValues} from '@react-form-builder/core'\nimport {useEffect, useMemo, useRef} from 'react'\nimport type {PickerHandle, TagPickerProps} from 'rsuite'\nimport {TagPicker} from 'rsuite'\nimport {pickerProps} from '../commonProperties'\nimport {setAriaHiddenIfNotExists} from '../hooks'\nimport {fieldsCategory} from './categories'\nimport {useTouchOnEvent} from './hooks/useTouchOnEvent'\nimport {Labeled} from './internal/Labeled'\n\n/**\n * Props for the RsTagPicker component.\n */\nexport interface RsTagPickerProps extends TagPickerProps {\n /**\n * Label for the tag picker.\n */\n label: string\n /**\n * Called after the value has been changed.\n * @param value the value.\n */\n onChange?: (value: any) => void\n}\n\nconst fixEmptyItem = ({value, label}: LabeledValue) => ({\n value: value ?? '',\n label: label ?? ''\n})\n\nconst EMPTY_LIST = [] as const\n\n/**\n * Tag picker component with label support.\n * @param props the component props.\n * @param props.data the data for the tag picker.\n * @param props.label the label for the tag picker.\n * @param props.value the value of the tag picker.\n * @param props.className the CSS class name.\n * @param props.props the additional tag picker props.\n * @returns the React element.\n */\nconst RsTagPicker = ({data, label, value, className, ...props}: RsTagPickerProps) => {\n const inputRef = useRef<PickerHandle>(null)\n const onClean = useTouchOnEvent(props, 'onClean')\n\n useEffect(() => {\n const searchInput = inputRef.current?.root?.querySelector('.rs-picker-search-input input')\n setAriaHiddenIfNotExists(searchInput)\n }, [])\n\n const transformedData = useMemo(() => {\n return toLabeledValues((data ?? []) as Array<string | LabeledValue>).map(fixEmptyItem)\n }, [data])\n\n return (\n <Labeled label={label} className={className} passAriaToChildren={true}>\n <TagPicker\n value={value ?? EMPTY_LIST}\n data={transformedData}\n onClean={onClean}\n {...props}\n ref={inputRef}\n />\n </Labeled>\n )\n}\n\nconst {disableVirtualized, onLoadData, ...tagPickerProps} = pickerProps\n\nexport const rsTagPicker = define(RsTagPicker, 'RsTagPicker')\n .name('TagPicker')\n .category(fieldsCategory)\n .props({\n ...tagPickerProps,\n value: array.valued.ofString,\n label: pickerProps.label.default('Select'),\n data: array.default(toLabeledValues(['a', 'b', 'c']))\n })\n"],"names":["fixEmptyItem","value","label","EMPTY_LIST","RsTagPicker","data","className","props","inputRef","useRef","onClean","useTouchOnEvent","useEffect","searchInput","setAriaHiddenIfNotExists","transformedData","useMemo","toLabeledValues","jsx","Labeled","TagPicker","disableVirtualized","onLoadData","tagPickerProps","pickerProps","rsTagPicker","define","fieldsCategory","array"],"mappings":";;;;;;;;;AA0BA,MAAMA,IAAe,CAAC,EAAC,OAAAC,GAAO,OAAAC,SAA0B;AAAA,EACtD,OAAOD,KAAS;AAAA,EAChB,OAAOC,KAAS;AAClB,IAEMC,IAAa,CAAA,GAYbC,IAAc,CAAC,EAAC,MAAAC,GAAM,OAAAH,GAAO,OAAAD,GAAO,WAAAK,GAAW,GAAGC,QAA6B;AACnF,QAAMC,IAAWC,EAAqB,IAAI,GACpCC,IAAUC,EAAgBJ,GAAO,SAAS;AAEhD,EAAAK,EAAU,MAAM;AACd,UAAMC,IAAcL,EAAS,SAAS,MAAM,cAAc,+BAA+B;AACzF,IAAAM,EAAyBD,CAAW;AAAA,EACtC,GAAG,CAAA,CAAE;AAEL,QAAME,IAAkBC,EAAQ,MACvBC,EAAiBZ,KAAQ,CAAA,CAAmC,EAAE,IAAIL,CAAY,GACpF,CAACK,CAAI,CAAC;AAET,SACE,gBAAAa,EAACC,GAAA,EAAQ,OAAAjB,GAAc,WAAAI,GAAsB,oBAAoB,IAC/D,UAAA,gBAAAY;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,OAAOnB,KAASE;AAAA,MAChB,MAAMY;AAAA,MACN,SAAAL;AAAA,MACC,GAAGH;AAAA,MACJ,KAAKC;AAAA,IAAA;AAAA,EAAA,GAET;AAEJ,GAEM,EAAC,oBAAAa,GAAoB,YAAAC,GAAY,GAAGC,MAAkBC,GAE/CC,IAAcC,EAAOtB,GAAa,aAAa,EACzD,KAAK,WAAW,EAChB,SAASuB,CAAc,EACvB,MAAM;AAAA,EACL,GAAGJ;AAAA,EACH,OAAOK,EAAM,OAAO;AAAA,EACpB,OAAOJ,EAAY,MAAM,QAAQ,QAAQ;AAAA,EACzC,MAAMI,EAAM,QAAQX,EAAgB,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC;AACtD,CAAC;"}
|
package/dist/text-area.d.ts
CHANGED
package/dist/text-area.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { jsx as r } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { define as
|
|
3
|
-
import { Input as
|
|
4
|
-
import {
|
|
5
|
-
import { f as u } from "./categories-
|
|
6
|
-
import { L as x } from "./Labeled-
|
|
7
|
-
|
|
8
|
-
import "@emotion/styled";
|
|
9
|
-
import "react";
|
|
10
|
-
const T = ({ style: t, className: o, label: s, ...i }) => /* @__PURE__ */ r(x, { label: s, style: t, className: o, passAriaToChildren: !0, children: /* @__PURE__ */ r(m, { as: "textarea", ...i }) }), R = l(T, "RsTextArea").name("Text area").category(u).props({
|
|
2
|
+
import { define as d, event as a, disabled as i, string as e } from "@react-form-builder/core";
|
|
3
|
+
import { Input as f } from "rsuite";
|
|
4
|
+
import { r as m, s as n, d as p } from "./commonProperties-ETOgvhCH.js";
|
|
5
|
+
import { f as u } from "./categories-_98lyB3C.js";
|
|
6
|
+
import { L as x } from "./Labeled-BWYRwMiY.js";
|
|
7
|
+
const T = ({ style: t, className: s, label: o, ...l }) => /* @__PURE__ */ r(x, { label: o, style: t, className: s, passAriaToChildren: !0, children: /* @__PURE__ */ r(f, { as: "textarea", ...l }) }), y = d(T, "RsTextArea").name("Text area").category(u).props({
|
|
11
8
|
label: e.default("Text area"),
|
|
12
9
|
value: e.default("").valued,
|
|
13
10
|
placeholder: e,
|
|
14
11
|
rows: p.default(5),
|
|
15
|
-
size:
|
|
16
|
-
disabled:
|
|
17
|
-
readOnly:
|
|
12
|
+
size: n,
|
|
13
|
+
disabled: i.default(!1),
|
|
14
|
+
readOnly: m,
|
|
18
15
|
onChange: a,
|
|
19
16
|
onPressEnter: a
|
|
20
17
|
});
|
|
21
18
|
export {
|
|
22
|
-
|
|
19
|
+
y as rsTextArea
|
|
23
20
|
};
|
|
24
21
|
//# sourceMappingURL=text-area.js.map
|
package/dist/text-area.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-area.js","sources":["../src/components/RsTextArea.tsx"],"sourcesContent":["import {define, disabled, event, string} from '@react-form-builder/core'\nimport type {InputProps} from 'rsuite'\nimport {Input} from 'rsuite'\nimport {positiveNumber, readOnly, size} from '../commonProperties'\nimport {fieldsCategory} from './categories'\nimport {Labeled} from './internal/Labeled'\n\n/**\n * Props for the RsTextArea component.\n */\nexport interface RsTextAreaProps extends InputProps {\n /**\n * The label for the text area.\n */\n label: string\n /**\n * The number of visible text lines.\n */\n rows: number\n /**\n * The htmlSize attribute defines the width of the «input> element.\n */\n htmlSize?: number\n}\n\n/**\n * A text area component for multi-line text input.\n * @param props the component props.\n * @param props.style the CSS style for the component.\n * @param props.className the CSS class name for the component.\n * @param props.label the label for the text area.\n * @returns the React element.\n */\nconst RsTextArea = ({style, className, label, ...props}: RsTextAreaProps) => (\n <Labeled label={label} style={style} className={className} passAriaToChildren={true}>\n <Input as=\"textarea\" {...props}/>\n </Labeled>\n)\n\nexport const rsTextArea = define(RsTextArea, 'RsTextArea')\n .name('Text area')\n .category(fieldsCategory)\n .props({\n label: string.default('Text area'),\n value: string.default('').valued,\n placeholder: string,\n rows: positiveNumber.default(5),\n size,\n disabled: disabled.default(false),\n readOnly,\n onChange: event,\n onPressEnter: event\n })\n"],"names":["RsTextArea","style","className","label","props","jsx","Labeled","Input","rsTextArea","define","fieldsCategory","string","positiveNumber","size","disabled","readOnly","event"],"mappings":"
|
|
1
|
+
{"version":3,"file":"text-area.js","sources":["../src/components/RsTextArea.tsx"],"sourcesContent":["import {define, disabled, event, string} from '@react-form-builder/core'\nimport type {InputProps} from 'rsuite'\nimport {Input} from 'rsuite'\nimport {positiveNumber, readOnly, size} from '../commonProperties'\nimport {fieldsCategory} from './categories'\nimport {Labeled} from './internal/Labeled'\n\n/**\n * Props for the RsTextArea component.\n */\nexport interface RsTextAreaProps extends InputProps {\n /**\n * The label for the text area.\n */\n label: string\n /**\n * The number of visible text lines.\n */\n rows: number\n /**\n * The htmlSize attribute defines the width of the «input> element.\n */\n htmlSize?: number\n}\n\n/**\n * A text area component for multi-line text input.\n * @param props the component props.\n * @param props.style the CSS style for the component.\n * @param props.className the CSS class name for the component.\n * @param props.label the label for the text area.\n * @returns the React element.\n */\nconst RsTextArea = ({style, className, label, ...props}: RsTextAreaProps) => (\n <Labeled label={label} style={style} className={className} passAriaToChildren={true}>\n <Input as=\"textarea\" {...props}/>\n </Labeled>\n)\n\nexport const rsTextArea = define(RsTextArea, 'RsTextArea')\n .name('Text area')\n .category(fieldsCategory)\n .props({\n label: string.default('Text area'),\n value: string.default('').valued,\n placeholder: string,\n rows: positiveNumber.default(5),\n size,\n disabled: disabled.default(false),\n readOnly,\n onChange: event,\n onPressEnter: event\n })\n"],"names":["RsTextArea","style","className","label","props","jsx","Labeled","Input","rsTextArea","define","fieldsCategory","string","positiveNumber","size","disabled","readOnly","event"],"mappings":";;;;;;AAiCA,MAAMA,IAAa,CAAC,EAAC,OAAAC,GAAO,WAAAC,GAAW,OAAAC,GAAO,GAAGC,EAAA,MAC/C,gBAAAC,EAACC,GAAA,EAAQ,OAAAH,GAAc,OAAAF,GAAc,WAAAC,GAAsB,oBAAoB,IAC7E,UAAA,gBAAAG,EAACE,KAAM,IAAG,YAAY,GAAGH,EAAA,CAAM,EAAA,CACjC,GAGWI,IAAaC,EAAOT,GAAY,YAAY,EACtD,KAAK,WAAW,EAChB,SAASU,CAAc,EACvB,MAAM;AAAA,EACL,OAAOC,EAAO,QAAQ,WAAW;AAAA,EACjC,OAAOA,EAAO,QAAQ,EAAE,EAAE;AAAA,EAC1B,aAAaA;AAAA,EACb,MAAMC,EAAe,QAAQ,CAAC;AAAA,EAC9B,MAAAC;AAAA,EACA,UAAUC,EAAS,QAAQ,EAAK;AAAA,EAChC,UAAAC;AAAA,EACA,UAAUC;AAAA,EACV,cAAcA;AAChB,CAAC;"}
|
package/dist/time-picker.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DatePickerProps } from 'rsuite';
|
|
2
2
|
import { Definer } from '@react-form-builder/core';
|
|
3
|
-
import
|
|
3
|
+
import { SyntheticEvent } from 'react';
|
|
4
4
|
|
|
5
5
|
export declare const rsTimePicker: Definer<RsTimePickerProps>;
|
|
6
6
|
|
package/dist/time-picker.js
CHANGED
|
@@ -1,60 +1,58 @@
|
|
|
1
1
|
import { jsx as u } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { define as
|
|
3
|
-
import { format as
|
|
4
|
-
import { useMemo as a, useCallback as
|
|
5
|
-
import { DatePicker as
|
|
6
|
-
import {
|
|
7
|
-
import { f as
|
|
8
|
-
import { f as
|
|
9
|
-
import { u as
|
|
10
|
-
import { L as
|
|
11
|
-
|
|
12
|
-
import "@emotion/styled";
|
|
13
|
-
const z = (t) => t instanceof Date && !Number.isNaN(t.getTime()), b = (t, s) => {
|
|
2
|
+
import { define as P, event as e, boolean as m, disabled as V, string as l, time as T, isNull as v, timeFormat as o } from "@react-form-builder/core";
|
|
3
|
+
import { format as x, parse as y } from "date-fns";
|
|
4
|
+
import { useMemo as a, useCallback as F } from "react";
|
|
5
|
+
import { DatePicker as H } from "rsuite";
|
|
6
|
+
import { s as I, p as w, r as A } from "./commonProperties-ETOgvhCH.js";
|
|
7
|
+
import { f as L, t as M } from "./dateTimeUtils-C2AEniv5.js";
|
|
8
|
+
import { f as R } from "./categories-_98lyB3C.js";
|
|
9
|
+
import { u as S } from "./useTouchOnEvent-BPYbKiku.js";
|
|
10
|
+
import { L as _ } from "./Labeled-BWYRwMiY.js";
|
|
11
|
+
const j = (t) => t instanceof Date && !Number.isNaN(t.getTime()), g = (t, n) => {
|
|
14
12
|
if (typeof t == "string") {
|
|
15
|
-
const
|
|
16
|
-
return isNaN(
|
|
13
|
+
const r = y(t, n, /* @__PURE__ */ new Date());
|
|
14
|
+
return isNaN(r.getTime()) ? (console.error("Invalid time string:", t), null) : r;
|
|
17
15
|
}
|
|
18
16
|
return t;
|
|
19
|
-
},
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
|
|
17
|
+
}, z = ({ open: t, label: n, value: r, className: b, format: d, defaultValue: f, onChange: i, ...c }) => {
|
|
18
|
+
const h = a(() => M(d), [d]), E = S(c, "onClean"), k = a(() => g(r, o), [r]), C = a(() => g(f, o), [f]), D = a(() => t === !0 ? !0 : void 0, [t]), N = F((s, p) => {
|
|
19
|
+
if (v(s)) {
|
|
20
|
+
i?.(null, p);
|
|
23
21
|
return;
|
|
24
22
|
}
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
|
|
23
|
+
if (j(s)) {
|
|
24
|
+
const O = x(s, o);
|
|
25
|
+
i?.(O, p);
|
|
28
26
|
}
|
|
29
|
-
}, [
|
|
30
|
-
return /* @__PURE__ */ u(
|
|
31
|
-
|
|
27
|
+
}, [i]);
|
|
28
|
+
return /* @__PURE__ */ u(_, { label: n, className: b, passAriaToChildren: !0, children: /* @__PURE__ */ u(
|
|
29
|
+
H,
|
|
32
30
|
{
|
|
33
|
-
...
|
|
34
|
-
onChange:
|
|
35
|
-
value:
|
|
36
|
-
open:
|
|
37
|
-
format:
|
|
38
|
-
onClean:
|
|
31
|
+
...c,
|
|
32
|
+
onChange: N,
|
|
33
|
+
value: k ?? C ?? null,
|
|
34
|
+
open: D,
|
|
35
|
+
format: h ?? o,
|
|
36
|
+
onClean: E,
|
|
39
37
|
preventOverflow: !0
|
|
40
38
|
}
|
|
41
39
|
) });
|
|
42
|
-
},
|
|
43
|
-
label:
|
|
44
|
-
placeholder:
|
|
40
|
+
}, Z = P(z, "RsTimePicker").name("TimePicker").category(R).props({
|
|
41
|
+
label: l.default("Time"),
|
|
42
|
+
placeholder: l,
|
|
45
43
|
value: T.valued,
|
|
46
44
|
defaultValue: T,
|
|
47
|
-
format:
|
|
45
|
+
format: l.validated(L, {
|
|
48
46
|
code: "INVALID_TIME_FORMAT",
|
|
49
47
|
message: "The provided time format is invalid"
|
|
50
48
|
}).withEditorProps({ placeholder: "HH:mm" }).default("HH:mm"),
|
|
51
|
-
editable:
|
|
52
|
-
cleanable:
|
|
53
|
-
disabled:
|
|
49
|
+
editable: m.default(!0),
|
|
50
|
+
cleanable: m.default(!1),
|
|
51
|
+
disabled: V.default(!1),
|
|
54
52
|
readOnly: A,
|
|
55
|
-
open:
|
|
56
|
-
placement:
|
|
57
|
-
size:
|
|
53
|
+
open: m,
|
|
54
|
+
placement: w,
|
|
55
|
+
size: I,
|
|
58
56
|
onChange: e,
|
|
59
57
|
onClean: e,
|
|
60
58
|
onClose: e,
|
|
@@ -69,6 +67,6 @@ const z = (t) => t instanceof Date && !Number.isNaN(t.getTime()), b = (t, s) =>
|
|
|
69
67
|
onSelect: e
|
|
70
68
|
});
|
|
71
69
|
export {
|
|
72
|
-
|
|
70
|
+
Z as rsTimePicker
|
|
73
71
|
};
|
|
74
72
|
//# sourceMappingURL=time-picker.js.map
|
package/dist/time-picker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-picker.js","sources":["../src/components/RsTimePicker.tsx"],"sourcesContent":["import {boolean, define, disabled, event, isNull, string, time, timeFormat} from '@react-form-builder/core'\nimport {format as formatDate, parse} from 'date-fns'\nimport type {SyntheticEvent} from 'react'\nimport {useCallback, useMemo} from 'react'\nimport type {DatePickerProps} from 'rsuite'\nimport {DatePicker} from 'rsuite'\nimport {placement, readOnly, size} from '../commonProperties'\nimport {formatValidator, toSafeFormat} from '../dateTimeUtils'\nimport {fieldsCategory} from './categories'\nimport {useTouchOnEvent} from './hooks/useTouchOnEvent'\nimport {Labeled} from './internal/Labeled'\n\nconst isValidDate = (value: any) => value instanceof Date && !Number.isNaN(value.getTime())\n\n/**\n * Returns the time converted to Date format.\n * @param value the date value in string or Date format.\n * @param format the time format.\n * @returns the time converted to Date format.\n */\nconst parseTimeValue = (value: any, format: string) => {\n if (typeof value === 'string') {\n const parsedDate = parse(value, format, new Date())\n if (!isNaN(parsedDate.getTime())) {\n return parsedDate\n }\n console.error('Invalid time string:', value)\n return null\n }\n return value\n}\n\n/**\n * Props for the RsTimePicker component.\n */\nexport interface RsTimePickerProps extends Omit<DatePickerProps, 'value' | 'onChange'> {\n /**\n * Value of the time picker.\n */\n value?: string\n /**\n * Callback when value changes.\n */\n onChange?: (value: string | null, event: SyntheticEvent) => void\n /**\n * Label for the time picker.\n */\n label: string\n /**\n * @deprecated\n */\n inline?: boolean\n}\n\n/**\n * Time picker component with label support.\n * @param props the component props.\n * @param props.open whether the time picker is open.\n * @param props.label the label for the time picker.\n * @param props.value the value of the time picker.\n * @param props.className the CSS class name.\n * @param props.format the format of the time.\n * @param props.defaultValue the default value of the time picker.\n * @param props.onChange the callback when value changes.\n * @param props.props the additional time picker props.\n * @returns the React element.\n */\nconst RsTimePicker = ({open, label, value, className, format, defaultValue, onChange, ...props}: RsTimePickerProps) => {\n const safeFormat = useMemo(() => toSafeFormat(format), [format])\n const onClean = useTouchOnEvent(props, 'onClean')\n const parsedValue = useMemo(() => parseTimeValue(value, timeFormat), [value])\n const parsedDefaultValue = useMemo(() => parseTimeValue(defaultValue, timeFormat), [defaultValue])\n const pickerOpen = useMemo(() => open === true ? true : undefined, [open])\n\n const handleChange = useCallback((value: Date | null, e: SyntheticEvent) => {\n if (isNull(value)) {\n onChange?.(null, e)\n return\n }\n if (isValidDate(value)) {\n const formatted = formatDate(value, timeFormat)\n onChange?.(formatted, e)\n }\n }, [onChange])\n\n return (\n <Labeled label={label} className={className} passAriaToChildren={true}>\n <DatePicker {...props} onChange={handleChange} value={parsedValue ?? parsedDefaultValue ?? null}\n open={pickerOpen} format={safeFormat ?? timeFormat} onClean={onClean} preventOverflow/>\n </Labeled>\n )\n}\n\nexport const rsTimePicker = define(RsTimePicker, 'RsTimePicker')\n .name('TimePicker')\n .category(fieldsCategory)\n .props({\n label: string.default('Time'),\n placeholder: string,\n value: time.valued,\n defaultValue: time,\n format: string\n .validated(formatValidator, {\n code: 'INVALID_TIME_FORMAT',\n message: 'The provided time format is invalid'\n })\n .withEditorProps({placeholder: 'HH:mm'})\n .default('HH:mm'),\n editable: boolean.default(true),\n cleanable: boolean.default(false),\n disabled: disabled.default(false),\n readOnly,\n open: boolean,\n placement: placement,\n size: size,\n onChange: event,\n onClean: event,\n onClose: event,\n onEnter: event,\n onEntered: event,\n onEntering: event,\n onExit: event,\n onExited: event,\n onExiting: event,\n onOk: event,\n onOpen: event,\n onSelect: event\n })\n"],"names":["isValidDate","value","parseTimeValue","format","parsedDate","parse","RsTimePicker","open","label","className","defaultValue","onChange","props","safeFormat","useMemo","toSafeFormat","onClean","useTouchOnEvent","parsedValue","timeFormat","parsedDefaultValue","pickerOpen","handleChange","useCallback","e","isNull","formatted","formatDate","jsx","Labeled","DatePicker","rsTimePicker","define","fieldsCategory","string","time","formatValidator","boolean","disabled","readOnly","placement","size","event"],"mappings":"
|
|
1
|
+
{"version":3,"file":"time-picker.js","sources":["../src/components/RsTimePicker.tsx"],"sourcesContent":["import {boolean, define, disabled, event, isNull, string, time, timeFormat} from '@react-form-builder/core'\nimport {format as formatDate, parse} from 'date-fns'\nimport type {SyntheticEvent} from 'react'\nimport {useCallback, useMemo} from 'react'\nimport type {DatePickerProps} from 'rsuite'\nimport {DatePicker} from 'rsuite'\nimport {placement, readOnly, size} from '../commonProperties'\nimport {formatValidator, toSafeFormat} from '../dateTimeUtils'\nimport {fieldsCategory} from './categories'\nimport {useTouchOnEvent} from './hooks/useTouchOnEvent'\nimport {Labeled} from './internal/Labeled'\n\nconst isValidDate = (value: any) => value instanceof Date && !Number.isNaN(value.getTime())\n\n/**\n * Returns the time converted to Date format.\n * @param value the date value in string or Date format.\n * @param format the time format.\n * @returns the time converted to Date format.\n */\nconst parseTimeValue = (value: any, format: string) => {\n if (typeof value === 'string') {\n const parsedDate = parse(value, format, new Date())\n if (!isNaN(parsedDate.getTime())) {\n return parsedDate\n }\n console.error('Invalid time string:', value)\n return null\n }\n return value\n}\n\n/**\n * Props for the RsTimePicker component.\n */\nexport interface RsTimePickerProps extends Omit<DatePickerProps, 'value' | 'onChange'> {\n /**\n * Value of the time picker.\n */\n value?: string\n /**\n * Callback when value changes.\n */\n onChange?: (value: string | null, event: SyntheticEvent) => void\n /**\n * Label for the time picker.\n */\n label: string\n /**\n * @deprecated\n */\n inline?: boolean\n}\n\n/**\n * Time picker component with label support.\n * @param props the component props.\n * @param props.open whether the time picker is open.\n * @param props.label the label for the time picker.\n * @param props.value the value of the time picker.\n * @param props.className the CSS class name.\n * @param props.format the format of the time.\n * @param props.defaultValue the default value of the time picker.\n * @param props.onChange the callback when value changes.\n * @param props.props the additional time picker props.\n * @returns the React element.\n */\nconst RsTimePicker = ({open, label, value, className, format, defaultValue, onChange, ...props}: RsTimePickerProps) => {\n const safeFormat = useMemo(() => toSafeFormat(format), [format])\n const onClean = useTouchOnEvent(props, 'onClean')\n const parsedValue = useMemo(() => parseTimeValue(value, timeFormat), [value])\n const parsedDefaultValue = useMemo(() => parseTimeValue(defaultValue, timeFormat), [defaultValue])\n const pickerOpen = useMemo(() => open === true ? true : undefined, [open])\n\n const handleChange = useCallback((value: Date | null, e: SyntheticEvent) => {\n if (isNull(value)) {\n onChange?.(null, e)\n return\n }\n if (isValidDate(value)) {\n const formatted = formatDate(value, timeFormat)\n onChange?.(formatted, e)\n }\n }, [onChange])\n\n return (\n <Labeled label={label} className={className} passAriaToChildren={true}>\n <DatePicker {...props} onChange={handleChange} value={parsedValue ?? parsedDefaultValue ?? null}\n open={pickerOpen} format={safeFormat ?? timeFormat} onClean={onClean} preventOverflow/>\n </Labeled>\n )\n}\n\nexport const rsTimePicker = define(RsTimePicker, 'RsTimePicker')\n .name('TimePicker')\n .category(fieldsCategory)\n .props({\n label: string.default('Time'),\n placeholder: string,\n value: time.valued,\n defaultValue: time,\n format: string\n .validated(formatValidator, {\n code: 'INVALID_TIME_FORMAT',\n message: 'The provided time format is invalid'\n })\n .withEditorProps({placeholder: 'HH:mm'})\n .default('HH:mm'),\n editable: boolean.default(true),\n cleanable: boolean.default(false),\n disabled: disabled.default(false),\n readOnly,\n open: boolean,\n placement: placement,\n size: size,\n onChange: event,\n onClean: event,\n onClose: event,\n onEnter: event,\n onEntered: event,\n onEntering: event,\n onExit: event,\n onExited: event,\n onExiting: event,\n onOk: event,\n onOpen: event,\n onSelect: event\n })\n"],"names":["isValidDate","value","parseTimeValue","format","parsedDate","parse","RsTimePicker","open","label","className","defaultValue","onChange","props","safeFormat","useMemo","toSafeFormat","onClean","useTouchOnEvent","parsedValue","timeFormat","parsedDefaultValue","pickerOpen","handleChange","useCallback","e","isNull","formatted","formatDate","jsx","Labeled","DatePicker","rsTimePicker","define","fieldsCategory","string","time","formatValidator","boolean","disabled","readOnly","placement","size","event"],"mappings":";;;;;;;;;;AAYA,MAAMA,IAAc,CAACC,MAAeA,aAAiB,QAAQ,CAAC,OAAO,MAAMA,EAAM,SAAS,GAQpFC,IAAiB,CAACD,GAAYE,MAAmB;AACrD,MAAI,OAAOF,KAAU,UAAU;AAC7B,UAAMG,IAAaC,EAAMJ,GAAOE,GAAQ,oBAAI,MAAM;AAClD,WAAK,MAAMC,EAAW,QAAA,CAAS,KAG/B,QAAQ,MAAM,wBAAwBH,CAAK,GACpC,QAHEG;AAAA,EAIX;AACA,SAAOH;AACT,GAqCMK,IAAe,CAAC,EAAC,MAAAC,GAAM,OAAAC,GAAO,OAAAP,GAAO,WAAAQ,GAAA,QAAWN,GAAQ,cAAAO,GAAc,UAAAC,GAAU,GAAGC,EAAA,MAA8B;AACrH,QAAMC,IAAaC,EAAQ,MAAMC,EAAaZ,CAAM,GAAG,CAACA,CAAM,CAAC,GACzDa,IAAUC,EAAgBL,GAAO,SAAS,GAC1CM,IAAcJ,EAAQ,MAAMZ,EAAeD,GAAOkB,CAAU,GAAG,CAAClB,CAAK,CAAC,GACtEmB,IAAqBN,EAAQ,MAAMZ,EAAeQ,GAAcS,CAAU,GAAG,CAACT,CAAY,CAAC,GAC3FW,IAAaP,EAAQ,MAAMP,MAAS,KAAO,KAAO,QAAW,CAACA,CAAI,CAAC,GAEnEe,IAAeC,EAAY,CAACtB,GAAoBuB,MAAsB;AAC1E,QAAIC,EAAOxB,CAAK,GAAG;AACjB,MAAAU,IAAW,MAAMa,CAAC;AAClB;AAAA,IACF;AACA,QAAIxB,EAAYC,CAAK,GAAG;AACtB,YAAMyB,IAAYC,EAAW1B,GAAOkB,CAAU;AAC9C,MAAAR,IAAWe,GAAWF,CAAC;AAAA,IACzB;AAAA,EACF,GAAG,CAACb,CAAQ,CAAC;AAEb,SACE,gBAAAiB,EAACC,GAAA,EAAQ,OAAArB,GAAc,WAAAC,GAAsB,oBAAoB,IAC/D,UAAA,gBAAAmB;AAAA,IAACE;AAAA,IAAA;AAAA,MAAY,GAAGlB;AAAA,MAAO,UAAUU;AAAA,MAAc,OAAOJ,KAAeE,KAAsB;AAAA,MAC/E,MAAMC;AAAA,MAAY,QAAQR,KAAcM;AAAA,MAAY,SAAAH;AAAA,MAAkB,iBAAe;AAAA,IAAA;AAAA,EAAA,GACnG;AAEJ,GAEae,IAAeC,EAAO1B,GAAc,cAAc,EAC5D,KAAK,YAAY,EACjB,SAAS2B,CAAc,EACvB,MAAM;AAAA,EACL,OAAOC,EAAO,QAAQ,MAAM;AAAA,EAC5B,aAAaA;AAAA,EACb,OAAOC,EAAK;AAAA,EACZ,cAAcA;AAAA,EACd,QAAQD,EACL,UAAUE,GAAiB;AAAA,IAC1B,MAAM;AAAA,IACN,SAAS;AAAA,EAAA,CACV,EACA,gBAAgB,EAAC,aAAa,QAAA,CAAQ,EACtC,QAAQ,OAAO;AAAA,EAClB,UAAUC,EAAQ,QAAQ,EAAI;AAAA,EAC9B,WAAWA,EAAQ,QAAQ,EAAK;AAAA,EAChC,UAAUC,EAAS,QAAQ,EAAK;AAAA,EAChC,UAAAC;AAAA,EACA,MAAMF;AAAA,EACN,WAAAG;AAAA,EACA,MAAAC;AAAA,EACA,UAAUC;AAAA,EACV,SAASA;AAAA,EACT,SAASA;AAAA,EACT,SAASA;AAAA,EACT,WAAWA;AAAA,EACX,YAAYA;AAAA,EACZ,QAAQA;AAAA,EACR,UAAUA;AAAA,EACV,WAAWA;AAAA,EACX,MAAMA;AAAA,EACN,QAAQA;AAAA,EACR,UAAUA;AACZ,CAAC;"}
|
package/dist/toggle.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ import { ToggleProps } from 'rsuite';
|
|
|
8
8
|
import { WithAsProps } from 'rsuite/esm/internals/types';
|
|
9
9
|
|
|
10
10
|
export declare const rsToggle: Definer<Omit_2<any, WithAsProps<ElementType<any, keyof JSX.IntrinsicElements>> & ToggleProps> & WithAsProps<ElementType<any, keyof JSX.IntrinsicElements>> & ToggleProps & {
|
|
11
|
-
|
|
11
|
+
children?: ReactNode | undefined;
|
|
12
12
|
} & {
|
|
13
|
-
|
|
13
|
+
theme?: Theme;
|
|
14
14
|
}>;
|
|
15
15
|
|
|
16
16
|
export { }
|
package/dist/toggle.js
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { define as
|
|
3
|
-
import { Toggle as
|
|
4
|
-
import {
|
|
5
|
-
import { f } from "./categories-
|
|
6
|
-
import { r as
|
|
7
|
-
|
|
8
|
-
import "@emotion/react";
|
|
9
|
-
import "react";
|
|
10
|
-
const n = r(i)`
|
|
1
|
+
import o from "@emotion/styled";
|
|
2
|
+
import { define as r, event as a, boolean as l, oneOf as d, disabled as t, string as e } from "@react-form-builder/core";
|
|
3
|
+
import { Toggle as s } from "rsuite";
|
|
4
|
+
import { c as i, r as f } from "./commonProperties-ETOgvhCH.js";
|
|
5
|
+
import { f as g } from "./categories-_98lyB3C.js";
|
|
6
|
+
import { r as n } from "./Labeled-BWYRwMiY.js";
|
|
7
|
+
const m = o(s)`
|
|
11
8
|
&.required .rs-toggle-label::after {
|
|
12
|
-
${
|
|
9
|
+
${n};
|
|
13
10
|
}
|
|
14
|
-
`,
|
|
11
|
+
`, y = r(m, "RsToggle").name("Toggle").category(g).props({
|
|
15
12
|
children: e,
|
|
16
|
-
checked:
|
|
13
|
+
checked: l.valued.default(!0).uncontrolledValue(!1),
|
|
17
14
|
checkedChildren: e,
|
|
18
15
|
unCheckedChildren: e,
|
|
19
|
-
disabled:
|
|
20
|
-
readOnly:
|
|
21
|
-
size:
|
|
22
|
-
color:
|
|
23
|
-
loading:
|
|
24
|
-
onChange:
|
|
16
|
+
disabled: t.default(!1),
|
|
17
|
+
readOnly: f,
|
|
18
|
+
size: d("sm", "md", "lg").labeled("Small", "Medium", "Large").default("md").withEditorProps({ creatable: !1 }),
|
|
19
|
+
color: i,
|
|
20
|
+
loading: l.default(!1),
|
|
21
|
+
onChange: a
|
|
25
22
|
});
|
|
26
23
|
export {
|
|
27
|
-
|
|
24
|
+
y as rsToggle
|
|
28
25
|
};
|
|
29
26
|
//# sourceMappingURL=toggle.js.map
|
package/dist/toggle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.js","sources":["../src/components/RsToggle.tsx"],"sourcesContent":["import styled from '@emotion/styled'\nimport {boolean, define, disabled, event, oneOf, string} from '@react-form-builder/core'\nimport {Toggle} from 'rsuite'\nimport {controlColor, readOnly} from '../commonProperties'\nimport {fieldsCategory} from './categories'\nimport {requiredStyle} from './internal/Labeled'\n\nconst SToggle = styled(Toggle)`\n &.required .rs-toggle-label::after {\n ${requiredStyle};\n }\n`\n\nexport const rsToggle = define(SToggle, 'RsToggle')\n .name('Toggle')\n .category(fieldsCategory)\n .props({\n children: string,\n checked: boolean.valued.default(true).uncontrolledValue(false),\n checkedChildren: string,\n unCheckedChildren: string,\n disabled: disabled.default(false),\n readOnly,\n size: oneOf('sm', 'md', 'lg')\n .labeled('Small', 'Medium', 'Large')\n .default('md')\n .withEditorProps({creatable: false}),\n color: controlColor,\n loading: boolean.default(false),\n onChange: event,\n })\n"],"names":["SToggle","styled","Toggle","requiredStyle","rsToggle","define","fieldsCategory","string","boolean","disabled","readOnly","oneOf","controlColor","event"],"mappings":"
|
|
1
|
+
{"version":3,"file":"toggle.js","sources":["../src/components/RsToggle.tsx"],"sourcesContent":["import styled from '@emotion/styled'\nimport {boolean, define, disabled, event, oneOf, string} from '@react-form-builder/core'\nimport {Toggle} from 'rsuite'\nimport {controlColor, readOnly} from '../commonProperties'\nimport {fieldsCategory} from './categories'\nimport {requiredStyle} from './internal/Labeled'\n\nconst SToggle = styled(Toggle)`\n &.required .rs-toggle-label::after {\n ${requiredStyle};\n }\n`\n\nexport const rsToggle = define(SToggle, 'RsToggle')\n .name('Toggle')\n .category(fieldsCategory)\n .props({\n children: string,\n checked: boolean.valued.default(true).uncontrolledValue(false),\n checkedChildren: string,\n unCheckedChildren: string,\n disabled: disabled.default(false),\n readOnly,\n size: oneOf('sm', 'md', 'lg')\n .labeled('Small', 'Medium', 'Large')\n .default('md')\n .withEditorProps({creatable: false}),\n color: controlColor,\n loading: boolean.default(false),\n onChange: event,\n })\n"],"names":["SToggle","styled","Toggle","requiredStyle","rsToggle","define","fieldsCategory","string","boolean","disabled","readOnly","oneOf","controlColor","event"],"mappings":";;;;;;AAOA,MAAMA,IAAUC,EAAOC,CAAM;AAAA;AAAA,MAEvBC,CAAa;AAAA;AAAA,GAINC,IAAWC,EAAOL,GAAS,UAAU,EAC/C,KAAK,QAAQ,EACb,SAASM,CAAc,EACvB,MAAM;AAAA,EACL,UAAUC;AAAA,EACV,SAASC,EAAQ,OAAO,QAAQ,EAAI,EAAE,kBAAkB,EAAK;AAAA,EAC7D,iBAAiBD;AAAA,EACjB,mBAAmBA;AAAA,EACnB,UAAUE,EAAS,QAAQ,EAAK;AAAA,EAChC,UAAAC;AAAA,EACA,MAAMC,EAAM,MAAM,MAAM,IAAI,EACzB,QAAQ,SAAS,UAAU,OAAO,EAClC,QAAQ,IAAI,EACZ,gBAAgB,EAAC,WAAW,IAAM;AAAA,EACrC,OAAOC;AAAA,EACP,SAASJ,EAAQ,QAAQ,EAAK;AAAA,EAC9B,UAAUK;AACZ,CAAC;"}
|
package/dist/tooltip.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Definer } from '@react-form-builder/core';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { OverlayTriggerType } from 'rsuite/esm/internals/Overlay/OverlayTrigger';
|
|
3
|
+
import { TypeAttributes } from 'rsuite/esm/internals/types';
|
|
4
4
|
import { WrapperProps } from '@react-form-builder/core';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/tooltip.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as t } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { define as n,
|
|
2
|
+
import { define as n, someOf as p, oneOf as s, node as d, string as m } from "@react-form-builder/core";
|
|
3
3
|
import { useMemo as c } from "react";
|
|
4
4
|
import { Tooltip as u, Whisper as f } from "rsuite";
|
|
5
|
-
import {
|
|
5
|
+
import { a as h } from "./categories-_98lyB3C.js";
|
|
6
6
|
const g = { width: "100%", height: "100%" }, S = ({ text: o, placement: e, trigger: i, children: r, ...a }) => {
|
|
7
7
|
const l = c(() => /* @__PURE__ */ t(u, { children: o }), [o]);
|
|
8
8
|
return r ? /* @__PURE__ */ t(f, { placement: e, trigger: i, speaker: l, children: /* @__PURE__ */ t("div", { ...a, style: g, children: r }) }) : null;
|
|
9
9
|
}, q = n(S, "RsTooltip").name("Tooltip").category(h).props({
|
|
10
|
-
text:
|
|
11
|
-
children:
|
|
12
|
-
placement:
|
|
10
|
+
text: m.required.default("Tooltip message...").dataBound,
|
|
11
|
+
children: d,
|
|
12
|
+
placement: s(
|
|
13
13
|
"top",
|
|
14
14
|
"bottom",
|
|
15
15
|
"right",
|
|
@@ -29,7 +29,7 @@ const g = { width: "100%", height: "100%" }, S = ({ text: o, placement: e, trigg
|
|
|
29
29
|
"autoHorizontal",
|
|
30
30
|
"autoHorizontalStart"
|
|
31
31
|
).required.default("bottom").withEditorProps({ creatable: !1 }),
|
|
32
|
-
trigger:
|
|
32
|
+
trigger: p("click", "hover", "focus", "active", "contextMenu").required.default(["hover"])
|
|
33
33
|
}).componentRole("tooltip");
|
|
34
34
|
export {
|
|
35
35
|
q as rsTooltip
|
package/dist/tooltip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","sources":["../src/components/RsTooltip.tsx"],"sourcesContent":["import type {WrapperProps} from '@react-form-builder/core'\nimport {define, node, oneOf, someOf, string} from '@react-form-builder/core'\nimport {useMemo} from 'react'\nimport {Tooltip, Whisper} from 'rsuite'\nimport type {OverlayTriggerType} from 'rsuite/esm/internals/Overlay/OverlayTrigger'\nimport type {TypeAttributes} from 'rsuite/esm/internals/types'\nimport {staticCategory} from './categories'\n\n/**\n * The properties of RsTooltip component.\n */\nexport interface RsTooltipProps extends WrapperProps {\n /**\n * The tooltip text.\n */\n text: string\n /**\n * The placement of a tooltip.\n */\n placement: TypeAttributes.Placement\n /**\n * The tooltip trigger.\n */\n trigger: OverlayTriggerType\n}\n\nconst wrapperStyle = {width: '100%', height: '100%'} as const\n\nconst RsTooltip = ({text, placement, trigger, children, ...props}: RsTooltipProps) => {\n const tooltip = useMemo(() => <Tooltip>{text}</Tooltip>, [text])\n\n if (!children) return null\n\n return <Whisper placement={placement} trigger={trigger} speaker={tooltip}>\n <div {...props} style={wrapperStyle}>{children}</div>\n </Whisper>\n}\n\n/**\n * Metadata builder for rSuite-based tooltip display component.\n */\nexport const rsTooltip = define(RsTooltip, 'RsTooltip')\n .name('Tooltip')\n .category(staticCategory)\n .props({\n text: string.required.default('Tooltip message...').dataBound,\n children: node,\n placement: oneOf('top', 'bottom', 'right', 'left', 'bottomStart', 'bottomEnd',\n 'topStart', 'topEnd', 'leftStart', 'rightStart', 'leftEnd', 'rightEnd', 'auto',\n 'autoVertical', 'autoVerticalStart', 'autoVerticalEnd', 'autoHorizontal', 'autoHorizontalStart')\n .required.default('bottom')\n .withEditorProps({creatable: false}),\n trigger: someOf('click', 'hover', 'focus', 'active', 'contextMenu')\n .required.default(['hover'])\n })\n .componentRole('tooltip')\n"],"names":["wrapperStyle","RsTooltip","text","placement","trigger","children","props","tooltip","useMemo","jsx","Tooltip","Whisper","rsTooltip","define","staticCategory","string","node","oneOf","someOf"],"mappings":";;;;;AA0BA,MAAMA,IAAe,EAAC,OAAO,QAAQ,QAAQ,
|
|
1
|
+
{"version":3,"file":"tooltip.js","sources":["../src/components/RsTooltip.tsx"],"sourcesContent":["import type {WrapperProps} from '@react-form-builder/core'\nimport {define, node, oneOf, someOf, string} from '@react-form-builder/core'\nimport {useMemo} from 'react'\nimport {Tooltip, Whisper} from 'rsuite'\nimport type {OverlayTriggerType} from 'rsuite/esm/internals/Overlay/OverlayTrigger'\nimport type {TypeAttributes} from 'rsuite/esm/internals/types'\nimport {staticCategory} from './categories'\n\n/**\n * The properties of RsTooltip component.\n */\nexport interface RsTooltipProps extends WrapperProps {\n /**\n * The tooltip text.\n */\n text: string\n /**\n * The placement of a tooltip.\n */\n placement: TypeAttributes.Placement\n /**\n * The tooltip trigger.\n */\n trigger: OverlayTriggerType\n}\n\nconst wrapperStyle = {width: '100%', height: '100%'} as const\n\nconst RsTooltip = ({text, placement, trigger, children, ...props}: RsTooltipProps) => {\n const tooltip = useMemo(() => <Tooltip>{text}</Tooltip>, [text])\n\n if (!children) return null\n\n return <Whisper placement={placement} trigger={trigger} speaker={tooltip}>\n <div {...props} style={wrapperStyle}>{children}</div>\n </Whisper>\n}\n\n/**\n * Metadata builder for rSuite-based tooltip display component.\n */\nexport const rsTooltip = define(RsTooltip, 'RsTooltip')\n .name('Tooltip')\n .category(staticCategory)\n .props({\n text: string.required.default('Tooltip message...').dataBound,\n children: node,\n placement: oneOf('top', 'bottom', 'right', 'left', 'bottomStart', 'bottomEnd',\n 'topStart', 'topEnd', 'leftStart', 'rightStart', 'leftEnd', 'rightEnd', 'auto',\n 'autoVertical', 'autoVerticalStart', 'autoVerticalEnd', 'autoHorizontal', 'autoHorizontalStart')\n .required.default('bottom')\n .withEditorProps({creatable: false}),\n trigger: someOf('click', 'hover', 'focus', 'active', 'contextMenu')\n .required.default(['hover'])\n })\n .componentRole('tooltip')\n"],"names":["wrapperStyle","RsTooltip","text","placement","trigger","children","props","tooltip","useMemo","jsx","Tooltip","Whisper","rsTooltip","define","staticCategory","string","node","oneOf","someOf"],"mappings":";;;;;AA0BA,MAAMA,IAAe,EAAC,OAAO,QAAQ,QAAQ,OAAA,GAEvCC,IAAY,CAAC,EAAC,MAAAC,GAAM,WAAAC,GAAW,SAAAC,GAAS,UAAAC,GAAU,GAAGC,QAA2B;AACpF,QAAMC,IAAUC,EAAQ,MAAM,gBAAAC,EAACC,KAAS,UAAAR,EAAA,CAAK,GAAY,CAACA,CAAI,CAAC;AAE/D,SAAKG,IAEE,gBAAAI,EAACE,GAAA,EAAQ,WAAAR,GAAsB,SAAAC,GAAkB,SAASG,GAC/D,UAAA,gBAAAE,EAAC,OAAA,EAAK,GAAGH,GAAO,OAAON,GAAe,UAAAK,GAAS,GACjD,IAJsB;AAKxB,GAKaO,IAAYC,EAAOZ,GAAW,WAAW,EACnD,KAAK,SAAS,EACd,SAASa,CAAc,EACvB,MAAM;AAAA,EACL,MAAMC,EAAO,SAAS,QAAQ,oBAAoB,EAAE;AAAA,EACpD,UAAUC;AAAA,EACV,WAAWC;AAAA,IAAM;AAAA,IAAO;AAAA,IAAU;AAAA,IAAS;AAAA,IAAQ;AAAA,IAAe;AAAA,IAChE;AAAA,IAAY;AAAA,IAAU;AAAA,IAAa;AAAA,IAAc;AAAA,IAAW;AAAA,IAAY;AAAA,IACxE;AAAA,IAAgB;AAAA,IAAqB;AAAA,IAAmB;AAAA,IAAkB;AAAA,EAAA,EACzE,SAAS,QAAQ,QAAQ,EACzB,gBAAgB,EAAC,WAAW,IAAM;AAAA,EACrC,SAASC,EAAO,SAAS,SAAS,SAAS,UAAU,aAAa,EAC/D,SAAS,QAAQ,CAAC,OAAO,CAAC;AAC/B,CAAC,EACA,cAAc,SAAS;"}
|
package/dist/uploader.d.ts
CHANGED