@stokelp/ui 4.0.3 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert/Alert.cjs +1 -1
- package/dist/components/alert/Alert.cjs.map +1 -1
- package/dist/components/alert/Alert.js +57 -53
- package/dist/components/alert/Alert.js.map +1 -1
- package/dist/components/combobox/Combobox.cjs +2 -2
- package/dist/components/combobox/Combobox.cjs.map +1 -1
- package/dist/components/combobox/Combobox.js +17 -17
- package/dist/components/date-picker/DatePicker.cjs +1 -1
- package/dist/components/date-picker/DatePicker.cjs.map +1 -1
- package/dist/components/date-picker/DatePicker.js +68 -53
- package/dist/components/date-picker/DatePicker.js.map +1 -1
- package/dist/components/dialog/styled.cjs +1 -1
- package/dist/components/dialog/styled.cjs.map +1 -1
- package/dist/components/dialog/styled.js +58 -54
- package/dist/components/dialog/styled.js.map +1 -1
- package/dist/components/drawer/Drawer.cjs +1 -1
- package/dist/components/drawer/Drawer.cjs.map +1 -1
- package/dist/components/drawer/Drawer.js +46 -42
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/pagination/Pagination.cjs +1 -1
- package/dist/components/pagination/Pagination.cjs.map +1 -1
- package/dist/components/pagination/Pagination.js +37 -36
- package/dist/components/pagination/Pagination.js.map +1 -1
- package/dist/components/select/Select.cjs +1 -1
- package/dist/components/select/Select.cjs.map +1 -1
- package/dist/components/select/Select.js +15 -15
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.cjs +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.cjs.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBadge.js +4 -4
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.cjs +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.cjs.map +1 -1
- package/dist/components/supplier-rating-badge/SupplierRatingBreakdown.js +33 -33
- package/dist/components/ui-labels/UiLabelsProvider.cjs +1 -1
- package/dist/components/ui-labels/UiLabelsProvider.cjs.map +1 -1
- package/dist/components/ui-labels/UiLabelsProvider.d.ts +34 -2
- package/dist/components/ui-labels/UiLabelsProvider.js +32 -7
- package/dist/components/ui-labels/UiLabelsProvider.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +69 -69
- package/package.json +1 -1
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createStyleContext as e } from "../../utils/slots.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { useUiLabels as t } from "../ui-labels/UiLabelsProvider.js";
|
|
4
|
+
import { IconButton as n } from "../icon-button/IconButton.js";
|
|
5
|
+
import { DOTS as r, usePagination as i } from "./use-pagination.js";
|
|
6
|
+
import { createEventHandler as a } from "../../shared/utils/events.js";
|
|
7
|
+
import { styled as o } from "@stokelp/styled-system/jsx";
|
|
8
|
+
import { pagination as s } from "@stokelp/styled-system/recipes";
|
|
9
|
+
import { createElement as c } from "react";
|
|
10
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
11
|
// src/components/pagination/Pagination.tsx
|
|
11
|
-
var { withProvider:
|
|
12
|
-
let { range:
|
|
13
|
-
page:
|
|
14
|
-
initialPage:
|
|
15
|
-
onChange:
|
|
12
|
+
var { withProvider: d, withContext: f } = e(s), p = d(o("div"), "root"), m = f(o("button"), "item"), h = f(o("div"), "dots"), g = ({ total: e, value: o, defaultValue: s, onChange: d, disabled: f, onNextPage: g, onPrevPage: _, siblings: v = 2, boundaries: y = 1, ...b }) => {
|
|
13
|
+
let { range: x, setPage: S, next: C, previous: w, active: T } = i({
|
|
14
|
+
page: o,
|
|
15
|
+
initialPage: s,
|
|
16
|
+
onChange: d,
|
|
16
17
|
total: e,
|
|
17
|
-
siblings:
|
|
18
|
-
boundaries:
|
|
19
|
-
}),
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
...
|
|
18
|
+
siblings: v,
|
|
19
|
+
boundaries: y
|
|
20
|
+
}), E = t(), D = a(g, C), O = a(_, w);
|
|
21
|
+
return /* @__PURE__ */ u(p, {
|
|
22
|
+
...b,
|
|
22
23
|
children: [
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ l(n, {
|
|
24
25
|
size: "md",
|
|
25
26
|
variant: "tertiary",
|
|
26
|
-
"aria-label":
|
|
27
|
-
disabled:
|
|
28
|
-
onClick:
|
|
29
|
-
children: /* @__PURE__ */
|
|
27
|
+
"aria-label": E.previousPage,
|
|
28
|
+
disabled: f || T === 1,
|
|
29
|
+
onClick: O,
|
|
30
|
+
children: /* @__PURE__ */ l("svg", {
|
|
30
31
|
width: "16",
|
|
31
32
|
height: "16",
|
|
32
33
|
viewBox: "0 0 16 16",
|
|
33
34
|
fill: "none",
|
|
34
35
|
xmlns: "http://www.w3.org/2000/svg",
|
|
35
|
-
children: /* @__PURE__ */
|
|
36
|
+
children: /* @__PURE__ */ l("path", {
|
|
36
37
|
fillRule: "evenodd",
|
|
37
38
|
clipRule: "evenodd",
|
|
38
39
|
d: "M5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L10.1464 2.64645C10.3417 2.45119 10.6583 2.45119 10.8536 2.64645C11.0488 2.84171 11.0488 3.15829 10.8536 3.35355L6.20711 8L10.8536 12.6464C11.0488 12.8417 11.0488 13.1583 10.8536 13.3536C10.6583 13.5488 10.3417 13.5488 10.1464 13.3536L5.14645 8.35355Z",
|
|
@@ -40,28 +41,28 @@ var { withProvider: u, withContext: d } = e(o), f = u(a("div"), "root"), p = d(a
|
|
|
40
41
|
})
|
|
41
42
|
})
|
|
42
43
|
}),
|
|
43
|
-
|
|
44
|
-
...
|
|
44
|
+
x.map((e, t) => e === r ? /* @__PURE__ */ c(h, {
|
|
45
|
+
...f ? { "data-disabled": !0 } : {},
|
|
45
46
|
key: t
|
|
46
|
-
}, "...") : /* @__PURE__ */
|
|
47
|
-
disabled:
|
|
48
|
-
...e ===
|
|
49
|
-
onClick: () =>
|
|
47
|
+
}, "...") : /* @__PURE__ */ l(m, {
|
|
48
|
+
disabled: f,
|
|
49
|
+
...e === T ? { "data-selected": !0 } : {},
|
|
50
|
+
onClick: () => S(e),
|
|
50
51
|
children: e
|
|
51
52
|
}, t)),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ l(n, {
|
|
53
54
|
size: "md",
|
|
54
55
|
variant: "tertiary",
|
|
55
|
-
"aria-label":
|
|
56
|
-
disabled:
|
|
57
|
-
onClick:
|
|
58
|
-
children: /* @__PURE__ */
|
|
56
|
+
"aria-label": E.nextPage,
|
|
57
|
+
disabled: f || T === e,
|
|
58
|
+
onClick: D,
|
|
59
|
+
children: /* @__PURE__ */ l("svg", {
|
|
59
60
|
width: "16",
|
|
60
61
|
height: "16",
|
|
61
62
|
viewBox: "0 0 16 16",
|
|
62
63
|
fill: "none",
|
|
63
64
|
xmlns: "http://www.w3.org/2000/svg",
|
|
64
|
-
children: /* @__PURE__ */
|
|
65
|
+
children: /* @__PURE__ */ l("path", {
|
|
65
66
|
fillRule: "evenodd",
|
|
66
67
|
clipRule: "evenodd",
|
|
67
68
|
d: "M10.8536 7.64645C11.0488 7.84171 11.0488 8.15829 10.8536 8.35355L5.85355 13.3536C5.65829 13.5488 5.34171 13.5488 5.14645 13.3536C4.95118 13.1583 4.95118 12.8417 5.14645 12.6464L9.79289 8L5.14645 3.35355C4.95118 3.15829 4.95118 2.84171 5.14645 2.64645C5.34171 2.45118 5.65829 2.45118 5.85355 2.64645L10.8536 7.64645Z",
|
|
@@ -72,6 +73,6 @@ var { withProvider: u, withContext: d } = e(o), f = u(a("div"), "root"), p = d(a
|
|
|
72
73
|
]
|
|
73
74
|
});
|
|
74
75
|
};
|
|
75
|
-
export {
|
|
76
|
+
export { g as Pagination };
|
|
76
77
|
|
|
77
78
|
//# sourceMappingURL=Pagination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","names":["createStyleContext","pagination","StyledPagination","withProvider","styled","PaginationItem","withContext","PaginationDots","Pagination","props","usePagination","value","defaultValue","handleNextPage","createEventHandler","onNextPage","next","handlePreviousPage","onPrevPage","previous","IconButton","disabled","active","range","pageNumber","DOTS","index","setPage","total"],"sources":["../../../src/components/pagination/Pagination.tsx"],"sourcesContent":["import type { ComponentProps, FC } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { pagination } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\nimport { DOTS, usePagination } from './use-pagination'\nimport { createEventHandler } from '~/shared/utils/events'\nimport { IconButton } from '~/components/icon-button'\n\nconst { withProvider, withContext } = createStyleContext(pagination)\n\nconst StyledPagination = withProvider(styled('div'), 'root')\ntype StyledPaginationProps = ComponentProps<typeof StyledPagination>\n\nconst PaginationItem = withContext(styled('button'), 'item')\nconst PaginationDots = withContext(styled('div'), 'dots')\n\nexport interface PaginationProps extends Omit<StyledPaginationProps, 'children' | 'defaultValue' | 'onChange'> {\n total: number\n value?: number\n defaultValue?: number\n onChange?: (value: number) => void\n disabled?: boolean\n siblings?: number\n boundaries?: number\n onNextPage?: () => void\n onPrevPage?: () => void\n}\n\nexport const Pagination: FC<PaginationProps> = ({\n total,\n value,\n defaultValue,\n onChange,\n disabled,\n onNextPage,\n onPrevPage,\n siblings = 2,\n boundaries = 1,\n ...props\n}: PaginationProps) => {\n const { range, setPage, next, previous, active } = usePagination({\n page: value,\n initialPage: defaultValue,\n onChange,\n total,\n siblings,\n boundaries,\n })\n\n const handleNextPage = createEventHandler(onNextPage, next)\n const handlePreviousPage = createEventHandler(onPrevPage, previous)\n\n return (\n <StyledPagination {...props}>\n <IconButton\n size=\"md\"\n variant=\"tertiary\"\n aria-label
|
|
1
|
+
{"version":3,"file":"Pagination.js","names":["createStyleContext","pagination","StyledPagination","withProvider","styled","PaginationItem","withContext","PaginationDots","Pagination","props","usePagination","value","defaultValue","labels","useUiLabels","handleNextPage","createEventHandler","onNextPage","next","handlePreviousPage","onPrevPage","previous","IconButton","disabled","active","range","pageNumber","DOTS","index","setPage","total"],"sources":["../../../src/components/pagination/Pagination.tsx"],"sourcesContent":["import type { ComponentProps, FC } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { pagination } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\nimport { DOTS, usePagination } from './use-pagination'\nimport { createEventHandler } from '~/shared/utils/events'\nimport { IconButton } from '~/components/icon-button'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\n\nconst { withProvider, withContext } = createStyleContext(pagination)\n\nconst StyledPagination = withProvider(styled('div'), 'root')\ntype StyledPaginationProps = ComponentProps<typeof StyledPagination>\n\nconst PaginationItem = withContext(styled('button'), 'item')\nconst PaginationDots = withContext(styled('div'), 'dots')\n\nexport interface PaginationProps extends Omit<StyledPaginationProps, 'children' | 'defaultValue' | 'onChange'> {\n total: number\n value?: number\n defaultValue?: number\n onChange?: (value: number) => void\n disabled?: boolean\n siblings?: number\n boundaries?: number\n onNextPage?: () => void\n onPrevPage?: () => void\n}\n\nexport const Pagination: FC<PaginationProps> = ({\n total,\n value,\n defaultValue,\n onChange,\n disabled,\n onNextPage,\n onPrevPage,\n siblings = 2,\n boundaries = 1,\n ...props\n}: PaginationProps) => {\n const { range, setPage, next, previous, active } = usePagination({\n page: value,\n initialPage: defaultValue,\n onChange,\n total,\n siblings,\n boundaries,\n })\n\n const labels = useUiLabels()\n const handleNextPage = createEventHandler(onNextPage, next)\n const handlePreviousPage = createEventHandler(onPrevPage, previous)\n\n return (\n <StyledPagination {...props}>\n <IconButton\n size=\"md\"\n variant=\"tertiary\"\n aria-label={labels.previousPage}\n disabled={disabled || active === 1}\n onClick={handlePreviousPage}\n >\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L10.1464 2.64645C10.3417 2.45119 10.6583 2.45119 10.8536 2.64645C11.0488 2.84171 11.0488 3.15829 10.8536 3.35355L6.20711 8L10.8536 12.6464C11.0488 12.8417 11.0488 13.1583 10.8536 13.3536C10.6583 13.5488 10.3417 13.5488 10.1464 13.3536L5.14645 8.35355Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n {range.map((pageNumber, index) => {\n if (pageNumber === DOTS) {\n return (\n <PaginationDots {...(disabled ? { 'data-disabled': true } : {})} key={index}>\n ...\n </PaginationDots>\n )\n }\n\n const isSelected = pageNumber === active\n\n return (\n <PaginationItem\n key={index}\n disabled={disabled}\n {...(isSelected\n ? {\n 'data-selected': true,\n }\n : {})}\n onClick={() => setPage(pageNumber)}\n >\n {pageNumber}\n </PaginationItem>\n )\n })}\n <IconButton\n size=\"md\"\n variant=\"tertiary\"\n aria-label={labels.nextPage}\n disabled={disabled || active === total}\n onClick={handleNextPage}\n >\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10.8536 7.64645C11.0488 7.84171 11.0488 8.15829 10.8536 8.35355L5.85355 13.3536C5.65829 13.5488 5.34171 13.5488 5.14645 13.3536C4.95118 13.1583 4.95118 12.8417 5.14645 12.6464L9.79289 8L5.14645 3.35355C4.95118 3.15829 4.95118 2.84171 5.14645 2.64645C5.34171 2.45118 5.65829 2.45118 5.85355 2.64645L10.8536 7.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </StyledPagination>\n )\n}\n"],"mappings":";;;;;;;;;;;AASA,IAAM,EAAE,iBAAc,mBAAgBA,EAAmBC,CAAU,GAE7DC,IAAmBC,EAAaC,EAAO,KAAK,GAAG,MAAM,G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,QAAD;MACE,UAAS;MACT,UAAS;MACT,GAAE;MACF,MAAK;KACN,CAAA;IACE,CAAA;GACK,CAAA;EACI;;AAEtB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../../utils/slots.cjs"),t=require("../
|
|
1
|
+
"use client";const e=require("../../utils/slots.cjs"),t=require("../ui-labels/UiLabelsProvider.cjs"),n=require("../tooltip/Tooltip.cjs"),r=require("../text/Text.cjs"),i=require("../../shared/ConditionalWrapper.cjs");let a=require("@ark-ui/react"),o=require("@stokelp/styled-system/jsx"),s=require("@stokelp/styled-system/recipes"),c=require("react"),l=require("react/jsx-runtime"),u=require("@stokelp/styled-system/css"),d=require("react-window");var{withProvider:f,withContext:p}=e.createStyleContext(s.select),m=f((0,o.styled)(a.Select.Root),`root`,{defaultProps:{loopFocus:!0}}),h=p((0,o.styled)(a.Select.ClearTrigger),`clearTrigger`),g=p((0,o.styled)(a.Select.Content),`content`),_=p((0,o.styled)(a.Select.Control),`control`),v=p((0,o.styled)(a.Select.Indicator),`indicator`),y=p((0,o.styled)(a.Select.Item),`item`),b=p((0,o.styled)(a.Select.ItemGroup),`itemGroup`),x=p((0,o.styled)(a.Select.ItemGroupLabel),`itemGroupLabel`),S=p((0,o.styled)(a.Select.ItemText),`itemText`),C=p((0,o.styled)(a.Select.Positioner),`positioner`),w=p((0,o.styled)(a.Select.Trigger),`trigger`),T=p((0,o.styled)(a.Select.ValueText),`valueText`),E=()=>(0,l.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,l.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,fill:`white`}),(0,l.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,className:(0,u.css)({stroke:`grey.100`})})]}),D=()=>(0,l.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,l.jsx)(`rect`,{y:`0.5`,width:`16`,height:`16`,rx:`4`,className:(0,u.css)({fill:`primary.500`})}),(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,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`,fill:`white`})]});function O({placeholder:e,allSelectedLabel:t}){let n=(0,a.useSelectContext)(),r=n.collection.items,i=n.selectedItems;return n.multiple&&i.filter(e=>!e.disabled).length>=r.filter(e=>!e.disabled).length&&t?(0,l.jsx)(T,{className:`custom`,truncate:!0,children:t}):(0,l.jsx)(T,{truncate:!0,placeholder:e})}function k({renderTrigger:e,placeholder:t,allSelectedLabel:n}){let r=(0,a.useSelectContext)(),i=r.value&&r.value.length>0?r.collection.findMany(r.value):[];if(i.length===0)return(0,l.jsx)(T,{className:`custom`,truncate:!0,placeholder:t});let o=r.selectedItems;return r.multiple&&o.filter(e=>!e.disabled).length>=r.collection.items.filter(e=>!e.disabled).length&&n?(0,l.jsx)(T,{className:`custom`,truncate:!0,children:n}):(0,l.jsx)(T,{className:`custom`,placeholder:t,children:i.map(t=>(0,l.jsx)(`span`,{children:e(t)},t.value))})}function A({item:e,isMultiple:t,renderItem:n}){let r=(0,a.useSelectItemContext)();return(0,l.jsxs)(l.Fragment,{children:[t?r.selected?(0,l.jsx)(D,{}):(0,l.jsx)(E,{}):null,n?n(e):(0,l.jsx)(S,{truncate:!0,children:e.label})]})}function j({index:e,style:t,ariaAttributes:r,items:a,isMultiple:o,renderItem:s}){let c=a[e];return(0,l.jsx)(i.ConditionalWrapper,{when:!!c.tooltip,wrapper:e=>(0,l.jsx)(n.Tooltip,{label:c.tooltip,children:e}),children:(0,l.jsx)(y,{item:c,style:t,"aria-posinset":r[`aria-posinset`],"aria-setsize":r[`aria-setsize`],children:(0,l.jsx)(A,{renderItem:s,item:c,isMultiple:o})})})}function M(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.label===n.groupLabel?e.items.push(n):t.push({label:n.groupLabel,items:[n]})}return t}function N({items:e,placeholder:o,emptyLabel:s,usePortal:f=!0,positioning:p,renderItem:S,renderTrigger:T,virtualized:E,rowHeight:D=34,...N}){let P=t.useUiLabels(),F=(0,a.createListCollection)({items:e}),I=(0,c.useRef)(null),L=e=>(0,l.jsxs)(c.Fragment,{children:[(0,l.jsx)(i.ConditionalWrapper,{when:!!e.tooltip,wrapper:t=>(0,l.jsx)(n.Tooltip,{label:e.tooltip,children:t}),children:(0,l.jsx)(y,{item:e,children:(0,l.jsx)(A,{renderItem:S,item:e,isMultiple:N.multiple})},e.value)},e.value),e.separatorAfter&&(0,l.jsx)(`div`,{role:`separator`,className:(0,u.css)({height:`1px`,flexShrink:0,backgroundColor:`grey.100`,marginY:`space-4`,marginX:`space-8`})})]},e.value);return(0,l.jsxs)(m,{lazyMount:!0,unmountOnExit:!0,collection:F,positioning:{sameWidth:!0,gutter:0,...p},"data-recipe":`select`,...N,ref:e=>{e&&(I.current=e.closest(`[role="dialog"]`))},children:[(0,l.jsxs)(_,{children:[(0,l.jsxs)(w,{children:[T?(0,l.jsx)(k,{renderTrigger:T,placeholder:o,allSelectedLabel:N.allSelectedLabel}):(0,l.jsx)(O,{placeholder:o,allSelectedLabel:N.allSelectedLabel}),(0,l.jsx)(v,{asChild:!0,children:(0,l.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,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`,fill:`currentColor`})})})]}),(0,l.jsx)(h,{disabled:N.readOnly,asChild:!0,children:(0,l.jsx)(`button`,{children:(0,l.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,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`,fill:`currentColor`})})})})]}),(0,l.jsx)(i.ConditionalWrapper,{when:f,wrapper:e=>(0,l.jsx)(a.Portal,{container:I,children:e}),children:(0,l.jsx)(C,{children:(0,l.jsx)(g,{children:e.length===0?(0,l.jsx)(r.Text,{px:`space-8`,textAlign:`center`,children:s??P.noResults}):E?(0,l.jsx)(d.List,{role:`presentation`,rowComponent:j,rowProps:{items:e,isMultiple:N.multiple,renderItem:S},rowCount:e.length,rowHeight:D,style:{height:Math.min(D*e.length,180)}}):M(e).map((e,t)=>e.label===void 0?(0,l.jsx)(c.Fragment,{children:e.items.map(L)},`group-${t}`):(0,l.jsxs)(b,{children:[(0,l.jsx)(x,{children:e.label}),e.items.map(L)]},`group-${t}`))})})}),(0,l.jsx)(a.Select.HiddenSelect,{})]})}exports.Select=N;
|
|
2
2
|
//# sourceMappingURL=Select.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.cjs","names":["createStyleContext","select","styled","ArkSelect","css","useSelectContext","useSelectItemContext","_Fragment","ConditionalWrapper","Tooltip","useUiLabels","createListCollection","useRef","Fragment","Portal","Text","List","require_slots","require_Tooltip","require_Text","require_ConditionalWrapper","require_UiLabelsProvider","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","_stokelp_styled_system_css","react_window","Root","withProvider","ClearTrigger","withContext","Content","Control","Indicator","Item","ItemGroup","ItemGroupLabel","ItemText","Positioner","Trigger","ValueText","MultipleUncheckedIndicator","MultipleCheckedIndicator","DefaultInnerTrigger","context","items","selectedItems","item","allSelectedLabel","CustomInnerTrigger","renderTrigger","CustomInnerItem","isMultiple","renderItem","VirtualRow","index","ariaAttributes","toGroupRuns","runs","current","Select","props","uiLabels","collection","$dialogContent","renderOption","positioning","node","usePortal","emptyLabel","virtualized","rowHeight","run","runIndex"],"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 { List, type RowComponentProps } 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\ninterface VirtualRowProps<Item extends SelectItem> {\n items: readonly Item[]\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\n// Declared at module level: react-window memoizes the row component by identity, so a\n// component created during render would remount every visible row on each render.\nfunction VirtualRow<Item extends SelectItem>({\n index,\n style,\n ariaAttributes,\n items,\n isMultiple,\n renderItem,\n}: RowComponentProps<VirtualRowProps<Item>>) {\n const item = items[index]\n\n return (\n <ConditionalWrapper when={!!item.tooltip} wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}>\n {/* Only the position attributes: the option keeps its role from Ark, not react-window's listitem. */}\n <Item\n item={item}\n style={style}\n aria-posinset={ariaAttributes['aria-posinset']}\n aria-setsize={ariaAttributes['aria-setsize']}\n >\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={isMultiple} />\n </Item>\n </ConditionalWrapper>\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 // role=\"presentation\" overrides the list's own role=\"list\": the options must stay\n // owned by the listbox.\n <List\n role=\"presentation\"\n rowComponent={VirtualRow<Item>}\n rowProps={{ items, isMultiple: props.multiple, renderItem }}\n rowCount={items.length}\n rowHeight={rowHeight}\n style={{ height: Math.min(rowHeight * items.length, 180) }}\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":"A,+bAsBA,GAAM,CAAE,eAAc,eAAgBA,EAAAA,mBAAmBC,EAAAA,MAAM,EAGzD4B,EAAOC,GAAA,EAAa5B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,IAAS,EAAG,OAAQ,CAC7D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEK4B,EAAeC,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,YAAY,EAAG,cAAc,EACzE8B,EAAUD,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA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AA,IAAA,CAAClB,EAAAA,mBAAD,CAAoB,KAAM8D,EAAW,QAAS,IAAY,EAAA5C,EAAA,IAAA,CAACZ,EAAAA,OAAD,CAAQ,UAAWoD,EAAiB,UAAiB,CAAA,EAC7G,UAAA,EAAAxC,EAAA,IAAA,CAACc,EAAD,CAAA,UACE,EAAAd,EAAA,IAAA,CAACO,EAAD,CAAA,SACGc,EAAM,SAAW,GAChB,EAAArB,EAAA,IAAA,CAACX,EAAAA,KAAD,CAAM,GAAG,UAAU,UAAU,SAC1B,SAAAwD,GAAcP,EAAS,SACpB,CAAA,EACJQ,GAGF,EAAA9C,EAAA,IAAA,CAACV,EAAAA,KAAD,CACE,KAAK,eACL,aAAcwC,EACd,SAAU,CAAE,QAAO,WAAYO,EAAM,SAAU,YAAW,EAC1D,SAAUhB,EAAM,OACL,YACX,MAAO,CAAE,OAAQ,KAAK,IAAI0B,EAAY1B,EAAM,OAAQ,GAAG,CAAE,CAC1D,CAAA,EAEDY,EAAkBZ,CAAK,CAAC,CAAC,KAAK,EAAK,IACjC2B,EAAI,QAAU,IAAA,IACZ,EAAAhD,EAAA,IAAA,CAACb,EAAAA,SAAD,CAAA,SAAqC6D,EAAI,MAAM,IAAIP,CAAY,CAAY,EAA5D,SAASQ,GAAmD,GAE3E,EAAAjD,EAAA,KAAA,CAACW,EAAD,CAAA,SAAA,EACE,EAAAX,EAAA,IAAA,CAACY,EAAD,CAAA,SAAiBoC,EAAI,KAAsB,CAAA,EAC1CA,EAAI,MAAM,IAAIP,CAAY,CAClB,CAAA,EAHK,SAASQ,GAGd,CAEf,CAEK,CAAA,CACC,CAAA,CACM,CAAA,GACpB,EAAAjD,EAAA,IAAA,CAACvB,EAAAA,OAAU,aAAX,CAAyB,CAAA,CACrB,C,EAEV,C"}
|
|
1
|
+
{"version":3,"file":"Select.cjs","names":["createStyleContext","select","styled","ArkSelect","css","useSelectContext","useSelectItemContext","_Fragment","ConditionalWrapper","Tooltip","useUiLabels","createListCollection","useRef","Fragment","Portal","Text","List","require_slots","require_UiLabelsProvider","require_Tooltip","require_Text","require_ConditionalWrapper","_ark_ui_react","_stokelp_styled_system_jsx","_stokelp_styled_system_recipes","react","react_jsx_runtime","_stokelp_styled_system_css","react_window","Root","withProvider","ClearTrigger","withContext","Content","Control","Indicator","Item","ItemGroup","ItemGroupLabel","ItemText","Positioner","Trigger","ValueText","MultipleUncheckedIndicator","MultipleCheckedIndicator","DefaultInnerTrigger","context","items","selectedItems","item","allSelectedLabel","CustomInnerTrigger","renderTrigger","CustomInnerItem","isMultiple","renderItem","VirtualRow","index","ariaAttributes","toGroupRuns","runs","current","Select","props","uiLabels","collection","$dialogContent","renderOption","positioning","node","usePortal","emptyLabel","virtualized","rowHeight","run","runIndex"],"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 { List, type RowComponentProps } 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\ninterface VirtualRowProps<Item extends SelectItem> {\n items: readonly Item[]\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\n// Declared at module level: react-window memoizes the row component by identity, so a\n// component created during render would remount every visible row on each render.\nfunction VirtualRow<Item extends SelectItem>({\n index,\n style,\n ariaAttributes,\n items,\n isMultiple,\n renderItem,\n}: RowComponentProps<VirtualRowProps<Item>>) {\n const item = items[index]\n\n return (\n <ConditionalWrapper when={!!item.tooltip} wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}>\n {/* Only the position attributes: the option keeps its role from Ark, not react-window's listitem. */}\n <Item\n item={item}\n style={style}\n aria-posinset={ariaAttributes['aria-posinset']}\n aria-setsize={ariaAttributes['aria-setsize']}\n >\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={isMultiple} />\n </Item>\n </ConditionalWrapper>\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 // role=\"presentation\" overrides the list's own role=\"list\": the options must stay\n // owned by the listbox.\n <List\n role=\"presentation\"\n rowComponent={VirtualRow<Item>}\n rowProps={{ items, isMultiple: props.multiple, renderItem }}\n rowCount={items.length}\n rowHeight={rowHeight}\n style={{ height: Math.min(rowHeight * items.length, 180) }}\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":"A,+bAsBA,GAAM,CAAE,eAAc,eAAgBA,EAAAA,mBAAmBC,EAAAA,MAAM,EAGzD4B,EAAOC,GAAA,EAAa5B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,IAAS,EAAG,OAAQ,CAC7D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEK4B,EAAeC,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,YAAY,EAAG,cAAc,EACzE8B,EAAUD,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,OAAO,EAAG,SAAS,EAC1D+B,EAAUF,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,OAAO,EAAG,SAAS,EAC1DgC,EAAYH,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,SAAS,EAAG,WAAW,EAChEiC,EAAOJ,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,IAAI,EAAG,MAAM,EACjDkC,EAAYL,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,SAAS,EAAG,WAAW,EAChEmC,EAAiBN,GAAA,EAAY9B,EAAAA,OAAAA,CAAOC,EAAAA,OAAU,cAAc,EAAG,gBAAgB,EAC/EoC,EAAWP,GAAA,EAAY9B,EAAAA,OAAAA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1D,SAAUhB,EAAM,OACL,YACX,MAAO,CAAE,OAAQ,KAAK,IAAI0B,EAAY1B,EAAM,OAAQ,GAAG,CAAE,CAC1D,CAAA,EAEDY,EAAkBZ,CAAK,CAAC,CAAC,KAAK,EAAK,IACjC2B,EAAI,QAAU,IAAA,IACZ,EAAAhD,EAAA,IAAA,CAACb,EAAAA,SAAD,CAAA,SAAqC6D,EAAI,MAAM,IAAIP,CAAY,CAAY,EAA5D,SAASQ,GAAmD,GAE3E,EAAAjD,EAAA,KAAA,CAACW,EAAD,CAAA,SAAA,EACE,EAAAX,EAAA,IAAA,CAACY,EAAD,CAAA,SAAiBoC,EAAI,KAAsB,CAAA,EAC1CA,EAAI,MAAM,IAAIP,CAAY,CAClB,CAAA,EAHK,SAASQ,GAGd,CAEf,CAEK,CAAA,CACC,CAAA,CACM,CAAA,GACpB,EAAAjD,EAAA,IAAA,CAACvB,EAAAA,OAAU,aAAX,CAAyB,CAAA,CACrB,C,EAEV,C"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createStyleContext as e } from "../../utils/slots.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useUiLabels as t } from "../ui-labels/UiLabelsProvider.js";
|
|
4
|
+
import { Tooltip as n } from "../tooltip/Tooltip.js";
|
|
5
|
+
import { Text as r } from "../text/Text.js";
|
|
6
|
+
import { ConditionalWrapper as i } from "../../shared/ConditionalWrapper.js";
|
|
7
7
|
import { Portal as a, Select as o, createListCollection as s, useSelectContext as c, useSelectItemContext as l } from "@ark-ui/react";
|
|
8
8
|
import { styled as u } from "@stokelp/styled-system/jsx";
|
|
9
9
|
import { select as d } from "@stokelp/styled-system/recipes";
|
|
@@ -88,19 +88,19 @@ function L({ item: e, isMultiple: t, renderItem: n }) {
|
|
|
88
88
|
children: e.label
|
|
89
89
|
})] });
|
|
90
90
|
}
|
|
91
|
-
function R({ index: e, style:
|
|
91
|
+
function R({ index: e, style: t, ariaAttributes: r, items: a, isMultiple: o, renderItem: s }) {
|
|
92
92
|
let c = a[e];
|
|
93
|
-
return /* @__PURE__ */ h(
|
|
93
|
+
return /* @__PURE__ */ h(i, {
|
|
94
94
|
when: !!c.tooltip,
|
|
95
|
-
wrapper: (e) => /* @__PURE__ */ h(
|
|
95
|
+
wrapper: (e) => /* @__PURE__ */ h(n, {
|
|
96
96
|
label: c.tooltip,
|
|
97
97
|
children: e
|
|
98
98
|
}),
|
|
99
99
|
children: /* @__PURE__ */ h(E, {
|
|
100
100
|
item: c,
|
|
101
|
-
style:
|
|
102
|
-
"aria-posinset":
|
|
103
|
-
"aria-setsize":
|
|
101
|
+
style: t,
|
|
102
|
+
"aria-posinset": r["aria-posinset"],
|
|
103
|
+
"aria-setsize": r["aria-setsize"],
|
|
104
104
|
children: /* @__PURE__ */ h(L, {
|
|
105
105
|
renderItem: s,
|
|
106
106
|
item: c,
|
|
@@ -121,11 +121,11 @@ function z(e) {
|
|
|
121
121
|
return t;
|
|
122
122
|
}
|
|
123
123
|
function B({ items: e, placeholder: c, emptyLabel: l, usePortal: u = !0, positioning: d, renderItem: m, renderTrigger: y, virtualized: b, rowHeight: k = 34, ...M }) {
|
|
124
|
-
let N =
|
|
124
|
+
let N = t(), P = s({ items: e }), B = p(null), V = (e) => /* @__PURE__ */ g(f, { children: [/* @__PURE__ */ h(i, {
|
|
125
125
|
when: !!e.tooltip,
|
|
126
|
-
wrapper: (
|
|
126
|
+
wrapper: (t) => /* @__PURE__ */ h(n, {
|
|
127
127
|
label: e.tooltip,
|
|
128
|
-
children:
|
|
128
|
+
children: t
|
|
129
129
|
}),
|
|
130
130
|
children: /* @__PURE__ */ h(E, {
|
|
131
131
|
item: e,
|
|
@@ -199,13 +199,13 @@ function B({ items: e, placeholder: c, emptyLabel: l, usePortal: u = !0, positio
|
|
|
199
199
|
})
|
|
200
200
|
}) })
|
|
201
201
|
})] }),
|
|
202
|
-
/* @__PURE__ */ h(
|
|
202
|
+
/* @__PURE__ */ h(i, {
|
|
203
203
|
when: u,
|
|
204
204
|
wrapper: (e) => /* @__PURE__ */ h(a, {
|
|
205
205
|
container: B,
|
|
206
206
|
children: e
|
|
207
207
|
}),
|
|
208
|
-
children: /* @__PURE__ */ h(A, { children: /* @__PURE__ */ h(C, { children: e.length === 0 ? /* @__PURE__ */ h(
|
|
208
|
+
children: /* @__PURE__ */ h(A, { children: /* @__PURE__ */ h(C, { children: e.length === 0 ? /* @__PURE__ */ h(r, {
|
|
209
209
|
px: "space-8",
|
|
210
210
|
textAlign: "center",
|
|
211
211
|
children: l ?? N.noResults
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../
|
|
1
|
+
"use client";const e=require("../ui-labels/UiLabelsProvider.cjs"),t=require("../text/Text.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=e.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)(t.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":["useState","useRef","useCallback","useUiLabels","Popover","PopoverTrigger","Box","Text","formatOverall","PopoverContent","SupplierRatingBreakdown","
|
|
1
|
+
{"version":3,"file":"SupplierRatingBadge.cjs","names":["useState","useRef","useCallback","useUiLabels","Popover","PopoverTrigger","Box","Text","formatOverall","PopoverContent","SupplierRatingBreakdown","require_UiLabelsProvider","require_Text","require_Popover","require_SupplierRatingBreakdown","_stokelp_styled_system_jsx","react","react_jsx_runtime","getBadgeColors","ratio","overall","SupplierRatingBadge","open","setOpen","closeTimer","cancelClose","scheduleClose","openOnMouse","closeOnMouse","insufficient","rating","uiLabels","insufficientLabel","labels","colors"],"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 } from '~/components/popover/Popover'\nimport { Text } from '~/components/text/Text'\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":"A,6QAsBA,SAASkB,EAAe,EAAgD,CACtE,IAAMC,EAAQC,EAAA,EAId,OAHID,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACvDA,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACvDA,GAAS,GAAY,CAAE,GAAI,UAAW,MAAO,SAAU,EACpD,CAAE,GAAI,UAAW,MAAO,SAAU,CAC3C,CAGA,SAAgBE,EAAoB,CAAE,SAAQ,eAAc,UAAoC,CAC9F,GAAM,CAACC,EAAMC,IAAA,EAAWvB,EAAAA,SAAAA,CAAS,EAAK,EAChCwB,GAAA,EAAavB,EAAAA,OAAAA,CAA6C,IAAI,EAE9DwB,GAAA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,KAAD,CAAM,KAAK,KAAK,KAAA,GAAK,WAAW,SAAS,MAAO,CAAE,MAAO2B,EAAO,KAAM,EACnE,SAAAL,EAAeG,EAAoB,GAAGxB,EAAAA,cAAcsB,EAAO,QAAmBC,EAAS,MAAM,EAAE,GAC5F,CAAA,CACH,CAAA,CACS,CAAA,GAChB,EAAAd,EAAA,IAAA,CAACR,EAAAA,eAAD,CACE,UAAU,0BACV,OAAQ,IACR,EAAE,IACF,GAAG,cACH,OAAO,OACP,aAAa,WACb,UAAU,6BACV,eAAgBkB,EAChB,eAAgBC,EAEhB,UAAA,EAAAX,EAAA,IAAA,CAACP,EAAAA,wBAAD,CAAiC,SAAsB,eAAsB,QAAS,CAAA,CACxE,CAAA,CACT,C,EAEb,C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useUiLabels as e } from "../ui-labels/UiLabelsProvider.js";
|
|
3
|
+
import { Text as t } from "../text/Text.js";
|
|
4
4
|
import { Popover as n, PopoverContent as r, PopoverTrigger as i } from "../popover/Popover.js";
|
|
5
5
|
import { SupplierRatingBreakdown as a, formatOverall as o } from "./SupplierRatingBreakdown.js";
|
|
6
6
|
import { Box as s } from "@stokelp/styled-system/jsx";
|
|
@@ -34,7 +34,7 @@ function h({ rating: h, responseRate: g, labels: _ }) {
|
|
|
34
34
|
e.pointerType === "mouse" && (x(), y(!0));
|
|
35
35
|
}, w = (e) => {
|
|
36
36
|
e.pointerType === "mouse" && S();
|
|
37
|
-
}, T = h.insufficientData || h.overall == null, E =
|
|
37
|
+
}, T = h.insufficientData || h.overall == null, E = e(), D = _?.insufficientData ?? E.supplierRating.insufficientData, O = T ? {
|
|
38
38
|
bg: "#F1F2F4",
|
|
39
39
|
color: "#5B6472"
|
|
40
40
|
} : m(h.overall);
|
|
@@ -68,7 +68,7 @@ function h({ rating: h, responseRate: g, labels: _ }) {
|
|
|
68
68
|
x(), y(!0);
|
|
69
69
|
},
|
|
70
70
|
onBlur: () => y(!1),
|
|
71
|
-
children: /* @__PURE__ */ f(
|
|
71
|
+
children: /* @__PURE__ */ f(t, {
|
|
72
72
|
size: "sm",
|
|
73
73
|
bold: !0,
|
|
74
74
|
whiteSpace: "nowrap",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("
|
|
1
|
+
"use client";const e=require("./labels.cjs"),t=require("../ui-labels/UiLabelsProvider.cjs"),n=require("../text/Text.cjs"),r=require("../icon/Icon.cjs"),i=require("../../node_modules/@heroicons/react/24/outline/esm/CheckCircleIcon.cjs"),a=require("../../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=t.useUiLabels(),_=e.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)(n.Text,{as:`span`,fontSize:`body.md`,fontWeight:`bold`,children:_.title}),c.insufficientData||c.overall==null?(0,s.jsx)(n.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`medium`,color:`grey.400`,children:_.insufficientData}):(0,s.jsxs)(n.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)(n.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`bold`,color:`grey.400`,children:_.componentsTitle}),S.map(e=>(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)(n.Text,{as:`span`,fontSize:`body.sm`,color:`grey.500`,children:_.components[e.key]}),(0,s.jsx)(n.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`medium`,whiteSpace:`nowrap`,style:{color:e.color},color:e.color?void 0:`grey.300`,children:e.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:e.barPercent==null?`0%`:`${e.barPercent}%`,background:e.color??`transparent`}})})]},e.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)(n.Text,{as:`span`,fontSize:`body.sm`,fontWeight:`bold`,color:`grey.400`,children:_.completionTitle}),l.map(e=>{let t=c.completion[e];return(0,s.jsxs)(o.HStack,{alignItems:`center`,gap:`space-8`,children:[(0,s.jsx)(r.Icon,{size:`sm`,color:t?`success.500`:`grey.300`,flexShrink:`0`,children:t?(0,s.jsx)(i.default,{}):(0,s.jsx)(a.default,{})}),(0,s.jsx)(n.Text,{as:`span`,fontSize:`body.sm`,color:t?`grey.500`:`grey.400`,children:_.completion[e]})]},e)})]}),_.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)(n.Text,{as:`span`,fontSize:`9px`,color:`grey.300`,style:{lineHeight:1},children:_.footer})]})]})};exports.DEFAULT_SUPPLIER_RATING_LABELS=e.DEFAULT_SUPPLIER_RATING_LABELS,exports.SUPPLIER_RATING_MAX=c,exports.SupplierRatingBreakdown=m,exports.formatOverall=u,exports.formatResponseDelay=d,exports.getHeadlineColor=f,exports.mergeSupplierRatingLabels=e.mergeSupplierRatingLabels;
|
|
2
2
|
//# sourceMappingURL=SupplierRatingBreakdown.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupplierRatingBreakdown.cjs","names":["useUiLabels","mergeSupplierRatingLabels","Box","HStack","Text","VStack","Icon","CheckCircleIcon","XCircleIcon","_Fragment","require_Text","require_labels","require_UiLabelsProvider","require_Icon","require_CheckCircleIcon","require_XCircleIcon","_stokelp_styled_system_jsx","react_jsx_runtime","SUPPLIER_RATING_MAX","COMPLETION_ORDER","formatOverall","locale","overall","formatResponseDelay","minutes","units","hours","days","getHeadlineColor","ratio","getBarColor","ratioPercent","SupplierRatingBreakdown","labelsProp","uiLabels","labels","hasResponseRate","responseRate","hasDelay","rating","delayPercent","completionPercent","rows","row","done","key"],"sources":["../../../src/components/supplier-rating-badge/SupplierRatingBreakdown.tsx"],"sourcesContent":["import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/outline'\nimport { Box, HStack, VStack } from '@stokelp/styled-system/jsx'\n\nimport { Icon } from '~/components/icon/Icon'\nimport { Text } from '~/components/text/Text'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\nimport {\n mergeSupplierRatingLabels,\n type SupplierRatingCompletionKey,\n type SupplierRatingComponentKey,\n type SupplierRating,\n type SupplierRatingLabels,\n} from './labels'\n\nexport * from './labels'\n\nexport const SUPPLIER_RATING_MAX = 5\n\nconst COMPLETION_ORDER: SupplierRatingCompletionKey[] = [\n 'profile',\n 'location',\n 'contacts',\n 'legalBanking',\n 'sector',\n 'certificate',\n]\n\n/** Note with one decimal in the reader's number format (\"4,2\" in French, \"4.2\" in English). */\nexport function formatOverall(overall: number, locale = 'fr-FR'): string {\n return new Intl.NumberFormat(locale, { minimumFractionDigits: 1, maximumFractionDigits: 1 }).format(overall)\n}\n\n/** Average response delay: minutes → \"45 min\" / \"18 h\" / \"2,5 j\". */\nexport function formatResponseDelay(minutes: number, units: SupplierRatingLabels['units'], locale = 'fr-FR'): string {\n if (minutes < 60) return `${Math.round(minutes)} ${units.minutes}`\n const hours = minutes / 60\n if (hours < 48) return `${Math.round(hours)} ${units.hours}`\n const days = hours / 24\n return `${new Intl.NumberFormat(locale, { maximumFractionDigits: 1 }).format(days)} ${units.days}`\n}\n\nexport function getHeadlineColor(overall: number): string {\n const ratio = overall / SUPPLIER_RATING_MAX\n if (ratio >= 0.7) return '#3B6D11'\n if (ratio >= 0.4) return '#854F0B'\n return '#A32D2D'\n}\n\nfunction getBarColor(ratioPercent: number): string {\n if (ratioPercent >= 70) return '#639922'\n if (ratioPercent >= 40) return '#BA7517'\n return '#E24B4A'\n}\n\ntype ComponentRow = {\n key: SupplierRatingComponentKey\n value: string\n /** 0..100 bar fill, or null when there is no data. */\n barPercent: number | null\n /** Bar/value colour, or undefined for the neutral (no-data) state. */\n color?: string\n}\n\ntype SupplierRatingBreakdownProps = {\n rating: SupplierRating\n /** Original response rate (0..100), displayed as the \"Taux de réponse\" value. */\n responseRate?: number\n labels?: Partial<SupplierRatingLabels>\n}\n\nexport const SupplierRatingBreakdown = ({ rating, responseRate, labels: labelsProp }: SupplierRatingBreakdownProps) => {\n const uiLabels = useUiLabels()\n const labels = mergeSupplierRatingLabels(uiLabels.supplierRating, labelsProp)\n\n const hasResponseRate = responseRate != null\n const hasDelay = rating.responseDelayMinutes != null\n const delayPercent = rating.responseDelayScore != null ? Math.round(rating.responseDelayScore * 100) : null\n const completionPercent = Math.round(rating.completionScore * 100)\n\n const rows: ComponentRow[] = [\n {\n key: 'responseRate',\n value: hasResponseRate ? `${Math.round(responseRate)} %` : labels.notAvailable,\n barPercent: hasResponseRate ? Math.round(responseRate) : null,\n color: hasResponseRate ? getBarColor(Math.round(responseRate)) : undefined,\n },\n {\n key: 'responseDelay',\n value: hasDelay\n ? formatResponseDelay(rating.responseDelayMinutes as number, labels.units, uiLabels.locale)\n : labels.notAvailable,\n barPercent: delayPercent,\n color: delayPercent != null ? getBarColor(delayPercent) : undefined,\n },\n {\n key: 'completion',\n value: `${completionPercent} %`,\n barPercent: completionPercent,\n color: getBarColor(completionPercent),\n },\n ]\n\n return (\n <Box\n bg=\"white\"\n borderRadius=\"radius-8\"\n p=\"space-16\"\n minW=\"240px\"\n maxW=\"260px\"\n css={{ '& *': { fontFamily: 'inherit' } }}\n >\n <HStack justify=\"space-between\" alignItems=\"baseline\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.md\" fontWeight=\"bold\">\n {labels.title}\n </Text>\n {rating.insufficientData || rating.overall == null ? (\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"medium\" color=\"grey.400\">\n {labels.insufficientData}\n </Text>\n ) : (\n <Text as=\"span\" fontSize=\"body.lg\" fontWeight=\"medium\" style={{ color: getHeadlineColor(rating.overall) }}>\n {formatOverall(rating.overall, uiLabels.locale)} / {SUPPLIER_RATING_MAX} ★\n </Text>\n )}\n </HStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-8\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.componentsTitle}\n </Text>\n {rows.map(row => (\n <VStack key={row.key} alignItems=\"stretch\" gap=\"space-2\">\n <HStack justify=\"space-between\" alignItems=\"baseline\" gap=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" color=\"grey.500\">\n {labels.components[row.key]}\n </Text>\n <Text\n as=\"span\"\n fontSize=\"body.sm\"\n fontWeight=\"medium\"\n whiteSpace=\"nowrap\"\n style={{ color: row.color }}\n color={row.color ? undefined : 'grey.300'}\n >\n {row.value}\n </Text>\n </HStack>\n <Box h=\"3px\" bg=\"grey.100\" borderRadius=\"full\" overflow=\"hidden\">\n <Box\n h=\"100%\"\n borderRadius=\"full\"\n style={{\n width: row.barPercent != null ? `${row.barPercent}%` : '0%',\n background: row.color ?? 'transparent',\n }}\n />\n </Box>\n </VStack>\n ))}\n </VStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-4\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.completionTitle}\n </Text>\n {COMPLETION_ORDER.map(key => {\n const done = rating.completion[key]\n return (\n <HStack key={key} alignItems=\"center\" gap=\"space-8\">\n <Icon size=\"sm\" color={done ? 'success.500' : 'grey.300'} flexShrink=\"0\">\n {done ? <CheckCircleIcon /> : <XCircleIcon />}\n </Icon>\n <Text as=\"span\" fontSize=\"body.sm\" color={done ? 'grey.500' : 'grey.400'}>\n {labels.completion[key]}\n </Text>\n </HStack>\n )\n })}\n </VStack>\n\n {labels.footer && (\n <>\n <Box h=\"1px\" bg=\"grey.100\" mt=\"space-8\" mb=\"space-8\" />\n <Text as=\"span\" fontSize=\"9px\" color=\"grey.300\" style={{ lineHeight: 1 }}>\n {labels.footer}\n </Text>\n </>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AAAe,EAAA,KAAA,CAACZ,EAAAA,OAAD,CAAQ,WAAW,UAAU,IAAI,UAAjC,SAAA,EACE,EAAAY,EAAA,IAAA,CAACb,EAAAA,KAAD,CAAM,GAAG,OAAO,SAAS,UAAU,WAAW,OAAO,MAAM,WACxD,SAAA+B,EAAO,eACJ,CAAA,EACLhB,EAAiB,IAAI,GAAO,CAC3B,IAAMyB,EAAOL,EAAO,WAAWM,GAC/B,OACE,EAAA5B,EAAA,KAAA,CAACd,EAAAA,OAAD,CAAkB,WAAW,SAAS,IAAI,UAA1C,SAAA,EACE,EAAAc,EAAA,IAAA,CAACX,EAAAA,KAAD,CAAM,KAAK,KAAK,MAAOsC,EAAO,cAAgB,WAAY,WAAW,IAClE,SAAAA,GAAO,EAAA3B,EAAA,IAAA,CAACV,EAAAA,QAAD,CAAkB,CAAA,GAAI,EAAAU,EAAA,IAAA,CAACT,EAAAA,QAAD,CAAc,CAAA,CACxC,CAAA,GACN,EAAAS,EAAA,IAAA,CAACb,EAAAA,KAAD,CAAM,GAAG,OAAO,SAAS,UAAU,MAAOwC,EAAO,WAAa,WAC3D,SAAAT,EAAO,WAAWU,EACf,CAAA,CACA,CAPK,EAAAA,CAOL,CAEZ,CAAC,CACK,C,GAEPV,EAAO,SACN,EAAAlB,EAAA,KAAA,CAAAR,EAAAA,SAAA,CAAA,SAAA,EACE,EAAAQ,EAAA,IAAA,CAACf,EAAAA,IAAD,CAAK,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,SAAW,CAAA,GACtD,EAAAe,EAAA,IAAA,CAACb,EAAAA,KAAD,CAAM,GAAG,OAAO,SAAS,MAAM,MAAM,WAAW,MAAO,CAAE,WAAY,CAAE,EACpE,SAAA+B,EAAO,MACJ,CAAA,CACN,CAAA,CAAA,CAED,C,EAET,E"}
|
|
1
|
+
{"version":3,"file":"SupplierRatingBreakdown.cjs","names":["useUiLabels","mergeSupplierRatingLabels","Box","HStack","Text","VStack","Icon","CheckCircleIcon","XCircleIcon","_Fragment","require_labels","require_UiLabelsProvider","require_Text","require_Icon","require_CheckCircleIcon","require_XCircleIcon","_stokelp_styled_system_jsx","react_jsx_runtime","SUPPLIER_RATING_MAX","COMPLETION_ORDER","formatOverall","locale","overall","formatResponseDelay","minutes","units","hours","days","getHeadlineColor","ratio","getBarColor","ratioPercent","SupplierRatingBreakdown","labelsProp","uiLabels","labels","hasResponseRate","responseRate","hasDelay","rating","delayPercent","completionPercent","rows","row","done","key"],"sources":["../../../src/components/supplier-rating-badge/SupplierRatingBreakdown.tsx"],"sourcesContent":["import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/outline'\nimport { Box, HStack, VStack } from '@stokelp/styled-system/jsx'\n\nimport { Icon } from '~/components/icon/Icon'\nimport { Text } from '~/components/text/Text'\nimport { useUiLabels } from '~/components/ui-labels/UiLabelsProvider'\nimport {\n mergeSupplierRatingLabels,\n type SupplierRatingCompletionKey,\n type SupplierRatingComponentKey,\n type SupplierRating,\n type SupplierRatingLabels,\n} from './labels'\n\nexport * from './labels'\n\nexport const SUPPLIER_RATING_MAX = 5\n\nconst COMPLETION_ORDER: SupplierRatingCompletionKey[] = [\n 'profile',\n 'location',\n 'contacts',\n 'legalBanking',\n 'sector',\n 'certificate',\n]\n\n/** Note with one decimal in the reader's number format (\"4,2\" in French, \"4.2\" in English). */\nexport function formatOverall(overall: number, locale = 'fr-FR'): string {\n return new Intl.NumberFormat(locale, { minimumFractionDigits: 1, maximumFractionDigits: 1 }).format(overall)\n}\n\n/** Average response delay: minutes → \"45 min\" / \"18 h\" / \"2,5 j\". */\nexport function formatResponseDelay(minutes: number, units: SupplierRatingLabels['units'], locale = 'fr-FR'): string {\n if (minutes < 60) return `${Math.round(minutes)} ${units.minutes}`\n const hours = minutes / 60\n if (hours < 48) return `${Math.round(hours)} ${units.hours}`\n const days = hours / 24\n return `${new Intl.NumberFormat(locale, { maximumFractionDigits: 1 }).format(days)} ${units.days}`\n}\n\nexport function getHeadlineColor(overall: number): string {\n const ratio = overall / SUPPLIER_RATING_MAX\n if (ratio >= 0.7) return '#3B6D11'\n if (ratio >= 0.4) return '#854F0B'\n return '#A32D2D'\n}\n\nfunction getBarColor(ratioPercent: number): string {\n if (ratioPercent >= 70) return '#639922'\n if (ratioPercent >= 40) return '#BA7517'\n return '#E24B4A'\n}\n\ntype ComponentRow = {\n key: SupplierRatingComponentKey\n value: string\n /** 0..100 bar fill, or null when there is no data. */\n barPercent: number | null\n /** Bar/value colour, or undefined for the neutral (no-data) state. */\n color?: string\n}\n\ntype SupplierRatingBreakdownProps = {\n rating: SupplierRating\n /** Original response rate (0..100), displayed as the \"Taux de réponse\" value. */\n responseRate?: number\n labels?: Partial<SupplierRatingLabels>\n}\n\nexport const SupplierRatingBreakdown = ({ rating, responseRate, labels: labelsProp }: SupplierRatingBreakdownProps) => {\n const uiLabels = useUiLabels()\n const labels = mergeSupplierRatingLabels(uiLabels.supplierRating, labelsProp)\n\n const hasResponseRate = responseRate != null\n const hasDelay = rating.responseDelayMinutes != null\n const delayPercent = rating.responseDelayScore != null ? Math.round(rating.responseDelayScore * 100) : null\n const completionPercent = Math.round(rating.completionScore * 100)\n\n const rows: ComponentRow[] = [\n {\n key: 'responseRate',\n value: hasResponseRate ? `${Math.round(responseRate)} %` : labels.notAvailable,\n barPercent: hasResponseRate ? Math.round(responseRate) : null,\n color: hasResponseRate ? getBarColor(Math.round(responseRate)) : undefined,\n },\n {\n key: 'responseDelay',\n value: hasDelay\n ? formatResponseDelay(rating.responseDelayMinutes as number, labels.units, uiLabels.locale)\n : labels.notAvailable,\n barPercent: delayPercent,\n color: delayPercent != null ? getBarColor(delayPercent) : undefined,\n },\n {\n key: 'completion',\n value: `${completionPercent} %`,\n barPercent: completionPercent,\n color: getBarColor(completionPercent),\n },\n ]\n\n return (\n <Box\n bg=\"white\"\n borderRadius=\"radius-8\"\n p=\"space-16\"\n minW=\"240px\"\n maxW=\"260px\"\n css={{ '& *': { fontFamily: 'inherit' } }}\n >\n <HStack justify=\"space-between\" alignItems=\"baseline\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.md\" fontWeight=\"bold\">\n {labels.title}\n </Text>\n {rating.insufficientData || rating.overall == null ? (\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"medium\" color=\"grey.400\">\n {labels.insufficientData}\n </Text>\n ) : (\n <Text as=\"span\" fontSize=\"body.lg\" fontWeight=\"medium\" style={{ color: getHeadlineColor(rating.overall) }}>\n {formatOverall(rating.overall, uiLabels.locale)} / {SUPPLIER_RATING_MAX} ★\n </Text>\n )}\n </HStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-8\" mb=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.componentsTitle}\n </Text>\n {rows.map(row => (\n <VStack key={row.key} alignItems=\"stretch\" gap=\"space-2\">\n <HStack justify=\"space-between\" alignItems=\"baseline\" gap=\"space-8\">\n <Text as=\"span\" fontSize=\"body.sm\" color=\"grey.500\">\n {labels.components[row.key]}\n </Text>\n <Text\n as=\"span\"\n fontSize=\"body.sm\"\n fontWeight=\"medium\"\n whiteSpace=\"nowrap\"\n style={{ color: row.color }}\n color={row.color ? undefined : 'grey.300'}\n >\n {row.value}\n </Text>\n </HStack>\n <Box h=\"3px\" bg=\"grey.100\" borderRadius=\"full\" overflow=\"hidden\">\n <Box\n h=\"100%\"\n borderRadius=\"full\"\n style={{\n width: row.barPercent != null ? `${row.barPercent}%` : '0%',\n background: row.color ?? 'transparent',\n }}\n />\n </Box>\n </VStack>\n ))}\n </VStack>\n\n <Box h=\"1px\" bg=\"grey.100\" mb=\"space-8\" />\n\n <VStack alignItems=\"stretch\" gap=\"space-4\">\n <Text as=\"span\" fontSize=\"body.sm\" fontWeight=\"bold\" color=\"grey.400\">\n {labels.completionTitle}\n </Text>\n {COMPLETION_ORDER.map(key => {\n const done = rating.completion[key]\n return (\n <HStack key={key} alignItems=\"center\" gap=\"space-8\">\n <Icon size=\"sm\" color={done ? 'success.500' : 'grey.300'} flexShrink=\"0\">\n {done ? <CheckCircleIcon /> : <XCircleIcon />}\n </Icon>\n <Text as=\"span\" fontSize=\"body.sm\" color={done ? 'grey.500' : 'grey.400'}>\n {labels.completion[key]}\n </Text>\n </HStack>\n )\n })}\n </VStack>\n\n {labels.footer && (\n <>\n <Box h=\"1px\" bg=\"grey.100\" mt=\"space-8\" mb=\"space-8\" />\n <Text as=\"span\" fontSize=\"9px\" color=\"grey.300\" style={{ lineHeight: 1 }}>\n {labels.footer}\n </Text>\n </>\n )}\n </Box>\n )\n}\n"],"mappings":"A,uYAgBA,IAAakB,EAAsB,EAE7BC,EAAkD,CACtD,UACA,WACA,WACA,eACA,SACA,aACF,EAGA,SAAgBC,EAAc,EAAiB,EAAS,QAAiB,CACvE,OAAO,IAAI,KAAK,aAAaC,EAAQ,CAAE,sBAAuB,EAAG,sBAAuB,CAAE,CAAC,CAAC,CAAC,OAAOC,CAAO,CAC7G,CAGA,SAAgBC,EAAoB,EAAiB,EAAsC,EAAS,QAAiB,CACnH,GAAIC,EAAU,GAAI,MAAO,GAAG,KAAK,MAAMA,CAAO,EAAE,GAAGC,EAAM,UACzD,IAAMC,EAAQF,EAAU,GACxB,GAAIE,EAAQ,GAAI,MAAO,GAAG,KAAK,MAAMA,CAAK,EAAE,GAAGD,EAAM,QACrD,IAAME,EAAOD,EAAQ,GACrB,MAAO,GAAG,IAAI,KAAK,aAAaL,EAAQ,CAAE,sBAAuB,CAAE,CAAC,CAAC,CAAC,OAAOM,CAAI,EAAE,GAAGF,EAAM,MAC9F,CAEA,SAAgBG,EAAiB,EAAyB,CACxD,IAAMC,EAAQP,EAAA,EAGd,OAFIO,GAAS,GAAY,UACrBA,GAAS,GAAY,UAClB,SACT,CAEA,SAASC,EAAY,EAA8B,CAGjD,OAFIC,GAAgB,GAAW,UAC3BA,GAAgB,GAAW,UACxB,SACT,CAkBA,IAAaC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