@nubisco/ui 4.1.4 → 5.1.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/{AiLabel-VbZiFHAZ.js → AiLabel-Ci7eROcw.js} +1 -1
- package/dist/{AiLabel-DZ9GkGqL.cjs → AiLabel-DtM5ZCQC.cjs} +1 -1
- package/dist/{Banner-7XsX8ibI.js → Banner-C5Erb75B.js} +1 -1
- package/dist/{Banner-DI5fA8Ow.cjs → Banner-JubX-4yR.cjs} +1 -1
- package/dist/{BlueprintControls-CJAKrQ6U.js → BlueprintControls-BkwhsHI8.js} +1 -1
- package/dist/{BlueprintControls-aF11uokn.cjs → BlueprintControls-CdvNvRkW.cjs} +1 -1
- package/dist/{BlueprintMinimap-C-gCkMIW.cjs → BlueprintMinimap-BIBsnBFs.cjs} +1 -1
- package/dist/{BlueprintMinimap-C-65UzhM.js → BlueprintMinimap-QAw6aiCc.js} +1 -1
- package/dist/{BottomPanel-B-dhgMWB.js → BottomPanel-BoBCdANz.js} +1 -1
- package/dist/{BottomPanel-CmVH0Hsf.cjs → BottomPanel-dbllmH2v.cjs} +1 -1
- package/dist/Button-Dwv0rx46.cjs +1 -0
- package/dist/{Button-Cegx6vaT.js → Button-Q8MBLMvG.js} +12 -4
- package/dist/{Card-Cs-7jXxG.cjs → Card-Cn5OS4q-.cjs} +1 -1
- package/dist/{Card-TjV_N8RU.js → Card-eM6DEphF.js} +1 -1
- package/dist/{Checkbox-BJrnykX9.js → Checkbox-DG82KK8V.js} +1 -1
- package/dist/{Checkbox-D9qW3gph.cjs → Checkbox-vFN3fLyr.cjs} +1 -1
- package/dist/{CheckboxGroup-CUSPscyy.js → CheckboxGroup-5pmdu9fe.js} +1 -1
- package/dist/{CheckboxGroup-mWcKUeq9.cjs → CheckboxGroup-Cyj2NUtI.cjs} +1 -1
- package/dist/{ColorStrip-CR1JDzwX.js → ColorStrip-BBTJU1Ox.js} +47 -45
- package/dist/ColorStrip-D3nbTyfs.cjs +1 -0
- package/dist/CommandPalette-CPJKTiDt.cjs +1 -0
- package/dist/CommandPalette-iaEdat_y.js +223 -0
- package/dist/{Confirm-pgn2HajX.js → Confirm-C-HRTF0s.js} +23 -52
- package/dist/Confirm-w3Ig0L5j.cjs +1 -0
- package/dist/{DataTable-c0ltF6wT.js → DataTable-BVxSUB-h.js} +3 -3
- package/dist/{DataTable-BbiDmA1X.cjs → DataTable-Cnyh04sD.cjs} +1 -1
- package/dist/{DatePicker-YJ8-ViVK.js → DatePicker-BimOzKti.js} +1 -1
- package/dist/{DatePicker-C8_qR25v.cjs → DatePicker-CMPgr4Hp.cjs} +1 -1
- package/dist/{EmptyState-DVg8l-bl.js → EmptyState-CwMG-NeI.js} +1 -1
- package/dist/{EmptyState-henL7JH6.cjs → EmptyState-Cz91HAKF.cjs} +1 -1
- package/dist/{FileUploader-Lzy4bFn7.cjs → FileUploader-BJdRC-Kp.cjs} +1 -1
- package/dist/{FileUploader-BLwR6H3f.js → FileUploader-BO2cDUwP.js} +2 -2
- package/dist/{ImageCropper-CpEGFPKb.cjs → ImageCropper-D7mr-xRE.cjs} +1 -1
- package/dist/{ImageCropper-BX2BnJai.js → ImageCropper-DEaGU0cZ.js} +1 -1
- package/dist/{InfoHint-DesESwdO.cjs → InfoHint-BNpqLVSX.cjs} +1 -1
- package/dist/{InfoHint-JwhhBFZP.js → InfoHint-C663u_NL.js} +1 -1
- package/dist/{InlineEdit-CZEt1vhH.cjs → InlineEdit-D95I45Vt.cjs} +1 -1
- package/dist/{InlineEdit-DNMF_40m.js → InlineEdit-DrhJ0AX2.js} +1 -1
- package/dist/{Message-Daj6hLC4.cjs → Message-Ax7rnAQl.cjs} +1 -1
- package/dist/{Message-BuG5t7bu.js → Message-DqUW3GHc.js} +1 -1
- package/dist/Modal-B1CQyPNo.js +206 -0
- package/dist/Modal-DvukGfHg.cjs +1 -0
- package/dist/{NotificationCenter-DL_Tshyb.js → NotificationCenter-Duu3XZC3.js} +3 -3
- package/dist/{NotificationCenter-D51ty3Lq.cjs → NotificationCenter-oOzClQI-.cjs} +1 -1
- package/dist/{NumberInput-Vc2wzK62.cjs → NumberInput-DKZsdWLv.cjs} +1 -1
- package/dist/{NumberInput-6R8FkJc-.js → NumberInput-_ff3Xi2r.js} +2 -2
- package/dist/{Pagination-B6a62qvI.js → Pagination-6bF88x_p.js} +3 -3
- package/dist/{Pagination-CkBe9Naz.cjs → Pagination-EipK6BGe.cjs} +1 -1
- package/dist/{Panel-BVtGI7YH.js → Panel-D3s_MKfd.js} +1 -1
- package/dist/{Panel-DQfmVtie.cjs → Panel-qDfyu_0v.cjs} +1 -1
- package/dist/{ProgressBar-fAaKT9lD.cjs → ProgressBar-CbqsSdZZ.cjs} +1 -1
- package/dist/{ProgressBar-DjejtCKA.js → ProgressBar-aF2zBoRA.js} +2 -2
- package/dist/{Radio-CQveGtXr.js → Radio-BnI7bi9Y.js} +2 -2
- package/dist/{Radio-DSvkUCxV.cjs → Radio-BqjtCaST.cjs} +1 -1
- package/dist/{ReorderList-Bai4yaIG.cjs → ReorderList-DLQ3rVnX.cjs} +1 -1
- package/dist/{ReorderList-Be-qicSf.js → ReorderList-DpytAupm.js} +1 -1
- package/dist/{Select-swFFQIMN.js → Select-B5t5QtVe.js} +1 -1
- package/dist/{Select-ClCyOqQI.cjs → Select-dAYn2iZO.cjs} +1 -1
- package/dist/{Shell-B8YmApR6.cjs → Shell-9lzopP-w.cjs} +1 -1
- package/dist/{Shell-Dr7LHIqk.js → Shell-B3jhTiNP.js} +99 -96
- package/dist/{ShellPanel-I0ZMGQ4K.js → ShellPanel-B3vZcQhX.js} +1 -1
- package/dist/{ShellPanel-CnN9orWH.cjs → ShellPanel-ChujN0eX.cjs} +1 -1
- package/dist/{SidebarLink-y2If8dtl.js → SidebarLink-B_CGHs0b.js} +1 -1
- package/dist/{SidebarLink-CngTvuB6.cjs → SidebarLink-CZrDLC8g.cjs} +1 -1
- package/dist/{SidebarMenuItem-DoyuIs3w.cjs → SidebarMenuItem-Dc6oh2Nc.cjs} +1 -1
- package/dist/{SidebarMenuItem-DBINoxeA.js → SidebarMenuItem-Dpqr9e0A.js} +1 -1
- package/dist/{Skeleton-D8CHd_4p.cjs → Skeleton-DP9iM6Ku.cjs} +1 -1
- package/dist/{Skeleton-CC7LVdxd.js → Skeleton-sox6qUDk.js} +1 -1
- package/dist/Slider-BNiQaaVa.cjs +1 -0
- package/dist/{Slider-lOhGG7UX.js → Slider-C0761rBk.js} +47 -33
- package/dist/{StepperStep-w1SSX7t7.cjs → StepperStep-B9JEE6WJ.cjs} +1 -1
- package/dist/{StepperStep-DNXUj71b.js → StepperStep-DFeOJ1ju.js} +1 -1
- package/dist/{Tabs-W_4iyGVx.js → Tabs-CQP9zwDw.js} +1 -1
- package/dist/{Tabs-Clg7lzy5.cjs → Tabs-Dp27EDrK.cjs} +1 -1
- package/dist/{TextInput-CGD_wFwo.cjs → TextInput-D4jBlYm9.cjs} +2 -2
- package/dist/{TextInput-CxC2HVj6.js → TextInput-DNrd12uS.js} +2 -2
- package/dist/{Toast-DueO27yl.cjs → Toast-BBsrCQK8.cjs} +1 -1
- package/dist/{Toast-QXobTGZM.js → Toast-cisfK5Zd.js} +1 -1
- package/dist/{Toaster-DcA6PJPt.js → Toaster-C1Uyr6O7.js} +1 -1
- package/dist/{Toaster-DY8o_iiy.cjs → Toaster-Dz_o--LF.cjs} +1 -1
- package/dist/{TreeNode-DS1XJGty.cjs → TreeNode-DB7ipWCg.cjs} +1 -1
- package/dist/{TreeNode-BI-Azvhe.js → TreeNode-a0MHLI27.js} +1 -1
- package/dist/{Walkthrough-DHtLDsOk.cjs → Walkthrough-YD3YYxxM.cjs} +1 -1
- package/dist/{Walkthrough-l7HOZths.js → Walkthrough-qaQ1rved.js} +2 -2
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +137 -135
- package/dist/component-styles.json +1 -1
- package/dist/components/AiLabel.cjs +1 -1
- package/dist/components/AiLabel.mjs +1 -1
- package/dist/components/AiLabel.vue.d.ts.map +1 -1
- package/dist/components/Banner.cjs +1 -1
- package/dist/components/Banner.mjs +1 -1
- package/dist/components/Banner.vue.d.ts.map +1 -1
- package/dist/components/BlueprintControls.cjs +1 -1
- package/dist/components/BlueprintControls.mjs +1 -1
- package/dist/components/BlueprintMinimap.cjs +1 -1
- package/dist/components/BlueprintMinimap.mjs +1 -1
- package/dist/components/BlueprintMinimap.vue.d.ts.map +1 -1
- package/dist/components/Board.vue.d.ts.map +1 -1
- package/dist/components/BottomPanel.cjs +1 -1
- package/dist/components/BottomPanel.mjs +1 -1
- package/dist/components/BottomPanel.vue.d.ts.map +1 -1
- package/dist/components/Button.cjs +1 -1
- package/dist/components/Button.d.ts +25 -1
- package/dist/components/Button.mjs +1 -1
- package/dist/components/Button.vue.d.ts +1 -1
- package/dist/components/Button.vue.d.ts.map +1 -1
- package/dist/components/Calendar.vue.d.ts.map +1 -1
- package/dist/components/Card.cjs +1 -1
- package/dist/components/Card.mjs +1 -1
- package/dist/components/Card.vue.d.ts.map +1 -1
- package/dist/components/Checkbox.cjs +1 -1
- package/dist/components/Checkbox.mjs +1 -1
- package/dist/components/Checkbox.vue.d.ts.map +1 -1
- package/dist/components/CheckboxGroup.cjs +1 -1
- package/dist/components/CheckboxGroup.mjs +1 -1
- package/dist/components/ColorStrip.cjs +1 -1
- package/dist/components/ColorStrip.mjs +1 -1
- package/dist/components/ColorStrip.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette.cjs +1 -1
- package/dist/components/CommandPalette.d.ts +28 -0
- package/dist/components/CommandPalette.mjs +1 -1
- package/dist/components/CommandPalette.vue.d.ts +2 -0
- package/dist/components/CommandPalette.vue.d.ts.map +1 -1
- package/dist/components/Confirm.cjs +1 -1
- package/dist/components/Confirm.mjs +1 -1
- package/dist/components/Confirm.vue.d.ts +1 -1
- package/dist/components/Confirm.vue.d.ts.map +1 -1
- package/dist/components/DataTable.cjs +1 -1
- package/dist/components/DataTable.mjs +1 -1
- package/dist/components/DataTable.vue.d.ts.map +1 -1
- package/dist/components/DatePicker.cjs +1 -1
- package/dist/components/DatePicker.mjs +1 -1
- package/dist/components/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/EmptyState.cjs +1 -1
- package/dist/components/EmptyState.mjs +1 -1
- package/dist/components/EmptyState.vue.d.ts.map +1 -1
- package/dist/components/FileUploader.cjs +1 -1
- package/dist/components/FileUploader.mjs +1 -1
- package/dist/components/FileUploader.vue.d.ts.map +1 -1
- package/dist/components/ImageCropper.cjs +1 -1
- package/dist/components/ImageCropper.mjs +1 -1
- package/dist/components/ImageCropper.vue.d.ts.map +1 -1
- package/dist/components/InfoHint.cjs +1 -1
- package/dist/components/InfoHint.mjs +1 -1
- package/dist/components/InfoHint.vue.d.ts.map +1 -1
- package/dist/components/InlineEdit.cjs +1 -1
- package/dist/components/InlineEdit.mjs +1 -1
- package/dist/components/InlineEdit.vue.d.ts.map +1 -1
- package/dist/components/Menu.vue.d.ts.map +1 -1
- package/dist/components/MenuItem.vue.d.ts.map +1 -1
- package/dist/components/Message.cjs +1 -1
- package/dist/components/Message.mjs +1 -1
- package/dist/components/Message.vue.d.ts.map +1 -1
- package/dist/components/Modal.cjs +1 -1
- package/dist/components/Modal.d.ts +39 -0
- package/dist/components/Modal.mjs +1 -1
- package/dist/components/Modal.vue.d.ts +3 -0
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter.mjs +1 -1
- package/dist/components/NotificationCenter.vue.d.ts.map +1 -1
- package/dist/components/NotificationCenterItem.vue.d.ts.map +1 -1
- package/dist/components/NumberInput.cjs +1 -1
- package/dist/components/NumberInput.mjs +1 -1
- package/dist/components/NumberInput.vue.d.ts.map +1 -1
- package/dist/components/Pagination.cjs +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Pagination.vue.d.ts.map +1 -1
- package/dist/components/Panel.cjs +1 -1
- package/dist/components/Panel.mjs +1 -1
- package/dist/components/Panel.vue.d.ts.map +1 -1
- package/dist/components/ProgressBar.cjs +1 -1
- package/dist/components/ProgressBar.mjs +1 -1
- package/dist/components/ProgressBar.vue.d.ts.map +1 -1
- package/dist/components/Radio.cjs +1 -1
- package/dist/components/Radio.mjs +1 -1
- package/dist/components/Radio.vue.d.ts.map +1 -1
- package/dist/components/ReorderList.cjs +1 -1
- package/dist/components/ReorderList.mjs +1 -1
- package/dist/components/ReorderList.vue.d.ts.map +1 -1
- package/dist/components/Select.cjs +1 -1
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Select.vue.d.ts.map +1 -1
- package/dist/components/Shell.cjs +1 -1
- package/dist/components/Shell.mjs +1 -1
- package/dist/components/Shell.vue.d.ts.map +1 -1
- package/dist/components/ShellPanel.cjs +1 -1
- package/dist/components/ShellPanel.mjs +1 -1
- package/dist/components/ShellPanel.vue.d.ts.map +1 -1
- package/dist/components/SidebarLink.cjs +1 -1
- package/dist/components/SidebarLink.mjs +1 -1
- package/dist/components/SidebarLink.vue.d.ts.map +1 -1
- package/dist/components/SidebarMenuItem.cjs +1 -1
- package/dist/components/SidebarMenuItem.mjs +1 -1
- package/dist/components/SidebarMenuItem.vue.d.ts.map +1 -1
- package/dist/components/Skeleton.cjs +1 -1
- package/dist/components/Skeleton.mjs +1 -1
- package/dist/components/Skeleton.vue.d.ts.map +1 -1
- package/dist/components/Slider.cjs +1 -1
- package/dist/components/Slider.d.ts +8 -0
- package/dist/components/Slider.mjs +1 -1
- package/dist/components/Slider.vue.d.ts +1 -0
- package/dist/components/Slider.vue.d.ts.map +1 -1
- package/dist/components/StepperStep.cjs +1 -1
- package/dist/components/StepperStep.mjs +1 -1
- package/dist/components/StepperStep.vue.d.ts.map +1 -1
- package/dist/components/Tabs.cjs +1 -1
- package/dist/components/Tabs.mjs +1 -1
- package/dist/components/Tabs.vue.d.ts.map +1 -1
- package/dist/components/TextInput.cjs +1 -1
- package/dist/components/TextInput.mjs +1 -1
- package/dist/components/TextInput.vue.d.ts.map +1 -1
- package/dist/components/Toast.cjs +1 -1
- package/dist/components/Toast.mjs +1 -1
- package/dist/components/Toast.vue.d.ts.map +1 -1
- package/dist/components/Toaster.cjs +1 -1
- package/dist/components/Toaster.mjs +1 -1
- package/dist/components/TreeNode.cjs +1 -1
- package/dist/components/TreeNode.mjs +1 -1
- package/dist/components/TreeNode.vue.d.ts.map +1 -1
- package/dist/components/UserMenu.vue.d.ts.map +1 -1
- package/dist/components/Walkthrough.cjs +1 -1
- package/dist/components/Walkthrough.mjs +1 -1
- package/dist/components/Walkthrough.vue.d.ts.map +1 -1
- package/dist/composables/useAppearance.composable.cjs +1 -0
- package/dist/composables/useAppearance.composable.d.ts +131 -0
- package/dist/composables/useAppearance.composable.d.ts.map +1 -0
- package/dist/composables/useAppearance.composable.mjs +65 -0
- package/dist/composables/useConfirm.composable.cjs +1 -1
- package/dist/composables/useConfirm.composable.mjs +2 -1
- package/dist/composables/useFocusTrap.composable.cjs +1 -0
- package/dist/composables/useFocusTrap.composable.d.ts +91 -0
- package/dist/composables/useFocusTrap.composable.d.ts.map +1 -0
- package/dist/composables/useFocusTrap.composable.mjs +98 -0
- package/dist/composables/useNamedTheme.composable.cjs +1 -0
- package/dist/composables/useNamedTheme.composable.d.ts +98 -0
- package/dist/composables/useNamedTheme.composable.d.ts.map +1 -0
- package/dist/composables/useNamedTheme.composable.mjs +68 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +45 -43
- package/dist/main.d.ts +5 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/plugins/vite/index.d.ts.map +1 -1
- package/dist/plugins/vite/index.js +59 -0
- package/dist/styles/AiLabel.css +1 -1
- package/dist/styles/Banner.css +1 -1
- package/dist/styles/BlueprintMinimap.css +1 -1
- package/dist/styles/Board.css +1 -1
- package/dist/styles/BottomPanel.css +1 -1
- package/dist/styles/Button.css +1 -1
- package/dist/styles/Calendar.css +1 -1
- package/dist/styles/Card.css +1 -1
- package/dist/styles/Checkbox.css +1 -1
- package/dist/styles/ColorStrip.css +1 -1
- package/dist/styles/CommandPalette.css +1 -1
- package/dist/styles/Confirm.css +1 -1
- package/dist/styles/DataTable.css +1 -1
- package/dist/styles/DatePicker.css +1 -1
- package/dist/styles/EmptyState.css +1 -1
- package/dist/styles/FileUploader.css +1 -1
- package/dist/styles/ImageCropper.css +1 -1
- package/dist/styles/InfoHint.css +1 -1
- package/dist/styles/InlineEdit.css +1 -1
- package/dist/styles/Menu.css +1 -1
- package/dist/styles/MenuItem.css +1 -1
- package/dist/styles/Message.css +1 -1
- package/dist/styles/Modal.css +1 -1
- package/dist/styles/NotificationCenter.css +1 -1
- package/dist/styles/NotificationCenterItem.css +1 -1
- package/dist/styles/NumberInput.css +1 -1
- package/dist/styles/Pagination.css +1 -1
- package/dist/styles/Panel.css +1 -1
- package/dist/styles/ProgressBar.css +1 -1
- package/dist/styles/Radio.css +1 -1
- package/dist/styles/ReorderList.css +1 -1
- package/dist/styles/Select.css +1 -1
- package/dist/styles/Shell.css +1 -1
- package/dist/styles/ShellPanel.css +1 -1
- package/dist/styles/SidebarLink.css +1 -1
- package/dist/styles/SidebarMenuItem.css +1 -1
- package/dist/styles/Skeleton.css +1 -1
- package/dist/styles/Slider.css +1 -1
- package/dist/styles/StepperStep.css +1 -1
- package/dist/styles/Tabs.css +1 -1
- package/dist/styles/TextInput.css +1 -1
- package/dist/styles/Toast.css +1 -1
- package/dist/styles/TreeNode.css +1 -1
- package/dist/styles/UserMenu.css +1 -1
- package/dist/styles/Walkthrough.css +1 -1
- package/dist/ui.css +45 -45
- package/package.json +7 -4
- package/src/plugins/vite/index.ts +62 -0
- package/src/styles/_appearance.scss +144 -0
- package/src/styles/_theme-api.scss +193 -0
- package/src/styles/_theme.scss +91 -5
- package/src/styles/index.scss +8 -0
- package/src/styles/logic/_radius.scss +146 -0
- package/src/styles/logic/index.scss +1 -0
- package/src/styles/presets/_classic-fields.scss +55 -0
- package/dist/Button-Dqtcr4i0.cjs +0 -1
- package/dist/ColorStrip-CAcR1O_R.cjs +0 -1
- package/dist/CommandPalette-BNXzQurN.js +0 -174
- package/dist/CommandPalette-DBjeOPtA.cjs +0 -1
- package/dist/Confirm-CW160zEF.cjs +0 -1
- package/dist/Modal-8lgeNWj8.cjs +0 -1
- package/dist/Modal-iN94HtKE.js +0 -156
- package/dist/Slider-CxrK7cAU.cjs +0 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { NB_COMMAND_PALETTE_KEY as e } from "./composables/useCommandPalette.composable.mjs";
|
|
2
|
+
import { t } from "./Icon-rREAqsu0.js";
|
|
3
|
+
import { useScrollLock as n } from "./composables/useScrollLock.composable.mjs";
|
|
4
|
+
import { Fragment as r, Teleport as i, Transition as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, inject as p, nextTick as m, normalizeClass as h, onBeforeUnmount as g, onMounted as _, openBlock as v, ref as y, renderList as b, toDisplayString as x, unref as S, vModelText as C, watch as w, withCtx as T, withDirectives as E, withModifiers as D } from "vue";
|
|
5
|
+
import { regular as O } from "@nubisco/ui/icons/magnifying-glass";
|
|
6
|
+
//#region src/components/CommandPalette.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var ee = { class: "nb-command-palette__input-row" }, te = ["placeholder"], ne = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "nb-command-palette__results"
|
|
10
|
+
}, k = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "nb-command-palette__group-header"
|
|
13
|
+
}, A = ["onClick", "onMouseenter"], re = { class: "nb-command-palette__item-label" }, ie = {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: "nb-command-palette__item-shortcut"
|
|
16
|
+
}, j = {
|
|
17
|
+
key: 1,
|
|
18
|
+
class: "nb-command-palette__empty"
|
|
19
|
+
}, M = {
|
|
20
|
+
key: 2,
|
|
21
|
+
class: "nb-command-palette__empty"
|
|
22
|
+
}, N = {
|
|
23
|
+
key: 3,
|
|
24
|
+
class: "nb-command-palette__empty"
|
|
25
|
+
}, P = /* @__PURE__ */ f({
|
|
26
|
+
__name: "CommandPalette",
|
|
27
|
+
props: {
|
|
28
|
+
openShortcut: { default: "Meta+k" },
|
|
29
|
+
placeholder: { default: "Search commands..." },
|
|
30
|
+
maxResults: { default: 50 },
|
|
31
|
+
suggest: {
|
|
32
|
+
type: Function,
|
|
33
|
+
default: void 0
|
|
34
|
+
},
|
|
35
|
+
suggestDebounce: { default: 150 }
|
|
36
|
+
},
|
|
37
|
+
setup(f) {
|
|
38
|
+
let { lock: P, unlock: F } = n(), I = f, L = p(e), R = y(null), z = y(""), B = y(null), V = y([]), H = y(!1), U = null, W = 0;
|
|
39
|
+
function G() {
|
|
40
|
+
U !== null && (clearTimeout(U), U = null);
|
|
41
|
+
}
|
|
42
|
+
function K() {
|
|
43
|
+
G(), W++, V.value = [], H.value = !1;
|
|
44
|
+
}
|
|
45
|
+
async function q(e) {
|
|
46
|
+
let t = I.suggest;
|
|
47
|
+
if (!t) return;
|
|
48
|
+
let n = ++W;
|
|
49
|
+
H.value = !0;
|
|
50
|
+
try {
|
|
51
|
+
let r = await t(e);
|
|
52
|
+
if (n !== W) return;
|
|
53
|
+
V.value = r;
|
|
54
|
+
} catch {
|
|
55
|
+
n === W && (V.value = []);
|
|
56
|
+
} finally {
|
|
57
|
+
n === W && (H.value = !1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
w(z, (e) => {
|
|
61
|
+
if (!I.suggest) return;
|
|
62
|
+
G();
|
|
63
|
+
let t = e.trim();
|
|
64
|
+
if (!t) {
|
|
65
|
+
K();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
H.value = !0, U = setTimeout(() => void q(t), I.suggestDebounce);
|
|
69
|
+
});
|
|
70
|
+
function J(e, t) {
|
|
71
|
+
let n = e.toLowerCase(), r = t.toLowerCase();
|
|
72
|
+
if (n.startsWith(r)) return 1e3 + r.length / n.length * 100;
|
|
73
|
+
if (n.split(/[\s\-_./]+/).some((e) => e.startsWith(r))) return 500;
|
|
74
|
+
let i = n.indexOf(r);
|
|
75
|
+
if (i >= 0) return 300 - i;
|
|
76
|
+
let a = 0, o = 0;
|
|
77
|
+
for (let e = 0; e < n.length && a < r.length; e++) n[e] === r[a] && (o += 10, e > 0 && n[e - 1] === (a > 0 ? r[a - 1] : "") && (o += 5), a++);
|
|
78
|
+
return a === r.length ? o : -1;
|
|
79
|
+
}
|
|
80
|
+
function ae(e, t) {
|
|
81
|
+
let n = J(e.label, t);
|
|
82
|
+
if (e.namespace && (n = Math.max(n, J(e.namespace, t) * .8)), e.keywords) for (let r of e.keywords) n = Math.max(n, J(r, t) * .7);
|
|
83
|
+
return n;
|
|
84
|
+
}
|
|
85
|
+
let oe = o(() => {
|
|
86
|
+
let e = Array.from(L.commands.values()).filter((e) => !e.context || e.context === L.activeContext);
|
|
87
|
+
return z.value ? e.map((e) => ({
|
|
88
|
+
cmd: e,
|
|
89
|
+
score: ae(e, z.value)
|
|
90
|
+
})).filter((e) => e.score > 0).sort((e, t) => t.score - e.score).slice(0, I.maxResults).map((e) => e.cmd) : e.slice(0, I.maxResults);
|
|
91
|
+
}), Y = o(() => {
|
|
92
|
+
let e = /* @__PURE__ */ new Map();
|
|
93
|
+
for (let t of oe.value) {
|
|
94
|
+
let n = t.namespace ?? "";
|
|
95
|
+
e.has(n) || e.set(n, []), e.get(n).push(t);
|
|
96
|
+
}
|
|
97
|
+
let t = Array.from(e.entries()).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => ({
|
|
98
|
+
namespace: e,
|
|
99
|
+
commands: t.sort((e, t) => e.label.localeCompare(t.label))
|
|
100
|
+
}));
|
|
101
|
+
if (V.value.length === 0) return t;
|
|
102
|
+
let n = /* @__PURE__ */ new Map();
|
|
103
|
+
for (let e of V.value.slice(0, I.maxResults)) {
|
|
104
|
+
let t = e.namespace ?? "";
|
|
105
|
+
n.has(t) || n.set(t, []), n.get(t).push(e);
|
|
106
|
+
}
|
|
107
|
+
return [...Array.from(n.entries()).map(([e, t]) => ({
|
|
108
|
+
namespace: e,
|
|
109
|
+
commands: t
|
|
110
|
+
})), ...t];
|
|
111
|
+
}), X = o(() => Y.value.flatMap((e) => e.commands));
|
|
112
|
+
function Z(e) {
|
|
113
|
+
L.close(), z.value = "", K(), e.handler();
|
|
114
|
+
}
|
|
115
|
+
function se(e) {
|
|
116
|
+
if (e.key === "Escape") {
|
|
117
|
+
e.preventDefault(), L.close(), z.value = "", K();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
let t = X.value;
|
|
121
|
+
if (!t.length) return;
|
|
122
|
+
let n = t.findIndex((e) => e.id === B.value);
|
|
123
|
+
if (e.key === "ArrowDown") e.preventDefault(), B.value = t[n < t.length - 1 ? n + 1 : 0].id, Q();
|
|
124
|
+
else if (e.key === "ArrowUp") e.preventDefault(), B.value = t[n > 0 ? n - 1 : t.length - 1].id, Q();
|
|
125
|
+
else if (e.key === "Enter" && B.value) {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
let n = t.find((e) => e.id === B.value);
|
|
128
|
+
n && Z(n);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function Q() {
|
|
132
|
+
m(() => {
|
|
133
|
+
document.querySelector(".nb-command-palette__item--highlighted")?.scrollIntoView({ block: "nearest" });
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
w(() => L.isOpen, (e) => {
|
|
137
|
+
e ? (z.value = L.searchFilter ?? "", B.value = null, m(() => {
|
|
138
|
+
R.value?.focus(), m(() => {
|
|
139
|
+
X.value.length > 0 && (B.value = X.value[0].id);
|
|
140
|
+
});
|
|
141
|
+
}), P()) : (z.value = "", K(), F());
|
|
142
|
+
}), w(X, (e) => {
|
|
143
|
+
e.length > 0 && !e.find((e) => e.id === B.value) ? B.value = e[0].id : e.length === 0 && (B.value = null);
|
|
144
|
+
});
|
|
145
|
+
let ce = {
|
|
146
|
+
cmd: "⌘",
|
|
147
|
+
meta: "⌘",
|
|
148
|
+
shift: "⇧",
|
|
149
|
+
alt: "⌥",
|
|
150
|
+
option: "⌥",
|
|
151
|
+
ctrl: "⌃",
|
|
152
|
+
control: "⌃"
|
|
153
|
+
};
|
|
154
|
+
function le(e) {
|
|
155
|
+
return e.split("+").map((e) => ce[e.trim().toLowerCase()] || e.trim());
|
|
156
|
+
}
|
|
157
|
+
function ue(e) {
|
|
158
|
+
let t = e.toLowerCase().split("+");
|
|
159
|
+
return {
|
|
160
|
+
key: t[t.length - 1],
|
|
161
|
+
meta: t.includes("meta") || t.includes("cmd"),
|
|
162
|
+
ctrl: t.includes("ctrl") || t.includes("control"),
|
|
163
|
+
shift: t.includes("shift"),
|
|
164
|
+
alt: t.includes("alt")
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function $(e) {
|
|
168
|
+
if (e.key === "Escape" && L.isOpen) {
|
|
169
|
+
e.preventDefault(), L.close(), z.value = "";
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
let t = ue(I.openShortcut), n = e.key.toLowerCase() === t.key, r = t.meta ? e.metaKey : !e.metaKey, i = t.ctrl ? e.ctrlKey : !e.ctrlKey, a = t.shift ? e.shiftKey : !e.shiftKey, o = t.alt ? e.altKey : !e.altKey;
|
|
173
|
+
n && r && i && a && o && (e.preventDefault(), L.isOpen ? L.close() : L.open());
|
|
174
|
+
}
|
|
175
|
+
return _(() => {
|
|
176
|
+
document.addEventListener("keydown", $);
|
|
177
|
+
}), g(() => {
|
|
178
|
+
document.removeEventListener("keydown", $), G(), F();
|
|
179
|
+
}), (e, n) => (v(), s(i, { to: "body" }, [d(a, { name: "nb-command-palette" }, {
|
|
180
|
+
default: T(() => [S(L).isOpen ? (v(), l("div", {
|
|
181
|
+
key: 0,
|
|
182
|
+
class: "nb-command-palette__overlay",
|
|
183
|
+
onClick: n[1] ||= D((e) => S(L).close(), ["self"])
|
|
184
|
+
}, [u("div", {
|
|
185
|
+
class: "nb-command-palette",
|
|
186
|
+
onKeydown: se
|
|
187
|
+
}, [u("div", ee, [d(t, {
|
|
188
|
+
name: S(O),
|
|
189
|
+
size: 20,
|
|
190
|
+
class: "nb-command-palette__search-icon"
|
|
191
|
+
}, null, 8, ["name"]), E(u("input", {
|
|
192
|
+
ref_key: "inputRef",
|
|
193
|
+
ref: R,
|
|
194
|
+
"onUpdate:modelValue": n[0] ||= (e) => z.value = e,
|
|
195
|
+
type: "text",
|
|
196
|
+
class: "nb-command-palette__input",
|
|
197
|
+
placeholder: f.placeholder,
|
|
198
|
+
autocomplete: "off",
|
|
199
|
+
spellcheck: "false"
|
|
200
|
+
}, null, 8, te), [[C, z.value]])]), Y.value.length > 0 ? (v(), l("div", ne, [(v(!0), l(r, null, b(Y.value, (e) => (v(), l(r, { key: e.namespace }, [e.namespace ? (v(), l("div", k, x(e.namespace), 1)) : c("", !0), (v(!0), l(r, null, b(e.commands, (e) => (v(), l("div", {
|
|
201
|
+
key: e.id,
|
|
202
|
+
class: h(["nb-command-palette__item", { "nb-command-palette__item--highlighted": e.id === B.value }]),
|
|
203
|
+
onClick: (t) => Z(e),
|
|
204
|
+
onMouseenter: (t) => B.value = e.id
|
|
205
|
+
}, [
|
|
206
|
+
e.icon ? (v(), s(t, {
|
|
207
|
+
key: 0,
|
|
208
|
+
name: e.icon,
|
|
209
|
+
size: 16,
|
|
210
|
+
class: "nb-command-palette__item-icon"
|
|
211
|
+
}, null, 8, ["name"])) : c("", !0),
|
|
212
|
+
u("span", re, x(e.label), 1),
|
|
213
|
+
e.shortcut ? (v(), l("span", ie, [(v(!0), l(r, null, b(le(e.shortcut), (e, t) => (v(), l("kbd", {
|
|
214
|
+
key: t,
|
|
215
|
+
class: "nb-command-palette__key"
|
|
216
|
+
}, x(e), 1))), 128))])) : c("", !0)
|
|
217
|
+
], 42, A))), 128))], 64))), 128))])) : H.value ? (v(), l("div", j, " Searching... ")) : z.value ? (v(), l("div", M, " No matches ")) : (v(), l("div", N, " Type to search commands "))], 32)])) : c("", !0)]),
|
|
218
|
+
_: 1
|
|
219
|
+
})]));
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
//#endregion
|
|
223
|
+
export { P as t };
|
|
@@ -1,43 +1,13 @@
|
|
|
1
1
|
import { useReducedMotion as e } from "./composables/useReducedMotion.composable.mjs";
|
|
2
2
|
import { t } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
3
3
|
import { t as n } from "./Icon-rREAqsu0.js";
|
|
4
|
-
import { t as r } from "./Button-
|
|
5
|
-
import { t as i } from "./Message-
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, nextTick as m, normalizeClass as h, onMounted as
|
|
9
|
-
import { regular as
|
|
10
|
-
import { regular as
|
|
11
|
-
//#region src/components/Confirm.env.ts
|
|
12
|
-
var S = 200, C = [
|
|
13
|
-
"[data-nb-confirm-floating]",
|
|
14
|
-
".nb-select__dropdown",
|
|
15
|
-
".nb-menu",
|
|
16
|
-
".nb-date-picker__calendar",
|
|
17
|
-
".nb-user-menu__panel",
|
|
18
|
-
".nb-sidebar-menu-item__flyout"
|
|
19
|
-
], w = /* @__PURE__ */ new Set();
|
|
20
|
-
function T(e) {
|
|
21
|
-
let t = e.trim();
|
|
22
|
-
return t ? (w.add(t), () => {
|
|
23
|
-
w.delete(t);
|
|
24
|
-
}) : () => {};
|
|
25
|
-
}
|
|
26
|
-
function ue(e = []) {
|
|
27
|
-
return [
|
|
28
|
-
...C,
|
|
29
|
-
...w,
|
|
30
|
-
...e
|
|
31
|
-
].map((e) => e.trim()).filter(Boolean).join(",");
|
|
32
|
-
}
|
|
33
|
-
function de(e, t) {
|
|
34
|
-
if (!e) return;
|
|
35
|
-
let n = `${t ? 0 : 200}ms`;
|
|
36
|
-
e.style.transitionDuration = n;
|
|
37
|
-
let r = e.parentElement;
|
|
38
|
-
r instanceof HTMLElement && (r.style.transitionDuration = n);
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
4
|
+
import { t as r } from "./Button-Q8MBLMvG.js";
|
|
5
|
+
import { t as i } from "./Message-DqUW3GHc.js";
|
|
6
|
+
import { i as a, r as ee, t as te } from "./Modal-B1CQyPNo.js";
|
|
7
|
+
import { t as ne } from "./TextInput-DNrd12uS.js";
|
|
8
|
+
import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, nextTick as m, normalizeClass as h, onMounted as re, onUnmounted as ie, openBlock as g, ref as _, renderSlot as ae, toDisplayString as v, unref as y, useId as oe, useSlots as se, watch as b, withCtx as x, withKeys as ce, withModifiers as le } from "vue";
|
|
9
|
+
import { regular as ue } from "@nubisco/ui/icons/warning";
|
|
10
|
+
import { regular as de } from "@nubisco/ui/icons/check";
|
|
41
11
|
//#region src/components/Confirm.vue?vue&type=script&setup=true&lang.ts
|
|
42
12
|
var fe = {
|
|
43
13
|
key: 0,
|
|
@@ -56,7 +26,7 @@ var fe = {
|
|
|
56
26
|
key: 1,
|
|
57
27
|
class: "nb-confirm__status nb-confirm__status--success",
|
|
58
28
|
role: "status"
|
|
59
|
-
},
|
|
29
|
+
}, S = /* @__PURE__ */ t(/* @__PURE__ */ p({
|
|
60
30
|
__name: "Confirm",
|
|
61
31
|
props: {
|
|
62
32
|
open: {
|
|
@@ -90,7 +60,7 @@ var fe = {
|
|
|
90
60
|
},
|
|
91
61
|
emits: ["confirm", "cancel"],
|
|
92
62
|
setup(t, { expose: p, emit: S }) {
|
|
93
|
-
let C = t, w = S, T =
|
|
63
|
+
let C = t, w = S, T = oe(), E = `nb-confirm-title-${T}`, D = `nb-confirm-body-${T}`, ye = se(), O = _(null), k = _(null), A = _(null), j = _(""), M = e(), N = o(() => C.busy || C.succeeded);
|
|
94
64
|
function P() {
|
|
95
65
|
return !!C.message || !!C.subject || !!ye.default;
|
|
96
66
|
}
|
|
@@ -129,7 +99,7 @@ var fe = {
|
|
|
129
99
|
"[tabindex]:not([tabindex=\"-1\"])"
|
|
130
100
|
].map((e) => `${e}:not([hidden]):not([aria-hidden="true"])`).join(",");
|
|
131
101
|
function Ee() {
|
|
132
|
-
return
|
|
102
|
+
return a(C.floatingSelectors);
|
|
133
103
|
}
|
|
134
104
|
function z(e) {
|
|
135
105
|
return e instanceof Element ? !!e.closest(Ee()) : !1;
|
|
@@ -156,7 +126,7 @@ var fe = {
|
|
|
156
126
|
W = null, e?.isConnected && e.focus();
|
|
157
127
|
}
|
|
158
128
|
function K() {
|
|
159
|
-
|
|
129
|
+
ee(L(), M.value);
|
|
160
130
|
}
|
|
161
131
|
b(M, () => {
|
|
162
132
|
C.open && K();
|
|
@@ -220,15 +190,15 @@ var fe = {
|
|
|
220
190
|
B(e) || z(e) || e && e !== document.body && !e.isConnected || R() && U();
|
|
221
191
|
});
|
|
222
192
|
}
|
|
223
|
-
return typeof document < "u" && (document.addEventListener("keydown", Q, !0), document.addEventListener("focusout", $, !0), document.addEventListener("mousedown", X, !0), document.addEventListener("touchstart", X, !0), document.addEventListener("click", Z, !0)),
|
|
193
|
+
return typeof document < "u" && (document.addEventListener("keydown", Q, !0), document.addEventListener("focusout", $, !0), document.addEventListener("mousedown", X, !0), document.addEventListener("touchstart", X, !0), document.addEventListener("click", Z, !0)), re(() => {
|
|
224
194
|
C.open && (K(), I() ? I()?.focus() : H());
|
|
225
|
-
}),
|
|
195
|
+
}), ie(() => {
|
|
226
196
|
typeof document < "u" && (document.removeEventListener("keydown", Q, !0), document.removeEventListener("focusout", $, !0), document.removeEventListener("mousedown", X, !0), document.removeEventListener("touchstart", X, !0), document.removeEventListener("click", Z, !0)), G();
|
|
227
197
|
}), p({
|
|
228
198
|
focusCancel: () => I()?.focus(),
|
|
229
199
|
restoreFocus: G,
|
|
230
200
|
isTopmost: R
|
|
231
|
-
}), (e,
|
|
201
|
+
}), (e, a) => (g(), s(te, {
|
|
232
202
|
open: t.open,
|
|
233
203
|
size: t.size,
|
|
234
204
|
role: t.tone === "danger" ? "alertdialog" : "dialog",
|
|
@@ -238,6 +208,7 @@ var fe = {
|
|
|
238
208
|
"close-on-overlay": !N.value,
|
|
239
209
|
"close-disabled": N.value,
|
|
240
210
|
"close-on-escape": !1,
|
|
211
|
+
"trap-focus": !1,
|
|
241
212
|
onClose: De
|
|
242
213
|
}, {
|
|
243
214
|
header: x(() => [u("span", {
|
|
@@ -245,7 +216,7 @@ var fe = {
|
|
|
245
216
|
class: h(["nb-confirm__heading", `nb-confirm__heading--${t.tone}`])
|
|
246
217
|
}, [t.tone === "danger" ? (g(), s(n, {
|
|
247
218
|
key: 0,
|
|
248
|
-
name: y(
|
|
219
|
+
name: y(ue),
|
|
249
220
|
size: 16,
|
|
250
221
|
"aria-hidden": "true"
|
|
251
222
|
}, null, 8, ["name"])) : c("", !0), u("span", null, v(t.title), 1)], 2)]),
|
|
@@ -286,13 +257,13 @@ var fe = {
|
|
|
286
257
|
key: 0,
|
|
287
258
|
id: D,
|
|
288
259
|
class: "nb-confirm__body"
|
|
289
|
-
}, [
|
|
260
|
+
}, [ae(e.$slots, "default", {}, () => [t.message ? (g(), l("p", fe, v(t.message), 1)) : c("", !0)], !0), t.subject ? (g(), l("p", {
|
|
290
261
|
key: 0,
|
|
291
262
|
class: h(["nb-confirm__subject", `nb-confirm__subject--${t.tone}`])
|
|
292
263
|
}, [t.subjectLabel ? (g(), l("span", pe, v(t.subjectLabel), 1)) : c("", !0), u("span", me, v(t.subject), 1)], 2)) : c("", !0)])) : c("", !0),
|
|
293
|
-
t.typeToConfirm ? (g(), l("div", he, [f(
|
|
264
|
+
t.typeToConfirm ? (g(), l("div", he, [f(ne, {
|
|
294
265
|
modelValue: j.value,
|
|
295
|
-
"onUpdate:modelValue":
|
|
266
|
+
"onUpdate:modelValue": a[0] ||= (e) => j.value = e,
|
|
296
267
|
class: "nb-confirm__gate-field",
|
|
297
268
|
label: xe.value,
|
|
298
269
|
helper: t.typeToConfirmHelper,
|
|
@@ -300,7 +271,7 @@ var fe = {
|
|
|
300
271
|
autocomplete: "off",
|
|
301
272
|
spellcheck: "false",
|
|
302
273
|
"data-nb-confirm": "gate",
|
|
303
|
-
onKeydown:
|
|
274
|
+
onKeydown: a[1] ||= ce(le(() => {}, ["prevent"]), ["enter"])
|
|
304
275
|
}, null, 8, [
|
|
305
276
|
"modelValue",
|
|
306
277
|
"label",
|
|
@@ -310,7 +281,7 @@ var fe = {
|
|
|
310
281
|
u("div", ge, [
|
|
311
282
|
t.busy ? (g(), l("p", _e, v(t.busyLabel), 1)) : c("", !0),
|
|
312
283
|
t.succeeded && t.successLabel ? (g(), l("p", ve, [f(n, {
|
|
313
|
-
name: y(
|
|
284
|
+
name: y(de),
|
|
314
285
|
size: 14,
|
|
315
286
|
"aria-hidden": "true"
|
|
316
287
|
}, null, 8, ["name"]), u("span", null, v(t.successLabel), 1)])) : c("", !0),
|
|
@@ -337,6 +308,6 @@ var fe = {
|
|
|
337
308
|
"close-disabled"
|
|
338
309
|
]));
|
|
339
310
|
}
|
|
340
|
-
}), [["__scopeId", "data-v-
|
|
311
|
+
}), [["__scopeId", "data-v-683eafb1"]]);
|
|
341
312
|
//#endregion
|
|
342
|
-
export { S as
|
|
313
|
+
export { S as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./composables/useReducedMotion.composable.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Icon-C8R_r_In.cjs`),r=require(`./Button-Dwv0rx46.cjs`),i=require(`./Message-Ax7rnAQl.cjs`),a=require(`./Modal-DvukGfHg.cjs`),o=require(`./TextInput-D4jBlYm9.cjs`);let s=require(`vue`),c=require(`@nubisco/ui/icons/warning`),ee=require(`@nubisco/ui/icons/check`);var te={key:0,class:`nb-confirm__message`},ne={key:0,class:`nb-confirm__subject-kind`},l={class:`nb-confirm__subject-name`},u={key:1,class:`nb-confirm__gate`},d={class:`nb-confirm__live`},f={key:0,class:`nb-confirm__status`,role:`status`},p={key:1,class:`nb-confirm__status nb-confirm__status--success`,role:`status`},m=(0,s.defineComponent)({__name:`Confirm`,props:{open:{type:Boolean,default:!1},title:{},message:{default:void 0},subject:{default:void 0},subjectLabel:{default:void 0},confirmLabel:{default:`Confirm`},cancelLabel:{default:`Cancel`},tone:{default:`danger`},typeToConfirm:{default:void 0},typeToConfirmLabel:{default:void 0},typeToConfirmHelper:{default:void 0},busy:{type:Boolean,default:!1},busyLabel:{default:`Working...`},succeeded:{type:Boolean,default:!1},successLabel:{default:void 0},error:{default:void 0},size:{default:`sm`},floatingSelectors:{default:()=>[]},contentClass:{default:void 0}},emits:[`confirm`,`cancel`],setup(t,{expose:m,emit:h}){let g=t,_=h,v=(0,s.useId)(),y=`nb-confirm-title-${v}`,b=`nb-confirm-body-${v}`,x=(0,s.useSlots)(),S=(0,s.ref)(null),C=(0,s.ref)(null),w=(0,s.ref)(null),T=(0,s.ref)(``),E=e.useReducedMotion(),D=(0,s.computed)(()=>g.busy||g.succeeded);function O(){return!!g.message||!!g.subject||!!x.default}let k=(0,s.computed)(()=>g.tone===`danger`?`danger`:`primary`),A=(0,s.computed)(()=>g.typeToConfirmLabel??`Type ${g.typeToConfirm} to confirm`),j=(0,s.computed)(()=>!g.typeToConfirm||T.value.trim()===g.typeToConfirm),M=(0,s.computed)(()=>j.value&&!D.value);function N(){M.value&&_(`confirm`)}function P(){let e=w.value?.$el;return e instanceof HTMLElement?e:null}function F(){return S.value?.closest(`[role="dialog"],[role="alertdialog"]`)??null}function re(){return typeof document>`u`?[]:Array.from(document.querySelectorAll(`[aria-modal="true"]`))}function I(){let e=F();if(!e)return!1;let t=re();return t.length===0||t[t.length-1]===e}let L=[`a[href]:not([tabindex="-1"])`,`area[href]:not([tabindex="-1"])`,`button:not([disabled]):not([tabindex="-1"])`,`input:not([disabled]):not([type="hidden"]):not([tabindex="-1"])`,`select:not([disabled]):not([tabindex="-1"])`,`textarea:not([disabled]):not([tabindex="-1"])`,`summary:not([tabindex="-1"])`,`audio[controls]:not([tabindex="-1"])`,`video[controls]:not([tabindex="-1"])`,`iframe:not([tabindex="-1"])`,`[contenteditable]:not([contenteditable="false"]):not([tabindex="-1"])`,`[tabindex]:not([tabindex="-1"])`].map(e=>`${e}:not([hidden]):not([aria-hidden="true"])`).join(`,`);function R(){return a.i(g.floatingSelectors)}function z(e){return e instanceof Element?!!e.closest(R()):!1}function B(e){let t=F();return!!t&&!!e&&t.contains(e)}function V(){let e=F();return e?Array.from(e.querySelectorAll(L)).filter(e=>e.getAttribute(`aria-disabled`)!==`true`):[]}function H(){let e=F();return e?(e.focus(),!0):!1}function U(){let e=V()[0];e?e.focus():H()}let W=null;function G(){let e=W;W=null,e?.isConnected&&e.focus()}function K(){a.r(F(),E.value)}(0,s.watch)(E,()=>{g.open&&K()}),(0,s.watch)(()=>[g.busy,g.error],async(e,t)=>{if(!g.open)return;let[n,r]=e,i=t?.[0]??!1;if(await(0,s.nextTick)(),n){V().length===0&&H();return}if(i&&r){let e=C.value;e?e.focus():U();return}let a=document.activeElement;!B(a)&&!z(a)&&U()}),(0,s.watch)(()=>g.open,async e=>{e?(W=document.activeElement instanceof HTMLElement?document.activeElement:null,T.value=``,await(0,s.nextTick)(),K(),P()?P()?.focus():H()):G()},{immediate:!0});function q(){D.value||_(`cancel`)}let J=!1,Y=!1;function X(e){let t=e.target;J=B(t)||z(t)}function Z(e){Y=B(e.target)}function ie(){let e=J&&!Y;J=!1,!e&&q()}function Q(e){if(!g.open||z(document.activeElement))return;if(e.key===`Escape`){if(!I())return;e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),q();return}if(e.key!==`Tab`||!I())return;let t=V();if(t.length===0){e.preventDefault(),B(document.activeElement)||H();return}let n=t[0],r=t[t.length-1],i=document.activeElement;e.shiftKey&&(i===n||!B(i))?(e.preventDefault(),r.focus()):!e.shiftKey&&i===r?(e.preventDefault(),n.focus()):B(i)||(e.preventDefault(),n.focus())}function $(e){if(!g.open)return;let t=e.relatedTarget;if(t instanceof Element){if(B(t)||z(t))return}else if(t!==null)return;requestAnimationFrame(()=>{if(!g.open)return;let e=document.activeElement;B(e)||z(e)||e&&e!==document.body&&!e.isConnected||I()&&U()})}return typeof document<`u`&&(document.addEventListener(`keydown`,Q,!0),document.addEventListener(`focusout`,$,!0),document.addEventListener(`mousedown`,X,!0),document.addEventListener(`touchstart`,X,!0),document.addEventListener(`click`,Z,!0)),(0,s.onMounted)(()=>{g.open&&(K(),P()?P()?.focus():H())}),(0,s.onUnmounted)(()=>{typeof document<`u`&&(document.removeEventListener(`keydown`,Q,!0),document.removeEventListener(`focusout`,$,!0),document.removeEventListener(`mousedown`,X,!0),document.removeEventListener(`touchstart`,X,!0),document.removeEventListener(`click`,Z,!0)),G()}),m({focusCancel:()=>P()?.focus(),restoreFocus:G,isTopmost:I}),(e,m)=>((0,s.openBlock)(),(0,s.createBlock)(a.t,{open:t.open,size:t.size,role:t.tone===`danger`?`alertdialog`:`dialog`,"labelled-by":y,"described-by":O()?b:void 0,busy:t.busy,"close-on-overlay":!D.value,"close-disabled":D.value,"close-on-escape":!1,"trap-focus":!1,onClose:ie},{header:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`span`,{id:y,class:(0,s.normalizeClass)([`nb-confirm__heading`,`nb-confirm__heading--${t.tone}`])},[t.tone===`danger`?((0,s.openBlock)(),(0,s.createBlock)(n.t,{key:0,name:(0,s.unref)(c.regular),size:16,"aria-hidden":`true`},null,8,[`name`])):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`span`,null,(0,s.toDisplayString)(t.title),1)],2)]),footer:(0,s.withCtx)(()=>[(0,s.createVNode)(r.t,{ref_key:`cancelRef`,ref:w,class:`nb-confirm__action nb-confirm__action--cancel`,variant:`ghost`,size:`lg`,disabled:D.value,"data-nb-confirm":`cancel`,onClick:q},{default:(0,s.withCtx)(()=>[(0,s.createTextVNode)((0,s.toDisplayString)(t.cancelLabel),1)]),_:1},8,[`disabled`]),(0,s.createVNode)(r.t,{class:`nb-confirm__action nb-confirm__action--confirm`,variant:k.value,size:`lg`,disabled:!M.value,loading:t.busy,"data-nb-confirm":`confirm`,onClick:N},{default:(0,s.withCtx)(()=>[(0,s.createTextVNode)((0,s.toDisplayString)(t.confirmLabel),1)]),_:1},8,[`variant`,`disabled`,`loading`])]),default:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`div`,{ref_key:`rootRef`,ref:S,class:(0,s.normalizeClass)([`nb-confirm`,t.contentClass])},[O()?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:0,id:b,class:`nb-confirm__body`},[(0,s.renderSlot)(e.$slots,`default`,{},()=>[t.message?((0,s.openBlock)(),(0,s.createElementBlock)(`p`,te,(0,s.toDisplayString)(t.message),1)):(0,s.createCommentVNode)(``,!0)],!0),t.subject?((0,s.openBlock)(),(0,s.createElementBlock)(`p`,{key:0,class:(0,s.normalizeClass)([`nb-confirm__subject`,`nb-confirm__subject--${t.tone}`])},[t.subjectLabel?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,ne,(0,s.toDisplayString)(t.subjectLabel),1)):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`span`,l,(0,s.toDisplayString)(t.subject),1)],2)):(0,s.createCommentVNode)(``,!0)])):(0,s.createCommentVNode)(``,!0),t.typeToConfirm?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,u,[(0,s.createVNode)(o.t,{modelValue:T.value,"onUpdate:modelValue":m[0]||=e=>T.value=e,class:`nb-confirm__gate-field`,label:A.value,helper:t.typeToConfirmHelper,disabled:D.value,autocomplete:`off`,spellcheck:`false`,"data-nb-confirm":`gate`,onKeydown:m[1]||=(0,s.withKeys)((0,s.withModifiers)(()=>{},[`prevent`]),[`enter`])},null,8,[`modelValue`,`label`,`helper`,`disabled`])])):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`div`,d,[t.busy?((0,s.openBlock)(),(0,s.createElementBlock)(`p`,f,(0,s.toDisplayString)(t.busyLabel),1)):(0,s.createCommentVNode)(``,!0),t.succeeded&&t.successLabel?((0,s.openBlock)(),(0,s.createElementBlock)(`p`,p,[(0,s.createVNode)(n.t,{name:(0,s.unref)(ee.regular),size:14,"aria-hidden":`true`},null,8,[`name`]),(0,s.createElementVNode)(`span`,null,(0,s.toDisplayString)(t.successLabel),1)])):(0,s.createCommentVNode)(``,!0),t.error?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:2,ref_key:`errorRef`,ref:C,class:`nb-confirm__error`,tabindex:`-1`},[(0,s.createVNode)(i.t,{variant:`error`},{default:(0,s.withCtx)(()=>[(0,s.createTextVNode)((0,s.toDisplayString)(t.error),1)]),_:1})],512)):(0,s.createCommentVNode)(``,!0)])],2)]),_:3},8,[`open`,`size`,`role`,`described-by`,`busy`,`close-on-overlay`,`close-disabled`]))}}),h=t.t(m,[[`__scopeId`,`data-v-683eafb1`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}});
|
|
@@ -2,9 +2,9 @@ import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
|
2
2
|
import { r as t } from "./Size.d-Bah6vMl3.js";
|
|
3
3
|
import { t as n } from "./Icon-rREAqsu0.js";
|
|
4
4
|
import { useSurfaceLayer as r } from "./composables/useSurfaceLayer.composable.mjs";
|
|
5
|
-
import { t as i } from "./Button-
|
|
5
|
+
import { t as i } from "./Button-Q8MBLMvG.js";
|
|
6
6
|
import { t as a } from "./Grid-CVNb1HcS.js";
|
|
7
|
-
import { t as o } from "./Checkbox-
|
|
7
|
+
import { t as o } from "./Checkbox-DG82KK8V.js";
|
|
8
8
|
import { Fragment as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, getCurrentInstance as ee, mergeProps as te, normalizeClass as g, normalizeStyle as ne, openBlock as _, ref as re, renderList as v, renderSlot as y, toDisplayString as b, unref as ie, useId as ae, useSlots as oe, watch as se, withCtx as x, withModifiers as S } from "vue";
|
|
9
9
|
import * as ce from "@nubisco/ui/icons/arrows-down-up";
|
|
10
10
|
import * as le from "@nubisco/ui/icons/arrow-up";
|
|
@@ -353,6 +353,6 @@ var de = {
|
|
|
353
353
|
t.$slots.footer ? (_(), d("div", Me, [y(t.$slots, "footer", {}, void 0, !0)])) : u("", !0)
|
|
354
354
|
], 16));
|
|
355
355
|
}
|
|
356
|
-
}), [["__scopeId", "data-v-
|
|
356
|
+
}), [["__scopeId", "data-v-e2562ae7"]]);
|
|
357
357
|
//#endregion
|
|
358
358
|
export { j as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Size.d-GBIblj2D.cjs`),r=require(`./Icon-C8R_r_In.cjs`),i=require(`./composables/useSurfaceLayer.composable.cjs`),a=require(`./Button-Dqtcr4i0.cjs`),o=require(`./Grid-DVT8lBHr.cjs`),s=require(`./Checkbox-D9qW3gph.cjs`);let c=require(`vue`),l=require(`@nubisco/ui/icons/arrows-down-up`);l=e.n(l);let u=require(`@nubisco/ui/icons/arrow-up`);u=e.n(u);let d=require(`@nubisco/ui/icons/arrow-down`);d=e.n(d);var f={key:0,class:`nb-data-table__toolbar`},p=[`inert`,`aria-hidden`],m={key:0},h={key:0,class:`nb-data-table__title`},g={key:1,class:`nb-data-table__description`},_=[`inert`,`aria-hidden`],v={key:1,class:`nb-data-table__batch`,role:`region`,"aria-label":`Table batch actions`},y={class:`nb-data-table__batch-count`},b={class:`nb-data-table__batch-actions`},x={class:`nb-data-table__scroll`},ee=[`aria-label`,`aria-busy`],te={key:0,class:`nb-data-table__col-select`},ne={key:1,class:`nb-data-table__col-actions`},re={class:`nb-data-table__head`},ie={key:0,scope:`col`,class:`nb-data-table__th nb-data-table__select-cell`},ae=[`aria-sort`],oe=[`onClick`],se={class:`nb-data-table__th-label`},ce={key:1,class:`nb-data-table__th-label`},le={key:1,scope:`col`,class:`nb-data-table__th nb-data-table__actions-cell`},ue={class:`nb-data-table__body`},de={key:0,class:`nb-data-table__td`},fe={key:1,class:`nb-data-table__td`},pe={key:1,class:`nb-data-table__state-row`},S=[`colspan`],C={key:2,class:`nb-data-table__state-row`},w=[`colspan`],T=[`aria-selected`,`onClick`],E=[`checked`,`aria-label`,`onChange`],D={key:1,class:`nb-data-table__footer`},O=(0,c.defineComponent)({__name:`DataTable`,props:{columns:{},rows:{},rowKey:{},size:{default:n.r.Medium},sortState:{default:null},selectable:{default:`none`},selected:{default:()=>[]},loading:{type:Boolean,default:!1},skeletonRows:{default:5},error:{default:void 0},emptyMessage:{default:void 0},stickyHeader:{type:Boolean,default:!0},zebra:{type:Boolean,default:!1},fill:{type:Boolean,default:!1},title:{default:void 0},description:{default:void 0},ariaLabel:{default:void 0}},emits:[`sort`,`update:selected`,`row-click`],setup(e,{emit:t}){let n=e,{layerProps:O}=i.useSurfaceLayer(),k=t,A=(0,c.useSlots)(),j=`nb-data-table-select-${(0,c.useId)()}`,M=(0,c.computed)(()=>n.size),N=(0,c.computed)(()=>n.columns.filter(e=>!e.hidden)),P=(0,c.computed)(()=>n.selectable!==`none`),F=(0,c.computed)(()=>!!A[`row-actions`]),I=(0,c.computed)(()=>N.value.length+(P.value?1:0)+(F.value?1:0));function L(e){if(e.width!=null)return{width:typeof e.width==`number`?`${e.width}px`:e.width}}function R(e,t){return t[e.key]}function z(e){return e==null?``:String(e)}let B=e=>e.column.render?.(e.row,R(e.column,e.row),e.rowIndex)??null;B.props=[`column`,`row`,`rowIndex`];function V(e){let t=n.rowKey;return typeof t==`function`?t(e):e[t]}let H=(0,c.computed)(()=>new Set(n.selected)),me=(0,c.computed)(()=>n.selected),U=(0,c.computed)(()=>n.selected.length);function W(e){return H.value.has(V(e))}let G=(0,c.computed)(()=>n.rows.map(e=>V(e))),K=(0,c.computed)(()=>G.value.length>0&&G.value.every(e=>H.value.has(e))),he=(0,c.computed)(()=>!K.value&&G.value.some(e=>H.value.has(e))),q=(0,c.ref)(null),J=!1;function Y(e){J=e.shiftKey}(0,c.watch)(G,()=>{q.value=null});function ge(e,t){let r=V(e),i=new Set(n.selected),a=!i.has(r),o=q.value,s=e=>{a?i.add(e):i.delete(e)};if(J&&o!==null&&o!==t){let e=Math.min(o,t),r=Math.max(o,t);for(let t=e;t<=r;t++){let e=n.rows[t];e&&s(V(e))}}else s(r),q.value=t;J=!1,k(`update:selected`,[...i])}function _e(e){k(`update:selected`,[V(e)])}function ve(){let e=new Set(n.selected);K.value?G.value.forEach(t=>e.delete(t)):G.value.forEach(t=>e.add(t)),k(`update:selected`,[...e])}function X(){k(`update:selected`,[])}let Z=(0,c.computed)(()=>n.selectable!==`none`&&!!A[`batch-actions`]),Q=(0,c.computed)(()=>Z.value&&U.value>0),ye=(0,c.computed)(()=>!!n.title||!!n.description||!!A.toolbar||!!A.search||!!A[`toolbar-actions`]),be=(0,c.computed)(()=>ye.value||Z.value);function $(e){return!!n.sortState&&n.sortState.key===e.key&&n.sortState.direction!==`none`}function xe(e){return $(e)?n.sortState.direction===`asc`?`ascending`:`descending`:`none`}function Se(e){return $(e)?n.sortState.direction===`asc`?u:d:l}function Ce(e){return e===`asc`?`desc`:e===`desc`?`none`:`asc`}function we(e){let t=n.sortState&&n.sortState.key===e.key?n.sortState.direction:`none`;k(`sort`,{key:e.key,direction:Ce(t)})}let Te=(0,c.getCurrentInstance)(),Ee=(0,c.computed)(()=>!!Te?.vnode.props?.onRowClick);function De(e,t){k(`row-click`,e,t)}return(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,(0,c.mergeProps)({class:[`nb-data-table`,`nb-data-table--${e.size}`,{"nb-data-table--zebra":e.zebra},{"nb-data-table--sticky":e.stickyHeader},{"nb-data-table--fill":e.fill}]},(0,c.unref)(O)),[be.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,f,[(0,c.createElementVNode)(`div`,{class:`nb-data-table__toolbar-heading`,inert:Q.value||void 0,"aria-hidden":Q.value||void 0},[(0,c.renderSlot)(t.$slots,`toolbar`,{selectedCount:U.value},()=>[e.title||e.description?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,m,[e.title?((0,c.openBlock)(),(0,c.createElementBlock)(`h2`,h,(0,c.toDisplayString)(e.title),1)):(0,c.createCommentVNode)(``,!0),e.description?((0,c.openBlock)(),(0,c.createElementBlock)(`p`,g,(0,c.toDisplayString)(e.description),1)):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0)],!0)],8,p),t.$slots.search||t.$slots[`toolbar-actions`]?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,class:`nb-data-table__toolbar-tools`,inert:Q.value||void 0,"aria-hidden":Q.value||void 0},[(0,c.renderSlot)(t.$slots,`search`,{},void 0,!0),(0,c.renderSlot)(t.$slots,`toolbar-actions`,{},void 0,!0)],8,_)):(0,c.createCommentVNode)(``,!0),Q.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,v,[(0,c.createElementVNode)(`span`,y,(0,c.toDisplayString)(U.value)+` selected `,1),(0,c.createElementVNode)(`div`,b,[(0,c.renderSlot)(t.$slots,`batch-actions`,{selectedKeys:me.value,clear:X},void 0,!0)]),(0,c.createVNode)(a.t,{class:`nb-data-table__batch-cancel`,variant:`ghost`,size:M.value,onClick:X},{default:(0,c.withCtx)(()=>[...n[2]||=[(0,c.createTextVNode)(` Cancel `,-1)]]),_:1},8,[`size`])])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,x,[(0,c.createElementVNode)(`table`,{class:`nb-data-table__table`,"aria-label":e.ariaLabel||e.title||void 0,"aria-busy":e.loading||void 0},[(0,c.createElementVNode)(`colgroup`,null,[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`col`,te)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`col`,{key:`col-${e.key}`,style:(0,c.normalizeStyle)(L(e))},null,4))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`col`,ne)):(0,c.createCommentVNode)(``,!0)]),(0,c.createElementVNode)(`thead`,re,[(0,c.createElementVNode)(`tr`,null,[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`th`,ie,[e.selectable===`multiple`?((0,c.openBlock)(),(0,c.createBlock)(s.t,{key:0,"model-value":K.value,indeterminate:he.value,"aria-label":`Select all rows`,"onUpdate:modelValue":ve},null,8,[`model-value`,`indeterminate`])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`th`,{key:`th-${e.key}`,scope:`col`,class:(0,c.normalizeClass)([`nb-data-table__th`,`nb-data-table__th--${e.align||`left`}`,{"nb-data-table__th--sortable":e.sortable},{"nb-data-table__th--sorted":$(e)}]),"aria-sort":e.sortable?xe(e):void 0},[e.sortable?((0,c.openBlock)(),(0,c.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-data-table__sort`,onClick:t=>we(e)},[(0,c.createElementVNode)(`span`,se,[(0,c.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.header),1)],!0)]),(0,c.createVNode)(r.t,{name:Se(e),class:`nb-data-table__sort-icon`,"aria-hidden":`true`},null,8,[`name`])],8,oe)):((0,c.openBlock)(),(0,c.createElementBlock)(`span`,ce,[(0,c.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.header),1)],!0)]))],10,ae))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`th`,le,[...n[3]||=[(0,c.createElementVNode)(`span`,{class:`nb-sr-only`},`Row actions`,-1)]])):(0,c.createCommentVNode)(``,!0)])]),(0,c.createElementVNode)(`tbody`,ue,[e.loading?((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,{key:0},(0,c.renderList)(e.skeletonRows,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,{key:`skeleton-${e}`,class:`nb-data-table__row nb-data-table__row--skeleton`},[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,de,[...n[4]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,t=>((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:`sk-${e}-${t.key}`,class:`nb-data-table__td`},[...n[5]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton`},null,-1)]]))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,fe,[...n[6]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,c.createCommentVNode)(``,!0)]))),128)):e.error?((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,pe,[(0,c.createElementVNode)(`td`,{colspan:I.value,class:`nb-data-table__state nb-data-table__state--error`},[(0,c.renderSlot)(t.$slots,`error`,{error:e.error},()=>[(0,c.createVNode)(o.t,{is:`span`,align:`center`,justify:`center`,gap:`xs`,class:`nb-data-table__state-inner`},{default:(0,c.withCtx)(()=>[(0,c.createVNode)(r.t,{name:`warning-circle-fill`,"aria-hidden":`true`}),(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(e.error),1)]),_:1})],!0)],8,S)])):e.rows.length?((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,{key:3},(0,c.renderList)(e.rows,(r,i)=>((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,{key:V(r),class:(0,c.normalizeClass)([`nb-data-table__row`,{"nb-data-table__row--selected":W(r)},{"nb-data-table__row--clickable":Ee.value}]),"aria-selected":e.selectable===`none`?void 0:W(r),onClick:e=>De(r,i)},[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:0,class:`nb-data-table__td nb-data-table__select-cell`,onClick:n[0]||=(0,c.withModifiers)(()=>{},[`stop`]),onMousedown:Y,onKeydown:Y},[e.selectable===`multiple`?((0,c.openBlock)(),(0,c.createBlock)(s.t,{key:0,"model-value":W(r),"aria-label":`Select row ${i+1}`,"onUpdate:modelValue":e=>ge(r,i)},null,8,[`model-value`,`aria-label`,`onUpdate:modelValue`])):((0,c.openBlock)(),(0,c.createElementBlock)(`input`,{key:1,type:`radio`,class:`nb-data-table__radio`,name:j,checked:W(r),"aria-label":`Select row ${i+1}`,onChange:e=>_e(r)},null,40,E))],32)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:`td-${V(r)}-${e.key}`,class:(0,c.normalizeClass)([`nb-data-table__td`,`nb-data-table__td--${e.align||`left`}`,e.cellClass])},[(0,c.renderSlot)(t.$slots,`cell-${e.key}`,{row:r,value:R(e,r),column:e,rowIndex:i},()=>[e.render?((0,c.openBlock)(),(0,c.createBlock)(B,{key:0,column:e,row:r,"row-index":i},null,8,[`column`,`row`,`row-index`])):((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:1},[(0,c.createTextVNode)((0,c.toDisplayString)(z(R(e,r))),1)],64))],!0)],2))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:1,class:`nb-data-table__td nb-data-table__actions-cell`,onClick:n[1]||=(0,c.withModifiers)(()=>{},[`stop`])},[(0,c.renderSlot)(t.$slots,`row-actions`,{row:r,rowIndex:i},void 0,!0)])):(0,c.createCommentVNode)(``,!0)],10,T))),128)):((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,C,[(0,c.createElementVNode)(`td`,{colspan:I.value,class:`nb-data-table__state nb-data-table__state--empty`},[(0,c.renderSlot)(t.$slots,`empty`,{},()=>[(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(e.emptyMessage||`No data to display`),1)],!0)],8,w)]))])],8,ee)]),t.$slots.footer?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,D,[(0,c.renderSlot)(t.$slots,`footer`,{},void 0,!0)])):(0,c.createCommentVNode)(``,!0)],16))}}),k=t.t(O,[[`__scopeId`,`data-v-c26b7d0f`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return k}});
|
|
1
|
+
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Size.d-GBIblj2D.cjs`),r=require(`./Icon-C8R_r_In.cjs`),i=require(`./composables/useSurfaceLayer.composable.cjs`),a=require(`./Button-Dwv0rx46.cjs`),o=require(`./Grid-DVT8lBHr.cjs`),s=require(`./Checkbox-vFN3fLyr.cjs`);let c=require(`vue`),l=require(`@nubisco/ui/icons/arrows-down-up`);l=e.n(l);let u=require(`@nubisco/ui/icons/arrow-up`);u=e.n(u);let d=require(`@nubisco/ui/icons/arrow-down`);d=e.n(d);var f={key:0,class:`nb-data-table__toolbar`},p=[`inert`,`aria-hidden`],m={key:0},h={key:0,class:`nb-data-table__title`},g={key:1,class:`nb-data-table__description`},_=[`inert`,`aria-hidden`],v={key:1,class:`nb-data-table__batch`,role:`region`,"aria-label":`Table batch actions`},y={class:`nb-data-table__batch-count`},b={class:`nb-data-table__batch-actions`},x={class:`nb-data-table__scroll`},ee=[`aria-label`,`aria-busy`],te={key:0,class:`nb-data-table__col-select`},ne={key:1,class:`nb-data-table__col-actions`},re={class:`nb-data-table__head`},ie={key:0,scope:`col`,class:`nb-data-table__th nb-data-table__select-cell`},ae=[`aria-sort`],oe=[`onClick`],se={class:`nb-data-table__th-label`},ce={key:1,class:`nb-data-table__th-label`},le={key:1,scope:`col`,class:`nb-data-table__th nb-data-table__actions-cell`},ue={class:`nb-data-table__body`},de={key:0,class:`nb-data-table__td`},fe={key:1,class:`nb-data-table__td`},pe={key:1,class:`nb-data-table__state-row`},S=[`colspan`],C={key:2,class:`nb-data-table__state-row`},w=[`colspan`],T=[`aria-selected`,`onClick`],E=[`checked`,`aria-label`,`onChange`],D={key:1,class:`nb-data-table__footer`},O=(0,c.defineComponent)({__name:`DataTable`,props:{columns:{},rows:{},rowKey:{},size:{default:n.r.Medium},sortState:{default:null},selectable:{default:`none`},selected:{default:()=>[]},loading:{type:Boolean,default:!1},skeletonRows:{default:5},error:{default:void 0},emptyMessage:{default:void 0},stickyHeader:{type:Boolean,default:!0},zebra:{type:Boolean,default:!1},fill:{type:Boolean,default:!1},title:{default:void 0},description:{default:void 0},ariaLabel:{default:void 0}},emits:[`sort`,`update:selected`,`row-click`],setup(e,{emit:t}){let n=e,{layerProps:O}=i.useSurfaceLayer(),k=t,A=(0,c.useSlots)(),j=`nb-data-table-select-${(0,c.useId)()}`,M=(0,c.computed)(()=>n.size),N=(0,c.computed)(()=>n.columns.filter(e=>!e.hidden)),P=(0,c.computed)(()=>n.selectable!==`none`),F=(0,c.computed)(()=>!!A[`row-actions`]),I=(0,c.computed)(()=>N.value.length+(P.value?1:0)+(F.value?1:0));function L(e){if(e.width!=null)return{width:typeof e.width==`number`?`${e.width}px`:e.width}}function R(e,t){return t[e.key]}function z(e){return e==null?``:String(e)}let B=e=>e.column.render?.(e.row,R(e.column,e.row),e.rowIndex)??null;B.props=[`column`,`row`,`rowIndex`];function V(e){let t=n.rowKey;return typeof t==`function`?t(e):e[t]}let H=(0,c.computed)(()=>new Set(n.selected)),me=(0,c.computed)(()=>n.selected),U=(0,c.computed)(()=>n.selected.length);function W(e){return H.value.has(V(e))}let G=(0,c.computed)(()=>n.rows.map(e=>V(e))),K=(0,c.computed)(()=>G.value.length>0&&G.value.every(e=>H.value.has(e))),he=(0,c.computed)(()=>!K.value&&G.value.some(e=>H.value.has(e))),q=(0,c.ref)(null),J=!1;function Y(e){J=e.shiftKey}(0,c.watch)(G,()=>{q.value=null});function ge(e,t){let r=V(e),i=new Set(n.selected),a=!i.has(r),o=q.value,s=e=>{a?i.add(e):i.delete(e)};if(J&&o!==null&&o!==t){let e=Math.min(o,t),r=Math.max(o,t);for(let t=e;t<=r;t++){let e=n.rows[t];e&&s(V(e))}}else s(r),q.value=t;J=!1,k(`update:selected`,[...i])}function _e(e){k(`update:selected`,[V(e)])}function ve(){let e=new Set(n.selected);K.value?G.value.forEach(t=>e.delete(t)):G.value.forEach(t=>e.add(t)),k(`update:selected`,[...e])}function X(){k(`update:selected`,[])}let Z=(0,c.computed)(()=>n.selectable!==`none`&&!!A[`batch-actions`]),Q=(0,c.computed)(()=>Z.value&&U.value>0),ye=(0,c.computed)(()=>!!n.title||!!n.description||!!A.toolbar||!!A.search||!!A[`toolbar-actions`]),be=(0,c.computed)(()=>ye.value||Z.value);function $(e){return!!n.sortState&&n.sortState.key===e.key&&n.sortState.direction!==`none`}function xe(e){return $(e)?n.sortState.direction===`asc`?`ascending`:`descending`:`none`}function Se(e){return $(e)?n.sortState.direction===`asc`?u:d:l}function Ce(e){return e===`asc`?`desc`:e===`desc`?`none`:`asc`}function we(e){let t=n.sortState&&n.sortState.key===e.key?n.sortState.direction:`none`;k(`sort`,{key:e.key,direction:Ce(t)})}let Te=(0,c.getCurrentInstance)(),Ee=(0,c.computed)(()=>!!Te?.vnode.props?.onRowClick);function De(e,t){k(`row-click`,e,t)}return(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,(0,c.mergeProps)({class:[`nb-data-table`,`nb-data-table--${e.size}`,{"nb-data-table--zebra":e.zebra},{"nb-data-table--sticky":e.stickyHeader},{"nb-data-table--fill":e.fill}]},(0,c.unref)(O)),[be.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,f,[(0,c.createElementVNode)(`div`,{class:`nb-data-table__toolbar-heading`,inert:Q.value||void 0,"aria-hidden":Q.value||void 0},[(0,c.renderSlot)(t.$slots,`toolbar`,{selectedCount:U.value},()=>[e.title||e.description?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,m,[e.title?((0,c.openBlock)(),(0,c.createElementBlock)(`h2`,h,(0,c.toDisplayString)(e.title),1)):(0,c.createCommentVNode)(``,!0),e.description?((0,c.openBlock)(),(0,c.createElementBlock)(`p`,g,(0,c.toDisplayString)(e.description),1)):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0)],!0)],8,p),t.$slots.search||t.$slots[`toolbar-actions`]?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,class:`nb-data-table__toolbar-tools`,inert:Q.value||void 0,"aria-hidden":Q.value||void 0},[(0,c.renderSlot)(t.$slots,`search`,{},void 0,!0),(0,c.renderSlot)(t.$slots,`toolbar-actions`,{},void 0,!0)],8,_)):(0,c.createCommentVNode)(``,!0),Q.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,v,[(0,c.createElementVNode)(`span`,y,(0,c.toDisplayString)(U.value)+` selected `,1),(0,c.createElementVNode)(`div`,b,[(0,c.renderSlot)(t.$slots,`batch-actions`,{selectedKeys:me.value,clear:X},void 0,!0)]),(0,c.createVNode)(a.t,{class:`nb-data-table__batch-cancel`,variant:`ghost`,size:M.value,onClick:X},{default:(0,c.withCtx)(()=>[...n[2]||=[(0,c.createTextVNode)(` Cancel `,-1)]]),_:1},8,[`size`])])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,x,[(0,c.createElementVNode)(`table`,{class:`nb-data-table__table`,"aria-label":e.ariaLabel||e.title||void 0,"aria-busy":e.loading||void 0},[(0,c.createElementVNode)(`colgroup`,null,[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`col`,te)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`col`,{key:`col-${e.key}`,style:(0,c.normalizeStyle)(L(e))},null,4))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`col`,ne)):(0,c.createCommentVNode)(``,!0)]),(0,c.createElementVNode)(`thead`,re,[(0,c.createElementVNode)(`tr`,null,[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`th`,ie,[e.selectable===`multiple`?((0,c.openBlock)(),(0,c.createBlock)(s.t,{key:0,"model-value":K.value,indeterminate:he.value,"aria-label":`Select all rows`,"onUpdate:modelValue":ve},null,8,[`model-value`,`indeterminate`])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`th`,{key:`th-${e.key}`,scope:`col`,class:(0,c.normalizeClass)([`nb-data-table__th`,`nb-data-table__th--${e.align||`left`}`,{"nb-data-table__th--sortable":e.sortable},{"nb-data-table__th--sorted":$(e)}]),"aria-sort":e.sortable?xe(e):void 0},[e.sortable?((0,c.openBlock)(),(0,c.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-data-table__sort`,onClick:t=>we(e)},[(0,c.createElementVNode)(`span`,se,[(0,c.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.header),1)],!0)]),(0,c.createVNode)(r.t,{name:Se(e),class:`nb-data-table__sort-icon`,"aria-hidden":`true`},null,8,[`name`])],8,oe)):((0,c.openBlock)(),(0,c.createElementBlock)(`span`,ce,[(0,c.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.header),1)],!0)]))],10,ae))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`th`,le,[...n[3]||=[(0,c.createElementVNode)(`span`,{class:`nb-sr-only`},`Row actions`,-1)]])):(0,c.createCommentVNode)(``,!0)])]),(0,c.createElementVNode)(`tbody`,ue,[e.loading?((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,{key:0},(0,c.renderList)(e.skeletonRows,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,{key:`skeleton-${e}`,class:`nb-data-table__row nb-data-table__row--skeleton`},[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,de,[...n[4]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,t=>((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:`sk-${e}-${t.key}`,class:`nb-data-table__td`},[...n[5]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton`},null,-1)]]))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,fe,[...n[6]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,c.createCommentVNode)(``,!0)]))),128)):e.error?((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,pe,[(0,c.createElementVNode)(`td`,{colspan:I.value,class:`nb-data-table__state nb-data-table__state--error`},[(0,c.renderSlot)(t.$slots,`error`,{error:e.error},()=>[(0,c.createVNode)(o.t,{is:`span`,align:`center`,justify:`center`,gap:`xs`,class:`nb-data-table__state-inner`},{default:(0,c.withCtx)(()=>[(0,c.createVNode)(r.t,{name:`warning-circle-fill`,"aria-hidden":`true`}),(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(e.error),1)]),_:1})],!0)],8,S)])):e.rows.length?((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,{key:3},(0,c.renderList)(e.rows,(r,i)=>((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,{key:V(r),class:(0,c.normalizeClass)([`nb-data-table__row`,{"nb-data-table__row--selected":W(r)},{"nb-data-table__row--clickable":Ee.value}]),"aria-selected":e.selectable===`none`?void 0:W(r),onClick:e=>De(r,i)},[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:0,class:`nb-data-table__td nb-data-table__select-cell`,onClick:n[0]||=(0,c.withModifiers)(()=>{},[`stop`]),onMousedown:Y,onKeydown:Y},[e.selectable===`multiple`?((0,c.openBlock)(),(0,c.createBlock)(s.t,{key:0,"model-value":W(r),"aria-label":`Select row ${i+1}`,"onUpdate:modelValue":e=>ge(r,i)},null,8,[`model-value`,`aria-label`,`onUpdate:modelValue`])):((0,c.openBlock)(),(0,c.createElementBlock)(`input`,{key:1,type:`radio`,class:`nb-data-table__radio`,name:j,checked:W(r),"aria-label":`Select row ${i+1}`,onChange:e=>_e(r)},null,40,E))],32)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:`td-${V(r)}-${e.key}`,class:(0,c.normalizeClass)([`nb-data-table__td`,`nb-data-table__td--${e.align||`left`}`,e.cellClass])},[(0,c.renderSlot)(t.$slots,`cell-${e.key}`,{row:r,value:R(e,r),column:e,rowIndex:i},()=>[e.render?((0,c.openBlock)(),(0,c.createBlock)(B,{key:0,column:e,row:r,"row-index":i},null,8,[`column`,`row`,`row-index`])):((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:1},[(0,c.createTextVNode)((0,c.toDisplayString)(z(R(e,r))),1)],64))],!0)],2))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:1,class:`nb-data-table__td nb-data-table__actions-cell`,onClick:n[1]||=(0,c.withModifiers)(()=>{},[`stop`])},[(0,c.renderSlot)(t.$slots,`row-actions`,{row:r,rowIndex:i},void 0,!0)])):(0,c.createCommentVNode)(``,!0)],10,T))),128)):((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,C,[(0,c.createElementVNode)(`td`,{colspan:I.value,class:`nb-data-table__state nb-data-table__state--empty`},[(0,c.renderSlot)(t.$slots,`empty`,{},()=>[(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(e.emptyMessage||`No data to display`),1)],!0)],8,w)]))])],8,ee)]),t.$slots.footer?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,D,[(0,c.renderSlot)(t.$slots,`footer`,{},void 0,!0)])):(0,c.createCommentVNode)(``,!0)],16))}}),k=t.t(O,[[`__scopeId`,`data-v-e2562ae7`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return k}});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./Icon-rREAqsu0.js";
|
|
2
2
|
import { useSurfaceLayer as t } from "./composables/useSurfaceLayer.composable.mjs";
|
|
3
3
|
import { t as n } from "./Label-t49uSLIY.js";
|
|
4
|
-
import { t as r } from "./Message-
|
|
4
|
+
import { t as r } from "./Message-DqUW3GHc.js";
|
|
5
5
|
import { t as i } from "./Grid-CVNb1HcS.js";
|
|
6
6
|
import { Fragment as a, Teleport as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, mergeProps as ee, nextTick as h, normalizeClass as g, onBeforeUnmount as te, openBlock as _, ref as v, renderList as ne, renderSlot as re, toDisplayString as y, unref as b, useId as ie, watch as ae, withCtx as x, withModifiers as oe } from "vue";
|
|
7
7
|
import { regular as se } from "@nubisco/ui/icons/caret-right";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Icon-C8R_r_In.cjs`),t=require(`./composables/useSurfaceLayer.composable.cjs`),n=require(`./Label-CXejhF9x.cjs`),r=require(`./Message-Daj6hLC4.cjs`),i=require(`./Grid-DVT8lBHr.cjs`);let a=require(`vue`),o=require(`@nubisco/ui/icons/caret-right`),s=require(`@nubisco/ui/icons/calendar`),c=require(`@nubisco/ui/icons/caret-double-left`),l=require(`@nubisco/ui/icons/caret-left`),u=require(`@nubisco/ui/icons/caret-double-right`);var d={class:`nb-date-picker__col`},ee=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`name`,`aria-invalid`,`aria-describedby`],te=[`disabled`,`aria-label`],ne={key:0,class:`nb-date-picker__col`},re=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`aria-invalid`,`aria-describedby`],ie=[`disabled`,`aria-label`],ae={key:0,class:`nb-date-picker__inner-header`},oe=[`for`],se={key:0,class:`nb-date-picker__asterisk`,"aria-hidden":`true`},ce={class:`nb-date-picker__fluid-row`},le=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`name`,`aria-invalid`],ue=[`disabled`,`aria-label`],de={key:0,class:`nb-date-picker__inner-header`},fe=[`for`],pe={key:0,class:`nb-date-picker__asterisk`,"aria-hidden":`true`},me={class:`nb-date-picker__fluid-row`},he=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`aria-invalid`],ge=[`disabled`,`aria-label`],_e=[`aria-label`],ve={class:`nb-date-picker__cal-header`},ye=[`id`],be=[`aria-labelledby`],xe={class:`nb-date-picker__cal-weekdays`},Se=[`abbr`],Ce=[`aria-selected`,`aria-disabled`],we=[`tabindex`,`disabled`,`aria-label`,`data-date`,`onClick`],f=(0,a.defineComponent)({inheritAttrs:!1,__name:`DatePicker`,props:{modelValue:{default:null},type:{default:`single`},endValue:{default:null},min:{default:void 0},max:{default:void 0},weekStart:{default:1},locale:{default:void 0},endPlaceholder:{default:``},endLabel:{default:``},endError:{default:``},endWarning:{default:``},disabledDates:{type:[Array,Function],default:void 0},readonly:{type:Boolean,default:!1},placeholder:{default:``},name:{default:``},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},id:{default:void 0},label:{default:``},error:{default:``},warning:{default:``},helper:{default:``},variant:{default:`default`},size:{default:`md`}},emits:[`update:modelValue`,`update:endValue`,`change`],setup(f,{expose:p,emit:Te}){let m=f,{layerProps:Ee}=t.useSurfaceLayer({overlay:!0}),h=Te,De=`nb-date-picker-${(0,a.useId)()}`,g=(0,a.computed)(()=>m.id??De),_=(0,a.computed)(()=>`${g.value}-end`),v=(0,a.computed)(()=>`${g.value}-helper`),y=(0,a.computed)(()=>`${g.value}-message`),Oe=(0,a.computed)(()=>`${g.value}-end-message`),ke=(0,a.computed)(()=>`${g.value}-cal-title`),b=(0,a.ref)(null),Ae=(0,a.computed)(()=>b.value!==null),x=(0,a.ref)(!1),S=(0,a.ref)($(new Date)),C=(0,a.ref)(null),w=(0,a.ref)(null),T=(0,a.ref)(null),E=(0,a.ref)(null),je=(0,a.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:`9999`}),D=(0,a.ref)(`start`),O=(0,a.computed)(()=>m.locale||navigator.language||`pt-PT`),k=(0,a.computed)(()=>new Intl.DateTimeFormat(O.value).formatToParts(new Date(2e3,0,15)).map(e=>e.type===`day`?`dd`:e.type===`month`?`mm`:e.type===`year`?`yyyy`:e.value).join(``));function A(e){if(!e)return``;let t=new Date(e+`T00:00:00`);return isNaN(t.getTime())?e:t.toLocaleDateString(O.value)}function Me(e){return new Date(e+`T00:00:00`).toLocaleDateString(O.value,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`})}let Ne=(0,a.computed)(()=>A(m.modelValue??null)),Pe=(0,a.computed)(()=>A(m.endValue??null)),j=(0,a.computed)(()=>m.error?{variant:`error`,text:m.error}:m.warning?{variant:`warning`,text:m.warning}:null),M=(0,a.computed)(()=>m.type===`range`?m.endError?{variant:`error`,text:m.endError}:m.endWarning?{variant:`warning`,text:m.endWarning}:null:null),N=(0,a.computed)(()=>j.value?j.value:m.helper?{variant:`helper`,text:m.helper}:null),Fe=(0,a.computed)(()=>{if(m.variant===`default`)return j.value?y.value:m.helper?v.value:void 0}),Ie=(0,a.computed)(()=>{if(m.variant===`default`)return M.value?Oe.value:m.helper?v.value:void 0}),P=(0,a.computed)(()=>m.type===`range`&&!!m.endLabel),Le=(0,a.computed)(()=>m.endLabel||m.endPlaceholder);function F(e){return m.min!=null&&e<m.min||m.max!=null&&e>m.max?!0:m.disabledDates?typeof m.disabledDates==`function`?m.disabledDates(e):m.disabledDates.includes(e):!1}function I(e){let t=e.trim();if(!t)return null;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){let e=new Date(t+`T00:00:00`);return isNaN(e.getTime())?null:t}let n=new Date(t);return isNaN(n.getTime())?null:$(n)}function Re(e){let t=e.target.value,n=I(t);n&&F(n)||(n||t===``)&&(h(`update:modelValue`,n),h(`change`,n))}function ze(e){let t=e.target.value,n=I(t);n&&F(n)||(n||t===``)&&h(`update:endValue`,n)}function L(e){b.value=e.target===T.value?`end`:`start`,m.type!==`simple`&&!m.readonly&&(D.value=b.value,x.value?B():V())}function R(){b.value=null}function z(e){if(!(m.type===`simple`||m.readonly))switch(e.key){case`Escape`:x.value&&(H(),e.preventDefault());break;case`ArrowDown`:e.preventDefault(),x.value||V(),(0,a.nextTick)(W);break;case`Enter`:x.value||(e.preventDefault(),V(),(0,a.nextTick)(W));break}}function B(){let e=C.value?.querySelectorAll(`.nb-date-picker__input-wrapper`);if(!e?.length)return;let t=(D.value===`end`&&e.length>1?e[1]:e[0]).getBoundingClientRect();je.value={position:`fixed`,top:`${t.bottom+4}px`,left:`${t.left}px`,zIndex:`9999`}}function V(){if(m.disabled||m.readonly||m.type===`simple`||x.value)return;x.value=!0;let e=D.value===`end`&&m.endValue?m.endValue:m.modelValue,t=e?new Date(e+`T00:00:00`):new Date;X.value=t.getFullYear(),Z.value=t.getMonth(),S.value=e||$(new Date),B()}function H(){x.value&&(x.value=!1,(0,a.nextTick)(()=>{D.value===`end`&&T.value?T.value.focus():w.value?.focus()}))}function U(){x.value?H():(D.value=`start`,V(),(0,a.nextTick)(W))}function W(){(0,a.nextTick)(()=>{(E.value?.querySelector(`[data-date="${S.value}"]`))?.focus()})}function Be(e){F(e)||(m.type===`range`?D.value===`start`?(h(`update:modelValue`,e),h(`change`,e),D.value=`end`,S.value=e,(0,a.nextTick)(()=>T.value?.focus())):(m.modelValue&&e<m.modelValue?(h(`update:endValue`,m.modelValue),h(`update:modelValue`,e),h(`change`,e)):h(`update:endValue`,e),H()):(h(`update:modelValue`,e),h(`change`,e),H()))}function Ve(e){let t=new Date(S.value+`T00:00:00`),n=!0;switch(e.key){case`ArrowRight`:G(t,1);break;case`ArrowLeft`:G(t,-1);break;case`ArrowDown`:G(t,7);break;case`ArrowUp`:G(t,-7);break;case`Home`:He(t,`start`);break;case`End`:He(t,`end`);break;case`PageUp`:e.shiftKey?K(t,-12):K(t,-1);break;case`PageDown`:e.shiftKey?K(t,12):K(t,1);break;case`Enter`:case` `:e.preventDefault(),Be(S.value);return;case`Escape`:H();break;case`Tab`:H();return;default:n=!1}n&&e.preventDefault()}function G(e,t){let n=new Date(e);n.setDate(n.getDate()+t),q(n)}function He(e,t){let n=e.getDay();m.weekStart===1&&(n=n===0?6:n-1);let r=t===`start`?-n:6-n,i=new Date(e);i.setDate(i.getDate()+r),q(i)}function K(e,t){let n=new Date(e);n.setMonth(n.getMonth()+t),n.getDate()!==e.getDate()&&n.setDate(0),q(n)}function q(e){let t=$(e);m.min!=null&&t<m.min||m.max!=null&&t>m.max||(S.value=t,X.value=e.getFullYear(),Z.value=e.getMonth(),W())}function J(e){let t=e.target,n=C.value?.contains(t)??!1,r=E.value?.contains(t)??!1;!n&&!r&&H()}function Y(){x.value&&B()}(0,a.watch)(x,e=>{e?(document.addEventListener(`mousedown`,J),window.addEventListener(`scroll`,Y,!0),window.addEventListener(`resize`,Y)):(document.removeEventListener(`mousedown`,J),window.removeEventListener(`scroll`,Y,!0),window.removeEventListener(`resize`,Y))}),(0,a.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,J),window.removeEventListener(`scroll`,Y,!0),window.removeEventListener(`resize`,Y)});let X=(0,a.ref)(new Date().getFullYear()),Z=(0,a.ref)(new Date().getMonth());function Q(e){let t=X.value*12+Z.value+e;X.value=Math.floor(t/12),Z.value=(t%12+12)%12;let n=new Date(S.value+`T00:00:00`).getDate(),r=new Date(X.value,Z.value+1,0).getDate();S.value=$(new Date(X.value,Z.value,Math.min(n,r))),W()}let Ue=()=>Q(-1),We=()=>Q(1),Ge=()=>Q(-12),Ke=()=>Q(12),qe=(0,a.computed)(()=>{let e=new Date(X.value,Z.value,1).toLocaleDateString(O.value,{month:`long`,year:`numeric`});return e.charAt(0).toUpperCase()+e.slice(1)}),Je=(0,a.computed)(()=>{let e=[],t=new Date(2024,0,m.weekStart===0?7:1);for(let n=0;n<7;n++){let r=new Date(t);r.setDate(t.getDate()+n);let i=r.toLocaleDateString(O.value,{weekday:`narrow`}).toUpperCase(),a=r.toLocaleDateString(O.value,{weekday:`long`});e.push({narrow:i,full:a.charAt(0).toUpperCase()+a.slice(1)})}return e});function $(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}let Ye=(0,a.computed)(()=>$(new Date)),Xe=(0,a.computed)(()=>{let e=X.value,t=Z.value,n=new Date(e,t,1),r=new Date(e,t+1,0),i=n.getDay();m.weekStart===1&&(i=i===0?6:i-1);let a=[],o=m.modelValue??null,s=m.endValue??null,c=o&&s?o<s?o:s:null,l=o&&s?o<s?s:o:null;function u(e,t){let n=$(e);return{key:n,date:n,day:e.getDate(),inMonth:t,isToday:n===Ye.value,isSelected:n===o||n===s,inRange:c!=null&&l!=null&&n>c&&n<l,isRangeStart:n===c&&l!=null,isRangeEnd:n===l&&c!=null,isDisabled:F(n)}}for(let n=i-1;n>=0;n--)a.push(u(new Date(e,t,-n),!1));for(let n=1;n<=r.getDate();n++)a.push(u(new Date(e,t,n),!0));let d=7-a.length%7;if(d<7)for(let n=1;n<=d;n++)a.push(u(new Date(e,t+1,n),!1));return a}),Ze=(0,a.computed)(()=>{let e=[];for(let t=0;t<Xe.value.length;t+=7)e.push(Xe.value.slice(t,t+7));return e}),Qe=(0,a.computed)(()=>[`nb-date-picker`,`nb-date-picker--${m.variant}`,`nb-date-picker--${m.size}`,`nb-date-picker--${m.type}`,{"nb-date-picker--focused":Ae.value,"nb-date-picker--open":x.value,"nb-date-picker--error":!!m.error||!!m.endError,"nb-date-picker--warning":!m.error&&!m.endError&&(!!m.warning||!!m.endWarning),"nb-date-picker--disabled":m.disabled,"nb-date-picker--readonly":m.readonly}]),$e=(0,a.computed)(()=>({"nb-date-picker__input-wrapper--focused":b.value===`start`,"nb-date-picker__input-wrapper--error":!!m.error,"nb-date-picker__input-wrapper--warning":!m.error&&!!m.warning,"nb-date-picker__input-wrapper--disabled":m.disabled,"nb-date-picker__input-wrapper--readonly":m.readonly})),et=(0,a.computed)(()=>({"nb-date-picker__input-wrapper--focused":b.value===`end`,"nb-date-picker__input-wrapper--error":!!m.endError,"nb-date-picker__input-wrapper--warning":!m.endError&&!!m.endWarning,"nb-date-picker__input-wrapper--disabled":m.disabled,"nb-date-picker__input-wrapper--readonly":m.readonly}));return p({open:V,close:H,focus:()=>w.value?.focus()}),(t,p)=>((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,null,[(0,a.createElementVNode)(`div`,{ref_key:`rootRef`,ref:C,class:(0,a.normalizeClass)(Qe.value)},[f.variant===`default`?((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:0},[t.$slots.label?(0,a.renderSlot)(t.$slots,`label`,{key:0}):f.label&&!P.value?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:1,for:g.value,required:f.required,disabled:f.disabled},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(f.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,a.createCommentVNode)(``,!0),(0,a.createVNode)(i.t,{dir:`row`,gap:f.type===`range`?`sm`:void 0,class:`nb-date-picker__fields`},{default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`div`,d,[P.value&&f.label?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:0,for:g.value,required:f.required,disabled:f.disabled},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(f.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,{class:(0,a.normalizeClass)([`nb-date-picker__input-wrapper`,$e.value])},[(0,a.createElementVNode)(`input`,(0,a.mergeProps)({id:g.value,ref_key:`inputRef`,ref:w},t.$attrs,{type:`text`,class:`nb-date-picker__field`,value:Ne.value,placeholder:f.placeholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,name:f.name,"aria-invalid":f.error?!0:void 0,"aria-describedby":Fe.value,onInput:p[0]||=e=>Re(e),onFocus:L,onBlur:R,onKeydown:z}),null,16,ee),f.type===`simple`?(0,a.createCommentVNode)(``,!0):((0,a.openBlock)(),(0,a.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.modelValue?`Change date, ${A(f.modelValue)}`:`Choose date`,onClick:U},[(0,a.createVNode)(e.t,{name:(0,a.unref)(s.regular),size:16},null,8,[`name`])],8,te))],2)]),f.type===`range`?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,ne,[P.value?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:0,for:_.value,required:f.required,disabled:f.disabled},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(f.endLabel),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,{class:(0,a.normalizeClass)([`nb-date-picker__input-wrapper`,et.value])},[(0,a.createElementVNode)(`input`,{id:_.value,ref_key:`endInputRef`,ref:T,type:`text`,class:`nb-date-picker__field`,value:Pe.value,placeholder:f.endPlaceholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,"aria-invalid":f.endError?!0:void 0,"aria-describedby":Ie.value,onInput:p[1]||=e=>ze(e),onFocus:L,onBlur:R,onKeydown:z},null,40,re),(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.endValue?`Change end date, ${A(f.endValue)}`:`Choose end date`,onClick:U},[(0,a.createVNode)(e.t,{name:(0,a.unref)(s.regular),size:16},null,8,[`name`])],8,ie)],2)])):(0,a.createCommentVNode)(``,!0)]),_:1},8,[`gap`]),j.value?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:2,id:y.value,variant:j.value.variant,class:`nb-date-picker__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(j.value.text),1)]),_:1},8,[`id`,`variant`])):(0,a.createCommentVNode)(``,!0),M.value?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:3,id:Oe.value,variant:M.value.variant,class:`nb-date-picker__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(M.value.text),1)]),_:1},8,[`id`,`variant`])):(0,a.createCommentVNode)(``,!0),!j.value&&!M.value&&f.helper?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:4,id:v.value,variant:`helper`,class:`nb-date-picker__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(f.helper),1)]),_:1},8,[`id`])):(0,a.createCommentVNode)(``,!0)],64)):f.variant===`fluid`?((0,a.openBlock)(),(0,a.createBlock)(i.t,{key:1,dir:`row`,gap:f.type===`range`?`sm`:void 0,class:`nb-date-picker__fields`},{default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`div`,{class:(0,a.normalizeClass)([`nb-date-picker__input-wrapper nb-date-picker__input-wrapper--fluid`,$e.value])},[f.label||t.$slots.label||N.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,ae,[t.$slots.label?(0,a.renderSlot)(t.$slots,`label`,{key:0}):((0,a.openBlock)(),(0,a.createElementBlock)(`label`,{key:1,for:g.value,class:`nb-date-picker__inner-label`},[(0,a.createTextVNode)((0,a.toDisplayString)(f.label)+` `,1),f.required?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,se,`*`)):(0,a.createCommentVNode)(``,!0)],8,oe)),N.value?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:2,variant:N.value.variant,"icon-only":``,class:`nb-date-picker__inner-message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(N.value.text),1)]),_:1},8,[`variant`])):(0,a.createCommentVNode)(``,!0)])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,ce,[(0,a.createElementVNode)(`input`,(0,a.mergeProps)({id:g.value,ref_key:`inputRef`,ref:w},t.$attrs,{type:`text`,class:`nb-date-picker__field`,value:Ne.value,placeholder:f.placeholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,name:f.name,"aria-invalid":f.error?!0:void 0,onInput:p[2]||=e=>Re(e),onFocus:L,onBlur:R,onKeydown:z}),null,16,le),f.type===`simple`?(0,a.createCommentVNode)(``,!0):((0,a.openBlock)(),(0,a.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.modelValue?`Change date, ${A(f.modelValue)}`:`Choose date`,onClick:U},[(0,a.createVNode)(e.t,{name:(0,a.unref)(s.regular),size:16},null,8,[`name`])],8,ue))])],2),f.type===`range`?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:0,class:(0,a.normalizeClass)([`nb-date-picker__input-wrapper nb-date-picker__input-wrapper--fluid`,et.value])},[Le.value||M.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,de,[(0,a.createElementVNode)(`label`,{for:_.value,class:`nb-date-picker__inner-label`},[(0,a.createTextVNode)((0,a.toDisplayString)(Le.value)+` `,1),f.required?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,pe,`*`)):(0,a.createCommentVNode)(``,!0)],8,fe),M.value?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:0,variant:M.value.variant,"icon-only":``,class:`nb-date-picker__inner-message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(M.value.text),1)]),_:1},8,[`variant`])):(0,a.createCommentVNode)(``,!0)])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,me,[(0,a.createElementVNode)(`input`,{id:_.value,ref_key:`endInputRef`,ref:T,type:`text`,class:`nb-date-picker__field`,value:Pe.value,placeholder:f.endPlaceholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,"aria-invalid":f.endError?!0:void 0,onInput:p[3]||=e=>ze(e),onFocus:L,onBlur:R,onKeydown:z},null,40,he),(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.endValue?`Change end date, ${A(f.endValue)}`:`Choose end date`,onClick:U},[(0,a.createVNode)(e.t,{name:(0,a.unref)(s.regular),size:16},null,8,[`name`])],8,ge)])],2)):(0,a.createCommentVNode)(``,!0)]),_:3},8,[`gap`])):(0,a.createCommentVNode)(``,!0)],2),((0,a.openBlock)(),(0,a.createBlock)(a.Teleport,{to:`body`},[x.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,(0,a.mergeProps)({key:0,ref_key:`calendarRef`,ref:E,role:`dialog`,"aria-modal":`true`,"aria-label":f.label?`${f.label} calendar`:`Date picker`,class:`nb-date-picker__calendar`},(0,a.unref)(Ee),{style:je.value,onKeydown:Ve,onMousedown:p[4]||=(0,a.withModifiers)(()=>{},[`prevent`])}),[(0,a.createElementVNode)(`div`,ve,[(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Previous year`,onClick:Ge},[(0,a.createVNode)(e.t,{name:(0,a.unref)(c.regular),size:16},null,8,[`name`])]),(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Previous month`,onClick:Ue},[(0,a.createVNode)(e.t,{name:(0,a.unref)(l.regular),size:16},null,8,[`name`])]),(0,a.createElementVNode)(`span`,{id:ke.value,class:`nb-date-picker__cal-title`,"aria-live":`polite`},(0,a.toDisplayString)(qe.value),9,ye),(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Next month`,onClick:We},[(0,a.createVNode)(e.t,{name:(0,a.unref)(o.regular),size:16},null,8,[`name`])]),(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Next year`,onClick:Ke},[(0,a.createVNode)(e.t,{name:(0,a.unref)(u.regular),size:16},null,8,[`name`])])]),(0,a.createElementVNode)(`table`,{role:`grid`,"aria-labelledby":ke.value,class:`nb-date-picker__cal-table`},[(0,a.createElementVNode)(`thead`,null,[(0,a.createElementVNode)(`tr`,xe,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(Je.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`th`,{key:e.narrow,scope:`col`,class:`nb-date-picker__cal-weekday`,abbr:e.full},(0,a.toDisplayString)(e.narrow),9,Se))),128))])]),(0,a.createElementVNode)(`tbody`,null,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(Ze.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`tr`,{key:t},[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(e,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`td`,{key:e.key,role:`gridcell`,"aria-selected":e.isSelected||void 0,"aria-disabled":e.isDisabled||void 0},[(0,a.createElementVNode)(`button`,{type:`button`,class:(0,a.normalizeClass)([`nb-date-picker__cal-day`,{"nb-date-picker__cal-day--outside":!e.inMonth,"nb-date-picker__cal-day--today":e.isToday,"nb-date-picker__cal-day--selected":e.isSelected,"nb-date-picker__cal-day--in-range":e.inRange,"nb-date-picker__cal-day--range-start":e.isRangeStart,"nb-date-picker__cal-day--range-end":e.isRangeEnd,"nb-date-picker__cal-day--disabled":e.isDisabled,"nb-date-picker__cal-day--focused":e.date===S.value}]),tabindex:e.date===S.value?0:-1,disabled:e.isDisabled,"aria-label":Me(e.date),"data-date":e.date,onClick:t=>Be(e.date)},(0,a.toDisplayString)(e.day),11,we)],8,Ce))),128))]))),128))])],8,be)],16,_e)):(0,a.createCommentVNode)(``,!0)]))],64))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Icon-C8R_r_In.cjs`),t=require(`./composables/useSurfaceLayer.composable.cjs`),n=require(`./Label-CXejhF9x.cjs`),r=require(`./Message-Ax7rnAQl.cjs`),i=require(`./Grid-DVT8lBHr.cjs`);let a=require(`vue`),o=require(`@nubisco/ui/icons/caret-right`),s=require(`@nubisco/ui/icons/calendar`),c=require(`@nubisco/ui/icons/caret-double-left`),l=require(`@nubisco/ui/icons/caret-left`),u=require(`@nubisco/ui/icons/caret-double-right`);var d={class:`nb-date-picker__col`},ee=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`name`,`aria-invalid`,`aria-describedby`],te=[`disabled`,`aria-label`],ne={key:0,class:`nb-date-picker__col`},re=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`aria-invalid`,`aria-describedby`],ie=[`disabled`,`aria-label`],ae={key:0,class:`nb-date-picker__inner-header`},oe=[`for`],se={key:0,class:`nb-date-picker__asterisk`,"aria-hidden":`true`},ce={class:`nb-date-picker__fluid-row`},le=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`name`,`aria-invalid`],ue=[`disabled`,`aria-label`],de={key:0,class:`nb-date-picker__inner-header`},fe=[`for`],pe={key:0,class:`nb-date-picker__asterisk`,"aria-hidden":`true`},me={class:`nb-date-picker__fluid-row`},he=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`required`,`aria-invalid`],ge=[`disabled`,`aria-label`],_e=[`aria-label`],ve={class:`nb-date-picker__cal-header`},ye=[`id`],be=[`aria-labelledby`],xe={class:`nb-date-picker__cal-weekdays`},Se=[`abbr`],Ce=[`aria-selected`,`aria-disabled`],we=[`tabindex`,`disabled`,`aria-label`,`data-date`,`onClick`],f=(0,a.defineComponent)({inheritAttrs:!1,__name:`DatePicker`,props:{modelValue:{default:null},type:{default:`single`},endValue:{default:null},min:{default:void 0},max:{default:void 0},weekStart:{default:1},locale:{default:void 0},endPlaceholder:{default:``},endLabel:{default:``},endError:{default:``},endWarning:{default:``},disabledDates:{type:[Array,Function],default:void 0},readonly:{type:Boolean,default:!1},placeholder:{default:``},name:{default:``},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},id:{default:void 0},label:{default:``},error:{default:``},warning:{default:``},helper:{default:``},variant:{default:`default`},size:{default:`md`}},emits:[`update:modelValue`,`update:endValue`,`change`],setup(f,{expose:p,emit:Te}){let m=f,{layerProps:Ee}=t.useSurfaceLayer({overlay:!0}),h=Te,De=`nb-date-picker-${(0,a.useId)()}`,g=(0,a.computed)(()=>m.id??De),_=(0,a.computed)(()=>`${g.value}-end`),v=(0,a.computed)(()=>`${g.value}-helper`),y=(0,a.computed)(()=>`${g.value}-message`),Oe=(0,a.computed)(()=>`${g.value}-end-message`),ke=(0,a.computed)(()=>`${g.value}-cal-title`),b=(0,a.ref)(null),Ae=(0,a.computed)(()=>b.value!==null),x=(0,a.ref)(!1),S=(0,a.ref)($(new Date)),C=(0,a.ref)(null),w=(0,a.ref)(null),T=(0,a.ref)(null),E=(0,a.ref)(null),je=(0,a.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:`9999`}),D=(0,a.ref)(`start`),O=(0,a.computed)(()=>m.locale||navigator.language||`pt-PT`),k=(0,a.computed)(()=>new Intl.DateTimeFormat(O.value).formatToParts(new Date(2e3,0,15)).map(e=>e.type===`day`?`dd`:e.type===`month`?`mm`:e.type===`year`?`yyyy`:e.value).join(``));function A(e){if(!e)return``;let t=new Date(e+`T00:00:00`);return isNaN(t.getTime())?e:t.toLocaleDateString(O.value)}function Me(e){return new Date(e+`T00:00:00`).toLocaleDateString(O.value,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`})}let Ne=(0,a.computed)(()=>A(m.modelValue??null)),Pe=(0,a.computed)(()=>A(m.endValue??null)),j=(0,a.computed)(()=>m.error?{variant:`error`,text:m.error}:m.warning?{variant:`warning`,text:m.warning}:null),M=(0,a.computed)(()=>m.type===`range`?m.endError?{variant:`error`,text:m.endError}:m.endWarning?{variant:`warning`,text:m.endWarning}:null:null),N=(0,a.computed)(()=>j.value?j.value:m.helper?{variant:`helper`,text:m.helper}:null),Fe=(0,a.computed)(()=>{if(m.variant===`default`)return j.value?y.value:m.helper?v.value:void 0}),Ie=(0,a.computed)(()=>{if(m.variant===`default`)return M.value?Oe.value:m.helper?v.value:void 0}),P=(0,a.computed)(()=>m.type===`range`&&!!m.endLabel),Le=(0,a.computed)(()=>m.endLabel||m.endPlaceholder);function F(e){return m.min!=null&&e<m.min||m.max!=null&&e>m.max?!0:m.disabledDates?typeof m.disabledDates==`function`?m.disabledDates(e):m.disabledDates.includes(e):!1}function I(e){let t=e.trim();if(!t)return null;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){let e=new Date(t+`T00:00:00`);return isNaN(e.getTime())?null:t}let n=new Date(t);return isNaN(n.getTime())?null:$(n)}function Re(e){let t=e.target.value,n=I(t);n&&F(n)||(n||t===``)&&(h(`update:modelValue`,n),h(`change`,n))}function ze(e){let t=e.target.value,n=I(t);n&&F(n)||(n||t===``)&&h(`update:endValue`,n)}function L(e){b.value=e.target===T.value?`end`:`start`,m.type!==`simple`&&!m.readonly&&(D.value=b.value,x.value?B():V())}function R(){b.value=null}function z(e){if(!(m.type===`simple`||m.readonly))switch(e.key){case`Escape`:x.value&&(H(),e.preventDefault());break;case`ArrowDown`:e.preventDefault(),x.value||V(),(0,a.nextTick)(W);break;case`Enter`:x.value||(e.preventDefault(),V(),(0,a.nextTick)(W));break}}function B(){let e=C.value?.querySelectorAll(`.nb-date-picker__input-wrapper`);if(!e?.length)return;let t=(D.value===`end`&&e.length>1?e[1]:e[0]).getBoundingClientRect();je.value={position:`fixed`,top:`${t.bottom+4}px`,left:`${t.left}px`,zIndex:`9999`}}function V(){if(m.disabled||m.readonly||m.type===`simple`||x.value)return;x.value=!0;let e=D.value===`end`&&m.endValue?m.endValue:m.modelValue,t=e?new Date(e+`T00:00:00`):new Date;X.value=t.getFullYear(),Z.value=t.getMonth(),S.value=e||$(new Date),B()}function H(){x.value&&(x.value=!1,(0,a.nextTick)(()=>{D.value===`end`&&T.value?T.value.focus():w.value?.focus()}))}function U(){x.value?H():(D.value=`start`,V(),(0,a.nextTick)(W))}function W(){(0,a.nextTick)(()=>{(E.value?.querySelector(`[data-date="${S.value}"]`))?.focus()})}function Be(e){F(e)||(m.type===`range`?D.value===`start`?(h(`update:modelValue`,e),h(`change`,e),D.value=`end`,S.value=e,(0,a.nextTick)(()=>T.value?.focus())):(m.modelValue&&e<m.modelValue?(h(`update:endValue`,m.modelValue),h(`update:modelValue`,e),h(`change`,e)):h(`update:endValue`,e),H()):(h(`update:modelValue`,e),h(`change`,e),H()))}function Ve(e){let t=new Date(S.value+`T00:00:00`),n=!0;switch(e.key){case`ArrowRight`:G(t,1);break;case`ArrowLeft`:G(t,-1);break;case`ArrowDown`:G(t,7);break;case`ArrowUp`:G(t,-7);break;case`Home`:He(t,`start`);break;case`End`:He(t,`end`);break;case`PageUp`:e.shiftKey?K(t,-12):K(t,-1);break;case`PageDown`:e.shiftKey?K(t,12):K(t,1);break;case`Enter`:case` `:e.preventDefault(),Be(S.value);return;case`Escape`:H();break;case`Tab`:H();return;default:n=!1}n&&e.preventDefault()}function G(e,t){let n=new Date(e);n.setDate(n.getDate()+t),q(n)}function He(e,t){let n=e.getDay();m.weekStart===1&&(n=n===0?6:n-1);let r=t===`start`?-n:6-n,i=new Date(e);i.setDate(i.getDate()+r),q(i)}function K(e,t){let n=new Date(e);n.setMonth(n.getMonth()+t),n.getDate()!==e.getDate()&&n.setDate(0),q(n)}function q(e){let t=$(e);m.min!=null&&t<m.min||m.max!=null&&t>m.max||(S.value=t,X.value=e.getFullYear(),Z.value=e.getMonth(),W())}function J(e){let t=e.target,n=C.value?.contains(t)??!1,r=E.value?.contains(t)??!1;!n&&!r&&H()}function Y(){x.value&&B()}(0,a.watch)(x,e=>{e?(document.addEventListener(`mousedown`,J),window.addEventListener(`scroll`,Y,!0),window.addEventListener(`resize`,Y)):(document.removeEventListener(`mousedown`,J),window.removeEventListener(`scroll`,Y,!0),window.removeEventListener(`resize`,Y))}),(0,a.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,J),window.removeEventListener(`scroll`,Y,!0),window.removeEventListener(`resize`,Y)});let X=(0,a.ref)(new Date().getFullYear()),Z=(0,a.ref)(new Date().getMonth());function Q(e){let t=X.value*12+Z.value+e;X.value=Math.floor(t/12),Z.value=(t%12+12)%12;let n=new Date(S.value+`T00:00:00`).getDate(),r=new Date(X.value,Z.value+1,0).getDate();S.value=$(new Date(X.value,Z.value,Math.min(n,r))),W()}let Ue=()=>Q(-1),We=()=>Q(1),Ge=()=>Q(-12),Ke=()=>Q(12),qe=(0,a.computed)(()=>{let e=new Date(X.value,Z.value,1).toLocaleDateString(O.value,{month:`long`,year:`numeric`});return e.charAt(0).toUpperCase()+e.slice(1)}),Je=(0,a.computed)(()=>{let e=[],t=new Date(2024,0,m.weekStart===0?7:1);for(let n=0;n<7;n++){let r=new Date(t);r.setDate(t.getDate()+n);let i=r.toLocaleDateString(O.value,{weekday:`narrow`}).toUpperCase(),a=r.toLocaleDateString(O.value,{weekday:`long`});e.push({narrow:i,full:a.charAt(0).toUpperCase()+a.slice(1)})}return e});function $(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}let Ye=(0,a.computed)(()=>$(new Date)),Xe=(0,a.computed)(()=>{let e=X.value,t=Z.value,n=new Date(e,t,1),r=new Date(e,t+1,0),i=n.getDay();m.weekStart===1&&(i=i===0?6:i-1);let a=[],o=m.modelValue??null,s=m.endValue??null,c=o&&s?o<s?o:s:null,l=o&&s?o<s?s:o:null;function u(e,t){let n=$(e);return{key:n,date:n,day:e.getDate(),inMonth:t,isToday:n===Ye.value,isSelected:n===o||n===s,inRange:c!=null&&l!=null&&n>c&&n<l,isRangeStart:n===c&&l!=null,isRangeEnd:n===l&&c!=null,isDisabled:F(n)}}for(let n=i-1;n>=0;n--)a.push(u(new Date(e,t,-n),!1));for(let n=1;n<=r.getDate();n++)a.push(u(new Date(e,t,n),!0));let d=7-a.length%7;if(d<7)for(let n=1;n<=d;n++)a.push(u(new Date(e,t+1,n),!1));return a}),Ze=(0,a.computed)(()=>{let e=[];for(let t=0;t<Xe.value.length;t+=7)e.push(Xe.value.slice(t,t+7));return e}),Qe=(0,a.computed)(()=>[`nb-date-picker`,`nb-date-picker--${m.variant}`,`nb-date-picker--${m.size}`,`nb-date-picker--${m.type}`,{"nb-date-picker--focused":Ae.value,"nb-date-picker--open":x.value,"nb-date-picker--error":!!m.error||!!m.endError,"nb-date-picker--warning":!m.error&&!m.endError&&(!!m.warning||!!m.endWarning),"nb-date-picker--disabled":m.disabled,"nb-date-picker--readonly":m.readonly}]),$e=(0,a.computed)(()=>({"nb-date-picker__input-wrapper--focused":b.value===`start`,"nb-date-picker__input-wrapper--error":!!m.error,"nb-date-picker__input-wrapper--warning":!m.error&&!!m.warning,"nb-date-picker__input-wrapper--disabled":m.disabled,"nb-date-picker__input-wrapper--readonly":m.readonly})),et=(0,a.computed)(()=>({"nb-date-picker__input-wrapper--focused":b.value===`end`,"nb-date-picker__input-wrapper--error":!!m.endError,"nb-date-picker__input-wrapper--warning":!m.endError&&!!m.endWarning,"nb-date-picker__input-wrapper--disabled":m.disabled,"nb-date-picker__input-wrapper--readonly":m.readonly}));return p({open:V,close:H,focus:()=>w.value?.focus()}),(t,p)=>((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,null,[(0,a.createElementVNode)(`div`,{ref_key:`rootRef`,ref:C,class:(0,a.normalizeClass)(Qe.value)},[f.variant===`default`?((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:0},[t.$slots.label?(0,a.renderSlot)(t.$slots,`label`,{key:0}):f.label&&!P.value?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:1,for:g.value,required:f.required,disabled:f.disabled},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(f.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,a.createCommentVNode)(``,!0),(0,a.createVNode)(i.t,{dir:`row`,gap:f.type===`range`?`sm`:void 0,class:`nb-date-picker__fields`},{default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`div`,d,[P.value&&f.label?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:0,for:g.value,required:f.required,disabled:f.disabled},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(f.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,{class:(0,a.normalizeClass)([`nb-date-picker__input-wrapper`,$e.value])},[(0,a.createElementVNode)(`input`,(0,a.mergeProps)({id:g.value,ref_key:`inputRef`,ref:w},t.$attrs,{type:`text`,class:`nb-date-picker__field`,value:Ne.value,placeholder:f.placeholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,name:f.name,"aria-invalid":f.error?!0:void 0,"aria-describedby":Fe.value,onInput:p[0]||=e=>Re(e),onFocus:L,onBlur:R,onKeydown:z}),null,16,ee),f.type===`simple`?(0,a.createCommentVNode)(``,!0):((0,a.openBlock)(),(0,a.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.modelValue?`Change date, ${A(f.modelValue)}`:`Choose date`,onClick:U},[(0,a.createVNode)(e.t,{name:(0,a.unref)(s.regular),size:16},null,8,[`name`])],8,te))],2)]),f.type===`range`?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,ne,[P.value?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:0,for:_.value,required:f.required,disabled:f.disabled},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(f.endLabel),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,{class:(0,a.normalizeClass)([`nb-date-picker__input-wrapper`,et.value])},[(0,a.createElementVNode)(`input`,{id:_.value,ref_key:`endInputRef`,ref:T,type:`text`,class:`nb-date-picker__field`,value:Pe.value,placeholder:f.endPlaceholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,"aria-invalid":f.endError?!0:void 0,"aria-describedby":Ie.value,onInput:p[1]||=e=>ze(e),onFocus:L,onBlur:R,onKeydown:z},null,40,re),(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.endValue?`Change end date, ${A(f.endValue)}`:`Choose end date`,onClick:U},[(0,a.createVNode)(e.t,{name:(0,a.unref)(s.regular),size:16},null,8,[`name`])],8,ie)],2)])):(0,a.createCommentVNode)(``,!0)]),_:1},8,[`gap`]),j.value?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:2,id:y.value,variant:j.value.variant,class:`nb-date-picker__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(j.value.text),1)]),_:1},8,[`id`,`variant`])):(0,a.createCommentVNode)(``,!0),M.value?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:3,id:Oe.value,variant:M.value.variant,class:`nb-date-picker__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(M.value.text),1)]),_:1},8,[`id`,`variant`])):(0,a.createCommentVNode)(``,!0),!j.value&&!M.value&&f.helper?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:4,id:v.value,variant:`helper`,class:`nb-date-picker__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(f.helper),1)]),_:1},8,[`id`])):(0,a.createCommentVNode)(``,!0)],64)):f.variant===`fluid`?((0,a.openBlock)(),(0,a.createBlock)(i.t,{key:1,dir:`row`,gap:f.type===`range`?`sm`:void 0,class:`nb-date-picker__fields`},{default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`div`,{class:(0,a.normalizeClass)([`nb-date-picker__input-wrapper nb-date-picker__input-wrapper--fluid`,$e.value])},[f.label||t.$slots.label||N.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,ae,[t.$slots.label?(0,a.renderSlot)(t.$slots,`label`,{key:0}):((0,a.openBlock)(),(0,a.createElementBlock)(`label`,{key:1,for:g.value,class:`nb-date-picker__inner-label`},[(0,a.createTextVNode)((0,a.toDisplayString)(f.label)+` `,1),f.required?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,se,`*`)):(0,a.createCommentVNode)(``,!0)],8,oe)),N.value?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:2,variant:N.value.variant,"icon-only":``,class:`nb-date-picker__inner-message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(N.value.text),1)]),_:1},8,[`variant`])):(0,a.createCommentVNode)(``,!0)])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,ce,[(0,a.createElementVNode)(`input`,(0,a.mergeProps)({id:g.value,ref_key:`inputRef`,ref:w},t.$attrs,{type:`text`,class:`nb-date-picker__field`,value:Ne.value,placeholder:f.placeholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,name:f.name,"aria-invalid":f.error?!0:void 0,onInput:p[2]||=e=>Re(e),onFocus:L,onBlur:R,onKeydown:z}),null,16,le),f.type===`simple`?(0,a.createCommentVNode)(``,!0):((0,a.openBlock)(),(0,a.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.modelValue?`Change date, ${A(f.modelValue)}`:`Choose date`,onClick:U},[(0,a.createVNode)(e.t,{name:(0,a.unref)(s.regular),size:16},null,8,[`name`])],8,ue))])],2),f.type===`range`?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:0,class:(0,a.normalizeClass)([`nb-date-picker__input-wrapper nb-date-picker__input-wrapper--fluid`,et.value])},[Le.value||M.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,de,[(0,a.createElementVNode)(`label`,{for:_.value,class:`nb-date-picker__inner-label`},[(0,a.createTextVNode)((0,a.toDisplayString)(Le.value)+` `,1),f.required?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,pe,`*`)):(0,a.createCommentVNode)(``,!0)],8,fe),M.value?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:0,variant:M.value.variant,"icon-only":``,class:`nb-date-picker__inner-message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(M.value.text),1)]),_:1},8,[`variant`])):(0,a.createCommentVNode)(``,!0)])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,me,[(0,a.createElementVNode)(`input`,{id:_.value,ref_key:`endInputRef`,ref:T,type:`text`,class:`nb-date-picker__field`,value:Pe.value,placeholder:f.endPlaceholder||k.value,disabled:f.disabled,readonly:f.readonly,required:f.required,"aria-invalid":f.endError?!0:void 0,onInput:p[3]||=e=>ze(e),onFocus:L,onBlur:R,onKeydown:z},null,40,he),(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__icon`,disabled:f.disabled||f.readonly,tabindex:`-1`,"aria-label":f.endValue?`Change end date, ${A(f.endValue)}`:`Choose end date`,onClick:U},[(0,a.createVNode)(e.t,{name:(0,a.unref)(s.regular),size:16},null,8,[`name`])],8,ge)])],2)):(0,a.createCommentVNode)(``,!0)]),_:3},8,[`gap`])):(0,a.createCommentVNode)(``,!0)],2),((0,a.openBlock)(),(0,a.createBlock)(a.Teleport,{to:`body`},[x.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,(0,a.mergeProps)({key:0,ref_key:`calendarRef`,ref:E,role:`dialog`,"aria-modal":`true`,"aria-label":f.label?`${f.label} calendar`:`Date picker`,class:`nb-date-picker__calendar`},(0,a.unref)(Ee),{style:je.value,onKeydown:Ve,onMousedown:p[4]||=(0,a.withModifiers)(()=>{},[`prevent`])}),[(0,a.createElementVNode)(`div`,ve,[(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Previous year`,onClick:Ge},[(0,a.createVNode)(e.t,{name:(0,a.unref)(c.regular),size:16},null,8,[`name`])]),(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Previous month`,onClick:Ue},[(0,a.createVNode)(e.t,{name:(0,a.unref)(l.regular),size:16},null,8,[`name`])]),(0,a.createElementVNode)(`span`,{id:ke.value,class:`nb-date-picker__cal-title`,"aria-live":`polite`},(0,a.toDisplayString)(qe.value),9,ye),(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Next month`,onClick:We},[(0,a.createVNode)(e.t,{name:(0,a.unref)(o.regular),size:16},null,8,[`name`])]),(0,a.createElementVNode)(`button`,{type:`button`,class:`nb-date-picker__cal-nav`,"aria-label":`Next year`,onClick:Ke},[(0,a.createVNode)(e.t,{name:(0,a.unref)(u.regular),size:16},null,8,[`name`])])]),(0,a.createElementVNode)(`table`,{role:`grid`,"aria-labelledby":ke.value,class:`nb-date-picker__cal-table`},[(0,a.createElementVNode)(`thead`,null,[(0,a.createElementVNode)(`tr`,xe,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(Je.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`th`,{key:e.narrow,scope:`col`,class:`nb-date-picker__cal-weekday`,abbr:e.full},(0,a.toDisplayString)(e.narrow),9,Se))),128))])]),(0,a.createElementVNode)(`tbody`,null,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(Ze.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`tr`,{key:t},[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(e,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`td`,{key:e.key,role:`gridcell`,"aria-selected":e.isSelected||void 0,"aria-disabled":e.isDisabled||void 0},[(0,a.createElementVNode)(`button`,{type:`button`,class:(0,a.normalizeClass)([`nb-date-picker__cal-day`,{"nb-date-picker__cal-day--outside":!e.inMonth,"nb-date-picker__cal-day--today":e.isToday,"nb-date-picker__cal-day--selected":e.isSelected,"nb-date-picker__cal-day--in-range":e.inRange,"nb-date-picker__cal-day--range-start":e.isRangeStart,"nb-date-picker__cal-day--range-end":e.isRangeEnd,"nb-date-picker__cal-day--disabled":e.isDisabled,"nb-date-picker__cal-day--focused":e.date===S.value}]),tabindex:e.date===S.value?0:-1,disabled:e.isDisabled,"aria-label":Me(e.date),"data-date":e.date,onClick:t=>Be(e.date)},(0,a.toDisplayString)(e.day),11,we)],8,Ce))),128))]))),128))])],8,be)],16,_e)):(0,a.createCommentVNode)(``,!0)]))],64))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Icon-C8R_r_In.cjs`);let r=require(`vue`),i=require(`@nubisco/ui/icons/tray`);i=e.n(i);let a=require(`@nubisco/ui/icons/magnifying-glass`);a=e.n(a);let o=require(`@nubisco/ui/icons/warning-circle`);o=e.n(o);let s=require(`@nubisco/ui/icons/lock-simple`);s=e.n(s);var c={key:0,class:`nb-empty-state__icon`},l={key:1,class:`nb-empty-state__title`},u={key:2,class:`nb-empty-state__description`},d={key:3,class:`nb-empty-state__actions`},f=(0,r.defineComponent)({__name:`EmptyState`,props:{title:{default:``},description:{default:``},icon:{default:void 0},kind:{default:`empty`},size:{default:`md`},bordered:{type:Boolean,default:!1}},setup(e){let t=e,f={empty:i,"no-results":a,error:o,forbidden:s},p=(0,r.computed)(()=>t.icon===null?null:t.icon??f[t.kind]??f.empty);return(t,i)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{class:(0,r.normalizeClass)([`nb-empty-state`,[`nb-empty-state--${e.size}`,`nb-empty-state--${e.kind}`,{"nb-empty-state--bordered":e.bordered}]])},[p.value||t.$slots.icon?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,c,[(0,r.renderSlot)(t.$slots,`icon`,{},()=>[(0,r.createVNode)(n.t,{name:p.value,size:e.size===`sm`?24:32},null,8,[`name`,`size`])],!0)])):(0,r.createCommentVNode)(``,!0),e.title||t.$slots.title?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,l,[(0,r.renderSlot)(t.$slots,`title`,{},()=>[(0,r.createTextVNode)((0,r.toDisplayString)(e.title),1)],!0)])):(0,r.createCommentVNode)(``,!0),e.description||t.$slots.default?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,u,[(0,r.renderSlot)(t.$slots,`default`,{},()=>[(0,r.createTextVNode)((0,r.toDisplayString)(e.description),1)],!0)])):(0,r.createCommentVNode)(``,!0),t.$slots.actions?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,d,[(0,r.renderSlot)(t.$slots,`actions`,{},void 0,!0)])):(0,r.createCommentVNode)(``,!0)],2))}}),p=t.t(f,[[`__scopeId`,`data-v-
|
|
1
|
+
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Icon-C8R_r_In.cjs`);let r=require(`vue`),i=require(`@nubisco/ui/icons/tray`);i=e.n(i);let a=require(`@nubisco/ui/icons/magnifying-glass`);a=e.n(a);let o=require(`@nubisco/ui/icons/warning-circle`);o=e.n(o);let s=require(`@nubisco/ui/icons/lock-simple`);s=e.n(s);var c={key:0,class:`nb-empty-state__icon`},l={key:1,class:`nb-empty-state__title`},u={key:2,class:`nb-empty-state__description`},d={key:3,class:`nb-empty-state__actions`},f=(0,r.defineComponent)({__name:`EmptyState`,props:{title:{default:``},description:{default:``},icon:{default:void 0},kind:{default:`empty`},size:{default:`md`},bordered:{type:Boolean,default:!1}},setup(e){let t=e,f={empty:i,"no-results":a,error:o,forbidden:s},p=(0,r.computed)(()=>t.icon===null?null:t.icon??f[t.kind]??f.empty);return(t,i)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{class:(0,r.normalizeClass)([`nb-empty-state`,[`nb-empty-state--${e.size}`,`nb-empty-state--${e.kind}`,{"nb-empty-state--bordered":e.bordered}]])},[p.value||t.$slots.icon?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,c,[(0,r.renderSlot)(t.$slots,`icon`,{},()=>[(0,r.createVNode)(n.t,{name:p.value,size:e.size===`sm`?24:32},null,8,[`name`,`size`])],!0)])):(0,r.createCommentVNode)(``,!0),e.title||t.$slots.title?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,l,[(0,r.renderSlot)(t.$slots,`title`,{},()=>[(0,r.createTextVNode)((0,r.toDisplayString)(e.title),1)],!0)])):(0,r.createCommentVNode)(``,!0),e.description||t.$slots.default?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,u,[(0,r.renderSlot)(t.$slots,`default`,{},()=>[(0,r.createTextVNode)((0,r.toDisplayString)(e.description),1)],!0)])):(0,r.createCommentVNode)(``,!0),t.$slots.actions?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,d,[(0,r.renderSlot)(t.$slots,`actions`,{},void 0,!0)])):(0,r.createCommentVNode)(``,!0)],2))}}),p=t.t(f,[[`__scopeId`,`data-v-0508480f`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return p}});
|