瀏覽代碼

Update components

Expose classname for extending components.
master
TheoryOfNekomata 1 年之前
父節點
當前提交
e4a544fd0f
共有 12 個檔案被更改,包括 106 行新增22 行删除
  1. +1
    -1
      packages/base/package.json
  2. +3
    -1
      packages/base/src/common.ts
  3. +1
    -1
      packages/base/src/plugin-tailwind.ts
  4. +1
    -1
      packages/react/package.json
  5. +9
    -1
      packages/react/src/layouts/Basic/index.tsx
  6. +18
    -3
      packages/react/src/layouts/LeftSidebar/index.tsx
  7. +38
    -7
      packages/react/src/layouts/LeftSidebarWithMenu/index.tsx
  8. +18
    -3
      packages/react/src/layouts/RightSidebarStatic/index.tsx
  9. +2
    -0
      packages/react/src/widgets/LeftSidebarBase/index.tsx
  10. +6
    -2
      packages/react/src/widgets/LeftSidebarWithMenuBase/index.tsx
  11. +7
    -2
      packages/react/src/widgets/RightSidebarBase/index.tsx
  12. +2
    -0
      packages/react/src/widgets/TopBar/index.tsx

+ 1
- 1
packages/base/package.json 查看文件

@@ -1,6 +1,6 @@
{
"name": "@tesseract-design/viewfinder-base",
"version": "0.0.0",
"version": "0.0.1",
"files": [
"dist",
"src"


+ 3
- 1
packages/base/src/common.ts 查看文件

@@ -1 +1,3 @@
export type Span = 'narrow' | 'normal' | 'wide';
export const AVAILABLE_SPANS = ['narrow', 'normal', 'wide'] as const;

export type Span = typeof AVAILABLE_SPANS[number];

+ 1
- 1
packages/base/src/plugin-tailwind.ts 查看文件

@@ -9,7 +9,7 @@ export interface ViewfinderPluginOptions {
colorSidebarMenu?: string;
}

export const plugin = tailwindPlugin.withOptions<ViewfinderPluginOptions>(
export const plugin = tailwindPlugin.withOptions<ViewfinderPluginOptions | undefined>(
({
baseWidth = 360 as const,
topbarHeight = '4rem' as const,


+ 1
- 1
packages/react/package.json 查看文件

@@ -1,6 +1,6 @@
{
"name": "@tesseract-design/viewfinder-react",
"version": "0.0.0",
"version": "0.0.1",
"files": [
"dist",
"src"


+ 9
- 1
packages/react/src/layouts/Basic/index.tsx 查看文件

@@ -9,6 +9,7 @@ export interface RootProps extends React.HTMLProps<HTMLDivElement> {
export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
children,
topBarWidget,
className,
...etcProps
}, ref) => (
<>
@@ -16,7 +17,10 @@ export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
<div
{...etcProps}
data-viewfinder="main"
className="box-border"
className={clsx(
'box-border',
className,
)}
ref={ref}
>
{children}
@@ -33,14 +37,18 @@ export type ContentContainerProps = Omit<React.HTMLProps<HTMLDivElement>, 'span'
export const ContentContainer = React.forwardRef<HTMLDivElement, ContentContainerProps>(({
children,
span = 'normal',
className,
...etcProps
}, ref) => {
return (
<div
{...etcProps}
className={clsx(
'px-8 box-border mx-auto w-full',
span === 'narrow' && 'max-w-screen-2xs',
span === 'normal' && 'max-w-screen-xs',
span === 'wide' && 'max-w-screen-sm',
className,
)}
ref={ref}
>


+ 18
- 3
packages/react/src/layouts/LeftSidebar/index.tsx 查看文件

@@ -1,4 +1,5 @@
import * as React from 'react';
import clsx from 'clsx';

export interface RootProps extends React.HTMLProps<HTMLDivElement> {
sidebarBaseWidget?: React.ReactNode;
@@ -9,6 +10,7 @@ export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
children,
topBarWidget,
sidebarBaseWidget,
className,
...etcProps
}, ref) => (
<>
@@ -18,7 +20,10 @@ export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
{...etcProps}
ref={ref}
data-viewfinder="main"
className="box-border md:pl-[calc(50%-(var(--base-width)*0.5))]"
className={clsx(
'box-border md:pl-[calc(50%-(var(--base-width)*0.5))]',
className,
)}
>
{children}
</div>
@@ -29,9 +34,15 @@ export interface ContentContainerProps extends React.HTMLProps<HTMLDivElement> {

export const MainContentContainer = React.forwardRef<HTMLDivElement, ContentContainerProps>(({
children,
className,
...etcProps
}, ref) => (
<div
className="px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:ml-0"
{...etcProps}
className={clsx(
'px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:ml-0',
className,
)}
ref={ref}
>
{children}
@@ -44,11 +55,15 @@ export interface SidebarMainContainerProps extends React.HTMLProps<HTMLDivElemen

export const SidebarContentContainer = React.forwardRef<HTMLDivElement, SidebarMainContainerProps>(({
children,
className,
...etcProps
}, ref) => (
<div
{...etcProps}
className="w-full mx-auto px-8 box-border max-w-[calc(var(--base-width)*2)] md:w-[var(--base-width)] md:mr-0"
className={clsx(
'w-full mx-auto px-8 box-border max-w-[calc(var(--base-width)*2)] md:w-[var(--base-width)] md:mr-0',
className,
)}
ref={ref}
>
{children}


+ 38
- 7
packages/react/src/layouts/LeftSidebarWithMenu/index.tsx 查看文件

@@ -1,4 +1,5 @@
import * as React from 'react';
import clsx from 'clsx';

export interface RootProps extends React.HTMLProps<HTMLDivElement> {
sidebarBaseWidget?: React.ReactNode;
@@ -9,6 +10,7 @@ export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
children,
topBarWidget,
sidebarBaseWidget,
className,
...etcProps
}, ref) => (
<>
@@ -18,7 +20,10 @@ export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
{...etcProps}
ref={ref}
data-viewfinder="main"
className="box-border pb-menu md:pb-0 md:pl-[calc(50%-(var(--base-width)*0.5))]"
className={clsx(
'box-border pb-menu md:pb-0 md:pl-[calc(50%-(var(--base-width)*0.5))]',
className,
)}
>
{children}
</div>
@@ -29,9 +34,15 @@ export interface ContentContainerProps extends React.HTMLProps<HTMLDivElement> {

export const MainContentContainer = React.forwardRef<HTMLDivElement, ContentContainerProps>(({
children,
className,
...etcProps
}, ref) => (
<div
className="px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:ml-0"
{...etcProps}
className={clsx(
'px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:ml-0',
className,
)}
ref={ref}
>
{children}
@@ -44,11 +55,15 @@ export interface SidebarMainContainerProps extends React.HTMLProps<HTMLDivElemen

export const SidebarContentContainer = React.forwardRef<HTMLDivElement, SidebarMainContainerProps>(({
children,
className,
...etcProps
}, ref) => (
<div
{...etcProps}
className="px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:max-w-none"
className={clsx(
'px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:max-w-none',
className,
)}
ref={ref}
>
{children}
@@ -61,11 +76,15 @@ export interface SidebarMenuItemIconProps extends React.HTMLProps<HTMLSpanElemen

export const SidebarMenuItemIcon = React.forwardRef<HTMLSpanElement, SidebarMenuItemIconProps>(({
children,
className,
...etcProps
}, ref) => (
<span
{...etcProps}
className="block md:w-menu md:h-menu md:flex md:justify-center md:items-center"
className={clsx(
'block md:w-menu md:h-menu md:flex md:justify-center md:items-center',
className,
)}
ref={ref}
>
{children}
@@ -76,11 +95,15 @@ SidebarMenuItemIcon.displayName = 'SidebarMenuItemIcon';

export const SidebarMenuContainer = React.forwardRef<HTMLSpanElement, SidebarMainContainerProps>(({
children,
className,
...etcProps
}, ref) => (
<span
{...etcProps}
className="box-border flex flex-col justify-center items-center w-full text-center md:justify-start md:ml-auto md:text-left md:w-[var(--base-width)] md:flex-row"
className={clsx(
'box-border flex flex-col justify-center items-center w-full text-center md:justify-start md:ml-auto md:text-left md:w-[var(--base-width)] md:flex-row',
className,
)}
ref={ref}
>
{children}
@@ -92,11 +115,15 @@ SidebarMenuContainer.displayName = 'SidebarMenuContainer';

export const MoreSidebarMenuItemIcon = React.forwardRef<HTMLSpanElement, SidebarMenuItemIconProps>(({
children,
className,
...etcProps
}, ref) => (
<span
{...etcProps}
className="block mr-4 md:w-menu md:h-menu md:flex md:justify-center md:items-center md:mr-0"
className={clsx(
'block mr-4 md:w-menu md:h-menu md:flex md:justify-center md:items-center md:mr-0',
className,
)}
ref={ref}
>
{children}
@@ -107,11 +134,15 @@ MoreSidebarMenuItemIcon.displayName = 'MoreSidebarMenuItemIcon';

export const MoreSidebarMenuContainer = React.forwardRef<HTMLSpanElement, SidebarMainContainerProps>(({
children,
className,
...etcProps
}, ref) => (
<span
{...etcProps}
className="flex justify-start items-center w-[calc(var(--base-width)*2)] mx-auto px-8 text-left box-border md:mr-0 md:w-[var(--base-width)] md:pl-0"
className={clsx(
'flex justify-start items-center w-[calc(var(--base-width)*2)] mx-auto px-8 text-left box-border md:mr-0 md:w-[var(--base-width)] md:pl-0',
className,
)}
ref={ref}
>
{children}


+ 18
- 3
packages/react/src/layouts/RightSidebarStatic/index.tsx 查看文件

@@ -1,4 +1,5 @@
import * as React from 'react';
import clsx from 'clsx';

export interface RootProps extends React.HTMLProps<HTMLDivElement> {
sidebarBaseWidget?: React.ReactNode;
@@ -9,6 +10,7 @@ export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
children,
topBarWidget,
sidebarBaseWidget,
className,
...etcProps
}, ref) => (
<>
@@ -17,7 +19,10 @@ export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
{...etcProps}
ref={ref}
data-viewfinder="main"
className="box-border md:pr-[calc(50%-(var(--base-width)*0.5))]"
className={clsx(
'box-border md:pr-[calc(50%-(var(--base-width)*0.5))]',
className,
)}
>
{children}
</div>
@@ -32,9 +37,15 @@ export interface ContentContainerProps extends React.HTMLProps<HTMLDivElement> {

export const MainContentContainer = React.forwardRef<HTMLDivElement, ContentContainerProps>(({
children,
className,
...etcProps
}, ref) => (
<div
className="px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:mr-0"
{...etcProps}
className={clsx(
'px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:mr-0',
className,
)}
ref={ref}
>
{children}
@@ -47,11 +58,15 @@ export interface SidebarMainContainerProps extends React.HTMLProps<HTMLDivElemen

export const SidebarContentContainer = React.forwardRef<HTMLDivElement, SidebarMainContainerProps>(({
children,
className,
...etcProps
}, ref) => (
<div
{...etcProps}
className="px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:ml-0 md:w-[var(--base-width)]"
className={clsx(
'px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:ml-0 md:w-[var(--base-width)]',
className,
)}
ref={ref}
>
{children}


+ 2
- 0
packages/react/src/widgets/LeftSidebarBase/index.tsx 查看文件

@@ -6,6 +6,7 @@ export interface LeftSidebarBaseProps extends React.HTMLProps<HTMLDivElement> {}
export const LeftSidebarBase = React.forwardRef<HTMLDivElement, LeftSidebarBaseProps>(({
children,
open = false,
className,
...etcProps
}, ref) => {
return (
@@ -13,6 +14,7 @@ export const LeftSidebarBase = React.forwardRef<HTMLDivElement, LeftSidebarBaseP
className={clsx(
'box-border fixed top-0 -left-full w-full h-full bg-sidebar md:left-0 md:w-[calc(50%-(var(--base-width)*0.5))] scrollbar-hidden',
open && 'left-0',
className,
)}
{...etcProps}
ref={ref}


+ 6
- 2
packages/react/src/widgets/LeftSidebarWithMenuBase/index.tsx 查看文件

@@ -34,6 +34,7 @@ export const LeftSidebarWithMenuBase = React.forwardRef<HTMLDivElement, LeftSide
moreLinkComponent: MoreLinkComponent = LinkComponent,
moreLinkItem,
moreItemsOpen = false,
className,
...etcProps
}, ref) => {
const primarySidebarMenuItems = sidebarMenuItems.filter(s => !s.secondary)
@@ -58,8 +59,11 @@ export const LeftSidebarWithMenuBase = React.forwardRef<HTMLDivElement, LeftSide

return (
<div
className="left-sidebar-with-menu-base box-border overflow-hidden contents left-[calc(var(--base-width)*-1)] md:fixed md:top-0 md:left-0 md:w-[calc(50%-var(--base-width)*0.5)] md:h-full md:block"
{...etcProps}
{...etcProps}
className={clsx(
'left-sidebar-with-menu-base box-border overflow-hidden contents left-[calc(var(--base-width)*-1)] md:fixed md:top-0 md:left-0 md:w-[calc(50%-var(--base-width)*0.5)] md:h-full md:block',
className,
)}
ref={ref}
>
<div


+ 7
- 2
packages/react/src/widgets/RightSidebarBase/index.tsx 查看文件

@@ -1,14 +1,19 @@
import * as React from 'react';
import clsx from 'clsx';

export interface RightSidebarStaticBaseProps extends React.HTMLProps<HTMLDivElement> {}

export const RightSidebarStaticBase = React.forwardRef<HTMLDivElement, RightSidebarStaticBaseProps>(({
children,
className,
...etcProps
}, ref) => (
<div
className="box-border after:pb-[1px] after:-mt-[1px] after:box-border md:pr-[calc(50%-(var(--base-width)*0.5)] md:absolute md:top-0 md:right-0 md:h-full md:w-[calc(50%-(var(--base-width)*0.5))]"
{...etcProps}
{...etcProps}
className={clsx(
'box-border after:pb-[1px] after:-mt-[1px] after:box-border md:pr-[calc(50%-(var(--base-width)*0.5)] md:absolute md:top-0 md:right-0 md:h-full md:w-[calc(50%-(var(--base-width)*0.5))]',
className,
)}
ref={ref}
>
<div


+ 2
- 0
packages/react/src/widgets/TopBar/index.tsx 查看文件

@@ -15,11 +15,13 @@ export const TopBar = React.forwardRef<HTMLDivElement, TopBarProps>(({
menuLink,
userLink,
children,
className,
...etcProps
}, ref) => {
return (
<div className={clsx(
'fixed top-0 left-0 w-full z-[3] topbar',
className,
)}>
<div
{...etcProps}


Loading…
取消
儲存