@bichon/ds 0.0.2 → 0.0.3

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.cjs CHANGED
@@ -7,10 +7,10 @@ var styled18 = require('@emotion/styled');
7
7
  var isPropValid8 = require('@emotion/is-prop-valid');
8
8
  var RadixAvatar = require('@radix-ui/react-avatar');
9
9
  var RadixProgress = require('@radix-ui/react-progress');
10
+ var lucideReact = require('lucide-react');
10
11
  var TextareaAutosize = require('react-textarea-autosize');
11
12
  var ToastPrimitive = require('@radix-ui/react-toast');
12
13
  var DialogPrimitive = require('@radix-ui/react-dialog');
13
- var lucideReact = require('lucide-react');
14
14
  var CheckboxPrimitive = require('@radix-ui/react-checkbox');
15
15
  var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
16
16
  var DropdownMenu2 = require('@radix-ui/react-dropdown-menu');
@@ -845,9 +845,24 @@ var Flex = react$1.forwardRef(
845
845
  }
846
846
  );
847
847
  Flex.displayName = "Flex";
848
+ var StyledTextFieldInputWrapper = styled18__default.default.div`
849
+ position: relative;
850
+ width: 100%;
851
+ `;
852
+ var StyledLeadingIconWrapper = styled18__default.default.div`
853
+ position: absolute;
854
+ left: 16px;
855
+ top: 50%;
856
+ transform: translateY(-50%);
857
+ color: ${({ theme: theme2 }) => theme2.colors.textTertiary};
858
+ display: flex;
859
+ align-items: center;
860
+ justify-content: center;
861
+ pointer-events: none;
862
+ `;
848
863
  var StyledTextFieldInput = styled18__default.default.input`
849
864
  width: 100%;
850
- padding: 12.5px 16px;
865
+ padding: ${({ $hasLeadingIcon }) => $hasLeadingIcon ? "12.5px 16px 12.5px 44px" : "12.5px 16px"};
851
866
  border: 1px solid
852
867
  ${({ theme: theme2, $variant }) => {
853
868
  if ($variant === "focus") return theme2.colors.lineAccent;
@@ -881,7 +896,7 @@ var StyledTextFieldTextarea = styled18__default.default(TextareaAutosize__defaul
881
896
  shouldForwardProp: (prop) => isPropValid8__default.default(prop) || prop === "minRows" || prop === "maxRows"
882
897
  })`
883
898
  width: 100%;
884
- padding: 12.5px 16px;
899
+ padding: ${({ $hasLeadingIcon }) => $hasLeadingIcon ? "12.5px 16px 12.5px 44px" : "12.5px 16px"};
885
900
  border: 1px solid
886
901
  ${({ theme: theme2, $variant }) => {
887
902
  if ($variant === "focus") return theme2.colors.lineAccent;
@@ -927,6 +942,7 @@ var TextField = react$1.forwardRef(
927
942
  multiline = false,
928
943
  variant = "default",
929
944
  width = "375px",
945
+ searchField = false,
930
946
  minRows = 2,
931
947
  maxRows,
932
948
  helperText,
@@ -934,6 +950,7 @@ var TextField = react$1.forwardRef(
934
950
  disabled,
935
951
  ...props
936
952
  }, ref) => {
953
+ const enableSearch = !multiline && searchField;
937
954
  const effectiveVariant = react$1.useMemo(() => {
938
955
  if (disabled) return "disabled";
939
956
  return variant;
@@ -948,6 +965,7 @@ var TextField = react$1.forwardRef(
948
965
  $variant: effectiveVariant,
949
966
  $width: "100%",
950
967
  $multiline: multiline,
968
+ $hasLeadingIcon: enableSearch,
951
969
  disabled: effectiveVariant === "disabled" || disabled
952
970
  };
953
971
  if (multiline) {
@@ -958,21 +976,32 @@ var TextField = react$1.forwardRef(
958
976
  };
959
977
  }
960
978
  return baseProps;
961
- }, [props, effectiveVariant, multiline, minRows, maxRows, disabled]);
979
+ }, [
980
+ props,
981
+ effectiveVariant,
982
+ multiline,
983
+ minRows,
984
+ maxRows,
985
+ disabled,
986
+ enableSearch
987
+ ]);
962
988
  return /* @__PURE__ */ jsxRuntime.jsxs(Flex, { direction: "column", width, children: [
963
- multiline ? /* @__PURE__ */ jsxRuntime.jsx(
964
- StyledTextFieldTextarea,
965
- {
966
- ref,
967
- ...inputProps
968
- }
969
- ) : /* @__PURE__ */ jsxRuntime.jsx(
970
- StyledTextFieldInput,
971
- {
972
- ref,
973
- ...inputProps
974
- }
975
- ),
989
+ /* @__PURE__ */ jsxRuntime.jsxs(StyledTextFieldInputWrapper, { children: [
990
+ enableSearch && /* @__PURE__ */ jsxRuntime.jsx(StyledLeadingIconWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { size: 20 }) }),
991
+ multiline ? /* @__PURE__ */ jsxRuntime.jsx(
992
+ StyledTextFieldTextarea,
993
+ {
994
+ ref,
995
+ ...inputProps
996
+ }
997
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
998
+ StyledTextFieldInput,
999
+ {
1000
+ ref,
1001
+ ...inputProps
1002
+ }
1003
+ )
1004
+ ] }),
976
1005
  shouldShowHelperText && /* @__PURE__ */ jsxRuntime.jsx(StyledHelperText, { $variant: effectiveVariant, children: helperText })
977
1006
  ] });
978
1007
  }
package/dist/index.d.cts 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.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';
@@ -809,9 +809,24 @@ var Flex = forwardRef(
809
809
  }
810
810
  );
811
811
  Flex.displayName = "Flex";
812
+ var StyledTextFieldInputWrapper = styled18.div`
813
+ position: relative;
814
+ width: 100%;
815
+ `;
816
+ var StyledLeadingIconWrapper = styled18.div`
817
+ position: absolute;
818
+ left: 16px;
819
+ top: 50%;
820
+ transform: translateY(-50%);
821
+ color: ${({ theme: theme2 }) => theme2.colors.textTertiary};
822
+ display: flex;
823
+ align-items: center;
824
+ justify-content: center;
825
+ pointer-events: none;
826
+ `;
812
827
  var StyledTextFieldInput = styled18.input`
813
828
  width: 100%;
814
- padding: 12.5px 16px;
829
+ padding: ${({ $hasLeadingIcon }) => $hasLeadingIcon ? "12.5px 16px 12.5px 44px" : "12.5px 16px"};
815
830
  border: 1px solid
816
831
  ${({ theme: theme2, $variant }) => {
817
832
  if ($variant === "focus") return theme2.colors.lineAccent;
@@ -845,7 +860,7 @@ var StyledTextFieldTextarea = styled18(TextareaAutosize, {
845
860
  shouldForwardProp: (prop) => isPropValid8(prop) || prop === "minRows" || prop === "maxRows"
846
861
  })`
847
862
  width: 100%;
848
- padding: 12.5px 16px;
863
+ padding: ${({ $hasLeadingIcon }) => $hasLeadingIcon ? "12.5px 16px 12.5px 44px" : "12.5px 16px"};
849
864
  border: 1px solid
850
865
  ${({ theme: theme2, $variant }) => {
851
866
  if ($variant === "focus") return theme2.colors.lineAccent;
@@ -891,6 +906,7 @@ var TextField = forwardRef(
891
906
  multiline = false,
892
907
  variant = "default",
893
908
  width = "375px",
909
+ searchField = false,
894
910
  minRows = 2,
895
911
  maxRows,
896
912
  helperText,
@@ -898,6 +914,7 @@ var TextField = forwardRef(
898
914
  disabled,
899
915
  ...props
900
916
  }, ref) => {
917
+ const enableSearch = !multiline && searchField;
901
918
  const effectiveVariant = useMemo(() => {
902
919
  if (disabled) return "disabled";
903
920
  return variant;
@@ -912,6 +929,7 @@ var TextField = forwardRef(
912
929
  $variant: effectiveVariant,
913
930
  $width: "100%",
914
931
  $multiline: multiline,
932
+ $hasLeadingIcon: enableSearch,
915
933
  disabled: effectiveVariant === "disabled" || disabled
916
934
  };
917
935
  if (multiline) {
@@ -922,21 +940,32 @@ var TextField = forwardRef(
922
940
  };
923
941
  }
924
942
  return baseProps;
925
- }, [props, effectiveVariant, multiline, minRows, maxRows, disabled]);
943
+ }, [
944
+ props,
945
+ effectiveVariant,
946
+ multiline,
947
+ minRows,
948
+ maxRows,
949
+ disabled,
950
+ enableSearch
951
+ ]);
926
952
  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
- ),
953
+ /* @__PURE__ */ jsxs(StyledTextFieldInputWrapper, { children: [
954
+ enableSearch && /* @__PURE__ */ jsx(StyledLeadingIconWrapper, { children: /* @__PURE__ */ jsx(Search, { size: 20 }) }),
955
+ multiline ? /* @__PURE__ */ jsx(
956
+ StyledTextFieldTextarea,
957
+ {
958
+ ref,
959
+ ...inputProps
960
+ }
961
+ ) : /* @__PURE__ */ jsx(
962
+ StyledTextFieldInput,
963
+ {
964
+ ref,
965
+ ...inputProps
966
+ }
967
+ )
968
+ ] }),
940
969
  shouldShowHelperText && /* @__PURE__ */ jsx(StyledHelperText, { $variant: effectiveVariant, children: helperText })
941
970
  ] });
942
971
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bichon/ds",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Bichon Design System - Design tokens & React components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",