@react-form-builder/components-rsuite 7.7.0 → 7.8.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.
Files changed (166) hide show
  1. package/dist/InputCell-f4236002.js +21 -0
  2. package/dist/InputCell-f4236002.js.map +1 -0
  3. package/dist/Labeled-751c2353.js +35 -0
  4. package/dist/Labeled-751c2353.js.map +1 -0
  5. package/dist/WrappedInput-bc5a6d33.js +11 -0
  6. package/dist/WrappedInput-bc5a6d33.js.map +1 -0
  7. package/dist/autocomplete.d.ts +30 -0
  8. package/dist/autocomplete.js +62 -0
  9. package/dist/autocomplete.js.map +1 -0
  10. package/dist/breadcrumb.d.ts +38 -0
  11. package/dist/breadcrumb.js +42 -0
  12. package/dist/breadcrumb.js.map +1 -0
  13. package/dist/builder-view-with-css.d.ts +9 -0
  14. package/dist/builder-view-with-css.js +66 -0
  15. package/dist/builder-view-with-css.js.map +1 -0
  16. package/dist/button.d.ts +6 -0
  17. package/dist/button.js +23 -0
  18. package/dist/button.js.map +1 -0
  19. package/dist/calendar.d.ts +20 -0
  20. package/dist/calendar.js +24 -0
  21. package/dist/calendar.js.map +1 -0
  22. package/dist/card.d.ts +20 -0
  23. package/dist/card.js +30 -0
  24. package/dist/card.js.map +1 -0
  25. package/dist/categories-7064b279.js +8 -0
  26. package/dist/categories-7064b279.js.map +1 -0
  27. package/dist/checkbox.d.ts +6 -0
  28. package/dist/checkbox.js +36 -0
  29. package/dist/checkbox.js.map +1 -0
  30. package/dist/commonProperties-d849cd5b.js +74 -0
  31. package/dist/commonProperties-d849cd5b.js.map +1 -0
  32. package/dist/components-descriptions.d.ts +6 -0
  33. package/dist/components-descriptions.js +5 -0
  34. package/dist/components-descriptions.js.map +1 -0
  35. package/dist/container.d.ts +25 -0
  36. package/dist/container.js +23 -0
  37. package/dist/container.js.map +1 -0
  38. package/dist/css/rsuite-no-reset-rtl.min.css +1 -1
  39. package/dist/css/rsuite-no-reset.min.css +1 -1
  40. package/dist/css-loader.d.ts +19 -0
  41. package/dist/css-loader.js +20 -0
  42. package/dist/css-loader.js.map +1 -0
  43. package/dist/date-picker.d.ts +25 -0
  44. package/dist/date-picker.js +75 -0
  45. package/dist/date-picker.js.map +1 -0
  46. package/dist/dateTimeUtils-b07ce438.js +26 -0
  47. package/dist/dateTimeUtils-b07ce438.js.map +1 -0
  48. package/dist/definitions.d.ts +5 -0
  49. package/dist/definitions.js +59 -0
  50. package/dist/definitions.js.map +1 -0
  51. package/dist/divider.d.ts +11 -0
  52. package/dist/divider.js +12 -0
  53. package/dist/divider.js.map +1 -0
  54. package/dist/dropdown.d.ts +58 -0
  55. package/dist/dropdown.js +57 -0
  56. package/dist/dropdown.js.map +1 -0
  57. package/dist/error-message.d.ts +20 -0
  58. package/dist/error-message.js +28 -0
  59. package/dist/error-message.js.map +1 -0
  60. package/dist/header.d.ts +69 -0
  61. package/dist/header.js +20 -0
  62. package/dist/header.js.map +1 -0
  63. package/dist/hooks-ff273a8a.js +53 -0
  64. package/dist/hooks-ff273a8a.js.map +1 -0
  65. package/dist/image.d.ts +22 -0
  66. package/dist/image.js +41 -0
  67. package/dist/image.js.map +1 -0
  68. package/dist/images/logo.svg +20 -0
  69. package/dist/index.d.ts +3 -0
  70. package/dist/index.js +116 -19516
  71. package/dist/index.js.map +1 -1
  72. package/dist/input.d.ts +32 -0
  73. package/dist/input.js +28 -0
  74. package/dist/input.js.map +1 -0
  75. package/dist/label.d.ts +47 -0
  76. package/dist/label.js +16 -0
  77. package/dist/label.js.map +1 -0
  78. package/dist/link.d.ts +56 -0
  79. package/dist/link.js +20 -0
  80. package/dist/link.js.map +1 -0
  81. package/dist/localization-wrapper.d.ts +164 -0
  82. package/dist/localization-wrapper.js +246 -0
  83. package/dist/localization-wrapper.js.map +1 -0
  84. package/dist/menu.d.ts +35 -0
  85. package/dist/menu.js +50 -0
  86. package/dist/menu.js.map +1 -0
  87. package/dist/message.d.ts +16 -0
  88. package/dist/message.js +18 -0
  89. package/dist/message.js.map +1 -0
  90. package/dist/modal-layout.d.ts +28 -0
  91. package/dist/modal-layout.js +21 -0
  92. package/dist/modal-layout.js.map +1 -0
  93. package/dist/modal.d.ts +16 -0
  94. package/dist/modal.js +27 -0
  95. package/dist/modal.js.map +1 -0
  96. package/dist/models.d.ts +8 -0
  97. package/dist/models.js +60 -0
  98. package/dist/models.js.map +1 -0
  99. package/dist/number-format.d.ts +25 -0
  100. package/dist/number-format.js +53 -0
  101. package/dist/number-format.js.map +1 -0
  102. package/dist/pattern-format.d.ts +25 -0
  103. package/dist/pattern-format.js +39 -0
  104. package/dist/pattern-format.js.map +1 -0
  105. package/dist/placeholder.d.ts +17 -0
  106. package/dist/placeholder.js +38 -0
  107. package/dist/placeholder.js.map +1 -0
  108. package/dist/progress.d.ts +14 -0
  109. package/dist/progress.js +27 -0
  110. package/dist/progress.js.map +1 -0
  111. package/dist/r-suite-components.d.ts +8 -0
  112. package/dist/r-suite-components.js +115 -0
  113. package/dist/r-suite-components.js.map +1 -0
  114. package/dist/rSuiteComponentsDescriptions-d616cdc1.js +17911 -0
  115. package/dist/rSuiteComponentsDescriptions-d616cdc1.js.map +1 -0
  116. package/dist/radio-group.d.ts +26 -0
  117. package/dist/radio-group.js +24 -0
  118. package/dist/radio-group.js.map +1 -0
  119. package/dist/rsuite-no-reset-rtl.min-af106e5c.js +5 -0
  120. package/dist/rsuite-no-reset-rtl.min-af106e5c.js.map +1 -0
  121. package/dist/rsuite-no-reset.min-3caeeea0.js +5 -0
  122. package/dist/rsuite-no-reset.min-3caeeea0.js.map +1 -0
  123. package/dist/search.d.ts +54 -0
  124. package/dist/search.js +60 -0
  125. package/dist/search.js.map +1 -0
  126. package/dist/static-content.d.ts +19 -0
  127. package/dist/static-content.js +15 -0
  128. package/dist/static-content.js.map +1 -0
  129. package/dist/tab.d.ts +39 -0
  130. package/dist/tab.js +59 -0
  131. package/dist/tab.js.map +1 -0
  132. package/dist/tag-picker.d.ts +21 -0
  133. package/dist/tag-picker.js +42 -0
  134. package/dist/tag-picker.js.map +1 -0
  135. package/dist/text-area.d.ts +24 -0
  136. package/dist/text-area.js +24 -0
  137. package/dist/text-area.js.map +1 -0
  138. package/dist/time-picker.d.ts +29 -0
  139. package/dist/time-picker.js +74 -0
  140. package/dist/time-picker.js.map +1 -0
  141. package/dist/toggle.d.ts +16 -0
  142. package/dist/toggle.js +29 -0
  143. package/dist/toggle.js.map +1 -0
  144. package/dist/tooltip.d.ts +29 -0
  145. package/dist/tooltip.js +37 -0
  146. package/dist/tooltip.js.map +1 -0
  147. package/dist/uploader.d.ts +20 -0
  148. package/dist/uploader.js +70 -0
  149. package/dist/uploader.js.map +1 -0
  150. package/dist/useTouchOnEvent-2be3c60d.js +12 -0
  151. package/dist/useTouchOnEvent-2be3c60d.js.map +1 -0
  152. package/dist/view-with-css.d.ts +9 -0
  153. package/dist/view-with-css.js +66 -0
  154. package/dist/view-with-css.js.map +1 -0
  155. package/dist/view.d.ts +8 -0
  156. package/dist/view.js +61 -0
  157. package/dist/view.js.map +1 -0
  158. package/dist/wizard.d.ts +88 -0
  159. package/dist/wizard.js +294 -0
  160. package/dist/wizard.js.map +1 -0
  161. package/package.json +191 -5
  162. package/dist/images/logo.png +0 -0
  163. package/dist/rsuite-no-reset-rtl.min-f9b04ca7.js +0 -5
  164. package/dist/rsuite-no-reset-rtl.min-f9b04ca7.js.map +0 -1
  165. package/dist/rsuite-no-reset.min-12eea714.js +0 -5
  166. package/dist/rsuite-no-reset.min-12eea714.js.map +0 -1
@@ -0,0 +1,54 @@
1
+ import { Definer } from '@react-form-builder/core';
2
+ import type { InputPickerProps } from 'rsuite';
3
+ import type { ItemDataType } from 'rsuite/esm/internals/types';
4
+
5
+ /**
6
+ * The callback function for loading data into the component.
7
+ * @param newData the new data to be loaded into the component.
8
+ */
9
+ declare type LoadCallback = (newData: ItemDataType[]) => void;
10
+
11
+ /**
12
+ * Describes a function that is called when data is to be loaded into the component.
13
+ * @param searchKeyword the current search value.
14
+ * @param loadCallback the callback function called to set the data in the component.
15
+ * @param currentDataLength the length of the data already loaded.
16
+ */
17
+ declare type LoadDataHandler = (searchKeyword: string, loadCallback: LoadCallback, currentDataLength: number) => {};
18
+
19
+ /**
20
+ * Interface for load data props.
21
+ */
22
+ declare interface LoadDataProps {
23
+ /**
24
+ * The callback function called when data should be load.
25
+ */
26
+ onLoadData?: LoadDataHandler;
27
+ /**
28
+ * Flag, if true, the data will be loaded in advance, before opening the dropdown, false otherwise.
29
+ */
30
+ preload?: boolean;
31
+ /**
32
+ * Flag, if true, the virtualized will be disabled, false otherwise.
33
+ */
34
+ disableVirtualized?: boolean;
35
+ }
36
+
37
+ export declare const rsSearch: Definer<RsSearchProps>;
38
+
39
+ /**
40
+ * Props for the RsSearch component.
41
+ */
42
+ export declare interface RsSearchProps extends InputPickerProps, LoadDataProps {
43
+ /**
44
+ * The label for the search input.
45
+ */
46
+ label: string;
47
+ /**
48
+ * Called after the value has been changed.
49
+ * @param value the value.
50
+ */
51
+ onChange?: (value: any) => void;
52
+ }
53
+
54
+ export { }
package/dist/search.js ADDED
@@ -0,0 +1,60 @@
1
+ import { jsx as a, jsxs as y } from "@emotion/react/jsx-runtime";
2
+ import c from "@emotion/styled";
3
+ import { define as I, boolean as L, string as l, useComponentData as R, useAriaAttributes as j } from "@react-form-builder/core";
4
+ import { Search as D } from "@rsuite/icons";
5
+ import { useCallback as F, useMemo as M } from "react";
6
+ import { InputPicker as O, Loader as T } from "rsuite";
7
+ import { b as w } from "./commonProperties-d849cd5b.js";
8
+ import { u as z, a as E } from "./hooks-ff273a8a.js";
9
+ import { f as N } from "./categories-7064b279.js";
10
+ import { u as q } from "./useTouchOnEvent-2be3c60d.js";
11
+ import { L as v } from "./Labeled-751c2353.js";
12
+ import "@emotion/react";
13
+ const B = c.div`
14
+ display: flex;
15
+ flex: 1;
16
+
17
+ .search-icon {
18
+ margin-inline-start: -28px;
19
+ margin-top: 10px;
20
+ z-index: 10;
21
+ }
22
+
23
+ .rs-loader .rs-loader-spin, .rs-loader .rs-loader-spin:after, .rs-loader .rs-loader-spin:before {
24
+ height: 16px !important;
25
+ width: 16px !important;
26
+ }
27
+ `, G = c(O)`
28
+ flex: 1;
29
+ `, H = () => null, J = ({ data: m, label: t, onLoadData: p, onSearch: d, value: e = "", className: f, preload: u, disableVirtualized: h, ...r }) => {
30
+ var s;
31
+ const { loading: x, onOpen: K, ...o } = z({ data: m, onLoadData: p, onSearch: d, value: e, preload: u, disableVirtualized: h }), b = F((P) => {
32
+ var i;
33
+ return (i = o.data) != null && i.length ? P : null;
34
+ }, [(s = o.data) == null ? void 0 : s.length]), g = q(r, "onClean"), n = x ? T : D, { id: C } = R(), S = j({ labeled: !!t }), A = E(), k = M(() => r.cleanable && e ? null : /* @__PURE__ */ a(n, { className: "search-icon" }), [n, r.cleanable, e]);
35
+ return /* @__PURE__ */ a(v, { label: t, className: f, passAriaToChildren: !1, children: /* @__PURE__ */ y(B, { children: [
36
+ /* @__PURE__ */ a(
37
+ G,
38
+ {
39
+ id: C,
40
+ ...S,
41
+ ...r,
42
+ ...o,
43
+ onClean: g,
44
+ renderMenu: b,
45
+ caretAs: H,
46
+ ref: A
47
+ }
48
+ ),
49
+ k
50
+ ] }) });
51
+ }, ar = I(J, "RsSearch").name("Search").category(N).props({
52
+ ...w,
53
+ preload: L.default(!1),
54
+ label: l.default("Search"),
55
+ placeholder: l.default("Search")
56
+ });
57
+ export {
58
+ ar as rsSearch
59
+ };
60
+ //# sourceMappingURL=search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sources":["../src/components/RsSearch.tsx"],"sourcesContent":["import styled from '@emotion/styled'\nimport {boolean, define, string, useAriaAttributes, useComponentData} from '@react-form-builder/core'\nimport {Search} from '@rsuite/icons'\nimport type {ReactNode} from 'react'\nimport {useCallback, useMemo} from 'react'\nimport type {InputPickerProps} from 'rsuite'\nimport {InputPicker, Loader} from 'rsuite'\nimport {pickerProps} from '../commonProperties'\nimport type {LoadDataProps} from '../hooks'\nimport {useFixAriaAttributesForInputPicker, useLoadData} from '../hooks'\nimport {fieldsCategory} from './categories'\nimport {useTouchOnEvent} from './hooks/useTouchOnEvent'\nimport {Labeled} from './internal/Labeled'\n\nconst Container = styled.div`\n display: flex;\n flex: 1;\n\n .search-icon {\n margin-inline-start: -28px;\n margin-top: 10px;\n z-index: 10;\n }\n\n .rs-loader .rs-loader-spin, .rs-loader .rs-loader-spin:after, .rs-loader .rs-loader-spin:before {\n height: 16px !important;\n width: 16px !important;\n }\n`\n\nconst SInputPicker = styled(InputPicker)`\n flex: 1;\n`\n\n/**\n * Props for the RsSearch component.\n */\nexport interface RsSearchProps extends InputPickerProps, LoadDataProps {\n /**\n * The label for the search input.\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 CustomCaret = () => null\n\n/**\n * Search component with label and data loading support.\n * @param props the component props.\n * @param props.data the data for the search.\n * @param props.label the label for the search input.\n * @param props.onLoadData the callback for loading data.\n * @param props.onSearch the callback for search.\n * @param props.value the value of the search.\n * @param props.className the CSS class name.\n * @param props.preload whether to preload data.\n * @param props.disableVirtualized whether to disable virtualization.\n * @param props.props the additional search props.\n * @returns the React element.\n */\nconst RsSearch = ({data, label, onLoadData, onSearch, value = '', className, preload, disableVirtualized, ...props}: RsSearchProps) => {\n const {loading, onOpen, ...loadProps} = useLoadData({data, onLoadData, onSearch, value, preload, disableVirtualized})\n\n const renderMenu = useCallback((menu: ReactNode) => {\n return loadProps.data?.length ? menu : null\n }, [loadProps.data?.length])\n\n const onClean = useTouchOnEvent(props, 'onClean')\n const Icon = loading ? Loader : Search\n const {id} = useComponentData()\n const aria = useAriaAttributes({labeled: !!label})\n const inputRef = useFixAriaAttributesForInputPicker()\n\n const icon = useMemo(() => {\n return !(props.cleanable && value) ? <Icon className={'search-icon'}/> : null\n }, [Icon, props.cleanable, value])\n\n return (\n <Labeled label={label} className={className} passAriaToChildren={false}>\n <Container>\n <SInputPicker id={id} {...aria} {...props} {...loadProps} onClean={onClean} renderMenu={renderMenu} caretAs={CustomCaret}\n ref={inputRef}/>\n {icon}\n </Container>\n </Labeled>\n )\n}\n\nexport const rsSearch = define(RsSearch, 'RsSearch')\n .name('Search')\n .category(fieldsCategory)\n .props({\n ...pickerProps,\n preload: boolean.default(false),\n label: string.default('Search'),\n placeholder: string.default('Search')\n })\n"],"names":["Container","styled","SInputPicker","InputPicker","CustomCaret","RsSearch","data","label","onLoadData","onSearch","value","className","preload","disableVirtualized","props","loading","onOpen","loadProps","useLoadData","renderMenu","useCallback","menu","_a","onClean","useTouchOnEvent","Icon","Loader","Search","id","useComponentData","aria","useAriaAttributes","inputRef","useFixAriaAttributesForInputPicker","icon","useMemo","Labeled","jsx","rsSearch","define","fieldsCategory","pickerProps","boolean","string"],"mappings":";;;;;;;;;;;;AAcA,MAAMA,IAAYC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAgBnBC,IAAeD,EAAOE,CAAW;AAAA;AAAA,GAmBjCC,IAAc,MAAM,MAgBpBC,IAAW,CAAC,EAAC,MAAAC,GAAM,OAAAC,GAAO,YAAAC,GAAY,UAAAC,GAAU,OAAAC,IAAQ,IAAI,WAAAC,GAAW,SAAAC,GAAS,oBAAAC,GAAoB,GAAGC,QAA0B;;AACrI,QAAM,EAAC,SAAAC,GAAS,QAAAC,GAAQ,GAAGC,MAAaC,EAAY,EAAC,MAAAZ,GAAM,YAAAE,GAAY,UAAAC,GAAU,OAAAC,GAAO,SAAAE,GAAS,oBAAAC,EAAmB,CAAA,GAE9GM,IAAaC,EAAY,CAACC,MAAoB;;AAC3C,YAAAC,IAAAL,EAAU,SAAV,QAAAK,EAAgB,SAASD,IAAO;AAAA,EACtC,GAAA,EAACC,IAAAL,EAAU,SAAV,gBAAAK,EAAgB,MAAM,CAAC,GAErBC,IAAUC,EAAgBV,GAAO,SAAS,GAC1CW,IAAOV,IAAUW,IAASC,GAC1B,EAAC,IAAAC,MAAMC,KACPC,IAAOC,EAAkB,EAAC,SAAS,CAAC,CAACxB,GAAM,GAC3CyB,IAAWC,KAEXC,IAAOC,EAAQ,MACVrB,EAAM,aAAaJ,IAA6C,yBAAnCe,GAAK,EAAA,WAAW,cAAc,CAAA,GACnE,CAACA,GAAMX,EAAM,WAAWJ,CAAK,CAAC;AAEjC,2BACG0B,GAAQ,EAAA,OAAA7B,GAAc,WAAAI,GAAsB,oBAAoB,IAC/D,4BAACX,GACC,EAAA,UAAA;AAAA,IAAA,gBAAAqC;AAAA,MAACnC;AAAA,MAAA;AAAA,QAAa,IAAA0B;AAAA,QAAS,GAAGE;AAAA,QAAO,GAAGhB;AAAA,QAAQ,GAAGG;AAAA,QAAW,SAAAM;AAAA,QAAkB,YAAAJ;AAAA,QAAwB,SAASf;AAAA,QAC/F,KAAK4B;AAAA,MAAA;AAAA,IAAS;AAAA,IAC3BE;AAAA,EAAA,EACH,CAAA,EACF,CAAA;AAEJ,GAEaI,KAAWC,EAAOlC,GAAU,UAAU,EAChD,KAAK,QAAQ,EACb,SAASmC,CAAc,EACvB,MAAM;AAAA,EACL,GAAGC;AAAA,EACH,SAASC,EAAQ,QAAQ,EAAK;AAAA,EAC9B,OAAOC,EAAO,QAAQ,QAAQ;AAAA,EAC9B,aAAaA,EAAO,QAAQ,QAAQ;AACtC,CAAC;"}
@@ -0,0 +1,19 @@
1
+ import { Definer } from '@react-form-builder/core';
2
+
3
+ export declare const rsStaticContent: Definer<RsStaticContentProps>;
4
+
5
+ /**
6
+ * Props for the RsStaticContent component.
7
+ */
8
+ export declare interface RsStaticContentProps {
9
+ /**
10
+ * The content to display.
11
+ */
12
+ content: string;
13
+ /**
14
+ * Whether to allow HTML content.
15
+ */
16
+ allowHtml: boolean;
17
+ }
18
+
19
+ export { }
@@ -0,0 +1,15 @@
1
+ import { jsx as e } from "@emotion/react/jsx-runtime";
2
+ import { define as c, string as i, boolean as m, useBuilderValue as u } from "@react-form-builder/core";
3
+ import { useMemo as d } from "react";
4
+ import { s as f } from "./categories-7064b279.js";
5
+ const n = "Text...", p = (r) => {
6
+ const { content: a, allowHtml: s, ...o } = r, t = u(a, n), l = d(() => ({ __html: t }), [t]);
7
+ return s ? /* @__PURE__ */ e("span", { ...o, dangerouslySetInnerHTML: l }) : /* @__PURE__ */ e("span", { ...o, children: t });
8
+ }, x = c(p, "RsStaticContent").name("Static content").category(f).props({
9
+ content: i.required.default(n).dataBound,
10
+ allowHtml: m.default(!1)
11
+ });
12
+ export {
13
+ x as rsStaticContent
14
+ };
15
+ //# sourceMappingURL=static-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-content.js","sources":["../src/components/RsStaticContent.tsx"],"sourcesContent":["import {boolean, define, string, useBuilderValue} from '@react-form-builder/core'\nimport {useMemo} from 'react'\nimport {staticCategory} from './categories'\n\nconst defaultContent = 'Text...'\n\n/**\n * Props for the RsStaticContent component.\n */\nexport interface RsStaticContentProps {\n /**\n * The content to display.\n */\n content: string\n /**\n * Whether to allow HTML content.\n */\n allowHtml: boolean\n}\n\n/**\n * A static content component that displays text or HTML content.\n * @param props the component props.\n * @returns the React element.\n */\nconst RsStaticContent = (props: RsStaticContentProps) => {\n const {content, allowHtml, ...otherProps} = props\n const data = useBuilderValue(content, defaultContent)\n const html = useMemo(() => ({__html: data}), [data])\n\n if (allowHtml) {\n return <span {...otherProps} dangerouslySetInnerHTML={html}/>\n }\n\n return <span {...otherProps}>{data}</span>\n}\n\nexport const rsStaticContent = define(RsStaticContent, 'RsStaticContent')\n .name('Static content')\n .category(staticCategory)\n .props({\n content: string.required.default(defaultContent).dataBound,\n allowHtml: boolean.default(false),\n })\n"],"names":["defaultContent","RsStaticContent","props","content","allowHtml","otherProps","data","useBuilderValue","html","useMemo","jsx","rsStaticContent","define","staticCategory","string","boolean"],"mappings":";;;;AAIA,MAAMA,IAAiB,WAqBjBC,IAAkB,CAACC,MAAgC;AACvD,QAAM,EAAC,SAAAC,GAAS,WAAAC,GAAW,GAAGC,MAAcH,GACtCI,IAAOC,EAAgBJ,GAASH,CAAc,GAC9CQ,IAAOC,EAAQ,OAAO,EAAC,QAAQH,MAAQ,CAACA,CAAI,CAAC;AAEnD,SAAIF,IACM,gBAAAM,EAAA,QAAA,EAAM,GAAGL,GAAY,yBAAyBG,EAAK,CAAA,IAGrD,gBAAAE,EAAA,QAAA,EAAM,GAAGL,GAAa,UAAKC,EAAA,CAAA;AACrC,GAEaK,IAAkBC,EAAOX,GAAiB,iBAAiB,EACrE,KAAK,gBAAgB,EACrB,SAASY,CAAc,EACvB,MAAM;AAAA,EACL,SAASC,EAAO,SAAS,QAAQd,CAAc,EAAE;AAAA,EACjD,WAAWe,EAAQ,QAAQ,EAAK;AAClC,CAAC;"}
package/dist/tab.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ import { Definer } from '@react-form-builder/core';
2
+ import type { NavProps } from 'rsuite';
3
+ import type { ReactNode } from 'react';
4
+
5
+ export declare const rsTab: Definer<RsTabProps>;
6
+
7
+ /**
8
+ * Tab item for RsTab component.
9
+ */
10
+ export declare type RsTabItem = {
11
+ /**
12
+ * Label for the tab item.
13
+ */
14
+ label: string;
15
+ /**
16
+ * Value for the tab item.
17
+ */
18
+ value: string;
19
+ };
20
+
21
+ /**
22
+ * Props for the RsTab component.
23
+ */
24
+ export declare interface RsTabProps extends NavProps {
25
+ /**
26
+ * Items for the tab.
27
+ */
28
+ items?: RsTabItem[];
29
+ /**
30
+ * Whether to show navigation.
31
+ */
32
+ showNavigation?: boolean;
33
+ /**
34
+ * Pane content for the tab.
35
+ */
36
+ pane: ReactNode;
37
+ }
38
+
39
+ export { }
package/dist/tab.js ADDED
@@ -0,0 +1,59 @@
1
+ import { jsxs as p, Fragment as b, jsx as l } from "@emotion/react/jsx-runtime";
2
+ import v from "@emotion/styled";
3
+ import { define as f, array as m, toLabeledValues as y, boolean as h, node as g, useComponentData as K } from "@react-form-builder/core";
4
+ import { useCallback as C } from "react";
5
+ import { Nav as i } from "rsuite";
6
+ import { n as I } from "./commonProperties-d849cd5b.js";
7
+ import { a as T } from "./categories-7064b279.js";
8
+ const x = v(i)({
9
+ ".builder & .rs-nav-item": {
10
+ zIndex: 7
11
+ },
12
+ ".rs-nav-item": {
13
+ border: "none",
14
+ outline: "none",
15
+ appearance: "none",
16
+ backgroundColor: "transparent"
17
+ }
18
+ }), P = ({
19
+ pane: n,
20
+ onSelect: e,
21
+ showNavigation: s,
22
+ items: r,
23
+ ...u
24
+ }) => {
25
+ const a = K(), c = C((o, t) => {
26
+ a.userDefinedProps ?? (a.userDefinedProps = {}), a.userDefinedProps.activeKey = o, e == null || e(o, t);
27
+ }, [a, e]);
28
+ if (!(r != null && r.length))
29
+ return null;
30
+ const d = u.activeKey ?? (r == null ? void 0 : r[0].value);
31
+ return /* @__PURE__ */ p(b, { children: [
32
+ s === !0 && /* @__PURE__ */ l(x, { onSelect: c, activeKey: d, ...u, children: r.map(
33
+ (o, t) => /* @__PURE__ */ l(
34
+ i.Item,
35
+ {
36
+ eventKey: o.value,
37
+ role: "tab",
38
+ as: "button",
39
+ type: "button",
40
+ children: o.label
41
+ },
42
+ t
43
+ )
44
+ ) }),
45
+ /* @__PURE__ */ l("div", { children: n })
46
+ ] });
47
+ }, B = f(P, "RsTab").name("Tab").category(T).props({
48
+ ...I,
49
+ items: m.default(y(["Item1", "Item2", "Item3"])),
50
+ showNavigation: h.default(!0),
51
+ pane: g.withSlotConditionBuilder((n) => {
52
+ var e;
53
+ return `return parentProps.activeKey === '${((e = n.activeKey) == null ? void 0 : e.value) ?? n.activeKey}'`;
54
+ }).calculable(!1)
55
+ });
56
+ export {
57
+ B as rsTab
58
+ };
59
+ //# sourceMappingURL=tab.js.map
@@ -0,0 +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","_a"],"mappings":";;;;;;;AAyCA,MAAMA,IAAQC,EAAOC,CAAG,EAAE;AAAA,EACxB,2BAA2B;AAAA,IACzB,QAAQ;AAAA,EACV;AAAA,EACA,gBAAgB;AAAA,IACd,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,iBAAiB;AAAA,EACnB;AACF,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,KAEhBC,IAAcC,EAAY,CAACC,GAAkBC,MAA0B;AAC3E,IAAAL,EAAc,qBAAdA,EAAc,mBAAqB,KACnCA,EAAc,iBAAiB,YAAYI,GAC3CR,KAAA,QAAAA,EAAWQ,GAAUC;AAAA,EAAK,GACzB,CAACL,GAAeJ,CAAQ,CAAC;AAE5B,MAAI,EAACE,KAAA,QAAAA,EAAO;AAAe,WAAA;AAE3B,QAAMQ,IAAYP,EAAM,cAAaD,KAAA,gBAAAA,EAAQ,GAAG;AAEhD,SACG,gBAAAS,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAmBX,MAAA,wBACjBN,GAAM,EAAA,UAAUW,GAAa,WAAAI,GAAuB,GAAGP,GACrD,UAAMD,EAAA;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,UAAKA,EAAA;AAAA,QAAA;AAAA,QALiCC;AAAA,MAMzC;AAAA,IAAA,GAEJ;AAAA,IAEF,gBAAAC,EAAC,SAAK,UAAKhB,EAAA,CAAA;AAAA,EACb,EAAA,CAAA;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;;AAAA,kDAAqCqB,IAAArB,EAAM,cAAN,gBAAAqB,EAAiB,UAASrB,EAAM,SAAS;AAAA,GAAG,EACnH,WAAW,EAAK;AACrB,CAAC;"}
@@ -0,0 +1,21 @@
1
+ import { Definer } from '@react-form-builder/core';
2
+ import type { TagPickerProps } from 'rsuite';
3
+
4
+ export declare const rsTagPicker: Definer<RsTagPickerProps>;
5
+
6
+ /**
7
+ * Props for the RsTagPicker component.
8
+ */
9
+ export declare interface RsTagPickerProps extends TagPickerProps {
10
+ /**
11
+ * Label for the tag picker.
12
+ */
13
+ label: string;
14
+ /**
15
+ * Called after the value has been changed.
16
+ * @param value the value.
17
+ */
18
+ onChange?: (value: any) => void;
19
+ }
20
+
21
+ export { }
@@ -0,0 +1,42 @@
1
+ import { jsx as i } from "@emotion/react/jsx-runtime";
2
+ import { define as g, array as n, toLabeledValues as c } from "@react-form-builder/core";
3
+ import { useRef as P, useEffect as T, useMemo as b } from "react";
4
+ import { TagPicker as k } from "rsuite";
5
+ import { b as l } from "./commonProperties-d849cd5b.js";
6
+ import { s as h } from "./hooks-ff273a8a.js";
7
+ import { f as v } from "./categories-7064b279.js";
8
+ import { u as y } from "./useTouchOnEvent-2be3c60d.js";
9
+ import { L as E } from "./Labeled-751c2353.js";
10
+ import "@emotion/react";
11
+ import "@emotion/styled";
12
+ const L = ({ value: e, label: r }) => ({
13
+ value: e ?? "",
14
+ label: r ?? ""
15
+ }), x = [], C = ({ data: e, label: r, value: m, className: u, ...t }) => {
16
+ const o = P(null), f = y(t, "onClean");
17
+ T(() => {
18
+ var a, s;
19
+ const d = (s = (a = o.current) == null ? void 0 : a.root) == null ? void 0 : s.querySelector(".rs-picker-search-input input");
20
+ h(d);
21
+ }, []);
22
+ const p = b(() => c(e ?? []).map(L), [e]);
23
+ return /* @__PURE__ */ i(E, { label: r, className: u, passAriaToChildren: !0, children: /* @__PURE__ */ i(
24
+ k,
25
+ {
26
+ value: m ?? x,
27
+ data: p,
28
+ onClean: f,
29
+ ...t,
30
+ ref: o
31
+ }
32
+ ) });
33
+ }, { disableVirtualized: O, onLoadData: Y, ...I } = l, _ = g(C, "RsTagPicker").name("TagPicker").category(v).props({
34
+ ...I,
35
+ value: n.valued.ofString,
36
+ label: l.label.default("Select"),
37
+ data: n.default(c(["a", "b", "c"]))
38
+ });
39
+ export {
40
+ _ as rsTagPicker
41
+ };
42
+ //# sourceMappingURL=tag-picker.js.map
@@ -0,0 +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","_b","_a","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;AAC7E,QAAAC,IAAWC,EAAqB,IAAI,GACpCC,IAAUC,EAAgBJ,GAAO,SAAS;AAEhD,EAAAK,EAAU,MAAM;;AACd,UAAMC,KAAcC,KAAAC,IAAAP,EAAS,YAAT,gBAAAO,EAAkB,SAAlB,gBAAAD,EAAwB,cAAc;AAC1D,IAAAE,EAAyBH,CAAW;AAAA,EACtC,GAAG,CAAE,CAAA;AAEC,QAAAI,IAAkBC,EAAQ,MACvBC,EAAiBd,KAAQ,CAAA,CAAmC,EAAE,IAAIL,CAAY,GACpF,CAACK,CAAI,CAAC;AAET,SACG,gBAAAe,EAAAC,GAAA,EAAQ,OAAAnB,GAAc,WAAAI,GAAsB,oBAAoB,IAC/D,UAAA,gBAAAc;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,OAAOrB,KAASE;AAAA,MAChB,MAAMc;AAAA,MACN,SAAAP;AAAA,MACC,GAAGH;AAAA,MACJ,KAAKC;AAAA,IAAA;AAAA,EAET,EAAA,CAAA;AAEJ,GAEM,EAAC,oBAAAe,GAAoB,YAAAC,GAAY,GAAGC,MAAkBC,GAE/CC,IAAcC,EAAOxB,GAAa,aAAa,EACzD,KAAK,WAAW,EAChB,SAASyB,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;"}
@@ -0,0 +1,24 @@
1
+ import { Definer } from '@react-form-builder/core';
2
+ import type { InputProps } from 'rsuite';
3
+
4
+ export declare const rsTextArea: Definer<RsTextAreaProps>;
5
+
6
+ /**
7
+ * Props for the RsTextArea component.
8
+ */
9
+ export declare interface RsTextAreaProps extends InputProps {
10
+ /**
11
+ * The label for the text area.
12
+ */
13
+ label: string;
14
+ /**
15
+ * The number of visible text lines.
16
+ */
17
+ rows: number;
18
+ /**
19
+ * The htmlSize attribute defines the width of the &laquo;input> element.
20
+ */
21
+ htmlSize?: number;
22
+ }
23
+
24
+ export { }
@@ -0,0 +1,24 @@
1
+ import { jsx as r } from "@emotion/react/jsx-runtime";
2
+ import { define as l, string as e, disabled as d, event as a } from "@react-form-builder/core";
3
+ import { Input as m } from "rsuite";
4
+ import { d as p, s as f, r as n } from "./commonProperties-d849cd5b.js";
5
+ import { f as u } from "./categories-7064b279.js";
6
+ import { L as x } from "./Labeled-751c2353.js";
7
+ import "@emotion/react";
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({
11
+ label: e.default("Text area"),
12
+ value: e.default("").valued,
13
+ placeholder: e,
14
+ rows: p.default(5),
15
+ size: f,
16
+ disabled: d.default(!1),
17
+ readOnly: n,
18
+ onChange: a,
19
+ onPressEnter: a
20
+ });
21
+ export {
22
+ R as rsTextArea
23
+ };
24
+ //# sourceMappingURL=text-area.js.map
@@ -0,0 +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 &laquo;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,EAAK,MACnD,gBAAAC,EAAAC,GAAA,EAAQ,OAAAH,GAAc,OAAAF,GAAc,WAAAC,GAAsB,oBAAoB,IAC7E,UAAA,gBAAAG,EAACE,KAAM,IAAG,YAAY,GAAGH,EAAM,CAAA,EACjC,CAAA,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;"}
@@ -0,0 +1,29 @@
1
+ import type { DatePickerProps } from 'rsuite';
2
+ import { Definer } from '@react-form-builder/core';
3
+ import type { SyntheticEvent } from 'react';
4
+
5
+ export declare const rsTimePicker: Definer<RsTimePickerProps>;
6
+
7
+ /**
8
+ * Props for the RsTimePicker component.
9
+ */
10
+ export declare interface RsTimePickerProps extends Omit<DatePickerProps, 'value' | 'onChange'> {
11
+ /**
12
+ * Value of the time picker.
13
+ */
14
+ value?: string;
15
+ /**
16
+ * Callback when value changes.
17
+ */
18
+ onChange?: (value: string | null, event: SyntheticEvent) => void;
19
+ /**
20
+ * Label for the time picker.
21
+ */
22
+ label: string;
23
+ /**
24
+ * @deprecated
25
+ */
26
+ inline?: boolean;
27
+ }
28
+
29
+ export { }
@@ -0,0 +1,74 @@
1
+ import { jsx as u } from "@emotion/react/jsx-runtime";
2
+ import { define as x, string as n, time as T, boolean as l, disabled as y, event as e, isNull as F, timeFormat as i } from "@react-form-builder/core";
3
+ import { format as H, parse as I } from "date-fns";
4
+ import { useMemo as a, useCallback as g } from "react";
5
+ import { DatePicker as w } from "rsuite";
6
+ import { r as A, p as L, s as M } from "./commonProperties-d849cd5b.js";
7
+ import { f as R, t as S } from "./dateTimeUtils-b07ce438.js";
8
+ import { f as _ } from "./categories-7064b279.js";
9
+ import { u as h } from "./useTouchOnEvent-2be3c60d.js";
10
+ import { L as j } from "./Labeled-751c2353.js";
11
+ import "@emotion/react";
12
+ import "@emotion/styled";
13
+ const z = (t) => t instanceof Date && !Number.isNaN(t.getTime()), b = (t, s) => {
14
+ if (typeof t == "string") {
15
+ const o = I(t, s, /* @__PURE__ */ new Date());
16
+ return isNaN(o.getTime()) ? (console.error("Invalid time string:", t), null) : o;
17
+ }
18
+ return t;
19
+ }, q = ({ open: t, label: s, value: o, className: E, format: d, defaultValue: f, onChange: r, ...p }) => {
20
+ const k = a(() => S(d), [d]), D = h(p, "onClean"), N = a(() => b(o, i), [o]), O = a(() => b(f, i), [f]), P = a(() => t === !0 ? !0 : void 0, [t]), V = g((m, c) => {
21
+ if (F(m)) {
22
+ r == null || r(null, c);
23
+ return;
24
+ }
25
+ if (z(m)) {
26
+ const v = H(m, i);
27
+ r == null || r(v, c);
28
+ }
29
+ }, [r]);
30
+ return /* @__PURE__ */ u(j, { label: s, className: E, passAriaToChildren: !0, children: /* @__PURE__ */ u(
31
+ w,
32
+ {
33
+ ...p,
34
+ onChange: V,
35
+ value: N ?? O ?? null,
36
+ open: P,
37
+ format: k ?? i,
38
+ onClean: D,
39
+ preventOverflow: !0
40
+ }
41
+ ) });
42
+ }, ee = x(q, "RsTimePicker").name("TimePicker").category(_).props({
43
+ label: n.default("Time"),
44
+ placeholder: n,
45
+ value: T.valued,
46
+ defaultValue: T,
47
+ format: n.validated(R, {
48
+ code: "INVALID_TIME_FORMAT",
49
+ message: "The provided time format is invalid"
50
+ }).withEditorProps({ placeholder: "HH:mm" }).default("HH:mm"),
51
+ editable: l.default(!0),
52
+ cleanable: l.default(!1),
53
+ disabled: y.default(!1),
54
+ readOnly: A,
55
+ open: l,
56
+ placement: L,
57
+ size: M,
58
+ onChange: e,
59
+ onClean: e,
60
+ onClose: e,
61
+ onEnter: e,
62
+ onEntered: e,
63
+ onEntering: e,
64
+ onExit: e,
65
+ onExited: e,
66
+ onExiting: e,
67
+ onOk: e,
68
+ onOpen: e,
69
+ onSelect: e
70
+ });
71
+ export {
72
+ ee as rsTimePicker
73
+ };
74
+ //# sourceMappingURL=time-picker.js.map
@@ -0,0 +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":";;;;;;;;;;;;AAYA,MAAMA,IAAc,CAACC,MAAeA,aAAiB,QAAQ,CAAC,OAAO,MAAMA,EAAM,QAAA,CAAS,GAQpFC,IAAiB,CAACD,GAAYE,MAAmB;AACjD,MAAA,OAAOF,KAAU,UAAU;AAC7B,UAAMG,IAAaC,EAAMJ,GAAOE,GAAQ,oBAAI,MAAM;AAClD,WAAK,MAAMC,EAAW,QAAS,CAAA,KAGvB,QAAA,MAAM,wBAAwBH,CAAK,GACpC,QAHEG;AAAA,EAIX;AACO,SAAAH;AACT,GAqCMK,IAAe,CAAC,EAAC,MAAAC,GAAM,OAAAC,GAAO,OAAAP,GAAO,WAAAQ,GAAWN,QAAAA,GAAQ,cAAAO,GAAc,UAAAC,GAAU,GAAGC,EAAA,MAA8B;AAC/G,QAAAC,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;AACtE,QAAAC,EAAOxB,CAAK,GAAG;AACjB,MAAAU,KAAA,QAAAA,EAAW,MAAMa;AACjB;AAAA,IACF;AACI,QAAAxB,EAAYC,CAAK,GAAG;AAChB,YAAAyB,IAAYC,EAAW1B,GAAOkB,CAAU;AAC9C,MAAAR,KAAA,QAAAA,EAAWe,GAAWF;AAAA,IACxB;AAAA,EAAA,GACC,CAACb,CAAQ,CAAC;AAEb,SACG,gBAAAiB,EAAAC,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,EACnG,EAAA,CAAA;AAEJ,GAEae,KAAeC,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,QAAO,CAAC,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;"}
@@ -0,0 +1,16 @@
1
+ import { Definer } from '@react-form-builder/core';
2
+ import { ElementType } from 'react';
3
+ import { JSX } from 'react';
4
+ import { Omit as Omit_2 } from 'rsuite/esm/internals/types/utils';
5
+ import { ReactNode } from 'react';
6
+ import { Theme } from '@emotion/react';
7
+ import { ToggleProps } from 'rsuite';
8
+ import { WithAsProps } from 'rsuite/esm/internals/types';
9
+
10
+ export declare const rsToggle: Definer<Omit_2<any, WithAsProps<ElementType<any, keyof JSX.IntrinsicElements>> & ToggleProps> & WithAsProps<ElementType<any, keyof JSX.IntrinsicElements>> & ToggleProps & {
11
+ children?: ReactNode;
12
+ } & {
13
+ theme?: Theme | undefined;
14
+ }>;
15
+
16
+ export { }
package/dist/toggle.js ADDED
@@ -0,0 +1,29 @@
1
+ import r from "@emotion/styled";
2
+ import { define as l, string as e, boolean as o, disabled as a, oneOf as t, event as d } from "@react-form-builder/core";
3
+ import { Toggle as i } from "rsuite";
4
+ import { r as s, c as m } from "./commonProperties-d849cd5b.js";
5
+ import { f } from "./categories-7064b279.js";
6
+ import { r as g } from "./Labeled-751c2353.js";
7
+ import "@emotion/react/jsx-runtime";
8
+ import "@emotion/react";
9
+ import "react";
10
+ const n = r(i)`
11
+ &.required .rs-toggle-label::after {
12
+ ${g};
13
+ }
14
+ `, S = l(n, "RsToggle").name("Toggle").category(f).props({
15
+ children: e,
16
+ checked: o.valued.default(!0).uncontrolledValue(!1),
17
+ checkedChildren: e,
18
+ unCheckedChildren: e,
19
+ disabled: a.default(!1),
20
+ readOnly: s,
21
+ size: t("sm", "md", "lg").labeled("Small", "Medium", "Large").default("md").withEditorProps({ creatable: !1 }),
22
+ color: m,
23
+ loading: o.default(!1),
24
+ onChange: d
25
+ });
26
+ export {
27
+ S as rsToggle
28
+ };
29
+ //# sourceMappingURL=toggle.js.map
@@ -0,0 +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":";;;;;;;;;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;"}
@@ -0,0 +1,29 @@
1
+ import { Definer } from '@react-form-builder/core';
2
+ import type { OverlayTriggerType } from 'rsuite/esm/internals/Overlay/OverlayTrigger';
3
+ import type { TypeAttributes } from 'rsuite/esm/internals/types';
4
+ import { WrapperProps } from '@react-form-builder/core';
5
+
6
+ /**
7
+ * Metadata builder for rSuite-based tooltip display component.
8
+ */
9
+ export declare const rsTooltip: Definer<RsTooltipProps>;
10
+
11
+ /**
12
+ * The properties of RsTooltip component.
13
+ */
14
+ export declare interface RsTooltipProps extends WrapperProps {
15
+ /**
16
+ * The tooltip text.
17
+ */
18
+ text: string;
19
+ /**
20
+ * The placement of a tooltip.
21
+ */
22
+ placement: TypeAttributes.Placement;
23
+ /**
24
+ * The tooltip trigger.
25
+ */
26
+ trigger: OverlayTriggerType;
27
+ }
28
+
29
+ export { }