@liguelead/design-system 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 (76) hide show
  1. package/components/Button/Button.appearance.ts +66 -62
  2. package/components/Button/Button.sizes.ts +42 -41
  3. package/components/Button/Button.styles.ts +46 -50
  4. package/components/Button/Button.tsx +76 -76
  5. package/components/Button/Button.types.ts +23 -23
  6. package/components/Button/index.ts +1 -1
  7. package/components/Checkbox/Checkbox.styles.ts +115 -66
  8. package/components/Checkbox/Checkbox.tsx +97 -40
  9. package/components/Checkbox/Checkbox.types.ts +12 -11
  10. package/components/Checkbox/index.tsx +2 -2
  11. package/components/DatePicker/DatePicker.styles.ts +66 -66
  12. package/components/DatePicker/DatePicker.tsx +135 -135
  13. package/components/DatePicker/DatePicker.types.ts +29 -29
  14. package/components/DatePicker/index.ts +1 -1
  15. package/components/IconButton/IconButton.sizes.ts +34 -41
  16. package/components/IconButton/IconButton.tsx +70 -70
  17. package/components/IconButton/index.ts +1 -1
  18. package/components/InputOpt/InputOpt.styles.ts +75 -0
  19. package/components/InputOpt/InputOpt.tsx +153 -0
  20. package/components/InputOpt/InputOpt.types.ts +14 -0
  21. package/components/InputOpt/index.ts +1 -0
  22. package/components/InputOpt/utils/focusManagement.ts +31 -0
  23. package/components/InputOpt/utils/index.ts +2 -0
  24. package/components/InputOpt/utils/inputValidation.ts +14 -0
  25. package/components/LinkButton/LinkButton.size.ts +39 -0
  26. package/components/LinkButton/LinkButton.style.ts +45 -0
  27. package/components/LinkButton/LinkButton.tsx +75 -0
  28. package/components/LinkButton/LinkButton.types.ts +11 -0
  29. package/components/LinkButton/index.ts +1 -0
  30. package/components/PageWrapper/PageWrapper.tsx +31 -31
  31. package/components/PageWrapper/index.ts +1 -1
  32. package/components/RadioButton/RadioButton.inputVariants.ts +133 -0
  33. package/components/RadioButton/RadioButton.styles.ts +78 -0
  34. package/components/RadioButton/RadioButton.tsx +88 -0
  35. package/components/RadioButton/RadioButton.types.ts +33 -0
  36. package/components/RadioButton/RadioButton.variants.ts +67 -0
  37. package/components/RadioButton/index.ts +1 -0
  38. package/components/SegmentedButton/SegmentedButton.styles.ts +29 -29
  39. package/components/SegmentedButton/SegmentedButton.tsx +43 -49
  40. package/components/SegmentedButton/SegmentedButton.types.ts +20 -20
  41. package/components/SegmentedButton/index.ts +1 -1
  42. package/components/Select/Select.sizes.ts +55 -56
  43. package/components/Select/Select.states.tsx +40 -69
  44. package/components/Select/Select.styles.ts +162 -148
  45. package/components/Select/Select.tsx +152 -144
  46. package/components/Select/Select.types.ts +35 -36
  47. package/components/Select/index.ts +1 -1
  48. package/components/Text/Text.styles.ts +46 -43
  49. package/components/Text/Text.tsx +27 -27
  50. package/components/Text/Text.types.ts +44 -42
  51. package/components/Text/index.ts +1 -1
  52. package/components/TextField/TextField.sizes.ts +52 -58
  53. package/components/TextField/TextField.states.tsx +53 -76
  54. package/components/TextField/TextField.styles.ts +85 -98
  55. package/components/TextField/TextField.tsx +108 -108
  56. package/components/TextField/TextField.types.ts +22 -21
  57. package/components/TextField/index.ts +2 -2
  58. package/components/TextField/utils/getState.ts +7 -0
  59. package/components/ThemeProvider/ThemeProvider.tsx +21 -21
  60. package/components/ThemeProvider/index.ts +1 -1
  61. package/components/ThemeProvider/style.ts +969 -969
  62. package/components/Wizard/StepContent.tsx +28 -28
  63. package/components/Wizard/StepMenuItem.tsx +33 -33
  64. package/components/Wizard/Wizard.context.tsx +76 -76
  65. package/components/Wizard/Wizard.styles.ts +126 -126
  66. package/components/Wizard/Wizard.tsx +55 -55
  67. package/components/Wizard/index.ts +1 -1
  68. package/components/index.ts +14 -11
  69. package/package.json +41 -41
  70. package/scripts/createTypes.js +70 -70
  71. package/utils/colorDarken.ts +10 -10
  72. package/utils/colorLighten.ts +10 -10
  73. package/utils/darkenOrLighen.ts +19 -19
  74. package/utils/getTextColor.ts +12 -12
  75. package/utils/index.ts +5 -5
  76. package/utils/parseColor.ts +7 -7
@@ -1,36 +1,35 @@
1
- import { FieldValues, UseFormRegisterReturn } from 'react-hook-form'
2
- export interface SelectProps<TFieldValues extends FieldValues = FieldValues> {
3
- className?: string
4
- disabled?: boolean
5
- error?: TFieldValues
6
- label: string
7
- options: Array<{ label: string; value: string }>
8
- value?: string
9
- defaultValue?: string
10
- handleLeftIcon?: () => void
11
- helperText?: string
12
- leftIcon?: React.ReactNode
13
- onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
14
- size?: 'sm' | 'md' | 'lg'
15
- register?: UseFormRegisterReturn<string>
16
- }
17
-
18
- export interface StateInterface {
19
- input: string
20
- label: string
21
- helperText: string
22
- animation?: string
23
- }
24
-
25
- export interface TextFieldStates {
26
- error: StateInterface
27
- default: StateInterface
28
- disabled: StateInterface
29
- }
30
-
31
- export type TextFieldSize = 'sm' | 'md' | 'lg'
32
-
33
- export type TextFieldSizeType = {
34
- input: string
35
- label: string
36
- }
1
+ import { FieldValues, UseFormRegisterReturn } from 'react-hook-form'
2
+ export interface SelectProps<TFieldValues extends FieldValues = FieldValues> {
3
+ className?: string
4
+ disabled?: boolean
5
+ error?: TFieldValues
6
+ label?: string
7
+ options: Array<{ label: string; value: string }>
8
+ value?: string
9
+ defaultValue?: string
10
+ handleLeftIcon?: () => void
11
+ helperText?: string
12
+ leftIcon?: React.ReactNode
13
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
14
+ size?: 'sm' | 'md' | 'lg'
15
+ register?: UseFormRegisterReturn<string>
16
+ }
17
+
18
+ export interface StateInterface {
19
+ input: string
20
+ label: string
21
+ helperText: string
22
+ }
23
+
24
+ export interface TextFieldStates {
25
+ error: StateInterface
26
+ default: StateInterface
27
+ disabled: StateInterface
28
+ }
29
+
30
+ export type TextFieldSize = 'sm' | 'md' | 'lg'
31
+
32
+ export type TextFieldSizeType = {
33
+ input: string
34
+ label: string
35
+ }
@@ -1 +1 @@
1
- export { default } from './Select'
1
+ export { default } from './Select'
@@ -1,43 +1,46 @@
1
- import { parseColor } from '../../utils'
2
- import styled, { css } from 'styled-components'
3
- import {
4
- fontSize,
5
- fontWeight,
6
- lineHeight,
7
- fontFamily
8
- } from '@liguelead/foundation'
9
- import { TextProps } from './Text.types'
10
-
11
- type BodyProps = Omit<TextProps, 'tag'>
12
-
13
- const Body = styled.p.withConfig({
14
- shouldForwardProp: prop =>
15
- !['color', 'margin', 'isTitle', 'size', 'align', 'weight'].includes(
16
- prop
17
- )
18
- })<BodyProps>`
19
- position: relative;
20
-
21
- ${({
22
- align = 'left',
23
- color = 'neutral800',
24
- isTitle,
25
- theme,
26
- size = 'body01'
27
- }) => css`
28
- text-align: ${align};
29
- color: ${parseColor(theme.colors[color] || theme.colors.neutral800)};
30
- font-family: '${isTitle
31
- ? fontFamily[theme.fonts.headings]
32
- : fontFamily[theme.fonts.default]}',
33
- sans-serif;
34
- font-weight: ${fontWeight[theme.typography[size]?.fontWeight] ||
35
- 'normal'};
36
- font-size: ${fontSize[theme.typography[size]?.fontSize] ||
37
- fontSize.fontSize16}px;
38
- line-height: ${lineHeight[theme.typography[size]?.lineHeight] ||
39
- lineHeight.lineHeight24}px;
40
- `}
41
- `
42
-
43
- export { Body }
1
+ import { parseColor } from '../../utils'
2
+ import styled, { css } from 'styled-components'
3
+ import {
4
+ fontSize,
5
+ fontWeight,
6
+ lineHeight,
7
+ fontFamily
8
+ } from '@liguelead/foundation'
9
+ import { TextProps } from './Text.types'
10
+
11
+ type BodyProps = Omit<TextProps, 'tag'>
12
+
13
+ const Body = styled.p.withConfig({
14
+ shouldForwardProp: prop =>
15
+ !['color', 'margin', 'isTitle', 'size', 'align', 'weight'].includes(
16
+ prop
17
+ )
18
+ })<BodyProps>`
19
+ position: relative;
20
+
21
+ ${({
22
+ align = 'left',
23
+ color = 'textMedium',
24
+ isTitle,
25
+ theme,
26
+ size = 'body01',
27
+ weight
28
+ }) => css`
29
+ text-align: ${align};
30
+ color: ${parseColor(theme.colors[color] || theme.colors.textMedium)};
31
+ font-family: '${isTitle
32
+ ? fontFamily[theme.fonts?.headings as keyof typeof fontFamily]
33
+ : fontFamily[theme.fonts?.default as keyof typeof fontFamily]}',
34
+ sans-serif;
35
+ font-weight: ${weight
36
+ ? fontWeight[weight as keyof typeof fontWeight]
37
+ : fontWeight[theme.typography[size]?.fontWeight as keyof typeof fontWeight] ||
38
+ 'normal'};
39
+ font-size: ${fontSize[theme.typography[size]?.fontSize as keyof typeof fontSize] ||
40
+ fontSize.fontSize16}px;
41
+ line-height: ${lineHeight[theme.typography[size]?.lineHeight as keyof typeof lineHeight] ||
42
+ lineHeight.lineHeight24}px;
43
+ `}
44
+ `
45
+
46
+ export { Body }
@@ -1,27 +1,27 @@
1
- import React from 'react'
2
- import { Body } from './Text.styles'
3
- import { TextProps } from './Text.types'
4
-
5
- const Text: React.FC<TextProps> = ({
6
- align,
7
- children,
8
- color = 'neutral1000',
9
- isTitle = false,
10
- tag = 'p',
11
- size,
12
- ...rest
13
- }) => {
14
- return (
15
- <Body
16
- as={isTitle ? 'h2' : tag}
17
- align={align}
18
- color={color}
19
- size={size}
20
- isTitle={isTitle}
21
- {...rest}>
22
- {children}
23
- </Body>
24
- )
25
- }
26
-
27
- export default Text
1
+ import React from 'react'
2
+ import { Body } from './Text.styles'
3
+ import { TextProps } from './Text.types'
4
+
5
+ const Text: React.FC<TextProps> = ({
6
+ align,
7
+ children,
8
+ color = 'textDark',
9
+ isTitle = false,
10
+ tag = 'p',
11
+ size,
12
+ ...rest
13
+ }) => {
14
+ return (
15
+ <Body
16
+ as={isTitle ? 'h2' : tag}
17
+ align={align}
18
+ color={color as string}
19
+ size={size}
20
+ isTitle={isTitle}
21
+ {...rest}>
22
+ {children}
23
+ </Body>
24
+ )
25
+ }
26
+
27
+ export default Text
@@ -1,42 +1,44 @@
1
- import { colorType } from 'types'
2
- import { ReactNode } from 'react'
3
-
4
- type AlignType = 'left' | 'center' | 'right' | 'justify'
5
-
6
- type SizeType =
7
- | 'span01'
8
- | 'body01'
9
- | 'body02'
10
- | 'heading01'
11
- | 'heading02'
12
- | 'heading03'
13
- | 'heading04'
14
-
15
- type TagType =
16
- | 'h1'
17
- | 'h2'
18
- | 'h3'
19
- | 'h4'
20
- | 'h5'
21
- | 'h6'
22
- | 'p'
23
- | 'span'
24
- | 'label'
25
- | 'small'
26
- | 'b'
27
- | 'i'
28
- | 'em'
29
- | 'td'
30
- | 'div'
31
- | 'a'
32
-
33
- export interface TextProps {
34
- align?: AlignType
35
- children?: ReactNode
36
- color?: colorType
37
- isTitle?: boolean
38
- tag?: TagType
39
- size?: SizeType
40
- weight?: string
41
- className?: string
42
- }
1
+ import { colorType } from 'types'
2
+ import { ReactNode } from 'react'
3
+
4
+ type AlignType = 'left' | 'center' | 'right' | 'justify'
5
+
6
+ type SizeType =
7
+ | 'span01'
8
+ | 'body01'
9
+ | 'body02'
10
+ | 'heading01'
11
+ | 'heading02'
12
+ | 'heading03'
13
+ | 'heading04'
14
+
15
+ type TagType =
16
+ | 'h1'
17
+ | 'h2'
18
+ | 'h3'
19
+ | 'h4'
20
+ | 'h5'
21
+ | 'h6'
22
+ | 'p'
23
+ | 'span'
24
+ | 'label'
25
+ | 'small'
26
+ | 'b'
27
+ | 'i'
28
+ | 'em'
29
+ | 'td'
30
+ | 'div'
31
+ | 'a'
32
+
33
+ type WeightType = 'fontWeight400' | 'fontWeight500' | 'fontWeight600' | 'fontWeight700'
34
+
35
+ export interface TextProps {
36
+ align?: AlignType
37
+ children?: ReactNode
38
+ color?: colorType
39
+ isTitle?: boolean
40
+ tag?: TagType
41
+ size?: SizeType
42
+ weight?: WeightType
43
+ className?: string
44
+ }
@@ -1 +1 @@
1
- export { default } from './Text'
1
+ export { default } from './Text'
@@ -1,58 +1,52 @@
1
- import { fontSize, lineHeight, spacing } from '@liguelead/foundation'
2
-
3
- export type TextFieldSize = 'sm' | 'md' | 'lg'
4
-
5
- export type TextFieldSizeType = {
6
- input: string
7
- label: string
8
- }
9
-
10
- export const textFieldSizes = (size: TextFieldSize, leftIcon: boolean, rightIcon: boolean) => {
11
- const withIconMargin = Number(spacing.spacing8) + 20
12
- const withIconPadding = {
13
- sm: Number(spacing.spacing12) + Number(withIconMargin),
14
- md: Number(spacing.spacing16) + Number(withIconMargin),
15
- lg: Number(spacing.spacing16) + Number(withIconMargin)
16
- }
17
-
18
- const sizes = {
19
- sm: {
20
- input: `
21
- font-size: ${fontSize.fontSize14}px;
22
- line-height: ${lineHeight.lineHeight22}px;
23
- padding: ${spacing.spacing8}px ${spacing.spacing12}px;
24
- padding-left: ${leftIcon ? withIconPadding.sm : spacing.spacing12}px;
25
- padding-right: ${rightIcon ? withIconPadding.sm : spacing.spacing12}px;
26
- `,
27
- label: `font-size: ${fontSize.fontSize14}px;
28
- margin-left: ${leftIcon ? withIconMargin : 0}px;
29
- margin-right: ${rightIcon ? withIconMargin : 0}px;`
30
- },
31
- md: {
32
- input: `
33
- font-size: ${fontSize.fontSize14}px;
34
- line-height: ${lineHeight.lineHeight20}px;
35
- padding: ${spacing.spacing12}px ${spacing.spacing16}px;
36
- padding-left: ${leftIcon ? withIconPadding.md : spacing.spacing16}px;
37
- padding-right: ${rightIcon ? withIconPadding.md : spacing.spacing16}px;
38
- `,
39
- label: `font-size: ${fontSize.fontSize14}px;
40
- margin-left: ${leftIcon ? withIconMargin : 0}px;
41
- margin-right: ${rightIcon ? withIconMargin : 0}px;`
42
- },
43
- lg: {
44
- input: `
45
- font-size: ${fontSize.fontSize16}px;
46
- line-height: ${lineHeight.lineHeight24}px;
47
- padding: ${spacing.spacing12}px ${spacing.spacing16}px;
48
- padding-left: ${leftIcon ? withIconPadding.lg : spacing.spacing16}px;
49
- padding-right: ${rightIcon ? withIconPadding.lg : spacing.spacing16}px;
50
- `,
51
- label: `font-size: ${fontSize.fontSize16}px;
52
- margin-left: ${leftIcon ? withIconMargin : 0}px;
53
- margin-right: ${rightIcon ? withIconMargin : 0}px;`
54
- }
55
- }
56
-
57
- return sizes[size]
58
- }
1
+ import { fontSize, lineHeight, spacing } from '@liguelead/foundation'
2
+
3
+ export type TextFieldSize = 'sm' | 'md' | 'lg'
4
+
5
+ export type TextFieldSizeType = {
6
+ input: string
7
+ label: string
8
+ }
9
+
10
+ export const textFieldSizes = (size: TextFieldSize, leftIcon: boolean, rightIcon: boolean) => {
11
+ const withIconMargin = Number(spacing.spacing8) + 20
12
+ const withIconPadding = {
13
+ sm: Number(spacing.spacing12) + Number(withIconMargin),
14
+ md: Number(spacing.spacing16) + Number(withIconMargin),
15
+ lg: Number(spacing.spacing16) + Number(withIconMargin)
16
+ }
17
+
18
+ const sizes = {
19
+ sm: {
20
+ input: `
21
+ font-size: ${fontSize.fontSize14}px;
22
+ line-height: ${lineHeight.lineHeight22}px;
23
+ padding: ${spacing.spacing8}px ${spacing.spacing12}px;
24
+ padding-left: ${leftIcon ? withIconPadding.sm : spacing.spacing12}px;
25
+ padding-right: ${rightIcon ? withIconPadding.sm : spacing.spacing12}px;
26
+ `,
27
+ label: `font-size: ${fontSize.fontSize14}px;`
28
+ },
29
+ md: {
30
+ input: `
31
+ font-size: ${fontSize.fontSize14}px;
32
+ line-height: ${lineHeight.lineHeight20}px;
33
+ padding: ${spacing.spacing12}px ${spacing.spacing16}px;
34
+ padding-left: ${leftIcon ? withIconPadding.md : spacing.spacing16}px;
35
+ padding-right: ${rightIcon ? withIconPadding.md : spacing.spacing16}px;
36
+ `,
37
+ label: `font-size: ${fontSize.fontSize14}px;`
38
+ },
39
+ lg: {
40
+ input: `
41
+ font-size: ${fontSize.fontSize16}px;
42
+ line-height: ${lineHeight.lineHeight24}px;
43
+ padding: ${spacing.spacing12}px ${spacing.spacing16}px;
44
+ padding-left: ${leftIcon ? withIconPadding.lg : spacing.spacing16}px;
45
+ padding-right: ${rightIcon ? withIconPadding.lg : spacing.spacing16}px;
46
+ `,
47
+ label: `font-size: ${fontSize.fontSize16}px;`
48
+ }
49
+ }
50
+
51
+ return sizes[size]
52
+ }
@@ -1,76 +1,53 @@
1
- import {parseColor} from '../../utils'
2
- import {useTheme} from 'styled-components'
3
- import {fontWeight, fontSize} from '@liguelead/foundation'
4
-
5
- export interface StateInterface {
6
- input: string
7
- label: string
8
- helperText: string
9
- animation?: string
10
- }
11
-
12
- interface TextFieldStates {
13
- error: StateInterface
14
- default: StateInterface
15
- disabled: StateInterface
16
- }
17
-
18
- export const TextFieldStates = (state: keyof TextFieldStates) => {
19
- const theme = useTheme()
20
- const states: TextFieldStates = {
21
- error: {
22
- input: `
23
- border: 1px solid ${parseColor(theme.colors.danger100)};
24
- color: ${parseColor(theme.colors.neutral1000)};
25
- &:focus {
26
- border-color: ${parseColor(theme.colors.danger100)};
27
- }
28
- &:focus + label {
29
- color: ${parseColor(theme.colors.danger100)};
30
- }
31
- `,
32
- label: `color: ${parseColor(theme.colors.danger100)};`,
33
- helperText: `color: ${parseColor(theme.colors.danger100)};`,
34
- animation: `
35
- &:focus + label,
36
- &:not(:placeholder-shown) + label {
37
- top: 0px;
38
- left: 12px;
39
- font-size: ${fontSize.fontSize12}px;
40
- }`
41
- },
42
- default: {
43
- input: `
44
- border: 1px solid ${parseColor(theme.colors.neutral700)};
45
- color: ${parseColor(theme.colors.neutral1000)};
46
- &:focus {
47
- border-color: ${parseColor(theme.colors.primary)};
48
- }
49
- &:focus + label {
50
- color: ${parseColor(theme.colors.primary)};
51
- font-weight: ${fontWeight.fontWeight600};
52
- }
53
- `,
54
- label: `color: ${parseColor(theme.colors.neutral800)};`,
55
- helperText: `color: ${parseColor(theme.colors.neutral700)};`,
56
- animation: `
57
- &:focus + label,
58
- &:not(:placeholder-shown) + label {
59
- top: 0px;
60
- left: 12px;
61
- font-size: ${fontSize.fontSize12}px;
62
- }`
63
- },
64
- disabled: {
65
- input: `
66
- border: 1px solid ${parseColor(theme.colors.neutral500)};
67
- color: ${parseColor(theme.colors.neutral600)};
68
- `,
69
- label: `color: ${parseColor(theme.colors.neutral500)};
70
- background: transparent;`,
71
- helperText: `color: ${parseColor(theme.colors.neutral500)};`,
72
- animation: ``
73
- }
74
- }
75
- return states[state]
76
- }
1
+ import { parseColor } from '../../utils'
2
+ import { useTheme } from 'styled-components'
3
+ import { shadow } from '@liguelead/foundation'
4
+ export interface StateInterface {
5
+ input: string
6
+ label?: string
7
+ helperText: string
8
+ }
9
+
10
+ interface TextFieldStates {
11
+ error: StateInterface
12
+ default: StateInterface
13
+ disabled: StateInterface
14
+ }
15
+
16
+ export const TextFieldStates = (state: keyof TextFieldStates) => {
17
+ const theme = useTheme()
18
+ const states: TextFieldStates = {
19
+ error: {
20
+ input: `
21
+ border: 1px solid ${parseColor(theme.colors.danger200)};
22
+ color: ${parseColor(theme.colors.textDark)};
23
+ &:focus {
24
+ border-color: ${parseColor(theme.colors.danger200)};
25
+ box-shadow: ${shadow.errorShadow};
26
+ }
27
+ `,
28
+ label: `color: ${parseColor(theme.colors.danger100)};`,
29
+ helperText: `color: ${parseColor(theme.colors.danger100)};`,
30
+ },
31
+ default: {
32
+ input: `
33
+ border: 1px solid ${parseColor(theme.colors.neutral400)};
34
+ color: ${parseColor(theme.colors.textDark)};
35
+ &:focus {
36
+ border-color: ${parseColor(theme.colors.neutral700)};
37
+ box-shadow: ${shadow.focusShadow};
38
+ }
39
+ `,
40
+ label: `color: ${parseColor(theme.colors.textDark)};`,
41
+ helperText: `color: ${parseColor(theme.colors.textMedium)};`,
42
+ },
43
+ disabled: {
44
+ input: `
45
+ color: ${parseColor(theme.colors.textDark)};
46
+ box-shadow: 0 1px 2px 0 #0000000D;
47
+ opacity: 0.5;
48
+ `,
49
+ helperText: `color: ${parseColor(theme.colors.neutral500)};`,
50
+ }
51
+ }
52
+ return states[state]
53
+ }