@appquality/unguess-design-system 2.12.83 → 2.12.85

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/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ # v2.12.85 (Wed May 03 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - fix(toast): add props with children [#233](https://github.com/AppQuality/unguess-design-system/pull/233) ([@cannarocks](https://github.com/cannarocks))
6
+
7
+ #### Authors: 1
8
+
9
+ - Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))
10
+
11
+ ---
12
+
13
+ # v2.12.84 (Tue May 02 2023)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - Develop [#232](https://github.com/AppQuality/unguess-design-system/pull/232) ([@marcbon](https://github.com/marcbon))
18
+ - 🔨 refactor(notifications): change Notification component to use styled-components [#231](https://github.com/AppQuality/unguess-design-system/pull/231) ([@marcbon](https://github.com/marcbon))
19
+
20
+ #### Authors: 1
21
+
22
+ - Marco Bonomo ([@marcbon](https://github.com/marcbon))
23
+
24
+ ---
25
+
1
26
  # v2.12.83 (Tue Mar 28 2023)
2
27
 
3
28
  #### 🐛 Bug Fix
package/build/index.js CHANGED
@@ -276,7 +276,83 @@ const fontWeights = Object.assign(Object.assign({}, reactTheming.DEFAULT_THEME.f
276
276
  const colors = Object.assign(Object.assign({}, reactTheming.DEFAULT_THEME.colors), { primaryHue: palette.blue[600], warningHue: palette.yellow[600], successHue: palette.teal["M600"], dangerHue: palette.red[600], accentHue: palette.water[600] });
277
277
 
278
278
  var _a, _b, _c, _d, _e, _f, _g$8, _h;
279
- const components = Object.assign(Object.assign({}, reactTheming.DEFAULT_THEME.components), { chrome: Object.assign(Object.assign({}, (_a = reactTheming.DEFAULT_THEME.components) === null || _a === void 0 ? void 0 : _a.chrome), { header: Object.assign(Object.assign({}, (_c = (_b = reactTheming.DEFAULT_THEME.components) === null || _b === void 0 ? void 0 : _b.chrome) === null || _c === void 0 ? void 0 : _c.header), { height: "64px" }), nav: Object.assign(Object.assign({}, (_e = (_d = reactTheming.DEFAULT_THEME.components) === null || _d === void 0 ? void 0 : _d.chrome) === null || _e === void 0 ? void 0 : _e.nav), { openWidth: 240, closedWidth: 36, workspaceDropdownWidth: 192 }) }), notification: Object.assign(Object.assign({}, (_f = reactTheming.DEFAULT_THEME.components) === null || _f === void 0 ? void 0 : _f.notification), { card: Object.assign(Object.assign({}, (_h = (_g$8 = reactTheming.DEFAULT_THEME.components) === null || _g$8 === void 0 ? void 0 : _g$8.notification) === null || _h === void 0 ? void 0 : _h.well), { padding: "16px" }) }), pageHeader: {
279
+ const components = Object.assign(Object.assign({}, reactTheming.DEFAULT_THEME.components), { chrome: Object.assign(Object.assign({}, (_a = reactTheming.DEFAULT_THEME.components) === null || _a === void 0 ? void 0 : _a.chrome), { header: Object.assign(Object.assign({}, (_c = (_b = reactTheming.DEFAULT_THEME.components) === null || _b === void 0 ? void 0 : _b.chrome) === null || _c === void 0 ? void 0 : _c.header), { height: "64px" }), nav: Object.assign(Object.assign({}, (_e = (_d = reactTheming.DEFAULT_THEME.components) === null || _d === void 0 ? void 0 : _d.chrome) === null || _e === void 0 ? void 0 : _e.nav), { openWidth: 240, closedWidth: 36, workspaceDropdownWidth: 192 }) }), notification: Object.assign(Object.assign({}, (_f = reactTheming.DEFAULT_THEME.components) === null || _f === void 0 ? void 0 : _f.notification), { card: Object.assign(Object.assign({}, (_h = (_g$8 = reactTheming.DEFAULT_THEME.components) === null || _g$8 === void 0 ? void 0 : _g$8.notification) === null || _h === void 0 ? void 0 : _h.well), { padding: "16px" }) }), "notifications.notification": ({ type, isPrimary, }) => {
280
+ return Object.assign(Object.assign(Object.assign(Object.assign({ "svg": {
281
+ marginTop: "-1px",
282
+ } }, (type === "success" &&
283
+ isPrimary && {
284
+ backgroundColor: palette.green[700],
285
+ svg: {
286
+ color: palette.white,
287
+ },
288
+ })), (type === "warning" &&
289
+ isPrimary && {
290
+ backgroundColor: palette.yellow[700],
291
+ svg: {
292
+ color: palette.white,
293
+ },
294
+ })), (type === "error" &&
295
+ isPrimary && {
296
+ backgroundColor: palette.red[700],
297
+ svg: {
298
+ color: palette.white,
299
+ },
300
+ })), (type === "info" &&
301
+ isPrimary && {
302
+ backgroundColor: palette.blue[700],
303
+ svg: {
304
+ color: palette.white,
305
+ },
306
+ }));
307
+ }, "notifications.notification.close": ({ type, isPrimary, }) => {
308
+ return Object.assign(Object.assign(Object.assign(Object.assign({ cursor: "pointer" }, (type === "success" &&
309
+ isPrimary && {
310
+ color: palette.white,
311
+ ":hover": {
312
+ color: palette.white,
313
+ },
314
+ })), (type === "warning" &&
315
+ isPrimary && {
316
+ color: palette.white,
317
+ ":hover": {
318
+ color: palette.white,
319
+ },
320
+ })), (type === "error" &&
321
+ isPrimary && {
322
+ color: palette.white,
323
+ ":hover": {
324
+ color: palette.white,
325
+ },
326
+ })), (type === "info" &&
327
+ isPrimary && {
328
+ color: palette.white,
329
+ ":hover": {
330
+ color: palette.white,
331
+ },
332
+ }));
333
+ }, "notifications.notification.close-icon": () => {
334
+ return {
335
+ "position": "relative",
336
+ "top": "unset",
337
+ "right": "unset",
338
+ "width": "auto",
339
+ "height": "auto",
340
+ };
341
+ }, "notifications.notification.title": ({ type, isPrimary, }) => {
342
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, (type === "success" &&
343
+ isPrimary && {
344
+ color: palette.white + " !important",
345
+ })), (type === "warning" &&
346
+ isPrimary && {
347
+ color: palette.white + " !important",
348
+ })), (type === "error" &&
349
+ isPrimary && {
350
+ color: palette.white + " !important",
351
+ })), (type === "info" &&
352
+ isPrimary && {
353
+ color: palette.white + " !important",
354
+ }));
355
+ }, pageHeader: {
280
356
  imgMaxHeight: "214px",
281
357
  }, autocomplete: {
282
358
  thumbSize: "60px",
@@ -1795,7 +1871,7 @@ const WaffleChart = ({ height, width, data, total, tooltip, }) => {
1795
1871
  } }) })));
1796
1872
  };
1797
1873
 
1798
- const UgClose = styled__default["default"](reactNotifications.Close) `
1874
+ const UgClose$1 = styled__default["default"](reactNotifications.Close) `
1799
1875
  display: flex;
1800
1876
  align-items: center;
1801
1877
  justify-content: center;
@@ -1805,7 +1881,7 @@ const UgClose = styled__default["default"](reactNotifications.Close) `
1805
1881
  /**
1806
1882
  * Title is a basic component used to display a title. Often used in card headers.
1807
1883
  */
1808
- const Close = (props) => jsxRuntime.jsx(UgClose, Object.assign({}, props));
1884
+ const Close = (props) => jsxRuntime.jsx(UgClose$1, Object.assign({}, props));
1809
1885
 
1810
1886
  const UgDrawer = styled__default["default"](reactModals.DrawerModal) `
1811
1887
  @media (max-width: ${({ theme }) => theme.breakpoints.sm}) {
@@ -3766,15 +3842,49 @@ ModalFullScreen.FooterItem = FooterItem;
3766
3842
  */
3767
3843
  const Chrome = (props) => jsxRuntime.jsx(reactChrome.Chrome, Object.assign({}, props));
3768
3844
 
3845
+ const NOTIFICATION_COMPONENT_ID = "notifications.notification";
3846
+ const CLOSE_COMPONENT_ID = "notifications.notification.close";
3847
+ const CLOSE_ICON_COMPONENT_ID = "notifications.notification.close-icon";
3848
+ const TITLE_COMPONENT_ID = "notifications.notification.title";
3849
+ const UgClose = styled__default["default"](Close).attrs({
3850
+ "data-custom-id": CLOSE_ICON_COMPONENT_ID,
3851
+ }) `
3852
+ ${(props) => reactTheming.retrieveComponentStyles(CLOSE_ICON_COMPONENT_ID, props)};
3853
+ `;
3854
+ const UgAnchor = styled__default["default"](reactButtons.Anchor).attrs({
3855
+ "data-custom-id": CLOSE_COMPONENT_ID,
3856
+ }) `
3857
+ ${(props) => reactTheming.retrieveComponentStyles(CLOSE_COMPONENT_ID, props)};
3858
+ `;
3859
+ const UgTitle = styled__default["default"](Title).attrs({
3860
+ "data-custom-id": TITLE_COMPONENT_ID,
3861
+ }) `
3862
+ ${(props) => reactTheming.retrieveComponentStyles(TITLE_COMPONENT_ID, props)};
3863
+ `;
3864
+ const UgNotification = styled__default["default"](reactNotifications.Notification) `
3865
+ display: flex;
3866
+ align-items: center;
3867
+ justify-content: space-between;
3868
+
3869
+ ${UgAnchor} {
3870
+ flex-shrink: 0;
3871
+ margin-left: ${({ theme }) => theme.space.md};
3872
+ }
3873
+
3874
+ ${(props) => reactTheming.retrieveComponentStyles(NOTIFICATION_COMPONENT_ID, props)};
3875
+ `;
3769
3876
  /**
3770
3877
  * A Notification is a passive status update that keeps users informed of system progress.
3771
3878
  * <hr>
3772
3879
  * Used for this:
3773
3880
  - For a passive status update about user or system activity
3774
3881
  */
3775
- const Notification = (props) => (jsxRuntime.jsx(reactNotifications.Notification, Object.assign({}, props)));
3776
- //Extras
3777
- const ToastProvider = (props) => jsxRuntime.jsx(reactNotifications.ToastProvider, Object.assign({}, props));
3882
+ const Notification = (_a) => {
3883
+ var { closeText, message, onClose, type, isPrimary, isRegular } = _a, props = __rest(_a, ["closeText", "message", "onClose", "type", "isPrimary", "isRegular"]);
3884
+ return (jsxRuntime.jsxs(UgNotification, Object.assign({ type: type, isPrimary: isPrimary }, props, { children: [jsxRuntime.jsx(UgTitle, Object.assign({ isRegular: isRegular, type: type, isPrimary: isPrimary }, { children: message })), jsxRuntime.jsx(UgAnchor, Object.assign({ type: type, isPrimary: isPrimary, onClick: onClose }, { children: closeText !== null && closeText !== void 0 ? closeText : jsxRuntime.jsx(UgClose, {}) }))] })));
3885
+ };
3886
+ // ToastProvider
3887
+ const ToastProvider = (props) => (jsxRuntime.jsx(reactNotifications.ToastProvider, Object.assign({}, props)));
3778
3888
  const useToast = reactNotifications.useToast;
3779
3889
 
3780
3890
  const UgPagination = styled__default["default"](reactPagination.Pagination) ``;
@@ -1,9 +1,11 @@
1
1
  import { INotificationProps, IToastProviderProps } from "@zendeskgarden/react-notifications";
2
2
  export interface NotificationArgs extends INotificationProps {
3
- /** Applies notification type styles */
4
- type?: "success" | "warning" | "error" | "info";
3
+ type?: "success" | "error" | "warning" | "info";
4
+ isPrimary?: boolean;
5
+ isRegular?: boolean;
6
+ message?: string;
7
+ onClose?: () => void;
8
+ closeText?: string;
5
9
  }
6
10
  export interface ToastProviderArgs extends IToastProviderProps {
7
- /** Applies regular (non-bold) font weight */
8
- isRegular?: boolean;
9
11
  }
@@ -1,12 +1,13 @@
1
1
  import { NotificationArgs, ToastProviderArgs } from "./_types";
2
+ import { PropsWithChildren } from "react";
2
3
  /**
3
4
  * A Notification is a passive status update that keeps users informed of system progress.
4
5
  * <hr>
5
6
  * Used for this:
6
7
  - For a passive status update about user or system activity
7
8
  */
8
- declare const Notification: (props: NotificationArgs) => JSX.Element;
9
- declare const ToastProvider: (props: ToastProviderArgs) => JSX.Element;
9
+ declare const Notification: ({ closeText, message, onClose, type, isPrimary, isRegular, ...props }: NotificationArgs) => JSX.Element;
10
+ declare const ToastProvider: (props: PropsWithChildren<ToastProviderArgs>) => JSX.Element;
10
11
  declare const useToast: () => {
11
12
  addToast: (content: import("@zendeskgarden/react-notifications").ToastContent, options?: Partial<import("@zendeskgarden/react-notifications").IToastOptions> | undefined) => string;
12
13
  removeToast: (id: string) => void;
@@ -1,9 +1,10 @@
1
1
  import { ComponentMeta, Story } from "@storybook/react";
2
- import { NotificationArgs } from "./_types";
3
- interface NotificationStoryProps extends NotificationArgs {
4
- title: string;
5
- content: string;
2
+ import { NotificationArgs, ToastProviderArgs } from "./_types";
3
+ interface NotificationStoryProps {
4
+ notificationArgs: NotificationArgs;
5
+ toastProviderArgs: ToastProviderArgs;
6
6
  }
7
- export declare const Default: Story<NotificationStoryProps>;
8
- declare const _default: ComponentMeta<(props: NotificationArgs) => JSX.Element>;
7
+ export declare const ToastProvider: Story<NotificationStoryProps>;
8
+ export declare const Notification: Story<NotificationArgs>;
9
+ declare const _default: ComponentMeta<({ closeText, message, onClose, type, isPrimary, isRegular, ...props }: NotificationArgs) => JSX.Element>;
9
10
  export default _default;
@@ -1,6 +1,42 @@
1
1
  export declare const components: {
2
2
  chrome: any;
3
3
  notification: any;
4
+ "notifications.notification": ({ type, isPrimary, }: {
5
+ type: string;
6
+ isPrimary: boolean;
7
+ }) => {
8
+ backgroundColor?: string | undefined;
9
+ svg: {
10
+ marginTop: string;
11
+ color?: undefined;
12
+ } | {
13
+ color: string;
14
+ marginTop?: undefined;
15
+ };
16
+ };
17
+ "notifications.notification.close": ({ type, isPrimary, }: {
18
+ type: string;
19
+ isPrimary: boolean;
20
+ }) => {
21
+ color?: string | undefined;
22
+ ":hover"?: {
23
+ color: string;
24
+ } | undefined;
25
+ cursor: string;
26
+ };
27
+ "notifications.notification.close-icon": () => {
28
+ position: string;
29
+ top: string;
30
+ right: string;
31
+ width: string;
32
+ height: string;
33
+ };
34
+ "notifications.notification.title": ({ type, isPrimary, }: {
35
+ type: string;
36
+ isPrimary: boolean;
37
+ }) => {
38
+ color?: string | undefined;
39
+ };
4
40
  pageHeader: {
5
41
  imgMaxHeight: string;
6
42
  };
@@ -206,6 +206,42 @@ declare const theme: {
206
206
  components: {
207
207
  chrome: any;
208
208
  notification: any;
209
+ "notifications.notification": ({ type, isPrimary, }: {
210
+ type: string;
211
+ isPrimary: boolean;
212
+ }) => {
213
+ backgroundColor?: string | undefined;
214
+ svg: {
215
+ marginTop: string;
216
+ color?: undefined;
217
+ } | {
218
+ color: string;
219
+ marginTop?: undefined;
220
+ };
221
+ };
222
+ "notifications.notification.close": ({ type, isPrimary, }: {
223
+ type: string;
224
+ isPrimary: boolean;
225
+ }) => {
226
+ color?: string | undefined;
227
+ ":hover"?: {
228
+ color: string;
229
+ } | undefined;
230
+ cursor: string;
231
+ };
232
+ "notifications.notification.close-icon": () => {
233
+ position: string;
234
+ top: string;
235
+ right: string;
236
+ width: string;
237
+ height: string;
238
+ };
239
+ "notifications.notification.title": ({ type, isPrimary, }: {
240
+ type: string;
241
+ isPrimary: boolean;
242
+ }) => {
243
+ color?: string | undefined;
244
+ };
209
245
  pageHeader: {
210
246
  imgMaxHeight: string;
211
247
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appquality/unguess-design-system",
3
- "version": "2.12.83",
3
+ "version": "2.12.85",
4
4
  "dependencies": {
5
5
  "@nivo/bar": "^0.80.0",
6
6
  "@nivo/bullet": "^0.80.0",