@c-rex/components 0.0.8 → 0.0.9
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/autocomplete.cjs.js +215 -0
- package/dist/autocomplete.cjs.js.map +1 -0
- package/dist/autocomplete.d.cts +10 -0
- package/dist/autocomplete.d.ts +10 -0
- package/dist/autocomplete.esm.js +154 -0
- package/dist/autocomplete.esm.js.map +1 -0
- package/dist/blog-card.cjs.js +265 -0
- package/dist/blog-card.cjs.js.map +1 -0
- package/dist/blog-card.d.cts +19 -0
- package/dist/blog-card.d.ts +19 -0
- package/dist/blog-card.esm.js +192 -0
- package/dist/blog-card.esm.js.map +1 -0
- package/dist/blur-image.cjs.js +198 -0
- package/dist/blur-image.cjs.js.map +1 -0
- package/dist/blur-image.d.cts +7 -0
- package/dist/blur-image.d.ts +7 -0
- package/dist/blur-image.esm.js +125 -0
- package/dist/blur-image.esm.js.map +1 -0
- package/dist/breadcrumb.cjs.js +159 -0
- package/dist/breadcrumb.cjs.js.map +1 -0
- package/dist/breadcrumb.d.cts +10 -0
- package/dist/breadcrumb.d.ts +10 -0
- package/dist/breadcrumb.esm.js +98 -0
- package/dist/breadcrumb.esm.js.map +1 -0
- package/dist/empty.cjs.js +79 -0
- package/dist/empty.cjs.js.map +1 -0
- package/dist/empty.d.cts +5 -0
- package/dist/empty.d.ts +5 -0
- package/dist/empty.esm.js +18 -0
- package/dist/empty.esm.js.map +1 -0
- package/dist/navbar.cjs.js +134 -0
- package/dist/navbar.cjs.js.map +1 -0
- package/dist/navbar.d.cts +9 -0
- package/dist/navbar.d.ts +9 -0
- package/dist/navbar.esm.js +61 -0
- package/dist/navbar.esm.js.map +1 -0
- package/dist/providers/search-state-wrapper.cjs.js +113 -0
- package/dist/providers/search-state-wrapper.cjs.js.map +1 -0
- package/dist/providers/search-state-wrapper.d.cts +14 -0
- package/dist/providers/search-state-wrapper.d.ts +14 -0
- package/dist/providers/search-state-wrapper.esm.js +51 -0
- package/dist/providers/search-state-wrapper.esm.js.map +1 -0
- package/dist/result-list.cjs.js +321 -0
- package/dist/result-list.cjs.js.map +1 -0
- package/dist/result-list.d.cts +9 -0
- package/dist/result-list.d.ts +9 -0
- package/dist/result-list.esm.js +247 -0
- package/dist/result-list.esm.js.map +1 -0
- package/dist/result-view/blog-view.stories.cjs.js +372 -0
- package/dist/result-view/blog-view.stories.cjs.js.map +1 -0
- package/dist/result-view/blog-view.stories.d.cts +11 -0
- package/dist/result-view/blog-view.stories.d.ts +11 -0
- package/dist/result-view/blog-view.stories.esm.js +295 -0
- package/dist/result-view/blog-view.stories.esm.js.map +1 -0
- package/dist/result-view/blog.cjs.js +290 -0
- package/dist/result-view/blog.cjs.js.map +1 -0
- package/dist/result-view/blog.d.cts +9 -0
- package/dist/result-view/blog.d.ts +9 -0
- package/dist/result-view/blog.esm.js +220 -0
- package/dist/result-view/blog.esm.js.map +1 -0
- package/dist/result-view/table-view.stories.cjs.js +196 -0
- package/dist/result-view/table-view.stories.cjs.js.map +1 -0
- package/dist/result-view/table-view.stories.d.cts +11 -0
- package/dist/result-view/table-view.stories.d.ts +11 -0
- package/dist/result-view/table-view.stories.esm.js +131 -0
- package/dist/result-view/table-view.stories.esm.js.map +1 -0
- package/dist/result-view/table.cjs.js +116 -0
- package/dist/result-view/table.cjs.js.map +1 -0
- package/dist/result-view/table.d.cts +9 -0
- package/dist/result-view/table.d.ts +9 -0
- package/dist/result-view/table.esm.js +59 -0
- package/dist/result-view/table.esm.js.map +1 -0
- package/dist/sidebar.cjs.js +225 -0
- package/dist/sidebar.cjs.js.map +1 -0
- package/dist/sidebar.d.cts +12 -0
- package/dist/sidebar.d.ts +12 -0
- package/dist/sidebar.esm.js +164 -0
- package/dist/sidebar.esm.js.map +1 -0
- package/dist/stories/blog-card.stories.cjs.js +323 -0
- package/dist/stories/blog-card.stories.cjs.js.map +1 -0
- package/dist/stories/blog-card.stories.d.cts +9 -0
- package/dist/stories/blog-card.stories.d.ts +9 -0
- package/dist/stories/blog-card.stories.esm.js +242 -0
- package/dist/stories/blog-card.stories.esm.js.map +1 -0
- package/dist/stories/blur-image.stories.cjs.js +265 -0
- package/dist/stories/blur-image.stories.cjs.js.map +1 -0
- package/dist/stories/blur-image.stories.d.cts +37 -0
- package/dist/stories/blur-image.stories.d.ts +37 -0
- package/dist/stories/blur-image.stories.esm.js +180 -0
- package/dist/stories/blur-image.stories.esm.js.map +1 -0
- package/dist/stories/breadcrumb.stories.cjs.js +214 -0
- package/dist/stories/breadcrumb.stories.cjs.js.map +1 -0
- package/dist/stories/breadcrumb.stories.d.cts +9 -0
- package/dist/stories/breadcrumb.stories.d.ts +9 -0
- package/dist/stories/breadcrumb.stories.esm.js +145 -0
- package/dist/stories/breadcrumb.stories.esm.js.map +1 -0
- package/dist/stories/empty.stories.cjs.js +93 -0
- package/dist/stories/empty.stories.cjs.js.map +1 -0
- package/dist/stories/empty.stories.d.cts +13 -0
- package/dist/stories/empty.stories.d.ts +13 -0
- package/dist/stories/empty.stories.esm.js +28 -0
- package/dist/stories/empty.stories.esm.js.map +1 -0
- package/dist/stories/navbar.stories.cjs.js +151 -0
- package/dist/stories/navbar.stories.cjs.js.map +1 -0
- package/dist/stories/navbar.stories.d.cts +8 -0
- package/dist/stories/navbar.stories.d.ts +8 -0
- package/dist/stories/navbar.stories.esm.js +74 -0
- package/dist/stories/navbar.stories.esm.js.map +1 -0
- package/dist/stories/sidebar.stories.cjs.js +327 -0
- package/dist/stories/sidebar.stories.cjs.js.map +1 -0
- package/dist/stories/sidebar.stories.d.cts +30 -0
- package/dist/stories/sidebar.stories.d.ts +30 -0
- package/dist/stories/sidebar.stories.esm.js +258 -0
- package/dist/stories/sidebar.stories.esm.js.map +1 -0
- package/package.json +40 -27
- package/src/autocomplete.tsx +0 -113
- package/src/blog-card.tsx +0 -87
- package/src/blur-image.tsx +0 -23
- package/src/breadcrumb.tsx +0 -81
- package/src/empty.tsx +0 -13
- package/src/navbar.tsx +0 -66
- package/src/providers/search-state-wrapper.tsx +0 -21
- package/src/result-list.tsx +0 -16
- package/src/result-view/blog-view.stories.tsx +0 -58
- package/src/result-view/blog.tsx +0 -38
- package/src/result-view/table-view.stories.tsx +0 -55
- package/src/result-view/table.tsx +0 -65
- package/src/sidebar.tsx +0 -76
- package/src/stories/blog-card.stories.tsx +0 -46
- package/src/stories/blur-image.stories.tsx +0 -51
- package/src/stories/breadcrumb.stories.tsx +0 -52
- package/src/stories/empty.stories.tsx +0 -14
- package/src/stories/navbar.stories.tsx +0 -16
- package/src/stories/sidebar.stories.tsx +0 -94
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/periotto/Desktop/workspace/c-rex.net-web-client-foundation/packages/components/dist/stories/sidebar.stories.cjs.js","../../src/stories/sidebar.stories.tsx","../../src/sidebar.tsx"],"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","sidebar_stories_exports","Default","Loading","default","sidebar_stories_default","module","exports","import_sidebar","require","import_skeleton","import_jsx_runtime","AppSidebar","data","loading","props","jsxs","Sidebar","collapsible","className","children","jsx","SidebarContent","SidebarGroup","SidebarMenu","Fragment","Skeleton","map","item","SidebarMenuItem","SidebarMenuButton","asChild","isActive","active","href","link","title","label","length","SidebarMenuSub","SidebarMenuSubItem","SidebarMenuSubButton","id","SidebarRail","meta","component","tags","parameters","layout","argTypes","control","decorators","Story","import_jsx_runtime2","import_sidebar3","SidebarProvider","SidebarTrigger","SidebarInset","mockData","args"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAIA,YAAYC,OAAOC,cAAc;AACrC,IAAIC,mBAAmBF,OAAOG,wBAAwB;AACtD,IAAIC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iB;IAC1ByD,MAAM;QACF9C,MAAM6C;QACN5C,SAAS;IACb;AACJ;AAEO,IAAMX,UAAiB;IAC1BwD,MAAM;QACF9C,MAAM,EAAC;QACPC,SAAS;IACb;AACJ;AD4CA,6DAA6D;AAC7D,KAAMR,CAAAA,OAAOC,OAAO,GAAG;IACrBL,SAAAA;IACAC,SAAAA;AACF,CAAA","sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/stories/sidebar.stories.tsx\nvar sidebar_stories_exports = {};\n__export(sidebar_stories_exports, {\n Default: () => Default,\n Loading: () => Loading,\n default: () => sidebar_stories_default\n});\nmodule.exports = __toCommonJS(sidebar_stories_exports);\n\n// src/sidebar.tsx\nvar import_sidebar = require(\"@c-rex/ui/sidebar\");\nvar import_skeleton = require(\"@c-rex/ui/skeleton\");\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nfunction AppSidebar({ data, loading, ...props }) {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_sidebar.Sidebar, { collapsible: \"icon\", ...props, className: \"top-20\", children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sidebar.SidebarContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sidebar.SidebarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sidebar.SidebarMenu, { className: \"pt-4\", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: \"w-auto h-10 mb-2\" }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: \"w-auto h-10 mb-2\" }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: \"w-auto h-10 mb-2 ml-8\" }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: \"w-auto h-10 mb-2 ml-8\" }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: \"w-auto h-10 mb-2 ml-8\" }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: \"w-auto h-10 mb-2 ml-8\" }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: \"w-auto h-10 mb-2\" })\n ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: data.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_sidebar.SidebarMenuItem, { children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sidebar.SidebarMenuButton, { asChild: true, isActive: item.active, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"a\", { href: item.link, title: item.label, children: item.label }) }),\n item.children?.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sidebar.SidebarMenuSub, { children: item.children.map((item2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sidebar.SidebarMenuSubItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\n import_sidebar.SidebarMenuSubButton,\n {\n asChild: true,\n isActive: item2.active,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(\"a\", { href: item2.link, title: item2.label, children: item2.label })\n }\n ) }, item2.label)) }) : null\n ] }, item.id)) }) }) }) }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sidebar.SidebarRail, {})\n ] });\n}\n\n// src/stories/sidebar.stories.tsx\nvar import_sidebar3 = require(\"@c-rex/ui/sidebar\");\nvar import_jsx_runtime2 = require(\"react/jsx-runtime\");\nvar meta = {\n title: \"Components/Sidebar\",\n component: AppSidebar,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"centered\"\n },\n argTypes: {\n data: { control: \"object\" },\n loading: { control: \"boolean\" }\n },\n decorators: [\n (Story) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sidebar3.SidebarProvider, { children: [\n /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sidebar3.SidebarTrigger, {}),\n /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(\"div\", { className: \"flex\", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sidebar3.SidebarInset, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Story, {}) }) })\n ] })\n ]\n};\nvar sidebar_stories_default = meta;\nvar mockData = [\n {\n id: \"1\",\n label: \"Getting Started\",\n link: \"/docs/getting-started\",\n active: true,\n children: [\n {\n id: \"1-1\",\n label: \"Installation\",\n link: \"/docs/getting-started/installation\",\n active: false,\n children: []\n },\n {\n id: \"1-2\",\n label: \"Configuration\",\n link: \"/docs/getting-started/configuration\",\n active: false,\n children: []\n }\n ]\n },\n {\n id: \"2\",\n label: \"Components\",\n link: \"/docs/components\",\n active: false,\n children: [\n {\n id: \"2-1\",\n label: \"Sidebar\",\n link: \"/docs/components/sidebar\",\n active: false,\n children: []\n },\n {\n id: \"2-2\",\n label: \"Navbar\",\n link: \"/docs/components/navbar\",\n active: false,\n children: []\n }\n ]\n }\n];\nvar Default = {\n args: {\n data: mockData,\n loading: false\n }\n};\nvar Loading = {\n args: {\n data: [],\n loading: true\n }\n};\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n Default,\n Loading\n});\n","import type { Meta, StoryObj } from '@storybook/react';\nimport { AppSidebar } from '../sidebar';\nimport { SidebarInset, SidebarProvider, SidebarTrigger } from \"@c-rex/ui/sidebar\";\n\nconst meta = {\n title: 'Components/Sidebar',\n component: AppSidebar,\n tags: ['autodocs'],\n parameters: {\n layout: 'centered',\n },\n argTypes: {\n data: { control: 'object' },\n loading: { control: 'boolean' },\n },\n decorators: [\n (Story: any) => (\n <SidebarProvider>\n <SidebarTrigger />\n\n <div className=\"flex\">\n <SidebarInset>\n <Story />\n </SidebarInset>\n </div>\n </SidebarProvider>\n\n ),\n ]\n} satisfies Meta<typeof AppSidebar>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nconst mockData = [\n {\n id: '1',\n label: 'Getting Started',\n link: '/docs/getting-started',\n active: true,\n children: [\n {\n id: '1-1',\n label: 'Installation',\n link: '/docs/getting-started/installation',\n active: false,\n children: [],\n },\n {\n id: '1-2',\n label: 'Configuration',\n link: '/docs/getting-started/configuration',\n active: false,\n children: [],\n },\n ],\n },\n {\n id: '2',\n label: 'Components',\n link: '/docs/components',\n active: false,\n children: [\n {\n id: '2-1',\n label: 'Sidebar',\n link: '/docs/components/sidebar',\n active: false,\n children: [],\n },\n {\n id: '2-2',\n label: 'Navbar',\n link: '/docs/components/navbar',\n active: false,\n children: [],\n },\n ],\n },\n];\n\nexport const Default: Story = {\n args: {\n data: mockData,\n loading: false,\n },\n};\n\nexport const Loading: Story = {\n args: {\n data: [],\n loading: true,\n },\n};","\"use client\";\n\nimport { ComponentProps } from \"react\";\nimport {\n Sidebar,\n SidebarContent,\n SidebarGroup,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarRail\n} from \"@c-rex/ui/sidebar\";\nimport { Skeleton } from \"@c-rex/ui/skeleton\";\nimport { TreeOfContent } from \"@c-rex/interfaces\";\n\ninterface SidebarProps extends ComponentProps<typeof Sidebar> {\n data: TreeOfContent[];\n loading?: boolean;\n}\n\nexport function AppSidebar({ data, loading, ...props }: SidebarProps) {\n return (\n <Sidebar collapsible=\"icon\" {...props} className=\"top-20\">\n <SidebarContent>\n <SidebarGroup>\n <SidebarMenu className=\"pt-4\">\n {loading ? (\n <>\n <Skeleton className=\"w-auto h-10 mb-2\" />\n <Skeleton className=\"w-auto h-10 mb-2\" />\n <Skeleton className=\"w-auto h-10 mb-2 ml-8\" />\n <Skeleton className=\"w-auto h-10 mb-2 ml-8\" />\n <Skeleton className=\"w-auto h-10 mb-2 ml-8\" />\n <Skeleton className=\"w-auto h-10 mb-2 ml-8\" />\n <Skeleton className=\"w-auto h-10 mb-2\" />\n </>\n ) : (\n <>\n {data.map((item) => (\n <SidebarMenuItem key={item.id}>\n <SidebarMenuButton asChild isActive={item.active}>\n <a href={item.link} title={item.label}>\n {item.label}\n </a>\n </SidebarMenuButton>\n\n {item.children?.length ? (\n <SidebarMenuSub>\n {item.children.map((item) => (\n <SidebarMenuSubItem key={item.label}>\n <SidebarMenuSubButton\n asChild\n isActive={item.active}\n >\n <a href={item.link} title={item.label}>\n {item.label}\n </a>\n </SidebarMenuSubButton>\n </SidebarMenuSubItem>\n ))}\n </SidebarMenuSub>\n ) : null}\n </SidebarMenuItem>\n ))}\n </>\n )}\n </SidebarMenu>\n </SidebarGroup>\n </SidebarContent>\n <SidebarRail />\n </Sidebar>\n );\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
import { AppSidebar } from '../sidebar.cjs';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '@c-rex/ui/sidebar';
|
|
6
|
+
import '@c-rex/interfaces';
|
|
7
|
+
|
|
8
|
+
declare const meta: {
|
|
9
|
+
title: string;
|
|
10
|
+
component: typeof AppSidebar;
|
|
11
|
+
tags: string[];
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: string;
|
|
14
|
+
};
|
|
15
|
+
argTypes: {
|
|
16
|
+
data: {
|
|
17
|
+
control: "object";
|
|
18
|
+
};
|
|
19
|
+
loading: {
|
|
20
|
+
control: "boolean";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
decorators: ((Story: any) => react_jsx_runtime.JSX.Element)[];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
declare const Default: Story;
|
|
28
|
+
declare const Loading: Story;
|
|
29
|
+
|
|
30
|
+
export { Default, Loading, meta as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
import { AppSidebar } from '../sidebar.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '@c-rex/ui/sidebar';
|
|
6
|
+
import '@c-rex/interfaces';
|
|
7
|
+
|
|
8
|
+
declare const meta: {
|
|
9
|
+
title: string;
|
|
10
|
+
component: typeof AppSidebar;
|
|
11
|
+
tags: string[];
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: string;
|
|
14
|
+
};
|
|
15
|
+
argTypes: {
|
|
16
|
+
data: {
|
|
17
|
+
control: "object";
|
|
18
|
+
};
|
|
19
|
+
loading: {
|
|
20
|
+
control: "boolean";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
decorators: ((Story: any) => react_jsx_runtime.JSX.Element)[];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
declare const Default: Story;
|
|
28
|
+
declare const Loading: Story;
|
|
29
|
+
|
|
30
|
+
export { Default, Loading, meta as default };
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// src/sidebar.tsx
|
|
2
|
+
function _define_property(obj, key, value) {
|
|
3
|
+
if (key in obj) {
|
|
4
|
+
Object.defineProperty(obj, key, {
|
|
5
|
+
value: value,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true
|
|
9
|
+
});
|
|
10
|
+
} else {
|
|
11
|
+
obj[key] = value;
|
|
12
|
+
}
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
function _object_spread(target) {
|
|
16
|
+
for(var i = 1; i < arguments.length; i++){
|
|
17
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
18
|
+
var ownKeys = Object.keys(source);
|
|
19
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
20
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
21
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
ownKeys.forEach(function(key) {
|
|
25
|
+
_define_property(target, key, source[key]);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return target;
|
|
29
|
+
}
|
|
30
|
+
function ownKeys(object, enumerableOnly) {
|
|
31
|
+
var keys = Object.keys(object);
|
|
32
|
+
if (Object.getOwnPropertySymbols) {
|
|
33
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
34
|
+
if (enumerableOnly) {
|
|
35
|
+
symbols = symbols.filter(function(sym) {
|
|
36
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
keys.push.apply(keys, symbols);
|
|
40
|
+
}
|
|
41
|
+
return keys;
|
|
42
|
+
}
|
|
43
|
+
function _object_spread_props(target, source) {
|
|
44
|
+
source = source != null ? source : {};
|
|
45
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
46
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
47
|
+
} else {
|
|
48
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
49
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return target;
|
|
53
|
+
}
|
|
54
|
+
function _object_without_properties(source, excluded) {
|
|
55
|
+
if (source == null) return {};
|
|
56
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
57
|
+
var key, i;
|
|
58
|
+
if (Object.getOwnPropertySymbols) {
|
|
59
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
60
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
61
|
+
key = sourceSymbolKeys[i];
|
|
62
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
63
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
64
|
+
target[key] = source[key];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return target;
|
|
68
|
+
}
|
|
69
|
+
function _object_without_properties_loose(source, excluded) {
|
|
70
|
+
if (source == null) return {};
|
|
71
|
+
var target = {};
|
|
72
|
+
var sourceKeys = Object.keys(source);
|
|
73
|
+
var key, i;
|
|
74
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
75
|
+
key = sourceKeys[i];
|
|
76
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
77
|
+
target[key] = source[key];
|
|
78
|
+
}
|
|
79
|
+
return target;
|
|
80
|
+
}
|
|
81
|
+
import { Sidebar, SidebarContent, SidebarGroup, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarRail } from "@c-rex/ui/sidebar";
|
|
82
|
+
import { Skeleton } from "@c-rex/ui/skeleton";
|
|
83
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
84
|
+
function AppSidebar(_param) {
|
|
85
|
+
var data = _param.data, loading = _param.loading, props = _object_without_properties(_param, [
|
|
86
|
+
"data",
|
|
87
|
+
"loading"
|
|
88
|
+
]);
|
|
89
|
+
return /* @__PURE__ */ jsxs(Sidebar, _object_spread_props(_object_spread({
|
|
90
|
+
collapsible: "icon"
|
|
91
|
+
}, props), {
|
|
92
|
+
className: "top-20",
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsx(SidebarContent, {
|
|
95
|
+
children: /* @__PURE__ */ jsx(SidebarGroup, {
|
|
96
|
+
children: /* @__PURE__ */ jsx(SidebarMenu, {
|
|
97
|
+
className: "pt-4",
|
|
98
|
+
children: loading ? /* @__PURE__ */ jsxs(Fragment, {
|
|
99
|
+
children: [
|
|
100
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
101
|
+
className: "w-auto h-10 mb-2"
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
104
|
+
className: "w-auto h-10 mb-2"
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
107
|
+
className: "w-auto h-10 mb-2 ml-8"
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
110
|
+
className: "w-auto h-10 mb-2 ml-8"
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
113
|
+
className: "w-auto h-10 mb-2 ml-8"
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
116
|
+
className: "w-auto h-10 mb-2 ml-8"
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
119
|
+
className: "w-auto h-10 mb-2"
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}) : /* @__PURE__ */ jsx(Fragment, {
|
|
123
|
+
children: data.map(function(item) {
|
|
124
|
+
var _item_children;
|
|
125
|
+
return /* @__PURE__ */ jsxs(SidebarMenuItem, {
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ jsx(SidebarMenuButton, {
|
|
128
|
+
asChild: true,
|
|
129
|
+
isActive: item.active,
|
|
130
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
131
|
+
href: item.link,
|
|
132
|
+
title: item.label,
|
|
133
|
+
children: item.label
|
|
134
|
+
})
|
|
135
|
+
}),
|
|
136
|
+
((_item_children = item.children) === null || _item_children === void 0 ? void 0 : _item_children.length) ? /* @__PURE__ */ jsx(SidebarMenuSub, {
|
|
137
|
+
children: item.children.map(function(item2) {
|
|
138
|
+
return /* @__PURE__ */ jsx(SidebarMenuSubItem, {
|
|
139
|
+
children: /* @__PURE__ */ jsx(SidebarMenuSubButton, {
|
|
140
|
+
asChild: true,
|
|
141
|
+
isActive: item2.active,
|
|
142
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
143
|
+
href: item2.link,
|
|
144
|
+
title: item2.label,
|
|
145
|
+
children: item2.label
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
}, item2.label);
|
|
149
|
+
})
|
|
150
|
+
}) : null
|
|
151
|
+
]
|
|
152
|
+
}, item.id);
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ jsx(SidebarRail, {})
|
|
159
|
+
]
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
// src/stories/sidebar.stories.tsx
|
|
163
|
+
import { SidebarInset, SidebarProvider, SidebarTrigger } from "@c-rex/ui/sidebar";
|
|
164
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
165
|
+
var meta = {
|
|
166
|
+
title: "Components/Sidebar",
|
|
167
|
+
component: AppSidebar,
|
|
168
|
+
tags: [
|
|
169
|
+
"autodocs"
|
|
170
|
+
],
|
|
171
|
+
parameters: {
|
|
172
|
+
layout: "centered"
|
|
173
|
+
},
|
|
174
|
+
argTypes: {
|
|
175
|
+
data: {
|
|
176
|
+
control: "object"
|
|
177
|
+
},
|
|
178
|
+
loading: {
|
|
179
|
+
control: "boolean"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
decorators: [
|
|
183
|
+
function(Story) {
|
|
184
|
+
return /* @__PURE__ */ jsxs2(SidebarProvider, {
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ jsx2(SidebarTrigger, {}),
|
|
187
|
+
/* @__PURE__ */ jsx2("div", {
|
|
188
|
+
className: "flex",
|
|
189
|
+
children: /* @__PURE__ */ jsx2(SidebarInset, {
|
|
190
|
+
children: /* @__PURE__ */ jsx2(Story, {})
|
|
191
|
+
})
|
|
192
|
+
})
|
|
193
|
+
]
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
};
|
|
198
|
+
var sidebar_stories_default = meta;
|
|
199
|
+
var mockData = [
|
|
200
|
+
{
|
|
201
|
+
id: "1",
|
|
202
|
+
label: "Getting Started",
|
|
203
|
+
link: "/docs/getting-started",
|
|
204
|
+
active: true,
|
|
205
|
+
children: [
|
|
206
|
+
{
|
|
207
|
+
id: "1-1",
|
|
208
|
+
label: "Installation",
|
|
209
|
+
link: "/docs/getting-started/installation",
|
|
210
|
+
active: false,
|
|
211
|
+
children: []
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
id: "1-2",
|
|
215
|
+
label: "Configuration",
|
|
216
|
+
link: "/docs/getting-started/configuration",
|
|
217
|
+
active: false,
|
|
218
|
+
children: []
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
id: "2",
|
|
224
|
+
label: "Components",
|
|
225
|
+
link: "/docs/components",
|
|
226
|
+
active: false,
|
|
227
|
+
children: [
|
|
228
|
+
{
|
|
229
|
+
id: "2-1",
|
|
230
|
+
label: "Sidebar",
|
|
231
|
+
link: "/docs/components/sidebar",
|
|
232
|
+
active: false,
|
|
233
|
+
children: []
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
id: "2-2",
|
|
237
|
+
label: "Navbar",
|
|
238
|
+
link: "/docs/components/navbar",
|
|
239
|
+
active: false,
|
|
240
|
+
children: []
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
];
|
|
245
|
+
var Default = {
|
|
246
|
+
args: {
|
|
247
|
+
data: mockData,
|
|
248
|
+
loading: false
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
var Loading = {
|
|
252
|
+
args: {
|
|
253
|
+
data: [],
|
|
254
|
+
loading: true
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
export { Default, Loading, sidebar_stories_default as default };
|
|
258
|
+
//# sourceMappingURL=sidebar.stories.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/periotto/Desktop/workspace/c-rex.net-web-client-foundation/packages/components/dist/stories/sidebar.stories.esm.js","../../src/sidebar.tsx","../../src/stories/sidebar.stories.tsx"],"names":["Sidebar","SidebarContent","SidebarGroup","SidebarMenu","SidebarMenuButton","SidebarMenuItem","SidebarMenuSub","SidebarMenuSubButton","SidebarMenuSubItem","SidebarRail","Skeleton","Fragment","jsx","jsxs","AppSidebar","data","loading","props","collapsible","className","children","map","item","asChild","isActive","active","href","link","title","label","length","id","SidebarInset","SidebarProvider","SidebarTrigger","meta","component","tags","parameters","layout","argTypes","control","decorators","Story","sidebar_stories_default","mockData","Default","args","Loading","default"],"mappings":"AAAA,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACGlB,SACIA,OAAA,EACAC,cAAA,EACAC,YAAA,EACAC,WAAA,EACAC,iBAAA,EACAC,eAAA,EACAC,cAAA,EACAC,oBAAA,EACAC,kBAAA,EACAC,WAAA,QACG,oBAAA;AACP,SAASC,QAAA,QAAgB,qBAAA;AAeG,SAAAC,QAAA,EACIC,GAAA,EADJC,IAAA,QAAA,oBAAA;AAPrB,SAASC,WAAW;QAAEC,OAAF,OAAEA,MAAMC,UAAR,OAAQA,SAAYC,mCAApB;QAAEF;QAAMC;;IAC/B,OACI,aAAA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;IACA;QACIW,IAAI;QACJF,OAAO;QACPF,MAAM;QACNF,QAAQ;QACRL,UAAU;YACN;gBACIW,IAAI;gBACJF,OAAO;gBACPF,MAAM;gBACNF,QAAQ;gBACRL,UAAU,EAAC;YACf;YACA;gBACIW,IAAI;gBACJF,OAAO;gBACPF,MAAM;gBACNF,QAAQ;gBACRL,UAAU,EAAC;YACf;SACJ;IACJ;CACJ;AAEO,IAAM0B,UAAiB;IAC1BC,MAAM;QACFhC,MAAM8B;QACN7B,SAAS;IACb;AACJ;AAEO,IAAMgC,UAAiB;IAC1BD,MAAM;QACFhC,MAAM,EAAC;QACPC,SAAS;IACb;AACJ;AF2BA,SACE8B,OAAO,EACPE,OAAO,EACPJ,2BAA2BK,OAAO,GAClC","sourcesContent":["// src/sidebar.tsx\nimport {\n Sidebar,\n SidebarContent,\n SidebarGroup,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarRail\n} from \"@c-rex/ui/sidebar\";\nimport { Skeleton } from \"@c-rex/ui/skeleton\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nfunction AppSidebar({ data, loading, ...props }) {\n return /* @__PURE__ */ jsxs(Sidebar, { collapsible: \"icon\", ...props, className: \"top-20\", children: [\n /* @__PURE__ */ jsx(SidebarContent, { children: /* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsx(SidebarMenu, { className: \"pt-4\", children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(Skeleton, { className: \"w-auto h-10 mb-2\" }),\n /* @__PURE__ */ jsx(Skeleton, { className: \"w-auto h-10 mb-2\" }),\n /* @__PURE__ */ jsx(Skeleton, { className: \"w-auto h-10 mb-2 ml-8\" }),\n /* @__PURE__ */ jsx(Skeleton, { className: \"w-auto h-10 mb-2 ml-8\" }),\n /* @__PURE__ */ jsx(Skeleton, { className: \"w-auto h-10 mb-2 ml-8\" }),\n /* @__PURE__ */ jsx(Skeleton, { className: \"w-auto h-10 mb-2 ml-8\" }),\n /* @__PURE__ */ jsx(Skeleton, { className: \"w-auto h-10 mb-2\" })\n ] }) : /* @__PURE__ */ jsx(Fragment, { children: data.map((item) => /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [\n /* @__PURE__ */ jsx(SidebarMenuButton, { asChild: true, isActive: item.active, children: /* @__PURE__ */ jsx(\"a\", { href: item.link, title: item.label, children: item.label }) }),\n item.children?.length ? /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.children.map((item2) => /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(\n SidebarMenuSubButton,\n {\n asChild: true,\n isActive: item2.active,\n children: /* @__PURE__ */ jsx(\"a\", { href: item2.link, title: item2.label, children: item2.label })\n }\n ) }, item2.label)) }) : null\n ] }, item.id)) }) }) }) }),\n /* @__PURE__ */ jsx(SidebarRail, {})\n ] });\n}\n\n// src/stories/sidebar.stories.tsx\nimport { SidebarInset, SidebarProvider, SidebarTrigger } from \"@c-rex/ui/sidebar\";\nimport { jsx as jsx2, jsxs as jsxs2 } from \"react/jsx-runtime\";\nvar meta = {\n title: \"Components/Sidebar\",\n component: AppSidebar,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"centered\"\n },\n argTypes: {\n data: { control: \"object\" },\n loading: { control: \"boolean\" }\n },\n decorators: [\n (Story) => /* @__PURE__ */ jsxs2(SidebarProvider, { children: [\n /* @__PURE__ */ jsx2(SidebarTrigger, {}),\n /* @__PURE__ */ jsx2(\"div\", { className: \"flex\", children: /* @__PURE__ */ jsx2(SidebarInset, { children: /* @__PURE__ */ jsx2(Story, {}) }) })\n ] })\n ]\n};\nvar sidebar_stories_default = meta;\nvar mockData = [\n {\n id: \"1\",\n label: \"Getting Started\",\n link: \"/docs/getting-started\",\n active: true,\n children: [\n {\n id: \"1-1\",\n label: \"Installation\",\n link: \"/docs/getting-started/installation\",\n active: false,\n children: []\n },\n {\n id: \"1-2\",\n label: \"Configuration\",\n link: \"/docs/getting-started/configuration\",\n active: false,\n children: []\n }\n ]\n },\n {\n id: \"2\",\n label: \"Components\",\n link: \"/docs/components\",\n active: false,\n children: [\n {\n id: \"2-1\",\n label: \"Sidebar\",\n link: \"/docs/components/sidebar\",\n active: false,\n children: []\n },\n {\n id: \"2-2\",\n label: \"Navbar\",\n link: \"/docs/components/navbar\",\n active: false,\n children: []\n }\n ]\n }\n];\nvar Default = {\n args: {\n data: mockData,\n loading: false\n }\n};\nvar Loading = {\n args: {\n data: [],\n loading: true\n }\n};\nexport {\n Default,\n Loading,\n sidebar_stories_default as default\n};\n","\"use client\";\n\nimport { ComponentProps } from \"react\";\nimport {\n Sidebar,\n SidebarContent,\n SidebarGroup,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarRail\n} from \"@c-rex/ui/sidebar\";\nimport { Skeleton } from \"@c-rex/ui/skeleton\";\nimport { TreeOfContent } from \"@c-rex/interfaces\";\n\ninterface SidebarProps extends ComponentProps<typeof Sidebar> {\n data: TreeOfContent[];\n loading?: boolean;\n}\n\nexport function AppSidebar({ data, loading, ...props }: SidebarProps) {\n return (\n <Sidebar collapsible=\"icon\" {...props} className=\"top-20\">\n <SidebarContent>\n <SidebarGroup>\n <SidebarMenu className=\"pt-4\">\n {loading ? (\n <>\n <Skeleton className=\"w-auto h-10 mb-2\" />\n <Skeleton className=\"w-auto h-10 mb-2\" />\n <Skeleton className=\"w-auto h-10 mb-2 ml-8\" />\n <Skeleton className=\"w-auto h-10 mb-2 ml-8\" />\n <Skeleton className=\"w-auto h-10 mb-2 ml-8\" />\n <Skeleton className=\"w-auto h-10 mb-2 ml-8\" />\n <Skeleton className=\"w-auto h-10 mb-2\" />\n </>\n ) : (\n <>\n {data.map((item) => (\n <SidebarMenuItem key={item.id}>\n <SidebarMenuButton asChild isActive={item.active}>\n <a href={item.link} title={item.label}>\n {item.label}\n </a>\n </SidebarMenuButton>\n\n {item.children?.length ? (\n <SidebarMenuSub>\n {item.children.map((item) => (\n <SidebarMenuSubItem key={item.label}>\n <SidebarMenuSubButton\n asChild\n isActive={item.active}\n >\n <a href={item.link} title={item.label}>\n {item.label}\n </a>\n </SidebarMenuSubButton>\n </SidebarMenuSubItem>\n ))}\n </SidebarMenuSub>\n ) : null}\n </SidebarMenuItem>\n ))}\n </>\n )}\n </SidebarMenu>\n </SidebarGroup>\n </SidebarContent>\n <SidebarRail />\n </Sidebar>\n );\n}\n","import type { Meta, StoryObj } from '@storybook/react';\nimport { AppSidebar } from '../sidebar';\nimport { SidebarInset, SidebarProvider, SidebarTrigger } from \"@c-rex/ui/sidebar\";\n\nconst meta = {\n title: 'Components/Sidebar',\n component: AppSidebar,\n tags: ['autodocs'],\n parameters: {\n layout: 'centered',\n },\n argTypes: {\n data: { control: 'object' },\n loading: { control: 'boolean' },\n },\n decorators: [\n (Story: any) => (\n <SidebarProvider>\n <SidebarTrigger />\n\n <div className=\"flex\">\n <SidebarInset>\n <Story />\n </SidebarInset>\n </div>\n </SidebarProvider>\n\n ),\n ]\n} satisfies Meta<typeof AppSidebar>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nconst mockData = [\n {\n id: '1',\n label: 'Getting Started',\n link: '/docs/getting-started',\n active: true,\n children: [\n {\n id: '1-1',\n label: 'Installation',\n link: '/docs/getting-started/installation',\n active: false,\n children: [],\n },\n {\n id: '1-2',\n label: 'Configuration',\n link: '/docs/getting-started/configuration',\n active: false,\n children: [],\n },\n ],\n },\n {\n id: '2',\n label: 'Components',\n link: '/docs/components',\n active: false,\n children: [\n {\n id: '2-1',\n label: 'Sidebar',\n link: '/docs/components/sidebar',\n active: false,\n children: [],\n },\n {\n id: '2-2',\n label: 'Navbar',\n link: '/docs/components/navbar',\n active: false,\n children: [],\n },\n ],\n },\n];\n\nexport const Default: Story = {\n args: {\n data: mockData,\n loading: false,\n },\n};\n\nexport const Loading: Story = {\n args: {\n data: [],\n loading: true,\n },\n};"]}
|
package/package.json
CHANGED
|
@@ -1,62 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c-rex/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"files": [
|
|
5
|
-
"
|
|
6
|
+
"dist"
|
|
6
7
|
],
|
|
7
8
|
"publishConfig": {
|
|
8
9
|
"access": "public"
|
|
9
10
|
},
|
|
10
11
|
"exports": {
|
|
11
12
|
"./autocomplete": {
|
|
12
|
-
"types": "./
|
|
13
|
-
"import": "./
|
|
13
|
+
"types": "./dist/autocomplete.d.ts",
|
|
14
|
+
"import": "./dist/autocomplete.esm.js",
|
|
15
|
+
"require": "./dist/autocomplete.cjs.js"
|
|
14
16
|
},
|
|
15
17
|
"./blog-card": {
|
|
16
|
-
"types": "./
|
|
17
|
-
"import": "./
|
|
18
|
+
"types": "./dist/blog-card.d.ts",
|
|
19
|
+
"import": "./dist/blog-card.esm.js",
|
|
20
|
+
"require": "./dist/blog-card.cjs.js"
|
|
18
21
|
},
|
|
19
22
|
"./blur-image": {
|
|
20
|
-
"types": "./
|
|
21
|
-
"import": "./
|
|
23
|
+
"types": "./dist/blur-image.d.ts",
|
|
24
|
+
"import": "./dist/blur-image.esm.js",
|
|
25
|
+
"require": "./dist/blur-image.cjs.js"
|
|
22
26
|
},
|
|
23
27
|
"./breadcrumb": {
|
|
24
|
-
"types": "./
|
|
25
|
-
"import": "./
|
|
28
|
+
"types": "./dist/breadcrumb.d.ts",
|
|
29
|
+
"import": "./dist/breadcrumb.esm.js",
|
|
30
|
+
"require": "./dist/breadcrumb.cjs.js"
|
|
26
31
|
},
|
|
27
32
|
"./empty": {
|
|
28
|
-
"types": "./
|
|
29
|
-
"import": "./
|
|
33
|
+
"types": "./dist/empty.d.ts",
|
|
34
|
+
"import": "./dist/empty.esm.js",
|
|
35
|
+
"require": "./dist/empty.cjs.js"
|
|
30
36
|
},
|
|
31
37
|
"./navbar": {
|
|
32
|
-
"types": "./
|
|
33
|
-
"import": "./
|
|
38
|
+
"types": "./dist/navbar.d.ts",
|
|
39
|
+
"import": "./dist/navbar.esm.js",
|
|
40
|
+
"require": "./dist/navbar.cjs.js"
|
|
34
41
|
},
|
|
35
42
|
"./search-wrapper": {
|
|
36
|
-
"types": "./
|
|
37
|
-
"import": "./
|
|
43
|
+
"types": "./dist/providers/search-state-wrapper.d.ts",
|
|
44
|
+
"import": "./dist/providers/search-state-wrapper.esm.js",
|
|
45
|
+
"require": "./dist/providers/search-state-wrapper.cjs.js"
|
|
38
46
|
},
|
|
39
47
|
"./result-list": {
|
|
40
|
-
"types": "./
|
|
41
|
-
"import": "./
|
|
48
|
+
"types": "./dist/result-list.d.ts",
|
|
49
|
+
"import": "./dist/result-list.esm.js",
|
|
50
|
+
"require": "./dist/result-list.cjs.js"
|
|
42
51
|
},
|
|
43
52
|
"./result-view/blog": {
|
|
44
|
-
"types": "./
|
|
45
|
-
"import": "./
|
|
53
|
+
"types": "./dist/result-view/blog.d.ts",
|
|
54
|
+
"import": "./dist/result-view/blog.esm.js",
|
|
55
|
+
"require": "./dist/result-view/blog.cjs.js"
|
|
46
56
|
},
|
|
47
57
|
"./result-view/table": {
|
|
48
|
-
"types": "./
|
|
49
|
-
"import": "./
|
|
58
|
+
"types": "./dist/result-view/table.d.ts",
|
|
59
|
+
"import": "./dist/result-view/table.esm.js",
|
|
60
|
+
"require": "./dist/result-view/table.cjs.js"
|
|
50
61
|
},
|
|
51
62
|
"./sidebar": {
|
|
52
|
-
"types": "./
|
|
53
|
-
"import": "./
|
|
63
|
+
"types": "./dist/sidebar.d.ts",
|
|
64
|
+
"import": "./dist/sidebar.esm.js",
|
|
65
|
+
"require": "./dist/sidebar.cjs.js"
|
|
54
66
|
},
|
|
55
67
|
"./package.json": "./package.json"
|
|
56
68
|
},
|
|
57
69
|
"scripts": {
|
|
58
|
-
"dev": "
|
|
59
|
-
"build": "
|
|
70
|
+
"dev": "tsup --watch",
|
|
71
|
+
"build": "tsup",
|
|
60
72
|
"storybook": "storybook dev -p 6006",
|
|
61
73
|
"build-storybook": "storybook build"
|
|
62
74
|
},
|
|
@@ -70,6 +82,7 @@
|
|
|
70
82
|
"@storybook/nextjs": "^8.6.12",
|
|
71
83
|
"@storybook/react": "^8.6.12",
|
|
72
84
|
"@storybook/test": "^8.6.12",
|
|
85
|
+
"@swc/core": "^1.11.21",
|
|
73
86
|
"@turbo/gen": "^2.4.4",
|
|
74
87
|
"@types/node": "^22.13.10",
|
|
75
88
|
"@types/react": "19.0.10",
|
|
@@ -84,12 +97,12 @@
|
|
|
84
97
|
"typescript": "latest"
|
|
85
98
|
},
|
|
86
99
|
"dependencies": {
|
|
100
|
+
"@c-rex/config": "*",
|
|
87
101
|
"@c-rex/contexts": "*",
|
|
88
102
|
"@c-rex/interfaces": "*",
|
|
89
103
|
"@c-rex/services": "*",
|
|
90
104
|
"@c-rex/ui": "*",
|
|
91
105
|
"@c-rex/utils": "*",
|
|
92
|
-
"@c-rex/config": "*",
|
|
93
106
|
"next": "^14",
|
|
94
107
|
"react": "^18",
|
|
95
108
|
"react-dom": "^18",
|
package/src/autocomplete.tsx
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Command as CommandPrimitive } from "cmdk";
|
|
2
|
-
import { Check } from "lucide-react";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { Input } from "@c-rex/ui/input";
|
|
5
|
-
import {
|
|
6
|
-
Command,
|
|
7
|
-
CommandEmpty,
|
|
8
|
-
CommandGroup,
|
|
9
|
-
CommandItem,
|
|
10
|
-
CommandList
|
|
11
|
-
} from "@c-rex/ui/command";
|
|
12
|
-
import {
|
|
13
|
-
Popover,
|
|
14
|
-
PopoverAnchor,
|
|
15
|
-
PopoverContent
|
|
16
|
-
} from "@c-rex/ui/popover";
|
|
17
|
-
|
|
18
|
-
type Props = {
|
|
19
|
-
initialValue: string;
|
|
20
|
-
onSelect: (value: string) => void;
|
|
21
|
-
onSearch: (value: string) => Promise<string[]>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const AutoComplete = ({
|
|
25
|
-
initialValue,
|
|
26
|
-
onSearch,
|
|
27
|
-
onSelect,
|
|
28
|
-
}: Props) => {
|
|
29
|
-
const [query, setQuery] = useState(initialValue);
|
|
30
|
-
const [suggestions, setSuggestions] = useState<string[]>([]);
|
|
31
|
-
|
|
32
|
-
const [open, setOpen] = useState(false);
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
const debounceFetch = setTimeout(() => {
|
|
36
|
-
if (query) {
|
|
37
|
-
onSearch(query).then(setSuggestions);
|
|
38
|
-
} else {
|
|
39
|
-
setSuggestions([]);
|
|
40
|
-
}
|
|
41
|
-
}, 300);
|
|
42
|
-
|
|
43
|
-
return () => clearTimeout(debounceFetch);
|
|
44
|
-
}, [onSearch, query]);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<div className="flex items-center">
|
|
48
|
-
<Popover open={open} onOpenChange={setOpen}>
|
|
49
|
-
<Command shouldFilter={false}>
|
|
50
|
-
<PopoverAnchor asChild>
|
|
51
|
-
<CommandPrimitive.Input
|
|
52
|
-
asChild
|
|
53
|
-
value={query}
|
|
54
|
-
onValueChange={setQuery}
|
|
55
|
-
onKeyDown={(e) => setOpen(e.key !== "Escape")}
|
|
56
|
-
onMouseDown={() => setOpen(false)}
|
|
57
|
-
onFocus={() => setOpen(true)}
|
|
58
|
-
>
|
|
59
|
-
<Input />
|
|
60
|
-
</CommandPrimitive.Input>
|
|
61
|
-
</PopoverAnchor>
|
|
62
|
-
|
|
63
|
-
{!open && <CommandList aria-hidden="true" className="hidden" />}
|
|
64
|
-
|
|
65
|
-
<PopoverContent
|
|
66
|
-
asChild
|
|
67
|
-
onOpenAutoFocus={(e) => e.preventDefault()}
|
|
68
|
-
onInteractOutside={(e) => {
|
|
69
|
-
if (
|
|
70
|
-
e.target instanceof Element &&
|
|
71
|
-
e.target.hasAttribute("cmdk-input")
|
|
72
|
-
) {
|
|
73
|
-
e.preventDefault();
|
|
74
|
-
}
|
|
75
|
-
}}
|
|
76
|
-
className="w-[--radix-popover-trigger-width] p-0"
|
|
77
|
-
>
|
|
78
|
-
<CommandList>
|
|
79
|
-
{/*isLoading && (
|
|
80
|
-
<CommandPrimitive.Loading>
|
|
81
|
-
<div className="p-1">
|
|
82
|
-
<Skeleton className="h-6 w-full" />
|
|
83
|
-
</div>
|
|
84
|
-
</CommandPrimitive.Loading>
|
|
85
|
-
)*/}
|
|
86
|
-
|
|
87
|
-
{suggestions.length > 0 ? (
|
|
88
|
-
<CommandGroup>
|
|
89
|
-
{suggestions.map((option) => (
|
|
90
|
-
<CommandItem
|
|
91
|
-
key={option}
|
|
92
|
-
value={option}
|
|
93
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
94
|
-
onSelect={(inputValue) => {
|
|
95
|
-
setOpen(false);
|
|
96
|
-
onSelect(inputValue ?? "");
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
99
|
-
<Check className="mr-2 h-4 w-4 opacity-0" />
|
|
100
|
-
{option}
|
|
101
|
-
</CommandItem>
|
|
102
|
-
))}
|
|
103
|
-
</CommandGroup>
|
|
104
|
-
) : (
|
|
105
|
-
<CommandEmpty>No suggestions.</CommandEmpty>
|
|
106
|
-
)}
|
|
107
|
-
</CommandList>
|
|
108
|
-
</PopoverContent>
|
|
109
|
-
</Command>
|
|
110
|
-
</Popover>
|
|
111
|
-
</div>
|
|
112
|
-
);
|
|
113
|
-
}
|