@fluidattacks/design 11.7.1 → 11.8.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.
@@ -1,19 +1,20 @@
1
1
  import { jsxs as u, jsx as o } from "react/jsx-runtime";
2
2
  import { useCallback as p } from "react";
3
- import { CarouselContainer as C, CarouselWrapper as m, CarouselSlide as d, NavContainer as v, NavButton as h } from "./styles.js";
3
+ import { CarouselContainer as m, CarouselWrapper as C, CarouselSlide as d, NavContainer as v, NavButton as h } from "./styles.js";
4
4
  import { useCarousel as k } from "../../hooks/use-carousel.js";
5
- const N = ({
5
+ import "../../_virtual/lodash.js";
6
+ const g = ({
6
7
  slides: a,
7
8
  interval: c = 300
8
9
  }) => {
9
- const { cycle: l, setCycle: n, setProgress: i } = k(c, a.length), s = p(
10
+ const { cycle: l, setCycle: i, setProgress: n } = k(c, a.length), s = p(
10
11
  (e) => () => {
11
- n(e), i(0);
12
+ i(e), n(0);
12
13
  },
13
- [n, i]
14
+ [i, n]
14
15
  );
15
- return /* @__PURE__ */ u(C, { "aria-roledescription": "carousel", children: [
16
- /* @__PURE__ */ o(m, { $currentIndex: l, children: a.map((e, r) => {
16
+ return /* @__PURE__ */ u(m, { "aria-roledescription": "carousel", children: [
17
+ /* @__PURE__ */ o(C, { $currentIndex: l, children: a.map((e, r) => {
17
18
  const t = `slide-${r}`;
18
19
  return /* @__PURE__ */ o(
19
20
  d,
@@ -41,5 +42,5 @@ const N = ({
41
42
  ] });
42
43
  };
43
44
  export {
44
- N as Carousel
45
+ g as Carousel
45
46
  };
@@ -1,8 +1,9 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import { AdvancedImage as l, lazyload as g, placeholder as c } from "../../node_modules/@cloudinary/react/dist/index.js";
3
- import f from "react";
4
- import { useCloudinaryImage as n } from "../../hooks/use-cloudinary-image.js";
5
- const p = ({
3
+ import p from "react";
4
+ import { useCloudinaryImage as f } from "../../hooks/use-cloudinary-image.js";
5
+ import "../../_virtual/lodash.js";
6
+ const n = ({
6
7
  alt: e = "img",
7
8
  height: a = "",
8
9
  width: r = "",
@@ -10,7 +11,7 @@ const p = ({
10
11
  plugins: d = [g(), c()],
11
12
  publicId: t
12
13
  }) => {
13
- const o = n({ publicId: t });
14
+ const o = f({ publicId: t });
14
15
  return m && o.addTransformation(m), /* @__PURE__ */ i(
15
16
  l,
16
17
  {
@@ -21,7 +22,7 @@ const p = ({
21
22
  width: r
22
23
  }
23
24
  );
24
- }, x = f.memo(p);
25
+ }, y = p.memo(n);
25
26
  export {
26
- x as CloudImage
27
+ y as CloudImage
27
28
  };
@@ -3,26 +3,27 @@ import { useState as k, useRef as j, useCallback as r, useMemo as D } from "reac
3
3
  import { Checkbox as M } from "../checkbox/index.js";
4
4
  import { Container as O } from "../container/index.js";
5
5
  import { Modal as y } from "../modal/index.js";
6
+ import "../../_virtual/lodash.js";
6
7
  import { useModal as v } from "../../hooks/use-modal.js";
7
8
  import { ModalConfirm as R } from "../modal/modal-confirm/index.js";
8
9
  const S = ({
9
10
  children: a,
10
- conditions: t,
11
+ conditions: n,
11
12
  id: c,
12
13
  modalRef: s,
13
14
  onConfirm: m,
14
15
  title: d
15
16
  }) => {
16
- const [n, i] = k(t), f = r(() => {
17
- i({ ...t });
18
- }, [t]), u = r((o) => () => {
17
+ const [t, i] = k(n), f = r(() => {
18
+ i({ ...n });
19
+ }, [n]), u = r((o) => () => {
19
20
  i((e) => ({
20
21
  ...e,
21
22
  [o]: { ...e[o], state: !e[o].state }
22
23
  }));
23
- }, []), l = !Object.values(n).every(
24
+ }, []), l = !Object.values(t).every(
24
25
  ({ state: o }) => o
25
- ), p = Object.entries(n).map(
26
+ ), p = Object.entries(t).map(
26
27
  ([o, { state: e, label: C }]) => /* @__PURE__ */ h(
27
28
  M,
28
29
  {
@@ -50,12 +51,12 @@ const S = ({
50
51
  ]
51
52
  }
52
53
  );
53
- }, E = (a, t, c) => {
54
- const { close: s, isOpen: m, name: d, open: n, setIsOpen: i, toggle: f } = v(
54
+ }, F = (a, n, c) => {
55
+ const { close: s, isOpen: m, name: d, open: t, setIsOpen: i, toggle: f } = v(
55
56
  "confirm-dialog-modal"
56
- ), [u] = k(c), l = j(null), p = r(async () => (n(), new Promise((g) => {
57
+ ), [u] = k(c), l = j(null), p = r(async () => (t(), new Promise((g) => {
57
58
  l.current = g;
58
- })), [n]), o = r(() => {
59
+ })), [t]), o = r(() => {
59
60
  s(), l.current?.(!0);
60
61
  }, [s]), e = r(() => {
61
62
  s(), l.current?.(!1);
@@ -64,11 +65,11 @@ const S = ({
64
65
  close: e,
65
66
  isOpen: m,
66
67
  name: d,
67
- open: n,
68
+ open: t,
68
69
  setIsOpen: i,
69
70
  toggle: f
70
71
  }),
71
- [e, m, d, n, i, f]
72
+ [e, m, d, t, i, f]
72
73
  ), b = r(
73
74
  ({ children: g }) => /* @__PURE__ */ h(
74
75
  S,
@@ -77,14 +78,14 @@ const S = ({
77
78
  id: a,
78
79
  modalRef: C,
79
80
  onConfirm: o,
80
- title: t,
81
+ title: n,
81
82
  children: g
82
83
  }
83
84
  ),
84
- [o, a, u, C, t]
85
+ [o, a, u, C, n]
85
86
  );
86
87
  return [p, b];
87
88
  };
88
89
  export {
89
- E as useConditionsDialog
90
+ F as useConditionsDialog
90
91
  };
@@ -1,23 +1,24 @@
1
1
  import { jsxs as f } from "react/jsx-runtime";
2
2
  import { useState as u, useRef as C, useCallback as l } from "react";
3
3
  import { Modal as p } from "../modal/index.js";
4
+ import "../../_virtual/lodash.js";
4
5
  import { useModal as g } from "../../hooks/use-modal.js";
5
- const M = () => {
6
- const [o, n] = u(), r = C(null), c = g("confirm-dialog-modal"), { close: e, open: s } = c, m = l(
6
+ const k = () => {
7
+ const [o, n] = u(), r = C(null), c = g("confirm-dialog-modal"), { close: e, open: s } = c, a = l(
7
8
  async (i) => (n(i), s(), new Promise((t) => {
8
9
  r.current = t;
9
10
  })),
10
11
  [s]
11
12
  ), d = l(() => {
12
13
  e(), n(void 0), r.current?.(!0);
13
- }, [e]), a = l(() => {
14
+ }, [e]), m = l(() => {
14
15
  e(), n(void 0), r.current?.(!1);
15
16
  }, [e]);
16
17
  return { ConfirmDialog: ({ id: i = "confirm-dialog-modal", children: t }) => /* @__PURE__ */ f(
17
18
  p,
18
19
  {
19
20
  cancelButton: o?.showCancel === !0 || o?.showCancel === void 0 ? {
20
- onClick: a,
21
+ onClick: m,
21
22
  text: o?.cancelText ?? "Cancel"
22
23
  } : void 0,
23
24
  confirmButton: o?.showConfirm === !0 || o?.showConfirm === void 0 ? {
@@ -27,7 +28,7 @@ const M = () => {
27
28
  } : void 0,
28
29
  description: o?.message,
29
30
  id: i,
30
- modalRef: { ...c, close: a },
31
+ modalRef: { ...c, close: m },
31
32
  size: o?.modalSize ?? "sm",
32
33
  title: o?.title,
33
34
  children: [
@@ -35,8 +36,8 @@ const M = () => {
35
36
  t
36
37
  ]
37
38
  }
38
- ), confirm: m };
39
+ ), confirm: a };
39
40
  };
40
41
  export {
41
- M as useConfirmDialog
42
+ k as useConfirmDialog
42
43
  };
@@ -1,21 +1,22 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
- import { useRef as f, useState as c } from "react";
2
+ import { useRef as f, useState as p } from "react";
3
3
  import { trapTabKey as o } from "./utils.js";
4
- import { ModalWrapper as p } from "../styles.js";
4
+ import { ModalWrapper as c } from "../styles.js";
5
+ import "../../../_virtual/lodash.js";
5
6
  import { useMountEffect as s } from "../../../hooks/use-mount-effect.js";
6
- const w = ({
7
+ const b = ({
7
8
  children: n = void 0,
8
9
  id: a = void 0,
9
10
  label: i
10
11
  }) => {
11
- const r = f(null), [t] = c(() => document.activeElement);
12
+ const r = f(null), [t] = p(() => document.activeElement);
12
13
  return s(() => {
13
14
  const e = r.current;
14
15
  return e?.contains(document.activeElement) !== !0 && e?.focus(), e?.addEventListener("keydown", o), () => {
15
16
  e?.removeEventListener("keydown", o), t instanceof HTMLElement && t.focus();
16
17
  };
17
18
  }), /* @__PURE__ */ m(
18
- p,
19
+ c,
19
20
  {
20
21
  "aria-label": i,
21
22
  "aria-modal": "true",
@@ -28,5 +29,5 @@ const w = ({
28
29
  );
29
30
  };
30
31
  export {
31
- w as Dialog
32
+ b as Dialog
32
33
  };
@@ -1,4 +1,4 @@
1
- import { IOAuthSelectorProps, IOptionRowProps, TOAuthProvider } from './types';
2
- declare const OAuthSelector: ({ align, buttonLabel, fallbackOptions, header, id, options, }: Readonly<IOAuthSelectorProps>) => JSX.Element;
1
+ import { IOAuthSelectorProps, IOptionRowProps, ISelectorNote, TOAuthProvider } from './types';
2
+ declare const OAuthSelector: ({ align, buttonLabel, fallbackOptions, header, id, note, options, }: Readonly<IOAuthSelectorProps>) => JSX.Element;
3
3
  export { OAuthSelector };
4
- export type { IOAuthSelectorProps, IOptionRowProps, TOAuthProvider };
4
+ export type { IOAuthSelectorProps, IOptionRowProps, ISelectorNote, TOAuthProvider, };
@@ -1,62 +1,65 @@
1
- import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import { useState as C, useRef as O, useId as I, useCallback as i, createElement as b, Fragment as D } from "react";
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { useState as O, useRef as b, useId as z, useCallback as r, createElement as S, Fragment as D } from "react";
3
3
  import { useTheme as k } from "styled-components";
4
4
  import { OptionRow as R } from "./option-row/index.js";
5
- import { Button as S } from "../button/index.js";
6
- import { Container as h } from "../container/index.js";
7
- import { Divider as z } from "../divider/index.js";
5
+ import { SelectorNote as T } from "./styles.js";
6
+ import { Button as W } from "../button/index.js";
7
+ import { Container as d } from "../container/index.js";
8
+ import { Divider as j } from "../divider/index.js";
9
+ import { Icon as A } from "../icon/index.js";
8
10
  import "../typography/heading/index.js";
9
11
  import "../typography/span/index.js";
10
- import { Text as T } from "../typography/text/index.js";
11
- import { useClickOutside as j } from "../../hooks/use-click-outside.js";
12
- const M = ({
13
- align: u = "end",
12
+ import { Text as p } from "../typography/text/index.js";
13
+ import { useClickOutside as E } from "../../hooks/use-click-outside.js";
14
+ const V = ({
15
+ align: x = "end",
14
16
  buttonLabel: a = "Add Credential",
15
- fallbackOptions: p = [],
17
+ fallbackOptions: m = [],
16
18
  header: n,
17
- id: x,
18
- options: g
19
+ id: y,
20
+ note: l,
21
+ options: v
19
22
  }) => {
20
- const o = k(), [d, r] = C(!1), m = O(null), w = I(), c = x ?? w, s = i(() => {
21
- r(!1);
23
+ const o = k(), [f, s] = O(!1), h = b(null), w = z(), g = y ?? w, c = r(() => {
24
+ s(!1);
22
25
  }, []);
23
- j(m, s);
24
- const y = i(() => {
25
- r((e) => !e);
26
- }, []), v = i(
27
- (e) => {
28
- e.key === "Escape" && r(!1);
26
+ E(h, c);
27
+ const C = r(() => {
28
+ s((i) => !i);
29
+ }, []), I = r(
30
+ (i) => {
31
+ i.key === "Escape" && s(!1);
29
32
  },
30
33
  []
31
- ), f = i(
32
- (e) => /* @__PURE__ */ b(R, { ...e, key: e.id, onChoose: s }),
33
- [s]
34
+ ), u = r(
35
+ (i) => /* @__PURE__ */ S(R, { ...i, key: i.id, onChoose: c }),
36
+ [c]
34
37
  );
35
- return /* @__PURE__ */ l(
36
- h,
38
+ return /* @__PURE__ */ t(
39
+ d,
37
40
  {
38
- alignItems: u,
41
+ alignItems: x,
39
42
  display: "flex",
40
43
  flexDirection: "column",
41
- onKeyDown: v,
44
+ onKeyDown: I,
42
45
  position: "relative",
43
- ref: m,
46
+ ref: h,
44
47
  width: "max-content",
45
48
  zIndex: 10,
46
49
  children: [
47
- /* @__PURE__ */ t(
48
- S,
50
+ /* @__PURE__ */ e(
51
+ W,
49
52
  {
50
- "aria-controls": c,
51
- "aria-expanded": d,
53
+ "aria-controls": g,
54
+ "aria-expanded": f,
52
55
  icon: "plus",
53
- onClick: y,
56
+ onClick: C,
54
57
  variant: "primary",
55
58
  children: a
56
59
  }
57
60
  ),
58
- d ? /* @__PURE__ */ l(
59
- h,
61
+ f ? /* @__PURE__ */ t(
62
+ d,
60
63
  {
61
64
  "aria-label": n ?? a,
62
65
  bgColor: o.palette.white,
@@ -65,7 +68,7 @@ const M = ({
65
68
  display: "flex",
66
69
  flexDirection: "column",
67
70
  gap: 0.25,
68
- id: c,
71
+ id: g,
69
72
  minWidth: "380px",
70
73
  padding: [0.75, 0.75, 0.75, 0.75],
71
74
  position: "absolute",
@@ -74,8 +77,8 @@ const M = ({
74
77
  top: "44px",
75
78
  zIndex: 10,
76
79
  children: [
77
- n === void 0 ? void 0 : /* @__PURE__ */ t(
78
- T,
80
+ n === void 0 ? void 0 : /* @__PURE__ */ e(
81
+ p,
79
82
  {
80
83
  color: o.palette.gray[400],
81
84
  fontWeight: "bold",
@@ -84,10 +87,33 @@ const M = ({
84
87
  children: n
85
88
  }
86
89
  ),
87
- /* @__PURE__ */ t("span", { children: g.map(f) }),
88
- p.length === 0 ? void 0 : /* @__PURE__ */ l(D, { children: [
89
- /* @__PURE__ */ t(z, { mb: 0.25, mt: 0.25 }),
90
- p.map(f)
90
+ /* @__PURE__ */ e("span", { children: v.map(u) }),
91
+ l === void 0 ? void 0 : /* @__PURE__ */ t(T, { role: "note", children: [
92
+ /* @__PURE__ */ e(
93
+ A,
94
+ {
95
+ icon: "circle-info",
96
+ iconColor: o.palette.info[700],
97
+ iconSize: "lg",
98
+ iconType: "fa-light"
99
+ }
100
+ ),
101
+ /* @__PURE__ */ t(d, { children: [
102
+ /* @__PURE__ */ e(
103
+ p,
104
+ {
105
+ color: o.palette.info[700],
106
+ fontWeight: "bold",
107
+ size: "md",
108
+ children: l.title
109
+ }
110
+ ),
111
+ /* @__PURE__ */ e(p, { color: o.palette.info[700], size: "md", children: l.description })
112
+ ] })
113
+ ] }),
114
+ m.length === 0 ? void 0 : /* @__PURE__ */ t(D, { children: [
115
+ /* @__PURE__ */ e(j, { mb: 0.25, mt: 0.25 }),
116
+ m.map(u)
91
117
  ] })
92
118
  ]
93
119
  }
@@ -97,5 +123,5 @@ const M = ({
97
123
  );
98
124
  };
99
125
  export {
100
- M as OAuthSelector
126
+ V as OAuthSelector
101
127
  };
@@ -1,2 +1,3 @@
1
1
  declare const OptionButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>>> & string;
2
- export { OptionButton };
2
+ declare const SelectorNote: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
3
+ export { OptionButton, SelectorNote };
@@ -1,21 +1,33 @@
1
- import { styled as r } from "styled-components";
2
- const t = r.button`
3
- ${({ theme: o }) => `
1
+ import { styled as o } from "styled-components";
2
+ const r = o.button`
3
+ ${({ theme: i }) => `
4
4
  align-items: center;
5
5
  background: none;
6
6
  border: none;
7
- border-radius: ${o.spacing[0.25]};
7
+ border-radius: ${i.spacing[0.25]};
8
8
  cursor: pointer;
9
9
  display: flex;
10
10
  gap: 9px;
11
- padding: ${o.spacing[0.5]};
11
+ padding: ${i.spacing[0.5]};
12
12
  text-align: left;
13
13
  width: 100%;
14
14
 
15
- &:hover { background-color: ${o.palette.gray[100]}; }
16
- &:focus-visible { outline: 1px solid ${o.palette.primary[400]}; }
15
+ &:hover { background-color: ${i.palette.gray[100]}; }
16
+ &:focus-visible { outline: 1px solid ${i.palette.primary[400]}; }
17
+ `}
18
+ `, a = o.div`
19
+ ${({ theme: i }) => `
20
+ align-items: center;
21
+ background: ${i.palette.info[50]};
22
+ border: 1px solid ${i.palette.info[500]};
23
+ border-radius: ${i.spacing[0.25]};
24
+ display: flex;
25
+ gap: ${i.spacing[0.5]};
26
+ margin-top: ${i.spacing[0.25]};
27
+ padding: ${i.spacing[0.75]};
17
28
  `}
18
29
  `;
19
30
  export {
20
- t as OptionButton
31
+ r as OptionButton,
32
+ a as SelectorNote
21
33
  };
@@ -32,6 +32,16 @@ interface IOptionRowProps {
32
32
  interface IOptionRowComponentProps extends IOptionRowProps {
33
33
  onChoose: VoidFunction;
34
34
  }
35
+ /**
36
+ * Info note shown inside the selector panel.
37
+ * @interface ISelectorNote
38
+ * @property {string} description - Regular line under the title.
39
+ * @property {string} title - Bold first line of the note.
40
+ */
41
+ interface ISelectorNote {
42
+ description: string;
43
+ title: string;
44
+ }
35
45
  /**
36
46
  * Oauth selector component props.
37
47
  * @interface IOAuthSelectorProps
@@ -40,6 +50,7 @@ interface IOptionRowComponentProps extends IOptionRowProps {
40
50
  * @property {IOptionRowProps[]} [fallbackOptions] - Options shown under a divider.
41
51
  * @property {string} [header] - Uppercase header shown above the options.
42
52
  * @property {string} [id] - Id to be used on the panel.
53
+ * @property {ISelectorNote} [note] - Info note shown between the options and the fallback options.
43
54
  * @property {IOptionRowProps[]} options - Ordered options the menu offers.
44
55
  */
45
56
  interface IOAuthSelectorProps {
@@ -48,6 +59,7 @@ interface IOAuthSelectorProps {
48
59
  fallbackOptions?: IOptionRowProps[];
49
60
  header?: string;
50
61
  id?: string;
62
+ note?: ISelectorNote;
51
63
  options: IOptionRowProps[];
52
64
  }
53
- export type { IOAuthSelectorProps, IOptionRowComponentProps, IOptionRowProps, TOAuthProvider, };
65
+ export type { IOAuthSelectorProps, IOptionRowComponentProps, IOptionRowProps, ISelectorNote, TOAuthProvider, };
@@ -2,11 +2,12 @@ import { jsx as a } from "react/jsx-runtime";
2
2
  import { useRef as l, useState as x, useCallback as m } from "react";
3
3
  import { TableContext as z } from "../context/index.js";
4
4
  import { TableContainer as y } from "../styles.js";
5
+ import "../../../_virtual/lodash.js";
5
6
  import { useMountEffect as u } from "../../../hooks/use-mount-effect.js";
6
7
  const C = 160, f = (t) => Number.parseFloat(t) || 0, E = (t) => {
7
8
  const { paddingLeft: e, paddingRight: n } = getComputedStyle(t);
8
9
  return t.clientWidth - f(e) - f(n);
9
- }, M = ({
10
+ }, P = ({
10
11
  children: t,
11
12
  table: e
12
13
  }) => {
@@ -62,5 +63,5 @@ const C = 160, f = (t) => Number.parseFloat(t) || 0, E = (t) => {
62
63
  );
63
64
  };
64
65
  export {
65
- M as Table
66
+ P as Table
66
67
  };
package/package.json CHANGED
@@ -135,5 +135,5 @@
135
135
  "./dist/index.js"
136
136
  ],
137
137
  "typings": "./dist/index.d.ts",
138
- "version": "11.7.1"
138
+ "version": "11.8.0"
139
139
  }