@blockbite/ui 2.0.7 → 2.0.9

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 (98) hide show
  1. package/dist/AutocompleteDropdown.d.ts +1 -1
  2. package/dist/AutocompleteDropdown.js +23 -94
  3. package/dist/AutocompleteDropdown.js.map +1 -0
  4. package/dist/Badge.js +5 -15
  5. package/dist/Badge.js.map +1 -0
  6. package/dist/BitePreview.js +50 -60
  7. package/dist/BitePreview.js.map +1 -0
  8. package/dist/Button.d.ts +1 -1
  9. package/dist/Button.js +8 -51
  10. package/dist/Button.js.map +1 -0
  11. package/dist/ButtonToggle.js +44 -111
  12. package/dist/ButtonToggle.js.map +1 -0
  13. package/dist/Chapter.d.ts +1 -1
  14. package/dist/Chapter.js +6 -18
  15. package/dist/Chapter.js.map +1 -0
  16. package/dist/ChapterDivider.js +5 -16
  17. package/dist/ChapterDivider.js.map +1 -0
  18. package/dist/Checkbox.d.ts +1 -1
  19. package/dist/Checkbox.js +11 -20
  20. package/dist/Checkbox.js.map +1 -0
  21. package/dist/DisappearingMessage.js +27 -21
  22. package/dist/DisappearingMessage.js.map +1 -0
  23. package/dist/DropdownPicker.d.ts +1 -1
  24. package/dist/DropdownPicker.js +35 -52
  25. package/dist/DropdownPicker.js.map +1 -0
  26. package/dist/EmptyState.js +16 -17
  27. package/dist/EmptyState.js.map +1 -0
  28. package/dist/FloatingPanel.js +30 -41
  29. package/dist/FloatingPanel.js.map +1 -0
  30. package/dist/FocalPointControl.js +30 -40
  31. package/dist/FocalPointControl.js.map +1 -0
  32. package/dist/Icon.d.ts +1 -1
  33. package/dist/Icon.js +7 -8
  34. package/dist/Icon.js.map +1 -0
  35. package/dist/LinkPicker.d.ts +1 -1
  36. package/dist/LinkPicker.js +48 -65
  37. package/dist/LinkPicker.js.map +1 -0
  38. package/dist/MediaPicker.js +93 -90
  39. package/dist/MediaPicker.js.map +1 -0
  40. package/dist/MetricsControl.js +92 -117
  41. package/dist/MetricsControl.js.map +1 -0
  42. package/dist/Modal.js +74 -80
  43. package/dist/Modal.js.map +1 -0
  44. package/dist/NewWindowPortal.js +52 -40
  45. package/dist/NewWindowPortal.js.map +1 -0
  46. package/dist/Notice.d.ts +1 -1
  47. package/dist/Notice.js +9 -23
  48. package/dist/Notice.js.map +1 -0
  49. package/dist/PasswordInput.js +20 -36
  50. package/dist/PasswordInput.js.map +1 -0
  51. package/dist/Popover.js +22 -47
  52. package/dist/Popover.js.map +1 -0
  53. package/dist/RangeSlider.js +36 -47
  54. package/dist/RangeSlider.js.map +1 -0
  55. package/dist/ResponsiveImage.js +13 -36
  56. package/dist/ResponsiveImage.js.map +1 -0
  57. package/dist/ResponsiveVideo.js +7 -19
  58. package/dist/ResponsiveVideo.js.map +1 -0
  59. package/dist/ScrollList.js +9 -21
  60. package/dist/ScrollList.js.map +1 -0
  61. package/dist/SectionList.d.ts +1 -1
  62. package/dist/SectionList.js +57 -118
  63. package/dist/SectionList.js.map +1 -0
  64. package/dist/SelectControlWrapper.js +17 -32
  65. package/dist/SelectControlWrapper.js.map +1 -0
  66. package/dist/SingleBlockTypeAppender.js +17 -18
  67. package/dist/SingleBlockTypeAppender.js.map +1 -0
  68. package/dist/SlideIn.d.ts +1 -1
  69. package/dist/SlideIn.js +16 -27
  70. package/dist/SlideIn.js.map +1 -0
  71. package/dist/Spinner.js +16 -14
  72. package/dist/Spinner.js.map +1 -0
  73. package/dist/Tabs.d.ts +6 -6
  74. package/dist/Tabs.js +52 -50
  75. package/dist/Tabs.js.map +1 -0
  76. package/dist/Tag.js +5 -10
  77. package/dist/Tag.js.map +1 -0
  78. package/dist/TextControl.js +17 -51
  79. package/dist/TextControl.js.map +1 -0
  80. package/dist/TextControlLabel.d.ts +1 -1
  81. package/dist/TextControlLabel.js +7 -18
  82. package/dist/TextControlLabel.js.map +1 -0
  83. package/dist/ToggleGroup.js +15 -51
  84. package/dist/ToggleGroup.js.map +1 -0
  85. package/dist/ToggleSwitch.d.ts +1 -1
  86. package/dist/ToggleSwitch.js +16 -28
  87. package/dist/ToggleSwitch.js.map +1 -0
  88. package/dist/Wrap.js +7 -9
  89. package/dist/Wrap.js.map +1 -0
  90. package/dist/index.js +49 -88
  91. package/dist/index.js.map +1 -0
  92. package/dist/types.js +2 -0
  93. package/dist/types.js.map +1 -0
  94. package/package.json +24 -30
  95. package/dist/_virtual/jsx-runtime.js +0 -4
  96. package/dist/_virtual/react-jsx-runtime.development.js +0 -4
  97. package/dist/_virtual/react-jsx-runtime.production.min.js +0 -4
  98. package/dist/vite.svg +0 -1
@@ -1,122 +1,61 @@
1
- import { j as t } from "./node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js";
2
- import { Button as c } from "@wordpress/components";
3
- import { useState as w, useRef as v } from "@wordpress/element";
4
- import { Wrap as u } from "./Wrap.js";
5
- import { Plus as C, Trash as R } from "@blockbite/icons";
6
- import k from "classnames";
7
- import { TextControl as _ } from "./TextControl.js";
8
- const D = ({
9
- sections: a,
10
- setSections: d,
11
- activeSection: n,
12
- setActiveSection: m,
13
- Update: x,
14
- newSection: s,
15
- setCode: f,
16
- addons: p
17
- }) => {
18
- const [i, o] = w({
19
- id: "",
20
- name: ""
21
- }), h = v(null), j = () => {
22
- const e = { ...s() };
23
- d([...a, e]);
24
- }, b = () => {
25
- if (!n || a.length === 0) return;
26
- const e = a.filter(
27
- (r) => r.id !== n
28
- );
29
- let l = null;
30
- if (e.length > 0) {
31
- const r = a.findIndex((g) => g.id === n), N = Math.min(r, e.length - 1);
32
- l = e[N]?.id || e[0]?.id;
33
- } else {
34
- const r = { ...s() };
35
- e.push(r), l = r.id;
36
- }
37
- d(e), m(l), f(e.find((r) => r.id === l)?.code || "");
38
- }, y = (e) => {
39
- d(
40
- (l) => l.map(
41
- (r) => r.id === i.id ? { ...r, name: e } : r
42
- )
43
- ), o({
44
- id: "",
45
- name: ""
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from '@wordpress/components';
3
+ import { useRef, useState } from '@wordpress/element';
4
+ import { Wrap } from './Wrap.js';
5
+ import { Plus as PlusIcon, Trash as TrashIcon } from '@blockbite/icons';
6
+ import classNames from 'classnames';
7
+ import { TextControl } from './TextControl.js';
8
+ export const SectionList = ({ sections, setSections, activeSection, setActiveSection, Update, newSection, setCode, addons, }) => {
9
+ const [renameSection, setRenameSection] = useState({
10
+ id: '',
11
+ name: '',
46
12
  });
47
- };
48
- return /* @__PURE__ */ t.jsxs(u, { important: !0, className: "w-[200px] border-r", children: [
49
- /* @__PURE__ */ t.jsxs("ul", { className: "h-[calc(100%-80px)] divide-y overflow-auto", children: [
50
- p,
51
- /* @__PURE__ */ t.jsx("li", { children: /* @__PURE__ */ t.jsx("ul", { className: "divide-y border-b", children: a.map((e, l) => /* @__PURE__ */ t.jsxs(
52
- "li",
53
- {
54
- className: "relative m-0",
55
- children: [
56
- /* @__PURE__ */ t.jsx(
57
- "button",
58
- {
59
- className: k(
60
- "text-gray-medium w-full truncate bg-opacity-50 px-3 py-2 text-left text-sm/6 font-semibold hover:bg-easy hover:text-wordpress",
61
- {
62
- "bg-easy": e.id === n
63
- }
64
- ),
65
- onClick: () => {
66
- m(e.id), x(n, e.id);
67
- },
68
- onDoubleClick: () => {
69
- o({
70
- id: e.id,
71
- name: e.name
72
- });
73
- },
74
- children: e.name
75
- }
76
- ),
77
- i.id === e.id && /* @__PURE__ */ t.jsx(
78
- _,
79
- {
80
- className: "absolute left-0 top-0 h-full w-full",
81
- defaultValue: i.name,
82
- onChange: (r) => o({
83
- ...i,
84
- name: r
85
- }),
86
- ref: h,
87
- onBlur: (r) => y(r)
88
- }
89
- )
90
- ]
91
- },
92
- `section__${l}__${e?.id}`
93
- )) }) })
94
- ] }),
95
- /* @__PURE__ */ t.jsxs(u, { className: "flex justify-center gap-2 p-2", children: [
96
- /* @__PURE__ */ t.jsx(
97
- c,
98
- {
99
- onClick: j,
100
- icon: /* @__PURE__ */ t.jsx(C, {}),
101
- variant: "tertiary",
102
- size: "compact",
103
- children: "Add"
13
+ const textFieldRef = useRef(null);
14
+ const addSection = () => {
15
+ const createNewSection = Object.assign({}, newSection());
16
+ setSections([...sections, createNewSection]);
17
+ };
18
+ const removeSection = () => {
19
+ var _a, _b, _c;
20
+ if (!activeSection || sections.length === 0)
21
+ return;
22
+ const newSections = sections.filter((section) => section.id !== activeSection);
23
+ let newActiveSection = null;
24
+ if (newSections.length > 0) {
25
+ // If we're not deleting the last section
26
+ const currentIndex = sections.findIndex((s) => s.id === activeSection);
27
+ const nextIndex = Math.min(currentIndex, newSections.length - 1);
28
+ newActiveSection = ((_a = newSections[nextIndex]) === null || _a === void 0 ? void 0 : _a.id) || ((_b = newSections[0]) === null || _b === void 0 ? void 0 : _b.id);
104
29
  }
105
- ),
106
- /* @__PURE__ */ t.jsx(
107
- c,
108
- {
109
- onClick: b,
110
- icon: /* @__PURE__ */ t.jsx(R, {}),
111
- variant: "tertiary",
112
- size: "compact",
113
- children: "Remove"
30
+ else {
31
+ // If we're deleting the last section, create a new one
32
+ const createNewSection = Object.assign({}, newSection());
33
+ newSections.push(createNewSection);
34
+ newActiveSection = createNewSection.id;
114
35
  }
115
- )
116
- ] })
117
- ] });
118
- };
119
- export {
120
- D as SectionList,
121
- D as default
36
+ setSections(newSections);
37
+ setActiveSection(newActiveSection);
38
+ setCode(((_c = newSections.find((s) => s.id === newActiveSection)) === null || _c === void 0 ? void 0 : _c.code) || '');
39
+ };
40
+ const onBlurHandler = (value) => {
41
+ setSections((prevSections) => prevSections.map((section) => section.id === renameSection.id
42
+ ? Object.assign(Object.assign({}, section), { name: value }) : section));
43
+ setRenameSection({
44
+ id: '',
45
+ name: '',
46
+ });
47
+ };
48
+ return (_jsxs(Wrap, { important: true, className: "w-[200px] border-r", children: [_jsxs("ul", { className: "h-[calc(100%-80px)] divide-y overflow-auto", children: [addons, _jsx("li", { children: _jsx("ul", { className: "divide-y border-b", children: sections.map((section, index) => (_jsxs("li", { className: "relative m-0", children: [_jsx("button", { className: classNames('text-gray-medium w-full truncate bg-opacity-50 px-3 py-2 text-left text-sm/6 font-semibold hover:bg-easy hover:text-wordpress', {
49
+ 'bg-easy': section.id === activeSection,
50
+ }), onClick: () => {
51
+ setActiveSection(section.id);
52
+ Update(activeSection, section.id);
53
+ }, onDoubleClick: () => {
54
+ setRenameSection({
55
+ id: section.id,
56
+ name: section.name,
57
+ });
58
+ }, children: section.name }), renameSection.id === section.id && (_jsx(TextControl, { className: "absolute left-0 top-0 h-full w-full", defaultValue: renameSection.name, onChange: (value) => setRenameSection(Object.assign(Object.assign({}, renameSection), { name: value })), ref: textFieldRef, onBlur: (value) => onBlurHandler(value) }))] }, `section__${index}__${section === null || section === void 0 ? void 0 : section.id}`))) }) })] }), _jsxs(Wrap, { className: "flex justify-center gap-2 p-2", children: [_jsx(Button, { onClick: addSection, icon: _jsx(PlusIcon, {}), variant: "tertiary", size: "compact", children: "Add" }), _jsx(Button, { onClick: removeSection, icon: _jsx(TrashIcon, {}), variant: "tertiary", size: "compact", children: "Remove" })] })] }));
122
59
  };
60
+ export default SectionList;
61
+ //# sourceMappingURL=SectionList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SectionList.js","sourceRoot":"","sources":["../src/SectionList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAqB/C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,QAAQ,EACR,WAAW,EACX,aAAa,EACb,gBAAgB,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E,CAAC,CAAC;wCACpC,CAAC,EACD,aAAa,EAAE,GAAG,EAAE;4CAClB,gBAAgB,CAAC;gDACf,EAAE,EAAE,OAAO,CAAC,EAAE;gDACd,IAAI,EAAE,OAAO,CAAC,IAAI;6CACnB,CAAC,CAAC;wCACL,CAAC,YAEA,OAAO,CAAC,IAAI,GACN,EAER,aAAa,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,IAAI,CAClC,KAAC,WAAW,IACV,SAAS,EAAC,qCAAqC,EAC/C,YAAY,EAAE,aAAa,CAAC,IAAI,EAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,gBAAgB,iCACX,aAAa,KAChB,IAAI,EAAE,KAAK,IACX,EAEJ,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GACvC,CACH,KArCI,YAAY,KAAK,KAAK,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,EAAE,EAAE,CAsCrC,CACN,CAAC,GACC,GACF,IACF,EACL,MAAC,IAAI,IAAC,SAAS,EAAC,+BAA+B,aAC7C,KAAC,MAAM,IACL,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,KAAC,QAAQ,KAAG,EAClB,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,SAAS,oBAGP,EACT,KAAC,MAAM,IACL,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,KAAC,SAAS,KAAG,EACnB,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,SAAS,uBAGP,IACJ,IACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,33 +1,18 @@
1
- import { j as t } from "./node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js";
2
- import { SelectControl as p } from "@wordpress/components";
3
- import { useState as u, useEffect as m } from "@wordpress/element";
4
- const j = ({
5
- onChange: l,
6
- className: a,
7
- defaultValue: n,
8
- options: e,
9
- label: s = ""
10
- }) => {
11
- const [c, o] = u("");
12
- m(() => {
13
- o(n);
14
- }, []);
15
- const i = (r) => {
16
- o(r), l && l(r);
17
- };
18
- return /* @__PURE__ */ t.jsxs("div", { className: a, children: [
19
- e && e.length > 0 && /* @__PURE__ */ t.jsx(
20
- p,
21
- {
22
- label: s || "",
23
- value: c || "",
24
- onChange: i,
25
- options: [{ value: "", label: "Select an option" }, ...e]
26
- }
27
- ),
28
- !e && /* @__PURE__ */ t.jsx("p", { children: "No options available" })
29
- ] });
30
- };
31
- export {
32
- j as SelectControlWrapper
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SelectControl as WordpressSelect } from '@wordpress/components';
3
+ import { useEffect, useState } from '@wordpress/element';
4
+ export const SelectControlWrapper = ({ onChange, className, defaultValue, options, label = '', }) => {
5
+ const [value, setValue] = useState('');
6
+ useEffect(() => {
7
+ setValue(defaultValue);
8
+ // eslint-disable-next-line react-hooks/exhaustive-deps
9
+ }, []);
10
+ const handleChange = (val) => {
11
+ setValue(val);
12
+ if (onChange) {
13
+ onChange(val);
14
+ }
15
+ };
16
+ return (_jsxs("div", { className: className, children: [options && options.length > 0 && (_jsx(WordpressSelect, { label: label || '', value: value || '', onChange: handleChange, options: [{ value: '', label: 'Select an option' }, ...options] })), !options && _jsx("p", { children: "No options available" })] }));
33
17
  };
18
+ //# sourceMappingURL=SelectControlWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectControlWrapper.js","sourceRoot":"","sources":["../src/SelectControlWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAWzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,OAAO,EACP,KAAK,GAAG,EAAE,GACgB,EAAE,EAAE;IAC9B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEvC,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,YAAY,CAAC,CAAC;QACvB,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,EAAE;QACnC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACd,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAE,SAAS,aACtB,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CAChC,KAAC,eAAe,IACd,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,EAAE,GAAG,OAAO,CAAC,GAC/D,CACH,EACA,CAAC,OAAO,IAAI,+CAA2B,IACpC,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -1,19 +1,18 @@
1
- import { j as s } from "./node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js";
2
- import { createBlock as i } from "@wordpress/blocks";
3
- import { Button as a } from "@wordpress/components";
4
- const { select: k, dispatch: d } = wp.data, u = ({
5
- buttonText: c = "Add block"
6
- }) => {
7
- const e = () => {
8
- const r = k("core/block-editor").getSelectedBlock(), { clientId: n, innerBlocks: o } = r, t = o[o.length - 1], l = i(
9
- t.name,
10
- t.attributes,
11
- t.innerBlocks
12
- );
13
- d("core/block-editor").insertBlocks(l, 0, n);
14
- };
15
- return /* @__PURE__ */ s.jsx(a, { variant: "primary", onClick: () => e(), children: c });
16
- };
17
- export {
18
- u as SingleBlockTypeAppender
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createBlock } from '@wordpress/blocks';
3
+ import { Button } from '@wordpress/components';
4
+ const { select, dispatch } = wp.data;
5
+ export const SingleBlockTypeAppender = ({ buttonText = 'Add block', }) => {
6
+ const addLastDuplicate = () => {
7
+ // Get the current block
8
+ const currentBlock = select('core/block-editor').getSelectedBlock();
9
+ const { clientId, innerBlocks } = currentBlock;
10
+ // get the last block
11
+ const lastBlock = innerBlocks[innerBlocks.length - 1];
12
+ // duplicate the last block
13
+ const newBlock = createBlock(lastBlock.name, lastBlock.attributes, lastBlock.innerBlocks);
14
+ dispatch('core/block-editor').insertBlocks(newBlock, 0, clientId);
15
+ };
16
+ return (_jsx(Button, { variant: "primary", onClick: () => addLastDuplicate(), children: buttonText }));
19
17
  };
18
+ //# sourceMappingURL=SingleBlockTypeAppender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SingleBlockTypeAppender.js","sourceRoot":"","sources":["../src/SingleBlockTypeAppender.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC;AAMrC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,UAAU,GAAG,WAAW,GACK,EAAE,EAAE;IACjC,MAAM,gBAAgB,GAAG,GAAG,EAAE;QAC5B,wBAAwB;QACxB,MAAM,YAAY,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC,gBAAgB,EAAE,CAAC;QACpE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC;QAE/C,qBAAqB;QACrB,MAAM,SAAS,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACtD,2BAA2B;QAC3B,MAAM,QAAQ,GAAG,WAAW,CAC1B,SAAS,CAAC,IAAI,EACd,SAAS,CAAC,UAAU,EACpB,SAAS,CAAC,WAAW,CACtB,CAAC;QAEF,QAAQ,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;IACpE,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,EAAE,YACxD,UAAU,GACJ,CACV,CAAC;AACJ,CAAC,CAAC"}
package/dist/SlideIn.d.ts CHANGED
@@ -3,5 +3,5 @@ type SlideInProps = {
3
3
  className?: string;
4
4
  watch?: any;
5
5
  };
6
- export declare const SlideIn: ({ children, watch, className }: SlideInProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const SlideIn: ({ children, watch, className }: SlideInProps) => import("react/jsx-runtime.js").JSX.Element;
7
7
  export {};
package/dist/SlideIn.js CHANGED
@@ -1,28 +1,17 @@
1
- import { j as a } from "./node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js";
2
- import { useState as i, useEffect as m } from "@wordpress/element";
3
- import n from "classnames";
4
- import { Wrap as l } from "./Wrap.js";
5
- const c = ({ children: s, watch: e, className: r }) => {
6
- const [t, o] = i(0);
7
- return m(() => {
8
- setTimeout(() => {
9
- o(1);
10
- }, 250);
11
- }, [e]), /* @__PURE__ */ a.jsx(
12
- l,
13
- {
14
- className: n(
15
- r,
16
- "duration-50 transform transition-all ease-in-out",
17
- {
18
- "translate-x-0": t === 1,
19
- "-translate-x-full": t === 0
20
- }
21
- ),
22
- children: s
23
- }
24
- );
25
- };
26
- export {
27
- c as SlideIn
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from '@wordpress/element';
3
+ import classNames from 'classnames';
4
+ import { Wrap } from './Wrap.js';
5
+ export const SlideIn = ({ children, watch, className }) => {
6
+ const [slide, setSlide] = useState(0);
7
+ useEffect(() => {
8
+ setTimeout(() => {
9
+ setSlide(1);
10
+ }, 250);
11
+ }, [watch]);
12
+ return (_jsx(Wrap, { className: classNames(className, 'duration-50 transform transition-all ease-in-out', {
13
+ 'translate-x-0': slide === 1,
14
+ '-translate-x-full': slide === 0,
15
+ }), children: children }));
28
16
  };
17
+ //# sourceMappingURL=SlideIn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlideIn.js","sourceRoot":"","sources":["../src/SlideIn.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAgB,EAAE,EAAE;IACtE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEtC,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,GAAG,EAAE;YACd,QAAQ,CAAC,CAAC,CAAC,CAAC;QACd,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,UAAU,CACnB,SAAS,EACT,kDAAkD,EAClD;YACE,eAAe,EAAE,KAAK,KAAK,CAAC;YAC5B,mBAAmB,EAAE,KAAK,KAAK,CAAC;SACjC,CACF,YAEA,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC"}
package/dist/Spinner.js CHANGED
@@ -1,15 +1,17 @@
1
- import { j as o } from "./node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js";
2
- import { Spinner as i } from "@wordpress/components";
3
- import { useState as m, useEffect as n } from "@wordpress/element";
4
- import a from "classnames";
5
- const x = ({ className: t, defaultValue: s }) => {
6
- const [e, r] = m(!1);
7
- return n(() => {
8
- setTimeout(() => {
9
- r(!1);
10
- }, 500), s && r(!0);
11
- }, [e, s]), e && /* @__PURE__ */ o.jsx(i, { className: a(t) });
12
- };
13
- export {
14
- x as Spinner
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Spinner as WordpressSpinner } from '@wordpress/components';
3
+ import { useEffect, useState } from '@wordpress/element';
4
+ import classNames from 'classnames';
5
+ export const Spinner = ({ className, defaultValue }) => {
6
+ const [isLoading, setIsLoading] = useState(false);
7
+ useEffect(() => {
8
+ setTimeout(() => {
9
+ setIsLoading(false);
10
+ }, 500);
11
+ if (defaultValue) {
12
+ setIsLoading(true);
13
+ }
14
+ }, [isLoading, defaultValue]);
15
+ return isLoading && _jsx(WordpressSpinner, { className: classNames(className) });
15
16
  };
17
+ //# sourceMappingURL=Spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../src/Spinner.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,UAAU,MAAM,YAAY,CAAC;AAQpC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,SAAS,EAAE,YAAY,EAAgB,EAAE,EAAE;IACnE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,GAAG,EAAE;YACd,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,EAAE,GAAG,CAAC,CAAC;QACR,IAAI,YAAY,EAAE,CAAC;YACjB,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;IAE9B,OAAO,SAAS,IAAI,KAAC,gBAAgB,IAAC,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,GAAI,CAAC;AAC7E,CAAC,CAAC"}
package/dist/Tabs.d.ts CHANGED
@@ -5,7 +5,7 @@ type TabsProps = {
5
5
  onValueChange?: (value: string) => void;
6
6
  children?: React.ReactNode;
7
7
  };
8
- export declare const TabsWrapper: ({ children, defaultValue, value, onValueChange, ...rest }: TabsProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const TabsWrapper: ({ children, defaultValue, value, onValueChange, ...rest }: TabsProps) => import("react/jsx-runtime.js").JSX.Element;
9
9
  type TabsListProps = {
10
10
  options: {
11
11
  name: string;
@@ -16,16 +16,16 @@ type TabsListProps = {
16
16
  onValueChange?: (value: string) => void;
17
17
  className?: string;
18
18
  };
19
- export declare const TabsList: ({ options, children, className, onValueChange, }: TabsListProps) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const TabsList: ({ options, children, className, onValueChange, }: TabsListProps) => import("react/jsx-runtime.js").JSX.Element;
20
20
  type TabsContentProps = {
21
21
  value: string;
22
22
  children: React.ReactNode;
23
23
  className?: string;
24
24
  };
25
- export declare const TabsContent: ({ value, children, className, }: TabsContentProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const TabsContent: ({ value, children, className, }: TabsContentProps) => import("react/jsx-runtime.js").JSX.Element;
26
26
  export declare const Tabs: {
27
- Wrapper: ({ children, defaultValue, value, onValueChange, ...rest }: TabsProps) => import("react/jsx-runtime").JSX.Element;
28
- List: ({ options, children, className, onValueChange, }: TabsListProps) => import("react/jsx-runtime").JSX.Element;
29
- Content: ({ value, children, className, }: TabsContentProps) => import("react/jsx-runtime").JSX.Element;
27
+ Wrapper: ({ children, defaultValue, value, onValueChange, ...rest }: TabsProps) => import("react/jsx-runtime.js").JSX.Element;
28
+ List: ({ options, children, className, onValueChange, }: TabsListProps) => import("react/jsx-runtime.js").JSX.Element;
29
+ Content: ({ value, children, className, }: TabsContentProps) => import("react/jsx-runtime.js").JSX.Element;
30
30
  };
31
31
  export {};
package/dist/Tabs.js CHANGED
@@ -1,52 +1,54 @@
1
- import { j as r } from "./node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js";
2
- import { TabPanel as x } from "@wordpress/components";
3
- import { useState as v, createContext as u, useContext as b } from "@wordpress/element";
4
- import d from "classnames";
5
- import { Wrap as m } from "./Wrap.js";
6
- const i = u(null), f = ({
7
- children: s,
8
- defaultValue: a,
9
- value: t,
10
- onValueChange: e,
11
- ...n
12
- }) => {
13
- const o = t !== void 0, [c, T] = v(a || ""), p = {
14
- activeTab: o ? t : c,
15
- setActiveTab: (l) => {
16
- o || T(l), e && e(l);
17
- }
18
- };
19
- return /* @__PURE__ */ r.jsx(i.Provider, { value: p, children: /* @__PURE__ */ r.jsx(m, { important: !0, className: n.className, children: s }) });
20
- }, j = ({
21
- options: s,
22
- children: a,
23
- className: t,
24
- onValueChange: e
25
- }) => {
26
- const n = b(i), o = e || n?.setActiveTab;
27
- return /* @__PURE__ */ r.jsx(
28
- x,
29
- {
30
- className: d("tabs-list", t),
31
- tabs: s,
32
- onSelect: (c) => {
33
- o(c);
34
- },
35
- children: () => a
36
- }
37
- );
38
- }, C = ({
39
- value: s,
40
- children: a,
41
- className: t
42
- }) => b(i)?.activeTab === s ? /* @__PURE__ */ r.jsx(m, { className: t, children: a }) : null, E = {
43
- Wrapper: f,
44
- List: j,
45
- Content: C
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
46
11
  };
47
- export {
48
- E as Tabs,
49
- C as TabsContent,
50
- j as TabsList,
51
- f as TabsWrapper
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { TabPanel } from '@wordpress/components';
14
+ import { createContext, useContext, useState } from '@wordpress/element';
15
+ import classNames from 'classnames';
16
+ import { Wrap } from './Wrap.js';
17
+ const TabsContext = createContext(null);
18
+ export const TabsWrapper = (_a) => {
19
+ var { children, defaultValue, value, onValueChange } = _a, rest = __rest(_a, ["children", "defaultValue", "value", "onValueChange"]);
20
+ const isControlled = value !== undefined;
21
+ const [internalValue, setInternalValue] = useState(defaultValue || '');
22
+ const activeTab = isControlled ? value : internalValue;
23
+ const handleTabChange = (newValue) => {
24
+ if (!isControlled) {
25
+ setInternalValue(newValue);
26
+ }
27
+ if (onValueChange) {
28
+ onValueChange(newValue);
29
+ }
30
+ };
31
+ const providerValue = {
32
+ activeTab,
33
+ setActiveTab: handleTabChange,
34
+ };
35
+ return (_jsx(TabsContext.Provider, { value: providerValue, children: _jsx(Wrap, { important: true, className: rest.className, children: children }) }));
52
36
  };
37
+ export const TabsList = ({ options, children, className, onValueChange, }) => {
38
+ const context = useContext(TabsContext);
39
+ const setActiveTab = onValueChange ? onValueChange : context === null || context === void 0 ? void 0 : context.setActiveTab;
40
+ return (_jsx(TabPanel, { className: classNames('tabs-list', className), tabs: options, onSelect: (tabName) => {
41
+ setActiveTab(tabName);
42
+ }, children: () => children }));
43
+ };
44
+ export const TabsContent = ({ value, children, className, }) => {
45
+ const context = useContext(TabsContext);
46
+ const activeTab = context === null || context === void 0 ? void 0 : context.activeTab;
47
+ return activeTab === value ? (_jsx(Wrap, { className: className, children: children })) : null;
48
+ };
49
+ export const Tabs = {
50
+ Wrapper: TabsWrapper,
51
+ List: TabsList,
52
+ Content: TabsContent,
53
+ };
54
+ //# sourceMappingURL=Tabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../src/Tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;AA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ACC,EAAE,EAAE;IAClB,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAC;IAE3E,OAAO,CACL,KAAC,QAAQ,IACP,SAAS,EAAE,UAAU,CAAC,WAAW,EAAE,SAAS,CAAC,EAC7C,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE;YACpB,YAAY,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC,YAEA,GAAG,EAAE,CAAC,QAAQ,GACN,CACZ,CAAC;AACJ,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,SAAS,GACQ,EAAE,EAAE;IACrB,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACxC,MAAM,SAAS,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC;IAErC,OAAO,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,CAC3B,KAAC,IAAI,IAAC,SAAS,EAAE,SAAS,YAAG,QAAQ,GAAQ,CAC9C,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,OAAO,EAAE,WAAW;IACpB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,WAAW;CACrB,CAAC"}
package/dist/Tag.js CHANGED
@@ -1,11 +1,6 @@
1
- import { j as s } from "./node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js";
2
- import m from "classnames";
3
- const n = ({
4
- children: r,
5
- onClick: t,
6
- color: o = "blue",
7
- className: e
8
- }) => /* @__PURE__ */ s.jsx("button", { onClick: t, children: /* @__PURE__ */ s.jsx("div", { color: o, className: m(e), children: r }) });
9
- export {
10
- n as Tag
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ export const Tag = ({ children, onClick, color = 'blue', className, }) => {
4
+ return (_jsx("button", { onClick: onClick, children: _jsx("div", { color: color, className: classNames(className), children: children }) }));
11
5
  };
6
+ //# sourceMappingURL=Tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tag.js","sourceRoot":"","sources":["../src/Tag.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AA8BpC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,EAClB,QAAQ,EACR,OAAO,EACP,KAAK,GAAG,MAAM,EACd,SAAS,GACA,EAAE,EAAE;IACb,OAAO,CACL,iBAAQ,OAAO,EAAE,OAAO,YACtB,cAAK,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,YAChD,QAAQ,GACL,GACC,CACV,CAAC;AACJ,CAAC,CAAC"}
@@ -1,51 +1,17 @@
1
- import { j as r } from "./node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js";
2
- import { forwardRef as j } from "@wordpress/element";
3
- import i from "classnames";
4
- import { Wrap as N } from "./Wrap.js";
5
- const g = j(
6
- ({
7
- onClick: t,
8
- onChange: o,
9
- className: x,
10
- defaultValue: l,
11
- children: p,
12
- inputClassName: d,
13
- readOnly: c,
14
- placeholder: u,
15
- onBlur: s,
16
- type: f = "text",
17
- label: m,
18
- helper: a = ""
19
- }, b) => {
20
- const n = `text-control-${Math.random().toString(36).substring(2, 15)}`;
21
- return /* @__PURE__ */ r.jsxs(N, { className: i("flex items-center p-0", x), children: [
22
- m ? /* @__PURE__ */ r.jsx("label", { htmlFor: n, className: "text-primary !m-0 !mb-0 !mr-2", children: m }) : null,
23
- /* @__PURE__ */ r.jsx(
24
- "input",
25
- {
26
- id: n,
27
- className: i(
28
- "border-primary !m-0 !mb-0 h-[32px] !rounded-none border border-opacity-70 focus:outline-none focus:ring-0",
29
- d
30
- ),
31
- type: f,
32
- value: l,
33
- placeholder: u,
34
- onFocus: () => t && t(),
35
- onBlur: (e) => {
36
- t && t(), s && s(e.target.value);
37
- },
38
- onChange: (e) => o && o(e.target.value),
39
- readOnly: c,
40
- ref: b
41
- }
42
- ),
43
- /* @__PURE__ */ r.jsx("span", { children: p }),
44
- a && /* @__PURE__ */ r.jsx("p", { className: "text-primary !m-0 !mb-0 text-xs", children: a })
45
- ] });
46
- }
47
- );
48
- g.displayName = "TextControl";
49
- export {
50
- g as TextControl
51
- };
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from '@wordpress/element';
3
+ import classNames from 'classnames';
4
+ import { Wrap } from './Wrap.js';
5
+ export const TextControl = forwardRef(({ onClick, onChange, className, defaultValue, children, inputClassName, readOnly, placeholder, onBlur, type = 'text', label, helper = '', }, ref) => {
6
+ const fieldId = `text-control-${Math.random()
7
+ .toString(36)
8
+ .substring(2, 15)}`;
9
+ return (_jsxs(Wrap, { className: classNames('flex items-center p-0', className), children: [label ? (_jsx("label", { htmlFor: fieldId, className: "text-primary !m-0 !mb-0 !mr-2", children: label })) : null, _jsx("input", { id: fieldId, className: classNames('border-primary !m-0 !mb-0 h-[32px] !rounded-none border border-opacity-70 focus:outline-none focus:ring-0', inputClassName), type: type, value: defaultValue, placeholder: placeholder, onFocus: () => onClick && onClick(), onBlur: (e) => {
10
+ if (onClick)
11
+ onClick();
12
+ if (onBlur)
13
+ onBlur(e.target.value);
14
+ }, onChange: (e) => onChange && onChange(e.target.value), readOnly: readOnly, ref: ref }), _jsx("span", { children: children }), helper && _jsx("p", { className: "text-primary !m-0 !mb-0 text-xs", children: helper })] }));
15
+ });
16
+ TextControl.displayName = 'TextControl'; // Recommended for debugging
17
+ //# sourceMappingURL=TextControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextControl.js","sourceRoot":"","sources":["../src/TextControl.tsx"],"names":[],"mappings":";AAAA,OAAO,E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