@travel-match/ui 0.3.0 → 0.5.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/components/AccountMenu/AccountMenu.cjs +1 -1
- package/dist/components/AccountMenu/AccountMenu.cjs.map +1 -1
- package/dist/components/AccountMenu/AccountMenu.js +1 -1
- package/dist/components/AccountMenu/AccountMenu.js.map +1 -1
- package/dist/components/ConfirmationDialog/ConfirmationDialog.cjs +1 -1
- package/dist/components/ConfirmationDialog/ConfirmationDialog.cjs.map +1 -1
- package/dist/components/ConfirmationDialog/ConfirmationDialog.js +1 -0
- package/dist/components/ConfirmationDialog/ConfirmationDialog.js.map +1 -1
- package/dist/components/CtaRequestFlow/CtaRequestFlow.cjs +1 -1
- package/dist/components/CtaRequestFlow/CtaRequestFlow.cjs.map +1 -1
- package/dist/components/CtaRequestFlow/CtaRequestFlow.js +72 -37
- package/dist/components/CtaRequestFlow/CtaRequestFlow.js.map +1 -1
- package/dist/components/ExampleRequests/ExampleRequests.cjs +1 -1
- package/dist/components/ExampleRequests/ExampleRequests.cjs.map +1 -1
- package/dist/components/ExampleRequests/ExampleRequests.js +18 -17
- package/dist/components/ExampleRequests/ExampleRequests.js.map +1 -1
- package/dist/components/FaqItem/FaqItem.cjs +1 -1
- package/dist/components/FaqItem/FaqItem.cjs.map +1 -1
- package/dist/components/FaqItem/FaqItem.js +79 -34
- package/dist/components/FaqItem/FaqItem.js.map +1 -1
- package/dist/components/Field/Field.cjs +1 -1
- package/dist/components/Field/Field.cjs.map +1 -1
- package/dist/components/Field/Field.js +10 -8
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/HowItWorksSteps/HowItWorksSteps.cjs +1 -1
- package/dist/components/HowItWorksSteps/HowItWorksSteps.cjs.map +1 -1
- package/dist/components/HowItWorksSteps/HowItWorksSteps.js +1 -1
- package/dist/components/HowItWorksSteps/HowItWorksSteps.js.map +1 -1
- package/dist/components/InlineAlert/InlineAlert.cjs +1 -1
- package/dist/components/InlineAlert/InlineAlert.cjs.map +1 -1
- package/dist/components/InlineAlert/InlineAlert.js +9 -8
- package/dist/components/InlineAlert/InlineAlert.js.map +1 -1
- package/dist/components/LogoAnimation/LogoAnimation.cjs +2 -0
- package/dist/components/LogoAnimation/LogoAnimation.cjs.map +1 -0
- package/dist/components/LogoAnimation/LogoAnimation.js +202 -0
- package/dist/components/LogoAnimation/LogoAnimation.js.map +1 -0
- package/dist/components/LogoAnimation/LogoAnimationArtwork.cjs +2 -0
- package/dist/components/LogoAnimation/LogoAnimationArtwork.cjs.map +1 -0
- package/dist/components/LogoAnimation/LogoAnimationArtwork.js +57 -0
- package/dist/components/LogoAnimation/LogoAnimationArtwork.js.map +1 -0
- package/dist/components/LogoAnimation/motion.cjs +2 -0
- package/dist/components/LogoAnimation/motion.cjs.map +1 -0
- package/dist/components/LogoAnimation/motion.js +180 -0
- package/dist/components/LogoAnimation/motion.js.map +1 -0
- package/dist/components/NewRequestOverlay/NewRequestOverlay.cjs +1 -1
- package/dist/components/NewRequestOverlay/NewRequestOverlay.cjs.map +1 -1
- package/dist/components/NewRequestOverlay/NewRequestOverlay.js +67 -48
- package/dist/components/NewRequestOverlay/NewRequestOverlay.js.map +1 -1
- package/dist/components/NotificationsDropdown/NotificationsMenu.cjs +1 -1
- package/dist/components/NotificationsDropdown/NotificationsMenu.cjs.map +1 -1
- package/dist/components/NotificationsDropdown/NotificationsMenu.js +1 -1
- package/dist/components/NotificationsDropdown/NotificationsMenu.js.map +1 -1
- package/dist/components/PackageAnimation/PackageAnimation.cjs +1 -1
- package/dist/components/PackageAnimation/PackageAnimation.cjs.map +1 -1
- package/dist/components/PackageAnimation/PackageAnimation.js +1 -1
- package/dist/components/PackageAnimation/PackageAnimation.js.map +1 -1
- package/dist/components/PartnerCarousel/PartnerCarousel.cjs.map +1 -1
- package/dist/components/PartnerCarousel/PartnerCarousel.js.map +1 -1
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.cjs.map +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +8 -5
- package/dist/components/PhoneInput/PhoneInput.js.map +1 -1
- package/dist/components/PopularQuestions/PopularQuestions.cjs +1 -1
- package/dist/components/PopularQuestions/PopularQuestions.cjs.map +1 -1
- package/dist/components/PopularQuestions/PopularQuestions.js +22 -21
- package/dist/components/PopularQuestions/PopularQuestions.js.map +1 -1
- package/dist/components/RegionMap/RegionMap.cjs +2 -0
- package/dist/components/RegionMap/RegionMap.cjs.map +1 -0
- package/dist/components/RegionMap/RegionMap.js +55 -0
- package/dist/components/RegionMap/RegionMap.js.map +1 -0
- package/dist/components/RegionMap/mapPaths.cjs +2 -0
- package/dist/components/RegionMap/mapPaths.cjs.map +1 -0
- package/dist/components/RegionMap/mapPaths.js +86 -0
- package/dist/components/RegionMap/mapPaths.js.map +1 -0
- package/dist/components/RequestSearch/RequestSearch.cjs +2 -0
- package/dist/components/RequestSearch/RequestSearch.cjs.map +1 -0
- package/dist/components/RequestSearch/RequestSearch.js +36 -0
- package/dist/components/RequestSearch/RequestSearch.js.map +1 -0
- package/dist/components/RequestSummary/RequestSummary.cjs +1 -1
- package/dist/components/RequestSummary/RequestSummary.cjs.map +1 -1
- package/dist/components/RequestSummary/RequestSummary.js +31 -32
- package/dist/components/RequestSummary/RequestSummary.js.map +1 -1
- package/dist/components/RequestTypeOption/RequestTypeOption.cjs +2 -0
- package/dist/components/RequestTypeOption/RequestTypeOption.cjs.map +1 -0
- package/dist/components/RequestTypeOption/RequestTypeOption.js +52 -0
- package/dist/components/RequestTypeOption/RequestTypeOption.js.map +1 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.js +127 -121
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/ShowMore/ShowMore.cjs +2 -0
- package/dist/components/ShowMore/ShowMore.cjs.map +1 -0
- package/dist/components/ShowMore/ShowMore.js +34 -0
- package/dist/components/ShowMore/ShowMore.js.map +1 -0
- package/dist/components/SiteHeader/SiteHeader.cjs.map +1 -1
- package/dist/components/SiteHeader/SiteHeader.js.map +1 -1
- package/dist/components/SortSelect/SortSelect.cjs +2 -0
- package/dist/components/SortSelect/SortSelect.cjs.map +1 -0
- package/dist/components/SortSelect/SortSelect.js +18 -0
- package/dist/components/SortSelect/SortSelect.js.map +1 -0
- package/dist/components/StatusFilter/StatusFilter.cjs +2 -0
- package/dist/components/StatusFilter/StatusFilter.cjs.map +1 -0
- package/dist/components/StatusFilter/StatusFilter.js +37 -0
- package/dist/components/StatusFilter/StatusFilter.js.map +1 -0
- package/dist/components/StatusTag/StatusTag.cjs.map +1 -1
- package/dist/components/StatusTag/StatusTag.js.map +1 -1
- package/dist/components/StepCard/StepCard.cjs +1 -1
- package/dist/components/StepCard/StepCard.cjs.map +1 -1
- package/dist/components/StepCard/StepCard.js +9 -6
- package/dist/components/StepCard/StepCard.js.map +1 -1
- package/dist/components/StepProgress/StepProgress.cjs +2 -0
- package/dist/components/StepProgress/StepProgress.cjs.map +1 -0
- package/dist/components/StepProgress/StepProgress.js +43 -0
- package/dist/components/StepProgress/StepProgress.js.map +1 -0
- package/dist/components/TelegramConnect/TelegramConnect.cjs +2 -0
- package/dist/components/TelegramConnect/TelegramConnect.cjs.map +1 -0
- package/dist/components/TelegramConnect/TelegramConnect.js +57 -0
- package/dist/components/TelegramConnect/TelegramConnect.js.map +1 -0
- package/dist/components/TextInput/TextInput.cjs +1 -1
- package/dist/components/TextInput/TextInput.cjs.map +1 -1
- package/dist/components/TextInput/TextInput.js +21 -19
- package/dist/components/TextInput/TextInput.js.map +1 -1
- package/dist/components/Textarea/Textarea.cjs +1 -1
- package/dist/components/Textarea/Textarea.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.js +18 -16
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Toast/Toast.cjs +2 -0
- package/dist/components/Toast/Toast.cjs.map +1 -0
- package/dist/components/Toast/Toast.js +57 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/icons/generated/CheckmarkIcon.cjs +1 -1
- package/dist/icons/generated/CheckmarkIcon.cjs.map +1 -1
- package/dist/icons/generated/CheckmarkIcon.js +19 -2
- package/dist/icons/generated/CheckmarkIcon.js.map +1 -1
- package/dist/icons/generated/InfoIcon.cjs +2 -0
- package/dist/icons/generated/InfoIcon.cjs.map +1 -0
- package/dist/icons/generated/InfoIcon.js +35 -0
- package/dist/icons/generated/InfoIcon.js.map +1 -0
- package/dist/icons/generated/SendIcon.cjs +2 -0
- package/dist/icons/generated/SendIcon.cjs.map +1 -0
- package/dist/icons/generated/SendIcon.js +23 -0
- package/dist/icons/generated/SendIcon.js.map +1 -0
- package/dist/icons/generated/index.cjs +1 -1
- package/dist/icons/generated/index.cjs.map +1 -1
- package/dist/icons/generated/index.js +71 -67
- package/dist/icons/generated/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +649 -34
- package/dist/index.d.ts +649 -34
- package/dist/index.js +146 -134
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +0 -6
- package/dist/tokens/generated.cjs +1 -1
- package/dist/tokens/generated.cjs.map +1 -1
- package/dist/tokens/generated.js +1 -7
- package/dist/tokens/generated.js.map +1 -1
- package/dist/tokens.css +0 -12
- package/dist/tokens.d.cts +2 -26
- package/dist/tokens.d.ts +2 -26
- package/dist/tokens.json +1 -7
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestSummary.js","names":["RequestSummary","props","cn","className","RequestSummarySection","ariaLabelledBy","titleId","useId","Heading","headingLevel","hasRows","rows","Children","children","title","action","RequestSummaryRow","row","index","label","empty","RequestSummaryEditLink","
|
|
1
|
+
{"version":3,"file":"RequestSummary.js","names":["RequestSummary","props","cn","className","RequestSummarySection","ariaLabelledBy","titleId","useId","Heading","headingLevel","hasRows","rows","Children","children","title","action","RequestSummaryRow","row","index","label","empty","RequestSummaryEditLink","asChild","Slot","icon","Slottable"],"sources":["../../../src/components/RequestSummary/RequestSummary.tsx"],"sourcesContent":["import { Slot, Slottable } from '@radix-ui/react-slot';\nimport { Children, forwardRef, useId, type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport './RequestSummary.css';\n\nexport type RequestSummaryProps = HTMLAttributes<HTMLDivElement>;\n\n/**\n * The details of a request as a card of sections (Figma component set \"Request Summary\"). Put one\n * `RequestSummarySection` per group inside; a divider is drawn between them. It fills its container and stacks\n * labels above values below 560px of own width (Figma \"Mobile / Request Summary\").\n */\nexport const RequestSummary = /* @__PURE__ */ forwardRef<HTMLDivElement, RequestSummaryProps>(function RequestSummary({ className, ...props }, ref) {\n return <div ref={ref} className={cn('tm-request-summary', className)} {...props} />;\n});\n\nexport interface RequestSummaryRowData {\n /** Name of the field, e.g. \"Destination\". */\n label: ReactNode;\n /** Already formatted, translated value. */\n value: ReactNode;\n /** Marks a placeholder value such as \"Not provided\" (lighter text). */\n empty?: boolean;\n /** React key; defaults to the row's index. */\n key?: string | number;\n}\n\nexport interface RequestSummarySectionProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {\n /** Section heading, e.g. \"Trip details\". */\n title: ReactNode;\n /** Heading level of the title; pick the one that fits the page outline. */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n /** Action at the end of the heading row, usually a `RequestSummaryEditLink`. */\n action?: ReactNode;\n /** The label/value rows as data. `RequestSummaryRow` children are rendered after them. */\n rows?: RequestSummaryRowData[];\n /** `RequestSummaryRow` elements, for rows that need their own markup or conditions. */\n children?: ReactNode;\n}\n\n/** One titled group of rows inside `RequestSummary` (Figma \"Group / …\"). The rows form a description list. */\nexport const RequestSummarySection = /* @__PURE__ */ forwardRef<HTMLElement, RequestSummarySectionProps>(function RequestSummarySection(\n { title, headingLevel = 3, action, rows, className, children, 'aria-labelledby': ariaLabelledBy, ...props },\n ref,\n) {\n const titleId = useId();\n const Heading = `h${headingLevel}` as const;\n const hasRows = Boolean(rows?.length) || Children.toArray(children).length > 0;\n return (\n <section ref={ref} className={cn('tm-request-summary__section', className)} aria-labelledby={ariaLabelledBy ?? titleId} {...props}>\n <div className=\"tm-request-summary__header\">\n <Heading id={titleId} className=\"tm-request-summary__title\">\n {title}\n </Heading>\n {action}\n </div>\n {hasRows ? (\n <dl className=\"tm-request-summary__rows\">\n {rows?.map((row, index) => (\n <RequestSummaryRow key={row.key ?? index} label={row.label} empty={row.empty}>\n {row.value}\n </RequestSummaryRow>\n ))}\n {children}\n </dl>\n ) : null}\n </section>\n );\n});\n\nexport interface RequestSummaryRowProps extends HTMLAttributes<HTMLDivElement> {\n /** Name of the field, e.g. \"Destination\". */\n label: ReactNode;\n /** Marks a placeholder value such as \"Not provided\" (lighter text). */\n empty?: boolean;\n /** The value: already formatted, translated content. */\n children?: ReactNode;\n}\n\n/** A label/value row (Figma \"Row / …\"); must be inside a `RequestSummarySection`. */\nexport const RequestSummaryRow = /* @__PURE__ */ forwardRef<HTMLDivElement, RequestSummaryRowProps>(function RequestSummaryRow(\n { label, empty = false, className, children, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cn('tm-request-summary__row', className)} {...props}>\n <dt className=\"tm-request-summary__label\">{label}</dt>\n <dd className=\"tm-request-summary__value\" data-empty={empty ? '' : undefined}>\n {children}\n </dd>\n </div>\n );\n});\n\nexport interface RequestSummaryEditLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n /** Icon before the label. None by default — Figma shows the word only; pass one (e.g. `<ResizeFieldIcon />`) to add it. */\n icon?: ReactNode;\n /** Renders the single child element (a router `<Link>`, or a `<button>` that opens an editor) instead of an `<a>`. */\n asChild?: boolean;\n /** Label. Defaults to \"Edit\" — pass the translated text in apps, and name the section for screen readers with `aria-label`. */\n children?: ReactNode;\n}\n\n/** The \"Edit\" link of a section heading (Figma \"Edit link\"). */\nexport const RequestSummaryEditLink = /* @__PURE__ */ forwardRef<HTMLAnchorElement, RequestSummaryEditLinkProps>(function RequestSummaryEditLink(\n { icon = null, asChild = false, className, children, ...props },\n ref,\n) {\n const Comp = asChild ? Slot : 'a';\n return (\n <Comp ref={ref} className={cn('tm-request-summary__edit', className)} data-tm-icon-size=\"sm\" {...props}>\n {icon}\n <Slottable>{children ?? 'Edit'}</Slottable>\n </Comp>\n );\n});\n"],"mappings":";;;;;;;AAYA,IAAaA,IAAiC,kBAAgD,SAAwB,EAAE,cAAW,GAAGC,KAAS,GAAK;CAClJ,OAAO,kBAAC,OAAD;EAAU;EAAK,WAAWC,EAAG,sBAAsBC,CAAS;EAAG,GAAIF;CAAQ,CAAA;AACpF,CAAC,GA2BYG,IAAwC,kBAAoD,SACvG,EAAE,UAAO,kBAAe,GAAG,WAAQ,SAAM,cAAW,aAAU,mBAAmBC,GAAgB,GAAGJ,KACpG,GACA;CACA,IAAMK,IAAUC,EAAM,GAChBC,IAAU,IAAIC,KACdC,IAAU,EAAQC,GAAM,UAAWC,EAAS,QAAQC,CAAQ,CAAC,CAAC,SAAS;CAC7E,OACE,kBAAC,WAAD;EAAc;EAAK,WAAWX,EAAG,+BAA+BC,CAAS;EAAG,mBAAiBE,KAAkBC;EAAS,GAAIL;EAA5H,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAACO,GAAD;IAAS,IAAIF;IAAS,WAAU;IAC7B,UAAAQ;GACM,CAAA,GACRC,CACE;EACJ,CAAA,GAAAL,IACC,kBAAC,MAAD;GAAI,WAAU;GAAd,UAAA,CACGC,GAAM,KAAK,GAAK,MACf,kBAACK,GAAD;IAA0C,OAAOC,EAAI;IAAO,OAAOA,EAAI;IACpE,UAAAA,EAAI;GACY,GAFKA,EAAI,OAAOC,CAEhB,CACpB,GACAL,CACC;EACF,CAAA,IAAA,IACG;;AAEb,CAAC,GAYYG,IAAoC,kBAAmD,SAClG,EAAE,UAAO,WAAQ,IAAO,cAAW,aAAU,GAAGf,KAChD,GACA;CACA,OACE,kBAAC,OAAD;EAAU;EAAK,WAAWC,EAAG,2BAA2BC,CAAS;EAAG,GAAIF;EAAxE,UAAA,CACE,kBAAC,MAAD;GAAI,WAAU;GAA6B,UAAAkB;EAAU,CAAA,GACrD,kBAAC,MAAD;GAAI,WAAU;GAA4B,cAAYC,IAAQ,KAAK,KAAA;GAChE;EACC,CAAA,CACD;;AAET,CAAC,GAYYC,IAAyC,kBAA2D,SAC/G,EAAE,UAAO,MAAM,aAAU,IAAO,cAAW,aAAU,GAAGpB,KACxD,GACA;CAEA,OACE,kBAFWqB,IAAUC,IAAO,KAE5B;EAAW;EAAK,WAAWrB,EAAG,4BAA4BC,CAAS;EAAG,qBAAkB;EAAK,GAAIF;EAAjG,UAAA,CACGuB,GACD,kBAACC,GAAD,EAAA,UAAYZ,KAAY,OAAkB,CAAA,CACtC;;AAEV,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";const e=require("../../icons/generated/NextArrowIcon.cjs"),t=require("../../utils/cn.cjs"),n=require("../IconTile/IconTile.cjs");;/* empty css */let r=require("react"),i=require("react/jsx-runtime"),a=require("@radix-ui/react-slot");var o=(0,r.forwardRef)(function({title:o,description:s,icon:c,href:l,asChild:u=!1,disabled:d,type:f,className:p,children:m,...h},g){let _=u?a.Slot:l===void 0?`button`:`a`,v=s!=null&&s!==!1,y=(0,r.useId)(),b=`${y}-title`,x=`${y}-description`;return(0,i.jsxs)(_,{ref:g,className:t.cn(`tm-request-type-option`,p),href:_===`a`&&!d?l:void 0,type:_===`button`?f??`button`:void 0,disabled:_===`button`?d:void 0,"aria-disabled":_!==`button`&&d?!0:void 0,"aria-labelledby":h[`aria-label`]?void 0:v?`${b} ${x}`:b,...h,children:[c?(0,i.jsx)(n.IconTile,{className:`tm-request-type-option__icon`,size:`md`,icon:c,"aria-hidden":`true`}):null,(0,i.jsxs)(`span`,{className:`tm-request-type-option__text`,children:[(0,i.jsx)(`span`,{id:b,className:`tm-request-type-option__title`,children:o}),v?(0,i.jsx)(`span`,{id:x,className:`tm-request-type-option__description`,children:s}):null]}),(0,i.jsx)(a.Slottable,{children:m}),(0,i.jsx)(`span`,{className:`tm-request-type-option__arrow`,"data-tm-icon-size":`md`,"aria-hidden":`true`,children:(0,i.jsx)(e.NextArrowIcon,{})})]})});exports.RequestTypeOption=o;
|
|
2
|
+
//# sourceMappingURL=RequestTypeOption.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestTypeOption.cjs","names":["Slot","useId","cn","IconTile","Slottable","NextArrowIcon","require_NextArrowIcon","require_cn","require_IconTile","react","react_jsx_runtime","_radix_ui_react_slot","RequestTypeOption","props","Comp","asChild","href","hasDescription","description","id","titleId","descriptionId","className","disabled","type","icon","title"],"sources":["../../../src/components/RequestTypeOption/RequestTypeOption.tsx"],"sourcesContent":["import { Slot, Slottable } from '@radix-ui/react-slot';\nimport { forwardRef, useId, type ButtonHTMLAttributes, type ElementType, type ReactNode } from 'react';\nimport { NextArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { IconTile } from '../IconTile';\nimport './RequestTypeOption.css';\n\nexport interface RequestTypeOptionProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'title'> {\n /** Name of the request type (Figma text property \"Title\", e.g. \"Travel Package\"). */\n title: ReactNode;\n /** Line under the title (Figma text property \"Description\"). */\n description?: ReactNode;\n /** One icon from `@travel-match/ui` for the 44px tile (Figma `roadmap`, `plane`). */\n icon?: ReactNode;\n /** Renders the option as a link to this URL instead of a button. */\n href?: string;\n /** Renders the single child element (e.g. an empty router `<Link href=\"…\" />`) as the option; the content is placed inside it. */\n asChild?: boolean;\n}\n\n/**\n * One choice of the New Request Overlay (Figma component set \"Request type option\", State: Default · Hover):\n * icon tile, title and description, and an arrow. The whole row is one button (or link) named by its title and\n * description — \"Travel Package A trip in Armenia or abroad…\" (pass `aria-label` to replace it).\n */\nexport const RequestTypeOption = /* @__PURE__ */ forwardRef<HTMLButtonElement, RequestTypeOptionProps>(function RequestTypeOption(\n { title, description, icon, href, asChild = false, disabled, type, className, children, ...props },\n ref,\n) {\n const Comp: ElementType = asChild ? Slot : href !== undefined ? 'a' : 'button';\n const hasDescription = description != null && description !== false;\n const id = useId();\n const titleId = `${id}-title`;\n const descriptionId = `${id}-description`;\n\n return (\n <Comp\n ref={ref}\n className={cn('tm-request-type-option', className)}\n // A link cannot be `disabled`: without `href` it is not focusable or clickable, and says so to assistive technology.\n href={Comp === 'a' && !disabled ? href : undefined}\n type={Comp === 'button' ? (type ?? 'button') : undefined}\n disabled={Comp === 'button' ? disabled : undefined}\n aria-disabled={Comp !== 'button' && disabled ? true : undefined}\n aria-labelledby={props['aria-label'] ? undefined : hasDescription ? `${titleId} ${descriptionId}` : titleId}\n {...props}\n >\n {icon ? <IconTile className=\"tm-request-type-option__icon\" size=\"md\" icon={icon} aria-hidden=\"true\" /> : null}\n <span className=\"tm-request-type-option__text\">\n <span id={titleId} className=\"tm-request-type-option__title\">\n {title}\n </span>\n {hasDescription ? (\n <span id={descriptionId} className=\"tm-request-type-option__description\">\n {description}\n </span>\n ) : null}\n </span>\n {/* With asChild this is where the child's own children go */}\n <Slottable>{children}</Slottable>\n <span className=\"tm-request-type-option__arrow\" data-tm-icon-size=\"md\" aria-hidden=\"true\">\n <NextArrowIcon />\n </span>\n </Comp>\n );\n});\n"],"mappings":"A,6QAyBA,IAAaY,GAAoC,EAAAH,EAAA,WAAA,CAAsD,SACrG,CAAE,QAAO,cAAa,OAAM,OAAM,UAAU,GAAO,WAAU,OAAM,YAAW,WAAU,GAAGI,GAC3F,EACA,CACA,IAAMC,EAAoBC,EAAUf,EAAAA,KAAOgB,IAAS,IAAA,GAAkB,SAAN,IAC1DC,EAAiBC,GAAe,MAAQA,IAAgB,GACxDC,GAAA,EAAKlB,EAAAA,MAAAA,CAAM,EACXmB,EAAU,GAAGD,EAAG,QAChBE,EAAgB,GAAGF,EAAG,cAE5B,OACE,EAAAT,EAAA,KAAA,CAACI,EAAD,CACO,MACL,UAAWZ,EAAAA,GAAG,yBAA0BoB,CAAS,EAEjD,KAAMR,IAAS,KAAO,CAACS,EAAWP,EAAO,IAAA,GACzC,KAAMF,IAAS,SAAYU,GAAQ,SAAY,IAAA,GAC/C,SAAUV,IAAS,SAAWS,EAAW,IAAA,GACzC,gBAAeT,IAAS,UAAYS,EAAW,GAAO,IAAA,GACtD,kBAAiBV,EAAM,cAAgB,IAAA,GAAYI,EAAiB,GAAGG,EAAQ,GAAGC,IAAkBD,EACpG,GAAIP,EATN,SAAA,CAWGY,GAAO,EAAAf,EAAA,IAAA,CAACP,EAAAA,SAAD,CAAU,UAAU,+BAA+B,KAAK,KAAW,OAAM,cAAY,MAAQ,CAAA,EAAI,MACzG,EAAAO,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,+BAAhB,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,GAAIU,EAAS,UAAU,gCAC1B,SAAAM,CACG,CAAA,EACLT,GACC,EAAAP,EAAA,IAAA,CAAC,OAAD,CAAM,GAAIW,EAAe,UAAU,sCAChC,SAAAH,CACG,CAAA,EACJ,IACA,C,IAEN,EAAAR,EAAA,IAAA,CAACN,EAAAA,UAAD,CAAY,UAAoB,CAAA,GAChC,EAAAM,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,gCAAgC,oBAAkB,KAAK,cAAY,OACjF,UAAA,EAAAA,EAAA,IAAA,CAACL,EAAAA,cAAD,CAAgB,CAAA,CACZ,CAAA,CACF,C,EAEV,CAAC,E"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { NextArrowIcon as e } from "../../icons/generated/NextArrowIcon.js";
|
|
3
|
+
import { cn as t } from "../../utils/cn.js";
|
|
4
|
+
import { IconTile as n } from "../IconTile/IconTile.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { forwardRef as r, useId as i } from "react";
|
|
7
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
8
|
+
import { Slot as s, Slottable as c } from "@radix-ui/react-slot";
|
|
9
|
+
// src/components/RequestTypeOption/RequestTypeOption.tsx
|
|
10
|
+
var l = /* @__PURE__ */ r(function({ title: r, description: l, icon: u, href: d, asChild: f = !1, disabled: p, type: m, className: h, children: g, ..._ }, v) {
|
|
11
|
+
let y = f ? s : d === void 0 ? "button" : "a", b = l != null && l !== !1, x = i(), S = `${x}-title`, C = `${x}-description`;
|
|
12
|
+
return /* @__PURE__ */ o(y, {
|
|
13
|
+
ref: v,
|
|
14
|
+
className: t("tm-request-type-option", h),
|
|
15
|
+
href: y === "a" && !p ? d : void 0,
|
|
16
|
+
type: y === "button" ? m ?? "button" : void 0,
|
|
17
|
+
disabled: y === "button" ? p : void 0,
|
|
18
|
+
"aria-disabled": y !== "button" && p ? !0 : void 0,
|
|
19
|
+
"aria-labelledby": _["aria-label"] ? void 0 : b ? `${S} ${C}` : S,
|
|
20
|
+
..._,
|
|
21
|
+
children: [
|
|
22
|
+
u ? /* @__PURE__ */ a(n, {
|
|
23
|
+
className: "tm-request-type-option__icon",
|
|
24
|
+
size: "md",
|
|
25
|
+
icon: u,
|
|
26
|
+
"aria-hidden": "true"
|
|
27
|
+
}) : null,
|
|
28
|
+
/* @__PURE__ */ o("span", {
|
|
29
|
+
className: "tm-request-type-option__text",
|
|
30
|
+
children: [/* @__PURE__ */ a("span", {
|
|
31
|
+
id: S,
|
|
32
|
+
className: "tm-request-type-option__title",
|
|
33
|
+
children: r
|
|
34
|
+
}), b ? /* @__PURE__ */ a("span", {
|
|
35
|
+
id: C,
|
|
36
|
+
className: "tm-request-type-option__description",
|
|
37
|
+
children: l
|
|
38
|
+
}) : null]
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ a(c, { children: g }),
|
|
41
|
+
/* @__PURE__ */ a("span", {
|
|
42
|
+
className: "tm-request-type-option__arrow",
|
|
43
|
+
"data-tm-icon-size": "md",
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
children: /* @__PURE__ */ a(e, {})
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
export { l as RequestTypeOption };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=RequestTypeOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestTypeOption.js","names":["RequestTypeOption","props","Comp","asChild","Slot","href","hasDescription","description","id","useId","titleId","descriptionId","cn","className","disabled","type","icon","IconTile","title","Slottable","NextArrowIcon"],"sources":["../../../src/components/RequestTypeOption/RequestTypeOption.tsx"],"sourcesContent":["import { Slot, Slottable } from '@radix-ui/react-slot';\nimport { forwardRef, useId, type ButtonHTMLAttributes, type ElementType, type ReactNode } from 'react';\nimport { NextArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { IconTile } from '../IconTile';\nimport './RequestTypeOption.css';\n\nexport interface RequestTypeOptionProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'title'> {\n /** Name of the request type (Figma text property \"Title\", e.g. \"Travel Package\"). */\n title: ReactNode;\n /** Line under the title (Figma text property \"Description\"). */\n description?: ReactNode;\n /** One icon from `@travel-match/ui` for the 44px tile (Figma `roadmap`, `plane`). */\n icon?: ReactNode;\n /** Renders the option as a link to this URL instead of a button. */\n href?: string;\n /** Renders the single child element (e.g. an empty router `<Link href=\"…\" />`) as the option; the content is placed inside it. */\n asChild?: boolean;\n}\n\n/**\n * One choice of the New Request Overlay (Figma component set \"Request type option\", State: Default · Hover):\n * icon tile, title and description, and an arrow. The whole row is one button (or link) named by its title and\n * description — \"Travel Package A trip in Armenia or abroad…\" (pass `aria-label` to replace it).\n */\nexport const RequestTypeOption = /* @__PURE__ */ forwardRef<HTMLButtonElement, RequestTypeOptionProps>(function RequestTypeOption(\n { title, description, icon, href, asChild = false, disabled, type, className, children, ...props },\n ref,\n) {\n const Comp: ElementType = asChild ? Slot : href !== undefined ? 'a' : 'button';\n const hasDescription = description != null && description !== false;\n const id = useId();\n const titleId = `${id}-title`;\n const descriptionId = `${id}-description`;\n\n return (\n <Comp\n ref={ref}\n className={cn('tm-request-type-option', className)}\n // A link cannot be `disabled`: without `href` it is not focusable or clickable, and says so to assistive technology.\n href={Comp === 'a' && !disabled ? href : undefined}\n type={Comp === 'button' ? (type ?? 'button') : undefined}\n disabled={Comp === 'button' ? disabled : undefined}\n aria-disabled={Comp !== 'button' && disabled ? true : undefined}\n aria-labelledby={props['aria-label'] ? undefined : hasDescription ? `${titleId} ${descriptionId}` : titleId}\n {...props}\n >\n {icon ? <IconTile className=\"tm-request-type-option__icon\" size=\"md\" icon={icon} aria-hidden=\"true\" /> : null}\n <span className=\"tm-request-type-option__text\">\n <span id={titleId} className=\"tm-request-type-option__title\">\n {title}\n </span>\n {hasDescription ? (\n <span id={descriptionId} className=\"tm-request-type-option__description\">\n {description}\n </span>\n ) : null}\n </span>\n {/* With asChild this is where the child's own children go */}\n <Slottable>{children}</Slottable>\n <span className=\"tm-request-type-option__arrow\" data-tm-icon-size=\"md\" aria-hidden=\"true\">\n <NextArrowIcon />\n </span>\n </Comp>\n );\n});\n"],"mappings":";;;;;;;;;AAyBA,IAAaA,IAAoC,kBAAsD,SACrG,EAAE,UAAO,gBAAa,SAAM,SAAM,aAAU,IAAO,aAAU,SAAM,cAAW,aAAU,GAAGC,KAC3F,GACA;CACA,IAAMC,IAAoBC,IAAUC,IAAOC,MAAS,KAAA,IAAkB,WAAN,KAC1DC,IAAiBC,KAAe,QAAQA,MAAgB,IACxDC,IAAKC,EAAM,GACXC,IAAU,GAAGF,EAAG,SAChBG,IAAgB,GAAGH,EAAG;CAE5B,OACE,kBAACN,GAAD;EACO;EACL,WAAWU,EAAG,0BAA0BC,CAAS;EAEjD,MAAMX,MAAS,OAAO,CAACY,IAAWT,IAAO,KAAA;EACzC,MAAMH,MAAS,WAAYa,KAAQ,WAAY,KAAA;EAC/C,UAAUb,MAAS,WAAWY,IAAW,KAAA;EACzC,iBAAeZ,MAAS,YAAYY,IAAW,KAAO,KAAA;EACtD,mBAAiBb,EAAM,gBAAgB,KAAA,IAAYK,IAAiB,GAAGI,EAAQ,GAAGC,MAAkBD;EACpG,GAAIT;EATN,UAAA;GAWGe,IAAO,kBAACC,GAAD;IAAU,WAAU;IAA+B,MAAK;IAAW;IAAM,eAAY;GAAQ,CAAA,IAAI;GACzG,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,kBAAC,QAAD;KAAM,IAAIP;KAAS,WAAU;KAC1B,UAAAQ;IACG,CAAA,GACLZ,IACC,kBAAC,QAAD;KAAM,IAAIK;KAAe,WAAU;KAChC,UAAAJ;IACG,CAAA,IACJ,IACA;;GAEN,kBAACY,GAAD,EAAY,YAAoB,CAAA;GAChC,kBAAC,QAAD;IAAM,WAAU;IAAgC,qBAAkB;IAAK,eAAY;IACjF,UAAA,kBAACC,GAAD,CAAgB,CAAA;GACZ,CAAA;EACF;;AAEV,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../icons/generated/DownArrowIcon.cjs"),n=require("../../icons/generated/SearchIcon.cjs"),r=require("../../icons/generated/UpArrowIcon.cjs"),i=require("../../utils/cn.cjs"),a=require("../Field/Field.cjs"),o=require("../OptionList/OptionList.cjs"),s=require("./SelectedItem.cjs");;/* empty css */let c=require("react"),l=require("react/jsx-runtime"),u=require("@radix-ui/react-popover");u=e.__toESM(u,1);var d=e=>Array.isArray(e)?e:e==null||e===``?[]:[e],f=e=>typeof e==`string`||typeof e==`number`?String(e):``,p=e=>e.textValue??(f(e.label)||e.value),m=(e,t)=>[p(e),f(e.detail),f(e.description)].some(e=>e.toLowerCase().includes(t)),
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../icons/generated/DownArrowIcon.cjs"),n=require("../../icons/generated/SearchIcon.cjs"),r=require("../../icons/generated/UpArrowIcon.cjs"),i=require("../../utils/cn.cjs"),a=require("../Field/Field.cjs"),o=require("../OptionList/OptionList.cjs"),s=require("./SelectedItem.cjs");;/* empty css */let c=require("react"),l=require("react/jsx-runtime"),u=require("@radix-ui/react-popover");u=e.__toESM(u,1);var d=e=>Array.isArray(e)?e:e==null||e===``?[]:[e],f=e=>typeof e==`string`||typeof e==`number`?String(e):``,p=e=>e.textValue??(f(e.label)||e.value),m=(e,t)=>[p(e),f(e.detail),f(e.description)].some(e=>e.toLowerCase().includes(t)),ee=e=>e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey,te=e=>`Remove ${e}`,h=(0,c.forwardRef)(function({label:e,helperText:f,error:h,required:g,optional:ne,errorColor:re,errorBox:ie,size:_=`md`,options:v,placeholder:ae=`Select option`,name:y,invalid:oe,searchable:b=!1,searchPlaceholder:x=`Search`,emptyText:se=`No results`,startIcon:ce,renderValue:S,checkmark:le=!0,fullWidth:C=!0,align:ue=`start`,open:w,defaultOpen:de=!1,onOpenChange:fe,portalContainer:pe,panelAnchor:T,panelClassName:me,listSize:he,removeLabel:ge=te,multiple:E=!1,value:D,defaultValue:_e,onValueChange:ve,disabled:O=!1,readOnly:k=!1,id:ye,className:be,style:xe,onKeyDown:Se,onKeyUp:Ce,"aria-describedby":we,"aria-labelledby":A,...j},Te){let M=a.useFieldIds(ye,!!(h||f)),N=`${M.controlId}-list`,Ee=e=>`${M.controlId}-option-${e}`,[De,Oe]=(0,c.useState)(de),[ke,Ae]=(0,c.useState)(()=>d(_e)),[je,Me]=(0,c.useState)(``),[P,F]=(0,c.useState)(null),I=(0,c.useRef)(null),L=(0,c.useRef)(!1),R=(0,c.useRef)({text:``,timer:0}),z=(w??De)&&!O&&!k,[Ne,Pe]=(0,c.useState)(0);(0,c.useEffect)(()=>{T&&Pe(e=>e+1)},[T,z]);let Fe=(0,c.useMemo)(()=>({current:{getBoundingClientRect:()=>T?.current?.getBoundingClientRect()??new DOMRect,contextElement:T?.current??void 0}}),[T,Ne]),B=D===void 0?ke:d(D),V=B.map(e=>v.find(t=>t.value===e)).filter(e=>e!==void 0),H=!!h||!!oe,U=b?je.trim().toLowerCase():``,W=U?v.filter(e=>m(e,U)):v,G=W.filter(e=>!e.disabled),K=G.find(e=>e.value===P),q=K?Ee(v.indexOf(K)):void 0;(0,c.useEffect)(()=>{z&&q&&document.getElementById(q)?.scrollIntoView?.({block:`nearest`})},[z,q]),(0,c.useEffect)(()=>()=>window.clearTimeout(R.current.timer),[]);let J=(e,t=`none`)=>{if(!(e&&k)){if(e){let e=v.filter(e=>!e.disabled),n=e.find(e=>B.includes(e.value)),r=t===`none`?void 0:t===`last`?e[e.length-1]:t===`first`?e[0]:n??e[0];Me(``),F(r?.value??null)}w===void 0&&Oe(e),fe?.(e)}},Ie=e=>{D===void 0&&Ae(e);let t=ve;E?t?.(e):e[0]!==void 0&&t?.(e[0])},Le=e=>Ie(B.includes(e)?B.filter(t=>t!==e):[...B,e]),Y=e=>{e.disabled||(E?(Le(e.value),F(e.value)):(B[0]!==e.value&&Ie([e.value]),J(!1)))},X=e=>{if(G.length===0)return;let t=K?G.indexOf(K):-1,n;if(e===`first`)n=0;else if(e===`last`)n=G.length-1;else if(t===-1){let t=G.findIndex(e=>B.includes(e.value));n=t===-1?e===1?0:G.length-1:t}else n=Math.min(G.length-1,Math.max(0,t+e));F(G[n].value)},Z=e=>{let t=R.current;window.clearTimeout(t.timer),t.text+=e.toLowerCase(),t.timer=window.setTimeout(()=>t.text=``,500);let n=v.filter(e=>!e.disabled),r=n.findIndex(e=>e.value===P),i=t.text.split(``).every(e=>e===t.text[0]),a=i?t.text[0]:t.text,o=i||t.text.length===1?r+1:Math.max(r,0),s=[...n.slice(o),...n.slice(0,o)].find(e=>p(e).toLowerCase().startsWith(a));s&&F(s.value)},Re=(e,t)=>{switch(e.key){case`ArrowDown`:e.preventDefault(),X(1);break;case`ArrowUp`:e.preventDefault(),e.altKey?J(!1):X(-1);break;case`Home`:case`End`:t===`trigger`&&(e.preventDefault(),X(e.key===`Home`?`first`:`last`));break;case`Enter`:e.preventDefault(),K&&Y(K);break;case`Tab`:t===`search`?e.preventDefault():L.current=!0,J(!1)}},ze=e=>{Se?.(e),e.defaultPrevented||k||(z?e.key===` `?(e.preventDefault(),R.current.text?Z(` `):K&&Y(K)):ee(e)&&!b?(e.preventDefault(),Z(e.key)):Re(e,`trigger`):[`ArrowDown`,`ArrowUp`,`Enter`,` `,`Home`,`End`].includes(e.key)?(e.preventDefault(),J(!0,e.key===`Home`?`first`:e.key===`End`?`last`:`selected`)):ee(e)&&(e.preventDefault(),J(!0),b?Be(e.key):Z(e.key)))},Be=e=>{let t=e.trim().toLowerCase();Me(e),F(v.find(e=>!e.disabled&&(!t||m(e,t)))?.value??null)},Q=E?void 0:V[0],$=E&&V.length>0,Ve=z?r.UpArrowIcon:t.DownArrowIcon,He=(0,l.jsxs)(`div`,{className:`tm-field tm-select__control`,"data-size":_,"data-tm-icon-size":_,"data-invalid":H?``:void 0,"data-disabled":O?``:void 0,"data-readonly":k&&!O?``:void 0,"data-focus":z?``:void 0,"data-has-chips":$?``:void 0,children:[$?(0,l.jsx)(`span`,{className:`tm-select__chips`,children:V.map(e=>(0,l.jsx)(s.SelectedItem,{size:_,disabled:O,removeLabel:ge(p(e)),onRemove:k?void 0:()=>Le(e.value),children:e.label},e.value))}):null,(0,l.jsx)(u.Trigger,{asChild:!0,children:(0,l.jsxs)(`button`,{ref:Te,type:`button`,id:M.controlId,className:`tm-select__trigger`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":z,"aria-controls":z?N:void 0,"aria-activedescendant":z&&!b?q:void 0,"aria-labelledby":A??(e?M.labelId:void 0),"aria-describedby":i.cn(we,M.messageId)||void 0,"aria-invalid":H||void 0,"aria-required":g||void 0,"aria-readonly":k||void 0,disabled:O,onKeyDown:ze,onKeyUp:e=>{Ce?.(e),e.key===` `&&e.preventDefault()},...j,children:[ce,Q?(0,l.jsx)(`span`,{className:`tm-select__value`,children:S?S(Q):Q.label}):$?(0,l.jsx)(`span`,{className:`tm-select__value tm-select__value--hidden`,children:V.map(p).join(`, `)}):(0,l.jsx)(`span`,{className:`tm-select__value`,"data-placeholder":``,children:ae}),(0,l.jsx)(Ve,{className:`tm-select__chevron`})]})})]});return(0,l.jsxs)(u.Root,{open:z,onOpenChange:e=>J(e),children:[(0,l.jsxs)(a.FormField,{ids:M,label:e,helperText:f,error:h,required:g,optional:ne,size:_,errorColor:re,errorBox:ie,className:i.cn(`tm-select`,be),style:xe,"data-full-width":C?``:void 0,children:[T?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(u.Anchor,{virtualRef:Fe}),He]}):(0,l.jsx)(u.Anchor,{asChild:!0,children:He}),y?(E?B:[B[0]??``]).map(e=>(0,l.jsx)(`input`,{type:`hidden`,name:y,value:e,disabled:O},e)):null]}),(0,l.jsx)(u.Portal,{container:pe,children:(0,l.jsxs)(u.Content,{role:`presentation`,className:i.cn(`tm-option-panel tm-select__panel`,me),"data-size":_,"data-fit":C?`field`:`content`,align:ue,sideOffset:8,collisionPadding:8,onOpenAutoFocus:e=>{e.preventDefault(),I.current?.focus()},onCloseAutoFocus:e=>{L.current&&e.preventDefault(),L.current=!1},children:[b?(0,l.jsxs)(`div`,{className:`tm-select__search`,children:[(0,l.jsx)(n.SearchIcon,{size:`sm`}),(0,l.jsx)(`input`,{ref:I,className:`tm-select__search-input`,type:`text`,role:`combobox`,"aria-label":x,"aria-expanded":`true`,"aria-controls":N,"aria-autocomplete":`list`,"aria-activedescendant":q,autoComplete:`off`,spellCheck:!1,placeholder:x,value:je,onChange:e=>Be(e.target.value),onKeyDown:e=>Re(e,`search`)})]}):null,(0,l.jsx)(o.OptionList,{id:N,size:he??_,multiple:E,surface:!1,"aria-labelledby":A??(e?M.labelId:void 0),"aria-label":A||e?void 0:j[`aria-label`],onMouseDown:e=>e.preventDefault(),children:W.map(e=>(0,l.jsx)(o.Option,{id:Ee(v.indexOf(e)),selected:B.includes(e.value),active:e===K,disabled:e.disabled,icon:e.icon,detail:e.detail,description:e.description,indicator:E?`checkbox`:le?`check`:`none`,onClick:()=>Y(e),children:e.label},e.value))}),W.length===0?(0,l.jsx)(`p`,{className:`tm-select__empty`,role:`status`,children:se}):null]})})]})});exports.Select=h;
|
|
2
2
|
//# sourceMappingURL=Select.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.cjs","names":["useFieldIds","useState","useRef","useMemo","UpArrowIcon","DownArrowIcon","SelectedItem","Popover","cn","FormField","_Fragment","SearchIcon","OptionList","Option","require_runtime","require_DownArrowIcon","require_SearchIcon","require_UpArrowIcon","require_cn","require_Field","require_OptionList","require_SelectedItem","react","react_jsx_runtime","_radix_ui_react_popover","toArray","value","asText","node","optionText","option","matches","text","query","isPrintable","event","defaultRemoveLabel","Select","invalidProp","openProp","ariaDescribedBy","ariaLabelledBy","props","ids","id","error","helperText","listId","optionId","index","internalOpen","setInternalOpen","defaultOpen","internalValue","setInternalValue","defaultValue","setQuery","activeValue","setActiveValue","searchRef","keepFocusOnClose","typed","isOpen","disabled","anchorVersion","setAnchorVersion","panelAnchor","version","virtualAnchor","selectedValues","selectedOptions","options","selected","invalid","needle","searchable","visible","enabled","activeOption","activeId","setOpen","next","candidates","initial","focus","onOpenChange","emit","notify","onValueChange","multiple","toggle","optionValue","commit","move","current","to","typeAhead","state","char","repeated","letter","term","from","match","handleListKeys","source","handleTriggerKeyDown","onKeyDown","search","single","hasChips","Chevron","control","size","removeLabel","label","required","onKeyUp","startIcon","renderValue","placeholder","className","fullWidth","name","portalContainer","panelClassName","searchPlaceholder","checkmark","emptyText"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { DownArrowIcon, SearchIcon, UpArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { FormField, useFieldIds, type FieldSize, type FormFieldProps } from '../Field';\nimport { Option, OptionList } from '../OptionList';\nimport { SelectedItem } from './SelectedItem';\nimport './Select.css';\n\nexport interface SelectOption {\n /** What `value` / `onValueChange` carry and what a form submits. */\n value: string;\n /** Text in the list and in the field, e.g. \"Armenia\", \"EN\", \"AMD\". */\n label: ReactNode;\n /** Regular-weight text after the label in the list only, e.g. \"English\" after \"EN\". */\n detail?: ReactNode;\n /** Small second line in the list (Figma \"Caption\"). */\n description?: ReactNode;\n /** Icon or flag before the label in the list (Figma \"Icon\"). */\n icon?: ReactNode;\n /** The option is shown but cannot be chosen. */\n disabled?: boolean;\n /** Plain text for type-ahead, search and the remove button when `label` is not a string. */\n textValue?: string;\n}\n\ntype TriggerProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'defaultValue' | 'onChange' | 'children' | 'type' | 'name' | 'role'>;\n\ninterface SelectBaseProps extends FormFieldProps, TriggerProps {\n /** The options, in display order. */\n options: SelectOption[];\n /** Shown in the field while nothing is selected. */\n placeholder?: ReactNode;\n /** Figma \"Size\": `lg` 52px · `md` 46px (default) · `sm` 42px. */\n size?: FieldSize;\n /** Adds hidden inputs so the value is submitted with a native form (one per value when `multiple`). */\n name?: string;\n /** Invalid look without a message of its own — for composite fields that show one message for several controls. */\n invalid?: boolean;\n /** Adds a search box above the list (Figma \"Type=Currency, State=Open\"); typing filters by label, detail and description. */\n searchable?: boolean;\n /** Placeholder and accessible name of the search box. */\n searchPlaceholder?: string;\n /** Shown instead of the list when the search matches nothing. */\n emptyText?: ReactNode;\n /** Icon in front of the value, e.g. `<LanguageIcon />`. */\n startIcon?: ReactNode;\n /** Custom content for the selected option in the field (single select), e.g. flag + dial code. Defaults to its `label`. */\n renderValue?: (option: SelectOption) => ReactNode;\n /** Shows the check mark on the selected option (Figma \"Done\"). Ignored when `multiple`, which uses checkboxes. */\n checkmark?: boolean;\n /** `false` makes the field hug its content (Figma \"Both-icon-drop-down\", \"Language\", \"Type=Currency\"); the list is then as wide as its options. */\n fullWidth?: boolean;\n /** How the list lines up with the field. */\n align?: 'start' | 'center' | 'end';\n /** Whether the list is open (controlled; Figma \"State=Clicked\" / \"Open\"). */\n open?: boolean;\n /** Opens the list initially (uncontrolled). */\n defaultOpen?: boolean;\n /** Called when the list opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Element the list is rendered into (default `document.body`). Set it when the theme is scoped to a container. */\n portalContainer?: HTMLElement | null;\n /** Element the list aligns to and takes its width from, when that is not the field itself (e.g. a whole phone-number row). */\n panelAnchor?: RefObject<HTMLElement | null>;\n /** Class for the list panel, which is rendered in a portal outside the root. */\n panelClassName?: string;\n /** Accessible name of a chip's × button (`multiple`), given the option's text. */\n removeLabel?: (optionText: string) => string;\n}\n\nexport interface SelectSingleProps extends SelectBaseProps {\n /** `true` turns the field into a multi-select (Figma \"Type=Checkbox\"): checkboxes in the list, removable chips in the field. */\n multiple?: false;\n /** Selected option value (controlled); `null` or `''` for none. */\n value?: string | null;\n /** Initially selected value (uncontrolled). */\n defaultValue?: string | null;\n /** Called with the chosen option's value. */\n onValueChange?: (value: string) => void;\n}\n\nexport interface SelectMultipleProps extends SelectBaseProps {\n multiple: true;\n /** Selected option values (controlled). */\n value?: string[];\n /** Initially selected values (uncontrolled). */\n defaultValue?: string[];\n /** Called with all selected values after one is added or removed. */\n onValueChange?: (value: string[]) => void;\n}\n\nexport type SelectProps = SelectSingleProps | SelectMultipleProps;\n\nconst toArray = (value: string | string[] | null | undefined): string[] => (Array.isArray(value) ? value : value == null || value === '' ? [] : [value]);\nconst asText = (node: ReactNode): string => (typeof node === 'string' || typeof node === 'number' ? String(node) : '');\nconst optionText = (option: SelectOption): string => option.textValue ?? (asText(option.label) || option.value);\nconst matches = (option: SelectOption, query: string): boolean =>\n [optionText(option), asText(option.detail), asText(option.description)].some((text) => text.toLowerCase().includes(query));\nconst isPrintable = (event: KeyboardEvent): boolean => event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;\nconst defaultRemoveLabel = (optionText: string) => `Remove ${optionText}`;\n\ntype InitialFocus = 'selected' | 'first' | 'last' | 'none';\n\n/**\n * Figma component set \"Drop down inputs\" (Type=Select · Checkbox, and the base of Language · Phone · Currency):\n * a field that opens a list of options. Keyboard support follows the WAI-ARIA select-only combobox pattern.\n * The ref and any extra props go to the trigger `<button role=\"combobox\">`; `className` goes to the root.\n */\nexport const Select = /* @__PURE__ */ forwardRef<HTMLButtonElement, SelectProps>(function Select(\n {\n label,\n helperText,\n error,\n required,\n optional,\n size = 'md',\n options,\n placeholder = 'Select option',\n name,\n invalid: invalidProp,\n searchable = false,\n searchPlaceholder = 'Search',\n emptyText = 'No results',\n startIcon,\n renderValue,\n checkmark = true,\n fullWidth = true,\n align = 'start',\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n portalContainer,\n panelAnchor,\n panelClassName,\n removeLabel = defaultRemoveLabel,\n multiple = false,\n value,\n defaultValue,\n onValueChange,\n disabled = false,\n id,\n className,\n style,\n onKeyDown,\n onKeyUp,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref,\n) {\n const ids = useFieldIds(id, Boolean(error || helperText));\n const listId = `${ids.controlId}-list`;\n const optionId = (index: number) => `${ids.controlId}-option-${index}`;\n\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalValue, setInternalValue] = useState<string[]>(() => toArray(defaultValue));\n const [query, setQuery] = useState('');\n const [activeValue, setActiveValue] = useState<string | null>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const keepFocusOnClose = useRef(false);\n const typed = useRef({ text: '', timer: 0 });\n\n const isOpen = (openProp ?? internalOpen) && !disabled;\n\n // `panelAnchor`: the list is positioned against a \"virtual\" element that measures the anchor each time it is asked.\n // Radix registers a virtual anchor only when its object changes, and it can end up holding the trigger instead:\n // on mount the trigger briefly registers itself as the anchor and is then replaced by a new button, which leaves\n // a removed element (measured as 0 × 0 at the top left of the page, so the list opened there; seen with React\n // Strict Mode and server rendering). A fresh object after mount and whenever the list opens or closes makes Radix\n // take the right anchor again.\n const [anchorVersion, setAnchorVersion] = useState(0);\n useEffect(() => {\n if (panelAnchor) setAnchorVersion((version) => version + 1);\n }, [panelAnchor, isOpen]);\n const virtualAnchor = useMemo(\n () => ({\n current: {\n getBoundingClientRect: () => panelAnchor?.current?.getBoundingClientRect() ?? new DOMRect(),\n // lets the positioning follow the anchor's scrolling ancestors\n contextElement: panelAnchor?.current ?? undefined,\n },\n }),\n // anchorVersion is listed on purpose: a new object per version\n [panelAnchor, anchorVersion],\n );\n const selectedValues = value !== undefined ? toArray(value) : internalValue;\n const selectedOptions = selectedValues.map((selected) => options.find((option) => option.value === selected)).filter((option) => option !== undefined);\n const invalid = Boolean(error) || Boolean(invalidProp);\n\n const needle = searchable ? query.trim().toLowerCase() : '';\n const visible = needle ? options.filter((option) => matches(option, needle)) : options;\n const enabled = visible.filter((option) => !option.disabled);\n const activeOption = enabled.find((option) => option.value === activeValue);\n const activeId = activeOption ? optionId(options.indexOf(activeOption)) : undefined;\n\n useEffect(() => {\n if (isOpen && activeId) document.getElementById(activeId)?.scrollIntoView?.({ block: 'nearest' });\n }, [isOpen, activeId]);\n\n useEffect(() => () => window.clearTimeout(typed.current.timer), []);\n\n const setOpen = (next: boolean, focus: InitialFocus = 'none') => {\n if (next) {\n const candidates = options.filter((option) => !option.disabled);\n const selected = candidates.find((option) => selectedValues.includes(option.value));\n const initial = focus === 'none' ? undefined : focus === 'last' ? candidates[candidates.length - 1] : focus === 'first' ? candidates[0] : (selected ?? candidates[0]);\n setQuery('');\n setActiveValue(initial?.value ?? null);\n }\n if (openProp === undefined) setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n const emit = (next: string[]) => {\n if (value === undefined) setInternalValue(next);\n const notify = onValueChange as ((next: string | string[]) => void) | undefined;\n if (multiple) notify?.(next);\n else if (next[0] !== undefined) notify?.(next[0]);\n };\n\n const toggle = (optionValue: string) =>\n emit(selectedValues.includes(optionValue) ? selectedValues.filter((selected) => selected !== optionValue) : [...selectedValues, optionValue]);\n\n const commit = (option: SelectOption) => {\n if (option.disabled) return;\n if (multiple) {\n toggle(option.value);\n setActiveValue(option.value);\n return;\n }\n if (selectedValues[0] !== option.value) emit([option.value]);\n setOpen(false);\n };\n\n const move = (to: 1 | -1 | 'first' | 'last') => {\n if (enabled.length === 0) return;\n const current = activeOption ? enabled.indexOf(activeOption) : -1;\n let next: number;\n if (to === 'first') next = 0;\n else if (to === 'last') next = enabled.length - 1;\n else if (current === -1) {\n // Opened with the pointer: start from the selected option, like a native select.\n const selected = enabled.findIndex((option) => selectedValues.includes(option.value));\n next = selected !== -1 ? selected : to === 1 ? 0 : enabled.length - 1;\n } else next = Math.min(enabled.length - 1, Math.max(0, current + to));\n setActiveValue(enabled[next].value);\n };\n\n /** Type-ahead: the typed characters jump to the next option starting with them; repeating one letter cycles. */\n const typeAhead = (char: string) => {\n const state = typed.current;\n window.clearTimeout(state.timer);\n state.text += char.toLowerCase();\n state.timer = window.setTimeout(() => (state.text = ''), 500);\n const candidates = options.filter((option) => !option.disabled);\n const current = candidates.findIndex((option) => option.value === activeValue);\n const repeated = state.text.split('').every((letter) => letter === state.text[0]);\n const term = repeated ? state.text[0] : state.text;\n const from = repeated || state.text.length === 1 ? current + 1 : Math.max(current, 0);\n const ordered = [...candidates.slice(from), ...candidates.slice(0, from)];\n const match = ordered.find((option) => optionText(option).toLowerCase().startsWith(term));\n if (match) setActiveValue(match.value);\n };\n\n const handleListKeys = (event: KeyboardEvent<HTMLElement>, source: 'trigger' | 'search') => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (event.altKey) setOpen(false);\n else move(-1);\n break;\n case 'Home':\n case 'End':\n // In the search box these keys move the caret.\n if (source === 'trigger') {\n event.preventDefault();\n move(event.key === 'Home' ? 'first' : 'last');\n }\n break;\n case 'Enter':\n event.preventDefault();\n if (activeOption) commit(activeOption);\n break;\n case 'Tab':\n if (source === 'search') {\n // The panel lives in a portal at the end of the document: go back to the field instead of tabbing out of the page.\n event.preventDefault();\n } else keepFocusOnClose.current = true;\n setOpen(false);\n break;\n default:\n }\n };\n\n const handleTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (!isOpen) {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' ', 'Home', 'End'].includes(event.key)) {\n event.preventDefault();\n setOpen(true, event.key === 'Home' ? 'first' : event.key === 'End' ? 'last' : 'selected');\n } else if (isPrintable(event)) {\n event.preventDefault();\n setOpen(true);\n if (searchable) search(event.key);\n else typeAhead(event.key);\n }\n return;\n }\n if (event.key === ' ') {\n event.preventDefault();\n // A space while typing ahead belongs to the search text (\"New York\").\n if (typed.current.text) typeAhead(' ');\n else if (activeOption) commit(activeOption);\n } else if (isPrintable(event) && !searchable) {\n event.preventDefault();\n typeAhead(event.key);\n } else handleListKeys(event, 'trigger');\n };\n\n /** Filters the list and puts the keyboard on the first match. */\n const search = (next: string) => {\n const term = next.trim().toLowerCase();\n setQuery(next);\n setActiveValue(options.find((option) => !option.disabled && (!term || matches(option, term)))?.value ?? null);\n };\n\n const single = !multiple ? selectedOptions[0] : undefined;\n const hasChips = multiple && selectedOptions.length > 0;\n const Chevron = isOpen ? UpArrowIcon : DownArrowIcon;\n\n const control = (\n <div\n className=\"tm-field tm-select__control\"\n data-size={size}\n data-tm-icon-size={size}\n data-invalid={invalid ? '' : undefined}\n data-disabled={disabled ? '' : undefined}\n data-focus={isOpen ? '' : undefined}\n data-has-chips={hasChips ? '' : undefined}\n >\n {hasChips ? (\n <span className=\"tm-select__chips\">\n {selectedOptions.map((option) => (\n <SelectedItem\n key={option.value}\n size={size}\n disabled={disabled}\n removeLabel={removeLabel(optionText(option))}\n onRemove={() => toggle(option.value)}\n >\n {option.label}\n </SelectedItem>\n ))}\n </span>\n ) : null}\n <Popover.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n id={ids.controlId}\n className=\"tm-select__trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listId : undefined}\n aria-activedescendant={isOpen && !searchable ? activeId : undefined}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-describedby={cn(ariaDescribedBy, ids.messageId) || undefined}\n aria-invalid={invalid || undefined}\n aria-required={required || undefined}\n disabled={disabled}\n onKeyDown={handleTriggerKeyDown}\n onKeyUp={(event) => {\n onKeyUp?.(event);\n // Firefox clicks a button on Space keyup; the keydown handler has already acted on it.\n if (event.key === ' ') event.preventDefault();\n }}\n {...props}\n >\n {startIcon}\n {single ? (\n <span className=\"tm-select__value\">{renderValue ? renderValue(single) : single.label}</span>\n ) : hasChips ? (\n // The chips sit outside the button; this keeps the selection in the combobox's own text for assistive technology.\n <span className=\"tm-select__value tm-select__value--hidden\">{selectedOptions.map(optionText).join(', ')}</span>\n ) : (\n <span className=\"tm-select__value\" data-placeholder=\"\">\n {placeholder}\n </span>\n )}\n <Chevron className=\"tm-select__chevron\" />\n </button>\n </Popover.Trigger>\n </div>\n );\n\n return (\n <Popover.Root open={isOpen} onOpenChange={(next) => setOpen(next)}>\n <FormField\n ids={ids}\n label={label}\n helperText={helperText}\n error={error}\n required={required}\n optional={optional}\n size={size}\n className={cn('tm-select', className)}\n style={style}\n data-full-width={fullWidth ? '' : undefined}\n >\n {panelAnchor ? (\n <>\n <Popover.Anchor virtualRef={virtualAnchor} />\n {control}\n </>\n ) : (\n <Popover.Anchor asChild>{control}</Popover.Anchor>\n )}\n {name\n ? (multiple ? selectedValues : [selectedValues[0] ?? '']).map((selected) => (\n <input key={selected} type=\"hidden\" name={name} value={selected} disabled={disabled} />\n ))\n : null}\n </FormField>\n <Popover.Portal container={portalContainer}>\n <Popover.Content\n // The combobox owns the listbox directly; the popover wrapper is only a surface.\n role=\"presentation\"\n className={cn('tm-option-panel tm-select__panel', panelClassName)}\n data-size={size}\n data-fit={fullWidth ? 'field' : 'content'}\n align={align}\n sideOffset={8}\n collisionPadding={8}\n onOpenAutoFocus={(event) => {\n // Select-only combobox: focus stays on the field (or moves to the search box) and the active option is announced through aria-activedescendant.\n event.preventDefault();\n searchRef.current?.focus();\n }}\n onCloseAutoFocus={(event) => {\n if (keepFocusOnClose.current) event.preventDefault();\n keepFocusOnClose.current = false;\n }}\n >\n {searchable ? (\n <div className=\"tm-select__search\">\n <SearchIcon size=\"sm\" />\n <input\n ref={searchRef}\n className=\"tm-select__search-input\"\n type=\"text\"\n role=\"combobox\"\n aria-label={searchPlaceholder}\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={activeId}\n autoComplete=\"off\"\n spellCheck={false}\n placeholder={searchPlaceholder}\n value={query}\n onChange={(event) => search(event.target.value)}\n onKeyDown={(event) => handleListKeys(event, 'search')}\n />\n </div>\n ) : null}\n <OptionList\n id={listId}\n size={size}\n multiple={multiple}\n surface={false}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-label={ariaLabelledBy || label ? undefined : props['aria-label']}\n // Keeps focus on the field (or the search box) while the pointer picks an option.\n onMouseDown={(event) => event.preventDefault()}\n >\n {visible.map((option) => (\n <Option\n key={option.value}\n id={optionId(options.indexOf(option))}\n selected={selectedValues.includes(option.value)}\n active={option === activeOption}\n disabled={option.disabled}\n icon={option.icon}\n detail={option.detail}\n description={option.description}\n indicator={multiple ? 'checkbox' : checkmark ? 'check' : 'none'}\n onClick={() => commit(option)}\n >\n {option.label}\n </Option>\n ))}\n </OptionList>\n {visible.length === 0 ? (\n <p className=\"tm-select__empty\" role=\"status\">\n {emptyText}\n </p>\n ) : null}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n});\n"],"mappings":"A,ifAwGA,IAAMyB,EAAW,GAA2D,MAAM,QAAQC,CAAK,EAAIA,EAAQA,GAAS,MAAQA,IAAU,GAAK,CAA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EAAO,OACf,YAAaA,EAAO,YACpB,UAAW2D,EAAW,WAAasC,GAAY,QAAU,OACzD,YAAenC,EAAO9D,CAAM,EAE3B,SAAAA,EAAO,KACF,EAZDA,EAAO,KAYN,CACT,CACS,CAAA,EACX8C,EAAQ,SAAW,GAClB,EAAArD,EAAA,IAAA,CAAC,IAAD,CAAG,UAAU,mBAAmB,KAAK,SAClC,SAAAyG,EACA,CAAA,EACD,IACW,C,EACH,CAAA,CACJ,C,EAElB,CAAC,E"}
|
|
1
|
+
{"version":3,"file":"Select.cjs","names":["useFieldIds","useState","useRef","useMemo","UpArrowIcon","DownArrowIcon","SelectedItem","Popover","cn","FormField","_Fragment","SearchIcon","OptionList","Option","require_runtime","require_DownArrowIcon","require_SearchIcon","require_UpArrowIcon","require_cn","require_Field","require_OptionList","require_SelectedItem","react","react_jsx_runtime","_radix_ui_react_popover","toArray","value","asText","node","optionText","option","matches","text","query","isPrintable","event","defaultRemoveLabel","Select","invalidProp","openProp","ariaDescribedBy","ariaLabelledBy","props","ids","id","error","helperText","listId","optionId","index","internalOpen","setInternalOpen","defaultOpen","internalValue","setInternalValue","defaultValue","setQuery","activeValue","setActiveValue","searchRef","keepFocusOnClose","typed","isOpen","disabled","readOnly","anchorVersion","setAnchorVersion","panelAnchor","version","virtualAnchor","selectedValues","selectedOptions","options","selected","invalid","needle","searchable","visible","enabled","activeOption","activeId","setOpen","next","candidates","initial","focus","onOpenChange","emit","notify","onValueChange","multiple","toggle","optionValue","commit","move","current","to","typeAhead","state","char","repeated","letter","term","from","match","handleListKeys","source","handleTriggerKeyDown","onKeyDown","search","single","hasChips","Chevron","control","size","removeLabel","label","required","onKeyUp","startIcon","renderValue","placeholder","className","fullWidth","name","portalContainer","panelClassName","searchPlaceholder","listSize","checkmark","emptyText"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { DownArrowIcon, SearchIcon, UpArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { FormField, useFieldIds, type FieldErrorAppearanceProps, type FieldSize, type FormFieldProps } from '../Field';\nimport { Option, OptionList } from '../OptionList';\nimport { SelectedItem } from './SelectedItem';\nimport './Select.css';\n\nexport interface SelectOption {\n /** What `value` / `onValueChange` carry and what a form submits. */\n value: string;\n /** Text in the list and in the field, e.g. \"Armenia\", \"EN\", \"AMD\". */\n label: ReactNode;\n /** Regular-weight text after the label in the list only, e.g. \"English\" after \"EN\". */\n detail?: ReactNode;\n /** Small second line in the list (Figma \"Caption\"). */\n description?: ReactNode;\n /** Icon or flag before the label in the list (Figma \"Icon\"). */\n icon?: ReactNode;\n /** The option is shown but cannot be chosen. */\n disabled?: boolean;\n /** Plain text for type-ahead, search and the remove button when `label` is not a string. */\n textValue?: string;\n}\n\ntype TriggerProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'defaultValue' | 'onChange' | 'children' | 'type' | 'name' | 'role'>;\n\ninterface SelectBaseProps extends FormFieldProps, FieldErrorAppearanceProps, TriggerProps {\n /** The options, in display order. */\n options: SelectOption[];\n /** Shown in the field while nothing is selected. */\n placeholder?: ReactNode;\n /** Figma \"Size\": `lg` 52px · `md` 46px (default) · `sm` 42px. */\n size?: FieldSize;\n /** Adds hidden inputs so the value is submitted with a native form (one per value when `multiple`). */\n name?: string;\n /** Invalid look without a message of its own — for composite fields that show one message for several controls. */\n invalid?: boolean;\n /** Adds a search box above the list (Figma \"Type=Currency, State=Open\"); typing filters by label, detail and description. */\n searchable?: boolean;\n /** Placeholder and accessible name of the search box. */\n searchPlaceholder?: string;\n /** Shown instead of the list when the search matches nothing. */\n emptyText?: ReactNode;\n /** Icon in front of the value, e.g. `<LanguageIcon />`. */\n startIcon?: ReactNode;\n /** Custom content for the selected option in the field (single select), e.g. flag + dial code. Defaults to its `label`. */\n renderValue?: (option: SelectOption) => ReactNode;\n /** Shows the check mark on the selected option (Figma \"Done\"). Ignored when `multiple`, which uses checkboxes. */\n checkmark?: boolean;\n /** `false` makes the field hug its content (Figma \"Both-icon-drop-down\", \"Language\", \"Type=Currency\"); the list is then as wide as its options. */\n fullWidth?: boolean;\n /** How the list lines up with the field. */\n align?: 'start' | 'center' | 'end';\n /** Whether the list is open (controlled; Figma \"State=Clicked\" / \"Open\"). */\n open?: boolean;\n /** Opens the list initially (uncontrolled). */\n defaultOpen?: boolean;\n /** Called when the list opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Element the list is rendered into (default `document.body`). Set it when the theme is scoped to a container. */\n portalContainer?: HTMLElement | null;\n /** Element the list aligns to and takes its width from, when that is not the field itself (e.g. a whole phone-number row). */\n panelAnchor?: RefObject<HTMLElement | null>;\n /** Class for the list panel, which is rendered in a portal outside the root. */\n panelClassName?: string;\n /** Size of the rows in the list when it differs from the field's `size` (e.g. Figma \"Type=Phone, State=Open\" keeps M rows at every size). Defaults to `size`. */\n listSize?: FieldSize;\n /** Accessible name of a chip's × button (`multiple`), given the option's text. */\n removeLabel?: (optionText: string) => string;\n /**\n * Figma \"Read-only\" (the last State column of \"Drop down inputs\"): the value is shown but cannot be changed —\n * the field stays focusable and is announced as read-only, the list does not open and chips have no × button.\n * Unlike `disabled`, the value is still submitted with a form.\n */\n readOnly?: boolean;\n}\n\nexport interface SelectSingleProps extends SelectBaseProps {\n /** `true` turns the field into a multi-select (Figma \"Type=Checkbox\"): checkboxes in the list, removable chips in the field. */\n multiple?: false;\n /** Selected option value (controlled); `null` or `''` for none. */\n value?: string | null;\n /** Initially selected value (uncontrolled). */\n defaultValue?: string | null;\n /** Called with the chosen option's value. */\n onValueChange?: (value: string) => void;\n}\n\nexport interface SelectMultipleProps extends SelectBaseProps {\n multiple: true;\n /** Selected option values (controlled). */\n value?: string[];\n /** Initially selected values (uncontrolled). */\n defaultValue?: string[];\n /** Called with all selected values after one is added or removed. */\n onValueChange?: (value: string[]) => void;\n}\n\nexport type SelectProps = SelectSingleProps | SelectMultipleProps;\n\nconst toArray = (value: string | string[] | null | undefined): string[] => (Array.isArray(value) ? value : value == null || value === '' ? [] : [value]);\nconst asText = (node: ReactNode): string => (typeof node === 'string' || typeof node === 'number' ? String(node) : '');\nconst optionText = (option: SelectOption): string => option.textValue ?? (asText(option.label) || option.value);\nconst matches = (option: SelectOption, query: string): boolean =>\n [optionText(option), asText(option.detail), asText(option.description)].some((text) => text.toLowerCase().includes(query));\nconst isPrintable = (event: KeyboardEvent): boolean => event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;\nconst defaultRemoveLabel = (optionText: string) => `Remove ${optionText}`;\n\ntype InitialFocus = 'selected' | 'first' | 'last' | 'none';\n\n/**\n * Figma component set \"Drop down inputs\" (Type=Select · Checkbox, and the base of Language · Phone · Currency):\n * a field that opens a list of options. Keyboard support follows the WAI-ARIA select-only combobox pattern.\n * The ref and any extra props go to the trigger `<button role=\"combobox\">`; `className` goes to the root.\n */\nexport const Select = /* @__PURE__ */ forwardRef<HTMLButtonElement, SelectProps>(function Select(\n {\n label,\n helperText,\n error,\n required,\n optional,\n errorColor,\n errorBox,\n size = 'md',\n options,\n placeholder = 'Select option',\n name,\n invalid: invalidProp,\n searchable = false,\n searchPlaceholder = 'Search',\n emptyText = 'No results',\n startIcon,\n renderValue,\n checkmark = true,\n fullWidth = true,\n align = 'start',\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n portalContainer,\n panelAnchor,\n panelClassName,\n listSize,\n removeLabel = defaultRemoveLabel,\n multiple = false,\n value,\n defaultValue,\n onValueChange,\n disabled = false,\n readOnly = false,\n id,\n className,\n style,\n onKeyDown,\n onKeyUp,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref,\n) {\n const ids = useFieldIds(id, Boolean(error || helperText));\n const listId = `${ids.controlId}-list`;\n const optionId = (index: number) => `${ids.controlId}-option-${index}`;\n\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalValue, setInternalValue] = useState<string[]>(() => toArray(defaultValue));\n const [query, setQuery] = useState('');\n const [activeValue, setActiveValue] = useState<string | null>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const keepFocusOnClose = useRef(false);\n const typed = useRef({ text: '', timer: 0 });\n\n const isOpen = (openProp ?? internalOpen) && !disabled && !readOnly;\n\n // `panelAnchor`: the list is positioned against a \"virtual\" element that measures the anchor each time it is asked.\n // Radix registers a virtual anchor only when its object changes, and it can end up holding the trigger instead:\n // on mount the trigger briefly registers itself as the anchor and is then replaced by a new button, which leaves\n // a removed element (measured as 0 × 0 at the top left of the page, so the list opened there; seen with React\n // Strict Mode and server rendering). A fresh object after mount and whenever the list opens or closes makes Radix\n // take the right anchor again.\n const [anchorVersion, setAnchorVersion] = useState(0);\n useEffect(() => {\n if (panelAnchor) setAnchorVersion((version) => version + 1);\n }, [panelAnchor, isOpen]);\n const virtualAnchor = useMemo(\n () => ({\n current: {\n getBoundingClientRect: () => panelAnchor?.current?.getBoundingClientRect() ?? new DOMRect(),\n // lets the positioning follow the anchor's scrolling ancestors\n contextElement: panelAnchor?.current ?? undefined,\n },\n }),\n // anchorVersion is listed on purpose: a new object per version\n [panelAnchor, anchorVersion],\n );\n const selectedValues = value !== undefined ? toArray(value) : internalValue;\n const selectedOptions = selectedValues.map((selected) => options.find((option) => option.value === selected)).filter((option) => option !== undefined);\n const invalid = Boolean(error) || Boolean(invalidProp);\n\n const needle = searchable ? query.trim().toLowerCase() : '';\n const visible = needle ? options.filter((option) => matches(option, needle)) : options;\n const enabled = visible.filter((option) => !option.disabled);\n const activeOption = enabled.find((option) => option.value === activeValue);\n const activeId = activeOption ? optionId(options.indexOf(activeOption)) : undefined;\n\n useEffect(() => {\n if (isOpen && activeId) document.getElementById(activeId)?.scrollIntoView?.({ block: 'nearest' });\n }, [isOpen, activeId]);\n\n useEffect(() => () => window.clearTimeout(typed.current.timer), []);\n\n const setOpen = (next: boolean, focus: InitialFocus = 'none') => {\n if (next && readOnly) return;\n if (next) {\n const candidates = options.filter((option) => !option.disabled);\n const selected = candidates.find((option) => selectedValues.includes(option.value));\n const initial = focus === 'none' ? undefined : focus === 'last' ? candidates[candidates.length - 1] : focus === 'first' ? candidates[0] : (selected ?? candidates[0]);\n setQuery('');\n setActiveValue(initial?.value ?? null);\n }\n if (openProp === undefined) setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n const emit = (next: string[]) => {\n if (value === undefined) setInternalValue(next);\n const notify = onValueChange as ((next: string | string[]) => void) | undefined;\n if (multiple) notify?.(next);\n else if (next[0] !== undefined) notify?.(next[0]);\n };\n\n const toggle = (optionValue: string) =>\n emit(selectedValues.includes(optionValue) ? selectedValues.filter((selected) => selected !== optionValue) : [...selectedValues, optionValue]);\n\n const commit = (option: SelectOption) => {\n if (option.disabled) return;\n if (multiple) {\n toggle(option.value);\n setActiveValue(option.value);\n return;\n }\n if (selectedValues[0] !== option.value) emit([option.value]);\n setOpen(false);\n };\n\n const move = (to: 1 | -1 | 'first' | 'last') => {\n if (enabled.length === 0) return;\n const current = activeOption ? enabled.indexOf(activeOption) : -1;\n let next: number;\n if (to === 'first') next = 0;\n else if (to === 'last') next = enabled.length - 1;\n else if (current === -1) {\n // Opened with the pointer: start from the selected option, like a native select.\n const selected = enabled.findIndex((option) => selectedValues.includes(option.value));\n next = selected !== -1 ? selected : to === 1 ? 0 : enabled.length - 1;\n } else next = Math.min(enabled.length - 1, Math.max(0, current + to));\n setActiveValue(enabled[next].value);\n };\n\n /** Type-ahead: the typed characters jump to the next option starting with them; repeating one letter cycles. */\n const typeAhead = (char: string) => {\n const state = typed.current;\n window.clearTimeout(state.timer);\n state.text += char.toLowerCase();\n state.timer = window.setTimeout(() => (state.text = ''), 500);\n const candidates = options.filter((option) => !option.disabled);\n const current = candidates.findIndex((option) => option.value === activeValue);\n const repeated = state.text.split('').every((letter) => letter === state.text[0]);\n const term = repeated ? state.text[0] : state.text;\n const from = repeated || state.text.length === 1 ? current + 1 : Math.max(current, 0);\n const ordered = [...candidates.slice(from), ...candidates.slice(0, from)];\n const match = ordered.find((option) => optionText(option).toLowerCase().startsWith(term));\n if (match) setActiveValue(match.value);\n };\n\n const handleListKeys = (event: KeyboardEvent<HTMLElement>, source: 'trigger' | 'search') => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (event.altKey) setOpen(false);\n else move(-1);\n break;\n case 'Home':\n case 'End':\n // In the search box these keys move the caret.\n if (source === 'trigger') {\n event.preventDefault();\n move(event.key === 'Home' ? 'first' : 'last');\n }\n break;\n case 'Enter':\n event.preventDefault();\n if (activeOption) commit(activeOption);\n break;\n case 'Tab':\n if (source === 'search') {\n // The panel lives in a portal at the end of the document: go back to the field instead of tabbing out of the page.\n event.preventDefault();\n } else keepFocusOnClose.current = true;\n setOpen(false);\n break;\n default:\n }\n };\n\n const handleTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || readOnly) return;\n if (!isOpen) {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' ', 'Home', 'End'].includes(event.key)) {\n event.preventDefault();\n setOpen(true, event.key === 'Home' ? 'first' : event.key === 'End' ? 'last' : 'selected');\n } else if (isPrintable(event)) {\n event.preventDefault();\n setOpen(true);\n if (searchable) search(event.key);\n else typeAhead(event.key);\n }\n return;\n }\n if (event.key === ' ') {\n event.preventDefault();\n // A space while typing ahead belongs to the search text (\"New York\").\n if (typed.current.text) typeAhead(' ');\n else if (activeOption) commit(activeOption);\n } else if (isPrintable(event) && !searchable) {\n event.preventDefault();\n typeAhead(event.key);\n } else handleListKeys(event, 'trigger');\n };\n\n /** Filters the list and puts the keyboard on the first match. */\n const search = (next: string) => {\n const term = next.trim().toLowerCase();\n setQuery(next);\n setActiveValue(options.find((option) => !option.disabled && (!term || matches(option, term)))?.value ?? null);\n };\n\n const single = !multiple ? selectedOptions[0] : undefined;\n const hasChips = multiple && selectedOptions.length > 0;\n const Chevron = isOpen ? UpArrowIcon : DownArrowIcon;\n\n const control = (\n <div\n className=\"tm-field tm-select__control\"\n data-size={size}\n data-tm-icon-size={size}\n data-invalid={invalid ? '' : undefined}\n data-disabled={disabled ? '' : undefined}\n data-readonly={readOnly && !disabled ? '' : undefined}\n data-focus={isOpen ? '' : undefined}\n data-has-chips={hasChips ? '' : undefined}\n >\n {hasChips ? (\n <span className=\"tm-select__chips\">\n {selectedOptions.map((option) => (\n <SelectedItem\n key={option.value}\n size={size}\n disabled={disabled}\n removeLabel={removeLabel(optionText(option))}\n // Read-only chips cannot be removed, so they get no × button.\n onRemove={readOnly ? undefined : () => toggle(option.value)}\n >\n {option.label}\n </SelectedItem>\n ))}\n </span>\n ) : null}\n <Popover.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n id={ids.controlId}\n className=\"tm-select__trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listId : undefined}\n aria-activedescendant={isOpen && !searchable ? activeId : undefined}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-describedby={cn(ariaDescribedBy, ids.messageId) || undefined}\n aria-invalid={invalid || undefined}\n aria-required={required || undefined}\n aria-readonly={readOnly || undefined}\n disabled={disabled}\n onKeyDown={handleTriggerKeyDown}\n onKeyUp={(event) => {\n onKeyUp?.(event);\n // Firefox clicks a button on Space keyup; the keydown handler has already acted on it.\n if (event.key === ' ') event.preventDefault();\n }}\n {...props}\n >\n {startIcon}\n {single ? (\n <span className=\"tm-select__value\">{renderValue ? renderValue(single) : single.label}</span>\n ) : hasChips ? (\n // The chips sit outside the button; this keeps the selection in the combobox's own text for assistive technology.\n <span className=\"tm-select__value tm-select__value--hidden\">{selectedOptions.map(optionText).join(', ')}</span>\n ) : (\n <span className=\"tm-select__value\" data-placeholder=\"\">\n {placeholder}\n </span>\n )}\n <Chevron className=\"tm-select__chevron\" />\n </button>\n </Popover.Trigger>\n </div>\n );\n\n return (\n <Popover.Root open={isOpen} onOpenChange={(next) => setOpen(next)}>\n <FormField\n ids={ids}\n label={label}\n helperText={helperText}\n error={error}\n required={required}\n optional={optional}\n size={size}\n errorColor={errorColor}\n errorBox={errorBox}\n className={cn('tm-select', className)}\n style={style}\n data-full-width={fullWidth ? '' : undefined}\n >\n {panelAnchor ? (\n <>\n <Popover.Anchor virtualRef={virtualAnchor} />\n {control}\n </>\n ) : (\n <Popover.Anchor asChild>{control}</Popover.Anchor>\n )}\n {name\n ? (multiple ? selectedValues : [selectedValues[0] ?? '']).map((selected) => (\n <input key={selected} type=\"hidden\" name={name} value={selected} disabled={disabled} />\n ))\n : null}\n </FormField>\n <Popover.Portal container={portalContainer}>\n <Popover.Content\n // The combobox owns the listbox directly; the popover wrapper is only a surface.\n role=\"presentation\"\n className={cn('tm-option-panel tm-select__panel', panelClassName)}\n data-size={size}\n data-fit={fullWidth ? 'field' : 'content'}\n align={align}\n sideOffset={8}\n collisionPadding={8}\n onOpenAutoFocus={(event) => {\n // Select-only combobox: focus stays on the field (or moves to the search box) and the active option is announced through aria-activedescendant.\n event.preventDefault();\n searchRef.current?.focus();\n }}\n onCloseAutoFocus={(event) => {\n if (keepFocusOnClose.current) event.preventDefault();\n keepFocusOnClose.current = false;\n }}\n >\n {searchable ? (\n <div className=\"tm-select__search\">\n <SearchIcon size=\"sm\" />\n <input\n ref={searchRef}\n className=\"tm-select__search-input\"\n type=\"text\"\n role=\"combobox\"\n aria-label={searchPlaceholder}\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={activeId}\n autoComplete=\"off\"\n spellCheck={false}\n placeholder={searchPlaceholder}\n value={query}\n onChange={(event) => search(event.target.value)}\n onKeyDown={(event) => handleListKeys(event, 'search')}\n />\n </div>\n ) : null}\n <OptionList\n id={listId}\n size={listSize ?? size}\n multiple={multiple}\n surface={false}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-label={ariaLabelledBy || label ? undefined : props['aria-label']}\n // Keeps focus on the field (or the search box) while the pointer picks an option.\n onMouseDown={(event) => event.preventDefault()}\n >\n {visible.map((option) => (\n <Option\n key={option.value}\n id={optionId(options.indexOf(option))}\n selected={selectedValues.includes(option.value)}\n active={option === activeOption}\n disabled={option.disabled}\n icon={option.icon}\n detail={option.detail}\n description={option.description}\n indicator={multiple ? 'checkbox' : checkmark ? 'check' : 'none'}\n onClick={() => commit(option)}\n >\n {option.label}\n </Option>\n ))}\n </OptionList>\n {visible.length === 0 ? (\n <p className=\"tm-select__empty\" role=\"status\">\n {emptyText}\n </p>\n ) : null}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n});\n"],"mappings":"A,ifAgHA,IAAMyB,EAAW,GAA2D,MAAM,QAAQC,CAAK,EAAIA,EAAQA,GAAS,MAAQA,IAAU,GAAK,CAAC,EAAI,CAACA,CAAK,EAChJC,EAAU,GAA6B,OAAOC,GAAS,UAAY,OAAOA,GAAS,SAAW,OAAOA,CAAI,EAAI,GAC7GC,EAAc,GAAiCC,EAAO,YAAcH,EAAOG,EAAO,KAAK,GAAKA,EAAO,OACnGC,GAAW,EAAsB,IACrC,CAACF,EAAWC,CAAM,EAAGH,EAAOG,EAAO,MAAM,EAAGH,EAAOG,EAAO,WAAW,CAAC,CAAC,CAAC,KAAM,GAASE,EAAK,YAAY,CAAC,CAAC,SAASC,CAAK,CAAC,EACrHC,GAAe,GAAkCC,EAAM,IAAI,SAAW,GAAK,CAACA,EAAM,SAAW,CAACA,EAAM,SAAW,CAACA,EAAM,OACtHC,GAAsB,GAAuB,UAAUP,IAShDQ,GAAyB,EAAAf,EAAA,WAAA,CAA2C,SAC/E,CACE,QACA,aACA,QACA,WACA,YACA,cACA,YACA,OAAO,KACP,UACA,eAAc,gBACd,OACA,QAASgB,GACT,aAAa,GACb,oBAAoB,SACpB,aAAY,aACZ,aACA,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