@paygreen/pgui 2.13.0 → 2.13.2

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/cjs/index.js CHANGED
@@ -47007,9 +47007,34 @@ var PaginationButtonNextPage = function (_a) {
47007
47007
  };
47008
47008
  var PaginationInfo = function (_a) {
47009
47009
  var rest = __rest$c(_a, []);
47010
- var _b = React.useContext(PaginationContext), isLoadingPage = _b.isLoadingPage, page = _b.page, lastPage = _b.lastPage, setPage = _b.setPage;
47010
+ var _b = React.useContext(PaginationContext), isLoadingPage = _b.isLoadingPage, page = _b.page, firstPage = _b.firstPage, lastPage = _b.lastPage, setPage = _b.setPage;
47011
47011
  var _c = React.useState(false), isEdit = _c[0], setIsEdit = _c[1];
47012
+ var _d = React.useState(page), inputValue = _d[0], setInputValue = _d[1];
47012
47013
  var numberInputRef = React.useRef(null);
47014
+ /**
47015
+ * Handles the page change event.
47016
+ *
47017
+ * @param {string} value - The value from the input field.
47018
+ * @returns {number} The new page number.
47019
+ *
47020
+ * The function first tries to parse the input value to an integer.
47021
+ * If the input is not a number, it defaults to the `firstPage`.
47022
+ * If the input exceeds the `lastPage`, it sets the page to the `lastPage`.
47023
+ * If the input is less than `firstPage`, it sets the page to the `firstPage`.
47024
+ */
47025
+ var handlePageChange = function (value) {
47026
+ var newPage = parseInt(value, 10);
47027
+ if (isNaN(newPage)) {
47028
+ newPage = firstPage; // default to first page if input is not a number
47029
+ }
47030
+ else if (newPage >= parseInt(lastPage, 10)) {
47031
+ newPage = lastPage; // set to last page if input exceeds last page
47032
+ }
47033
+ else if (newPage < parseInt(firstPage, 10)) {
47034
+ newPage = firstPage; // set to first page if input is less than first page
47035
+ }
47036
+ return newPage;
47037
+ };
47013
47038
  React.useEffect(function () {
47014
47039
  var _a;
47015
47040
  if (isEdit) {
@@ -47023,14 +47048,23 @@ var PaginationInfo = function (_a) {
47023
47048
  }, cursor: "pointer", wrap: "nowrap" }, rest),
47024
47049
  React__default["default"].createElement(React__default["default"].Fragment, null, !isLoadingPage && (React__default["default"].createElement(React__default["default"].Fragment, null,
47025
47050
  !isEdit && (React__default["default"].createElement(react.Text, { as: "span", cursor: "pointer" }, page)),
47026
- isEdit && (React__default["default"].createElement(react.NumberInput, { w: 20, min: 1, max: lastPage, onChange: function (value) {
47027
- var newPage = value
47028
- ? parseInt(value, 10) >= parseInt(lastPage, 10)
47029
- ? lastPage
47030
- : value
47031
- : 1;
47032
- setPage(parseInt(newPage, 10));
47033
- }, defaultValue: page, size: "sm", onBlur: function () { return setIsEdit(false); } },
47051
+ isEdit && (React__default["default"].createElement(react.NumberInput, { w: 20, min: 1, max: lastPage, onBlur: function (event) {
47052
+ var value = event.target.value;
47053
+ var newPage = handlePageChange(value);
47054
+ setPage(newPage);
47055
+ setIsEdit(false);
47056
+ }, onChange: function (value) {
47057
+ var newPage = handlePageChange(value);
47058
+ setInputValue(newPage);
47059
+ }, onKeyDown: function (event) {
47060
+ if (event.key === 'Enter') {
47061
+ event.preventDefault();
47062
+ var value = inputValue;
47063
+ var newPage = handlePageChange(String(value));
47064
+ setPage(newPage);
47065
+ setIsEdit(false);
47066
+ }
47067
+ }, defaultValue: page, size: "sm" },
47034
47068
  React__default["default"].createElement(react.NumberInputField, { ref: numberInputRef }),
47035
47069
  React__default["default"].createElement(react.NumberInputStepper, null,
47036
47070
  React__default["default"].createElement(react.NumberIncrementStepper, null),
@@ -55800,7 +55834,10 @@ var SelectInner = function (_a, ref) {
55800
55834
  }); })), getComponentStyles('control', function (_a) {
55801
55835
  var isFocused = _a.isFocused, isDisabled = _a.isDisabled;
55802
55836
  return (__assign$g(__assign$g(__assign$g({ color: fieldTextColor, fontSize: fieldFontSize, height: 'fit-content', minHeight: fieldHeight, borderRadius: fieldBorderRadius, borderColor: fieldBorderColor, backgroundColor: fieldBg, ':hover': {
55803
- borderColor: theme.colors.gray[300],
55837
+ borderColor: !!isError && !isFocused ? fieldErrorBorderColor : fieldBorderColor,
55838
+ backgroundColor: isLightMode
55839
+ ? theme.colors.gray['100']
55840
+ : theme.colors.gray['700'],
55804
55841
  cursor: 'text'
55805
55842
  } }, getConditionalStyles(isFocused && fieldFocusBorderColor, {
55806
55843
  borderColor: fieldFocusBorderColor,
@@ -55810,9 +55847,13 @@ var SelectInner = function (_a, ref) {
55810
55847
  }
55811
55848
  })), getConditionalStyles(!!isError, {
55812
55849
  borderColor: fieldErrorBorderColor,
55813
- boxShadow: "0 0 0 1px ".concat(fieldErrorBorderColor),
55850
+ boxShadow: "none",
55851
+ borderWidth: '1px',
55814
55852
  '&:hover': {
55815
- borderColor: fieldErrorBorderColor
55853
+ borderColor: fieldErrorBorderColor,
55854
+ boxShadow: "none",
55855
+ borderWidth: '1px',
55856
+ borderStyle: 'solid'
55816
55857
  }
55817
55858
  })), getConditionalStyles(isDisabled, {
55818
55859
  opacity: 0.6
@@ -55902,7 +55943,7 @@ var SideNav = function (_a) {
55902
55943
  }
55903
55944
  var flexBgGradient = useColorModeValue(theme.colors.gradients.primary, 'linear(to-l, gray.900, gray.900)');
55904
55945
  var color = useColorModeValue('white', 'gray.50');
55905
- return (React__default["default"].createElement(react.Flex, __assign$g({ w: "20rem", h: "100vh", flexDir: "column", bgGradient: flexBgGradient, color: color, pt: 6, px: 6, overflow: "auto", position: "fixed", top: "0", left: "0", sx: customScrollBar }, props), children));
55946
+ return (React__default["default"].createElement(react.Flex, __assign$g({ w: "18rem", h: "100vh", flexDir: "column", bgGradient: flexBgGradient, color: color, pt: 6, px: 6, overflow: "auto", position: "fixed", top: "0", left: "0", sx: customScrollBar }, props), children));
55906
55947
  };
55907
55948
  var SideNavContainer = function (props) { return (React__default["default"].createElement(react.VStack, __assign$g({ spacing: 6, alignItems: "inherit", minH: "100%" }, props))); };
55908
55949
  var SideNavHeader = function (_a) {
@@ -55925,7 +55966,7 @@ var SideNavMenu = function (_a) {
55925
55966
  };
55926
55967
  var color = useColorModeValue('white', 'gray.100');
55927
55968
  return (React__default["default"].createElement(react.VStack, __assign$g({ spacing: 1, alignItems: "inherit", h: "full", w: "full" }, rest),
55928
- React__default["default"].createElement(react.Text, __assign$g({ fontSize: "lg", fontWeight: "bold", color: color, textTransform: "uppercase" }, textProps), title),
55969
+ React__default["default"].createElement(react.Text, __assign$g({ fontWeight: "bold", color: color, textTransform: "uppercase" }, textProps), title),
55929
55970
  children));
55930
55971
  };
55931
55972
  var SideNavMenuItem = function (_a) {
@@ -55937,10 +55978,10 @@ var SideNavMenuItem = function (_a) {
55937
55978
  if (isActive) {
55938
55979
  var bg = useColorModeValue('white', 'gray.800');
55939
55980
  var color = useColorModeValue('brand.600', 'gray.200');
55940
- return (React__default["default"].createElement(react.Button, __assign$g({ w: "full", justifyContent: "flex-start", background: bg, color: color, fontSize: 'lg' }, rest), children));
55981
+ return (React__default["default"].createElement(react.Button, __assign$g({ w: "full", justifyContent: "flex-start", background: bg, color: color }, rest), children));
55941
55982
  }
55942
55983
  var btnColor = useColorModeValue('brand.50', 'gray.200');
55943
- return (React__default["default"].createElement(react.Button, __assign$g({ w: "full", justifyContent: "flex-start", background: "transparent", color: btnColor, fontSize: 'lg', _hover: { background: 'whiteAlpha.200' }, _focus: { background: 'whiteAlpha.200' }, _active: { background: 'whiteAlpha.200' } }, rest), children));
55984
+ return (React__default["default"].createElement(react.Button, __assign$g({ w: "full", justifyContent: "flex-start", background: "transparent", color: btnColor, _hover: { background: 'whiteAlpha.200' }, _focus: { background: 'whiteAlpha.200' }, _active: { background: 'whiteAlpha.200' } }, rest), children));
55944
55985
  };
55945
55986
 
55946
55987
  var TopBar = function (props) { return (React__default["default"].createElement(react.Stack, __assign$g({ minH: "4.6875rem", bg: react.useColorModeValue('white', 'gray.900'), boxShadow: "layout", w: "full", borderRadius: "0", justifyContent: "space-between", spacing: 2, alignItems: { base: 'inherit', xl: 'center' }, direction: { base: 'column', xl: 'row' }, py: { base: 4, xl: 0 } }, props))); };
@@ -56349,6 +56390,9 @@ var Input = {
56349
56390
  },
56350
56391
  _focusVisible: {
56351
56392
  boxShadow: "0 0 0 1px ".concat(props.theme.colors.gray[300])
56393
+ },
56394
+ _placeholder: {
56395
+ color: 'gray.500'
56352
56396
  }
56353
56397
  },
56354
56398
  addon: {
@@ -56370,6 +56414,9 @@ var Input = {
56370
56414
  _focusVisible: {
56371
56415
  bg: props.colorMode === 'light' ? 'gray.200' : 'gray.800',
56372
56416
  boxShadow: "0 0 0 1px ".concat(props.theme.colors.gray[300])
56417
+ },
56418
+ _placeholder: {
56419
+ color: 'gray.500'
56373
56420
  }
56374
56421
  },
56375
56422
  addon: {
@@ -56506,6 +56553,14 @@ var textarea = {
56506
56553
  defaultProps: defaultProps
56507
56554
  };
56508
56555
 
56556
+ var tooltip = {
56557
+ baseStyle: {
56558
+ fontSize: 'sm',
56559
+ borderRadius: 'md',
56560
+ padding: '0.5rem'
56561
+ }
56562
+ };
56563
+
56509
56564
  var components = /*#__PURE__*/Object.freeze({
56510
56565
  __proto__: null,
56511
56566
  Alert: alert,
@@ -56522,7 +56577,8 @@ var components = /*#__PURE__*/Object.freeze({
56522
56577
  Slider: slider,
56523
56578
  Switch: _switch,
56524
56579
  Tag: tag,
56525
- Textarea: textarea
56580
+ Textarea: textarea,
56581
+ Tooltip: tooltip
56526
56582
  });
56527
56583
 
56528
56584
  var colors = {
@@ -56622,7 +56678,7 @@ var largeSizes = {
56622
56678
  '3xs': '14rem',
56623
56679
  '2xs': '16rem',
56624
56680
  xs: '20rem',
56625
- nav: '20rem',
56681
+ nav: '18rem',
56626
56682
  sm: '24rem',
56627
56683
  md: '28rem',
56628
56684
  lg: '32rem',
@@ -56910,7 +56966,10 @@ var externalsStyles = function (props) {
56910
56966
  return Object.values(rawStyle).reduce(function (acc, cur) { return (__assign$g(__assign$g({}, acc), (typeof cur === 'function' ? cur(props) : cur))); }, {});
56911
56967
  };
56912
56968
  var styles = {
56913
- global: function (props) { return (__assign$g({ '#chakra-toast-portal > *': {
56969
+ global: function (props) { return (__assign$g({ body: {
56970
+ fontFamily: 'body',
56971
+ fontSize: 'md'
56972
+ }, '#chakra-toast-portal > *': {
56914
56973
  pt: 'safe-top',
56915
56974
  pl: 'safe-left',
56916
56975
  pr: 'safe-right',