@sats-group/ui-lib 85.1.1 → 85.3.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.
package/package.json
CHANGED
package/react/modal/modal.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type Modal as Props, backgrounds } from './modal.types';
|
|
3
|
-
declare const
|
|
3
|
+
declare const RefModal: React.ForwardRefExoticComponent<Props & {
|
|
4
|
+
children?: React.ReactNode | undefined;
|
|
5
|
+
} & React.RefAttributes<HTMLDialogElement>>;
|
|
6
|
+
declare const Modal: typeof RefModal & {
|
|
4
7
|
backgrounds: typeof backgrounds;
|
|
5
8
|
};
|
|
6
9
|
export default Modal;
|
package/react/modal/modal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";var
|
|
1
|
+
"use client";var B=Object.defineProperty,I=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var u=(a,e,s)=>e in a?B(a,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[e]=s,n=(a,e)=>{for(var s in e||(e={}))k.call(e,s)&&u(a,s,e[s]);if(_)for(var s of _(e))w.call(e,s)&&u(a,s,e[s]);return a},f=(a,e)=>I(a,P(e));import p from"classnames";import*as o from"react";import*as C from"react-dom";import l from"../button";import c from"../icons/18/close";import O from"../link-button";import A from"./tab-trapper";import m from"../text";import{ActionTypes as y,backgrounds as N}from"./modal.types";const T=o.forwardRef(({actions:a,ariaLabel:e,background:s=N.primary,children:g,closeLabel:v,explanation:r,id:d,onClick:h=()=>{},title:t},M)=>{const[x,b]=o.useState(!1);return o.useEffect(()=>b(!0)),x?C.createPortal(o.createElement("dialog",{"aria-label":e,className:p("modal",{[`modal--${s}`]:s}),id:d,popover:"auto",ref:M},o.createElement(A,{isActive:!0,className:"modal__inner"},o.createElement("div",{className:p("modal__close-action",{"modal__close-action--always-shown":a&&a.length})},o.createElement(l,{leadingIcon:o.createElement(c,null),popoverTarget:d,size:l.sizes.small,text:v,variant:l.variants.secondary,iconOnly:!0})),t||r?o.createElement("div",{className:"modal__nav"},o.createElement("div",{className:"modal__texts"},t?o.createElement(m,{className:"modal__title",size:m.sizes.headline2,theme:m.themes.emphasis},t):null,r?o.createElement("div",{className:p("modal__explanation",{[`modal__explanation--${s}`]:s})},o.createElement(m,{size:m.sizes.small},r)):null)):null,o.createElement("div",{className:"modal__children"},o.createElement("div",null,g)),a&&a.length?o.createElement("div",{className:"modal__actions"},a.map(i=>i.type===y.LinkButton?o.createElement(O,n({},i.action)):i.type===y.Button?o.createElement(l,f(n({},i.action),{onClick:z=>h(i.buttonId,z)})):null)):o.createElement("div",{className:"modal__close-action-mobile"},o.createElement(l,{leadingIcon:o.createElement(c,null),popoverTarget:d,text:v,variant:l.variants.secondary})))),document.body):null});T.displayName="Modal";const D=Object.assign(T,{backgrounds:N});var F=D;export{F 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 RefModal = React.forwardRef<\n HTMLDialogElement,\n React.PropsWithChildren<Props>\n>(\n (\n {\n actions,\n ariaLabel,\n background = backgrounds.primary,\n children,\n closeLabel,\n explanation,\n id,\n onClick = () => {},\n title,\n },\n ref,\n ) => {\n const [isMounted, setIsMounted] = React.useState(false);\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={ref}\n >\n <TabTrapper isActive={true} className=\"modal__inner\">\n <div\n className={classNames('modal__close-action', {\n 'modal__close-action--always-shown':\n 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);\n\n// NOTE: If this isn't set, stack traces say \"forwardRef\" instead of \"Modal\"\nRefModal.displayName = 'Modal';\n\n// NOTE: The component is redeclared here because TypeScript doesn't accept assigning extra properties to `RefComponent` when it's declared\nconst Modal: typeof RefModal & {\n backgrounds: typeof backgrounds;\n} = Object.assign(RefModal, { 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,EAAWT,EAAM,WAIrB,CACE,CACE,QAAAU,EACA,UAAAC,EACA,WAAAC,EAAaJ,EAAY,QACzB,SAAAK,EACA,WAAAC,EACA,YAAAC,EACA,GAAAC,EACA,QAAAC,EAAU,IAAM,CAAC,EACjB,MAAAC,CACF,EACAC,IACG,CACH,KAAM,CAACC,EAAWC,CAAY,EAAIrB,EAAM,SAAS,EAAK,EAEtD,OAAAA,EAAM,UAAU,IAAMqB,EAAa,EAAI,CAAC,EAEjCD,EACHnB,EAAS,aACPD,EAAA,cAAC,UACC,aAAYW,EACZ,UAAWZ,EAAW,QAAS,CAC7B,CAAC,UAAUa,CAAU,EAAE,EAAGA,CAC5B,CAAC,EACD,GAAII,EACJ,QAAQ,OACR,IAAKG,GAELnB,EAAA,c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AGAO,EAAS,YAAc,QAGvB,MAAMiB,EAEF,OAAO,OAAOjB,EAAU,CAAE,YAAAD,CAAY,CAAC,EAE3C,IAAOmB,EAAQD",
|
|
6
|
+
"names": ["classNames", "React", "ReactDOM", "Button", "Close", "LinkButton", "TabTrapper", "Text", "ActionTypes", "backgrounds", "RefModal", "actions", "ariaLabel", "background", "children", "closeLabel", "explanation", "id", "onClick", "title", "ref", "isMounted", "setIsMounted", "action", "__spreadValues", "__spreadProps", "e", "Modal", "modal_default"]
|
|
7
7
|
}
|
package/react/modal/modal.scss
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
width: 100vw;
|
|
18
18
|
height: 100vh;
|
|
19
19
|
height: 100svh;
|
|
20
|
-
padding: 0 spacing.$m;
|
|
21
20
|
|
|
22
21
|
&::backdrop {
|
|
23
22
|
background: color-mix(
|
|
@@ -52,12 +51,10 @@
|
|
|
52
51
|
|
|
53
52
|
@include break {
|
|
54
53
|
@include elevation.level(24);
|
|
55
|
-
padding: 0
|
|
54
|
+
padding: 0;
|
|
56
55
|
border-radius: corner-radius.$s;
|
|
57
56
|
max-width: 640px;
|
|
58
57
|
height: min-content;
|
|
59
|
-
max-height: 95vh;
|
|
60
|
-
max-height: 95svh;
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
&__texts {
|
|
@@ -124,11 +121,12 @@
|
|
|
124
121
|
display: flex;
|
|
125
122
|
gap: spacing.$m;
|
|
126
123
|
justify-content: space-between;
|
|
127
|
-
padding
|
|
124
|
+
padding: spacing.$l spacing.$m 0;
|
|
128
125
|
height: min-content;
|
|
129
126
|
|
|
130
127
|
@include break {
|
|
131
128
|
margin-bottom: 0;
|
|
129
|
+
padding-inline: spacing.$l;
|
|
132
130
|
}
|
|
133
131
|
}
|
|
134
132
|
|
|
@@ -137,7 +135,11 @@
|
|
|
137
135
|
overflow-x: hidden;
|
|
138
136
|
overflow-y: auto;
|
|
139
137
|
overscroll-behavior: contain;
|
|
140
|
-
padding: spacing.$l
|
|
138
|
+
padding: spacing.$l spacing.$m;
|
|
141
139
|
margin-bottom: auto;
|
|
140
|
+
|
|
141
|
+
@include break {
|
|
142
|
+
padding: spacing.$l;
|
|
143
|
+
}
|
|
142
144
|
}
|
|
143
145
|
}
|