@stenajs-webui/modal 18.12.0 → 18.12.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/dist/index.es.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function(){"use strict";try{var o=document.createElement("style");o.appendChild(document.createTextNode("._overlay_5x3op_1{--swui-modal-animation-time: var(--swui-animation-time-fast);--swui-modal-overlay-bg-color: var(--swui-overlay-bg-color);--swui-modal-content-bg-color: var(--swui-white);--swui-modal-width: 960px;--swui-modal-max-width: 100%;--swui-modal-header-border-color: var(--lhds-color-ui-300);--swui-modal-shadow: var(--swui-shadow-modal);--swui-modal-footer-shadow: var(--swui-shadow-modal);position:fixed;z-index:10;top:0;left:0;right:0;bottom:0;background-color:var(--swui-modal-overlay-bg-color);overflow:auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;-webkit-animation:_fadeIn_5x3op_1 var(--swui-modal-animation-time) cubic-bezier(.645,.045,.355,1) both;animation:_fadeIn_5x3op_1 var(--swui-modal-animation-time) cubic-bezier(.645,.045,.355,1) both}@media print{._overlay_5x3op_1{background-color:#fff}}._overlay_5x3op_1 ._modal_5x3op_31{max-width:100%;outline:none;pointer-events:none}@media (max-width: 768px){._overlay_5x3op_1 ._modal_5x3op_31{width:100%}}._overlay_5x3op_1 ._content_5x3op_41{position:relative;display:block;background:var(--swui-modal-content-bg-color);box-shadow:var(--swui-modal-shadow);pointer-events:all;top:calc(var(--swui-metrics-space) * 2);width:var(--swui-modal-width);max-width:var(--swui-modal-max-width)}@media (max-width: 768px){._overlay_5x3op_1 ._content_5x3op_41{top:0;width:100%;max-width:100%}}._overlay_5x3op_1 ._content_5x3op_41{-webkit-animation:_appear_5x3op_1 var(--swui-animation-time-fast) cubic-bezier(.645,.045,.355,1) both;animation:_appear_5x3op_1 var(--swui-animation-time-fast) cubic-bezier(.645,.045,.355,1) both}@media print{._overlay_5x3op_1 ._content_5x3op_41{box-shadow:none;top:0}}._overlay_5x3op_1 ._content_5x3op_41 :focus{outline:0}._overlay_5x3op_1 ._content_5x3op_41._isDraggable_5x3op_70 .draggable-modal-handle{cursor:move}._overlay_5x3op_1 ._content_5x3op_41._isDraggable_5x3op_70 .draggable-modal-handle .draggable-modal-cancel,._overlay_5x3op_1 ._content_5x3op_41._isDraggable_5x3op_70 .draggable-modal-handle [role=tooltip]{cursor:initial}@-webkit-keyframes _fadeIn_5x3op_1{0%{background-color:var(--swui-hidden)}to{background-color:var(--swui-modal-overlay-bg-color)}}@keyframes _fadeIn_5x3op_1{0%{background-color:var(--swui-hidden)}to{background-color:var(--swui-modal-overlay-bg-color)}}@-webkit-keyframes _appear_5x3op_1{0%{opacity:0}to{opacity:1}}@keyframes _appear_5x3op_1{0%{opacity:0}to{opacity:1}}._footer_5x3op_101{background-color:var(--swui-modal-content-bg-color)}._stickyFooter_5x3op_105{position:-webkit-sticky;position:sticky;bottom:0;box-shadow:var(--swui-modal-footer-shadow)}@media print{._stickyFooter_5x3op_105{position:static;box-shadow:none}}._portal_17quq_1 ._overlay_17quq_2{position:fixed;inset:0}._portal_17quq_1 ._content_17quq_7{box-shadow:var(--swui-shadow-modal);background:white;position:absolute;transition:-webkit-transform var(--swui-animation-time-medium) ease-in-out;transition:transform var(--swui-animation-time-medium) ease-in-out;transition:transform var(--swui-animation-time-medium) ease-in-out,-webkit-transform var(--swui-animation-time-medium) ease-in-out}._portal_17quq_1 ._content_17quq_7._slideFromLeft_17quq_13,._portal_17quq_1 ._content_17quq_7._slideFromRight_17quq_14{-webkit-transform:translateX(var(--translate-x-outside-screen, 0));transform:translate(var(--translate-x-outside-screen, 0));overflow-y:auto;top:0;bottom:0}._portal_17quq_1 ._content_17quq_7._slideFromLeft_17quq_13._afterOpen_17quq_20,._portal_17quq_1 ._content_17quq_7._slideFromRight_17quq_14._afterOpen_17quq_20{-webkit-transform:translateX(0);transform:translate(0)}._portal_17quq_1 ._content_17quq_7._slideFromLeft_17quq_13._beforeClose_17quq_24,._portal_17quq_1 ._content_17quq_7._slideFromRight_17quq_14._beforeClose_17quq_24{-webkit-transform:translateX(var(--translate-x-outside-screen));transform:translate(var(--translate-x-outside-screen))}._portal_17quq_1 ._content_17quq_7._slideFromTop_17quq_29,._portal_17quq_1 ._content_17quq_7._slideFromBottom_17quq_30{-webkit-transform:translateY(var(--translate-y-outside-screen, 0));transform:translateY(var(--translate-y-outside-screen, 0));overflow-x:auto;left:0;right:0}._portal_17quq_1 ._content_17quq_7._slideFromTop_17quq_29._afterOpen_17quq_20,._portal_17quq_1 ._content_17quq_7._slideFromBottom_17quq_30._afterOpen_17quq_20{-webkit-transform:translateY(0);transform:translateY(0)}._portal_17quq_1 ._content_17quq_7._slideFromTop_17quq_29._beforeClose_17quq_24,._portal_17quq_1 ._content_17quq_7._slideFromBottom_17quq_30._beforeClose_17quq_24{-webkit-transform:translateY(var(--translate-y-outside-screen));transform:translateY(var(--translate-y-outside-screen))}._portal_17quq_1 ._content_17quq_7._slideFromLeft_17quq_13{--translate-x-outside-screen: -100%;width:370px;left:0}._portal_17quq_1 ._content_17quq_7._slideFromRight_17quq_14{--translate-x-outside-screen: 100%;width:370px;right:0}._portal_17quq_1 ._content_17quq_7._slideFromTop_17quq_29{--translate-y-outside-screen: -100%;height:370px;top:0}._portal_17quq_1 ._content_17quq_7._slideFromBottom_17quq_30{--translate-y-outside-screen: 100%;height:370px;bottom:0}._modal_4fwgb_1{display:flex;justify-content:center;align-items:center;position:fixed;top:0;left:0;right:0;bottom:0;background-color:transparent}._overlay_4fwgb_13{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--swui-overlay-bg-color)}")),document.head.appendChild(o)}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ import { jsx as e, jsxs as c, Fragment as h } from "react/jsx-runtime";
2
3
  import _ from "react-modal";
3
4
  import w from "react-draggable";
4
5
  import u from "classnames";
5
- import { jsx as e, jsxs as c, Fragment as h } from "react/jsx-runtime";
6
6
  import { exhaustSwitchCase as x, Column as v, Box as m, Spacing as q, Row as f, Indent as S, Heading as A, Txt as B } from "@stenajs-webui/core";
7
7
  import { Spinner as L, Icon as M, FlatButton as D, stenaTimes as I } from "@stenajs-webui/elements";
8
8
  const O = "_overlay_5x3op_1", R = "_fadeIn_5x3op_1", $ = "_modal_5x3op_31", k = "_content_5x3op_41", E = "_appear_5x3op_1", j = "_isDraggable_5x3op_70", G = "_footer_5x3op_101", z = "_stickyFooter_5x3op_105", n = {
@@ -20,27 +20,36 @@ const O = "_overlay_5x3op_1", R = "_fadeIn_5x3op_1", $ = "_modal_5x3op_31", k =
20
20
  draggable: l = !1,
21
21
  children: r,
22
22
  ...s
23
- }) => /* @__PURE__ */ e(_, {
24
- overlayClassName: n.overlay,
25
- className: n.modal,
26
- ...s,
27
- children: /* @__PURE__ */ e(w, {
28
- handle: `.${b}`,
29
- cancel: `.${F}, button, [role="tooltip"]`,
30
- bounds: ".ReactModal__Overlay",
31
- disabled: !l,
32
- children: /* @__PURE__ */ e("div", {
33
- style: {
34
- ["--swui-modal-width"]: o,
35
- ["--swui-modal-max-width"]: t
36
- },
37
- className: u(n.content, {
38
- [n.isDraggable]: l
39
- }),
40
- children: r
41
- })
42
- })
43
- }), T = "_portal_17quq_1", J = "_overlay_17quq_2", K = "_content_17quq_7", Q = "_slideFromLeft_17quq_13", U = "_slideFromRight_17quq_14", V = "_afterOpen_17quq_20", W = "_beforeClose_17quq_24", X = "_slideFromTop_17quq_29", Y = "_slideFromBottom_17quq_30", a = {
23
+ }) => /* @__PURE__ */ e(
24
+ _,
25
+ {
26
+ overlayClassName: n.overlay,
27
+ className: n.modal,
28
+ ...s,
29
+ children: /* @__PURE__ */ e(
30
+ w,
31
+ {
32
+ handle: `.${b}`,
33
+ cancel: `.${F}, button, [role="tooltip"]`,
34
+ bounds: ".ReactModal__Overlay",
35
+ disabled: !l,
36
+ children: /* @__PURE__ */ e(
37
+ "div",
38
+ {
39
+ style: {
40
+ ["--swui-modal-width"]: o,
41
+ ["--swui-modal-max-width"]: t
42
+ },
43
+ className: u(n.content, {
44
+ [n.isDraggable]: l
45
+ }),
46
+ children: r
47
+ }
48
+ )
49
+ }
50
+ )
51
+ }
52
+ ), T = "_portal_17quq_1", J = "_overlay_17quq_2", K = "_content_17quq_7", Q = "_slideFromLeft_17quq_13", U = "_slideFromRight_17quq_14", V = "_afterOpen_17quq_20", W = "_beforeClose_17quq_24", X = "_slideFromTop_17quq_29", Y = "_slideFromBottom_17quq_30", a = {
44
53
  portal: T,
45
54
  overlay: J,
46
55
  content: K,
@@ -58,37 +67,28 @@ const O = "_overlay_5x3op_1", R = "_fadeIn_5x3op_1", $ = "_modal_5x3op_31", k =
58
67
  portalTarget: s,
59
68
  ...i
60
69
  }) => {
61
- const {
62
- height: d,
63
- width: p
64
- } = i;
65
- return /* @__PURE__ */ e(_, {
66
- closeTimeoutMS: 250,
67
- portalClassName: a.portal,
68
- overlayClassName: {
69
- base: a.overlay,
70
- afterOpen: a.afterOpen,
71
- beforeClose: a.beforeClose
72
- },
73
- className: {
74
- base: u(a.content, Z(r)),
75
- afterOpen: a.afterOpen,
76
- beforeClose: a.beforeClose
77
- },
78
- style: {
79
- content: {
80
- width: p,
81
- height: d,
82
- background: o
70
+ const { height: d, width: p } = i;
71
+ return /* @__PURE__ */ e(
72
+ _,
73
+ {
74
+ closeTimeoutMS: 250,
75
+ portalClassName: a.portal,
76
+ overlayClassName: {
77
+ base: a.overlay,
78
+ afterOpen: a.afterOpen,
79
+ beforeClose: a.beforeClose
83
80
  },
84
- overlay: {
85
- zIndex: t
86
- }
87
- },
88
- parentSelector: s ? () => s : void 0,
89
- ...i,
90
- children: l
91
- });
81
+ className: {
82
+ base: u(a.content, Z(r)),
83
+ afterOpen: a.afterOpen,
84
+ beforeClose: a.beforeClose
85
+ },
86
+ style: { content: { width: p, height: d, background: o }, overlay: { zIndex: t } },
87
+ parentSelector: s ? () => s : void 0,
88
+ ...i,
89
+ children: l
90
+ }
91
+ );
92
92
  }, Z = (o) => {
93
93
  switch (o) {
94
94
  case "left":
@@ -102,97 +102,94 @@ const O = "_overlay_5x3op_1", R = "_fadeIn_5x3op_1", $ = "_modal_5x3op_31", k =
102
102
  default:
103
103
  return x(o, a.slideFromLeft);
104
104
  }
105
- }, P = {
106
- overlay: {
107
- justifyContent: "center"
108
- }
109
- }, _e = ({
105
+ }, P = { overlay: { justifyContent: "center" } }, _e = ({
110
106
  children: o,
111
107
  ...t
112
- }) => /* @__PURE__ */ e(_, {
113
- overlayClassName: n.overlay,
114
- className: n.modal,
115
- style: P,
116
- ...t,
117
- children: /* @__PURE__ */ e("div", {
118
- className: n.content,
119
- style: {
120
- ["--swui-modal-width"]: "fit-content"
121
- },
122
- children: o
123
- })
124
- }), ee = "_modal_4fwgb_1", oe = "_overlay_4fwgb_13", y = {
108
+ }) => /* @__PURE__ */ e(
109
+ _,
110
+ {
111
+ overlayClassName: n.overlay,
112
+ className: n.modal,
113
+ style: P,
114
+ ...t,
115
+ children: /* @__PURE__ */ e(
116
+ "div",
117
+ {
118
+ className: n.content,
119
+ style: { ["--swui-modal-width"]: "fit-content" },
120
+ children: o
121
+ }
122
+ )
123
+ }
124
+ ), ee = "_modal_4fwgb_1", oe = "_overlay_4fwgb_13", y = {
125
125
  modal: ee,
126
126
  overlay: oe
127
127
  }, pe = ({
128
128
  headerIconLeft: o,
129
129
  headerText: t,
130
130
  ...l
131
- }) => /* @__PURE__ */ e(_, {
132
- ...l,
133
- isOpen: !0,
134
- className: y.modal,
135
- overlayClassName: y.overlay,
136
- children: /* @__PURE__ */ c(v, {
137
- spacing: 2,
138
- alignItems: "center",
139
- children: [/* @__PURE__ */ e(m, {
140
- alignItems: "center",
141
- justifyContent: "center",
142
- width: "64px",
143
- height: "64px",
144
- borderRadius: "50%",
145
- background: "white",
146
- shadow: "modal",
147
- children: /* @__PURE__ */ e(L, {
148
- size: "small"
149
- })
150
- }), (o || t) && /* @__PURE__ */ c(h, {
151
- children: [/* @__PURE__ */ e(q, {}), /* @__PURE__ */ c(f, {
152
- indent: 2,
153
- children: [o && /* @__PURE__ */ c(h, {
154
- children: [/* @__PURE__ */ e(M, {
155
- size: 14,
156
- icon: o,
157
- color: "white"
158
- }), /* @__PURE__ */ e(S, {})]
159
- }), t && /* @__PURE__ */ e(A, {
160
- variant: "h4",
161
- color: "white",
162
- children: t
163
- })]
164
- })]
165
- })]
166
- })
167
- }), te = ({
131
+ }) => /* @__PURE__ */ e(
132
+ _,
133
+ {
134
+ ...l,
135
+ isOpen: !0,
136
+ className: y.modal,
137
+ overlayClassName: y.overlay,
138
+ children: /* @__PURE__ */ c(v, { spacing: 2, alignItems: "center", children: [
139
+ /* @__PURE__ */ e(
140
+ m,
141
+ {
142
+ alignItems: "center",
143
+ justifyContent: "center",
144
+ width: "64px",
145
+ height: "64px",
146
+ borderRadius: "50%",
147
+ background: "white",
148
+ shadow: "modal",
149
+ children: /* @__PURE__ */ e(L, { size: "small" })
150
+ }
151
+ ),
152
+ (o || t) && /* @__PURE__ */ c(h, { children: [
153
+ /* @__PURE__ */ e(q, {}),
154
+ /* @__PURE__ */ c(f, { indent: 2, children: [
155
+ o && /* @__PURE__ */ c(h, { children: [
156
+ /* @__PURE__ */ e(M, { size: 14, icon: o, color: "white" }),
157
+ /* @__PURE__ */ e(S, {})
158
+ ] }),
159
+ t && /* @__PURE__ */ e(A, { variant: "h4", color: "white", children: t })
160
+ ] })
161
+ ] })
162
+ ] })
163
+ }
164
+ ), te = ({
168
165
  onRequestClose: o,
169
166
  header: t,
170
167
  headerText: l,
171
168
  closeButtonClassName: r
172
- }) => /* @__PURE__ */ c(f, {
173
- spacing: 2,
174
- indent: 2,
175
- borderBottom: "1px solid var(--swui-modal-header-border-color)",
176
- className: b,
177
- children: [/* @__PURE__ */ c(f, {
178
- flex: 1,
179
- indent: !0,
180
- alignItems: "center",
181
- children: [l && /* @__PURE__ */ e(B, {
182
- className: F,
183
- size: "large",
184
- children: l
185
- }), t]
186
- }), /* @__PURE__ */ e(m, {
187
- alignSelf: "flex-start",
188
- children: /* @__PURE__ */ e(D, {
189
- className: r,
190
- onClick: o,
191
- "aria-label": "Close",
192
- leftIcon: I
193
- })
194
- })]
195
- }), fe = ({
169
+ }) => /* @__PURE__ */ c(
170
+ f,
171
+ {
172
+ spacing: 2,
173
+ indent: 2,
174
+ borderBottom: "1px solid var(--swui-modal-header-border-color)",
175
+ className: b,
176
+ children: [
177
+ /* @__PURE__ */ c(f, { flex: 1, indent: !0, alignItems: "center", children: [
178
+ l && /* @__PURE__ */ e(B, { className: F, size: "large", children: l }),
179
+ t
180
+ ] }),
181
+ /* @__PURE__ */ e(m, { alignSelf: "flex-start", children: /* @__PURE__ */ e(
182
+ D,
183
+ {
184
+ className: r,
185
+ onClick: o,
186
+ "aria-label": "Close",
187
+ leftIcon: I
188
+ }
189
+ ) })
190
+ ]
191
+ }
192
+ ), fe = ({
196
193
  header: o,
197
194
  headerText: t,
198
195
  children: l,
@@ -204,32 +201,27 @@ const O = "_overlay_5x3op_1", R = "_fadeIn_5x3op_1", $ = "_modal_5x3op_31", k =
204
201
  footer: g,
205
202
  disableStickyFooter: C = !1,
206
203
  ...N
207
- }) => /* @__PURE__ */ c(H, {
208
- ...N,
209
- onRequestClose: d,
210
- draggable: i,
211
- children: [/* @__PURE__ */ e(te, {
212
- onRequestClose: d,
213
- header: o,
214
- headerText: t,
215
- closeButtonClassName: p
216
- }), /* @__PURE__ */ e(m, {
217
- spacing: typeof r == "number" ? r : 1,
218
- indent: typeof s == "number" ? s : 1,
219
- children: l
220
- }), g && /* @__PURE__ */ e(m, {
221
- className: u(n.footer, {
222
- [n.stickyFooter]: !C
223
- }),
224
- children: g
225
- })]
226
- }), ue = ({
227
- children: o
228
- }) => /* @__PURE__ */ e(v, {
229
- indent: 2,
230
- spacing: 2,
231
- children: o
232
- });
204
+ }) => /* @__PURE__ */ c(H, { ...N, onRequestClose: d, draggable: i, children: [
205
+ /* @__PURE__ */ e(
206
+ te,
207
+ {
208
+ onRequestClose: d,
209
+ header: o,
210
+ headerText: t,
211
+ closeButtonClassName: p
212
+ }
213
+ ),
214
+ /* @__PURE__ */ e(m, { spacing: typeof r == "number" ? r : 1, indent: typeof s == "number" ? s : 1, children: l }),
215
+ g && /* @__PURE__ */ e(
216
+ m,
217
+ {
218
+ className: u(n.footer, {
219
+ [n.stickyFooter]: !C
220
+ }),
221
+ children: g
222
+ }
223
+ )
224
+ ] }), ue = ({ children: o }) => /* @__PURE__ */ e(v, { indent: 2, spacing: 2, children: o });
233
225
  export {
234
226
  H as BaseModal,
235
227
  _e as CenterModal,
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/components/modal/BaseModal.tsx","../src/components/drawer/Drawer.tsx","../src/components/center-modal/CenterModal.tsx","../src/components/loading-modal/LoadingModal.tsx","../src/components/modal/ModalHeader.tsx","../src/components/modal/Modal.tsx","../src/components/modal/ModalFooter.tsx"],"sourcesContent":["import * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport Draggable from \"react-draggable\";\nimport cx from \"classnames\";\nimport styles from \"./Modal.module.css\";\n\nexport interface BaseModalProps extends ReactModal.Props {\n width?: string;\n maxWidth?: string;\n onRequestClose?: () => void;\n draggable?: boolean;\n}\n\nexport const DRAGGABLE_HANDLE_CLASSNAME = \"draggable-modal-handle\";\nexport const DRAGGABLE_CANCEL_CLASSNAME = \"draggable-modal-cancel\";\n\nexport const BaseModal: React.FC<BaseModalProps> = ({\n width,\n maxWidth,\n draggable = false,\n children,\n ...reactModalProps\n}) => {\n return (\n <ReactModal\n overlayClassName={styles.overlay}\n className={styles.modal}\n {...reactModalProps}\n >\n <Draggable\n handle={`.${DRAGGABLE_HANDLE_CLASSNAME}`}\n cancel={`.${DRAGGABLE_CANCEL_CLASSNAME}, button, [role=\"tooltip\"]`}\n bounds=\".ReactModal__Overlay\"\n disabled={!draggable}\n >\n <div\n style={{\n [\"--swui-modal-width\" as string]: width,\n [\"--swui-modal-max-width\" as string]: maxWidth,\n }}\n className={cx(styles.content, {\n [styles.isDraggable]: draggable,\n })}\n >\n {children}\n </div>\n </Draggable>\n </ReactModal>\n );\n};\n","import * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport cx from \"classnames\";\nimport styles from \"./Drawer.module.css\";\nimport { exhaustSwitchCase, FlattenUnion } from \"@stenajs-webui/core\";\n\nexport type SlideFrom = SlideFromLeftRight | SlideFromTopBottom;\nexport type SlideFromLeftRight = \"left\" | \"right\";\nexport type SlideFromTopBottom = \"top\" | \"bottom\";\n\nexport type DrawerProps = DrawerBaseLeftRight | DrawerBaseTopBottom;\n\ninterface DrawerBaseLeftRight extends DrawerBaseProps {\n width?: string;\n /**\n * Which direction the drawer will appear from.\n * @default left\n * @param {String('left'|'right')}\n */\n slideFrom?: SlideFromLeftRight;\n}\n\ninterface DrawerBaseTopBottom extends DrawerBaseProps {\n height?: string;\n /**\n * Which direction the drawer will appear from.\n * @default left\n * @param {String('top'|'bottom')}\n */\n slideFrom?: SlideFromTopBottom;\n}\n\ninterface DrawerBaseProps\n extends Omit<\n ReactModal.Props,\n | \"closeTimeoutMS\"\n | \"portalClassName\"\n | \"overlayClassName\"\n | \"className\"\n | \"style\"\n | \"parentSelector\"\n > {\n background?: string;\n zIndex?: number;\n onRequestClose?: () => void;\n /**\n * Portal target, HTML element. If not set, portal is not used.\n */\n portalTarget?: HTMLElement | null;\n}\n\nexport const Drawer: React.FC<DrawerProps> = ({\n background,\n zIndex,\n children,\n slideFrom = \"left\",\n portalTarget,\n ...reactModalProps\n}) => {\n const { height, width } = reactModalProps as FlattenUnion<DrawerProps>;\n\n return (\n <ReactModal\n closeTimeoutMS={250}\n portalClassName={styles.portal}\n overlayClassName={{\n base: styles.overlay,\n afterOpen: styles.afterOpen,\n beforeClose: styles.beforeClose,\n }}\n className={{\n base: cx(styles.content, getClassNameForSlide(slideFrom)),\n afterOpen: styles.afterOpen,\n beforeClose: styles.beforeClose,\n }}\n style={{ content: { width, height, background }, overlay: { zIndex } }}\n parentSelector={portalTarget ? () => portalTarget : undefined}\n {...reactModalProps}\n >\n {children}\n </ReactModal>\n );\n};\n\nconst getClassNameForSlide = (slideFrom: SlideFrom): string => {\n switch (slideFrom) {\n case \"left\":\n return styles.slideFromLeft;\n case \"right\":\n return styles.slideFromRight;\n case \"top\":\n return styles.slideFromTop;\n case \"bottom\":\n return styles.slideFromBottom;\n default:\n return exhaustSwitchCase(slideFrom, styles.slideFromLeft);\n }\n};\n","import * as React from \"react\";\nimport ReactModal from \"react-modal\";\n\nimport styles from \"../modal/Modal.module.css\";\n\nexport interface CenterModalProps extends ReactModal.Props {\n onRequestClose?: () => void;\n}\n\nconst style = { overlay: { justifyContent: \"center\" } };\n\nexport const CenterModal: React.FC<CenterModalProps> = ({\n children,\n ...reactModalProps\n}) => {\n return (\n <ReactModal\n overlayClassName={styles.overlay}\n className={styles.modal}\n style={style}\n {...reactModalProps}\n >\n <div\n className={styles.content}\n style={{ [\"--swui-modal-width\" as string]: \"fit-content\" }}\n >\n {children}\n </div>\n </ReactModal>\n );\n};\n","import { IconDefinition } from \"@fortawesome/fontawesome-svg-core\";\nimport {\n Box,\n Column,\n Heading,\n Indent,\n Row,\n Spacing,\n} from \"@stenajs-webui/core\";\nimport { Icon, Spinner } from \"@stenajs-webui/elements\";\nimport * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport styles from \"./LoadingModal.module.css\";\n\nexport interface LoadingModalProps extends Omit<ReactModal.Props, \"isOpen\"> {\n headerText?: string;\n headerIconLeft?: IconDefinition;\n}\n\nexport const LoadingModal: React.FC<LoadingModalProps> = ({\n headerIconLeft,\n headerText,\n ...modalProps\n}) => {\n return (\n <ReactModal\n {...modalProps}\n isOpen\n className={styles.modal}\n overlayClassName={styles.overlay}\n >\n <Column spacing={2} alignItems={\"center\"}>\n <Box\n alignItems={\"center\"}\n justifyContent={\"center\"}\n width={\"64px\"}\n height={\"64px\"}\n borderRadius={\"50%\"}\n background={\"white\"}\n shadow={\"modal\"}\n >\n <Spinner size={\"small\"} />\n </Box>\n {(headerIconLeft || headerText) && (\n <>\n <Spacing />\n <Row indent={2}>\n {headerIconLeft && (\n <>\n <Icon size={14} icon={headerIconLeft} color={\"white\"} />\n <Indent />\n </>\n )}\n {headerText && (\n <Heading variant={\"h4\"} color={\"white\"}>\n {headerText}\n </Heading>\n )}\n </Row>\n </>\n )}\n </Column>\n </ReactModal>\n );\n};\n","import { FlatButton, stenaTimes } from \"@stenajs-webui/elements\";\nimport * as React from \"react\";\nimport { ReactNode } from \"react\";\nimport {\n DRAGGABLE_CANCEL_CLASSNAME,\n DRAGGABLE_HANDLE_CLASSNAME,\n} from \"./BaseModal\";\nimport { Box, Row, Txt } from \"@stenajs-webui/core\";\n\nexport interface ModalHeaderProps {\n onRequestClose?: () => void;\n header?: ReactNode;\n headerText?: string;\n closeButtonClassName?: string;\n}\n\nexport const ModalHeader: React.FC<ModalHeaderProps> = ({\n onRequestClose,\n header,\n headerText,\n closeButtonClassName,\n}) => {\n return (\n <Row\n spacing={2}\n indent={2}\n borderBottom={\"1px solid var(--swui-modal-header-border-color)\"}\n className={DRAGGABLE_HANDLE_CLASSNAME}\n >\n <Row flex={1} indent alignItems={\"center\"}>\n {headerText && (\n <Txt className={DRAGGABLE_CANCEL_CLASSNAME} size={\"large\"}>\n {headerText}\n </Txt>\n )}\n {header}\n </Row>\n <Box alignSelf={\"flex-start\"}>\n <FlatButton\n className={closeButtonClassName}\n onClick={onRequestClose}\n aria-label={\"Close\"}\n leftIcon={stenaTimes}\n />\n </Box>\n </Row>\n );\n};\n","import { Box } from \"@stenajs-webui/core\";\nimport * as React from \"react\";\nimport { BaseModal, BaseModalProps } from \"./BaseModal\";\nimport { ModalHeader, ModalHeaderProps } from \"./ModalHeader\";\nimport cx from \"classnames\";\nimport styles from \"./Modal.module.css\";\n\nexport interface ModalProps extends BaseModalProps, ModalHeaderProps {\n spacing?: number;\n indent?: number;\n draggable?: boolean;\n footer?: React.ReactNode;\n disableStickyFooter?: boolean;\n}\n\nexport const Modal: React.FC<ModalProps> = ({\n header,\n headerText,\n children,\n spacing,\n indent,\n draggable = false,\n onRequestClose,\n closeButtonClassName,\n footer,\n disableStickyFooter = false,\n ...props\n}) => {\n const activeSpacing = typeof spacing === \"number\" ? spacing : 1;\n const activeIndent = typeof indent === \"number\" ? indent : 1;\n\n return (\n <BaseModal {...props} onRequestClose={onRequestClose} draggable={draggable}>\n <ModalHeader\n onRequestClose={onRequestClose}\n header={header}\n headerText={headerText}\n closeButtonClassName={closeButtonClassName}\n />\n <Box spacing={activeSpacing} indent={activeIndent}>\n {children}\n </Box>\n {footer && (\n <Box\n className={cx(styles.footer, {\n [styles.stickyFooter]: !disableStickyFooter,\n })}\n >\n {footer}\n </Box>\n )}\n </BaseModal>\n );\n};\n","import { Column } from \"@stenajs-webui/core\";\nimport * as React from \"react\";\nimport { ReactNode } from \"react\";\n\nexport interface ModalFooterProps {\n children?: ReactNode;\n}\n\nexport const ModalFooter: React.FC<ModalFooterProps> = ({ children }) => (\n <Column indent={2} spacing={2}>\n {children}\n </Column>\n);\n"],"names":["DRAGGABLE_HANDLE_CLASSNAME","DRAGGABLE_CANCEL_CLASSNAME","BaseModal","width","maxWidth","draggable","children","reactModalProps","ReactModal","styles","overlay","modal","Draggable","cx","content","isDraggable","Drawer","background","zIndex","slideFrom","portalTarget","height","portal","base","afterOpen","beforeClose","getClassNameForSlide","undefined","slideFromLeft","slideFromRight","slideFromTop","slideFromBottom","exhaustSwitchCase","style","justifyContent","CenterModal","LoadingModal","headerIconLeft","headerText","modalProps","Column","_jsx","Box","Spinner","_Fragment","Spacing","Row","_jsxs","Icon","Indent","Heading","ModalHeader","onRequestClose","header","closeButtonClassName","Txt","FlatButton","stenaTimes","Modal","spacing","indent","footer","disableStickyFooter","props","stickyFooter","ModalFooter"],"mappings":";;;;;;;;;;;;;;;GAaaA,IAA6B,0BAC7BC,IAA6B,0BAE7BC,IAAsC,CAAC;AAAA,EAClDC,OAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,WAAAA,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AAAAA,MACX,SAASF;AAAAA,MACT,cAAY;AAAA,MACZ,UAAUK;AAAAA,IAAAA,CAJZ;AAAA,EAAA,CAfJ,CAAA;AAAA,CADF,GCPWC,KAA8B,CAAC;AAAA,EAC1CL,QAAAA;AAAAA,EACAf,YAAAA;AAAAA,EACAhC,UAAAA;AAAAA,EACAqD,SAAAA;AAAAA,EACAC,QAAAA;AAAAA,EACAvD,WAAAA,IAAY;AAAA,EACZ+C,gBAAAA;AAAAA,EACAE,sBAAAA;AAAAA,EACAO,QAAAA;AAAAA,EACAC,qBAAAA,IAAsB;AAAA,KACnBC;AAXuC,wBAiBvC7D,GAAD;AAAA,EAAA,GAAe6D;AAAAA,EAAO,gBAAAX;AAAA,EAAgC,WAAA/C;AAAA,EAAtD,UAAA,CACEoC,gBAAAA,EAACU,IAAD;AAAA,IACE,gBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAf;AAAA,IACA,sBAAAgB;AAAA,EAAA,CALJ,GAOEb,gBAAAA,EAACC,GAAD;AAAA,IAAK,SAXa,OAAOiB,KAAY,WAAWA,IAAU;AAAA,IAW7B,QAVZ,OAAOC,KAAW,WAAWA,IAAS;AAAA,IAUvD,UAAAtD;AAAA,EAAA,CAAA,GAGCuD,KACCpB,gBAAAA,EAACC,GAAD;AAAA,IACE,WAAW7B,EAAGJ,EAAOoD,QAAQ;AAAA,MAC3B,CAACpD,EAAOuD,eAAe,CAACF;AAAAA,IAAAA,CADb;AAAA,IADf,UAKGD;AAAAA,EAAAA,CAhBP,CAAA;AAAA,CADF,GCvBWI,KAA0C,CAAC;AAAA,EAAE3D,UAAAA;AAAF,wBACrDkC,GAAD;AAAA,EAAQ,QAAQ;AAAA,EAAG,SAAS;AAAA,EAA5B,UAAAlC;AAAA,CADK;"}
1
+ {"version":3,"file":"index.es.js","sources":["../src/components/modal/BaseModal.tsx","../src/components/drawer/Drawer.tsx","../src/components/center-modal/CenterModal.tsx","../src/components/loading-modal/LoadingModal.tsx","../src/components/modal/ModalHeader.tsx","../src/components/modal/Modal.tsx","../src/components/modal/ModalFooter.tsx"],"sourcesContent":["import * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport Draggable from \"react-draggable\";\nimport cx from \"classnames\";\nimport styles from \"./Modal.module.css\";\n\nexport interface BaseModalProps extends ReactModal.Props {\n width?: string;\n maxWidth?: string;\n onRequestClose?: () => void;\n draggable?: boolean;\n}\n\nexport const DRAGGABLE_HANDLE_CLASSNAME = \"draggable-modal-handle\";\nexport const DRAGGABLE_CANCEL_CLASSNAME = \"draggable-modal-cancel\";\n\nexport const BaseModal: React.FC<BaseModalProps> = ({\n width,\n maxWidth,\n draggable = false,\n children,\n ...reactModalProps\n}) => {\n return (\n <ReactModal\n overlayClassName={styles.overlay}\n className={styles.modal}\n {...reactModalProps}\n >\n <Draggable\n handle={`.${DRAGGABLE_HANDLE_CLASSNAME}`}\n cancel={`.${DRAGGABLE_CANCEL_CLASSNAME}, button, [role=\"tooltip\"]`}\n bounds=\".ReactModal__Overlay\"\n disabled={!draggable}\n >\n <div\n style={{\n [\"--swui-modal-width\" as string]: width,\n [\"--swui-modal-max-width\" as string]: maxWidth,\n }}\n className={cx(styles.content, {\n [styles.isDraggable]: draggable,\n })}\n >\n {children}\n </div>\n </Draggable>\n </ReactModal>\n );\n};\n","import * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport cx from \"classnames\";\nimport styles from \"./Drawer.module.css\";\nimport { exhaustSwitchCase, FlattenUnion } from \"@stenajs-webui/core\";\n\nexport type SlideFrom = SlideFromLeftRight | SlideFromTopBottom;\nexport type SlideFromLeftRight = \"left\" | \"right\";\nexport type SlideFromTopBottom = \"top\" | \"bottom\";\n\nexport type DrawerProps = DrawerBaseLeftRight | DrawerBaseTopBottom;\n\ninterface DrawerBaseLeftRight extends DrawerBaseProps {\n width?: string;\n /**\n * Which direction the drawer will appear from.\n * @default left\n * @param {String('left'|'right')}\n */\n slideFrom?: SlideFromLeftRight;\n}\n\ninterface DrawerBaseTopBottom extends DrawerBaseProps {\n height?: string;\n /**\n * Which direction the drawer will appear from.\n * @default left\n * @param {String('top'|'bottom')}\n */\n slideFrom?: SlideFromTopBottom;\n}\n\ninterface DrawerBaseProps\n extends Omit<\n ReactModal.Props,\n | \"closeTimeoutMS\"\n | \"portalClassName\"\n | \"overlayClassName\"\n | \"className\"\n | \"style\"\n | \"parentSelector\"\n > {\n background?: string;\n zIndex?: number;\n onRequestClose?: () => void;\n /**\n * Portal target, HTML element. If not set, portal is not used.\n */\n portalTarget?: HTMLElement | null;\n}\n\nexport const Drawer: React.FC<DrawerProps> = ({\n background,\n zIndex,\n children,\n slideFrom = \"left\",\n portalTarget,\n ...reactModalProps\n}) => {\n const { height, width } = reactModalProps as FlattenUnion<DrawerProps>;\n\n return (\n <ReactModal\n closeTimeoutMS={250}\n portalClassName={styles.portal}\n overlayClassName={{\n base: styles.overlay,\n afterOpen: styles.afterOpen,\n beforeClose: styles.beforeClose,\n }}\n className={{\n base: cx(styles.content, getClassNameForSlide(slideFrom)),\n afterOpen: styles.afterOpen,\n beforeClose: styles.beforeClose,\n }}\n style={{ content: { width, height, background }, overlay: { zIndex } }}\n parentSelector={portalTarget ? () => portalTarget : undefined}\n {...reactModalProps}\n >\n {children}\n </ReactModal>\n );\n};\n\nconst getClassNameForSlide = (slideFrom: SlideFrom): string => {\n switch (slideFrom) {\n case \"left\":\n return styles.slideFromLeft;\n case \"right\":\n return styles.slideFromRight;\n case \"top\":\n return styles.slideFromTop;\n case \"bottom\":\n return styles.slideFromBottom;\n default:\n return exhaustSwitchCase(slideFrom, styles.slideFromLeft);\n }\n};\n","import * as React from \"react\";\nimport ReactModal from \"react-modal\";\n\nimport styles from \"../modal/Modal.module.css\";\n\nexport interface CenterModalProps extends ReactModal.Props {\n onRequestClose?: () => void;\n}\n\nconst style = { overlay: { justifyContent: \"center\" } };\n\nexport const CenterModal: React.FC<CenterModalProps> = ({\n children,\n ...reactModalProps\n}) => {\n return (\n <ReactModal\n overlayClassName={styles.overlay}\n className={styles.modal}\n style={style}\n {...reactModalProps}\n >\n <div\n className={styles.content}\n style={{ [\"--swui-modal-width\" as string]: \"fit-content\" }}\n >\n {children}\n </div>\n </ReactModal>\n );\n};\n","import { IconDefinition } from \"@fortawesome/fontawesome-svg-core\";\nimport {\n Box,\n Column,\n Heading,\n Indent,\n Row,\n Spacing,\n} from \"@stenajs-webui/core\";\nimport { Icon, Spinner } from \"@stenajs-webui/elements\";\nimport * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport styles from \"./LoadingModal.module.css\";\n\nexport interface LoadingModalProps extends Omit<ReactModal.Props, \"isOpen\"> {\n headerText?: string;\n headerIconLeft?: IconDefinition;\n}\n\nexport const LoadingModal: React.FC<LoadingModalProps> = ({\n headerIconLeft,\n headerText,\n ...modalProps\n}) => {\n return (\n <ReactModal\n {...modalProps}\n isOpen\n className={styles.modal}\n overlayClassName={styles.overlay}\n >\n <Column spacing={2} alignItems={\"center\"}>\n <Box\n alignItems={\"center\"}\n justifyContent={\"center\"}\n width={\"64px\"}\n height={\"64px\"}\n borderRadius={\"50%\"}\n background={\"white\"}\n shadow={\"modal\"}\n >\n <Spinner size={\"small\"} />\n </Box>\n {(headerIconLeft || headerText) && (\n <>\n <Spacing />\n <Row indent={2}>\n {headerIconLeft && (\n <>\n <Icon size={14} icon={headerIconLeft} color={\"white\"} />\n <Indent />\n </>\n )}\n {headerText && (\n <Heading variant={\"h4\"} color={\"white\"}>\n {headerText}\n </Heading>\n )}\n </Row>\n </>\n )}\n </Column>\n </ReactModal>\n );\n};\n","import { FlatButton, stenaTimes } from \"@stenajs-webui/elements\";\nimport * as React from \"react\";\nimport { ReactNode } from \"react\";\nimport {\n DRAGGABLE_CANCEL_CLASSNAME,\n DRAGGABLE_HANDLE_CLASSNAME,\n} from \"./BaseModal\";\nimport { Box, Row, Txt } from \"@stenajs-webui/core\";\n\nexport interface ModalHeaderProps {\n onRequestClose?: () => void;\n header?: ReactNode;\n headerText?: string;\n closeButtonClassName?: string;\n}\n\nexport const ModalHeader: React.FC<ModalHeaderProps> = ({\n onRequestClose,\n header,\n headerText,\n closeButtonClassName,\n}) => {\n return (\n <Row\n spacing={2}\n indent={2}\n borderBottom={\"1px solid var(--swui-modal-header-border-color)\"}\n className={DRAGGABLE_HANDLE_CLASSNAME}\n >\n <Row flex={1} indent alignItems={\"center\"}>\n {headerText && (\n <Txt className={DRAGGABLE_CANCEL_CLASSNAME} size={\"large\"}>\n {headerText}\n </Txt>\n )}\n {header}\n </Row>\n <Box alignSelf={\"flex-start\"}>\n <FlatButton\n className={closeButtonClassName}\n onClick={onRequestClose}\n aria-label={\"Close\"}\n leftIcon={stenaTimes}\n />\n </Box>\n </Row>\n );\n};\n","import { Box } from \"@stenajs-webui/core\";\nimport * as React from \"react\";\nimport { BaseModal, BaseModalProps } from \"./BaseModal\";\nimport { ModalHeader, ModalHeaderProps } from \"./ModalHeader\";\nimport cx from \"classnames\";\nimport styles from \"./Modal.module.css\";\n\nexport interface ModalProps extends BaseModalProps, ModalHeaderProps {\n spacing?: number;\n indent?: number;\n draggable?: boolean;\n footer?: React.ReactNode;\n disableStickyFooter?: boolean;\n}\n\nexport const Modal: React.FC<ModalProps> = ({\n header,\n headerText,\n children,\n spacing,\n indent,\n draggable = false,\n onRequestClose,\n closeButtonClassName,\n footer,\n disableStickyFooter = false,\n ...props\n}) => {\n const activeSpacing = typeof spacing === \"number\" ? spacing : 1;\n const activeIndent = typeof indent === \"number\" ? indent : 1;\n\n return (\n <BaseModal {...props} onRequestClose={onRequestClose} draggable={draggable}>\n <ModalHeader\n onRequestClose={onRequestClose}\n header={header}\n headerText={headerText}\n closeButtonClassName={closeButtonClassName}\n />\n <Box spacing={activeSpacing} indent={activeIndent}>\n {children}\n </Box>\n {footer && (\n <Box\n className={cx(styles.footer, {\n [styles.stickyFooter]: !disableStickyFooter,\n })}\n >\n {footer}\n </Box>\n )}\n </BaseModal>\n );\n};\n","import { Column } from \"@stenajs-webui/core\";\nimport * as React from \"react\";\nimport { ReactNode } from \"react\";\n\nexport interface ModalFooterProps {\n children?: ReactNode;\n}\n\nexport const ModalFooter: React.FC<ModalFooterProps> = ({ children }) => (\n <Column indent={2} spacing={2}>\n {children}\n </Column>\n);\n"],"names":["DRAGGABLE_HANDLE_CLASSNAME","DRAGGABLE_CANCEL_CLASSNAME","BaseModal","width","maxWidth","draggable","children","reactModalProps","jsx","ReactModal","styles","Draggable","cx","Drawer","background","zIndex","slideFrom","portalTarget","height","getClassNameForSlide","exhaustSwitchCase","style","CenterModal","LoadingModal","headerIconLeft","headerText","modalProps","jsxs","Column","Box","Spinner","Fragment","Spacing","Row","Icon","Indent","Heading","ModalHeader","onRequestClose","header","closeButtonClassName","Txt","FlatButton","stenaTimes","Modal","spacing","indent","footer","disableStickyFooter","props","ModalFooter"],"mappings":";;;;;;;;;;;;;;;GAaaA,IAA6B,0BAC7BC,IAA6B,0BAE7BC,IAAsC,CAAC;AAAA,EAClD,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,KACGC;AACL,MAEI,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,kBAAkBC,EAAO;AAAA,IACzB,WAAWA,EAAO;AAAA,IACjB,GAAGH;AAAA,IAEJ,UAAA,gBAAAC;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,QAAQ,IAAIX;AAAA,QACZ,QAAQ,IAAIC;AAAA,QACZ,QAAO;AAAA,QACP,UAAU,CAACI;AAAA,QAEX,UAAA,gBAAAG;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,cACL,CAAC,uBAAiCL;AAAA,cAClC,CAAC,2BAAqCC;AAAA,YACxC;AAAA,YACA,WAAWQ,EAAGF,EAAO,SAAS;AAAA,cAC5B,CAACA,EAAO,cAAcL;AAAA,YAAA,CACvB;AAAA,YAEA,UAAAC;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AA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UAAAxC,GACH;AAAA,EACCyC,KACC,gBAAAvC;AAAA,IAACqB;AAAA,IAAA;AAAA,MACC,WAAWjB,EAAGF,EAAO,QAAQ;AAAA,QAC3B,CAACA,EAAO,eAAe,CAACsC;AAAA,MAAA,CACzB;AAAA,MAEA,UAAAD;AAAA,IAAA;AAAA,EACH;AAEJ,EAAA,CAAA,GC3CSG,KAA0C,CAAC,EAAE,UAAA5C,EAAS,MAChE,gBAAAE,EAAAoB,GAAA,EAAO,QAAQ,GAAG,SAAS,GACzB,UAAAtB,EACH,CAAA;"}
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  (function(){"use strict";try{var o=document.createElement("style");o.appendChild(document.createTextNode("._overlay_5x3op_1{--swui-modal-animation-time: var(--swui-animation-time-fast);--swui-modal-overlay-bg-color: var(--swui-overlay-bg-color);--swui-modal-content-bg-color: var(--swui-white);--swui-modal-width: 960px;--swui-modal-max-width: 100%;--swui-modal-header-border-color: var(--lhds-color-ui-300);--swui-modal-shadow: var(--swui-shadow-modal);--swui-modal-footer-shadow: var(--swui-shadow-modal);position:fixed;z-index:10;top:0;left:0;right:0;bottom:0;background-color:var(--swui-modal-overlay-bg-color);overflow:auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:center;-webkit-animation:_fadeIn_5x3op_1 var(--swui-modal-animation-time) cubic-bezier(.645,.045,.355,1) both;animation:_fadeIn_5x3op_1 var(--swui-modal-animation-time) cubic-bezier(.645,.045,.355,1) both}@media print{._overlay_5x3op_1{background-color:#fff}}._overlay_5x3op_1 ._modal_5x3op_31{max-width:100%;outline:none;pointer-events:none}@media (max-width: 768px){._overlay_5x3op_1 ._modal_5x3op_31{width:100%}}._overlay_5x3op_1 ._content_5x3op_41{position:relative;display:block;background:var(--swui-modal-content-bg-color);box-shadow:var(--swui-modal-shadow);pointer-events:all;top:calc(var(--swui-metrics-space) * 2);width:var(--swui-modal-width);max-width:var(--swui-modal-max-width)}@media (max-width: 768px){._overlay_5x3op_1 ._content_5x3op_41{top:0;width:100%;max-width:100%}}._overlay_5x3op_1 ._content_5x3op_41{-webkit-animation:_appear_5x3op_1 var(--swui-animation-time-fast) cubic-bezier(.645,.045,.355,1) both;animation:_appear_5x3op_1 var(--swui-animation-time-fast) cubic-bezier(.645,.045,.355,1) both}@media print{._overlay_5x3op_1 ._content_5x3op_41{box-shadow:none;top:0}}._overlay_5x3op_1 ._content_5x3op_41 :focus{outline:0}._overlay_5x3op_1 ._content_5x3op_41._isDraggable_5x3op_70 .draggable-modal-handle{cursor:move}._overlay_5x3op_1 ._content_5x3op_41._isDraggable_5x3op_70 .draggable-modal-handle .draggable-modal-cancel,._overlay_5x3op_1 ._content_5x3op_41._isDraggable_5x3op_70 .draggable-modal-handle [role=tooltip]{cursor:initial}@-webkit-keyframes _fadeIn_5x3op_1{0%{background-color:var(--swui-hidden)}to{background-color:var(--swui-modal-overlay-bg-color)}}@keyframes _fadeIn_5x3op_1{0%{background-color:var(--swui-hidden)}to{background-color:var(--swui-modal-overlay-bg-color)}}@-webkit-keyframes _appear_5x3op_1{0%{opacity:0}to{opacity:1}}@keyframes _appear_5x3op_1{0%{opacity:0}to{opacity:1}}._footer_5x3op_101{background-color:var(--swui-modal-content-bg-color)}._stickyFooter_5x3op_105{position:-webkit-sticky;position:sticky;bottom:0;box-shadow:var(--swui-modal-footer-shadow)}@media print{._stickyFooter_5x3op_105{position:static;box-shadow:none}}._portal_17quq_1 ._overlay_17quq_2{position:fixed;inset:0}._portal_17quq_1 ._content_17quq_7{box-shadow:var(--swui-shadow-modal);background:white;position:absolute;transition:-webkit-transform var(--swui-animation-time-medium) ease-in-out;transition:transform var(--swui-animation-time-medium) ease-in-out;transition:transform var(--swui-animation-time-medium) ease-in-out,-webkit-transform var(--swui-animation-time-medium) ease-in-out}._portal_17quq_1 ._content_17quq_7._slideFromLeft_17quq_13,._portal_17quq_1 ._content_17quq_7._slideFromRight_17quq_14{-webkit-transform:translateX(var(--translate-x-outside-screen, 0));transform:translate(var(--translate-x-outside-screen, 0));overflow-y:auto;top:0;bottom:0}._portal_17quq_1 ._content_17quq_7._slideFromLeft_17quq_13._afterOpen_17quq_20,._portal_17quq_1 ._content_17quq_7._slideFromRight_17quq_14._afterOpen_17quq_20{-webkit-transform:translateX(0);transform:translate(0)}._portal_17quq_1 ._content_17quq_7._slideFromLeft_17quq_13._beforeClose_17quq_24,._portal_17quq_1 ._content_17quq_7._slideFromRight_17quq_14._beforeClose_17quq_24{-webkit-transform:translateX(var(--translate-x-outside-screen));transform:translate(var(--translate-x-outside-screen))}._portal_17quq_1 ._content_17quq_7._slideFromTop_17quq_29,._portal_17quq_1 ._content_17quq_7._slideFromBottom_17quq_30{-webkit-transform:translateY(var(--translate-y-outside-screen, 0));transform:translateY(var(--translate-y-outside-screen, 0));overflow-x:auto;left:0;right:0}._portal_17quq_1 ._content_17quq_7._slideFromTop_17quq_29._afterOpen_17quq_20,._portal_17quq_1 ._content_17quq_7._slideFromBottom_17quq_30._afterOpen_17quq_20{-webkit-transform:translateY(0);transform:translateY(0)}._portal_17quq_1 ._content_17quq_7._slideFromTop_17quq_29._beforeClose_17quq_24,._portal_17quq_1 ._content_17quq_7._slideFromBottom_17quq_30._beforeClose_17quq_24{-webkit-transform:translateY(var(--translate-y-outside-screen));transform:translateY(var(--translate-y-outside-screen))}._portal_17quq_1 ._content_17quq_7._slideFromLeft_17quq_13{--translate-x-outside-screen: -100%;width:370px;left:0}._portal_17quq_1 ._content_17quq_7._slideFromRight_17quq_14{--translate-x-outside-screen: 100%;width:370px;right:0}._portal_17quq_1 ._content_17quq_7._slideFromTop_17quq_29{--translate-y-outside-screen: -100%;height:370px;top:0}._portal_17quq_1 ._content_17quq_7._slideFromBottom_17quq_30{--translate-y-outside-screen: 100%;height:370px;bottom:0}._modal_4fwgb_1{display:flex;justify-content:center;align-items:center;position:fixed;top:0;left:0;right:0;bottom:0;background-color:transparent}._overlay_4fwgb_13{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--swui-overlay-bg-color)}")),document.head.appendChild(o)}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("react-modal"),q=require("react-draggable"),M=require("classnames"),e=require("react/jsx-runtime"),t=require("@stenajs-webui/core"),_=require("@stenajs-webui/elements"),f=o=>o&&typeof o=="object"&&"default"in o?o:{default:o},m=f(N),A=f(q),x=f(M),L="_overlay_5x3op_1",S="_fadeIn_5x3op_1",B="_modal_5x3op_31",D="_content_5x3op_41",R="_appear_5x3op_1",E="_isDraggable_5x3op_70",O="_footer_5x3op_101",G="_stickyFooter_5x3op_105",n={overlay:L,fadeIn:S,modal:B,content:D,appear:R,isDraggable:E,footer:O,stickyFooter:G},p="draggable-modal-handle",g="draggable-modal-cancel",b=({width:o,maxWidth:s,draggable:l=!1,children:r,...c})=>e.jsx(m.default,{overlayClassName:n.overlay,className:n.modal,...c,children:e.jsx(A.default,{handle:`.${p}`,cancel:`.${g}, button, [role="tooltip"]`,bounds:".ReactModal__Overlay",disabled:!l,children:e.jsx("div",{style:{["--swui-modal-width"]:o,["--swui-modal-max-width"]:s},className:x.default(n.content,{[n.isDraggable]:l}),children:r})})}),I="_portal_17quq_1",$="_overlay_17quq_2",k="_content_17quq_7",H="_slideFromLeft_17quq_13",T="_slideFromRight_17quq_14",z="_afterOpen_17quq_20",J="_beforeClose_17quq_24",K="_slideFromTop_17quq_29",P="_slideFromBottom_17quq_30",a={portal:I,overlay:$,content:k,slideFromLeft:H,slideFromRight:T,afterOpen:z,beforeClose:J,slideFromTop:K,slideFromBottom:P},Q=({background:o,zIndex:s,children:l,slideFrom:r="left",portalTarget:c,...i})=>{const{height:d,width:u}=i;return e.jsx(m.default,{closeTimeoutMS:250,portalClassName:a.portal,overlayClassName:{base:a.overlay,afterOpen:a.afterOpen,beforeClose:a.beforeClose},className:{base:x.default(a.content,U(r)),afterOpen:a.afterOpen,beforeClose:a.beforeClose},style:{content:{width:u,height:d,background:o},overlay:{zIndex:s}},parentSelector:c?()=>c:void 0,...i,children:l})},U=o=>{switch(o){case"left":return a.slideFromLeft;case"right":return a.slideFromRight;case"top":return a.slideFromTop;case"bottom":return a.slideFromBottom;default:return t.exhaustSwitchCase(o,a.slideFromLeft)}},V={overlay:{justifyContent:"center"}},W=({children:o,...s})=>e.jsx(m.default,{overlayClassName:n.overlay,className:n.modal,style:V,...s,children:e.jsx("div",{className:n.content,style:{["--swui-modal-width"]:"fit-content"},children:o})}),X="_modal_4fwgb_1",Y="_overlay_4fwgb_13",h={modal:X,overlay:Y},Z=({headerIconLeft:o,headerText:s,...l})=>e.jsx(m.default,{...l,isOpen:!0,className:h.modal,overlayClassName:h.overlay,children:e.jsxs(t.Column,{spacing:2,alignItems:"center",children:[e.jsx(t.Box,{alignItems:"center",justifyContent:"center",width:"64px",height:"64px",borderRadius:"50%",background:"white",shadow:"modal",children:e.jsx(_.Spinner,{size:"small"})}),(o||s)&&e.jsxs(e.Fragment,{children:[e.jsx(t.Spacing,{}),e.jsxs(t.Row,{indent:2,children:[o&&e.jsxs(e.Fragment,{children:[e.jsx(_.Icon,{size:14,icon:o,color:"white"}),e.jsx(t.Indent,{})]}),s&&e.jsx(t.Heading,{variant:"h4",color:"white",children:s})]})]})]})}),j=({onRequestClose:o,header:s,headerText:l,closeButtonClassName:r})=>e.jsxs(t.Row,{spacing:2,indent:2,borderBottom:"1px solid var(--swui-modal-header-border-color)",className:p,children:[e.jsxs(t.Row,{flex:1,indent:!0,alignItems:"center",children:[l&&e.jsx(t.Txt,{className:g,size:"large",children:l}),s]}),e.jsx(t.Box,{alignSelf:"flex-start",children:e.jsx(_.FlatButton,{className:r,onClick:o,"aria-label":"Close",leftIcon:_.stenaTimes})})]}),ee=({header:o,headerText:s,children:l,spacing:r,indent:c,draggable:i=!1,onRequestClose:d,closeButtonClassName:u,footer:y,disableStickyFooter:v=!1,...C})=>{const F=typeof r=="number"?r:1,w=typeof c=="number"?c:1;return e.jsxs(b,{...C,onRequestClose:d,draggable:i,children:[e.jsx(j,{onRequestClose:d,header:o,headerText:s,closeButtonClassName:u}),e.jsx(t.Box,{spacing:F,indent:w,children:l}),y&&e.jsx(t.Box,{className:x.default(n.footer,{[n.stickyFooter]:!v}),children:y})]})},oe=({children:o})=>e.jsx(t.Column,{indent:2,spacing:2,children:o});exports.BaseModal=b;exports.CenterModal=W;exports.DRAGGABLE_CANCEL_CLASSNAME=g;exports.DRAGGABLE_HANDLE_CLASSNAME=p;exports.Drawer=Q;exports.LoadingModal=Z;exports.Modal=ee;exports.ModalFooter=oe;exports.ModalHeader=j;
2
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),N=require("react-modal"),q=require("react-draggable"),M=require("classnames"),t=require("@stenajs-webui/core"),_=require("@stenajs-webui/elements"),f=o=>o&&typeof o=="object"&&"default"in o?o:{default:o},m=f(N),A=f(q),x=f(M),L="_overlay_5x3op_1",S="_fadeIn_5x3op_1",B="_modal_5x3op_31",D="_content_5x3op_41",R="_appear_5x3op_1",E="_isDraggable_5x3op_70",O="_footer_5x3op_101",G="_stickyFooter_5x3op_105",n={overlay:L,fadeIn:S,modal:B,content:D,appear:R,isDraggable:E,footer:O,stickyFooter:G},p="draggable-modal-handle",g="draggable-modal-cancel",b=({width:o,maxWidth:s,draggable:l=!1,children:r,...c})=>e.jsx(m.default,{overlayClassName:n.overlay,className:n.modal,...c,children:e.jsx(A.default,{handle:`.${p}`,cancel:`.${g}, button, [role="tooltip"]`,bounds:".ReactModal__Overlay",disabled:!l,children:e.jsx("div",{style:{["--swui-modal-width"]:o,["--swui-modal-max-width"]:s},className:x.default(n.content,{[n.isDraggable]:l}),children:r})})}),I="_portal_17quq_1",$="_overlay_17quq_2",k="_content_17quq_7",H="_slideFromLeft_17quq_13",T="_slideFromRight_17quq_14",z="_afterOpen_17quq_20",J="_beforeClose_17quq_24",K="_slideFromTop_17quq_29",P="_slideFromBottom_17quq_30",a={portal:I,overlay:$,content:k,slideFromLeft:H,slideFromRight:T,afterOpen:z,beforeClose:J,slideFromTop:K,slideFromBottom:P},Q=({background:o,zIndex:s,children:l,slideFrom:r="left",portalTarget:c,...i})=>{const{height:d,width:u}=i;return e.jsx(m.default,{closeTimeoutMS:250,portalClassName:a.portal,overlayClassName:{base:a.overlay,afterOpen:a.afterOpen,beforeClose:a.beforeClose},className:{base:x.default(a.content,U(r)),afterOpen:a.afterOpen,beforeClose:a.beforeClose},style:{content:{width:u,height:d,background:o},overlay:{zIndex:s}},parentSelector:c?()=>c:void 0,...i,children:l})},U=o=>{switch(o){case"left":return a.slideFromLeft;case"right":return a.slideFromRight;case"top":return a.slideFromTop;case"bottom":return a.slideFromBottom;default:return t.exhaustSwitchCase(o,a.slideFromLeft)}},V={overlay:{justifyContent:"center"}},W=({children:o,...s})=>e.jsx(m.default,{overlayClassName:n.overlay,className:n.modal,style:V,...s,children:e.jsx("div",{className:n.content,style:{["--swui-modal-width"]:"fit-content"},children:o})}),X="_modal_4fwgb_1",Y="_overlay_4fwgb_13",h={modal:X,overlay:Y},Z=({headerIconLeft:o,headerText:s,...l})=>e.jsx(m.default,{...l,isOpen:!0,className:h.modal,overlayClassName:h.overlay,children:e.jsxs(t.Column,{spacing:2,alignItems:"center",children:[e.jsx(t.Box,{alignItems:"center",justifyContent:"center",width:"64px",height:"64px",borderRadius:"50%",background:"white",shadow:"modal",children:e.jsx(_.Spinner,{size:"small"})}),(o||s)&&e.jsxs(e.Fragment,{children:[e.jsx(t.Spacing,{}),e.jsxs(t.Row,{indent:2,children:[o&&e.jsxs(e.Fragment,{children:[e.jsx(_.Icon,{size:14,icon:o,color:"white"}),e.jsx(t.Indent,{})]}),s&&e.jsx(t.Heading,{variant:"h4",color:"white",children:s})]})]})]})}),j=({onRequestClose:o,header:s,headerText:l,closeButtonClassName:r})=>e.jsxs(t.Row,{spacing:2,indent:2,borderBottom:"1px solid var(--swui-modal-header-border-color)",className:p,children:[e.jsxs(t.Row,{flex:1,indent:!0,alignItems:"center",children:[l&&e.jsx(t.Txt,{className:g,size:"large",children:l}),s]}),e.jsx(t.Box,{alignSelf:"flex-start",children:e.jsx(_.FlatButton,{className:r,onClick:o,"aria-label":"Close",leftIcon:_.stenaTimes})})]}),ee=({header:o,headerText:s,children:l,spacing:r,indent:c,draggable:i=!1,onRequestClose:d,closeButtonClassName:u,footer:y,disableStickyFooter:v=!1,...C})=>{const F=typeof r=="number"?r:1,w=typeof c=="number"?c:1;return e.jsxs(b,{...C,onRequestClose:d,draggable:i,children:[e.jsx(j,{onRequestClose:d,header:o,headerText:s,closeButtonClassName:u}),e.jsx(t.Box,{spacing:F,indent:w,children:l}),y&&e.jsx(t.Box,{className:x.default(n.footer,{[n.stickyFooter]:!v}),children:y})]})},oe=({children:o})=>e.jsx(t.Column,{indent:2,spacing:2,children:o});exports.BaseModal=b;exports.CenterModal=W;exports.DRAGGABLE_CANCEL_CLASSNAME=g;exports.DRAGGABLE_HANDLE_CLASSNAME=p;exports.Drawer=Q;exports.LoadingModal=Z;exports.Modal=ee;exports.ModalFooter=oe;exports.ModalHeader=j;
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/components/modal/BaseModal.tsx","../src/components/drawer/Drawer.tsx","../src/components/center-modal/CenterModal.tsx","../src/components/loading-modal/LoadingModal.tsx","../src/components/modal/ModalHeader.tsx","../src/components/modal/Modal.tsx","../src/components/modal/ModalFooter.tsx"],"sourcesContent":["import * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport Draggable from \"react-draggable\";\nimport cx from \"classnames\";\nimport styles from \"./Modal.module.css\";\n\nexport interface BaseModalProps extends ReactModal.Props {\n width?: string;\n maxWidth?: string;\n onRequestClose?: () => void;\n draggable?: boolean;\n}\n\nexport const DRAGGABLE_HANDLE_CLASSNAME = \"draggable-modal-handle\";\nexport const DRAGGABLE_CANCEL_CLASSNAME = \"draggable-modal-cancel\";\n\nexport const BaseModal: React.FC<BaseModalProps> = ({\n width,\n maxWidth,\n draggable = false,\n children,\n ...reactModalProps\n}) => {\n return (\n <ReactModal\n overlayClassName={styles.overlay}\n className={styles.modal}\n {...reactModalProps}\n >\n <Draggable\n handle={`.${DRAGGABLE_HANDLE_CLASSNAME}`}\n cancel={`.${DRAGGABLE_CANCEL_CLASSNAME}, button, [role=\"tooltip\"]`}\n bounds=\".ReactModal__Overlay\"\n disabled={!draggable}\n >\n <div\n style={{\n [\"--swui-modal-width\" as string]: width,\n [\"--swui-modal-max-width\" as string]: maxWidth,\n }}\n className={cx(styles.content, {\n [styles.isDraggable]: draggable,\n })}\n >\n {children}\n </div>\n </Draggable>\n </ReactModal>\n );\n};\n","import * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport cx from \"classnames\";\nimport styles from \"./Drawer.module.css\";\nimport { exhaustSwitchCase, FlattenUnion } from \"@stenajs-webui/core\";\n\nexport type SlideFrom = SlideFromLeftRight | SlideFromTopBottom;\nexport type SlideFromLeftRight = \"left\" | \"right\";\nexport type SlideFromTopBottom = \"top\" | \"bottom\";\n\nexport type DrawerProps = DrawerBaseLeftRight | DrawerBaseTopBottom;\n\ninterface DrawerBaseLeftRight extends DrawerBaseProps {\n width?: string;\n /**\n * Which direction the drawer will appear from.\n * @default left\n * @param {String('left'|'right')}\n */\n slideFrom?: SlideFromLeftRight;\n}\n\ninterface DrawerBaseTopBottom extends DrawerBaseProps {\n height?: string;\n /**\n * Which direction the drawer will appear from.\n * @default left\n * @param {String('top'|'bottom')}\n */\n slideFrom?: SlideFromTopBottom;\n}\n\ninterface DrawerBaseProps\n extends Omit<\n ReactModal.Props,\n | \"closeTimeoutMS\"\n | \"portalClassName\"\n | \"overlayClassName\"\n | \"className\"\n | \"style\"\n | \"parentSelector\"\n > {\n background?: string;\n zIndex?: number;\n onRequestClose?: () => void;\n /**\n * Portal target, HTML element. If not set, portal is not used.\n */\n portalTarget?: HTMLElement | null;\n}\n\nexport const Drawer: React.FC<DrawerProps> = ({\n background,\n zIndex,\n children,\n slideFrom = \"left\",\n portalTarget,\n ...reactModalProps\n}) => {\n const { height, width } = reactModalProps as FlattenUnion<DrawerProps>;\n\n return (\n <ReactModal\n closeTimeoutMS={250}\n portalClassName={styles.portal}\n overlayClassName={{\n base: styles.overlay,\n afterOpen: styles.afterOpen,\n beforeClose: styles.beforeClose,\n }}\n className={{\n base: cx(styles.content, getClassNameForSlide(slideFrom)),\n afterOpen: styles.afterOpen,\n beforeClose: styles.beforeClose,\n }}\n style={{ content: { width, height, background }, overlay: { zIndex } }}\n parentSelector={portalTarget ? () => portalTarget : undefined}\n {...reactModalProps}\n >\n {children}\n </ReactModal>\n );\n};\n\nconst getClassNameForSlide = (slideFrom: SlideFrom): string => {\n switch (slideFrom) {\n case \"left\":\n return styles.slideFromLeft;\n case \"right\":\n return styles.slideFromRight;\n case \"top\":\n return styles.slideFromTop;\n case \"bottom\":\n return styles.slideFromBottom;\n default:\n return exhaustSwitchCase(slideFrom, styles.slideFromLeft);\n }\n};\n","import * as React from \"react\";\nimport ReactModal from \"react-modal\";\n\nimport styles from \"../modal/Modal.module.css\";\n\nexport interface CenterModalProps extends ReactModal.Props {\n onRequestClose?: () => void;\n}\n\nconst style = { overlay: { justifyContent: \"center\" } };\n\nexport const CenterModal: React.FC<CenterModalProps> = ({\n children,\n ...reactModalProps\n}) => {\n return (\n <ReactModal\n overlayClassName={styles.overlay}\n className={styles.modal}\n style={style}\n {...reactModalProps}\n >\n <div\n className={styles.content}\n style={{ [\"--swui-modal-width\" as string]: \"fit-content\" }}\n >\n {children}\n </div>\n </ReactModal>\n );\n};\n","import { IconDefinition } from \"@fortawesome/fontawesome-svg-core\";\nimport {\n Box,\n Column,\n Heading,\n Indent,\n Row,\n Spacing,\n} from \"@stenajs-webui/core\";\nimport { Icon, Spinner } from \"@stenajs-webui/elements\";\nimport * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport styles from \"./LoadingModal.module.css\";\n\nexport interface LoadingModalProps extends Omit<ReactModal.Props, \"isOpen\"> {\n headerText?: string;\n headerIconLeft?: IconDefinition;\n}\n\nexport const LoadingModal: React.FC<LoadingModalProps> = ({\n headerIconLeft,\n headerText,\n ...modalProps\n}) => {\n return (\n <ReactModal\n {...modalProps}\n isOpen\n className={styles.modal}\n overlayClassName={styles.overlay}\n >\n <Column spacing={2} alignItems={\"center\"}>\n <Box\n alignItems={\"center\"}\n justifyContent={\"center\"}\n width={\"64px\"}\n height={\"64px\"}\n borderRadius={\"50%\"}\n background={\"white\"}\n shadow={\"modal\"}\n >\n <Spinner size={\"small\"} />\n </Box>\n {(headerIconLeft || headerText) && (\n <>\n <Spacing />\n <Row indent={2}>\n {headerIconLeft && (\n <>\n <Icon size={14} icon={headerIconLeft} color={\"white\"} />\n <Indent />\n </>\n )}\n {headerText && (\n <Heading variant={\"h4\"} color={\"white\"}>\n {headerText}\n </Heading>\n )}\n </Row>\n </>\n )}\n </Column>\n </ReactModal>\n );\n};\n","import { FlatButton, stenaTimes } from \"@stenajs-webui/elements\";\nimport * as React from \"react\";\nimport { ReactNode } from \"react\";\nimport {\n DRAGGABLE_CANCEL_CLASSNAME,\n DRAGGABLE_HANDLE_CLASSNAME,\n} from \"./BaseModal\";\nimport { Box, Row, Txt } from \"@stenajs-webui/core\";\n\nexport interface ModalHeaderProps {\n onRequestClose?: () => void;\n header?: ReactNode;\n headerText?: string;\n closeButtonClassName?: string;\n}\n\nexport const ModalHeader: React.FC<ModalHeaderProps> = ({\n onRequestClose,\n header,\n headerText,\n closeButtonClassName,\n}) => {\n return (\n <Row\n spacing={2}\n indent={2}\n borderBottom={\"1px solid var(--swui-modal-header-border-color)\"}\n className={DRAGGABLE_HANDLE_CLASSNAME}\n >\n <Row flex={1} indent alignItems={\"center\"}>\n {headerText && (\n <Txt className={DRAGGABLE_CANCEL_CLASSNAME} size={\"large\"}>\n {headerText}\n </Txt>\n )}\n {header}\n </Row>\n <Box alignSelf={\"flex-start\"}>\n <FlatButton\n className={closeButtonClassName}\n onClick={onRequestClose}\n aria-label={\"Close\"}\n leftIcon={stenaTimes}\n />\n </Box>\n </Row>\n );\n};\n","import { Box } from \"@stenajs-webui/core\";\nimport * as React from \"react\";\nimport { BaseModal, BaseModalProps } from \"./BaseModal\";\nimport { ModalHeader, ModalHeaderProps } from \"./ModalHeader\";\nimport cx from \"classnames\";\nimport styles from \"./Modal.module.css\";\n\nexport interface ModalProps extends BaseModalProps, ModalHeaderProps {\n spacing?: number;\n indent?: number;\n draggable?: boolean;\n footer?: React.ReactNode;\n disableStickyFooter?: boolean;\n}\n\nexport const Modal: React.FC<ModalProps> = ({\n header,\n headerText,\n children,\n spacing,\n indent,\n draggable = false,\n onRequestClose,\n closeButtonClassName,\n footer,\n disableStickyFooter = false,\n ...props\n}) => {\n const activeSpacing = typeof spacing === \"number\" ? spacing : 1;\n const activeIndent = typeof indent === \"number\" ? indent : 1;\n\n return (\n <BaseModal {...props} onRequestClose={onRequestClose} draggable={draggable}>\n <ModalHeader\n onRequestClose={onRequestClose}\n header={header}\n headerText={headerText}\n closeButtonClassName={closeButtonClassName}\n />\n <Box spacing={activeSpacing} indent={activeIndent}>\n {children}\n </Box>\n {footer && (\n <Box\n className={cx(styles.footer, {\n [styles.stickyFooter]: !disableStickyFooter,\n })}\n >\n {footer}\n </Box>\n )}\n </BaseModal>\n );\n};\n","import { Column } from \"@stenajs-webui/core\";\nimport * as React from \"react\";\nimport { ReactNode } from \"react\";\n\nexport interface ModalFooterProps {\n children?: ReactNode;\n}\n\nexport const ModalFooter: React.FC<ModalFooterProps> = ({ children }) => (\n <Column indent={2} spacing={2}>\n {children}\n </Column>\n);\n"],"names":["DRAGGABLE_HANDLE_CLASSNAME","DRAGGABLE_CANCEL_CLASSNAME","BaseModal","width","maxWidth","draggable","children","reactModalProps","ReactModal","styles","overlay","modal","Draggable","cx","content","isDraggable","Drawer","background","zIndex","slideFrom","portalTarget","height","portal","base","afterOpen","beforeClose","getClassNameForSlide","undefined","slideFromLeft","slideFromRight","slideFromTop","slideFromBottom","exhaustSwitchCase","style","justifyContent","CenterModal","LoadingModal","headerIconLeft","headerText","modalProps","Column","_jsx","Box","Spinner","_Fragment","Spacing","Row","_jsxs","Icon","Indent","Heading","ModalHeader","onRequestClose","header","closeButtonClassName","Txt","FlatButton","stenaTimes","Modal","spacing","indent","footer","disableStickyFooter","props","activeSpacing","activeIndent","stickyFooter","ModalFooter"],"mappings":"6nBAaaA,EAA6B,yBAC7BC,EAA6B,yBAE7BC,EAAsC,CAAC,CAClDC,MAAAA,EACAC,SAAAA,EACAC,UAAAA,EAAY,GACZC,SAAAA,KACGC,CAL+C,UAQ/CC,EAAAA,QAAD,CACE,iBAAkBC,EAAOC,QACzB,UAAWD,EAAOE,MAFpB,GAGMJ,EAHN,eAKGK,UAAD,CACE,OAAS,IAAGZ,IACZ,OAAS,IAAGC,8BACZ,OAAO,uBACP,SAAU,CAACI,EAJb,eAME,MAAA,CACE,MAAO,CACL,CAAC,sBAAiCF,EAClC,CAAC,0BAAqCC,CAFjC,EAIP,UAAWS,EAAAA,QAAGJ,EAAOK,QAAS,CAC5B,CAACL,EAAOM,aAAcV,CAAAA,CADX,EALf,SAAAC,CAAA,CAAA,CAAA,CANF,CAAA,CANJ,iWC4BWU,EAAgC,CAAC,CAC5CC,WAAAA,EACAC,OAAAA,EACAZ,SAAAA,EACAa,UAAAA,EAAY,OACZC,aAAAA,KACGb,CANyC,IAOxC,CACE,KAAA,CAAEc,OAAAA,EAAQlB,MAAAA,CAAUI,EAAAA,EAE1B,aACGC,EAAAA,QAAD,CACE,eAAgB,IAChB,gBAAiBC,EAAOa,OACxB,iBAAkB,CAChBC,KAAMd,EAAOC,QACbc,UAAWf,EAAOe,UAClBC,YAAahB,EAAOgB,WAHJ,EAKlB,UAAW,CACTF,KAAMV,EAAGJ,QAAAA,EAAOK,QAASY,EAAqBP,CAAD,CAArC,EACRK,UAAWf,EAAOe,UAClBC,YAAahB,EAAOgB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,EACA,OAAAC,EACA,WAAAf,EACA,qBAAAgB,CAAA,CALJ,EAOEb,EAAA,IAACC,MAAD,CAAK,QAASsB,EAAe,OAAQC,EAArC,SAAA3D,CAAA,CAAA,EAGCuD,GACCpB,EAAA,IAACC,MAAD,CACE,UAAW7B,EAAAA,QAAGJ,EAAOoD,OAAQ,CAC3B,CAACpD,EAAOyD,cAAe,CAACJ,CAAAA,CADb,EADf,SAKGD,CAAAA,CAhBP,CAAA,CAAA,CADF,CAsBD,EC7CYM,GAA0C,CAAC,CAAE7D,SAAAA,CAAF,UACrDkC,EAAAA,OAAD,CAAQ,OAAQ,EAAG,QAAS,EAA5B,SAAAlC,CAAA,CADK"}
1
+ {"version":3,"file":"index.js","sources":["../src/components/modal/BaseModal.tsx","../src/components/drawer/Drawer.tsx","../src/components/center-modal/CenterModal.tsx","../src/components/loading-modal/LoadingModal.tsx","../src/components/modal/ModalHeader.tsx","../src/components/modal/Modal.tsx","../src/components/modal/ModalFooter.tsx"],"sourcesContent":["import * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport Draggable from \"react-draggable\";\nimport cx from \"classnames\";\nimport styles from \"./Modal.module.css\";\n\nexport interface BaseModalProps extends ReactModal.Props {\n width?: string;\n maxWidth?: string;\n onRequestClose?: () => void;\n draggable?: boolean;\n}\n\nexport const DRAGGABLE_HANDLE_CLASSNAME = \"draggable-modal-handle\";\nexport const DRAGGABLE_CANCEL_CLASSNAME = \"draggable-modal-cancel\";\n\nexport const BaseModal: React.FC<BaseModalProps> = ({\n width,\n maxWidth,\n draggable = false,\n children,\n ...reactModalProps\n}) => {\n return (\n <ReactModal\n overlayClassName={styles.overlay}\n className={styles.modal}\n {...reactModalProps}\n >\n <Draggable\n handle={`.${DRAGGABLE_HANDLE_CLASSNAME}`}\n cancel={`.${DRAGGABLE_CANCEL_CLASSNAME}, button, [role=\"tooltip\"]`}\n bounds=\".ReactModal__Overlay\"\n disabled={!draggable}\n >\n <div\n style={{\n [\"--swui-modal-width\" as string]: width,\n [\"--swui-modal-max-width\" as string]: maxWidth,\n }}\n className={cx(styles.content, {\n [styles.isDraggable]: draggable,\n })}\n >\n {children}\n </div>\n </Draggable>\n </ReactModal>\n );\n};\n","import * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport cx from \"classnames\";\nimport styles from \"./Drawer.module.css\";\nimport { exhaustSwitchCase, FlattenUnion } from \"@stenajs-webui/core\";\n\nexport type SlideFrom = SlideFromLeftRight | SlideFromTopBottom;\nexport type SlideFromLeftRight = \"left\" | \"right\";\nexport type SlideFromTopBottom = \"top\" | \"bottom\";\n\nexport type DrawerProps = DrawerBaseLeftRight | DrawerBaseTopBottom;\n\ninterface DrawerBaseLeftRight extends DrawerBaseProps {\n width?: string;\n /**\n * Which direction the drawer will appear from.\n * @default left\n * @param {String('left'|'right')}\n */\n slideFrom?: SlideFromLeftRight;\n}\n\ninterface DrawerBaseTopBottom extends DrawerBaseProps {\n height?: string;\n /**\n * Which direction the drawer will appear from.\n * @default left\n * @param {String('top'|'bottom')}\n */\n slideFrom?: SlideFromTopBottom;\n}\n\ninterface DrawerBaseProps\n extends Omit<\n ReactModal.Props,\n | \"closeTimeoutMS\"\n | \"portalClassName\"\n | \"overlayClassName\"\n | \"className\"\n | \"style\"\n | \"parentSelector\"\n > {\n background?: string;\n zIndex?: number;\n onRequestClose?: () => void;\n /**\n * Portal target, HTML element. If not set, portal is not used.\n */\n portalTarget?: HTMLElement | null;\n}\n\nexport const Drawer: React.FC<DrawerProps> = ({\n background,\n zIndex,\n children,\n slideFrom = \"left\",\n portalTarget,\n ...reactModalProps\n}) => {\n const { height, width } = reactModalProps as FlattenUnion<DrawerProps>;\n\n return (\n <ReactModal\n closeTimeoutMS={250}\n portalClassName={styles.portal}\n overlayClassName={{\n base: styles.overlay,\n afterOpen: styles.afterOpen,\n beforeClose: styles.beforeClose,\n }}\n className={{\n base: cx(styles.content, getClassNameForSlide(slideFrom)),\n afterOpen: styles.afterOpen,\n beforeClose: styles.beforeClose,\n }}\n style={{ content: { width, height, background }, overlay: { zIndex } }}\n parentSelector={portalTarget ? () => portalTarget : undefined}\n {...reactModalProps}\n >\n {children}\n </ReactModal>\n );\n};\n\nconst getClassNameForSlide = (slideFrom: SlideFrom): string => {\n switch (slideFrom) {\n case \"left\":\n return styles.slideFromLeft;\n case \"right\":\n return styles.slideFromRight;\n case \"top\":\n return styles.slideFromTop;\n case \"bottom\":\n return styles.slideFromBottom;\n default:\n return exhaustSwitchCase(slideFrom, styles.slideFromLeft);\n }\n};\n","import * as React from \"react\";\nimport ReactModal from \"react-modal\";\n\nimport styles from \"../modal/Modal.module.css\";\n\nexport interface CenterModalProps extends ReactModal.Props {\n onRequestClose?: () => void;\n}\n\nconst style = { overlay: { justifyContent: \"center\" } };\n\nexport const CenterModal: React.FC<CenterModalProps> = ({\n children,\n ...reactModalProps\n}) => {\n return (\n <ReactModal\n overlayClassName={styles.overlay}\n className={styles.modal}\n style={style}\n {...reactModalProps}\n >\n <div\n className={styles.content}\n style={{ [\"--swui-modal-width\" as string]: \"fit-content\" }}\n >\n {children}\n </div>\n </ReactModal>\n );\n};\n","import { IconDefinition } from \"@fortawesome/fontawesome-svg-core\";\nimport {\n Box,\n Column,\n Heading,\n Indent,\n Row,\n Spacing,\n} from \"@stenajs-webui/core\";\nimport { Icon, Spinner } from \"@stenajs-webui/elements\";\nimport * as React from \"react\";\nimport ReactModal from \"react-modal\";\nimport styles from \"./LoadingModal.module.css\";\n\nexport interface LoadingModalProps extends Omit<ReactModal.Props, \"isOpen\"> {\n headerText?: string;\n headerIconLeft?: IconDefinition;\n}\n\nexport const LoadingModal: React.FC<LoadingModalProps> = ({\n headerIconLeft,\n headerText,\n ...modalProps\n}) => {\n return (\n <ReactModal\n {...modalProps}\n isOpen\n className={styles.modal}\n overlayClassName={styles.overlay}\n >\n <Column spacing={2} alignItems={\"center\"}>\n <Box\n alignItems={\"center\"}\n justifyContent={\"center\"}\n width={\"64px\"}\n height={\"64px\"}\n borderRadius={\"50%\"}\n background={\"white\"}\n shadow={\"modal\"}\n >\n <Spinner size={\"small\"} />\n </Box>\n {(headerIconLeft || headerText) && (\n <>\n <Spacing />\n <Row indent={2}>\n {headerIconLeft && (\n <>\n <Icon size={14} icon={headerIconLeft} color={\"white\"} />\n <Indent />\n </>\n )}\n {headerText && (\n <Heading variant={\"h4\"} color={\"white\"}>\n {headerText}\n </Heading>\n )}\n </Row>\n </>\n )}\n </Column>\n </ReactModal>\n );\n};\n","import { FlatButton, stenaTimes } from \"@stenajs-webui/elements\";\nimport * as React from \"react\";\nimport { ReactNode } from \"react\";\nimport {\n DRAGGABLE_CANCEL_CLASSNAME,\n DRAGGABLE_HANDLE_CLASSNAME,\n} from \"./BaseModal\";\nimport { Box, Row, Txt } from \"@stenajs-webui/core\";\n\nexport interface ModalHeaderProps {\n onRequestClose?: () => void;\n header?: ReactNode;\n headerText?: string;\n closeButtonClassName?: string;\n}\n\nexport const ModalHeader: React.FC<ModalHeaderProps> = ({\n onRequestClose,\n header,\n headerText,\n closeButtonClassName,\n}) => {\n return (\n <Row\n spacing={2}\n indent={2}\n borderBottom={\"1px solid var(--swui-modal-header-border-color)\"}\n className={DRAGGABLE_HANDLE_CLASSNAME}\n >\n <Row flex={1} indent alignItems={\"center\"}>\n {headerText && (\n <Txt className={DRAGGABLE_CANCEL_CLASSNAME} size={\"large\"}>\n {headerText}\n </Txt>\n )}\n {header}\n </Row>\n <Box alignSelf={\"flex-start\"}>\n <FlatButton\n className={closeButtonClassName}\n onClick={onRequestClose}\n aria-label={\"Close\"}\n leftIcon={stenaTimes}\n />\n </Box>\n </Row>\n );\n};\n","import { Box } from \"@stenajs-webui/core\";\nimport * as React from \"react\";\nimport { BaseModal, BaseModalProps } from \"./BaseModal\";\nimport { ModalHeader, ModalHeaderProps } from \"./ModalHeader\";\nimport cx from \"classnames\";\nimport styles from \"./Modal.module.css\";\n\nexport interface ModalProps extends BaseModalProps, ModalHeaderProps {\n spacing?: number;\n indent?: number;\n draggable?: boolean;\n footer?: React.ReactNode;\n disableStickyFooter?: boolean;\n}\n\nexport const Modal: React.FC<ModalProps> = ({\n header,\n headerText,\n children,\n spacing,\n indent,\n draggable = false,\n onRequestClose,\n closeButtonClassName,\n footer,\n disableStickyFooter = false,\n ...props\n}) => {\n const activeSpacing = typeof spacing === \"number\" ? spacing : 1;\n const activeIndent = typeof indent === \"number\" ? indent : 1;\n\n return (\n <BaseModal {...props} onRequestClose={onRequestClose} draggable={draggable}>\n <ModalHeader\n onRequestClose={onRequestClose}\n header={header}\n headerText={headerText}\n closeButtonClassName={closeButtonClassName}\n />\n <Box spacing={activeSpacing} indent={activeIndent}>\n {children}\n </Box>\n {footer && (\n <Box\n className={cx(styles.footer, {\n [styles.stickyFooter]: !disableStickyFooter,\n })}\n >\n {footer}\n </Box>\n )}\n </BaseModal>\n );\n};\n","import { Column } from \"@stenajs-webui/core\";\nimport * as React from \"react\";\nimport { ReactNode } from \"react\";\n\nexport interface ModalFooterProps {\n children?: ReactNode;\n}\n\nexport const ModalFooter: React.FC<ModalFooterProps> = ({ children }) => (\n <Column indent={2} spacing={2}>\n {children}\n </Column>\n);\n"],"names":["DRAGGABLE_HANDLE_CLASSNAME","DRAGGABLE_CANCEL_CLASSNAME","BaseModal","width","maxWidth","draggable","children","reactModalProps","jsx","ReactModal","styles","Draggable","cx","Drawer","background","zIndex","slideFrom","portalTarget","height","getClassNameForSlide","exhaustSwitchCase","style","CenterModal","LoadingModal","headerIconLeft","headerText","modalProps","jsxs","Column","Box","Spinner","Fragment","Spacing","Row","Icon","Indent","Heading","ModalHeader","onRequestClose","header","closeButtonClassName","Txt","FlatButton","stenaTimes","Modal","spacing","indent","footer","disableStickyFooter","props","activeSpacing","activeIndent","ModalFooter"],"mappings":"6nBAaaA,EAA6B,yBAC7BC,EAA6B,yBAE7BC,EAAsC,CAAC,CAClD,MAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,GACZ,SAAAC,KACGC,CACL,IAEIC,EAAA,IAACC,EAAA,QA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tB,CACH,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stenajs-webui/modal",
3
- "version": "18.12.0",
3
+ "version": "18.12.1",
4
4
  "description": "",
5
5
  "author": "mattias800",
6
6
  "license": "MIT",
@@ -26,9 +26,9 @@
26
26
  "deploy": "gh-pages -d example/build"
27
27
  },
28
28
  "dependencies": {
29
- "@stenajs-webui/core": "18.12.0",
30
- "@stenajs-webui/elements": "18.12.0",
31
- "@stenajs-webui/theme": "18.12.0",
29
+ "@stenajs-webui/core": "18.12.1",
30
+ "@stenajs-webui/elements": "18.12.1",
31
+ "@stenajs-webui/theme": "18.12.1",
32
32
  "@types/react-modal": "^3.13.1",
33
33
  "classnames": "^2.3.1",
34
34
  "react-draggable": "^4.4.5",
@@ -58,5 +58,5 @@
58
58
  "files": [
59
59
  "dist"
60
60
  ],
61
- "gitHead": "d0bc10e9bd393ffa69851bed86e6929d632aae2a"
61
+ "gitHead": "8818f001c7328f889eb570756dc9f7ad7b394ca9"
62
62
  }