@scalar/components 0.36.1 → 0.37.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.
Files changed (19) hide show
  1. package/dist/components/ScalarSidebar/ScalarSidebarButton.vue.d.ts +3 -0
  2. package/dist/components/ScalarSidebar/ScalarSidebarButton.vue.d.ts.map +1 -1
  3. package/dist/components/ScalarSidebar/ScalarSidebarButton.vue_vue_type_script_setup_true_lang.js +1 -1
  4. package/dist/components/ScalarSidebar/ScalarSidebarButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  5. package/dist/components/ScalarSidebar/ScalarSidebarItems.vue.d.ts +5 -0
  6. package/dist/components/ScalarSidebar/ScalarSidebarItems.vue.d.ts.map +1 -1
  7. package/dist/components/ScalarSidebar/ScalarSidebarItems.vue_vue_type_script_setup_true_lang.js +3 -3
  8. package/dist/components/ScalarSidebar/ScalarSidebarItems.vue_vue_type_script_setup_true_lang.js.map +1 -1
  9. package/dist/components/ScalarSidebar/ScalarSidebarNestedItems.vue.d.ts +5 -0
  10. package/dist/components/ScalarSidebar/ScalarSidebarNestedItems.vue.d.ts.map +1 -1
  11. package/dist/components/ScalarSidebar/ScalarSidebarNestedItems.vue_vue_type_script_setup_true_lang.js +9 -7
  12. package/dist/components/ScalarSidebar/ScalarSidebarNestedItems.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/components/ScalarSidebar/ScalarSidebarSearchButton.vue.d.ts +3 -0
  14. package/dist/components/ScalarSidebar/ScalarSidebarSearchButton.vue.d.ts.map +1 -1
  15. package/dist/components/ScalarSidebar/ScalarSidebarSearchButton.vue_vue_type_script_setup_true_lang.js +1 -1
  16. package/dist/components/ScalarSidebar/ScalarSidebarSearchButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  17. package/dist/style.css +2 -2
  18. package/dist/vue-styles.css +2 -2
  19. package/package.json +4 -4
@@ -20,6 +20,9 @@ import type { ScalarSidebarButtonSlots, ScalarSidebarItemProps } from './types';
20
20
  * <!-- After the button text -->
21
21
  * </template>
22
22
  * </ScalarSidebarButton>
23
+ *
24
+ * Stable hooks for styling from outside the component:
25
+ * - `.scalar-sidebar-button` targets the button
23
26
  */
24
27
  declare const _default: typeof __VLS_export;
25
28
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarButton.vue"],"names":[],"mappings":"AAsGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAG/E;;;;;;;;;;;;;;;;;;;;;GAqBG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY,mWAsId,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarSidebarButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarButton.vue"],"names":[],"mappings":"AAyGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAG/E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY,mWAsId,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -28,7 +28,7 @@ var ScalarSidebarButton_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
28
28
  },
29
29
  setup(__props) {
30
30
  const variants = cva({
31
- base: ["group/button peer/button flex items-stretch rounded p-2", "font-sidebar text-base/4 text-sidebar-c-2 no-underline wrap-break-word"],
31
+ base: ["scalar-sidebar-button group/button peer/button flex items-stretch rounded p-2", "font-sidebar text-base/4 text-sidebar-c-2 no-underline wrap-break-word"],
32
32
  variants: {
33
33
  active: { true: "text-sidebar-c-active font-sidebar-active" },
34
34
  disabled: { true: "cursor-auto" },
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarButton.vue_vue_type_script_setup_true_lang.js","names":["$slots","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","_renderSlot","_createVNode","ScalarSidebarIndent","_createElementBlock","ScalarIconLegacyAdapter","_createElementVNode"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarButton.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Button component\n *\n * Provide a styled link for the ScalarSidebar or similar, supports\n * the same props and slots as ScalarSidebarItem\n *\n * This is used internally by the ScalarSidebarItem component\n *\n * If you're looking to create items in ScalarSidebarItems\n * you probably want the ScalarSidebarItem component\n *\n * @example\n * <ScalarSidebarButton>\n * <template #icon>\n * <!-- Overrides the icon slot -->\n * </template>\n * <!-- Button text -->\n * <template #aside>\n * <!-- After the button text -->\n * </template>\n * </ScalarSidebarButton>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { cva, useBindCx } from '@scalar/use-hooks/useBindCx'\n\nimport { ScalarIconLegacyAdapter } from '../ScalarIcon'\nimport ScalarSidebarIndent from './ScalarSidebarIndent.vue'\nimport type { ScalarSidebarButtonSlots, ScalarSidebarItemProps } from './types'\n\nconst { is = 'a', indent = 0 } = defineProps<ScalarSidebarItemProps>()\n\ndefineSlots<ScalarSidebarButtonSlots>()\n\nconst variants = cva({\n base: [\n 'group/button peer/button flex items-stretch rounded p-2',\n 'font-sidebar text-base/4 text-sidebar-c-2 no-underline wrap-break-word',\n ],\n variants: {\n active: { true: 'text-sidebar-c-active font-sidebar-active' },\n disabled: { true: 'cursor-auto' },\n selected: {\n true: 'cursor-auto bg-sidebar-b-active text-sidebar-c-active font-sidebar-active',\n },\n },\n compoundVariants: [\n {\n selected: false,\n disabled: false,\n active: false,\n class: 'hover:bg-sidebar-b-hover hover:text-sidebar-c-hover',\n },\n {\n selected: false,\n disabled: false,\n active: true,\n class: 'hover:bg-sidebar-b-hover',\n },\n ],\n defaultVariants: { selected: false, disabled: false, active: false },\n})\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <component\n :is=\"is\"\n :aria-current=\"selected ? 'page' : undefined\"\n :type=\"is === 'button' ? 'button' : undefined\"\n v-bind=\"cx(variants({ selected, disabled, active }))\">\n <slot name=\"indent\">\n <ScalarSidebarIndent\n class=\"-my-2\"\n :disabled\n :indent\n :selected />\n </slot>\n <div\n v-if=\"icon || $slots.icon\"\n class=\"mr-1 flex h-lh items-center *:size-4\">\n <slot name=\"icon\">\n <ScalarIconLegacyAdapter\n v-if=\"icon\"\n :icon=\"icon\" />\n </slot>\n </div>\n <div class=\"group/button-label min-w-0 flex-1\">\n <slot />\n </div>\n <slot name=\"aside\" />\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCA,MAAM,WAAW,IAAI;GACnB,MAAM,CACJ,2DACA,yEACF;GACA,UAAU;IACR,QAAQ,EAAE,MAAM,4CAA4C;IAC5D,UAAU,EAAE,MAAM,cAAc;IAChC,UAAU,EACR,MAAM,4EACR;GACF;GACA,kBAAkB,CAChB;IACE,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;GACT,GACA;IACE,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;GACT,CACF;GACA,iBAAiB;IAAE,UAAU;IAAO,UAAU;IAAO,QAAQ;GAAM;EACrE,CAAC;EAED,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAC,UAAA,GAAAC,YAyBYC,wBAxBL,QAAA,EAAE,GADTC,WAyBY;IAvBT,gBAAc,QAAA,WAAQ,SAAY,KAAA;IAClC,MAAM,QAAA,OAAE,WAAA,WAA2B,KAAA;GAC5B,GAAAC,MAAA,EAAA,CAAE,CAACA,MAAA,QAAA,CAAQ,CAAA;IAAA,UAAG,QAAA;IAAQ,UAAE,QAAA;IAAQ,QAAE,QAAA;GAAM,CAAA,CAAA,CAAA,GAAA;IAChD,SAAAC,cAMO;KANPC,WAMO,KAAA,QAAA,UAAA,CAAA,SAAA,CALLC,YAIcC,6BAAA;MAHZ,OAAM;MACL,UAAA,QAAA;MACA,QAAA,QAAA;MACA,UAAA,QAAA;;;;;;KAGG,QAAA,QAAQT,KAAAA,OAAO,QADvBC,UAAA,GAAAS,mBAQM,OARN,YAQM,CALJH,WAIO,KAAA,QAAA,QAAA,CAAA,SAAA,CAFG,QAAA,QADRN,UAAA,GAAAC,YAEiBG,MAAAM,+BAAA,GAAA;;MAAd,MAAM,QAAA;;KAGbC,mBAEM,OAFN,YAEM,CADJL,WAAQ,KAAA,QAAA,SAAA,C;KAEVA,WAAqB,KAAA,QAAA,OAAA"}
1
+ {"version":3,"file":"ScalarSidebarButton.vue_vue_type_script_setup_true_lang.js","names":["$slots","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","_renderSlot","_createVNode","ScalarSidebarIndent","_createElementBlock","ScalarIconLegacyAdapter","_createElementVNode"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarButton.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Button component\n *\n * Provide a styled link for the ScalarSidebar or similar, supports\n * the same props and slots as ScalarSidebarItem\n *\n * This is used internally by the ScalarSidebarItem component\n *\n * If you're looking to create items in ScalarSidebarItems\n * you probably want the ScalarSidebarItem component\n *\n * @example\n * <ScalarSidebarButton>\n * <template #icon>\n * <!-- Overrides the icon slot -->\n * </template>\n * <!-- Button text -->\n * <template #aside>\n * <!-- After the button text -->\n * </template>\n * </ScalarSidebarButton>\n *\n * Stable hooks for styling from outside the component:\n * - `.scalar-sidebar-button` targets the button\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { cva, useBindCx } from '@scalar/use-hooks/useBindCx'\n\nimport { ScalarIconLegacyAdapter } from '../ScalarIcon'\nimport ScalarSidebarIndent from './ScalarSidebarIndent.vue'\nimport type { ScalarSidebarButtonSlots, ScalarSidebarItemProps } from './types'\n\nconst { is = 'a', indent = 0 } = defineProps<ScalarSidebarItemProps>()\n\ndefineSlots<ScalarSidebarButtonSlots>()\n\nconst variants = cva({\n base: [\n 'scalar-sidebar-button group/button peer/button flex items-stretch rounded p-2',\n 'font-sidebar text-base/4 text-sidebar-c-2 no-underline wrap-break-word',\n ],\n variants: {\n active: { true: 'text-sidebar-c-active font-sidebar-active' },\n disabled: { true: 'cursor-auto' },\n selected: {\n true: 'cursor-auto bg-sidebar-b-active text-sidebar-c-active font-sidebar-active',\n },\n },\n compoundVariants: [\n {\n selected: false,\n disabled: false,\n active: false,\n class: 'hover:bg-sidebar-b-hover hover:text-sidebar-c-hover',\n },\n {\n selected: false,\n disabled: false,\n active: true,\n class: 'hover:bg-sidebar-b-hover',\n },\n ],\n defaultVariants: { selected: false, disabled: false, active: false },\n})\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <component\n :is=\"is\"\n :aria-current=\"selected ? 'page' : undefined\"\n :type=\"is === 'button' ? 'button' : undefined\"\n v-bind=\"cx(variants({ selected, disabled, active }))\">\n <slot name=\"indent\">\n <ScalarSidebarIndent\n class=\"-my-2\"\n :disabled\n :indent\n :selected />\n </slot>\n <div\n v-if=\"icon || $slots.icon\"\n class=\"mr-1 flex h-lh items-center *:size-4\">\n <slot name=\"icon\">\n <ScalarIconLegacyAdapter\n v-if=\"icon\"\n :icon=\"icon\" />\n </slot>\n </div>\n <div class=\"group/button-label min-w-0 flex-1\">\n <slot />\n </div>\n <slot name=\"aside\" />\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCA,MAAM,WAAW,IAAI;GACnB,MAAM,CACJ,iFACA,yEACF;GACA,UAAU;IACR,QAAQ,EAAE,MAAM,4CAA4C;IAC5D,UAAU,EAAE,MAAM,cAAc;IAChC,UAAU,EACR,MAAM,4EACR;GACF;GACA,kBAAkB,CAChB;IACE,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;GACT,GACA;IACE,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;GACT,CACF;GACA,iBAAiB;IAAE,UAAU;IAAO,UAAU;IAAO,QAAQ;GAAM;EACrE,CAAC;EAED,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAC,UAAA,GAAAC,YAyBYC,wBAxBL,QAAA,EAAE,GADTC,WAyBY;IAvBT,gBAAc,QAAA,WAAQ,SAAY,KAAA;IAClC,MAAM,QAAA,OAAE,WAAA,WAA2B,KAAA;GAC5B,GAAAC,MAAA,EAAA,CAAE,CAACA,MAAA,QAAA,CAAQ,CAAA;IAAA,UAAG,QAAA;IAAQ,UAAE,QAAA;IAAQ,QAAE,QAAA;GAAM,CAAA,CAAA,CAAA,GAAA;IAChD,SAAAC,cAMO;KANPC,WAMO,KAAA,QAAA,UAAA,CAAA,SAAA,CALLC,YAIcC,6BAAA;MAHZ,OAAM;MACL,UAAA,QAAA;MACA,QAAA,QAAA;MACA,UAAA,QAAA;;;;;;KAGG,QAAA,QAAQT,KAAAA,OAAO,QADvBC,UAAA,GAAAS,mBAQM,OARN,YAQM,CALJH,WAIO,KAAA,QAAA,QAAA,CAAA,SAAA,CAFG,QAAA,QADRN,UAAA,GAAAC,YAEiBG,MAAAM,+BAAA,GAAA;;MAAd,MAAM,QAAA;;KAGbC,mBAEM,OAFN,YAEM,CADJL,WAAQ,KAAA,QAAA,SAAA,C;KAEVA,WAAqB,KAAA,QAAA,OAAA"}
@@ -11,6 +11,11 @@ import type { Component } from 'vue';
11
11
  * <ScalarSidebarItem>...</ScalarSidebarItem>
12
12
  * <ScalarSidebarItem>...</ScalarSidebarItem>
13
13
  * </ScalarSidebarItems>
14
+ *
15
+ * Stable hooks for styling from outside the component:
16
+ * - `.scalar-sidebar-items` targets the list
17
+ * - `[data-nested-open]` is set while a nested list inside it is open,
18
+ * which slides this list out of view
14
19
  */
15
20
  declare const _default: typeof __VLS_export;
16
21
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarItems.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarItems.vue"],"names":[],"mappings":"AAwEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAKpC;;;;;;;;;;;;GAYG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;SAEX,SAAS,GAAG,MAAM;;SAAlB,SAAS,GAAG,MAAM;;cAwDX,CAAC,KAAK,IAAgB,KAAK,GAAG;EASxC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarSidebarItems.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarItems.vue"],"names":[],"mappings":"AAoFA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAKpC;;;;;;;;;;;;;;;;;GAiBG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;SAEX,SAAS,GAAG,MAAM;;SAAlB,SAAS,GAAG,MAAM;;cA0DX,CAAC,KAAK,IAAgB,KAAK,GAAG;EASxC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { useSidebarNestedItems } from "./useSidebarNestedItems.js";
2
2
  import { useBindCx } from "@scalar/use-hooks/useBindCx";
3
- import { createBlock, defineComponent, guardReactiveProps, normalizeProps, openBlock, renderSlot, resolveDynamicComponent, unref, withCtx } from "vue";
3
+ import { createBlock, defineComponent, mergeProps, openBlock, renderSlot, resolveDynamicComponent, unref, withCtx } from "vue";
4
4
  var ScalarSidebarItems_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
5
5
  inheritAttrs: false,
6
6
  __name: "ScalarSidebarItems",
@@ -16,10 +16,10 @@ var ScalarSidebarItems_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
16
16
  const { open } = useSidebarNestedItems();
17
17
  const { cx } = useBindCx();
18
18
  return (_ctx, _cache) => {
19
- return openBlock(), createBlock(resolveDynamicComponent(__props.is), normalizeProps(guardReactiveProps(unref(cx)("group/items relative flex flex-col p-(--scalar-sidebar-padding) gap-px transition-transform duration-300", unref(open) ? "-translate-x-full" : "translate-x-0"))), {
19
+ return openBlock(), createBlock(resolveDynamicComponent(__props.is), mergeProps(unref(cx)("scalar-sidebar-items group/items relative flex flex-col p-(--scalar-sidebar-padding) gap-px transition-transform duration-300", unref(open) ? "-translate-x-full" : "translate-x-0"), { "data-nested-open": unref(open) || void 0 }), {
20
20
  default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
21
21
  _: 3
22
- }, 16);
22
+ }, 16, ["data-nested-open"]);
23
23
  };
24
24
  }
25
25
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarItems.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_normalizeProps","_guardReactiveProps","_unref","_withCtx","_renderSlot"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarItems.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Items component\n *\n * A base container for ScalarSidebarItem(s), renders as\n * a `<ul>` by default to meet accessibility requirements\n *\n * @example\n * <ScalarSidebarItems>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * </ScalarSidebarItems>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport type { Component } from 'vue'\n\nimport { useSidebarNestedItems } from './useSidebarNestedItems'\n\nconst { is = 'ul' } = defineProps<{\n is?: Component | string\n}>()\n\nconst { open } = useSidebarNestedItems()\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <component\n :is=\"is\"\n v-bind=\"\n cx(\n 'group/items relative flex flex-col p-(--scalar-sidebar-padding) gap-px transition-transform duration-300',\n open ? '-translate-x-full' : 'translate-x-0',\n )\n \">\n <slot />\n </component>\n</template>\n<style>\n@reference \"../../style.css\";\n\n/* Hide the buttons from the keyboard when a nested item is open */\n.group\\/items.-translate-x-full .group\\/button {\n /* Required to prevent the button from being focused */\n display: none;\n /* Required to prevent the button from taking up scroll space */\n max-height: 0;\n\n transition-property: display, max-height;\n transition-behavior: allow-discrete;\n transition-duration: 0s;\n transition-delay: 300ms;\n}\n\n/* Show the buttons within a nested item when it is open */\n.group\\/item.group\\/nested-items-open\n > *\n > .group\\/items.translate-x-0\n .group\\/button {\n max-height: calc(infinity * 1px);\n display: flex;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;EA0BA,MAAM,EAAE,SAAS,sBAAsB;EAGvC,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,YASYC,wBARL,QAAA,EAAE,GAAAC,eAAAC,mBACQC,MAAA,EAAA,CAAE,C,4GAA8HA,MAAA,IAAA,IAAI,sBAAA,e;IAMnJ,SAAAC,cAAQ,CAARC,WAAQ,KAAA,QAAA,SAAA,C"}
1
+ {"version":3,"file":"ScalarSidebarItems.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","_renderSlot"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarItems.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Items component\n *\n * A base container for ScalarSidebarItem(s), renders as\n * a `<ul>` by default to meet accessibility requirements\n *\n * @example\n * <ScalarSidebarItems>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * </ScalarSidebarItems>\n *\n * Stable hooks for styling from outside the component:\n * - `.scalar-sidebar-items` targets the list\n * - `[data-nested-open]` is set while a nested list inside it is open,\n * which slides this list out of view\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport type { Component } from 'vue'\n\nimport { useSidebarNestedItems } from './useSidebarNestedItems'\n\nconst { is = 'ul' } = defineProps<{\n is?: Component | string\n}>()\n\nconst { open } = useSidebarNestedItems()\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <component\n :is=\"is\"\n v-bind=\"\n cx(\n 'scalar-sidebar-items group/items relative flex flex-col p-(--scalar-sidebar-padding) gap-px transition-transform duration-300',\n open ? '-translate-x-full' : 'translate-x-0',\n )\n \"\n :data-nested-open=\"open || undefined\">\n <slot />\n </component>\n</template>\n<style>\n@reference \"../../style.css\";\n\n/*\n * Hide the buttons from the keyboard when a nested item is open\n *\n * group/button still matches so custom buttons passed through a #button slot\n * keep working. :is() keeps the specificity of a single class.\n */\n.scalar-sidebar-items[data-nested-open]\n :is(.scalar-sidebar-button, .group\\/button) {\n /* Required to prevent the button from being focused */\n display: none;\n /* Required to prevent the button from taking up scroll space */\n max-height: 0;\n\n transition-property: display, max-height;\n transition-behavior: allow-discrete;\n transition-duration: 0s;\n transition-delay: 300ms;\n}\n\n/* Show the buttons within a nested item when it is open */\n.scalar-sidebar-nested-items[data-open]\n > *\n > .scalar-sidebar-items:not([data-nested-open])\n :is(.scalar-sidebar-button, .group\\/button) {\n max-height: calc(infinity * 1px);\n display: flex;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;EA+BA,MAAM,EAAE,SAAS,sBAAsB;EAGvC,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,YAUYC,wBATL,QAAA,EAAE,GADTC,WAEiBC,MAAA,EAAA,CAAE,C,iIAAmJA,MAAA,IAAA,IAAI,sBAAA,e,KAMvK,oBAAkBA,MAAA,IAAA,KAAQ,KAAA,E;IAC3B,SAAAC,cAAQ,CAARC,WAAQ,KAAA,QAAA,SAAA,C"}
@@ -13,6 +13,11 @@
13
13
  * <ScalarSidebarItem>...</ScalarSidebarItem>
14
14
  * </template>
15
15
  * </ScalarSidebarNestedItems>
16
+ *
17
+ * Stable hooks for styling from outside the component:
18
+ * - `.scalar-sidebar-nested-items` targets the item, with `[data-open]` while open
19
+ * - `.scalar-sidebar-nested-items-panel` targets the layer the opened list is
20
+ * drawn in, positioned over the parent list
16
21
  */
17
22
  declare const _default: typeof __VLS_export;
18
23
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarNestedItems.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarNestedItems.vue"],"names":[],"mappings":"AAyNA;;;;;;;;;;;;;;;GAeG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;;;;;WA+FT,OAAO;;;;;;;;;;;WAAP,OAAO;;;;;;IA9Ed,qCAAqC;cACzB,MAAM,OAAO;IACzB,iCAAiC;aACtB,MAAM,OAAO;IACxB,wBAAwB;WACf,MAAM,OAAO;IACtB,8BAA8B;YACpB,MAAM,OAAO;IACvB,+BAA+B;WACtB,MAAM,OAAO;IACtB,qCAAqC;mBACtB,MAAM,OAAO;IAC5B,mCAAmC;YACzB,MAAM,OAAO;EAmUrB,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarSidebarNestedItems.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarNestedItems.vue"],"names":[],"mappings":"AAkOA;;;;;;;;;;;;;;;;;;;;GAoBG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;;;;;WA+FT,OAAO;;;;;;;;;;;WAAP,OAAO;;;;;;IA9Ed,qCAAqC;cACzB,MAAM,OAAO;IACzB,iCAAiC;aACtB,MAAM,OAAO;IACxB,wBAAwB;WACf,MAAM,OAAO;IACtB,8BAA8B;YACpB,MAAM,OAAO;IACvB,+BAA+B;WACtB,MAAM,OAAO;IACtB,qCAAqC;mBACtB,MAAM,OAAO;IAC5B,mCAAmC;YACzB,MAAM,OAAO;EAyUrB,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -8,11 +8,12 @@ import { useSidebarNestedItem } from "./useSidebarNestedItems.js";
8
8
  import { Transition, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, openBlock, ref, renderSlot, unref, useModel, useTemplateRef, withCtx } from "vue";
9
9
  import { ScalarIconArrowRight, ScalarIconCaretLeft } from "@scalar/icons";
10
10
  // src/components/ScalarSidebar/ScalarSidebarNestedItems.vue?vue&type=script&setup=true&lang.ts
11
- var _hoisted_1 = {
11
+ var _hoisted_1 = ["data-open"];
12
+ var _hoisted_2 = {
12
13
  key: 0,
13
- class: "absolute inset-0 translate-x-full"
14
+ class: "scalar-sidebar-nested-items-panel absolute inset-0 translate-x-full"
14
15
  };
15
- var _hoisted_2 = { class: "bg-sidebar-b-1 animate-sidebar-border-bottom border-b-sidebar-border sticky top-(--scalar-sidebar-sticky-offset,0) z-1 -mx-(--scalar-sidebar-padding) -mt-(--scalar-sidebar-padding) flex flex-col gap-px px-(--scalar-sidebar-padding) pt-(--scalar-sidebar-padding)" };
16
+ var _hoisted_3 = { class: "bg-sidebar-b-1 animate-sidebar-border-bottom border-b-sidebar-border sticky top-(--scalar-sidebar-sticky-offset,0) z-1 -mx-(--scalar-sidebar-padding) -mt-(--scalar-sidebar-padding) flex flex-col gap-px px-(--scalar-sidebar-padding) pt-(--scalar-sidebar-padding)" };
16
17
  var ScalarSidebarNestedItems_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
17
18
  inheritAttrs: false,
18
19
  __name: "ScalarSidebarNestedItems",
@@ -75,7 +76,8 @@ var ScalarSidebarNestedItems_vue_vue_type_script_setup_true_lang_default = /*@__
75
76
  return openBlock(), createElementBlock("li", {
76
77
  ref_key: "el",
77
78
  ref: el,
78
- class: normalizeClass(["group/item group/nested-items contents", { "group/nested-items-open": open.value }]),
79
+ class: normalizeClass(["scalar-sidebar-nested-items group/item group/nested-items contents", { "group/nested-items-open": open.value }]),
80
+ "data-open": open.value || void 0,
79
81
  style: normalizeStyle({ "--nested-items-offset": `${offset.value}px` })
80
82
  }, [renderSlot(_ctx.$slots, "button", {}, () => [createVNode(ScalarSidebarButton_default, mergeProps({
81
83
  is: "button",
@@ -106,8 +108,8 @@ var ScalarSidebarNestedItems_vue_vue_type_script_setup_true_lang_default = /*@__
106
108
  onEnter: onOpen,
107
109
  onLeave: onClose
108
110
  }, {
109
- default: withCtx(() => [open.value ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(ScalarSidebarItems_default, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
110
- default: withCtx(() => [createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "back", {}, () => [createVNode(ScalarSidebarButton_default, {
111
+ default: withCtx(() => [open.value ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(ScalarSidebarItems_default, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
112
+ default: withCtx(() => [createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "back", {}, () => [createVNode(ScalarSidebarButton_default, {
111
113
  is: "button",
112
114
  class: "text-sidebar-c-1 font-sidebar-active hover:text-sidebar-c-1",
113
115
  onClick: handleBack
@@ -119,7 +121,7 @@ var ScalarSidebarNestedItems_vue_vue_type_script_setup_true_lang_default = /*@__
119
121
  _: 3
120
122
  }, 16)])) : createCommentVNode("", true)]),
121
123
  _: 3
122
- })], 6);
124
+ })], 14, _hoisted_1);
123
125
  };
124
126
  }
125
127
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarNestedItems.vue_vue_type_script_setup_true_lang.js","names":["$attrs","$slots","_useModel","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_renderSlot","_createVNode","ScalarSidebarButton","_mergeProps","_unref","_createSlots","_withCtx","_Transition","ScalarSidebarItems","_normalizeProps","_guardReactiveProps","_createElementVNode","_createTextVNode","ScalarSidebarSpacer","_createBlock","ScalarSidebarLoading"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarNestedItems.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Nested Items component\n *\n * A provides list of items thats presented over the parent list\n * Needs to be nested inside a ScalarSidebarItems component\n *\n * @example\n * <ScalarSidebarNestedItems v-model=\"open\">\n * <!-- Item text -->\n * <template #items>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * </template>\n * </ScalarSidebarNestedItems>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { ScalarIconArrowRight, ScalarIconCaretLeft } from '@scalar/icons'\nimport { nextTick, ref, useTemplateRef } from 'vue'\n\nimport { findScrollContainer } from './findScrollContainer'\nimport ScalarSidebarButton from './ScalarSidebarButton.vue'\nimport ScalarSidebarItems from './ScalarSidebarItems.vue'\nimport ScalarSidebarLoading from './ScalarSidebarLoading.vue'\nimport ScalarSidebarSpacer from './ScalarSidebarSpacer.vue'\nimport type { ScalarSidebarGroupProps } from './types'\nimport { useSidebarGroups } from './useSidebarGroups'\nimport { useSidebarNestedItem } from './useSidebarNestedItems'\n\nconst { controlled } = defineProps<ScalarSidebarGroupProps>()\n\nconst emit = defineEmits<{\n /** Emitted when the nested item button is clicked */\n (e: 'click', event: MouseEvent): void\n /** Emitted when the back button is clicked */\n (e: 'back', event: MouseEvent): void\n}>()\n\nconst open = defineModel<boolean>('open', { default: false })\nuseSidebarNestedItem(() => open.value)\n\ndefineSlots<{\n /** The text content of the button */\n 'default'?: () => unknown\n /** Override the entire button */\n 'button'?: () => unknown\n /** Override the icon */\n 'icon'?: () => unknown\n /** Override the aside slot */\n 'aside'?: () => unknown\n /** Override the back button */\n 'back'?: () => unknown\n /** Override the back button label */\n 'back-label'?: () => unknown\n /** The list of sidebar subitems */\n 'items'?: () => unknown\n}>()\n\nconst { level } = useSidebarGroups({ reset: true })\n\n/** The root element ref */\nconst el = useTemplateRef('el')\n\n/** How far down to offset the nested items by when animating them in */\nconst offset = ref(0)\n\n// Transition hooks\n\nfunction onOpen() {\n // Calculate how far down the nearest scroll container is scrolled\n // We offset the nested items by this amount when animating them\n // in so they appear in line with the parent items list.\n offset.value = findScrollContainer(el.value).scrollTop ?? 0\n\n // Focus the first button in the nested items\n nextTick(() =>\n el.value\n ?.querySelector<HTMLButtonElement>('button:not([aria-expanded=\"true\"])')\n ?.focus({ preventScroll: true }),\n )\n}\nfunction onOpened() {\n /** Reset the scroll position of the scroll container after opening */\n findScrollContainer(el.value).scrollTop = 0\n}\nfunction onClose() {\n nextTick(() => {\n el.value?.querySelector('button')?.focus({ preventScroll: true })\n findScrollContainer(el.value).scrollTop = offset.value\n })\n}\n\ndefineOptions({ inheritAttrs: false })\n\n/** Handle the click event for the nested items button */\nconst handleClick = (event: MouseEvent) => {\n // Bubble up the click event\n emit('click', event)\n if (!controlled) {\n // Only toggle the open state if the group is uncontrolled\n open.value = true\n }\n}\n\n/** Handle the back button click event */\nconst handleBack = (event: MouseEvent) => {\n // Bubble up the back event\n emit('back', event)\n if (!controlled) {\n // Only toggle the open state if the group is uncontrolled\n open.value = false\n }\n}\n</script>\n<template>\n <li\n ref=\"el\"\n class=\"group/item group/nested-items contents\"\n :class=\"{ 'group/nested-items-open': open }\"\n :style=\"{ '--nested-items-offset': `${offset}px` }\">\n <slot name=\"button\">\n <ScalarSidebarButton\n is=\"button\"\n :aria-expanded=\"open\"\n :disabled\n :icon\n :indent=\"level\"\n :selected\n v-bind=\"$attrs\"\n @click=\"handleClick\">\n <template\n v-if=\"$slots.icon\"\n #icon>\n <slot name=\"icon\" />\n </template>\n <slot />\n <template #aside>\n <slot name=\"aside\">\n <ScalarIconArrowRight class=\"text-sidebar-c-2 size-4\" />\n </slot>\n </template>\n </ScalarSidebarButton>\n </slot>\n <!-- Make sure the div is around for the entire transition -->\n <Transition\n :duration=\"300\"\n enterActiveClass=\"top-(--nested-items-offset)!\"\n leaveActiveClass=\"top-(--nested-items-offset)!\"\n @afterEnter=\"onOpened\"\n @enter=\"onOpen\"\n @leave=\"onClose\">\n <div\n v-if=\"open\"\n class=\"absolute inset-0 translate-x-full\">\n <ScalarSidebarItems v-bind=\"$attrs\">\n <div\n class=\"bg-sidebar-b-1 animate-sidebar-border-bottom border-b-sidebar-border sticky top-(--scalar-sidebar-sticky-offset,0) z-1 -mx-(--scalar-sidebar-padding) -mt-(--scalar-sidebar-padding) flex flex-col gap-px px-(--scalar-sidebar-padding) pt-(--scalar-sidebar-padding)\">\n <slot name=\"back\">\n <ScalarSidebarButton\n is=\"button\"\n class=\"text-sidebar-c-1 font-sidebar-active hover:text-sidebar-c-1\"\n @click=\"handleBack\">\n <template #icon>\n <ScalarIconCaretLeft class=\"text-sidebar-c-2 -m-px size-4\" />\n </template>\n <slot name=\"back-label\">Back</slot>\n </ScalarSidebarButton>\n </slot>\n <ScalarSidebarSpacer class=\"h-3\" />\n </div>\n <ScalarSidebarLoading v-if=\"loading\" />\n <slot\n v-else\n name=\"items\" />\n </ScalarSidebarItems>\n </div>\n </Transition>\n </li>\n</template>\n\n<style>\n@reference \"../../style.css\";\n\n.animate-sidebar-border-bottom {\n animation: border-bottom forwards;\n animation-timeline: scroll();\n animation-range-end: 1px;\n}\n\n@keyframes border-bottom {\n from {\n border-bottom-width: 0;\n }\n to {\n border-bottom-width: var(--scalar-border-width);\n }\n}\n</style>\n"],"mappings":"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"}
1
+ {"version":3,"file":"ScalarSidebarNestedItems.vue_vue_type_script_setup_true_lang.js","names":["$attrs","$slots","_useModel","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_renderSlot","_createVNode","ScalarSidebarButton","_mergeProps","_unref","_createSlots","_withCtx","_Transition","ScalarSidebarItems","_normalizeProps","_guardReactiveProps","_createElementVNode","_createTextVNode","ScalarSidebarSpacer","_createBlock","ScalarSidebarLoading"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarNestedItems.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Nested Items component\n *\n * A provides list of items thats presented over the parent list\n * Needs to be nested inside a ScalarSidebarItems component\n *\n * @example\n * <ScalarSidebarNestedItems v-model=\"open\">\n * <!-- Item text -->\n * <template #items>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * </template>\n * </ScalarSidebarNestedItems>\n *\n * Stable hooks for styling from outside the component:\n * - `.scalar-sidebar-nested-items` targets the item, with `[data-open]` while open\n * - `.scalar-sidebar-nested-items-panel` targets the layer the opened list is\n * drawn in, positioned over the parent list\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { ScalarIconArrowRight, ScalarIconCaretLeft } from '@scalar/icons'\nimport { nextTick, ref, useTemplateRef } from 'vue'\n\nimport { findScrollContainer } from './findScrollContainer'\nimport ScalarSidebarButton from './ScalarSidebarButton.vue'\nimport ScalarSidebarItems from './ScalarSidebarItems.vue'\nimport ScalarSidebarLoading from './ScalarSidebarLoading.vue'\nimport ScalarSidebarSpacer from './ScalarSidebarSpacer.vue'\nimport type { ScalarSidebarGroupProps } from './types'\nimport { useSidebarGroups } from './useSidebarGroups'\nimport { useSidebarNestedItem } from './useSidebarNestedItems'\n\nconst { controlled } = defineProps<ScalarSidebarGroupProps>()\n\nconst emit = defineEmits<{\n /** Emitted when the nested item button is clicked */\n (e: 'click', event: MouseEvent): void\n /** Emitted when the back button is clicked */\n (e: 'back', event: MouseEvent): void\n}>()\n\nconst open = defineModel<boolean>('open', { default: false })\nuseSidebarNestedItem(() => open.value)\n\ndefineSlots<{\n /** The text content of the button */\n 'default'?: () => unknown\n /** Override the entire button */\n 'button'?: () => unknown\n /** Override the icon */\n 'icon'?: () => unknown\n /** Override the aside slot */\n 'aside'?: () => unknown\n /** Override the back button */\n 'back'?: () => unknown\n /** Override the back button label */\n 'back-label'?: () => unknown\n /** The list of sidebar subitems */\n 'items'?: () => unknown\n}>()\n\nconst { level } = useSidebarGroups({ reset: true })\n\n/** The root element ref */\nconst el = useTemplateRef('el')\n\n/** How far down to offset the nested items by when animating them in */\nconst offset = ref(0)\n\n// Transition hooks\n\nfunction onOpen() {\n // Calculate how far down the nearest scroll container is scrolled\n // We offset the nested items by this amount when animating them\n // in so they appear in line with the parent items list.\n offset.value = findScrollContainer(el.value).scrollTop ?? 0\n\n // Focus the first button in the nested items\n nextTick(() =>\n el.value\n ?.querySelector<HTMLButtonElement>('button:not([aria-expanded=\"true\"])')\n ?.focus({ preventScroll: true }),\n )\n}\nfunction onOpened() {\n /** Reset the scroll position of the scroll container after opening */\n findScrollContainer(el.value).scrollTop = 0\n}\nfunction onClose() {\n nextTick(() => {\n el.value?.querySelector('button')?.focus({ preventScroll: true })\n findScrollContainer(el.value).scrollTop = offset.value\n })\n}\n\ndefineOptions({ inheritAttrs: false })\n\n/** Handle the click event for the nested items button */\nconst handleClick = (event: MouseEvent) => {\n // Bubble up the click event\n emit('click', event)\n if (!controlled) {\n // Only toggle the open state if the group is uncontrolled\n open.value = true\n }\n}\n\n/** Handle the back button click event */\nconst handleBack = (event: MouseEvent) => {\n // Bubble up the back event\n emit('back', event)\n if (!controlled) {\n // Only toggle the open state if the group is uncontrolled\n open.value = false\n }\n}\n</script>\n<template>\n <li\n ref=\"el\"\n class=\"scalar-sidebar-nested-items group/item group/nested-items contents\"\n :class=\"{\n // Deprecated: kept for existing selectors, use [data-open] instead\n 'group/nested-items-open': open,\n }\"\n :data-open=\"open || undefined\"\n :style=\"{ '--nested-items-offset': `${offset}px` }\">\n <slot name=\"button\">\n <ScalarSidebarButton\n is=\"button\"\n :aria-expanded=\"open\"\n :disabled\n :icon\n :indent=\"level\"\n :selected\n v-bind=\"$attrs\"\n @click=\"handleClick\">\n <template\n v-if=\"$slots.icon\"\n #icon>\n <slot name=\"icon\" />\n </template>\n <slot />\n <template #aside>\n <slot name=\"aside\">\n <ScalarIconArrowRight class=\"text-sidebar-c-2 size-4\" />\n </slot>\n </template>\n </ScalarSidebarButton>\n </slot>\n <!-- Make sure the div is around for the entire transition -->\n <Transition\n :duration=\"300\"\n enterActiveClass=\"top-(--nested-items-offset)!\"\n leaveActiveClass=\"top-(--nested-items-offset)!\"\n @afterEnter=\"onOpened\"\n @enter=\"onOpen\"\n @leave=\"onClose\">\n <div\n v-if=\"open\"\n class=\"scalar-sidebar-nested-items-panel absolute inset-0 translate-x-full\">\n <ScalarSidebarItems v-bind=\"$attrs\">\n <div\n class=\"bg-sidebar-b-1 animate-sidebar-border-bottom border-b-sidebar-border sticky top-(--scalar-sidebar-sticky-offset,0) z-1 -mx-(--scalar-sidebar-padding) -mt-(--scalar-sidebar-padding) flex flex-col gap-px px-(--scalar-sidebar-padding) pt-(--scalar-sidebar-padding)\">\n <slot name=\"back\">\n <ScalarSidebarButton\n is=\"button\"\n class=\"text-sidebar-c-1 font-sidebar-active hover:text-sidebar-c-1\"\n @click=\"handleBack\">\n <template #icon>\n <ScalarIconCaretLeft class=\"text-sidebar-c-2 -m-px size-4\" />\n </template>\n <slot name=\"back-label\">Back</slot>\n </ScalarSidebarButton>\n </slot>\n <ScalarSidebarSpacer class=\"h-3\" />\n </div>\n <ScalarSidebarLoading v-if=\"loading\" />\n <slot\n v-else\n name=\"items\" />\n </ScalarSidebarItems>\n </div>\n </Transition>\n </li>\n</template>\n\n<style>\n@reference \"../../style.css\";\n\n.animate-sidebar-border-bottom {\n animation: border-bottom forwards;\n animation-timeline: scroll();\n animation-range-end: 1px;\n}\n\n@keyframes border-bottom {\n from {\n border-bottom-width: 0;\n }\n to {\n border-bottom-width: var(--scalar-border-width);\n }\n}\n</style>\n"],"mappings":"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"}
@@ -8,6 +8,9 @@
8
8
  * <ScalarSidebarSearchButton>
9
9
  * <template #shortcut>⌘K</template>
10
10
  * </ScalarSidebarSearchButton>
11
+ *
12
+ * Stable hooks for styling from outside the component:
13
+ * - `.scalar-sidebar-search-shortcut` targets the keyboard shortcut hint
11
14
  */
12
15
  declare const _default: typeof __VLS_export;
13
16
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarSearchButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarSearchButton.vue"],"names":[],"mappings":"AA0DA;;;;;;;;;;GAUG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;oBAEA,MAAM;;oBAAN,MAAM;;cAmFV,CAAC,KAAK,IAAgB,KAAK,GAAG;;eAC7B,CAAC,KAAK,IAAgB,KAAK,GAAG;EASzC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarSidebarSearchButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarSearchButton.vue"],"names":[],"mappings":"AA6DA;;;;;;;;;;;;;GAaG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;oBAEA,MAAM;;oBAAN,MAAM;;cAoFV,CAAC,KAAK,IAAgB,KAAK,GAAG;;eAC7B,CAAC,KAAK,IAAgB,KAAK,GAAG;EASzC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -5,7 +5,7 @@ import { ScalarIconMagnifyingGlass } from "@scalar/icons";
5
5
  var _hoisted_1 = { class: "flex-1 text-start leading-none" };
6
6
  var _hoisted_2 = {
7
7
  key: 0,
8
- class: "text-sidebar-c-2 rounded border px-1.25 py-1 text-xs leading-none font-medium uppercase"
8
+ class: "scalar-sidebar-search-shortcut text-sidebar-c-2 rounded border px-1.25 py-1 text-xs leading-none font-medium uppercase"
9
9
  };
10
10
  var _hoisted_3 = { class: "sr-only" };
11
11
  var _hoisted_4 = { dir: "ltr" };
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarSearchButton.vue_vue_type_script_setup_true_lang.js","names":["$slots","_openBlock","_createElementBlock","_mergeProps","_unref","_createVNode","_createElementVNode","_renderSlot","_createTextVNode","_toDisplayString"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarSearchButton.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Search Button component\n *\n * A styled button that serves as a search trigger in the sidebar.\n * Displays a magnifying glass icon and an optional keyboard shortcut.\n *\n * @example\n * <ScalarSidebarSearchButton>\n * <template #shortcut>⌘K</template>\n * </ScalarSidebarSearchButton>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { ScalarIconMagnifyingGlass } from '@scalar/icons'\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\n\nconst { shortcutLabel = 'Keyboard Shortcut:' } = defineProps<{\n shortcutLabel?: string\n}>()\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <!-- role=\"search\" is a landmark for a search region, not a button control -->\n <button\n type=\"button\"\n v-bind=\"\n cx(\n 'flex items-center rounded border text-base h-8 gap-1 pl-2 pr-1',\n 'bg-sidebar-b-search border-sidebar-border-search text-sidebar-c-search',\n )\n \">\n <ScalarIconMagnifyingGlass\n aria-hidden=\"true\"\n class=\"size-4\" />\n <span class=\"flex-1 text-start leading-none\">\n <slot>Search...</slot>\n </span>\n <span\n v-if=\"$slots.shortcut\"\n class=\"text-sidebar-c-2 rounded border px-1.25 py-1 text-xs leading-none font-medium uppercase\">\n <span class=\"sr-only\">{{ shortcutLabel }}</span>\n <kbd dir=\"ltr\">\n <slot name=\"shortcut\" />\n </kbd>\n </span>\n </button>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;EAuBA,MAAM,EAAE,OAAO,UAAU;;GAIvB,OAAAC,UAAA,GAAAC,mBAsBS,UAtBTC,WAsBS,EArBP,MAAK,SAAQ,GACEC,MAAA,EAAA,CAAE,C;IAMjBC,YAEmBD,MAAA,yBAAA,GAAA;KADjB,eAAY;KACZ,OAAM;;IACRE,mBAEO,QAFP,YAEO,CADLC,WAAsB,KAAA,QAAA,WAAA,CAAA,SAAA,CAAhB,OAAA,OAAA,OAAA,KAAAC,gBAAA,aAAS,EAAA,E;IAGTR,KAAAA,OAAO,YADfC,UAAA,GAAAC,mBAOO,QAPP,YAOO,CAJLI,mBAAgD,QAAhD,YAAgDG,gBAAvB,QAAA,aAAa,GAAA,CAAA,GACtCH,mBAEM,OAFN,YAEM,CADJC,WAAwB,KAAA,QAAA,UAAA,C"}
1
+ {"version":3,"file":"ScalarSidebarSearchButton.vue_vue_type_script_setup_true_lang.js","names":["$slots","_openBlock","_createElementBlock","_mergeProps","_unref","_createVNode","_createElementVNode","_renderSlot","_createTextVNode","_toDisplayString"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarSearchButton.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Search Button component\n *\n * A styled button that serves as a search trigger in the sidebar.\n * Displays a magnifying glass icon and an optional keyboard shortcut.\n *\n * @example\n * <ScalarSidebarSearchButton>\n * <template #shortcut>⌘K</template>\n * </ScalarSidebarSearchButton>\n *\n * Stable hooks for styling from outside the component:\n * - `.scalar-sidebar-search-shortcut` targets the keyboard shortcut hint\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { ScalarIconMagnifyingGlass } from '@scalar/icons'\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\n\nconst { shortcutLabel = 'Keyboard Shortcut:' } = defineProps<{\n shortcutLabel?: string\n}>()\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <!-- role=\"search\" is a landmark for a search region, not a button control -->\n <button\n type=\"button\"\n v-bind=\"\n cx(\n 'flex items-center rounded border text-base h-8 gap-1 pl-2 pr-1',\n 'bg-sidebar-b-search border-sidebar-border-search text-sidebar-c-search',\n )\n \">\n <ScalarIconMagnifyingGlass\n aria-hidden=\"true\"\n class=\"size-4\" />\n <span class=\"flex-1 text-start leading-none\">\n <slot>Search...</slot>\n </span>\n <span\n v-if=\"$slots.shortcut\"\n class=\"scalar-sidebar-search-shortcut text-sidebar-c-2 rounded border px-1.25 py-1 text-xs leading-none font-medium uppercase\">\n <span class=\"sr-only\">{{ shortcutLabel }}</span>\n <kbd dir=\"ltr\">\n <slot name=\"shortcut\" />\n </kbd>\n </span>\n </button>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;EA0BA,MAAM,EAAE,OAAO,UAAU;;GAIvB,OAAAC,UAAA,GAAAC,mBAsBS,UAtBTC,WAsBS,EArBP,MAAK,SAAQ,GACEC,MAAA,EAAA,CAAE,C;IAMjBC,YAEmBD,MAAA,yBAAA,GAAA;KADjB,eAAY;KACZ,OAAM;;IACRE,mBAEO,QAFP,YAEO,CADLC,WAAsB,KAAA,QAAA,WAAA,CAAA,SAAA,CAAhB,OAAA,OAAA,OAAA,KAAAC,gBAAA,aAAS,EAAA,E;IAGTR,KAAAA,OAAO,YADfC,UAAA,GAAAC,mBAOO,QAPP,YAOO,CAJLI,mBAAgD,QAAhD,YAAgDG,gBAAvB,QAAA,aAAa,GAAA,CAAA,GACtCH,mBAEM,OAFN,YAEM,CADJC,WAAwB,KAAA,QAAA,UAAA,C"}
package/dist/style.css CHANGED
@@ -4869,7 +4869,7 @@ ol > li::marker,
4869
4869
  width: 66.6667%;
4870
4870
  }
4871
4871
  /*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
4872
- .group\/items.-translate-x-full .group\/button {
4872
+ .scalar-sidebar-items[data-nested-open] :is(.scalar-sidebar-button, .group\/button) {
4873
4873
  transition-behavior: allow-discrete;
4874
4874
  max-height: 0;
4875
4875
  transition-property: display, max-height;
@@ -4877,7 +4877,7 @@ ol > li::marker,
4877
4877
  transition-delay: .3s;
4878
4878
  display: none;
4879
4879
  }
4880
- .group\/item.group\/nested-items-open > * > .group\/items.translate-x-0 .group\/button {
4880
+ .scalar-sidebar-nested-items[data-open] > * > .scalar-sidebar-items:not([data-nested-open]) :is(.scalar-sidebar-button, .group\/button) {
4881
4881
  max-height: 2147483647px;
4882
4882
  display: flex;
4883
4883
  }
@@ -1187,7 +1187,7 @@ ol > li::marker,
1187
1187
  width: 66.6667%;
1188
1188
  }
1189
1189
  /*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
1190
- .group\/items.-translate-x-full .group\/button {
1190
+ .scalar-sidebar-items[data-nested-open] :is(.scalar-sidebar-button, .group\/button) {
1191
1191
  transition-behavior: allow-discrete;
1192
1192
  max-height: 0;
1193
1193
  transition-property: display, max-height;
@@ -1195,7 +1195,7 @@ ol > li::marker,
1195
1195
  transition-delay: .3s;
1196
1196
  display: none;
1197
1197
  }
1198
- .group\/item.group\/nested-items-open > * > .group\/items.translate-x-0 .group\/button {
1198
+ .scalar-sidebar-nested-items[data-open] > * > .scalar-sidebar-items:not([data-nested-open]) :is(.scalar-sidebar-button, .group\/button) {
1199
1199
  max-height: 2147483647px;
1200
1200
  display: flex;
1201
1201
  }
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "git+https://github.com/scalar/scalar.git",
11
11
  "directory": "packages/components"
12
12
  },
13
- "version": "0.36.1",
13
+ "version": "0.37.0",
14
14
  "engines": {
15
15
  "node": ">=22"
16
16
  },
@@ -221,12 +221,12 @@
221
221
  "@floating-ui/vue": "2.0.1",
222
222
  "@headlessui/tailwindcss": "^0.2.2",
223
223
  "@headlessui/vue": "1.7.23",
224
- "@scalar/helpers": "0.20.1",
224
+ "@scalar/helpers": "0.21.0",
225
225
  "@scalar/highlight": "0.9.0",
226
226
  "@scalar/icons": "0.7.12",
227
227
  "@scalar/markdown": "0.1.3",
228
228
  "@scalar/themes": "0.22.0",
229
- "@scalar/use-hooks": "0.5.1",
229
+ "@scalar/use-hooks": "0.5.2",
230
230
  "@vueuse/core": "15.0.0",
231
231
  "cva": "1.0.0-beta.4",
232
232
  "radix-vue": "^1.9.17",
@@ -235,7 +235,7 @@
235
235
  },
236
236
  "devDependencies": {
237
237
  "@playwright/test": "1.65.1",
238
- "@scalar/use-toasts": "0.10.11",
238
+ "@scalar/use-toasts": "0.10.12",
239
239
  "@storybook/addon-docs": "10.6.8",
240
240
  "@storybook/addon-links": "10.6.8",
241
241
  "@storybook/vue3-vite": "10.6.8",