@fanvue/ui 3.26.0 → 3.27.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.
- package/dist/cjs/components/Icons/AISettingsIcon.cjs +83 -0
- package/dist/cjs/components/Icons/AISettingsIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/AddCircleIcon.cjs +81 -0
- package/dist/cjs/components/Icons/AddCircleIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/ProgrammingArrowIcon.cjs +9 -76
- package/dist/cjs/components/Icons/ProgrammingArrowIcon.cjs.map +1 -1
- package/dist/cjs/components/Icons/RefreshArrowIcon.cjs +3 -12
- package/dist/cjs/components/Icons/RefreshArrowIcon.cjs.map +1 -1
- package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs +21 -13
- package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
- package/dist/cjs/index.cjs +4 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/components/Icons/AISettingsIcon.mjs +66 -0
- package/dist/components/Icons/AISettingsIcon.mjs.map +1 -0
- package/dist/components/Icons/AddCircleIcon.mjs +64 -0
- package/dist/components/Icons/AddCircleIcon.mjs.map +1 -0
- package/dist/components/Icons/ProgrammingArrowIcon.mjs +9 -76
- package/dist/components/Icons/ProgrammingArrowIcon.mjs.map +1 -1
- package/dist/components/Icons/RefreshArrowIcon.mjs +3 -12
- package/dist/components/Icons/RefreshArrowIcon.mjs.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.mjs +21 -13
- package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/dist/index.d.ts +48 -9
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/Icons/AiSettingsIcon.cjs +0 -92
- package/dist/cjs/components/Icons/AiSettingsIcon.cjs.map +0 -1
- package/dist/components/Icons/AiSettingsIcon.mjs +0 -75
- package/dist/components/Icons/AiSettingsIcon.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgrammingArrowIcon.mjs","sources":["../../../src/components/Icons/ProgrammingArrowIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { BaseIcon } from \"./BaseIcon\";\nimport type { BaseIconProps, IconVariants } from \"./types\";\n\nconst VARIANTS: IconVariants = {\n 16: {\n outlined: [\n {
|
|
1
|
+
{"version":3,"file":"ProgrammingArrowIcon.mjs","sources":["../../../src/components/Icons/ProgrammingArrowIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { BaseIcon } from \"./BaseIcon\";\nimport type { BaseIconProps, IconVariants } from \"./types\";\n\nconst VARIANTS: IconVariants = {\n 16: {\n outlined: [\n { d: \"M12.667 10.667V4.333c0-.733-.6-1.333-1.333-1.333h-3\" },\n {\n d: \"M10 1.333 8 3l2 1.667M3.334 6v4.667m.166-5a2.167 2.167 0 1 0 0-4.334 2.167 2.167 0 0 0 0 4.334m-.166 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4m9.333 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4\",\n },\n ],\n filled: [\n {\n d: \"M3.834 10.74V5.26c.86-.22 1.5-.993 1.5-1.927 0-1.106-.894-2-2-2-1.107 0-2 .894-2 2 0 .934.64 1.707 1.5 1.927v5.473a1.997 1.997 0 0 0 .5 3.933c1.106 0 2-.893 2-2 0-.933-.64-1.706-1.5-1.926m9.333 0V4.335c0-1.014-.82-1.834-1.833-1.834H9.38l.94-.78a.505.505 0 0 0 .067-.706.506.506 0 0 0-.707-.067l-2 1.667a.508.508 0 0 0 0 .773l2 1.667a.506.506 0 0 0 .707-.067.5.5 0 0 0-.067-.707l-.94-.78h1.954c.46 0 .833.374.833.834v6.407c-.86.22-1.5.993-1.5 1.926 0 1.107.893 2 2 2s2-.893 2-2c0-.933-.64-1.707-1.5-1.926\",\n },\n ],\n },\n 24: {\n outlined: [\n { d: \"M19 16V6.5c0-1.1-.9-2-2-2h-4.5\", sw: 1.5 },\n {\n d: \"m15 2-3 2.5L15 7M5 9v7m.25-7.5a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5M5 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6m14 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6\",\n sw: 1.5,\n },\n ],\n filled: [\n {\n d: \"M5.75 16.11V7.89A2.98 2.98 0 0 0 8 5c0-1.66-1.34-3-3-3S2 3.34 2 5c0 1.4.96 2.56 2.25 2.89v8.21A2.996 2.996 0 0 0 5 22c1.66 0 3-1.34 3-3 0-1.4-.96-2.56-2.25-2.89m14 0V6.5c0-1.52-1.23-2.75-2.75-2.75h-2.93l1.41-1.17c.32-.27.36-.74.1-1.06a.76.76 0 0 0-1.06-.1l-3 2.5a.76.76 0 0 0 0 1.16l3 2.5c.14.12.31.17.48.17a.75.75 0 0 0 .48-1.33l-1.41-1.17H17c.69 0 1.25.56 1.25 1.25v9.61A2.98 2.98 0 0 0 16 19c0 1.66 1.34 3 3 3s3-1.34 3-3c0-1.4-.96-2.56-2.25-2.89\",\n },\n ],\n },\n 32: {\n outlined: [\n { d: \"M25.333 21.333V8.667C25.333 7.2 24.133 6 22.667 6h-6\", sw: 2 },\n {\n d: \"M20 2.667 16 6l4 3.333M6.667 12v9.333m.333-10a4.333 4.333 0 1 0 0-8.666 4.333 4.333 0 0 0 0 8.666m-.333 18a4 4 0 1 0 0-8 4 4 0 0 0 0 8m18.666 0a4 4 0 1 0 0-8 4 4 0 0 0 0 8\",\n sw: 2,\n },\n ],\n filled: [\n {\n d: \"M7.667 21.48V10.52c1.72-.44 3-1.987 3-3.853 0-2.214-1.787-4-4-4s-4 1.786-4 4a3.98 3.98 0 0 0 3 3.853v10.947c-1.72.453-3 2-3 3.866 0 2.214 1.786 4 4 4s4-1.786 4-4a3.98 3.98 0 0 0-3-3.853m18.666 0V8.669A3.665 3.665 0 0 0 22.667 5H18.76l1.88-1.56c.427-.36.48-.987.133-1.413a1.01 1.01 0 0 0-1.413-.134l-4 3.334A1 1 0 0 0 15 6c0 .307.133.573.36.773l4 3.334c.187.16.413.226.64.226a.999.999 0 0 0 .64-1.773L18.76 7h3.906c.92 0 1.667.747 1.667 1.667V21.48c-1.72.44-3 1.987-3 3.853 0 2.214 1.787 4 4 4s4-1.786 4-4a3.98 3.98 0 0 0-3-3.853\",\n },\n ],\n },\n};\n\n/** Props for {@link ProgrammingArrowIcon}. See {@link BaseIconProps} for the shared shape. */\nexport type ProgrammingArrowIconProps = BaseIconProps;\n\n/**\n * Programming Arrow icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.\n *\n * @example\n * ```tsx\n * <ProgrammingArrowIcon size={24} filled />\n * ```\n */\nexport const ProgrammingArrowIcon = React.forwardRef<SVGSVGElement, ProgrammingArrowIconProps>(\n (props, ref) => <BaseIcon ref={ref} variants={VARIANTS} {...props} />,\n);\n\nProgrammingArrowIcon.displayName = \"ProgrammingArrowIcon\";\n"],"names":[],"mappings":";;;;AAIA,MAAM,WAAyB;AAAA,EAC7B,IAAI;AAAA,IACF,UAAU;AAAA,MACR,EAAE,GAAG,sDAAA;AAAA,MACL;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR,EAAE,GAAG,kCAAkC,IAAI,IAAA;AAAA,MAC3C;AAAA,QACE,GAAG;AAAA,QACH,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR,EAAE,GAAG,wDAAwD,IAAI,EAAA;AAAA,MACjE;AAAA,QACE,GAAG;AAAA,QACH,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,IAEF,QAAQ;AAAA,MACN;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAEJ;AAaO,MAAM,uBAAuB,MAAM;AAAA,EACxC,CAAC,OAAO,QAAQ,oBAAC,YAAS,KAAU,UAAU,UAAW,GAAG,MAAA,CAAO;AACrE;AAEA,qBAAqB,cAAc;"}
|
|
@@ -6,30 +6,21 @@ const VARIANTS = {
|
|
|
6
6
|
16: {
|
|
7
7
|
outlined: [
|
|
8
8
|
{
|
|
9
|
-
d: "
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
d: "M 7.53,15.15 C 7.51,15.15 7.5,15.15 7.49,15.15 C 6.77,15.1 6.07,14.94 5.4,14.68 C 5.21,14.61 5.07,14.41 5.08,14.21 C 5.08,14.15 5.09,14.09 5.11,14.03 C 5.21,13.78 5.51,13.65 5.76,13.75 C 6.34,13.97 6.95,14.11 7.56,14.15 C 7.82,14.17 8.03,14.39 8.03,14.66 L 8.02,14.69 C 8.01,14.95 7.79,15.15 7.53,15.15 M 3.85,13.72 C 3.74,13.72 3.63,13.68 3.54,13.61 C 2.98,13.16 2.49,12.63 2.09,12.05 C 2.03,11.96 1.99,11.87 1.99,11.77 C 1.99,11.6 2.07,11.45 2.21,11.35 C 2.43,11.2 2.75,11.26 2.91,11.47 C 2.91,11.48 2.91,11.48 2.91,11.48 C 2.91,11.49 2.92,11.5 2.93,11.51 C 3.27,12.01 3.69,12.45 4.17,12.83 C 4.28,12.92 4.35,13.06 4.35,13.21 C 4.35,13.33 4.32,13.44 4.25,13.53 C 4.15,13.65 4.01,13.72 3.85,13.72 M 1.63,10.47 C 1.41,10.47 1.21,10.33 1.15,10.12 C 0.94,9.43 0.83,8.72 0.83,8 L 0.83,7.99 C 0.84,7.72 1.06,7.5 1.33,7.5 C 1.61,7.5 1.83,7.73 1.83,8 C 1.83,8.63 1.93,9.24 2.11,9.82 C 2.12,9.87 2.13,9.92 2.13,9.97 C 2.13,10.19 1.99,10.38 1.77,10.45 C 1.73,10.46 1.68,10.47 1.63,10.47"
|
|
9
|
+
d: "M9.7 14.947a.504.504 0 0 1-.487-.374.5.5 0 0 1 .36-.613 6.17 6.17 0 0 0 4.594-5.967c0-3.4-2.767-6.166-6.167-6.166-2.887 0-4.78 1.686-5.667 2.706h1.96a.504.504 0 0 1 0 1.007H1.34a.6.6 0 0 1-.14-.02.6.6 0 0 1-.16-.08.44.44 0 0 1-.14-.153.5.5 0 0 1-.067-.207V2c0-.273.227-.5.5-.5.274 0 .5.227.5.5v1.593C2.92 2.427 4.967.833 8 .833a7.17 7.17 0 0 1 1.827 14.1 1 1 0 0 1-.127.014m-2.173.206c-.014 0-.027-.006-.034-.006A7 7 0 0 1 5.4 14.68a.5.5 0 0 1-.287-.647c.1-.253.4-.38.647-.286a6.2 6.2 0 0 0 1.8.406c.26.014.467.24.467.507l-.007.027a.496.496 0 0 1-.493.466M3.853 13.72a.54.54 0 0 1-.313-.107 7.4 7.4 0 0 1-1.453-1.566.486.486 0 0 1 .126-.694.513.513 0 0 1 .694.12v.007c.006.007.013.02.02.027.346.5.766.946 1.24 1.32a.514.514 0 0 1 .08.707c-.1.12-.24.186-.394.186m-2.226-3.253a.49.49 0 0 1-.474-.347A7.1 7.1 0 0 1 .833 8v-.007a.5.5 0 0 1 .5-.493c.274 0 .5.227.5.5 0 .627.094 1.24.274 1.82.013.053.02.1.02.153a.5.5 0 0 1-.5.494"
|
|
13
10
|
}
|
|
14
11
|
]
|
|
15
12
|
},
|
|
16
13
|
24: {
|
|
17
14
|
outlined: [
|
|
18
15
|
{
|
|
19
|
-
d: "
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
d: "M 11.29,22.73 C 11.27,22.73 11.25,22.72 11.24,22.72 C 10.16,22.65 9.1,22.41 8.1,22.02 C 7.81,21.91 7.61,21.62 7.62,21.31 C 7.62,21.22 7.64,21.13 7.67,21.05 C 7.82,20.67 8.27,20.48 8.64,20.62 C 9.51,20.96 10.42,21.16 11.34,21.23 C 11.73,21.25 12.04,21.59 12.04,21.99 L 12.03,22.03 C 12.01,22.42 11.68,22.73 11.29,22.73 M 5.78,20.58 C 5.61,20.58 5.45,20.52 5.31,20.42 C 4.47,19.74 3.73,18.95 3.13,18.07 C 3.04,17.94 2.99,17.8 2.99,17.65 C 2.99,17.4 3.11,17.17 3.32,17.03 C 3.65,16.8 4.13,16.89 4.36,17.21 C 4.36,17.22 4.36,17.22 4.36,17.22 C 4.37,17.23 4.38,17.25 4.39,17.26 C 4.91,18.01 5.54,18.68 6.25,19.24 C 6.42,19.38 6.53,19.59 6.53,19.82 C 6.53,19.99 6.48,20.16 6.37,20.3 C 6.22,20.48 6.01,20.58 5.78,20.58 M 2.44,15.7 C 2.11,15.7 1.82,15.49 1.73,15.18 C 1.41,14.15 1.25,13.08 1.25,12 L 1.25,11.99 C 1.26,11.58 1.59,11.25 2,11.25 C 2.41,11.25 2.75,11.59 2.75,12 C 2.75,12.94 2.89,13.86 3.16,14.73 C 3.18,14.81 3.19,14.88 3.19,14.96 C 3.19,15.28 2.98,15.57 2.66,15.67 C 2.59,15.69 2.52,15.7 2.44,15.7"
|
|
16
|
+
d: "M14.55 22.42c-.33 0-.64-.22-.73-.56-.11-.4.13-.81.54-.92a9.256 9.256 0 0 0 6.89-8.95c0-5.1-4.15-9.25-9.25-9.25-4.33 0-7.17 2.53-8.5 4.06h2.94a.755.755 0 0 1 0 1.51H2.01c-.05 0-.14-.01-.21-.03a.9.9 0 0 1-.24-.12.66.66 0 0 1-.21-.23.8.8 0 0 1-.1-.31V3c0-.41.34-.75.75-.75s.75.34.75.75v2.39C4.38 3.64 7.45 1.25 12 1.25c5.93 0 10.75 4.82 10.75 10.75 0 4.88-3.29 9.16-8.01 10.4-.06.01-.13.02-.19.02m-3.26.31c-.02 0-.04-.01-.05-.01-1.08-.07-2.14-.31-3.14-.7a.747.747 0 0 1-.43-.97c.15-.38.6-.57.97-.43.87.34 1.78.54 2.7.61.39.02.7.36.7.76l-.01.04c-.02.39-.35.7-.74.7m-5.51-2.15c-.17 0-.33-.06-.47-.16-.84-.68-1.58-1.47-2.18-2.35a.73.73 0 0 1 .19-1.04.77.77 0 0 1 1.04.18v.01c.01.01.02.03.03.04a9.2 9.2 0 0 0 1.86 1.98c.17.14.28.35.28.58 0 .17-.05.34-.16.48-.15.18-.36.28-.59.28M2.44 15.7c-.33 0-.62-.21-.71-.52-.32-1.03-.48-2.1-.48-3.18v-.01c.01-.41.34-.74.75-.74s.75.34.75.75c0 .94.14 1.86.41 2.73.02.08.03.15.03.23a.747.747 0 0 1-.75.74"
|
|
23
17
|
}
|
|
24
18
|
]
|
|
25
19
|
},
|
|
26
20
|
32: {
|
|
27
21
|
outlined: [
|
|
28
22
|
{
|
|
29
|
-
d: "
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
d: "M 15.05,30.31 C 15.03,30.31 15,30.29 14.99,30.29 C 13.55,30.2 12.13,29.88 10.8,29.36 C 10.41,29.21 10.15,28.83 10.16,28.41 C 10.16,28.29 10.19,28.17 10.23,28.07 C 10.43,27.56 11.03,27.31 11.52,27.49 C 12.68,27.95 13.89,28.21 15.12,28.31 C 15.64,28.33 16.05,28.79 16.05,29.32 L 16.04,29.37 C 16.01,29.89 15.57,30.31 15.05,30.31 M 7.71,27.44 C 7.48,27.44 7.27,27.36 7.08,27.23 C 5.96,26.32 4.97,25.27 4.17,24.09 C 4.05,23.92 3.99,23.73 3.99,23.53 C 3.99,23.2 4.15,22.89 4.43,22.71 C 4.87,22.4 5.51,22.52 5.81,22.95 C 5.81,22.96 5.81,22.96 5.81,22.96 C 5.83,22.97 5.84,23 5.85,23.01 C 6.55,24.01 7.39,24.91 8.33,25.65 C 8.56,25.84 8.71,26.12 8.71,26.43 C 8.71,26.65 8.64,26.88 8.49,27.07 C 8.29,27.31 8.01,27.44 7.71,27.44 M 3.25,20.93 C 2.81,20.93 2.43,20.65 2.31,20.24 C 1.88,18.87 1.67,17.44 1.67,16 L 1.67,15.99 C 1.68,15.44 2.12,15 2.67,15 C 3.21,15 3.67,15.45 3.67,16 C 3.67,17.25 3.85,18.48 4.21,19.64 C 4.24,19.75 4.25,19.84 4.25,19.95 C 4.25,20.37 3.97,20.76 3.55,20.89 C 3.45,20.92 3.36,20.93 3.25,20.93"
|
|
23
|
+
d: "M19.4 29.893c-.44 0-.853-.293-.973-.746a1 1 0 0 1 .72-1.227 12.34 12.34 0 0 0 9.186-11.933c0-6.8-5.533-12.334-12.333-12.334-5.773 0-9.56 3.374-11.333 5.414h3.92a1.007 1.007 0 0 1 0 2.013H2.68c-.067 0-.187-.013-.28-.04a1.2 1.2 0 0 1-.32-.16.9.9 0 0 1-.28-.307 1.1 1.1 0 0 1-.133-.413V4c0-.547.453-1 1-1s1 .453 1 1v3.187C5.84 4.853 9.933 1.667 16 1.667c7.907 0 14.333 6.426 14.333 14.333 0 6.507-4.386 12.213-10.68 13.867a2 2 0 0 1-.253.026m-4.347.414c-.026 0-.053-.014-.066-.014a14 14 0 0 1-4.187-.933.995.995 0 0 1-.573-1.293c.2-.507.8-.76 1.293-.574 1.16.454 2.373.72 3.6.814.52.026.933.48.933 1.013l-.013.053a.99.99 0 0 1-.987.934M7.707 27.44c-.227 0-.44-.08-.627-.213a14.7 14.7 0 0 1-2.907-3.134.973.973 0 0 1 .254-1.386 1.025 1.025 0 0 1 1.386.24v.013c.014.013.027.04.04.053.694 1 1.534 1.894 2.48 2.64.227.187.374.467.374.774 0 .226-.067.453-.214.64-.2.24-.48.373-.786.373m-4.454-6.507a.98.98 0 0 1-.946-.693c-.427-1.373-.64-2.8-.64-4.24v-.013a1.005 1.005 0 0 1 1-.987c.546 0 1 .453 1 1 0 1.253.186 2.48.546 3.64.027.107.04.2.04.307 0 .426-.28.813-.706.946-.094.027-.187.04-.294.04"
|
|
33
24
|
}
|
|
34
25
|
]
|
|
35
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshArrowIcon.mjs","sources":["../../../src/components/Icons/RefreshArrowIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { BaseIcon } from \"./BaseIcon\";\nimport type { BaseIconProps, IconVariants } from \"./types\";\n\nconst VARIANTS: IconVariants = {\n 16: {\n outlined: [\n {\n d: \"
|
|
1
|
+
{"version":3,"file":"RefreshArrowIcon.mjs","sources":["../../../src/components/Icons/RefreshArrowIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { BaseIcon } from \"./BaseIcon\";\nimport type { BaseIconProps, IconVariants } from \"./types\";\n\nconst VARIANTS: IconVariants = {\n 16: {\n outlined: [\n {\n d: \"M9.7 14.947a.504.504 0 0 1-.487-.374.5.5 0 0 1 .36-.613 6.17 6.17 0 0 0 4.594-5.967c0-3.4-2.767-6.166-6.167-6.166-2.887 0-4.78 1.686-5.667 2.706h1.96a.504.504 0 0 1 0 1.007H1.34a.6.6 0 0 1-.14-.02.6.6 0 0 1-.16-.08.44.44 0 0 1-.14-.153.5.5 0 0 1-.067-.207V2c0-.273.227-.5.5-.5.274 0 .5.227.5.5v1.593C2.92 2.427 4.967.833 8 .833a7.17 7.17 0 0 1 1.827 14.1 1 1 0 0 1-.127.014m-2.173.206c-.014 0-.027-.006-.034-.006A7 7 0 0 1 5.4 14.68a.5.5 0 0 1-.287-.647c.1-.253.4-.38.647-.286a6.2 6.2 0 0 0 1.8.406c.26.014.467.24.467.507l-.007.027a.496.496 0 0 1-.493.466M3.853 13.72a.54.54 0 0 1-.313-.107 7.4 7.4 0 0 1-1.453-1.566.486.486 0 0 1 .126-.694.513.513 0 0 1 .694.12v.007c.006.007.013.02.02.027.346.5.766.946 1.24 1.32a.514.514 0 0 1 .08.707c-.1.12-.24.186-.394.186m-2.226-3.253a.49.49 0 0 1-.474-.347A7.1 7.1 0 0 1 .833 8v-.007a.5.5 0 0 1 .5-.493c.274 0 .5.227.5.5 0 .627.094 1.24.274 1.82.013.053.02.1.02.153a.5.5 0 0 1-.5.494\",\n },\n ],\n },\n 24: {\n outlined: [\n {\n d: \"M14.55 22.42c-.33 0-.64-.22-.73-.56-.11-.4.13-.81.54-.92a9.256 9.256 0 0 0 6.89-8.95c0-5.1-4.15-9.25-9.25-9.25-4.33 0-7.17 2.53-8.5 4.06h2.94a.755.755 0 0 1 0 1.51H2.01c-.05 0-.14-.01-.21-.03a.9.9 0 0 1-.24-.12.66.66 0 0 1-.21-.23.8.8 0 0 1-.1-.31V3c0-.41.34-.75.75-.75s.75.34.75.75v2.39C4.38 3.64 7.45 1.25 12 1.25c5.93 0 10.75 4.82 10.75 10.75 0 4.88-3.29 9.16-8.01 10.4-.06.01-.13.02-.19.02m-3.26.31c-.02 0-.04-.01-.05-.01-1.08-.07-2.14-.31-3.14-.7a.747.747 0 0 1-.43-.97c.15-.38.6-.57.97-.43.87.34 1.78.54 2.7.61.39.02.7.36.7.76l-.01.04c-.02.39-.35.7-.74.7m-5.51-2.15c-.17 0-.33-.06-.47-.16-.84-.68-1.58-1.47-2.18-2.35a.73.73 0 0 1 .19-1.04.77.77 0 0 1 1.04.18v.01c.01.01.02.03.03.04a9.2 9.2 0 0 0 1.86 1.98c.17.14.28.35.28.58 0 .17-.05.34-.16.48-.15.18-.36.28-.59.28M2.44 15.7c-.33 0-.62-.21-.71-.52-.32-1.03-.48-2.1-.48-3.18v-.01c.01-.41.34-.74.75-.74s.75.34.75.75c0 .94.14 1.86.41 2.73.02.08.03.15.03.23a.747.747 0 0 1-.75.74\",\n },\n ],\n },\n 32: {\n outlined: [\n {\n d: \"M19.4 29.893c-.44 0-.853-.293-.973-.746a1 1 0 0 1 .72-1.227 12.34 12.34 0 0 0 9.186-11.933c0-6.8-5.533-12.334-12.333-12.334-5.773 0-9.56 3.374-11.333 5.414h3.92a1.007 1.007 0 0 1 0 2.013H2.68c-.067 0-.187-.013-.28-.04a1.2 1.2 0 0 1-.32-.16.9.9 0 0 1-.28-.307 1.1 1.1 0 0 1-.133-.413V4c0-.547.453-1 1-1s1 .453 1 1v3.187C5.84 4.853 9.933 1.667 16 1.667c7.907 0 14.333 6.426 14.333 14.333 0 6.507-4.386 12.213-10.68 13.867a2 2 0 0 1-.253.026m-4.347.414c-.026 0-.053-.014-.066-.014a14 14 0 0 1-4.187-.933.995.995 0 0 1-.573-1.293c.2-.507.8-.76 1.293-.574 1.16.454 2.373.72 3.6.814.52.026.933.48.933 1.013l-.013.053a.99.99 0 0 1-.987.934M7.707 27.44c-.227 0-.44-.08-.627-.213a14.7 14.7 0 0 1-2.907-3.134.973.973 0 0 1 .254-1.386 1.025 1.025 0 0 1 1.386.24v.013c.014.013.027.04.04.053.694 1 1.534 1.894 2.48 2.64.227.187.374.467.374.774 0 .226-.067.453-.214.64-.2.24-.48.373-.786.373m-4.454-6.507a.98.98 0 0 1-.946-.693c-.427-1.373-.64-2.8-.64-4.24v-.013a1.005 1.005 0 0 1 1-.987c.546 0 1 .453 1 1 0 1.253.186 2.48.546 3.64.027.107.04.2.04.307 0 .426-.28.813-.706.946-.094.027-.187.04-.294.04\",\n },\n ],\n },\n};\n\n/** Props for {@link RefreshArrowIcon}. See {@link BaseIconProps} for the shared shape. */\nexport type RefreshArrowIconProps = BaseIconProps;\n\n/**\n * Refresh Arrow icon. Renders at sizes 16, 24, or 32 px.\n *\n * @example\n * ```tsx\n * <RefreshArrowIcon size={24} />\n * ```\n */\nexport const RefreshArrowIcon = React.forwardRef<SVGSVGElement, RefreshArrowIconProps>(\n (props, ref) => <BaseIcon ref={ref} variants={VARIANTS} {...props} />,\n);\n\nRefreshArrowIcon.displayName = \"RefreshArrowIcon\";\n"],"names":[],"mappings":";;;;AAIA,MAAM,WAAyB;AAAA,EAC7B,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAAA,EAEF,IAAI;AAAA,IACF,UAAU;AAAA,MACR;AAAA,QACE,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,EACF;AAEJ;AAaO,MAAM,mBAAmB,MAAM;AAAA,EACpC,CAAC,OAAO,QAAQ,oBAAC,YAAS,KAAU,UAAU,UAAW,GAAG,MAAA,CAAO;AACrE;AAEA,iBAAiB,cAAc;"}
|
|
@@ -27,15 +27,15 @@ function warnMissingOptionAccessibleName(options) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
function warnUnsupportedCollapsible(appearance, options) {
|
|
30
|
+
function warnUnsupportedCollapsible(appearance, options, hasCollapsedIcon) {
|
|
31
31
|
if (process.env.NODE_ENV !== "production") {
|
|
32
32
|
if (appearance === "pill") {
|
|
33
33
|
console.warn(
|
|
34
34
|
'SegmentedControl: `collapsible` is only supported for the "plain" and "brand" appearances; ignoring it.'
|
|
35
35
|
);
|
|
36
|
-
} else if (!options.every((option) => option.icon)) {
|
|
36
|
+
} else if (!hasCollapsedIcon && !options.every((option) => option.icon)) {
|
|
37
37
|
console.warn(
|
|
38
|
-
"SegmentedControl: `collapsible` requires every option to define an `icon
|
|
38
|
+
"SegmentedControl: `collapsible` requires every option to define an `icon`, or a `collapsedIcon` to show instead; ignoring it."
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -70,10 +70,10 @@ function getSegmentClassName({
|
|
|
70
70
|
disabled && "pointer-events-none"
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
"32": "
|
|
75
|
-
"40": "
|
|
76
|
-
"48": "
|
|
73
|
+
const collapsedSizeClasses = {
|
|
74
|
+
"32": "size-8",
|
|
75
|
+
"40": "size-10",
|
|
76
|
+
"48": "size-12"
|
|
77
77
|
};
|
|
78
78
|
function getCollapsedButtonClassName({
|
|
79
79
|
appearance,
|
|
@@ -89,8 +89,10 @@ function getCollapsedButtonClassName({
|
|
|
89
89
|
// footprint icon-sized while the padding enlarges the hit target.
|
|
90
90
|
"-m-1 p-1 text-icons-primary"
|
|
91
91
|
) : cn(
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
collapsedSizeClasses[size],
|
|
93
|
+
// Neutral circle rather than the brand pill: collapsed, the control is a switch
|
|
94
|
+
// affordance, not a preview of the selected segment.
|
|
95
|
+
"bg-surface-secondary text-icons-primary hover:bg-buttons-switch-hover"
|
|
94
96
|
),
|
|
95
97
|
disabled && "pointer-events-none"
|
|
96
98
|
);
|
|
@@ -132,17 +134,18 @@ const SegmentedControl = React.forwardRef(
|
|
|
132
134
|
onChange,
|
|
133
135
|
disabled = false,
|
|
134
136
|
collapsible = false,
|
|
137
|
+
collapsedIcon,
|
|
135
138
|
...props
|
|
136
139
|
}, ref) => {
|
|
137
140
|
warnMissingAccessibleName(props["aria-label"], props["aria-labelledby"]);
|
|
138
141
|
warnMissingOptionAccessibleName(options);
|
|
139
|
-
if (collapsible) warnUnsupportedCollapsible(appearance, options);
|
|
142
|
+
if (collapsible) warnUnsupportedCollapsible(appearance, options, collapsedIcon !== void 0);
|
|
140
143
|
const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0]?.value);
|
|
141
144
|
const isControlled = controlledValue !== void 0;
|
|
142
145
|
const currentValue = isControlled ? controlledValue : internalValue;
|
|
143
146
|
const anySelected = options.some((o) => o.value === currentValue);
|
|
144
147
|
const buttonRefs = React.useRef([]);
|
|
145
|
-
const canCollapse = collapsible && (appearance === "plain" || appearance === "brand") && options.every((option) => option.icon);
|
|
148
|
+
const canCollapse = collapsible && (appearance === "plain" || appearance === "brand") && (collapsedIcon !== void 0 || options.every((option) => option.icon));
|
|
146
149
|
const rootRef = React.useRef(null);
|
|
147
150
|
const measureRef = React.useRef(null);
|
|
148
151
|
const setRootRef = React.useCallback(
|
|
@@ -238,7 +241,12 @@ const SegmentedControl = React.forwardRef(
|
|
|
238
241
|
className: cn(
|
|
239
242
|
"relative items-center rounded-full",
|
|
240
243
|
variant === "fill" ? "flex w-full" : "inline-flex",
|
|
241
|
-
|
|
244
|
+
isCollapsed ? (
|
|
245
|
+
// Collapsed, the toggle itself carries the surface, so the container drops its own
|
|
246
|
+
// chrome and centres the button instead of pinning it to the start of a full-width
|
|
247
|
+
// row — in a narrow rail that offset is the whole width of the column.
|
|
248
|
+
"justify-center"
|
|
249
|
+
) : appearance === "plain" ? "gap-2" : "bg-surface-tertiary p-1",
|
|
242
250
|
disabled && "cursor-not-allowed opacity-50",
|
|
243
251
|
className
|
|
244
252
|
),
|
|
@@ -252,7 +260,7 @@ const SegmentedControl = React.forwardRef(
|
|
|
252
260
|
"aria-label": selectedOption.label,
|
|
253
261
|
onClick: handleCycle,
|
|
254
262
|
className: getCollapsedButtonClassName({ appearance, size, disabled }),
|
|
255
|
-
children: selectedOption.icon && /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center justify-center", "aria-hidden": "true", children: selectedOption.icon })
|
|
263
|
+
children: (collapsedIcon ?? selectedOption.icon) && /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center justify-center", "aria-hidden": "true", children: collapsedIcon ?? selectedOption.icon })
|
|
256
264
|
}
|
|
257
265
|
) : options.map((option, index) => renderSegment(option, index)),
|
|
258
266
|
canCollapse && // Off-screen replica of the fully expanded control. Kept in the DOM (out of flow, hidden
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.mjs","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Height of the segmented control in pixels. */\nexport type SegmentedControlSize = \"32\" | \"40\" | \"48\";\n\n/**\n * Segment layout.\n * - `\"hug\"`: each segment is sized to its content.\n * - `\"fill\"`: the control spans the full width of its container and each segment grows equally.\n */\nexport type SegmentedControlVariant = \"hug\" | \"fill\";\n\n/**\n * Visual style of the control.\n * - `\"pill\"`: the container has a muted background and the selected segment shows a filled pill (default).\n * - `\"plain\"`: no container or selected-pill background; segments are bare content and selection is\n * communicated by color alone. Designed for icon-only toggles (e.g. a list/grid view switch).\n * - `\"brand\"`: like `\"pill\"`, but segments render their `icon` alongside the visible `label` and the\n * selected segment uses the brand-green pill. Designed for prominent toggles such as the\n * Home/Agent navigation switch.\n */\nexport type SegmentedControlAppearance = \"pill\" | \"plain\" | \"brand\";\n\n/** Describes one selectable segment. */\nexport interface SegmentedControlOption {\n /**\n * Display label for the segment. In `pill`/`plain` appearances, when `icon` is provided the\n * segment renders icon-only and this value becomes its accessible name (applied as `aria-label`)\n * instead of visible text. In the `brand` appearance the label is always rendered as visible text\n * (alongside the icon when present).\n */\n label: string;\n /** Value identifier returned via `onChange`. */\n value: string;\n /**\n * Icon to render for the segment. In `pill`/`plain` appearances the segment renders icon-only and\n * `label` becomes required as its accessible name (applied as `aria-label`, no visible text). In\n * the `brand` appearance the icon renders alongside the visible `label`. Required for every option\n * when `collapsible` is set, since the collapsed control shows the selected option's icon alone.\n */\n icon?: React.ReactNode;\n}\n\nexport interface SegmentedControlProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Height of the control in pixels. @default \"32\" */\n size?: SegmentedControlSize;\n /** Segment layout. @default \"hug\" */\n variant?: SegmentedControlVariant;\n /** Visual style of the control. @default \"pill\" */\n appearance?: SegmentedControlAppearance;\n /** The selectable segments. Designed for two or three mutually exclusive options. */\n options: SegmentedControlOption[];\n /** Currently selected value (controlled). */\n value?: string;\n /** Initially selected value (uncontrolled). Defaults to the first option. */\n defaultValue?: string;\n /** Callback fired when the selected value changes. */\n onChange?: (value: string) => void;\n /** Whether the control is disabled. @default false */\n disabled?: boolean;\n /**\n * When `true`, the control automatically collapses to a single icon-only toggle whenever its\n * container is too narrow to show every segment side by side, and expands again when the space\n * returns. Collapsed, it shows the currently-selected option's `icon`; clicking it (or pressing\n * Enter/Space) advances to the next option, wrapping around from the last back to the first.\n *\n * Only supported for the icon-bearing `\"plain\"` and `\"brand\"` appearances, and every option must\n * define an `icon` (there is nothing to show otherwise). Ignored, with a dev-time warning, when\n * those conditions are not met. @default false\n */\n collapsible?: boolean;\n}\n\n/** Padding and typography per size. Combined with the container's `p-1` these hit the 32/40/48px heights. */\nconst sizeClasses: Record<SegmentedControlSize, string> = {\n \"32\": \"px-2 py-1 typography-description-12px-semibold\",\n \"40\": \"px-3 py-1.75 typography-body-small-14px-semibold\",\n \"48\": \"px-4 py-2 typography-body-default-16px-semibold\",\n};\n\nfunction warnMissingAccessibleName(ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"SegmentedControl: no accessible name provided. Pass an `aria-label` or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\nfunction warnMissingOptionAccessibleName(options: SegmentedControlOption[]) {\n if (process.env.NODE_ENV !== \"production\") {\n for (const option of options) {\n if (option.icon && !option.label?.trim()) {\n console.warn(\n `SegmentedControl: icon-only segment \"${option.value}\" is missing a non-empty \\`label\\` to use as its accessible name.`,\n );\n }\n }\n }\n}\n\nfunction warnUnsupportedCollapsible(\n appearance: SegmentedControlAppearance,\n options: SegmentedControlOption[],\n) {\n if (process.env.NODE_ENV !== \"production\") {\n if (appearance === \"pill\") {\n console.warn(\n 'SegmentedControl: `collapsible` is only supported for the \"plain\" and \"brand\" appearances; ignoring it.',\n );\n } else if (!options.every((option) => option.icon)) {\n console.warn(\n \"SegmentedControl: `collapsible` requires every option to define an `icon`; ignoring it.\",\n );\n }\n }\n}\n\nfunction getSegmentClassName({\n appearance,\n size,\n variant,\n isSelected,\n disabled,\n}: {\n appearance: SegmentedControlAppearance;\n size: SegmentedControlSize;\n variant: SegmentedControlVariant;\n isSelected: boolean;\n disabled: boolean;\n}) {\n return cn(\n \"relative inline-flex min-w-0 cursor-pointer items-center justify-center rounded-full\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n variant === \"fill\" ? \"flex-1\" : \"shrink-0\",\n appearance === \"plain\"\n ? cn(\n // Padding + negative margin enlarge the hit target without changing the\n // visual footprint, which must stay glyph-only to match the design.\n \"-m-1 p-1\",\n isSelected ? \"text-icons-primary\" : \"text-icons-tertiary hover:text-icons-primary\",\n )\n : cn(\n sizeClasses[size],\n // brand renders icon + label together, so space them.\n appearance === \"brand\" && \"gap-1.5\",\n isSelected\n ? appearance === \"brand\"\n ? // Approximate brand-green pill using existing tokens; exact colours pending\n // dedicated navigation tokens (see ENG follow-up).\n \"bg-brand-primary-muted text-content-always-black shadow-sm ring-1 ring-brand-primary-default\"\n : \"bg-buttons-primary-default text-content-primary-inverted shadow-sm\"\n : \"text-content-primary hover:bg-buttons-switch-hover\",\n ),\n disabled && \"pointer-events-none\",\n );\n}\n\n/** Symmetric padding per size so the collapsed toggle is a square (a circle once `rounded-full`). */\nconst collapsedPaddingClasses: Record<SegmentedControlSize, string> = {\n \"32\": \"p-1\",\n \"40\": \"p-2\",\n \"48\": \"p-3\",\n};\n\n/**\n * Classes for the single button shown while the control is collapsed. Unlike an expanded segment\n * (which carries asymmetric `px`/`py` padding and so reads slightly wider than tall), the collapsed\n * toggle is forced to an `aspect-square` circle via symmetric padding and `rounded-full`, so the\n * icon-only control reads as a round button.\n */\nfunction getCollapsedButtonClassName({\n appearance,\n size,\n disabled,\n}: {\n appearance: SegmentedControlAppearance;\n size: SegmentedControlSize;\n disabled: boolean;\n}) {\n return cn(\n \"relative inline-flex aspect-square shrink-0 cursor-pointer items-center justify-center rounded-full\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n appearance === \"plain\"\n ? // Glyph-only: no pill, just the selected icon colour. The negative margin keeps the visual\n // footprint icon-sized while the padding enlarges the hit target.\n \"-m-1 p-1 text-icons-primary\"\n : cn(\n collapsedPaddingClasses[size],\n \"bg-brand-primary-muted text-content-always-black shadow-sm ring-1 ring-brand-primary-default\",\n ),\n disabled && \"pointer-events-none\",\n );\n}\n\n/**\n * Watches `rootRef`'s available width against the natural width of the fully expanded control\n * (measured from `measureRef`, an off-screen replica) and returns whether the control should\n * collapse. Comparing available space to a stable off-screen measurement — rather than to the\n * live control, which shrinks when it collapses — avoids the expand/collapse oscillation that a\n * self-referential measurement would cause. Returns `false` until both widths are measurable\n * (SSR, jsdom, or a zero-width layout), so the control renders expanded by default.\n */\nfunction useAutoCollapse(\n rootRef: React.RefObject<HTMLDivElement | null>,\n measureRef: React.RefObject<HTMLDivElement | null>,\n enabled: boolean,\n): boolean {\n const [collapsed, setCollapsed] = React.useState(false);\n\n React.useEffect(() => {\n if (!enabled) {\n setCollapsed(false);\n return;\n }\n const root = rootRef.current;\n const measure = measureRef.current;\n const parent = root?.parentElement;\n if (!root || !measure || !parent) return;\n\n const evaluate = () => {\n const available = parent.getBoundingClientRect().width;\n const required = measure.getBoundingClientRect().width;\n // Both unmeasured (SSR/jsdom/zero-width): leave the current state untouched.\n if (available <= 0 || required <= 0) return;\n setCollapsed(required > available);\n };\n\n evaluate();\n\n const observer = new ResizeObserver(evaluate);\n observer.observe(parent);\n observer.observe(measure);\n return () => observer.disconnect();\n }, [enabled, rootRef, measureRef]);\n\n return enabled && collapsed;\n}\n\n/**\n * A compact selector for choosing between two or three mutually exclusive\n * options where the choice affects the content immediately below it. Use\n * instead of tabs when the options are more like settings or filters than\n * navigation, such as toggling a list/grid view or a monthly/annual price.\n *\n * Rendered as a `radiogroup` with roving-tabindex keyboard navigation. Supports\n * both controlled and uncontrolled usage. With `collapsible`, the icon-bearing\n * `plain`/`brand` appearances shrink to a single cycling icon toggle when space\n * is tight (rendered as a `group` containing one button).\n *\n * @example\n * ```tsx\n * <SegmentedControl\n * options={[\n * { label: \"Net\", value: \"net\" },\n * { label: \"Gross\", value: \"gross\" },\n * ]}\n * value={amount}\n * onChange={setAmount}\n * aria-label=\"Amount type\"\n * />\n * ```\n *\n * @example Icon-only segments (e.g. a list/grid view toggle)\n * ```tsx\n * <SegmentedControl\n * appearance=\"plain\"\n * options={[\n * { label: \"List view\", value: \"list\", icon: <ListViewIcon size={16} /> },\n * { label: \"Grid view\", value: \"grid\", icon: <GridViewIcon size={16} /> },\n * ]}\n * value={view}\n * onChange={setView}\n * aria-label=\"View\"\n * />\n * ```\n *\n * @example Icon + label with the brand-green pill (e.g. the Home/Agent nav switch)\n * ```tsx\n * <SegmentedControl\n * appearance=\"brand\"\n * options={[\n * { label: \"Home\", value: \"home\", icon: <HomeIcon size={16} /> },\n * { label: \"Agent\", value: \"agent\", icon: <AIIcon size={16} /> },\n * ]}\n * value={mode}\n * onChange={setMode}\n * aria-label=\"Navigation mode\"\n * />\n * ```\n *\n * @example Collapses to a cycling icon toggle when the container is too narrow\n * ```tsx\n * <SegmentedControl\n * appearance=\"plain\"\n * collapsible\n * options={[\n * { label: \"List view\", value: \"list\", icon: <ListViewIcon size={16} /> },\n * { label: \"Grid view\", value: \"grid\", icon: <GridViewIcon size={16} /> },\n * ]}\n * value={view}\n * onChange={setView}\n * aria-label=\"View\"\n * />\n * ```\n */\nexport const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedControlProps>(\n (\n {\n className,\n size = \"32\",\n variant = \"hug\",\n appearance = \"pill\",\n options,\n value: controlledValue,\n defaultValue,\n onChange,\n disabled = false,\n collapsible = false,\n ...props\n },\n ref,\n ) => {\n warnMissingAccessibleName(props[\"aria-label\"], props[\"aria-labelledby\"]);\n warnMissingOptionAccessibleName(options);\n if (collapsible) warnUnsupportedCollapsible(appearance, options);\n\n // Tracks selection for uncontrolled usage; ignored when `value` prop is provided\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0]?.value);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : internalValue;\n const anySelected = options.some((o) => o.value === currentValue);\n const buttonRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n // Collapsing only makes sense for icon-bearing appearances where every option has an icon\n // to show. Anything else falls back to the normal expanded control (a dev warning fires above).\n const canCollapse =\n collapsible &&\n (appearance === \"plain\" || appearance === \"brand\") &&\n options.every((option) => option.icon);\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const measureRef = React.useRef<HTMLDivElement | null>(null);\n const setRootRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n rootRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n const isCollapsed = useAutoCollapse(rootRef, measureRef, canCollapse);\n\n const handleSelect = (optionValue: string) => {\n if (disabled || optionValue === currentValue) return;\n if (!isControlled) {\n setInternalValue(optionValue);\n }\n onChange?.(optionValue);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent, index: number) => {\n const nextIndex =\n e.key === \"ArrowRight\" || e.key === \"ArrowDown\"\n ? (index + 1) % options.length\n : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\"\n ? (index - 1 + options.length) % options.length\n : null;\n if (nextIndex === null) return;\n e.preventDefault();\n const nextOption = options[nextIndex] as SegmentedControlOption;\n handleSelect(nextOption.value);\n buttonRefs.current[nextIndex]?.focus();\n };\n\n const renderSegment = (option: SegmentedControlOption, index: number) => {\n const isSelected = currentValue === option.value;\n // `brand` shows the label as visible text (with the icon); `pill`/`plain` render\n // icon-only when an icon is given, falling back to the label otherwise.\n const showLabelText = appearance === \"brand\" || !option.icon;\n return (\n // biome-ignore lint/a11y/useSemanticElements: native radio inputs only allow Tab-focus on the checked item; buttons with roving tabindex give full keyboard navigation\n <button\n key={option.value}\n ref={(el) => {\n buttonRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n tabIndex={isSelected || (!anySelected && index === 0) ? 0 : -1}\n disabled={disabled}\n aria-label={showLabelText ? undefined : option.label}\n onClick={() => handleSelect(option.value)}\n onKeyDown={(e) => handleKeyDown(e, index)}\n className={getSegmentClassName({ appearance, size, variant, isSelected, disabled })}\n >\n {option.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n {showLabelText && <span className=\"min-w-0 truncate\">{option.label}</span>}\n </button>\n );\n };\n\n // Off-screen replica of one segment used only to size the expanded control. Rendered as an\n // inert (disabled + `aria-hidden`) button with no `radio` semantics so it stays out of the\n // accessibility tree and tab order, and always with hug sizing so the replica reflects the\n // natural (uncompressed) width even under a `fill` layout.\n const renderMeasureSegment = (option: SegmentedControlOption) => {\n const showLabelText = appearance === \"brand\" || !option.icon;\n return (\n <button\n key={option.value}\n type=\"button\"\n disabled\n aria-hidden=\"true\"\n tabIndex={-1}\n className={getSegmentClassName({\n appearance,\n size,\n variant: \"hug\",\n isSelected: currentValue === option.value,\n disabled,\n })}\n >\n {option.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n {showLabelText && <span className=\"min-w-0 truncate\">{option.label}</span>}\n </button>\n );\n };\n\n // Collapsed: a single button showing the selected option's icon that cycles to the next\n // option on activation, wrapping from the last option back to the first.\n const selectedIndex = options.findIndex((option) => option.value === currentValue);\n const selectedOption = options[selectedIndex] ?? options[0];\n const handleCycle = () => {\n if (disabled || options.length === 0) return;\n const from = selectedIndex < 0 ? 0 : selectedIndex;\n const nextOption = options[(from + 1) % options.length] as SegmentedControlOption;\n handleSelect(nextOption.value);\n };\n\n return (\n <div\n ref={setRootRef}\n role={isCollapsed ? \"group\" : \"radiogroup\"}\n className={cn(\n \"relative items-center rounded-full\",\n variant === \"fill\" ? \"flex w-full\" : \"inline-flex\",\n appearance === \"plain\" ? \"gap-2\" : \"bg-surface-tertiary p-1\",\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n {isCollapsed && selectedOption ? (\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={selectedOption.label}\n onClick={handleCycle}\n className={getCollapsedButtonClassName({ appearance, size, disabled })}\n >\n {selectedOption.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {selectedOption.icon}\n </span>\n )}\n </button>\n ) : (\n options.map((option, index) => renderSegment(option, index))\n )}\n\n {canCollapse && (\n // Off-screen replica of the fully expanded control. Kept in the DOM (out of flow, hidden\n // from AT and tab order) so its natural width is always measurable, whether the visible\n // control is currently expanded or collapsed.\n <div\n ref={measureRef}\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none invisible absolute top-0 left-0 -z-10 flex items-center whitespace-nowrap rounded-full\",\n appearance === \"plain\" ? \"gap-2\" : \"bg-surface-tertiary p-1\",\n )}\n >\n {options.map((option) => renderMeasureSegment(option))}\n </div>\n )}\n </div>\n );\n },\n);\n\nSegmentedControl.displayName = \"SegmentedControl\";\n"],"names":[],"mappings":";;;;AA4EA,MAAM,cAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,SAAS,0BAA0B,WAAoB,gBAAyB;AAC9E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,aAAa,CAAC,gBAAgB;AACjC,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AAEA,SAAS,gCAAgC,SAAmC;AAC1E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,eAAW,UAAU,SAAS;AAC5B,UAAI,OAAO,QAAQ,CAAC,OAAO,OAAO,QAAQ;AACxC,gBAAQ;AAAA,UACN,wCAAwC,OAAO,KAAK;AAAA,QAAA;AAAA,MAExD;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,2BACP,YACA,SACA;AACA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,eAAe,QAAQ;AACzB,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ,WAAW,CAAC,QAAQ,MAAM,CAAC,WAAW,OAAO,IAAI,GAAG;AAClD,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AAEA,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,SA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AC,QAAA,EAAK,WAAU,6CAA4C,eAAY,QACrE,UAAA,eAAe,KAAA,CAClB;AAAA,YAAA;AAAA,UAAA,IAIJ,QAAQ,IAAI,CAAC,QAAQ,UAAU,cAAc,QAAQ,KAAK,CAAC;AAAA,UAG5D;AAAA;AAAA;AAAA,UAIC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL,eAAY;AAAA,cACZ,WAAW;AAAA,gBACT;AAAA,gBACA,eAAe,UAAU,UAAU;AAAA,cAAA;AAAA,cAGpC,kBAAQ,IAAI,CAAC,WAAW,qBAAqB,MAAM,CAAC;AAAA,YAAA;AAAA,UAAA;AAAA,QACvD;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,iBAAiB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"SegmentedControl.mjs","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Height of the segmented control in pixels. */\nexport type SegmentedControlSize = \"32\" | \"40\" | \"48\";\n\n/**\n * Segment layout.\n * - `\"hug\"`: each segment is sized to its content.\n * - `\"fill\"`: the control spans the full width of its container and each segment grows equally.\n */\nexport type SegmentedControlVariant = \"hug\" | \"fill\";\n\n/**\n * Visual style of the control.\n * - `\"pill\"`: the container has a muted background and the selected segment shows a filled pill (default).\n * - `\"plain\"`: no container or selected-pill background; segments are bare content and selection is\n * communicated by color alone. Designed for icon-only toggles (e.g. a list/grid view switch).\n * - `\"brand\"`: like `\"pill\"`, but segments render their `icon` alongside the visible `label` and the\n * selected segment uses the brand-green pill. Designed for prominent toggles such as the\n * Home/Agent navigation switch.\n */\nexport type SegmentedControlAppearance = \"pill\" | \"plain\" | \"brand\";\n\n/** Describes one selectable segment. */\nexport interface SegmentedControlOption {\n /**\n * Display label for the segment. In `pill`/`plain` appearances, when `icon` is provided the\n * segment renders icon-only and this value becomes its accessible name (applied as `aria-label`)\n * instead of visible text. In the `brand` appearance the label is always rendered as visible text\n * (alongside the icon when present).\n */\n label: string;\n /** Value identifier returned via `onChange`. */\n value: string;\n /**\n * Icon to render for the segment. In `pill`/`plain` appearances the segment renders icon-only and\n * `label` becomes required as its accessible name (applied as `aria-label`, no visible text). In\n * the `brand` appearance the icon renders alongside the visible `label`. Required for every option\n * when `collapsible` is set unless a `collapsedIcon` is given, since the collapsed control\n * otherwise shows the selected option's icon alone.\n */\n icon?: React.ReactNode;\n}\n\nexport interface SegmentedControlProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Height of the control in pixels. @default \"32\" */\n size?: SegmentedControlSize;\n /** Segment layout. @default \"hug\" */\n variant?: SegmentedControlVariant;\n /** Visual style of the control. @default \"pill\" */\n appearance?: SegmentedControlAppearance;\n /** The selectable segments. Designed for two or three mutually exclusive options. */\n options: SegmentedControlOption[];\n /** Currently selected value (controlled). */\n value?: string;\n /** Initially selected value (uncontrolled). Defaults to the first option. */\n defaultValue?: string;\n /** Callback fired when the selected value changes. */\n onChange?: (value: string) => void;\n /** Whether the control is disabled. @default false */\n disabled?: boolean;\n /**\n * When `true`, the control automatically collapses to a single icon-only toggle whenever its\n * container is too narrow to show every segment side by side, and expands again when the space\n * returns. Collapsed, it shows `collapsedIcon` when given and otherwise the currently-selected\n * option's `icon`; clicking it (or pressing Enter/Space) advances to the next option, wrapping\n * around from the last back to the first.\n *\n * Only supported for the icon-bearing `\"plain\"` and `\"brand\"` appearances, and every option must\n * define an `icon` unless `collapsedIcon` is given (there is nothing to show otherwise). Ignored,\n * with a dev-time warning, when those conditions are not met. @default false\n */\n collapsible?: boolean;\n /**\n * Single glyph for the collapsed toggle, replacing the selected option's icon. Use it when the\n * collapsed control should read as one switch affordance rather than as a preview of the current\n * selection — the collapsed navigation rail shows a repeat glyph this way. The button still\n * announces the selected option as its accessible name, so the current state stays available to\n * assistive tech. Only meaningful alongside `collapsible`.\n */\n collapsedIcon?: React.ReactNode;\n}\n\n/** Padding and typography per size. Combined with the container's `p-1` these hit the 32/40/48px heights. */\nconst sizeClasses: Record<SegmentedControlSize, string> = {\n \"32\": \"px-2 py-1 typography-description-12px-semibold\",\n \"40\": \"px-3 py-1.75 typography-body-small-14px-semibold\",\n \"48\": \"px-4 py-2 typography-body-default-16px-semibold\",\n};\n\nfunction warnMissingAccessibleName(ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"SegmentedControl: no accessible name provided. Pass an `aria-label` or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\nfunction warnMissingOptionAccessibleName(options: SegmentedControlOption[]) {\n if (process.env.NODE_ENV !== \"production\") {\n for (const option of options) {\n if (option.icon && !option.label?.trim()) {\n console.warn(\n `SegmentedControl: icon-only segment \"${option.value}\" is missing a non-empty \\`label\\` to use as its accessible name.`,\n );\n }\n }\n }\n}\n\nfunction warnUnsupportedCollapsible(\n appearance: SegmentedControlAppearance,\n options: SegmentedControlOption[],\n hasCollapsedIcon: boolean,\n) {\n if (process.env.NODE_ENV !== \"production\") {\n if (appearance === \"pill\") {\n console.warn(\n 'SegmentedControl: `collapsible` is only supported for the \"plain\" and \"brand\" appearances; ignoring it.',\n );\n } else if (!hasCollapsedIcon && !options.every((option) => option.icon)) {\n console.warn(\n \"SegmentedControl: `collapsible` requires every option to define an `icon`, or a `collapsedIcon` to show instead; ignoring it.\",\n );\n }\n }\n}\n\nfunction getSegmentClassName({\n appearance,\n size,\n variant,\n isSelected,\n disabled,\n}: {\n appearance: SegmentedControlAppearance;\n size: SegmentedControlSize;\n variant: SegmentedControlVariant;\n isSelected: boolean;\n disabled: boolean;\n}) {\n return cn(\n \"relative inline-flex min-w-0 cursor-pointer items-center justify-center rounded-full\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n variant === \"fill\" ? \"flex-1\" : \"shrink-0\",\n appearance === \"plain\"\n ? cn(\n // Padding + negative margin enlarge the hit target without changing the\n // visual footprint, which must stay glyph-only to match the design.\n \"-m-1 p-1\",\n isSelected ? \"text-icons-primary\" : \"text-icons-tertiary hover:text-icons-primary\",\n )\n : cn(\n sizeClasses[size],\n // brand renders icon + label together, so space them.\n appearance === \"brand\" && \"gap-1.5\",\n isSelected\n ? appearance === \"brand\"\n ? // Approximate brand-green pill using existing tokens; exact colours pending\n // dedicated navigation tokens (see ENG follow-up).\n \"bg-brand-primary-muted text-content-always-black shadow-sm ring-1 ring-brand-primary-default\"\n : \"bg-buttons-primary-default text-content-primary-inverted shadow-sm\"\n : \"text-content-primary hover:bg-buttons-switch-hover\",\n ),\n disabled && \"pointer-events-none\",\n );\n}\n\n/**\n * Footprint of the collapsed toggle per size. A fixed square keeps the collapsed control the same\n * height as the expanded one, whose height comes from the segment padding plus the container's\n * `p-1` — padding the collapsed button alone would fall short of it by that container padding.\n */\nconst collapsedSizeClasses: Record<SegmentedControlSize, string> = {\n \"32\": \"size-8\",\n \"40\": \"size-10\",\n \"48\": \"size-12\",\n};\n\n/**\n * Classes for the single button shown while the control is collapsed. Unlike an expanded segment\n * (which carries asymmetric `px`/`py` padding and so reads slightly wider than tall), the collapsed\n * toggle is forced to a square via a fixed footprint and `aspect-square`, so with `rounded-full` the\n * icon-only control reads as a round button.\n */\nfunction getCollapsedButtonClassName({\n appearance,\n size,\n disabled,\n}: {\n appearance: SegmentedControlAppearance;\n size: SegmentedControlSize;\n disabled: boolean;\n}) {\n return cn(\n \"relative inline-flex aspect-square shrink-0 cursor-pointer items-center justify-center rounded-full\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n appearance === \"plain\"\n ? // Glyph-only: no pill, just the selected icon colour. The negative margin keeps the visual\n // footprint icon-sized while the padding enlarges the hit target.\n \"-m-1 p-1 text-icons-primary\"\n : cn(\n collapsedSizeClasses[size],\n // Neutral circle rather than the brand pill: collapsed, the control is a switch\n // affordance, not a preview of the selected segment.\n \"bg-surface-secondary text-icons-primary hover:bg-buttons-switch-hover\",\n ),\n disabled && \"pointer-events-none\",\n );\n}\n\n/**\n * Watches `rootRef`'s available width against the natural width of the fully expanded control\n * (measured from `measureRef`, an off-screen replica) and returns whether the control should\n * collapse. Comparing available space to a stable off-screen measurement — rather than to the\n * live control, which shrinks when it collapses — avoids the expand/collapse oscillation that a\n * self-referential measurement would cause. Returns `false` until both widths are measurable\n * (SSR, jsdom, or a zero-width layout), so the control renders expanded by default.\n */\nfunction useAutoCollapse(\n rootRef: React.RefObject<HTMLDivElement | null>,\n measureRef: React.RefObject<HTMLDivElement | null>,\n enabled: boolean,\n): boolean {\n const [collapsed, setCollapsed] = React.useState(false);\n\n React.useEffect(() => {\n if (!enabled) {\n setCollapsed(false);\n return;\n }\n const root = rootRef.current;\n const measure = measureRef.current;\n const parent = root?.parentElement;\n if (!root || !measure || !parent) return;\n\n const evaluate = () => {\n const available = parent.getBoundingClientRect().width;\n const required = measure.getBoundingClientRect().width;\n // Both unmeasured (SSR/jsdom/zero-width): leave the current state untouched.\n if (available <= 0 || required <= 0) return;\n setCollapsed(required > available);\n };\n\n evaluate();\n\n const observer = new ResizeObserver(evaluate);\n observer.observe(parent);\n observer.observe(measure);\n return () => observer.disconnect();\n }, [enabled, rootRef, measureRef]);\n\n return enabled && collapsed;\n}\n\n/**\n * A compact selector for choosing between two or three mutually exclusive\n * options where the choice affects the content immediately below it. Use\n * instead of tabs when the options are more like settings or filters than\n * navigation, such as toggling a list/grid view or a monthly/annual price.\n *\n * Rendered as a `radiogroup` with roving-tabindex keyboard navigation. Supports\n * both controlled and uncontrolled usage. With `collapsible`, the icon-bearing\n * `plain`/`brand` appearances shrink to a single cycling icon toggle when space\n * is tight (rendered as a `group` containing one button).\n *\n * @example\n * ```tsx\n * <SegmentedControl\n * options={[\n * { label: \"Net\", value: \"net\" },\n * { label: \"Gross\", value: \"gross\" },\n * ]}\n * value={amount}\n * onChange={setAmount}\n * aria-label=\"Amount type\"\n * />\n * ```\n *\n * @example Icon-only segments (e.g. a list/grid view toggle)\n * ```tsx\n * <SegmentedControl\n * appearance=\"plain\"\n * options={[\n * { label: \"List view\", value: \"list\", icon: <ListViewIcon size={16} /> },\n * { label: \"Grid view\", value: \"grid\", icon: <GridViewIcon size={16} /> },\n * ]}\n * value={view}\n * onChange={setView}\n * aria-label=\"View\"\n * />\n * ```\n *\n * @example Icon + label with the brand-green pill (e.g. the Home/Agent nav switch)\n * ```tsx\n * <SegmentedControl\n * appearance=\"brand\"\n * options={[\n * { label: \"Home\", value: \"home\", icon: <HomeIcon size={16} /> },\n * { label: \"Agent\", value: \"agent\", icon: <AIIcon size={16} /> },\n * ]}\n * value={mode}\n * onChange={setMode}\n * aria-label=\"Navigation mode\"\n * />\n * ```\n *\n * @example Collapses to a cycling icon toggle when the container is too narrow\n * ```tsx\n * <SegmentedControl\n * appearance=\"plain\"\n * collapsible\n * options={[\n * { label: \"List view\", value: \"list\", icon: <ListViewIcon size={16} /> },\n * { label: \"Grid view\", value: \"grid\", icon: <GridViewIcon size={16} /> },\n * ]}\n * value={view}\n * onChange={setView}\n * aria-label=\"View\"\n * />\n * ```\n *\n * @example A collapsed toggle that shows one switch glyph instead of the selected icon\n * ```tsx\n * <SegmentedControl\n * appearance=\"brand\"\n * collapsible\n * collapsedIcon={<RepeatIcon size={16} />}\n * options={[\n * { label: \"Home\", value: \"home\", icon: <HomeIcon size={16} /> },\n * { label: \"Agent\", value: \"agent\", icon: <AIIcon size={16} filled /> },\n * ]}\n * value={mode}\n * onChange={setMode}\n * aria-label=\"Navigation mode\"\n * />\n * ```\n */\nexport const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedControlProps>(\n (\n {\n className,\n size = \"32\",\n variant = \"hug\",\n appearance = \"pill\",\n options,\n value: controlledValue,\n defaultValue,\n onChange,\n disabled = false,\n collapsible = false,\n collapsedIcon,\n ...props\n },\n ref,\n ) => {\n warnMissingAccessibleName(props[\"aria-label\"], props[\"aria-labelledby\"]);\n warnMissingOptionAccessibleName(options);\n if (collapsible) warnUnsupportedCollapsible(appearance, options, collapsedIcon !== undefined);\n\n // Tracks selection for uncontrolled usage; ignored when `value` prop is provided\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0]?.value);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : internalValue;\n const anySelected = options.some((o) => o.value === currentValue);\n const buttonRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n // Collapsing only makes sense for icon-bearing appearances where there is a glyph to show:\n // either a `collapsedIcon` for every state, or an icon on every option. Anything else falls\n // back to the normal expanded control (a dev warning fires above).\n const canCollapse =\n collapsible &&\n (appearance === \"plain\" || appearance === \"brand\") &&\n (collapsedIcon !== undefined || options.every((option) => option.icon));\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const measureRef = React.useRef<HTMLDivElement | null>(null);\n const setRootRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n rootRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n const isCollapsed = useAutoCollapse(rootRef, measureRef, canCollapse);\n\n const handleSelect = (optionValue: string) => {\n if (disabled || optionValue === currentValue) return;\n if (!isControlled) {\n setInternalValue(optionValue);\n }\n onChange?.(optionValue);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent, index: number) => {\n const nextIndex =\n e.key === \"ArrowRight\" || e.key === \"ArrowDown\"\n ? (index + 1) % options.length\n : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\"\n ? (index - 1 + options.length) % options.length\n : null;\n if (nextIndex === null) return;\n e.preventDefault();\n const nextOption = options[nextIndex] as SegmentedControlOption;\n handleSelect(nextOption.value);\n buttonRefs.current[nextIndex]?.focus();\n };\n\n const renderSegment = (option: SegmentedControlOption, index: number) => {\n const isSelected = currentValue === option.value;\n // `brand` shows the label as visible text (with the icon); `pill`/`plain` render\n // icon-only when an icon is given, falling back to the label otherwise.\n const showLabelText = appearance === \"brand\" || !option.icon;\n return (\n // biome-ignore lint/a11y/useSemanticElements: native radio inputs only allow Tab-focus on the checked item; buttons with roving tabindex give full keyboard navigation\n <button\n key={option.value}\n ref={(el) => {\n buttonRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n tabIndex={isSelected || (!anySelected && index === 0) ? 0 : -1}\n disabled={disabled}\n aria-label={showLabelText ? undefined : option.label}\n onClick={() => handleSelect(option.value)}\n onKeyDown={(e) => handleKeyDown(e, index)}\n className={getSegmentClassName({ appearance, size, variant, isSelected, disabled })}\n >\n {option.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n {showLabelText && <span className=\"min-w-0 truncate\">{option.label}</span>}\n </button>\n );\n };\n\n // Off-screen replica of one segment used only to size the expanded control. Rendered as an\n // inert (disabled + `aria-hidden`) button with no `radio` semantics so it stays out of the\n // accessibility tree and tab order, and always with hug sizing so the replica reflects the\n // natural (uncompressed) width even under a `fill` layout.\n const renderMeasureSegment = (option: SegmentedControlOption) => {\n const showLabelText = appearance === \"brand\" || !option.icon;\n return (\n <button\n key={option.value}\n type=\"button\"\n disabled\n aria-hidden=\"true\"\n tabIndex={-1}\n className={getSegmentClassName({\n appearance,\n size,\n variant: \"hug\",\n isSelected: currentValue === option.value,\n disabled,\n })}\n >\n {option.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n {showLabelText && <span className=\"min-w-0 truncate\">{option.label}</span>}\n </button>\n );\n };\n\n // Collapsed: a single button showing the selected option's icon that cycles to the next\n // option on activation, wrapping from the last option back to the first.\n const selectedIndex = options.findIndex((option) => option.value === currentValue);\n const selectedOption = options[selectedIndex] ?? options[0];\n const handleCycle = () => {\n if (disabled || options.length === 0) return;\n const from = selectedIndex < 0 ? 0 : selectedIndex;\n const nextOption = options[(from + 1) % options.length] as SegmentedControlOption;\n handleSelect(nextOption.value);\n };\n\n return (\n <div\n ref={setRootRef}\n role={isCollapsed ? \"group\" : \"radiogroup\"}\n className={cn(\n \"relative items-center rounded-full\",\n variant === \"fill\" ? \"flex w-full\" : \"inline-flex\",\n isCollapsed\n ? // Collapsed, the toggle itself carries the surface, so the container drops its own\n // chrome and centres the button instead of pinning it to the start of a full-width\n // row — in a narrow rail that offset is the whole width of the column.\n \"justify-center\"\n : appearance === \"plain\"\n ? \"gap-2\"\n : \"bg-surface-tertiary p-1\",\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n {isCollapsed && selectedOption ? (\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={selectedOption.label}\n onClick={handleCycle}\n className={getCollapsedButtonClassName({ appearance, size, disabled })}\n >\n {(collapsedIcon ?? selectedOption.icon) && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {collapsedIcon ?? selectedOption.icon}\n </span>\n )}\n </button>\n ) : (\n options.map((option, index) => renderSegment(option, index))\n )}\n\n {canCollapse && (\n // Off-screen replica of the fully expanded control. Kept in the DOM (out of flow, hidden\n // from AT and tab order) so its natural width is always measurable, whether the visible\n // control is currently expanded or collapsed.\n <div\n ref={measureRef}\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none invisible absolute top-0 left-0 -z-10 flex items-center whitespace-nowrap rounded-full\",\n appearance === \"plain\" ? \"gap-2\" : \"bg-surface-tertiary p-1\",\n )}\n >\n {options.map((option) => renderMeasureSegment(option))}\n </div>\n )}\n </div>\n );\n },\n);\n\nSegmentedControl.displayName = \"SegmentedControl\";\n"],"names":[],"mappings":";;;;AAsFA,MAAM,cAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,SAAS,0BAA0B,WAAoB,gBAAyB;AAC9E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,aAAa,CAAC,gBAA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A,EAIR;AACF;AAEA,iBAAiB,cAAc;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -86,6 +86,19 @@ export declare type AccordionTriggerProps = React_2.ComponentPropsWithoutRef<typ
|
|
|
86
86
|
avatar?: React_2.ReactNode;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Add Circle icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```tsx
|
|
94
|
+
* <AddCircleIcon size={24} filled />
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare const AddCircleIcon: React_2.ForwardRefExoticComponent<BaseIconProps & React_2.RefAttributes<SVGSVGElement>>;
|
|
98
|
+
|
|
99
|
+
/** Props for {@link AddCircleIcon}. See {@link BaseIconProps} for the shared shape. */
|
|
100
|
+
export declare type AddCircleIconProps = BaseIconProps;
|
|
101
|
+
|
|
89
102
|
/**
|
|
90
103
|
* Add icon. Renders at sizes 16, 24, or 32 px.
|
|
91
104
|
*
|
|
@@ -263,7 +276,7 @@ export declare const AIIcon: React_2.ForwardRefExoticComponent<BaseIconProps & R
|
|
|
263
276
|
export declare type AIIconProps = BaseIconProps;
|
|
264
277
|
|
|
265
278
|
/**
|
|
266
|
-
* AI
|
|
279
|
+
* AI Settings icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.
|
|
267
280
|
*
|
|
268
281
|
* @example
|
|
269
282
|
* ```tsx
|
|
@@ -4472,7 +4485,7 @@ export declare interface ProfileStatusProps extends React_2.HTMLAttributes<HTMLS
|
|
|
4472
4485
|
export declare type ProfileStatusSize = "sm" | "md";
|
|
4473
4486
|
|
|
4474
4487
|
/**
|
|
4475
|
-
* Programming
|
|
4488
|
+
* Programming Arrow icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.
|
|
4476
4489
|
*
|
|
4477
4490
|
* @example
|
|
4478
4491
|
* ```tsx
|
|
@@ -4741,11 +4754,11 @@ export declare const ReceiveMoneyIcon: React_2.ForwardRefExoticComponent<BaseIco
|
|
|
4741
4754
|
export declare type ReceiveMoneyIconProps = BaseIconProps;
|
|
4742
4755
|
|
|
4743
4756
|
/**
|
|
4744
|
-
* Refresh
|
|
4757
|
+
* Refresh Arrow icon. Renders at sizes 16, 24, or 32 px.
|
|
4745
4758
|
*
|
|
4746
4759
|
* @example
|
|
4747
4760
|
* ```tsx
|
|
4748
|
-
* <RefreshArrowIcon size={24}
|
|
4761
|
+
* <RefreshArrowIcon size={24} />
|
|
4749
4762
|
* ```
|
|
4750
4763
|
*/
|
|
4751
4764
|
export declare const RefreshArrowIcon: React_2.ForwardRefExoticComponent<BaseIconProps & React_2.RefAttributes<SVGSVGElement>>;
|
|
@@ -4942,6 +4955,22 @@ export declare type SearchIconProps = BaseIconProps;
|
|
|
4942
4955
|
* aria-label="View"
|
|
4943
4956
|
* />
|
|
4944
4957
|
* ```
|
|
4958
|
+
*
|
|
4959
|
+
* @example A collapsed toggle that shows one switch glyph instead of the selected icon
|
|
4960
|
+
* ```tsx
|
|
4961
|
+
* <SegmentedControl
|
|
4962
|
+
* appearance="brand"
|
|
4963
|
+
* collapsible
|
|
4964
|
+
* collapsedIcon={<RepeatIcon size={16} />}
|
|
4965
|
+
* options={[
|
|
4966
|
+
* { label: "Home", value: "home", icon: <HomeIcon size={16} /> },
|
|
4967
|
+
* { label: "Agent", value: "agent", icon: <AIIcon size={16} filled /> },
|
|
4968
|
+
* ]}
|
|
4969
|
+
* value={mode}
|
|
4970
|
+
* onChange={setMode}
|
|
4971
|
+
* aria-label="Navigation mode"
|
|
4972
|
+
* />
|
|
4973
|
+
* ```
|
|
4945
4974
|
*/
|
|
4946
4975
|
export declare const SegmentedControl: React_2.ForwardRefExoticComponent<SegmentedControlProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
4947
4976
|
|
|
@@ -4971,7 +5000,8 @@ export declare interface SegmentedControlOption {
|
|
|
4971
5000
|
* Icon to render for the segment. In `pill`/`plain` appearances the segment renders icon-only and
|
|
4972
5001
|
* `label` becomes required as its accessible name (applied as `aria-label`, no visible text). In
|
|
4973
5002
|
* the `brand` appearance the icon renders alongside the visible `label`. Required for every option
|
|
4974
|
-
* when `collapsible` is set, since the collapsed control
|
|
5003
|
+
* when `collapsible` is set unless a `collapsedIcon` is given, since the collapsed control
|
|
5004
|
+
* otherwise shows the selected option's icon alone.
|
|
4975
5005
|
*/
|
|
4976
5006
|
icon?: React_2.ReactNode;
|
|
4977
5007
|
}
|
|
@@ -4996,14 +5026,23 @@ export declare interface SegmentedControlProps extends Omit<React_2.HTMLAttribut
|
|
|
4996
5026
|
/**
|
|
4997
5027
|
* When `true`, the control automatically collapses to a single icon-only toggle whenever its
|
|
4998
5028
|
* container is too narrow to show every segment side by side, and expands again when the space
|
|
4999
|
-
* returns. Collapsed, it shows
|
|
5000
|
-
* Enter/Space) advances to the next option, wrapping
|
|
5029
|
+
* returns. Collapsed, it shows `collapsedIcon` when given and otherwise the currently-selected
|
|
5030
|
+
* option's `icon`; clicking it (or pressing Enter/Space) advances to the next option, wrapping
|
|
5031
|
+
* around from the last back to the first.
|
|
5001
5032
|
*
|
|
5002
5033
|
* Only supported for the icon-bearing `"plain"` and `"brand"` appearances, and every option must
|
|
5003
|
-
* define an `icon` (there is nothing to show otherwise). Ignored,
|
|
5004
|
-
* those conditions are not met. @default false
|
|
5034
|
+
* define an `icon` unless `collapsedIcon` is given (there is nothing to show otherwise). Ignored,
|
|
5035
|
+
* with a dev-time warning, when those conditions are not met. @default false
|
|
5005
5036
|
*/
|
|
5006
5037
|
collapsible?: boolean;
|
|
5038
|
+
/**
|
|
5039
|
+
* Single glyph for the collapsed toggle, replacing the selected option's icon. Use it when the
|
|
5040
|
+
* collapsed control should read as one switch affordance rather than as a preview of the current
|
|
5041
|
+
* selection — the collapsed navigation rail shows a repeat glyph this way. The button still
|
|
5042
|
+
* announces the selected option as its accessible name, so the current state stays available to
|
|
5043
|
+
* assistive tech. Only meaningful alongside `collapsible`.
|
|
5044
|
+
*/
|
|
5045
|
+
collapsedIcon?: React_2.ReactNode;
|
|
5007
5046
|
}
|
|
5008
5047
|
|
|
5009
5048
|
/** Height of the segmented control in pixels. */
|
package/dist/index.mjs
CHANGED
|
@@ -43,13 +43,14 @@ import { EmptyState } from "./components/EmptyState/EmptyState.mjs";
|
|
|
43
43
|
import { FanFollowerCount } from "./components/FanFollowerCount/FanFollowerCount.mjs";
|
|
44
44
|
import { FloatingActionButton } from "./components/FloatingActionButton/FloatingActionButton.mjs";
|
|
45
45
|
import { IconButton } from "./components/IconButton/IconButton.mjs";
|
|
46
|
+
import { AddCircleIcon } from "./components/Icons/AddCircleIcon.mjs";
|
|
46
47
|
import { AddIcon } from "./components/Icons/AddIcon.mjs";
|
|
47
48
|
import { AffiliatesIcon } from "./components/Icons/AffiliatesIcon.mjs";
|
|
48
49
|
import { AI2Icon } from "./components/Icons/AI2Icon.mjs";
|
|
49
50
|
import { AICallIcon } from "./components/Icons/AICallIcon.mjs";
|
|
50
51
|
import { AIDisclosureIcon } from "./components/Icons/AIDisclosureIcon.mjs";
|
|
51
52
|
import { AIIcon } from "./components/Icons/AIIcon.mjs";
|
|
52
|
-
import { AISettingsIcon } from "./components/Icons/
|
|
53
|
+
import { AISettingsIcon } from "./components/Icons/AISettingsIcon.mjs";
|
|
53
54
|
import { AlertIcon } from "./components/Icons/AlertIcon.mjs";
|
|
54
55
|
import { AppsIcon } from "./components/Icons/AppsIcon.mjs";
|
|
55
56
|
import { ArrowDownIcon } from "./components/Icons/ArrowDownIcon.mjs";
|
|
@@ -278,6 +279,7 @@ export {
|
|
|
278
279
|
AccordionContent,
|
|
279
280
|
AccordionItem,
|
|
280
281
|
AccordionTrigger,
|
|
282
|
+
AddCircleIcon,
|
|
281
283
|
AddIcon,
|
|
282
284
|
AffiliatesIcon,
|
|
283
285
|
AiButton,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|