@charcoal-ui/react 3.0.0-beta.3 → 3.0.0-beta.4

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 (86) hide show
  1. package/dist/_lib/compat.d.ts +18 -0
  2. package/dist/_lib/compat.d.ts.map +1 -1
  3. package/dist/_lib/index.d.ts +7 -0
  4. package/dist/_lib/index.d.ts.map +1 -1
  5. package/dist/components/Checkbox/index.d.ts +1 -0
  6. package/dist/components/Checkbox/index.d.ts.map +1 -1
  7. package/dist/components/Checkbox/index.story.d.ts +1 -0
  8. package/dist/components/Checkbox/index.story.d.ts.map +1 -1
  9. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  10. package/dist/components/LoadingSpinner/index.d.ts +8 -6
  11. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  12. package/dist/components/LoadingSpinner/index.story.d.ts +1 -2
  13. package/dist/components/LoadingSpinner/index.story.d.ts.map +1 -1
  14. package/dist/components/Modal/index.d.ts +17 -26
  15. package/dist/components/Modal/index.d.ts.map +1 -1
  16. package/dist/components/Modal/index.story.d.ts +12 -2
  17. package/dist/components/Modal/index.story.d.ts.map +1 -1
  18. package/dist/components/MultiSelect/index.d.ts +14 -1
  19. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  20. package/dist/components/MultiSelect/index.story.d.ts +14 -2
  21. package/dist/components/MultiSelect/index.story.d.ts.map +1 -1
  22. package/dist/components/Radio/index.d.ts +12 -5
  23. package/dist/components/Radio/index.d.ts.map +1 -1
  24. package/dist/components/Radio/index.story.d.ts +10 -6
  25. package/dist/components/Radio/index.story.d.ts.map +1 -1
  26. package/dist/components/SegmentedControl/index.d.ts +1 -0
  27. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  28. package/dist/components/Switch/index.d.ts +2 -1
  29. package/dist/components/Switch/index.d.ts.map +1 -1
  30. package/dist/components/Switch/index.story.d.ts +1 -2
  31. package/dist/components/Switch/index.story.d.ts.map +1 -1
  32. package/dist/components/TextArea/index.d.ts +3 -10
  33. package/dist/components/TextArea/index.d.ts.map +1 -1
  34. package/dist/components/TextField/TextField.story.d.ts +4 -5
  35. package/dist/components/TextField/TextField.story.d.ts.map +1 -1
  36. package/dist/components/TextField/index.d.ts +6 -29
  37. package/dist/components/TextField/index.d.ts.map +1 -1
  38. package/dist/components/TextField/index.story.d.ts +5 -4
  39. package/dist/components/TextField/index.story.d.ts.map +1 -1
  40. package/dist/index.cjs.js +636 -594
  41. package/dist/index.cjs.js.map +1 -1
  42. package/dist/index.d.ts +2 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.esm.js +604 -563
  45. package/dist/index.esm.js.map +1 -1
  46. package/package.json +6 -6
  47. package/src/_lib/compat.ts +19 -0
  48. package/src/_lib/index.ts +23 -0
  49. package/src/components/Checkbox/index.story.tsx +1 -0
  50. package/src/components/Checkbox/index.tsx +2 -1
  51. package/src/components/DropdownSelector/DropdownMenuItem.tsx +1 -1
  52. package/src/components/DropdownSelector/ListItem/index.story.tsx +1 -1
  53. package/src/components/DropdownSelector/ListItem/index.tsx +1 -1
  54. package/src/components/DropdownSelector/MenuItem/index.tsx +0 -1
  55. package/src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx +1 -1
  56. package/src/components/DropdownSelector/MenuItemGroup/index.tsx +0 -1
  57. package/src/components/DropdownSelector/MenuList/index.story.tsx +0 -1
  58. package/src/components/DropdownSelector/MenuList/index.tsx +1 -1
  59. package/src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx +1 -1
  60. package/src/components/DropdownSelector/Popover/index.story.tsx +1 -1
  61. package/src/components/DropdownSelector/Popover/index.tsx +1 -1
  62. package/src/components/DropdownSelector/index.tsx +16 -14
  63. package/src/components/DropdownSelector/utils/findPreviewRecursive.tsx +2 -1
  64. package/src/components/LoadingSpinner/index.story.tsx +7 -1
  65. package/src/components/LoadingSpinner/index.tsx +27 -11
  66. package/src/components/Modal/index.tsx +18 -12
  67. package/src/components/MultiSelect/index.story.tsx +16 -4
  68. package/src/components/MultiSelect/index.tsx +70 -60
  69. package/src/components/Radio/index.story.tsx +7 -8
  70. package/src/components/Radio/index.test.tsx +3 -3
  71. package/src/components/Radio/index.tsx +23 -23
  72. package/src/components/SegmentedControl/index.tsx +6 -1
  73. package/src/components/Switch/index.tsx +37 -32
  74. package/src/components/TextArea/TextArea.story.tsx +61 -0
  75. package/src/components/TextArea/index.tsx +246 -0
  76. package/src/components/TextField/{index.story.tsx → TextField.story.tsx} +6 -28
  77. package/src/components/TextField/index.tsx +146 -371
  78. package/src/index.ts +1 -2
  79. package/dist/components/DropdownSelector/OptionItem.d.ts +0 -7
  80. package/dist/components/DropdownSelector/OptionItem.d.ts.map +0 -1
  81. package/dist/components/DropdownSelector/utils/focusIfHTMLLIElement.d.ts +0 -6
  82. package/dist/components/DropdownSelector/utils/focusIfHTMLLIElement.d.ts.map +0 -1
  83. package/dist/components/DropdownSelector/utils/handleFocusByKeyBoard.d.ts +0 -6
  84. package/dist/components/DropdownSelector/utils/handleFocusByKeyBoard.d.ts.map +0 -1
  85. package/dist/types/CustomJSXElement.d.ts +0 -3
  86. package/dist/types/CustomJSXElement.d.ts.map +0 -1
@@ -2,325 +2,175 @@ import { useTextField } from '@react-aria/textfield'
2
2
  import { useVisuallyHidden } from '@react-aria/visually-hidden'
3
3
  import { ReactNode, useCallback, useEffect, useRef, useState } from 'react'
4
4
  import * as React from 'react'
5
- import styled, { css } from 'styled-components'
5
+ import styled from 'styled-components'
6
6
  import FieldLabel, { FieldLabelProps } from '../FieldLabel'
7
- import { createTheme } from '@charcoal-ui/styled'
8
-
9
- const theme = createTheme(styled)
7
+ import { countCodePointsInString, mergeRefs } from '../../_lib'
8
+ import { theme } from '../../styled'
9
+ import { ReactAreaUseTextFieldCompat } from '../../_lib/compat'
10
+
11
+ type DOMProps = Omit<
12
+ React.InputHTMLAttributes<HTMLInputElement>,
13
+ // react-ariaのhookは、onChangeが`(v: string) => void`想定
14
+ | 'onChange'
15
+
16
+ // RDFa Attributeとかぶる
17
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/58d57ca87ac7be0d306c0844dc254e90c150bd0d/types/react/index.d.ts#L1951
18
+ | 'prefix'
19
+
20
+ // ReactAreaUseTextFieldCompatに書いてあるような事情で、ここにあるイベントハンドラの型をゆるめる
21
+ | keyof ReactAreaUseTextFieldCompat
22
+ >
23
+
24
+ export interface TextFieldProps
25
+ extends Pick<FieldLabelProps, 'label' | 'requiredText' | 'subLabel'>,
26
+ DOMProps,
27
+ ReactAreaUseTextFieldCompat {
28
+ readonly prefix?: ReactNode
29
+ readonly suffix?: ReactNode
10
30
 
11
- interface TextFieldBaseProps
12
- extends Pick<FieldLabelProps, 'label' | 'requiredText' | 'subLabel'> {
13
- readonly className?: string
31
+ // <input> 要素は number とか string[] もありうるが、今はこれしか想定してない
14
32
  readonly defaultValue?: string
15
33
  readonly value?: string
16
34
  readonly onChange?: (value: string) => void
35
+
36
+ // react-ariaの型定義のせいでHTMLInputElementにできない
17
37
  readonly onKeyDown?: (event: React.KeyboardEvent<Element>) => void
18
38
  readonly onFocus?: (event: React.FocusEvent<Element>) => void
19
39
  readonly onBlur?: (event: React.FocusEvent<Element>) => void
40
+
20
41
  readonly showCount?: boolean
21
42
  readonly showLabel?: boolean
22
- readonly placeholder?: string
23
43
  readonly assistiveText?: string
24
- readonly disabled?: boolean
25
- readonly required?: boolean
26
44
  readonly invalid?: boolean
27
- readonly maxLength?: number
28
- /**
29
- * tab-indexがー1かどうか
30
- */
31
- readonly excludeFromTabOrder?: boolean
32
- }
33
-
34
- export interface SingleLineTextFieldProps extends TextFieldBaseProps {
35
- readonly autoHeight?: never
36
- readonly multiline?: false
37
- readonly rows?: never
38
- readonly type?: string
39
- readonly prefix?: ReactNode
40
- readonly suffix?: ReactNode
41
- }
42
-
43
- export interface MultiLineTextFieldProps extends TextFieldBaseProps {
44
- readonly autoHeight?: boolean
45
- readonly multiline: true
46
- readonly rows?: number
47
- readonly type?: never
48
- readonly prefix?: never
49
- readonly suffix?: never
50
- }
51
-
52
- export type TextFieldProps = SingleLineTextFieldProps | MultiLineTextFieldProps
53
- type TextFieldElement = HTMLInputElement & HTMLTextAreaElement
54
-
55
- function mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback<T> {
56
- return (value) => {
57
- for (const ref of refs) {
58
- if (typeof ref === 'function') {
59
- ref(value)
60
- } else if (ref !== null) {
61
- ;(ref as React.MutableRefObject<T | null>).current = value
62
- }
63
- }
64
- }
65
- }
66
-
67
- function countCodePointsInString(string: string) {
68
- // [...string] とするとproduction buildで動かなくなる
69
- // cf. https://twitter.com/f_subal/status/1497214727511891972
70
- return Array.from(string).length
71
45
  }
72
46
 
73
- const TextField = React.forwardRef<TextFieldElement, TextFieldProps>(
74
- function TextField(props, ref) {
75
- return props.multiline !== undefined && props.multiline ? (
76
- <MultiLineTextField ref={ref} {...props} />
77
- ) : (
78
- <SingleLineTextField ref={ref} {...props} />
47
+ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
48
+ function SingleLineTextFieldInner({ onChange, ...props }, forwardRef) {
49
+ const {
50
+ className,
51
+ showLabel = false,
52
+ showCount = false,
53
+ label,
54
+ requiredText,
55
+ subLabel,
56
+ disabled = false,
57
+ required,
58
+ invalid = false,
59
+ assistiveText,
60
+ maxLength,
61
+ prefix = null,
62
+ suffix = null,
63
+ } = props
64
+
65
+ const { visuallyHiddenProps } = useVisuallyHidden()
66
+ const ariaRef = useRef<HTMLInputElement>(null)
67
+ const prefixRef = useRef<HTMLSpanElement>(null)
68
+ const suffixRef = useRef<HTMLSpanElement>(null)
69
+ const [count, setCount] = useState(
70
+ countCodePointsInString(props.value ?? '')
79
71
  )
80
- }
81
- )
82
-
83
- export default TextField
84
-
85
- const SingleLineTextField = React.forwardRef<
86
- HTMLInputElement,
87
- SingleLineTextFieldProps
88
- >(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef) {
89
- const {
90
- className,
91
- showLabel = false,
92
- showCount = false,
93
- label,
94
- requiredText,
95
- subLabel,
96
- disabled = false,
97
- required,
98
- invalid = false,
99
- assistiveText,
100
- maxLength,
101
- prefix = null,
102
- suffix = null,
103
- } = props
104
-
105
- const { visuallyHiddenProps } = useVisuallyHidden()
106
- const ariaRef = useRef<HTMLInputElement>(null)
107
- const prefixRef = useRef<HTMLSpanElement>(null)
108
- const suffixRef = useRef<HTMLSpanElement>(null)
109
- const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))
110
- const [prefixWidth, setPrefixWidth] = useState(0)
111
- const [suffixWidth, setSuffixWidth] = useState(0)
112
-
113
- const nonControlled = props.value === undefined
114
- const handleChange = useCallback(
115
- (value: string) => {
116
- const count = countCodePointsInString(value)
117
- if (maxLength !== undefined && count > maxLength) {
118
- return
119
- }
120
- if (nonControlled) {
121
- setCount(count)
122
- }
123
- onChange?.(value)
124
- },
125
- [maxLength, nonControlled, onChange]
126
- )
127
-
128
- useEffect(() => {
129
- setCount(countCodePointsInString(props.value ?? ''))
130
- }, [props.value])
131
-
132
- const { inputProps, labelProps, descriptionProps, errorMessageProps } =
133
- useTextField(
134
- {
135
- inputElementType: 'input',
136
- isDisabled: disabled,
137
- isRequired: required,
138
- validationState: invalid ? 'invalid' : 'valid',
139
- description: !invalid && assistiveText,
140
- errorMessage: invalid && assistiveText,
141
- onChange: handleChange,
142
- ...props,
72
+ const [prefixWidth, setPrefixWidth] = useState(0)
73
+ const [suffixWidth, setSuffixWidth] = useState(0)
74
+
75
+ const nonControlled = props.value === undefined
76
+ const handleChange = useCallback(
77
+ (value: string) => {
78
+ const count = countCodePointsInString(value)
79
+ if (maxLength !== undefined && count > maxLength) {
80
+ return
81
+ }
82
+ if (nonControlled) {
83
+ setCount(count)
84
+ }
85
+ onChange?.(value)
143
86
  },
144
- ariaRef
87
+ [maxLength, nonControlled, onChange]
145
88
  )
146
89
 
147
- useEffect(() => {
148
- const prefixObserver = new ResizeObserver((entries) => {
149
- setPrefixWidth(entries[0].contentRect.width)
150
- })
151
- const suffixObserver = new ResizeObserver((entries) => {
152
- setSuffixWidth(entries[0].contentRect.width)
153
- })
154
-
155
- if (prefixRef.current !== null) {
156
- prefixObserver.observe(prefixRef.current)
157
- }
158
- if (suffixRef.current !== null) {
159
- suffixObserver.observe(suffixRef.current)
160
- }
161
-
162
- return () => {
163
- suffixObserver.disconnect()
164
- prefixObserver.disconnect()
165
- }
166
- }, [])
167
-
168
- return (
169
- <TextFieldRoot className={className} isDisabled={disabled}>
170
- <TextFieldLabel
171
- label={label}
172
- requiredText={requiredText}
173
- required={required}
174
- subLabel={subLabel}
175
- {...labelProps}
176
- {...(!showLabel ? visuallyHiddenProps : {})}
177
- />
178
- <StyledInputContainer>
179
- <PrefixContainer ref={prefixRef}>
180
- <Affix>{prefix}</Affix>
181
- </PrefixContainer>
182
- <StyledInput
183
- ref={mergeRefs(forwardRef, ariaRef)}
184
- invalid={invalid}
185
- extraLeftPadding={prefixWidth}
186
- extraRightPadding={suffixWidth}
187
- {...inputProps}
188
- />
189
- <SuffixContainer ref={suffixRef}>
190
- <Affix>{suffix}</Affix>
191
- {showCount && (
192
- <SingleLineCounter>
193
- {maxLength !== undefined ? `${count}/${maxLength}` : count}
194
- </SingleLineCounter>
195
- )}
196
- </SuffixContainer>
197
- </StyledInputContainer>
198
- {assistiveText != null && assistiveText.length !== 0 && (
199
- <AssistiveText
200
- invalid={invalid}
201
- {...(invalid ? errorMessageProps : descriptionProps)}
202
- >
203
- {assistiveText}
204
- </AssistiveText>
205
- )}
206
- </TextFieldRoot>
207
- )
208
- })
209
-
210
- const MultiLineTextField = React.forwardRef<
211
- HTMLTextAreaElement,
212
- MultiLineTextFieldProps
213
- >(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef) {
214
- const {
215
- className,
216
- showCount = false,
217
- showLabel = false,
218
- label,
219
- requiredText,
220
- subLabel,
221
- disabled = false,
222
- required,
223
- invalid = false,
224
- assistiveText,
225
- maxLength,
226
- autoHeight = false,
227
- rows: initialRows = 4,
228
- } = props
229
-
230
- const { visuallyHiddenProps } = useVisuallyHidden()
231
- const textareaRef = useRef<HTMLTextAreaElement>(null)
232
- const ariaRef = useRef<HTMLTextAreaElement>(null)
233
- const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))
234
- const [rows, setRows] = useState(initialRows)
235
-
236
- const syncHeight = useCallback(
237
- (textarea: HTMLTextAreaElement) => {
238
- const rows = (`${textarea.value}\n`.match(/\n/gu)?.length ?? 0) || 1
239
- setRows(initialRows <= rows ? rows : initialRows)
240
- },
241
- [initialRows]
242
- )
243
-
244
- const nonControlled = props.value === undefined
245
- const handleChange = useCallback(
246
- (value: string) => {
247
- const count = countCodePointsInString(value)
248
- if (maxLength !== undefined && count > maxLength) {
249
- return
250
- }
251
- if (nonControlled) {
252
- setCount(count)
90
+ useEffect(() => {
91
+ setCount(countCodePointsInString(props.value ?? ''))
92
+ }, [props.value])
93
+
94
+ const { inputProps, labelProps, descriptionProps, errorMessageProps } =
95
+ useTextField(
96
+ {
97
+ inputElementType: 'input',
98
+ isDisabled: disabled,
99
+ isRequired: required,
100
+ validationState: invalid ? 'invalid' : 'valid',
101
+ description: !invalid && assistiveText,
102
+ errorMessage: invalid && assistiveText,
103
+ onChange: handleChange,
104
+ ...props,
105
+ },
106
+ ariaRef
107
+ )
108
+
109
+ useEffect(() => {
110
+ const prefixObserver = new ResizeObserver((entries) => {
111
+ setPrefixWidth(entries[0].contentRect.width)
112
+ })
113
+ const suffixObserver = new ResizeObserver((entries) => {
114
+ setSuffixWidth(entries[0].contentRect.width)
115
+ })
116
+
117
+ if (prefixRef.current !== null) {
118
+ prefixObserver.observe(prefixRef.current)
253
119
  }
254
- if (autoHeight && textareaRef.current !== null) {
255
- syncHeight(textareaRef.current)
120
+ if (suffixRef.current !== null) {
121
+ suffixObserver.observe(suffixRef.current)
256
122
  }
257
- onChange?.(value)
258
- },
259
- [autoHeight, maxLength, nonControlled, onChange, syncHeight]
260
- )
261
-
262
- useEffect(() => {
263
- setCount(countCodePointsInString(props.value ?? ''))
264
- }, [props.value])
265
-
266
- const { inputProps, labelProps, descriptionProps, errorMessageProps } =
267
- useTextField(
268
- {
269
- inputElementType: 'textarea',
270
- isDisabled: disabled,
271
- isRequired: required,
272
- validationState: invalid ? 'invalid' : 'valid',
273
- description: !invalid && assistiveText,
274
- errorMessage: invalid && assistiveText,
275
- onChange: handleChange,
276
- ...props,
277
- },
278
- ariaRef
279
- )
280
123
 
281
- useEffect(() => {
282
- if (autoHeight && textareaRef.current !== null) {
283
- syncHeight(textareaRef.current)
284
- }
285
- }, [autoHeight, syncHeight])
286
-
287
- return (
288
- <TextFieldRoot className={className} isDisabled={disabled}>
289
- <TextFieldLabel
290
- label={label}
291
- requiredText={requiredText}
292
- required={required}
293
- subLabel={subLabel}
294
- {...labelProps}
295
- {...(!showLabel ? visuallyHiddenProps : {})}
296
- />
297
- <StyledTextareaContainer
298
- invalid={invalid}
299
- rows={showCount ? rows + 1 : rows}
300
- >
301
- <StyledTextarea
302
- ref={mergeRefs(textareaRef, forwardRef, ariaRef)}
303
- rows={rows}
304
- noBottomPadding={showCount}
305
- {...inputProps}
124
+ return () => {
125
+ suffixObserver.disconnect()
126
+ prefixObserver.disconnect()
127
+ }
128
+ }, [])
129
+
130
+ return (
131
+ <TextFieldRoot className={className} isDisabled={disabled}>
132
+ <TextFieldLabel
133
+ label={label}
134
+ requiredText={requiredText}
135
+ required={required}
136
+ subLabel={subLabel}
137
+ {...labelProps}
138
+ {...(!showLabel ? visuallyHiddenProps : {})}
306
139
  />
307
- {showCount && (
308
- <MultiLineCounter>
309
- {maxLength !== undefined ? `${count}/${maxLength}` : count}
310
- </MultiLineCounter>
140
+ <StyledInputContainer>
141
+ <PrefixContainer ref={prefixRef}>
142
+ <Affix>{prefix}</Affix>
143
+ </PrefixContainer>
144
+ <StyledInput
145
+ ref={mergeRefs(forwardRef, ariaRef)}
146
+ invalid={invalid}
147
+ extraLeftPadding={prefixWidth}
148
+ extraRightPadding={suffixWidth}
149
+ {...inputProps}
150
+ />
151
+ <SuffixContainer ref={suffixRef}>
152
+ <Affix>{suffix}</Affix>
153
+ {showCount && (
154
+ <SingleLineCounter>
155
+ {maxLength !== undefined ? `${count}/${maxLength}` : count}
156
+ </SingleLineCounter>
157
+ )}
158
+ </SuffixContainer>
159
+ </StyledInputContainer>
160
+ {assistiveText != null && assistiveText.length !== 0 && (
161
+ <AssistiveText
162
+ invalid={invalid}
163
+ {...(invalid ? errorMessageProps : descriptionProps)}
164
+ >
165
+ {assistiveText}
166
+ </AssistiveText>
311
167
  )}
312
- </StyledTextareaContainer>
313
- {assistiveText != null && assistiveText.length !== 0 && (
314
- <AssistiveText
315
- invalid={invalid}
316
- {...(invalid ? errorMessageProps : descriptionProps)}
317
- >
318
- {assistiveText}
319
- </AssistiveText>
320
- )}
321
- </TextFieldRoot>
322
- )
323
- })
168
+ </TextFieldRoot>
169
+ )
170
+ }
171
+ )
172
+
173
+ export default TextField
324
174
 
325
175
  const TextFieldRoot = styled.div<{ isDisabled: boolean }>`
326
176
  display: flex;
@@ -400,85 +250,10 @@ const StyledInput = styled.input<{
400
250
  }
401
251
  `
402
252
 
403
- const StyledTextareaContainer = styled.div<{ rows: number; invalid: boolean }>`
404
- position: relative;
405
- overflow: hidden;
406
- padding: 0 8px;
407
-
408
- ${(p) =>
409
- theme((o) => [
410
- o.bg.surface3.hover,
411
- p.invalid && o.outline.assertive,
412
- o.font.text2,
413
- o.borderRadius(4),
414
- ])}
415
-
416
- /**
417
- * FIXME: o.outline.default を &:focus-within 内に書いてると、外れるときに transition が効かない
418
- * 本来 o.outline.default.focus と書けば足してくれるような transition の内容を一旦明示している
419
- * o.outline.default.focusWithin のようなものがあればこの行は不要になるはず
420
- */
421
- transition: box-shadow 0.2s;
422
-
423
- &:focus-within {
424
- ${(p) =>
425
- theme((o) => (p.invalid ? o.outline.assertive : o.outline.default))}
426
- }
427
-
428
- ${({ rows }) => css`
429
- height: calc(22px * ${rows} + 18px);
430
- `};
431
- `
432
-
433
- const StyledTextarea = styled.textarea<{ noBottomPadding: boolean }>`
434
- border: none;
435
- outline: none;
436
- resize: none;
437
- font-family: inherit;
438
- color: inherit;
439
-
440
- /* Prevent zooming for iOS Safari */
441
- transform-origin: top left;
442
- transform: scale(0.875);
443
- width: calc(100% / 0.875);
444
- font-size: calc(14px / 0.875);
445
- line-height: calc(22px / 0.875);
446
- padding: calc(9px / 0.875) 0 ${(p) => (p.noBottomPadding ? 0 : '')};
447
-
448
- ${({ rows = 1 }) => css`
449
- height: calc(22px / 0.875 * ${rows});
450
- `};
451
-
452
- /* Display box-shadow for iOS Safari */
453
- appearance: none;
454
-
455
- background: none;
456
-
457
- &::placeholder {
458
- ${theme((o) => o.font.text3)}
459
- }
460
-
461
- /* Hide scrollbar for Chrome, Safari and Opera */
462
- &::-webkit-scrollbar {
463
- display: none;
464
- }
465
- /* Hide scrollbar for IE, Edge and Firefox */
466
- -ms-overflow-style: none; /* IE and Edge */
467
- scrollbar-width: none; /* Firefox */
468
- `
469
-
470
253
  const SingleLineCounter = styled.span`
471
254
  ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}
472
255
  `
473
256
 
474
- const MultiLineCounter = styled.span`
475
- position: absolute;
476
- bottom: 9px;
477
- right: 8px;
478
-
479
- ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}
480
- `
481
-
482
257
  const AssistiveText = styled.p<{ invalid: boolean }>`
483
258
  ${(p) =>
484
259
  theme((o) => [
package/src/index.ts CHANGED
@@ -35,9 +35,8 @@ export { default as Switch, type SwitchProps } from './components/Switch'
35
35
  export {
36
36
  default as TextField,
37
37
  type TextFieldProps,
38
- type SingleLineTextFieldProps,
39
- type MultiLineTextFieldProps,
40
38
  } from './components/TextField'
39
+ export { default as TextArea, type TextAreaProps } from './components/TextArea'
41
40
  export { default as Icon, type IconProps } from './components/Icon'
42
41
  export { default as Modal, type ModalProps } from './components/Modal'
43
42
  export {
@@ -1,7 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export type OptionItemProps = {
3
- children?: ReactNode;
4
- value: string;
5
- };
6
- export declare function OptionItem(props: OptionItemProps): JSX.Element;
7
- //# sourceMappingURL=OptionItem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OptionItem.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownSelector/OptionItem.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAc,MAAM,OAAO,CAAA;AAQpD,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eA2ChD"}
@@ -1,6 +0,0 @@
1
- /**
2
- * li要素ならフォーカスしてスクロールスクロール領域に見えるように親要素をスクロールする
3
- * @param element
4
- */
5
- export declare function focusIfHTMLLIElement(element: Node | null | undefined): void;
6
- //# sourceMappingURL=focusIfHTMLLIElement.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"focusIfHTMLLIElement.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownSelector/utils/focusIfHTMLLIElement.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,QAKpE"}
@@ -1,6 +0,0 @@
1
- /**
2
- * スクロールスクロール領域に見えるように親要素をスクロールする
3
- * @param element
4
- */
5
- export declare function handleFocusByKeyBoard(element: HTMLElement): void;
6
- //# sourceMappingURL=handleFocusByKeyBoard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handleFocusByKeyBoard.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownSelector/utils/handleFocusByKeyBoard.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,QAczD"}
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export type CustomJSXElement = keyof JSX.IntrinsicElements | React.JSXElementConstructor<any>;
3
- //# sourceMappingURL=CustomJSXElement.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CustomJSXElement.d.ts","sourceRoot":"","sources":["../../src/types/CustomJSXElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,MAAM,gBAAgB,GACxB,MAAM,GAAG,CAAC,iBAAiB,GAE3B,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAA"}