wini-web-components 2.8.4 → 2.8.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 (130) hide show
  1. package/dist/index.js.js +11 -11
  2. package/dist/index.js.mjs +745 -882
  3. package/global.d.ts +6 -0
  4. package/package.json +3 -4
  5. package/dist/component/button/button.d.ts +0 -22
  6. package/dist/component/button/button.d.ts.map +0 -1
  7. package/dist/component/calendar/calendar.d.ts +0 -31
  8. package/dist/component/calendar/calendar.d.ts.map +0 -1
  9. package/dist/component/carousel/carousel.d.ts +0 -32
  10. package/dist/component/carousel/carousel.d.ts.map +0 -1
  11. package/dist/component/checkbox/checkbox.d.ts +0 -25
  12. package/dist/component/checkbox/checkbox.d.ts.map +0 -1
  13. package/dist/component/ck-editor/ckeditor.d.ts +0 -36
  14. package/dist/component/ck-editor/ckeditor.d.ts.map +0 -1
  15. package/dist/component/component-status.d.ts +0 -8
  16. package/dist/component/component-status.d.ts.map +0 -1
  17. package/dist/component/date-time-picker/date-time-picker.d.ts +0 -36
  18. package/dist/component/date-time-picker/date-time-picker.d.ts.map +0 -1
  19. package/dist/component/dialog/dialog.d.ts +0 -18
  20. package/dist/component/dialog/dialog.d.ts.map +0 -1
  21. package/dist/component/import-file/import-file.d.ts +0 -34
  22. package/dist/component/import-file/import-file.d.ts.map +0 -1
  23. package/dist/component/infinite-scroll/infinite-scroll.d.ts +0 -18
  24. package/dist/component/infinite-scroll/infinite-scroll.d.ts.map +0 -1
  25. package/dist/component/input-multi-select/input-multi-select.d.ts +0 -22
  26. package/dist/component/input-multi-select/input-multi-select.d.ts.map +0 -1
  27. package/dist/component/input-otp/input-otp.d.ts +0 -23
  28. package/dist/component/input-otp/input-otp.d.ts.map +0 -1
  29. package/dist/component/number-picker/number-picker.d.ts +0 -24
  30. package/dist/component/number-picker/number-picker.d.ts.map +0 -1
  31. package/dist/component/pagination/pagination.d.ts +0 -14
  32. package/dist/component/pagination/pagination.d.ts.map +0 -1
  33. package/dist/component/popup/popup.d.ts +0 -40
  34. package/dist/component/popup/popup.d.ts.map +0 -1
  35. package/dist/component/progress-bar/progress-bar.d.ts +0 -16
  36. package/dist/component/progress-bar/progress-bar.d.ts.map +0 -1
  37. package/dist/component/progress-circle/progress-circle.d.ts +0 -13
  38. package/dist/component/progress-circle/progress-circle.d.ts.map +0 -1
  39. package/dist/component/radio-button/radio-button.d.ts +0 -21
  40. package/dist/component/radio-button/radio-button.d.ts.map +0 -1
  41. package/dist/component/rating/rating.d.ts +0 -24
  42. package/dist/component/rating/rating.d.ts.map +0 -1
  43. package/dist/component/select1/select1.d.ts +0 -32
  44. package/dist/component/select1/select1.d.ts.map +0 -1
  45. package/dist/component/switch/switch.d.ts +0 -24
  46. package/dist/component/switch/switch.d.ts.map +0 -1
  47. package/dist/component/table/table.d.ts +0 -51
  48. package/dist/component/table/table.d.ts.map +0 -1
  49. package/dist/component/tag/tag.d.ts +0 -23
  50. package/dist/component/tag/tag.d.ts.map +0 -1
  51. package/dist/component/text/text.d.ts +0 -16
  52. package/dist/component/text/text.d.ts.map +0 -1
  53. package/dist/component/text-area/text-area.d.ts +0 -28
  54. package/dist/component/text-area/text-area.d.ts.map +0 -1
  55. package/dist/component/text-field/text-field.d.ts +0 -37
  56. package/dist/component/text-field/text-field.d.ts.map +0 -1
  57. package/dist/component/toast-noti/toast-noti.d.ts +0 -5
  58. package/dist/component/toast-noti/toast-noti.d.ts.map +0 -1
  59. package/dist/component/wini-icon/winicon.d.ts +0 -27
  60. package/dist/component/wini-icon/winicon.d.ts.map +0 -1
  61. package/dist/form/login/view.d.ts +0 -41
  62. package/dist/form/login/view.d.ts.map +0 -1
  63. package/dist/index.d.ts +0 -34
  64. package/dist/index.d.ts.map +0 -1
  65. package/dist/language/i18n.d.ts +0 -3
  66. package/dist/language/i18n.d.ts.map +0 -1
  67. package/src/component/button/button.module.css +0 -210
  68. package/src/component/button/button.tsx +0 -57
  69. package/src/component/calendar/calendar.module.css +0 -153
  70. package/src/component/calendar/calendar.tsx +0 -389
  71. package/src/component/carousel/carousel.css +0 -622
  72. package/src/component/carousel/carousel.tsx +0 -91
  73. package/src/component/checkbox/checkbox.module.css +0 -48
  74. package/src/component/checkbox/checkbox.tsx +0 -80
  75. package/src/component/ck-editor/ck-editor.css +0 -206
  76. package/src/component/ck-editor/ckeditor.tsx +0 -522
  77. package/src/component/component-status.tsx +0 -53
  78. package/src/component/date-time-picker/date-time-picker.module.css +0 -94
  79. package/src/component/date-time-picker/date-time-picker.tsx +0 -663
  80. package/src/component/dialog/dialog.module.css +0 -111
  81. package/src/component/dialog/dialog.tsx +0 -109
  82. package/src/component/import-file/import-file.module.css +0 -83
  83. package/src/component/import-file/import-file.tsx +0 -174
  84. package/src/component/infinite-scroll/infinite-scroll.module.css +0 -34
  85. package/src/component/infinite-scroll/infinite-scroll.tsx +0 -35
  86. package/src/component/input-multi-select/input-multi-select.module.css +0 -121
  87. package/src/component/input-multi-select/input-multi-select.tsx +0 -263
  88. package/src/component/input-otp/input-otp.module.css +0 -41
  89. package/src/component/input-otp/input-otp.tsx +0 -110
  90. package/src/component/number-picker/number-picker.module.css +0 -137
  91. package/src/component/number-picker/number-picker.tsx +0 -107
  92. package/src/component/pagination/pagination.module.css +0 -48
  93. package/src/component/pagination/pagination.tsx +0 -88
  94. package/src/component/popup/popup.css +0 -136
  95. package/src/component/popup/popup.tsx +0 -125
  96. package/src/component/progress-bar/progress-bar.module.css +0 -42
  97. package/src/component/progress-bar/progress-bar.tsx +0 -33
  98. package/src/component/progress-circle/progress-circle.css +0 -0
  99. package/src/component/progress-circle/progress-circle.tsx +0 -25
  100. package/src/component/radio-button/radio-button.module.css +0 -51
  101. package/src/component/radio-button/radio-button.tsx +0 -60
  102. package/src/component/rating/rating.module.css +0 -11
  103. package/src/component/rating/rating.tsx +0 -65
  104. package/src/component/select1/select1.module.css +0 -108
  105. package/src/component/select1/select1.tsx +0 -271
  106. package/src/component/switch/switch.module.css +0 -53
  107. package/src/component/switch/switch.tsx +0 -68
  108. package/src/component/table/table.css +0 -74
  109. package/src/component/table/table.tsx +0 -108
  110. package/src/component/tag/tag.module.css +0 -108
  111. package/src/component/tag/tag.tsx +0 -31
  112. package/src/component/text/text.css +0 -27
  113. package/src/component/text/text.tsx +0 -24
  114. package/src/component/text-area/text-area.module.css +0 -57
  115. package/src/component/text-area/text-area.tsx +0 -65
  116. package/src/component/text-field/text-field.module.css +0 -71
  117. package/src/component/text-field/text-field.tsx +0 -102
  118. package/src/component/toast-noti/toast-noti.css +0 -866
  119. package/src/component/toast-noti/toast-noti.tsx +0 -22
  120. package/src/component/wini-icon/winicon.module.css +0 -110
  121. package/src/component/wini-icon/winicon.tsx +0 -9424
  122. package/src/form/login/view.module.css +0 -80
  123. package/src/form/login/view.tsx +0 -138
  124. package/src/global.d.ts +0 -5
  125. package/src/index.tsx +0 -66
  126. package/src/language/i18n.tsx +0 -143
  127. package/src/skin/layout.css +0 -649
  128. package/src/skin/root.css +0 -294
  129. package/src/skin/typography.css +0 -314
  130. package/src/vite-env.d.ts +0 -1
@@ -1,108 +0,0 @@
1
- import React, { CSSProperties, MouseEventHandler, ReactNode } from 'react';
2
- import './table.css'
3
-
4
- export enum CellAlignItems {
5
- start = 'start',
6
- center = 'center',
7
- end = 'end',
8
- }
9
-
10
- type TbCellProps = {
11
- id?: string,
12
- fixed?: boolean,
13
- children?: ReactNode,
14
- className?: string,
15
- style?: CSSProperties,
16
- align?: CellAlignItems | string,
17
- onClick?: React.MouseEventHandler<HTMLTableDataCellElement>
18
- }
19
-
20
- export class TbCell extends React.Component<TbCellProps> {
21
- render(): React.ReactNode {
22
- return <td id={this.props.id} onClick={this.props.onClick} style={this.props.style} align-cell={this.props.align ?? CellAlignItems.start} className={`tb-cell ${this.props.className ?? ''} ${this.props.fixed ? 'tb-cell-fixed' : ''}`}>{this.props.children}</td>
23
- }
24
- }
25
-
26
- interface TbRowProps {
27
- id?: string,
28
- children?: Array<TbCell>,
29
- className?: string,
30
- style?: CSSProperties,
31
- onClick?: MouseEventHandler<HTMLTableRowElement>,
32
- }
33
-
34
-
35
- export class TbRow extends React.Component<TbRowProps> {
36
- render(): React.ReactNode {
37
- return <tr id={this.props.id} style={this.props.style} className={`tb-row ${this.props.className ?? ""}`} onClick={this.props.onClick}>
38
- {(this.props.children ?? []).map((e: TbCell, i: number) => {
39
- let ox: number | string = 0
40
- if (this.props.children && i > 0 && i < (this.props.children.length - 1)) {
41
- ox = `calc(${this.props.children.slice(0, i).map(tb => {
42
- const wValue = tb.props.style?.minWidth ?? tb.props.style?.width
43
- return wValue ? typeof wValue === 'number' ? `${wValue}px` : wValue : '60px';
44
- }).join(" + ")})`
45
- }
46
- return <TbCell
47
- id={e.props.id}
48
- key={`tb-cell-${i}`}
49
- align={e.props.align}
50
- children={e.props.children}
51
- fixed={e.props.fixed}
52
- onClick={e.props.onClick}
53
- style={e.props.fixed ? (this.props.children && i === this.props.children.length - 1) ? { right: 0, ...(e.props.style ?? {}) } : { left: ox, ...(e.props.style ?? {}) } : e.props.style}
54
- className={e.props.className} />;
55
- })}
56
- </tr>
57
- }
58
- }
59
-
60
- export class TbHeader extends React.Component<TbRowProps> {
61
- render() {
62
- return <thead style={this.props.style} className={`tb-header ${this.props.className ?? ""}`}>
63
- <tr>
64
- {(this.props.children ?? []).map((e: TbCell, i: number) => {
65
- let ox: number | string = 0
66
- if (this.props.children && i > 0 && i < (this.props.children.length - 1)) {
67
- ox = `calc(${this.props.children.slice(0, i).map(tb => tb.props.style?.width ? typeof tb.props.style.width === 'number' ? `${tb.props.style.width}px` : tb.props.style.width : '60px').join(" + ")})`
68
- }
69
- return <TbCell
70
- id={e.props.id}
71
- key={`tb-cell-${i}`}
72
- align={e.props.align}
73
- children={e.props.children}
74
- onClick={e.props.onClick}
75
- fixed={e.props.fixed}
76
- style={e.props.fixed ? (this.props.children && i === this.props.children.length - 1) ? { right: 0, ...(e.props.style ?? {}) } : { left: ox, ...(e.props.style ?? {}) } : e.props.style}
77
- className={e.props.className} />;
78
- })}
79
- </tr>
80
- </thead>
81
- }
82
- }
83
-
84
- interface TbBodyProps {
85
- id?: string,
86
- children?: Array<TbRow>,
87
- className?: string,
88
- style?: CSSProperties,
89
- }
90
-
91
- export class TbBody extends React.Component<TbBodyProps> {
92
- render(): React.ReactNode {
93
- return <tbody id={this.props.id}>{this.props.children as ReactNode}</tbody>
94
- }
95
- }
96
-
97
- interface TableProps {
98
- id?: string,
99
- children?: Array<TbBody | TbHeader>,
100
- className?: string,
101
- style?: CSSProperties,
102
- }
103
-
104
- export class Table extends React.Component<TableProps> {
105
- render(): React.ReactNode {
106
- return <table id={this.props.id} className={`custom-table ${this.props.className}`} style={this.props.style}>{this.props.children as ReactNode}</table>
107
- }
108
- }
@@ -1,108 +0,0 @@
1
- .tag-container {
2
- padding: 3px 7px;
3
- border-radius: 100rem;
4
- gap: 6px;
5
- justify-content: center;
6
- color: var(--neutral-text-subtitle-color, #61616B);
7
- border: var(--neutral-bolder-border);
8
- }
9
-
10
- .tag-container[class~="dashed"] {
11
- border-style: dashed;
12
- }
13
-
14
- .tag-container[class~="size32"] {
15
- padding: 4px 11px;
16
- gap: 8px;
17
- }
18
-
19
- .tag-container.type-button {
20
- cursor: pointer;
21
- }
22
-
23
- .tag-container>.tag-label {
24
- color: inherit;
25
- font: inherit;
26
- font-size: inherit;
27
- font-family: inherit;
28
- line-height: inherit;
29
- font-weight: inherit;
30
- text-align: inherit;
31
- letter-spacing: inherit;
32
- }
33
-
34
- .tag-container.disabled {
35
- color: var(--neutral-text-disabled-color);
36
- background-color: var(--neutral-disable-background-color) !important;
37
- border-color: var(--neutral-disable-background-color) !important;
38
- pointer-events: none !important;
39
- }
40
-
41
- .tag-container[class~="tag-primary"] {
42
- background-color: var(--primary-main-color) !important;
43
- border-color: var(--primary-main-color) !important;
44
- }
45
-
46
- .tag-container[class~="tag-primary"] * {
47
- color: var(--neutral-text-stable-color) !important;
48
- --color: var(--neutral-text-stable-color) !important;
49
- }
50
-
51
- .tag-container[class~="tag-grey"] {
52
- border-color: var(--neutral-bolder-border-color) !important;
53
- background-color: var(--neutral-main-background-color) !important;
54
- }
55
-
56
- .tag-container[class~="tag-grey"] * {
57
- color: var(--neutral-text-subtitle-color) !important;
58
- --color: var(--neutral-text-subtitle-color) !important;
59
- }
60
-
61
- .tag-container[class~="tag-neutral"] {
62
- border-color: var(--neutral-bolder-border-color) !important;
63
- }
64
-
65
- .tag-container[class~="tag-neutral"] * {
66
- color: var(--neutral-text-subtitle-color) !important;
67
- --color: var(--neutral-text-subtitle-color) !important;
68
- }
69
-
70
- .tag-container[class~="tag-infor"] {
71
- background-color: var(--infor-background);
72
- border-color: var(--infor-main-color) !important;
73
- }
74
-
75
- .tag-container[class~="tag-infor"] * {
76
- color: var(--infor-main-color) !important;
77
- --color: var(--infor-main-color) !important;
78
- }
79
-
80
- .tag-container[class~="tag-warning"] {
81
- background-color: var(--warning-background);
82
- border-color: var(--warning-main-color) !important;
83
- }
84
-
85
- .tag-container[class~="tag-warning"] * {
86
- color: var(--warning-main-color) !important;
87
- --color: var(--warning-main-color) !important;
88
- }
89
-
90
- .tag-container[class~="tag-error"] {
91
- background-color: var(--error-background);
92
- border-color: var(--error-main-color) !important;
93
- }
94
-
95
- .tag-container[class~="tag-error"] * {
96
- color: var(--error-main-color) !important;
97
- --color: var(--error-main-color) !important;
98
- }
99
-
100
- .tag-container[class~="tag-success"] {
101
- background-color: var(--success-background);
102
- border-color: var(--success-main-color) !important;
103
- }
104
-
105
- .tag-container[class~="tag-success"] * {
106
- color: var(--success-main-color) !important;
107
- --color: var(--success-main-color) !important;
108
- }
@@ -1,31 +0,0 @@
1
- import React, { CSSProperties, ReactNode } from 'react';
2
- import { Text } from '../text/text';
3
- import styles from './tag.module.css'
4
- import { ComponentStatus } from '../component-status';
5
-
6
- interface TagProps {
7
- id?: string,
8
- title: string,
9
- prefix?: ReactNode,
10
- suffix?: ReactNode,
11
- disabled?: boolean,
12
- style?: CSSProperties,
13
- /**
14
- * default: size24: button-text-6 \
15
- * recommend: size24: button-text-6 | size32: button-text-4 \
16
- * status tag: tag-primary | tag-infor | tag-warning | tag-error | tag-success | tag-grey | tag-neutral | tag-infor-main | tag-warning-main | tag-error-main | tag-success-main
17
- * */
18
- className?: string,
19
- status?: ComponentStatus,
20
- onClick?: React.MouseEventHandler<HTMLDivElement>
21
- }
22
-
23
- export class Tag extends React.Component<TagProps> {
24
- render() {
25
- return <div id={this.props.id} tag-type={this.props.status ?? 'default'} className={`${styles['tag-container']} row ${this.props.onClick ? styles['type-button'] : ''} ${this.props.disabled ? styles['disabled'] : ""} ${this.props.className ?? "button-text-6"} `} style={this.props.style} onClick={this.props.onClick}>
26
- {this.props.prefix}
27
- <Text maxLine={1} className={styles['tag-label']}>{this.props.title}</Text>
28
- {this.props.suffix}
29
- </div>
30
- }
31
- }
@@ -1,27 +0,0 @@
1
- .comp-text {
2
- display: inline-block;
3
- -webkit-box-orient: vertical;
4
- -webkit-line-clamp: var(--max-line);
5
- overflow: hidden;
6
- text-overflow: ellipsis;
7
- -webkit-box-pack: center;
8
- text-align: start;
9
- vertical-align: middle;
10
- display: -webkit-box;
11
- }
12
-
13
- .comp-text.type-button {
14
- cursor: pointer;
15
- }
16
-
17
- .comp-text.innerhtml * {
18
- -webkit-box-orient: vertical;
19
- overflow: hidden;
20
- text-overflow: ellipsis;
21
- text-align: inherit;
22
- margin: 0;
23
- padding: 0;
24
- font-family: inherit;
25
- font-size: inherit;
26
- -webkit-box-pack: inherit;
27
- }
@@ -1,24 +0,0 @@
1
- import React, { CSSProperties, ReactNode } from 'react';
2
- import './text.css';
3
-
4
- interface TextProps {
5
- id?: string,
6
- children?: ReactNode,
7
- style?: CSSProperties,
8
- className?: string,
9
- maxLine?: number,
10
- onClick?: React.MouseEventHandler<HTMLDivElement>,
11
- onHover?: React.MouseEventHandler<HTMLDivElement>,
12
- html?: string,
13
- }
14
-
15
- export class Text extends React.Component<TextProps> {
16
- render(): React.ReactNode {
17
- let convertStyle: CSSProperties = this.props.style ?? {}
18
- if (this.props.maxLine) {
19
- convertStyle = { ...convertStyle, '--max-line': this.props.maxLine } as CSSProperties
20
- }
21
- return this.props.html ? <div dangerouslySetInnerHTML={{ __html: this.props.html }} id={this.props.id} onMouseOver={this.props.onHover} onClick={this.props.onClick} className={`comp-text innerhtml ${this.props.onClick ? 'type-button' : ''} ${this.props.className ?? ''}`} style={convertStyle} /> :
22
- <div id={this.props.id} onMouseOver={this.props.onHover} onClick={this.props.onClick} className={`comp-text ${this.props.onClick ? 'type-button' : ''} ${this.props.className ?? ''}`} style={convertStyle}>{this.props.children}</div>
23
- }
24
- }
@@ -1,57 +0,0 @@
1
- .text-area-container {
2
- height: 4rem;
3
- position: relative;
4
- gap: 0.8rem;
5
- border-radius: 0.8rem;
6
- border: var(--neutral-bolder-border);
7
- padding: 0.8rem 1.6rem;
8
- align-items: start;
9
- }
10
-
11
- .text-area-container:has(> textarea:disabled) {
12
- background-color: var(--neutral-disable-background-color) !important;
13
- color: var(--neutral-text-disabled-color) !important;
14
- pointer-events: none !important;
15
- }
16
-
17
- .text-area-container:focus-within {
18
- border-color: var(--primary-main-color);
19
- }
20
-
21
- .text-area-container>textarea {
22
- flex: 1;
23
- padding: 0;
24
- width: 100%;
25
- height: inherit;
26
- max-height: 100%;
27
- border: none;
28
- outline: none;
29
- background-color: transparent !important;
30
- font: inherit;
31
- color: inherit;
32
- font-size: inherit;
33
- font-family: inherit;
34
- font-weight: inherit;
35
- line-height: inherit;
36
- text-align: inherit;
37
- text-overflow: inherit;
38
- resize: inherit;
39
- }
40
-
41
- .text-area-container.helper-text {
42
- overflow: visible !important;
43
- border-color: var(--helper-text-color) !important;
44
- }
45
-
46
- .text-area-container.helper-text::after {
47
- content: attr(helper-text);
48
- color: var(--helper-text-color);
49
- position: absolute;
50
- left: 0;
51
- bottom: -0.4rem;
52
- width: max-content;
53
- font-size: 1.2rem;
54
- line-height: 1.6rem;
55
- font-family: inherit;
56
- transform: translateY(100%);
57
- }
@@ -1,65 +0,0 @@
1
- import React, { createRef, CSSProperties } from "react";
2
- import styles from './text-area.module.css'
3
- import { UseFormRegister } from "react-hook-form";
4
-
5
- interface TextAreaProps {
6
- id?: string,
7
- value?: string,
8
- maxLength?: number,
9
- defaultValue?: string,
10
- onChange?: React.ChangeEventHandler<HTMLTextAreaElement>,
11
- onBlur?: React.FocusEventHandler<HTMLTextAreaElement>,
12
- onFocus?: React.FocusEventHandler<HTMLTextAreaElement>,
13
- placeholder?: string,
14
- disabled?: boolean,
15
- readOnly?: boolean,
16
- autoFocus?: boolean,
17
- className?: string,
18
- helperText?: string,
19
- name?: string,
20
- helperTextColor?: string,
21
- style?: CSSProperties,
22
- register?: UseFormRegister<{}>,
23
- }
24
-
25
- export class TextArea extends React.Component<TextAreaProps> {
26
- private containerRef = createRef<HTMLDivElement>()
27
-
28
- getTextarea = () => {
29
- return this.containerRef.current?.querySelector("textarea")
30
- }
31
-
32
- render(): React.ReactNode {
33
- return <div
34
- ref={this.containerRef}
35
- id={this.props.id}
36
- className={`${styles['text-area-container']} row ${this.props.className ?? 'body-3'} ${this.props.helperText?.length ? styles['helper-text'] : ""}`}
37
- helper-text={this.props.helperText}
38
- style={this.props.style ? { ...({ '--helper-text-color': this.props.helperTextColor ?? '#e14337' } as CSSProperties), ...this.props.style } : ({ '--helper-text-color': this.props.helperTextColor ?? '#e14337' } as CSSProperties)}
39
- >
40
- {this.props.register ?
41
- <textarea
42
- name={this.props.name}
43
- autoFocus={this.props.autoFocus}
44
- {...this.props.register}
45
- maxLength={this.props.maxLength}
46
- placeholder={this.props.placeholder}
47
- readOnly={this.props.readOnly}
48
- disabled={this.props.disabled}
49
- onFocus={this.props.onFocus}
50
- /> : <textarea
51
- autoFocus={this.props.autoFocus}
52
- maxLength={this.props.maxLength}
53
- name={this.props.name}
54
- defaultValue={this.props.defaultValue}
55
- value={this.props.value}
56
- placeholder={this.props.placeholder}
57
- readOnly={this.props.readOnly}
58
- disabled={this.props.disabled}
59
- onChange={this.props.onChange}
60
- onFocus={this.props.onFocus}
61
- onBlur={this.props.onBlur}
62
- />}
63
- </div>
64
- }
65
- }
@@ -1,71 +0,0 @@
1
- .text-field-container {
2
- position: relative;
3
- box-sizing: border-box;
4
- padding: 0.8rem 1.5rem;
5
- border: var(--neutral-main-border);
6
- border-radius: 0.8rem;
7
- gap: 0.8rem;
8
- }
9
-
10
- input::-webkit-outer-spin-button,
11
- input::-webkit-inner-spin-button {
12
- -webkit-appearance: none;
13
- margin: 0;
14
- }
15
-
16
- .text-field-container[class~="size48"] {
17
- padding: 1.2rem 1.5rem;
18
- }
19
-
20
- .text-field-container[class~="size32"] {
21
- padding: 0.4rem 1.1rem;
22
- }
23
-
24
- .text-field-container[class~="size24"] {
25
- padding: 0 0.7rem;
26
- }
27
-
28
- .text-field-container:has(> input:disabled) {
29
- background-color: var(--neutral-disable-background-color) !important;
30
- color: var(--neutral-text-disabled-color) !important;
31
- pointer-events: none !important;
32
- }
33
-
34
- .text-field-container:focus-within {
35
- border-color: var(--primary-main-color);
36
- }
37
-
38
- .text-field-container>input {
39
- flex: 1;
40
- width: 100%;
41
- border: none;
42
- outline: none;
43
- padding: 0;
44
- background-color: transparent !important;
45
- font: inherit;
46
- color: inherit;
47
- font-size: inherit;
48
- font-family: inherit;
49
- font-weight: inherit;
50
- line-height: inherit;
51
- text-align: inherit;
52
- text-overflow: inherit;
53
- }
54
-
55
- .text-field-container.helper-text {
56
- overflow: visible !important;
57
- border-color: var(--helper-text-color) !important;
58
- }
59
-
60
- .text-field-container.helper-text::after {
61
- content: attr(helper-text);
62
- color: var(--helper-text-color);
63
- position: absolute;
64
- left: 0;
65
- bottom: -0.4rem;
66
- width: max-content;
67
- font-size: 1.2rem;
68
- line-height: 1.6rem;
69
- font-family: inherit;
70
- transform: translateY(100%);
71
- }
@@ -1,102 +0,0 @@
1
- import React, { createRef, CSSProperties, ReactNode } from "react";
2
- import styles from './text-field.module.css'
3
- import { UseFormRegister } from "react-hook-form";
4
-
5
- interface TextFieldProps {
6
- id?: string,
7
- value?: string,
8
- maxLength?: number,
9
- defaultValue?: string,
10
- onChange?: React.ChangeEventHandler<HTMLInputElement>,
11
- onComplete?: React.KeyboardEventHandler<HTMLInputElement>,
12
- onBlur?: React.FocusEventHandler<HTMLInputElement>,
13
- onFocus?: React.FocusEventHandler<HTMLInputElement>,
14
- placeholder?: string,
15
- disabled?: boolean,
16
- readOnly?: boolean,
17
- /**
18
- * default: size40: body-3
19
- * recommend: size48: body-3 | size32: body-3 | size24: body-3
20
- * */
21
- className?: string,
22
- helperText?: string,
23
- name?: string,
24
- suffix?: ReactNode,
25
- prefix?: ReactNode,
26
- helperTextColor?: string,
27
- style?: CSSProperties,
28
- type?: React.HTMLInputTypeAttribute,
29
- autoFocus?: boolean,
30
- autoComplete?: React.HTMLInputAutoCompleteAttribute,
31
- register?: UseFormRegister<{}>,
32
- }
33
-
34
- export class TextField extends React.Component<TextFieldProps> {
35
- private containerRef = createRef<HTMLDivElement>()
36
-
37
- getInput = () => {
38
- return this.containerRef.current?.querySelector("input")
39
- }
40
-
41
- render(): React.ReactNode {
42
- return <div
43
- ref={this.containerRef}
44
- id={this.props.id}
45
- className={`${styles['text-field-container']} row ${this.props.className ?? 'body-3'} ${this.props.helperText?.length ? styles['helper-text'] : ""}`}
46
- helper-text={this.props.helperText}
47
- style={this.props.style ? { ...({ '--helper-text-color': this.props.helperTextColor ?? '#e14337' } as CSSProperties), ...this.props.style } : ({ '--helper-text-color': this.props.helperTextColor ?? '#e14337' } as CSSProperties)}
48
- >
49
- {this.props.prefix}
50
- {this.props.register ?
51
- <input
52
- name={this.props.name}
53
- {...this.props.register}
54
- autoComplete={this.props.autoComplete}
55
- autoFocus={this.props.autoFocus}
56
- maxLength={this.props.maxLength}
57
- type={this.props.type ?? 'text'}
58
- placeholder={this.props.placeholder}
59
- readOnly={this.props.readOnly}
60
- disabled={this.props.disabled}
61
- onFocus={this.props.onFocus}
62
- onKeyDown={this.props.onComplete ? (ev) => {
63
- if (this.props.onComplete) {
64
- switch (ev.key.toLowerCase()) {
65
- case "enter":
66
- this.props.onComplete(ev)
67
- break;
68
- default:
69
- break;
70
- }
71
- }
72
- } : undefined}
73
- /> : <input
74
- autoComplete={this.props.autoComplete}
75
- autoFocus={this.props.autoFocus}
76
- maxLength={this.props.maxLength}
77
- name={this.props.name}
78
- type={this.props.type ?? 'text'}
79
- defaultValue={this.props.defaultValue}
80
- value={this.props.value}
81
- placeholder={this.props.placeholder}
82
- readOnly={this.props.readOnly}
83
- disabled={this.props.disabled}
84
- onChange={this.props.onChange}
85
- onFocus={this.props.onFocus}
86
- onBlur={this.props.onBlur}
87
- onKeyDown={this.props.onComplete ? (ev) => {
88
- if (this.props.onComplete) {
89
- switch (ev.key.toLowerCase()) {
90
- case "enter":
91
- this.props.onComplete(ev)
92
- break;
93
- default:
94
- break;
95
- }
96
- }
97
- } : undefined}
98
- />}
99
- {this.props.suffix}
100
- </div>
101
- }
102
- }