@stisla/react 3.0.0-beta.8
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/LICENSE +9 -0
- package/README.md +18 -0
- package/dist/button/index.d.ts +12 -0
- package/dist/button/index.js +6 -0
- package/dist/chunk-JC4IGX2C.js +121 -0
- package/dist/chunk-QDDSG4CH.js +47 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +14 -0
- package/dist/sidebar/index.d.ts +93 -0
- package/dist/sidebar/index.js +6 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2019 Muhamad Nauval Azhar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @stisla/react
|
|
2
|
+
|
|
3
|
+
React components for [Stisla](https://github.com/stisla/stisla) — thin wrappers over [Base UI](https://base-ui.com) and the `@stisla/style` composer.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @stisla/react @stisla/css
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
import { Button } from "@stisla/react";
|
|
13
|
+
import "@stisla/css";
|
|
14
|
+
|
|
15
|
+
<Button tone="primary">Hello</Button>;
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Docs and source: https://github.com/stisla/stisla
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ButtonHTMLAttributes, Ref } from 'react';
|
|
3
|
+
import { button } from '@stisla/style';
|
|
4
|
+
|
|
5
|
+
type ButtonComposerProps = NonNullable<Parameters<typeof button>[0]>;
|
|
6
|
+
type ButtonProps = ButtonComposerProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonComposerProps> & {
|
|
7
|
+
ref?: Ref<HTMLButtonElement>;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare function Button({ ref, tone, shape, size, iconOnly, iconRound, block, wrap, loading, tune, className, style, type, ...rest }: ButtonProps): react.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { Button, type ButtonProps };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// src/sidebar/index.tsx
|
|
2
|
+
import {
|
|
3
|
+
composer,
|
|
4
|
+
sidebar,
|
|
5
|
+
sidebarKnobs
|
|
6
|
+
} from "@stisla/style";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function part(base, Tag) {
|
|
9
|
+
const compose = composer({ base, variants: {}, knobPrefix: "sidebar", knobs: sidebarKnobs });
|
|
10
|
+
function Part({ tune, className, style, ...rest }) {
|
|
11
|
+
const c = compose({ tune, className });
|
|
12
|
+
return /* @__PURE__ */ jsx(Tag, { className: c.className, style: { ...c.style, ...style }, ...rest });
|
|
13
|
+
}
|
|
14
|
+
Part.displayName = base;
|
|
15
|
+
return Part;
|
|
16
|
+
}
|
|
17
|
+
function SidebarRoot({
|
|
18
|
+
ref,
|
|
19
|
+
size,
|
|
20
|
+
tune,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
collapsed,
|
|
24
|
+
children,
|
|
25
|
+
...rest
|
|
26
|
+
}) {
|
|
27
|
+
const c = sidebar({ size, tune, className });
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
"aside",
|
|
30
|
+
{
|
|
31
|
+
ref,
|
|
32
|
+
className: c.className,
|
|
33
|
+
style: { ...c.style, ...style },
|
|
34
|
+
"data-collapsed": collapsed ? "" : void 0,
|
|
35
|
+
...rest,
|
|
36
|
+
children
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
SidebarRoot.displayName = "Sidebar";
|
|
41
|
+
var brandCompose = composer({
|
|
42
|
+
base: "sidebar__brand",
|
|
43
|
+
variants: {},
|
|
44
|
+
knobPrefix: "sidebar",
|
|
45
|
+
knobs: sidebarKnobs
|
|
46
|
+
});
|
|
47
|
+
function SidebarBrand({ ref, tune, className, style, ...rest }) {
|
|
48
|
+
const c = brandCompose({ tune, className });
|
|
49
|
+
return /* @__PURE__ */ jsx("a", { ref, className: c.className, style: { ...c.style, ...style }, ...rest });
|
|
50
|
+
}
|
|
51
|
+
SidebarBrand.displayName = "Sidebar.Brand";
|
|
52
|
+
var buttonCompose = composer({
|
|
53
|
+
base: "sidebar__button",
|
|
54
|
+
variants: {},
|
|
55
|
+
knobPrefix: "sidebar",
|
|
56
|
+
knobs: sidebarKnobs
|
|
57
|
+
});
|
|
58
|
+
function SidebarButton({
|
|
59
|
+
ref,
|
|
60
|
+
href,
|
|
61
|
+
tune,
|
|
62
|
+
className,
|
|
63
|
+
style,
|
|
64
|
+
children,
|
|
65
|
+
...rest
|
|
66
|
+
}) {
|
|
67
|
+
const c = buttonCompose({ tune, className });
|
|
68
|
+
const shared = { className: c.className, style: { ...c.style, ...style }, ...rest };
|
|
69
|
+
return href != null ? /* @__PURE__ */ jsx("a", { ref, href, ...shared, children }) : /* @__PURE__ */ jsx("button", { ref, type: "button", ...shared, children });
|
|
70
|
+
}
|
|
71
|
+
SidebarButton.displayName = "Sidebar.Button";
|
|
72
|
+
var itemActionCompose = composer({
|
|
73
|
+
base: "sidebar__item-action",
|
|
74
|
+
variants: {},
|
|
75
|
+
knobPrefix: "sidebar",
|
|
76
|
+
knobs: sidebarKnobs
|
|
77
|
+
});
|
|
78
|
+
function SidebarItemAction({
|
|
79
|
+
as = "span",
|
|
80
|
+
tune,
|
|
81
|
+
className,
|
|
82
|
+
style,
|
|
83
|
+
children,
|
|
84
|
+
...rest
|
|
85
|
+
}) {
|
|
86
|
+
const c = itemActionCompose({ tune, className });
|
|
87
|
+
const shared = { className: c.className, style: { ...c.style, ...style }, ...rest };
|
|
88
|
+
return as === "button" ? /* @__PURE__ */ jsx("button", { type: "button", ...shared, children }) : /* @__PURE__ */ jsx("span", { ...shared, children });
|
|
89
|
+
}
|
|
90
|
+
SidebarItemAction.displayName = "Sidebar.ItemAction";
|
|
91
|
+
var Header = part("sidebar__header", "header");
|
|
92
|
+
var Content = part("sidebar__content", "div");
|
|
93
|
+
var Footer = part("sidebar__footer", "footer");
|
|
94
|
+
var Menu = part("sidebar__menu", "nav");
|
|
95
|
+
var Group = part("sidebar__group", "div");
|
|
96
|
+
var GroupTitle = part("sidebar__group-title", "span");
|
|
97
|
+
var GroupAction = part("sidebar__group-action", "div");
|
|
98
|
+
var List = part("sidebar__list", "ul");
|
|
99
|
+
var Item = part("sidebar__item", "li");
|
|
100
|
+
var Submenu = part("sidebar__submenu", "div");
|
|
101
|
+
var Caret = part("sidebar__caret", "span");
|
|
102
|
+
var Sidebar = Object.assign(SidebarRoot, {
|
|
103
|
+
Header,
|
|
104
|
+
Brand: SidebarBrand,
|
|
105
|
+
Content,
|
|
106
|
+
Footer,
|
|
107
|
+
Menu,
|
|
108
|
+
Group,
|
|
109
|
+
GroupTitle,
|
|
110
|
+
GroupAction,
|
|
111
|
+
List,
|
|
112
|
+
Item,
|
|
113
|
+
Button: SidebarButton,
|
|
114
|
+
ItemAction: SidebarItemAction,
|
|
115
|
+
Submenu,
|
|
116
|
+
Caret
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
Sidebar
|
|
121
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/button/index.tsx
|
|
2
|
+
import { Button as BaseButton } from "@base-ui/react/button";
|
|
3
|
+
import { button } from "@stisla/style";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
function Button({
|
|
6
|
+
ref,
|
|
7
|
+
tone,
|
|
8
|
+
shape,
|
|
9
|
+
size,
|
|
10
|
+
iconOnly,
|
|
11
|
+
iconRound,
|
|
12
|
+
block,
|
|
13
|
+
wrap,
|
|
14
|
+
loading,
|
|
15
|
+
tune,
|
|
16
|
+
className,
|
|
17
|
+
style,
|
|
18
|
+
type,
|
|
19
|
+
...rest
|
|
20
|
+
}) {
|
|
21
|
+
const composed = button({
|
|
22
|
+
tone,
|
|
23
|
+
shape,
|
|
24
|
+
size,
|
|
25
|
+
iconOnly,
|
|
26
|
+
iconRound,
|
|
27
|
+
block,
|
|
28
|
+
wrap,
|
|
29
|
+
tune,
|
|
30
|
+
className
|
|
31
|
+
});
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
BaseButton,
|
|
34
|
+
{
|
|
35
|
+
ref,
|
|
36
|
+
type: type ?? "button",
|
|
37
|
+
className: composed.className,
|
|
38
|
+
style: { ...composed.style, ...style },
|
|
39
|
+
"aria-busy": loading || void 0,
|
|
40
|
+
...rest
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
Button
|
|
47
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Button, ButtonProps } from './button/index.js';
|
|
2
|
+
export { Sidebar, SidebarBrandProps, SidebarButtonProps, SidebarItemActionProps, SidebarProps } from './sidebar/index.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import '@stisla/style';
|
|
5
|
+
|
|
6
|
+
declare const cn: (...parts: Array<string | false | null | undefined>) => string;
|
|
7
|
+
|
|
8
|
+
export { cn };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, Ref, AnchorHTMLAttributes } from 'react';
|
|
3
|
+
import { sidebar, Tune, SidebarKnob } from '@stisla/style';
|
|
4
|
+
|
|
5
|
+
type TuneProp = {
|
|
6
|
+
tune?: Tune<SidebarKnob>;
|
|
7
|
+
};
|
|
8
|
+
type DataAttrs = {
|
|
9
|
+
[key: `data-${string}`]: string | number | boolean | undefined;
|
|
10
|
+
};
|
|
11
|
+
type PartProps = TuneProp & HTMLAttributes<HTMLElement> & DataAttrs;
|
|
12
|
+
type SidebarComposerProps = NonNullable<Parameters<typeof sidebar>[0]>;
|
|
13
|
+
type SidebarProps = SidebarComposerProps & Omit<HTMLAttributes<HTMLElement>, keyof SidebarComposerProps> & DataAttrs & {
|
|
14
|
+
ref?: Ref<HTMLElement>;
|
|
15
|
+
collapsed?: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare function SidebarRoot({ ref, size, tune, className, style, collapsed, children, ...rest }: SidebarProps): react.JSX.Element;
|
|
18
|
+
declare namespace SidebarRoot {
|
|
19
|
+
var displayName: string;
|
|
20
|
+
}
|
|
21
|
+
type SidebarBrandProps = TuneProp & AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
22
|
+
ref?: Ref<HTMLAnchorElement>;
|
|
23
|
+
};
|
|
24
|
+
declare function SidebarBrand({ ref, tune, className, style, ...rest }: SidebarBrandProps): react.JSX.Element;
|
|
25
|
+
declare namespace SidebarBrand {
|
|
26
|
+
var displayName: string;
|
|
27
|
+
}
|
|
28
|
+
type SidebarButtonProps = TuneProp & HTMLAttributes<HTMLElement> & DataAttrs & {
|
|
29
|
+
ref?: Ref<HTMLElement>;
|
|
30
|
+
href?: string;
|
|
31
|
+
};
|
|
32
|
+
declare function SidebarButton({ ref, href, tune, className, style, children, ...rest }: SidebarButtonProps): react.JSX.Element;
|
|
33
|
+
declare namespace SidebarButton {
|
|
34
|
+
var displayName: string;
|
|
35
|
+
}
|
|
36
|
+
type SidebarItemActionProps = PartProps & {
|
|
37
|
+
as?: "span" | "button";
|
|
38
|
+
};
|
|
39
|
+
declare function SidebarItemAction({ as, tune, className, style, children, ...rest }: SidebarItemActionProps): react.JSX.Element;
|
|
40
|
+
declare namespace SidebarItemAction {
|
|
41
|
+
var displayName: string;
|
|
42
|
+
}
|
|
43
|
+
declare const Sidebar: typeof SidebarRoot & {
|
|
44
|
+
Header: {
|
|
45
|
+
({ tune, className, style, ...rest }: PartProps): react.JSX.Element;
|
|
46
|
+
displayName: string;
|
|
47
|
+
};
|
|
48
|
+
Brand: typeof SidebarBrand;
|
|
49
|
+
Content: {
|
|
50
|
+
({ tune, className, style, ...rest }: PartProps): react.JSX.Element;
|
|
51
|
+
displayName: string;
|
|
52
|
+
};
|
|
53
|
+
Footer: {
|
|
54
|
+
({ tune, className, style, ...rest }: PartProps): react.JSX.Element;
|
|
55
|
+
displayName: string;
|
|
56
|
+
};
|
|
57
|
+
Menu: {
|
|
58
|
+
({ tune, className, style, ...rest }: PartProps): react.JSX.Element;
|
|
59
|
+
displayName: string;
|
|
60
|
+
};
|
|
61
|
+
Group: {
|
|
62
|
+
({ tune, className, style, ...rest }: PartProps): react.JSX.Element;
|
|
63
|
+
displayName: string;
|
|
64
|
+
};
|
|
65
|
+
GroupTitle: {
|
|
66
|
+
({ tune, className, style, ...rest }: PartProps): react.JSX.Element;
|
|
67
|
+
displayName: string;
|
|
68
|
+
};
|
|
69
|
+
GroupAction: {
|
|
70
|
+
({ tune, className, style, ...rest }: PartProps): react.JSX.Element;
|
|
71
|
+
displayName: string;
|
|
72
|
+
};
|
|
73
|
+
List: {
|
|
74
|
+
({ tune, className, style, ...rest }: PartProps): react.JSX.Element;
|
|
75
|
+
displayName: string;
|
|
76
|
+
};
|
|
77
|
+
Item: {
|
|
78
|
+
({ tune, className, style, ...rest }: PartProps): react.JSX.Element;
|
|
79
|
+
displayName: string;
|
|
80
|
+
};
|
|
81
|
+
Button: typeof SidebarButton;
|
|
82
|
+
ItemAction: typeof SidebarItemAction;
|
|
83
|
+
Submenu: {
|
|
84
|
+
({ tune, className, style, ...rest }: PartProps): react.JSX.Element;
|
|
85
|
+
displayName: string;
|
|
86
|
+
};
|
|
87
|
+
Caret: {
|
|
88
|
+
({ tune, className, style, ...rest }: PartProps): react.JSX.Element;
|
|
89
|
+
displayName: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export { Sidebar, type SidebarBrandProps, type SidebarButtonProps, type SidebarItemActionProps, type SidebarProps };
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stisla/react",
|
|
3
|
+
"version": "3.0.0-beta.8",
|
|
4
|
+
"description": "Stisla React components — thin Base UI wrappers over the @stisla/style composer.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./button": {
|
|
13
|
+
"types": "./dist/button/index.d.ts",
|
|
14
|
+
"import": "./dist/button/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./sidebar": {
|
|
17
|
+
"types": "./dist/sidebar/index.d.ts",
|
|
18
|
+
"import": "./dist/sidebar/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": [
|
|
28
|
+
"**/*.css"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@base-ui/react": "^1.6.0",
|
|
32
|
+
"clsx": "^2.1.0",
|
|
33
|
+
"@stisla/style": "3.0.0-beta.8"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react": ">=18",
|
|
37
|
+
"react-dom": ">=18"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/react": "^19.0.0",
|
|
41
|
+
"tsup": "^8.0.0",
|
|
42
|
+
"typescript": "^5.4.0"
|
|
43
|
+
},
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/stisla/stisla.git",
|
|
47
|
+
"directory": "next/packages/react"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/stisla/stisla#readme",
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsup"
|
|
55
|
+
}
|
|
56
|
+
}
|