glints-aries 4.0.268 → 4.0.270

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.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconPaginationProps } from './paginationUtils';
3
+ export declare const IconPagination: React.ForwardRefExoticComponent<IconPaginationProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { IconPaginationStyledNav, StyledBorderPaginationButton, StyledLabel } from './PaginationStyle';
3
+ import { Icon } from '../Icon';
4
+ export var IconPagination = /*#__PURE__*/React.forwardRef(function IconPagination(_ref, ref) {
5
+ var label = _ref.label,
6
+ disableNext = _ref.disableNext,
7
+ disablePrevious = _ref.disablePrevious,
8
+ onNext = _ref.onNext,
9
+ onPrevious = _ref.onPrevious;
10
+ return /*#__PURE__*/React.createElement(IconPaginationStyledNav, {
11
+ ref: ref
12
+ }, /*#__PURE__*/React.createElement(StyledBorderPaginationButton, {
13
+ "data-testid": "previous-page",
14
+ disabled: disablePrevious,
15
+ onClick: onPrevious
16
+ }, /*#__PURE__*/React.createElement(Icon, {
17
+ name: "ri-arrow-m-left-line"
18
+ })), label && /*#__PURE__*/React.createElement(StyledLabel, null, label), /*#__PURE__*/React.createElement(StyledBorderPaginationButton, {
19
+ "data-testid": "next-page",
20
+ disabled: disableNext,
21
+ onClick: onNext
22
+ }, /*#__PURE__*/React.createElement(Icon, {
23
+ name: "ri-arrow-m-right-line"
24
+ })));
25
+ });
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ declare const _default: Meta<import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const Interactive: any;
5
+ export declare const WithLabel: any;
@@ -2,7 +2,10 @@ import React from 'react';
2
2
  import { PageButtonProps } from './PageButton';
3
3
  export declare const StyledNav: import("styled-components").StyledComponent<"nav", any, {}, never>;
4
4
  export declare const SimplePaginationStyledNav: import("styled-components").StyledComponent<"nav", any, {}, never>;
5
+ export declare const IconPaginationStyledNav: import("styled-components").StyledComponent<"nav", any, {}, never>;
5
6
  export declare const StyledPageButton: import("styled-components").StyledComponent<"button", any, PageButtonProps, never>;
6
7
  export declare const StyledSimplePaginationButton: import("styled-components").StyledComponent<"button", any, PageButtonProps, never>;
8
+ export declare const StyledBorderPaginationButton: import("styled-components").StyledComponent<"button", any, PageButtonProps, never>;
9
+ export declare const StyledLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
7
10
  export declare const StyledActiveSimplePaginationButton: import("styled-components").StyledComponent<(props: PageButtonProps) => JSX.Element, any, {}, never>;
8
11
  export declare const StyledSimplePaginationInput: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<import("../NumberInput").NumberInputProps & React.RefAttributes<HTMLInputElement>>, any, {}, never>;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { NumberInput } from '../NumberInput';
4
- import { borderRadius2 } from '../utilities/borderRadius';
4
+ import { borderRadius2, borderRadius4 } from '../utilities/borderRadius';
5
5
  import { Blue, Neutral } from '../utilities/colors';
6
- import { space4 } from '../utilities/spacing';
6
+ import { space12, space4 } from '../utilities/spacing';
7
7
  import { PageButton } from './PageButton';
8
8
  export var StyledNav = styled.nav.withConfig({
9
9
  displayName: "PaginationStyle__StyledNav",
@@ -13,21 +13,33 @@ export var SimplePaginationStyledNav = styled(StyledNav).withConfig({
13
13
  displayName: "PaginationStyle__SimplePaginationStyledNav",
14
14
  componentId: "sc-1hi5sa8-1"
15
15
  })(["gap:4px;"]);
16
+ export var IconPaginationStyledNav = styled(StyledNav).withConfig({
17
+ displayName: "PaginationStyle__IconPaginationStyledNav",
18
+ componentId: "sc-1hi5sa8-2"
19
+ })(["gap:0px;align-items:center;column-gap:1px;"]);
16
20
  export var StyledPageButton = styled.button.withConfig({
17
21
  displayName: "PaginationStyle__StyledPageButton",
18
- componentId: "sc-1hi5sa8-2"
22
+ componentId: "sc-1hi5sa8-3"
19
23
  })(["cursor:pointer;height:32px;min-width:32px;border:0;background:transparent;border-radius:", ";padding:", ";color:", ";&:hover{background:", ";}&:disabled{color:", ";}svg{fill:", ";width:24px;height:24px;}&[data-active='true']{background:", ";color:", ";}&:disabled svg{fill:", ";}&[data-active='true']:disabled{background:", ";color:", ";}"], borderRadius2, space4, Neutral.B18, Neutral.B95, Neutral.B85, Neutral.B40, Blue.S08, Blue.S99, Neutral.B85, Neutral.B95, Neutral.B85);
20
24
  export var StyledSimplePaginationButton = styled(StyledPageButton).withConfig({
21
25
  displayName: "PaginationStyle__StyledSimplePaginationButton",
22
- componentId: "sc-1hi5sa8-3"
26
+ componentId: "sc-1hi5sa8-4"
23
27
  })(["pointer-events:none;"]);
28
+ export var StyledBorderPaginationButton = styled(StyledPageButton).withConfig({
29
+ displayName: "PaginationStyle__StyledBorderPaginationButton",
30
+ componentId: "sc-1hi5sa8-5"
31
+ })(["outline:1px solid ", ";height:36px;min-width:36px;svg{vertical-align:middle;}&:first-of-type{border-radius:", " 0 0 ", ";}&:last-of-type{border-radius:0 ", " ", " 0;}&:hover{background:", ";}&:disabled{background:", ";}"], Neutral.B85, borderRadius4, borderRadius4, borderRadius4, borderRadius4, Blue.S08, Neutral.B95);
32
+ export var StyledLabel = styled.div.withConfig({
33
+ displayName: "PaginationStyle__StyledLabel",
34
+ componentId: "sc-1hi5sa8-6"
35
+ })(["padding:0 ", " 0;vertical-align:middle;"], space12);
24
36
  export var StyledActiveSimplePaginationButton = styled(function (props) {
25
37
  return /*#__PURE__*/React.createElement(PageButton, props);
26
38
  }).withConfig({
27
39
  displayName: "PaginationStyle__StyledActiveSimplePaginationButton",
28
- componentId: "sc-1hi5sa8-4"
40
+ componentId: "sc-1hi5sa8-7"
29
41
  })(["background:", ";color:", ";&:hover{background:", ";color:", ";}"], Blue.S08, Blue.S99, Neutral.B95, Neutral.B18);
30
42
  export var StyledSimplePaginationInput = styled(NumberInput).withConfig({
31
43
  displayName: "PaginationStyle__StyledSimplePaginationInput",
32
- componentId: "sc-1hi5sa8-5"
44
+ componentId: "sc-1hi5sa8-8"
33
45
  })(["padding:0;text-align:center;height:32px;width:32px;"]);
@@ -1,3 +1,4 @@
1
1
  export * from './Pagination';
2
+ export * from './IconPagination';
2
3
  export * from './SimplePagination';
3
- export { PaginationProps } from './paginationUtils';
4
+ export { PaginationProps, IconPaginationProps } from './paginationUtils';
@@ -1,3 +1,4 @@
1
1
  export * from './Pagination';
2
+ export * from './IconPagination';
2
3
  export * from './SimplePagination';
3
- export { PaginationProps } from './paginationUtils';
4
+ export { PaginationProps, IconPaginationProps } from './paginationUtils';
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  export declare type PaginationProps = {
2
3
  /** Total items to be displayed, must be positive integer and above 0 */
3
4
  totalItems: number;
@@ -8,6 +9,13 @@ export declare type PaginationProps = {
8
9
  disabled?: boolean;
9
10
  onPageChanged?: (currentPage: number) => void;
10
11
  };
12
+ export declare type IconPaginationProps = {
13
+ label?: React.ReactNode;
14
+ disableNext?: boolean;
15
+ disablePrevious?: boolean;
16
+ onNext?: () => void;
17
+ onPrevious?: () => void;
18
+ };
11
19
  export declare const defaultPageSize = 10;
12
20
  export declare const defaultBufferSize = 2;
13
21
  export declare const getAllPages: (pageSize: number, total: number) => number;
@@ -1,13 +1,31 @@
1
- import React, { TextareaHTMLAttributes } from 'react';
1
+ import React, { TextareaHTMLAttributes, RefObject } from 'react';
2
2
  export declare type TextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange'> & {
3
3
  value: string;
4
4
  onChange: (value: string) => void;
5
5
  error?: boolean;
6
6
  width?: string;
7
+ forwardedRef?: RefObject<HTMLTextAreaElement>;
8
+ /**
9
+ * if true, allows the user to type more than the maxLength.
10
+ * if false, the user will not be able to type more than the maxLength,
11
+ * all the characters typed after the maxLength will be ignored.
12
+ *
13
+ * **defaults to** `true`
14
+ */
15
+ canExceedMaxLength: boolean;
7
16
  };
8
17
  export declare const TextArea: React.ForwardRefExoticComponent<Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> & {
9
18
  value: string;
10
19
  onChange: (value: string) => void;
11
20
  error?: boolean;
12
21
  width?: string;
22
+ forwardedRef?: RefObject<HTMLTextAreaElement>;
23
+ /**
24
+ * if true, allows the user to type more than the maxLength.
25
+ * if false, the user will not be able to type more than the maxLength,
26
+ * all the characters typed after the maxLength will be ignored.
27
+ *
28
+ * **defaults to** `true`
29
+ */
30
+ canExceedMaxLength: boolean;
13
31
  } & React.RefAttributes<HTMLTextAreaElement>>;
@@ -1,10 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["value", "rows", "maxLength", "error", "disabled", "width", "onChange"];
4
- import React, { useEffect, useRef, useState } from 'react';
3
+ var _excluded = ["value", "rows", "maxLength", "error", "disabled", "width", "onChange", "forwardedRef", "canExceedMaxLength"];
4
+ import React, { useRef, useState } from 'react';
5
5
  import { StyledTextAreaContainer, StyledTextArea, StyledWordCountContainer } from './TextAreaStyle';
6
6
  import { Typography } from '../Typography';
7
- export var TextArea = /*#__PURE__*/React.forwardRef(function TextArea(_ref, ref) {
7
+ var _TextArea = function _TextArea(_ref) {
8
8
  var value = _ref.value,
9
9
  _ref$rows = _ref.rows,
10
10
  rows = _ref$rows === void 0 ? 3 : _ref$rows,
@@ -16,28 +16,20 @@ export var TextArea = /*#__PURE__*/React.forwardRef(function TextArea(_ref, ref)
16
16
  _ref$width = _ref.width,
17
17
  width = _ref$width === void 0 ? '520px' : _ref$width,
18
18
  onChange = _ref.onChange,
19
+ forwardedRef = _ref.forwardedRef,
20
+ _ref$canExceedMaxLeng = _ref.canExceedMaxLength,
21
+ canExceedMaxLength = _ref$canExceedMaxLeng === void 0 ? true : _ref$canExceedMaxLeng,
19
22
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
20
- var _useState = useState(0),
21
- charCount = _useState[0],
22
- setCharCount = _useState[1];
23
- var _useState2 = useState(false),
24
- isFocused = _useState2[0],
25
- setIsFocused = _useState2[1];
26
- var isError = error || !!maxLength && charCount > maxLength;
23
+ var _useState = useState(false),
24
+ isFocused = _useState[0],
25
+ setIsFocused = _useState[1];
26
+ var charCount = value.length;
27
+ var hasMaxLengthEnforced = maxLength > 0;
28
+ var hasError = error || canExceedMaxLength && charCount > maxLength;
27
29
  var localRef = useRef(null);
28
- var setRefs = function setRefs(node) {
29
- localRef.current = node;
30
- if (typeof ref === 'function') {
31
- ref(node);
32
- } else if (ref) {
33
- ref.current = node;
34
- }
35
- };
36
- useEffect(function () {
37
- setCharCount(value.length);
38
- }, [value]);
30
+ var textAreaInputRef = forwardedRef || localRef;
39
31
  var handleContainerClick = function handleContainerClick() {
40
- if (localRef.current) {
32
+ if (textAreaInputRef.current) {
41
33
  localRef.current.focus();
42
34
  }
43
35
  };
@@ -46,30 +38,38 @@ export var TextArea = /*#__PURE__*/React.forwardRef(function TextArea(_ref, ref)
46
38
  onChange(val);
47
39
  };
48
40
  return /*#__PURE__*/React.createElement(StyledTextAreaContainer, {
49
- "data-error": isError,
41
+ "data-error": hasError,
50
42
  "data-disabled": disabled,
51
43
  "data-focus": isFocused,
52
- "data-has-counter": !!maxLength,
44
+ "data-has-counter": hasMaxLengthEnforced,
53
45
  width: width,
54
46
  onClick: handleContainerClick
55
47
  }, /*#__PURE__*/React.createElement(StyledTextArea, _extends({
56
- ref: setRefs,
48
+ ref: textAreaInputRef,
57
49
  value: value,
58
50
  rows: rows,
59
51
  width: width,
60
52
  onChange: handleChange,
61
53
  disabled: disabled,
54
+ maxLength: !canExceedMaxLength && maxLength,
62
55
  onFocus: function onFocus() {
63
56
  return setIsFocused(true);
64
57
  },
65
58
  onBlur: function onBlur() {
66
59
  return setIsFocused(false);
67
60
  }
68
- }, props)), !!maxLength && /*#__PURE__*/React.createElement(StyledWordCountContainer, {
61
+ }, props)), hasMaxLengthEnforced && /*#__PURE__*/React.createElement(StyledWordCountContainer, {
69
62
  "data-disabled": disabled,
70
- "data-error": isError
63
+ "data-error": hasError
71
64
  }, /*#__PURE__*/React.createElement(Typography, {
72
65
  as: "span",
73
66
  variant: "overline"
74
67
  }, charCount, " / ", maxLength)));
75
- });
68
+ };
69
+ var forwardRef = function forwardRef(props, ref) {
70
+ return /*#__PURE__*/React.createElement(_TextArea, _extends({}, props, {
71
+ forwardedRef: ref
72
+ }));
73
+ };
74
+ forwardRef.displayName = _TextArea.name;
75
+ export var TextArea = /*#__PURE__*/React.forwardRef(forwardRef);
@@ -26,7 +26,7 @@ export { Link, LinkProps } from './Link';
26
26
  export { Menu, MenuProps } from './Menu';
27
27
  export { Modal, ModalContext, ModalProps, ModalProvider, useModal, } from './Modal';
28
28
  export { NumberInput, NumberInputProps } from './NumberInput';
29
- export { Pagination, PaginationProps, SimplePagination } from './Pagination';
29
+ export { IconPagination, IconPaginationProps, Pagination, PaginationProps, SimplePagination, } from './Pagination';
30
30
  export { PasswordInput, PasswordInputProps } from './PasswordInput';
31
31
  export { Popover, PopoverProps } from './Popover';
32
32
  export { RadioButton, RadioButtonProps } from './RadioButton';
package/es/@next/index.js CHANGED
@@ -27,7 +27,7 @@ export { Link, LinkProps } from './Link';
27
27
  export { Menu, MenuProps } from './Menu';
28
28
  export { Modal, ModalContext, ModalProps, ModalProvider, useModal } from './Modal';
29
29
  export { NumberInput, NumberInputProps } from './NumberInput';
30
- export { Pagination, PaginationProps, SimplePagination } from './Pagination';
30
+ export { IconPagination, IconPaginationProps, Pagination, PaginationProps, SimplePagination } from './Pagination';
31
31
  export { PasswordInput, PasswordInputProps } from './PasswordInput';
32
32
  export { Popover, PopoverProps } from './Popover';
33
33
  export { RadioButton, RadioButtonProps } from './RadioButton';
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconPaginationProps } from './paginationUtils';
3
+ export declare const IconPagination: React.ForwardRefExoticComponent<IconPaginationProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.IconPagination = void 0;
6
+ var _react = _interopRequireDefault(require("react"));
7
+ var _PaginationStyle = require("./PaginationStyle");
8
+ var _Icon = require("../Icon");
9
+ var IconPagination = /*#__PURE__*/_react["default"].forwardRef(function IconPagination(_ref, ref) {
10
+ var label = _ref.label,
11
+ disableNext = _ref.disableNext,
12
+ disablePrevious = _ref.disablePrevious,
13
+ onNext = _ref.onNext,
14
+ onPrevious = _ref.onPrevious;
15
+ return /*#__PURE__*/_react["default"].createElement(_PaginationStyle.IconPaginationStyledNav, {
16
+ ref: ref
17
+ }, /*#__PURE__*/_react["default"].createElement(_PaginationStyle.StyledBorderPaginationButton, {
18
+ "data-testid": "previous-page",
19
+ disabled: disablePrevious,
20
+ onClick: onPrevious
21
+ }, /*#__PURE__*/_react["default"].createElement(_Icon.Icon, {
22
+ name: "ri-arrow-m-left-line"
23
+ })), label && /*#__PURE__*/_react["default"].createElement(_PaginationStyle.StyledLabel, null, label), /*#__PURE__*/_react["default"].createElement(_PaginationStyle.StyledBorderPaginationButton, {
24
+ "data-testid": "next-page",
25
+ disabled: disableNext,
26
+ onClick: onNext
27
+ }, /*#__PURE__*/_react["default"].createElement(_Icon.Icon, {
28
+ name: "ri-arrow-m-right-line"
29
+ })));
30
+ });
31
+ exports.IconPagination = IconPagination;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ declare const _default: Meta<import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const Interactive: any;
5
+ export declare const WithLabel: any;
@@ -2,7 +2,10 @@ import React from 'react';
2
2
  import { PageButtonProps } from './PageButton';
3
3
  export declare const StyledNav: import("styled-components").StyledComponent<"nav", any, {}, never>;
4
4
  export declare const SimplePaginationStyledNav: import("styled-components").StyledComponent<"nav", any, {}, never>;
5
+ export declare const IconPaginationStyledNav: import("styled-components").StyledComponent<"nav", any, {}, never>;
5
6
  export declare const StyledPageButton: import("styled-components").StyledComponent<"button", any, PageButtonProps, never>;
6
7
  export declare const StyledSimplePaginationButton: import("styled-components").StyledComponent<"button", any, PageButtonProps, never>;
8
+ export declare const StyledBorderPaginationButton: import("styled-components").StyledComponent<"button", any, PageButtonProps, never>;
9
+ export declare const StyledLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
7
10
  export declare const StyledActiveSimplePaginationButton: import("styled-components").StyledComponent<(props: PageButtonProps) => JSX.Element, any, {}, never>;
8
11
  export declare const StyledSimplePaginationInput: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<import("../NumberInput").NumberInputProps & React.RefAttributes<HTMLInputElement>>, any, {}, never>;
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
- exports.StyledSimplePaginationInput = exports.StyledSimplePaginationButton = exports.StyledPageButton = exports.StyledNav = exports.StyledActiveSimplePaginationButton = exports.SimplePaginationStyledNav = void 0;
5
+ exports.StyledSimplePaginationInput = exports.StyledSimplePaginationButton = exports.StyledPageButton = exports.StyledNav = exports.StyledLabel = exports.StyledBorderPaginationButton = exports.StyledActiveSimplePaginationButton = exports.SimplePaginationStyledNav = exports.IconPaginationStyledNav = void 0;
6
6
  var _react = _interopRequireDefault(require("react"));
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
8
  var _NumberInput = require("../NumberInput");
@@ -20,25 +20,40 @@ var SimplePaginationStyledNav = (0, _styledComponents["default"])(StyledNav).wit
20
20
  componentId: "sc-1hi5sa8-1"
21
21
  })(["gap:4px;"]);
22
22
  exports.SimplePaginationStyledNav = SimplePaginationStyledNav;
23
+ var IconPaginationStyledNav = (0, _styledComponents["default"])(StyledNav).withConfig({
24
+ displayName: "PaginationStyle__IconPaginationStyledNav",
25
+ componentId: "sc-1hi5sa8-2"
26
+ })(["gap:0px;align-items:center;column-gap:1px;"]);
27
+ exports.IconPaginationStyledNav = IconPaginationStyledNav;
23
28
  var StyledPageButton = _styledComponents["default"].button.withConfig({
24
29
  displayName: "PaginationStyle__StyledPageButton",
25
- componentId: "sc-1hi5sa8-2"
30
+ componentId: "sc-1hi5sa8-3"
26
31
  })(["cursor:pointer;height:32px;min-width:32px;border:0;background:transparent;border-radius:", ";padding:", ";color:", ";&:hover{background:", ";}&:disabled{color:", ";}svg{fill:", ";width:24px;height:24px;}&[data-active='true']{background:", ";color:", ";}&:disabled svg{fill:", ";}&[data-active='true']:disabled{background:", ";color:", ";}"], _borderRadius.borderRadius2, _spacing.space4, _colors.Neutral.B18, _colors.Neutral.B95, _colors.Neutral.B85, _colors.Neutral.B40, _colors.Blue.S08, _colors.Blue.S99, _colors.Neutral.B85, _colors.Neutral.B95, _colors.Neutral.B85);
27
32
  exports.StyledPageButton = StyledPageButton;
28
33
  var StyledSimplePaginationButton = (0, _styledComponents["default"])(StyledPageButton).withConfig({
29
34
  displayName: "PaginationStyle__StyledSimplePaginationButton",
30
- componentId: "sc-1hi5sa8-3"
35
+ componentId: "sc-1hi5sa8-4"
31
36
  })(["pointer-events:none;"]);
32
37
  exports.StyledSimplePaginationButton = StyledSimplePaginationButton;
38
+ var StyledBorderPaginationButton = (0, _styledComponents["default"])(StyledPageButton).withConfig({
39
+ displayName: "PaginationStyle__StyledBorderPaginationButton",
40
+ componentId: "sc-1hi5sa8-5"
41
+ })(["outline:1px solid ", ";height:36px;min-width:36px;svg{vertical-align:middle;}&:first-of-type{border-radius:", " 0 0 ", ";}&:last-of-type{border-radius:0 ", " ", " 0;}&:hover{background:", ";}&:disabled{background:", ";}"], _colors.Neutral.B85, _borderRadius.borderRadius4, _borderRadius.borderRadius4, _borderRadius.borderRadius4, _borderRadius.borderRadius4, _colors.Blue.S08, _colors.Neutral.B95);
42
+ exports.StyledBorderPaginationButton = StyledBorderPaginationButton;
43
+ var StyledLabel = _styledComponents["default"].div.withConfig({
44
+ displayName: "PaginationStyle__StyledLabel",
45
+ componentId: "sc-1hi5sa8-6"
46
+ })(["padding:0 ", " 0;vertical-align:middle;"], _spacing.space12);
47
+ exports.StyledLabel = StyledLabel;
33
48
  var StyledActiveSimplePaginationButton = (0, _styledComponents["default"])(function (props) {
34
49
  return /*#__PURE__*/_react["default"].createElement(_PageButton.PageButton, props);
35
50
  }).withConfig({
36
51
  displayName: "PaginationStyle__StyledActiveSimplePaginationButton",
37
- componentId: "sc-1hi5sa8-4"
52
+ componentId: "sc-1hi5sa8-7"
38
53
  })(["background:", ";color:", ";&:hover{background:", ";color:", ";}"], _colors.Blue.S08, _colors.Blue.S99, _colors.Neutral.B95, _colors.Neutral.B18);
39
54
  exports.StyledActiveSimplePaginationButton = StyledActiveSimplePaginationButton;
40
55
  var StyledSimplePaginationInput = (0, _styledComponents["default"])(_NumberInput.NumberInput).withConfig({
41
56
  displayName: "PaginationStyle__StyledSimplePaginationInput",
42
- componentId: "sc-1hi5sa8-5"
57
+ componentId: "sc-1hi5sa8-8"
43
58
  })(["padding:0;text-align:center;height:32px;width:32px;"]);
44
59
  exports.StyledSimplePaginationInput = StyledSimplePaginationInput;
@@ -1,3 +1,4 @@
1
1
  export * from './Pagination';
2
+ export * from './IconPagination';
2
3
  export * from './SimplePagination';
3
- export { PaginationProps } from './paginationUtils';
4
+ export { PaginationProps, IconPaginationProps } from './paginationUtils';
@@ -2,9 +2,10 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  var _exportNames = {
5
- PaginationProps: true
5
+ PaginationProps: true,
6
+ IconPaginationProps: true
6
7
  };
7
- exports.PaginationProps = void 0;
8
+ exports.PaginationProps = exports.IconPaginationProps = void 0;
8
9
  var _Pagination = require("./Pagination");
9
10
  Object.keys(_Pagination).forEach(function (key) {
10
11
  if (key === "default" || key === "__esModule") return;
@@ -12,6 +13,13 @@ Object.keys(_Pagination).forEach(function (key) {
12
13
  if (key in exports && exports[key] === _Pagination[key]) return;
13
14
  exports[key] = _Pagination[key];
14
15
  });
16
+ var _IconPagination = require("./IconPagination");
17
+ Object.keys(_IconPagination).forEach(function (key) {
18
+ if (key === "default" || key === "__esModule") return;
19
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
+ if (key in exports && exports[key] === _IconPagination[key]) return;
21
+ exports[key] = _IconPagination[key];
22
+ });
15
23
  var _SimplePagination = require("./SimplePagination");
16
24
  Object.keys(_SimplePagination).forEach(function (key) {
17
25
  if (key === "default" || key === "__esModule") return;
@@ -20,4 +28,5 @@ Object.keys(_SimplePagination).forEach(function (key) {
20
28
  exports[key] = _SimplePagination[key];
21
29
  });
22
30
  var _paginationUtils = require("./paginationUtils");
23
- exports.PaginationProps = _paginationUtils.PaginationProps;
31
+ exports.PaginationProps = _paginationUtils.PaginationProps;
32
+ exports.IconPaginationProps = _paginationUtils.IconPaginationProps;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  export declare type PaginationProps = {
2
3
  /** Total items to be displayed, must be positive integer and above 0 */
3
4
  totalItems: number;
@@ -8,6 +9,13 @@ export declare type PaginationProps = {
8
9
  disabled?: boolean;
9
10
  onPageChanged?: (currentPage: number) => void;
10
11
  };
12
+ export declare type IconPaginationProps = {
13
+ label?: React.ReactNode;
14
+ disableNext?: boolean;
15
+ disablePrevious?: boolean;
16
+ onNext?: () => void;
17
+ onPrevious?: () => void;
18
+ };
11
19
  export declare const defaultPageSize = 10;
12
20
  export declare const defaultBufferSize = 2;
13
21
  export declare const getAllPages: (pageSize: number, total: number) => number;
@@ -1,13 +1,31 @@
1
- import React, { TextareaHTMLAttributes } from 'react';
1
+ import React, { TextareaHTMLAttributes, RefObject } from 'react';
2
2
  export declare type TextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'onChange'> & {
3
3
  value: string;
4
4
  onChange: (value: string) => void;
5
5
  error?: boolean;
6
6
  width?: string;
7
+ forwardedRef?: RefObject<HTMLTextAreaElement>;
8
+ /**
9
+ * if true, allows the user to type more than the maxLength.
10
+ * if false, the user will not be able to type more than the maxLength,
11
+ * all the characters typed after the maxLength will be ignored.
12
+ *
13
+ * **defaults to** `true`
14
+ */
15
+ canExceedMaxLength: boolean;
7
16
  };
8
17
  export declare const TextArea: React.ForwardRefExoticComponent<Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> & {
9
18
  value: string;
10
19
  onChange: (value: string) => void;
11
20
  error?: boolean;
12
21
  width?: string;
22
+ forwardedRef?: RefObject<HTMLTextAreaElement>;
23
+ /**
24
+ * if true, allows the user to type more than the maxLength.
25
+ * if false, the user will not be able to type more than the maxLength,
26
+ * all the characters typed after the maxLength will be ignored.
27
+ *
28
+ * **defaults to** `true`
29
+ */
30
+ canExceedMaxLength: boolean;
13
31
  } & React.RefAttributes<HTMLTextAreaElement>>;
@@ -8,10 +8,10 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _TextAreaStyle = require("./TextAreaStyle");
10
10
  var _Typography = require("../Typography");
11
- var _excluded = ["value", "rows", "maxLength", "error", "disabled", "width", "onChange"];
11
+ var _excluded = ["value", "rows", "maxLength", "error", "disabled", "width", "onChange", "forwardedRef", "canExceedMaxLength"];
12
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
- var TextArea = /*#__PURE__*/_react["default"].forwardRef(function TextArea(_ref, ref) {
14
+ var _TextArea = function _TextArea(_ref) {
15
15
  var value = _ref.value,
16
16
  _ref$rows = _ref.rows,
17
17
  rows = _ref$rows === void 0 ? 3 : _ref$rows,
@@ -23,28 +23,20 @@ var TextArea = /*#__PURE__*/_react["default"].forwardRef(function TextArea(_ref,
23
23
  _ref$width = _ref.width,
24
24
  width = _ref$width === void 0 ? '520px' : _ref$width,
25
25
  onChange = _ref.onChange,
26
+ forwardedRef = _ref.forwardedRef,
27
+ _ref$canExceedMaxLeng = _ref.canExceedMaxLength,
28
+ canExceedMaxLength = _ref$canExceedMaxLeng === void 0 ? true : _ref$canExceedMaxLeng,
26
29
  props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
27
- var _useState = (0, _react.useState)(0),
28
- charCount = _useState[0],
29
- setCharCount = _useState[1];
30
- var _useState2 = (0, _react.useState)(false),
31
- isFocused = _useState2[0],
32
- setIsFocused = _useState2[1];
33
- var isError = error || !!maxLength && charCount > maxLength;
30
+ var _useState = (0, _react.useState)(false),
31
+ isFocused = _useState[0],
32
+ setIsFocused = _useState[1];
33
+ var charCount = value.length;
34
+ var hasMaxLengthEnforced = maxLength > 0;
35
+ var hasError = error || canExceedMaxLength && charCount > maxLength;
34
36
  var localRef = (0, _react.useRef)(null);
35
- var setRefs = function setRefs(node) {
36
- localRef.current = node;
37
- if (typeof ref === 'function') {
38
- ref(node);
39
- } else if (ref) {
40
- ref.current = node;
41
- }
42
- };
43
- (0, _react.useEffect)(function () {
44
- setCharCount(value.length);
45
- }, [value]);
37
+ var textAreaInputRef = forwardedRef || localRef;
46
38
  var handleContainerClick = function handleContainerClick() {
47
- if (localRef.current) {
39
+ if (textAreaInputRef.current) {
48
40
  localRef.current.focus();
49
41
  }
50
42
  };
@@ -53,31 +45,39 @@ var TextArea = /*#__PURE__*/_react["default"].forwardRef(function TextArea(_ref,
53
45
  onChange(val);
54
46
  };
55
47
  return /*#__PURE__*/_react["default"].createElement(_TextAreaStyle.StyledTextAreaContainer, {
56
- "data-error": isError,
48
+ "data-error": hasError,
57
49
  "data-disabled": disabled,
58
50
  "data-focus": isFocused,
59
- "data-has-counter": !!maxLength,
51
+ "data-has-counter": hasMaxLengthEnforced,
60
52
  width: width,
61
53
  onClick: handleContainerClick
62
54
  }, /*#__PURE__*/_react["default"].createElement(_TextAreaStyle.StyledTextArea, (0, _extends2["default"])({
63
- ref: setRefs,
55
+ ref: textAreaInputRef,
64
56
  value: value,
65
57
  rows: rows,
66
58
  width: width,
67
59
  onChange: handleChange,
68
60
  disabled: disabled,
61
+ maxLength: !canExceedMaxLength && maxLength,
69
62
  onFocus: function onFocus() {
70
63
  return setIsFocused(true);
71
64
  },
72
65
  onBlur: function onBlur() {
73
66
  return setIsFocused(false);
74
67
  }
75
- }, props)), !!maxLength && /*#__PURE__*/_react["default"].createElement(_TextAreaStyle.StyledWordCountContainer, {
68
+ }, props)), hasMaxLengthEnforced && /*#__PURE__*/_react["default"].createElement(_TextAreaStyle.StyledWordCountContainer, {
76
69
  "data-disabled": disabled,
77
- "data-error": isError
70
+ "data-error": hasError
78
71
  }, /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
79
72
  as: "span",
80
73
  variant: "overline"
81
74
  }, charCount, " / ", maxLength)));
82
- });
75
+ };
76
+ var forwardRef = function forwardRef(props, ref) {
77
+ return /*#__PURE__*/_react["default"].createElement(_TextArea, (0, _extends2["default"])({}, props, {
78
+ forwardedRef: ref
79
+ }));
80
+ };
81
+ forwardRef.displayName = _TextArea.name;
82
+ var TextArea = /*#__PURE__*/_react["default"].forwardRef(forwardRef);
83
83
  exports.TextArea = TextArea;
@@ -26,7 +26,7 @@ export { Link, LinkProps } from './Link';
26
26
  export { Menu, MenuProps } from './Menu';
27
27
  export { Modal, ModalContext, ModalProps, ModalProvider, useModal, } from './Modal';
28
28
  export { NumberInput, NumberInputProps } from './NumberInput';
29
- export { Pagination, PaginationProps, SimplePagination } from './Pagination';
29
+ export { IconPagination, IconPaginationProps, Pagination, PaginationProps, SimplePagination, } from './Pagination';
30
30
  export { PasswordInput, PasswordInputProps } from './PasswordInput';
31
31
  export { Popover, PopoverProps } from './Popover';
32
32
  export { RadioButton, RadioButtonProps } from './RadioButton';
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.TooltipPosition = exports.Tooltip = exports.TextInputProps = exports.TextInput = exports.TextAreaProps = exports.TextArea = exports.TagProps = exports.Tag = exports.TabsProps = exports.Tabs = exports.TableRowProps = exports.TableHeaderProps = exports.TableCellProps = exports.TabProps = exports.TabModel = exports.Tab = exports.Switch = exports.SpinnerProps = exports.Spinner = exports.Spacing = exports.SkeletonTextProps = exports.SkeletonText = exports.SkeletonImageSquareProps = exports.SkeletonImageSquare = exports.SkeletonImageCircleProps = exports.SkeletonImageCircle = exports.SimplePagination = exports.SideSheetProps = exports.SideSheet = exports.SelectProps = exports.Select = exports.RadioButtonProps = exports.RadioButton = exports.PrimaryButton = exports.PopoverProps = exports.Popover = exports.PasswordInputProps = exports.PasswordInput = exports.PaginationProps = exports.Pagination = exports.OutlineMonochromeButton = exports.OutlineButton = exports.NumberInputProps = exports.NumberInput = exports.ModalProvider = exports.ModalProps = exports.ModalContext = exports.Modal = exports.MenuProps = exports.Menu = exports.LinkProps = exports.Link = exports.InlineErrorProps = exports.InlineError = exports.IndexTableProps = exports.IndexTable = exports.IconProps = exports.Icon = exports.Fonts = exports.EmptyState = exports.DropShadow = exports.Divider = exports.DestructiveButton = exports.DataTableProps = exports.DataTable = exports.CurrencyInputProps = exports.CurrencyInput = exports.ComboboxProps = exports.Combobox = exports.Colors = exports.CheckboxProps = exports.Checkbox = exports.CarouselProps = exports.Carousel = exports.CardProps = exports.Card = exports.ButtonProps = exports.ButtonGroupProps = exports.ButtonGroup = exports.Button = exports.Breakpoints = exports.BorderRadius = exports.BarProps = exports.Bar = exports.BannerProps = exports.Banner = exports.BadgeProps = exports.Badge = exports.AvatarProps = exports.Avatar = exports.AlertWithProvider = exports.AlertProvider = exports.AlertProps = exports.AlertContextProps = exports.AlertContext = exports.Alert = exports.ActionListSection = exports.ActionListProps = exports.ActionListItem = exports.ActionList = void 0;
5
- exports.useModal = exports.useIndexResourceState = exports.useAlert = exports.UploadProps = exports.Upload = exports.TypographyProps = exports.Typography = exports.TooltipProps = void 0;
4
+ exports.TextInputProps = exports.TextInput = exports.TextAreaProps = exports.TextArea = exports.TagProps = exports.Tag = exports.TabsProps = exports.Tabs = exports.TableRowProps = exports.TableHeaderProps = exports.TableCellProps = exports.TabProps = exports.TabModel = exports.Tab = exports.Switch = exports.SpinnerProps = exports.Spinner = exports.Spacing = exports.SkeletonTextProps = exports.SkeletonText = exports.SkeletonImageSquareProps = exports.SkeletonImageSquare = exports.SkeletonImageCircleProps = exports.SkeletonImageCircle = exports.SimplePagination = exports.SideSheetProps = exports.SideSheet = exports.SelectProps = exports.Select = exports.RadioButtonProps = exports.RadioButton = exports.PrimaryButton = exports.PopoverProps = exports.Popover = exports.PasswordInputProps = exports.PasswordInput = exports.PaginationProps = exports.Pagination = exports.OutlineMonochromeButton = exports.OutlineButton = exports.NumberInputProps = exports.NumberInput = exports.ModalProvider = exports.ModalProps = exports.ModalContext = exports.Modal = exports.MenuProps = exports.Menu = exports.LinkProps = exports.Link = exports.InlineErrorProps = exports.InlineError = exports.IndexTableProps = exports.IndexTable = exports.IconProps = exports.IconPaginationProps = exports.IconPagination = exports.Icon = exports.Fonts = exports.EmptyState = exports.DropShadow = exports.Divider = exports.DestructiveButton = exports.DataTableProps = exports.DataTable = exports.CurrencyInputProps = exports.CurrencyInput = exports.ComboboxProps = exports.Combobox = exports.Colors = exports.CheckboxProps = exports.Checkbox = exports.CarouselProps = exports.Carousel = exports.CardProps = exports.Card = exports.ButtonProps = exports.ButtonGroupProps = exports.ButtonGroup = exports.Button = exports.Breakpoints = exports.BorderRadius = exports.BarProps = exports.Bar = exports.BannerProps = exports.Banner = exports.BadgeProps = exports.Badge = exports.AvatarProps = exports.Avatar = exports.AlertWithProvider = exports.AlertProvider = exports.AlertProps = exports.AlertContextProps = exports.AlertContext = exports.Alert = exports.ActionListSection = exports.ActionListProps = exports.ActionListItem = exports.ActionList = void 0;
5
+ exports.useModal = exports.useIndexResourceState = exports.useAlert = exports.UploadProps = exports.Upload = exports.TypographyProps = exports.Typography = exports.TooltipProps = exports.TooltipPosition = exports.Tooltip = void 0;
6
6
  var BorderRadius = _interopRequireWildcard(require("./utilities/borderRadius"));
7
7
  exports.BorderRadius = BorderRadius;
8
8
  var Breakpoints = _interopRequireWildcard(require("./utilities/breakpoints"));
@@ -98,6 +98,8 @@ var _NumberInput = require("./NumberInput");
98
98
  exports.NumberInput = _NumberInput.NumberInput;
99
99
  exports.NumberInputProps = _NumberInput.NumberInputProps;
100
100
  var _Pagination = require("./Pagination");
101
+ exports.IconPagination = _Pagination.IconPagination;
102
+ exports.IconPaginationProps = _Pagination.IconPaginationProps;
101
103
  exports.Pagination = _Pagination.Pagination;
102
104
  exports.PaginationProps = _Pagination.PaginationProps;
103
105
  exports.SimplePagination = _Pagination.SimplePagination;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glints-aries",
3
- "version": "4.0.268",
3
+ "version": "4.0.270",
4
4
  "description": "Glints ui-kit for frontend",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",