@portnet/ui 0.1.23 → 0.1.25

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.
@@ -49,7 +49,7 @@ const StyledDateMuiTextField = (0, _styles.styled)( /*#__PURE__*/React.forwardRe
49
49
  }
50
50
  }));
51
51
  const TimePickerDialog = _ref => {
52
- var _ref2, _position$top, _ref3, _ref4;
52
+ var _ref2, _ref3;
53
53
  let {
54
54
  open,
55
55
  selectedDate,
@@ -81,31 +81,22 @@ const TimePickerDialog = _ref => {
81
81
  PaperProps: {
82
82
  elevation: 5,
83
83
  sx: {
84
- backgroundColor: "white",
84
+ position: "fixed",
85
+ alignContent: "center",
86
+ justifyContent: "center",
85
87
  alignItems: "center",
86
- display: "flex",
88
+ backgroundColor: "white",
89
+ height: 58,
87
90
  width: 340,
88
91
  maxWidth: "720px!important",
89
- position: "fixed",
90
- height: 48,
91
92
  left: (_ref2 = (position === null || position === void 0 ? void 0 : position.left) - 420 / 2) !== null && _ref2 !== void 0 ? _ref2 : 0,
92
- top: (_position$top = position === null || position === void 0 ? void 0 : position.top) !== null && _position$top !== void 0 ? _position$top : 0,
93
- paddingLeft: 0
93
+ top: (_ref3 = (position === null || position === void 0 ? void 0 : position.top) + 36) !== null && _ref3 !== void 0 ? _ref3 : 36
94
94
  }
95
95
  },
96
96
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
97
97
  sx: {
98
98
  display: "flex",
99
- alignItems: "center",
100
- alignContent: "center",
101
- marginTop: 1,
102
- gap: 2,
103
- width: 340,
104
- justifyContent: "center",
105
- left: (_ref3 = (position === null || position === void 0 ? void 0 : position.left) - 380 / 2) !== null && _ref3 !== void 0 ? _ref3 : 0,
106
- top: (_ref4 = (position === null || position === void 0 ? void 0 : position.top) + 36) !== null && _ref4 !== void 0 ? _ref4 : 36,
107
- paddingLeft: 1.5,
108
- position: "fixed"
99
+ gap: 1
109
100
  },
110
101
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTextField.default, {
111
102
  id: "time",
@@ -138,7 +129,7 @@ const TimePickerDialog = _ref => {
138
129
  })
139
130
  });
140
131
  };
141
- const PuiStandardDateTimeField = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
132
+ const PuiStandardDateTimeField = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
142
133
  let {
143
134
  id,
144
135
  className,
@@ -160,8 +151,8 @@ const PuiStandardDateTimeField = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
160
151
  helperText,
161
152
  onChange,
162
153
  onBlur
163
- } = _ref5,
164
- rest = _objectWithoutProperties(_ref5, _excluded);
154
+ } = _ref4,
155
+ rest = _objectWithoutProperties(_ref4, _excluded);
165
156
  const textFieldRef = React.useRef(null);
166
157
  const [dateTime, setDateTime] = React.useState(value || null);
167
158
  const minDateObj = minDate ? (0, _moment.default)(minDate, format).toDate() : undefined;
@@ -184,8 +175,9 @@ const PuiStandardDateTimeField = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
184
175
  };
185
176
  React.useEffect(() => {
186
177
  const updatePosition = () => {
187
- if (textFieldRef.current) {
178
+ if (textFieldRef !== null && textFieldRef !== void 0 && textFieldRef.current) {
188
179
  const rect = textFieldRef.current.getBoundingClientRect();
180
+ console.log("rect : ", rect);
189
181
  setDialogPosition({
190
182
  left: rect.left + rect.width / 2 + window.scrollX,
191
183
  top: rect.top > 310 ? rect.top - 80 : rect.top + 80
@@ -202,7 +194,7 @@ const PuiStandardDateTimeField = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
202
194
  }, []);
203
195
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
204
196
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.DatePicker, _objectSpread({
205
- ref: ref,
197
+ ref: textFieldRef,
206
198
  sx: sx,
207
199
  ampm: false,
208
200
  label: label,
@@ -246,7 +238,7 @@ const PuiStandardDateTimeField = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
246
238
  })]
247
239
  });
248
240
  });
249
- const PuiFormikDateTimeField = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
241
+ const PuiFormikDateTimeField = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
250
242
  let {
251
243
  id,
252
244
  className,
@@ -268,8 +260,8 @@ const PuiFormikDateTimeField = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
268
260
  helperText,
269
261
  onChange,
270
262
  onBlur
271
- } = _ref6,
272
- rest = _objectWithoutProperties(_ref6, _excluded2);
263
+ } = _ref5,
264
+ rest = _objectWithoutProperties(_ref5, _excluded2);
273
265
  const [field, meta] = (0, _formik.useField)(name);
274
266
  const formikContext = (0, _formik.useFormikContext)();
275
267
  const [hasError, setHasError] = React.useState(false);
@@ -316,7 +308,7 @@ const PuiFormikDateTimeField = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
316
308
  onBlur: handleBlur
317
309
  }, rest));
318
310
  });
319
- const PuiDateTimeField = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
311
+ const PuiDateTimeField = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
320
312
  let {
321
313
  formik,
322
314
  id,
@@ -339,8 +331,8 @@ const PuiDateTimeField = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
339
331
  helperText,
340
332
  onChange,
341
333
  onBlur
342
- } = _ref7,
343
- rest = _objectWithoutProperties(_ref7, _excluded3);
334
+ } = _ref6,
335
+ rest = _objectWithoutProperties(_ref6, _excluded3);
344
336
  return /*#__PURE__*/React.createElement(formik ? PuiFormikDateTimeField : PuiStandardDateTimeField, _objectSpread({
345
337
  ref,
346
338
  id,
@@ -15,7 +15,7 @@ var React = _interopRequireWildcard(require("react"));
15
15
  var _apperance = require("../../config/apperance");
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
17
  const _excluded = ["baseId", "children", "value", "index"],
18
- _excluded2 = ["id", "className", "sx", "variant", "centered", "children"];
18
+ _excluded2 = ["id", "className", "sx", "variant", "centered", "children"]; // Define TabPanel component
19
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -48,39 +48,47 @@ const TabPanel = _ref => {
48
48
  })
49
49
  }));
50
50
  };
51
+ TabPanel.propTypes = {
52
+ baseId: _propTypes.default.string.isRequired,
53
+ children: _propTypes.default.node,
54
+ value: _propTypes.default.number.isRequired,
55
+ index: _propTypes.default.number.isRequired
56
+ };
57
+
58
+ // Define function to get Tab properties
51
59
  const getTabProps = (baseId, index) => {
52
60
  return {
53
61
  id: "".concat(baseId, "-").concat(index),
54
62
  "aria-controls": "".concat(baseId, "panel-").concat(index)
55
63
  };
56
64
  };
65
+
66
+ // Define styled Tabs component
57
67
  const StyledTabs = (0, _styles.styled)( /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tabs, _objectSpread({
58
68
  ref: ref
59
- }, props))))(() => {
60
- return {
61
- "&.MuiTabs-root": {
62
- "& .MuiTab-root": {
63
- fontWeight: "600",
64
- fontSize: ".8rem"
65
- },
66
- "& .Mui-selected": {
67
- color: _apperance.palette.primary,
68
- background: "#d0d6e0"
69
- },
70
- "& .MuiTabs-indicator": {
71
- backgroundColor: "#d1eaff",
72
- height: "3px"
73
- },
74
- "&:hover": {
75
- color: "#40a9ff",
76
- opacity: 1
77
- },
78
- "&.Mui-focusVisible": {
79
- backgroundColor: "#d1eaff"
80
- }
69
+ }, props))))(() => ({
70
+ "&.MuiTabs-root": {
71
+ "& .MuiTab-root": {
72
+ fontWeight: "600",
73
+ fontSize: ".8rem",
74
+ borderRadius: "8px",
75
+ // Make tabs rounded
76
+ margin: "0 4px",
77
+ // Add space between tabs
78
+ minHeight: "36px" // Adjust minimum height if necessary
79
+ },
80
+ "& .Mui-selected": {
81
+ color: "#fff",
82
+ // Change this to white for selected tab text
83
+ background: "#1976d2" // Change this to blue for selected tab background
84
+ },
85
+ "& .MuiTabs-indicator": {
86
+ backgroundColor: "transparent" // Make the indicator transparent
81
87
  }
82
- };
83
- });
88
+ }
89
+ }));
90
+
91
+ // Define PuiTabs component
84
92
  const PuiTabs = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
85
93
  let {
86
94
  id,
@@ -103,7 +111,7 @@ const PuiTabs = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
103
111
  ref: ref,
104
112
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
105
113
  sx: {
106
- borderBottom: "2px solid ".concat(_apperance.palette.gray.dark)
114
+ borderBottom: "1px solid ".concat(_apperance.palette.gray.dark) // Adjust border bottom
107
115
  },
108
116
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledTabs, _objectSpread(_objectSpread({
109
117
  value: value,
@@ -136,7 +144,8 @@ PuiTabs.propTypes = {
136
144
  className: _propTypes.default.string,
137
145
  sx: _propTypes.default.object,
138
146
  variant: _propTypes.default.oneOf(["fullWidth", "scrollable", "standard"]),
139
- centered: _propTypes.default.bool
147
+ centered: _propTypes.default.bool,
148
+ children: _propTypes.default.node.isRequired
140
149
  };
141
150
  PuiTabs.defaultProps = {
142
151
  variant: "standard",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portnet/ui",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "Portnet UI",
5
5
  "keywords": [
6
6
  "react",