@supersoniks/concorde 1.1.42 → 1.1.44

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.
Files changed (189) hide show
  1. package/components.js +2 -3
  2. package/concorde-core.bundle.js +37 -35
  3. package/concorde-core.es.js +5283 -4453
  4. package/core/_types/types.d.ts +31 -0
  5. package/core/_types/types.js +2 -0
  6. package/core/components/functional/date/date.d.ts +13 -5
  7. package/core/components/functional/date/date.js +57 -38
  8. package/core/components/functional/example/example.d.ts +1 -1
  9. package/core/components/functional/example/example.js +1 -1
  10. package/core/components/functional/fetch/fetch.d.ts +45 -6
  11. package/core/components/functional/fetch/fetch.js +2 -6
  12. package/core/components/functional/functional.d.ts +2 -0
  13. package/core/components/functional/functional.js +2 -0
  14. package/core/components/functional/if/if.d.ts +3 -0
  15. package/core/components/functional/if/if.js +6 -12
  16. package/core/components/functional/if/if.test.d.ts +1 -0
  17. package/core/components/functional/if/if.test.js +44 -0
  18. package/core/components/functional/list/list.d.ts +44 -12
  19. package/core/components/functional/list/list.js +54 -49
  20. package/core/components/functional/mix/mix.d.ts +22 -0
  21. package/core/components/functional/mix/mix.js +102 -0
  22. package/core/components/functional/queue/queue.d.ts +27 -5
  23. package/core/components/functional/queue/queue.js +88 -26
  24. package/core/components/functional/router/redirect.d.ts +11 -2
  25. package/core/components/functional/router/redirect.js +7 -12
  26. package/core/components/functional/router/router.d.ts +15 -1
  27. package/core/components/functional/router/router.js +11 -16
  28. package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +1 -2
  29. package/core/components/functional/sdui/SDUIDescriptorTransformer.js +56 -45
  30. package/core/components/functional/sdui/default-library.json +108 -0
  31. package/core/components/functional/sdui/sdui-utils.d.ts +5 -0
  32. package/core/components/functional/sdui/sdui-utils.js +63 -0
  33. package/core/components/functional/sdui/sdui.d.ts +21 -13
  34. package/core/components/functional/sdui/sdui.js +70 -44
  35. package/core/components/functional/sdui/types.d.ts +10 -8
  36. package/core/components/functional/states/states.d.ts +20 -4
  37. package/core/components/functional/states/states.js +15 -20
  38. package/core/components/functional/submit/submit.d.ts +16 -1
  39. package/core/components/functional/submit/submit.js +95 -25
  40. package/core/components/functional/subscriber/subscriber.d.ts +4 -1
  41. package/core/components/functional/subscriber/subscriber.js +1 -6
  42. package/core/components/functional/value/value.d.ts +7 -0
  43. package/core/components/functional/value/value.js +26 -0
  44. package/core/components/ui/_css/scroll.js +6 -7
  45. package/core/components/ui/_css/size.d.ts +1 -0
  46. package/core/components/ui/_css/size.js +3 -1
  47. package/core/components/ui/alert/alert.d.ts +2 -2
  48. package/core/components/ui/alert/alert.js +11 -16
  49. package/core/components/ui/badge/badge.d.ts +3 -1
  50. package/core/components/ui/badge/badge.js +36 -22
  51. package/core/components/ui/button/button.d.ts +28 -23
  52. package/core/components/ui/button/button.js +60 -43
  53. package/core/components/ui/captcha/captcha.d.ts +14 -2
  54. package/core/components/ui/captcha/captcha.js +18 -13
  55. package/core/components/ui/card/card-footer.js +1 -8
  56. package/core/components/ui/card/card-header-descripton.js +3 -9
  57. package/core/components/ui/card/card-header.js +6 -7
  58. package/core/components/ui/card/card-main.js +0 -5
  59. package/core/components/ui/card/card.d.ts +1 -1
  60. package/core/components/ui/card/card.js +30 -12
  61. package/core/components/ui/divider/divider.d.ts +2 -0
  62. package/core/components/ui/divider/divider.js +43 -16
  63. package/core/components/ui/form/checkbox/checkbox.d.ts +86 -25
  64. package/core/components/ui/form/checkbox/checkbox.js +53 -28
  65. package/core/components/ui/form/css/form-control.d.ts +2 -0
  66. package/core/components/ui/form/css/form-control.js +145 -67
  67. package/core/components/ui/form/fieldset/fieldset.d.ts +8 -1
  68. package/core/components/ui/form/fieldset/fieldset.js +45 -8
  69. package/core/components/ui/form/fieldset/legend-description.js +0 -5
  70. package/core/components/ui/form/fieldset/legend.js +3 -6
  71. package/core/components/ui/form/form-actions/form-actions.d.ts +2 -0
  72. package/core/components/ui/form/form-actions/form-actions.js +26 -11
  73. package/core/components/ui/form/form-layout/form-layout.d.ts +5 -2
  74. package/core/components/ui/form/form-layout/form-layout.js +31 -9
  75. package/core/components/ui/form/input/input.d.ts +26 -24
  76. package/core/components/ui/form/input/input.js +87 -52
  77. package/core/components/ui/form/input/password-helper.d.ts +1 -1
  78. package/core/components/ui/form/input/password-helper.js +4 -3
  79. package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
  80. package/core/components/ui/form/input/same-value-helper.js +3 -2
  81. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +2 -3
  82. package/core/components/ui/form/input-autocomplete/input-autocomplete.js +2 -6
  83. package/core/components/ui/form/radio/radio.d.ts +6 -0
  84. package/core/components/ui/form/radio/radio.js +7 -12
  85. package/core/components/ui/form/select/select.d.ts +25 -8
  86. package/core/components/ui/form/select/select.js +72 -41
  87. package/core/components/ui/form/textarea/textarea.d.ts +21 -19
  88. package/core/components/ui/form/textarea/textarea.js +29 -36
  89. package/core/components/ui/group/group.d.ts +11 -1
  90. package/core/components/ui/group/group.js +79 -17
  91. package/core/components/ui/icon/icon.d.ts +10 -3
  92. package/core/components/ui/icon/icon.js +16 -15
  93. package/core/components/ui/icon/icons.js +25 -20
  94. package/core/components/ui/icon/icons.json +1 -1
  95. package/core/components/ui/image/image.js +0 -5
  96. package/core/components/ui/link/link.d.ts +1 -1
  97. package/core/components/ui/link/link.js +2 -6
  98. package/core/components/ui/loader/loader.d.ts +1 -1
  99. package/core/components/ui/loader/loader.js +3 -9
  100. package/core/components/ui/menu/menu-item.js +4 -9
  101. package/core/components/ui/menu/menu.d.ts +9 -1
  102. package/core/components/ui/menu/menu.js +182 -27
  103. package/core/components/ui/modal/modal-actions.js +1 -6
  104. package/core/components/ui/modal/modal-close.d.ts +1 -0
  105. package/core/components/ui/modal/modal-close.js +14 -10
  106. package/core/components/ui/modal/modal-content.js +0 -5
  107. package/core/components/ui/modal/modal-subtitle.js +2 -6
  108. package/core/components/ui/modal/modal-title.js +0 -5
  109. package/core/components/ui/modal/modal.d.ts +7 -7
  110. package/core/components/ui/modal/modal.js +37 -37
  111. package/core/components/ui/pop/pop.d.ts +6 -5
  112. package/core/components/ui/pop/pop.js +57 -57
  113. package/core/components/ui/progress/progress.js +34 -32
  114. package/core/components/ui/table/table-caption.js +5 -10
  115. package/core/components/ui/table/table-tbody.js +10 -14
  116. package/core/components/ui/table/table-td.d.ts +2 -0
  117. package/core/components/ui/table/table-td.js +8 -5
  118. package/core/components/ui/table/table-tfoot.js +5 -7
  119. package/core/components/ui/table/table-th.d.ts +2 -0
  120. package/core/components/ui/table/table-th.js +12 -9
  121. package/core/components/ui/table/table-thead.js +1 -6
  122. package/core/components/ui/table/table-tr.js +4 -6
  123. package/core/components/ui/table/table.d.ts +0 -3
  124. package/core/components/ui/table/table.js +14 -31
  125. package/core/components/ui/theme/theme-collection/core-variables.js +13 -11
  126. package/core/components/ui/theme/theme-collection/dark.js +1 -1
  127. package/core/components/ui/theme/theme.d.ts +1 -6
  128. package/core/components/ui/theme/theme.js +19 -46
  129. package/core/components/ui/toast/message-subscriber.d.ts +16 -7
  130. package/core/components/ui/toast/message-subscriber.js +10 -8
  131. package/core/components/ui/toast/toast-item.js +1 -1
  132. package/core/components/ui/toast/toast.d.ts +3 -2
  133. package/core/components/ui/toast/toast.js +33 -19
  134. package/core/components/ui/toast/types.d.ts +3 -2
  135. package/core/components/ui/tooltip/tooltip.d.ts +1 -0
  136. package/core/components/ui/tooltip/tooltip.js +36 -15
  137. package/core/components/ui/ui.d.ts +1 -1
  138. package/core/components/ui/ui.js +1 -4
  139. package/core/core.js +5 -6
  140. package/core/mixins/Fetcher.d.ts +20 -13
  141. package/core/mixins/Fetcher.js +44 -19
  142. package/core/mixins/FormCheckable.d.ts +25 -13
  143. package/core/mixins/FormCheckable.js +180 -23
  144. package/core/mixins/FormElement.d.ts +17 -9
  145. package/core/mixins/FormElement.js +56 -39
  146. package/core/mixins/FormInput.d.ts +22 -12
  147. package/core/mixins/FormInput.js +4 -3
  148. package/core/mixins/Subscriber.d.ts +12 -8
  149. package/core/mixins/Subscriber.js +51 -48
  150. package/core/mixins/TemplatesContainer.d.ts +2 -1
  151. package/core/mixins/TemplatesContainer.js +2 -2
  152. package/core/utils/Arrays.d.ts +15 -15
  153. package/core/utils/Arrays.js +12 -9
  154. package/core/utils/DataBindObserver.d.ts +18 -11
  155. package/core/utils/DataBindObserver.js +47 -54
  156. package/core/utils/Electron.d.ts +5 -1
  157. package/core/utils/Electron.js +4 -2
  158. package/core/utils/HTML.d.ts +9 -2
  159. package/core/utils/HTML.js +24 -5
  160. package/core/utils/LocationHandler.d.ts +6 -5
  161. package/core/utils/LocationHandler.js +27 -16
  162. package/core/utils/Objects.d.ts +7 -4
  163. package/core/utils/Objects.js +37 -9
  164. package/core/utils/{PublisherProxy.d.mts → PublisherProxy.d.ts} +49 -34
  165. package/core/utils/{PublisherProxy.mjs → PublisherProxy.js} +107 -77
  166. package/core/utils/Utils.d.ts +3 -0
  167. package/core/utils/Utils.js +18 -0
  168. package/core/utils/api.d.ts +26 -9
  169. package/core/utils/api.js +62 -45
  170. package/img/concorde-logo.svg +1 -0
  171. package/img/concorde.png +0 -0
  172. package/img/concorde_def.png +0 -0
  173. package/mixins.d.ts +53 -29
  174. package/mixins.js +3 -4
  175. package/package.json +51 -12
  176. package/svg/regular/plane.svg +1 -0
  177. package/svg/solid/plane.svg +1 -0
  178. package/test-utils/TestUtils.d.ts +4 -0
  179. package/test-utils/TestUtils.js +12 -0
  180. package/utils.d.ts +3 -1
  181. package/utils.js +7 -5
  182. package/core/components/functional/configuration/configuration.d.ts +0 -5
  183. package/core/components/functional/configuration/configuration.js +0 -22
  184. package/core/components/ui/tabs/tab.d.ts +0 -6
  185. package/core/components/ui/tabs/tab.js +0 -46
  186. package/core/components/ui/tabs/tabs.d.ts +0 -15
  187. package/core/components/ui/tabs/tabs.js +0 -129
  188. package/core/components/ui/taxonomy/taxonomy.d.ts +0 -41
  189. package/core/components/ui/taxonomy/taxonomy.js +0 -115
@@ -13,17 +13,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  step((generator = generator.apply(thisArg, _arguments || [])).next());
14
14
  });
15
15
  };
16
- import { LitElement, css, nothing } from "lit";
17
- import { customElement, property } from "lit/decorators.js";
18
16
  import Icons from "@supersoniks/concorde/core/components/ui/icon/icons";
17
+ import { css, LitElement, nothing } from "lit";
18
+ import { customElement, property } from "lit/decorators.js";
19
+ const tagName = "sonic-icon";
19
20
  /**
20
21
  * Afficher l'icone choisie parmis une liste prédéfinie dans icons.json
21
22
  * les tailles suivantes sont disponible via l'attribut *size* : 2xs,xs,sm,"",lg,xl,2xl
22
23
  */
23
- const tagName = "sonic-icon";
24
24
  let Icon = class Icon extends LitElement {
25
25
  constructor() {
26
26
  super(...arguments);
27
+ this.renderId = 0;
27
28
  this.iconText = "";
28
29
  /**
29
30
  * Nom identifiant l'icone ex : *info*
@@ -39,12 +40,17 @@ let Icon = class Icon extends LitElement {
39
40
  this._library = "";
40
41
  }
41
42
  updateIcon() {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- if (!this.name)
43
+ if (!this.name)
44
+ return;
45
+ this.renderId++;
46
+ const frameRenderId = this.renderId;
47
+ window.requestAnimationFrame(() => __awaiter(this, void 0, void 0, function* () {
48
+ if (frameRenderId != this.renderId) {
44
49
  return;
50
+ }
45
51
  this.iconText = yield Icons.default.get({ name: this.name, prefix: this.prefix, library: this.library });
46
52
  this.requestUpdate();
47
- });
53
+ }));
48
54
  }
49
55
  get name() {
50
56
  return this._name;
@@ -88,14 +94,14 @@ Icon.styles = css `
88
94
  width: var(--sc-icon-size, 1em);
89
95
  }
90
96
 
91
- svg:not([fill="none"]){
97
+ svg:not([fill="none"]) {
92
98
  fill: currentColor;
93
99
  }
94
100
 
95
- svg[fill="none"]{
101
+ svg[fill="none"] {
96
102
  stroke-width: 2;
97
103
  }
98
-
104
+
99
105
  :host([size="2xs"]) svg {
100
106
  --sc-icon-size: 0.625em;
101
107
  }
@@ -122,7 +128,7 @@ Icon.styles = css `
122
128
 
123
129
  :host([size="3xl"]) svg {
124
130
  --sc-icon-size: 2.8em;
125
-
131
+ }
126
132
  `;
127
133
  __decorate([
128
134
  property({ type: String })
@@ -137,8 +143,3 @@ Icon = __decorate([
137
143
  customElement(tagName)
138
144
  ], Icon);
139
145
  export { Icon };
140
- //Ajout pour la creation du cem notamment pour Storybook
141
- try {
142
- customElements.define(tagName, Icon);
143
- }
144
- catch (e) { }
@@ -8,8 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  var _a;
11
- import { unsafeHTML } from "lit/directives/unsafe-html.js";
11
+ // ici on désactive un regle de eslint exceptionnelement pour ce fichier
12
+ /* eslint no-async-promise-executor: 0 */ // --> OFF
12
13
  import icons from "@supersoniks/concorde/core/components/ui/icon/icons.json";
14
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
13
15
  /**
14
16
  * Ce tableau static permet de ne pas appeler plusieurs fois le même service lors d'appel concurrents en GET.
15
17
  */
@@ -31,6 +33,9 @@ const libraries = {
31
33
  feathers: {
32
34
  url: "https://cdn.jsdelivr.net/npm/feather-icons@4.29.0/dist/icons/$name.svg",
33
35
  },
36
+ lucide: {
37
+ url: "https://cdn.jsdelivr.net/npm/lucide-static@0.16.29/icons/$name.svg",
38
+ },
34
39
  material: {
35
40
  url: "https://cdn.jsdelivr.net/npm/@material-icons/svg@1.0.5/svg/$name/$prefix.svg",
36
41
  defaultPrefix: "regular",
@@ -39,6 +44,7 @@ const libraries = {
39
44
  url: "https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.1/svgs/$prefix/$name.svg",
40
45
  defaultPrefix: "regular",
41
46
  },
47
+ custom: { url: "", defaultPrefix: "" },
42
48
  };
43
49
  let hasEnabledCustomLibrary = false;
44
50
  function enableCustomLibrary() {
@@ -46,17 +52,17 @@ function enableCustomLibrary() {
46
52
  if (hasEnabledCustomLibrary)
47
53
  return;
48
54
  hasEnabledCustomLibrary = true;
49
- libraries.custom = {};
50
- libraries.custom.url = (_b = document.querySelector("[customIconLibraryPath]")) === null || _b === void 0 ? void 0 : _b.getAttribute("customIconLibraryPath");
51
- libraries.custom.defaultPrefix = (_c = document.querySelector("[customIconDefaultPrefix]")) === null || _c === void 0 ? void 0 : _c.getAttribute("customIconDefaultPrefix");
55
+ libraries.custom.url = ((_b = document.querySelector("[customIconLibraryPath]")) === null || _b === void 0 ? void 0 : _b.getAttribute("customIconLibraryPath")) || "";
56
+ libraries.custom.defaultPrefix =
57
+ ((_c = document.querySelector("[customIconDefaultPrefix]")) === null || _c === void 0 ? void 0 : _c.getAttribute("customIconDefaultPrefix")) || "";
52
58
  }
53
59
  export default class Icons {
54
60
  static registerIcons(newIcons) {
55
61
  const record = icons;
56
- for (let prefix in newIcons) {
62
+ for (const prefix in newIcons) {
57
63
  const newObj = newIcons[prefix];
58
64
  const currentRecord = record[prefix] || {};
59
- for (let name in newObj) {
65
+ for (const name in newObj) {
60
66
  currentRecord[name] = newObj[name];
61
67
  }
62
68
  record[prefix] = currentRecord;
@@ -66,8 +72,8 @@ export default class Icons {
66
72
  _a = Icons;
67
73
  Icons.fontAwesomeNext = {
68
74
  get: (params) => __awaiter(void 0, void 0, void 0, function* () {
69
- let library = params.library;
70
- let name = params.name || "";
75
+ const library = params.library;
76
+ const name = params.name || "";
71
77
  const iconsAsRecord = icons;
72
78
  /**
73
79
  * SVGS en ligne
@@ -76,31 +82,30 @@ Icons.fontAwesomeNext = {
76
82
  enableCustomLibrary();
77
83
  }
78
84
  if (library && libraries[library]) {
79
- let libraryItem = libraries[library];
80
- let prefix = params.prefix || libraryItem.defaultPrefix;
81
- let libIcons = iconsAsRecord[library] || {};
82
- let libIconsKey = prefix + "-" + name;
85
+ const libraryItem = libraries[library];
86
+ const prefix = params.prefix || libraryItem.defaultPrefix || "";
87
+ const libIcons = iconsAsRecord[library] || {};
88
+ iconsAsRecord[library] = libIcons;
89
+ const libIconsKey = prefix + "-" + name;
83
90
  // if(!libIcons )libIcons = iconsAsRecord[library] = {};
84
91
  /**
85
92
  * Si l'icone a déjà été chargée on ne la recharge pas
86
93
  */
87
94
  if (libIcons[libIconsKey])
88
95
  return unsafeHTML(libIcons[libIconsKey]);
89
- let url = libraryItem.url.replace("$prefix", prefix).replace("$name", name);
96
+ const url = libraryItem.url.replace("$prefix", prefix).replace("$name", name);
90
97
  /**
91
98
  * on utilise une promise mutualisée pour ne pas faire plusieurs appels concurents d'une même icone
92
99
  */
93
- if (libIcons[libIconsKey])
94
- return unsafeHTML(libIcons[libIconsKey]);
95
100
  if (!loadingGetPromises.has(url)) {
96
- let promise = new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
97
- let result = yield fetch(url);
101
+ const promise = new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
102
+ const result = yield fetch(url);
98
103
  if (!result.ok) {
99
104
  resolve(`<b title="Erreur ${result.status}">😶</b>`);
100
105
  return;
101
106
  }
102
107
  try {
103
- let text = yield result.text();
108
+ const text = yield result.text();
104
109
  resolve(text);
105
110
  }
106
111
  catch (e) {
@@ -112,9 +117,9 @@ Icons.fontAwesomeNext = {
112
117
  /**
113
118
  * Chargement de l'icone.
114
119
  */
115
- let result = yield loadingGetPromises.get(url);
120
+ const result = yield loadingGetPromises.get(url);
116
121
  loadingGetPromises.delete(url);
117
- libIcons[libIconsKey] = result;
122
+ libIcons[libIconsKey] = result || "";
118
123
  return unsafeHTML(result);
119
124
  }
120
125
  /**
@@ -1 +1 @@
1
- { "core": { "cancel": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6.75827 17.2426L12.0009 12M17.2435 6.75736L12.0009 12M12.0009 12L6.75827 6.75736M12.0009 12L17.2435 17.2426\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "check-circled-outline": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M7 12.5L10 15.5L17 8.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "check": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5 13L9 17L19 7\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "emoji-puzzled": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg width=\"24px\" height=\"24px\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" color=\"#000000\"><path d=\"M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path><path d=\"M11.5 15.5s1.5-2 4.5-2 4.5 2 4.5 2M3 4c0-2.754 4-2.754 4 0 0 1.967-2 1.64-2 4M5 11.01l.01-.011\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path><path d=\"M17.5 9a.5.5 0 110-1 .5.5 0 010 1zM10.5 9a.5.5 0 110-1 .5.5 0 010 1z\" fill=\"#000\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></svg>", "info-empty": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 11.5V16.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7.51L12.01 7.49889\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "loader": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-loader\"><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"6\"></line><line x1=\"12\" y1=\"18\" x2=\"12\" y2=\"22\"></line><line x1=\"4.93\" y1=\"4.93\" x2=\"7.76\" y2=\"7.76\"></line><line x1=\"16.24\" y1=\"16.24\" x2=\"19.07\" y2=\"19.07\"></line><line x1=\"2\" y1=\"12\" x2=\"6\" y2=\"12\"></line><line x1=\"18\" y1=\"12\" x2=\"22\" y2=\"12\"></line><line x1=\"4.93\" y1=\"19.07\" x2=\"7.76\" y2=\"16.24\"></line><line x1=\"16.24\" y1=\"7.76\" x2=\"19.07\" y2=\"4.93\"></line></svg>", "more-horiz": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M18 12.5C18.2761 12.5 18.5 12.2761 18.5 12C18.5 11.7239 18.2761 11.5 18 11.5C17.7239 11.5 17.5 11.7239 17.5 12C17.5 12.2761 17.7239 12.5 18 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 12.5C12.2761 12.5 12.5 12.2761 12.5 12C12.5 11.7239 12.2761 11.5 12 11.5C11.7239 11.5 11.5 11.7239 11.5 12C11.5 12.2761 11.7239 12.5 12 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M6 12.5C6.27614 12.5 6.5 12.2761 6.5 12C6.5 11.7239 6.27614 11.5 6 11.5C5.72386 11.5 5.5 11.7239 5.5 12C5.5 12.2761 5.72386 12.5 6 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "more-vert": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 12.5C12.2761 12.5 12.5 12.2761 12.5 12C12.5 11.7239 12.2761 11.5 12 11.5C11.7239 11.5 11.5 11.7239 11.5 12C11.5 12.2761 11.7239 12.5 12 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 18.5C12.2761 18.5 12.5 18.2761 12.5 18C12.5 17.7239 12.2761 17.5 12 17.5C11.7239 17.5 11.5 17.7239 11.5 18C11.5 18.2761 11.7239 18.5 12 18.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 6.5C12.2761 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.2761 5.5 12 5.5C11.7239 5.5 11.5 5.72386 11.5 6C11.5 6.27614 11.7239 6.5 12 6.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "nav-arrow-down": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6 9L12 15L18 9\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "warning-circled-outline": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 7L12 13\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 17.01L12.01 16.9989\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n" } }
1
+ { "core": { "cancel": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6.75827 17.2426L12.0009 12M17.2435 6.75736L12.0009 12M12.0009 12L6.75827 6.75736M12.0009 12L17.2435 17.2426\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "check-circled-outline": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M7 12.5L10 15.5L17 8.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "check": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5 13L9 17L19 7\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "emoji-puzzled": "<svg width=\"24px\" height=\"24px\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" ><path d=\"M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path><path d=\"M11.5 15.5s1.5-2 4.5-2 4.5 2 4.5 2M3 4c0-2.754 4-2.754 4 0 0 1.967-2 1.64-2 4M5 11.01l.01-.011\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path><path d=\"M17.5 9a.5.5 0 110-1 .5.5 0 010 1zM10.5 9a.5.5 0 110-1 .5.5 0 010 1z\" fill=\"#000\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></svg>", "info-empty": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 11.5V16.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7.51L12.01 7.49889\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "loader": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-loader\"><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"6\"></line><line x1=\"12\" y1=\"18\" x2=\"12\" y2=\"22\"></line><line x1=\"4.93\" y1=\"4.93\" x2=\"7.76\" y2=\"7.76\"></line><line x1=\"16.24\" y1=\"16.24\" x2=\"19.07\" y2=\"19.07\"></line><line x1=\"2\" y1=\"12\" x2=\"6\" y2=\"12\"></line><line x1=\"18\" y1=\"12\" x2=\"22\" y2=\"12\"></line><line x1=\"4.93\" y1=\"19.07\" x2=\"7.76\" y2=\"16.24\"></line><line x1=\"16.24\" y1=\"7.76\" x2=\"19.07\" y2=\"4.93\"></line></svg>", "minus-small": "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"w-6 h-6\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M18 12H6\" />\n</svg>\n", "more-horiz": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M18 12.5C18.2761 12.5 18.5 12.2761 18.5 12C18.5 11.7239 18.2761 11.5 18 11.5C17.7239 11.5 17.5 11.7239 17.5 12C17.5 12.2761 17.7239 12.5 18 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 12.5C12.2761 12.5 12.5 12.2761 12.5 12C12.5 11.7239 12.2761 11.5 12 11.5C11.7239 11.5 11.5 11.7239 11.5 12C11.5 12.2761 11.7239 12.5 12 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M6 12.5C6.27614 12.5 6.5 12.2761 6.5 12C6.5 11.7239 6.27614 11.5 6 11.5C5.72386 11.5 5.5 11.7239 5.5 12C5.5 12.2761 5.72386 12.5 6 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "more-vert": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 12.5C12.2761 12.5 12.5 12.2761 12.5 12C12.5 11.7239 12.2761 11.5 12 11.5C11.7239 11.5 11.5 11.7239 11.5 12C11.5 12.2761 11.7239 12.5 12 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 18.5C12.2761 18.5 12.5 18.2761 12.5 18C12.5 17.7239 12.2761 17.5 12 17.5C11.7239 17.5 11.5 17.7239 11.5 18C11.5 18.2761 11.7239 18.5 12 18.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 6.5C12.2761 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.2761 5.5 12 5.5C11.7239 5.5 11.5 5.72386 11.5 6C11.5 6.27614 11.7239 6.5 12 6.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "nav-arrow-down": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6 9L12 15L18 9\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n", "warning-circled-outline": "<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 7L12 13\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 17.01L12.01 16.9989\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n" } }
@@ -123,8 +123,3 @@ Image = __decorate([
123
123
  customElement(tagName)
124
124
  ], Image);
125
125
  export { Image };
126
- //Ajout pour la creation du cem notamment pour Storybook
127
- try {
128
- customElements.define(tagName, Image);
129
- }
130
- catch (e) { }
@@ -10,7 +10,7 @@ export declare class Link extends LitElement {
10
10
  * - strict : l'url courante match exactement avec le href du bouton
11
11
  * - partial : l'url courante match à gauche avec le href du bouton
12
12
  * - disabled : aucune activation / désactivation
13
- */
13
+ */
14
14
  autoActive: "strict" | "partial" | "disabled";
15
15
  connectedCallback(): void;
16
16
  disconnectedCallback(): void;
@@ -20,7 +20,7 @@ let Link = class Link extends LitElement {
20
20
  * - strict : l'url courante match exactement avec le href du bouton
21
21
  * - partial : l'url courante match à gauche avec le href du bouton
22
22
  * - disabled : aucune activation / désactivation
23
- */
23
+ */
24
24
  this.autoActive = "partial";
25
25
  this._target = null;
26
26
  /**
@@ -73,7 +73,7 @@ Link.styles = [
73
73
  a {
74
74
  color: inherit;
75
75
  text-decoration: none;
76
- display:contents;
76
+ display: contents;
77
77
  }
78
78
  `,
79
79
  ];
@@ -93,7 +93,3 @@ Link = __decorate([
93
93
  customElement(tagName)
94
94
  ], Link);
95
95
  export { Link };
96
- try {
97
- customElements.define(tagName, Link);
98
- }
99
- catch (e) { }
@@ -1,5 +1,5 @@
1
1
  import { LitElement } from "lit";
2
- declare type LoaderConf = {
2
+ type LoaderConf = {
3
3
  mode?: string;
4
4
  container?: HTMLElement;
5
5
  };
@@ -23,12 +23,11 @@ let Loader = Loader_1 = class Loader extends LitElement {
23
23
  static show(conf) {
24
24
  if (!Loader_1.loader)
25
25
  Loader_1.loader = document.createElement("sonic-loader");
26
- let loader = Loader_1.loader;
26
+ const loader = Loader_1.loader;
27
27
  if (!conf)
28
28
  conf = {};
29
- let v = conf;
30
- for (let z in v)
31
- loader.setAttribute(z, v[z]);
29
+ if (conf.mode)
30
+ loader.setAttribute("mode", conf.mode);
32
31
  if (!conf.container) {
33
32
  conf.container = document.querySelector("sonic-theme") || document.body;
34
33
  conf.mode = "fixed";
@@ -88,8 +87,3 @@ Loader = Loader_1 = __decorate([
88
87
  customElement(tagName)
89
88
  ], Loader);
90
89
  export { Loader };
91
- //Ajout pour la creation du cem notamment pour Storybook
92
- try {
93
- customElements.define(tagName, Loader);
94
- }
95
- catch (e) { }
@@ -12,16 +12,16 @@ let MenuItem = class MenuItem extends Button {
12
12
  super();
13
13
  }
14
14
  connectedCallback() {
15
- if (!this.hasAttribute('variant')) {
15
+ if (!this.hasAttribute("variant")) {
16
16
  this.variant = "ghost";
17
17
  }
18
- if (!this.hasAttribute('type')) {
18
+ if (!this.hasAttribute("type")) {
19
19
  this.type = "primary";
20
20
  }
21
- if (!this.hasAttribute('shape')) {
21
+ if (!this.hasAttribute("shape")) {
22
22
  this.shape = "block";
23
23
  }
24
- if (!this.hasAttribute('align')) {
24
+ if (!this.hasAttribute("align")) {
25
25
  this.align = "left";
26
26
  }
27
27
  super.connectedCallback();
@@ -31,8 +31,3 @@ MenuItem = __decorate([
31
31
  customElement(tagName)
32
32
  ], MenuItem);
33
33
  export { MenuItem };
34
- //Ajout pour Storybook
35
- try {
36
- customElements.define(tagName, MenuItem);
37
- }
38
- catch (e) { }
@@ -16,18 +16,26 @@ export declare class MenuItems extends LitElement {
16
16
  /**
17
17
  * Ombre
18
18
  */
19
- shadow: "" | "sm" | "md" | 'lg' | "xl" | "none" | null;
19
+ shadow: "" | "sm" | "md" | "lg" | "xl" | "none" | null;
20
20
  moreShape: "square" | "circle";
21
+ scrollable: boolean;
22
+ observer: ResizeObserver | null;
21
23
  /**
22
24
  * Propriété min-width du bouton
23
25
  */
24
26
  minWidth: string;
27
+ menu: HTMLElement;
25
28
  menuChildren: Array<HTMLElement>;
26
29
  moreElements: Array<HTMLElement>;
27
30
  hasMoreElements: boolean;
28
31
  checkIfMore(): void;
29
32
  updated(_changedProperties: PropertyValues): void;
30
33
  mainSlotChange(): void;
34
+ connectedCallback(): void;
35
+ disconnectedCallback(): void;
36
+ updateIsScollable: () => void;
37
+ initScrollable(): void;
38
+ setScrollShadow(target: HTMLElement, direction: string): void;
31
39
  setChildrenSize(menuItems: Array<HTMLElement>): void;
32
40
  render(): import("lit-html").TemplateResult<1>;
33
41
  }
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html, LitElement, css } from "lit";
8
8
  import { styleMap } from "lit/directives/style-map.js";
9
- import { customElement, property, queryAssignedElements, state } from "lit/decorators.js";
9
+ import { customElement, property, queryAssignedElements, state, query } from "lit/decorators.js";
10
10
  import "@supersoniks/concorde/core/components/ui/menu/menu-item";
11
11
  const tagName = "sonic-menu";
12
12
  let MenuItems = class MenuItems extends LitElement {
@@ -28,18 +28,26 @@ let MenuItems = class MenuItems extends LitElement {
28
28
  */
29
29
  this.shadow = null;
30
30
  this.moreShape = "circle";
31
+ this.scrollable = false;
32
+ this.observer = null;
31
33
  /**
32
34
  * Propriété min-width du bouton
33
35
  */
34
36
  this.minWidth = "0";
35
37
  this.hasMoreElements = false;
38
+ this.updateIsScollable = () => {
39
+ if (this.scrollable) {
40
+ this.initScrollable();
41
+ this.setScrollShadow(this, this.direction);
42
+ }
43
+ };
36
44
  }
37
45
  checkIfMore() {
38
46
  var _a;
39
47
  this.hasMoreElements = !!((_a = this.moreElements) === null || _a === void 0 ? void 0 : _a.length);
40
48
  }
41
49
  updated(_changedProperties) {
42
- const moreBtn = this.querySelector('.more-btn');
50
+ const moreBtn = this.querySelector(".more-btn");
43
51
  if (this.size && moreBtn) {
44
52
  moreBtn.setAttribute("size", this.size);
45
53
  }
@@ -53,6 +61,84 @@ let MenuItems = class MenuItems extends LitElement {
53
61
  }
54
62
  mainSlotChange() {
55
63
  this.setChildrenSize(this.menuChildren);
64
+ this.updateIsScollable();
65
+ }
66
+ connectedCallback() {
67
+ this.observer = new ResizeObserver(this.updateIsScollable);
68
+ // observe if menu elements are overflowing and initiate scrollable
69
+ this.observer.observe(this);
70
+ super.connectedCallback();
71
+ }
72
+ disconnectedCallback() {
73
+ var _a;
74
+ (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
75
+ super.disconnectedCallback();
76
+ }
77
+ initScrollable() {
78
+ let isDown = false;
79
+ let startX;
80
+ let scrollLeft;
81
+ if (this.scrollable) {
82
+ this.addEventListener("mousedown", (e) => {
83
+ isDown = true;
84
+ this.classList.add("active");
85
+ startX = e.pageX - this.offsetLeft;
86
+ scrollLeft = this.scrollLeft;
87
+ });
88
+ this.addEventListener("mouseleave", () => {
89
+ isDown = false;
90
+ this.classList.remove("active");
91
+ });
92
+ this.addEventListener("mouseup", () => {
93
+ isDown = false;
94
+ this.classList.remove("active");
95
+ });
96
+ this.addEventListener("mousemove", (e) => {
97
+ if (!isDown)
98
+ return;
99
+ e.preventDefault();
100
+ const x = e.pageX - this.offsetLeft;
101
+ const walk = (x - startX) * 1.5; //scroll-fast
102
+ this.scrollLeft = scrollLeft - walk;
103
+ this.setScrollShadow(this, this.direction);
104
+ });
105
+ this.addEventListener("scroll", (e) => {
106
+ e.preventDefault();
107
+ // const delta = Math.sign(e.deltaY);
108
+ // this.scrollLeft += delta * 50;
109
+ this.setScrollShadow(this, this.direction);
110
+ });
111
+ }
112
+ }
113
+ setScrollShadow(target, direction) {
114
+ if (direction == "row") {
115
+ if (target.scrollLeft > 0) {
116
+ this.classList.add("shadow-left");
117
+ }
118
+ else {
119
+ this.classList.remove("shadow-left");
120
+ }
121
+ if (target.scrollLeft < target.scrollWidth - target.offsetWidth) {
122
+ this.classList.add("shadow-right");
123
+ }
124
+ else {
125
+ this.classList.remove("shadow-right");
126
+ }
127
+ }
128
+ else if (direction == "column") {
129
+ if (target.scrollTop > 0) {
130
+ this.classList.add("shadow-top");
131
+ }
132
+ else {
133
+ this.classList.remove("shadow-top");
134
+ }
135
+ if (target.scrollTop < target.scrollHeight - (target.offsetHeight + 1)) {
136
+ this.classList.add("shadow-bottom");
137
+ }
138
+ else {
139
+ this.classList.remove("shadow-bottom");
140
+ }
141
+ }
56
142
  }
57
143
  setChildrenSize(menuItems) {
58
144
  menuItems.forEach((elt) => {
@@ -63,7 +149,7 @@ let MenuItems = class MenuItems extends LitElement {
63
149
  elt.setAttribute("align", this.align);
64
150
  }
65
151
  if (this.direction == "row") {
66
- if (elt.getAttribute('shape') == "block") {
152
+ if (elt.getAttribute("shape") == "block") {
67
153
  elt.setAttribute("shape", "default");
68
154
  }
69
155
  }
@@ -73,34 +159,34 @@ let MenuItems = class MenuItems extends LitElement {
73
159
  const menuStyles = {
74
160
  minWidth: this.minWidth,
75
161
  flexDirection: this.direction,
76
- gap: this.gap
162
+ gap: this.gap,
77
163
  };
78
164
  const isMenuRow = this.direction == "row";
79
165
  const popStyles = {
80
- display: 'block',
81
- alignSelf: isMenuRow ? 'center' : 'flex-start',
82
- justifySelf: 'center',
83
- flexDirection: this.direction
166
+ display: "block",
167
+ alignSelf: isMenuRow ? "center" : "flex-start",
168
+ justifySelf: "center",
169
+ flexDirection: this.direction,
84
170
  };
85
171
  const popBtnStyles = {
86
- marginLeft: isMenuRow ? '' : '.55em'
172
+ marginLeft: isMenuRow ? "" : ".55em",
87
173
  };
88
174
  return html `<menu part="menu" class="shadowable" style=${styleMap(menuStyles)}>
89
- <slot @slotchange=${this.mainSlotChange}></slot>
90
- <sonic-pop style=${styleMap(popStyles)} class=${!this.hasMoreElements ? 'hidden' : ''}>
91
- <sonic-menu-item style=${styleMap(popBtnStyles)} class="more-btn" shape=${this.moreShape} align="center" >
92
- <sonic-icon size="xl" name=${isMenuRow ? "more-vert" : "more-horiz"} ></sonic-icon>
93
- </sonic-menu-item>
94
- <slot name="more" @slotchange=${this.checkIfMore} slot="content"></slot>
95
- </sonic-pop>
96
- </menu>`;
175
+ <slot @slotchange=${this.mainSlotChange}></slot>
176
+ <sonic-pop style=${styleMap(popStyles)} class=${!this.hasMoreElements ? "hidden" : ""}>
177
+ <sonic-menu-item style=${styleMap(popBtnStyles)} class="more-btn" shape=${this.moreShape} align="center">
178
+ <sonic-icon size="xl" name=${isMenuRow ? "more-vert" : "more-horiz"}></sonic-icon>
179
+ </sonic-menu-item>
180
+ <slot name="more" @slotchange=${this.checkIfMore} slot="content"></slot>
181
+ </sonic-pop>
182
+ </menu>`;
97
183
  }
98
184
  };
99
185
  MenuItems.styles = [
100
186
  css `
101
187
  :host {
102
188
  display: block;
103
- --sc-menu-gap:.15rem;
189
+ --sc-menu-gap: 0.15rem;
104
190
  }
105
191
 
106
192
  :host > menu {
@@ -109,9 +195,9 @@ MenuItems.styles = [
109
195
  margin: 0;
110
196
  padding: 0.35em;
111
197
  }
112
-
198
+
113
199
  .hidden {
114
- display:none !important;
200
+ display: none !important;
115
201
  }
116
202
 
117
203
  /*OMBRE*/
@@ -128,11 +214,79 @@ MenuItems.styles = [
128
214
  :host([shadow="lg"]) .shadowable {
129
215
  box-shadow: var(--sc-shadow-lg);
130
216
  }
131
-
217
+
132
218
  :host([shadow="none"]) .shadowable {
133
219
  box-shadow: none;
134
220
  }
135
-
221
+
222
+ /* SCROLLABLE*/
223
+ :host([scrollable]) {
224
+ scrollbar-width: none;
225
+ -ms-overflow-style: none;
226
+ }
227
+ :host([scrollable]) menu > * {
228
+ scroll-snap-align: start;
229
+ white-space: nowrap;
230
+ }
231
+ :host([scrollable][direction="row"]) {
232
+ overflow-x: scroll;
233
+ scroll-snap-type: x mandatory;
234
+ }
235
+ :host([scrollable][direction="column"]) {
236
+ overflow-y: scroll;
237
+ scroll-snap-type: y mandatory;
238
+ }
239
+ :host([scrollable])::-webkit-scrollbar {
240
+ display: none !important;
241
+ }
242
+ :host([scrollable][direction="row"].shadow-right) {
243
+ -webkit-mask-image: linear-gradient(to left, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 10%);
244
+ mask-image: linear-gradient(to left, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 10%);
245
+ }
246
+ :host([scrollable][direction="row"].shadow-left) {
247
+ -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 10%);
248
+ mask-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 10%);
249
+ }
250
+ :host([scrollable][direction="row"].shadow-left.shadow-right) {
251
+ -webkit-mask-image: linear-gradient(
252
+ to right,
253
+ rgba(0, 0, 0, 0) 0%,
254
+ rgba(0, 0, 0, 1) 10%,
255
+ rgba(0, 0, 0, 1) 90%,
256
+ rgba(0, 0, 0, 0) 100%
257
+ );
258
+ mask-image: linear-gradient(
259
+ to right,
260
+ rgba(0, 0, 0, 0) 0%,
261
+ rgba(0, 0, 0, 1) 10%,
262
+ rgba(0, 0, 0, 1) 90%,
263
+ rgba(0, 0, 0, 0) 100%
264
+ );
265
+ }
266
+ :host([scrollable][direction="column"].shadow-top) {
267
+ -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 10%);
268
+ mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 10%);
269
+ }
270
+ :host([scrollable][direction="column"].shadow-bottom) {
271
+ -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 10%);
272
+ mask-image: linear-gradient(to top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 10%);
273
+ }
274
+ :host([scrollable][direction="column"].shadow-top.shadow-bottom) {
275
+ -webkit-mask-image: linear-gradient(
276
+ to top,
277
+ rgba(0, 0, 0, 0) 0%,
278
+ rgba(0, 0, 0, 1) 10%,
279
+ rgba(0, 0, 0, 1) 90%,
280
+ rgba(0, 0, 0, 0) 100%
281
+ );
282
+ mask-image: linear-gradient(
283
+ to bottom,
284
+ rgba(0, 0, 0, 0) 0%,
285
+ rgba(0, 0, 0, 1) 10%,
286
+ rgba(0, 0, 0, 1) 90%,
287
+ rgba(0, 0, 0, 0) 100%
288
+ );
289
+ }
136
290
  `,
137
291
  ];
138
292
  __decorate([
@@ -153,9 +307,15 @@ __decorate([
153
307
  __decorate([
154
308
  property({ type: String })
155
309
  ], MenuItems.prototype, "moreShape", void 0);
310
+ __decorate([
311
+ property({ type: Boolean })
312
+ ], MenuItems.prototype, "scrollable", void 0);
156
313
  __decorate([
157
314
  property({ type: String })
158
315
  ], MenuItems.prototype, "minWidth", void 0);
316
+ __decorate([
317
+ query("menu")
318
+ ], MenuItems.prototype, "menu", void 0);
159
319
  __decorate([
160
320
  queryAssignedElements({ selector: "sonic-menu-item" })
161
321
  ], MenuItems.prototype, "menuChildren", void 0);
@@ -169,8 +329,3 @@ MenuItems = __decorate([
169
329
  customElement(tagName)
170
330
  ], MenuItems);
171
331
  export { MenuItems };
172
- //Ajout pour la creation du cem notamment pour Storybook
173
- try {
174
- customElements.define(tagName, MenuItems);
175
- }
176
- catch (e) { }