@alfadocs/ui-kit 1.115.0 → 1.116.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/_chunks/accessible-target-Bs9ELM3l.js +6 -0
- package/dist/_chunks/{actions-cell-renderer-bI27uXXC.js → actions-cell-renderer-DzHxDyI7.js} +3 -3
- package/dist/_chunks/{address-fields-D5Ije0S2.js → address-fields-BFVCtfP2.js} +3 -3
- package/dist/_chunks/{anamnesis-summary-rows-BZ36ULQk.js → anamnesis-summary-rows-gEXqU5i5.js} +6 -6
- package/dist/_chunks/{appointment-card-D_-aBrx5.js → appointment-card-BMZoXaGx.js} +3 -3
- package/dist/_chunks/{appointment-peek-DWfcpoGy.js → appointment-peek-B1CCv-7J.js} +2 -2
- package/dist/_chunks/{appointment-timeline-DxLu3afn.js → appointment-timeline-0k4LxODn.js} +3 -3
- package/dist/_chunks/{appointment-tray-BhXOJpIJ.js → appointment-tray-DIxpgIXM.js} +2 -2
- package/dist/_chunks/arrow-down-left-DECv-dJt.js +15 -0
- package/dist/_chunks/{balance-badge-cell-CXHihM22.js → balance-badge-cell-L7bD0Nsh.js} +6 -6
- package/dist/_chunks/bill-line-table-WEIRDcv6.js +1563 -0
- package/dist/_chunks/{bmi-calculator-Ba4yoR31.js → bmi-calculator-BjUfXqcY.js} +2 -2
- package/dist/_chunks/{button-group-CUnNnt8a.js → button-group-BvU9vRnX.js} +2 -2
- package/dist/_chunks/{calculator-dialog-D4TyJwqy.js → calculator-dialog-BGX5XQCM.js} +2 -2
- package/dist/_chunks/{calendar-appointment-editor-dialog-BVzFi4hH.js → calendar-appointment-editor-dialog-DqZMb4yd.js} +16 -16
- package/dist/_chunks/{care-plan-card-BA3MfdfZ.js → care-plan-card-CfV8jiF0.js} +3 -3
- package/dist/_chunks/{care-plan-entry-card-CUtFZ813.js → care-plan-entry-card-Bt01kyTl.js} +3 -3
- package/dist/_chunks/{chart-DebrFZ6L.js → chart-BSx8cfMm.js} +2 -2
- package/dist/_chunks/circle-off-DuT9pVy2.js +16 -0
- package/dist/_chunks/combobox-BBCVQS-S.js +935 -0
- package/dist/_chunks/{compact-editor-fields-cP6yh7xv.js → compact-editor-fields-6sTWRLtf.js} +3 -3
- package/dist/_chunks/{contact-profile-card-DMXWBBkU.js → contact-profile-card-BRCHbQ3-.js} +2 -2
- package/dist/_chunks/{country-select-CUuGOAoZ.js → country-select-C2GdvRtS.js} +2 -2
- package/dist/_chunks/{cycle-calculator-C68V9rdH.js → cycle-calculator-Brd0PP4U.js} +2 -2
- package/dist/_chunks/{dashboard-grid-DrOkTtya.js → dashboard-grid-3aidD-IQ.js} +2 -2
- package/dist/_chunks/{toolbar-Bc3pjfG5.js → data-grid-ByhrYGVw.js} +3013 -3106
- package/dist/_chunks/{data-grid-tabs-CsLbIv0h.js → data-grid-tabs-D9Y4DeeH.js} +2 -2
- package/dist/_chunks/{data-table-DXaE2Ret.js → data-table-B47iw2CO.js} +101 -100
- package/dist/_chunks/{date-range-panel-CBFfkgmz.js → date-range-panel-B-DUtfw3.js} +7 -7
- package/dist/_chunks/default-tabs-BQcSqcNG.js +2250 -0
- package/dist/_chunks/dialog-CIUn5oLb.js +348 -0
- package/dist/_chunks/{document-preview-WvJKHJOP.js → document-preview-B_JGHsEW.js} +2 -2
- package/dist/_chunks/{dropdown-menu-CqxBthww.js → dropdown-menu-Dmbak7q6.js} +320 -248
- package/dist/_chunks/{due-date-calculator-C1UA5jpS.js → due-date-calculator-DzIQXEX5.js} +2 -2
- package/dist/_chunks/{editable-currency-cell-renderer-CtlMhLai.js → editable-currency-cell-renderer-p-Q1UkZS.js} +2 -2
- package/dist/_chunks/export-files-BByoK9Cg.js +248 -0
- package/dist/_chunks/{face-scheme-DkoxiDCh.js → face-scheme-CEjJUnNe.js} +19 -18
- package/dist/_chunks/{fetal-weight-DmZzMRzB.js → fetal-weight-CJTlfh_k.js} +2 -2
- package/dist/_chunks/{file-manager-DFFExyym.js → file-manager-DEe51ZDe.js} +5 -5
- package/dist/_chunks/format-price-CIX0YJZn.js +179 -0
- package/dist/_chunks/{grid-context-AwsLJRhH.js → grid-context-jn9y8tNE.js} +4 -4
- package/dist/_chunks/{hcg-doubling-CC-dbKE8.js → hcg-doubling-BUZQkSYC.js} +2 -2
- package/dist/_chunks/{header-settings-Df9q1uHt.js → header-settings-DNgvO8fS.js} +2 -2
- package/dist/_chunks/{heatmap-eXdtmEoU.js → heatmap-tn1WxoMT.js} +3 -3
- package/dist/_chunks/{help-me-write-templates-CWxgjDZl.js → help-me-write-templates-C28E_rOt.js} +2 -2
- package/dist/_chunks/highlighter-DSkckT2Q.js +15 -0
- package/dist/_chunks/{icon-button-group-C9mPK-bX.js → icon-button-group-Ca2VkXy5.js} +2 -2
- package/dist/_chunks/{kit-extensions-CzG0RmhQ.js → kit-extensions-BFfLg7c-.js} +6 -6
- package/dist/_chunks/{link-cell-renderer-Ditt5mvT.js → link-cell-renderer-D-Io828l.js} +4 -4
- package/dist/_chunks/{marketplace-app-shell-CcEHJgDd.js → marketplace-app-shell-CBHNg8x-.js} +4 -4
- package/dist/_chunks/money-OE6_oDPH.js +138 -0
- package/dist/_chunks/{muscle-scheme-BkmDUTmk.js → muscle-scheme-7UsRsCHP.js} +2 -2
- package/dist/_chunks/{notes-panel-BVYG_MJE.js → notes-panel-DexbfrFo.js} +3 -3
- package/dist/_chunks/number-input-DUSvP7Dq.js +625 -0
- package/dist/_chunks/{optical-prescription-CvbN8yD2.js → optical-prescription-Da_r8pMr.js} +2 -2
- package/dist/_chunks/parts-CtcTW1PN.js +869 -0
- package/dist/_chunks/{patient-details-DlT-vpSe.js → patient-details-PJ0Y__7t.js} +2 -2
- package/dist/_chunks/{patient-field-row-B54uzvu-.js → patient-field-row-0QP8KCVp.js} +5 -5
- package/dist/_chunks/{patient-search-DDRDCjZi.js → patient-search-Bdx_Ob3y.js} +2 -2
- package/dist/_chunks/{patient-summary-card-Dy9-CzON.js → patient-summary-card-BOfXDP8a.js} +3 -3
- package/dist/_chunks/{payment-request-card-BmV2pLoM.js → payment-request-card-_04afZEx.js} +14 -13
- package/dist/_chunks/{practice-results-BlxfBx-D.js → practice-results-CrBjScXX.js} +3 -3
- package/dist/_chunks/{pregnancy-dating-qZpw3zj8.js → pregnancy-dating-Bg_VUPwl.js} +2 -2
- package/dist/_chunks/{pregnancy-weight-gain-DQoOM8QV.js → pregnancy-weight-gain-B-eXFdmq.js} +2 -2
- package/dist/_chunks/{province-select-cVOlwEc5.js → province-select-CTM8A9SM.js} +2 -2
- package/dist/_chunks/{radiograph-panel.agent-C1LGeX-G.js → radiograph-panel.agent-9jwXlOXB.js} +2 -2
- package/dist/_chunks/{reserved.agent-6p3Hm4oH.js → reserved.agent-C1zRHaya.js} +4 -4
- package/dist/_chunks/{rich-text-editor-efaMWbYz.js → rich-text-editor-r80Zw8ll.js} +12 -11
- package/dist/_chunks/row-actions-Df7TJbNR.js +213 -0
- package/dist/_chunks/{signature-request-BnTihryS.js → signature-request-CgvjLic3.js} +3 -3
- package/dist/_chunks/{tab-bar-C_pggqVr.js → tab-bar-DTn8pHqH.js} +2 -2
- package/dist/_chunks/{tabs-CXYjr_8O.js → tabs-CsmgkiG6.js} +2 -2
- package/dist/_chunks/{task-editor-CSa6vQ9r.js → task-editor-DgUjtqpX.js} +168 -178
- package/dist/_chunks/{tasks-panel-CVjY1d7Q.js → tasks-panel-B5Nsf10r.js} +2 -2
- package/dist/_chunks/{theme-toggle-CObX2Ffa.js → theme-toggle-DfvdEg_V.js} +3 -3
- package/dist/_chunks/{token-insert-menu-Dl3x2ekR.js → token-insert-menu-BdcmK5Um.js} +2 -2
- package/dist/_chunks/toolbar-DbUQBrq4.js +159 -0
- package/dist/_chunks/{tooth-scheme-C-ALCHaV.js → tooth-scheme-LTkT4EXd.js} +2 -2
- package/dist/_chunks/{transaction-chip-CohY6sTA.js → transaction-chip-CkYd-3ky.js} +47 -57
- package/dist/_chunks/{treatment-receipt-BydbojdD.js → treatment-receipt-1VnuinhY.js} +2 -2
- package/dist/_chunks/undo-2-EBxWjj1W.js +15 -0
- package/dist/_chunks/{unit-converter-D77vmlzN.js → unit-converter-YKlHyUC2.js} +2 -2
- package/dist/_chunks/{use-appointment-details-read-BMAiQYo6.js → use-appointment-details-read-_r7cjTtm.js} +7 -7
- package/dist/_chunks/{verify-identity-types-C85EXNzy.js → verify-identity-types-D_LdByCp.js} +2 -2
- package/dist/_chunks/{widget-picker-U4JsEhQE.js → widget-picker-DrxJjEkv.js} +2 -2
- package/dist/_chunks/{workflow-map-B4XkcET0.js → workflow-map-D-u8_YSr.js} +2 -2
- package/dist/_chunks/{workflow-status-9wb7iWUd.js → workflow-status-fykpTxfb.js} +2 -2
- package/dist/_chunks/{workflow-webhook-action-DNSe65yd.js → workflow-webhook-action-DM3W8XZE.js} +2 -2
- package/dist/agent-catalog.json +1080 -1
- package/dist/agent-i18n/en.json +50 -0
- package/dist/components/_shared/accessible-target.d.ts +12 -0
- package/dist/components/_shared/decimal.d.ts +171 -0
- package/dist/components/_shared/format-price.d.ts +54 -2
- package/dist/components/address-fields/index.js +1 -1
- package/dist/components/appointment-card/index.js +2 -2
- package/dist/components/appointment-details-panel/index.js +1 -1
- package/dist/components/appointment-peek/index.js +1 -1
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/bill-line-table/bill-line-table.agent.d.ts +4 -0
- package/dist/components/bill-line-table/bill-line-table.columns.d.ts +47 -0
- package/dist/components/bill-line-table/bill-line-table.d.ts +4 -0
- package/dist/components/bill-line-table/bill-line-table.model.d.ts +173 -0
- package/dist/components/bill-line-table/bill-line-table.types.d.ts +443 -0
- package/dist/components/bill-line-table/bill-line-table.variants.d.ts +34 -0
- package/dist/components/bill-line-table/index.d.ts +6 -0
- package/dist/components/bill-line-table/index.js +23 -0
- package/dist/components/bill-table/bill-table.agent.d.ts +4 -0
- package/dist/components/bill-table/bill-table.d.ts +13 -0
- package/dist/components/bill-table/bill-table.variants.d.ts +55 -0
- package/dist/components/bill-table/cells.d.ts +89 -0
- package/dist/components/bill-table/columns.d.ts +21 -0
- package/dist/components/bill-table/default-tabs.d.ts +21 -0
- package/dist/components/bill-table/handle.d.ts +19 -0
- package/dist/components/bill-table/index.d.ts +7 -0
- package/dist/components/bill-table/index.js +19 -0
- package/dist/components/bill-table/model.d.ts +103 -0
- package/dist/components/bill-table/row-actions.d.ts +27 -0
- package/dist/components/bill-table/status-maps.d.ts +225 -0
- package/dist/components/bill-table/types.d.ts +542 -0
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/button-group/index.js +1 -1
- package/dist/components/calculator-dialog/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/chart/index.js +1 -1
- package/dist/components/combobox/combobox.d.ts +59 -1
- package/dist/components/combobox/index.d.ts +1 -1
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/contact-profile-card/index.js +1 -1
- package/dist/components/country-select/index.js +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/dashboard-grid/index.js +1 -1
- package/dist/components/data-grid/body.d.ts +6 -0
- package/dist/components/data-grid/data-grid.variants.d.ts +1 -9
- package/dist/components/data-grid/editors.d.ts +7 -1
- package/dist/components/data-grid/index.js +9 -8
- package/dist/components/data-grid/selection.d.ts +10 -0
- package/dist/components/data-grid/types.d.ts +61 -11
- package/dist/components/data-grid-tabs/index.js +1 -1
- package/dist/components/data-table/index.js +4 -4
- package/dist/components/dialog/focus-return.d.ts +12 -0
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +11 -0
- package/dist/components/dropdown-menu/index.js +1 -1
- package/dist/components/due-date-calculator/index.js +1 -1
- package/dist/components/face-scheme/index.js +1 -1
- package/dist/components/fetal-weight/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/header-settings/index.js +1 -1
- package/dist/components/heatmap/index.js +1 -1
- package/dist/components/icon-button-group/index.js +1 -1
- package/dist/components/index.d.ts +6 -0
- package/dist/components/money/index.js +1 -1
- package/dist/components/money/money.d.ts +39 -6
- package/dist/components/muscle-scheme/index.js +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/number-input/index.d.ts +2 -2
- package/dist/components/number-input/index.js +1 -1
- package/dist/components/number-input/number-input.d.ts +43 -2
- package/dist/components/number-input/use-locale-number.d.ts +67 -3
- package/dist/components/optical-prescription/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/province-select/index.js +1 -1
- package/dist/components/radiograph-panel/index.js +1 -1
- package/dist/components/rich-text-editor/index.js +2 -2
- package/dist/components/row-actions/index.d.ts +3 -0
- package/dist/components/row-actions/index.js +5 -0
- package/dist/components/row-actions/row-actions.d.ts +63 -0
- package/dist/components/skeleton-scheme/index.js +1 -1
- package/dist/components/smart-date/smart-date.d.ts +1 -1
- package/dist/components/tab-bar/index.js +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/task-editor/index.js +1 -1
- package/dist/components/tasks-panel/index.js +1 -1
- package/dist/components/theme-toggle/index.js +1 -1
- package/dist/components/token-insert-menu/index.js +1 -1
- package/dist/components/tooth-scheme/index.js +1 -1
- package/dist/components/transaction-chip/index.js +1 -1
- package/dist/components/transaction-chip/transaction-chip.d.ts +1 -1
- package/dist/components/treatment-receipt/index.js +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/widget-picker/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/components/workflow-status/index.js +1 -1
- package/dist/core.css +1 -1
- package/dist/decimal/index.js +149 -0
- package/dist/host-compat.css +4 -1
- package/dist/i18n/locales/ar.d.ts +248 -0
- package/dist/i18n/locales/ar.js +249 -1
- package/dist/i18n/locales/de.d.ts +248 -0
- package/dist/i18n/locales/de.js +249 -1
- package/dist/i18n/locales/el.d.ts +248 -0
- package/dist/i18n/locales/el.js +249 -1
- package/dist/i18n/locales/en.d.ts +248 -0
- package/dist/i18n/locales/en.js +249 -1
- package/dist/i18n/locales/es.d.ts +248 -0
- package/dist/i18n/locales/es.js +249 -1
- package/dist/i18n/locales/fr.d.ts +248 -0
- package/dist/i18n/locales/fr.js +249 -1
- package/dist/i18n/locales/hi.d.ts +248 -0
- package/dist/i18n/locales/hi.js +249 -1
- package/dist/i18n/locales/it.d.ts +248 -0
- package/dist/i18n/locales/it.js +249 -1
- package/dist/i18n/locales/ja.d.ts +248 -0
- package/dist/i18n/locales/ja.js +249 -1
- package/dist/i18n/locales/nl.d.ts +248 -0
- package/dist/i18n/locales/nl.js +249 -1
- package/dist/i18n/locales/pl.d.ts +248 -0
- package/dist/i18n/locales/pl.js +249 -1
- package/dist/i18n/locales/pt.d.ts +248 -0
- package/dist/i18n/locales/pt.js +249 -1
- package/dist/i18n/locales/ro.d.ts +248 -0
- package/dist/i18n/locales/ro.js +249 -1
- package/dist/i18n/locales/ru.d.ts +248 -0
- package/dist/i18n/locales/ru.js +249 -1
- package/dist/i18n/locales/sq.d.ts +248 -0
- package/dist/i18n/locales/sq.js +249 -1
- package/dist/i18n/locales/sv.d.ts +248 -0
- package/dist/i18n/locales/sv.js +249 -1
- package/dist/i18n/locales/tr.d.ts +248 -0
- package/dist/i18n/locales/tr.js +249 -1
- package/dist/i18n/locales/zh.d.ts +248 -0
- package/dist/i18n/locales/zh.js +249 -1
- package/dist/index.js +1298 -1246
- package/dist/locales/ar.json +249 -1
- package/dist/locales/de.json +249 -1
- package/dist/locales/el.json +249 -1
- package/dist/locales/en.json +249 -1
- package/dist/locales/es.json +249 -1
- package/dist/locales/fr.json +249 -1
- package/dist/locales/hi.json +249 -1
- package/dist/locales/it.json +249 -1
- package/dist/locales/ja.json +249 -1
- package/dist/locales/nl.json +249 -1
- package/dist/locales/pl.json +249 -1
- package/dist/locales/pt.json +249 -1
- package/dist/locales/ro.json +249 -1
- package/dist/locales/ru.json +249 -1
- package/dist/locales/sq.json +249 -1
- package/dist/locales/sv.json +249 -1
- package/dist/locales/tr.json +249 -1
- package/dist/locales/zh.json +249 -1
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/patterns/help-me-write-templates/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/signature-request/index.js +1 -1
- package/dist/patterns/verify-identity/index.js +1 -1
- package/dist/patterns/workflow-webhook-action/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +17 -1
- package/dist/_chunks/combobox-duuDRI1t.js +0 -688
- package/dist/_chunks/dialog-BTjSQjdY.js +0 -274
- package/dist/_chunks/format-price-BcFBa-WP.js +0 -52
- package/dist/_chunks/money-Tsczpjfz.js +0 -102
- package/dist/_chunks/number-input-CVwI1ltI.js +0 -423
- package/dist/_chunks/parts-Wz2LeGnH.js +0 -1113
- package/dist/_chunks/undo-2-CYNAzclj.js +0 -26
|
@@ -0,0 +1,935 @@
|
|
|
1
|
+
import { jsx as n, jsxs as x, Fragment as Vt } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ot, useContext as Pt, useMemo as Ne, useState as E, useRef as c, useEffect as w, useCallback as G } from "react";
|
|
3
|
+
import * as ne from "@radix-ui/react-popover";
|
|
4
|
+
import { R as Lt, _ as S, P as _e } from "./index-4xgbg-sn.js";
|
|
5
|
+
import { c as X } from "./index-D2ZczOXr.js";
|
|
6
|
+
import { useTranslation as jt } from "react-i18next";
|
|
7
|
+
import { u as qt, F as Ht, b as $t } from "./form-field-context-DtiROUJV.js";
|
|
8
|
+
import { c as Bt } from "./compose-refs-C0k0tdqF.js";
|
|
9
|
+
import { n as H } from "./normalize-diacritics-BNGbFNlJ.js";
|
|
10
|
+
import { g as Ut } from "./group-options-BvKhQ3xb.js";
|
|
11
|
+
import { b as Mt } from "./menu-row-BAr8bx1I.js";
|
|
12
|
+
import { O as Kt, a as Gt, o as Wt, b as Xt, c as Yt } from "./option-row-Dc7BrbK8.js";
|
|
13
|
+
import { u as Jt } from "./use-controllable-state-BiY4xTzM.js";
|
|
14
|
+
import { u as W } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
|
|
15
|
+
import { I as Zt, a as ke, d as Ee, c as Qt } from "./input-surface-BMffm2Vd.js";
|
|
16
|
+
import { u as er } from "./registry-DvAUVLHh.js";
|
|
17
|
+
import { S as tr } from "./spinner-CoflYlEx.js";
|
|
18
|
+
import { X as rr } from "./x-B5YnXwCz.js";
|
|
19
|
+
import { C as sr } from "./check-DrFSN__t.js";
|
|
20
|
+
const nr = {
|
|
21
|
+
id: "combobox",
|
|
22
|
+
// Persisted single choice (value state + set_value) → select_single + set_value,
|
|
23
|
+
// plus type-to-filter and open/close of the option list.
|
|
24
|
+
capabilities: ["select_single", "set_value", "filter", "open", "close"],
|
|
25
|
+
state: {
|
|
26
|
+
value: {
|
|
27
|
+
type: "string | null",
|
|
28
|
+
descriptionKey: "ui.agent.combobox.state.value",
|
|
29
|
+
description: "Currently-selected option value, or null when nothing is selected.",
|
|
30
|
+
read: (i) => i.getValue()
|
|
31
|
+
},
|
|
32
|
+
query: {
|
|
33
|
+
type: "string",
|
|
34
|
+
descriptionKey: "ui.agent.combobox.state.query",
|
|
35
|
+
description: "Current filter query in the combobox input.",
|
|
36
|
+
read: (i) => i.getQuery()
|
|
37
|
+
},
|
|
38
|
+
isOpen: {
|
|
39
|
+
type: "boolean",
|
|
40
|
+
descriptionKey: "ui.agent.combobox.state.isOpen",
|
|
41
|
+
description: "True when the option list is visible.",
|
|
42
|
+
read: (i) => i.getIsOpen()
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
actions: {
|
|
46
|
+
set_value: {
|
|
47
|
+
// Persists the user's chosen option — reversible via the same UI.
|
|
48
|
+
safety: "write",
|
|
49
|
+
argsType: "{ value: string | null }",
|
|
50
|
+
argsSchema: {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
value: {
|
|
54
|
+
type: ["string", "null"],
|
|
55
|
+
description: "Option value to select, or null to clear."
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
required: ["value"]
|
|
59
|
+
},
|
|
60
|
+
idempotent: !0,
|
|
61
|
+
descriptionKey: "ui.agent.combobox.actions.setValue",
|
|
62
|
+
description: "Set the selected value programmatically.",
|
|
63
|
+
examples: [{ args: { value: "it" }, note: 'Select the "it" option.' }],
|
|
64
|
+
invoke: (i, a) => {
|
|
65
|
+
i.setValue(a.value);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
apply_filter: {
|
|
69
|
+
// Pure ephemeral filter of the visible options — no persisted change.
|
|
70
|
+
safety: "read",
|
|
71
|
+
argsType: "{ query: string }",
|
|
72
|
+
argsSchema: {
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: {
|
|
75
|
+
query: { type: "string", description: "Filter text for the list." }
|
|
76
|
+
},
|
|
77
|
+
required: ["query"]
|
|
78
|
+
},
|
|
79
|
+
idempotent: !0,
|
|
80
|
+
descriptionKey: "ui.agent.combobox.actions.applyFilter",
|
|
81
|
+
description: "Set the filter query for the option list.",
|
|
82
|
+
invoke: (i, a) => {
|
|
83
|
+
i.setQuery(a.query);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
clear_selection: {
|
|
87
|
+
// Discards the persisted choice — destructive (loses the selection).
|
|
88
|
+
safety: "destructive",
|
|
89
|
+
idempotent: !0,
|
|
90
|
+
descriptionKey: "ui.agent.combobox.actions.clearSelection",
|
|
91
|
+
description: "Clear the current selection.",
|
|
92
|
+
invoke: (i) => {
|
|
93
|
+
i.clear();
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
open: {
|
|
97
|
+
safety: "read",
|
|
98
|
+
idempotent: !0,
|
|
99
|
+
descriptionKey: "ui.agent.combobox.actions.open",
|
|
100
|
+
description: "Open the option list.",
|
|
101
|
+
invoke: (i) => {
|
|
102
|
+
i.open();
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
close: {
|
|
106
|
+
safety: "read",
|
|
107
|
+
idempotent: !0,
|
|
108
|
+
descriptionKey: "ui.agent.combobox.actions.close",
|
|
109
|
+
description: "Close the option list.",
|
|
110
|
+
invoke: (i) => {
|
|
111
|
+
i.close();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
domHooks: {
|
|
116
|
+
root: { attr: "data-component", value: "combobox" },
|
|
117
|
+
instanceId: {
|
|
118
|
+
attr: "data-component-id",
|
|
119
|
+
sourceProp: "id",
|
|
120
|
+
description: "Sourced from the id prop."
|
|
121
|
+
},
|
|
122
|
+
item: {
|
|
123
|
+
attr: "data-option-id",
|
|
124
|
+
description: "Each option emits its value as data-option-id."
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, or = X(
|
|
128
|
+
[
|
|
129
|
+
"ds:peer ds:w-full ds:bg-transparent ds:text-foreground ds:placeholder:text-muted-foreground",
|
|
130
|
+
"ds:outline-none ds:border-0",
|
|
131
|
+
"ds:disabled:cursor-not-allowed"
|
|
132
|
+
].join(" "),
|
|
133
|
+
{
|
|
134
|
+
variants: {
|
|
135
|
+
size: {
|
|
136
|
+
sm: "ds:text-[length:var(--font-size-sm)]",
|
|
137
|
+
md: "ds:text-[length:var(--font-size-base)]",
|
|
138
|
+
lg: "ds:text-[length:var(--font-size-lg)]"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
defaultVariants: {
|
|
142
|
+
size: "md"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
), ir = X(
|
|
146
|
+
[
|
|
147
|
+
"ds:group ds:relative ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)] ds:w-full",
|
|
148
|
+
Qt
|
|
149
|
+
].join(" "),
|
|
150
|
+
{
|
|
151
|
+
variants: {
|
|
152
|
+
size: {
|
|
153
|
+
sm: `${ke.sm} ${Ee.sm}`,
|
|
154
|
+
md: `${ke.md} ${Ee.md}`,
|
|
155
|
+
lg: `${ke.lg} ${Ee.lg}`
|
|
156
|
+
},
|
|
157
|
+
tone: Zt
|
|
158
|
+
},
|
|
159
|
+
defaultVariants: {
|
|
160
|
+
size: "md",
|
|
161
|
+
tone: "default"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
), ar = X(
|
|
165
|
+
[
|
|
166
|
+
"ds:z-[var(--z-popover)] ds:overflow-hidden",
|
|
167
|
+
// A guard: whatever the width below, the list never runs past the edge
|
|
168
|
+
// of the space the screen leaves.
|
|
169
|
+
"ds:max-w-[var(--radix-popover-content-available-width)]",
|
|
170
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-border ds:bg-background ds:text-foreground",
|
|
171
|
+
"ds:shadow-[var(--shadow-lg)]",
|
|
172
|
+
"ds:animate-in ds:fade-in ds:zoom-in-95",
|
|
173
|
+
"ds:data-[side=bottom]:slide-in-from-top-2",
|
|
174
|
+
"ds:data-[side=top]:slide-in-from-bottom-2",
|
|
175
|
+
"ds:motion-reduce:animate-none"
|
|
176
|
+
].join(" "),
|
|
177
|
+
{
|
|
178
|
+
variants: {
|
|
179
|
+
// The field's width, or a token width that the field's own width
|
|
180
|
+
// overrides when it is wider.
|
|
181
|
+
popoverSize: {
|
|
182
|
+
trigger: "ds:w-[var(--radix-popover-trigger-width)]",
|
|
183
|
+
sm: "ds:w-[max(var(--radix-popover-trigger-width),var(--popover-size-sm))]",
|
|
184
|
+
md: "ds:w-[max(var(--radix-popover-trigger-width),var(--popover-size-md))]",
|
|
185
|
+
lg: "ds:w-[max(var(--radix-popover-trigger-width),var(--popover-size-lg))]"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
defaultVariants: {
|
|
189
|
+
popoverSize: "trigger"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
), Ce = X(
|
|
193
|
+
[
|
|
194
|
+
"ds:relative ds:flex ds:cursor-pointer ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
195
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
196
|
+
"ds:text-foreground ds:outline-none ds:select-none",
|
|
197
|
+
Mt.selected,
|
|
198
|
+
"ds:aria-disabled:pointer-events-none ds:aria-disabled:opacity-50"
|
|
199
|
+
].join(" "),
|
|
200
|
+
{
|
|
201
|
+
variants: {
|
|
202
|
+
size: {
|
|
203
|
+
sm: "ds:min-h-8 ds:ps-3 ds:pe-3 ds:text-[length:var(--font-size-sm)]",
|
|
204
|
+
md: "ds:min-h-[var(--min-target-size)] ds:ps-3 ds:pe-3 ds:text-[length:var(--font-size-base)]",
|
|
205
|
+
// The scroll padding of a list with an action reads the same token.
|
|
206
|
+
lg: "ds:min-h-[var(--spacing-2xl)] ds:ps-4 ds:pe-4 ds:text-[length:var(--font-size-lg)]"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
defaultVariants: {
|
|
210
|
+
size: "md"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
), cr = [
|
|
214
|
+
"ds:ps-3 ds:pe-3 ds:py-1.5",
|
|
215
|
+
"type-eyebrow ds:text-muted-foreground"
|
|
216
|
+
].join(" "), lr = X(
|
|
217
|
+
[
|
|
218
|
+
// One padding token, which the pinned action row reads as well.
|
|
219
|
+
"ds:[--combobox-list-pad:var(--spacing-xs)]",
|
|
220
|
+
"ds:max-h-72 ds:overflow-y-auto ds:p-[var(--combobox-list-pad)]"
|
|
221
|
+
].join(" "),
|
|
222
|
+
{
|
|
223
|
+
variants: {
|
|
224
|
+
withAction: {
|
|
225
|
+
// The pinned action row covers the bottom of the list. Keep a row
|
|
226
|
+
// the arrow keys reach above it: the tallest row is lg's
|
|
227
|
+
// --spacing-2xl, or the target size where that is larger. Fix the
|
|
228
|
+
// rule colour here: a highlighted row repoints --border at its own
|
|
229
|
+
// ink.
|
|
230
|
+
true: [
|
|
231
|
+
"ds:scroll-pb-[calc(max(var(--spacing-2xl),var(--min-target-size))+var(--combobox-list-pad))]",
|
|
232
|
+
"ds:[--combobox-action-rule:var(--border)]"
|
|
233
|
+
].join(" "),
|
|
234
|
+
false: ""
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
defaultVariants: {
|
|
238
|
+
withAction: !1
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
), dr = [
|
|
242
|
+
"ds:sticky ds:bottom-[calc(var(--combobox-list-pad)*-1)] ds:mt-[var(--combobox-list-pad)] ds:mb-[calc(var(--combobox-list-pad)*-1)] ds:bg-background",
|
|
243
|
+
"ds:rounded-t-none ds:border-t ds:border-[color:var(--combobox-action-rule)]"
|
|
244
|
+
].join(" "), ur = [
|
|
245
|
+
"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
246
|
+
"ds:ps-3 ds:pe-3 ds:py-2 type-body-sm ds:text-muted-foreground"
|
|
247
|
+
].join(" "), fr = "ds:ps-3 ds:pe-3 ds:py-2 type-body-sm ds:text-muted-foreground", mr = {
|
|
248
|
+
sm: "ds:size-3.5",
|
|
249
|
+
md: "ds:size-4",
|
|
250
|
+
lg: "ds:size-5"
|
|
251
|
+
};
|
|
252
|
+
function pr({
|
|
253
|
+
search: i,
|
|
254
|
+
label: a,
|
|
255
|
+
iconClass: y,
|
|
256
|
+
size: _,
|
|
257
|
+
onSelect: D
|
|
258
|
+
}) {
|
|
259
|
+
return _e((C) => C.filtered.count) > 0 ? null : /* @__PURE__ */ x(
|
|
260
|
+
S.Item,
|
|
261
|
+
{
|
|
262
|
+
value: "__combobox-create__",
|
|
263
|
+
keywords: [],
|
|
264
|
+
forceMount: !0,
|
|
265
|
+
onSelect: () => D(i),
|
|
266
|
+
className: Ce({ size: _ }),
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ n(
|
|
269
|
+
"span",
|
|
270
|
+
{
|
|
271
|
+
"aria-hidden": "true",
|
|
272
|
+
className: `ds:inline-flex ds:items-center ds:justify-center ${y}`
|
|
273
|
+
}
|
|
274
|
+
),
|
|
275
|
+
/* @__PURE__ */ n("span", { className: "ds:flex-1 ds:truncate", children: a })
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
const oe = "__combobox-action__", Me = '[cmdk-item][data-selected="true"]', br = '[cmdk-item]:not([aria-disabled="true"])';
|
|
281
|
+
function vr({
|
|
282
|
+
loading: i,
|
|
283
|
+
open: a,
|
|
284
|
+
announceEmpty: y,
|
|
285
|
+
loadingLabel: _,
|
|
286
|
+
emptyLabel: D,
|
|
287
|
+
resultsLabel: Y
|
|
288
|
+
}) {
|
|
289
|
+
const C = _e((A) => A.filtered.count), [V, ie] = E({ loading: i, open: a }), [ae, ce] = E(!1);
|
|
290
|
+
(V.loading !== i || V.open !== a) && (ie({ loading: i, open: a }), ce(V.loading && !i && a && V.open));
|
|
291
|
+
let F = "";
|
|
292
|
+
return a && i ? F = _ : a && ae ? F = C === 0 ? D : Y(C) : a && y && C === 0 && (F = D), /* @__PURE__ */ n(
|
|
293
|
+
"span",
|
|
294
|
+
{
|
|
295
|
+
role: "status",
|
|
296
|
+
"aria-live": "polite",
|
|
297
|
+
"aria-atomic": "true",
|
|
298
|
+
className: "ds:sr-only",
|
|
299
|
+
children: F
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
function hr({ label: i }) {
|
|
304
|
+
return _e((y) => y.filtered.count) > 0 ? null : (
|
|
305
|
+
// An unavailable option, like the empty message: the listbox may only
|
|
306
|
+
// own options. Not a cmdk item, so the arrow keys pass over it.
|
|
307
|
+
/* @__PURE__ */ x(
|
|
308
|
+
"div",
|
|
309
|
+
{
|
|
310
|
+
role: "option",
|
|
311
|
+
"aria-selected": !1,
|
|
312
|
+
"aria-disabled": "true",
|
|
313
|
+
"data-combobox-loading": "",
|
|
314
|
+
className: ur,
|
|
315
|
+
children: [
|
|
316
|
+
/* @__PURE__ */ n(tr, { variant: "pulse", size: "sm", "aria-hidden": "true" }),
|
|
317
|
+
/* @__PURE__ */ n("span", { children: i })
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
function gr({
|
|
324
|
+
action: i,
|
|
325
|
+
iconClass: a,
|
|
326
|
+
size: y,
|
|
327
|
+
onSelect: _
|
|
328
|
+
}) {
|
|
329
|
+
return /* @__PURE__ */ x(
|
|
330
|
+
S.Item,
|
|
331
|
+
{
|
|
332
|
+
value: oe,
|
|
333
|
+
keywords: [],
|
|
334
|
+
forceMount: !0,
|
|
335
|
+
onSelect: _,
|
|
336
|
+
"data-combobox-action": "",
|
|
337
|
+
className: Ce({
|
|
338
|
+
size: y,
|
|
339
|
+
className: dr
|
|
340
|
+
}),
|
|
341
|
+
children: [
|
|
342
|
+
/* @__PURE__ */ n(
|
|
343
|
+
"span",
|
|
344
|
+
{
|
|
345
|
+
"aria-hidden": "true",
|
|
346
|
+
className: `ds:inline-flex ds:items-center ds:justify-center ds:shrink-0 ds:[&_svg]:size-full ${a}`,
|
|
347
|
+
children: i.icon
|
|
348
|
+
}
|
|
349
|
+
),
|
|
350
|
+
/* @__PURE__ */ n("span", { className: "ds:flex-1 ds:truncate", children: i.label })
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
const Ke = Ot(
|
|
356
|
+
function({
|
|
357
|
+
options: a,
|
|
358
|
+
value: y,
|
|
359
|
+
defaultValue: _,
|
|
360
|
+
onValueChange: D,
|
|
361
|
+
placeholder: Y,
|
|
362
|
+
clearable: C = !1,
|
|
363
|
+
disabled: V,
|
|
364
|
+
readOnly: ie,
|
|
365
|
+
required: ae,
|
|
366
|
+
name: ce,
|
|
367
|
+
id: F,
|
|
368
|
+
size: A = "md",
|
|
369
|
+
tone: Ge = "default",
|
|
370
|
+
filter: le,
|
|
371
|
+
allowCreate: We = !1,
|
|
372
|
+
onCreate: de,
|
|
373
|
+
open: Fe,
|
|
374
|
+
onOpenChange: I,
|
|
375
|
+
onQueryChange: d,
|
|
376
|
+
emptyMessage: ue,
|
|
377
|
+
className: Xe,
|
|
378
|
+
"aria-label": fe,
|
|
379
|
+
"aria-labelledby": $,
|
|
380
|
+
"aria-invalid": Ye,
|
|
381
|
+
"aria-describedby": Je,
|
|
382
|
+
autoComplete: J,
|
|
383
|
+
matchAutofill: Ie,
|
|
384
|
+
wrapOptionLabels: ze = !1,
|
|
385
|
+
action: h,
|
|
386
|
+
openOnFocus: Ze = !0,
|
|
387
|
+
popoverSize: Qe = "trigger",
|
|
388
|
+
loading: O
|
|
389
|
+
}, et) {
|
|
390
|
+
const { t: N } = jt("ui"), k = qt(), Z = Pt(Ht) !== null, [tt, Q] = Jt({
|
|
391
|
+
value: y,
|
|
392
|
+
defaultValue: _ ?? "",
|
|
393
|
+
onChange: D
|
|
394
|
+
}), g = tt ?? "", P = Ne(
|
|
395
|
+
() => a.find((e) => e.value === g),
|
|
396
|
+
[a, g]
|
|
397
|
+
), u = (P == null ? void 0 : P.label) ?? "", [f, m] = E(u), [rt, Te] = E(!1), ee = Fe !== void 0, o = ee ? Fe : rt, B = c(!1), z = u !== "" && f === u, U = c(!1);
|
|
398
|
+
w(() => {
|
|
399
|
+
o || (U.current = !1);
|
|
400
|
+
}, [o]);
|
|
401
|
+
const b = c(null), me = c(null), L = c(null), [te, st] = E(null);
|
|
402
|
+
$t(k, b);
|
|
403
|
+
const [nt, ot] = E(0), De = c(!1);
|
|
404
|
+
W(() => {
|
|
405
|
+
if (!De.current) {
|
|
406
|
+
De.current = !0;
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
z && ot((e) => e + 1);
|
|
410
|
+
}, [z]);
|
|
411
|
+
const T = c(!1), [it, pe] = E("");
|
|
412
|
+
w(() => {
|
|
413
|
+
T.current = !1, pe((e) => e === oe ? "" : e);
|
|
414
|
+
}, [f, o]);
|
|
415
|
+
const re = c(!1), be = c(void 0), Ve = G(() => {
|
|
416
|
+
T.current = !0, re.current = !0, window.clearTimeout(be.current), be.current = window.setTimeout(() => {
|
|
417
|
+
re.current = !1;
|
|
418
|
+
});
|
|
419
|
+
}, []);
|
|
420
|
+
w(() => () => window.clearTimeout(be.current), []);
|
|
421
|
+
const at = G((e) => {
|
|
422
|
+
if (e === oe && !re.current) {
|
|
423
|
+
pe((t) => t === "" ? " " : "");
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
pe(e);
|
|
427
|
+
}, []), Oe = c(null), ve = c(!1);
|
|
428
|
+
W(() => {
|
|
429
|
+
const e = te, t = b.current;
|
|
430
|
+
if (!o || !e || !t || e !== L.current) return;
|
|
431
|
+
const s = () => {
|
|
432
|
+
const r = e.querySelector(Me), v = (r == null ? void 0 : r.id) || null;
|
|
433
|
+
v !== Oe.current && (Oe.current = v, re.current || (T.current = !1));
|
|
434
|
+
const q = r == null ? void 0 : r.id;
|
|
435
|
+
q ? t.getAttribute("aria-activedescendant") !== q && t.setAttribute("aria-activedescendant", q) : t.hasAttribute("aria-activedescendant") && t.removeAttribute("aria-activedescendant");
|
|
436
|
+
};
|
|
437
|
+
s();
|
|
438
|
+
const l = new MutationObserver(s);
|
|
439
|
+
return l.observe(e, {
|
|
440
|
+
subtree: !0,
|
|
441
|
+
childList: !0,
|
|
442
|
+
attributes: !0,
|
|
443
|
+
attributeFilter: ["data-selected"]
|
|
444
|
+
}), l.observe(t, {
|
|
445
|
+
attributes: !0,
|
|
446
|
+
attributeFilter: ["aria-activedescendant"]
|
|
447
|
+
}), () => l.disconnect();
|
|
448
|
+
}, [o, te]);
|
|
449
|
+
const j = c(!1), he = c(0);
|
|
450
|
+
w(() => () => cancelAnimationFrame(he.current), []);
|
|
451
|
+
const [ct, lt] = E();
|
|
452
|
+
W(() => {
|
|
453
|
+
const e = me.current;
|
|
454
|
+
if (!e) return;
|
|
455
|
+
const t = getComputedStyle(e).direction === "rtl" ? "rtl" : "ltr";
|
|
456
|
+
lt((s) => s === t ? s : t);
|
|
457
|
+
}, [o]);
|
|
458
|
+
const Pe = c(null);
|
|
459
|
+
W(() => {
|
|
460
|
+
var r;
|
|
461
|
+
const e = L.current;
|
|
462
|
+
if (e !== te || !o || !z || !g || e === Pe.current) return;
|
|
463
|
+
const t = e == null ? void 0 : e.querySelector(
|
|
464
|
+
`[data-option-id="${CSS.escape(g)}"]`
|
|
465
|
+
);
|
|
466
|
+
if (!e || !t) return;
|
|
467
|
+
Pe.current = e;
|
|
468
|
+
const s = () => {
|
|
469
|
+
if (T.current) return;
|
|
470
|
+
const v = e.getBoundingClientRect(), q = t.getBoundingClientRect(), Ue = e.offsetHeight > 0 ? v.height / e.offsetHeight : 1, Tt = (q.top - v.top) / (Ue || 1), Dt = q.height / (Ue || 1);
|
|
471
|
+
e.scrollTop += Tt - (e.clientHeight - Dt) / 2;
|
|
472
|
+
};
|
|
473
|
+
s();
|
|
474
|
+
const l = requestAnimationFrame(s);
|
|
475
|
+
ve.current = !0;
|
|
476
|
+
try {
|
|
477
|
+
t.dispatchEvent(new PointerEvent("pointermove", { bubbles: !0 }));
|
|
478
|
+
} finally {
|
|
479
|
+
ve.current = !1;
|
|
480
|
+
}
|
|
481
|
+
return (r = b.current) == null || r.setAttribute("aria-activedescendant", t.id), () => cancelAnimationFrame(l);
|
|
482
|
+
}, [o, te, z, g]);
|
|
483
|
+
const M = J && J !== "off" ? J : void 0, ge = c(null), xe = G(() => {
|
|
484
|
+
var s;
|
|
485
|
+
const e = b.current;
|
|
486
|
+
if (!e) return;
|
|
487
|
+
ge.current === null && (ge.current = e.getAttribute("aria-labelledby") ?? "");
|
|
488
|
+
const t = $ || ge.current;
|
|
489
|
+
t && e.getAttribute("aria-labelledby") !== t && e.setAttribute("aria-labelledby", t), e.setAttribute("aria-expanded", String(o)), o && ((s = L.current) != null && s.id) ? e.setAttribute("aria-controls", L.current.id) : o || (e.removeAttribute("aria-controls"), e.removeAttribute("aria-activedescendant")), M && e.setAttribute("autocomplete", M);
|
|
490
|
+
}, [o, M, $]);
|
|
491
|
+
W(xe);
|
|
492
|
+
const dt = G(
|
|
493
|
+
(e) => {
|
|
494
|
+
L.current = e, xe(), e && st(e);
|
|
495
|
+
},
|
|
496
|
+
[xe]
|
|
497
|
+
), ye = c(!1);
|
|
498
|
+
w(() => {
|
|
499
|
+
const e = b.current;
|
|
500
|
+
if (!e || !M) return;
|
|
501
|
+
const t = (s) => {
|
|
502
|
+
const l = s.inputType;
|
|
503
|
+
ye.current = !l || l === "insertReplacementText";
|
|
504
|
+
};
|
|
505
|
+
return e.addEventListener("input", t), () => e.removeEventListener("input", t);
|
|
506
|
+
}, [M]);
|
|
507
|
+
const Le = c(u);
|
|
508
|
+
w(() => {
|
|
509
|
+
const e = Le.current !== u;
|
|
510
|
+
Le.current = u, (!o || e && !U.current) && m(u);
|
|
511
|
+
}, [u, o]);
|
|
512
|
+
const K = (Z ? k.disabled : !1) || !!V, R = !!ie, ut = (Z ? k.required : !1) || !!ae, je = Z ? k.invalid : !!Ye, ft = je ? "error" : Ge, mt = Z && k.describedBy ? k.describedBy : Je, Re = Y ?? N("inputs.combobox.placeholder", "Search…"), pt = Ne(
|
|
513
|
+
() => (e, t, s) => {
|
|
514
|
+
if (e === oe) return 0;
|
|
515
|
+
if (B.current || u !== "" && t === u) return 1;
|
|
516
|
+
const l = H(e), r = H(t), v = s == null ? void 0 : s.map(H);
|
|
517
|
+
return le ? le(
|
|
518
|
+
l,
|
|
519
|
+
r,
|
|
520
|
+
(v == null ? void 0 : v[0]) ?? ""
|
|
521
|
+
) : Lt(
|
|
522
|
+
l,
|
|
523
|
+
r,
|
|
524
|
+
v
|
|
525
|
+
);
|
|
526
|
+
},
|
|
527
|
+
[le, u]
|
|
528
|
+
), we = (e) => {
|
|
529
|
+
Q(e);
|
|
530
|
+
}, p = (e) => {
|
|
531
|
+
ee || Te(e), I == null || I(e);
|
|
532
|
+
}, bt = (e) => {
|
|
533
|
+
const t = a.find((s) => s.value === e);
|
|
534
|
+
we(e), m((t == null ? void 0 : t.label) ?? ""), p(!1);
|
|
535
|
+
}, vt = (e) => {
|
|
536
|
+
de == null || de(e), p(!1);
|
|
537
|
+
}, ht = () => {
|
|
538
|
+
if (!h) return;
|
|
539
|
+
const e = U.current || !z ? f : "";
|
|
540
|
+
j.current = !0, cancelAnimationFrame(he.current), he.current = requestAnimationFrame(() => {
|
|
541
|
+
document.activeElement === b.current && (j.current = !1);
|
|
542
|
+
}), p(!1), m(u), h.onSelect(e);
|
|
543
|
+
}, gt = (e) => {
|
|
544
|
+
var l;
|
|
545
|
+
const t = H(e.trim());
|
|
546
|
+
if (!t) return;
|
|
547
|
+
const s = Ie ? Ie(e.trim()) : (l = a.find(
|
|
548
|
+
(r) => H(r.value) === t || H(r.label) === t
|
|
549
|
+
)) == null ? void 0 : l.value;
|
|
550
|
+
return a.find((r) => r.value === s && !r.disabled);
|
|
551
|
+
}, xt = (e) => {
|
|
552
|
+
if (!R) {
|
|
553
|
+
if (ye.current) {
|
|
554
|
+
ye.current = !1;
|
|
555
|
+
const t = gt(e);
|
|
556
|
+
if (t) {
|
|
557
|
+
we(t.value), m(t.label), o && p(!1);
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
if (document.activeElement !== b.current) {
|
|
561
|
+
m(u);
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
m(e), U.current = !0, B.current || d == null || d(e), !o && e.length > 0 && !B.current && p(!0);
|
|
566
|
+
}
|
|
567
|
+
}, yt = () => {
|
|
568
|
+
if (j.current) {
|
|
569
|
+
j.current = !1;
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
Ze && !K && !R && p(!0);
|
|
573
|
+
}, Se = c(!1), Rt = () => {
|
|
574
|
+
Se.current = document.activeElement !== b.current;
|
|
575
|
+
}, wt = () => {
|
|
576
|
+
var t;
|
|
577
|
+
j.current = !1;
|
|
578
|
+
const e = Se.current;
|
|
579
|
+
Se.current = !1, e && !R && f !== "" && f === u && ((t = b.current) == null || t.select()), !o && !K && !R && p(!0);
|
|
580
|
+
}, St = () => {
|
|
581
|
+
B.current = !0;
|
|
582
|
+
}, At = () => {
|
|
583
|
+
var t;
|
|
584
|
+
if (B.current = !1, R) return;
|
|
585
|
+
const e = ((t = b.current) == null ? void 0 : t.value) ?? "";
|
|
586
|
+
m(e), U.current = !0, d == null || d(e), e.length > 0 && p(!0);
|
|
587
|
+
}, Nt = (e) => {
|
|
588
|
+
var t;
|
|
589
|
+
if (j.current = !1, !e.nativeEvent.isComposing) {
|
|
590
|
+
if ((e.key === "ArrowDown" || e.key === "ArrowUp") && !o && !K && !R) {
|
|
591
|
+
e.preventDefault(), p(!0);
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
if ((e.key === "Home" || e.key === "End") && !o) {
|
|
595
|
+
e.stopPropagation();
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
if ((e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Home" || e.key === "End" || /* cmdk's own Ctrl+N, J, P and K move the highlight too. */
|
|
599
|
+
e.ctrlKey && ["n", "j", "p", "k"].includes(e.key)) && Ve(), e.key === "Enter" && o && h && !T.current) {
|
|
600
|
+
const s = (t = L.current) == null ? void 0 : t.querySelector(Me);
|
|
601
|
+
if (!s || s.hasAttribute("data-combobox-action")) {
|
|
602
|
+
e.preventDefault();
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
if (e.key === "Enter" && (!o || !T.current && (z || f === ""))) {
|
|
607
|
+
e.preventDefault(), o && p(!1);
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
if (e.key === "Enter" && o && O && !T.current) {
|
|
611
|
+
e.preventDefault();
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
e.key === "Escape" && o && (e.preventDefault(), p(!1), m(u));
|
|
615
|
+
}
|
|
616
|
+
}, kt = (e) => {
|
|
617
|
+
var t;
|
|
618
|
+
e.preventDefault(), e.stopPropagation(), we(""), m(""), d == null || d(""), p(!0), (t = b.current) == null || t.focus();
|
|
619
|
+
}, Et = (e) => {
|
|
620
|
+
R && e || (p(e), e || m(u));
|
|
621
|
+
}, qe = c(g);
|
|
622
|
+
w(() => {
|
|
623
|
+
qe.current = g;
|
|
624
|
+
}, [g]);
|
|
625
|
+
const He = c(f);
|
|
626
|
+
w(() => {
|
|
627
|
+
He.current = f;
|
|
628
|
+
}, [f]);
|
|
629
|
+
const $e = c(o);
|
|
630
|
+
w(() => {
|
|
631
|
+
$e.current = o;
|
|
632
|
+
}, [o]);
|
|
633
|
+
const Ae = G(
|
|
634
|
+
(e) => {
|
|
635
|
+
ee || Te(e), I == null || I(e);
|
|
636
|
+
},
|
|
637
|
+
[ee, I]
|
|
638
|
+
), _t = Ne(
|
|
639
|
+
() => ({
|
|
640
|
+
getValue: () => qe.current || null,
|
|
641
|
+
getQuery: () => He.current,
|
|
642
|
+
getIsOpen: () => $e.current,
|
|
643
|
+
setValue: (e) => {
|
|
644
|
+
const t = e ?? "";
|
|
645
|
+
Q(t);
|
|
646
|
+
const s = a.find((l) => l.value === t);
|
|
647
|
+
m((s == null ? void 0 : s.label) ?? "");
|
|
648
|
+
},
|
|
649
|
+
setQuery: (e) => {
|
|
650
|
+
m(e), d == null || d(e);
|
|
651
|
+
},
|
|
652
|
+
clear: () => {
|
|
653
|
+
Q(""), m(""), d == null || d("");
|
|
654
|
+
},
|
|
655
|
+
open: () => Ae(!0),
|
|
656
|
+
close: () => Ae(!1)
|
|
657
|
+
}),
|
|
658
|
+
[Q, a, Ae, d]
|
|
659
|
+
);
|
|
660
|
+
er(nr, _t, F);
|
|
661
|
+
const Ct = C && !!g && !K && !R, Ft = Ut(a), se = mr[A], Be = N("common.loading", "Loading..."), It = typeof ue == "string" ? ue : N("inputs.combobox.empty", "No results found"), zt = (e) => N("inputs.autocomplete.results", {
|
|
662
|
+
count: e,
|
|
663
|
+
defaultValue: "{{count}} results"
|
|
664
|
+
});
|
|
665
|
+
return /* @__PURE__ */ n(ne.Root, { open: o, onOpenChange: Et, children: /* @__PURE__ */ x(
|
|
666
|
+
S,
|
|
667
|
+
{
|
|
668
|
+
filter: pt,
|
|
669
|
+
shouldFilter: !0,
|
|
670
|
+
loop: !0,
|
|
671
|
+
value: h ? it : void 0,
|
|
672
|
+
onValueChange: h ? at : void 0,
|
|
673
|
+
label: fe ?? (k.label || Re),
|
|
674
|
+
className: "ds:w-full",
|
|
675
|
+
children: [
|
|
676
|
+
/* @__PURE__ */ n(ne.Anchor, { asChild: !0, children: /* @__PURE__ */ x(
|
|
677
|
+
"div",
|
|
678
|
+
{
|
|
679
|
+
ref: me,
|
|
680
|
+
className: ir({
|
|
681
|
+
size: A,
|
|
682
|
+
tone: ft,
|
|
683
|
+
className: Xe
|
|
684
|
+
}),
|
|
685
|
+
"data-component": "combobox",
|
|
686
|
+
"data-component-id": F,
|
|
687
|
+
children: [
|
|
688
|
+
/* @__PURE__ */ n(
|
|
689
|
+
S.Input,
|
|
690
|
+
{
|
|
691
|
+
ref: Bt(et, b),
|
|
692
|
+
value: f,
|
|
693
|
+
onValueChange: xt,
|
|
694
|
+
dir: P == null ? void 0 : P.dir,
|
|
695
|
+
name: ce,
|
|
696
|
+
placeholder: Re,
|
|
697
|
+
disabled: K,
|
|
698
|
+
readOnly: R,
|
|
699
|
+
required: ut,
|
|
700
|
+
autoComplete: J,
|
|
701
|
+
"aria-describedby": mt,
|
|
702
|
+
"aria-invalid": je || void 0,
|
|
703
|
+
onFocus: yt,
|
|
704
|
+
onPointerDown: Rt,
|
|
705
|
+
onClick: wt,
|
|
706
|
+
onKeyDown: Nt,
|
|
707
|
+
onCompositionStart: St,
|
|
708
|
+
onCompositionEnd: At,
|
|
709
|
+
className: or({ size: A })
|
|
710
|
+
}
|
|
711
|
+
),
|
|
712
|
+
Ct ? /* @__PURE__ */ n(
|
|
713
|
+
"button",
|
|
714
|
+
{
|
|
715
|
+
type: "button",
|
|
716
|
+
"aria-label": N("inputs.combobox.clear", "Clear selection"),
|
|
717
|
+
onClick: kt,
|
|
718
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
719
|
+
className: [
|
|
720
|
+
"ds:inline-flex ds:items-center ds:justify-center ds:rounded-[var(--radius-sm)]",
|
|
721
|
+
"ds:text-muted-foreground ds:hover:text-foreground",
|
|
722
|
+
"ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
723
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
|
|
724
|
+
"ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
725
|
+
"ds:size-4 ds:shrink-0",
|
|
726
|
+
/* A 24px hit area with no visual change. */
|
|
727
|
+
"ds:relative ds:before:absolute ds:before:inset-[calc(var(--spacing-xs)*-1)] ds:before:content-['']"
|
|
728
|
+
].join(" "),
|
|
729
|
+
children: /* @__PURE__ */ n(rr, { "aria-hidden": "true", className: "ds:size-3.5" })
|
|
730
|
+
}
|
|
731
|
+
) : null,
|
|
732
|
+
O !== void 0 || h ? (
|
|
733
|
+
// In place before it changes, so the change is announced.
|
|
734
|
+
/* @__PURE__ */ n(
|
|
735
|
+
vr,
|
|
736
|
+
{
|
|
737
|
+
loading: !!O,
|
|
738
|
+
open: o,
|
|
739
|
+
announceEmpty: !!h && f !== "" && !z,
|
|
740
|
+
loadingLabel: Be,
|
|
741
|
+
emptyLabel: It,
|
|
742
|
+
resultsLabel: zt
|
|
743
|
+
}
|
|
744
|
+
)
|
|
745
|
+
) : null
|
|
746
|
+
]
|
|
747
|
+
}
|
|
748
|
+
) }),
|
|
749
|
+
/* @__PURE__ */ n(ne.Portal, { forceMount: !0, children: o ? /* @__PURE__ */ n(
|
|
750
|
+
ne.Content,
|
|
751
|
+
{
|
|
752
|
+
"aria-labelledby": $,
|
|
753
|
+
"aria-label": $ ? void 0 : fe ?? N("inputs.combobox.popupLabel", "Options"),
|
|
754
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
755
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
756
|
+
onInteractOutside: (e) => {
|
|
757
|
+
var s;
|
|
758
|
+
const t = e.target;
|
|
759
|
+
t && ((s = me.current) != null && s.contains(t)) && e.preventDefault();
|
|
760
|
+
},
|
|
761
|
+
sideOffset: 4,
|
|
762
|
+
align: "start",
|
|
763
|
+
dir: ct,
|
|
764
|
+
className: ar({ popoverSize: Qe }),
|
|
765
|
+
children: /* @__PURE__ */ x(
|
|
766
|
+
S.List,
|
|
767
|
+
{
|
|
768
|
+
ref: dt,
|
|
769
|
+
label: fe ?? (k.label || Re),
|
|
770
|
+
"aria-labelledby": $,
|
|
771
|
+
className: lr({ withAction: !!h }),
|
|
772
|
+
"aria-busy": O || void 0,
|
|
773
|
+
onPointerMoveCapture: (e) => {
|
|
774
|
+
var t, s;
|
|
775
|
+
ve.current || (s = (t = e.target).closest) != null && s.call(t, br) && Ve();
|
|
776
|
+
},
|
|
777
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
778
|
+
children: [
|
|
779
|
+
O ? /* @__PURE__ */ n(hr, { label: Be }) : /* @__PURE__ */ n(S.Empty, { className: fr, children: /* @__PURE__ */ n(
|
|
780
|
+
"div",
|
|
781
|
+
{
|
|
782
|
+
role: "option",
|
|
783
|
+
"aria-selected": !1,
|
|
784
|
+
"aria-disabled": "true",
|
|
785
|
+
children: ue ?? N("inputs.combobox.empty", "No results found")
|
|
786
|
+
}
|
|
787
|
+
) }),
|
|
788
|
+
Ft.map(({ group: e, items: t }, s) => {
|
|
789
|
+
const l = t.map((r) => {
|
|
790
|
+
const v = r.value === g;
|
|
791
|
+
return /* @__PURE__ */ x(
|
|
792
|
+
S.Item,
|
|
793
|
+
{
|
|
794
|
+
value: r.value,
|
|
795
|
+
"data-option-id": r.value,
|
|
796
|
+
keywords: [r.label],
|
|
797
|
+
disabled: r.disabled,
|
|
798
|
+
onSelect: bt,
|
|
799
|
+
className: Ce({ size: A }),
|
|
800
|
+
children: [
|
|
801
|
+
/* @__PURE__ */ n(
|
|
802
|
+
"span",
|
|
803
|
+
{
|
|
804
|
+
"aria-hidden": "true",
|
|
805
|
+
className: `ds:inline-flex ds:items-center ds:justify-center ${se}`,
|
|
806
|
+
children: v ? /* @__PURE__ */ n(sr, { className: se }) : null
|
|
807
|
+
}
|
|
808
|
+
),
|
|
809
|
+
r.startAdornment ? (
|
|
810
|
+
// Decorative by contract — the option's accessible
|
|
811
|
+
// name comes from its label. Hide so a text-bearing
|
|
812
|
+
// adornment can't leak into the computed name.
|
|
813
|
+
/* @__PURE__ */ n(
|
|
814
|
+
"span",
|
|
815
|
+
{
|
|
816
|
+
"aria-hidden": "true",
|
|
817
|
+
className: "ds:inline-flex ds:items-center ds:shrink-0",
|
|
818
|
+
children: r.startAdornment
|
|
819
|
+
}
|
|
820
|
+
)
|
|
821
|
+
) : null,
|
|
822
|
+
r.description || ze ? (
|
|
823
|
+
// Stacked: the label and its end content on one
|
|
824
|
+
// row, the description on a line of its own
|
|
825
|
+
// under them. In this DOM order the option's
|
|
826
|
+
// name reads label, end content, description.
|
|
827
|
+
/* @__PURE__ */ x(
|
|
828
|
+
"span",
|
|
829
|
+
{
|
|
830
|
+
className: `${Kt} ds:py-[var(--spacing-xs)]`,
|
|
831
|
+
children: [
|
|
832
|
+
/* @__PURE__ */ x("span", { className: Gt, children: [
|
|
833
|
+
/* @__PURE__ */ n(
|
|
834
|
+
"span",
|
|
835
|
+
{
|
|
836
|
+
dir: r.dir,
|
|
837
|
+
className: Wt({
|
|
838
|
+
wrap: ze,
|
|
839
|
+
className: "ds:flex-1"
|
|
840
|
+
}),
|
|
841
|
+
children: r.label
|
|
842
|
+
}
|
|
843
|
+
),
|
|
844
|
+
r.endContent ? (
|
|
845
|
+
// Announced, as below.
|
|
846
|
+
/* @__PURE__ */ n("span", { className: Xt, children: r.endContent })
|
|
847
|
+
) : null
|
|
848
|
+
] }),
|
|
849
|
+
r.description ? /* @__PURE__ */ n(
|
|
850
|
+
"span",
|
|
851
|
+
{
|
|
852
|
+
className: Yt({
|
|
853
|
+
tone: r.descriptionTone
|
|
854
|
+
}),
|
|
855
|
+
children: r.description
|
|
856
|
+
}
|
|
857
|
+
) : null
|
|
858
|
+
]
|
|
859
|
+
}
|
|
860
|
+
)
|
|
861
|
+
) : /* @__PURE__ */ x(Vt, { children: [
|
|
862
|
+
/* @__PURE__ */ n(
|
|
863
|
+
"span",
|
|
864
|
+
{
|
|
865
|
+
dir: r.dir,
|
|
866
|
+
className: "ds:flex-1 ds:truncate",
|
|
867
|
+
children: r.label
|
|
868
|
+
}
|
|
869
|
+
),
|
|
870
|
+
r.endContent ? (
|
|
871
|
+
// Deliberately NOT aria-hidden — unlike
|
|
872
|
+
// `startAdornment`, this slot carries meaning
|
|
873
|
+
// (a price, a count) and must reach the
|
|
874
|
+
// option's accessible name. `ms-auto` pins it
|
|
875
|
+
// to the inline-end and flips under RTL.
|
|
876
|
+
/* @__PURE__ */ n("span", { className: "ds:inline-flex ds:items-center ds:ms-auto ds:shrink-0", children: r.endContent })
|
|
877
|
+
) : null
|
|
878
|
+
] })
|
|
879
|
+
]
|
|
880
|
+
},
|
|
881
|
+
`${r.value}\0${r.label}`
|
|
882
|
+
);
|
|
883
|
+
});
|
|
884
|
+
return e ? /* @__PURE__ */ n(
|
|
885
|
+
S.Group,
|
|
886
|
+
{
|
|
887
|
+
heading: /* @__PURE__ */ n("span", { className: cr, children: e }),
|
|
888
|
+
children: l
|
|
889
|
+
},
|
|
890
|
+
`group-${e}`
|
|
891
|
+
) : /* @__PURE__ */ n(S.Group, { children: l }, `group-${s}`);
|
|
892
|
+
}),
|
|
893
|
+
We && f.length > 0 && !O ? /* @__PURE__ */ n(
|
|
894
|
+
pr,
|
|
895
|
+
{
|
|
896
|
+
search: f,
|
|
897
|
+
label: N("inputs.combobox.create", 'Create "{{value}}"', {
|
|
898
|
+
value: f
|
|
899
|
+
}),
|
|
900
|
+
iconClass: se,
|
|
901
|
+
size: A,
|
|
902
|
+
onSelect: vt
|
|
903
|
+
}
|
|
904
|
+
) : null,
|
|
905
|
+
h ? /* @__PURE__ */ n(
|
|
906
|
+
gr,
|
|
907
|
+
{
|
|
908
|
+
action: h,
|
|
909
|
+
iconClass: se,
|
|
910
|
+
size: A,
|
|
911
|
+
onSelect: ht
|
|
912
|
+
}
|
|
913
|
+
) : null
|
|
914
|
+
]
|
|
915
|
+
},
|
|
916
|
+
nt
|
|
917
|
+
)
|
|
918
|
+
}
|
|
919
|
+
) : null })
|
|
920
|
+
]
|
|
921
|
+
}
|
|
922
|
+
) });
|
|
923
|
+
}
|
|
924
|
+
);
|
|
925
|
+
Ke.displayName = "Combobox";
|
|
926
|
+
const Pr = Ke;
|
|
927
|
+
export {
|
|
928
|
+
Pr as C,
|
|
929
|
+
ar as a,
|
|
930
|
+
or as b,
|
|
931
|
+
nr as c,
|
|
932
|
+
Ce as d,
|
|
933
|
+
ir as e
|
|
934
|
+
};
|
|
935
|
+
//# sourceMappingURL=combobox-BBCVQS-S.js.map
|