@dreamtree-org/twreact-ui 1.0.92 → 1.0.94
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/dist/index.esm.js +112 -113
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1053 -1054
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import React__default, { forwardRef, createElement, useId, useRef, useState, useEffect, useImperativeHandle, useMemo, memo, useLayoutEffect, useCallback, createContext, useContext, cloneElement, PureComponent } from 'react';
|
|
3
3
|
import ReactDOM, { createPortal } from 'react-dom';
|
|
4
4
|
|
|
@@ -3907,7 +3907,7 @@ var DEFAULT_ACTIONS = [{
|
|
|
3907
3907
|
onClick: function onClick() {
|
|
3908
3908
|
return console.log("Edit action clicked");
|
|
3909
3909
|
},
|
|
3910
|
-
icon: /*#__PURE__*/
|
|
3910
|
+
icon: /*#__PURE__*/React__default.createElement(PenSquare, {
|
|
3911
3911
|
size: 16
|
|
3912
3912
|
})
|
|
3913
3913
|
}, {
|
|
@@ -3916,7 +3916,7 @@ var DEFAULT_ACTIONS = [{
|
|
|
3916
3916
|
onClick: function onClick() {
|
|
3917
3917
|
return console.log("Delete action clicked");
|
|
3918
3918
|
},
|
|
3919
|
-
icon: /*#__PURE__*/
|
|
3919
|
+
icon: /*#__PURE__*/React__default.createElement(Trash, {
|
|
3920
3920
|
size: 16
|
|
3921
3921
|
})
|
|
3922
3922
|
}, {
|
|
@@ -3925,7 +3925,7 @@ var DEFAULT_ACTIONS = [{
|
|
|
3925
3925
|
onClick: function onClick() {
|
|
3926
3926
|
return console.log("View action clicked");
|
|
3927
3927
|
},
|
|
3928
|
-
icon: /*#__PURE__*/
|
|
3928
|
+
icon: /*#__PURE__*/React__default.createElement(Eye, {
|
|
3929
3929
|
size: 16
|
|
3930
3930
|
})
|
|
3931
3931
|
}];
|
|
@@ -3962,102 +3962,6 @@ function useClickOutside(refs, isActive, onClickOutside) {
|
|
|
3962
3962
|
}, [refs, isActive, onClickOutside]);
|
|
3963
3963
|
}
|
|
3964
3964
|
|
|
3965
|
-
function ownKeys$a(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3966
|
-
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), true).forEach(function (r) { _defineProperty$4(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3967
|
-
|
|
3968
|
-
/**
|
|
3969
|
-
* Action menu dropdown component for table row actions
|
|
3970
|
-
* Uses fixed positioning with smart placement above/below anchor
|
|
3971
|
-
*/
|
|
3972
|
-
var ActionMenu = /*#__PURE__*/memo(function ActionMenu(_ref) {
|
|
3973
|
-
var _ref$actions = _ref.actions,
|
|
3974
|
-
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
3975
|
-
row = _ref.row,
|
|
3976
|
-
onAction = _ref.onAction,
|
|
3977
|
-
menuRef = _ref.menuRef,
|
|
3978
|
-
anchorEl = _ref.anchorEl,
|
|
3979
|
-
onClose = _ref.onClose;
|
|
3980
|
-
var _useState = useState({
|
|
3981
|
-
top: 0,
|
|
3982
|
-
left: 0,
|
|
3983
|
-
visibility: "hidden"
|
|
3984
|
-
}),
|
|
3985
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3986
|
-
pos = _useState2[0],
|
|
3987
|
-
setPos = _useState2[1];
|
|
3988
|
-
useLayoutEffect(function () {
|
|
3989
|
-
if (!anchorEl || !(menuRef !== null && menuRef !== void 0 && menuRef.current) || typeof window === "undefined") {
|
|
3990
|
-
setPos(function (p) {
|
|
3991
|
-
return _objectSpread$a(_objectSpread$a({}, p), {}, {
|
|
3992
|
-
visibility: "hidden"
|
|
3993
|
-
});
|
|
3994
|
-
});
|
|
3995
|
-
return;
|
|
3996
|
-
}
|
|
3997
|
-
var menu = menuRef.current;
|
|
3998
|
-
var rect = anchorEl.getBoundingClientRect();
|
|
3999
|
-
var menuWidth = menu.offsetWidth || 176;
|
|
4000
|
-
var menuHeight = menu.offsetHeight || menu.scrollHeight || 200;
|
|
4001
|
-
var viewportWidth = window.innerWidth;
|
|
4002
|
-
var viewportHeight = window.innerHeight;
|
|
4003
|
-
var scrollX = window.scrollX || window.pageXOffset || 0;
|
|
4004
|
-
var scrollY = window.scrollY || window.pageYOffset || 0;
|
|
4005
|
-
var preferBelowTop = rect.bottom + scrollY + 6;
|
|
4006
|
-
var preferAboveTop = rect.top + scrollY - menuHeight - 6;
|
|
4007
|
-
|
|
4008
|
-
// Calculate horizontal position
|
|
4009
|
-
var left = rect.right + scrollX - menuWidth;
|
|
4010
|
-
if (left < 8) left = 8;
|
|
4011
|
-
if (left + menuWidth > viewportWidth - 8) {
|
|
4012
|
-
left = Math.max(8, viewportWidth - menuWidth - 8);
|
|
4013
|
-
}
|
|
4014
|
-
|
|
4015
|
-
// Calculate vertical position
|
|
4016
|
-
var top;
|
|
4017
|
-
if (preferBelowTop + menuHeight <= scrollY + viewportHeight - 8) {
|
|
4018
|
-
top = preferBelowTop;
|
|
4019
|
-
} else if (preferAboveTop >= scrollY + 8) {
|
|
4020
|
-
top = preferAboveTop;
|
|
4021
|
-
} else {
|
|
4022
|
-
top = Math.max(scrollY + 8, Math.min(preferBelowTop, scrollY + viewportHeight - menuHeight - 8));
|
|
4023
|
-
}
|
|
4024
|
-
setPos({
|
|
4025
|
-
top: top,
|
|
4026
|
-
left: left,
|
|
4027
|
-
visibility: "visible"
|
|
4028
|
-
});
|
|
4029
|
-
}, [anchorEl, menuRef, actions, row]);
|
|
4030
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
4031
|
-
ref: menuRef,
|
|
4032
|
-
className: "absolute right-0 z-50 bg-white rounded-lg shadow-lg ring-1 ring-black ring-opacity-5",
|
|
4033
|
-
style: {
|
|
4034
|
-
visibility: pos.visibility,
|
|
4035
|
-
minWidth: 176
|
|
4036
|
-
},
|
|
4037
|
-
onClick: function onClick(e) {
|
|
4038
|
-
return e.stopPropagation();
|
|
4039
|
-
}
|
|
4040
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
4041
|
-
className: "p-1"
|
|
4042
|
-
}, actions.length === 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
4043
|
-
className: "px-3 py-2 text-sm text-gray-500"
|
|
4044
|
-
}, "No actions") : actions.map(function (action) {
|
|
4045
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
4046
|
-
key: action.name,
|
|
4047
|
-
className: "px-1"
|
|
4048
|
-
}, /*#__PURE__*/React__default.createElement("button", {
|
|
4049
|
-
className: "w-full text-left px-3 py-2 text-sm hover:bg-gray-100 flex items-center gap-2 rounded-md",
|
|
4050
|
-
onClick: function onClick(e) {
|
|
4051
|
-
e.stopPropagation();
|
|
4052
|
-
onAction === null || onAction === void 0 || onAction(action, row);
|
|
4053
|
-
onClose === null || onClose === void 0 || onClose();
|
|
4054
|
-
}
|
|
4055
|
-
}, action.render ? action.render(row) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, action.icon && /*#__PURE__*/React__default.createElement("span", {
|
|
4056
|
-
className: "inline-flex"
|
|
4057
|
-
}, action.icon), /*#__PURE__*/React__default.createElement("span", null, action.label))));
|
|
4058
|
-
})));
|
|
4059
|
-
});
|
|
4060
|
-
|
|
4061
3965
|
/**
|
|
4062
3966
|
* Pagination controls component for the table
|
|
4063
3967
|
* Supports both header (icon-only) and footer (with page numbers) variants
|
|
@@ -4281,6 +4185,102 @@ function MobileFilters(_ref) {
|
|
|
4281
4185
|
})));
|
|
4282
4186
|
}
|
|
4283
4187
|
|
|
4188
|
+
function ownKeys$a(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4189
|
+
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), true).forEach(function (r) { _defineProperty$4(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4190
|
+
|
|
4191
|
+
/**
|
|
4192
|
+
* Action menu dropdown component for table row actions
|
|
4193
|
+
* Uses fixed positioning with smart placement above/below anchor
|
|
4194
|
+
*/
|
|
4195
|
+
var ActionMenu = /*#__PURE__*/memo(function ActionMenu(_ref) {
|
|
4196
|
+
var _ref$actions = _ref.actions,
|
|
4197
|
+
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
4198
|
+
row = _ref.row,
|
|
4199
|
+
onAction = _ref.onAction,
|
|
4200
|
+
menuRef = _ref.menuRef,
|
|
4201
|
+
anchorEl = _ref.anchorEl,
|
|
4202
|
+
onClose = _ref.onClose;
|
|
4203
|
+
var _useState = useState({
|
|
4204
|
+
top: 0,
|
|
4205
|
+
left: 0,
|
|
4206
|
+
visibility: "hidden"
|
|
4207
|
+
}),
|
|
4208
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
4209
|
+
pos = _useState2[0],
|
|
4210
|
+
setPos = _useState2[1];
|
|
4211
|
+
useLayoutEffect(function () {
|
|
4212
|
+
if (!anchorEl || !(menuRef !== null && menuRef !== void 0 && menuRef.current) || typeof window === "undefined") {
|
|
4213
|
+
setPos(function (p) {
|
|
4214
|
+
return _objectSpread$a(_objectSpread$a({}, p), {}, {
|
|
4215
|
+
visibility: "hidden"
|
|
4216
|
+
});
|
|
4217
|
+
});
|
|
4218
|
+
return;
|
|
4219
|
+
}
|
|
4220
|
+
var menu = menuRef.current;
|
|
4221
|
+
var rect = anchorEl.getBoundingClientRect();
|
|
4222
|
+
var menuWidth = menu.offsetWidth || 176;
|
|
4223
|
+
var menuHeight = menu.offsetHeight || menu.scrollHeight || 200;
|
|
4224
|
+
var viewportWidth = window.innerWidth;
|
|
4225
|
+
var viewportHeight = window.innerHeight;
|
|
4226
|
+
var scrollX = window.scrollX || window.pageXOffset || 0;
|
|
4227
|
+
var scrollY = window.scrollY || window.pageYOffset || 0;
|
|
4228
|
+
var preferBelowTop = rect.bottom + scrollY + 6;
|
|
4229
|
+
var preferAboveTop = rect.top + scrollY - menuHeight - 6;
|
|
4230
|
+
|
|
4231
|
+
// Calculate horizontal position
|
|
4232
|
+
var left = rect.right + scrollX - menuWidth;
|
|
4233
|
+
if (left < 8) left = 8;
|
|
4234
|
+
if (left + menuWidth > viewportWidth - 8) {
|
|
4235
|
+
left = Math.max(8, viewportWidth - menuWidth - 8);
|
|
4236
|
+
}
|
|
4237
|
+
|
|
4238
|
+
// Calculate vertical position
|
|
4239
|
+
var top;
|
|
4240
|
+
if (preferBelowTop + menuHeight <= scrollY + viewportHeight - 8) {
|
|
4241
|
+
top = preferBelowTop;
|
|
4242
|
+
} else if (preferAboveTop >= scrollY + 8) {
|
|
4243
|
+
top = preferAboveTop;
|
|
4244
|
+
} else {
|
|
4245
|
+
top = Math.max(scrollY + 8, Math.min(preferBelowTop, scrollY + viewportHeight - menuHeight - 8));
|
|
4246
|
+
}
|
|
4247
|
+
setPos({
|
|
4248
|
+
top: top,
|
|
4249
|
+
left: left,
|
|
4250
|
+
visibility: "visible"
|
|
4251
|
+
});
|
|
4252
|
+
}, [anchorEl, menuRef, actions, row]);
|
|
4253
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
4254
|
+
ref: menuRef,
|
|
4255
|
+
className: "absolute right-0 z-50 bg-white rounded-lg shadow-lg ring-1 ring-black ring-opacity-5",
|
|
4256
|
+
style: {
|
|
4257
|
+
visibility: pos.visibility,
|
|
4258
|
+
minWidth: 176
|
|
4259
|
+
},
|
|
4260
|
+
onClick: function onClick(e) {
|
|
4261
|
+
return e.stopPropagation();
|
|
4262
|
+
}
|
|
4263
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
4264
|
+
className: "p-1"
|
|
4265
|
+
}, actions.length === 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
4266
|
+
className: "px-3 py-2 text-sm text-gray-500"
|
|
4267
|
+
}, "No actions") : actions.map(function (action) {
|
|
4268
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
4269
|
+
key: action.name,
|
|
4270
|
+
className: "px-1"
|
|
4271
|
+
}, /*#__PURE__*/React__default.createElement("button", {
|
|
4272
|
+
className: "w-full text-left px-3 py-2 text-sm hover:bg-gray-100 flex items-center gap-2 rounded-md",
|
|
4273
|
+
onClick: function onClick(e) {
|
|
4274
|
+
e.stopPropagation();
|
|
4275
|
+
onAction === null || onAction === void 0 || onAction(action, row);
|
|
4276
|
+
onClose === null || onClose === void 0 || onClose();
|
|
4277
|
+
}
|
|
4278
|
+
}, action.render ? action.render(row) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, action.icon && /*#__PURE__*/React__default.createElement("span", {
|
|
4279
|
+
className: "inline-flex"
|
|
4280
|
+
}, action.icon), /*#__PURE__*/React__default.createElement("span", null, action.label))));
|
|
4281
|
+
})));
|
|
4282
|
+
});
|
|
4283
|
+
|
|
4284
4284
|
/**
|
|
4285
4285
|
* Desktop table row component
|
|
4286
4286
|
*/
|
|
@@ -17758,7 +17758,7 @@ var canUseDOM = () => !!(typeof window !== "undefined" && typeof window.document
|
|
|
17758
17758
|
var isDOM = /* @__PURE__ */ canUseDOM();
|
|
17759
17759
|
var isRunningInReactNative = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
17760
17760
|
var isReactNative = /* @__PURE__ */ isRunningInReactNative();
|
|
17761
|
-
var getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? React
|
|
17761
|
+
var getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? React.useLayoutEffect : React.useEffect;
|
|
17762
17762
|
var useIsomorphicLayoutEffect = /* @__PURE__ */ getUseIsomorphicLayoutEffect();
|
|
17763
17763
|
|
|
17764
17764
|
// src/components/Context.ts
|
|
@@ -17768,17 +17768,17 @@ var gT = typeof globalThis !== "undefined" ? globalThis : (
|
|
|
17768
17768
|
{}
|
|
17769
17769
|
);
|
|
17770
17770
|
function getContext() {
|
|
17771
|
-
if (!React
|
|
17771
|
+
if (!React.createContext) return {};
|
|
17772
17772
|
const contextMap = gT[ContextKey] ??= /* @__PURE__ */ new Map();
|
|
17773
|
-
let realContext = contextMap.get(React
|
|
17773
|
+
let realContext = contextMap.get(React.createContext);
|
|
17774
17774
|
if (!realContext) {
|
|
17775
|
-
realContext = React
|
|
17775
|
+
realContext = React.createContext(
|
|
17776
17776
|
null
|
|
17777
17777
|
);
|
|
17778
17778
|
if (process.env.NODE_ENV !== "production") {
|
|
17779
17779
|
realContext.displayName = "ReactRedux";
|
|
17780
17780
|
}
|
|
17781
|
-
contextMap.set(React
|
|
17781
|
+
contextMap.set(React.createContext, realContext);
|
|
17782
17782
|
}
|
|
17783
17783
|
return realContext;
|
|
17784
17784
|
}
|
|
@@ -17787,7 +17787,7 @@ var ReactReduxContext = /* @__PURE__ */ getContext();
|
|
|
17787
17787
|
// src/components/Provider.tsx
|
|
17788
17788
|
function Provider(providerProps) {
|
|
17789
17789
|
const { children, context, serverState, store } = providerProps;
|
|
17790
|
-
const contextValue = React
|
|
17790
|
+
const contextValue = React.useMemo(() => {
|
|
17791
17791
|
const subscription = createSubscription(store);
|
|
17792
17792
|
const baseContextValue = {
|
|
17793
17793
|
store,
|
|
@@ -17804,7 +17804,7 @@ function Provider(providerProps) {
|
|
|
17804
17804
|
});
|
|
17805
17805
|
}
|
|
17806
17806
|
}, [store, serverState]);
|
|
17807
|
-
const previousState = React
|
|
17807
|
+
const previousState = React.useMemo(() => store.getState(), [store]);
|
|
17808
17808
|
useIsomorphicLayoutEffect(() => {
|
|
17809
17809
|
const { subscription } = contextValue;
|
|
17810
17810
|
subscription.onStateChange = subscription.notifyNestedSubs;
|
|
@@ -17818,14 +17818,14 @@ function Provider(providerProps) {
|
|
|
17818
17818
|
};
|
|
17819
17819
|
}, [contextValue, previousState]);
|
|
17820
17820
|
const Context = context || ReactReduxContext;
|
|
17821
|
-
return /* @__PURE__ */ React
|
|
17821
|
+
return /* @__PURE__ */ React.createElement(Context.Provider, { value: contextValue }, children);
|
|
17822
17822
|
}
|
|
17823
17823
|
var Provider_default = Provider;
|
|
17824
17824
|
|
|
17825
17825
|
// src/hooks/useReduxContext.ts
|
|
17826
17826
|
function createReduxContextHook(context = ReactReduxContext) {
|
|
17827
17827
|
return function useReduxContext2() {
|
|
17828
|
-
const contextValue = React
|
|
17828
|
+
const contextValue = React.useContext(context);
|
|
17829
17829
|
if (process.env.NODE_ENV !== "production" && !contextValue) {
|
|
17830
17830
|
throw new Error(
|
|
17831
17831
|
"could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
|
|
@@ -17886,8 +17886,8 @@ function createSelectorHook(context = ReactReduxContext) {
|
|
|
17886
17886
|
}
|
|
17887
17887
|
const reduxContext = useReduxContext2();
|
|
17888
17888
|
const { store, subscription, getServerState } = reduxContext;
|
|
17889
|
-
const firstRun = React
|
|
17890
|
-
const wrappedSelector = React
|
|
17889
|
+
const firstRun = React.useRef(true);
|
|
17890
|
+
const wrappedSelector = React.useCallback(
|
|
17891
17891
|
{
|
|
17892
17892
|
[selector.name](state) {
|
|
17893
17893
|
const selected = selector(state);
|
|
@@ -17950,7 +17950,7 @@ function createSelectorHook(context = ReactReduxContext) {
|
|
|
17950
17950
|
wrappedSelector,
|
|
17951
17951
|
equalityFn
|
|
17952
17952
|
);
|
|
17953
|
-
React
|
|
17953
|
+
React.useDebugValue(selectedState);
|
|
17954
17954
|
return selectedState;
|
|
17955
17955
|
};
|
|
17956
17956
|
Object.assign(useSelector2, {
|
|
@@ -26310,4 +26310,3 @@ var StoreProvider = function StoreProvider(_ref) {
|
|
|
26310
26310
|
};
|
|
26311
26311
|
|
|
26312
26312
|
export { Accordion, Alert, Avatar, Badge, Breadcrumbs, Button, Card, Checkbox, ColorPicker, DatePicker, DateRangePicker, Dialog, EmitterClass as Emitter, FileUpload, FootNav, Form, Helpers, Input, Loader, LocationPicker, Navbar, Pagination, PriceRangePicker, ProgressBar, Radio, Rate, RoundedTag, Select, Sidebar, Skeleton, Stepper, StoreProvider, Switch, Table, Tabs, ThemeProvider, ThreeDotPopoverSimple as ThreeDotPopover, Toast, ToastContainer, Tooltip, cn$1 as cn, useApi, useMixins, useTheme, useToast };
|
|
26313
|
-
//# sourceMappingURL=index.esm.js.map
|