@bichon/ds 0.0.2 → 0.0.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.
package/dist/index.d.ts CHANGED
@@ -320,15 +320,25 @@ declare const Flex: react.ForwardRefExoticComponent<FlexProps & react.RefAttribu
320
320
 
321
321
  type TextFieldVariant = 'default' | 'focus' | 'warning' | 'disabled';
322
322
 
323
- interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement> & TextareaHTMLAttributes<HTMLTextAreaElement>, 'width'> {
324
- multiline?: boolean;
323
+ interface BaseTextFieldProps {
325
324
  variant?: TextFieldVariant;
326
325
  width?: CSSProperties['width'];
327
- minRows?: number;
328
- maxRows?: number;
326
+ searchField?: boolean;
329
327
  helperText?: string;
330
328
  showHelperText?: boolean;
331
329
  }
330
+ type SinglelineTextFieldProps = BaseTextFieldProps & Omit<InputHTMLAttributes<HTMLInputElement>, 'width'> & {
331
+ multiline?: false;
332
+ minRows?: never;
333
+ maxRows?: never;
334
+ };
335
+ type MultilineTextFieldProps = BaseTextFieldProps & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'width'> & {
336
+ multiline: true;
337
+ minRows?: number;
338
+ maxRows?: number;
339
+ searchField?: never;
340
+ };
341
+ type TextFieldProps = SinglelineTextFieldProps | MultilineTextFieldProps;
332
342
  type TextFieldRef = HTMLInputElement | HTMLTextAreaElement;
333
343
  declare const TextField: react.ForwardRefExoticComponent<TextFieldProps & react.RefAttributes<TextFieldRef>>;
334
344
 
package/dist/index.js CHANGED
@@ -5,10 +5,10 @@ import styled18 from '@emotion/styled';
5
5
  import isPropValid8 from '@emotion/is-prop-valid';
6
6
  import * as RadixAvatar from '@radix-ui/react-avatar';
7
7
  import * as RadixProgress from '@radix-ui/react-progress';
8
+ import { Search, Check, ChevronRight, ChevronLeft, Ellipsis, X } from 'lucide-react';
8
9
  import TextareaAutosize from 'react-textarea-autosize';
9
10
  import * as ToastPrimitive from '@radix-ui/react-toast';
10
11
  import * as DialogPrimitive from '@radix-ui/react-dialog';
11
- import { Check, ChevronRight, ChevronLeft, Ellipsis, X } from 'lucide-react';
12
12
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
13
13
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
14
14
  import * as DropdownMenu2 from '@radix-ui/react-dropdown-menu';
@@ -255,95 +255,76 @@ var shadows = {
255
255
  xl: "0px 12px 24px 0px rgba(0, 27, 55, 0.18)",
256
256
  modal: "0px 4px 12px 0px rgba(0, 27, 55, 0.15)"
257
257
  };
258
-
259
- // src/assets/fonts/woff2/Pretendard-Thin.woff2
260
- var Pretendard_Thin_default = "./Pretendard-Thin-7QVSFVOF.woff2";
261
-
262
- // src/assets/fonts/woff2/Pretendard-ExtraLight.woff2
263
- var Pretendard_ExtraLight_default = "./Pretendard-ExtraLight-W2EFW6U4.woff2";
264
-
265
- // src/assets/fonts/woff2/Pretendard-Light.woff2
266
- var Pretendard_Light_default = "./Pretendard-Light-44S62PI7.woff2";
267
-
268
- // src/assets/fonts/woff2/Pretendard-Regular.woff2
269
- var Pretendard_Regular_default = "./Pretendard-Regular-CGOPAG2E.woff2";
270
-
271
- // src/assets/fonts/woff2/Pretendard-Medium.woff2
272
- var Pretendard_Medium_default = "./Pretendard-Medium-CLYKZXFO.woff2";
273
-
274
- // src/assets/fonts/woff2/Pretendard-SemiBold.woff2
275
- var Pretendard_SemiBold_default = "./Pretendard-SemiBold-Z6RJ4TYK.woff2";
276
-
277
- // src/assets/fonts/woff2/Pretendard-Bold.woff2
278
- var Pretendard_Bold_default = "./Pretendard-Bold-4AHBL5CN.woff2";
279
-
280
- // src/assets/fonts/woff2/Pretendard-ExtraBold.woff2
281
- var Pretendard_ExtraBold_default = "./Pretendard-ExtraBold-3U7HNRI4.woff2";
282
-
283
- // src/assets/fonts/woff2/Pretendard-Black.woff2
284
- var Pretendard_Black_default = "./Pretendard-Black-JLVK6ESK.woff2";
285
-
286
- // src/styles/globalStyles.ts
258
+ var PRETENDARD_CDN_BASE = "https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/woff2";
287
259
  var globalStyles = css`
288
260
  @font-face {
289
261
  font-family: 'Pretendard';
290
- src: url(${Pretendard_Thin_default}) format('woff2');
262
+ src: url('${PRETENDARD_CDN_BASE}/Pretendard-Thin.woff2')
263
+ format('woff2');
291
264
  font-weight: 100;
292
265
  font-display: swap;
293
266
  }
294
267
 
295
268
  @font-face {
296
269
  font-family: 'Pretendard';
297
- src: url(${Pretendard_ExtraLight_default}) format('woff2');
270
+ src: url('${PRETENDARD_CDN_BASE}/Pretendard-ExtraLight.woff2')
271
+ format('woff2');
298
272
  font-weight: 200;
299
273
  font-display: swap;
300
274
  }
301
275
 
302
276
  @font-face {
303
277
  font-family: 'Pretendard';
304
- src: url(${Pretendard_Light_default}) format('woff2');
278
+ src: url('${PRETENDARD_CDN_BASE}/Pretendard-Light.woff2')
279
+ format('woff2');
305
280
  font-weight: 300;
306
281
  font-display: swap;
307
282
  }
308
283
 
309
284
  @font-face {
310
285
  font-family: 'Pretendard';
311
- src: url(${Pretendard_Regular_default}) format('woff2');
286
+ src: url('${PRETENDARD_CDN_BASE}/Pretendard-Regular.woff2')
287
+ format('woff2');
312
288
  font-weight: 400;
313
289
  font-display: swap;
314
290
  }
315
291
 
316
292
  @font-face {
317
293
  font-family: 'Pretendard';
318
- src: url(${Pretendard_Medium_default}) format('woff2');
294
+ src: url('${PRETENDARD_CDN_BASE}/Pretendard-Medium.woff2')
295
+ format('woff2');
319
296
  font-weight: 500;
320
297
  font-display: swap;
321
298
  }
322
299
 
323
300
  @font-face {
324
301
  font-family: 'Pretendard';
325
- src: url(${Pretendard_SemiBold_default}) format('woff2');
302
+ src: url('${PRETENDARD_CDN_BASE}/Pretendard-SemiBold.woff2')
303
+ format('woff2');
326
304
  font-weight: 600;
327
305
  font-display: swap;
328
306
  }
329
307
 
330
308
  @font-face {
331
309
  font-family: 'Pretendard';
332
- src: url(${Pretendard_Bold_default}) format('woff2');
310
+ src: url('${PRETENDARD_CDN_BASE}/Pretendard-Bold.woff2')
311
+ format('woff2');
333
312
  font-weight: 700;
334
313
  font-display: swap;
335
314
  }
336
315
 
337
316
  @font-face {
338
317
  font-family: 'Pretendard';
339
- src: url(${Pretendard_ExtraBold_default}) format('woff2');
318
+ src: url('${PRETENDARD_CDN_BASE}/Pretendard-ExtraBold.woff2')
319
+ format('woff2');
340
320
  font-weight: 800;
341
321
  font-display: swap;
342
322
  }
343
323
 
344
324
  @font-face {
345
325
  font-family: 'Pretendard';
346
- src: url(${Pretendard_Black_default}) format('woff2');
326
+ src: url('${PRETENDARD_CDN_BASE}/Pretendard-Black.woff2')
327
+ format('woff2');
347
328
  font-weight: 900;
348
329
  font-display: swap;
349
330
  }
@@ -809,9 +790,24 @@ var Flex = forwardRef(
809
790
  }
810
791
  );
811
792
  Flex.displayName = "Flex";
793
+ var StyledTextFieldInputWrapper = styled18.div`
794
+ position: relative;
795
+ width: 100%;
796
+ `;
797
+ var StyledLeadingIconWrapper = styled18.div`
798
+ position: absolute;
799
+ left: 16px;
800
+ top: 50%;
801
+ transform: translateY(-50%);
802
+ color: ${({ theme: theme2 }) => theme2.colors.textTertiary};
803
+ display: flex;
804
+ align-items: center;
805
+ justify-content: center;
806
+ pointer-events: none;
807
+ `;
812
808
  var StyledTextFieldInput = styled18.input`
813
809
  width: 100%;
814
- padding: 12.5px 16px;
810
+ padding: ${({ $hasLeadingIcon }) => $hasLeadingIcon ? "12.5px 16px 12.5px 44px" : "12.5px 16px"};
815
811
  border: 1px solid
816
812
  ${({ theme: theme2, $variant }) => {
817
813
  if ($variant === "focus") return theme2.colors.lineAccent;
@@ -845,7 +841,7 @@ var StyledTextFieldTextarea = styled18(TextareaAutosize, {
845
841
  shouldForwardProp: (prop) => isPropValid8(prop) || prop === "minRows" || prop === "maxRows"
846
842
  })`
847
843
  width: 100%;
848
- padding: 12.5px 16px;
844
+ padding: ${({ $hasLeadingIcon }) => $hasLeadingIcon ? "12.5px 16px 12.5px 44px" : "12.5px 16px"};
849
845
  border: 1px solid
850
846
  ${({ theme: theme2, $variant }) => {
851
847
  if ($variant === "focus") return theme2.colors.lineAccent;
@@ -891,6 +887,7 @@ var TextField = forwardRef(
891
887
  multiline = false,
892
888
  variant = "default",
893
889
  width = "375px",
890
+ searchField = false,
894
891
  minRows = 2,
895
892
  maxRows,
896
893
  helperText,
@@ -898,6 +895,7 @@ var TextField = forwardRef(
898
895
  disabled,
899
896
  ...props
900
897
  }, ref) => {
898
+ const enableSearch = !multiline && searchField;
901
899
  const effectiveVariant = useMemo(() => {
902
900
  if (disabled) return "disabled";
903
901
  return variant;
@@ -912,6 +910,7 @@ var TextField = forwardRef(
912
910
  $variant: effectiveVariant,
913
911
  $width: "100%",
914
912
  $multiline: multiline,
913
+ $hasLeadingIcon: enableSearch,
915
914
  disabled: effectiveVariant === "disabled" || disabled
916
915
  };
917
916
  if (multiline) {
@@ -922,21 +921,32 @@ var TextField = forwardRef(
922
921
  };
923
922
  }
924
923
  return baseProps;
925
- }, [props, effectiveVariant, multiline, minRows, maxRows, disabled]);
924
+ }, [
925
+ props,
926
+ effectiveVariant,
927
+ multiline,
928
+ minRows,
929
+ maxRows,
930
+ disabled,
931
+ enableSearch
932
+ ]);
926
933
  return /* @__PURE__ */ jsxs(Flex, { direction: "column", width, children: [
927
- multiline ? /* @__PURE__ */ jsx(
928
- StyledTextFieldTextarea,
929
- {
930
- ref,
931
- ...inputProps
932
- }
933
- ) : /* @__PURE__ */ jsx(
934
- StyledTextFieldInput,
935
- {
936
- ref,
937
- ...inputProps
938
- }
939
- ),
934
+ /* @__PURE__ */ jsxs(StyledTextFieldInputWrapper, { children: [
935
+ enableSearch && /* @__PURE__ */ jsx(StyledLeadingIconWrapper, { children: /* @__PURE__ */ jsx(Search, { size: 20 }) }),
936
+ multiline ? /* @__PURE__ */ jsx(
937
+ StyledTextFieldTextarea,
938
+ {
939
+ ref,
940
+ ...inputProps
941
+ }
942
+ ) : /* @__PURE__ */ jsx(
943
+ StyledTextFieldInput,
944
+ {
945
+ ref,
946
+ ...inputProps
947
+ }
948
+ )
949
+ ] }),
940
950
  shouldShowHelperText && /* @__PURE__ */ jsx(StyledHelperText, { $variant: effectiveVariant, children: helperText })
941
951
  ] });
942
952
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@bichon/ds",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Bichon Design System - Design tokens & React components",
5
5
  "type": "module",
6
- "main": "./dist/index.cjs",
6
+ "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "imports": {
@@ -12,8 +12,7 @@
12
12
  "exports": {
13
13
  ".": {
14
14
  "types": "./dist/index.d.ts",
15
- "import": "./dist/index.js",
16
- "require": "./dist/index.cjs"
15
+ "import": "./dist/index.js"
17
16
  }
18
17
  },
19
18
  "files": [
Binary file
Binary file