@sakura-ui/sakura-ui 0.1.4 → 0.1.6

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 (51) hide show
  1. package/package.json +4 -4
  2. package/packages/config/package.json +10 -10
  3. package/packages/core/package.json +14 -14
  4. package/packages/core/src/components/Button.tsx +31 -43
  5. package/packages/core/src/components/Card.tsx +1 -1
  6. package/packages/core/src/components/Code.tsx +1 -1
  7. package/packages/core/src/components/Heading.tsx +1 -1
  8. package/packages/core/src/components/Icon.tsx +9 -9
  9. package/packages/core/src/components/IconButton.tsx +38 -51
  10. package/packages/core/src/components/InfoCard.tsx +1 -1
  11. package/packages/core/src/components/Link.tsx +39 -36
  12. package/packages/core/src/components/List.tsx +1 -1
  13. package/packages/core/src/components/Pre.tsx +1 -1
  14. package/packages/core/src/components/Table.tsx +4 -4
  15. package/packages/forms/dist/components/Checkbox.d.ts.map +1 -1
  16. package/packages/forms/dist/components/Radio.d.ts.map +1 -1
  17. package/packages/forms/dist/components/Select.d.ts.map +1 -1
  18. package/packages/forms/dist/components/Text.d.ts.map +1 -1
  19. package/packages/forms/dist/components/Textarea.d.ts.map +1 -1
  20. package/packages/forms/dist/index.cjs.js +39 -29
  21. package/packages/forms/dist/index.cjs.js.map +1 -1
  22. package/packages/forms/dist/index.es.js +365 -378
  23. package/packages/forms/dist/index.es.js.map +1 -1
  24. package/packages/forms/dist/utils/{index.d.ts → class.d.ts} +1 -1
  25. package/packages/forms/dist/utils/class.d.ts.map +1 -0
  26. package/packages/forms/node_modules/.bin/autoprefixer +4 -4
  27. package/packages/forms/node_modules/.bin/jest +4 -4
  28. package/packages/forms/node_modules/.bin/tailwind +4 -4
  29. package/packages/forms/node_modules/.bin/tailwindcss +4 -4
  30. package/packages/forms/node_modules/.bin/ts-jest +4 -4
  31. package/packages/forms/node_modules/.bin/ts-node +4 -4
  32. package/packages/forms/node_modules/.bin/ts-node-cwd +4 -4
  33. package/packages/forms/node_modules/.bin/ts-node-esm +4 -4
  34. package/packages/forms/node_modules/.bin/ts-node-script +4 -4
  35. package/packages/forms/node_modules/.bin/ts-node-transpile-only +4 -4
  36. package/packages/forms/node_modules/.bin/ts-script +4 -4
  37. package/packages/forms/node_modules/.bin/tsc +4 -4
  38. package/packages/forms/node_modules/.bin/tsc-alias +4 -4
  39. package/packages/forms/node_modules/.bin/tsserver +4 -4
  40. package/packages/forms/node_modules/.bin/vite +4 -4
  41. package/packages/forms/package.json +15 -15
  42. package/packages/forms/src/components/Checkbox.tsx +7 -8
  43. package/packages/forms/src/components/FieldsetControl.tsx +1 -1
  44. package/packages/forms/src/components/LabelControl.tsx +1 -1
  45. package/packages/forms/src/components/Radio.tsx +5 -3
  46. package/packages/forms/src/components/Select.tsx +17 -10
  47. package/packages/forms/src/components/Text.tsx +3 -5
  48. package/packages/forms/src/components/Textarea.tsx +3 -5
  49. package/packages/forms/dist/utils/index.d.ts.map +0 -1
  50. /package/packages/core/src/utils/{index.ts → class.ts} +0 -0
  51. /package/packages/forms/src/utils/{index.ts → class.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sakura-ui/sakura-ui",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "keywords": [],
5
5
  "author": "glassonion1",
6
6
  "homepage": "https://github.com/glassonion1/sakura-ui",
@@ -13,9 +13,9 @@
13
13
  "packages"
14
14
  ],
15
15
  "dependencies": {
16
- "@sakura-ui/core": "0.0.3",
17
- "@sakura-ui/config": "0.0.10",
18
- "@sakura-ui/forms": "0.0.5"
16
+ "@sakura-ui/config": "0.0.12",
17
+ "@sakura-ui/core": "0.0.5",
18
+ "@sakura-ui/forms": "0.0.7"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "react": "^18.2.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sakura-ui/config",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "main": "dist/index.cjs.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -35,16 +35,16 @@
35
35
  "tailwindcss": "^3.2.7"
36
36
  },
37
37
  "devDependencies": {
38
- "@types/jest": "^29.4.0",
39
- "@types/node": "^18.14.1",
40
- "autoprefixer": "^10.4.13",
41
- "jest": "^29.4.3",
38
+ "@types/jest": "^29.5.1",
39
+ "@types/node": "^18.16.15",
40
+ "autoprefixer": "^10.4.14",
41
+ "jest": "^29.5.0",
42
42
  "npm-run-all": "^4.1.5",
43
- "postcss": "^8.4.21",
44
- "tailwindcss": "^3.2.7",
45
- "ts-jest": "^29.0.5",
43
+ "postcss": "^8.4.23",
44
+ "tailwindcss": "^3.3.2",
45
+ "ts-jest": "^29.1.0",
46
46
  "ts-node": "^10.9.1",
47
- "typescript": "^5.0.2",
48
- "vite": "^4.2.2"
47
+ "typescript": "^5.0.4",
48
+ "vite": "^4.3.9"
49
49
  }
50
50
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sakura-ui/core",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,22 +39,22 @@
39
39
  "tailwindcss": "^3.2.7"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/jest": "^29.4.0",
43
- "@types/node": "^18.14.1",
44
- "@types/react": "^18.0.27",
45
- "@types/react-dom": "^18.0.10",
46
- "@vitejs/plugin-react-swc": "^3.0.0",
47
- "autoprefixer": "^10.4.13",
48
- "jest": "^29.4.3",
42
+ "@types/jest": "^29.5.1",
43
+ "@types/node": "^18.16.15",
44
+ "@types/react": "^18.2.7",
45
+ "@types/react-dom": "^18.2.4",
46
+ "@vitejs/plugin-react-swc": "^3.3.1",
47
+ "autoprefixer": "^10.4.14",
48
+ "jest": "^29.5.0",
49
49
  "npm-run-all": "^4.1.5",
50
- "postcss": "^8.4.21",
50
+ "postcss": "^8.4.23",
51
51
  "react": "^18.2.0",
52
52
  "react-dom": "^18.2.0",
53
- "tailwindcss": "^3.2.7",
54
- "ts-jest": "^29.0.5",
53
+ "tailwindcss": "^3.3.2",
54
+ "ts-jest": "^29.1.0",
55
55
  "ts-node": "^10.9.1",
56
- "tsc-alias": "^1.8.2",
57
- "typescript": "^5.0.2",
58
- "vite": "^4.2.2"
56
+ "tsc-alias": "^1.8.6",
57
+ "typescript": "^5.0.4",
58
+ "vite": "^4.3.9"
59
59
  }
60
60
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
2
+ import { cx } from '../utils/class'
3
3
 
4
4
  export interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {
5
5
  variant?: 'primary' | 'secondary'
@@ -14,51 +14,39 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
14
14
  const align = textAlign ?? 'center'
15
15
 
16
16
  const style = `
17
- inline-block
18
- p-4
19
- text-base
20
- font-bold
21
- rounded-lg
22
- text-${align}
23
- cursor-pointer
24
- whitespace-nowrap
25
- `
17
+ inline-block
18
+ p-4
19
+ text-base
20
+ font-bold
21
+ rounded-lg
22
+ text-${align}
23
+ cursor-pointer
24
+ whitespace-nowrap
25
+ border
26
+ border-solid
27
+ border-sea-600
28
+ focus:outline
29
+ focus:outline-2
30
+ focus:outline-wood-500
31
+ disabled:border-sumi-500
32
+ disabled:cursor-not-allowed
33
+ `
26
34
 
27
35
  const primary = `
28
- text-white-1000
29
- border
30
- border-solid
31
- border-sea-600
32
- bg-sea-600
33
- hover:bg-sea-800
34
- active:bg-sea-800
35
- focus:outline
36
- focus:outline-2
37
- focus:outline-wood-500
38
- disabled:bg-sumi-500
39
- disabled:text-white-1000
40
- disabled:border
41
- disabled:border-solid
42
- disabled:border-sumi-500
43
- disabled:cursor-not-allowed
44
- `
36
+ text-white-1000
37
+ bg-sea-600
38
+ hover:enabled:bg-sea-700
39
+ active:enabled:bg-sea-800
40
+ disabled:bg-sumi-500
41
+ disabled:text-white-1000
42
+ `
45
43
  const secondary = `
46
- text-sea-600
47
- border
48
- border-solid
49
- border-sea-600
50
- hover:bg-sea-100
51
- active:bg-sea-100
52
- focus:outline
53
- focus:outline-2
54
- focus:outline-wood-500
55
- disabled:hover:bg-white-1000
56
- disabled:text-sumi-500
57
- disabled:border
58
- disabled:border-solid
59
- disabled:border-sumi-500
60
- disabled:cursor-not-allowed
61
- `
44
+ text-sea-600
45
+ bg-transparent
46
+ hover:enabled:bg-sea-100
47
+ active:enabled:bg-sea-200
48
+ disabled:text-sumi-500
49
+ `
62
50
 
63
51
  const styles = {
64
52
  primary: primary,
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
2
+ import { cx } from '../utils/class'
3
3
 
4
4
  export interface CardProps extends React.ComponentProps<'section'> {}
5
5
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
2
+ import { cx } from '../utils/class'
3
3
 
4
4
  export interface CodeProps extends React.ComponentProps<'code'> {}
5
5
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
2
+ import { cx } from '../utils/class'
3
3
 
4
4
  export interface HeadingProps extends React.ComponentProps<'h1'> {}
5
5
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
2
+ import { cx } from '../utils/class'
3
3
 
4
4
  export interface IconProps extends React.ComponentProps<'span'> {
5
5
  icon: string
@@ -9,14 +9,14 @@ export const Icon = React.forwardRef<HTMLElement, IconProps>((props, ref) => {
9
9
  const { className, icon, ...restProps } = props
10
10
 
11
11
  const style = `
12
- inline-block
13
- align-middle
14
- font-icon
15
- text-2xl
16
- font-light
17
- leading-none
18
- antialiased
19
- mb-1
12
+ inline-block
13
+ align-middle
14
+ font-icon
15
+ text-2xl
16
+ font-light
17
+ leading-none
18
+ antialiased
19
+ mb-1
20
20
  `
21
21
 
22
22
  return (
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
2
+ import { cx } from '../utils/class'
3
3
 
4
4
  export interface IconButtonProps extends React.ComponentProps<'button'> {
5
5
  variant?: 'primary' | 'secondary'
@@ -17,51 +17,38 @@ export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
17
17
  const align = 'center'
18
18
 
19
19
  const style = `
20
- inline-block
21
- p-4
22
- text-base
23
- font-bold
24
- rounded-lg
25
- text-${align}
26
- cursor-pointer
27
- whitespace-nowrap
28
- `
20
+ inline-block
21
+ p-4
22
+ text-base
23
+ font-bold
24
+ rounded-lg
25
+ text-${align}
26
+ cursor-pointer
27
+ whitespace-nowrap
28
+ border
29
+ border-solid
30
+ border-sea-600
31
+ focus:outline
32
+ focus:outline-2
33
+ focus:outline-wood-500
34
+ disabled:border-sumi-500
35
+ disabled:cursor-not-allowed
36
+ `
29
37
 
30
38
  const primary = `
31
- text-white-1000
32
- border
33
- border-solid
34
- border-sea-600
35
- bg-sea-600
36
- hover:bg-sea-800
37
- active:bg-sea-800
38
- focus:outline
39
- focus:outline-2
40
- focus:outline-wood-500
41
- disabled:bg-sumi-500
42
- disabled:text-white-1000
43
- disabled:border
44
- disabled:border-solid
45
- disabled:border-sumi-500
46
- disabled:cursor-not-allowed
47
- `
39
+ text-white-1000
40
+ bg-sea-600
41
+ hover:enabled:bg-sea-700
42
+ active:enabled:bg-sea-800
43
+ disabled:bg-sumi-500
44
+ disabled:text-white-1000
45
+ `
48
46
  const secondary = `
49
- text-sea-600
50
- border
51
- border-solid
52
- border-sea-600
53
- hover:bg-sea-100
54
- active:bg-sea-100
55
- focus:outline
56
- focus:outline-2
57
- focus:outline-wood-500
58
- disabled:hover:bg-white-1000
59
- disabled:text-sumi-500
60
- disabled:border
61
- disabled:border-solid
62
- disabled:border-sumi-500
63
- disabled:cursor-not-allowed
64
- `
47
+ text-sea-600
48
+ hover:enabled:bg-sea-100
49
+ active:enabled:bg-sea-200
50
+ disabled:text-sumi-500
51
+ `
65
52
 
66
53
  const styles = {
67
54
  primary: primary,
@@ -69,14 +56,14 @@ export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
69
56
  }
70
57
 
71
58
  const iconStyle = `
72
- inline-block
73
- align-middle
74
- font-icon
75
- text-2xl
76
- font-light
77
- leading-4
78
- antialiased
79
- mb-1
59
+ inline-block
60
+ align-middle
61
+ font-icon
62
+ text-2xl
63
+ font-light
64
+ leading-4
65
+ antialiased
66
+ mb-1
80
67
  `
81
68
 
82
69
  return (
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
2
+ import { cx } from '../utils/class'
3
3
 
4
4
  export interface InfoCardProps extends React.ComponentProps<'section'> {
5
5
  title?: string
@@ -1,7 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
3
-
4
- export interface LinkProps extends React.ComponentProps<'a'> {}
2
+ import { cx } from '../utils/class'
5
3
 
6
4
  const getFileType = (url: string) => {
7
5
  const converted = url.toLowerCase()
@@ -30,44 +28,49 @@ const getFileType = (url: string) => {
30
28
  return null
31
29
  }
32
30
 
33
- export const Link = (props: LinkProps) => {
34
- const { className, children, ...restProps } = props
35
- const href = props.href ?? ''
36
- const fileType = getFileType(href)
31
+ export interface LinkProps extends React.ComponentProps<'a'> {}
37
32
 
38
- const style = `
39
- rounded-sm
40
- cursor-pointer
41
- text-sea-600
42
- underline
43
- underline-offset-[0.1em]
44
- hover:text-sea-800
45
- active:text-sea-800
46
- visited:text-sea-900
47
- focus:outline
48
- focus:outline-2
49
- focus:outline-wood-500
50
- disabled:border-sumi-500
51
- `
33
+ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
34
+ (props, ref) => {
35
+ const { className, children, ...restProps } = props
36
+ const href = props.href ?? ''
37
+ const fileType = getFileType(href)
52
38
 
53
- if (href.startsWith('http')) {
39
+ const style = `
40
+ rounded-sm
41
+ cursor-pointer
42
+ text-sea-600
43
+ underline
44
+ underline-offset-[0.1em]
45
+ hover:text-sea-800
46
+ active:text-sea-800
47
+ visited:text-sea-900
48
+ focus:outline
49
+ focus:outline-2
50
+ focus:outline-wood-500
51
+ disabled:border-sumi-500
52
+ `
53
+
54
+ if (href.startsWith('http')) {
55
+ return (
56
+ <a
57
+ className={cx(style, className)}
58
+ href={href}
59
+ target="_blank"
60
+ rel="noopener noreferrer"
61
+ {...restProps}
62
+ ref={ref}
63
+ >
64
+ {children}
65
+ {fileType ? `(${fileType})` : null}
66
+ </a>
67
+ )
68
+ }
54
69
  return (
55
- <a
56
- className={cx(style, className)}
57
- href={href}
58
- target="_blank"
59
- rel="noopener noreferrer"
60
- {...restProps}
61
- >
70
+ <a className={cx(style, className)} href={href} {...restProps} ref={ref}>
62
71
  {children}
63
72
  {fileType ? `(${fileType})` : null}
64
73
  </a>
65
74
  )
66
75
  }
67
- return (
68
- <a className={cx(style, className)} href={href} {...restProps}>
69
- {children}
70
- {fileType ? `(${fileType})` : null}
71
- </a>
72
- )
73
- }
76
+ )
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
2
+ import { cx } from '../utils/class'
3
3
 
4
4
  export interface UlProps extends React.ComponentProps<'ul'> {}
5
5
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
2
+ import { cx } from '../utils/class'
3
3
 
4
4
  export interface PreProps extends React.ComponentProps<'pre'> {}
5
5
 
@@ -1,12 +1,12 @@
1
1
  import React from 'react'
2
- import { cx } from '../utils'
2
+ import { cx } from '../utils/class'
3
3
 
4
4
  export interface TableProps extends React.ComponentProps<'table'> {}
5
5
 
6
6
  const styleBorder = `
7
- border
8
- border-collapse
9
- border-sumi-900
7
+ border
8
+ border-collapse
9
+ border-sumi-900
10
10
  `
11
11
 
12
12
  export const Table = (props: TableProps) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC;CAAG;AAEvE,eAAO,MAAM,QAAQ,qGA+DpB,CAAA"}
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC;CAAG;AAEvE,eAAO,MAAM,QAAQ,qGA8DpB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../src/components/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,KAAM,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC;CAAG;AAEzE,eAAO,MAAM,KAAK,gFAoDhB,CAAA"}
1
+ {"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../src/components/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,KAAM,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC;CAAG;AAEzE,eAAO,MAAM,KAAK,gFAsDhB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC;CAAG;AAEhF,eAAO,MAAM,MAAM,uFAmDlB,CAAA"}
1
+ {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC;CAAG;AAEhF,eAAO,MAAM,MAAM,uFA0DlB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC;CAAG;AAE7E,eAAO,MAAM,IAAI,oFAsChB,CAAA"}
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC;CAAG;AAE7E,eAAO,MAAM,IAAI,oFAoChB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC;CAAG;AAEvD,eAAO,MAAM,QAAQ,2FAwCpB,CAAA"}
1
+ {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC;CAAG;AAEvD,eAAO,MAAM,QAAQ,2FAsCpB,CAAA"}