@sakura-ui/sakura-ui 0.5.0 → 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.
Files changed (134) hide show
  1. package/package.json +5 -5
  2. package/packages/core/package.json +1 -1
  3. package/packages/core/src/components/Card.tsx +52 -56
  4. package/packages/core/src/components/Code.tsx +6 -6
  5. package/packages/core/src/components/Faq.tsx +30 -26
  6. package/packages/core/src/components/Heading.tsx +50 -48
  7. package/packages/core/src/components/Icon.tsx +34 -34
  8. package/packages/core/src/components/LangSelector.tsx +2 -2
  9. package/packages/core/src/components/Link.tsx +13 -12
  10. package/packages/core/src/components/LinkCard.tsx +87 -76
  11. package/packages/core/src/components/List.tsx +20 -13
  12. package/packages/core/src/components/OverflowContainer.tsx +9 -9
  13. package/packages/core/src/components/PopoverMenu.tsx +2 -13
  14. package/packages/core/src/components/Pre.tsx +9 -9
  15. package/packages/core/src/components/Table.tsx +30 -25
  16. package/packages/core/src/components/index.ts +1 -0
  17. package/packages/core/src/components/styles.ts +42 -0
  18. package/packages/core/src/index.ts +2 -0
  19. package/packages/forms/.turbo/turbo-build.log +4 -4
  20. package/packages/forms/dist/index.cjs.js +13 -21
  21. package/packages/forms/dist/index.es.js +91 -99
  22. package/packages/forms/package.json +1 -1
  23. package/packages/helper/.turbo/turbo-build.log +3 -3
  24. package/packages/helper/dist/index.cjs.js +6 -14
  25. package/packages/helper/dist/index.es.js +18 -26
  26. package/packages/helper/dist/types/styles.d.ts +2 -4
  27. package/packages/helper/dist/types/styles.d.ts.map +1 -1
  28. package/packages/helper/node_modules/.bin/vitest +2 -2
  29. package/packages/helper/package.json +1 -1
  30. package/packages/helper/src/styles.ts +2 -14
  31. package/packages/markdown/.turbo/turbo-build.log +4 -4
  32. package/packages/markdown/README.md +240 -4
  33. package/packages/markdown/dist/index.cjs.js +71 -145
  34. package/packages/markdown/dist/index.es.js +2624 -16747
  35. package/packages/markdown/dist/types/components/Markdown.d.ts +15 -10
  36. package/packages/markdown/dist/types/components/Markdown.d.ts.map +1 -1
  37. package/packages/markdown/dist/types/components/index.d.ts +1 -1
  38. package/packages/markdown/dist/types/components/index.d.ts.map +1 -1
  39. package/packages/markdown/dist/types/decorate.d.ts +24 -0
  40. package/packages/markdown/dist/types/decorate.d.ts.map +1 -0
  41. package/packages/markdown/dist/types/index.d.ts +3 -1
  42. package/packages/markdown/dist/types/index.d.ts.map +1 -1
  43. package/packages/markdown/dist/types/marked/attributes.d.ts +31 -0
  44. package/packages/markdown/dist/types/marked/attributes.d.ts.map +1 -0
  45. package/packages/markdown/dist/types/marked/directives/card.d.ts +3 -0
  46. package/packages/markdown/dist/types/marked/directives/card.d.ts.map +1 -0
  47. package/packages/markdown/dist/types/marked/directives/context.d.ts +36 -0
  48. package/packages/markdown/dist/types/marked/directives/context.d.ts.map +1 -0
  49. package/packages/markdown/dist/types/marked/directives/faq.d.ts +11 -0
  50. package/packages/markdown/dist/types/marked/directives/faq.d.ts.map +1 -0
  51. package/packages/markdown/dist/types/marked/directives/grid.d.ts +9 -0
  52. package/packages/markdown/dist/types/marked/directives/grid.d.ts.map +1 -0
  53. package/packages/markdown/dist/types/marked/directives/index.d.ts +8 -0
  54. package/packages/markdown/dist/types/marked/directives/index.d.ts.map +1 -0
  55. package/packages/markdown/dist/types/marked/directives/linkButton.d.ts +6 -0
  56. package/packages/markdown/dist/types/marked/directives/linkButton.d.ts.map +1 -0
  57. package/packages/markdown/dist/types/marked/directives/youtube.d.ts +3 -0
  58. package/packages/markdown/dist/types/marked/directives/youtube.d.ts.map +1 -0
  59. package/packages/markdown/dist/types/marked/html.d.ts +15 -0
  60. package/packages/markdown/dist/types/marked/html.d.ts.map +1 -0
  61. package/packages/markdown/dist/types/marked/index.d.ts +13 -0
  62. package/packages/markdown/dist/types/marked/index.d.ts.map +1 -0
  63. package/packages/markdown/dist/types/marked/registry.d.ts +8 -0
  64. package/packages/markdown/dist/types/marked/registry.d.ts.map +1 -0
  65. package/packages/markdown/dist/types/marked/renderer.d.ts +16 -0
  66. package/packages/markdown/dist/types/marked/renderer.d.ts.map +1 -0
  67. package/packages/markdown/dist/types/marked/tokenizer.d.ts +40 -0
  68. package/packages/markdown/dist/types/marked/tokenizer.d.ts.map +1 -0
  69. package/packages/markdown/dist/types/render.d.ts +22 -0
  70. package/packages/markdown/dist/types/render.d.ts.map +1 -0
  71. package/packages/markdown/dist/types/sanitize.d.ts +11 -0
  72. package/packages/markdown/dist/types/sanitize.d.ts.map +1 -0
  73. package/packages/markdown/node_modules/.bin/marked +55 -0
  74. package/packages/markdown/package.json +6 -19
  75. package/packages/markdown/src/components/Markdown.tsx +44 -346
  76. package/packages/markdown/src/components/index.ts +1 -1
  77. package/packages/markdown/src/decorate.ts +164 -0
  78. package/packages/markdown/src/index.ts +3 -1
  79. package/packages/markdown/src/marked/attributes.ts +88 -0
  80. package/packages/markdown/src/marked/directives/card.ts +77 -0
  81. package/packages/markdown/src/marked/directives/context.ts +39 -0
  82. package/packages/markdown/src/marked/directives/faq.ts +29 -0
  83. package/packages/markdown/src/marked/directives/grid.ts +50 -0
  84. package/packages/markdown/src/marked/directives/index.ts +29 -0
  85. package/packages/markdown/src/marked/directives/linkButton.ts +20 -0
  86. package/packages/markdown/src/marked/directives/youtube.ts +46 -0
  87. package/packages/markdown/src/marked/html.ts +55 -0
  88. package/packages/markdown/src/marked/index.ts +45 -0
  89. package/packages/markdown/src/marked/registry.ts +34 -0
  90. package/packages/markdown/src/marked/renderer.ts +52 -0
  91. package/packages/markdown/src/marked/tokenizer.ts +175 -0
  92. package/packages/markdown/src/render.ts +55 -0
  93. package/packages/markdown/src/sanitize.ts +194 -0
  94. package/packages/markdown/tests/Markdown.test.tsx +122 -0
  95. package/packages/markdown/tests/__snapshots__/Markdown.test.tsx.snap +451 -0
  96. package/packages/markdown/tests/anchors.test.ts +108 -0
  97. package/packages/markdown/tests/fixtures.ts +100 -0
  98. package/packages/markdown/tests/sanitize.test.ts +168 -0
  99. package/packages/markdown/tests/server.test.tsx +51 -0
  100. package/packages/markdown/tests/vitest.setup.ts +4 -0
  101. package/packages/markdown/tsconfig.test.json +11 -0
  102. package/packages/markdown/vite.config.ts +5 -1
  103. package/packages/tailwind-theme-plugin/.turbo/turbo-build.log +1 -1
  104. package/packages/tailwind-theme-plugin/package.json +1 -1
  105. package/packages/markdown/dist/types/plugins/attr.d.ts +0 -3
  106. package/packages/markdown/dist/types/plugins/attr.d.ts.map +0 -1
  107. package/packages/markdown/dist/types/plugins/card.d.ts +0 -3
  108. package/packages/markdown/dist/types/plugins/card.d.ts.map +0 -1
  109. package/packages/markdown/dist/types/plugins/cell.d.ts +0 -3
  110. package/packages/markdown/dist/types/plugins/cell.d.ts.map +0 -1
  111. package/packages/markdown/dist/types/plugins/faq.d.ts +0 -3
  112. package/packages/markdown/dist/types/plugins/faq.d.ts.map +0 -1
  113. package/packages/markdown/dist/types/plugins/grid.d.ts +0 -3
  114. package/packages/markdown/dist/types/plugins/grid.d.ts.map +0 -1
  115. package/packages/markdown/dist/types/plugins/headings.d.ts +0 -11
  116. package/packages/markdown/dist/types/plugins/headings.d.ts.map +0 -1
  117. package/packages/markdown/dist/types/plugins/helper.d.ts +0 -9
  118. package/packages/markdown/dist/types/plugins/helper.d.ts.map +0 -1
  119. package/packages/markdown/dist/types/plugins/index.d.ts +0 -9
  120. package/packages/markdown/dist/types/plugins/index.d.ts.map +0 -1
  121. package/packages/markdown/dist/types/plugins/linkButton.d.ts +0 -3
  122. package/packages/markdown/dist/types/plugins/linkButton.d.ts.map +0 -1
  123. package/packages/markdown/dist/types/plugins/youtube.d.ts +0 -3
  124. package/packages/markdown/dist/types/plugins/youtube.d.ts.map +0 -1
  125. package/packages/markdown/src/plugins/attr.ts +0 -19
  126. package/packages/markdown/src/plugins/card.ts +0 -71
  127. package/packages/markdown/src/plugins/cell.ts +0 -47
  128. package/packages/markdown/src/plugins/faq.ts +0 -40
  129. package/packages/markdown/src/plugins/grid.ts +0 -54
  130. package/packages/markdown/src/plugins/headings.ts +0 -38
  131. package/packages/markdown/src/plugins/helper.ts +0 -27
  132. package/packages/markdown/src/plugins/index.ts +0 -8
  133. package/packages/markdown/src/plugins/linkButton.ts +0 -26
  134. 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(stylePosition, styleHover, styleFocus, className)}
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, styleHeading)}>
122
- <Component className={styleOverlay} {...restProps}>
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(style, className)} {...restProps}>
177
+ <CardFooter className={cx(linkCardFooterStyle, className)} {...restProps}>
167
178
  <span>{children}</span>
168
- <span className={cx(styleIcon, styleIconHover)}>
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(style, className)} {...restProps}>
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(style, className)} {...restProps}>
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(style, className)} {...restProps}>
20
+ <div className={cx(overflowContainerStyle, className)} {...restProps}>
21
21
  {children}
22
22
  </div>
23
23
  )
@@ -7,22 +7,11 @@ export const PopoverMenu = React.forwardRef<
7
7
  React.ComponentProps<'ul'>
8
8
  >((props, ref) => {
9
9
  const { className, children, ...rest } = props
10
- const stylePopover = `
11
- min-w-fit
12
- w-auto
13
- py-2
14
- bg-white
15
- shadow-1
16
- rounded-lg
17
- border
18
- border-solid-grey-420
19
- has-[>:nth-child(7)]:rounded-r-none
20
- `
21
10
 
22
11
  const style = `
23
12
  font-normal
24
13
  whitespace-nowrap
25
- ${stylePopover}
14
+ ${Style.popover}
26
15
  `
27
16
 
28
17
  return (
@@ -46,7 +35,7 @@ export const PopoverMenuItem = React.forwardRef<
46
35
  flex
47
36
  items-center
48
37
  gap-x-1.5
49
- hover:bg-solid-grey-50
38
+ hover:bg-solid-gray-50
50
39
  ${Style.focusRectCondensedWithBg}
51
40
  `
52
41
 
@@ -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(style, className)} {...restProps}>
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
- export namespace Table {
5
- export interface Props extends React.ComponentPropsWithoutRef<'table'> {}
6
- }
7
-
8
- const styleBorder = `
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
- border-solid-grey-420
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(styleBorder, className)} {...restProps}>
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(style, className)} {...restProps}>
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(style, styleBorder, className)} {...restProps}>
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(style, styleBorder, className)} {...restProps}>
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(style, styleBorder, className)} {...restProps}>
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'
@@ -40,3 +40,5 @@ export {
40
40
  } from './components'
41
41
 
42
42
  export type { CardHeaderAs } from './components'
43
+
44
+ export { styles } from './components'
@@ -1,12 +1,12 @@
1
1
  $ rimraf dist
2
2
  $ run-p build:*
3
- $ tsc && tsc-alias
4
3
  $ vite build
4
+ $ tsc && tsc-alias
5
5
  vite v7.3.6 building client environment for production...
6
6
  transforming...
7
7
  ✓ 25 modules transformed.
8
8
  rendering chunks...
9
9
  computing gzip size...
10
- dist/index.es.js 24.36 kB │ gzip: 6.13 kB
11
- dist/index.cjs.js 16.94 kB │ gzip: 5.27 kB
12
- ✓ built in 375ms
10
+ dist/index.es.js 24.22 kB │ gzip: 6.09 kB
11
+ dist/index.cjs.js 16.80 kB │ gzip: 5.23 kB
12
+ ✓ built in 459ms