@cruk/cruk-react-components 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AddressLookup/AddressLookup.stories.d.ts +2 -0
- package/lib/components/Badge/Badge.stories.d.ts +0 -1
- package/lib/components/Button/Button.stories.d.ts +1 -1
- package/lib/components/Collapse/Collapse.stories.d.ts +0 -1
- package/lib/components/DateField/DateField.stories.d.ts +0 -1
- package/lib/components/Footer/Footer.stories.d.ts +0 -1
- package/lib/components/Header/Header.stories.d.ts +0 -1
- package/lib/components/Heading/Heading.stories.d.ts +0 -1
- package/lib/components/Icon/Icon.stories.d.ts +0 -1
- package/lib/components/IconFa/IconFa.stories.d.ts +0 -1
- package/lib/components/LegendWrapper/LegendWrapper.stories.d.ts +0 -1
- package/lib/components/Link/Link.stories.d.ts +1 -1
- package/lib/components/Loader/Loader.stories.d.ts +0 -1
- package/lib/components/Modal/Modal.stories.d.ts +0 -1
- package/lib/components/Pagination/Pagination.stories.d.ts +0 -1
- package/lib/components/PopOver/Popover.stories.d.ts +0 -1
- package/lib/components/ProgressBar/ProgressBar.stories.d.ts +0 -1
- package/lib/components/Totaliser/Totaliser.stories.d.ts +0 -1
- package/lib/components/UserBlock/UserBlock.stories.d.ts +0 -1
- package/lib/docs/Docs.d.ts +0 -1
- package/lib/es/src/components/AddressLookup/index.js +1 -1
- package/lib/es/src/utils/Helper.js +1 -1
- package/lib/hocs/MdxProvider.d.ts +0 -1
- package/lib/utils/Helper.d.ts +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ declare const _default: {
|
|
|
13
13
|
isIconButton?: boolean | undefined;
|
|
14
14
|
ref?: React.Ref<HTMLElement> | undefined;
|
|
15
15
|
children?: React.ReactNode;
|
|
16
|
-
}, "
|
|
16
|
+
}, "css" | "as" | "size" | keyof React.ButtonHTMLAttributes<HTMLElement> | "appearance" | "full" | "href" | "isIconButton"> & React.RefAttributes<HTMLElement>>;
|
|
17
17
|
args: {
|
|
18
18
|
appearance: string;
|
|
19
19
|
disabled: boolean;
|
|
@@ -9,7 +9,7 @@ declare const _default: {
|
|
|
9
9
|
ref?: React.Ref<HTMLElement> | undefined;
|
|
10
10
|
as?: React.ElementType | undefined;
|
|
11
11
|
children?: React.ReactNode;
|
|
12
|
-
}, "
|
|
12
|
+
}, "slot" | "style" | "title" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | keyof import("../Spacing").SpacingProps | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "as" | "textSize" | "textAlign" | "textColor" | "wordBreak" | "overflowWrap" | "referrerPolicy" | "appearance" | "href" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "textWeight" | "textHoverColor"> & React.RefAttributes<HTMLElement>>;
|
|
13
13
|
args: {
|
|
14
14
|
appearance: undefined;
|
|
15
15
|
href: string;
|
package/lib/docs/Docs.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as t}from"../../../_virtual/_tslib.js";import n,{forwardRef as r,useState as o,useRef as s,useCallback as a,useEffect as i}from"react";import{useTheme as l}from"styled-components";import{faChevronRight as c}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js";import{useKey as d}from"../../hooks/useKey.js";import u from"../../utils/debounce.js";import{removeCommasFromObjectStringValues as m}from"../../utils/Helper.js";import{Text as f}from"../Text/index.js";import p from"../TextField/index.js";import h from"../IconFa/index.js";import g from"../../themes/cruk.js";import{ScreenReaderOnly as v,ListWrapper as y,List as E,ListItem as w}from"./styles.js";var b=r((function(r,b){var j=r.apiKey,x=r.countries,I=r.errorMessage,T=r.hasError,V=r.isValid,k=r.isValidVisible,A=r.isInvalidVisible,C=r.label,K=r.hintText,D=r.onAddressError,F=void 0===D?function(e){}:D,S=r.onAddressSelected,_=r.onChange,M=r.onBlur,B=e(r,["apiKey","countries","errorMessage","hasError","isValid","isValidVisible","isInvalidVisible","label","hintText","onAddressError","onAddressSelected","onChange","onBlur"]),H=o([]),L=H[0],O=H[1],U=o(-1),q=U[0],R=U[1],W=s(null),z=l(),G=t(t({},g),z),J=function(){R(-1),O([])},N=a(u(500,(function(e){return P(e)})),[]),P=function(e,t){if(void 0===t&&(t=""),0===e.length)return O([]);var n="".concat("https://api.addressy.com/Capture/Interactive/Find/v1.1/json3.ws","?Key=").concat(j,"&Text=").concat(e,"&Container=").concat(t);return void 0!==x&&(n="".concat(n,"&Countries=").concat(x.join(","))),fetch(n).then((function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()})).then((function(e){if(e.Items[0].Error)throw new Error("Something went wrong please try again");return O(e.Items||[]),null})).catch((function(e){return F(e)})),null},Q=function(e){fetch("".concat("https://api.addressy.com/Capture/Interactive/Retrieve/v1/json3.ws","?Key=").concat(j,"&Id=").concat(e)).then((function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()})).then((function(e){
|
|
1
|
+
import{__rest as e,__assign as t}from"../../../_virtual/_tslib.js";import n,{forwardRef as r,useState as o,useRef as s,useCallback as a,useEffect as i}from"react";import{useTheme as l}from"styled-components";import{faChevronRight as c}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js";import{useKey as d}from"../../hooks/useKey.js";import u from"../../utils/debounce.js";import{removeCommasFromObjectStringValues as m}from"../../utils/Helper.js";import{Text as f}from"../Text/index.js";import p from"../TextField/index.js";import h from"../IconFa/index.js";import g from"../../themes/cruk.js";import{ScreenReaderOnly as v,ListWrapper as y,List as E,ListItem as w}from"./styles.js";var b=r((function(r,b){var j=r.apiKey,x=r.countries,I=r.errorMessage,T=r.hasError,V=r.isValid,k=r.isValidVisible,A=r.isInvalidVisible,C=r.label,K=r.hintText,D=r.onAddressError,F=void 0===D?function(e){}:D,S=r.onAddressSelected,_=r.onChange,M=r.onBlur,B=e(r,["apiKey","countries","errorMessage","hasError","isValid","isValidVisible","isInvalidVisible","label","hintText","onAddressError","onAddressSelected","onChange","onBlur"]),H=o([]),L=H[0],O=H[1],U=o(-1),q=U[0],R=U[1],W=s(null),z=l(),G=t(t({},g),z),J=function(){R(-1),O([])},N=a(u(500,(function(e){return P(e)})),[]),P=function(e,t){if(void 0===t&&(t=""),0===e.length)return O([]);var n="".concat("https://api.addressy.com/Capture/Interactive/Find/v1.1/json3.ws","?Key=").concat(j,"&Text=").concat(e,"&Container=").concat(t);return void 0!==x&&(n="".concat(n,"&Countries=").concat(x.join(","))),fetch(n).then((function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()})).then((function(e){if(e.Items[0].Error)throw new Error("Something went wrong please try again");return O(e.Items||[]),null})).catch((function(e){return F(e)})),null},Q=function(e){fetch("".concat("https://api.addressy.com/Capture/Interactive/Retrieve/v1/json3.ws","?Key=").concat(j,"&Id=").concat(e)).then((function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()})).then((function(e){var t=e.Items[0],n=m(t);return S(n),J(),null})).catch((function(e){return F(e)}))},X=function(e){return"Address"===e.Type?Q(e.Id):(P(e.Text,e.Id),null)},Y=function(e){W.current&&e.target instanceof HTMLElement&&!W.current.contains(e.target)&&J()};return i((function(){return document.addEventListener("mousedown",Y),function(){document.removeEventListener("mousedown",Y)}})),d((function(){J()}),{detectKeys:["Escape","Tab"]},[]),n.createElement(n.Fragment,null,n.createElement(p,t({"aria-activedescendant":L.length?"addressOptions-".concat(q):"","aria-owns":"found_addresses","aria-autocomplete":"both","aria-expanded":L.length?"true":"false",autoComplete:"off",hasError:T||!!I,errorMessage:I,hintText:null!=K?K:"Start typing your address or postcode",isValid:V,isValidVisible:k,isInvalidVisible:A,label:null!=C?C:"Home address",ref:b,required:!0,role:"combobox",type:"search"},B,{onKeyDown:function(e){"Enter"===e.key&&L[q]?(e.preventDefault(),"Address"===L[q].Type&&Q(L[q].Id),P(L[q].Text,L[q].Id),R(-1)):"ArrowUp"===e.key?(e.preventDefault(),q<=-1&&R(L.length-1),R(q-1)):"ArrowDown"===e.key?(e.preventDefault(),q+1>=L.length&&R(0),R(q+1)):R(-1)},onChange:function(e){N(e.target.value),_&&_(e)},onBlur:function(e){var t=!!L.length;M&&!t&&M(e)}})),!!L.length&&n.createElement(n.Fragment,null,n.createElement(v,{role:"status","aria-live":"assertive"},!!L.length&&"We have found ".concat(L.length," result").concat(1!==L.length?"s":""," matching your search. Use up and down arrow keys to navigate")),n.createElement(y,{ref:W},n.createElement(E,{"aria-label":"found addresses",id:"found_addresses",role:"listbox",theme:G},L.map((function(e,t){return n.createElement(w,{tabIndex:0,id:"addressOptions-".concat(t),isActive:t===q,key:e.Id,onClick:function(){X(e)},onKeyDown:function(t){"Enter"===t.key&&X(e)},role:"option","data-hj-suppress":!0,theme:G},n.createElement(f,{as:"span","data-hj-suppress":!0},e.Text," ",e.Description),"Address"!==e.Type&&n.createElement(n.Fragment,null,n.createElement(v,null,"press enter for these addresses"),n.createElement(h,{faIcon:c})))}))))))}));export{b as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as r}from"../../_virtual/_tslib.js";var t="undefined"!=typeof window,e=function(r,t){var e=r/t*100;return e===Number.POSITIVE_INFINITY||Number.isNaN(e)?0:Math.floor(e<1?Math.ceil(e):Math.floor(e))},n=function(r){if(!r)return"";var t=r.toString().split(".");return"".concat(t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")).concat(t[1]?".".concat(t[1]):"")},o=function(r){var t=Number.parseFloat((Math.round(100*r)/100).toString()).toFixed(2);return Number.isNaN(parseFloat(t))||Number.isNaN(r)?"0":n(t)},a=function(t){return Object.entries(t).reduce((function(t,e){var n,o=e[0],a=e[1].replace(/,/g,"");return r(r({},t),((n={})[o]=
|
|
1
|
+
import{__assign as r}from"../../_virtual/_tslib.js";var t="undefined"!=typeof window,e=function(r,t){var e=r/t*100;return e===Number.POSITIVE_INFINITY||Number.isNaN(e)?0:Math.floor(e<1?Math.ceil(e):Math.floor(e))},n=function(r){if(!r)return"";var t=r.toString().split(".");return"".concat(t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")).concat(t[1]?".".concat(t[1]):"")},o=function(r){var t=Number.parseFloat((Math.round(100*r)/100).toString()).toFixed(2);return Number.isNaN(parseFloat(t))||Number.isNaN(r)?"0":n(t)},a=function(t){return Object.entries(t).reduce((function(t,e){var n,o=e[0],a=e[1],i="string"==typeof a?a.replace(/,/g,""):a;return r(r({},t),((n={})[o]=i,n))}),{})};export{e as calculatePercentRounded,o as formatMoneyWithCommas,t as isBrowser,n as numberWithCommas,a as removeCommasFromObjectStringValues};
|
|
2
2
|
//# sourceMappingURL=Helper.js.map
|
package/lib/utils/Helper.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export declare const formatMoney: (value: number) => string;
|
|
|
4
4
|
export declare const numberWithCommas: (n?: number | string) => string;
|
|
5
5
|
export declare const formatMoneyWithCommas: (value: number) => string;
|
|
6
6
|
export declare const camelize: (str: string) => string;
|
|
7
|
-
export declare const removeCommasFromObjectStringValues: <T>(object: T
|
|
7
|
+
export declare const removeCommasFromObjectStringValues: <T>(object: T) => T;
|