@stokelp/ui 2.122.1 → 2.124.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.
Files changed (37) hide show
  1. package/dist/components/app/navigation/language-select/AppNavigationLanguageSelect.cjs +1 -1
  2. package/dist/components/app/navigation/language-select/AppNavigationLanguageSelect.cjs.map +1 -1
  3. package/dist/components/app/navigation/language-select/AppNavigationLanguageSelect.d.ts +13 -0
  4. package/dist/components/app/navigation/language-select/AppNavigationLanguageSelect.js +85 -165
  5. package/dist/components/app/navigation/language-select/AppNavigationLanguageSelect.js.map +1 -1
  6. package/dist/components/combobox/Combobox.cjs +1 -1
  7. package/dist/components/combobox/Combobox.cjs.map +1 -1
  8. package/dist/components/combobox/Combobox.js +71 -70
  9. package/dist/components/combobox/Combobox.js.map +1 -1
  10. package/dist/components/index.d.ts +1 -0
  11. package/dist/components/select/Select.cjs +1 -1
  12. package/dist/components/select/Select.cjs.map +1 -1
  13. package/dist/components/select/Select.js +75 -74
  14. package/dist/components/select/Select.js.map +1 -1
  15. package/dist/components/supplier-rating-badge/SupplierRatingBadge.cjs +1 -1
  16. package/dist/components/supplier-rating-badge/SupplierRatingBadge.cjs.map +1 -1
  17. package/dist/components/supplier-rating-badge/SupplierRatingBadge.js +10 -9
  18. package/dist/components/supplier-rating-badge/SupplierRatingBadge.js.map +1 -1
  19. package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.cjs +1 -1
  20. package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.cjs.map +1 -1
  21. package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.d.ts +5 -43
  22. package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.js +69 -101
  23. package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.js.map +1 -1
  24. package/dist/components/supplier-rating-badge/labels.cjs +2 -0
  25. package/dist/components/supplier-rating-badge/labels.cjs.map +1 -0
  26. package/dist/components/supplier-rating-badge/labels.d.ts +42 -0
  27. package/dist/components/supplier-rating-badge/labels.js +49 -0
  28. package/dist/components/supplier-rating-badge/labels.js.map +1 -0
  29. package/dist/components/ui-labels/UiLabelsProvider.cjs +2 -0
  30. package/dist/components/ui-labels/UiLabelsProvider.cjs.map +1 -0
  31. package/dist/components/ui-labels/UiLabelsProvider.d.ts +27 -0
  32. package/dist/components/ui-labels/UiLabelsProvider.js +28 -0
  33. package/dist/components/ui-labels/UiLabelsProvider.js.map +1 -0
  34. package/dist/components/ui-labels/index.d.ts +1 -0
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.js +57 -55
  37. package/package.json +8 -7
@@ -3,91 +3,92 @@ import { createStyleContext as e } from "../../utils/slots.js";
3
3
  import { Tooltip as t } from "../tooltip/Tooltip.js";
4
4
  import { Text as n } from "../text/Text.js";
5
5
  import { ConditionalWrapper as r } from "../../shared/ConditionalWrapper.js";
6
- import { Portal as i, Select as a, createListCollection as o, useSelectContext as s, useSelectItemContext as c } from "@ark-ui/react";
7
- import { styled as l } from "@stokelp/styled-system/jsx";
8
- import { select as u } from "@stokelp/styled-system/recipes";
9
- import { Fragment as d, useRef as f } from "react";
10
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
11
- import { css as g } from "@stokelp/styled-system/css";
12
- import { FixedSizeList as _ } from "react-window";
6
+ import { useUiLabels as i } from "../ui-labels/UiLabelsProvider.js";
7
+ import { Portal as a, Select as o, createListCollection as s, useSelectContext as c, useSelectItemContext as l } from "@ark-ui/react";
8
+ import { styled as u } from "@stokelp/styled-system/jsx";
9
+ import { select as d } from "@stokelp/styled-system/recipes";
10
+ import { Fragment as f, useRef as p } from "react";
11
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
12
+ import { css as _ } from "@stokelp/styled-system/css";
13
+ import { FixedSizeList as v } from "react-window";
13
14
  //#region src/components/select/Select.tsx
14
- var { withProvider: v, withContext: y } = e(u), b = v(l(a.Root), "root", { defaultProps: { loopFocus: !0 } }), x = y(l(a.ClearTrigger), "clearTrigger"), S = y(l(a.Content), "content"), C = y(l(a.Control), "control"), w = y(l(a.Indicator), "indicator"), T = y(l(a.Item), "item"), E = y(l(a.ItemGroup), "itemGroup"), D = y(l(a.ItemGroupLabel), "itemGroupLabel"), O = y(l(a.ItemText), "itemText"), k = y(l(a.Positioner), "positioner"), A = y(l(a.Trigger), "trigger"), j = y(l(a.ValueText), "valueText"), M = () => /* @__PURE__ */ h("svg", {
15
+ var { withProvider: y, withContext: b } = e(d), x = y(u(o.Root), "root", { defaultProps: { loopFocus: !0 } }), S = b(u(o.ClearTrigger), "clearTrigger"), C = b(u(o.Content), "content"), w = b(u(o.Control), "control"), T = b(u(o.Indicator), "indicator"), E = b(u(o.Item), "item"), D = b(u(o.ItemGroup), "itemGroup"), O = b(u(o.ItemGroupLabel), "itemGroupLabel"), k = b(u(o.ItemText), "itemText"), A = b(u(o.Positioner), "positioner"), j = b(u(o.Trigger), "trigger"), M = b(u(o.ValueText), "valueText"), N = () => /* @__PURE__ */ g("svg", {
15
16
  width: "16",
16
17
  height: "17",
17
18
  viewBox: "0 0 16 17",
18
19
  fill: "none",
19
20
  xmlns: "http://www.w3.org/2000/svg",
20
- children: [/* @__PURE__ */ m("rect", {
21
+ children: [/* @__PURE__ */ h("rect", {
21
22
  x: "0.5",
22
23
  y: "1",
23
24
  width: "15",
24
25
  height: "15",
25
26
  rx: "3.5",
26
27
  fill: "white"
27
- }), /* @__PURE__ */ m("rect", {
28
+ }), /* @__PURE__ */ h("rect", {
28
29
  x: "0.5",
29
30
  y: "1",
30
31
  width: "15",
31
32
  height: "15",
32
33
  rx: "3.5",
33
- className: g({ stroke: "grey.100" })
34
+ className: _({ stroke: "grey.100" })
34
35
  })]
35
- }), N = () => /* @__PURE__ */ h("svg", {
36
+ }), P = () => /* @__PURE__ */ g("svg", {
36
37
  width: "16",
37
38
  height: "17",
38
39
  viewBox: "0 0 16 17",
39
40
  fill: "none",
40
41
  xmlns: "http://www.w3.org/2000/svg",
41
- children: [/* @__PURE__ */ m("rect", {
42
+ children: [/* @__PURE__ */ h("rect", {
42
43
  y: "0.5",
43
44
  width: "16",
44
45
  height: "16",
45
46
  rx: "4",
46
- className: g({ fill: "primary.500" })
47
- }), /* @__PURE__ */ m("path", {
47
+ className: _({ fill: "primary.500" })
48
+ }), /* @__PURE__ */ h("path", {
48
49
  fillRule: "evenodd",
49
50
  clipRule: "evenodd",
50
51
  d: "M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z",
51
52
  fill: "white"
52
53
  })]
53
54
  });
54
- function P({ placeholder: e, allSelectedLabel: t }) {
55
- let n = s(), r = n.collection.items, i = n.selectedItems;
56
- return n.multiple && i.filter((e) => !e.disabled).length >= r.filter((e) => !e.disabled).length && t ? /* @__PURE__ */ m(j, {
55
+ function F({ placeholder: e, allSelectedLabel: t }) {
56
+ let n = c(), r = n.collection.items, i = n.selectedItems;
57
+ return n.multiple && i.filter((e) => !e.disabled).length >= r.filter((e) => !e.disabled).length && t ? /* @__PURE__ */ h(M, {
57
58
  className: "custom",
58
59
  truncate: !0,
59
60
  children: t
60
- }) : /* @__PURE__ */ m(j, {
61
+ }) : /* @__PURE__ */ h(M, {
61
62
  truncate: !0,
62
63
  placeholder: e
63
64
  });
64
65
  }
65
- function F({ renderTrigger: e, placeholder: t, allSelectedLabel: n }) {
66
- let r = s(), i = r.value && r.value.length > 0 ? r.collection.findMany(r.value) : [];
67
- if (i.length === 0) return /* @__PURE__ */ m(j, {
66
+ function I({ renderTrigger: e, placeholder: t, allSelectedLabel: n }) {
67
+ let r = c(), i = r.value && r.value.length > 0 ? r.collection.findMany(r.value) : [];
68
+ if (i.length === 0) return /* @__PURE__ */ h(M, {
68
69
  className: "custom",
69
70
  truncate: !0,
70
71
  placeholder: t
71
72
  });
72
73
  let a = r.selectedItems;
73
- return r.multiple && a.filter((e) => !e.disabled).length >= r.collection.items.filter((e) => !e.disabled).length && n ? /* @__PURE__ */ m(j, {
74
+ return r.multiple && a.filter((e) => !e.disabled).length >= r.collection.items.filter((e) => !e.disabled).length && n ? /* @__PURE__ */ h(M, {
74
75
  className: "custom",
75
76
  truncate: !0,
76
77
  children: n
77
- }) : /* @__PURE__ */ m(j, {
78
+ }) : /* @__PURE__ */ h(M, {
78
79
  className: "custom",
79
80
  placeholder: t,
80
- children: i.map((t) => /* @__PURE__ */ m("span", { children: e(t) }, t.value))
81
+ children: i.map((t) => /* @__PURE__ */ h("span", { children: e(t) }, t.value))
81
82
  });
82
83
  }
83
- function I({ item: e, isMultiple: t, renderItem: n }) {
84
- let r = c();
85
- return /* @__PURE__ */ h(p, { children: [t ? r.selected ? /* @__PURE__ */ m(N, {}) : /* @__PURE__ */ m(M, {}) : null, n ? n(e) : /* @__PURE__ */ m(O, {
84
+ function L({ item: e, isMultiple: t, renderItem: n }) {
85
+ let r = l();
86
+ return /* @__PURE__ */ g(m, { children: [t ? r.selected ? /* @__PURE__ */ h(P, {}) : /* @__PURE__ */ h(N, {}) : null, n ? n(e) : /* @__PURE__ */ h(k, {
86
87
  truncate: !0,
87
88
  children: e.label
88
89
  })] });
89
90
  }
90
- function L(e) {
91
+ function R(e) {
91
92
  let t = [];
92
93
  for (let n of e) {
93
94
  let e = t[t.length - 1];
@@ -102,24 +103,24 @@ function L(e) {
102
103
  }
103
104
  return t;
104
105
  }
105
- function R({ items: e, placeholder: s, emptyLabel: c, usePortal: l = !0, positioning: u, renderItem: v, renderTrigger: y, virtualized: O, rowHeight: j = 34, ...M }) {
106
- let N = o({ items: e }), R = f(null), z = (e) => /* @__PURE__ */ h(d, { children: [/* @__PURE__ */ m(r, {
106
+ function z({ items: e, placeholder: c, emptyLabel: l, usePortal: u = !0, positioning: d, renderItem: y, renderTrigger: b, virtualized: k, rowHeight: M = 34, ...N }) {
107
+ let P = i(), z = s({ items: e }), B = p(null), V = (e) => /* @__PURE__ */ g(f, { children: [/* @__PURE__ */ h(r, {
107
108
  when: !!e.tooltip,
108
- wrapper: (n) => /* @__PURE__ */ m(t, {
109
+ wrapper: (n) => /* @__PURE__ */ h(t, {
109
110
  label: e.tooltip,
110
111
  children: n
111
112
  }),
112
- children: /* @__PURE__ */ m(T, {
113
+ children: /* @__PURE__ */ h(E, {
113
114
  item: e,
114
- children: /* @__PURE__ */ m(I, {
115
- renderItem: v,
115
+ children: /* @__PURE__ */ h(L, {
116
+ renderItem: y,
116
117
  item: e,
117
- isMultiple: M.multiple
118
+ isMultiple: N.multiple
118
119
  })
119
120
  }, e.value)
120
- }, e.value), e.separatorAfter && /* @__PURE__ */ m("div", {
121
+ }, e.value), e.separatorAfter && /* @__PURE__ */ h("div", {
121
122
  role: "separator",
122
- className: g({
123
+ className: _({
123
124
  height: "1px",
124
125
  flexShrink: 0,
125
126
  backgroundColor: "grey.100",
@@ -127,53 +128,53 @@ function R({ items: e, placeholder: s, emptyLabel: c, usePortal: l = !0, positio
127
128
  marginX: "space-8"
128
129
  })
129
130
  })] }, e.value);
130
- return /* @__PURE__ */ h(b, {
131
+ return /* @__PURE__ */ g(x, {
131
132
  lazyMount: !0,
132
133
  unmountOnExit: !0,
133
- collection: N,
134
+ collection: z,
134
135
  positioning: {
135
136
  sameWidth: !0,
136
137
  gutter: 0,
137
- ...u
138
+ ...d
138
139
  },
139
140
  "data-recipe": "select",
140
- ...M,
141
+ ...N,
141
142
  ref: (e) => {
142
- e && (R.current = e.closest("[role=\"dialog\"]"));
143
+ e && (B.current = e.closest("[role=\"dialog\"]"));
143
144
  },
144
145
  children: [
145
- /* @__PURE__ */ h(C, { children: [/* @__PURE__ */ h(A, { children: [y ? /* @__PURE__ */ m(F, {
146
- renderTrigger: y,
147
- placeholder: s,
148
- allSelectedLabel: M.allSelectedLabel
149
- }) : /* @__PURE__ */ m(P, {
150
- placeholder: s,
151
- allSelectedLabel: M.allSelectedLabel
152
- }), /* @__PURE__ */ m(w, {
146
+ /* @__PURE__ */ g(w, { children: [/* @__PURE__ */ g(j, { children: [b ? /* @__PURE__ */ h(I, {
147
+ renderTrigger: b,
148
+ placeholder: c,
149
+ allSelectedLabel: N.allSelectedLabel
150
+ }) : /* @__PURE__ */ h(F, {
151
+ placeholder: c,
152
+ allSelectedLabel: N.allSelectedLabel
153
+ }), /* @__PURE__ */ h(T, {
153
154
  asChild: !0,
154
- children: /* @__PURE__ */ m("svg", {
155
+ children: /* @__PURE__ */ h("svg", {
155
156
  width: "24",
156
157
  height: "24",
157
158
  viewBox: "0 0 24 24",
158
159
  fill: "none",
159
160
  xmlns: "http://www.w3.org/2000/svg",
160
- children: /* @__PURE__ */ m("path", {
161
+ children: /* @__PURE__ */ h("path", {
161
162
  fillRule: "evenodd",
162
163
  clipRule: "evenodd",
163
164
  d: "M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z",
164
165
  fill: "currentColor"
165
166
  })
166
167
  })
167
- })] }), /* @__PURE__ */ m(x, {
168
- disabled: M.readOnly,
168
+ })] }), /* @__PURE__ */ h(S, {
169
+ disabled: N.readOnly,
169
170
  asChild: !0,
170
- children: /* @__PURE__ */ m("button", { children: /* @__PURE__ */ m("svg", {
171
+ children: /* @__PURE__ */ h("button", { children: /* @__PURE__ */ h("svg", {
171
172
  width: "20",
172
173
  height: "20",
173
174
  viewBox: "0 0 20 20",
174
175
  fill: "none",
175
176
  xmlns: "http://www.w3.org/2000/svg",
176
- children: /* @__PURE__ */ m("path", {
177
+ children: /* @__PURE__ */ h("path", {
177
178
  fillRule: "evenodd",
178
179
  clipRule: "evenodd",
179
180
  d: "M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z",
@@ -181,43 +182,43 @@ function R({ items: e, placeholder: s, emptyLabel: c, usePortal: l = !0, positio
181
182
  })
182
183
  }) })
183
184
  })] }),
184
- /* @__PURE__ */ m(r, {
185
- when: l,
186
- wrapper: (e) => /* @__PURE__ */ m(i, {
187
- container: R,
185
+ /* @__PURE__ */ h(r, {
186
+ when: u,
187
+ wrapper: (e) => /* @__PURE__ */ h(a, {
188
+ container: B,
188
189
  children: e
189
190
  }),
190
- children: /* @__PURE__ */ m(k, { children: /* @__PURE__ */ m(S, { children: e.length === 0 ? /* @__PURE__ */ m(n, {
191
+ children: /* @__PURE__ */ h(A, { children: /* @__PURE__ */ h(C, { children: e.length === 0 ? /* @__PURE__ */ h(n, {
191
192
  px: "space-8",
192
193
  textAlign: "center",
193
- children: c ?? "Aucun résultat"
194
- }) : O ? /* @__PURE__ */ m(p, { children: /* @__PURE__ */ m(_, {
195
- height: Math.min(j * e.length, 180),
194
+ children: l ?? P.noResults
195
+ }) : k ? /* @__PURE__ */ h(m, { children: /* @__PURE__ */ h(v, {
196
+ height: Math.min(M * e.length, 180),
196
197
  itemCount: e.length,
197
- itemSize: j,
198
+ itemSize: M,
198
199
  width: "100%",
199
- children: ({ index: n, style: i }) => /* @__PURE__ */ m(r, {
200
+ children: ({ index: n, style: i }) => /* @__PURE__ */ h(r, {
200
201
  when: !!e[n].tooltip,
201
- wrapper: (r) => /* @__PURE__ */ m(t, {
202
+ wrapper: (r) => /* @__PURE__ */ h(t, {
202
203
  label: e[n].tooltip,
203
204
  children: r
204
205
  }),
205
- children: /* @__PURE__ */ m(T, {
206
+ children: /* @__PURE__ */ h(E, {
206
207
  item: e[n],
207
208
  style: i,
208
- children: /* @__PURE__ */ m(I, {
209
- renderItem: v,
209
+ children: /* @__PURE__ */ h(L, {
210
+ renderItem: y,
210
211
  item: e[n]
211
212
  })
212
213
  }, e[n].value)
213
214
  }, e[n].value)
214
- }) }) : L(e).map((e, t) => e.label === void 0 ? /* @__PURE__ */ m(d, { children: e.items.map(z) }, `group-${t}`) : /* @__PURE__ */ h(E, { children: [/* @__PURE__ */ m(D, { children: e.label }), e.items.map(z)] }, `group-${t}`)) }) })
215
+ }) }) : R(e).map((e, t) => e.label === void 0 ? /* @__PURE__ */ h(f, { children: e.items.map(V) }, `group-${t}`) : /* @__PURE__ */ g(D, { children: [/* @__PURE__ */ h(O, { children: e.label }), e.items.map(V)] }, `group-${t}`)) }) })
215
216
  }),
216
- /* @__PURE__ */ m(a.HiddenSelect, {})
217
+ /* @__PURE__ */ h(o.HiddenSelect, {})
217
218
  ]
218
219
  });
219
220
  }
220
221
  //#endregion
221
- export { R as Select };
222
+ export { z as Select };
222
223
 
223
224
  //# sourceMappingURL=Select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":[],"sources":["../../../src/components/select/Select.tsx"],"sourcesContent":["import {\n createListCollection,\n Portal,\n Select as ArkSelect,\n type SelectRootProps,\n useSelectItemContext,\n useSelectContext,\n} from '@ark-ui/react'\nimport { FC, Fragment, ReactNode, useRef } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\n\nimport { select } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { HTMLStyledProps, RecipeVariantProps } from '@stokelp/styled-system/types'\nimport { FixedSizeList } from 'react-window'\nimport { css } from '@stokelp/styled-system/css'\n\nconst { withProvider, withContext } = createStyleContext(select)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkSelect.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkSelect.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkSelect.Content), 'content')\nconst Control = withContext(styled(ArkSelect.Control), 'control')\nconst Indicator = withContext(styled(ArkSelect.Indicator), 'indicator')\nconst Item = withContext(styled(ArkSelect.Item), 'item')\nconst ItemGroup = withContext(styled(ArkSelect.ItemGroup), 'itemGroup')\nconst ItemGroupLabel = withContext(styled(ArkSelect.ItemGroupLabel), 'itemGroupLabel')\nconst ItemText = withContext(styled(ArkSelect.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkSelect.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkSelect.Trigger), 'trigger')\nconst ValueText = withContext(styled(ArkSelect.ValueText), 'valueText')\n\nexport interface SelectItem {\n value: string | number\n label: string\n tooltip?: ReactNode\n disabled?: boolean\n /**\n * Renders a thin divider line after this item, separating option groups.\n * Ignored by the virtualized list (fixed row heights).\n */\n separatorAfter?: boolean\n /**\n * Heading for the group this item belongs to. Consecutive items sharing a label are\n * wrapped in one labelled group, so the heading is announced by screen readers instead\n * of being faked with a decorative row inside `renderItem`. Items without a label stay\n * ungrouped. Ignored by the virtualized list (fixed row heights).\n */\n groupLabel?: string\n}\n\nexport type SelectProps<Item extends SelectItem> = Omit<SelectRootProps<Item>, 'collection'> & {\n items: Item[] | readonly Item[]\n renderItem?: (item: Item) => ReactNode\n renderTrigger?: (item: Item) => ReactNode\n emptyLabel?: string\n placeholder?: string\n allSelectedLabel?: string\n usePortal?: boolean\n virtualized?: boolean\n rowHeight?: number\n} & HTMLStyledProps<'div'> &\n RecipeVariantProps<typeof select>\n\nconst MultipleUncheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" fill=\"white\" />\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" className={css({ stroke: 'grey.100' })} />\n </svg>\n)\n\nconst MultipleCheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect y=\"0.5\" width=\"16\" height=\"16\" rx=\"4\" className={css({ fill: 'primary.500' })} />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z\"\n fill=\"white\"\n />\n </svg>\n)\n\ninterface InnerItemProps<Item extends SelectItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\ninterface InnerTriggerProps<Item extends SelectItem> {\n renderTrigger: (item: Item) => ReactNode\n placeholder?: string\n allSelectedLabel?: string\n}\n\ninterface DefaultInnerTriggerProps {\n placeholder?: string\n allSelectedLabel?: string\n}\n\nfunction DefaultInnerTrigger({ placeholder, allSelectedLabel }: DefaultInnerTriggerProps) {\n const context = useSelectContext()\n const items = context.collection.items\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >= items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return <ValueText truncate placeholder={placeholder} />\n}\n\nfunction CustomInnerTrigger<Item extends SelectItem>({\n renderTrigger,\n placeholder,\n allSelectedLabel,\n}: InnerTriggerProps<Item>) {\n const context = useSelectContext()\n const items = context.value && context.value.length > 0 ? context.collection.findMany(context.value) : []\n\n if (items.length === 0) {\n return <ValueText className=\"custom\" truncate placeholder={placeholder} />\n }\n\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >=\n context.collection.items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return (\n <ValueText className=\"custom\" placeholder={placeholder}>\n {items.map(item => (\n <span key={item.value}>{renderTrigger(item)}</span>\n ))}\n </ValueText>\n )\n}\n\nfunction CustomInnerItem<Item extends SelectItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useSelectItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\n/**\n * Splits the flat item list into consecutive runs sharing a `groupLabel`. Runs are built\n * from adjacency rather than by collecting every item with the same label, so the caller\n * keeps full control of the order: sorting is the caller's business, grouping is ours.\n */\nfunction toGroupRuns<Item extends SelectItem>(items: readonly Item[]) {\n const runs: Array<{ label?: string; items: Item[] }> = []\n\n for (const item of items) {\n const current = runs[runs.length - 1]\n if (current && current.label === item.groupLabel) {\n current.items.push(item)\n continue\n }\n runs.push({ label: item.groupLabel, items: [item] })\n }\n\n return runs\n}\n\nexport function Select<Item extends SelectItem>({\n items,\n placeholder,\n emptyLabel,\n usePortal = true,\n positioning,\n renderItem,\n renderTrigger,\n virtualized,\n rowHeight = 34,\n ...props\n}: SelectProps<Item>) {\n const collection = createListCollection({\n items,\n })\n const $dialogContent = useRef<HTMLDivElement | null>(null)\n\n const renderOption = (item: Item) => (\n <Fragment key={item.value}>\n <ConditionalWrapper\n key={item.value}\n when={!!item.tooltip}\n wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}\n >\n <Item key={item.value} item={item}>\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={props.multiple} />\n </Item>\n </ConditionalWrapper>\n {item.separatorAfter && (\n <div\n role=\"separator\"\n className={css({\n height: '1px',\n flexShrink: 0,\n backgroundColor: 'grey.100',\n marginY: 'space-4',\n marginX: 'space-8',\n })}\n />\n )}\n </Fragment>\n )\n\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"select\"\n {...props}\n ref={(node: HTMLDivElement | null) => {\n if (node) {\n $dialogContent.current = node.closest('[role=\"dialog\"]') as HTMLDivElement | null\n }\n }}\n >\n <Control>\n <Trigger>\n {renderTrigger ? (\n <CustomInnerTrigger\n renderTrigger={renderTrigger}\n placeholder={placeholder}\n allSelectedLabel={props.allSelectedLabel}\n />\n ) : (\n <DefaultInnerTrigger placeholder={placeholder} allSelectedLabel={props.allSelectedLabel} />\n )}\n <Indicator asChild>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z\"\n fill=\"currentColor\"\n />\n </svg>\n </Indicator>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal container={$dialogContent}>{children}</Portal>}>\n <Positioner>\n <Content>\n {items.length === 0 ? (\n <Text px=\"space-8\" textAlign=\"center\">\n {emptyLabel ?? 'Aucun résultat'}\n </Text>\n ) : virtualized ? (\n <>\n <FixedSizeList\n height={Math.min(rowHeight * items.length, 180)}\n itemCount={items.length}\n itemSize={rowHeight}\n width=\"100%\"\n >\n {({ index, style }) => (\n <ConditionalWrapper\n key={items[index].value}\n when={!!items[index].tooltip}\n wrapper={children => <Tooltip label={items[index].tooltip}>{children}</Tooltip>}\n >\n <Item key={items[index].value} item={items[index]} style={style}>\n <CustomInnerItem renderItem={renderItem} item={items[index]} />\n </Item>\n </ConditionalWrapper>\n )}\n </FixedSizeList>\n </>\n ) : (\n toGroupRuns<Item>(items).map((run, runIndex) =>\n run.label === undefined ? (\n <Fragment key={`group-${runIndex}`}>{run.items.map(renderOption)}</Fragment>\n ) : (\n <ItemGroup key={`group-${runIndex}`}>\n <ItemGroupLabel>{run.label}</ItemGroupLabel>\n {run.items.map(renderOption)}\n </ItemGroup>\n ),\n )\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n <ArkSelect.HiddenSelect />\n </Root>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAM,EAAE,iBAAc,mBAAgB,EAAmB,CAAM,GAGzD,IAAO,EAAa,EAAO,EAAU,IAAS,GAAG,QAAQ,EAC7D,cAAc,EACZ,WAAW,GACb,EACF,CAAC,GAEK,IAAe,EAAY,EAAO,EAAU,YAAY,GAAG,cAAc,GACzE,IAAU,EAAY,EAAO,EAAU,OAAO,GAAG,SAAS,GAC1D,IAAU,EAAY,EAAO,EAAU,OAAO,GAAG,SAAS,GAC1D,IAAY,EAAY,EAAO,EAAU,SAAS,GAAG,WAAW,GAChE,IAAO,EAAY,EAAO,EAAU,IAAI,GAAG,MAAM,GACjD,IAAY,EAAY,EAAO,EAAU,SAAS,GAAG,WAAW,GAChE,IAAiB,EAAY,EAAO,EAAU,cAAc,GAAG,gBAAgB,GAC/E,IAAW,EAAY,EAAO,EAAU,QAAQ,GAAG,UAAU,GAC7D,IAAa,EAAY,EAAO,EAAU,UA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GACM,CAAA;GACpB,kBAAC,EAAU,cAAX,CAAyB,CAAA;EACrB;;AAEV"}
1
+ {"version":3,"file":"Select.js","names":[],"sources":["../../../src/components/select/Select.tsx"],"sourcesContent":["import {\n createListCollection,\n Portal,\n Select as ArkSelect,\n type SelectRootProps,\n useSelectItemContext,\n useSelectContext,\n} from '@ark-ui/react'\nimport { FC, Fragment, ReactNode, useRef } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\n\nimport { select } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\nimport { HTMLStyledProps, RecipeVariantProps } from '@stokelp/styled-system/types'\nimport { FixedSizeList } from 'react-window'\nimport { css } from '@stokelp/styled-system/css'\n\nconst { withProvider, withContext } = createStyleContext(select)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkSelect.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkSelect.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkSelect.Content), 'content')\nconst Control = withContext(styled(ArkSelect.Control), 'control')\nconst Indicator = withContext(styled(ArkSelect.Indicator), 'indicator')\nconst Item = withContext(styled(ArkSelect.Item), 'item')\nconst ItemGroup = withContext(styled(ArkSelect.ItemGroup), 'itemGroup')\nconst ItemGroupLabel = withContext(styled(ArkSelect.ItemGroupLabel), 'itemGroupLabel')\nconst ItemText = withContext(styled(ArkSelect.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkSelect.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkSelect.Trigger), 'trigger')\nconst ValueText = withContext(styled(ArkSelect.ValueText), 'valueText')\n\nexport interface SelectItem {\n value: string | number\n label: string\n tooltip?: ReactNode\n disabled?: boolean\n /**\n * Renders a thin divider line after this item, separating option groups.\n * Ignored by the virtualized list (fixed row heights).\n */\n separatorAfter?: boolean\n /**\n * Heading for the group this item belongs to. Consecutive items sharing a label are\n * wrapped in one labelled group, so the heading is announced by screen readers instead\n * of being faked with a decorative row inside `renderItem`. Items without a label stay\n * ungrouped. Ignored by the virtualized list (fixed row heights).\n */\n groupLabel?: string\n}\n\nexport type SelectProps<Item extends SelectItem> = Omit<SelectRootProps<Item>, 'collection'> & {\n items: Item[] | readonly Item[]\n renderItem?: (item: Item) => ReactNode\n renderTrigger?: (item: Item) => ReactNode\n emptyLabel?: string\n placeholder?: string\n allSelectedLabel?: string\n usePortal?: boolean\n virtualized?: boolean\n rowHeight?: number\n} & HTMLStyledProps<'div'> &\n RecipeVariantProps<typeof select>\n\nconst MultipleUncheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" fill=\"white\" />\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" className={css({ stroke: 'grey.100' })} />\n </svg>\n)\n\nconst MultipleCheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect y=\"0.5\" width=\"16\" height=\"16\" rx=\"4\" className={css({ fill: 'primary.500' })} />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z\"\n fill=\"white\"\n />\n </svg>\n)\n\ninterface InnerItemProps<Item extends SelectItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\ninterface InnerTriggerProps<Item extends SelectItem> {\n renderTrigger: (item: Item) => ReactNode\n placeholder?: string\n allSelectedLabel?: string\n}\n\ninterface DefaultInnerTriggerProps {\n placeholder?: string\n allSelectedLabel?: string\n}\n\nfunction DefaultInnerTrigger({ placeholder, allSelectedLabel }: DefaultInnerTriggerProps) {\n const context = useSelectContext()\n const items = context.collection.items\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >= items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return <ValueText truncate placeholder={placeholder} />\n}\n\nfunction CustomInnerTrigger<Item extends SelectItem>({\n renderTrigger,\n placeholder,\n allSelectedLabel,\n}: InnerTriggerProps<Item>) {\n const context = useSelectContext()\n const items = context.value && context.value.length > 0 ? context.collection.findMany(context.value) : []\n\n if (items.length === 0) {\n return <ValueText className=\"custom\" truncate placeholder={placeholder} />\n }\n\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >=\n context.collection.items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return (\n <ValueText className=\"custom\" placeholder={placeholder}>\n {items.map(item => (\n <span key={item.value}>{renderTrigger(item)}</span>\n ))}\n </ValueText>\n )\n}\n\nfunction CustomInnerItem<Item extends SelectItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useSelectItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\n/**\n * Splits the flat item list into consecutive runs sharing a `groupLabel`. Runs are built\n * from adjacency rather than by collecting every item with the same label, so the caller\n * keeps full control of the order: sorting is the caller's business, grouping is ours.\n */\nfunction toGroupRuns<Item extends SelectItem>(items: readonly Item[]) {\n const runs: Array<{ label?: string; items: Item[] }> = []\n\n for (const item of items) {\n const current = runs[runs.length - 1]\n if (current && current.label === item.groupLabel) {\n current.items.push(item)\n continue\n }\n runs.push({ label: item.groupLabel, items: [item] })\n }\n\n return runs\n}\n\nexport function Select<Item extends SelectItem>({\n items,\n placeholder,\n emptyLabel,\n usePortal = true,\n positioning,\n renderItem,\n renderTrigger,\n virtualized,\n rowHeight = 34,\n ...props\n}: SelectProps<Item>) {\n const uiLabels = useUiLabels()\n const collection = createListCollection({\n items,\n })\n const $dialogContent = useRef<HTMLDivElement | null>(null)\n\n const renderOption = (item: Item) => (\n <Fragment key={item.value}>\n <ConditionalWrapper\n key={item.value}\n when={!!item.tooltip}\n wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}\n >\n <Item key={item.value} item={item}>\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={props.multiple} />\n </Item>\n </ConditionalWrapper>\n {item.separatorAfter && (\n <div\n role=\"separator\"\n className={css({\n height: '1px',\n flexShrink: 0,\n backgroundColor: 'grey.100',\n marginY: 'space-4',\n marginX: 'space-8',\n })}\n />\n )}\n </Fragment>\n )\n\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"select\"\n {...props}\n ref={(node: HTMLDivElement | null) => {\n if (node) {\n $dialogContent.current = node.closest('[role=\"dialog\"]') as HTMLDivElement | null\n }\n }}\n >\n <Control>\n <Trigger>\n {renderTrigger ? (\n <CustomInnerTrigger\n renderTrigger={renderTrigger}\n placeholder={placeholder}\n allSelectedLabel={props.allSelectedLabel}\n />\n ) : (\n <DefaultInnerTrigger placeholder={placeholder} allSelectedLabel={props.allSelectedLabel} />\n )}\n <Indicator asChild>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z\"\n fill=\"currentColor\"\n />\n </svg>\n </Indicator>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal container={$dialogContent}>{children}</Portal>}>\n <Positioner>\n <Content>\n {items.length === 0 ? (\n <Text px=\"space-8\" textAlign=\"center\">\n {emptyLabel ?? uiLabels.noResults}\n </Text>\n ) : virtualized ? (\n <>\n <FixedSizeList\n height={Math.min(rowHeight * items.length, 180)}\n itemCount={items.length}\n itemSize={rowHeight}\n width=\"100%\"\n >\n {({ index, style }) => (\n <ConditionalWrapper\n key={items[index].value}\n when={!!items[index].tooltip}\n wrapper={children => <Tooltip label={items[index].tooltip}>{children}</Tooltip>}\n >\n <Item key={items[index].value} item={items[index]} style={style}>\n <CustomInnerItem renderItem={renderItem} item={items[index]} />\n </Item>\n </ConditionalWrapper>\n )}\n </FixedSizeList>\n </>\n ) : (\n toGroupRuns<Item>(items).map((run, runIndex) =>\n run.label === undefined ? (\n <Fragment key={`group-${runIndex}`}>{run.items.map(renderOption)}</Fragment>\n ) : (\n <ItemGroup key={`group-${runIndex}`}>\n <ItemGroupLabel>{run.label}</ItemGroupLabel>\n {run.items.map(renderOption)}\n </ItemGroup>\n ),\n )\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n <ArkSelect.HiddenSelect />\n </Root>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,IAAM,EAAE,iBAAc,mBAAgB,EAAmB,CAAM,GAGzD,IAAO,EAAa,EAAO,EAAU,IAAS,GAAG,QAAQ,EAC7D,cAAc,EACZ,WAAW,GACb,EACF,CAAC,GAEK,IAAe,EAAY,EAAO,EAAU,YAAY,GAAG,cAAc,GACzE,IAAU,EAAY,EAAO,EAAU,OAAO,GAAG,SAAS,GAC1D,IAAU,EAAY,EAAO,EAAU,OAAO,GAAG,SAAS,GAC1D,IAAY,EAAY,EAAO,EAAU,SAAS,GAAG,WAAW,GAChE,IAAO,EAAY,EAAO,EAAU,IAAI,GAAG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AAM,IAAI,CAAY,EAAY,GAA5D,SAAS,GAAmD,IAE3E,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UAAiB,EAAI,MAAsB,CAAA,GAC1C,EAAI,MAAM,IAAI,CAAY,CAClB,EAAA,GAHK,SAAS,GAGd,CAEf,EAEK,CAAA,EACC,CAAA;GACM,CAAA;GACpB,kBAAC,EAAU,cAAX,CAAyB,CAAA;EACrB;;AAEV"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../text/Text.cjs"),t=require("../popover/Popover.cjs"),n=require("./SupplierRatingBreakdown.cjs");let r=require("@stokelp/styled-system/jsx"),i=require("react"),a=require("react/jsx-runtime");function o(e){let t=e/5;return t>=.8?{bg:`#E6F3D9`,color:`#3B6D11`}:t>=.6?{bg:`#FBF1CC`,color:`#92750C`}:t>=.4?{bg:`#FDF0E0`,color:`#C2740C`}:{bg:`#FCEBEB`,color:`#A32D2D`}}function s({rating:s,responseRate:c,labels:l}){let[u,d]=(0,i.useState)(!1),f=(0,i.useRef)(null),p=(0,i.useCallback)(()=>{f.current&&=(clearTimeout(f.current),null)},[]),m=(0,i.useCallback)(()=>{p(),f.current=setTimeout(()=>d(!1),120)},[p]);(0,i.useEffect)(()=>p,[p]);let h=e=>{e.pointerType===`mouse`&&(p(),d(!0))},g=e=>{e.pointerType===`mouse`&&m()},_=s.insufficientData||s.overall==null,v=l?.insufficientData??n.DEFAULT_SUPPLIER_RATING_LABELS.insufficientData,y=_?{bg:`#F1F2F4`,color:`#5B6472`}:o(s.overall);return(0,a.jsxs)(t.Popover,{open:u,onOpenChange:e=>d(e.open),positioning:{placement:`top-end`,gutter:8},autoFocus:!1,restoreFocus:!1,lazyMount:!0,unmountOnExit:!0,children:[(0,a.jsx)(t.PopoverTrigger,{asChild:!0,children:(0,a.jsx)(r.Box,{display:`inline-flex`,alignItems:`center`,w:`fit-content`,maxW:`100%`,px:`space-8`,py:`space-2`,borderRadius:`full`,tabIndex:0,cursor:`default`,style:{backgroundColor:y.bg},onPointerEnter:h,onPointerLeave:g,onFocus:()=>{p(),d(!0)},onBlur:()=>d(!1),children:(0,a.jsx)(e.Text,{size:`sm`,bold:!0,whiteSpace:`nowrap`,style:{color:y.color},children:_?v:`${n.formatOverall(s.overall)} ★`})})}),(0,a.jsx)(t.PopoverContent,{className:`panda-preflight-enabled`,zIndex:1e4,p:`0`,bg:`transparent`,border:`none`,borderRadius:`radius-8`,boxShadow:`0px 8px 16px 4px #1624861A`,onPointerEnter:h,onPointerLeave:g,children:(0,a.jsx)(n.SupplierRatingBreakdown,{rating:s,responseRate:c,labels:l})})]})}exports.SupplierRatingBadge=s;
1
+ "use client";const e=require("../text/Text.cjs"),t=require("../ui-labels/UiLabelsProvider.cjs"),n=require("../popover/Popover.cjs"),r=require("./SupplierRatingBreakdown.cjs");let i=require("@stokelp/styled-system/jsx"),a=require("react"),o=require("react/jsx-runtime");function s(e){let t=e/5;return t>=.8?{bg:`#E6F3D9`,color:`#3B6D11`}:t>=.6?{bg:`#FBF1CC`,color:`#92750C`}:t>=.4?{bg:`#FDF0E0`,color:`#C2740C`}:{bg:`#FCEBEB`,color:`#A32D2D`}}function c({rating:c,responseRate:l,labels:u}){let[d,f]=(0,a.useState)(!1),p=(0,a.useRef)(null),m=(0,a.useCallback)(()=>{p.current&&=(clearTimeout(p.current),null)},[]),h=(0,a.useCallback)(()=>{m(),p.current=setTimeout(()=>f(!1),120)},[m]);(0,a.useEffect)(()=>m,[m]);let g=e=>{e.pointerType===`mouse`&&(m(),f(!0))},_=e=>{e.pointerType===`mouse`&&h()},v=c.insufficientData||c.overall==null,y=t.useUiLabels(),b=u?.insufficientData??y.supplierRating.insufficientData,x=v?{bg:`#F1F2F4`,color:`#5B6472`}:s(c.overall);return(0,o.jsxs)(n.Popover,{open:d,onOpenChange:e=>f(e.open),positioning:{placement:`top-end`,gutter:8},autoFocus:!1,restoreFocus:!1,lazyMount:!0,unmountOnExit:!0,children:[(0,o.jsx)(n.PopoverTrigger,{asChild:!0,children:(0,o.jsx)(i.Box,{display:`inline-flex`,alignItems:`center`,w:`fit-content`,maxW:`100%`,px:`space-8`,py:`space-2`,borderRadius:`full`,tabIndex:0,cursor:`default`,style:{backgroundColor:x.bg},onPointerEnter:g,onPointerLeave:_,onFocus:()=>{m(),f(!0)},onBlur:()=>f(!1),children:(0,o.jsx)(e.Text,{size:`sm`,bold:!0,whiteSpace:`nowrap`,style:{color:x.color},children:v?b:`${r.formatOverall(c.overall,y.locale)} ★`})})}),(0,o.jsx)(n.PopoverContent,{className:`panda-preflight-enabled`,zIndex:1e4,p:`0`,bg:`transparent`,border:`none`,borderRadius:`radius-8`,boxShadow:`0px 8px 16px 4px #1624861A`,onPointerEnter:g,onPointerLeave:_,children:(0,o.jsx)(r.SupplierRatingBreakdown,{rating:c,responseRate:l,labels:u})})]})}exports.SupplierRatingBadge=c;
2
2
  //# sourceMappingURL=SupplierRatingBadge.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"SupplierRatingBadge.cjs","names":[],"sources":["../../../src/components/supplier-rating-badge/SupplierRatingBadge.tsx"],"sourcesContent":["import { Box } from '@stokelp/styled-system/jsx'\nimport { PointerEvent, useCallback, useEffect, useRef, useState } from 'react'\n\nimport { Popover, PopoverContent, PopoverTrigger, Text } from '~/components'\n\nimport {\n DEFAULT_SUPPLIER_RATING_LABELS,\n formatOverall,\n SUPPLIER_RATING_MAX,\n SupplierRatingBreakdown,\n type SupplierRating,\n type SupplierRatingLabels,\n} from './SupplierRatingBreakdown'\n\nexport type SupplierRatingBadgeProps = {\n rating: SupplierRating\n /** Optional original response rate (0..100) reminded inside the breakdown. */\n responseRate?: number\n labels?: Partial<SupplierRatingLabels>\n}\n\nfunction getBadgeColors(overall: number): { bg: string; color: string } {\n const ratio = overall / SUPPLIER_RATING_MAX\n if (ratio >= 0.8) return { bg: '#E6F3D9', color: '#3B6D11' }\n if (ratio >= 0.6) return { bg: '#FBF1CC', color: '#92750C' }\n if (ratio >= 0.4) return { bg: '#FDF0E0', color: '#C2740C' }\n return { bg: '#FCEBEB', color: '#A32D2D' }\n}\n\n/** Compact supplier-rating pill (note /5) with an accessible, keyboard-openable breakdown popover. */\nexport function SupplierRatingBadge({ rating, responseRate, labels }: SupplierRatingBadgeProps) {\n const [open, setOpen] = useState(false)\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current)\n closeTimer.current = null\n }\n }, [])\n\n const scheduleClose = useCallback(() => {\n cancelClose()\n closeTimer.current = setTimeout(() => setOpen(false), 120)\n }, [cancelClose])\n\n useEffect(() => cancelClose, [cancelClose])\n\n const openOnMouse = (e: PointerEvent) => {\n if (e.pointerType !== 'mouse') return\n cancelClose()\n setOpen(true)\n }\n const closeOnMouse = (e: PointerEvent) => {\n if (e.pointerType !== 'mouse') return\n scheduleClose()\n }\n\n const insufficient = rating.insufficientData || rating.overall == null\n const insufficientLabel = labels?.insufficientData ?? DEFAULT_SUPPLIER_RATING_LABELS.insufficientData\n const colors = insufficient ? { bg: '#F1F2F4', color: '#5B6472' } : getBadgeColors(rating.overall as number)\n\n return (\n <Popover\n open={open}\n onOpenChange={e => setOpen(e.open)}\n positioning={{ placement: 'top-end', gutter: 8 }}\n autoFocus={false}\n restoreFocus={false}\n lazyMount\n unmountOnExit\n >\n <PopoverTrigger asChild>\n <Box\n display=\"inline-flex\"\n alignItems=\"center\"\n w=\"fit-content\"\n maxW=\"100%\"\n px=\"space-8\"\n py=\"space-2\"\n borderRadius=\"full\"\n tabIndex={0}\n cursor=\"default\"\n style={{ backgroundColor: colors.bg }}\n onPointerEnter={openOnMouse}\n onPointerLeave={closeOnMouse}\n onFocus={() => {\n cancelClose()\n setOpen(true)\n }}\n onBlur={() => setOpen(false)}\n >\n <Text size=\"sm\" bold whiteSpace=\"nowrap\" style={{ color: colors.color }}>\n {insufficient ? insufficientLabel : `${formatOverall(rating.overall as number)} ★`}\n </Text>\n </Box>\n </PopoverTrigger>\n <PopoverContent\n className=\"panda-preflight-enabled\"\n zIndex={10000}\n p=\"0\"\n bg=\"transparent\"\n border=\"none\"\n borderRadius=\"radius-8\"\n boxShadow=\"0px 8px 16px 4px #1624861A\"\n onPointerEnter={openOnMouse}\n onPointerLeave={closeOnMouse}\n >\n <SupplierRatingBreakdown rating={rating} responseRate={responseRate} labels={labels} />\n </PopoverContent>\n </Popover>\n )\n}\n"],"mappings":"8NAqBA,SAAS,EAAe,EAAgD,CACtE,IAAM,EAAQ,EAAA,EAId,OAHI,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACvD,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACvD,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACpD,CAAE,GAAI,UAAW,MAAO,SAAU,CAC3C,CAGA,SAAgB,EAAoB,CAAE,SAAQ,eAAc,UAAoC,CAC9F,GAAM,CAAC,EAAM,IAAA,EAAA,EAAA,UAAoB,EAAK,EAChC,GAAA,EAAA,EAAA,QAA0D,IAAI,EAE9D,GAAA,EAAA,EAAA,iBAAgC,CACpC,AAEE,EAAW,WADX,aAAa,EAAW,OAAO,EACV,KAEzB,EAAG,CAAC,CAAC,EAEC,GAAA,EAAA,EAAA,iBAAkC,CACtC,EAAY,EACZ,EAAW,QAAU,eAAiB,EAAQ,EAAK,EAAG,GAAG,CAC3D,EAAG,CAAC,CAAW,CAAC,GAEhB,EAAA,EAAA,eAAgB,EAAa,CAAC,CAAW,CAAC,EAE1C,IAAM,EAAe,GAAoB,CACnC,EAAE,cAAgB,UACtB,EAAY,EACZ,EAAQ,EAAI,EACd,EACM,EAAgB,GAAoB,CACpC,EAAE,cAAgB,SACtB,EAAc,CAChB,EAEM,EAAe,EAAO,kBAAoB,EAAO,SAAW,KAC5D,EAAoB,GAAQ,kBAAoB,EAAA,+BAA+B,iBAC/E,EAAS,EAAe,CAAE,GAAI,UAAW,MAAO,SAAU,EAAI,EAAe,EAAO,OAAiB,EAE3G,OACE,EAAA,EAAA,MAAC,EAAA,QAAD,CACQ,OACN,aAAc,GAAK,EAAQ,EAAE,IAAI,EACjC,YAAa,CAAE,UAAW,UAAW,OAAQ,CAAE,EAC/C,UAAW,GACX,aAAc,GACd,UAAA,GACA,cAAA,YAPF,EASE,EAAA,EAAA,KAAC,EAAA,eAAD,CAAgB,QAAA,aACd,EAAA,EAAA,KAAC,EAAA,IAAD,CACE,QAAQ,cACR,WAAW,SACX,EAAE,cACF,KAAK,OACL,GAAG,UACH,GAAG,UACH,aAAa,OACb,SAAU,EACV,OAAO,UACP,MAAO,CAAE,gBAAiB,EAAO,EAAG,EACpC,eAAgB,EAChB,eAAgB,EAChB,YAAe,CACb,EAAY,EACZ,EAAQ,EAAI,CACd,EACA,WAAc,EAAQ,EAAK,YAE3B,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,KAAK,KAAK,KAAA,GAAK,WAAW,SAAS,MAAO,CAAE,MAAO,EAAO,KAAM,WACnE,EAAe,EAAoB,GAAG,EAAA,cAAc,EAAO,OAAiB,EAAE,GAC3E,CAAA,CACH,CAAA,CACS,CAAA,GAChB,EAAA,EAAA,KAAC,EAAA,eAAD,CACE,UAAU,0BACV,OAAQ,IACR,EAAE,IACF,GAAG,cACH,OAAO,OACP,aAAa,WACb,UAAU,6BACV,eAAgB,EAChB,eAAgB,YAEhB,EAAA,EAAA,KAAC,EAAA,wBAAD,CAAiC,SAAsB,eAAsB,QAAS,CAAA,CACxE,CAAA,CACT,GAEb"}
1
+ {"version":3,"file":"SupplierRatingBadge.cjs","names":[],"sources":["../../../src/components/supplier-rating-badge/SupplierRatingBadge.tsx"],"sourcesContent":["import { Box } from '@stokelp/styled-system/jsx'\nimport { PointerEvent, useCallback, useEffect, useRef, useState } from 'react'\n\nimport { Popover, PopoverContent, PopoverTrigger, Text } from '~/components'\n\nimport {\n formatOverall,\n SUPPLIER_RATING_MAX,\n SupplierRatingBreakdown,\n type SupplierRating,\n type SupplierRatingLabels,\n} from './SupplierRatingBreakdown'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\n\nexport type SupplierRatingBadgeProps = {\n rating: SupplierRating\n /** Optional original response rate (0..100) reminded inside the breakdown. */\n responseRate?: number\n labels?: Partial<SupplierRatingLabels>\n}\n\nfunction getBadgeColors(overall: number): { bg: string; color: string } {\n const ratio = overall / SUPPLIER_RATING_MAX\n if (ratio >= 0.8) return { bg: '#E6F3D9', color: '#3B6D11' }\n if (ratio >= 0.6) return { bg: '#FBF1CC', color: '#92750C' }\n if (ratio >= 0.4) return { bg: '#FDF0E0', color: '#C2740C' }\n return { bg: '#FCEBEB', color: '#A32D2D' }\n}\n\n/** Compact supplier-rating pill (note /5) with an accessible, keyboard-openable breakdown popover. */\nexport function SupplierRatingBadge({ rating, responseRate, labels }: SupplierRatingBadgeProps) {\n const [open, setOpen] = useState(false)\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current)\n closeTimer.current = null\n }\n }, [])\n\n const scheduleClose = useCallback(() => {\n cancelClose()\n closeTimer.current = setTimeout(() => setOpen(false), 120)\n }, [cancelClose])\n\n useEffect(() => cancelClose, [cancelClose])\n\n const openOnMouse = (e: PointerEvent) => {\n if (e.pointerType !== 'mouse') return\n cancelClose()\n setOpen(true)\n }\n const closeOnMouse = (e: PointerEvent) => {\n if (e.pointerType !== 'mouse') return\n scheduleClose()\n }\n\n const insufficient = rating.insufficientData || rating.overall == null\n const uiLabels = useUiLabels()\n const insufficientLabel = labels?.insufficientData ?? uiLabels.supplierRating.insufficientData\n const colors = insufficient ? { bg: '#F1F2F4', color: '#5B6472' } : getBadgeColors(rating.overall as number)\n\n return (\n <Popover\n open={open}\n onOpenChange={e => setOpen(e.open)}\n positioning={{ placement: 'top-end', gutter: 8 }}\n autoFocus={false}\n restoreFocus={false}\n lazyMount\n unmountOnExit\n >\n <PopoverTrigger asChild>\n <Box\n display=\"inline-flex\"\n alignItems=\"center\"\n w=\"fit-content\"\n maxW=\"100%\"\n px=\"space-8\"\n py=\"space-2\"\n borderRadius=\"full\"\n tabIndex={0}\n cursor=\"default\"\n style={{ backgroundColor: colors.bg }}\n onPointerEnter={openOnMouse}\n onPointerLeave={closeOnMouse}\n onFocus={() => {\n cancelClose()\n setOpen(true)\n }}\n onBlur={() => setOpen(false)}\n >\n <Text size=\"sm\" bold whiteSpace=\"nowrap\" style={{ color: colors.color }}>\n {insufficient ? insufficientLabel : `${formatOverall(rating.overall as number, uiLabels.locale)} ★`}\n </Text>\n </Box>\n </PopoverTrigger>\n <PopoverContent\n className=\"panda-preflight-enabled\"\n zIndex={10000}\n p=\"0\"\n bg=\"transparent\"\n border=\"none\"\n borderRadius=\"radius-8\"\n boxShadow=\"0px 8px 16px 4px #1624861A\"\n onPointerEnter={openOnMouse}\n onPointerLeave={closeOnMouse}\n >\n <SupplierRatingBreakdown rating={rating} responseRate={responseRate} labels={labels} />\n </PopoverContent>\n </Popover>\n )\n}\n"],"mappings":"6QAqBA,SAAS,EAAe,EAAgD,CACtE,IAAM,EAAQ,EAAA,EAId,OAHI,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACvD,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACvD,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACpD,CAAE,GAAI,UAAW,MAAO,SAAU,CAC3C,CAGA,SAAgB,EAAoB,CAAE,SAAQ,eAAc,UAAoC,CAC9F,GAAM,CAAC,EAAM,IAAA,EAAA,EAAA,UAAoB,EAAK,EAChC,GAAA,EAAA,EAAA,QAA0D,IAAI,EAE9D,GAAA,EAAA,EAAA,iBAAgC,CACpC,AAEE,EAAW,WADX,aAAa,EAAW,OAAO,EACV,KAEzB,EAAG,CAAC,CAAC,EAEC,GAAA,EAAA,EAAA,iBAAkC,CACtC,EAAY,EACZ,EAAW,QAAU,eAAiB,EAAQ,EA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UAAU,6BACV,eAAgB,EAChB,eAAgB,YAEhB,EAAA,EAAA,KAAC,EAAA,wBAAD,CAAiC,SAAsB,eAAsB,QAAS,CAAA,CACxE,CAAA,CACT,GAEb"}
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import { Text as e } from "../text/Text.js";
3
- import { Popover as t, PopoverContent as n, PopoverTrigger as r } from "../popover/Popover.js";
4
- import { DEFAULT_SUPPLIER_RATING_LABELS as i, SupplierRatingBreakdown as a, formatOverall as o } from "./SupplierRatingBreakdown.js";
3
+ import { useUiLabels as t } from "../ui-labels/UiLabelsProvider.js";
4
+ import { Popover as n, PopoverContent as r, PopoverTrigger as i } from "../popover/Popover.js";
5
+ import { SupplierRatingBreakdown as a, formatOverall as o } from "./SupplierRatingBreakdown.js";
5
6
  import { Box as s } from "@stokelp/styled-system/jsx";
6
7
  import { useCallback as c, useEffect as l, useRef as u, useState as d } from "react";
7
8
  import { jsx as f, jsxs as p } from "react/jsx-runtime";
@@ -33,11 +34,11 @@ function h({ rating: h, responseRate: g, labels: _ }) {
33
34
  e.pointerType === "mouse" && (x(), y(!0));
34
35
  }, w = (e) => {
35
36
  e.pointerType === "mouse" && S();
36
- }, T = h.insufficientData || h.overall == null, E = _?.insufficientData ?? i.insufficientData, D = T ? {
37
+ }, T = h.insufficientData || h.overall == null, E = t(), D = _?.insufficientData ?? E.supplierRating.insufficientData, O = T ? {
37
38
  bg: "#F1F2F4",
38
39
  color: "#5B6472"
39
40
  } : m(h.overall);
40
- return /* @__PURE__ */ p(t, {
41
+ return /* @__PURE__ */ p(n, {
41
42
  open: v,
42
43
  onOpenChange: (e) => y(e.open),
43
44
  positioning: {
@@ -48,7 +49,7 @@ function h({ rating: h, responseRate: g, labels: _ }) {
48
49
  restoreFocus: !1,
49
50
  lazyMount: !0,
50
51
  unmountOnExit: !0,
51
- children: [/* @__PURE__ */ f(r, {
52
+ children: [/* @__PURE__ */ f(i, {
52
53
  asChild: !0,
53
54
  children: /* @__PURE__ */ f(s, {
54
55
  display: "inline-flex",
@@ -60,7 +61,7 @@ function h({ rating: h, responseRate: g, labels: _ }) {
60
61
  borderRadius: "full",
61
62
  tabIndex: 0,
62
63
  cursor: "default",
63
- style: { backgroundColor: D.bg },
64
+ style: { backgroundColor: O.bg },
64
65
  onPointerEnter: C,
65
66
  onPointerLeave: w,
66
67
  onFocus: () => {
@@ -71,11 +72,11 @@ function h({ rating: h, responseRate: g, labels: _ }) {
71
72
  size: "sm",
72
73
  bold: !0,
73
74
  whiteSpace: "nowrap",
74
- style: { color: D.color },
75
- children: T ? E : `${o(h.overall)} ★`
75
+ style: { color: O.color },
76
+ children: T ? D : `${o(h.overall, E.locale)} ★`
76
77
  })
77
78
  })
78
- }), /* @__PURE__ */ f(n, {
79
+ }), /* @__PURE__ */ f(r, {
79
80
  className: "panda-preflight-enabled",
80
81
  zIndex: 1e4,
81
82
  p: "0",
@@ -1 +1 @@
1
- {"version":3,"file":"SupplierRatingBadge.js","names":[],"sources":["../../../src/components/supplier-rating-badge/SupplierRatingBadge.tsx"],"sourcesContent":["import { Box } from '@stokelp/styled-system/jsx'\nimport { PointerEvent, useCallback, useEffect, useRef, useState } from 'react'\n\nimport { Popover, PopoverContent, PopoverTrigger, Text } from '~/components'\n\nimport {\n DEFAULT_SUPPLIER_RATING_LABELS,\n formatOverall,\n SUPPLIER_RATING_MAX,\n SupplierRatingBreakdown,\n type SupplierRating,\n type SupplierRatingLabels,\n} from './SupplierRatingBreakdown'\n\nexport type SupplierRatingBadgeProps = {\n rating: SupplierRating\n /** Optional original response rate (0..100) reminded inside the breakdown. */\n responseRate?: number\n labels?: Partial<SupplierRatingLabels>\n}\n\nfunction getBadgeColors(overall: number): { bg: string; color: string } {\n const ratio = overall / SUPPLIER_RATING_MAX\n if (ratio >= 0.8) return { bg: '#E6F3D9', color: '#3B6D11' }\n if (ratio >= 0.6) return { bg: '#FBF1CC', color: '#92750C' }\n if (ratio >= 0.4) return { bg: '#FDF0E0', color: '#C2740C' }\n return { bg: '#FCEBEB', color: '#A32D2D' }\n}\n\n/** Compact supplier-rating pill (note /5) with an accessible, keyboard-openable breakdown popover. */\nexport function SupplierRatingBadge({ rating, responseRate, labels }: SupplierRatingBadgeProps) {\n const [open, setOpen] = useState(false)\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current)\n closeTimer.current = null\n }\n }, [])\n\n const scheduleClose = useCallback(() => {\n cancelClose()\n closeTimer.current = setTimeout(() => setOpen(false), 120)\n }, [cancelClose])\n\n useEffect(() => cancelClose, [cancelClose])\n\n const openOnMouse = (e: PointerEvent) => {\n if (e.pointerType !== 'mouse') return\n cancelClose()\n setOpen(true)\n }\n const closeOnMouse = (e: PointerEvent) => {\n if (e.pointerType !== 'mouse') return\n scheduleClose()\n }\n\n const insufficient = rating.insufficientData || rating.overall == null\n const insufficientLabel = labels?.insufficientData ?? DEFAULT_SUPPLIER_RATING_LABELS.insufficientData\n const colors = insufficient ? { bg: '#F1F2F4', color: '#5B6472' } : getBadgeColors(rating.overall as number)\n\n return (\n <Popover\n open={open}\n onOpenChange={e => setOpen(e.open)}\n positioning={{ placement: 'top-end', gutter: 8 }}\n autoFocus={false}\n restoreFocus={false}\n lazyMount\n unmountOnExit\n >\n <PopoverTrigger asChild>\n <Box\n display=\"inline-flex\"\n alignItems=\"center\"\n w=\"fit-content\"\n maxW=\"100%\"\n px=\"space-8\"\n py=\"space-2\"\n borderRadius=\"full\"\n tabIndex={0}\n cursor=\"default\"\n style={{ backgroundColor: colors.bg }}\n onPointerEnter={openOnMouse}\n onPointerLeave={closeOnMouse}\n onFocus={() => {\n cancelClose()\n setOpen(true)\n }}\n onBlur={() => setOpen(false)}\n >\n <Text size=\"sm\" bold whiteSpace=\"nowrap\" style={{ color: colors.color }}>\n {insufficient ? insufficientLabel : `${formatOverall(rating.overall as number)} ★`}\n </Text>\n </Box>\n </PopoverTrigger>\n <PopoverContent\n className=\"panda-preflight-enabled\"\n zIndex={10000}\n p=\"0\"\n bg=\"transparent\"\n border=\"none\"\n borderRadius=\"radius-8\"\n boxShadow=\"0px 8px 16px 4px #1624861A\"\n onPointerEnter={openOnMouse}\n onPointerLeave={closeOnMouse}\n >\n <SupplierRatingBreakdown rating={rating} responseRate={responseRate} labels={labels} />\n </PopoverContent>\n </Popover>\n )\n}\n"],"mappings":";;;;;;;;AAqBA,SAAS,EAAe,GAAgD;CACtE,IAAM,IAAQ,IAAA;CAId,OAHI,KAAS,KAAY;EAAE,IAAI;EAAW,OAAO;CAAU,IACvD,KAAS,KAAY;EAAE,IAAI;EAAW,OAAO;CAAU,IACvD,KAAS,KAAY;EAAE,IAAI;EAAW,OAAO;CAAU,IACpD;EAAE,IAAI;EAAW,OAAO;CAAU;AAC3C;AAGA,SAAgB,EAAoB,EAAE,WAAQ,iBAAc,aAAoC;CAC9F,IAAM,CAAC,GAAM,KAAW,EAAS,EAAK,GAChC,IAAa,EAA6C,IAAI,GAE9D,IAAc,QAAkB;EACpC,AAEE,EAAW,aADX,aAAa,EAAW,OAAO,GACV;CAEzB,GAAG,CAAC,CAAC,GAEC,IAAgB,QAAkB;EAEtC,AADA,EAAY,GACZ,EAAW,UAAU,iBAAiB,EAAQ,EAAK,GAAG,GAAG;CAC3D,GAAG,CAAC,CAAW,CAAC;CAEhB,QAAgB,GAAa,CAAC,CAAW,CAAC;CAE1C,IAAM,KAAe,MAAoB;EACnC,EAAE,gBAAgB,YACtB,EAAY,GACZ,EAAQ,EAAI;CACd,GACM,KAAgB,MAAoB;EACpC,EAAE,gBAAgB,WACtB,EAAc;CAChB,GAEM,IAAe,EAAO,oBAAoB,EAAO,WAAW,MAC5D,IAAoB,GAAQ,oBAAoB,EAA+B,kBAC/E,IAAS,IAAe;EAAE,IAAI;EAAW,OAAO;CAAU,IAAI,EAAe,EAAO,OAAiB;CAE3G,OACE,kBAAC,GAAD;EACQ;EACN,eAAc,MAAK,EAAQ,EAAE,IAAI;EACjC,aAAa;GAAE,WAAW;GAAW,QAAQ;EAAE;EAC/C,WAAW;EACX,cAAc;EACd,WAAA;EACA,eAAA;YAPF,CASE,kBAAC,GAAD;GAAgB,SAAA;aACd,kBAAC,GAAD;IACE,SAAQ;IACR,YAAW;IACX,GAAE;IACF,MAAK;IACL,IAAG;IACH,IAAG;IACH,cAAa;IACb,UAAU;IACV,QAAO;IACP,OAAO,EAAE,iBAAiB,EAAO,GAAG;IACpC,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;KAEb,AADA,EAAY,GACZ,EAAQ,EAAI;IACd;IACA,cAAc,EAAQ,EAAK;cAE3B,kBAAC,GAAD;KAAM,MAAK;KAAK,MAAA;KAAK,YAAW;KAAS,OAAO,EAAE,OAAO,EAAO,MAAM;eACnE,IAAe,IAAoB,GAAG,EAAc,EAAO,OAAiB,EAAE;IAC3E,CAAA;GACH,CAAA;EACS,CAAA,GAChB,kBAAC,GAAD;GACE,WAAU;GACV,QAAQ;GACR,GAAE;GACF,IAAG;GACH,QAAO;GACP,cAAa;GACb,WAAU;GACV,gBAAgB;GAChB,gBAAgB;aAEhB,kBAAC,GAAD;IAAiC;IAAsB;IAAsB;GAAS,CAAA;EACxE,CAAA,CACT;;AAEb"}
1
+ {"version":3,"file":"SupplierRatingBadge.js","names":[],"sources":["../../../src/components/supplier-rating-badge/SupplierRatingBadge.tsx"],"sourcesContent":["import { Box } from '@stokelp/styled-system/jsx'\nimport { PointerEvent, useCallback, useEffect, useRef, useState } from 'react'\n\nimport { Popover, PopoverContent, PopoverTrigger, Text } from '~/components'\n\nimport {\n formatOverall,\n SUPPLIER_RATING_MAX,\n SupplierRatingBreakdown,\n type SupplierRating,\n type SupplierRatingLabels,\n} from './SupplierRatingBreakdown'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\n\nexport type SupplierRatingBadgeProps = {\n rating: SupplierRating\n /** Optional original response rate (0..100) reminded inside the breakdown. */\n responseRate?: number\n labels?: Partial<SupplierRatingLabels>\n}\n\nfunction getBadgeColors(overall: number): { bg: string; color: string } {\n const ratio = overall / SUPPLIER_RATING_MAX\n if (ratio >= 0.8) return { bg: '#E6F3D9', color: '#3B6D11' }\n if (ratio >= 0.6) return { bg: '#FBF1CC', color: '#92750C' }\n if (ratio >= 0.4) return { bg: '#FDF0E0', color: '#C2740C' }\n return { bg: '#FCEBEB', color: '#A32D2D' }\n}\n\n/** Compact supplier-rating pill (note /5) with an accessible, keyboard-openable breakdown popover. */\nexport function SupplierRatingBadge({ rating, responseRate, labels }: SupplierRatingBadgeProps) {\n const [open, setOpen] = useState(false)\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current)\n closeTimer.current = null\n }\n }, [])\n\n const scheduleClose = useCallback(() => {\n cancelClose()\n closeTimer.current = setTimeout(() => setOpen(false), 120)\n }, [cancelClose])\n\n useEffect(() => cancelClose, [cancelClose])\n\n const openOnMouse = (e: PointerEvent) => {\n if (e.pointerType !== 'mouse') return\n cancelClose()\n setOpen(true)\n }\n const closeOnMouse = (e: PointerEvent) => {\n if (e.pointerType !== 'mouse') return\n scheduleClose()\n }\n\n const insufficient = rating.insufficientData || rating.overall == null\n const uiLabels = useUiLabels()\n const insufficientLabel = labels?.insufficientData ?? uiLabels.supplierRating.insufficientData\n const colors = insufficient ? { bg: '#F1F2F4', color: '#5B6472' } : getBadgeColors(rating.overall as number)\n\n return (\n <Popover\n open={open}\n onOpenChange={e => setOpen(e.open)}\n positioning={{ placement: 'top-end', gutter: 8 }}\n autoFocus={false}\n restoreFocus={false}\n lazyMount\n unmountOnExit\n >\n <PopoverTrigger asChild>\n <Box\n display=\"inline-flex\"\n alignItems=\"center\"\n w=\"fit-content\"\n maxW=\"100%\"\n px=\"space-8\"\n py=\"space-2\"\n borderRadius=\"full\"\n tabIndex={0}\n cursor=\"default\"\n style={{ backgroundColor: colors.bg }}\n onPointerEnter={openOnMouse}\n onPointerLeave={closeOnMouse}\n onFocus={() => {\n cancelClose()\n setOpen(true)\n }}\n onBlur={() => setOpen(false)}\n >\n <Text size=\"sm\" bold whiteSpace=\"nowrap\" style={{ color: colors.color }}>\n {insufficient ? insufficientLabel : `${formatOverall(rating.overall as number, uiLabels.locale)} ★`}\n </Text>\n </Box>\n </PopoverTrigger>\n <PopoverContent\n className=\"panda-preflight-enabled\"\n zIndex={10000}\n p=\"0\"\n bg=\"transparent\"\n border=\"none\"\n borderRadius=\"radius-8\"\n boxShadow=\"0px 8px 16px 4px #1624861A\"\n onPointerEnter={openOnMouse}\n onPointerLeave={closeOnMouse}\n >\n <SupplierRatingBreakdown rating={rating} responseRate={responseRate} labels={labels} />\n </PopoverContent>\n </Popover>\n )\n}\n"],"mappings":";;;;;;;;;AAqBA,SAAS,EAAe,GAAgD;CACtE,IAAM,IAAQ,IAAA;CAId,OAHI,KAAS,KAAY;EAAE,IAAI;EAAW,OAAO;CAAU,IACvD,KAAS,KAAY;EAAE,IAAI;EAAW,OAAO;CAAU,IACvD,KAAS,KAAY;EAAE,IAAI;EAAW,OAAO;CAAU,IACpD;EAAE,IAAI;EAAW,OAAO;CAAU;AAC3C;AAGA,SAAgB,EAAoB,EAAE,WAAQ,iBAAc,aAAoC;CAC9F,IAAM,CAAC,GAAM,KAAW,EAAS,EAAK,GAChC,IAAa,EAA6C,IAAI,GAE9D,IAAc,QAAkB;EACpC,AAEE,EAAW,aADX,aAAa,EAAW,OAAO,GACV;CAEzB,GAAG,CAAC,CAAC,GAEC,IAAgB,QAAkB;EAEtC,AADA,EAAY,GACZ,EAAW,UAAU,iBAAiB,EAAQ,EAAK,GAAG,GAAG;CAC3D,GAAG,CAAC,CAAW,CAAC;CAEhB,QAAgB,GAAa,CAAC,CAAW,CAAC;CAE1C,IAAM,KAAe,MAAoB;EACnC,EAAE,gBAAgB,YACtB,EAAY,GACZ,EAAQ,EAAI;CACd,GACM,KAAgB,MAAoB;EACpC,EAAE,gBAAgB,WACtB,EAAc;CAChB,GAEM,IAAe,EAAO,oBAAoB,EAAO,WAAW,MAC5D,IAAW,EAAY,GACvB,IAAoB,GAAQ,oBAAoB,EAAS,eAAe,kBACxE,IAAS,IAAe;EAAE,IAAI;EAAW,OAAO;CAAU,IAAI,EAAe,EAAO,OAAiB;CAE3G,OACE,kBAAC,GAAD;EACQ;EACN,eAAc,MAAK,EAAQ,EAAE,IAAI;EACjC,aAAa;GAAE,WAAW;GAAW,QAAQ;EAAE;EAC/C,WAAW;EACX,cAAc;EACd,WAAA;EACA,eAAA;YAPF,CASE,kBAAC,GAAD;GAAgB,SAAA;aACd,kBAAC,GAAD;IACE,SAAQ;IACR,YAAW;IACX,GAAE;IACF,MAAK;IACL,IAAG;IACH,IAAG;IACH,cAAa;IACb,UAAU;IACV,QAAO;IACP,OAAO,EAAE,iBAAiB,EAAO,GAAG;IACpC,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;KAEb,AADA,EAAY,GACZ,EAAQ,EAAI;IACd;IACA,cAAc,EAAQ,EAAK;cAE3B,kBAAC,GAAD;KAAM,MAAK;KAAK,MAAA;KAAK,YAAW;KAAS,OAAO,EAAE,OAAO,EAAO,MAAM;eACnE,IAAe,IAAoB,GAAG,EAAc,EAAO,SAAmB,EAAS,MAAM,EAAE;IAC5F,CAAA;GACH,CAAA;EACS,CAAA,GAChB,kBAAC,GAAD;GACE,WAAU;GACV,QAAQ;GACR,GAAE;GACF,IAAG;GACH,QAAO;GACP,cAAa;GACb,WAAU;GACV,gBAAgB;GAChB,gBAAgB;aAEhB,kBAAC,GAAD;IAAiC;IAAsB;IAAsB;GAAS,CAAA;EACxE,CAAA,CACT;;AAEb"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../text/Text.cjs"),t=require("../icon/Icon.cjs"),n=require("../../node_modules/.pnpm/@heroicons_react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/outline/esm/CheckCircleIcon.cjs"),r=require("../../node_modules/.pnpm/@heroicons_react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/outline/esm/XCircleIcon.cjs");let i=require("@stokelp/styled-system/jsx"),a=require("react/jsx-runtime");var o=5,s={title:`Note fournisseur`,insufficientData:`Non noté`,componentsTitle:`Détail de la note`,completionTitle:`Complétion du compte`,notAvailable:`—`,units:{minutes:`min`,hours:`h`,days:`j`},components:{responseRate:`Taux de réponse`,responseDelay:`Délai de réponse`,completion:`Complétion du compte`},completion:{profile:`Profil (photo et description)`,location:`Localisation`,contacts:`Contact`,legalBanking:`Coordonnées légales et bancaires`,sector:`Secteur d'activité`,certificate:`Certificat`}},c=[`profile`,`location`,`contacts`,`legalBanking`,`sector`,`certificate`];function l(e){return e.toFixed(1).replace(`.`,`,`)}function u(e,t){if(e<60)return`${Math.round(e)} ${t.minutes}`;let n=e/60;return n<48?`${Math.round(n)} ${t.hours}`:`${(n/24).toFixed(1).replace(`.`,`,`)} ${t.days}`}function d(e){let t=e/5;return t>=.7?`#3B6D11`:t>=.4?`#854F0B`:`#A32D2D`}function f(e){return e>=70?`#639922`:e>=40?`#BA7517`:`#E24B4A`}var p=({rating:o,responseRate:p,labels:m})=>{let h={...s,...m,units:{...s.units,...m?.units},components:{...s.components,...m?.components},completion:{...s.completion,...m?.completion}},g=p!=null,_=o.responseDelayMinutes!=null,v=o.responseDelayScore==null?null:Math.round(o.responseDelayScore*100),y=Math.round(o.completionScore*100),b=[{key:`responseRate`,value:g?`${Math.round(p)} %`:h.notAvailable,barPercent:g?Math.round(p):null,color:g?f(Math.round(p)):void 0},{key:`responseDelay`,value:_?u(o.responseDelayMinutes,h.units):h.notAvailable,barPercent:v,color:v==null?void 0:f(v)},{key:`completion`,value:`${y} %`,barPercent:y,color:f(y)}];return(0,a.jsxs)(i.Box,{bg:`white`,borderRadius:`radius-8`,p:`space-16`,minW:`240px`,maxW:`260px`,css:{"& *":{fontFamily:`inherit`}},children:[(0,a.jsxs)(i.HStack,{justify:`space-between`,alignItems:`baseline`,mb:`space-8`,children:[(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.md`,fontWeight:`bold`,children:h.title}),o.insufficientData||o.overall==null?(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`medium`,color:`grey.400`,children:h.insufficientData}):(0,a.jsxs)(e.Text,{as:`span`,fontSize:`body.lg`,fontWeight:`medium`,style:{color:d(o.overall)},children:[l(o.overall),` / `,5,` ★`]})]}),(0,a.jsx)(i.Box,{h:`1px`,bg:`grey.100`,mb:`space-8`}),(0,a.jsxs)(i.VStack,{alignItems:`stretch`,gap:`space-8`,mb:`space-8`,children:[(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`bold`,color:`grey.400`,children:h.componentsTitle}),b.map(t=>(0,a.jsxs)(i.VStack,{alignItems:`stretch`,gap:`space-2`,children:[(0,a.jsxs)(i.HStack,{justify:`space-between`,alignItems:`baseline`,gap:`space-8`,children:[(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,color:`grey.500`,children:h.components[t.key]}),(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`medium`,whiteSpace:`nowrap`,style:{color:t.color},color:t.color?void 0:`grey.300`,children:t.value})]}),(0,a.jsx)(i.Box,{h:`3px`,bg:`grey.100`,borderRadius:`full`,overflow:`hidden`,children:(0,a.jsx)(i.Box,{h:`100%`,borderRadius:`full`,style:{width:t.barPercent==null?`0%`:`${t.barPercent}%`,background:t.color??`transparent`}})})]},t.key))]}),(0,a.jsx)(i.Box,{h:`1px`,bg:`grey.100`,mb:`space-8`}),(0,a.jsxs)(i.VStack,{alignItems:`stretch`,gap:`space-4`,children:[(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`bold`,color:`grey.400`,children:h.completionTitle}),c.map(s=>{let c=o.completion[s];return(0,a.jsxs)(i.HStack,{alignItems:`center`,gap:`space-8`,children:[(0,a.jsx)(t.Icon,{size:`sm`,color:c?`success.500`:`grey.300`,flexShrink:`0`,children:c?(0,a.jsx)(n.default,{}):(0,a.jsx)(r.default,{})}),(0,a.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,color:c?`grey.500`:`grey.400`,children:h.completion[s]})]},s)})]}),h.footer&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Box,{h:`1px`,bg:`grey.100`,mt:`space-8`,mb:`space-8`}),(0,a.jsx)(e.Text,{as:`span`,fontSize:`9px`,color:`grey.300`,style:{lineHeight:1},children:h.footer})]})]})};exports.DEFAULT_SUPPLIER_RATING_LABELS=s,exports.SUPPLIER_RATING_MAX=o,exports.SupplierRatingBreakdown=p,exports.formatOverall=l,exports.formatResponseDelay=u,exports.getHeadlineColor=d;
1
+ "use client";const e=require("../text/Text.cjs"),t=require("./labels.cjs"),n=require("../ui-labels/UiLabelsProvider.cjs"),r=require("../icon/Icon.cjs"),i=require("../../node_modules/.pnpm/@heroicons_react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/outline/esm/CheckCircleIcon.cjs"),a=require("../../node_modules/.pnpm/@heroicons_react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/outline/esm/XCircleIcon.cjs");let o=require("@stokelp/styled-system/jsx"),s=require("react/jsx-runtime");var c=5,l=[`profile`,`location`,`contacts`,`legalBanking`,`sector`,`certificate`];function u(e,t=`fr-FR`){return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(e)}function d(e,t,n=`fr-FR`){if(e<60)return`${Math.round(e)} ${t.minutes}`;let r=e/60;if(r<48)return`${Math.round(r)} ${t.hours}`;let i=r/24;return`${new Intl.NumberFormat(n,{maximumFractionDigits:1}).format(i)} ${t.days}`}function f(e){let t=e/5;return t>=.7?`#3B6D11`:t>=.4?`#854F0B`:`#A32D2D`}function p(e){return e>=70?`#639922`:e>=40?`#BA7517`:`#E24B4A`}var m=({rating:c,responseRate:m,labels:h})=>{let g=n.useUiLabels(),_=t.mergeSupplierRatingLabels(g.supplierRating,h),v=m!=null,y=c.responseDelayMinutes!=null,b=c.responseDelayScore==null?null:Math.round(c.responseDelayScore*100),x=Math.round(c.completionScore*100),S=[{key:`responseRate`,value:v?`${Math.round(m)} %`:_.notAvailable,barPercent:v?Math.round(m):null,color:v?p(Math.round(m)):void 0},{key:`responseDelay`,value:y?d(c.responseDelayMinutes,_.units,g.locale):_.notAvailable,barPercent:b,color:b==null?void 0:p(b)},{key:`completion`,value:`${x} %`,barPercent:x,color:p(x)}];return(0,s.jsxs)(o.Box,{bg:`white`,borderRadius:`radius-8`,p:`space-16`,minW:`240px`,maxW:`260px`,css:{"& *":{fontFamily:`inherit`}},children:[(0,s.jsxs)(o.HStack,{justify:`space-between`,alignItems:`baseline`,mb:`space-8`,children:[(0,s.jsx)(e.Text,{as:`span`,fontSize:`body.md`,fontWeight:`bold`,children:_.title}),c.insufficientData||c.overall==null?(0,s.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`medium`,color:`grey.400`,children:_.insufficientData}):(0,s.jsxs)(e.Text,{as:`span`,fontSize:`body.lg`,fontWeight:`medium`,style:{color:f(c.overall)},children:[u(c.overall,g.locale),` / `,5,` ★`]})]}),(0,s.jsx)(o.Box,{h:`1px`,bg:`grey.100`,mb:`space-8`}),(0,s.jsxs)(o.VStack,{alignItems:`stretch`,gap:`space-8`,mb:`space-8`,children:[(0,s.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`bold`,color:`grey.400`,children:_.componentsTitle}),S.map(t=>(0,s.jsxs)(o.VStack,{alignItems:`stretch`,gap:`space-2`,children:[(0,s.jsxs)(o.HStack,{justify:`space-between`,alignItems:`baseline`,gap:`space-8`,children:[(0,s.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,color:`grey.500`,children:_.components[t.key]}),(0,s.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`medium`,whiteSpace:`nowrap`,style:{color:t.color},color:t.color?void 0:`grey.300`,children:t.value})]}),(0,s.jsx)(o.Box,{h:`3px`,bg:`grey.100`,borderRadius:`full`,overflow:`hidden`,children:(0,s.jsx)(o.Box,{h:`100%`,borderRadius:`full`,style:{width:t.barPercent==null?`0%`:`${t.barPercent}%`,background:t.color??`transparent`}})})]},t.key))]}),(0,s.jsx)(o.Box,{h:`1px`,bg:`grey.100`,mb:`space-8`}),(0,s.jsxs)(o.VStack,{alignItems:`stretch`,gap:`space-4`,children:[(0,s.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`bold`,color:`grey.400`,children:_.completionTitle}),l.map(t=>{let n=c.completion[t];return(0,s.jsxs)(o.HStack,{alignItems:`center`,gap:`space-8`,children:[(0,s.jsx)(r.Icon,{size:`sm`,color:n?`success.500`:`grey.300`,flexShrink:`0`,children:n?(0,s.jsx)(i.default,{}):(0,s.jsx)(a.default,{})}),(0,s.jsx)(e.Text,{as:`span`,fontSize:`body.sm`,color:n?`grey.500`:`grey.400`,children:_.completion[t]})]},t)})]}),_.footer&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.Box,{h:`1px`,bg:`grey.100`,mt:`space-8`,mb:`space-8`}),(0,s.jsx)(e.Text,{as:`span`,fontSize:`9px`,color:`grey.300`,style:{lineHeight:1},children:_.footer})]})]})};exports.SUPPLIER_RATING_MAX=c,exports.SupplierRatingBreakdown=m,exports.formatOverall=u,exports.formatResponseDelay=d,exports.getHeadlineColor=f;
2
2
  //# sourceMappingURL=SupplierRatingBreakdown.cjs.map