@solibo/solibo-ui 1.0.20 → 1.0.22
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/assets/index18.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index47.css +1 -1
- package/dist/assets/index50.css +1 -1
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.js +34 -34
- package/dist/components/collapsible/index.cjs +1 -1
- package/dist/components/collapsible/index.js +8 -8
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.js +20 -20
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.cjs.map +1 -1
- package/dist/components/dropdown/index.js +1 -1
- package/dist/components/dropdown/index.js.map +1 -1
- package/dist/components/empty-state/index.cjs +1 -1
- package/dist/components/empty-state/index.js +11 -11
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.cjs.map +1 -1
- package/dist/components/header/index.js +8 -9
- package/dist/components/header/index.js.map +1 -1
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.cjs.map +1 -1
- package/dist/components/list/index.js +41 -39
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/textarea/index.cjs.map +1 -1
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/{index-Rm3D-iwf.js → index-BAxpgMzb.js} +17 -17
- package/dist/index-BAxpgMzb.js.map +1 -0
- package/dist/index-BOiGSTKz.cjs.map +1 -1
- package/dist/index-BlnG4Rbh.cjs +2 -0
- package/dist/index-BlnG4Rbh.cjs.map +1 -0
- package/dist/index-DMGGDV9J.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/tokens.json +1 -1
- package/dist/use-touched-B999bBr8.js.map +1 -1
- package/dist/use-touched-Bq5Gjbpz.cjs.map +1 -1
- package/package.json +1 -1
- package/dist/index-CXge5nFf.cjs +0 -2
- package/dist/index-CXge5nFf.cjs.map +0 -1
- package/dist/index-Rm3D-iwf.js.map +0 -1
package/dist/assets/index18.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._header_xu8zs_1{color:var(--colors-semantic-content-secondary);display:grid;font-weight:var(--font-font-weight-bold);gap:var(--shape-spacing-3xs) var(--shape-spacing-xs);grid-template-columns:minmax(25ch,1fr) minmax(0,-webkit-max-content);grid-template-columns:minmax(25ch,1fr) minmax(0,max-content);margin:var(--shape-spacing-md) 0;position:relative}._header_xu8zs_1>*{grid-column:1;min-width:0}._header_xu8zs_1 :is(h1,h2,h3,h4,h5,h6){color:var(--colors-semantic-content-primary);margin:0;overflow-wrap:break-word}._header_xu8zs_1 h1{font-size:var(--typography-font-sizes-h1);letter-spacing:-1.2px}._header_xu8zs_1 h2,._header_xu8zs_1 sup{font-size:var(--typography-font-sizes-h2)}._header_xu8zs_1 h3{font-size:var(--typography-font-sizes-h3)}._header_xu8zs_1 p{font-size:var(--typography-font-sizes-body-lg);font-weight:var(--font-font-weight-regular);margin:var(--shape-spacing-xs) 0 0!important}._header_xu8zs_1 sub{font-weight:var(--font-font-weight-regular)}._header_xu8zs_1 sub[data-clipboard]{align-items:center;cursor:copy;display:flex;gap:var(--scale-8);padding:var(--scale-8) 0}._header_xu8zs_1 sub,._header_xu8zs_1 sup{font-size:var(--typography-font-sizes-body-sm)}._header_xu8zs_1:has([data-component=badge]) h1,._header_xu8zs_1:has([data-component=badge]) h2,._header_xu8zs_1:has([data-component=badge]) h3,._header_xu8zs_1:has([data-component=badge]) h4{display:inline-block}._header_xu8zs_1 [data-component=button],._header_xu8zs_1 [data-component=controls],._header_xu8zs_1 [data-component=popover],._header_xu8zs_1 [data-component=toggle]{grid-column:2;grid-row:1 / span 2;height:-webkit-min-content;height:-moz-min-content;height:min-content;min-width:0;overflow-wrap:anywhere}._header_xu8zs_1 [data-component=controls]{margin-top:0}@media (width < 480px){._header_xu8zs_1{grid-template-columns:1fr}._header_xu8zs_1>[data-component=button],._header_xu8zs_1 [data-component=controls],._header_xu8zs_1 [data-component=toggle]{grid-column:1;grid-row:auto;margin-top:var(--shape-spacing-md)}}@media (width >= 960px){._jumbo_xu8zs_96{margin:calc(var(--utils-tokens-unit) * 3) 0}._jumbo_xu8zs_96 h1{font-size:var(--typography-font-sizes-display-sm)}}
|
package/dist/assets/index30.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._card_1czes_1{background-color:var(--colors-semantic-bg-surface);border-radius:var(--shape-border-radius-radius-lg);box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color);max-width:calc(100vw - calc(var(--shape-spacing-md) * 2));min-width:0;overflow:hidden!important;padding:var(--shape-spacing-md);position:relative;text-overflow:ellipsis;transition:background-color var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function),box-shadow var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function),width var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function);width:100%}._card_1czes_1 section{display:block;flex:1 1 auto;min-width:0;width:100%}._card_1czes_1 ._head_1czes_28{align-items:center;display:flex;gap:var(--shape-spacing-xs);max-width:100%}._card_1czes_1 ._head_1czes_28 header{flex:1 1 auto;margin:0;min-width:0}._card_1czes_1 ._head_1czes_28._center_1czes_40{align-items:center}._card_1czes_1 ._head_1czes_28 :is(h1,h2,h3,h4,h5,h6):first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._card_1czes_1 ._content_1czes_52>:last-child{margin-bottom:0}._card_1czes_1 ._preview_1czes_58{align-items:center;color:var(--colors-semantic-content-secondary);display:grid;grid-template-columns:-webkit-max-content minmax(0,1fr) -webkit-max-content;grid-template-columns:max-content minmax(0,1fr) max-content;max-width:100%;min-width:0;white-space:nowrap;width:100%}._card_1czes_1 ._preview-leading_1czes_69,._card_1czes_1 ._preview-trailing_1czes_70{align-items:center;display:inline-flex;flex-wrap:nowrap;max-width:-webkit-max-content;max-width:-moz-max-content;max-width:max-content;white-space:nowrap}._card_1czes_1 ._preview-leading_1czes_69:not(:empty){margin-right:var(--shape-spacing-xs)}._card_1czes_1 ._preview-trailing_1czes_70:not(:empty){margin-left:var(--shape-spacing-xs)}._card_1czes_1 ._preview-trailing_1czes_70 time{font-size:var(--typography-font-sizes-caption)}._card_1czes_1 ._preview-content_1czes_90{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._card_1czes_1 ._margin_1czes_98{margin-top:var(--shape-spacing-xs)}._card_1czes_1:has(select),._card_1czes_1:has([data-component=popover]){overflow:visible!important}._card_1czes_1 [data-component=croppable]{width:100%}._card_1czes_1 [data-component=list]{min-width:0}._card_1czes_1 [data-component=list] li{max-width:100%;min-width:0}._card_1czes_1 [data-component=list] li>a{display:block;max-width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._card_1czes_1 [data-component=list] li>[data-component=file]{width:100%}._card_1czes_1:has([data-component=messages]){padding-block:0}._card_1czes_1 [data-component=messages]{border-top:var(--shape-border-width-default) solid var(--colors-semantic-border-default);margin:0 calc(var(--shape-spacing-md) * -1) calc(var(--shape-spacing-md) * -1)}._clickable_1czes_143{cursor:pointer}._clickable_1czes_143:hover{background-color:var(--colors-semantic-interactive-hover-subtle);box-shadow:var(--shape-box-shadow-sm-position-x) var(--shape-box-shadow-sm-position-y) var(--shape-box-shadow-sm-blur) var(--shape-box-shadow-sm-spread) var(--shape-box-shadow-sm-color)}._clickable_1czes_143:focus-visible{outline:var(--scale-2) solid var(--colors-semantic-border-focus)}._muted_1czes_158 ._head_1czes_28 :is(header,h1,h2,h3,h4,h5,h6){font-weight:var(--font-font-weight-regular)}._muted_1czes_158:not(._selected_1czes_163){background-color:transparent}._image-top_1czes_168{margin-bottom:var(--shape-spacing-md);width:100%}._image-top_1czes_168 img{height:calc(12.5 * var(--utils-tokens-unit));-o-object-fit:cover;object-fit:cover;width:100%}._image-left_1czes_179{max-height:calc(8.75 * var(--utils-tokens-unit));max-width:calc(8.75 * var(--utils-tokens-unit));min-height:var(--scale-56);min-width:var(--scale-56)}._image-left_1czes_179 img{aspect-ratio:1 / 1}._selected_1czes_163{background-color:var(--colors-semantic-interactive-selected);outline:var(--scale-2) solid var(--colors-semantic-primary-primary-subtle-border)}._selected_1czes_163:hover{background-color:var(--colors-semantic-interactive-selected)}
|
package/dist/assets/index33.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
._collapsible_1nzgt_1 summary{align-items:center;color:var(--colors-semantic-primary-primary);cursor:pointer;display:flex;list-style:none;min-width:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}._collapsible_1nzgt_1 ._content_1nzgt_12{min-width:0}._collapsible_1nzgt_1 ._indicator_1nzgt_16{align-items:center;display:inline-flex;flex-shrink:0;justify-content:center;margin-left:auto;transform-origin:center;transition:transform var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function)}._collapsible_1nzgt_1[open]>summary ._indicator_1nzgt_16{transform:rotate(180deg)}
|
package/dist/assets/index36.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._dialog_10cs4_3{max-width:var(--shape-width-max-lg);background-color:var(--colors-semantic-bg-surface);border:none;border-radius:var(--shape-border-radius-radius-md);box-shadow:var(--shape-box-shadow-sm-position-x) var(--shape-box-shadow-sm-position-y) var(--shape-box-shadow-sm-blur) var(--shape-box-shadow-sm-spread) var(--shape-box-shadow-sm-color);box-sizing:border-box;max-height:80vh;max-height:80dvh;overflow:auto;padding:var(--shape-spacing-md) var(--shape-spacing-lg);width:100%}._dialog_10cs4_3::backdrop{-webkit-backdrop-filter:blur(var(--shape-box-shadow-xs-blur));backdrop-filter:blur(var(--shape-box-shadow-xs-blur));background:var(--colors-box-shadow)}._dialog_10cs4_3 ._close_10cs4_24{position:absolute;right:0;top:0;z-index:1}._dialog_10cs4_3:not([open]){display:none}._dialog_10cs4_3._fullscreen_10cs4_35{border-radius:0;height:100vh;height:100dvh;top:0;right:0;bottom:0;left:0;margin:0;max-height:none;max-width:none;padding:0;width:100vw;width:100dvw}@media (width <= 768px){._dialog_10cs4_3{border-radius:var(--shape-border-radius-radius-md) var(--shape-border-radius-radius-md) 0 0;margin:auto 0 0;max-width:none}}._structured_10cs4_56{display:grid;grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden;padding:0}._structured_10cs4_56 ._header_10cs4_62{align-items:start;display:grid;grid-template-columns:minmax(0,1fr) auto;padding:var(--shape-spacing-md) var(--shape-spacing-lg)}._structured_10cs4_56 ._header_10cs4_62>header{margin-block:0}._structured_10cs4_56 ._content_10cs4_73{min-height:0;overflow:auto;padding:var(--shape-spacing-md) var(--shape-spacing-lg)}@supports (-moz-appearance: none){._structured_10cs4_56 ._content_10cs4_73{scrollbar-color:var(--colors-semantic-border-default) transparent;scrollbar-width:thin}}@supports selector(::-webkit-scrollbar){._structured_10cs4_56 ._content_10cs4_73::-webkit-scrollbar{height:var(--scale-2);width:var(--scale-2)}._structured_10cs4_56 ._content_10cs4_73::-webkit-scrollbar-track{background-color:transparent}._structured_10cs4_56 ._content_10cs4_73::-webkit-scrollbar-thumb{background-color:var(--colors-semantic-border-default);border-radius:var(--scale-4)}}._structured_10cs4_56 ._controls_10cs4_81{border-top:var(--shape-border-width-default) solid var(--colors-semantic-border-default);padding:var(--shape-spacing-md) var(--shape-spacing-lg)}._structured_10cs4_56 ._controls_10cs4_81>:first-child{margin-top:0}._structured_10cs4_56 ._close_10cs4_24{grid-column:2;justify-self:end;position:static}._structured_10cs4_56._dialog_10cs4_3._fullscreen_10cs4_35{grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden}._structured_10cs4_56._dialog_10cs4_3._fullscreen_10cs4_35 ._content_10cs4_73{box-sizing:border-box;height:100%;min-height:0;min-width:0;width:100%}@media (width <= 768px){._structured_10cs4_56 ._controls_10cs4_81{padding-top:0}._structured_10cs4_56 ._controls_10cs4_81>:first-child{margin-top:var(--shape-spacing-md)}}
|
package/dist/assets/index40.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._empty-
|
|
1
|
+
._empty-state_tqnjq_3{max-width:var(--shape-width-max);align-items:center;display:flex;flex-direction:column;margin:var(--shape-spacing-3xl) auto;text-align:center;width:100%}._empty-state_tqnjq_3 ._header_tqnjq_13{font-size:var(--typography-font-sizes-h3);font-weight:var(--font-font-weight-bold);margin-bottom:0}@media (width <= 768px){._empty-state_tqnjq_3{margin-block:var(--shape-spacing-md)}}
|
package/dist/assets/index47.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._controls_1n69k_1{margin-top:var(--shape-spacing-xs);padding-left:var(--shape-spacing-md)}._horizontal_1n69k_6{display:block}._horizontal_1n69k_6 li{display:inline-block;margin-right:var(--utils-tokens-unit);max-width:100%;min-width:0}._list_1n69k_17{display:block;list-style-type:none;min-width:0;padding-left:0}._list_1n69k_17 li{-moz-column-break-inside:avoid;break-inside:avoid;list-style:none;margin-bottom:var(--utils-tokens-unit);max-width:100%;min-width:0;padding-left:0}._list_1n69k_17 li>li,._list_1n69k_17 li>details li{margin-left:var(--utils-tokens-unit)}._list_1n69k_17 li>section{border-bottom:var(--scale-1) solid var(--colors-semantic-border-default)}._list_1n69k_17 li>section:first-child{border-top:var(--scale-1) solid var(--colors-semantic-border-default)}._list_1n69k_17 li>section:last-of-type{border-bottom:none}._list_1n69k_17 li:has([data-span=all]){-moz-column-span:all;column-span:all}._list_1n69k_17 li:last-child{margin-bottom:0}._columns_1n69k_58{-moz-column-count:var(--list-columns, 2);column-count:var(--list-columns, 2);-moz-column-gap:var(--utils-tokens-unit);column-gap:var(--utils-tokens-unit)}@media (width <= 960px){._columns_1n69k_58{-moz-column-count:1;column-count:1}}._compact_1n69k_67 li{margin-bottom:var(--shape-spacing-xs)}
|
package/dist/assets/index50.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._select_1bm47_3{border:var(--scale-1) solid var(--colors-semantic-border-default);border-radius:var(--shape-border-radius-radius-md);box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color);color:var(--colors-semantic-content-primary);font-size:var(--typography-font-sizes-body-md);padding:var(--utils-tokens-unit);transition:border var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function);-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--colors-semantic-bg-surface);background-image:var(--icon-svg);background-position:right var(--scale-8) center;background-repeat:no-repeat;background-size:var(--utils-tokens-icon-medium);max-width:100%;padding-right:var(--scale-32);text-overflow:ellipsis}._select_1bm47_3::-moz-placeholder{color:var(--colors-semantic-content-tertiary)}._select_1bm47_3::placeholder{color:var(--colors-semantic-content-tertiary)}._select_1bm47_3:disabled{background-color:var(--colors-semantic-interactive-disabled);color:var(--colors-semantic-content-primary);pointer-events:none}._select_1bm47_3:has(option[value=""]:checked){color:var(--colors-semantic-content-tertiary)}._select_1bm47_3 option{padding-right:var(--scale-32)}._select_1bm47_3._touched_1bm47_24:invalid{border-color:var(--colors-semantic-status-error-border)}._label_1bm47_29{display:block}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index30.css');const n=require("react/jsx-runtime"),d=require("../../classix-5H4IWnMA.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index30.css');const n=require("react/jsx-runtime"),d=require("../../classix-5H4IWnMA.cjs"),j=require("../badge/index.cjs"),z=require("../checkbox/index.cjs"),g=require("../figure/index.cjs"),f=require("../icon/index.cjs"),v="_card_1czes_1",w="_head_1czes_28",h="_center_1czes_40",N="_content_1czes_52",q="_preview_1czes_58",y="_margin_1czes_98",b="_clickable_1czes_143",T="_muted_1czes_158",k="_selected_1czes_163",e={card:v,head:w,center:h,content:N,preview:q,"preview-leading":"_preview-leading_1czes_69","preview-trailing":"_preview-trailing_1czes_70","preview-content":"_preview-content_1czes_90",margin:y,clickable:b,muted:T,selected:k,"image-top":"_image-top_1czes_168","image-left":"_image-left_1czes_179"},D=({actions:x,badge:m,checkbox:s,children:o,emphasis:u="default",header:_,icon:p,image:i,imagePosition:r="top",onClick:a,preview:l,variant:c="default"})=>n.jsxs("article",{className:d.t(e.card,u==="muted"&&e.muted,a&&e.clickable,(s==null?void 0:s.checked)&&e.selected),"data-emphasis":u,"data-minimal":c==="minimal",onClick:a,onKeyDown:t=>{a&&t.currentTarget===document.activeElement&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),t.currentTarget.click())},tabIndex:a?0:-1,"data-component":"card",children:[i&&c!=="minimal"&&r==="top"&&n.jsx(g.Figure,{className:e[`image-${r}`],children:i}),n.jsxs("section",{children:[n.jsxs("div",{className:d.t(e.head,c==="minimal"&&e.center),children:[s&&n.jsx("span",{onClick:t=>t.stopPropagation(),children:n.jsx(z.Checkbox,{...s})}),i&&c!=="minimal"&&r==="left"&&n.jsx(g.Figure,{className:e[`image-${r}`],children:i}),_,m&&n.jsx(j.Badge,{...m}),p&&n.jsx(f.Icon,{name:p,size:"medium"}),x]}),o&&c!=="minimal"&&n.jsx("div",{className:d.t(e.content,!!_&&e.margin),children:o}),l&&c!=="minimal"&&n.jsxs("div",{className:d.t(e.preview,!!_&&e.margin),children:[n.jsx("span",{className:e["preview-leading"],children:l.leading}),n.jsx("span",{className:e["preview-content"],children:l.children}),n.jsx("span",{className:e["preview-trailing"],children:l.trailing})]})]})]});exports.Card=D;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { t as
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { t as d } from "../../classix-DG18itHa.js";
|
|
3
3
|
import { Badge as w } from "../badge/index.js";
|
|
4
4
|
import { Checkbox as v } from "../checkbox/index.js";
|
|
5
5
|
import { Figure as f } from "../figure/index.js";
|
|
6
6
|
import { Icon as N } from "../icon/index.js";
|
|
7
|
-
import '../../assets/index30.css';const h = "
|
|
7
|
+
import '../../assets/index30.css';const h = "_card_1czes_1", y = "_head_1czes_28", j = "_center_1czes_40", D = "_content_1czes_52", E = "_preview_1czes_58", I = "_margin_1czes_98", T = "_clickable_1czes_143", $ = "_muted_1czes_158", k = "_selected_1czes_163", e = {
|
|
8
8
|
card: h,
|
|
9
9
|
head: y,
|
|
10
10
|
center: j,
|
|
11
11
|
content: D,
|
|
12
12
|
preview: E,
|
|
13
|
-
"preview-leading": "_preview-
|
|
14
|
-
"preview-trailing": "_preview-
|
|
15
|
-
"preview-content": "_preview-
|
|
13
|
+
"preview-leading": "_preview-leading_1czes_69",
|
|
14
|
+
"preview-trailing": "_preview-trailing_1czes_70",
|
|
15
|
+
"preview-content": "_preview-content_1czes_90",
|
|
16
16
|
margin: I,
|
|
17
17
|
clickable: T,
|
|
18
18
|
muted: $,
|
|
19
19
|
selected: k,
|
|
20
|
-
"image-top": "_image-
|
|
21
|
-
"image-left": "_image-
|
|
20
|
+
"image-top": "_image-top_1czes_168",
|
|
21
|
+
"image-left": "_image-left_1czes_179"
|
|
22
22
|
}, G = ({
|
|
23
|
-
actions:
|
|
24
|
-
badge:
|
|
25
|
-
checkbox:
|
|
26
|
-
children:
|
|
23
|
+
actions: z,
|
|
24
|
+
badge: o,
|
|
25
|
+
checkbox: r,
|
|
26
|
+
children: p,
|
|
27
27
|
emphasis: g = "default",
|
|
28
|
-
header:
|
|
28
|
+
header: _,
|
|
29
29
|
icon: u,
|
|
30
|
-
image:
|
|
31
|
-
imagePosition:
|
|
32
|
-
onClick:
|
|
33
|
-
preview:
|
|
34
|
-
variant:
|
|
35
|
-
}) => /* @__PURE__ */
|
|
36
|
-
|
|
37
|
-
}, tabIndex:
|
|
38
|
-
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
image: a,
|
|
31
|
+
imagePosition: i = "top",
|
|
32
|
+
onClick: s,
|
|
33
|
+
preview: l,
|
|
34
|
+
variant: n = "default"
|
|
35
|
+
}) => /* @__PURE__ */ m("article", { className: d(e.card, g === "muted" && e.muted, s && e.clickable, (r == null ? void 0 : r.checked) && e.selected), "data-emphasis": g, "data-minimal": n === "minimal", onClick: s, onKeyDown: (c) => {
|
|
36
|
+
s && c.currentTarget === document.activeElement && (c.key === "Enter" || c.key === " ") && (c.preventDefault(), c.currentTarget.click());
|
|
37
|
+
}, tabIndex: s ? 0 : -1, "data-component": "card", children: [
|
|
38
|
+
a && n !== "minimal" && i === "top" && /* @__PURE__ */ t(f, { className: e[`image-${i}`], children: a }),
|
|
39
|
+
/* @__PURE__ */ m("section", { children: [
|
|
40
|
+
/* @__PURE__ */ m("div", { className: d(e.head, n === "minimal" && e.center), children: [
|
|
41
|
+
r && /* @__PURE__ */ t("span", { onClick: (c) => c.stopPropagation(), children: /* @__PURE__ */ t(v, { ...r }) }),
|
|
42
|
+
a && n !== "minimal" && i === "left" && /* @__PURE__ */ t(f, { className: e[`image-${i}`], children: a }),
|
|
43
|
+
_,
|
|
44
|
+
o && /* @__PURE__ */ t(w, { ...o }),
|
|
45
45
|
u && /* @__PURE__ */ t(N, { name: u, size: "medium" }),
|
|
46
|
-
|
|
46
|
+
z
|
|
47
47
|
] }),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/* @__PURE__ */ t("span", { className: e["preview-leading"], children:
|
|
51
|
-
/* @__PURE__ */ t("span", { className: e["preview-content"], children:
|
|
52
|
-
/* @__PURE__ */ t("span", { className: e["preview-trailing"], children:
|
|
48
|
+
p && n !== "minimal" && /* @__PURE__ */ t("div", { className: d(e.content, !!_ && e.margin), children: p }),
|
|
49
|
+
l && n !== "minimal" && /* @__PURE__ */ m("div", { className: d(e.preview, !!_ && e.margin), children: [
|
|
50
|
+
/* @__PURE__ */ t("span", { className: e["preview-leading"], children: l.leading }),
|
|
51
|
+
/* @__PURE__ */ t("span", { className: e["preview-content"], children: l.children }),
|
|
52
|
+
/* @__PURE__ */ t("span", { className: e["preview-trailing"], children: l.trailing })
|
|
53
53
|
] })
|
|
54
54
|
] })
|
|
55
55
|
] });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index33.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index33.css');const n=require("react/jsx-runtime"),l=require("../icon/index.cjs"),i="_collapsible_1nzgt_1",a="_content_1nzgt_12",r="_indicator_1nzgt_16",e={collapsible:i,content:a,indicator:r},d=({children:o,disabled:t,open:s,summary:c})=>n.jsxs("details",{className:e.collapsible,open:t||s||void 0,"data-component":"collapsible",children:[n.jsxs("summary",{children:[n.jsx("span",{className:e.content,"data-content":"collapsible-summary",children:c}),!t&&n.jsx("span",{className:e.indicator,"data-content":"collapsible-indicator",children:n.jsx(l.Icon,{name:"chevron",size:"medium"})})]}),o]});exports.Collapsible=d;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
1
|
+
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { Icon as s } from "../icon/index.js";
|
|
3
|
-
import '../../assets/index33.css';const i = "
|
|
3
|
+
import '../../assets/index33.css';const i = "_collapsible_1nzgt_1", r = "_content_1nzgt_12", m = "_indicator_1nzgt_16", o = {
|
|
4
4
|
collapsible: i,
|
|
5
5
|
content: r,
|
|
6
6
|
indicator: m
|
|
7
7
|
}, _ = ({
|
|
8
|
-
children:
|
|
9
|
-
disabled:
|
|
8
|
+
children: l,
|
|
9
|
+
disabled: t,
|
|
10
10
|
open: a,
|
|
11
11
|
summary: e
|
|
12
|
-
}) => /* @__PURE__ */ c("details", { className:
|
|
12
|
+
}) => /* @__PURE__ */ c("details", { className: o.collapsible, open: t || a || void 0, "data-component": "collapsible", children: [
|
|
13
13
|
/* @__PURE__ */ c("summary", { children: [
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
!
|
|
14
|
+
/* @__PURE__ */ n("span", { className: o.content, "data-content": "collapsible-summary", children: e }),
|
|
15
|
+
!t && /* @__PURE__ */ n("span", { className: o.indicator, "data-content": "collapsible-indicator", children: /* @__PURE__ */ n(s, { name: "chevron", size: "medium" }) })
|
|
16
16
|
] }),
|
|
17
|
-
|
|
17
|
+
l
|
|
18
18
|
] });
|
|
19
19
|
export {
|
|
20
20
|
_ as Collapsible
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index36.css');const e=require("react/jsx-runtime"),P=require("../../classix-5H4IWnMA.cjs"),a=require("react"),j=require("../button/index.cjs"),T=require("../icon/index.cjs"),E="
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index36.css');const e=require("react/jsx-runtime"),P=require("../../classix-5H4IWnMA.cjs"),a=require("react"),j=require("../button/index.cjs"),T=require("../icon/index.cjs"),E="_dialog_10cs4_3",F="_close_10cs4_24",M="_fullscreen_10cs4_35",S="_structured_10cs4_56",X="_header_10cs4_62",Y="_content_10cs4_73",w="_controls_10cs4_81",r={dialog:E,close:F,fullscreen:M,structured:S,header:X,content:Y,controls:w},B=l=>a.Children.toArray(l).some(c=>a.isValidElement(c)?c.type===j.Button&&c.props.variant==="danger"?!0:B(c.props.children):!1),A=({children:l,className:c,controls:o,fullscreen:f=!1,header:_,onCancel:i,onClick:u,onClose:d,open:n=!1,setOpen:s,...b})=>{const g=a.useRef(null),m=B(o),h=f||_!=null||o!=null;a.useEffect(()=>{const t=g.current;t&&(n&&!t.open?t.showModal():!n&&t.open&&t.close())},[n]);const q=t=>{i==null||i(t),!(t.defaultPrevented||!s)&&(t.preventDefault(),s(!1))},y=t=>{if(u==null||u(t),m||t.defaultPrevented||t.target!==t.currentTarget||!s)return;const{bottom:R,left:D,right:k,top:p}=t.currentTarget.getBoundingClientRect();(t.clientX<D||t.clientX>k||t.clientY<p||t.clientY>R)&&s(!1)},N=t=>{d==null||d(t),n&&(s==null||s(!1))},x=s&&!m?e.jsx(j.Button,{"aria-label":"Close dialog",className:r.close,onClick:()=>s(!1),variant:"simple",children:e.jsx(T.Icon,{name:"x"})}):null;return e.jsx("dialog",{className:P.t(r.dialog,h&&r.structured,f&&r.fullscreen,c),onCancel:q,onClick:y,onClose:N,ref:g,...b,"data-component":"dialog",children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:r.header,children:[_,x]}),e.jsx("div",{className:r.content,children:l}),o!=null&&e.jsx("div",{className:r.controls,children:o})]}):e.jsxs(e.Fragment,{children:[x,l]})})};exports.Dialog=A;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -3,7 +3,7 @@ import { t as X } from "../../classix-DG18itHa.js";
|
|
|
3
3
|
import N, { useRef as Y, useEffect as w } from "react";
|
|
4
4
|
import { Button as x } from "../button/index.js";
|
|
5
5
|
import { Icon as A } from "../icon/index.js";
|
|
6
|
-
import '../../assets/index36.css';const F = "
|
|
6
|
+
import '../../assets/index36.css';const F = "_dialog_10cs4_3", I = "_close_10cs4_24", M = "_fullscreen_10cs4_35", V = "_structured_10cs4_56", q = "_header_10cs4_62", z = "_content_10cs4_73", G = "_controls_10cs4_81", c = {
|
|
7
7
|
dialog: F,
|
|
8
8
|
close: I,
|
|
9
9
|
fullscreen: M,
|
|
@@ -11,28 +11,28 @@ import '../../assets/index36.css';const F = "_dialog_gog2p_3", I = "_close_gog2p
|
|
|
11
11
|
header: q,
|
|
12
12
|
content: z,
|
|
13
13
|
controls: G
|
|
14
|
-
}, R = (
|
|
15
|
-
children:
|
|
16
|
-
className:
|
|
17
|
-
controls:
|
|
14
|
+
}, R = (s) => N.Children.toArray(s).some((l) => N.isValidElement(l) ? l.type === x && l.props.variant === "danger" ? !0 : R(l.props.children) : !1), U = ({
|
|
15
|
+
children: s,
|
|
16
|
+
className: l,
|
|
17
|
+
controls: o,
|
|
18
18
|
fullscreen: f = !1,
|
|
19
|
-
header:
|
|
19
|
+
header: _,
|
|
20
20
|
onCancel: n,
|
|
21
21
|
onClick: i,
|
|
22
22
|
onClose: d,
|
|
23
|
-
open:
|
|
23
|
+
open: a = !1,
|
|
24
24
|
setOpen: t,
|
|
25
25
|
...k
|
|
26
26
|
}) => {
|
|
27
|
-
const
|
|
27
|
+
const m = Y(null), g = R(o), h = f || _ != null || o != null;
|
|
28
28
|
w(() => {
|
|
29
|
-
const r =
|
|
30
|
-
r && (
|
|
31
|
-
}, [
|
|
29
|
+
const r = m.current;
|
|
30
|
+
r && (a && !r.open ? r.showModal() : !a && r.open && r.close());
|
|
31
|
+
}, [a]);
|
|
32
32
|
const y = (r) => {
|
|
33
33
|
n == null || n(r), !(r.defaultPrevented || !t) && (r.preventDefault(), t(!1));
|
|
34
34
|
}, D = (r) => {
|
|
35
|
-
if (i == null || i(r),
|
|
35
|
+
if (i == null || i(r), g || r.defaultPrevented || r.target !== r.currentTarget || !t) return;
|
|
36
36
|
const {
|
|
37
37
|
bottom: j,
|
|
38
38
|
left: E,
|
|
@@ -41,18 +41,18 @@ import '../../assets/index36.css';const F = "_dialog_gog2p_3", I = "_close_gog2p
|
|
|
41
41
|
} = r.currentTarget.getBoundingClientRect();
|
|
42
42
|
(r.clientX < E || r.clientX > P || r.clientY < T || r.clientY > j) && t(!1);
|
|
43
43
|
}, b = (r) => {
|
|
44
|
-
d == null || d(r),
|
|
45
|
-
}, p = t && !
|
|
46
|
-
return /* @__PURE__ */ e("dialog", { className: X(
|
|
47
|
-
/* @__PURE__ */ u("div", { className:
|
|
48
|
-
|
|
44
|
+
d == null || d(r), a && (t == null || t(!1));
|
|
45
|
+
}, p = t && !g ? /* @__PURE__ */ e(x, { "aria-label": "Close dialog", className: c.close, onClick: () => t(!1), variant: "simple", children: /* @__PURE__ */ e(A, { name: "x" }) }) : null;
|
|
46
|
+
return /* @__PURE__ */ e("dialog", { className: X(c.dialog, h && c.structured, f && c.fullscreen, l), onCancel: y, onClick: D, onClose: b, ref: m, ...k, "data-component": "dialog", children: h ? /* @__PURE__ */ u(B, { children: [
|
|
47
|
+
/* @__PURE__ */ u("div", { className: c.header, children: [
|
|
48
|
+
_,
|
|
49
49
|
p
|
|
50
50
|
] }),
|
|
51
|
-
/* @__PURE__ */ e("div", { className:
|
|
52
|
-
|
|
51
|
+
/* @__PURE__ */ e("div", { className: c.content, children: s }),
|
|
52
|
+
o != null && /* @__PURE__ */ e("div", { className: c.controls, children: o })
|
|
53
53
|
] }) : /* @__PURE__ */ u(B, { children: [
|
|
54
54
|
p,
|
|
55
|
-
|
|
55
|
+
s
|
|
56
56
|
] }) });
|
|
57
57
|
};
|
|
58
58
|
export {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const l=require("react/jsx-runtime"),g=require("../../classix-5H4IWnMA.cjs"),a=require("react"),F=require("../button/index.cjs"),de=require("../../icons-Lq3pr85X.cjs"),X=require("../../index-BOiGSTKz.cjs"),pe=require("../list/index.cjs"),E=require("../../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const l=require("react/jsx-runtime"),g=require("../../classix-5H4IWnMA.cjs"),a=require("react"),F=require("../button/index.cjs"),de=require("../../icons-Lq3pr85X.cjs"),X=require("../../index-BOiGSTKz.cjs"),pe=require("../list/index.cjs"),E=require("../../index-BlnG4Rbh.cjs");function V(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(V).join(" "):a.isValidElement(t)?V(t.props.children):""}function fe(t){return a.isValidElement(t)&&t.type==="option"}function me(t){return a.isValidElement(t)&&t.type==="optgroup"}function be(t){return a.isValidElement(t)&&t.type===a.Fragment}function _e(t){return a.isValidElement(t)&&t.type===E.Select}function W(t,i,r=!1){const s=[];return a.Children.forEach(t,n=>{if(be(n))s.push(...W(n.props.children,i,r));else if(fe(n)){const c=V(n.props.children).trim(),f=n.props.value!=null?String(n.props.value):c;s.push({disabled:r||!!n.props.disabled,groupLabel:i,hidden:!!n.props.hidden,isPlaceholder:!!(n.props.hidden&&f===""),label:n.props.children,selected:!!n.props.selected,text:c,value:f})}else me(n)&&s.push(...W(n.props.children,n.props.label,r||!!n.props.disabled))}),s}function he(t){const i=t.trim();if(!i)return null;const s=[.../[*?]/.test(i)?i:`*${i}*`].map(n=>n==="*"?".*":n==="?"?".":n.replace(/[|\\{}()[\]^$+.,]/g,"\\$&")).join("");return new RegExp(`^${s}$`,"i")}function ye(t,i){const r=he(i),s=t.filter(n=>!n.hidden&&!n.isPlaceholder);return r?s.filter(n=>r.test([n.groupLabel,n.text,n.value].filter(Boolean).join(" "))):s}function xe(t,i){return t.find(r=>r.value===i)??t.find(r=>r.isPlaceholder)??t[0]}function ge(t,i,r){var s,n;return i!=null?String(i):r!=null?String(r):((s=t.find(c=>c.selected))==null?void 0:s.value)??((n=t[0])==null?void 0:n.value)??""}function je(t){if(_e(t)){const{children:i,placeholder:r,...s}=t.props;return{children:l.jsxs(l.Fragment,{children:[r&&l.jsx("option",{hidden:!0,value:"",children:r}),i]}),props:s}}return{children:t.props.children,props:t.props}}const ve="_combobox_jkdyb_3",we="_dropdown_jkdyb_27",ke="_empty_jkdyb_30",Se="_group_jkdyb_31",Ne="_placeholder_jkdyb_32",Ce="_filter_jkdyb_40",Ee="_native_jkdyb_52",Ve="_option_jkdyb_62",Le="_options_jkdyb_84",Re="_panel_jkdyb_108",$e="_selected_jkdyb_132",Be="_text_jkdyb_136",Ie="_trigger_jkdyb_144",qe="_minimal_jkdyb_180",Pe="_inline_jkdyb_235",De="_label_jkdyb_267",o={combobox:ve,"combobox-input":"_combobox-input_jkdyb_12",dropdown:we,empty:ke,group:Se,placeholder:Ne,filter:Ce,native:Ee,option:Ve,options:Le,panel:Re,selected:$e,text:Be,trigger:Ie,minimal:qe,inline:Pe,label:De,"inline-field":"_inline-field_jkdyb_273"};function Y(t,i){return{"--icon-svg":de.iconSVG(t).replace("currentColor",i)}}const Fe=({children:t,className:i,combobox:r=!1,createOption:s,emptyLabel:n="No matches found",label:c,renderOption:f,searchPlaceholder:L="Filter",selectedItems:Z,variant:h="default",...ee})=>{const R=je(t),{defaultValue:te,onChange:$,value:B,...ne}=R.props,j=E.sanitizeSelectProps(ne),{className:re,...se}=j,M=a.useRef(null),Q=a.useRef(null),v=a.useId(),z=a.useRef(null),m=a.useRef(null),y=W(R.children),x=B!=null,I=ge(y,B,te),[q,P]=a.useState(()=>I),[u,p]=a.useState(!1),[w,k]=a.useState(""),S=x?String(B):q,O={default:E.resolveColor("--colors-semantic-content-secondary"),white:E.resolveColor("--color-white","white")},T=h==="minimal"?O.white:O.default,N=xe(y,S),le=Y("chevron",T),oe=Y("search",T),A=ye(y,w),b=w.trim(),C=!!(r&&s&&b&&s.isValid(b)),ie=c&&h==="inline"?X.formatInlineLabel(c):c,G=e=>e?(f==null?void 0:f({groupLabel:e.groupLabel,isSelected:e.value===S,label:e.label,text:e.text,value:e.value}))??e.label:"Select an option";a.useEffect(()=>{!x&&!y.some(e=>e.value===q)&&P(I)},[I,q,x,y]),a.useEffect(()=>{var e;if(!u){k("");return}(e=m.current)==null||e.focus()},[u]),a.useEffect(()=>{if(!u)return;const e=d=>{var _;(_=Q.current)!=null&&_.contains(d.target)||p(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[u]);const ae=e=>{x||P(e.target.value),$==null||$(e)},D=()=>{var e;p(!1),r||(e=M.current)==null||e.focus()},K=()=>{var e;k(""),p(!0),(e=m.current)==null||e.focus()},H=()=>{!s||!C||(s.onCreate(b),K())},ce=e=>{var U;x||P(e);const d=z.current;if(!d){D();return}const _=(U=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value"))==null?void 0:U.set;_==null||_.call(d,e),d.dispatchEvent(new Event("change",{bubbles:!0})),r?K():D()},ue=e=>{e.key==="Escape"&&D(),e.key==="Enter"&&e.target===m.current&&C&&(e.preventDefault(),H())},J=l.jsxs("div",{className:g.t(o.dropdown,h==="inline"&&o.inline,h==="minimal"&&o.minimal,i),onKeyDown:ue,ref:Q,...ee,children:[l.jsx("select",{...se,"aria-hidden":"true",className:g.t(o.native,re),onChange:ae,ref:z,tabIndex:-1,value:S,children:R.children}),r?l.jsxs("div",{className:o.combobox,onClick:()=>{var e;return(e=m.current)==null?void 0:e.focus()},children:[Z,l.jsx("input",{"aria-autocomplete":"list","aria-expanded":u,"aria-label":j["aria-label"]??c??L,className:o["combobox-input"],disabled:j.disabled,onChange:e=>{k(e.target.value),p(!0)},onClick:()=>p(!0),onFocus:()=>p(!0),placeholder:L||void 0,ref:m,role:"combobox",type:"text",value:w})]}):l.jsx(F.Button,{"aria-expanded":u,"aria-haspopup":"dialog","aria-labelledby":c?`${v} ${v}-value`:void 0,className:g.t(o.trigger,(N==null?void 0:N.isPlaceholder)&&o.placeholder),"data-open":u?"true":void 0,disabled:j.disabled,onClick:()=>p(e=>!e),ref:M,style:le,variant:"tertiary",children:l.jsx("span",{className:o.text,id:`${v}-value`,children:G(N)})}),u&&l.jsxs("div",{className:o.panel,children:[!r&&l.jsx(X.Input,{"aria-label":"Filter",className:o.filter,icon:"search",onChange:e=>k(e.target.value),placeholder:L,ref:m,style:oe,type:"search",value:w}),l.jsxs(pe.List,{"aria-label":"Dropdown",className:o.options,children:[A.map(e=>{const d=e.value===S;return l.jsx("li",{"data-component":"dropdown",children:l.jsxs(F.Button,{"aria-label":d?`${e.text}, selected`:e.text,className:g.t(o.option,d&&o.selected),disabled:e.disabled,onClick:()=>ce(e.value),variant:"tertiary",children:[l.jsx("span",{className:o.text,children:G(e)}),e.groupLabel&&l.jsx("small",{className:o.group,children:e.groupLabel})]})},`${e.groupLabel??"root"}-${e.value}`)}),C&&s&&l.jsx("li",{children:l.jsx(F.Button,{"aria-label":V(s.render(b))||b,className:o.option,onClick:H,variant:"tertiary",children:l.jsx("span",{className:o.text,children:s.render(b)})})}),A.length===0&&!C&&l.jsx("li",{className:o.empty,children:n})]})]})]});return c?l.jsxs("div",{className:g.t(o.label,h==="inline"&&o["inline-field"]),"data-component":"dropdown",children:[l.jsx("span",{id:v,children:ie}),J]}):J};exports.Dropdown=Fe;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/dropdown/options.tsx","../../../src/components/dropdown/index.tsx"],"sourcesContent":["import React, { Children, isValidElement } from 'react';\n\nimport { Select, type SelectProps } from '@/components/select';\n\ntype NativeSelectProps = Omit<React.ComponentPropsWithoutRef<'select'>, 'children' | 'multiple'> & {\n children: React.ReactNode;\n multiple?: false;\n};\n\ntype NativeSelectElement = React.ReactElement<NativeSelectProps, 'select'>;\ntype WrappedSelectElement = React.ReactElement<SelectProps, typeof Select>;\n\nexport type DropdownSelectElement = NativeSelectElement | WrappedSelectElement;\n\nexport type DropdownOption = {\n disabled: boolean;\n groupLabel?: string;\n hidden: boolean;\n isPlaceholder: boolean;\n label: React.ReactNode;\n selected: boolean;\n text: string;\n value: string;\n};\n\nexport type DropdownRenderOption = Pick<\n DropdownOption,\n 'groupLabel' | 'label' | 'text' | 'value'\n> & {\n isSelected: boolean;\n};\n\nexport function getNodeText(node: React.ReactNode): string {\n if (typeof node === 'string' || typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(getNodeText).join(' ');\n if (isValidElement<{ children?: React.ReactNode }>(node)) return getNodeText(node.props.children);\n return '';\n}\n\nfunction isOptionElement(\n node: React.ReactNode\n): node is React.ReactElement<React.ComponentPropsWithoutRef<'option'>, 'option'> {\n return isValidElement(node) && node.type === 'option';\n}\n\nfunction isOptGroupElement(\n node: React.ReactNode\n): node is React.ReactElement<React.ComponentPropsWithoutRef<'optgroup'>, 'optgroup'> {\n return isValidElement(node) && node.type === 'optgroup';\n}\n\nfunction isFragmentElement(\n node: React.ReactNode\n): node is React.ReactElement<{ children?: React.ReactNode }, typeof React.Fragment> {\n return isValidElement(node) && node.type === React.Fragment;\n}\n\nfunction isWrappedSelectElement(node: React.ReactNode): node is WrappedSelectElement {\n return isValidElement(node) && node.type === Select;\n}\n\nexport function extractOptions(\n children: React.ReactNode,\n groupLabel?: string,\n groupDisabled = false\n): DropdownOption[] {\n const options: DropdownOption[] = [];\n\n Children.forEach(children, (child) => {\n if (isFragmentElement(child)) {\n options.push(...extractOptions(child.props.children, groupLabel, groupDisabled));\n } else if (isOptionElement(child)) {\n const text = getNodeText(child.props.children).trim();\n const value = child.props.value != null ? String(child.props.value) : text;\n options.push({\n disabled: groupDisabled || Boolean(child.props.disabled),\n groupLabel,\n hidden: Boolean(child.props.hidden),\n isPlaceholder: Boolean(child.props.hidden && value === ''),\n label: child.props.children,\n selected: Boolean(child.props.selected),\n text,\n value,\n });\n } else if (isOptGroupElement(child)) {\n options.push(\n ...extractOptions(\n child.props.children,\n child.props.label,\n groupDisabled || Boolean(child.props.disabled)\n )\n );\n }\n });\n\n return options;\n}\n\nfunction buildWildcardMatcher(query: string) {\n const trimmedQuery = query.trim();\n if (!trimmedQuery) return null;\n\n const wildcardQuery = /[*?]/.test(trimmedQuery) ? trimmedQuery : `*${trimmedQuery}*`;\n const expression = [...wildcardQuery]\n .map((character) => {\n if (character === '*') return '.*';\n if (character === '?') return '.';\n return character.replace(/[|\\\\{}()[\\]^$+.,]/g, '\\\\$&');\n })\n .join('');\n\n return new RegExp(`^${expression}$`, 'i');\n}\n\nexport function filterOptions(options: DropdownOption[], query: string) {\n const matcher = buildWildcardMatcher(query);\n const selectableOptions = options.filter((option) => !option.hidden && !option.isPlaceholder);\n return matcher\n ? selectableOptions.filter((option) =>\n matcher.test([option.groupLabel, option.text, option.value].filter(Boolean).join(' '))\n )\n : selectableOptions;\n}\n\nexport function getDisplayOption(options: DropdownOption[], selectedValue: string) {\n return (\n options.find((option) => option.value === selectedValue) ??\n options.find((option) => option.isPlaceholder) ??\n options[0]\n );\n}\n\nexport function getInitialValue(\n options: DropdownOption[],\n value?: NativeSelectProps['value'],\n defaultValue?: NativeSelectProps['defaultValue']\n) {\n if (value != null) return String(value);\n if (defaultValue != null) return String(defaultValue);\n return options.find((option) => option.selected)?.value ?? options[0]?.value ?? '';\n}\n\nexport function normalizeSelectElement(selectElement: DropdownSelectElement) {\n if (isWrappedSelectElement(selectElement)) {\n const { children, placeholder, ...props } = selectElement.props;\n return {\n children: (\n <>\n {placeholder && (\n <option\n hidden\n value=''\n >\n {placeholder}\n </option>\n )}\n {children}\n </>\n ),\n props,\n };\n }\n\n return { children: selectElement.props.children, props: selectElement.props };\n}\n","import cx from 'classix';\nimport React, { useEffect, useId, useRef, useState } from 'react';\n\nimport { Button } from '@/components/button';\nimport { type IconName, iconSVG } from '@/components/icon/icons';\nimport { Input } from '@/components/input';\nimport { List } from '@/components/list';\nimport { sanitizeSelectProps } from '@/components/select/sanitize-select-props';\nimport { resolveColor } from '@/lib/color';\nimport { formatInlineLabel } from '@/lib/text';\n\nimport {\n type DropdownOption,\n type DropdownRenderOption,\n type DropdownSelectElement,\n extractOptions,\n filterOptions,\n getDisplayOption,\n getInitialValue,\n getNodeText,\n normalizeSelectElement,\n} from './options';\nimport styles from './styles.module.css';\n\nexport type { DropdownRenderOption } from './options';\n\nexport type DropdownCreateOption = {\n isValid: (value: string) => boolean;\n onCreate: (value: string) => void;\n render: (value: string) => React.ReactNode;\n};\n\nexport type DropdownProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {\n children: DropdownSelectElement;\n combobox?: boolean;\n createOption?: DropdownCreateOption;\n emptyLabel?: string;\n label?: string;\n renderOption?: (option: DropdownRenderOption) => React.ReactNode;\n searchPlaceholder?: string;\n selectedItems?: React.ReactNode;\n variant?: 'default' | 'inline' | 'minimal';\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nfunction getIconWithVars(icon: IconName, color: string): withVars {\n return {\n '--icon-svg': iconSVG(icon).replace('currentColor', color),\n };\n}\n\nexport const Dropdown = ({\n children: selectElement,\n className,\n combobox = false,\n createOption,\n emptyLabel = 'No matches found',\n label,\n renderOption,\n searchPlaceholder = 'Filter',\n selectedItems,\n variant = 'default',\n ...props\n}: DropdownProps) => {\n const normalizedSelect = normalizeSelectElement(selectElement);\n const { defaultValue, onChange, value, ...restSelectProps } = normalizedSelect.props;\n const selectProps = sanitizeSelectProps(restSelectProps);\n const { className: selectClassName, ...nativeSelectProps } = selectProps;\n const buttonRef = useRef<HTMLButtonElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const labelId = useId();\n const nativeSelectRef = useRef<HTMLSelectElement>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const options = extractOptions(normalizedSelect.children);\n const isControlled = value != null;\n const initialValue = getInitialValue(options, value, defaultValue);\n const [internalValue, setInternalValue] = useState(() => initialValue);\n const [isOpen, setIsOpen] = useState(false);\n const [query, setQuery] = useState('');\n const selectedValue = isControlled ? String(value) : internalValue;\n const iconColors = {\n default: resolveColor('--colors-semantic-content-secondary'),\n white: resolveColor('--color-white', 'white'),\n };\n const dropdownIconColor = variant === 'minimal' ? iconColors.white : iconColors.default;\n const displayOption = getDisplayOption(options, selectedValue);\n const triggerWithVars = getIconWithVars('chevron', dropdownIconColor);\n const filterWithVars = getIconWithVars('search', dropdownIconColor);\n const filteredOptions = filterOptions(options, query);\n const customValue = query.trim();\n const canCreateOption = Boolean(\n combobox && createOption && customValue && createOption.isValid(customValue)\n );\n const displayLabel = label && variant === 'inline' ? formatInlineLabel(label) : label;\n const renderDropdownOption = (option: DropdownOption | undefined) => {\n if (!option) return 'Select an option';\n\n return (\n renderOption?.({\n groupLabel: option.groupLabel,\n isSelected: option.value === selectedValue,\n label: option.label,\n text: option.text,\n value: option.value,\n }) ?? option.label\n );\n };\n\n useEffect(() => {\n if (!isControlled && !options.some((option) => option.value === internalValue)) {\n setInternalValue(initialValue);\n }\n }, [initialValue, internalValue, isControlled, options]);\n\n useEffect(() => {\n if (!isOpen) {\n setQuery('');\n return;\n }\n\n searchRef.current?.focus();\n }, [isOpen]);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n const handlePointerDown = (event: MouseEvent) => {\n if (!containerRef.current?.contains(event.target as Node)) {\n setIsOpen(false);\n }\n };\n\n document.addEventListener('mousedown', handlePointerDown);\n\n return () => {\n document.removeEventListener('mousedown', handlePointerDown);\n };\n }, [isOpen]);\n\n const handleNativeChange = (event: React.ChangeEvent<HTMLSelectElement>) => {\n if (!isControlled) {\n setInternalValue(event.target.value);\n }\n\n onChange?.(event);\n };\n\n const closeMenu = () => {\n setIsOpen(false);\n if (!combobox) {\n buttonRef.current?.focus();\n }\n };\n\n const continueComboboxSelection = () => {\n setQuery('');\n setIsOpen(true);\n searchRef.current?.focus();\n };\n\n const commitCustomValue = () => {\n if (!createOption || !canCreateOption) return;\n\n createOption.onCreate(customValue);\n continueComboboxSelection();\n };\n\n const commitValue = (nextValue: string) => {\n if (!isControlled) {\n setInternalValue(nextValue);\n }\n\n const nativeSelect = nativeSelectRef.current;\n\n if (!nativeSelect) {\n closeMenu();\n return;\n }\n\n const valueSetter = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, 'value')?.set;\n\n valueSetter?.call(nativeSelect, nextValue);\n nativeSelect.dispatchEvent(new Event('change', { bubbles: true }));\n if (combobox) {\n continueComboboxSelection();\n } else {\n closeMenu();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Escape') {\n closeMenu();\n }\n\n if (event.key === 'Enter' && event.target === searchRef.current && canCreateOption) {\n event.preventDefault();\n commitCustomValue();\n }\n };\n\n const dropdown = (\n <div\n className={cx(\n styles.dropdown,\n variant === 'inline' && styles.inline,\n variant === 'minimal' && styles.minimal,\n className\n )}\n onKeyDown={handleKeyDown}\n ref={containerRef}\n {...props}\n >\n <select\n {...nativeSelectProps}\n aria-hidden='true'\n className={cx(styles.native, selectClassName)}\n onChange={handleNativeChange}\n ref={nativeSelectRef}\n tabIndex={-1}\n value={selectedValue}\n >\n {normalizedSelect.children}\n </select>\n {combobox ? (\n <div\n className={styles.combobox}\n onClick={() => searchRef.current?.focus()}\n >\n {selectedItems}\n <input\n aria-autocomplete='list'\n aria-expanded={isOpen}\n aria-label={selectProps['aria-label'] ?? label ?? searchPlaceholder}\n className={styles['combobox-input']}\n disabled={selectProps.disabled}\n onChange={(event) => {\n setQuery(event.target.value);\n setIsOpen(true);\n }}\n onClick={() => setIsOpen(true)}\n onFocus={() => setIsOpen(true)}\n placeholder={searchPlaceholder || undefined}\n ref={searchRef}\n role='combobox'\n type='text'\n value={query}\n />\n </div>\n ) : (\n <Button\n aria-expanded={isOpen}\n aria-haspopup='dialog'\n aria-labelledby={label ? `${labelId} ${labelId}-value` : undefined}\n className={cx(styles.trigger, displayOption?.isPlaceholder && styles.placeholder)}\n data-open={isOpen ? 'true' : undefined}\n disabled={selectProps.disabled}\n onClick={() => setIsOpen((currentValue) => !currentValue)}\n ref={buttonRef}\n style={triggerWithVars}\n variant='tertiary'\n >\n <span\n className={styles.text}\n id={`${labelId}-value`}\n >\n {renderDropdownOption(displayOption)}\n </span>\n </Button>\n )}\n {isOpen && (\n <div className={styles.panel}>\n {!combobox && (\n <Input\n aria-label='Filter'\n className={styles.filter}\n icon='search'\n onChange={(event) => setQuery(event.target.value)}\n placeholder={searchPlaceholder}\n ref={searchRef}\n style={filterWithVars}\n type='search'\n value={query}\n />\n )}\n <List\n aria-label='Dropdown'\n className={styles.options}\n >\n {filteredOptions.map((option) => {\n const isSelected = option.value === selectedValue;\n\n return (\n <li key={`${option.groupLabel ?? 'root'}-${option.value}`}>\n <Button\n aria-label={isSelected ? `${option.text}, selected` : option.text}\n className={cx(styles.option, isSelected && styles.selected)}\n disabled={option.disabled}\n onClick={() => commitValue(option.value)}\n variant='tertiary'\n >\n <span className={styles.text}>{renderDropdownOption(option)}</span>\n {option.groupLabel && (\n <small className={styles.group}>{option.groupLabel}</small>\n )}\n </Button>\n </li>\n );\n })}\n {canCreateOption && createOption && (\n <li>\n <Button\n aria-label={getNodeText(createOption.render(customValue)) || customValue}\n className={styles.option}\n onClick={commitCustomValue}\n variant='tertiary'\n >\n <span className={styles.text}>{createOption.render(customValue)}</span>\n </Button>\n </li>\n )}\n {filteredOptions.length === 0 && !canCreateOption && (\n <li className={styles.empty}>{emptyLabel}</li>\n )}\n </List>\n </div>\n )}\n </div>\n );\n\n return label ? (\n <div className={cx(styles.label, variant === 'inline' && styles['inline-field'])}>\n <span id={labelId}>{displayLabel}</span>\n {dropdown}\n </div>\n ) : (\n dropdown\n );\n};\n"],"names":["getNodeText","node","String","Array","isArray","map","join","isValidElement","props","children","isOptionElement","type","isOptGroupElement","isFragmentElement","React","Fragment","isWrappedSelectElement","Select","extractOptions","groupLabel","groupDisabled","options","Children","forEach","child","push","text","trim","value","disabled","Boolean","hidden","isPlaceholder","label","selected","buildWildcardMatcher","query","trimmedQuery","expression","test","character","replace","RegExp","filterOptions","matcher","selectableOptions","filter","option","getDisplayOption","selectedValue","find","getInitialValue","defaultValue","normalizeSelectElement","selectElement","placeholder","jsxs","getIconWithVars","icon","color","iconSVG","Dropdown","className","combobox","createOption","emptyLabel","renderOption","searchPlaceholder","selectedItems","variant","normalizedSelect","onChange","restSelectProps","selectProps","sanitizeSelectProps","selectClassName","nativeSelectProps","buttonRef","useRef","containerRef","labelId","useId","nativeSelectRef","searchRef","isControlled","initialValue","internalValue","setInternalValue","useState","isOpen","setIsOpen","setQuery","iconColors","default","resolveColor","white","dropdownIconColor","displayOption","triggerWithVars","filterWithVars","filteredOptions","customValue","canCreateOption","isValid","displayLabel","formatInlineLabel","renderDropdownOption","isSelected","useEffect","some","current","focus","handlePointerDown","event","contains","target","document","addEventListener","removeEventListener","handleNativeChange","closeMenu","continueComboboxSelection","commitCustomValue","onCreate","commitValue","nextValue","nativeSelect","valueSetter","Object","getOwnPropertyDescriptor","HTMLSelectElement","prototype","set","call","dispatchEvent","Event","bubbles","handleKeyDown","key","preventDefault","dropdown","cx","styles","inline","minimal","jsx","native","undefined","Button","trigger","currentValue","panel","Input","List","group","render","length","empty"],"mappings":"oWAgCO,SAASA,EAAYC,EAA+B,CACzD,OAAI,OAAOA,GAAS,UAAY,OAAOA,GAAS,SAAiBC,OAAOD,CAAI,EACxEE,MAAMC,QAAQH,CAAI,EAAUA,EAAKI,IAAIL,CAAW,EAAEM,KAAK,GAAG,EAC1DC,EAAAA,eAA+CN,CAAI,EAAUD,EAAYC,EAAKO,MAAMC,QAAQ,EACzF,EACT,CAEA,SAASC,GACPT,EACgF,CAChF,OAAOM,EAAAA,eAAeN,CAAI,GAAKA,EAAKU,OAAS,QAC/C,CAEA,SAASC,GACPX,EACoF,CACpF,OAAOM,EAAAA,eAAeN,CAAI,GAAKA,EAAKU,OAAS,UAC/C,CAEA,SAASE,GACPZ,EACmF,CACnF,OAAOM,EAAAA,eAAeN,CAAI,GAAKA,EAAKU,OAASG,EAAMC,QACrD,CAEA,SAASC,GAAuBf,EAAqD,CACnF,OAAOM,EAAAA,eAAeN,CAAI,GAAKA,EAAKU,OAASM,EAAAA,MAC/C,CAEO,SAASC,EACdT,EACAU,EACAC,EAAgB,GACE,CAClB,MAAMC,EAA4B,CAAA,EAElCC,OAAAA,EAAAA,SAASC,QAAQd,EAAWe,GAAU,CACpC,GAAIX,GAAkBW,CAAK,EACzBH,EAAQI,KAAK,GAAGP,EAAeM,EAAMhB,MAAMC,SAAUU,EAAYC,CAAa,CAAC,UACtEV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sx"],"sourcesContent":["import React, { Children, isValidElement } from 'react';\n\nimport { Select, type SelectProps } from '@/components/select';\n\ntype NativeSelectProps = Omit<React.ComponentPropsWithoutRef<'select'>, 'children' | 'multiple'> & {\n children: React.ReactNode;\n multiple?: false;\n};\n\ntype NativeSelectElement = React.ReactElement<NativeSelectProps, 'select'>;\ntype WrappedSelectElement = React.ReactElement<SelectProps, typeof Select>;\n\nexport type DropdownSelectElement = NativeSelectElement | WrappedSelectElement;\n\nexport type DropdownOption = {\n disabled: boolean;\n groupLabel?: string;\n hidden: boolean;\n isPlaceholder: boolean;\n label: React.ReactNode;\n selected: boolean;\n text: string;\n value: string;\n};\n\nexport type DropdownRenderOption = Pick<\n DropdownOption,\n 'groupLabel' | 'label' | 'text' | 'value'\n> & {\n isSelected: boolean;\n};\n\nexport function getNodeText(node: React.ReactNode): string {\n if (typeof node === 'string' || typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(getNodeText).join(' ');\n if (isValidElement<{ children?: React.ReactNode }>(node)) return getNodeText(node.props.children);\n return '';\n}\n\nfunction isOptionElement(\n node: React.ReactNode\n): node is React.ReactElement<React.ComponentPropsWithoutRef<'option'>, 'option'> {\n return isValidElement(node) && node.type === 'option';\n}\n\nfunction isOptGroupElement(\n node: React.ReactNode\n): node is React.ReactElement<React.ComponentPropsWithoutRef<'optgroup'>, 'optgroup'> {\n return isValidElement(node) && node.type === 'optgroup';\n}\n\nfunction isFragmentElement(\n node: React.ReactNode\n): node is React.ReactElement<{ children?: React.ReactNode }, typeof React.Fragment> {\n return isValidElement(node) && node.type === React.Fragment;\n}\n\nfunction isWrappedSelectElement(node: React.ReactNode): node is WrappedSelectElement {\n return isValidElement(node) && node.type === Select;\n}\n\nexport function extractOptions(\n children: React.ReactNode,\n groupLabel?: string,\n groupDisabled = false\n): DropdownOption[] {\n const options: DropdownOption[] = [];\n\n Children.forEach(children, (child) => {\n if (isFragmentElement(child)) {\n options.push(...extractOptions(child.props.children, groupLabel, groupDisabled));\n } else if (isOptionElement(child)) {\n const text = getNodeText(child.props.children).trim();\n const value = child.props.value != null ? String(child.props.value) : text;\n options.push({\n disabled: groupDisabled || Boolean(child.props.disabled),\n groupLabel,\n hidden: Boolean(child.props.hidden),\n isPlaceholder: Boolean(child.props.hidden && value === ''),\n label: child.props.children,\n selected: Boolean(child.props.selected),\n text,\n value,\n });\n } else if (isOptGroupElement(child)) {\n options.push(\n ...extractOptions(\n child.props.children,\n child.props.label,\n groupDisabled || Boolean(child.props.disabled)\n )\n );\n }\n });\n\n return options;\n}\n\nfunction buildWildcardMatcher(query: string) {\n const trimmedQuery = query.trim();\n if (!trimmedQuery) return null;\n\n const wildcardQuery = /[*?]/.test(trimmedQuery) ? trimmedQuery : `*${trimmedQuery}*`;\n const expression = [...wildcardQuery]\n .map((character) => {\n if (character === '*') return '.*';\n if (character === '?') return '.';\n return character.replace(/[|\\\\{}()[\\]^$+.,]/g, '\\\\$&');\n })\n .join('');\n\n return new RegExp(`^${expression}$`, 'i');\n}\n\nexport function filterOptions(options: DropdownOption[], query: string) {\n const matcher = buildWildcardMatcher(query);\n const selectableOptions = options.filter((option) => !option.hidden && !option.isPlaceholder);\n return matcher\n ? selectableOptions.filter((option) =>\n matcher.test([option.groupLabel, option.text, option.value].filter(Boolean).join(' '))\n )\n : selectableOptions;\n}\n\nexport function getDisplayOption(options: DropdownOption[], selectedValue: string) {\n return (\n options.find((option) => option.value === selectedValue) ??\n options.find((option) => option.isPlaceholder) ??\n options[0]\n );\n}\n\nexport function getInitialValue(\n options: DropdownOption[],\n value?: NativeSelectProps['value'],\n defaultValue?: NativeSelectProps['defaultValue']\n) {\n if (value != null) return String(value);\n if (defaultValue != null) return String(defaultValue);\n return options.find((option) => option.selected)?.value ?? options[0]?.value ?? '';\n}\n\nexport function normalizeSelectElement(selectElement: DropdownSelectElement) {\n if (isWrappedSelectElement(selectElement)) {\n const { children, placeholder, ...props } = selectElement.props;\n return {\n children: (\n <>\n {placeholder && (\n <option\n hidden\n value=''\n >\n {placeholder}\n </option>\n )}\n {children}\n </>\n ),\n props,\n };\n }\n\n return { children: selectElement.props.children, props: selectElement.props };\n}\n","import cx from 'classix';\nimport React, { useEffect, useId, useRef, useState } from 'react';\n\nimport { Button } from '@/components/button';\nimport { type IconName, iconSVG } from '@/components/icon/icons';\nimport { Input } from '@/components/input';\nimport { List } from '@/components/list';\nimport { sanitizeSelectProps } from '@/components/select/sanitize-select-props';\nimport { resolveColor } from '@/utils/color';\nimport { formatInlineLabel } from '@/utils/text';\n\nimport {\n type DropdownOption,\n type DropdownRenderOption,\n type DropdownSelectElement,\n extractOptions,\n filterOptions,\n getDisplayOption,\n getInitialValue,\n getNodeText,\n normalizeSelectElement,\n} from './options';\nimport styles from './styles.module.css';\n\nexport type { DropdownRenderOption } from './options';\n\nexport type DropdownCreateOption = {\n isValid: (value: string) => boolean;\n onCreate: (value: string) => void;\n render: (value: string) => React.ReactNode;\n};\n\nexport type DropdownProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {\n children: DropdownSelectElement;\n combobox?: boolean;\n createOption?: DropdownCreateOption;\n emptyLabel?: string;\n label?: string;\n renderOption?: (option: DropdownRenderOption) => React.ReactNode;\n searchPlaceholder?: string;\n selectedItems?: React.ReactNode;\n variant?: 'default' | 'inline' | 'minimal';\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nfunction getIconWithVars(icon: IconName, color: string): withVars {\n return {\n '--icon-svg': iconSVG(icon).replace('currentColor', color),\n };\n}\n\nexport const Dropdown = ({\n children: selectElement,\n className,\n combobox = false,\n createOption,\n emptyLabel = 'No matches found',\n label,\n renderOption,\n searchPlaceholder = 'Filter',\n selectedItems,\n variant = 'default',\n ...props\n}: DropdownProps) => {\n const normalizedSelect = normalizeSelectElement(selectElement);\n const { defaultValue, onChange, value, ...restSelectProps } = normalizedSelect.props;\n const selectProps = sanitizeSelectProps(restSelectProps);\n const { className: selectClassName, ...nativeSelectProps } = selectProps;\n const buttonRef = useRef<HTMLButtonElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const labelId = useId();\n const nativeSelectRef = useRef<HTMLSelectElement>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const options = extractOptions(normalizedSelect.children);\n const isControlled = value != null;\n const initialValue = getInitialValue(options, value, defaultValue);\n const [internalValue, setInternalValue] = useState(() => initialValue);\n const [isOpen, setIsOpen] = useState(false);\n const [query, setQuery] = useState('');\n const selectedValue = isControlled ? String(value) : internalValue;\n const iconColors = {\n default: resolveColor('--colors-semantic-content-secondary'),\n white: resolveColor('--color-white', 'white'),\n };\n const dropdownIconColor = variant === 'minimal' ? iconColors.white : iconColors.default;\n const displayOption = getDisplayOption(options, selectedValue);\n const triggerWithVars = getIconWithVars('chevron', dropdownIconColor);\n const filterWithVars = getIconWithVars('search', dropdownIconColor);\n const filteredOptions = filterOptions(options, query);\n const customValue = query.trim();\n const canCreateOption = Boolean(\n combobox && createOption && customValue && createOption.isValid(customValue)\n );\n const displayLabel = label && variant === 'inline' ? formatInlineLabel(label) : label;\n const renderDropdownOption = (option: DropdownOption | undefined) => {\n if (!option) return 'Select an option';\n\n return (\n renderOption?.({\n groupLabel: option.groupLabel,\n isSelected: option.value === selectedValue,\n label: option.label,\n text: option.text,\n value: option.value,\n }) ?? option.label\n );\n };\n\n useEffect(() => {\n if (!isControlled && !options.some((option) => option.value === internalValue)) {\n setInternalValue(initialValue);\n }\n }, [initialValue, internalValue, isControlled, options]);\n\n useEffect(() => {\n if (!isOpen) {\n setQuery('');\n return;\n }\n\n searchRef.current?.focus();\n }, [isOpen]);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n const handlePointerDown = (event: MouseEvent) => {\n if (!containerRef.current?.contains(event.target as Node)) {\n setIsOpen(false);\n }\n };\n\n document.addEventListener('mousedown', handlePointerDown);\n\n return () => {\n document.removeEventListener('mousedown', handlePointerDown);\n };\n }, [isOpen]);\n\n const handleNativeChange = (event: React.ChangeEvent<HTMLSelectElement>) => {\n if (!isControlled) {\n setInternalValue(event.target.value);\n }\n\n onChange?.(event);\n };\n\n const closeMenu = () => {\n setIsOpen(false);\n if (!combobox) {\n buttonRef.current?.focus();\n }\n };\n\n const continueComboboxSelection = () => {\n setQuery('');\n setIsOpen(true);\n searchRef.current?.focus();\n };\n\n const commitCustomValue = () => {\n if (!createOption || !canCreateOption) return;\n\n createOption.onCreate(customValue);\n continueComboboxSelection();\n };\n\n const commitValue = (nextValue: string) => {\n if (!isControlled) {\n setInternalValue(nextValue);\n }\n\n const nativeSelect = nativeSelectRef.current;\n\n if (!nativeSelect) {\n closeMenu();\n return;\n }\n\n const valueSetter = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, 'value')?.set;\n\n valueSetter?.call(nativeSelect, nextValue);\n nativeSelect.dispatchEvent(new Event('change', { bubbles: true }));\n if (combobox) {\n continueComboboxSelection();\n } else {\n closeMenu();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Escape') {\n closeMenu();\n }\n\n if (event.key === 'Enter' && event.target === searchRef.current && canCreateOption) {\n event.preventDefault();\n commitCustomValue();\n }\n };\n\n const dropdown = (\n <div\n className={cx(\n styles.dropdown,\n variant === 'inline' && styles.inline,\n variant === 'minimal' && styles.minimal,\n className\n )}\n onKeyDown={handleKeyDown}\n ref={containerRef}\n {...props}\n >\n <select\n {...nativeSelectProps}\n aria-hidden='true'\n className={cx(styles.native, selectClassName)}\n onChange={handleNativeChange}\n ref={nativeSelectRef}\n tabIndex={-1}\n value={selectedValue}\n >\n {normalizedSelect.children}\n </select>\n {combobox ? (\n <div\n className={styles.combobox}\n onClick={() => searchRef.current?.focus()}\n >\n {selectedItems}\n <input\n aria-autocomplete='list'\n aria-expanded={isOpen}\n aria-label={selectProps['aria-label'] ?? label ?? searchPlaceholder}\n className={styles['combobox-input']}\n disabled={selectProps.disabled}\n onChange={(event) => {\n setQuery(event.target.value);\n setIsOpen(true);\n }}\n onClick={() => setIsOpen(true)}\n onFocus={() => setIsOpen(true)}\n placeholder={searchPlaceholder || undefined}\n ref={searchRef}\n role='combobox'\n type='text'\n value={query}\n />\n </div>\n ) : (\n <Button\n aria-expanded={isOpen}\n aria-haspopup='dialog'\n aria-labelledby={label ? `${labelId} ${labelId}-value` : undefined}\n className={cx(styles.trigger, displayOption?.isPlaceholder && styles.placeholder)}\n data-open={isOpen ? 'true' : undefined}\n disabled={selectProps.disabled}\n onClick={() => setIsOpen((currentValue) => !currentValue)}\n ref={buttonRef}\n style={triggerWithVars}\n variant='tertiary'\n >\n <span\n className={styles.text}\n id={`${labelId}-value`}\n >\n {renderDropdownOption(displayOption)}\n </span>\n </Button>\n )}\n {isOpen && (\n <div className={styles.panel}>\n {!combobox && (\n <Input\n aria-label='Filter'\n className={styles.filter}\n icon='search'\n onChange={(event) => setQuery(event.target.value)}\n placeholder={searchPlaceholder}\n ref={searchRef}\n style={filterWithVars}\n type='search'\n value={query}\n />\n )}\n <List\n aria-label='Dropdown'\n className={styles.options}\n >\n {filteredOptions.map((option) => {\n const isSelected = option.value === selectedValue;\n\n return (\n <li key={`${option.groupLabel ?? 'root'}-${option.value}`}>\n <Button\n aria-label={isSelected ? `${option.text}, selected` : option.text}\n className={cx(styles.option, isSelected && styles.selected)}\n disabled={option.disabled}\n onClick={() => commitValue(option.value)}\n variant='tertiary'\n >\n <span className={styles.text}>{renderDropdownOption(option)}</span>\n {option.groupLabel && (\n <small className={styles.group}>{option.groupLabel}</small>\n )}\n </Button>\n </li>\n );\n })}\n {canCreateOption && createOption && (\n <li>\n <Button\n aria-label={getNodeText(createOption.render(customValue)) || customValue}\n className={styles.option}\n onClick={commitCustomValue}\n variant='tertiary'\n >\n <span className={styles.text}>{createOption.render(customValue)}</span>\n </Button>\n </li>\n )}\n {filteredOptions.length === 0 && !canCreateOption && (\n <li className={styles.empty}>{emptyLabel}</li>\n )}\n </List>\n </div>\n )}\n </div>\n );\n\n return label ? (\n <div className={cx(styles.label, variant === 'inline' && styles['inline-field'])}>\n <span id={labelId}>{displayLabel}</span>\n {dropdown}\n </div>\n ) : (\n dropdown\n );\n};\n"],"names":["getNodeText","node","String","Array","isArray","map","join","isValidElement","props","children","isOptionElement","type","isOptGroupElement","isFragmentElement","React","Fragment","isWrappedSelectElement","Select","extractOptions","groupLabel","groupDisabled","options","Children","forEach","child","push","text","trim","value","disabled","Boolean","hidden","isPlaceholder","label","selected","buildWildcardMatcher","query","trimmedQuery","expression","test","character","replace","RegExp","filterOptions","matcher","selectableOptions","filter","option","getDisplayOption","selectedValue","find","getInitialValue","defaultValue","normalizeSelectElement","selectElement","placeholder","jsxs","getIconWithVars","icon","color","iconSVG","Dropdown","className","combobox","createOption","emptyLabel","renderOption","searchPlaceholder","selectedItems","variant","normalizedSelect","onChange","restSelectProps","selectProps","sanitizeSelectProps","selectClassName","nativeSelectProps","buttonRef","useRef","containerRef","labelId","useId","nativeSelectRef","searchRef","isControlled","initialValue","internalValue","setInternalValue","useState","isOpen","setIsOpen","setQuery","iconColors","default","resolveColor","white","dropdownIconColor","displayOption","triggerWithVars","filterWithVars","filteredOptions","customValue","canCreateOption","isValid","displayLabel","formatInlineLabel","renderDropdownOption","isSelected","useEffect","some","current","focus","handlePointerDown","event","contains","target","document","addEventListener","removeEventListener","handleNativeChange","closeMenu","continueComboboxSelection","commitCustomValue","onCreate","commitValue","nextValue","nativeSelect","valueSetter","Object","getOwnPropertyDescriptor","HTMLSelectElement","prototype","set","call","dispatchEvent","Event","bubbles","handleKeyDown","key","preventDefault","dropdown","cx","styles","inline","minimal","jsx","native","undefined","Button","trigger","currentValue","panel","Input","List","group","render","length","empty"],"mappings":"oWAgCO,SAASA,EAAYC,EAA+B,CACzD,OAAI,OAAOA,GAAS,UAAY,OAAOA,GAAS,SAAiBC,OAAOD,CAAI,EACxEE,MAAMC,QAAQH,CAAI,EAAUA,EAAKI,IAAIL,CAAW,EAAEM,KAAK,GAAG,EAC1DC,EAAAA,eAA+CN,CAAI,EAAUD,EAAYC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AWyC,EAAO/F,OAClB,QAAS2E,EACT,QAAQ,WAER,eAAC,OAAA,CAAK,UAAWoB,EAAOpH,KAAOsC,SAAAA,EAAa2F,OAAOtD,CAAW,CAAA,CAAE,EAClE,EACF,EAEDD,EAAgBwD,SAAW,GAAK,CAACtD,SAC/B,KAAA,CAAG,UAAWwC,EAAOe,MAAQ5F,SAAAA,CAAAA,CAAW,CAAA,CAAA,CAE7C,CAAA,CAAA,CACF,CAAA,EAEJ,EAGF,OAAOhC,EACLuB,EAAAA,KAAC,MAAA,CAAI,UAAWqF,EAAAA,EAAGC,EAAO7G,MAAOoC,IAAY,UAAYyE,EAAO,cAAc,CAAC,EAAE,iBAAA,WAC/E,SAAA,CAAAG,EAAAA,IAAC,OAAA,CAAK,GAAIjE,EAAUwB,SAAAA,GAAa,EAChCoC,CAAAA,CAAAA,CACH,EAEAA,CAEJ"}
|
|
@@ -5,7 +5,7 @@ import { Button as M } from "../button/index.js";
|
|
|
5
5
|
import { i as ye } from "../../icons-BkaMeh-J.js";
|
|
6
6
|
import { f as ge, I as ve } from "../../index-DMGGDV9J.js";
|
|
7
7
|
import { List as xe } from "../list/index.js";
|
|
8
|
-
import { S as ke, s as we, r as ee } from "../../index-
|
|
8
|
+
import { S as ke, s as we, r as ee } from "../../index-BAxpgMzb.js";
|
|
9
9
|
import '../../assets/index37.css';function I(t) {
|
|
10
10
|
return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(I).join(" ") : x(t) ? I(t.props.children) : "";
|
|
11
11
|
}
|