@supersoniks/concorde 3.1.76 → 3.1.78

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 (216) hide show
  1. package/build-infos.json +1 -1
  2. package/concorde-core.bundle.js +2 -2
  3. package/concorde-core.es.js +2 -2
  4. package/dist/concorde-core.bundle.js +2 -2
  5. package/dist/concorde-core.es.js +2 -2
  6. package/docs/assets/index-D9bBwsCn.js +4537 -0
  7. package/docs/assets/index-DCRPZO3x.css +1 -0
  8. package/docs/css/docs.css +0 -0
  9. package/docs/fonts/ClashGrotesk-Bold.eot +0 -0
  10. package/docs/fonts/ClashGrotesk-Bold.ttf +0 -0
  11. package/docs/fonts/ClashGrotesk-Bold.woff +0 -0
  12. package/docs/fonts/ClashGrotesk-Bold.woff2 +0 -0
  13. package/docs/fonts/ClashGrotesk-Extralight.eot +0 -0
  14. package/docs/fonts/ClashGrotesk-Extralight.ttf +0 -0
  15. package/docs/fonts/ClashGrotesk-Extralight.woff +0 -0
  16. package/docs/fonts/ClashGrotesk-Extralight.woff2 +0 -0
  17. package/docs/fonts/ClashGrotesk-Light.eot +0 -0
  18. package/docs/fonts/ClashGrotesk-Light.ttf +0 -0
  19. package/docs/fonts/ClashGrotesk-Light.woff +0 -0
  20. package/docs/fonts/ClashGrotesk-Light.woff2 +0 -0
  21. package/docs/fonts/ClashGrotesk-Medium.eot +0 -0
  22. package/docs/fonts/ClashGrotesk-Medium.ttf +0 -0
  23. package/docs/fonts/ClashGrotesk-Medium.woff +0 -0
  24. package/docs/fonts/ClashGrotesk-Medium.woff2 +0 -0
  25. package/docs/fonts/ClashGrotesk-Regular.eot +0 -0
  26. package/docs/fonts/ClashGrotesk-Regular.ttf +0 -0
  27. package/docs/fonts/ClashGrotesk-Regular.woff +0 -0
  28. package/docs/fonts/ClashGrotesk-Regular.woff2 +0 -0
  29. package/docs/fonts/ClashGrotesk-Semibold.eot +0 -0
  30. package/docs/fonts/ClashGrotesk-Semibold.ttf +0 -0
  31. package/docs/fonts/ClashGrotesk-Semibold.woff +0 -0
  32. package/docs/fonts/ClashGrotesk-Semibold.woff2 +0 -0
  33. package/docs/fonts/ClashGrotesk-Variable.eot +0 -0
  34. package/docs/fonts/ClashGrotesk-Variable.ttf +0 -0
  35. package/docs/fonts/ClashGrotesk-Variable.woff +0 -0
  36. package/docs/fonts/ClashGrotesk-Variable.woff2 +0 -0
  37. package/docs/img/concorde-icon.svg +5 -0
  38. package/docs/img/concorde-logo.svg +1 -0
  39. package/docs/img/concorde.png +0 -0
  40. package/docs/img/concorde_def.png +0 -0
  41. package/docs/img/concorde_seuil.png.webp +0 -0
  42. package/docs/img/concorde_seuil_invert.png +0 -0
  43. package/docs/img/paul_metrand.jpg +0 -0
  44. package/docs/img/paul_metrand_xs.jpg +0 -0
  45. package/docs/index.html +93 -0
  46. package/docs/src/core/components/functional/date/date.md +290 -0
  47. package/docs/src/core/components/functional/fetch/fetch.md +117 -0
  48. package/docs/src/core/components/functional/if/if.md +16 -0
  49. package/docs/src/core/components/functional/list/list.md +199 -0
  50. package/docs/src/core/components/functional/mix/mix.md +41 -0
  51. package/docs/src/core/components/functional/queue/queue.md +87 -0
  52. package/docs/src/core/components/functional/router/router.md +108 -0
  53. package/docs/src/core/components/functional/sdui/default-library.json +108 -0
  54. package/docs/src/core/components/functional/sdui/example.json +99 -0
  55. package/docs/src/core/components/functional/sdui/sdui.md +356 -0
  56. package/docs/src/core/components/functional/states/states.md +87 -0
  57. package/docs/src/core/components/functional/submit/submit.md +83 -0
  58. package/docs/src/core/components/functional/subscriber/subscriber.md +91 -0
  59. package/docs/src/core/components/functional/value/value.md +35 -0
  60. package/docs/src/core/components/ui/alert/alert.md +121 -0
  61. package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -0
  62. package/docs/src/core/components/ui/badge/badge.md +127 -0
  63. package/docs/src/core/components/ui/button/button.md +182 -0
  64. package/docs/src/core/components/ui/captcha/captcha.md +12 -0
  65. package/docs/src/core/components/ui/card/card.md +97 -0
  66. package/docs/src/core/components/ui/divider/divider.md +35 -0
  67. package/docs/src/core/components/ui/form/checkbox/checkbox.md +94 -0
  68. package/docs/src/core/components/ui/form/fieldset/fieldset.md +129 -0
  69. package/docs/src/core/components/ui/form/form-actions/form-actions.md +77 -0
  70. package/docs/src/core/components/ui/form/form-layout/form-layout.md +44 -0
  71. package/docs/src/core/components/ui/form/input/input.md +167 -0
  72. package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +130 -0
  73. package/docs/src/core/components/ui/form/radio/radio.md +84 -0
  74. package/docs/src/core/components/ui/form/select/select.md +97 -0
  75. package/docs/src/core/components/ui/form/switch/switch.md +84 -0
  76. package/docs/src/core/components/ui/form/textarea/textarea.md +65 -0
  77. package/docs/src/core/components/ui/group/group.md +75 -0
  78. package/docs/src/core/components/ui/icon/icon.md +125 -0
  79. package/docs/src/core/components/ui/icon/icons.json +1 -0
  80. package/docs/src/core/components/ui/image/image.md +107 -0
  81. package/docs/src/core/components/ui/link/link.md +43 -0
  82. package/docs/src/core/components/ui/loader/loader.md +67 -0
  83. package/docs/src/core/components/ui/menu/menu.md +288 -0
  84. package/docs/src/core/components/ui/modal/modal.md +123 -0
  85. package/docs/src/core/components/ui/pop/pop.md +79 -0
  86. package/docs/src/core/components/ui/progress/progress.md +63 -0
  87. package/docs/src/core/components/ui/table/table.md +455 -0
  88. package/docs/src/core/components/ui/tooltip/tooltip.md +82 -0
  89. package/docs/src/docs/_core-concept/overview.md +57 -0
  90. package/docs/src/docs/_core-concept/subscriber.md +76 -0
  91. package/docs/src/docs/_getting-started/concorde-outside.md +143 -0
  92. package/docs/src/docs/_getting-started/create-a-component.md +137 -0
  93. package/docs/src/docs/_getting-started/my-first-subscriber.md +174 -0
  94. package/docs/src/docs/_getting-started/pubsub.md +150 -0
  95. package/docs/src/docs/_getting-started/start.md +39 -0
  96. package/docs/src/docs/_getting-started/theming.md +91 -0
  97. package/docs/src/docs/search/docs-search.json +3902 -0
  98. package/docs/src/tag-list.json +1 -0
  99. package/docs/src/tsconfig-model.json +23 -0
  100. package/docs/src/tsconfig.json +835 -0
  101. package/docs/svg/regular/plane.svg +1 -0
  102. package/docs/svg/solid/plane.svg +1 -0
  103. package/index.html +0 -0
  104. package/package.json +1 -1
  105. package/php/get-challenge.php +34 -0
  106. package/php/some-service.php +42 -0
  107. package/scripts/create-search.js +0 -0
  108. package/scripts/generate-routes.js +0 -0
  109. package/src/core/_types/types.ts +0 -0
  110. package/src/core/components/functional/date/date.ts +0 -0
  111. package/src/core/components/functional/functional.ts +0 -0
  112. package/src/core/components/functional/if/if.md +0 -0
  113. package/src/core/components/functional/if/if.test.ts +0 -0
  114. package/src/core/components/functional/list/list.demo.ts +0 -0
  115. package/src/core/components/functional/list/list.spec.ts +0 -0
  116. package/src/core/components/functional/queue/queue.demo.ts +0 -0
  117. package/src/core/components/functional/queue/queue.ts +1 -1
  118. package/src/core/components/functional/router/router.demo.ts +0 -0
  119. package/src/core/components/functional/router/router.md +0 -0
  120. package/src/core/components/functional/router/router.spec.ts +0 -0
  121. package/src/core/components/functional/router/router.ts +0 -0
  122. package/src/core/components/functional/sonic-scope/sonic-scope.ts +0 -0
  123. package/src/core/components/functional/states/states.demo.ts +0 -0
  124. package/src/core/components/functional/states/states.md +0 -0
  125. package/src/core/components/functional/states/states.spec.ts +0 -0
  126. package/src/core/components/functional/states/states.ts +0 -0
  127. package/src/core/components/functional/translation/translation.ts +0 -0
  128. package/src/core/components/ui/_css/scroll.ts +0 -0
  129. package/src/core/components/ui/_css/shadow.ts +0 -0
  130. package/src/core/components/ui/_css/size.ts +0 -0
  131. package/src/core/components/ui/_css/type.ts +0 -0
  132. package/src/core/components/ui/alert/alert.md +0 -0
  133. package/src/core/components/ui/alert/alert.ts +0 -0
  134. package/src/core/components/ui/alert-messages/alert-messages.md +0 -0
  135. package/src/core/components/ui/badge/badge.md +0 -0
  136. package/src/core/components/ui/badge/badge.ts +0 -0
  137. package/src/core/components/ui/button/button.md +0 -0
  138. package/src/core/components/ui/button/button.ts +0 -0
  139. package/src/core/components/ui/captcha/captcha.md +0 -0
  140. package/src/core/components/ui/card/card-footer.ts +0 -0
  141. package/src/core/components/ui/card/card-header-descripton.ts +0 -0
  142. package/src/core/components/ui/card/card-header.ts +0 -0
  143. package/src/core/components/ui/card/card-main.ts +0 -0
  144. package/src/core/components/ui/card/card.md +0 -0
  145. package/src/core/components/ui/card/card.ts +0 -0
  146. package/src/core/components/ui/divider/divider.ts +0 -0
  147. package/src/core/components/ui/form/css/form-control.ts +0 -0
  148. package/src/core/components/ui/form/fieldset/fieldset.ts +0 -0
  149. package/src/core/components/ui/form/fieldset/legend-description.ts +0 -0
  150. package/src/core/components/ui/form/fieldset/legend.ts +0 -0
  151. package/src/core/components/ui/form/form-layout/form-layout.md +0 -0
  152. package/src/core/components/ui/form/input/input.md +0 -0
  153. package/src/core/components/ui/form/input-autocomplete/input-autocomplete.ts +0 -0
  154. package/src/core/components/ui/form/radio/radio.md +0 -0
  155. package/src/core/components/ui/form/radio/radio.ts +0 -0
  156. package/src/core/components/ui/form/select/select.md +0 -0
  157. package/src/core/components/ui/form/switch/switch.md +0 -0
  158. package/src/core/components/ui/form/switch/switch.ts +0 -0
  159. package/src/core/components/ui/icon/icon.ts +0 -0
  160. package/src/core/components/ui/icon/icons.ts +1 -1
  161. package/src/core/components/ui/image/image.md +0 -0
  162. package/src/core/components/ui/image/image.ts +0 -0
  163. package/src/core/components/ui/loader/loader.md +0 -0
  164. package/src/core/components/ui/loader/loader.ts +0 -0
  165. package/src/core/components/ui/loader/styles/fixed.ts +0 -0
  166. package/src/core/components/ui/loader/styles/inline.ts +0 -0
  167. package/src/core/components/ui/menu/menu.ts +0 -0
  168. package/src/core/components/ui/modal/modal-actions.ts +0 -0
  169. package/src/core/components/ui/modal/modal-subtitle.ts +0 -0
  170. package/src/core/components/ui/modal/modal-title.ts +0 -0
  171. package/src/core/components/ui/modal/modal.md +0 -0
  172. package/src/core/components/ui/modal/modal.ts +0 -0
  173. package/src/core/components/ui/progress/progress.ts +0 -0
  174. package/src/core/components/ui/table/table-tbody.ts +0 -0
  175. package/src/core/components/ui/table/table-th.ts +0 -0
  176. package/src/core/components/ui/table/table.ts +0 -0
  177. package/src/core/components/ui/theme/theme-collection/core-variables.ts +0 -0
  178. package/src/core/components/ui/theme/theme-collection/dark.ts +0 -0
  179. package/src/core/components/ui/theme/theme-collection/light.ts +0 -0
  180. package/src/core/components/ui/theme/theme.ts +0 -0
  181. package/src/core/components/ui/toast/toast-item.ts +0 -0
  182. package/src/core/components/ui/toast/toast.ts +0 -0
  183. package/src/core/components/ui/tooltip/tooltip.ts +0 -0
  184. package/src/core/components/ui/ui.ts +0 -0
  185. package/src/core/directives/DataProvider.ts +0 -0
  186. package/src/core/directives/Wording.ts +0 -0
  187. package/src/core/mixins/Fetcher.ts +0 -0
  188. package/src/core/mixins/Subscriber.ts +0 -0
  189. package/src/core/mixins/TemplatesContainer.ts +0 -0
  190. package/src/core/utils/LocationHandler.ts +0 -0
  191. package/src/core/utils/Objects.ts +0 -0
  192. package/src/core/utils/Utils.ts +0 -0
  193. package/src/core/utils/aesCrypto.ts +0 -0
  194. package/src/core/utils/api.ts +0 -0
  195. package/src/core/utils/route.spec.ts +0 -0
  196. package/src/core/utils/route.ts +0 -0
  197. package/src/docs/code.ts +0 -0
  198. package/src/docs/docs.ts +0 -0
  199. package/src/docs/header/header.ts +0 -0
  200. package/src/docs/layout.ts +0 -0
  201. package/src/docs/navigation/navigation.ts +0 -0
  202. package/src/docs/search/docs-search.json +0 -0
  203. package/src/docs/search/markdown-renderer.ts +0 -0
  204. package/src/docs/search/page.ts +0 -0
  205. package/src/docs/search/search.ts +0 -0
  206. package/src/docs/tailwind/css/tailwind.css +0 -0
  207. package/src/docs/tailwind/css.d.ts +0 -0
  208. package/src/index.ts +0 -0
  209. package/src/test-utils/TestUtils.ts +0 -0
  210. package/src/tsconfig-model.json +0 -0
  211. package/src/tsconfig.json +0 -0
  212. package/src/tsconfig.tsbuildinfo +0 -0
  213. package/tailwind.config.js +0 -0
  214. package/templates-test.html +0 -0
  215. package/vite/config.js +0 -0
  216. package/vite.config.mts +0 -0
@@ -0,0 +1,117 @@
1
+ # Fetch
2
+ The **sonic-fetch** component is used to request and store data from an API.
3
+ Fetch extends the mixins Fetcher and [Subscriber](#docs/_core-concept/subscriber.md/subscriber)
4
+
5
+ ## Basic usage
6
+ In order to work properly the <b>sonic-fetch</b> component needs at least the following attributes.
7
+ - **serviceURL** : A base service url. This attribute can be inherited from an ancestor.
8
+ *ex : https://reqres.in*
9
+ - **endPoint** : the specific location where requests for information are sent (see the api docs).
10
+ *ex : api/users | api/users?page=2 | api/users/2*
11
+ - **dataProvider *(Required)*** : An ID that is used as a reference to the object storing the data returned by the API.
12
+ This attribute can be inherited from an ancestor.
13
+
14
+ <sonic-code>
15
+ <template>
16
+ <sonic-fetch serviceURL="https://reqres.in" endPoint="api/users?page=2" dataProvider="myDataObj"></sonic-fetch>
17
+ <sonic-button dataProvider="myDataObj" debug>Hover to see the data</sonic-button>
18
+ </template>
19
+ </sonic-code>
20
+
21
+ ## DataProvider as an endPoint
22
+ If no **endPoint** is specified it will be filled by the **dataProvider ID** instead
23
+
24
+ <sonic-code>
25
+ <template>
26
+ <sonic-fetch serviceURL="https://reqres.in" dataProvider="api/users?page=2" ></sonic-fetch>
27
+ <sonic-button dataProvider="api/users?page=2" debug>Hover to see the data</sonic-button>
28
+ </template>
29
+ </sonic-code>
30
+
31
+ ## HeadersDataProvider
32
+
33
+ <sonic-alert status="error" background>Deprecated</sonic-alert>
34
+
35
+ ## Key
36
+ When the **key** attribute is present, only a sub-part of the data received is injected into the **dataProvider**.
37
+ We can use the dot syntax to target what we want to keep.
38
+
39
+ For example if the data is `{my:{data:{a:1,b:2}}}` and the key is `key="my.data"`, the data available in the **dataProvider** will be `{a:1 , b:2}`
40
+
41
+ <sonic-code>
42
+ <template>
43
+ <sonic-fetch serviceURL="https://reqres.in" dataProvider="api/users/2" ></sonic-fetch>
44
+ <sonic-button dataProvider="api/users/2" debug>dataProvider object</sonic-button>
45
+ <!-- Get the user ID -->
46
+ <sonic-fetch serviceURL="https://reqres.in" dataProvider="id" endPoint="api/users/2" key="data.id"></sonic-fetch>
47
+ <sonic-button dataProvider="id" debug>data.id</sonic-button>
48
+ <!-- Get the user First name -->
49
+ <sonic-fetch serviceURL="https://reqres.in" dataProvider="first_name" endPoint="api/users/2" key="data.first_name"></sonic-fetch>
50
+ <sonic-button dataProvider="first_name" debug>data.first_name</sonic-button>
51
+ <!-- Get the user Last name -->
52
+ <sonic-fetch serviceURL="https://reqres.in" dataProvider="last_name" endPoint="api/users/2" key="data.last_name"></sonic-fetch>
53
+ <sonic-button dataProvider="last_name" debug>data.last_name</sonic-button>
54
+ <!-- Get the user email -->
55
+ <sonic-fetch serviceURL="https://reqres.in" dataProvider="email" endPoint="api/users/2" key="data.email"></sonic-fetch>
56
+ <sonic-button dataProvider="email" debug>data.email</sonic-button>
57
+ </template>
58
+ </sonic-code>
59
+
60
+ ## Text mode
61
+
62
+ if the mime type of the content returned by the service begins with **text/**, then the dataProvider has a key named "text" which contains the text returned by the service.
63
+
64
+ <sonic-code>
65
+ <template>
66
+ <sonic-fetch endPoint="README.md" dataProvider="fetchText"></sonic-fetch>
67
+ <sonic-button dataProvider="fetchText" debug>Hover to see the data</sonic-button>
68
+ </template>
69
+ </sonic-code>
70
+
71
+ ## NoLoader
72
+
73
+ The noLoader attribute disables display of the default loader
74
+
75
+ <sonic-code>
76
+ <template>
77
+ <sonic-fetch noLoader serviceURL="https://reqres.in" endPoint="api/users?page=2" dataProvider="myDataObj"></sonic-fetch>
78
+ <sonic-button dataProvider="myDataObj" debug>Basic fetch with noLoader attribute</sonic-button>
79
+ </template>
80
+ </sonic-code>
81
+
82
+
83
+
84
+
85
+ <!--
86
+ ## Summary
87
+ Extends mixins : Fetcher, [Subscriber](#core/components/functional/subscriber/subscriber.md/subscriber)
88
+
89
+ ### Configuration via les attributs
90
+
91
+ | nom | sur quelle balise | Description | Exemple de valeur | défaut / requis |
92
+ |-----|-----|---|---|---|
93
+ | serviceURL |Fetcher ou un de ses parents | URL de base des services. | http://la-billetterie.net/api/v2 | domain du site |
94
+ | endpoint |Fetcher | point d'accès d'un service | user/2 | valeur de l'attribut dataProvider |
95
+ | dataProvider |Fetcher ou un de ses parents | Identifiant d'un publisher qui stock les données, voir [subscriber](#core/components/functional/subscriber/subscriber.md/subscriber). | billetterie/user/2 | *REQUIS* |
96
+ | headersDataProvider |Fetcher ou un de ses parents | Identifiant d'un publisher qui stock les données destinées à être envoyées en entêtes de la requetes | MyCoockieHEaders | null |
97
+ | key |Fetcher | extrait une sous propriété de la donnée chargée avant de l'assignée à son publisher | ma.data | null |
98
+
99
+ *Si la données est `{ma:{data:{a:1,b:2}}}` et `key="ma.data"`, la données disponible dans le composant sera `{a:1, b:2}`*
100
+
101
+ ### Intégration auto de basic auth (pour tester une api qui nécessite une authentification)
102
+
103
+ Fetch utilise le service pour générer le token et l'ajoute au header de l'appel qui récupère les données.
104
+
105
+ | nom | sur quelle balise | Description | Exemple de valeur | défaut / requis |
106
+ |-----|-----|---|---|---|
107
+ | userName | Fetcher ou un de ses parents | Nom de l'utilisateur | DjuDju | null |
108
+ | password | Fetcher ou un de ses parents | mot de passe | pom_549 | null |
109
+ | tokenProvider | Fetcher ou un de ses parents | point d'accès du service fournissant le token | auth | null |
110
+ | token | Fetcher ou un de ses parents | A fournir à la place des autres attributs si on le possède | q<d34gb | null |
111
+
112
+ ### Autres choses utiles
113
+ L'attribut *noLoader* du composant permet de désactiver l'affichage du loader par défaut.
114
+ On peut appeler la methode invalidate() sur le publisher associé au composant pour declencher le rechargement des données.
115
+ endPoint est une propriété réctive, par conséquent, sa modification, manuelle via template ou data binbding provoque la mise à jour du contenu.
116
+ -->
117
+
@@ -0,0 +1,16 @@
1
+ # if
2
+
3
+ The **sonic-if** component shows its content based on the value of its reactive property names **condition**
4
+
5
+ <sonic-code>
6
+ <template>
7
+ <div dataProvider="visibilitySettings" formDataProvider="visibilitySettings">
8
+ <sonic-checkbox label="Show evacuation plan" name="togglePlan" unique checked value="true"></sonic-checkbox>
9
+ <sonic-if data-bind ::condition="$togglePlan" class="mt-4 block">
10
+ <sonic-image src="https://www.thebaron.info/assets/mail/concorde-evacuation.jpg" rounded="md" ratio="654/463"></sonic-image>
11
+ </sonic-if>
12
+ </div>
13
+ </template>
14
+ </sonic-code>
15
+
16
+
@@ -0,0 +1,199 @@
1
+ # List
2
+
3
+ The **sonic-list** component creates list items.
4
+
5
+
6
+ List extends the mixins [Subscriber](#docs/_core-concept/subscriber.md/subscriber) and Fetcher :
7
+ * As a Subscriber it as a **props** reactive property (basically an array of data) and its data is associated to a publisher via its dataProvider attribute.
8
+ * List doesn't Fetch by default (see below for activation).
9
+
10
+
11
+ ## Template
12
+
13
+ The list component loops over its template children to render each items of its props data.
14
+ Consider the following example using **2 templates** and **9 items** :
15
+ - First template will render the first item.
16
+ - Second template will render the second item.
17
+ - Then back to the first template and so on and so forth.
18
+
19
+ Note that for each line there is a dataProvider found at *[list dataProvider name]/liste-item/[line index or key]*
20
+ You can hover the list items in the examples to see it.
21
+
22
+ <sonic-code>
23
+ <template>
24
+ <sonic-list dataProvider="listTemplateExample" class="grid grid-cols-3 gap-4" props='[{"id": "1"}, {"id": "2"}, {"id": "3"}, {"id": "4"}, {"id": "5"}, {"id": "6"}, {"id": "7"}, {"id": "8"}, {"id": "9"}]' debug>
25
+ <template>
26
+ <div class="bg-neutral-100 text-center p-3">
27
+ <sonic-value key="id"></sonic-value>
28
+ <div class="text-xs">1st template</div>
29
+ </div>
30
+ </template>
31
+ <template>
32
+ <div class="bg-neutral-100 text-info text-center p-3">
33
+ <sonic-value key="id"></sonic-value>
34
+ <div class="text-xs">2nd template</div>
35
+ </div>
36
+ </template>
37
+ </sonic-list>
38
+ </template>
39
+ </sonic-code>
40
+
41
+
42
+
43
+ ## TemplateKey / data-value
44
+
45
+ The **templateKey** attribute allows you to bind a template to a props item.
46
+ Consider the following example :
47
+ - The list **templateKey** attribute is set to the value **tpl** (any name would do)
48
+ - Items 4,5 and 6 are each one **referencing** a templates with a matching **data-value** attribute
49
+
50
+ <sonic-code>
51
+ <template>
52
+ <sonic-list
53
+ templateKey="tpl"
54
+ class="grid gap-3"
55
+ dataProvider="TemplateKeyExample"
56
+ props='[
57
+ {"id":"1", "default": "The first template with no data-value is used"},
58
+ {"id":"2", "default": "The second template with no data-value is used"},
59
+ {"id":"3", "default": "Back to the first template with no data-value"},
60
+ {"id":"4", "tpl":"custom-tpl-danger"},
61
+ {"id":"5", "tpl":"custom-tpl-info"},
62
+ {"id":"6", "tpl":"custom-tpl-success"},
63
+ {"id":"7", "tpl": "Non-valid tpl name, Back to the first template with no data-value"}
64
+ ]'
65
+ debug
66
+ >
67
+ <template>
68
+ <div class="p-2 border rounded text-neutral-900">
69
+ <sonic-value key="id"> : </sonic-value>
70
+ <b>First</b> template with no <b>data-value</b> attribute
71
+ </div>
72
+ </template>
73
+ <template data-value="custom-tpl-danger">
74
+ <div class="p-2 border rounded text-danger">
75
+ <sonic-value key="id"> : </sonic-value>
76
+ data-value : <b>custom-tpl-danger</b>
77
+ </div>
78
+ </template>
79
+ <template data-value="custom-tpl-info">
80
+ <div class="p-2 border rounded text-info">
81
+ <sonic-value key="id"> : </sonic-value>
82
+ data-value : <b>custom-tpl-info</b>
83
+ </div>
84
+ </template>
85
+ <template data-value="custom-tpl-success">
86
+ <div class="p-2 border rounded text-success">
87
+ <sonic-value key="id"> : </sonic-value>
88
+ data-value : <b>custom-tpl-success</b>
89
+ </div>
90
+ </template>
91
+ <template>
92
+ <div class="p-2 border rounded text-neutral-400">
93
+ <sonic-value key="id"> : </sonic-value>
94
+ <b>Second</b> template with no <b>data-value</b> attribute <br>
95
+ This one is used if it <b>follows another data-item</b> with <b>no tpl</b> specified in the props
96
+ </div>
97
+ </template>
98
+ </sonic-list>
99
+ </template>
100
+ </sonic-code>
101
+
102
+ ## Special templates : list item separator / empty list view
103
+
104
+ A special template with attribute **data-value="separator"** will act as a separator between each list item
105
+
106
+ <sonic-code>
107
+ <template>
108
+ <sonic-list props='[{"id":"1"},{"id":"2"},{"id":"3"}]' dataProvider="ListSeparatorDemo">
109
+ <template><sonic-value key="id"></sonic-value></template>
110
+ <template data-value="separator"> 🤜 </template>
111
+ </sonic-list>
112
+ </template>
113
+ </sonic-code>
114
+
115
+ The same principle can be used to handle empty lists using a template with attribute **data-value="no-item"**
116
+
117
+
118
+ ## Fetch
119
+
120
+ Enables the list to get data from an external API in order to fill its **props** attribute with an **array of items**
121
+ See the [Fetch] web component(#core/components/functional/fetch/fetch.md/fetch)
122
+ <sonic-code>
123
+ <template>
124
+ <sonic-list
125
+ props='["a", "b", "c"]' fetch
126
+ serviceURL="https://reqres.in"
127
+ dataProvider="api/users"
128
+ key="data"
129
+ class="grid grid-cols-1" debug>
130
+ <template>
131
+ <docs-user></docs-user>
132
+ </template>
133
+ </sonic-list>
134
+ </template>
135
+ </sonic-code>
136
+
137
+ ## Extract Values
138
+
139
+ Example of using the `extractValues` attribute with a service.
140
+ As in the previous example, the `fetch` attribute indicates that a service call should be made.
141
+ Note that we use:
142
+ * the property `_metadata_` added by the list component to display the key of the extracted value
143
+ * the special property `_self_` that allows targeting the item itself. This is useful here because there is no sub-property; we are directly dealing with a string.
144
+ <sonic-code>
145
+ <template>
146
+ <sonic-list
147
+ debug
148
+ fetch
149
+ serviceURL="https://reqres.in"
150
+ dataProvider="list-extract-values-test"
151
+ endPoint="api/users/2"
152
+ key="data"
153
+ extractValues
154
+ >
155
+ <template>
156
+ <div class="flex items-center">
157
+ <span data-bind ::inner-html="$_metadata_.key : " class="bold w-24"></span>
158
+ <span data-bind ::inner-html="$_self_"></span>
159
+ <sonic-if data-bind ::condition="|'$_metadata_.key' == 'avatar'">
160
+ <sonic-image data-bind ::src="$_self_" rounded="full" ratio="1/1" class="w-20 block"></sonic-image>
161
+ </sonic-if>
162
+ </div>
163
+ </template>
164
+ </sonic-list>
165
+ </template>
166
+ </sonic-code>
167
+
168
+ ## Additionnal tips
169
+
170
+ * If the result of the request is an object, it is nested within an array to ensure functionality.
171
+ * The invalidate() method can be called on its publisher to trigger data reloading.
172
+ * Each list item publisher has a "_parent_" property pointing to the list publisher
173
+
174
+
175
+
176
+ <!--
177
+ ## FormDataProvider
178
+
179
+ <sonic-alert status="error" background>À déplacer dans la bonne doc</sonic-alert>
180
+
181
+ <sonic-code>
182
+ <template>
183
+ <div formDataProvider="profileInfos">
184
+ <form>
185
+ <sonic-fieldset label="Edit profile">
186
+ <sonic-form-layout>
187
+ <sonic-input label="First name" type="text" name="first_name" value="Sponge" size="sm"></sonic-input>
188
+ <sonic-input label="Last name" type="text" name="last_name" value="Bob" size="sm"></sonic-input>
189
+ <sonic-input label="email" type="email" name="email" value="bob@krustykrab.com" size="sm"></sonic-input>
190
+ <sonic-input label="Image url" type="text" name="avatar" value="http://www.bobleponge.fr/goodies/avatars/avatar-bob-eponge_Bob-Eponge-coiffure.jpg" size="sm"></sonic-input>
191
+ </sonic-form-layout>
192
+ </sonic-fieldset>
193
+ </form>
194
+ </div>
195
+ <sonic-card dataProvider="profileInfos">
196
+ <docs-user ></docs-user>
197
+ </sonic-card>
198
+ </template>
199
+ </sonic-code> -->
@@ -0,0 +1,41 @@
1
+ # Mix
2
+
3
+ Mix allows you to mix several subsets of dataProvider in a new key/value structure which is itself associated with a new dataProvider. The data update is then bidirectional.
4
+
5
+ Dot notation is supported to extract a sub-part of the data.
6
+
7
+ For example, if we declare dataproviders as follows :
8
+ <sonic-code>
9
+ <template>
10
+ <sonic-subscriber dataProvider="dataToMixA" props='{"foo":{"bar":2}}'></sonic-subscriber>
11
+ <sonic-subscriber dataProvider="dataToMixB" props='{"baz":3}'></sonic-subscriber>
12
+ </template>
13
+ </sonic-code>
14
+ We can rearrange the data as follows
15
+ <sonic-code>
16
+ <template>
17
+ <sonic-mix dataProvider="mixedData" composition='{"either":"dataToMixB","orThat":"dataToMixA.foo.bar"}'>
18
+ <div>Value of dataToMixA.foo.bar and mixedData.orThat : <sonic-value key="orThat"></sonic-value></div>
19
+ <div>Value of dataToMixB.baz and mixedData.either.baz : <sonic-value key="either.baz"></sonic-value></div>
20
+ </sonic-mix>
21
+ </template>
22
+ </sonic-code>
23
+ Then we can change values in both dataProviders programaticaly this way, they will stay in sync
24
+ <sonic-code language="javascript">
25
+ <template>
26
+ SonicPublisherManager.get("mixedData").either.baz=6;
27
+ SonicPublisherManager.get("dataToMixB").baz=8;
28
+ SonicPublisherManager.get("dataToMixA").foo.bar=8;
29
+ SonicPublisherManager.get("mixedData").orThat=6;
30
+ </template>
31
+ </sonic-code>
32
+ Or by using a form element
33
+ <sonic-code>
34
+ <template>
35
+ <sonic-input label="mixedData.orThat" formDataProvider="mixedData" name="orThat"></sonic-input>
36
+ </template>
37
+ </sonic-code>
38
+
39
+
40
+
41
+
@@ -0,0 +1,87 @@
1
+ # Queue
2
+
3
+ **sonic-queue** loads content in batches based on the expression provided in the dataProviderExpression attribute.
4
+
5
+ * Each batch is loaded by a [List component](#core/components/functional/list/list.md/list) whose dataProvider is created from the dataProviderExpression attribute.
6
+ * Upon initialization, it looks at the dataFilterProvider attribute, which provides the address of a publisher.
7
+ If this attribute is found, Queue listens to the provided publisher and resets itself whenever the content of the publisher is modified.
8
+ The values provided in this publisher are added as parameters to each request.
9
+ * The key property can be used to target a specific property in the API response as fetch does.
10
+
11
+ List extends the mixin [Subscriber](#docs/_core-concept/subscriber.md/subscriber)
12
+
13
+
14
+ <sonic-code>
15
+ <template>
16
+ <sonic-queue
17
+ class="grid grid-cols-3 gap-3"
18
+ dataProviderExpression="communes?limit=$limit"
19
+ limit="30"
20
+ serviceURL="https://geo.api.gouv.fr/"
21
+ debug
22
+ >
23
+ <template>
24
+ <div data-bind ::inner-html="$nom" class="bg-neutral-100 p-2">
25
+ queue
26
+ </div>
27
+ </template>
28
+ </sonic-queue>
29
+ </template>
30
+ </sonic-code>
31
+
32
+ <sonic-code>
33
+ <template>
34
+ <sonic-queue
35
+ lazyload
36
+ dataProviderExpression="api/users?page=$offset&per_page=$limit"
37
+ offset="2"
38
+ limit="5"
39
+ dataFilterProvider="filter"
40
+ targetRequestDuration="500"
41
+ serviceURL="https://reqres.in"
42
+ key="data"
43
+ debug
44
+ >
45
+ <template>
46
+ <div class="flex px-4 py-3 items-center gap-4">
47
+ <sonic-image data-bind ::src="$avatar" rounded="full" ratio="1/1" class="w-20 block"></sonic-image>
48
+ <div>
49
+ <div class="text-bold text-2xl mb-2">
50
+ <span data-bind ::inner-html="$first_name"></span>
51
+ <span data-bind ::inner-html="$last_name"></span>
52
+ </div>
53
+ <sonic-button data-bind ::href="mailto|$email" size="xs" variant="outline"> Contact </sonic-button>
54
+ </div>
55
+ </div>
56
+ <div class="border-0 border-t-2 border-t-neutral-200 w-full border-solid"></div>
57
+ </template>
58
+ </sonic-queue>
59
+ </template>
60
+ </sonic-code>
61
+
62
+ <sonic-code>
63
+ <template>
64
+ <sonic-list
65
+ lazyload
66
+ fetch
67
+ dataProvider="api/users?page=2&per_page=5"
68
+ serviceURL="https://reqres.in"
69
+ key="data"
70
+ debug
71
+ >
72
+ <template>
73
+ <div class="flex px-4 py-3 items-center gap-4">
74
+ <sonic-image data-bind ::src="$avatar" rounded="full" ratio="1/1" class="w-20 block"></sonic-image>
75
+ <div>
76
+ <div class="text-bold text-2xl mb-2">
77
+ <span data-bind ::inner-html="$first_name"></span>
78
+ <span data-bind ::inner-html="$last_name"></span>
79
+ </div>
80
+ <sonic-button data-bind ::href="mailto|$email" size="xs" variant="outline"> Contact </sonic-button>
81
+ </div>
82
+ </div>
83
+ <div class="border-0 border-t-2 border-t-neutral-200 w-full border-solid"></div>
84
+ </template>
85
+ </sonic-list>
86
+ </template>
87
+ </sonic-code>
@@ -0,0 +1,108 @@
1
+ # Router
2
+
3
+ The router observes the document.location changes and updates its view as follows
4
+
5
+ ## Data-route / Basic
6
+
7
+ When the data-route attribute of a template matches the current url, the content of this template is rendered
8
+
9
+ <sonic-code>
10
+ <template>
11
+ <div class="flex gap-2 items-center">
12
+ <sonic-button href="#core/components/functional/router/router.md/router#home" size="xs">Home</sonic-button>
13
+ <sonic-button href="#core/components/functional/router/router.md/router#about" size="xs">About</sonic-button>
14
+ <sonic-button href="#core/components/functional/router/router.md/router#work" size="xs">Work</sonic-button>
15
+ <sonic-button href="#core/components/functional/router/router.md/router#contact" size="xs">Contact</sonic-button>
16
+ </div>
17
+ <sonic-router>
18
+ <template data-route="#home">
19
+ <div class="text-center text-neutral-700 border rounded text-4xl my-6 p-3 ">Home</div>
20
+ </template>
21
+ <template data-route="#about">
22
+ <div class="text-center text-neutral-700 border rounded text-4xl my-6 p-3 ">About</div>
23
+ </template>
24
+ <template data-route="#work">
25
+ <div class="text-center text-neutral-700 border rounded text-4xl my-6 p-3 ">Work</div>
26
+ </template>
27
+ <template data-route="#contact">
28
+ <div class="text-center text-neutral-700 border rounded text-4xl my-6 p-3 ">Contact</div>
29
+ </template>
30
+ </sonic-router>
31
+ </template>
32
+ </sonic-code>
33
+
34
+ ## Data-route / Regexp
35
+
36
+ You can use any RegExp in the data-route attribute of your templates to match the current location and to extract variables from it using capturing groups.
37
+ A dataProvider attribute is generated using the dataProviderExpression where $1, $2... are replaced with this variables.
38
+
39
+ **e.g.**, data-route="#couleur_<b class="text-danger">(\d+)</b>" => dataProviderExpression="api/unknown/<b class="text-danger">$1</b>"
40
+
41
+ The rendered content of the matching template is scoped with this **dataProvider**.
42
+ You can make creative usage on this feature to generate dynamic content based on services.
43
+
44
+ <sonic-code>
45
+ <template>
46
+ <sonic-list fetch dataProvider="api/unknown" key="data" class="flex gap-2 items-center" >
47
+ <template>
48
+ <sonic-button radio size="xs" data-bind ::href="#core/components/functional/router/router.md/router#couleur_$id">
49
+ <span data-bind ::inner-html="ucFirst|$name"></span>
50
+ </sonic-button>
51
+ </template>
52
+ </sonic-list>
53
+ <sonic-router>
54
+ <template data-route="#couleur_(\d+)" dataProviderExpression="api/unknown/$1">
55
+ <sonic-fetch>
56
+ <input type="color" disabled data-bind ::value="$data.color" class=" w-full h-10 my-3" />
57
+ </sonic-fetch>
58
+ </template>
59
+ </sonic-router>
60
+ </template>
61
+ </sonic-code>
62
+
63
+ ## Data-route / Url-pattern
64
+
65
+ Same as RegExp but using <a href="https://www.npmjs.com/package/url-pattern" target="_blank">url patterns</a>
66
+ **e.g.**, data-route="#couleur_<b class="text-danger">:id</b>" => dataProviderExpression="api/unknown/<b class="text-danger">:id</b>"
67
+
68
+ <sonic-code>
69
+ <template>
70
+ <sonic-list fetch dataProvider="api/unknown" key="data" class="flex gap-2 items-center" >
71
+ <template>
72
+ <sonic-button radio size="xs" data-bind ::href="#core/components/functional/router/router.md/router#couleur_$id">
73
+ <span data-bind ::inner-html="ucFirst|$name"></span>
74
+ </sonic-button>
75
+ </template>
76
+ </sonic-list>
77
+ <sonic-router>
78
+ <template data-route="/*#couleur_:id" dataProviderExpression="api/unknown/:id">
79
+ <sonic-fetch>
80
+ <input type="color" disabled data-bind ::value="$data.color" class=" w-full h-10 my-3" />
81
+ </sonic-fetch>
82
+ </template>
83
+ </sonic-router>
84
+ </template>
85
+ </sonic-code>
86
+
87
+ ## Redirect
88
+
89
+ Redirect allows to redirect to a url when a data is provided.
90
+ Here Redirect waits that a data is available in the property *theData* of the dataProvider *stupid-data-set-id*
91
+ We are then redirected to the url *#data-is-set* which does nothing in itself.
92
+
93
+ <sonic-code>
94
+ <template>
95
+ <sonic-redirect to="#core/components/functional/router/router.md/router#data-is-set" dataProvider="stupid-data-set-id" onData="theData"></sonic-redirect>
96
+ <div class="flex gap-2 mb-4" formDataProvider="stupid-data-set-id">
97
+ <sonic-button radio name="theData" value="Some Data" size="xs">
98
+ Enter data
99
+ </sonic-button>
100
+ <sonic-button radio name="theData" value="" href="javascript:history.back();" size="xs">
101
+ Delete the data and do a history.back()
102
+ </sonic-button>
103
+ </div>
104
+
105
+ </template>
106
+ </sonic-code>
107
+
108
+ Example of use : use with a router and a submit to manage the steps of login/logout, display of user info.