@sats-group/ui-lib 85.3.2 → 85.3.3
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/package.json +1 -1
- package/react/modal/modal.d.ts +1 -4
- package/react/modal/modal.js +1 -1
- package/react/modal/modal.js.map +3 -3
- package/react/modal/modal.scss +19 -2
- package/react/modal/modal.types.d.ts +4 -2
- package/react/modal/modal.types.js +1 -1
- package/react/modal/modal.types.js.map +2 -2
package/package.json
CHANGED
package/react/modal/modal.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type Modal as Props, backgrounds } from './modal.types';
|
|
3
|
-
declare const
|
|
4
|
-
children?: React.ReactNode | undefined;
|
|
5
|
-
} & React.RefAttributes<HTMLDialogElement>>;
|
|
6
|
-
declare const Modal: typeof RefModal & {
|
|
3
|
+
declare const Modal: React.FC<React.PropsWithChildren<Props>> & {
|
|
7
4
|
backgrounds: typeof backgrounds;
|
|
8
5
|
};
|
|
9
6
|
export default Modal;
|
package/react/modal/modal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";var
|
|
1
|
+
"use client";var I=Object.defineProperty,P=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var c=Object.getOwnPropertySymbols;var D=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var f=(o,a,l)=>a in o?I(o,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[a]=l,p=(o,a)=>{for(var l in a||(a={}))D.call(a,l)&&f(o,l,a[l]);if(c)for(var l of c(a))E.call(a,l)&&f(o,l,a[l]);return o},N=(o,a)=>P(o,B(a));import u from"classnames";import*as e from"react";import*as H from"react-dom";import s from"../button";import T from"../icons/18/close";import L from"../link-button";import w from"./tab-trapper";import r from"../text";import{ActionTypes as g,backgrounds as h}from"./modal.types";const v=({actions:o,ariaLabel:a,background:l=h.primary,children:y,closeLabel:_,explanation:n,id:t,onClick:M=()=>{},ref:x,title:d})=>{const[b,k]=e.useState(!1),m=e.useRef(null);e.useImperativeHandle(x,()=>m.current,[]);const z=()=>{m.current&&m.current.hidePopover()};return e.useEffect(()=>k(!0)),b?H.createPortal(e.createElement("dialog",{"aria-label":a,className:u("modal",{[`modal--${l}`]:l}),id:t,popover:"auto",ref:m},e.createElement("div",{className:"modal__click-trapper",onClick:z}),e.createElement(w,{isActive:!0,className:"modal__inner"},e.createElement("div",{className:u("modal__close-action",{"modal__close-action--always-shown":o&&o.length})},e.createElement(s,{leadingIcon:e.createElement(T,null),popoverTarget:t,size:s.sizes.small,text:_,variant:s.variants.secondary,iconOnly:!0})),d||n?e.createElement("div",{className:"modal__nav"},e.createElement("div",{className:"modal__texts"},d?e.createElement(r,{className:"modal__title",size:r.sizes.headline2,theme:r.themes.emphasis},d):null,n?e.createElement("div",{className:u("modal__explanation",{[`modal__explanation--${l}`]:l})},e.createElement(r,{size:r.sizes.small},n)):null)):null,e.createElement("div",{className:"modal__children"},e.createElement("div",null,y)),o&&o.length?e.createElement("div",{className:"modal__actions"},o.map(i=>i.type===g.LinkButton?e.createElement(L,p({},i.action)):i.type===g.Button?e.createElement(s,N(p({},i.action),{onClick:C=>M(i.buttonId,C)})):null)):e.createElement("div",{className:"modal__close-action-mobile"},e.createElement(s,{leadingIcon:e.createElement(T,null),popoverTarget:t,text:_,variant:s.variants.secondary})))),document.body):null};v.displayName="Modal",v.backgrounds=h;var G=v;export{G as default};
|
|
2
2
|
//# sourceMappingURL=modal.js.map
|
package/react/modal/modal.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../react/modal/modal.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\n\nimport Button from '../button';\nimport Close from '../icons/18/close';\nimport LinkButton from '../link-button';\nimport TabTrapper from './tab-trapper';\nimport Text from '../text';\n\nimport { ActionTypes, type Modal as Props, backgrounds } from './modal.types';\n\nconst
|
|
5
|
-
"mappings": "0bAEA,OAAOA,MAAgB,aACvB,UAAYC,MAAW,QACvB,UAAYC,MAAc,YAE1B,OAAOC,MAAY,YACnB,OAAOC,MAAW,oBAClB,OAAOC,MAAgB,iBACvB,OAAOC,MAAgB,gBACvB,OAAOC,MAAU,UAEjB,OAAS,eAAAC,EAAkC,eAAAC,MAAmB,gBAE9D,MAAMC,
|
|
6
|
-
"names": ["classNames", "React", "ReactDOM", "Button", "Close", "LinkButton", "TabTrapper", "Text", "ActionTypes", "backgrounds", "
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\n\nimport Button from '../button';\nimport Close from '../icons/18/close';\nimport LinkButton from '../link-button';\nimport TabTrapper from './tab-trapper';\nimport Text from '../text';\n\nimport { ActionTypes, type Modal as Props, backgrounds } from './modal.types';\n\nconst Modal: React.FC<React.PropsWithChildren<Props>> & {\n backgrounds: typeof backgrounds;\n} = ({\n actions,\n ariaLabel,\n background = backgrounds.primary,\n children,\n closeLabel,\n explanation,\n id,\n onClick = () => {},\n ref,\n title,\n}) => {\n const [isMounted, setIsMounted] = React.useState(false);\n const innerRef = React.useRef<HTMLDialogElement>(null);\n\n React.useImperativeHandle<HTMLDialogElement | null, HTMLDialogElement | null>(\n ref,\n () => innerRef.current,\n [],\n );\n\n const hide = () => {\n if (innerRef.current) {\n innerRef.current.hidePopover();\n }\n };\n\n React.useEffect(() => setIsMounted(true));\n\n return isMounted\n ? ReactDOM.createPortal(\n <dialog\n aria-label={ariaLabel}\n className={classNames('modal', {\n [`modal--${background}`]: background,\n })}\n id={id}\n popover=\"auto\"\n ref={innerRef}\n >\n <div className=\"modal__click-trapper\" onClick={hide} />\n <TabTrapper isActive={true} className=\"modal__inner\">\n <div\n className={classNames('modal__close-action', {\n 'modal__close-action--always-shown': actions && actions.length,\n })}\n >\n <Button\n leadingIcon={<Close />}\n popoverTarget={id}\n size={Button.sizes.small}\n text={closeLabel}\n variant={Button.variants.secondary}\n iconOnly\n />\n </div>\n {title || explanation ? (\n <div className=\"modal__nav\">\n <div className=\"modal__texts\">\n {title ? (\n <Text\n className=\"modal__title\"\n size={Text.sizes.headline2}\n theme={Text.themes.emphasis}\n >\n {title}\n </Text>\n ) : null}\n {explanation ? (\n <div\n className={classNames('modal__explanation', {\n [`modal__explanation--${background}`]: background,\n })}\n >\n <Text size={Text.sizes.small}>{explanation}</Text>\n </div>\n ) : null}\n </div>\n </div>\n ) : null}\n <div className=\"modal__children\">\n <div>{children}</div>\n </div>\n {actions && actions.length ? (\n <div className=\"modal__actions\">\n {actions.map(action =>\n action.type === ActionTypes.LinkButton ? (\n <LinkButton {...action.action} />\n ) : action.type === ActionTypes.Button ? (\n <Button\n {...action.action}\n onClick={e => onClick(action.buttonId, e)}\n />\n ) : null,\n )}\n </div>\n ) : (\n <div className=\"modal__close-action-mobile\">\n <Button\n leadingIcon={<Close />}\n popoverTarget={id}\n text={closeLabel}\n variant={Button.variants.secondary}\n />\n </div>\n )}\n </TabTrapper>\n </dialog>,\n document.body,\n )\n : null;\n};\n\nModal.displayName = 'Modal';\nModal.backgrounds = backgrounds;\n\nexport default Modal;\n"],
|
|
5
|
+
"mappings": "0bAEA,OAAOA,MAAgB,aACvB,UAAYC,MAAW,QACvB,UAAYC,MAAc,YAE1B,OAAOC,MAAY,YACnB,OAAOC,MAAW,oBAClB,OAAOC,MAAgB,iBACvB,OAAOC,MAAgB,gBACvB,OAAOC,MAAU,UAEjB,OAAS,eAAAC,EAAkC,eAAAC,MAAmB,gBAE9D,MAAMC,EAEF,CAAC,CACH,QAAAC,EACA,UAAAC,EACA,WAAAC,EAAaJ,EAAY,QACzB,SAAAK,EACA,WAAAC,EACA,YAAAC,EACA,GAAAC,EACA,QAAAC,EAAU,IAAM,CAAC,EACjB,IAAAC,EACA,MAAAC,CACF,IAAM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CAAS,CACjB,EACCH,GAAWA,EAAQ,OAClBV,EAAA,cAAC,OAAI,UAAU,kBACZU,EAAQ,IAAIc,GACXA,EAAO,OAASjB,EAAY,WAC1BP,EAAA,cAACI,EAAAqB,EAAA,GAAeD,EAAO,OAAQ,EAC7BA,EAAO,OAASjB,EAAY,OAC9BP,EAAA,cAACE,EAAAwB,EAAAD,EAAA,GACKD,EAAO,QADZ,CAEC,QAASG,GAAKV,EAAQO,EAAO,SAAUG,CAAC,GAC1C,EACE,IACN,CACF,EAEA3B,EAAA,cAAC,OAAI,UAAU,8BACbA,EAAA,cAACE,EAAA,CACC,YAAaF,EAAA,cAACG,EAAA,IAAM,EACpB,cAAea,EACf,KAAMF,EACN,QAASZ,EAAO,SAAS,UAC3B,CACF,CAEJ,CACF,EACA,SAAS,IACX,EACA,IACN,EAEAO,EAAM,YAAc,QACpBA,EAAM,YAAcD,EAEpB,IAAOoB,EAAQnB",
|
|
6
|
+
"names": ["classNames", "React", "ReactDOM", "Button", "Close", "LinkButton", "TabTrapper", "Text", "ActionTypes", "backgrounds", "Modal", "actions", "ariaLabel", "background", "children", "closeLabel", "explanation", "id", "onClick", "ref", "title", "isMounted", "setIsMounted", "innerRef", "hide", "action", "__spreadValues", "__spreadProps", "e", "modal_default"]
|
|
7
7
|
}
|
package/react/modal/modal.scss
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
border: none;
|
|
14
|
-
display:
|
|
14
|
+
display: none;
|
|
15
15
|
padding: 0;
|
|
16
16
|
overflow: hidden;
|
|
17
17
|
width: 100vw;
|
|
@@ -30,15 +30,32 @@
|
|
|
30
30
|
display: block;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
:root:has(&:popover-open) {
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&__click-trapper {
|
|
38
|
+
height: 100vh;
|
|
39
|
+
height: 100svh;
|
|
40
|
+
inset: 0;
|
|
41
|
+
left: 0;
|
|
42
|
+
position: fixed;
|
|
43
|
+
top: 0;
|
|
44
|
+
width: 100%;
|
|
45
|
+
z-index: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
33
48
|
&__inner {
|
|
34
49
|
display: flex;
|
|
35
50
|
flex-direction: column;
|
|
36
51
|
height: 100%;
|
|
52
|
+
position: relative;
|
|
53
|
+
z-index: 1;
|
|
37
54
|
|
|
38
55
|
@include break {
|
|
39
56
|
height: fit-content;
|
|
40
57
|
max-height: calc(100vh - (spacing.$m * 2));
|
|
41
|
-
max-height: calc(
|
|
58
|
+
max-height: calc(100svh - (spacing.$m * 2));
|
|
42
59
|
}
|
|
43
60
|
}
|
|
44
61
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
1
2
|
import { Button } from '../button/button.types';
|
|
2
3
|
import { LinkButton } from '../link-button/link-button.types';
|
|
3
4
|
import { ObjectValues } from '../types';
|
|
@@ -19,13 +20,14 @@ type ButtonAction = {
|
|
|
19
20
|
buttonId: string;
|
|
20
21
|
};
|
|
21
22
|
export type Modal = {
|
|
23
|
+
actions?: (LinkAction | ButtonAction)[];
|
|
22
24
|
ariaLabel: string;
|
|
23
25
|
background?: ObjectValues<typeof backgrounds>;
|
|
24
26
|
closeLabel: string;
|
|
25
27
|
explanation?: string;
|
|
26
28
|
id: string;
|
|
27
|
-
title?: string;
|
|
28
|
-
actions?: (LinkAction | ButtonAction)[];
|
|
29
29
|
onClick?: (id: string, arg?: unknown) => void;
|
|
30
|
+
ref?: Ref<HTMLDialogElement>;
|
|
31
|
+
title?: string;
|
|
30
32
|
};
|
|
31
33
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const
|
|
1
|
+
const p={primary:"primary",secondary:"secondary"};var n=(t=>(t.LinkButton="LinkButton",t.Button="Button",t))(n||{});export{n as ActionTypes,p as backgrounds};
|
|
2
2
|
//# sourceMappingURL=modal.types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../react/modal/modal.types.ts"],
|
|
4
|
-
"sourcesContent": ["import { Button } from '../button/button.types';\nimport { LinkButton } from '../link-button/link-button.types';\nimport { ObjectValues } from '../types';\n\nexport const backgrounds = {\n primary: 'primary',\n secondary: 'secondary',\n} as const;\n\nexport enum ActionTypes {\n LinkButton = 'LinkButton',\n Button = 'Button',\n}\n\ntype LinkAction = {\n type: ActionTypes.LinkButton;\n action: LinkButton;\n};\n\ntype ButtonAction = {\n type: ActionTypes.Button;\n action: Button;\n buttonId: string;\n};\n\nexport type Modal = {\n ariaLabel: string;\n background?: ObjectValues<typeof backgrounds>;\n closeLabel: string;\n explanation?: string;\n id: string;\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { Ref } from 'react';\nimport { Button } from '../button/button.types';\nimport { LinkButton } from '../link-button/link-button.types';\nimport { ObjectValues } from '../types';\n\nexport const backgrounds = {\n primary: 'primary',\n secondary: 'secondary',\n} as const;\n\nexport enum ActionTypes {\n LinkButton = 'LinkButton',\n Button = 'Button',\n}\n\ntype LinkAction = {\n type: ActionTypes.LinkButton;\n action: LinkButton;\n};\n\ntype ButtonAction = {\n type: ActionTypes.Button;\n action: Button;\n buttonId: string;\n};\n\nexport type Modal = {\n actions?: (LinkAction | ButtonAction)[];\n ariaLabel: string;\n background?: ObjectValues<typeof backgrounds>;\n closeLabel: string;\n explanation?: string;\n id: string;\n onClick?: (id: string, arg?: unknown) => void;\n ref?: Ref<HTMLDialogElement>;\n title?: string;\n};\n"],
|
|
5
|
+
"mappings": "AAKO,MAAMA,EAAc,CACzB,QAAS,UACT,UAAW,WACb,EAEO,IAAKC,OACVA,EAAA,WAAa,aACbA,EAAA,OAAS,SAFCA,OAAA",
|
|
6
6
|
"names": ["backgrounds", "ActionTypes"]
|
|
7
7
|
}
|