@sakura-ui/sakura-ui 0.5.1 → 0.5.2
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/package.json +2 -2
- package/packages/core/package.json +1 -1
- package/packages/core/src/components/Card.tsx +52 -56
- package/packages/core/src/components/Code.tsx +6 -6
- package/packages/core/src/components/Faq.tsx +30 -26
- package/packages/core/src/components/Heading.tsx +50 -48
- package/packages/core/src/components/Icon.tsx +34 -34
- package/packages/core/src/components/Link.tsx +13 -12
- package/packages/core/src/components/LinkCard.tsx +87 -76
- package/packages/core/src/components/List.tsx +20 -13
- package/packages/core/src/components/OverflowContainer.tsx +9 -9
- package/packages/core/src/components/Pre.tsx +9 -9
- package/packages/core/src/components/Table.tsx +29 -24
- package/packages/core/src/components/index.ts +1 -0
- package/packages/core/src/components/styles.ts +42 -0
- package/packages/core/src/index.ts +2 -0
- package/packages/forms/.turbo/turbo-build.log +2 -2
- package/packages/helper/.turbo/turbo-build.log +1 -1
- package/packages/helper/node_modules/.bin/vitest +2 -2
- package/packages/markdown/.turbo/turbo-build.log +4 -4
- package/packages/markdown/README.md +240 -4
- package/packages/markdown/dist/index.cjs.js +71 -137
- package/packages/markdown/dist/index.es.js +2624 -16739
- package/packages/markdown/dist/types/components/Markdown.d.ts +15 -10
- package/packages/markdown/dist/types/components/Markdown.d.ts.map +1 -1
- package/packages/markdown/dist/types/components/index.d.ts +1 -1
- package/packages/markdown/dist/types/components/index.d.ts.map +1 -1
- package/packages/markdown/dist/types/decorate.d.ts +24 -0
- package/packages/markdown/dist/types/decorate.d.ts.map +1 -0
- package/packages/markdown/dist/types/index.d.ts +3 -1
- package/packages/markdown/dist/types/index.d.ts.map +1 -1
- package/packages/markdown/dist/types/marked/attributes.d.ts +31 -0
- package/packages/markdown/dist/types/marked/attributes.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/directives/card.d.ts +3 -0
- package/packages/markdown/dist/types/marked/directives/card.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/directives/context.d.ts +36 -0
- package/packages/markdown/dist/types/marked/directives/context.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/directives/faq.d.ts +11 -0
- package/packages/markdown/dist/types/marked/directives/faq.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/directives/grid.d.ts +9 -0
- package/packages/markdown/dist/types/marked/directives/grid.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/directives/index.d.ts +8 -0
- package/packages/markdown/dist/types/marked/directives/index.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/directives/linkButton.d.ts +6 -0
- package/packages/markdown/dist/types/marked/directives/linkButton.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/directives/youtube.d.ts +3 -0
- package/packages/markdown/dist/types/marked/directives/youtube.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/html.d.ts +15 -0
- package/packages/markdown/dist/types/marked/html.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/index.d.ts +13 -0
- package/packages/markdown/dist/types/marked/index.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/registry.d.ts +8 -0
- package/packages/markdown/dist/types/marked/registry.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/renderer.d.ts +16 -0
- package/packages/markdown/dist/types/marked/renderer.d.ts.map +1 -0
- package/packages/markdown/dist/types/marked/tokenizer.d.ts +40 -0
- package/packages/markdown/dist/types/marked/tokenizer.d.ts.map +1 -0
- package/packages/markdown/dist/types/render.d.ts +22 -0
- package/packages/markdown/dist/types/render.d.ts.map +1 -0
- package/packages/markdown/dist/types/sanitize.d.ts +11 -0
- package/packages/markdown/dist/types/sanitize.d.ts.map +1 -0
- package/packages/markdown/node_modules/.bin/marked +55 -0
- package/packages/markdown/package.json +6 -19
- package/packages/markdown/src/components/Markdown.tsx +44 -346
- package/packages/markdown/src/components/index.ts +1 -1
- package/packages/markdown/src/decorate.ts +164 -0
- package/packages/markdown/src/index.ts +3 -1
- package/packages/markdown/src/marked/attributes.ts +88 -0
- package/packages/markdown/src/marked/directives/card.ts +77 -0
- package/packages/markdown/src/marked/directives/context.ts +39 -0
- package/packages/markdown/src/marked/directives/faq.ts +29 -0
- package/packages/markdown/src/marked/directives/grid.ts +50 -0
- package/packages/markdown/src/marked/directives/index.ts +29 -0
- package/packages/markdown/src/marked/directives/linkButton.ts +20 -0
- package/packages/markdown/src/marked/directives/youtube.ts +46 -0
- package/packages/markdown/src/marked/html.ts +55 -0
- package/packages/markdown/src/marked/index.ts +45 -0
- package/packages/markdown/src/marked/registry.ts +34 -0
- package/packages/markdown/src/marked/renderer.ts +52 -0
- package/packages/markdown/src/marked/tokenizer.ts +175 -0
- package/packages/markdown/src/render.ts +55 -0
- package/packages/markdown/src/sanitize.ts +194 -0
- package/packages/markdown/tests/Markdown.test.tsx +122 -0
- package/packages/markdown/tests/__snapshots__/Markdown.test.tsx.snap +451 -0
- package/packages/markdown/tests/anchors.test.ts +108 -0
- package/packages/markdown/tests/fixtures.ts +100 -0
- package/packages/markdown/tests/sanitize.test.ts +168 -0
- package/packages/markdown/tests/server.test.tsx +51 -0
- package/packages/markdown/tests/vitest.setup.ts +4 -0
- package/packages/markdown/tsconfig.test.json +11 -0
- package/packages/markdown/vite.config.ts +5 -1
- package/packages/tailwind-theme-plugin/.turbo/turbo-build.log +2 -2
- package/packages/markdown/dist/types/plugins/attr.d.ts +0 -3
- package/packages/markdown/dist/types/plugins/attr.d.ts.map +0 -1
- package/packages/markdown/dist/types/plugins/card.d.ts +0 -3
- package/packages/markdown/dist/types/plugins/card.d.ts.map +0 -1
- package/packages/markdown/dist/types/plugins/cell.d.ts +0 -3
- package/packages/markdown/dist/types/plugins/cell.d.ts.map +0 -1
- package/packages/markdown/dist/types/plugins/faq.d.ts +0 -3
- package/packages/markdown/dist/types/plugins/faq.d.ts.map +0 -1
- package/packages/markdown/dist/types/plugins/grid.d.ts +0 -3
- package/packages/markdown/dist/types/plugins/grid.d.ts.map +0 -1
- package/packages/markdown/dist/types/plugins/headings.d.ts +0 -11
- package/packages/markdown/dist/types/plugins/headings.d.ts.map +0 -1
- package/packages/markdown/dist/types/plugins/helper.d.ts +0 -9
- package/packages/markdown/dist/types/plugins/helper.d.ts.map +0 -1
- package/packages/markdown/dist/types/plugins/index.d.ts +0 -9
- package/packages/markdown/dist/types/plugins/index.d.ts.map +0 -1
- package/packages/markdown/dist/types/plugins/linkButton.d.ts +0 -3
- package/packages/markdown/dist/types/plugins/linkButton.d.ts.map +0 -1
- package/packages/markdown/dist/types/plugins/youtube.d.ts +0 -3
- package/packages/markdown/dist/types/plugins/youtube.d.ts.map +0 -1
- package/packages/markdown/src/plugins/attr.ts +0 -19
- package/packages/markdown/src/plugins/card.ts +0 -71
- package/packages/markdown/src/plugins/cell.ts +0 -47
- package/packages/markdown/src/plugins/faq.ts +0 -40
- package/packages/markdown/src/plugins/grid.ts +0 -54
- package/packages/markdown/src/plugins/headings.ts +0 -38
- package/packages/markdown/src/plugins/helper.ts +0 -27
- package/packages/markdown/src/plugins/index.ts +0 -8
- package/packages/markdown/src/plugins/linkButton.ts +0 -26
- package/packages/markdown/src/plugins/youtube.ts +0 -49
|
@@ -12,41 +12,45 @@ export namespace LinkCard {
|
|
|
12
12
|
* through a ::after overlay, so the card cannot contain another link, a button
|
|
13
13
|
* or a form control.
|
|
14
14
|
*/
|
|
15
|
+
/**
|
|
16
|
+
* z-0 establishes a stacking context so that the overlay of the title can be
|
|
17
|
+
* raised above the rest of the card. CardFooter is sticky, which makes it a
|
|
18
|
+
* positioned element that would otherwise paint over the overlay and swallow
|
|
19
|
+
* the clicks aimed at the bottom of the card.
|
|
20
|
+
*/
|
|
21
|
+
export const linkCardPositionStyle = `
|
|
22
|
+
relative
|
|
23
|
+
z-0
|
|
24
|
+
group
|
|
25
|
+
`
|
|
26
|
+
|
|
27
|
+
export const linkCardHoverStyle = `
|
|
28
|
+
hover:outline
|
|
29
|
+
hover:outline-2
|
|
30
|
+
hover:outline-black
|
|
31
|
+
hover:bg-solid-gray-50
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The focus ring goes on the card itself, not on the <a>, so that it surrounds
|
|
36
|
+
* the whole card. The card sets overflow-hidden, which would cut off a ring
|
|
37
|
+
* drawn on the ::after overlay inside it. An element never clips its own
|
|
38
|
+
* outline, so the ring survives here.
|
|
39
|
+
*/
|
|
40
|
+
export const linkCardFocusStyle = `
|
|
41
|
+
has-[a:focus-visible]:outline
|
|
42
|
+
has-[a:focus-visible]:outline-4
|
|
43
|
+
has-[a:focus-visible]:outline-black
|
|
44
|
+
has-[a:focus-visible]:outline-offset-[calc(2/16*1rem)]
|
|
45
|
+
has-[a:focus-visible]:ring-[calc(2/16*1rem)]
|
|
46
|
+
has-[a:focus-visible]:ring-yellow-300
|
|
47
|
+
`
|
|
48
|
+
|
|
15
49
|
export const LinkCard = <T extends React.ElementType = 'div'>(
|
|
16
50
|
props: LinkCard.Props<T> & Omit<React.ComponentProps<T>, keyof LinkCard.Props<T>>
|
|
17
51
|
) => {
|
|
18
52
|
const { className, children, ...restProps } = props
|
|
19
53
|
|
|
20
|
-
// z-0 establishes a stacking context so that the overlay of the title can be
|
|
21
|
-
// raised above the rest of the card. CardFooter is sticky, which makes it a
|
|
22
|
-
// positioned element that would otherwise paint over the overlay and swallow
|
|
23
|
-
// the clicks aimed at the bottom of the card.
|
|
24
|
-
const stylePosition = `
|
|
25
|
-
relative
|
|
26
|
-
z-0
|
|
27
|
-
group
|
|
28
|
-
`
|
|
29
|
-
|
|
30
|
-
const styleHover = `
|
|
31
|
-
hover:outline
|
|
32
|
-
hover:outline-2
|
|
33
|
-
hover:outline-black
|
|
34
|
-
hover:bg-solid-gray-50
|
|
35
|
-
`
|
|
36
|
-
|
|
37
|
-
// The focus ring goes on the card itself, not on the <a>, so that it surrounds
|
|
38
|
-
// the whole card. The card sets overflow-hidden, which would cut off a ring
|
|
39
|
-
// drawn on the ::after overlay inside it. An element never clips its own
|
|
40
|
-
// outline, so the ring survives here.
|
|
41
|
-
const styleFocus = `
|
|
42
|
-
has-[a:focus-visible]:outline
|
|
43
|
-
has-[a:focus-visible]:outline-4
|
|
44
|
-
has-[a:focus-visible]:outline-black
|
|
45
|
-
has-[a:focus-visible]:outline-offset-[calc(2/16*1rem)]
|
|
46
|
-
has-[a:focus-visible]:ring-[calc(2/16*1rem)]
|
|
47
|
-
has-[a:focus-visible]:ring-yellow-300
|
|
48
|
-
`
|
|
49
|
-
|
|
50
54
|
// TypeScript cannot carry the generic through to Card, which is polymorphic in
|
|
51
55
|
// the same way. The public signature above stays exact; only this hand-off is
|
|
52
56
|
// widened.
|
|
@@ -54,7 +58,12 @@ export const LinkCard = <T extends React.ElementType = 'div'>(
|
|
|
54
58
|
|
|
55
59
|
return (
|
|
56
60
|
<Root
|
|
57
|
-
className={cx(
|
|
61
|
+
className={cx(
|
|
62
|
+
linkCardPositionStyle,
|
|
63
|
+
linkCardHoverStyle,
|
|
64
|
+
linkCardFocusStyle,
|
|
65
|
+
className
|
|
66
|
+
)}
|
|
58
67
|
{...restProps}
|
|
59
68
|
>
|
|
60
69
|
{children}
|
|
@@ -64,6 +73,49 @@ export const LinkCard = <T extends React.ElementType = 'div'>(
|
|
|
64
73
|
|
|
65
74
|
LinkCard.displayName = 'LinkCard'
|
|
66
75
|
|
|
76
|
+
export const linkCardHeadingStyle = `
|
|
77
|
+
decoration-blue-900
|
|
78
|
+
underline
|
|
79
|
+
underline-offset-[calc(3/16*1rem)]
|
|
80
|
+
|
|
81
|
+
group-hover:text-blue-900
|
|
82
|
+
group-hover:decoration-[calc(3/16*1rem)]
|
|
83
|
+
`
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The ::after overlay makes the whole card clickable. It carries no visual of
|
|
87
|
+
* its own; the focus ring lives on the LinkCard element.
|
|
88
|
+
*/
|
|
89
|
+
export const linkCardOverlayStyle = `
|
|
90
|
+
after:content-['']
|
|
91
|
+
after:absolute
|
|
92
|
+
after:inset-0
|
|
93
|
+
after:z-10
|
|
94
|
+
focus-visible:outline-none
|
|
95
|
+
`
|
|
96
|
+
|
|
97
|
+
export const linkCardFooterStyle = `
|
|
98
|
+
flex
|
|
99
|
+
justify-between
|
|
100
|
+
items-center
|
|
101
|
+
`
|
|
102
|
+
|
|
103
|
+
export const linkCardArrowStyle = `
|
|
104
|
+
inline-flex
|
|
105
|
+
items-center
|
|
106
|
+
justify-center
|
|
107
|
+
w-6 h-6
|
|
108
|
+
text-blue-1000
|
|
109
|
+
border
|
|
110
|
+
border-blue-1000
|
|
111
|
+
rounded-full
|
|
112
|
+
`
|
|
113
|
+
|
|
114
|
+
export const linkCardArrowHoverStyle = `
|
|
115
|
+
group-hover:bg-blue-1000
|
|
116
|
+
group-hover:text-white
|
|
117
|
+
`
|
|
118
|
+
|
|
67
119
|
export namespace LinkCardHeader {
|
|
68
120
|
export interface Props<T extends React.ElementType> {
|
|
69
121
|
/** The element to render the title as. See CardHeader. */
|
|
@@ -98,28 +150,9 @@ export const LinkCardHeader = <T extends React.ElementType = 'a'>(
|
|
|
98
150
|
)
|
|
99
151
|
}
|
|
100
152
|
|
|
101
|
-
const styleHeading = `
|
|
102
|
-
decoration-blue-900
|
|
103
|
-
underline
|
|
104
|
-
underline-offset-[calc(3/16*1rem)]
|
|
105
|
-
|
|
106
|
-
group-hover:text-blue-900
|
|
107
|
-
group-hover:decoration-[calc(3/16*1rem)]
|
|
108
|
-
`
|
|
109
|
-
|
|
110
|
-
// The ::after overlay makes the whole card clickable. It carries no visual of
|
|
111
|
-
// its own; the focus ring lives on the LinkCard element.
|
|
112
|
-
const styleOverlay = `
|
|
113
|
-
after:content-['']
|
|
114
|
-
after:absolute
|
|
115
|
-
after:inset-0
|
|
116
|
-
after:z-10
|
|
117
|
-
focus-visible:outline-none
|
|
118
|
-
`
|
|
119
|
-
|
|
120
153
|
return (
|
|
121
|
-
<CardHeader as={as} className={cx(className,
|
|
122
|
-
<Component className={
|
|
154
|
+
<CardHeader as={as} className={cx(className, linkCardHeadingStyle)}>
|
|
155
|
+
<Component className={linkCardOverlayStyle} {...restProps}>
|
|
123
156
|
{children}
|
|
124
157
|
{restProps.target === '_blank' && (
|
|
125
158
|
<Icon opticalSize={16} className="ml-1" altText="新しいタブで開きます">
|
|
@@ -140,32 +173,10 @@ export namespace LinkCardFooter {
|
|
|
140
173
|
export const LinkCardFooter = (props: LinkCardFooter.Props) => {
|
|
141
174
|
const { className, children, ...restProps } = props
|
|
142
175
|
|
|
143
|
-
const style = `
|
|
144
|
-
flex
|
|
145
|
-
justify-between
|
|
146
|
-
items-center
|
|
147
|
-
`
|
|
148
|
-
|
|
149
|
-
const styleIcon = `
|
|
150
|
-
inline-flex
|
|
151
|
-
items-center
|
|
152
|
-
justify-center
|
|
153
|
-
w-6 h-6
|
|
154
|
-
text-blue-1000
|
|
155
|
-
border
|
|
156
|
-
border-blue-1000
|
|
157
|
-
rounded-full
|
|
158
|
-
`
|
|
159
|
-
|
|
160
|
-
const styleIconHover = `
|
|
161
|
-
group-hover:bg-blue-1000
|
|
162
|
-
group-hover:text-white
|
|
163
|
-
`
|
|
164
|
-
|
|
165
176
|
return (
|
|
166
|
-
<CardFooter className={cx(
|
|
177
|
+
<CardFooter className={cx(linkCardFooterStyle, className)} {...restProps}>
|
|
167
178
|
<span>{children}</span>
|
|
168
|
-
<span className={cx(
|
|
179
|
+
<span className={cx(linkCardArrowStyle, linkCardArrowHoverStyle)}>
|
|
169
180
|
<Icon opticalSize={16}>arrow_forward</Icon>
|
|
170
181
|
</span>
|
|
171
182
|
</CardFooter>
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { cx } from '@sakura-ui/helper'
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* The nested markers rely on the class being present on the nested list too:
|
|
6
|
+
* `[&_&]` compiles to a descendant selector of the class with itself. Anything
|
|
7
|
+
* rendering lists without React has to emit the same class for that to hold.
|
|
8
|
+
*/
|
|
9
|
+
export const ulStyle = `
|
|
10
|
+
list-disc
|
|
11
|
+
[&_&]:list-circle
|
|
12
|
+
[&_&_&]:list-square
|
|
13
|
+
pl-8
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
export const olStyle = `
|
|
17
|
+
list-decimal
|
|
18
|
+
[&_&]:list-lower-latin
|
|
19
|
+
pl-8
|
|
20
|
+
`
|
|
21
|
+
|
|
4
22
|
export namespace Ul {
|
|
5
23
|
export interface Props extends React.ComponentPropsWithoutRef<'ul'> {}
|
|
6
24
|
}
|
|
@@ -8,14 +26,8 @@ export namespace Ul {
|
|
|
8
26
|
export const Ul = (props: Ul.Props) => {
|
|
9
27
|
const { className, children, ...restProps } = props
|
|
10
28
|
|
|
11
|
-
const style = `
|
|
12
|
-
list-disc
|
|
13
|
-
[&_&]:list-circle
|
|
14
|
-
[&_&_&]:list-square
|
|
15
|
-
pl-8
|
|
16
|
-
`
|
|
17
29
|
return (
|
|
18
|
-
<ul className={cx(
|
|
30
|
+
<ul className={cx(ulStyle, className)} {...restProps}>
|
|
19
31
|
{children}
|
|
20
32
|
</ul>
|
|
21
33
|
)
|
|
@@ -28,13 +40,8 @@ export namespace Ol {
|
|
|
28
40
|
export const Ol = (props: Ol.Props) => {
|
|
29
41
|
const { className, children, ...restProps } = props
|
|
30
42
|
|
|
31
|
-
const style = `
|
|
32
|
-
list-decimal
|
|
33
|
-
[&_&]:list-lower-latin
|
|
34
|
-
pl-8
|
|
35
|
-
`
|
|
36
43
|
return (
|
|
37
|
-
<ol className={cx(
|
|
44
|
+
<ol className={cx(olStyle, className)} {...restProps}>
|
|
38
45
|
{children}
|
|
39
46
|
</ol>
|
|
40
47
|
)
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { cx } from '@sakura-ui/helper'
|
|
3
3
|
|
|
4
|
+
export const overflowContainerStyle = `
|
|
5
|
+
w-full
|
|
6
|
+
overflow-x-auto
|
|
7
|
+
whitespace-nowrap
|
|
8
|
+
print:overflow-visible
|
|
9
|
+
print:whitespace-normal
|
|
10
|
+
`
|
|
11
|
+
|
|
4
12
|
export namespace OverflowContainer {
|
|
5
13
|
export interface Props extends React.ComponentPropsWithoutRef<'div'> {}
|
|
6
14
|
}
|
|
@@ -8,16 +16,8 @@ export namespace OverflowContainer {
|
|
|
8
16
|
export const OverflowContainer = (props: OverflowContainer.Props) => {
|
|
9
17
|
const { className, children, ...restProps } = props
|
|
10
18
|
|
|
11
|
-
const style = `
|
|
12
|
-
w-full
|
|
13
|
-
overflow-x-auto
|
|
14
|
-
whitespace-nowrap
|
|
15
|
-
print:overflow-visible
|
|
16
|
-
print:whitespace-normal
|
|
17
|
-
`
|
|
18
|
-
|
|
19
19
|
return (
|
|
20
|
-
<div className={cx(
|
|
20
|
+
<div className={cx(overflowContainerStyle, className)} {...restProps}>
|
|
21
21
|
{children}
|
|
22
22
|
</div>
|
|
23
23
|
)
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { cx } from '@sakura-ui/helper'
|
|
3
3
|
|
|
4
|
+
export const preStyle = `
|
|
5
|
+
p-4
|
|
6
|
+
bg-solid-gray-50
|
|
7
|
+
rounded-lg
|
|
8
|
+
whitespace-pre-wrap
|
|
9
|
+
overflow-y-scroll
|
|
10
|
+
`
|
|
11
|
+
|
|
4
12
|
export namespace Pre {
|
|
5
13
|
export interface Props extends React.ComponentPropsWithoutRef<'pre'> {}
|
|
6
14
|
}
|
|
@@ -8,16 +16,8 @@ export namespace Pre {
|
|
|
8
16
|
export const Pre = (props: Pre.Props) => {
|
|
9
17
|
const { className, children, ...restProps } = props
|
|
10
18
|
|
|
11
|
-
const style = `
|
|
12
|
-
p-4
|
|
13
|
-
bg-solid-gray-50
|
|
14
|
-
rounded-lg
|
|
15
|
-
whitespace-pre-wrap
|
|
16
|
-
overflow-y-scroll
|
|
17
|
-
`
|
|
18
|
-
|
|
19
19
|
return (
|
|
20
|
-
<pre className={cx(
|
|
20
|
+
<pre className={cx(preStyle, className)} {...restProps}>
|
|
21
21
|
{children}
|
|
22
22
|
</pre>
|
|
23
23
|
)
|
|
@@ -1,21 +1,40 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { cx } from '@sakura-ui/helper'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Table classes are exported separately, in the order the components combine
|
|
6
|
+
* them, so that anything rendering a table without React produces the same
|
|
7
|
+
* class attribute.
|
|
8
|
+
*/
|
|
9
|
+
export const tableBorderStyle = `
|
|
9
10
|
border
|
|
10
11
|
border-collapse
|
|
11
12
|
border-solid-gray-420
|
|
12
13
|
`
|
|
13
14
|
|
|
15
|
+
export const captionStyle = 'text-left'
|
|
16
|
+
|
|
17
|
+
export const thStyle = `
|
|
18
|
+
p-2
|
|
19
|
+
bg-[#f8f8fb]
|
|
20
|
+
text-label
|
|
21
|
+
text-left
|
|
22
|
+
`
|
|
23
|
+
|
|
24
|
+
export const tdStyle = `
|
|
25
|
+
p-2
|
|
26
|
+
text-label
|
|
27
|
+
`
|
|
28
|
+
|
|
29
|
+
export namespace Table {
|
|
30
|
+
export interface Props extends React.ComponentPropsWithoutRef<'table'> {}
|
|
31
|
+
}
|
|
32
|
+
|
|
14
33
|
export const Table = (props: Table.Props) => {
|
|
15
34
|
const { className, children, ...restProps } = props
|
|
16
35
|
|
|
17
36
|
return (
|
|
18
|
-
<table className={cx(
|
|
37
|
+
<table className={cx(tableBorderStyle, className)} {...restProps}>
|
|
19
38
|
{children}
|
|
20
39
|
</table>
|
|
21
40
|
)
|
|
@@ -28,9 +47,8 @@ export namespace Caption {
|
|
|
28
47
|
export const Caption = (props: Caption.Props) => {
|
|
29
48
|
const { className, children, ...restProps } = props
|
|
30
49
|
|
|
31
|
-
const style = 'text-left'
|
|
32
50
|
return (
|
|
33
|
-
<caption className={cx(
|
|
51
|
+
<caption className={cx(captionStyle, className)} {...restProps}>
|
|
34
52
|
{children}
|
|
35
53
|
</caption>
|
|
36
54
|
)
|
|
@@ -71,14 +89,8 @@ export namespace Th {
|
|
|
71
89
|
export const Th = (props: Th.Props) => {
|
|
72
90
|
const { className, children, ...restProps } = props
|
|
73
91
|
|
|
74
|
-
const style = `
|
|
75
|
-
p-2
|
|
76
|
-
bg-[#f8f8fb]
|
|
77
|
-
text-label
|
|
78
|
-
text-left
|
|
79
|
-
`
|
|
80
92
|
return (
|
|
81
|
-
<th className={cx(
|
|
93
|
+
<th className={cx(thStyle, tableBorderStyle, className)} {...restProps}>
|
|
82
94
|
{children}
|
|
83
95
|
</th>
|
|
84
96
|
)
|
|
@@ -91,10 +103,8 @@ export namespace Tr {
|
|
|
91
103
|
export const Tr = (props: Tr.Props) => {
|
|
92
104
|
const { className, children, ...restProps } = props
|
|
93
105
|
|
|
94
|
-
const style = ''
|
|
95
|
-
|
|
96
106
|
return (
|
|
97
|
-
<tr className={cx(
|
|
107
|
+
<tr className={cx(tableBorderStyle, className)} {...restProps}>
|
|
98
108
|
{children}
|
|
99
109
|
</tr>
|
|
100
110
|
)
|
|
@@ -107,13 +117,8 @@ export namespace Td {
|
|
|
107
117
|
export const Td = (props: Td.Props) => {
|
|
108
118
|
const { className, children, ...restProps } = props
|
|
109
119
|
|
|
110
|
-
const style = `
|
|
111
|
-
p-2
|
|
112
|
-
text-label
|
|
113
|
-
`
|
|
114
|
-
|
|
115
120
|
return (
|
|
116
|
-
<td className={cx(
|
|
121
|
+
<td className={cx(tdStyle, tableBorderStyle, className)} {...restProps}>
|
|
117
122
|
{children}
|
|
118
123
|
</td>
|
|
119
124
|
)
|
|
@@ -16,3 +16,4 @@ export { Table, Caption, Thead, Tbody, Th, Tr, Td } from './Table'
|
|
|
16
16
|
export { OverflowContainer } from './OverflowContainer'
|
|
17
17
|
export { LangSelector } from './LangSelector'
|
|
18
18
|
export { PopoverMenu, PopoverMenuItem } from './PopoverMenu'
|
|
19
|
+
export * as styles from './styles'
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The class strings the components put on the elements they render.
|
|
3
|
+
*
|
|
4
|
+
* They are exported so that anything producing the same markup without React —
|
|
5
|
+
* @sakura-ui/markdown builds HTML strings — reads these instead of keeping a
|
|
6
|
+
* copy of its own, which would drift the moment a component is restyled.
|
|
7
|
+
*
|
|
8
|
+
* Reach for a component first. These are for the cases where there is no React
|
|
9
|
+
* tree to put one in.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
base as buttonBaseStyle,
|
|
14
|
+
getVariantStyle as getButtonVariantStyle,
|
|
15
|
+
getSizeStyle as getButtonSizeStyle
|
|
16
|
+
} from './buttonStyle'
|
|
17
|
+
export {
|
|
18
|
+
cardStyle,
|
|
19
|
+
cardImgStyle,
|
|
20
|
+
cardHeaderStyle,
|
|
21
|
+
cardBodyStyle,
|
|
22
|
+
cardFooterPositionStyle
|
|
23
|
+
} from './Card'
|
|
24
|
+
export { codeStyle } from './Code'
|
|
25
|
+
export { faqStyle, faqMarkerStyle, questionStyle, answerStyle } from './Faq'
|
|
26
|
+
export { headingStyle } from './Heading'
|
|
27
|
+
export { iconStyle, iconSizeStyle } from './Icon'
|
|
28
|
+
export { linkStyle } from './Link'
|
|
29
|
+
export {
|
|
30
|
+
linkCardPositionStyle,
|
|
31
|
+
linkCardHoverStyle,
|
|
32
|
+
linkCardFocusStyle,
|
|
33
|
+
linkCardHeadingStyle,
|
|
34
|
+
linkCardOverlayStyle,
|
|
35
|
+
linkCardFooterStyle,
|
|
36
|
+
linkCardArrowStyle,
|
|
37
|
+
linkCardArrowHoverStyle
|
|
38
|
+
} from './LinkCard'
|
|
39
|
+
export { ulStyle, olStyle } from './List'
|
|
40
|
+
export { overflowContainerStyle } from './OverflowContainer'
|
|
41
|
+
export { preStyle } from './Pre'
|
|
42
|
+
export { tableBorderStyle, captionStyle, thStyle, tdStyle } from './Table'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
$ rimraf dist
|
|
2
2
|
$ run-p build:*
|
|
3
|
-
$ tsc && tsc-alias
|
|
4
3
|
$ vite build
|
|
4
|
+
$ tsc && tsc-alias
|
|
5
5
|
[36mvite v7.3.6 [32mbuilding client environment for production...[36m[39m
|
|
6
6
|
transforming...
|
|
7
7
|
[32m✓[39m 25 modules transformed.
|
|
@@ -9,4 +9,4 @@ rendering chunks...
|
|
|
9
9
|
computing gzip size...
|
|
10
10
|
[2mdist/[22m[36mindex.es.js [39m[1m[2m24.22 kB[22m[1m[22m[2m │ gzip: 6.09 kB[22m
|
|
11
11
|
[2mdist/[22m[36mindex.cjs.js [39m[1m[2m16.80 kB[22m[1m[22m[2m │ gzip: 5.23 kB[22m
|
|
12
|
-
[32m✓ built in
|
|
12
|
+
[32m✓ built in 459ms[39m
|
|
@@ -37,9 +37,9 @@ case `uname -a` in
|
|
|
37
37
|
esac
|
|
38
38
|
|
|
39
39
|
if [ -z "$NODE_PATH" ]; then
|
|
40
|
-
export NODE_PATH="/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/vitest@4.1.11_@types+node@24.13.3_happy-dom@20.11.
|
|
40
|
+
export NODE_PATH="/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/vitest@4.1.11_@types+node@24.13.3_happy-dom@20.11.6_jsdom@30.0.1_vite@7.3.6_@types+node_05497a8ae2f31e152233075f0a7cffce/node_modules/vitest/node_modules:/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/vitest@4.1.11_@types+node@24.13.3_happy-dom@20.11.6_jsdom@30.0.1_vite@7.3.6_@types+node_05497a8ae2f31e152233075f0a7cffce/node_modules:/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/node_modules"
|
|
41
41
|
else
|
|
42
|
-
export NODE_PATH="/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/vitest@4.1.11_@types+node@24.13.3_happy-dom@20.11.
|
|
42
|
+
export NODE_PATH="/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/vitest@4.1.11_@types+node@24.13.3_happy-dom@20.11.6_jsdom@30.0.1_vite@7.3.6_@types+node_05497a8ae2f31e152233075f0a7cffce/node_modules/vitest/node_modules:/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/vitest@4.1.11_@types+node@24.13.3_happy-dom@20.11.6_jsdom@30.0.1_vite@7.3.6_@types+node_05497a8ae2f31e152233075f0a7cffce/node_modules:/home/runner/work/sakura-ui/sakura-ui/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
43
43
|
fi
|
|
44
44
|
if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
|
|
45
45
|
exec "$basedir/node.exe" "$basedir_win/../vitest/vitest.mjs" "$@"
|
|
@@ -4,9 +4,9 @@ $ vite build
|
|
|
4
4
|
$ tsc && tsc-alias
|
|
5
5
|
[36mvite v7.3.6 [32mbuilding client environment for production...[36m[39m
|
|
6
6
|
transforming...
|
|
7
|
-
[32m✓[39m
|
|
7
|
+
[32m✓[39m 31 modules transformed.
|
|
8
8
|
rendering chunks...
|
|
9
9
|
computing gzip size...
|
|
10
|
-
[2mdist/[22m[36mindex.es.js [39m[1m[
|
|
11
|
-
[2mdist/[22m[36mindex.cjs.js [39m[1m[
|
|
12
|
-
[32m✓ built in
|
|
10
|
+
[2mdist/[22m[36mindex.es.js [39m[1m[2m129.40 kB[22m[1m[22m[2m │ gzip: 39.45 kB[22m
|
|
11
|
+
[2mdist/[22m[36mindex.cjs.js [39m[1m[2m98.41 kB[22m[1m[22m[2m │ gzip: 34.84 kB[22m
|
|
12
|
+
[32m✓ built in 624ms[39m
|