@teamturing/react-kit 2.19.14 → 2.19.16

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.
package/dist/index.js CHANGED
@@ -18869,6 +18869,7 @@ const Dialog = ({
18869
18869
  isOpen,
18870
18870
  onDismiss,
18871
18871
  size = 'm',
18872
+ initialFocusRef,
18872
18873
  sx
18873
18874
  }, ref) => {
18874
18875
  const handleDismiss = React.useCallback(() => onDismiss?.(), [onDismiss]);
@@ -18891,7 +18892,7 @@ const Dialog = ({
18891
18892
  }, [handleDismiss]);
18892
18893
  useFocusTrap({
18893
18894
  containerRef: dialogRef,
18894
- initialFocusRef: closeButtonRef,
18895
+ initialFocusRef: initialFocusRef || closeButtonRef,
18895
18896
  disabled: !isOpen
18896
18897
  });
18897
18898
  React.useEffect(() => {
@@ -20880,6 +20881,13 @@ const OverlayPopper = ({
20880
20881
  };
20881
20882
  const defaultPopperProps = {
20882
20883
  onClick: handleOverlayToggle,
20884
+ onKeyDown: e => {
20885
+ if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
20886
+ e.preventDefault();
20887
+ openOverlay();
20888
+ }
20889
+ e.stopPropagation();
20890
+ },
20883
20891
  tabIndex: 0,
20884
20892
  ...{
20885
20893
  ref: refs.setReference
@@ -20922,116 +20930,118 @@ const OverlayPopper = ({
20922
20930
  });
20923
20931
  };
20924
20932
 
20925
- const OverlaySelectInput = ({
20933
+ const TextInputTrailingAction = ({
20934
+ icon: Icon,
20935
+ disabled,
20936
+ ...props
20937
+ }, ref) => /*#__PURE__*/jsxRuntimeExports.jsx(BaseTextInputTrailingAction, {
20938
+ ref: ref,
20939
+ ...props,
20940
+ disabled: disabled,
20941
+ "aria-disabled": disabled,
20942
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(Icon, {})
20943
+ });
20944
+ const BaseTextInputTrailingAction = styled__default.default(UnstyledButton)`
20945
+ display: inline-flex;
20946
+ padding: ${({
20947
+ theme
20948
+ }) => forcePixelValue(theme.space[2])};
20949
+ background-color: ${({
20950
+ theme
20951
+ }) => theme.colors['bg/neutral/subtler']};
20952
+ border-radius: ${({
20953
+ theme
20954
+ }) => forcePixelValue(theme.radii.full)};
20955
+
20956
+ & svg {
20957
+ width: ${forcePixelValue(16)};
20958
+ height: ${forcePixelValue(16)};
20959
+ color: ${({
20960
+ theme
20961
+ }) => theme.colors['icon/neutral/bolder']};
20962
+ }
20963
+
20964
+ &:hover {
20965
+ background-color: ${({
20966
+ theme
20967
+ }) => theme.colors['bg/neutral/subtler/hovered']};
20968
+ }
20969
+
20970
+ &[aria-disabled='true'] {
20971
+ cursor: not-allowed;
20972
+ & svg {
20973
+ color: ${({
20974
+ theme
20975
+ }) => theme.colors['icon/disabled']};
20976
+ }
20977
+ }
20978
+
20979
+ ${sx}
20980
+ `;
20981
+ var TextInputTrailingAction$1 = /*#__PURE__*/React.forwardRef(TextInputTrailingAction);
20982
+
20983
+ const TextInput = ({
20984
+ type = 'text',
20985
+ disabled,
20926
20986
  validationStatus,
20927
20987
  leadingVisual: LeadingVisual,
20928
- children,
20929
- onChange,
20930
- focusTrapSettings,
20931
- focusZoneSettings,
20932
- onOpen,
20933
- onClose,
20988
+ trailingVisual: TrailingVisual,
20989
+ trailingAction,
20934
20990
  ...props
20935
20991
  }, ref) => {
20936
- const valueInputRef = useProvidedOrCreatedRef(ref);
20937
- const labelInputRef = React.useRef(null);
20992
+ const inputRef = useProvidedOrCreatedRef(ref);
20938
20993
  const focusInput = () => {
20939
- labelInputRef.current?.focus();
20940
- };
20941
- const {
20942
- id,
20943
- disabled,
20944
- placeholder
20945
- } = props;
20946
- const handleSelect = item => {
20947
- if (labelInputRef.current && valueInputRef.current) {
20948
- labelInputRef.current.setAttribute('value', item.label);
20949
-
20950
- /**
20951
- * ! valueInput의 native onChange를 trigger하려고 했으나 작동하지 않음.
20952
- * ! 일단 Custom onChange를 만들어서 해결.
20953
- */
20954
- const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value')?.set;
20955
- nativeInputValueSetter?.call(valueInputRef.current, item.value.toString());
20956
- onChange?.(item);
20957
- }
20994
+ inputRef.current?.focus();
20958
20995
  };
20959
- return /*#__PURE__*/jsxRuntimeExports.jsx(OverlayPopper, {
20960
- focusTrapSettings: focusTrapSettings,
20961
- focusZoneSettings: focusZoneSettings,
20962
- onOpen: onOpen,
20963
- onClose: onClose,
20964
- renderOverlay: (overlayProps, _, {
20965
- elements
20966
- }) => /*#__PURE__*/jsxRuntimeExports.jsx(Overlay$1, {
20967
- ...overlayProps,
20968
- style: {
20969
- ...overlayProps.style,
20970
- width: elements?.reference?.getBoundingClientRect().width
20996
+ return /*#__PURE__*/jsxRuntimeExports.jsxs(TextInputWrapper$1, {
20997
+ disabled: disabled,
20998
+ onClick: focusInput,
20999
+ hasLeadingVisual: !isNullable(LeadingVisual),
21000
+ hasTrailingVisual: !isNullable(TrailingVisual),
21001
+ hasTrailingAction: !isNullable(trailingAction),
21002
+ validationStatus: validationStatus,
21003
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
21004
+ sx: {
21005
+ 'flexShrink': 0,
21006
+ 'fontSize': 'xxs',
21007
+ 'fontWeight': 'medium',
21008
+ 'color': color$1['text/neutral'],
21009
+ '& > svg': {
21010
+ display: 'block',
21011
+ width: 16,
21012
+ height: 16,
21013
+ color: color$1['icon/neutral/bold']
21014
+ }
20971
21015
  },
20972
- children: children?.({
20973
- handleSelect
20974
- })
20975
- }),
20976
- children: (popperProps, {
20977
- openOverlay
20978
- }) => /*#__PURE__*/jsxRuntimeExports.jsxs(TextInputWrapper$1, {
20979
- ...popperProps,
20980
- tabIndex: disabled ? -1 : 0,
21016
+ children: typeof LeadingVisual !== 'string' && reactIsExports.isValidElementType(LeadingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(LeadingVisual, {}) : LeadingVisual
21017
+ }), /*#__PURE__*/jsxRuntimeExports.jsx(BaseInput$1, {
21018
+ ref: e => {
21019
+ isFunction(ref) ? ref(e) : null;
21020
+ inputRef.current = e;
21021
+ },
21022
+ type: type,
20981
21023
  disabled: disabled,
20982
- onClick: focusInput,
20983
- hasLeadingVisual: !isNullable(LeadingVisual),
20984
- validationStatus: validationStatus,
20985
- onKeyDown: e => {
20986
- if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
20987
- e.preventDefault();
20988
- openOverlay();
21024
+ ...props
21025
+ }), /*#__PURE__*/jsxRuntimeExports.jsxs(View, {
21026
+ sx: {
21027
+ 'display': 'flex',
21028
+ 'alignItems': 'center',
21029
+ 'columnGap': 2,
21030
+ 'flexShrink': 0,
21031
+ 'fontSize': 'xxs',
21032
+ 'fontWeight': 'medium',
21033
+ 'color': color$1['text/neutral'],
21034
+ '& > svg': {
21035
+ display: 'block',
21036
+ width: 16,
21037
+ height: 16,
21038
+ color: color$1['icon/neutral/bold']
20989
21039
  }
20990
21040
  },
20991
- children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
20992
- sx: {
20993
- 'flexShrink': 0,
20994
- 'fontSize': 'xxs',
20995
- 'fontWeight': 'medium',
20996
- 'color': 'text/neutral',
20997
- '& > svg': {
20998
- display: 'block',
20999
- width: 16,
21000
- height: 16,
21001
- color: 'icon/neutral/bold'
21002
- }
21003
- },
21004
- children: typeof LeadingVisual !== 'string' && reactIsExports.isValidElementType(LeadingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(LeadingVisual, {}) : LeadingVisual
21005
- }), /*#__PURE__*/jsxRuntimeExports.jsx(BaseInput$1, {
21006
- id: id,
21007
- ref: labelInputRef,
21008
- onChange: noop$2,
21009
- autoComplete: 'off',
21010
- tabIndex: -1,
21011
- onClick: e => {
21012
- popperProps.onClick?.(e);
21013
- props.onClick?.(e);
21014
- },
21015
- placeholder: placeholder
21016
- }), /*#__PURE__*/jsxRuntimeExports.jsx(StyledIcon, {
21017
- sx: {
21018
- position: 'absolute',
21019
- top: '50%',
21020
- transform: 'translateY(-50%)',
21021
- right: 4,
21022
- pointerEvents: 'none'
21023
- },
21024
- icon: SvgChevronDown,
21025
- color: disabled ? 'icon/disabled' : 'icon/neutral/bolder',
21026
- size: 16
21027
- }), /*#__PURE__*/jsxRuntimeExports.jsx(BaseInput$1, {
21028
- ref: e => {
21029
- isFunction(ref) ? ref(e) : null;
21030
- valueInputRef.current = e;
21031
- },
21032
- type: 'hidden'
21033
- })]
21034
- })
21041
+ children: [typeof TrailingVisual !== 'string' && reactIsExports.isValidElementType(TrailingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(TrailingVisual, {}) : TrailingVisual, trailingAction ? /*#__PURE__*/React.cloneElement(trailingAction, {
21042
+ disabled: disabled
21043
+ }) : null]
21044
+ })]
21035
21045
  });
21036
21046
  };
21037
21047
  const TextInputWrapper$1 = styled__default.default.div`
@@ -21048,10 +21058,7 @@ const TextInputWrapper$1 = styled__default.default.div`
21048
21058
  background-color: ${({
21049
21059
  theme
21050
21060
  }) => theme.colors['bg/input']};
21051
- cursor: default;
21052
- input {
21053
- cursor: default;
21054
- }
21061
+ cursor: text;
21055
21062
  display: inline-flex;
21056
21063
  align-items: center;
21057
21064
 
@@ -21106,7 +21113,7 @@ const TextInputWrapper$1 = styled__default.default.div`
21106
21113
  }
21107
21114
  `}
21108
21115
 
21109
- ${props => props.validationStatus !== 'error' && !props.disabled && styled.css`
21116
+ ${props => props.validationStatus !== 'error' && styled.css`
21110
21117
  &:focus-within {
21111
21118
  &:after {
21112
21119
  border-color: ${({
@@ -21137,6 +21144,21 @@ const TextInputWrapper$1 = styled__default.default.div`
21137
21144
  }
21138
21145
  `}
21139
21146
 
21147
+ ${props => props.hasTrailingVisual && styled.css`
21148
+ padding-right: ${forcePixelValue(props.theme.space[4])};
21149
+ `}
21150
+
21151
+ ${props => props.hasTrailingAction && styled.css`
21152
+ padding-right: ${forcePixelValue(props.theme.space[2])};
21153
+ `}
21154
+
21155
+ ${props => (props.hasTrailingVisual || props.hasTrailingAction) && styled.css`
21156
+ input {
21157
+ padding-right: ${forcePixelValue(props.theme.space[2])};
21158
+ }
21159
+ `}
21160
+
21161
+
21140
21162
  transition: color 100ms, background-color 100ms;
21141
21163
  &:after {
21142
21164
  transition: border-color 100ms;
@@ -21164,102 +21186,226 @@ const BaseInput$1 = styled__default.default(UnstyledInput$1)`
21164
21186
  }) => forcePixelValue(theme.space[3])};
21165
21187
  padding-right: ${({
21166
21188
  theme
21167
- }) => forcePixelValue(theme.space[10])};
21189
+ }) => forcePixelValue(theme.space[4])};
21168
21190
  padding-bottom: ${({
21169
21191
  theme
21170
21192
  }) => forcePixelValue(theme.space[3])};
21171
21193
  padding-left: ${({
21172
21194
  theme
21173
21195
  }) => forcePixelValue(theme.space[4])};
21174
-
21175
- white-space: pre;
21176
- text-overflow: ellipsis;
21177
21196
  `;
21178
- var OverlaySelectInput$1 = /*#__PURE__*/React.forwardRef(OverlaySelectInput);
21179
-
21180
- const SelectOption = ({
21181
- children: propChildren,
21182
- ...props
21183
- }) => {
21184
- const children = isNullable(propChildren) ? props.label : propChildren;
21185
- return /*#__PURE__*/jsxRuntimeExports.jsx(BaseSelectOption, {
21186
- ...props,
21187
- children: children
21188
- });
21189
- };
21190
- const BaseSelectOption = styled__default.default.option``;
21197
+ var TextInput$1 = Object.assign( /*#__PURE__*/React.forwardRef(TextInput), {
21198
+ TrailingAction: TextInputTrailingAction$1
21199
+ });
21191
21200
 
21192
- const Select = ({
21193
- children,
21194
- disabled,
21201
+ const SearchSelectInput = ({
21195
21202
  validationStatus,
21196
21203
  leadingVisual: LeadingVisual,
21197
- placeholder = '옵션 선택',
21204
+ children,
21205
+ onChange,
21206
+ focusTrapSettings,
21207
+ focusZoneSettings,
21208
+ onOpen,
21209
+ onClose,
21210
+ searchInputProps,
21211
+ value,
21212
+ renderValue = value => value?.toString(),
21198
21213
  ...props
21199
21214
  }, ref) => {
21200
- const PLACEHOLDER_VALUE = '';
21201
- const selectRef = useProvidedOrCreatedRef(ref);
21202
- const [isValueEmpty, setIsValueEmpty] = React.useState(isNullable(props.value) || props.value === PLACEHOLDER_VALUE);
21203
- const focusSelect = () => {
21204
- selectRef.current?.focus();
21215
+ const theme = styled.useTheme();
21216
+ const hasLeadingVisual = !isNullable(LeadingVisual);
21217
+ const valueInputRef = useProvidedOrCreatedRef(ref);
21218
+ const labelInputRef = React.useRef(null);
21219
+ const focusInput = () => {
21220
+ labelInputRef.current?.focus();
21205
21221
  };
21206
- return /*#__PURE__*/jsxRuntimeExports.jsxs(SelectWrapper, {
21207
- disabled: disabled,
21208
- onClick: focusSelect,
21209
- hasLeadingVisual: !isNullable(LeadingVisual),
21210
- validationStatus: validationStatus,
21211
- isValueEmpty: isValueEmpty,
21212
- children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
21213
- sx: {
21214
- 'flexShrink': 0,
21215
- 'fontSize': 'xxs',
21216
- 'fontWeight': 'medium',
21217
- 'color': 'text/neutral',
21218
- '& > svg': {
21219
- display: 'block',
21220
- width: 16,
21221
- height: 16,
21222
- color: 'icon/neutral/bold'
21222
+ const {
21223
+ id,
21224
+ disabled,
21225
+ placeholder
21226
+ } = props;
21227
+ const handleSelect = item => {
21228
+ if (labelInputRef.current && valueInputRef.current) {
21229
+ /**
21230
+ * ! valueInput의 native onChange를 trigger하려고 했으나 작동하지 않음.
21231
+ * ! 일단 Custom onChange를 만들어서 해결.
21232
+ */
21233
+ const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value')?.set;
21234
+ nativeInputValueSetter?.call(valueInputRef.current, item.value.toString());
21235
+ onChange?.(item);
21236
+ }
21237
+ };
21238
+ const listContainerRef = React.useRef(null);
21239
+ const searchInputRef = React.useRef(null);
21240
+ const activeDescendantRef = React.useRef();
21241
+ return /*#__PURE__*/jsxRuntimeExports.jsx(OverlayPopper, {
21242
+ focusTrapSettings: {
21243
+ initialFocusRef: searchInputRef,
21244
+ restoreFocusOnCleanUp: true,
21245
+ ...focusTrapSettings
21246
+ },
21247
+ focusZoneSettings: {
21248
+ containerRef: listContainerRef,
21249
+ activeDescendantFocus: searchInputRef,
21250
+ focusOutBehavior: 'stop',
21251
+ onActiveDescendantChanged: (current, previous) => {
21252
+ activeDescendantRef.current = current;
21253
+ if (current && listContainerRef.current) {
21254
+ current.style.backgroundColor = theme.colors['bg/selected/subtle'];
21255
+ scrollIntoView({
21256
+ childrenRef: current,
21257
+ scrollContainerRef: listContainerRef.current,
21258
+ options: {
21259
+ behavior: 'auto',
21260
+ direction: 'vertical',
21261
+ offset: 0
21262
+ }
21263
+ });
21264
+ }
21265
+ if (previous && current !== previous) {
21266
+ previous.style.backgroundColor = '';
21223
21267
  }
21224
21268
  },
21225
- children: typeof LeadingVisual !== 'string' && reactIsExports.isValidElementType(LeadingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(LeadingVisual, {}) : LeadingVisual
21226
- }), /*#__PURE__*/jsxRuntimeExports.jsxs(BaseSelect, {
21227
- ref: e => {
21228
- isFunction(ref) ? ref(e) : null;
21229
- selectRef.current = e;
21269
+ focusableElementFilter: elem => {
21270
+ return elem instanceof HTMLElement;
21230
21271
  },
21231
- placeholder: placeholder,
21272
+ ...focusZoneSettings
21273
+ },
21274
+ onOpen: onOpen,
21275
+ onClose: onClose,
21276
+ renderOverlay: (overlayProps, overlayHandler, {
21277
+ elements
21278
+ }) => /*#__PURE__*/jsxRuntimeExports.jsxs(Overlay$1, {
21279
+ ...overlayProps,
21280
+ maxHeight: 200,
21281
+ sx: {
21282
+ display: 'flex',
21283
+ flexDirection: 'column'
21284
+ },
21285
+ style: {
21286
+ ...overlayProps.style,
21287
+ width: elements?.reference?.getBoundingClientRect().width
21288
+ },
21289
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(Space, {
21290
+ p: 2,
21291
+ sx: {
21292
+ flexGrow: 0,
21293
+ flexShrink: 0,
21294
+ flexBasis: 'auto'
21295
+ },
21296
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(TextInput$1, {
21297
+ ref: searchInputRef,
21298
+ leadingVisual: SvgSearch,
21299
+ onKeyDown: e => {
21300
+ if (e.code === 'Enter' && activeDescendantRef.current) {
21301
+ const activeDescendantEvent = new KeyboardEvent(e.type, e.nativeEvent);
21302
+ activeDescendantRef.current?.dispatchEvent(activeDescendantEvent);
21303
+ }
21304
+ },
21305
+ ...searchInputProps
21306
+ })
21307
+ }), /*#__PURE__*/jsxRuntimeExports.jsx(HorizontalDivider, {}), /*#__PURE__*/jsxRuntimeExports.jsx(View, {
21308
+ ref: listContainerRef,
21309
+ sx: {
21310
+ flexGrow: 1,
21311
+ flexShrink: 1,
21312
+ flexBasis: 'auto',
21313
+ overflowY: 'auto'
21314
+ },
21315
+ children: children?.({
21316
+ handleSelect
21317
+ }, overlayHandler)
21318
+ })]
21319
+ }),
21320
+ children: (popperProps, {
21321
+ openOverlay
21322
+ }) => /*#__PURE__*/jsxRuntimeExports.jsxs(TextInputWrapper, {
21323
+ ...popperProps,
21324
+ tabIndex: disabled ? -1 : 0,
21232
21325
  disabled: disabled,
21233
- ...props,
21234
- onChange: e => {
21235
- props.onChange?.(e);
21236
- if (!e.defaultPrevented) {
21237
- if (e.target.value === PLACEHOLDER_VALUE) {
21238
- setIsValueEmpty(true);
21239
- } else {
21240
- setIsValueEmpty(false);
21241
- }
21326
+ onClick: focusInput,
21327
+ hasLeadingVisual: hasLeadingVisual,
21328
+ validationStatus: validationStatus,
21329
+ onKeyDown: e => {
21330
+ if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
21331
+ e.preventDefault();
21332
+ openOverlay();
21242
21333
  }
21334
+ e.stopPropagation();
21243
21335
  },
21244
- children: [/*#__PURE__*/jsxRuntimeExports.jsx(SelectOption, {
21245
- label: placeholder,
21246
- value: PLACEHOLDER_VALUE
21247
- }), children]
21248
- }), /*#__PURE__*/jsxRuntimeExports.jsx(StyledIcon, {
21249
- sx: {
21250
- position: 'absolute',
21251
- top: '50%',
21252
- transform: 'translateY(-50%)',
21253
- right: 4,
21254
- pointerEvents: 'none'
21255
- },
21256
- icon: SvgChevronDown,
21257
- color: disabled ? 'icon/disabled' : 'icon/neutral/bolder',
21258
- size: 16
21259
- })]
21336
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
21337
+ sx: {
21338
+ 'flexShrink': 0,
21339
+ 'fontSize': 'xxs',
21340
+ 'fontWeight': 'medium',
21341
+ 'color': 'text/neutral',
21342
+ '& > svg': {
21343
+ display: 'block',
21344
+ width: 16,
21345
+ height: 16,
21346
+ color: 'icon/neutral/bold'
21347
+ }
21348
+ },
21349
+ children: typeof LeadingVisual !== 'string' && reactIsExports.isValidElementType(LeadingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(LeadingVisual, {}) : LeadingVisual
21350
+ }), /*#__PURE__*/jsxRuntimeExports.jsxs(View, {
21351
+ sx: {
21352
+ display: 'flex',
21353
+ alignItems: 'center',
21354
+ paddingTop: 3,
21355
+ paddingRight: 10,
21356
+ paddingBottom: 3,
21357
+ paddingLeft: hasLeadingVisual ? 2 : 4,
21358
+ whiteSpace: 'pre',
21359
+ textOverflow: 'ellipsis',
21360
+ width: '100%'
21361
+ },
21362
+ onClick: e => {
21363
+ popperProps.onClick?.(e);
21364
+ },
21365
+ children: [!isNullable(renderValue(value)) ? /*#__PURE__*/jsxRuntimeExports.jsx(View, {
21366
+ sx: {
21367
+ flex: '0 1 auto',
21368
+ maxWidth: '100%',
21369
+ textOverflow: 'ellipsis',
21370
+ whiteSpace: 'pre',
21371
+ overflow: 'hidden'
21372
+ },
21373
+ children: renderValue(value)
21374
+ }) : null, /*#__PURE__*/jsxRuntimeExports.jsx(BaseInput, {
21375
+ id: id,
21376
+ ref: labelInputRef,
21377
+ readOnly: true,
21378
+ onChange: noop$2,
21379
+ autoComplete: 'off',
21380
+ tabIndex: -1,
21381
+ onClick: e => {
21382
+ props.onClick?.(e);
21383
+ },
21384
+ placeholder: !isNullable(renderValue(value)) ? '' : placeholder
21385
+ })]
21386
+ }), /*#__PURE__*/jsxRuntimeExports.jsx(StyledIcon, {
21387
+ sx: {
21388
+ position: 'absolute',
21389
+ top: '50%',
21390
+ transform: 'translateY(-50%)',
21391
+ right: 4,
21392
+ pointerEvents: 'none'
21393
+ },
21394
+ icon: SvgChevronDown,
21395
+ color: disabled ? 'icon/disabled' : 'icon/neutral/bolder',
21396
+ size: 16
21397
+ }), /*#__PURE__*/jsxRuntimeExports.jsx(BaseInput, {
21398
+ ref: e => {
21399
+ isFunction(ref) ? ref(e) : null;
21400
+ valueInputRef.current = e;
21401
+ },
21402
+ type: 'hidden',
21403
+ defaultValue: value
21404
+ })]
21405
+ })
21260
21406
  });
21261
21407
  };
21262
- const SelectWrapper = styled__default.default.div`
21408
+ const TextInputWrapper = styled__default.default.div`
21263
21409
  position: relative;
21264
21410
  width: ${forcePixelValue('100%')};
21265
21411
  border-width: ${forcePixelValue(1)};
@@ -21273,6 +21419,12 @@ const SelectWrapper = styled__default.default.div`
21273
21419
  background-color: ${({
21274
21420
  theme
21275
21421
  }) => theme.colors['bg/input']};
21422
+ cursor: default;
21423
+ input {
21424
+ cursor: default;
21425
+
21426
+ flex: 1;
21427
+ }
21276
21428
  display: inline-flex;
21277
21429
  align-items: center;
21278
21430
 
@@ -21288,16 +21440,11 @@ const SelectWrapper = styled__default.default.div`
21288
21440
  color: ${({
21289
21441
  theme
21290
21442
  }) => theme.colors['text/neutral']};
21291
-
21292
- /**
21293
- * placeholder style
21294
- */
21295
- ${({
21296
- theme,
21297
- isValueEmpty
21298
- }) => isValueEmpty ? styled.css`
21299
- color: ${theme.colors['text/neutral/subtlest']};
21300
- ` : null}
21443
+ input::placeholder {
21444
+ color: ${({
21445
+ theme
21446
+ }) => theme.colors['text/neutral/subtlest']};
21447
+ }
21301
21448
 
21302
21449
  &:after {
21303
21450
  content: '';
@@ -21332,7 +21479,7 @@ const SelectWrapper = styled__default.default.div`
21332
21479
  }
21333
21480
  `}
21334
21481
 
21335
- ${props => props.validationStatus !== 'error' && styled.css`
21482
+ ${props => props.validationStatus !== 'error' && !props.disabled && styled.css`
21336
21483
  &:focus-within {
21337
21484
  &:after {
21338
21485
  border-color: ${({
@@ -21347,28 +21494,25 @@ const SelectWrapper = styled__default.default.div`
21347
21494
  background-color: ${props.theme.colors['bg/disabled']};
21348
21495
  color: ${props.theme.colors['text/disabled']};
21349
21496
 
21350
- select::placeholder {
21497
+ input::placeholder {
21351
21498
  color: ${props.theme.colors['text/disabled']};
21352
21499
  }
21353
21500
 
21354
- select {
21501
+ input {
21355
21502
  cursor: not-allowed;
21356
21503
  }
21357
21504
  `};
21358
21505
 
21359
21506
  ${props => props.hasLeadingVisual && styled.css`
21360
21507
  padding-left: ${forcePixelValue(props.theme.space[4])};
21361
- select {
21362
- padding-left: ${forcePixelValue(props.theme.space[2])};
21363
- }
21364
21508
  `}
21365
21509
 
21366
- transition: background-color 100ms;
21510
+ transition: color 100ms, background-color 100ms;
21367
21511
  &:after {
21368
21512
  transition: border-color 100ms;
21369
21513
  }
21370
21514
  `;
21371
- const UnstyledSelect = styled__default.default.select`
21515
+ const UnstyledInput = styled__default.default.input`
21372
21516
  font-size: inherit;
21373
21517
  font-weight: inherit;
21374
21518
  line-height: inherit;
@@ -21376,154 +21520,104 @@ const UnstyledSelect = styled__default.default.select`
21376
21520
  border-radius: inherit;
21377
21521
  color: inherit;
21378
21522
  transition: inherit;
21523
+ width: 100%;
21379
21524
 
21380
21525
  border: 0;
21526
+ padding: 0;
21381
21527
  background-color: transparent;
21382
- width: 100%;
21383
21528
  &:focus {
21384
21529
  outline: 0;
21385
21530
  }
21386
-
21387
- appearance: none;
21388
- -webkit-appearance: none;
21389
- -moz-appearance: none;
21390
21531
  `;
21391
- const BaseSelect = styled__default.default(UnstyledSelect)`
21392
- padding-top: ${({
21393
- theme
21394
- }) => forcePixelValue(theme.space[3])};
21395
- padding-right: ${({
21396
- theme
21397
- }) => forcePixelValue(theme.space[10])};
21398
- padding-bottom: ${({
21399
- theme
21400
- }) => forcePixelValue(theme.space[3])};
21401
- padding-left: ${({
21402
- theme
21403
- }) => forcePixelValue(theme.space[4])};
21404
-
21532
+ const BaseInput = styled__default.default(UnstyledInput)`
21405
21533
  white-space: pre;
21406
21534
  text-overflow: ellipsis;
21407
21535
  `;
21408
- var Select$1 = Object.assign( /*#__PURE__*/React.forwardRef(Select), {
21409
- Option: SelectOption
21410
- });
21536
+ var SearchSelectInput$1 = /*#__PURE__*/React.forwardRef(SearchSelectInput);
21411
21537
 
21412
- const TextInputTrailingAction = ({
21413
- icon: Icon,
21414
- disabled,
21538
+ const SelectOption = ({
21539
+ children: propChildren,
21415
21540
  ...props
21416
- }, ref) => /*#__PURE__*/jsxRuntimeExports.jsx(BaseTextInputTrailingAction, {
21417
- ref: ref,
21418
- ...props,
21419
- disabled: disabled,
21420
- "aria-disabled": disabled,
21421
- children: /*#__PURE__*/jsxRuntimeExports.jsx(Icon, {})
21422
- });
21423
- const BaseTextInputTrailingAction = styled__default.default(UnstyledButton)`
21424
- display: inline-flex;
21425
- padding: ${({
21426
- theme
21427
- }) => forcePixelValue(theme.space[2])};
21428
- background-color: ${({
21429
- theme
21430
- }) => theme.colors['bg/neutral/subtler']};
21431
- border-radius: ${({
21432
- theme
21433
- }) => forcePixelValue(theme.radii.full)};
21434
-
21435
- & svg {
21436
- width: ${forcePixelValue(16)};
21437
- height: ${forcePixelValue(16)};
21438
- color: ${({
21439
- theme
21440
- }) => theme.colors['icon/neutral/bolder']};
21441
- }
21442
-
21443
- &:hover {
21444
- background-color: ${({
21445
- theme
21446
- }) => theme.colors['bg/neutral/subtler/hovered']};
21447
- }
21448
-
21449
- &[aria-disabled='true'] {
21450
- cursor: not-allowed;
21451
- & svg {
21452
- color: ${({
21453
- theme
21454
- }) => theme.colors['icon/disabled']};
21455
- }
21456
- }
21457
-
21458
- ${sx}
21459
- `;
21460
- var TextInputTrailingAction$1 = /*#__PURE__*/React.forwardRef(TextInputTrailingAction);
21541
+ }) => {
21542
+ const children = isNullable(propChildren) ? props.label : propChildren;
21543
+ return /*#__PURE__*/jsxRuntimeExports.jsx(BaseSelectOption, {
21544
+ ...props,
21545
+ children: children
21546
+ });
21547
+ };
21548
+ const BaseSelectOption = styled__default.default.option``;
21461
21549
 
21462
- const TextInput = ({
21463
- type = 'text',
21550
+ const Select = ({
21551
+ children,
21464
21552
  disabled,
21465
21553
  validationStatus,
21466
21554
  leadingVisual: LeadingVisual,
21467
- trailingVisual: TrailingVisual,
21468
- trailingAction,
21555
+ placeholder = '옵션 선택',
21469
21556
  ...props
21470
21557
  }, ref) => {
21471
- const inputRef = useProvidedOrCreatedRef(ref);
21472
- const focusInput = () => {
21473
- inputRef.current?.focus();
21558
+ const PLACEHOLDER_VALUE = '';
21559
+ const selectRef = useProvidedOrCreatedRef(ref);
21560
+ const [isValueEmpty, setIsValueEmpty] = React.useState(isNullable(props.value) || props.value === PLACEHOLDER_VALUE);
21561
+ const focusSelect = () => {
21562
+ selectRef.current?.focus();
21474
21563
  };
21475
- return /*#__PURE__*/jsxRuntimeExports.jsxs(TextInputWrapper, {
21564
+ return /*#__PURE__*/jsxRuntimeExports.jsxs(SelectWrapper, {
21476
21565
  disabled: disabled,
21477
- onClick: focusInput,
21566
+ onClick: focusSelect,
21478
21567
  hasLeadingVisual: !isNullable(LeadingVisual),
21479
- hasTrailingVisual: !isNullable(TrailingVisual),
21480
- hasTrailingAction: !isNullable(trailingAction),
21481
21568
  validationStatus: validationStatus,
21569
+ isValueEmpty: isValueEmpty,
21482
21570
  children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
21483
21571
  sx: {
21484
21572
  'flexShrink': 0,
21485
21573
  'fontSize': 'xxs',
21486
21574
  'fontWeight': 'medium',
21487
- 'color': color$1['text/neutral'],
21575
+ 'color': 'text/neutral',
21488
21576
  '& > svg': {
21489
21577
  display: 'block',
21490
21578
  width: 16,
21491
21579
  height: 16,
21492
- color: color$1['icon/neutral/bold']
21580
+ color: 'icon/neutral/bold'
21493
21581
  }
21494
21582
  },
21495
21583
  children: typeof LeadingVisual !== 'string' && reactIsExports.isValidElementType(LeadingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(LeadingVisual, {}) : LeadingVisual
21496
- }), /*#__PURE__*/jsxRuntimeExports.jsx(BaseInput, {
21584
+ }), /*#__PURE__*/jsxRuntimeExports.jsxs(BaseSelect, {
21497
21585
  ref: e => {
21498
21586
  isFunction(ref) ? ref(e) : null;
21499
- inputRef.current = e;
21587
+ selectRef.current = e;
21500
21588
  },
21501
- type: type,
21589
+ placeholder: placeholder,
21502
21590
  disabled: disabled,
21503
- ...props
21504
- }), /*#__PURE__*/jsxRuntimeExports.jsxs(View, {
21505
- sx: {
21506
- 'display': 'flex',
21507
- 'alignItems': 'center',
21508
- 'columnGap': 2,
21509
- 'flexShrink': 0,
21510
- 'fontSize': 'xxs',
21511
- 'fontWeight': 'medium',
21512
- 'color': color$1['text/neutral'],
21513
- '& > svg': {
21514
- display: 'block',
21515
- width: 16,
21516
- height: 16,
21517
- color: color$1['icon/neutral/bold']
21591
+ ...props,
21592
+ onChange: e => {
21593
+ props.onChange?.(e);
21594
+ if (!e.defaultPrevented) {
21595
+ if (e.target.value === PLACEHOLDER_VALUE) {
21596
+ setIsValueEmpty(true);
21597
+ } else {
21598
+ setIsValueEmpty(false);
21599
+ }
21518
21600
  }
21519
21601
  },
21520
- children: [typeof TrailingVisual !== 'string' && reactIsExports.isValidElementType(TrailingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(TrailingVisual, {}) : TrailingVisual, trailingAction ? /*#__PURE__*/React.cloneElement(trailingAction, {
21521
- disabled: disabled
21522
- }) : null]
21602
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(SelectOption, {
21603
+ label: placeholder,
21604
+ value: PLACEHOLDER_VALUE
21605
+ }), children]
21606
+ }), /*#__PURE__*/jsxRuntimeExports.jsx(StyledIcon, {
21607
+ sx: {
21608
+ position: 'absolute',
21609
+ top: '50%',
21610
+ transform: 'translateY(-50%)',
21611
+ right: 4,
21612
+ pointerEvents: 'none'
21613
+ },
21614
+ icon: SvgChevronDown,
21615
+ color: disabled ? 'icon/disabled' : 'icon/neutral/bolder',
21616
+ size: 16
21523
21617
  })]
21524
21618
  });
21525
21619
  };
21526
- const TextInputWrapper = styled__default.default.div`
21620
+ const SelectWrapper = styled__default.default.div`
21527
21621
  position: relative;
21528
21622
  width: ${forcePixelValue('100%')};
21529
21623
  border-width: ${forcePixelValue(1)};
@@ -21537,7 +21631,6 @@ const TextInputWrapper = styled__default.default.div`
21537
21631
  background-color: ${({
21538
21632
  theme
21539
21633
  }) => theme.colors['bg/input']};
21540
- cursor: text;
21541
21634
  display: inline-flex;
21542
21635
  align-items: center;
21543
21636
 
@@ -21553,11 +21646,16 @@ const TextInputWrapper = styled__default.default.div`
21553
21646
  color: ${({
21554
21647
  theme
21555
21648
  }) => theme.colors['text/neutral']};
21556
- input::placeholder {
21557
- color: ${({
21558
- theme
21559
- }) => theme.colors['text/neutral/subtlest']};
21560
- }
21649
+
21650
+ /**
21651
+ * placeholder style
21652
+ */
21653
+ ${({
21654
+ theme,
21655
+ isValueEmpty
21656
+ }) => isValueEmpty ? styled.css`
21657
+ color: ${theme.colors['text/neutral/subtlest']};
21658
+ ` : null}
21561
21659
 
21562
21660
  &:after {
21563
21661
  content: '';
@@ -21607,43 +21705,28 @@ const TextInputWrapper = styled__default.default.div`
21607
21705
  background-color: ${props.theme.colors['bg/disabled']};
21608
21706
  color: ${props.theme.colors['text/disabled']};
21609
21707
 
21610
- input::placeholder {
21708
+ select::placeholder {
21611
21709
  color: ${props.theme.colors['text/disabled']};
21612
21710
  }
21613
21711
 
21614
- input {
21712
+ select {
21615
21713
  cursor: not-allowed;
21616
21714
  }
21617
21715
  `};
21618
21716
 
21619
21717
  ${props => props.hasLeadingVisual && styled.css`
21620
21718
  padding-left: ${forcePixelValue(props.theme.space[4])};
21621
- input {
21719
+ select {
21622
21720
  padding-left: ${forcePixelValue(props.theme.space[2])};
21623
21721
  }
21624
21722
  `}
21625
21723
 
21626
- ${props => props.hasTrailingVisual && styled.css`
21627
- padding-right: ${forcePixelValue(props.theme.space[4])};
21628
- `}
21629
-
21630
- ${props => props.hasTrailingAction && styled.css`
21631
- padding-right: ${forcePixelValue(props.theme.space[2])};
21632
- `}
21633
-
21634
- ${props => (props.hasTrailingVisual || props.hasTrailingAction) && styled.css`
21635
- input {
21636
- padding-right: ${forcePixelValue(props.theme.space[2])};
21637
- }
21638
- `}
21639
-
21640
-
21641
- transition: color 100ms, background-color 100ms;
21724
+ transition: background-color 100ms;
21642
21725
  &:after {
21643
21726
  transition: border-color 100ms;
21644
21727
  }
21645
21728
  `;
21646
- const UnstyledInput = styled__default.default.input`
21729
+ const UnstyledSelect = styled__default.default.select`
21647
21730
  font-size: inherit;
21648
21731
  font-weight: inherit;
21649
21732
  line-height: inherit;
@@ -21658,23 +21741,30 @@ const UnstyledInput = styled__default.default.input`
21658
21741
  &:focus {
21659
21742
  outline: 0;
21660
21743
  }
21744
+
21745
+ appearance: none;
21746
+ -webkit-appearance: none;
21747
+ -moz-appearance: none;
21661
21748
  `;
21662
- const BaseInput = styled__default.default(UnstyledInput)`
21749
+ const BaseSelect = styled__default.default(UnstyledSelect)`
21663
21750
  padding-top: ${({
21664
21751
  theme
21665
21752
  }) => forcePixelValue(theme.space[3])};
21666
21753
  padding-right: ${({
21667
21754
  theme
21668
- }) => forcePixelValue(theme.space[4])};
21755
+ }) => forcePixelValue(theme.space[10])};
21669
21756
  padding-bottom: ${({
21670
21757
  theme
21671
21758
  }) => forcePixelValue(theme.space[3])};
21672
21759
  padding-left: ${({
21673
21760
  theme
21674
21761
  }) => forcePixelValue(theme.space[4])};
21762
+
21763
+ white-space: pre;
21764
+ text-overflow: ellipsis;
21675
21765
  `;
21676
- var TextInput$1 = Object.assign( /*#__PURE__*/React.forwardRef(TextInput), {
21677
- TrailingAction: TextInputTrailingAction$1
21766
+ var Select$1 = Object.assign( /*#__PURE__*/React.forwardRef(Select), {
21767
+ Option: SelectOption
21678
21768
  });
21679
21769
 
21680
21770
  const FormControlCaption = ({
@@ -21833,7 +21923,7 @@ const FormControl = ({
21833
21923
  successMessage: FormControlSuccessMessage
21834
21924
  }
21835
21925
  });
21836
- const inputComponentCandidates = [TextInput$1, Select$1, OverlaySelectInput$1, Checkbox$1, ...additionalInputComponentCandidates];
21926
+ const inputComponentCandidates = [TextInput$1, Select$1, SearchSelectInput$1, Checkbox$1, ...additionalInputComponentCandidates];
21837
21927
  const InputComponent = restComponents.find(component => inputComponentCandidates.some(candidate => /*#__PURE__*/React.isValidElement(component) && component.type === candidate));
21838
21928
  const isHorizontalLayoutNeeded = /*#__PURE__*/React.isValidElement(InputComponent) && InputComponent.type === Checkbox$1;
21839
21929
  return /*#__PURE__*/jsxRuntimeExports.jsx(FormControlContext.Provider, {
@@ -22008,6 +22098,7 @@ const Pagination = ({
22008
22098
  onPreviousClick = noop$2,
22009
22099
  onNextClick = noop$2,
22010
22100
  renderPage = (page, i) => /*#__PURE__*/jsxRuntimeExports.jsx(PaginationPage, {
22101
+ type: 'button',
22011
22102
  onClick: () => onPageClick(page, i),
22012
22103
  selected: i === currentPageIndex,
22013
22104
  children: page.label
@@ -22049,6 +22140,7 @@ const Pagination = ({
22049
22140
  sx: sx,
22050
22141
  children: [renderPreviousPageDirection({
22051
22142
  previousPageDirectionProps: {
22143
+ type: 'button',
22052
22144
  onClick: () => onPreviousClick(currentPageIndex),
22053
22145
  disabled: currentPageIndex === 0
22054
22146
  }
@@ -22086,6 +22178,7 @@ const Pagination = ({
22086
22178
  originalIndex
22087
22179
  }) => renderPaginationPage(page, originalIndex))], renderNextPageDirection({
22088
22180
  nextPageDirectionProps: {
22181
+ type: 'button',
22089
22182
  onClick: () => onNextClick(currentPageIndex),
22090
22183
  disabled: currentPageIndex === totalPageCount - 1
22091
22184
  }
@@ -22293,6 +22386,7 @@ const Pill = ({
22293
22386
  hasRemoveButton: !isNullable(propOnRemove),
22294
22387
  disabled: disabled,
22295
22388
  ...props,
22389
+ type: 'button',
22296
22390
  children: [typeof LeadingVisual !== 'string' && reactIsExports.isValidElementType(LeadingVisual) ? /*#__PURE__*/jsxRuntimeExports.jsx(LeadingVisual, {}) : LeadingVisual, /*#__PURE__*/jsxRuntimeExports.jsx("span", {
22297
22391
  title: children?.toString(),
22298
22392
  children: children
@@ -23325,6 +23419,7 @@ const TabItem = ({
23325
23419
  onClick?.(e);
23326
23420
  };
23327
23421
  return /*#__PURE__*/jsxRuntimeExports.jsx(BaseTabItem, {
23422
+ type: 'button',
23328
23423
  role: 'tab',
23329
23424
  ref: ref,
23330
23425
  variant: variant,
@@ -24237,9 +24332,9 @@ exports.ItemList = ItemList;
24237
24332
  exports.MotionView = MotionView;
24238
24333
  exports.Overlay = Overlay$1;
24239
24334
  exports.OverlayPopper = OverlayPopper;
24240
- exports.OverlaySelectInput = OverlaySelectInput$1;
24241
24335
  exports.Pagination = index$3;
24242
24336
  exports.Pill = index$2;
24337
+ exports.SearchSelectInput = SearchSelectInput$1;
24243
24338
  exports.Select = Select$1;
24244
24339
  exports.Space = Space;
24245
24340
  exports.Spinner = Spinner;