@paygreen/pgui 2.13.0 → 2.13.1

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.
@@ -13,3 +13,4 @@ export { default as Slider } from './slider';
13
13
  export { default as Switch } from './switch';
14
14
  export { default as Tag } from './tag';
15
15
  export { default as Textarea } from './textarea';
16
+ export { default as Tooltip } from './tooltip';
@@ -19,6 +19,9 @@ declare const _default: {
19
19
  _focusVisible: {
20
20
  boxShadow: string;
21
21
  };
22
+ _placeholder: {
23
+ color: string;
24
+ };
22
25
  };
23
26
  addon: {
24
27
  borderRadius: string;
@@ -40,6 +43,9 @@ declare const _default: {
40
43
  bg: string;
41
44
  boxShadow: string;
42
45
  };
46
+ _placeholder: {
47
+ color: string;
48
+ };
43
49
  };
44
50
  addon: {
45
51
  borderRadius: string;
@@ -12,6 +12,9 @@ declare const _default: {
12
12
  _focusVisible: {
13
13
  boxShadow: string;
14
14
  };
15
+ _placeholder: {
16
+ color: string;
17
+ };
15
18
  };
16
19
  filled: (props: any) => {
17
20
  bg: string;
@@ -28,6 +31,9 @@ declare const _default: {
28
31
  bg: string;
29
32
  boxShadow: string;
30
33
  };
34
+ _placeholder: {
35
+ color: string;
36
+ };
31
37
  };
32
38
  };
33
39
  };
@@ -20,6 +20,9 @@ declare const _default: {
20
20
  _focusVisible: {
21
21
  boxShadow: string;
22
22
  };
23
+ _placeholder: {
24
+ color: string;
25
+ };
23
26
  };
24
27
  filled: (props: any) => {
25
28
  bg: string;
@@ -36,6 +39,9 @@ declare const _default: {
36
39
  bg: string;
37
40
  boxShadow: string;
38
41
  };
42
+ _placeholder: {
43
+ color: string;
44
+ };
39
45
  };
40
46
  };
41
47
  defaultProps: {
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ baseStyle: {
3
+ fontSize: string;
4
+ borderRadius: string;
5
+ padding: string;
6
+ };
7
+ };
8
+ export default _default;
package/dist/esm/index.js CHANGED
@@ -46981,9 +46981,34 @@ var PaginationButtonNextPage = function (_a) {
46981
46981
  };
46982
46982
  var PaginationInfo = function (_a) {
46983
46983
  var rest = __rest$c(_a, []);
46984
- var _b = useContext(PaginationContext), isLoadingPage = _b.isLoadingPage, page = _b.page, lastPage = _b.lastPage, setPage = _b.setPage;
46984
+ var _b = useContext(PaginationContext), isLoadingPage = _b.isLoadingPage, page = _b.page, firstPage = _b.firstPage, lastPage = _b.lastPage, setPage = _b.setPage;
46985
46985
  var _c = useState(false), isEdit = _c[0], setIsEdit = _c[1];
46986
+ var _d = useState(page), inputValue = _d[0], setInputValue = _d[1];
46986
46987
  var numberInputRef = useRef(null);
46988
+ /**
46989
+ * Handles the page change event.
46990
+ *
46991
+ * @param {string} value - The value from the input field.
46992
+ * @returns {number} The new page number.
46993
+ *
46994
+ * The function first tries to parse the input value to an integer.
46995
+ * If the input is not a number, it defaults to the `firstPage`.
46996
+ * If the input exceeds the `lastPage`, it sets the page to the `lastPage`.
46997
+ * If the input is less than `firstPage`, it sets the page to the `firstPage`.
46998
+ */
46999
+ var handlePageChange = function (value) {
47000
+ var newPage = parseInt(value, 10);
47001
+ if (isNaN(newPage)) {
47002
+ newPage = firstPage; // default to first page if input is not a number
47003
+ }
47004
+ else if (newPage >= parseInt(lastPage, 10)) {
47005
+ newPage = lastPage; // set to last page if input exceeds last page
47006
+ }
47007
+ else if (newPage < parseInt(firstPage, 10)) {
47008
+ newPage = firstPage; // set to first page if input is less than first page
47009
+ }
47010
+ return newPage;
47011
+ };
46987
47012
  useEffect(function () {
46988
47013
  var _a;
46989
47014
  if (isEdit) {
@@ -46997,14 +47022,23 @@ var PaginationInfo = function (_a) {
46997
47022
  }, cursor: "pointer", wrap: "nowrap" }, rest),
46998
47023
  React__default.createElement(React__default.Fragment, null, !isLoadingPage && (React__default.createElement(React__default.Fragment, null,
46999
47024
  !isEdit && (React__default.createElement(Text, { as: "span", cursor: "pointer" }, page)),
47000
- isEdit && (React__default.createElement(NumberInput, { w: 20, min: 1, max: lastPage, onChange: function (value) {
47001
- var newPage = value
47002
- ? parseInt(value, 10) >= parseInt(lastPage, 10)
47003
- ? lastPage
47004
- : value
47005
- : 1;
47006
- setPage(parseInt(newPage, 10));
47007
- }, defaultValue: page, size: "sm", onBlur: function () { return setIsEdit(false); } },
47025
+ isEdit && (React__default.createElement(NumberInput, { w: 20, min: 1, max: lastPage, onBlur: function (event) {
47026
+ var value = event.target.value;
47027
+ var newPage = handlePageChange(value);
47028
+ setPage(newPage);
47029
+ setIsEdit(false);
47030
+ }, onChange: function (value) {
47031
+ var newPage = handlePageChange(value);
47032
+ setInputValue(newPage);
47033
+ }, onKeyDown: function (event) {
47034
+ if (event.key === 'Enter') {
47035
+ event.preventDefault();
47036
+ var value = inputValue;
47037
+ var newPage = handlePageChange(String(value));
47038
+ setPage(newPage);
47039
+ setIsEdit(false);
47040
+ }
47041
+ }, defaultValue: page, size: "sm" },
47008
47042
  React__default.createElement(NumberInputField, { ref: numberInputRef }),
47009
47043
  React__default.createElement(NumberInputStepper, null,
47010
47044
  React__default.createElement(NumberIncrementStepper, null),
@@ -55774,7 +55808,10 @@ var SelectInner = function (_a, ref) {
55774
55808
  }); })), getComponentStyles('control', function (_a) {
55775
55809
  var isFocused = _a.isFocused, isDisabled = _a.isDisabled;
55776
55810
  return (__assign$g(__assign$g(__assign$g({ color: fieldTextColor, fontSize: fieldFontSize, height: 'fit-content', minHeight: fieldHeight, borderRadius: fieldBorderRadius, borderColor: fieldBorderColor, backgroundColor: fieldBg, ':hover': {
55777
- borderColor: theme.colors.gray[300],
55811
+ borderColor: !!isError && !isFocused ? fieldErrorBorderColor : fieldBorderColor,
55812
+ backgroundColor: isLightMode
55813
+ ? theme.colors.gray['100']
55814
+ : theme.colors.gray['700'],
55778
55815
  cursor: 'text'
55779
55816
  } }, getConditionalStyles(isFocused && fieldFocusBorderColor, {
55780
55817
  borderColor: fieldFocusBorderColor,
@@ -55784,9 +55821,13 @@ var SelectInner = function (_a, ref) {
55784
55821
  }
55785
55822
  })), getConditionalStyles(!!isError, {
55786
55823
  borderColor: fieldErrorBorderColor,
55787
- boxShadow: "0 0 0 1px ".concat(fieldErrorBorderColor),
55824
+ boxShadow: "none",
55825
+ borderWidth: '1px',
55788
55826
  '&:hover': {
55789
- borderColor: fieldErrorBorderColor
55827
+ borderColor: fieldErrorBorderColor,
55828
+ boxShadow: "none",
55829
+ borderWidth: '1px',
55830
+ borderStyle: 'solid'
55790
55831
  }
55791
55832
  })), getConditionalStyles(isDisabled, {
55792
55833
  opacity: 0.6
@@ -56323,6 +56364,9 @@ var Input = {
56323
56364
  },
56324
56365
  _focusVisible: {
56325
56366
  boxShadow: "0 0 0 1px ".concat(props.theme.colors.gray[300])
56367
+ },
56368
+ _placeholder: {
56369
+ color: 'gray.500'
56326
56370
  }
56327
56371
  },
56328
56372
  addon: {
@@ -56344,6 +56388,9 @@ var Input = {
56344
56388
  _focusVisible: {
56345
56389
  bg: props.colorMode === 'light' ? 'gray.200' : 'gray.800',
56346
56390
  boxShadow: "0 0 0 1px ".concat(props.theme.colors.gray[300])
56391
+ },
56392
+ _placeholder: {
56393
+ color: 'gray.500'
56347
56394
  }
56348
56395
  },
56349
56396
  addon: {
@@ -56480,6 +56527,14 @@ var textarea = {
56480
56527
  defaultProps: defaultProps
56481
56528
  };
56482
56529
 
56530
+ var tooltip = {
56531
+ baseStyle: {
56532
+ fontSize: 'sm',
56533
+ borderRadius: 'md',
56534
+ padding: '0.5rem'
56535
+ }
56536
+ };
56537
+
56483
56538
  var components = /*#__PURE__*/Object.freeze({
56484
56539
  __proto__: null,
56485
56540
  Alert: alert,
@@ -56496,7 +56551,8 @@ var components = /*#__PURE__*/Object.freeze({
56496
56551
  Slider: slider,
56497
56552
  Switch: _switch,
56498
56553
  Tag: tag,
56499
- Textarea: textarea
56554
+ Textarea: textarea,
56555
+ Tooltip: tooltip
56500
56556
  });
56501
56557
 
56502
56558
  var colors = {