@perawallet/react-ui-toolkit 2.0.0-beta.0

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.
Files changed (116) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -0
  3. package/dist/Button.js +1 -0
  4. package/dist/Checkbox.js +1 -0
  5. package/dist/DateTimer-DIYsxSVY.js +1 -0
  6. package/dist/DateTimer.js +1 -0
  7. package/dist/FileInput.js +1 -0
  8. package/dist/FileUploadButton.js +1 -0
  9. package/dist/FormField.js +1 -0
  10. package/dist/Input.js +1 -0
  11. package/dist/List.js +1 -0
  12. package/dist/ListItem.js +1 -0
  13. package/dist/NumberInput.js +1 -0
  14. package/dist/PasswordInput.js +1 -0
  15. package/dist/ProgressBar.js +1 -0
  16. package/dist/Radio.js +1 -0
  17. package/dist/RadioGroup.js +1 -0
  18. package/dist/Select-CMiQfdu3.js +1 -0
  19. package/dist/Select.js +1 -0
  20. package/dist/Spinner.js +1 -0
  21. package/dist/Switch.js +1 -0
  22. package/dist/Textarea.js +1 -0
  23. package/dist/TimeInput.js +1 -0
  24. package/dist/Toast-9FKOjJle.js +1 -0
  25. package/dist/Toast.js +1 -0
  26. package/dist/Toggle.js +1 -0
  27. package/dist/TypeaheadInput.js +1 -0
  28. package/dist/TypeaheadSelect.js +1 -0
  29. package/dist/arrayUtils-BZ-V_2c9.js +1 -0
  30. package/dist/button/Button.d.ts +25 -0
  31. package/dist/button/file-upload/FileUploadButton.d.ts +9 -0
  32. package/dist/check-BSS-LBT3.js +1 -0
  33. package/dist/core/utils/array/arrayUtils.d.ts +13 -0
  34. package/dist/core/utils/device/deviceUtils.d.ts +2 -0
  35. package/dist/core/utils/dom/domUtils.d.ts +2 -0
  36. package/dist/core/utils/function/functionUtils.d.ts +7 -0
  37. package/dist/core/utils/hooks/useDateTimer.d.ts +17 -0
  38. package/dist/core/utils/hooks/useDebounce.d.ts +2 -0
  39. package/dist/core/utils/hooks/useOnClickOutside.d.ts +2 -0
  40. package/dist/core/utils/keyboard/keyboardEventConstants.d.ts +16 -0
  41. package/dist/core/utils/number/numberConstants.d.ts +5 -0
  42. package/dist/core/utils/number/numberTypes.d.ts +7 -0
  43. package/dist/core/utils/number/numberUtils.d.ts +44 -0
  44. package/dist/core/utils/string/stringConstants.d.ts +2 -0
  45. package/dist/core/utils/string/stringUtils.d.ts +5 -0
  46. package/dist/core/utils/test/testUtils.d.ts +19 -0
  47. package/dist/core/utils/time/timeConstants.d.ts +13 -0
  48. package/dist/core/utils/time/timeTypes.d.ts +13 -0
  49. package/dist/core/utils/time/timeUtils.d.ts +42 -0
  50. package/dist/date-timer/DateTimer.d.ts +4 -0
  51. package/dist/date-timer/util/dateTimerTypes.d.ts +18 -0
  52. package/dist/date-timer/util/dateTimerUtils.d.ts +7 -0
  53. package/dist/form/field/FormField.d.ts +14 -0
  54. package/dist/form/field/message/FormFieldMessage.d.ts +9 -0
  55. package/dist/form/input/Input.d.ts +14 -0
  56. package/dist/form/input/checkbox/CheckboxInput.d.ts +14 -0
  57. package/dist/form/input/file/FileInput.d.ts +19 -0
  58. package/dist/form/input/number/NumberInput.d.ts +6 -0
  59. package/dist/form/input/number/util/numberInputTypes.d.ts +14 -0
  60. package/dist/form/input/number/util/numberInputUtils.d.ts +42 -0
  61. package/dist/form/input/radio/RadioInput.d.ts +24 -0
  62. package/dist/form/input/radio/group/RadioGroup.d.ts +12 -0
  63. package/dist/form/input/typeahead/TypeaheadInput.d.ts +27 -0
  64. package/dist/form/input/util/inputTypes.d.ts +12 -0
  65. package/dist/form/password-input/PasswordInput.d.ts +9 -0
  66. package/dist/form/textarea/Textarea.d.ts +22 -0
  67. package/dist/form/time-input/TimeInput.d.ts +10 -0
  68. package/dist/index.d.ts +93 -0
  69. package/dist/index.js +1 -0
  70. package/dist/keyboardEventConstants-BL5de2V9.js +1 -0
  71. package/dist/list/List.d.ts +26 -0
  72. package/dist/list/description-term/DescriptionTerm.d.ts +16 -0
  73. package/dist/list/item/ListItem.d.ts +17 -0
  74. package/dist/list/util/listUtils.d.ts +7 -0
  75. package/dist/main.css +703 -0
  76. package/dist/numberUtils-CMCFc8Kh.js +1 -0
  77. package/dist/progress-bar/ProgressBar.d.ts +20 -0
  78. package/dist/select/Select.d.ts +19 -0
  79. package/dist/select/content/SelectContent.d.ts +9 -0
  80. package/dist/select/group/SelectGroup.d.ts +8 -0
  81. package/dist/select/item/SelectItem.d.ts +17 -0
  82. package/dist/select/item-list/SelectItemList.d.ts +13 -0
  83. package/dist/select/trigger/SelectTrigger.d.ts +6 -0
  84. package/dist/select/typeahead/TypeaheadSelect.d.ts +26 -0
  85. package/dist/select/typeahead/trigger/TypeheadSelectTrigger.d.ts +20 -0
  86. package/dist/select/typeahead/util/typeaheadSelectUtils.d.ts +3 -0
  87. package/dist/select/util/context/SelectContext.d.ts +7 -0
  88. package/dist/select/util/context/SelectContext.reducer.d.ts +3 -0
  89. package/dist/select/util/hook/useMultiSelect.d.ts +14 -0
  90. package/dist/select/util/hook/useSelectClassName.d.ts +12 -0
  91. package/dist/select/util/hook/useSelectKeyDown.d.ts +18 -0
  92. package/dist/select/util/hook/useSingleSelect.d.ts +13 -0
  93. package/dist/select/util/selectTypes.d.ts +40 -0
  94. package/dist/select/util/selectUtils.d.ts +9 -0
  95. package/dist/spinner/Spinner.d.ts +7 -0
  96. package/dist/switch/Switch.d.ts +10 -0
  97. package/dist/tab/Tab.d.ts +27 -0
  98. package/dist/tab/header/item/TabHeaderItem.d.ts +11 -0
  99. package/dist/tag/Tag.d.ts +15 -0
  100. package/dist/tag/util/tagUtils.d.ts +4 -0
  101. package/dist/timeUtils-BvuzU1KM.js +1 -0
  102. package/dist/toast/Toast.d.ts +11 -0
  103. package/dist/toast/ToastItemContext.d.ts +5 -0
  104. package/dist/toast/ToastProvider.d.ts +17 -0
  105. package/dist/toast/close-button/ToastCloseButton.d.ts +8 -0
  106. package/dist/toast/stack/ToastStack.d.ts +6 -0
  107. package/dist/toast/util/toastConstants.d.ts +4 -0
  108. package/dist/toast/util/toastHooks.d.ts +28 -0
  109. package/dist/toast/util/toastReducer.d.ts +5 -0
  110. package/dist/toast/util/toastTypes.d.ts +39 -0
  111. package/dist/toast/util/toastUtils.d.ts +3 -0
  112. package/dist/toggle/Toggle.d.ts +18 -0
  113. package/dist/toggle/item/ToggleItem.d.ts +11 -0
  114. package/dist/toggle/util/ToggleContext.d.ts +8 -0
  115. package/dist/useDebounce-CP74COv3.js +1 -0
  116. package/package.json +110 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Hipo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ # @perawallet/react-ui-toolkit 🧩
2
+
3
+ Pera Wallet's React based UI Toolkit.
4
+
5
+ A fork of [studiobakers/react-ui-toolkit](https://github.com/studiobakers/react-ui-toolkit)
6
+ by [Studio Bakers](https://github.com/studiobakers) (formerly Hipo), published upstream as
7
+ [@hipo/react-ui-toolkit](https://www.npmjs.com/package/@hipo/react-ui-toolkit). See
8
+ [Credits](#credits).
9
+
10
+ ## Getting started
11
+
12
+ First, install the package via npm:
13
+
14
+ ```bash
15
+ npm install @perawallet/react-ui-toolkit
16
+ ```
17
+
18
+ After installing the package you should import the main CSS file to gather the initial styles of the components, and then import the components you want to use in your project.:
19
+
20
+ ```javascript
21
+ import {FormField, Input} from "@perawallet/react-ui-toolkit/dist/Input";
22
+
23
+ // This import required to gather the initial styles of the components
24
+ // You can do it while bootstrapping your app
25
+ import "@perawallet/react-ui-toolkit/dist/main.css";
26
+
27
+ function LoginForm() {
28
+ return (
29
+ <form>
30
+ <FormField label="E-mail">
31
+ <Input name="email" />
32
+ </FormField>
33
+
34
+ <FormField label="Password">
35
+ <Input name="password" type="password" />
36
+ </FormField>
37
+
38
+ <Button type="submit">Login</Button>
39
+ </form>
40
+ );
41
+ }
42
+ ```
43
+
44
+ ### How to style components?
45
+
46
+ Every component holds a minimum amount of CSS. You can modify them via the CSS variables. See `_colors.scss` and `_measurement.scss`
47
+
48
+ Here is a simple example that shows how to customize `Button` and `Input` styles by overriding the default CSS variables:
49
+
50
+ ```scss
51
+ .button {
52
+ // Override the default button styles using CSS variables
53
+
54
+ --button-bg: #989898;
55
+ --button-color: black;
56
+ }
57
+
58
+ .input {
59
+ // Override the default input styles using CSS variables
60
+
61
+ --default-border-color: black;
62
+ }
63
+ ```
64
+
65
+ ## Development
66
+
67
+ [Storybook](#storybook) is suggested for the development environment. It allows you to see the components in isolation and interact with them. It also supports hot-reloading, i.e. when you change the component, it automatically reloads the component in the browser.
68
+
69
+ First of all, you need to install the dependencies, in the project root folder, run:
70
+
71
+ ```bash
72
+ npm install
73
+ ```
74
+
75
+ > ⚠️ Make sure you are using the exact version of `node` and `npm` that are specified in the `engines` field of [package.json](/package.json) file. Otherwise, you may face some unexpected issues.
76
+
77
+ ### Storybook
78
+
79
+ Storybook is a development environment for UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components.
80
+
81
+ To run the Storybook development server on your local environment, you can use the following command:
82
+
83
+ ```bash
84
+ npm run storybook
85
+ ```
86
+
87
+ To generate a static build of the Storybook (usually, you don't need this. This is only necessary when you want to publish it to somewhere), you can use the following command:
88
+
89
+ ```bash
90
+ npm run storybook:build
91
+ ```
92
+
93
+ ### Production Build
94
+
95
+ Releases are automated by GitHub Actions. Pushing a `v*` tag whose version matches
96
+ `package.json` runs the gates (lint, type-check, tests, build, production audit) and publishes to
97
+ npm with provenance. See [.github/workflows/release.yml](/.github/workflows/release.yml).
98
+
99
+ ```bash
100
+ # after the version bump is merged
101
+ git tag v2.0.0 && git push origin v2.0.0
102
+ ```
103
+
104
+ A tag ending in a hyphenated prerelease (`v2.1.0-beta.1`) publishes under the `beta` dist-tag
105
+ instead of `latest`.
106
+
107
+ ---
108
+
109
+ If you need to generate a production ready build for some reason, use:
110
+
111
+ ```bash
112
+ npm run build
113
+ ```
114
+
115
+ This will generate a `dist` folder that contains the compiled components.
116
+
117
+ ## Credits
118
+
119
+ This project is a fork of [**studiobakers/react-ui-toolkit**](https://github.com/studiobakers/react-ui-toolkit),
120
+ created and maintained by [Studio Bakers](https://github.com/studiobakers) (formerly Hipo) and
121
+ published on npm as [@hipo/react-ui-toolkit](https://www.npmjs.com/package/@hipo/react-ui-toolkit).
122
+ Every component here originates from their work.
123
+
124
+ The fork exists so Pera Wallet can ship changes it needs on its own schedule — currently React 19,
125
+ date-fns 4, Storybook 10 and Biome. It is published under the `@perawallet` scope because the
126
+ `@hipo` scope belongs to the upstream authors.
127
+
128
+ The original MIT licence and copyright notice are retained verbatim in [LICENSE](/LICENSE).
package/dist/Button.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var t=require("react/jsx-runtime"),e=require("classnames"),n=require("react"),s=require("./Spinner.js");const i=n.forwardRef(function(n,i){const{testid:o,type:a="button",onClick:r,children:u,customSpinner:l,customClassName:c,shouldPreventDefault:d=!0,shouldStopPropagation:p=!0,shouldFocus:b,shouldDisplaySpinner:m,isDisabled:f,...h}=n,v=Boolean(f||m),j=e("button",c,{"button--is-inactive":v,"button--is-pending":m}),x=l||t.jsx("div",{className:"button__spinner-container",children:t.jsx(s,{customClassName:"button__spinner","aria-label":"Button spinner visible. Button inactivated."})});return t.jsxs("button",{ref:i,"data-testid":o,className:j,type:a,autoFocus:b,onClick:function(t){r&&(d&&t.preventDefault(),p&&t.stopPropagation(),v||r(t))},disabled:v,...h,children:[u,m&&x]})});module.exports=i;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),c=require("./check-BSS-LBT3.js"),s=require("classnames");require("react"),module.exports=function({item:t,onSelect:a,customClassName:i,isSelected:l,isDisabled:n,customIcon:o,testid:r}){const{inputProps:{name:u,value:d,htmlFor:b},content:h}=t,m=s("checkbox-input-label",i,{"checkbox-input-label--is-selected":l,"checkbox-input-label--is-disabled":n}),x=o||e.jsx(c.SvgCheck,{});return e.jsxs("label",{"data-testid":r,htmlFor:b,className:m,children:[e.jsx("input",{type:"checkbox",id:b,name:u,value:d,className:"checkbox-input",onChange:function(e){a(t,e)},checked:l,disabled:n}),e.jsx("span",{className:"checkbox-input-label__icon",children:x}),h]})};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("classnames"),r=require("react"),s=require("./timeUtils-BvuzU1KM.js"),n=require("./ListItem.js"),a=require("./List.js");function i({range:e,cadence:t=s.SECOND_IN_MS,timerType:n="down",onEnd:a}){const i=r.useRef(0),u=r.useRef(void 0),[c,o]=r.useState(s.calculateRemainingTimeBreakdown(e,i.current,n)),[d,l]=e,m=r.useRef(void 0);return r.useLayoutEffect(()=>{m.current=a},[a]),r.useLayoutEffect(()=>(u.current=setInterval(()=>{l&&(i.current+=t);const e=s.calculateRemainingTimeBreakdown([d,l],i.current,n);e.delta>=s.SECOND_IN_MS?o(e):(clearInterval(u.current),o({delta:0,days:0,hours:0,minutes:0,seconds:0}))},t),()=>{clearInterval(u.current)}),[t,d,l,n]),r.useEffect(()=>{c.delta<=0&&(clearInterval(u.current),m.current&&m.current())},[c.delta]),c}exports.DateTimer=function({testid:u,range:c,timerInterval:o=1,timerType:d="down",alwaysShowSeconds:l=!1,titleMap:m,onEnd:p,customClassName:f}){const h=function({titleMap:e,alwaysShowSeconds:t},r){let s=[];return s=r.days>=1?["days","hours","minutes"]:r.hours>=1?["hours","minutes"]:["minutes","seconds"],t&&r.hours>=1&&s.push("seconds"),s.map(t=>({id:t,count:r[t].toString().padStart(2,"0"),title:(e?e[t]:void 0)||t}))}({titleMap:m,alwaysShowSeconds:l},i({range:c,cadence:o*s.SECOND_IN_MS,timerType:d,onEnd:p}));return r.useEffect(()=>{const[e]=s.sortDateRange([c[0],c[1]||new Date]);"up"===d&&e.getTime()>(new Date).getTime()&&console.error("`timerType` is `up` but `range` is not in the past",c),"down"===d&&e.getTime()<(new Date).getTime()&&console.error("`timerType` is `down` but `range` is not in the future",c)},[c,d]),e.jsx(a,{customClassName:t("date-timer",f),testid:u,items:h,children:(t,r)=>e.jsxs(n,{customClassName:"date-timer-box",children:[e.jsx("p",{"data-testid":`${r}.${t.id}.count`,className:"date-timer-box__count",children:t.count}),e.jsx("p",{"data-testid":`${r}.${t.id}.title`,className:"date-timer-box__title",children:t.title})]})})},exports.useDateTimer=i;
@@ -0,0 +1 @@
1
+ "use strict";require("react/jsx-runtime"),require("classnames"),require("react");var e=require("./DateTimer-DIYsxSVY.js");require("./timeUtils-BvuzU1KM.js"),require("./ListItem.js"),require("./List.js"),require("date-fns/fp"),require("date-fns/locale"),require("date-fns-tz"),require("./keyboardEventConstants-BL5de2V9.js"),require("uuid"),module.exports=e.DateTimer;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),i=require("classnames"),s=require("react"),a=require("./Spinner.js");const l=s.forwardRef(function(s,l){const{onChange:t,children:n,testid:r,name:c,htmlFor:u,acceptedFileTypes:d="image/png, image/jpeg, .pdf",customSpinner:m,customClassName:p,customLabelClassName:o,isPending:f,isDisabled:b,isMultiple:_}=s,g=i("file-input__container",p),h=f||b,j=i("file-input__label",o,{"file-input__label--is-disabled":h}),x=m||e.jsx(a,{customClassName:"file-input__spinner"});return e.jsxs("div",{className:g,children:[e.jsx("input",{"data-testid":r,type:"file",value:"",name:c,className:"file-input",onChange:t,id:u,disabled:h,accept:d,multiple:_}),e.jsxs("label",{ref:l,htmlFor:u,className:j,"data-testid":`${r}.label`,children:[n,f&&x]})]})});module.exports=l;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),r=require("classnames"),t=require("react"),s=require("./FileInput.js");require("./Spinner.js");const n=t.forwardRef(function(t,n){const{onFileSelect:u,children:a,customClassName:l,customLabelClassName:o,...c}=t;return e.jsx(s,{...c,ref:n,customClassName:r("file-upload-button",l),customLabelClassName:r("file-upload-button__label","button",o),onChange:function(e){const{files:r}=e.currentTarget;u&&r?.length&&u(r)},children:a})});module.exports=n;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),s=require("classnames"),r=require("./ListItem.js"),l=require("./List.js");function t({customClassName:r,type:l,message:t,testid:a}){return e.jsx("p",{"data-testid":a,className:s("form-field-message",r,`form-field-message--is-${l}`),children:t})}require("./keyboardEventConstants-BL5de2V9.js"),require("react"),require("uuid"),module.exports=function(a){const{label:i,labelledBy:m,labelFor:o,customClassName:d,children:n,errorMessages:c,helperMessages:f,testid:u}=a,h=Boolean(c?.length),_=Boolean(f?.length),g=s("form-field",d,{"form-field--has-error":h});return e.jsxs("div",{className:g,"data-testid":u,children:[e.jsxs("label",{id:m,htmlFor:o,className:"form-field__label",children:[Boolean(i)&&e.jsx("span",{className:"form-field__title",children:i}),n]}),h&&e.jsx(l,{testid:`${u}.error-messages`,customClassName:"form-field__error-message-list",items:c,children:(s,l)=>e.jsx(r,{customClassName:"form-field__error-message-list__item",children:e.jsx(t,{type:"error",message:s,testid:l})})}),!h&&_&&e.jsx(l,{testid:`${u}.helper-messages`,customClassName:"form-field__helper-message-list",items:f,children:(s,l)=>e.jsx(r,{customClassName:"form-field__helper-message-list__item",children:e.jsx(t,{type:"helper",message:s,testid:l})})})]})};
package/dist/Input.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("classnames");const n=require("react").forwardRef((n,r)=>{const{testid:i,type:a="text",isDisabled:s,hasError:o,customClassName:c,leftIcon:u,rightIcon:l,role:p,autoComplete:d="off",autoCorrect:m="off",...f}=n,_=t("input-container",c,`input-container--type-${a}`,{"input-container--is-disabled":s,"input-container--has-error":o});return e.jsxs("div",{role:p,className:_,"data-testid":i,children:[u&&e.jsx("span",{className:"input-container__icon input-container__left-icon",children:u}),e.jsx("input",{ref:r,className:"input",type:a,autoComplete:d,autoCorrect:m,disabled:s,...f}),l&&e.jsx("span",{className:"input-container__icon input-container__right-icon",children:l})]})});module.exports=n;
package/dist/List.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("classnames"),r=require("react"),s=require("uuid");const l=r.forwardRef(function({items:l,children:a,customClassName:i,testid:o,listItemKeyGenerator:d,placeholderProps:c,emptyStateProps:n,type:u="unordered",role:m},p){const h=t("list",i);let y;switch(u){case"ordered":y="ol";break;case"description":y="dl";break;default:y="ul"}return e.jsxs(y,{ref:p,className:h,role:m,"data-testid":o,children:[l.map((t,l)=>{const i=`${o}.item-${l}`;return e.jsx(r.Fragment,{children:a(t,i,l)},function({listItemKeyGenerator:e,listItemTestId:t,item:r}){let l;return l=e?e(r,t):r&&"object"==typeof r&&r.id?r.id:s.v4(),l}({listItemKeyGenerator:d,listItemTestId:i,item:t}))}),c?.shouldDisplayPlaceholder&&c.placeholder,!c?.shouldDisplayPlaceholder&&n?.shouldDisplayEmptyState&&n.emptyState]})});module.exports=l;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("classnames"),s=require("./keyboardEventConstants-BL5de2V9.js");module.exports=function({id:i,testid:r,children:a,customClassName:l,clickableListItemProps:c,role:n,ariaSelected:d,listItemRef:o}){const m=t("list-item",l);let u=e.jsx("li",{ref:o,id:i,"data-testid":r,className:m,role:n,"aria-selected":d,children:a});return c&&(u=e.jsx("li",{ref:o,id:i,"data-testid":r,className:m,children:e.jsx("div",{role:"button",tabIndex:c.tabIndex||0,className:"list-item__click-wrapper",onClick:x,onKeyPress:function(e){e.key===s.KEYBOARD_EVENT_KEY.ENTER&&x(e)},children:a})})),u;function x(e){c.onClick(e)}};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("classnames"),r=require("react"),o=require("./Input.js"),a=require("./numberUtils-CMCFc8Kh.js");function n(){try{return!function(){const e="undefined"!=typeof navigator?navigator.userAgent||navigator.vendor:"";return[/Android/i,/iPhone/i,/iPad/i].some(t=>e.match(t))}()&&a.isIntlAPISupported()}catch{return!1}}function i(e){return n()?{...e,...a.getNumberSeparators(e.locale),...a.getNegativeZero(e.locale)}:{locale:void 0,shouldFormatToLocaleString:!1,DECIMAL_NUMBER_SEPARATOR:void 0,MINUS_SIGN:void 0,LOCALE_NEGATIVE_ZERO:void 0}}function u({value:e,event:t,formatProps:r,parseNumberOptions:o,maximumFractionDigits:n}){const{locale:u,shouldFormatToLocaleString:s}=i(r),l=t.currentTarget.value,c=a.parseNumber(o,l);let m=c?String(c):"";const g=!function({eventValue:e,formattedValue:t}){return""===t||"-"!==e&&Number.isNaN(Number(t))}({eventValue:l,formattedValue:c});if(g&&c.match(/./)?.length?m=String(c):g||(m=e),g&&(s||n>0||m.includes("-"))&&(m=a.removeLeadingZeros(u,m)),0===n&&"-0"===m&&(m="0"),s){const r=a.getThousandthSeparatorCount(m),o=a.getThousandthSeparatorCount(e),n=t.currentTarget;let i=t.currentTarget.selectionStart||0;!m||String(e).length!==m.length+1&&String(e).length!==m.length-1||(o===r+1?i-=1:o===r-1&&(i+=1),window.requestAnimationFrame(()=>{n.selectionStart=i,n.selectionEnd=i}))}return m}const s=r.forwardRef((r,s)=>{const{formatProps:l={},maximumFractionDigits:c=0,value:m,onChange:g,inputMode:p="decimal",customClassName:d,...v}=r;if(!function({maximumFractionDigits:e}){return Number.isInteger(e)&&e>=0}({maximumFractionDigits:c}))throw new Error("maximumFractionDigits should be zero or a positive integer.");const{locale:S,shouldFormatToLocaleString:f,DECIMAL_NUMBER_SEPARATOR:h,MINUS_SIGN:F,LOCALE_NEGATIVE_ZERO:N}=i(l),L=(T={locale:S,maximumFractionDigits:c},n()?T:{...T,locale:"en-US"});var T;const E=function({value:e,formatProps:t,signProps:r,maximumFractionDigits:o}){const{locale:n,shouldFormatToLocaleString:i}=t,{decimalSeparatorForLocale:u,minusSignForLocale:s,negativeZeroForLocale:l}=r;let c=e;if("string"==typeof e&&i){const[t,r]=String(e).split("."),i=a.formatNumber({maximumFractionDigits:o,locale:n});e.match(/\.$/)?.length||r?c=`${i(parseInt(t))}${u}${a.mapDigitsToLocalVersion({locale:n},r)}`:t&&(c=t!==s&&t!==l?i(parseInt(t)):`${s}${a.mapDigitsToLocalVersion({locale:n},t)}`)}return c}({value:m,formatProps:{locale:S,shouldFormatToLocaleString:f},signProps:{decimalSeparatorForLocale:h,minusSignForLocale:F,negativeZeroForLocale:N},maximumFractionDigits:c});return e.jsx(o,{ref:s,customClassName:t(d,"number-input"),type:"text",onChange:function(e){e.currentTarget.value&&(e.currentTarget.value=u({value:m,event:e,formatProps:l,parseNumberOptions:L,maximumFractionDigits:c}));g(e)},value:E,...v})});module.exports=s;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),s=require("classnames"),r=require("react"),a=require("./Button.js"),o=require("./Input.js");require("./Spinner.js"),module.exports=function({testid:t,name:i,value:n,onChange:u,hasError:l,placeholder:c,customClassName:d,hideIcon:p,revealIcon:h}){const[m,w]=r.useState(!1),v=s("password-input__icon",{"password-input__icon--is-visible":Boolean(n)}),j=s("password-input",d);let q="Show password",C=h,x="password";return m&&(q="Hide password",C=p,x="text"),e.jsx(o,{testid:t,type:x,name:i,customClassName:j,value:n,hasError:l,placeholder:c,onChange:u,rightIcon:h&&p&&e.jsx(a,{testid:`${t}-password-visibility-icon`,customClassName:v,"aria-label":q,onClick:function(){w(!m)},shouldStopPropagation:!1,shouldPreventDefault:!1,children:C})})};
@@ -0,0 +1 @@
1
+ "use strict";var a=require("react/jsx-runtime"),e=require("classnames");const r=100;module.exports=function(s){const{ariaLabelledBy:t,ariaLabel:l,title:i,ariaValueText:o,ariaDescribedBy:c,testid:d}=s,{percentage:n,style:u,children:b,customClassName:m}=s,g=e("progress-bar",m),v=n>=r?r:n,{trackColor:x="blue",backgroundColor:y="gray",completedColor:p="green"}=u||{};return a.jsxs("div",{className:g,style:{backgroundColor:y},role:"progressbar","aria-valuenow":v,"aria-valuemin":0,"aria-valuemax":r,"aria-labelledby":t,"aria-label":l,title:i,"aria-valuetext":o,"aria-describedby":c,"data-testid":d,children:[a.jsx("div",{className:"progress-bar__track",style:{width:`${v}%`,backgroundColor:v===r?p:x},"data-testid":`${d}.track`}),b&&a.jsx("div",{className:"progress-bar__content",children:b})]})};
package/dist/Radio.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),a=require("classnames");module.exports=function({testid:s,item:i,onSelect:t,isSelected:l,isDisabled:n}){const{inputProps:{name:r,value:d,htmlFor:o},customClassName:c,content:u}=i,m=a("radio-input-label",c,{"radio-input-label--is-selected":l,"radio-input-label--is-disabled":n});return e.jsxs("label",{"data-testid":s,htmlFor:o,className:m,children:[e.jsx("input",{type:"radio",id:o,name:r,value:d,className:"radio-input",onChange:function(e){t(i,e)},checked:l,disabled:n}),e.jsx("span",{className:"radio-input-label__icon"}),u]})};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),s=require("classnames"),i=require("./ListItem.js"),t=require("./List.js"),r=require("./Radio.js");require("./keyboardEventConstants-BL5de2V9.js"),require("react"),require("uuid"),module.exports=function({items:a,testid:u,onSelect:d,selectedItem:o,customClassName:m,isDisabled:l}){return e.jsx(t,{testid:u,items:a,customClassName:s("radio-group",m),children:(t,a)=>e.jsx(i,{customClassName:s("radio-group__item",t.customClassName),children:e.jsx(r,{testid:a,isDisabled:l||t.isDisabled,item:t,onSelect:d,isSelected:Boolean(o&&o.id===t.id)})})})};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("classnames"),s=require("./check-BSS-LBT3.js"),o=require("./List.js"),r=require("./Button.js"),i=require("./keyboardEventConstants-BL5de2V9.js");const a=t.createContext(null),c=t.createContext(null);function l(){const e=t.useContext(a);if(!e)throw new Error("You can only use SelectContext within a component tree that is rooted with SelectContext.Provider.");return e}function u(){const e=t.useContext(c);if(!e)throw new Error("You can only use SelectDispatchContext within a component tree that is rooted with SelectDispatchContext.Provider.");return e}a.displayName="SelectContext";const d=t.forwardRef(function({children:t,customClassName:s,testid:o},r){const{isMenuOpen:i}=l(),a=n("select-content",s,{"select-content--is-visible":i});return e.jsx("div",{ref:r,hidden:!i,className:a,"data-testid":o,children:t})});const E=t.forwardRef(function({children:t,customClassName:s,...o},r){return e.jsx("div",{ref:r,className:n("select-group",s),role:"group",...o,children:t})});const p=t.forwardRef(function({option:o,children:r,customClassName:i,onKeyDown:a,as:c="div",testid:d},E){const p=l(),f=u(),{onSelect:O,value:I,focusedOptionIndex:_,shouldCloseOnSelect:m,options:h}=p,N=h.findIndex(e=>e?.id===o?.id),D=Array.isArray(I)?Boolean(I.find(e=>e.id===o?.id)):I?.id===o?.id,S=_===N,y=n("select-item",i,{"select-item--is-disabled":o?.isDisabled,"select-item--is-selected":D,"select-item--is-focused":S}),C=t.useRef(null);return t.useImperativeHandle(E,()=>C.current,[]),t.useLayoutEffect(()=>{S&&C.current&&C.current.focus()},[S]),e.jsxs(c,{ref:C,className:y,role:"option",id:o?.id,"data-testid":d,tabIndex:o?.isDisabled?-1:0,"aria-selected":D,onClick:function(){o?.isDisabled||(O(o),f({type:"SET_FOCUSED_OPTION_INDEX",payload:N}),m&&f({type:"TOGGLE_MENU_VISIBILITY"}))},onKeyDown:function(e){a&&a(o,e)},children:[r," ",D&&e.jsx(s.SvgCheck,{})]})});const f=t.forwardRef(function({options:t,customClassName:s,contentRenderer:r,...i},a){return e.jsx(o,{ref:a,items:t,customClassName:n("select-item-list",s),...i,children:(t,n)=>e.jsx(_.Item,{as:"li",option:t,customClassName:"select-item-list__item",children:r(t)},n)})});const O=t.forwardRef(function({customClassName:s,children:o,onClick:i,onKeyDown:a,...c},d){const{role:E,isMenuOpen:p,isDisabled:f}=l(),O=u(),I=t.useRef(null);return t.useImperativeHandle(d,()=>I.current),e.jsx(r,{ref:I,customClassName:n("select-trigger",s),"aria-haspopup":E,"aria-expanded":p,onClick:function(e){if(f)return;O({type:"TOGGLE_MENU_VISIBILITY"}),i&&i(e)},...c,children:o})});function I(e,t){let n=e;switch(t.type){case"TOGGLE_MENU_VISIBILITY":n={...e,isMenuOpen:!e.isMenuOpen,focusedOptionIndex:-1};break;case"OPEN_MENU":e.isMenuOpen||(n={...e,isMenuOpen:!0,focusedOptionIndex:-1});break;case"SET_FOCUSED_OPTION_INDEX":n={...e,focusedOptionIndex:t.payload}}return n}const _=Object.assign(t.forwardRef(function(s,o){const{children:r,role:l="listbox",customClassName:u,value:d}=s,[E,p]=t.useReducer(I,{focusedOptionIndex:-1,isMenuOpen:!1,options:s.options||[]}),f=t.useRef(null),O=function(e,t){return{isDisabled:t.isDisabled??!1,hasError:t.hasError??!1,value:t.value||null,onSelect:t.onSelect,shouldCloseOnSelect:t.shouldCloseOnSelect??!0,role:t.role??"listbox",...e}}(E,s),{handleSelectKeyDown:_}=function(e,n){const{isMenuOpen:s,focusedOptionIndex:o,onSelect:r,shouldCloseOnSelect:a,options:c}=e;return{handleSelectKeyDown:t.useCallback(e=>{const{key:t}=e;switch(t){case i.KEYBOARD_EVENT_KEY.TAB:s&&(e.preventDefault(),n({type:"TOGGLE_MENU_VISIBILITY"}));break;case i.KEYBOARD_EVENT_KEY.ESCAPE:s&&n({type:"TOGGLE_MENU_VISIBILITY"});break;case i.KEYBOARD_EVENT_KEY.ENTER:case i.KEYBOARD_EVENT_KEY.SPACE:s&&(e.stopPropagation(),e.preventDefault(),c[o]&&!c[o]?.isDisabled&&(r(c[o]),n(a?{type:"TOGGLE_MENU_VISIBILITY"}:{type:"SET_FOCUSED_OPTION_INDEX",payload:-1})));break;case i.KEYBOARD_EVENT_KEY.ARROW_DOWN:e.stopPropagation(),e.preventDefault(),n({type:"SET_FOCUSED_OPTION_INDEX",payload:(o+1)%c.length});break;case i.KEYBOARD_EVENT_KEY.ARROW_UP:e.stopPropagation(),e.preventDefault(),n({type:"SET_FOCUSED_OPTION_INDEX",payload:(o||c.length)-1});break;case i.KEYBOARD_EVENT_KEY.HOME:e.stopPropagation(),e.preventDefault(),n({type:"SET_FOCUSED_OPTION_INDEX",payload:0});break;case i.KEYBOARD_EVENT_KEY.END:e.stopPropagation(),e.preventDefault(),n({type:"SET_FOCUSED_OPTION_INDEX",payload:c.length-1})}},[n,o,s,c,r,a])}}(O,p),m=function(e,t){const{isMenuOpen:s,value:o,hasError:r,isDisabled:i}=e,a=Array.isArray(o);return n("select",t,{"select--is-disabled":i,"select--is-multi-select":a,"select--has-selected-option":Array.isArray(o)?Boolean(o.length):Boolean(o),"select--has-error":r,"select--is-open":s})}(O,u);return function(e,n){const s=t.useRef(n);t.useEffect(()=>{s.current=n},[n]),t.useEffect(()=>{function t(t){e&&t.target instanceof HTMLElement&&!e.contains(t.target)&&s.current()}return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}},[e])}(f?.current,function(){E.isMenuOpen&&p({type:"TOGGLE_MENU_VISIBILITY"})}),t.useImperativeHandle(o,()=>f.current),e.jsx("div",{ref:f,className:m,role:l,onKeyDown:_,"aria-multiselectable":Array.isArray(d),children:e.jsx(a.Provider,{value:O,children:e.jsx(c.Provider,{value:p,children:r})})})}),{Content:d,Group:E,Item:p,Trigger:O,ItemList:f});exports.Select=_,exports.useSelectContext=l,exports.useSelectDispatchContext=u;
package/dist/Select.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";require("react/jsx-runtime"),require("react");var e=require("./Select-CMiQfdu3.js");require("classnames"),require("./check-BSS-LBT3.js"),require("./List.js"),require("uuid"),require("./Button.js"),require("./Spinner.js"),require("./keyboardEventConstants-BL5de2V9.js"),module.exports=e.Select;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),s=require("classnames");module.exports=function({color:i="#150F2A",customClassName:t}){const r=s("spinner",t);return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:r,xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20ZM10 17.4737C14.1276 17.4737 17.4737 14.1276 17.4737 10C17.4737 5.8724 14.1276 2.52632 10 2.52632C5.8724 2.52632 2.52632 5.8724 2.52632 10C2.52632 14.1276 5.8724 17.4737 10 17.4737Z",fill:"url(#paint0_linear)"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"paint0_linear",x1:"20",y1:"10.0351",x2:"4.52632",y2:"10.0351",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:i}),e.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]})})]})};
package/dist/Switch.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var s=require("react/jsx-runtime"),e=require("classnames");module.exports=function({onToggle:a,isToggledOn:i,isDisabled:c,customClassName:t,testid:l}){const r=e("switch",t,{"switch--is-disabled":c});return s.jsxs("label",{"data-testid":l,className:r,children:[s.jsx("input",{className:"switch__controller",type:"checkbox",checked:i,disabled:c,onChange:a,role:"switch","aria-checked":i,"aria-readonly":c}),s.jsx("span",{className:"switch__slider"})]})};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("classnames"),a=require("react"),r=require("react-textarea-autosize"),o=require("./keyboardEventConstants-BL5de2V9.js");module.exports=function(s){const{name:n,value:u,isDisabled:i,customClassNames:c,testid:l,onKeyUp:d,style:m,autoSizeProps:E,onJustEnterPressed:x,isRequired:y,onShiftEnter:K,hasError:f,onKeyDown:p,autoComplete:C="off",autoCorrect:D="off",autoFocus:R=!1,...h}=s,[q,v]=a.useState(!1),N=t("textarea-container",c?.container,{"textarea--has-error":f,"textarea--is-disabled":i}),w=t("textarea",c?.textarea);return e.jsx("div",{"data-testid":"textarea-container",className:N,children:E?e.jsx(r,{className:w,"data-testid":l,name:n,value:u,autoComplete:C,autoCorrect:D,disabled:i,onKeyDown:T,onKeyUp:Y,style:E.style,maxRows:E.maxRows,minRows:E.minRows,onHeightChange:E.onHeightChange,required:y,autoFocus:R,...h}):e.jsx("textarea",{className:w,"data-testid":l,name:n,value:u,autoComplete:C,autoCorrect:D,disabled:i,onKeyDown:T,onKeyUp:Y,style:m,required:y,autoFocus:R,...h})});function T(e){const{key:t}=e,a={...e};a.currentTarget.name=n,t===o.KEYBOARD_EVENT_KEY.ENTER?!q&&x?(e.preventDefault(),x()):q&&K&&(e.preventDefault(),K()):t===o.KEYBOARD_EVENT_KEY.SHIFT&&v(!0),p&&p(a)}function Y(e){const{key:t}=e;t===o.KEYBOARD_EVENT_KEY.SHIFT&&v(!1),d&&d(e)}};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("classnames"),r=require("./useDebounce-CP74COv3.js"),n=require("./timeUtils-BvuzU1KM.js"),u=require("./Input.js");require("react"),require("date-fns/fp"),require("date-fns/locale"),require("date-fns-tz");const a=n.formatDateWithOptions({format:n.DATE_FORMAT.LONG_TIME_FORMAT,shouldShiftDateToCompensateForTimezone:!1});module.exports=function({testid:i,initialDateTime:s,value:o,onChange:l,placeholder:m="03:30 PM",name:c="TimeInput",customClassName:p,...f}){const[T,d]=r.useDebounce(l,s?a(s):null,100);return e.jsx(u,{type:"text",testid:`${i}.input`,customClassName:t("time-input",p),name:c,value:T,placeholder:m,onChange:function(e){d(e.currentTarget.value)},onBlur:function(){let e=n.parseTime(o);s&&o.length<1&&(e=a(s));d(e)},...f})};
@@ -0,0 +1 @@
1
+ "use strict";var t=require("react/jsx-runtime"),e=require("classnames"),o=require("react"),s=require("./ListItem.js"),a=require("./Button.js"),r=require("./numberUtils-CMCFc8Kh.js"),n=require("react-dom"),i=require("./List.js"),u=require("./arrayUtils-BZ-V_2c9.js");const c=o.createContext({toastId:""});function l({customRootId:e}){const s=x(),[a,r]=o.useState(null);return o.useLayoutEffect(()=>{const t=e&&document.querySelector(`#${e}`);if(t)r(t);else{const t=document.createElement("div");t.setAttribute("id","toast-root"),document.body.append(t),r(t)}},[e]),a&&n.createPortal(s.toastStack.length?t.jsx(i,{testid:"ToastStack",items:s.toastStack,customClassName:"toast-stack",children:(e,o)=>t.jsx(p,{testid:o,data:e})}):t.jsx(o.Fragment,{}),a)}c.displayName="ToastItemContext";const d={toastStack:[],autoCloseToasts:!0,defaultAutoCloseTimeout:4e3};function T(t){return function(e){return!t(e)}}function m(t){return e=>t===e.id}function C(t,e){let o=t;switch(e.type){case"DISPLAY":{const{toastData:s}=e,a=[...t.toastStack.filter(T(m(s.id))),s];o={...t,toastStack:u.limitArrayLengthFromTheEnd(t.limit,a)};break}case"HIDE":o={...t,toastStack:t.toastStack.filter(T(m(e.toastId)))};break;case"HIDE_ALL":o={...t,toastStack:[]};break;case"UPDATE":{const s=t.toastStack.findIndex(m(e.toastId));if(!(s>-1))throw new Error("Trying to update a Toast that is already removed");o={...t,toastStack:u.updateAtIndex(t.toastStack,s,{...t.toastStack[s],...e.toastData})};break}case"SET_LIMIT":{const{limit:s}=e;o={...t,limit:s,toastStack:u.limitArrayLengthFromTheEnd(s,t.toastStack)};break}case"SET_AUTO_CLOSE":o={...t,autoCloseToasts:e.autoCloseToasts};break;case"SET_DEFAULT_AUTO_CLOSE_TIMEOUT_FOR_ALL_TOASTS":{const{timeout:s}=e;r.isNonNegativeNumber(s)&&(o={...t,defaultAutoCloseTimeout:s});break}}return o}const f=o.createContext(null),S=o.createContext(null);function x(){const t=o.useContext(f);if(!t)throw new Error("Trying to consume ToastStateContext outside of its provider.");return t}function E(){const t=o.useContext(S);if(!t)throw new Error("Trying to consume ToastDispatchContext outside of its provider");return{display:o.useCallback(e=>{const o=e.id||function(){const{radix:t=36,substringStartIndex:e=7}={};return Math.random().toString(t).substring(e)}();return t({type:"DISPLAY",toastData:{...e,id:o}}),o},[t]),hide:o.useCallback(e=>{t({type:"HIDE",toastId:e})},[t]),update:o.useCallback((e,o)=>{t({type:"UPDATE",toastId:e,toastData:o})},[t]),hideAll:o.useCallback(()=>{t({type:"HIDE_ALL"})},[t])}}function p({testid:a,data:r}){const n=x(),{hide:i}=E(),{timeout:u=n.defaultAutoCloseTimeout,render:l,customClassName:d,id:T}=r,m="boolean"==typeof r.autoClose?r.autoClose:n.autoCloseToasts;return o.useLayoutEffect(()=>{let t;return m&&(t=setTimeout(()=>{i(T)},u)),()=>{t&&clearTimeout(t)}},[m,u,i,T]),t.jsx(c.Provider,{value:{toastId:T},children:t.jsx(s,{testid:a,customClassName:e("toast",d),children:l()})})}S.displayName="ToastDispatchContext",f.displayName="ToastStateContext",p.CloseButton=function({children:e,testid:s}){const{hide:r}=E(),{toastId:n}=function(){const t=o.useContext(c);if(!t)throw new Error("Trying to consume ToastItemContext outside of its provider");return t}();return t.jsx(a,{testid:s,onClick:function(){r(n)},customClassName:"toast-close-button",children:e})},exports.Toast=p,exports.ToastContextProvider=function({children:e,customRootId:s,autoCloseToasts:a=!0,limit:n,defaultAutoCloseTimeout:i=4e3}){const[u,c]=o.useReducer(C,{...d,autoCloseToasts:a,limit:n,defaultAutoCloseTimeout:i});return o.useEffect(()=>{r.isNonNegativeNumber(n)&&c({type:"SET_LIMIT",limit:n})},[n]),o.useEffect(()=>{c({type:"SET_AUTO_CLOSE",autoCloseToasts:a})},[a]),o.useEffect(()=>{c({type:"SET_DEFAULT_AUTO_CLOSE_TIMEOUT_FOR_ALL_TOASTS",timeout:i})},[i]),t.jsx(f.Provider,{value:u,children:t.jsxs(S.Provider,{value:c,children:[e,t.jsx(l,{customRootId:s})]})})},exports.ToastDispatchContext=S,exports.ToastStateContext=f,exports.useToastContextState=x,exports.useToaster=E;
package/dist/Toast.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";require("react/jsx-runtime"),require("classnames"),require("react"),require("./ListItem.js");var e=require("./Toast-9FKOjJle.js");require("./keyboardEventConstants-BL5de2V9.js"),require("./Button.js"),require("./Spinner.js"),require("./numberUtils-CMCFc8Kh.js"),require("react-dom"),require("./List.js"),require("uuid"),require("./arrayUtils-BZ-V_2c9.js"),module.exports=e.Toast;
package/dist/Toggle.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("classnames"),s=require("./ListItem.js"),l=require("react");require("./keyboardEventConstants-BL5de2V9.js");const o=l.createContext({selectedItems:[],onToggle:()=>{},canSelectMultiple:!1});function i({children:s,onToggle:l,selectedItems:i=[],canSelectMultiple:n=!1,position:c="horizontal",isDisabled:r,customClassName:a}){const g=t("toggle",a,{"toggle--is-horizontal":"horizontal"===c,"toggle--is-vertical":"vertical"===c,"toggle--is-disabled":r});return e.jsx("ul",{className:g,children:e.jsx(o.Provider,{value:{selectedItems:i,onToggle:l,canSelectMultiple:n},children:s})})}o.displayName="ToggleContext",i.Item=function({children:i,dataId:n,customClassName:c,isDisabled:r,testid:a}){const{selectedItems:g,onToggle:d,canSelectMultiple:u}=function(){const e=l.useContext(o);if(!e)throw new Error("Trying to consume ToggleContext outside of its provider.");return e}(),m=g.includes(n),x=t("toggle-item",c,{"toggle-item--is-selected":m,"toggle-item--is-disabled":r});return e.jsx(s,{testid:a,customClassName:x,children:e.jsxs("label",{className:"toggle-item__label",children:[e.jsx("input",{type:"checkbox",className:"toggle-input",checked:m,disabled:r,onChange:function(){let e;e=m?g.filter(e=>e!==n):u?[...g,n]:[n];d(e)}}),i]})})},exports.Toggle=i,exports.ToggleContext=o;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),n=require("classnames"),t=require("react"),r=require("./useDebounce-CP74COv3.js"),u=require("./Input.js");const o=250,s=t.forwardRef((s,a)=>{const{testid:i,placeholder:c,name:l,type:d="text",customClassName:m,onFocus:f,onBlur:p,id:h,onKeyDown:y,onQueryChange:g,isDisabled:D=!1,leftIcon:q,rightIcon:b,initialValue:C="",value:I,queryChangeDebounceTimeout:j=o,...v}=s,[x,w]=r.useDebounce(g,C,j);return t.useEffect(()=>{"string"==typeof I&&w(I)},[I,w]),e.jsx(u,{ref:a,customClassName:n("typeahead-input",m),id:h,testid:i,name:l,type:d,placeholder:c,onChange:function(e){w(e.currentTarget.value)},onFocus:f,onBlur:p,onKeyDown:y,value:x,isDisabled:D,leftIcon:q,rightIcon:b,...v})});module.exports=s;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("classnames"),n=require("react"),s=require("./arrayUtils-BZ-V_2c9.js"),i=require("./keyboardEventConstants-BL5de2V9.js"),r=require("./TypeaheadInput.js"),a=require("./Spinner.js"),o=require("./Select-CMiQfdu3.js"),l=require("./ListItem.js"),c=require("./List.js");function u(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}require("./numberUtils-CMCFc8Kh.js"),require("./useDebounce-CP74COv3.js"),require("./Input.js"),require("./check-BSS-LBT3.js"),require("./Button.js"),require("uuid");var d,p=u(n);function m(e){return{id:e.id,content:e.title,context:e}}function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},h.apply(null,arguments)}var g,f=function(e){return p.createElement("svg",h({xmlns:"http://www.w3.org/2000/svg",width:10,height:5,fill:"none"},e),d||(d=p.createElement("path",{fill:"#222",d:"m5 5 5-5H0z"})))};function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},y.apply(null,arguments)}var j=function(e){return p.createElement("svg",y({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16"},e),g||(g=p.createElement("path",{stroke:"#C7C7C7",strokeWidth:1.5,d:"m4 12 8-8M12 12 4 4"})))};function v({testid:n,tag:s,onRemove:r,customClassName:a}){const o=t("tag",a,{"tag--is-removable":r});return e.jsxs("div",{role:"button",tabIndex:0,"data-testid":n,onKeyDown:function(e){switch(e.stopPropagation(),e.key){case i.KEYBOARD_EVENT_KEY.ENTER:case i.KEYBOARD_EVENT_KEY.BACKSPACE:r&&r(s)}},className:o,onClick:function(e){e.stopPropagation(),r&&r(s)},children:[e.jsx("div",{className:"tag__body",children:s.content}),r&&e.jsx(j,{className:"tag__close-icon","aria-hidden":!0})]})}function _({handleTagRemove:n,tags:s,customClassName:i,input:r,canOpenMenu:a=!0}){const{isDisabled:u}=o.useSelectContext(),d=o.useSelectDispatchContext();return e.jsxs("div",{className:t("select-trigger","typeahead-select-trigger",i),onFocus:function(){a&&!u&&d({type:"OPEN_MENU"})},children:[e.jsx(c,{customClassName:t("typeahead-select-trigger__tag-list",i),testid:"TypeaheadSelectTrigger.list",items:s,children:t=>e.jsx(l,{customClassName:"typeahead-select-trigger__tag-list__item",children:e.jsx(v,{onRemove:n,customClassName:"typeahead-select-trigger__tag-list__item__tag",tag:t})},t.id)}),r]})}module.exports=function({testid:l,options:c,selectedOptions:u,typeaheadProps:d,onTagRemove:p,onKeywordChange:h,onSelect:g,customClassName:y,selectedOptionLimit:j,shouldDisplaySelectedOptions:v=!0,shouldFilterOptionsByKeyword:E=!0,isDisabled:O,shouldShowEmptyOptions:x=!0,canOpenDropdownMenu:C=!0,areOptionsFetching:b,customSpinner:w,initialKeyword:N="",controlledKeyword:S}){const q=n.useRef(null),[K,D]=n.useState(c),[B,T]=n.useState(!1),[P,R]=n.useState(N),k="string"==typeof S?S:P,A=function(e){return e.map(m)}(u),I=Boolean(j&&u.length>=j),Y=!j||j>1,F=!Y||Boolean(j&&u.length>=j-1),L=t("typeahead-select",y,{"typeahead-select--has-selected-options":Boolean(u.length),"typeahead-select--can-select-multiple":Y}),M=w||e.jsx(a,{customClassName:"typeahead-select__spinner"});return n.useEffect(()=>{D(c)},[c]),n.useEffect(()=>{let e;return B&&(e=setTimeout(()=>{q.current&&(q.current.focus(),T(!1))})),()=>{clearTimeout(e)}},[B]),n.useEffect(()=>{D(s.filterOutItemsByKey(c,"id",u))},[c,u]),e.jsxs(o.Select,{role:"listbox",onSelect:function(e){I||O||(g(e),D(c),R(""),T(!0))},options:K,customClassName:L,value:u,isDisabled:O,shouldCloseOnSelect:F,children:[e.jsx(_,{tags:v?A:[],handleTagRemove:function(e){p&&(p(e.context),T(!0))},canOpenMenu:C,input:!I&&e.jsx(r,{testid:`${l}.search`,customClassName:"typeahead-select__input",id:d.id,name:d.name,type:d.type,placeholder:d.placeholder,value:k,onQueryChange:function(e){if(E){const t=c.filter(e=>u.indexOf(e)<0);D(function(e,t){let n=e;return t&&(n=e.filter(e=>!e.title||e.title.toLowerCase().includes(t.toLowerCase()))),n}(t,e))}h&&h(e);void 0===S&&R(e)},onKeyDown:function(e){const{key:t}=e;t===i.KEYBOARD_EVENT_KEY.BACKSPACE&&!k&&p&&u.length&&(e.stopPropagation(),p(u[u.length-1]))},rightIcon:b?M:e.jsx(f,{"aria-hidden":!0}),onFocus:d.onFocus,isDisabled:O})}),e.jsxs(o.Select.Content,{testid:l,children:[K.map((t,n)=>e.jsx(o.Select.Item,{option:t,testid:`${l}.item-${n}`,children:t.title},t.id)),x&&!K.length&&e.jsx("p",{"data-testid":`${l}.empty-message`,className:"dropdown-list__empty-message",children:"No available options"})]})]})};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./numberUtils-CMCFc8Kh.js");exports.filterOutItemsByKey=function(e,t,r){const n=r.map(e=>e[t]);return e.reduce((e,r)=>(n.includes(r[t])||e.push(r),e),[])},exports.limitArrayLengthFromTheEnd=function(t,r){let n=r;return e.isNonNegativeNumber(t)&&r.length>t&&(n=r.slice(r.length-t)),n},exports.updateAtIndex=function(e,t,r){const n=[...e];return n.splice(t,1,r),n};
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import "./_button.scss";
3
+ export type ButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "disabled" | "className"> & {
4
+ children: React.ReactNode;
5
+ testid?: string;
6
+ customSpinner?: React.ReactNode;
7
+ isDisabled?: boolean;
8
+ shouldPreventDefault?: boolean;
9
+ shouldStopPropagation?: boolean;
10
+ shouldFocus?: boolean;
11
+ shouldDisplaySpinner?: boolean;
12
+ customClassName?: string;
13
+ };
14
+ declare const Button: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "disabled" | "className"> & {
15
+ children: React.ReactNode;
16
+ testid?: string;
17
+ customSpinner?: React.ReactNode;
18
+ isDisabled?: boolean;
19
+ shouldPreventDefault?: boolean;
20
+ shouldStopPropagation?: boolean;
21
+ shouldFocus?: boolean;
22
+ shouldDisplaySpinner?: boolean;
23
+ customClassName?: string;
24
+ } & React.RefAttributes<HTMLButtonElement>>;
25
+ export default Button;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { FileInputProps } from "../../form/input/file/FileInput";
3
+ export type FileUploadButtonProps = Omit<FileInputProps, "onChange"> & {
4
+ customLabelClassName?: string;
5
+ ref?: React.RefObject<HTMLLabelElement>;
6
+ onFileSelect?: (files: React.SyntheticEvent<HTMLInputElement>["currentTarget"]["files"]) => void;
7
+ };
8
+ declare const FileUploadButton: React.ForwardRefExoticComponent<Omit<FileUploadButtonProps, "ref"> & React.RefAttributes<HTMLLabelElement>>;
9
+ export default FileUploadButton;
@@ -0,0 +1 @@
1
+ "use strict";function e(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var t,r=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(null,arguments)}exports.SvgCheck=function(e){return r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:10,height:7,fill:"none",className:"check_svg__check-icon"},e),t||(t=r.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M8.918 0 10 1.012 3.665 7 0 3.548l1.083-1.012 2.582 2.44z",clipRule:"evenodd"})))};
@@ -0,0 +1,13 @@
1
+ declare function filterOutItemsByKey<T extends {
2
+ [x: string]: any;
3
+ }>(array: T[], key: keyof T, items: T[]): T[];
4
+ declare function updateAtIndex<Item>(items: Item[], index: number, newItem: Item): Item[];
5
+ /**
6
+ * Slices an array at an offset from the end so that the new array's length would be `limit` at most.
7
+ *
8
+ * @param limit - Limit for the length of that array
9
+ * @param array - List of items
10
+ * @returns The same array if array.length <=limit, otherwise returns a new array.
11
+ */
12
+ declare function limitArrayLengthFromTheEnd<Item>(limit: undefined | number, array: Item[]): Item[];
13
+ export { filterOutItemsByKey, limitArrayLengthFromTheEnd, updateAtIndex };
@@ -0,0 +1,2 @@
1
+ declare function isMobileDevice(): boolean;
2
+ export { isMobileDevice };
@@ -0,0 +1,2 @@
1
+ declare function computeScrollAmountToMakeChildVisible(parent: HTMLElement, child: HTMLElement): number;
2
+ export { computeScrollAmountToMakeChildVisible };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns a negated function that invokes the passed in function and returns the logical negation of its return value.
3
+ * @param {function} fn A function
4
+ * @returns {function} Negated function
5
+ */
6
+ declare function not(fn: (item: any) => boolean): (item: any) => boolean;
7
+ export { not };
@@ -0,0 +1,17 @@
1
+ import type { DateTimerProps, TimerType } from "../../../date-timer/util/dateTimerTypes";
2
+ import type { RemainingTimeBreakdown } from "../time/timeTypes";
3
+ /**
4
+ * A React Hook that provides a date timer
5
+ * @param {Date[]} options.range - The target date range we're counting down to
6
+ * @param {number} options.cadence - The rate of the timer in milliseconds
7
+ * @param {TimerType} options.timerType - Type of the timer, either "down" or "up"
8
+ * @param {onEnd} options.onEnd - If provided, runs this callback when the timer ended
9
+ * @returns {object} The RemainingTimeBreakdown object
10
+ */
11
+ declare function useDateTimer({ range, cadence, timerType, onEnd }: {
12
+ range: DateTimerProps["range"];
13
+ cadence?: number;
14
+ timerType?: TimerType;
15
+ onEnd?: DateTimerProps["onEnd"];
16
+ }): RemainingTimeBreakdown;
17
+ export default useDateTimer;
@@ -0,0 +1,2 @@
1
+ declare function useDebounce(debouncedHandler: any, initialValue: any, delay: number): any[];
2
+ export default useDebounce;
@@ -0,0 +1,2 @@
1
+ declare function useOnClickOutside(element: HTMLElement | null, callback: () => void): void;
2
+ export default useOnClickOutside;
@@ -0,0 +1,16 @@
1
+ declare const KEYBOARD_EVENT_KEY: {
2
+ ENTER: string;
3
+ SPACE: string;
4
+ ESCAPE: string;
5
+ TAB: string;
6
+ BACKSPACE: string;
7
+ ARROW_UP: string;
8
+ ARROW_DOWN: string;
9
+ ARROW_LEFT: string;
10
+ ARROW_RIGHT: string;
11
+ CMD: string;
12
+ SHIFT: string;
13
+ HOME: string;
14
+ END: string;
15
+ };
16
+ export { KEYBOARD_EVENT_KEY };
@@ -0,0 +1,5 @@
1
+ declare const DEFAULT_THOUSANDTHS_SEPARATOR = ",";
2
+ declare const DEFAULT_DECIMAL_NUMBER_SEPARATOR = ".";
3
+ declare const DEFAULT_MINUS_SIGN = "-";
4
+ declare const DEFAULT_NUMERALS: string[];
5
+ export { DEFAULT_DECIMAL_NUMBER_SEPARATOR, DEFAULT_MINUS_SIGN, DEFAULT_NUMERALS, DEFAULT_THOUSANDTHS_SEPARATOR };
@@ -0,0 +1,7 @@
1
+ export type FormatNumberOptions = Omit<Intl.NumberFormatOptions, "style"> & {
2
+ locale?: string;
3
+ };
4
+ export interface ParseNumberOptions {
5
+ locale?: string;
6
+ maximumFractionDigits: number;
7
+ }
@@ -0,0 +1,44 @@
1
+ import type { FormatNumberOptions, ParseNumberOptions } from "./numberTypes";
2
+ /**
3
+ * @param {number} limit The number of digits in decimal part of a number
4
+ * @return {function} A function that takes in a number and returns the truncated version of it
5
+ */
6
+ declare function truncateDecimalPart(limit: number): (x: number) => number;
7
+ /**
8
+ * @param {number} x number to check
9
+ * @return {boolean} Whether x is an integer or not
10
+ */
11
+ declare function isInteger(x: number): boolean;
12
+ declare function isIntlAPISupported(): boolean;
13
+ declare function formatNumber(formatNumberOptions: FormatNumberOptions): (value: number) => string;
14
+ /**
15
+ * Coerces a number to scientific notation. {@link https://observablehq.com/@mbostock/localized-number-parsing | Reference}
16
+ * @param {object} options - An object includes parse number options
17
+ * @param {string} options.locale - Default locale used is browser locale
18
+ * @param {number} options.maximumFractionDigits - The maximum digit a decimal can have
19
+ * @param {number} value - A number to convert to string
20
+ * @returns {string} The value after coercing the given value to a scientific notation.
21
+ */
22
+ declare function parseNumber(options: ParseNumberOptions, value: string): string;
23
+ declare function getDigit(digitMap: Map<string, number>): (d: string) => string;
24
+ declare function mapDigitsToLocalVersion({ locale }: {
25
+ locale?: string;
26
+ }, digits: string): string;
27
+ declare function getNumberSeparators(locale?: string): {
28
+ THOUSANDTHS_SEPARATOR: string;
29
+ DECIMAL_NUMBER_SEPARATOR: string;
30
+ MINUS_SIGN: string;
31
+ };
32
+ /**
33
+ * @returns Scientific and locale presentations of "-0" and "-00" values
34
+ */
35
+ declare function getNegativeZero(locale?: string): {
36
+ LOCALE_NEGATIVE_ZERO: string;
37
+ LOCALE_NEGATIVE_DOUBLE_ZERO: string;
38
+ DEFAULT_NEGATIVE_ZERO: string;
39
+ DEFAULT_NEGATIVE_DOUBLE_ZERO: string;
40
+ };
41
+ declare function removeLeadingZeros(locale: string | undefined, value: string): string;
42
+ declare function getThousandthSeparatorCount(value: string): number;
43
+ declare function isNonNegativeNumber(x: unknown): x is number;
44
+ export { formatNumber, getDigit, getNegativeZero, getNumberSeparators, getThousandthSeparatorCount, isInteger, isIntlAPISupported, isNonNegativeNumber, mapDigitsToLocalVersion, parseNumber, removeLeadingZeros, truncateDecimalPart };
@@ -0,0 +1,2 @@
1
+ declare const SINGLE_ALPHANUMERIC_CHARACTER_REGEX: RegExp;
2
+ export { SINGLE_ALPHANUMERIC_CHARACTER_REGEX };
@@ -0,0 +1,5 @@
1
+ declare function generateRandomString(options?: {
2
+ radix?: number;
3
+ substringStartIndex?: number;
4
+ }): string;
5
+ export { generateRandomString };
@@ -0,0 +1,19 @@
1
+ import { axe } from "jest-axe";
2
+ /**
3
+ * Validates against common a11y mistakes.
4
+ *
5
+ * @example
6
+ * ```
7
+ * it('passes a11y test', async () => {
8
+ * await testA11Y(<MyComponent />, options);
9
+ * });
10
+ *
11
+ * ```
12
+ * @param {HTMLElement} container - The html element we want to test
13
+ * @param {RunOptions} options - Axe run options
14
+ * @returns {void}
15
+ *
16
+ * @see https://github.com/nickcolley/jest-axe#testing-react-with-react-testing-library
17
+ */
18
+ declare function testA11y(container: HTMLElement, options?: Parameters<typeof axe>[1]): Promise<void>;
19
+ export { testA11y };
@@ -0,0 +1,13 @@
1
+ declare const HH_MM_A_TIME_FORMAT_REGEX: RegExp;
2
+ declare const SECOND_IN_MS = 1000;
3
+ declare const MINUTE_IN_S = 60;
4
+ declare const MINUTE_IN_MS: number;
5
+ declare const HOUR_IN_MINS = 60;
6
+ declare const DAY_IN_HRS = 24;
7
+ declare const HOUR_IN_S: number;
8
+ declare const DAY_IN_S: number;
9
+ declare const DATE_FORMAT: {
10
+ DEFAULT: string;
11
+ LONG_TIME_FORMAT: string;
12
+ };
13
+ export { DATE_FORMAT, DAY_IN_HRS, DAY_IN_S, HH_MM_A_TIME_FORMAT_REGEX, HOUR_IN_MINS, HOUR_IN_S, MINUTE_IN_MS, MINUTE_IN_S, SECOND_IN_MS };
@@ -0,0 +1,13 @@
1
+ export interface RemainingTimeBreakdown {
2
+ delta: number;
3
+ days: number;
4
+ hours: number;
5
+ minutes: number;
6
+ seconds: number;
7
+ }
8
+ export type FormatDateUtilOptions = {
9
+ timeZone?: string | null;
10
+ format?: string;
11
+ shouldShiftDateToCompensateForTimezone?: boolean;
12
+ isProvidedDateInUTC?: boolean;
13
+ };
@@ -0,0 +1,42 @@
1
+ import type { DateTimerProps, TimerType } from "../../../date-timer/util/dateTimerTypes";
2
+ import type { FormatDateUtilOptions, RemainingTimeBreakdown } from "./timeTypes";
3
+ declare function sortDateRange(initialRange: Date[]): Date[];
4
+ declare function calculateRemainingTimeBreakdown(range: DateTimerProps["range"], intervalCount?: number, timerType?: TimerType): RemainingTimeBreakdown;
5
+ /**
6
+ * Formats a Date object into a human friendly string
7
+ *
8
+ * Note on usage:
9
+ * Whenever the timezone information is not available and a date object that is passed to this
10
+ * function is generated from a ISO-8601 date string (yyyy-MM-dd), `shouldShiftDateToCompensateForTimezone` option should be set to `true`.
11
+ *
12
+ * Otherwise, displayed date would be inconsistent with the data.
13
+ * For example, for a user with Eastern Daylight Time (to generalize, any user that has a negative UTC offset),
14
+ * the following Date object is created for "2007-05-16": Tue May 15 2007 20:00:00 GMT-0400 (Eastern Daylight Time) {}.
15
+ * Therefore, 15 May appears on the screen. By passing `new Date("2007-05-16")` value to `compensateForTimezone` utility, we fix this problem.
16
+ *
17
+ * When the timezone information is passed to `formatDateWithOptions`, this extra compensation is redundant as `toZonedTime` handles it correctly.
18
+ *
19
+ * @param {object} options FormatDateUtilOptions
20
+ * @return {string} Formatted date
21
+ */
22
+ declare function formatDateWithOptions(options: FormatDateUtilOptions): (date: Date) => string;
23
+ /**
24
+ * Shifts the time of the Date object by the system's UTC offset to avoid timezone issues.
25
+ *
26
+ * For example, for a user with Eastern Daylight Time (to generalize, any user that has a negative UTC offset),
27
+ * the following Date object is created for "2007-05-16": Tue May 15 2007 20:00:00 GMT-0400 (Eastern Daylight Time) {}.
28
+ *
29
+ * By using this utility we get the following Date object: `compansateForTimezone(new Date("2007-05-16"))` = Tue May 16 2007 00:00:00 GMT-0400 (Eastern Daylight Time) {}
30
+ *
31
+ * @param {Date} date Date to shift
32
+ * @return {Date} shifted Date
33
+ */
34
+ declare function compansateForTimezone(date: Date): Date;
35
+ declare function parseTime(time: string, format?: string): string;
36
+ declare function getHourMinuteMeridiemFromTimeString(timeString: string): {
37
+ hours: string;
38
+ minutes: string;
39
+ meridiem: string;
40
+ };
41
+ declare function formatTimeStringTo12hFormatWithMeridiem(timeString: string): string;
42
+ export { calculateRemainingTimeBreakdown, compansateForTimezone, formatDateWithOptions, formatTimeStringTo12hFormatWithMeridiem, getHourMinuteMeridiemFromTimeString, parseTime, sortDateRange };
@@ -0,0 +1,4 @@
1
+ import "./_date-timer.scss";
2
+ import type { DateTimerProps } from "./util/dateTimerTypes";
3
+ declare function DateTimer({ testid, range, timerInterval, timerType, alwaysShowSeconds, titleMap, onEnd, customClassName }: DateTimerProps): import("react").JSX.Element;
4
+ export default DateTimer;