@sybilion/uilib 1.3.4 → 1.3.6

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.
@@ -0,0 +1,15 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import cn from 'classnames';
3
+ import S from './GridLayout.styl.js';
4
+
5
+ function GridLayout({ children, colWidth = 300, gap = 'var(--p-2)', className, as: asProp, }) {
6
+ const As = asProp ?? 'div';
7
+ return (jsx(As, { className: cn(S.root, className), style: {
8
+ maxWidth: '100%',
9
+ gap: gap,
10
+ display: 'grid',
11
+ gridTemplateColumns: `repeat(auto-fit, minmax(${colWidth}px, 1fr))`,
12
+ }, children: children }));
13
+ }
14
+
15
+ export { GridLayout };
@@ -0,0 +1,7 @@
1
+ import styleInject from 'style-inject';
2
+
3
+ var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.GridLayout_root__VF9sR{display:grid;min-width:0;width:100%}.GridLayout_root__VF9sR>*{min-width:300px}";
4
+ var S = {"root":"GridLayout_root__VF9sR"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -15,8 +15,8 @@ function hasTabPanelContent(content) {
15
15
  return false;
16
16
  return true;
17
17
  }
18
- function PageTabs({ className, contentClassName, scrollbarClassName, items, tabsListProps, ...props }) {
19
- return (jsxs(Tabs, { className: cn(S.root, className), variant: "link", ...props, children: [jsx(TabsList, { ...tabsListProps, className: cn(S.list, tabsListProps?.withPaddings && S.withPaddings), children: jsx(PageXScroll, { size: "sm", scrollbarClassName: cn(S.scrollbar, scrollbarClassName), children: items.map(item => (jsx(TabsTrigger, { value: item.value, children: item.label }, item.value))) }) }), items.map(item => hasTabPanelContent(item.content) ? (jsx(TabsContent, { value: item.value, className: cn(S.content, contentClassName), children: item.content }, item.value)) : null)] }));
18
+ function PageTabs({ className, contentClassName, innerClassName, scrollbarClassName, items, tabsListProps, ...props }) {
19
+ return (jsxs(Tabs, { className: cn(S.root, className), variant: "link", ...props, children: [jsx(TabsList, { ...tabsListProps, className: cn(S.list, tabsListProps?.withPaddings && S.withPaddings), children: jsx(PageXScroll, { size: "sm", scrollbarClassName: cn(S.scrollbar, scrollbarClassName), innerClassName: innerClassName, children: items.map(item => (jsx(TabsTrigger, { value: item.value, children: item.label }, item.value))) }) }), items.map(item => hasTabPanelContent(item.content) ? (jsx(TabsContent, { value: item.value, className: cn(S.content, contentClassName), children: item.content }, item.value)) : null)] }));
20
20
  }
21
21
 
22
22
  export { PageTabs };
package/dist/esm/index.js CHANGED
@@ -36,6 +36,7 @@ export { DropZone } from './components/ui/DropZone/DropZone.js';
36
36
  export { FlickeringGrid } from './components/ui/FlickeringGrid/FlickeringGrid.js';
37
37
  export { Foldable } from './components/ui/Foldable/Foldable.js';
38
38
  export { Gap } from './components/ui/Gap/Gap.js';
39
+ export { GridLayout } from './components/ui/GridLayout/GridLayout.js';
39
40
  export { Image } from './components/ui/Image/Image.js';
40
41
  export { ImageWithFallback } from './components/ui/ImageWithFallback/ImageWithFallback.js';
41
42
  export { Input } from './components/ui/Input/Input.js';
@@ -0,0 +1,9 @@
1
+ import type { ElementType, ReactNode } from 'react';
2
+ export interface GridLayoutProps {
3
+ children: ReactNode;
4
+ colWidth?: number;
5
+ gap?: string;
6
+ className?: string;
7
+ as?: ElementType;
8
+ }
9
+ export declare function GridLayout({ children, colWidth, gap, className, as: asProp, }: GridLayoutProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { TabsListProps, TabsProps } from '#uilib/components/ui/Tabs';
2
- export declare function PageTabs({ className, contentClassName, scrollbarClassName, items, tabsListProps, ...props }: {
2
+ export declare function PageTabs({ className, contentClassName, innerClassName, scrollbarClassName, items, tabsListProps, ...props }: {
3
3
  items: {
4
4
  value: string;
5
5
  label: string;
@@ -11,5 +11,6 @@ export declare function PageTabs({ className, contentClassName, scrollbarClassNa
11
11
  };
12
12
  } & TabsProps & {
13
13
  contentClassName?: string;
14
+ innerClassName?: string;
14
15
  scrollbarClassName?: string;
15
16
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function GridLayoutPage(): import("react/jsx-runtime").JSX.Element;
@@ -25,6 +25,7 @@ export * from './components/ui/DropZone/DropZone';
25
25
  export * from './components/ui/FlickeringGrid';
26
26
  export * from './components/ui/Foldable';
27
27
  export * from './components/ui/Gap/Gap';
28
+ export * from './components/ui/GridLayout/GridLayout';
28
29
  export * from './components/ui/Image';
29
30
  export * from './components/ui/ImageWithFallback';
30
31
  export * from './components/ui/Input';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sybilion/uilib",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Sybilion Design System — React UI components (Webpack + Stylus)",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -0,0 +1,9 @@
1
+ @import '../../../lib/theme.styl'
2
+
3
+ .root
4
+ display grid
5
+ width 100%
6
+ min-width 0
7
+
8
+ > *
9
+ min-width 300px
@@ -0,0 +1,7 @@
1
+ // This file is automatically generated.
2
+ // Please do not change this file!
3
+ interface CssExports {
4
+ 'root': string;
5
+ }
6
+ export const cssExports: CssExports;
7
+ export default cssExports;
@@ -0,0 +1,38 @@
1
+ import cn from 'classnames';
2
+ import type { CSSProperties, ElementType, ReactNode } from 'react';
3
+
4
+ import S from './GridLayout.styl';
5
+
6
+ export interface GridLayoutProps {
7
+ children: ReactNode;
8
+ colWidth?: number;
9
+ gap?: string;
10
+ className?: string;
11
+ as?: ElementType;
12
+ }
13
+
14
+ export function GridLayout({
15
+ children,
16
+ colWidth = 300,
17
+ gap = 'var(--p-2)',
18
+ className,
19
+ as: asProp,
20
+ }: GridLayoutProps) {
21
+ const As = asProp ?? 'div';
22
+
23
+ return (
24
+ <As
25
+ className={cn(S.root, className)}
26
+ style={
27
+ {
28
+ maxWidth: '100%',
29
+ gap: gap,
30
+ display: 'grid',
31
+ gridTemplateColumns: `repeat(auto-fit, minmax(${colWidth}px, 1fr))`,
32
+ } as CSSProperties
33
+ }
34
+ >
35
+ {children}
36
+ </As>
37
+ );
38
+ }
@@ -23,6 +23,7 @@ function hasTabPanelContent(content: React.ReactNode | undefined): boolean {
23
23
  export function PageTabs({
24
24
  className,
25
25
  contentClassName,
26
+ innerClassName,
26
27
  scrollbarClassName,
27
28
  items,
28
29
  tabsListProps,
@@ -33,7 +34,11 @@ export function PageTabs({
33
34
  fullWidth?: boolean;
34
35
  withPaddings?: boolean;
35
36
  };
36
- } & TabsProps & { contentClassName?: string; scrollbarClassName?: string }) {
37
+ } & TabsProps & {
38
+ contentClassName?: string;
39
+ innerClassName?: string;
40
+ scrollbarClassName?: string;
41
+ }) {
37
42
  return (
38
43
  <Tabs className={cn(S.root, className)} variant="link" {...props}>
39
44
  <TabsList
@@ -43,6 +48,7 @@ export function PageTabs({
43
48
  <PageXScroll
44
49
  size="sm"
45
50
  scrollbarClassName={cn(S.scrollbar, scrollbarClassName)}
51
+ innerClassName={innerClassName}
46
52
  >
47
53
  {items.map(item => (
48
54
  <TabsTrigger value={item.value} key={item.value}>
@@ -0,0 +1,64 @@
1
+ import type { CSSProperties } from 'react';
2
+
3
+ import { GridLayout } from '#uilib/components/ui/GridLayout/GridLayout';
4
+ import { PageContentSection } from '#uilib/components/ui/Page';
5
+
6
+ import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
7
+ import { DocsHeaderActions } from '../docsHeaderActions';
8
+
9
+ const tileStyle: CSSProperties = {
10
+ margin: 0,
11
+ padding: 'var(--p-4)',
12
+ borderRadius: 'var(--p-3)',
13
+ border: '1px solid var(--border)',
14
+ backgroundColor: 'var(--muted)',
15
+ };
16
+
17
+ function Tile({ label }: { label: string }) {
18
+ return <p style={tileStyle}>{label}</p>;
19
+ }
20
+
21
+ export default function GridLayoutPage() {
22
+ return (
23
+ <>
24
+ <AppPageHeader
25
+ breadcrumbs={[{ label: 'GridLayout' }]}
26
+ title="GridLayout"
27
+ subheader="Responsive CSS grid (`repeat(auto-fit, minmax(colWidth, 1fr))`), optional gap, polymorphic root via `as`."
28
+ actions={<DocsHeaderActions />}
29
+ />
30
+ <PageContentSection
31
+ style={{ display: 'flex', flexDirection: 'column', gap: '2rem' }}
32
+ >
33
+ <section>
34
+ <h3 style={{ marginBottom: '0.75rem' }}>Default (colWidth 300)</h3>
35
+ <p
36
+ style={{
37
+ marginBottom: '1rem',
38
+ color: 'var(--muted-foreground)',
39
+ }}
40
+ >
41
+ Tiles wrap to new rows when the viewport is narrow; each cell keeps
42
+ at least 300px min width before wrapping.
43
+ </p>
44
+ <GridLayout>
45
+ <Tile label="Item A" />
46
+ <Tile label="Item B" />
47
+ <Tile label="Item C" />
48
+ <Tile label="Item D" />
49
+ </GridLayout>
50
+ </section>
51
+ <section>
52
+ <h3 style={{ marginBottom: '0.75rem' }}>
53
+ colWidth 180, gap var(--p-4)
54
+ </h3>
55
+ <GridLayout colWidth={180} gap="var(--p-4)">
56
+ <Tile label="Narrow 1" />
57
+ <Tile label="Narrow 2" />
58
+ <Tile label="Narrow 3" />
59
+ </GridLayout>
60
+ </section>
61
+ </PageContentSection>
62
+ </>
63
+ );
64
+ }
@@ -157,6 +157,12 @@ export const DOC_REGISTRY: DocEntry[] = [
157
157
  section: 'Layout',
158
158
  load: () => import('./pages/FoldablePage'),
159
159
  },
160
+ {
161
+ slug: 'grid-layout',
162
+ title: 'GridLayout',
163
+ section: 'Layout',
164
+ load: () => import('./pages/GridLayoutPage'),
165
+ },
160
166
  {
161
167
  slug: 'image',
162
168
  title: 'Image',
package/src/index.ts CHANGED
@@ -25,6 +25,7 @@ export * from './components/ui/DropZone/DropZone';
25
25
  export * from './components/ui/FlickeringGrid';
26
26
  export * from './components/ui/Foldable';
27
27
  export * from './components/ui/Gap/Gap';
28
+ export * from './components/ui/GridLayout/GridLayout';
28
29
  export * from './components/ui/Image';
29
30
  export * from './components/ui/ImageWithFallback';
30
31
  export * from './components/ui/Input';