@gouvfr-lasuite/ui-kit 0.19.3 → 0.19.5

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.d.ts CHANGED
@@ -42,7 +42,7 @@ export declare type AccessData<UserType, T> = T & {
42
42
  can_delete?: boolean;
43
43
  };
44
44
 
45
- export declare const AccessRoleDropdown: ({ roles, onSelect, canUpdate, selectedRole, isOpen, onOpenChange, roleTopMessage, onDelete, }: AccessRoleDropdownProps) => JSX.Element;
45
+ export declare const AccessRoleDropdown: ({ roles, onSelect, canUpdate, selectedRole, isOpen, onOpenChange, roleTopMessage, onDelete, canDelete, }: AccessRoleDropdownProps) => JSX.Element;
46
46
 
47
47
  declare type AccessRoleDropdownProps = {
48
48
  selectedRole: string;
@@ -53,6 +53,7 @@ declare type AccessRoleDropdownProps = {
53
53
  onOpenChange?: (isOpen: boolean) => void;
54
54
  roleTopMessage?: DropdownMenuProps["topMessage"];
55
55
  onDelete?: () => void;
56
+ canDelete?: boolean;
56
57
  };
57
58
 
58
59
  export declare type AddShareUserListProps<UserType> = {
package/dist/index.js CHANGED
@@ -21096,25 +21096,27 @@ const La = ({
21096
21096
  isOpen: i,
21097
21097
  onOpenChange: o,
21098
21098
  roleTopMessage: l,
21099
- onDelete: a
21099
+ onDelete: a,
21100
+ canDelete: s = !0
21100
21101
  }) => {
21101
- const { t: s } = xe(), c = t.find((d) => d.value === n), u = q(() => a ? [
21102
+ const { t: c } = xe(), u = t.find((h) => h.value === n), d = q(() => !a && !s ? t : [
21102
21103
  ...t,
21103
21104
  { type: "separator" },
21104
21105
  {
21105
- label: s("components.share.access.delete"),
21106
- callback: a
21106
+ label: c("components.share.access.delete"),
21107
+ callback: a,
21108
+ isDisabled: !s
21107
21109
  }
21108
- ] : t, [t, a, s]);
21110
+ ], [t, a, c, s]);
21109
21111
  return r ? /* @__PURE__ */ v.jsx(
21110
21112
  di,
21111
21113
  {
21112
21114
  isOpen: i,
21113
- shouldCloseOnInteractOutside: (d) => !d.closest(
21115
+ shouldCloseOnInteractOutside: (h) => !h.closest(
21114
21116
  ".c__access-role-dropdown"
21115
21117
  ),
21116
21118
  onOpenChange: o,
21117
- options: u,
21119
+ options: d,
21118
21120
  selectedValues: [n],
21119
21121
  onSelectValue: e,
21120
21122
  topMessage: l,
@@ -21128,13 +21130,13 @@ const La = ({
21128
21130
  o == null || o(!i);
21129
21131
  },
21130
21132
  children: [
21131
- /* @__PURE__ */ v.jsx("span", { className: "c__access-role-dropdown__role-label", children: c == null ? void 0 : c.label }),
21133
+ /* @__PURE__ */ v.jsx("span", { className: "c__access-role-dropdown__role-label", children: u == null ? void 0 : u.label }),
21132
21134
  /* @__PURE__ */ v.jsx("span", { className: "material-icons c__access-role-dropdown__icon", children: i ? "arrow_drop_up" : "arrow_drop_down" })
21133
21135
  ]
21134
21136
  }
21135
21137
  )
21136
21138
  }
21137
- ) : /* @__PURE__ */ v.jsx("span", { className: "c__access-role-dropdown__role-label-can-not-update", children: c == null ? void 0 : c.label });
21139
+ ) : /* @__PURE__ */ v.jsx("span", { className: "c__access-role-dropdown__role-label-can-not-update", children: u == null ? void 0 : u.label });
21138
21140
  }, jm = ({
21139
21141
  users: t,
21140
21142
  onRemoveUser: e,
@@ -21164,7 +21166,9 @@ const La = ({
21164
21166
  selectedRole: l,
21165
21167
  onSelect: a,
21166
21168
  isOpen: c,
21167
- onOpenChange: u
21169
+ onOpenChange: u,
21170
+ canDelete: !1,
21171
+ onDelete: void 0
21168
21172
  }
21169
21173
  ),
21170
21174
  /* @__PURE__ */ v.jsx($e, { onClick: n, children: i ?? s("components.share.shareButton") })
@@ -21265,7 +21269,7 @@ const La = ({
21265
21269
  canUpdate: o = !0,
21266
21270
  roleTopMessage: l
21267
21271
  }) => {
21268
- const a = on();
21272
+ const a = on(), s = t.is_explicit !== !1 && t.can_delete !== !1;
21269
21273
  return /* @__PURE__ */ v.jsx("div", { className: "c__share-member-item", children: /* @__PURE__ */ v.jsx(
21270
21274
  _a,
21271
21275
  {
@@ -21284,12 +21288,13 @@ const La = ({
21284
21288
  {
21285
21289
  roles: r,
21286
21290
  selectedRole: t[e],
21287
- onSelect: (s) => n == null ? void 0 : n(t, s),
21291
+ onSelect: (c) => n == null ? void 0 : n(t, c),
21288
21292
  isOpen: a.isOpen,
21289
21293
  onOpenChange: a.setIsOpen,
21290
21294
  canUpdate: o,
21291
21295
  roleTopMessage: l,
21292
- onDelete: t.is_explicit !== !1 && t.can_delete !== !1 && i ? () => i(t) : void 0
21296
+ canDelete: s,
21297
+ onDelete: i ? () => i(t) : void 0
21293
21298
  }
21294
21299
  ) })
21295
21300
  }
@@ -21383,10 +21388,11 @@ const La = ({
21383
21388
  })),
21384
21389
  // eslint-disable-next-line react-hooks/exhaustive-deps
21385
21390
  [o]
21386
- ), x = q(
21387
- () => E.find((w) => w.value === y),
21388
- [E, y]
21389
- ), I = i && o.length > 0, K = () => /* @__PURE__ */ v.jsx("div", { className: "c__share-modal__link-settings__content__select", children: e ? /* @__PURE__ */ v.jsx(
21391
+ ), x = q(() => E.find((w) => w.value === y), [E, y]);
21392
+ Y(() => {
21393
+ m([r]);
21394
+ }, [r]);
21395
+ const I = i && o.length > 0, K = () => /* @__PURE__ */ v.jsx("div", { className: "c__share-modal__link-settings__content__select", children: e ? /* @__PURE__ */ v.jsx(
21390
21396
  di,
21391
21397
  {
21392
21398
  onSelectValue: (w) => {