@sakura-ui/sakura-ui 0.0.9 → 0.0.11

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 (36) hide show
  1. package/README.md +2 -2
  2. package/examples/README.md +14 -0
  3. package/examples/package.json +1 -1
  4. package/examples/src/App.tsx +28 -2
  5. package/examples/tailwind.config.js +2 -2
  6. package/package.json +2 -2
  7. package/packages/react/package.json +1 -1
  8. package/packages/react/src/components/Button.tsx +6 -3
  9. package/packages/react/src/components/Card.tsx +2 -2
  10. package/packages/react/src/components/Checkbox.tsx +56 -0
  11. package/packages/react/src/components/Code.tsx +1 -1
  12. package/packages/react/src/components/Heading.tsx +1 -1
  13. package/packages/react/src/components/IconButton.tsx +5 -54
  14. package/packages/react/src/components/InfoCard.tsx +2 -2
  15. package/packages/react/src/components/Link.tsx +1 -1
  16. package/packages/react/src/components/List.tsx +2 -2
  17. package/packages/react/src/components/Pre.tsx +1 -1
  18. package/packages/react/src/components/Radio.tsx +4 -1
  19. package/packages/react/src/components/Select.tsx +2 -2
  20. package/packages/react/src/components/Table.tsx +7 -7
  21. package/packages/react/src/components/Text.tsx +2 -2
  22. package/packages/react/src/components/Textarea.tsx +3 -2
  23. package/packages/react/src/components/index.ts +1 -0
  24. package/packages/react/src/index.ts +1 -0
  25. package/packages/config/coverage/clover.xml +0 -12
  26. package/packages/config/coverage/coverage-final.json +0 -2
  27. package/packages/config/coverage/lcov-report/base.css +0 -224
  28. package/packages/config/coverage/lcov-report/block-navigation.js +0 -87
  29. package/packages/config/coverage/lcov-report/favicon.png +0 -0
  30. package/packages/config/coverage/lcov-report/index.html +0 -116
  31. package/packages/config/coverage/lcov-report/index.ts.html +0 -385
  32. package/packages/config/coverage/lcov-report/prettify.css +0 -1
  33. package/packages/config/coverage/lcov-report/prettify.js +0 -2
  34. package/packages/config/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  35. package/packages/config/coverage/lcov-report/sorter.js +0 -196
  36. package/packages/config/coverage/lcov.info +0 -14
package/README.md CHANGED
@@ -16,8 +16,8 @@ tailwind.config.js
16
16
  module.exports = {
17
17
  mode: 'jit',
18
18
  content: [
19
- './src/pages/**/*.{js,ts,jsx,tsx}',
20
- './node_modules/@sakura-ui/react/**/*.{js,ts,jsx,tsx}'
19
+ './src/pages/**/*.{jsx,tsx}',
20
+ './node_modules/@sakura-ui/sakura-ui/packages/react/**/*.{jsx,tsx}'
21
21
  ],
22
22
  plugins: [require('@sakura-ui/config')]
23
23
  }
@@ -0,0 +1,14 @@
1
+ # SakuraUI examples
2
+
3
+ ## Install
4
+ ```
5
+ $ pnpm install
6
+ ```
7
+
8
+ ## Run
9
+ ```
10
+ $ pnpm dev
11
+ ```
12
+
13
+ ## Browse
14
+ http://localhost:5173/
@@ -8,7 +8,7 @@
8
8
  "preview": "vite preview"
9
9
  },
10
10
  "dependencies": {
11
- "@sakura-ui/sakura-ui": "workspace:^0.0.8",
11
+ "@sakura-ui/sakura-ui": "workspace:^0.0.10",
12
12
  "react": "^18.2.0",
13
13
  "react-dom": "^18.2.0"
14
14
  },
@@ -1,11 +1,23 @@
1
1
  import { useState } from 'react'
2
- import { H1, H2, H3, H4, H5, H6, Button } from '@sakura-ui/react'
2
+ import {
3
+ H1,
4
+ H2,
5
+ H3,
6
+ H4,
7
+ H5,
8
+ H6,
9
+ Button,
10
+ Checkbox,
11
+ Radio,
12
+ Text,
13
+ Textarea
14
+ } from '../../packages/react/src'
3
15
 
4
16
  const App = () => {
5
17
  const [count, setCount] = useState(0)
6
18
 
7
19
  return (
8
- <div>
20
+ <div className="text-sumi-900 text-base">
9
21
  <H1>SakuraUI Heading1</H1>
10
22
  <H2>SakuraUI Heading2</H2>
11
23
  <H3>SakuraUI Heading3</H3>
@@ -22,6 +34,20 @@ const App = () => {
22
34
  >
23
35
  count is {count}
24
36
  </Button>
37
+ <Button onClick={() => setCount((count) => count + 1)} disabled>
38
+ count is {count}
39
+ </Button>
40
+ <Button
41
+ variant="secondary"
42
+ onClick={() => setCount((count) => count + 1)}
43
+ disabled
44
+ >
45
+ count is {count}
46
+ </Button>
47
+ <Radio name="sample">ラジオ1</Radio>
48
+ <Radio name="sample">ラジオ2</Radio>
49
+ <Checkbox>選択肢1</Checkbox>
50
+ <Checkbox>選択肢2</Checkbox>
25
51
  </div>
26
52
  </div>
27
53
  )
@@ -2,8 +2,8 @@ module.exports = {
2
2
  mode: 'jit',
3
3
  content: [
4
4
  './index.html',
5
- './src/**/*.{js,ts,jsx,tsx}',
6
- './node_modules/@sakura-ui/sakura-ui/packages/react/**/*.{js,ts,jsx,tsx}'
5
+ './src/**/*.{jsx,tsx}',
6
+ './node_modules/@sakura-ui/sakura-ui/packages/react/**/*.{jsx,tsx}'
7
7
  ],
8
8
  plugins: [require('@sakura-ui/config')]
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sakura-ui/sakura-ui",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "keywords": [],
5
5
  "author": "glassonion1",
6
6
  "homepage": "https://github.com/glassonion1/sakura-ui",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@sakura-ui/react": "0.0.1",
13
+ "@sakura-ui/react": "0.0.2",
14
14
  "@sakura-ui/config": "0.0.2"
15
15
  },
16
16
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sakura-ui/react",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type ButtonProps = React.ComponentPropsWithoutRef<'button'> & {
4
+ export interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {
5
5
  variant?: 'primary' | 'secondary'
6
6
  textAlign?: 'left' | 'right' | 'center'
7
7
  }
@@ -37,8 +37,10 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
37
37
  disabled:border
38
38
  disabled:border-solid
39
39
  disabled:border-sumi-500
40
+ disabled:cursor-not-allowed
40
41
  `
41
42
  const secondary = `
43
+ text-sea-600
42
44
  border
43
45
  border-solid
44
46
  border-sea-600
@@ -47,11 +49,12 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
47
49
  focus:outline
48
50
  focus:outline-2
49
51
  focus:outline-wood-500
50
- disabled:bg-sumi-500
51
- disabled:text-white-1000
52
+ disabled:hover:bg-white-1000
53
+ disabled:text-sumi-500
52
54
  disabled:border
53
55
  disabled:border-solid
54
56
  disabled:border-sumi-500
57
+ disabled:cursor-not-allowed
55
58
  `
56
59
 
57
60
  const styles = {
@@ -1,9 +1,9 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type Props = React.ComponentProps<'div'>
4
+ export interface CardProps extends React.ComponentProps<'div'> {}
5
5
 
6
- export const Card = (props: Props) => {
6
+ export const Card = (props: CardProps) => {
7
7
  const { className, children, ...newProps } = props
8
8
 
9
9
  const style = `
@@ -0,0 +1,56 @@
1
+ import React from 'react'
2
+ import { cx } from '../utils'
3
+
4
+ export interface CheckboxProps extends React.ComponentProps<'input'> {}
5
+
6
+ export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
7
+ (props, ref) => {
8
+ const { className, children, ...newProps } = props
9
+
10
+ const style = `
11
+ flex
12
+ items-center
13
+ text-sm
14
+ cursor-pointer
15
+ py-2
16
+ `
17
+ const styleInput = `
18
+ hidden
19
+ peer
20
+ `
21
+
22
+ const styleCheck = `
23
+ inline-block
24
+ bg-clip-content
25
+ w-6 h-6
26
+ ml-1
27
+ mr-2
28
+ rounded
29
+ border
30
+ border-solid
31
+ border-sumi-900
32
+ peer-checked:bg-sea-600
33
+ peer-checked:border-none
34
+ `
35
+
36
+ return (
37
+ <label htmlFor={newProps.id} className={cx(style, className)}>
38
+ <input className={styleInput} type="checkbox" {...newProps} ref={ref} />
39
+ <span className={styleCheck}>
40
+ <svg
41
+ xmlns="http://www.w3.org/2000/svg"
42
+ width="w-6"
43
+ height="w-6"
44
+ viewBox="0 0 24 24"
45
+ >
46
+ <path
47
+ d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"
48
+ fill="#fff"
49
+ />
50
+ </svg>
51
+ </span>
52
+ {children}
53
+ </label>
54
+ )
55
+ }
56
+ )
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type CodeProps = React.ComponentProps<'code'>
4
+ export interface CodeProps extends React.ComponentProps<'code'> {}
5
5
 
6
6
  export const Code = (props: CodeProps) => {
7
7
  const { className, children, ...newProps } = props
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type HeadingProps = React.ComponentProps<'h1'>
4
+ export interface HeadingProps extends React.ComponentProps<'h1'> {}
5
5
 
6
6
  const common = `
7
7
  font-bold
@@ -1,71 +1,22 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
2
+ import { Button } from './Button'
3
3
 
4
- export type IconButtonProps = React.ComponentProps<'button'> & {
4
+ export interface IconButtonProps extends React.ComponentProps<'button'> {
5
5
  variant?: 'primary' | 'secondary'
6
6
  icon: string
7
7
  }
8
8
 
9
9
  export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
10
10
  (props, ref) => {
11
- const { className, children, icon, variant, ...newProps } = props
11
+ const { children, icon, ...newProps } = props
12
12
 
13
13
  const align = 'center'
14
14
 
15
- const style = `
16
- inline-block
17
- p-4
18
- text-base
19
- font-bold
20
- rounded-lg
21
- text-${align}
22
- cursor-pointer
23
- `
24
-
25
- const primary = `
26
- text-white-1000
27
- bg-sea-600
28
- hover:bg-sea-800
29
- active:bg-sea-800
30
- focus:outline
31
- focus:outline-2
32
- focus:outline-wood-500
33
- disabled:bg-sumi-500
34
- disabled:text-white-1000
35
- disabled:border
36
- disabled:border-solid
37
- disabled:border-sumi-500
38
- `
39
- const secondary = `
40
- border
41
- border-solid
42
- border-sea-600
43
- hover:bg-sea-100
44
- active:bg-sea-100
45
- focus:outline
46
- focus:outline-2
47
- focus:outline-wood-500
48
- disabled:bg-sumi-500
49
- disabled:text-white-1000
50
- disabled:border
51
- disabled:border-solid
52
- disabled:border-sumi-500
53
- `
54
-
55
- const styles = {
56
- primary: primary,
57
- secondary: secondary
58
- }
59
-
60
15
  return (
61
- <button
62
- className={cx(style, styles[variant ?? 'primary'], className)}
63
- {...newProps}
64
- ref={ref}
65
- >
16
+ <Button textAlign={align} {...newProps} ref={ref}>
66
17
  <img src={`/icons/${props.icon}.svg`} alt={props.icon} width="24" />
67
18
  {children}
68
- </button>
19
+ </Button>
69
20
  )
70
21
  }
71
22
  )
@@ -1,11 +1,11 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type Props = React.ComponentProps<'div'> & {
4
+ export interface InfoCardProps extends React.ComponentProps<'div'> {
5
5
  title?: string
6
6
  }
7
7
 
8
- export const InfoCard = (props: Props) => {
8
+ export const InfoCard = (props: InfoCardProps) => {
9
9
  const { className, children, ...newProps } = props
10
10
 
11
11
  const style = `
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type LinkProps = React.ComponentProps<'a'>
4
+ export interface LinkProps extends React.ComponentProps<'a'> {}
5
5
 
6
6
  const getFileType = (url: string) => {
7
7
  const converted = url.toLowerCase()
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type UlProps = React.ComponentProps<'ul'>
4
+ export interface UlProps extends React.ComponentProps<'ul'> {}
5
5
 
6
6
  export const Ul = (props: UlProps) => {
7
7
  const { className, children, ...newprops } = props
@@ -19,7 +19,7 @@ export const Ul = (props: UlProps) => {
19
19
  )
20
20
  }
21
21
 
22
- export type OlProps = React.ComponentProps<'ol'>
22
+ export interface OlProps extends React.ComponentProps<'ol'> {}
23
23
 
24
24
  export const Ol = (props: OlProps) => {
25
25
  const { className, children, ...newprops } = props
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type PreProps = React.ComponentProps<'pre'>
4
+ export interface PreProps extends React.ComponentProps<'pre'> {}
5
5
 
6
6
  export const Pre = (props: PreProps) => {
7
7
  const { className, children, ...newProps } = props
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type Props = React.ComponentProps<'input'> & {}
4
+ export interface Props extends React.ComponentProps<'input'> {}
5
5
 
6
6
  export const Radio = React.forwardRef<HTMLInputElement, Props>((props, ref) => {
7
7
  const { className, children, ...newProps } = props
@@ -11,6 +11,7 @@ export const Radio = React.forwardRef<HTMLInputElement, Props>((props, ref) => {
11
11
  items-center
12
12
  text-sm
13
13
  cursor-pointer
14
+ py-2
14
15
  `
15
16
  const styleInput = `
16
17
  hidden
@@ -21,6 +22,7 @@ export const Radio = React.forwardRef<HTMLInputElement, Props>((props, ref) => {
21
22
  inline-block
22
23
  bg-clip-content
23
24
  w-6 h-6
25
+ ml-1
24
26
  mr-2
25
27
  p-1
26
28
  rounded-full
@@ -28,6 +30,7 @@ export const Radio = React.forwardRef<HTMLInputElement, Props>((props, ref) => {
28
30
  border-solid
29
31
  border-sumi-900
30
32
  peer-checked:bg-sea-600
33
+ peer-checked:border-sea-600
31
34
  `
32
35
  return (
33
36
  <label htmlFor={newProps.id} className={cx(style, className)}>
@@ -1,9 +1,9 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type Props = React.ComponentPropsWithoutRef<'select'>
4
+ export interface SelectProps extends React.ComponentPropsWithoutRef<'select'> {}
5
5
 
6
- export const Select = React.forwardRef<HTMLSelectElement, Props>(
6
+ export const Select = React.forwardRef<HTMLSelectElement, SelectProps>(
7
7
  (props, ref) => {
8
8
  const { className, children, ...newProps } = props
9
9
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type TableProps = React.ComponentProps<'table'>
4
+ export interface TableProps extends React.ComponentProps<'table'> {}
5
5
 
6
6
  const styleBorder = `
7
7
  border
@@ -26,7 +26,7 @@ export const Table = (props: TableProps) => {
26
26
  )
27
27
  }
28
28
 
29
- export type CaptionProps = React.ComponentProps<'caption'>
29
+ export interface CaptionProps extends React.ComponentProps<'caption'> {}
30
30
 
31
31
  export const Caption = (props: CaptionProps) => {
32
32
  const { className, children, ...newprops } = props
@@ -39,7 +39,7 @@ export const Caption = (props: CaptionProps) => {
39
39
  )
40
40
  }
41
41
 
42
- export type TheadProps = React.ComponentProps<'thead'>
42
+ export interface TheadProps extends React.ComponentProps<'thead'> {}
43
43
 
44
44
  export const Thead = (props: TheadProps) => {
45
45
  const { className, children, ...newprops } = props
@@ -51,7 +51,7 @@ export const Thead = (props: TheadProps) => {
51
51
  )
52
52
  }
53
53
 
54
- export type TbodyProps = React.ComponentProps<'tbody'>
54
+ export interface TbodyProps extends React.ComponentProps<'tbody'> {}
55
55
 
56
56
  export const Tbody = (props: TbodyProps) => {
57
57
  const { className, children, ...newprops } = props
@@ -63,7 +63,7 @@ export const Tbody = (props: TbodyProps) => {
63
63
  )
64
64
  }
65
65
 
66
- export type ThProps = React.ComponentProps<'th'>
66
+ export interface ThProps extends React.ComponentProps<'th'> {}
67
67
 
68
68
  export const Th = (props: ThProps) => {
69
69
  const { className, children, ...newprops } = props
@@ -80,7 +80,7 @@ export const Th = (props: ThProps) => {
80
80
  )
81
81
  }
82
82
 
83
- export type TrProps = React.ComponentProps<'tr'>
83
+ export interface TrProps extends React.ComponentProps<'tr'> {}
84
84
 
85
85
  export const Tr = (props: TrProps) => {
86
86
  const { className, children, ...newprops } = props
@@ -94,7 +94,7 @@ export const Tr = (props: TrProps) => {
94
94
  )
95
95
  }
96
96
 
97
- export type TdProps = React.ComponentProps<'td'>
97
+ export interface TdProps extends React.ComponentProps<'td'> {}
98
98
 
99
99
  export const Td = (props: TdProps) => {
100
100
  const { className, children, ...newprops } = props
@@ -1,10 +1,10 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type TextProps = React.ComponentPropsWithoutRef<'input'>
4
+ export interface TextProps extends React.ComponentPropsWithoutRef<'input'> {}
5
5
 
6
6
  export const Text = React.forwardRef<HTMLInputElement, TextProps>(
7
- ({ ...props }, ref) => {
7
+ (props, ref) => {
8
8
  const { className, ...newProps } = props
9
9
 
10
10
  const style = `
@@ -1,10 +1,11 @@
1
1
  import React from 'react'
2
2
  import { cx } from '../utils'
3
3
 
4
- export type TextareaProps = React.ComponentPropsWithoutRef<'textarea'>
4
+ export interface TextareaProps
5
+ extends React.ComponentPropsWithoutRef<'textarea'> {}
5
6
 
6
7
  export const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
7
- ({ ...props }, ref) => {
8
+ (props, ref) => {
8
9
  const { className, children, ...newProps } = props
9
10
 
10
11
  const style = `
@@ -1,5 +1,6 @@
1
1
  export { Button } from './Button'
2
2
  export { Card } from './Card'
3
+ export { Checkbox } from './Checkbox'
3
4
  export { Code } from './Code'
4
5
  export { H1, H2, H3, H4, H5, H6 } from './Heading'
5
6
  export { IconButton } from './IconButton'
@@ -1,6 +1,7 @@
1
1
  export {
2
2
  Button,
3
3
  Card,
4
+ Checkbox,
4
5
  Code,
5
6
  H1,
6
7
  H2,
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1677477705846" clover="3.2.0">
3
- <project timestamp="1677477705847" name="All files">
4
- <metrics statements="3" coveredstatements="3" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="0" elements="4" coveredelements="3" complexity="0" loc="3" ncloc="3" packages="1" files="1" classes="1"/>
5
- <file name="index.ts" path="/Users/taisukefujita/Documents/Repos/sakura-ui/packages/config/src/index.ts">
6
- <metrics statements="3" coveredstatements="3" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="0"/>
7
- <line num="1" count="1" type="stmt"/>
8
- <line num="3" count="1" type="stmt"/>
9
- <line num="100" count="1" type="stmt"/>
10
- </file>
11
- </project>
12
- </coverage>
@@ -1,2 +0,0 @@
1
- {"/Users/taisukefujita/Documents/Repos/sakura-ui/packages/config/src/index.ts": {"path":"/Users/taisukefujita/Documents/Repos/sakura-ui/packages/config/src/index.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}},"1":{"start":{"line":3,"column":21},"end":{"line":98,"column":2}},"2":{"start":{"line":100,"column":0},"end":{"line":100,"column":null}}},"fnMap":{"0":{"name":"(anonymous_1)","decl":{"start":{"line":3,"column":28},"end":{"line":3,"column":31}},"loc":{"start":{"line":3,"column":33},"end":{"line":3,"column":36}}}},"branchMap":{},"s":{"0":1,"1":1,"2":1},"f":{"0":0},"b":{}}
2
- }