@mrshmllw/smores-react 9.6.0-crumbs-seach-input-ui.2 → 9.6.0-crumbs-smol-input.1

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.
@@ -61,7 +61,7 @@ const StyledSelect = styled.select `
61
61
  background-color: ${({ $fallbackStyle }) => $fallbackStyle ? theme.colors.custard : theme.colors.cream};
62
62
 
63
63
  border-radius: 12px;
64
- padding: 18px 14px;
64
+ padding: 12px 12px;
65
65
  border: 2px solid
66
66
  ${({ $error }) => ($error ? theme.colors.strawberry : theme.colors.oatmeal)};
67
67
  height: auto;
@@ -1,4 +1,4 @@
1
- import { FC, FormEvent, HTMLAttributes } from 'react';
1
+ import { FC, FormEvent } from 'react';
2
2
  import { Icons } from '../Icon/iconsList';
3
3
  import { Color } from '../theme';
4
4
  import { MarginProps } from '../utils/space';
@@ -18,5 +18,7 @@ export type IconStrictProps = {
18
18
  handleClick?: (e: FormEvent<HTMLButtonElement>) => void;
19
19
  /** rotation degrees */
20
20
  rotate?: number;
21
- } & MarginProps & Partial<HTMLAttributes<HTMLButtonElement>>;
21
+ /** Title attribute */
22
+ title?: string;
23
+ } & MarginProps;
22
24
  export declare const IconStrict: FC<IconStrictProps>;
@@ -22,14 +22,15 @@ const iconSizes = {
22
22
  padding: 3,
23
23
  },
24
24
  };
25
- export const IconStrict = ({ id, className = '', size = 16, render, iconColor, backgroundColor, rotate, handleClick, title, ...otherProps }) => {
26
- const isButton = !!handleClick;
27
- const defaultLabel = isButton ? (title ? title : 'icon-button') : undefined;
28
- return (React.createElement(IconContainer, { id: id, as: isButton ? 'button' : 'div', className: className, "$size": size, "$backgroundColor": backgroundColor, onClick: handleClick, title: defaultLabel, ...otherProps },
29
- React.createElement(Icon, { render: render, size: backgroundColor ? iconSizes[size].smallSize : size, color: iconColor, rotate: rotate })));
30
- };
25
+ export const IconStrict = ({ id, className = '', size = 16, render, iconColor, backgroundColor, rotate, handleClick, title, ...marginProps }) => (React.createElement(IconContainer, { id: id, forwardedAs: handleClick ? 'button' : 'div', className: className, "$size": size, title: title, ...marginProps, "$backgroundColor": backgroundColor, onClick: handleClick, onKeyDown: (e) => {
26
+ if (!handleClick)
27
+ return;
28
+ if (e.key === 'Enter') {
29
+ handleClick;
30
+ }
31
+ } },
32
+ React.createElement(Icon, { render: render, className: className, size: backgroundColor ? iconSizes[size].smallSize : size, color: iconColor, rotate: rotate, ...marginProps })));
31
33
  const IconContainer = styled.div(({ $size, $backgroundColor, onClick }) => css `
32
- position: relative;
33
34
  padding: ${$backgroundColor ? `${iconSizes[$size].padding}px` : 0};
34
35
  width: 100%;
35
36
  max-width: ${$size}px;
@@ -1 +1 @@
1
- {"version":3,"file":"IconStrict.js","sourceRoot":"","sources":["../../src/IconStrict/IconStrict.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAA;AAC5D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAG9B,OAAO,EAAS,KAAK,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAsBzD,MAAM,SAAS,GAAG;IAChB,EAAE,EAAE;QACF,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,EAAE;KACZ;IACD,EAAE,EAAE;QACF,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,CAAC;KACX;IACD,EAAE,EAAE;QACF,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,CAAC;KACX;IACD,EAAE,EAAE;QACF,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,CAAC;KACX;CACF,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAwB,CAAC,EAC9C,EAAE,EACF,SAAS,GAAG,EAAE,EACd,IAAI,GAAG,EAAE,EACT,MAA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O,EAAE,WAAW,EACpB,SAAS,EAAE,CAAC,CAAkB,EAAE,EAAE;QAChC,IAAI,CAAC,WAAW;YAAE,OAAM;QACxB,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;YACtB,WAAW,CAAA;QACb,CAAC;IACH,CAAC;IAED,oBAAC,IAAI,IACH,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EACxD,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,KACV,WAAW,GACf,CACY,CACjB,CAAA;AAQD,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAC9B,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;eAChC,gBAAgB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;;iBAEpD,KAAK;cACR,KAAK;;wBAEK,gBAAgB;IAClC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAChC,CAAC,CAAC,MAAM;cACA,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;;MAEvC,OAAO;IACT;;0BAGI,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,MACnE;;;KAGD;;MAEC,iBAAiB;GACpB,CACF,CAAA"}
@@ -21,8 +21,6 @@ export interface SearchInputProps extends CommonFieldProps {
21
21
  notFoundComponent?: ReactNode;
22
22
  /** optional boolean to show search icon */
23
23
  showIcon?: boolean;
24
- /** optional boolean to show a clear search button */
25
- clearSearch?: boolean;
26
24
  /** Optional callback to run on blur */
27
25
  onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
28
26
  /** Optional default value for input */
@@ -39,14 +37,3 @@ export interface SearchInputProps extends CommonFieldProps {
39
37
  fuzzySearchOptions?: IFuseOptions<SearchInputItem>;
40
38
  }
41
39
  export declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLInputElement>>;
42
- export declare const Icons: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("..").MarginProps & import("..").PaddingProps & import("../utils/flex").FlexProps & import("../utils/measure").MeasureProps & React.HTMLAttributes<HTMLElement> & {
43
- as?: React.ElementType | undefined;
44
- forwardedAs?: React.ElementType | undefined;
45
- } & React.RefAttributes<HTMLDivElement>, "ref"> & {
46
- ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
47
- }, {
48
- $clearSearch: boolean;
49
- }>> & string & Omit<React.ForwardRefExoticComponent<import("..").MarginProps & import("..").PaddingProps & import("../utils/flex").FlexProps & import("../utils/measure").MeasureProps & React.HTMLAttributes<HTMLElement> & {
50
- as?: React.ElementType | undefined;
51
- forwardedAs?: React.ElementType | undefined;
52
- } & React.RefAttributes<HTMLDivElement>>, keyof React.Component<any, {}, any>>;
@@ -1,12 +1,8 @@
1
1
  import Fuse from 'fuse.js';
2
- import React, { forwardRef, useMemo, useRef, useState, } from 'react';
3
- import styled from 'styled-components';
2
+ import React, { forwardRef, useMemo, useState, } from 'react';
4
3
  import { Box } from '../Box';
5
- import { IconStrict } from '../IconStrict';
6
4
  import { Field } from '../fields/Field';
7
5
  import { Input, StyledFrontIcon } from '../fields/components/CommonInput';
8
- import { useOnClickOutside } from '../hooks';
9
- import { theme } from '../theme';
10
6
  import { useUniqueId } from '../utils/id';
11
7
  import { useControllableState } from '../utils/useControlledState';
12
8
  import { SearchOptions } from './components/SearchOptions';
@@ -18,8 +14,7 @@ const defaultFuzzySearchOptions = {
18
14
  threshold: 0.45,
19
15
  distance: 55,
20
16
  };
21
- export const SearchInput = forwardRef(function SearchInput({ id: idProp, name = 'search_input', className = '', placeholder, searchList, showIcon = false, renderAsTitle = false, value, onBlur, onFound, onNotFound, notFoundComponent, fallbackStyle, resultsRelativePosition = false, resultsBorder = true, enableFuzzySearch = false, fuzzySearchOptions, clearSearch, ...otherProps }, ref) {
22
- const wrapperRef = useRef(null);
17
+ export const SearchInput = forwardRef(function SearchInput({ id: idProp, name = 'search_input', className = '', placeholder, searchList, showIcon = false, renderAsTitle = false, value, onBlur, onFound, onNotFound, notFoundComponent, fallbackStyle, resultsRelativePosition = false, resultsBorder = true, enableFuzzySearch = false, fuzzySearchOptions, ...otherProps }, ref) {
23
18
  const id = useUniqueId(idProp);
24
19
  const [showOptions, setShowOptions] = useState(false);
25
20
  const [selectedValue, setSelectedValue] = useControllableState({
@@ -27,11 +22,6 @@ export const SearchInput = forwardRef(function SearchInput({ id: idProp, name =
27
22
  stateProp: value,
28
23
  });
29
24
  const [searchQuery, setSearchQuery] = useState(null);
30
- const [focusedIndex, setFocusedIndex] = useState(-1);
31
- useOnClickOutside({
32
- ref: wrapperRef,
33
- callback: () => setShowOptions(false),
34
- });
35
25
  const fuse = useMemo(() => {
36
26
  return new Fuse(searchList, {
37
27
  ...defaultFuzzySearchOptions,
@@ -60,7 +50,6 @@ export const SearchInput = forwardRef(function SearchInput({ id: idProp, name =
60
50
  const displayedInputText = getDisplayedInputText();
61
51
  const updateSearchQuery = (query) => {
62
52
  setSearchQuery(query);
63
- setFocusedIndex(-1);
64
53
  if (query === null) {
65
54
  setShowOptions(false);
66
55
  }
@@ -68,16 +57,6 @@ export const SearchInput = forwardRef(function SearchInput({ id: idProp, name =
68
57
  setShowOptions(2 <= query.length);
69
58
  }
70
59
  };
71
- const handleClick = () => {
72
- if (searchQuery !== null && 2 <= searchQuery.length) {
73
- updateSearchQuery(searchQuery);
74
- setShowOptions(true);
75
- }
76
- else if (selectedValue !== null && searchQuery === null) {
77
- setSearchQuery(selectedValue);
78
- setShowOptions(true);
79
- }
80
- };
81
60
  const handleInputChange = (event) => {
82
61
  const nextValue = event.currentTarget.value;
83
62
  updateSearchQuery(nextValue);
@@ -87,52 +66,15 @@ export const SearchInput = forwardRef(function SearchInput({ id: idProp, name =
87
66
  setSelectedValue(nextValue.label);
88
67
  onFound(nextValue.value);
89
68
  };
90
- const handleClearSearch = () => {
91
- updateSearchQuery(null);
92
- setSelectedValue(null);
93
- };
94
- const handleCaretClick = () => {
95
- setShowOptions(!showOptions);
96
- };
97
- const handleKeyDown = (event) => {
98
- if (event.key === 'ArrowDown') {
99
- event.preventDefault();
100
- const nextIndex = (focusedIndex + 1) % filteredList.length;
101
- setFocusedIndex(nextIndex);
102
- }
103
- else if (event.key === 'ArrowUp') {
104
- event.preventDefault();
105
- const prevIndex = (focusedIndex - 1 + filteredList.length) % filteredList.length;
106
- setFocusedIndex(prevIndex);
107
- }
108
- };
109
- return (React.createElement(Wrapper, { ref: wrapperRef },
110
- React.createElement(Field, { className: className, renderAsTitle: renderAsTitle, htmlFor: id, ...otherProps },
111
- React.createElement(Box, { flex: true, alignItems: "center", justifyContent: "flex-start" },
112
- showIcon && React.createElement(StyledFrontIcon, { render: "search", color: "sesame" }),
113
- React.createElement(Input, { id: id, name: name, ref: ref, placeholder: placeholder, "$error": otherProps.error, "$frontIcon": showIcon ? 'search' : undefined, "$fallbackStyle": fallbackStyle, autoComplete: "off", value: displayedInputText, onFocus: handleClick, onChange: handleInputChange, selected: isSelected, onClick: handleClick, onKeyDown: handleKeyDown, onBlur: (e) => {
114
- if (displayedInputText === '') {
115
- setSearchQuery(null);
116
- }
117
- onBlur?.(e);
118
- } }),
119
- React.createElement(Icons, { flex: true, alignItems: "center", gap: "8px", "$clearSearch": !!clearSearch },
120
- clearSearch && (React.createElement(IconStrict, { render: "plus", rotate: 45, iconColor: "marzipan", handleClick: handleClearSearch, size: 24 })),
121
- React.createElement(Line, null),
122
- React.createElement(IconStrict, { render: "caret", iconColor: "marzipan", rotate: showOptions ? 180 : 0, handleClick: handleCaretClick, size: 24 }))),
123
- showOptions && (React.createElement(SearchOptions, { displayedList: filteredList, selectedValue: selectedValue, focusedIndex: focusedIndex, onKeyDown: handleKeyDown, searchTerm: searchQuery || '', onSelect: handleSelect, positionRelative: resultsRelativePosition, resultsBorder: resultsBorder, onNotFound: onNotFound, notFoundComponent: notFoundComponent })))));
69
+ return (React.createElement(Field, { className: className, renderAsTitle: renderAsTitle, htmlFor: id, ...otherProps },
70
+ React.createElement(Box, { flex: true, alignItems: "center", justifyContent: "flex-start" },
71
+ showIcon && React.createElement(StyledFrontIcon, { render: "search", color: "sesame" }),
72
+ React.createElement(Input, { id: id, name: name, ref: ref, placeholder: placeholder, "$frontIcon": showIcon ? 'search' : undefined, "$fallbackStyle": fallbackStyle, autoComplete: "off", value: displayedInputText, onChange: handleInputChange, selected: isSelected, onBlur: (e) => {
73
+ if (displayedInputText === '') {
74
+ setSearchQuery(null);
75
+ }
76
+ onBlur?.(e);
77
+ } })),
78
+ showOptions && (React.createElement(SearchOptions, { displayedList: filteredList, searchTerm: searchQuery || '', onSelect: handleSelect, positionRelative: resultsRelativePosition, resultsBorder: resultsBorder, onNotFound: onNotFound, notFoundComponent: notFoundComponent }))));
124
79
  });
125
- const Wrapper = styled(Box) `
126
- position: relative;
127
- `;
128
- const Line = styled(Box) `
129
- background: ${theme.colors.oatmeal};
130
- height: 24px;
131
- width: 1px;
132
- `;
133
- export const Icons = styled(Box) `
134
- position: relative;
135
- right: ${({ $clearSearch }) => ($clearSearch ? '78px' : '48px')};
136
- margin-right: ${({ $clearSearch }) => ($clearSearch ? '-78px' : '-48px')};
137
- `;
138
80
  //# sourceMappingURL=SearchInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../src/SearchInput/SearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAsB,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EAAE,EAIZ,UAAU,EACV,OAAO,EACP,MAAM,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E,kBAAkB,EACzB,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;oBACZ,IAAI,kBAAkB,KAAK,EAAE,EAAE,CAAC;wBAC9B,cAAc,CAAC,IAAI,CAAC,CAAA;oBACtB,CAAC;oBACD,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;gBACb,CAAC,GACD,CACE;QAEL,WAAW,IAAI,CACd,oBAAC,aAAa,IACZ,aAAa,EAAE,YAAY,EAC3B,UAAU,EAAE,WAAW,IAAI,EAAE,EAC7B,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,uBAAuB,EACzC,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CACK,CACT,CAAA;AACH,CAAC,CACF,CAAA"}
@@ -5,13 +5,7 @@ type Option = {
5
5
  };
6
6
  type SearchOptionsProps = {
7
7
  displayedList: Array<Option>;
8
- selectedValue: string | null;
9
- focusedIndex: number;
10
8
  onSelect: (option: Option) => void;
11
- onKeyDown: (e: {
12
- key: string;
13
- preventDefault: () => void;
14
- }) => void;
15
9
  positionRelative: boolean;
16
10
  resultsBorder: boolean;
17
11
  onNotFound?: (searchTerm: string) => void;
@@ -1,36 +1,19 @@
1
- import React, { createRef, useEffect, useRef } from 'react';
1
+ import { darken } from 'polished';
2
+ import React from 'react';
2
3
  import styled, { css } from 'styled-components';
3
4
  import { Box } from '../../Box';
4
- import { Icon } from '../../Icon';
5
5
  import { theme } from '../../theme';
6
6
  import { EmptyResults } from './EmptyResults';
7
- export const SearchOptions = ({ displayedList, selectedValue, focusedIndex, onSelect, onKeyDown, positionRelative, resultsBorder, onNotFound, searchTerm, notFoundComponent, }) => {
8
- const itemRefs = useRef([]);
9
- useEffect(() => {
10
- itemRefs.current = displayedList.map((_, i) => itemRefs.current[i] ?? createRef());
11
- }, [displayedList.length]);
12
- useEffect(() => {
13
- const itemRef = itemRefs?.current[focusedIndex]?.current;
14
- if (focusedIndex >= 0 && itemRef) {
15
- itemRef.focus();
16
- }
17
- }, [focusedIndex]);
7
+ export const SearchOptions = ({ displayedList, onSelect, positionRelative, resultsBorder, onNotFound, searchTerm, notFoundComponent, }) => {
18
8
  return (React.createElement(BoxWithPositionRelative, null,
19
9
  React.createElement(StyledResultsContainer, { "$positionRelative": positionRelative },
20
- React.createElement(ResultsList, { "$resultsBorder": resultsBorder, onKeyDown: onKeyDown }, displayedList.length ? (displayedList.map((el, i) => {
21
- const isSelected = selectedValue === el.label;
22
- return (React.createElement(ListButton, { type: "button", "aria-label": el.label + '_list_item', ref: itemRefs.current[i], key: i, onClick: () => onSelect(el), "$isSelected": isSelected || focusedIndex === i },
23
- el.label,
24
- isSelected && (React.createElement(Icon, { render: "tick", size: 16, color: "marshmallowPink" }))));
25
- })) : (React.createElement(EmptyResults, { onNotFound: onNotFound, searchTerm: searchTerm, notFoundComponent: notFoundComponent }))))));
10
+ React.createElement(ResultsList, { "$resultsBorder": resultsBorder }, displayedList.length ? (displayedList.map((el, i) => (React.createElement("li", { key: i, onClick: () => onSelect(el) }, el.label)))) : (React.createElement(EmptyResults, { onNotFound: onNotFound, searchTerm: searchTerm, notFoundComponent: notFoundComponent }))))));
26
11
  };
27
12
  const StyledResultsContainer = styled.div `
28
13
  box-sizing: border-box;
29
- overflow: hidden;
30
- margin: -16px;
31
- padding: 16px;
14
+ overflow-y: hidden;
32
15
  ${({ $positionRelative }) => !$positionRelative && 'position: absolute;'}
33
- width: calc(100% + 32px);
16
+ width: 100%;
34
17
  left: 0px;
35
18
  top: -8px;
36
19
 
@@ -44,12 +27,14 @@ const ResultsList = styled.ul `
44
27
  overflow-y: auto;
45
28
  padding: 0;
46
29
  margin: 0;
47
- background-color: ${theme.colors.cream};
30
+ background-color: ${theme.colors.custard};
48
31
  border-radius: 12px;
49
32
  margin-top: 14px;
50
33
  z-index: 1000;
51
- border: 1px solid ${theme.colors.oatmeal};
52
- box-shadow: 0px 4px 8px 2px rgba(0, 0, 0, 0.25);
34
+ ${({ $resultsBorder }) => $resultsBorder &&
35
+ css `
36
+ border: 2px solid ${theme.colors.oatmeal};
37
+ `}
53
38
 
54
39
  li {
55
40
  padding: 16px 14px;
@@ -58,38 +43,16 @@ const ResultsList = styled.ul `
58
43
  color: ${theme.colors.liquorice};
59
44
  cursor: pointer;
60
45
 
61
- &:hover {
62
- background-color: ${theme.colors.mascarpone};
63
- }
64
- }
65
- `;
66
- const ListButton = styled.button `
67
- display: flex;
68
- justify-content: space-between;
69
- padding: 16px 14px;
70
- box-sizing: border-box;
71
- font-size: 16px;
72
- width: 100%;
73
- color: ${theme.colors.liquorice};
74
- cursor: pointer;
46
+ ${({ $resultsBorder }) => $resultsBorder && `border-bottom: 2px solid ${theme.colors.oatmeal};`}
75
47
 
76
- &:hover {
77
- background-color: ${theme.colors.mascarpone};
78
- }
48
+ &:last-child {
49
+ ${({ $resultsBorder }) => $resultsBorder && `border-bottom:none`}
50
+ }
79
51
 
80
- &:focus {
81
- outline: none;
82
- background-color: ${theme.colors.mascarpone};
83
- }
84
- &:focus-visible {
85
- outline: none;
86
- background-color: ${theme.colors.mascarpone};
52
+ &:hover {
53
+ background-color: ${darken(0.1, theme.colors.custard)};
54
+ }
87
55
  }
88
-
89
- ${({ $isSelected }) => $isSelected &&
90
- css `
91
- background-color: ${theme.colors.mascarpone};
92
- `}
93
56
  `;
94
57
  const BoxWithPositionRelative = styled(Box) `
95
58
  position: relative;
@@ -1 +1 @@
1
- {"version":3,"file":"SearchOptions.js","sourceRoot":"","sources":["../../../src/SearchInput/components/SearchOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC1E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAA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AE,EAAE,EAAE,CACpB,WAAW;IACX,GAAG,CAAA;0BACmB,KAAK,CAAC,MAAM,CAAC,UAAU;KAC5C;CACJ,CAAA;AAED,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;CAE1C,CAAA"}
1
+ {"version":3,"file":"SearchOptions.js","sourceRoot":"","sources":["../../../src/SearchInput/components/SearchOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,KAAwB,MAAM,OAAO,CAAA;AAC5C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAiB7C,MAAM,CAAC,MAAM,aAAa,GAA2B,CAAC,EACpD,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,UAAU,EACV,iBAAiB,GAClB,EAAE,EAAE;IACH,OAAO,CACL,oBAAC,uBAAuB;QACtB,oBAAC,sBAAsB,yBAAoB,gBAAgB;YACzD,oBAAC,WAAW,sBAAiB,aAAa,IACvC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CACtB,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAC3B,4BAAI,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IACpC,EAAE,CAAC,KAAK,CACN,CACN,CAAC,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,YAAY,IACX,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CACW,CACS,CACD,CAC3B,CAAA;AACH,CAAC,CAAA;AAED,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAExC;;;IAGG,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE,CAAC,CAAC,iBAAiB,IAAI,qBAAqB;;;;;;;;CAQzE,CAAA;AAED,MAAM,WAAW,GAAG,MAAM,CAAC,EAAE,CAE5B;;;;;;sBAMqB,KAAK,CAAC,MAAM,CAAC,OAAO;;;;IAItC,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,CACvB,cAAc;IACd,GAAG,CAAA;0BACmB,KAAK,CAAC,MAAM,CAAC,OAAO;KACzC;;;;;;aAMQ,KAAK,CAAC,MAAM,CAAC,SAAS;;;MAG7B,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,CACvB,cAAc,IAAI,4BAA4B,KAAK,CAAC,MAAM,CAAC,OAAO,GAAG;;;QAGnE,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,cAAc,IAAI,oBAAoB;;;;0BAI5C,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;;;CAG1D,CAAA;AAED,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;CAE1C,CAAA"}
@@ -3,36 +3,14 @@ import { TableProps } from './types';
3
3
  /**
4
4
  * A table component that displays data with various features such as expandable rows, striped rows, and fixed headers.
5
5
  *
6
- * Caveats:
7
- * - subRows should always have the same columns as the Parent table.
8
- * - stripedColor wont be applied to subRows or subTables.
9
- * - rowActions will always need an onClick, this will be automatically passed onto the ReactNode you place & will be selectable
10
- * - rows will scale depending on the cell content size
11
- * - using clickableRow with clickable cells, ensure you use e.stopPropagation in your cells onClick
6
+ * ## Caveats:
7
+ * - `subRows` should always have the same columns as the Parent table
8
+ * - `stripedColor` wont be applied to `subRows` or `subTables`
9
+ * - `rowActions` will always need an `onClick`, this will be automatically passed onto the `ReactNode` you place & will be selectable
10
+ * - Rows will scale depending on the cell content size
11
+ * - Using `clickableRow` with clickable cells, ensure you use `e.stopPropagation` in your cells `onClick`
12
12
  *
13
- * Improvements:
13
+ * ## Improvements:
14
14
  * - It would be nice if we expandable logic inside this component, e.g the presence of certain props would automatically add this
15
- * -
16
- *
17
- * @template T - The type of data the table displays.
18
- * @property {T[]} data - Array of data to be displayed in the table.
19
- * @property {TableColumn<T>[]} columns - Array of columns to display in the table.
20
- * @property {boolean} [hasKeyline=false] - If true, the table header will have a key line.
21
- * @property {boolean} [fixedHeader=false] - If true, the table header will be fixed/sticky.
22
- * @property {string} [headerHeight] - Sets the height of the header.
23
- * @property {function(T): boolean} [expandable] - A function to determine if a row is expandable.
24
- * @property {Color} [stripedColor] - If present, the table rows will have alternating colors.
25
- * @property {Color} [headerColor='mascarpone'] - The color for the table header.
26
- * @property {Color} [rowColor='custard'] - The default color for each table row.
27
- * @property {Color} [rowBorderColor='oatmeal'] - The default color for each table row border.
28
- * @property {ReactElement} [subTable] - A React element to show when a row is expanded.
29
- * @property {Object} [subRows] - Settings for sub rows.
30
- * @property {function(T): ReactElement} subRows.rows - Function that returns a React element for the sub row.
31
- * @property {boolean} [subRows.showOnExpand=false] - If true, the sub rows will only be shown when the row is expanded.
32
- * @property {RowAction<T>[]} [rowActions] - Array of actions that can be performed on each row.
33
- * @property {function<T>: void} [clickableRow] - Function to apply to a row, to make the entire row clickable, useful for navigation.
34
- * @property {string} [rowPadding] - The Y padding for each row.
35
- * @property {string} [columnPadding] - The X padding for each row.
36
- * @property {string} [noDataContent] - The text to show when there is no available data to map through.
37
15
  */
38
16
  export declare const Table: <T extends object>({ columns, data, fixedHeader, hasKeyline, expandable, subTable, subRows, headerHeight, headerColor, rowColor, stripedColor, rowBorderColor, rowActions, clickableRow, rowPadding, columnPadding, noDataContent, }: TableProps<T>) => React.JSX.Element;
@@ -6,37 +6,15 @@ import { StyledCell, StyledTable } from './components/commonComponents';
6
6
  /**
7
7
  * A table component that displays data with various features such as expandable rows, striped rows, and fixed headers.
8
8
  *
9
- * Caveats:
10
- * - subRows should always have the same columns as the Parent table.
11
- * - stripedColor wont be applied to subRows or subTables.
12
- * - rowActions will always need an onClick, this will be automatically passed onto the ReactNode you place & will be selectable
13
- * - rows will scale depending on the cell content size
14
- * - using clickableRow with clickable cells, ensure you use e.stopPropagation in your cells onClick
9
+ * ## Caveats:
10
+ * - `subRows` should always have the same columns as the Parent table
11
+ * - `stripedColor` wont be applied to `subRows` or `subTables`
12
+ * - `rowActions` will always need an `onClick`, this will be automatically passed onto the `ReactNode` you place & will be selectable
13
+ * - Rows will scale depending on the cell content size
14
+ * - Using `clickableRow` with clickable cells, ensure you use `e.stopPropagation` in your cells `onClick`
15
15
  *
16
- * Improvements:
16
+ * ## Improvements:
17
17
  * - It would be nice if we expandable logic inside this component, e.g the presence of certain props would automatically add this
18
- * -
19
- *
20
- * @template T - The type of data the table displays.
21
- * @property {T[]} data - Array of data to be displayed in the table.
22
- * @property {TableColumn<T>[]} columns - Array of columns to display in the table.
23
- * @property {boolean} [hasKeyline=false] - If true, the table header will have a key line.
24
- * @property {boolean} [fixedHeader=false] - If true, the table header will be fixed/sticky.
25
- * @property {string} [headerHeight] - Sets the height of the header.
26
- * @property {function(T): boolean} [expandable] - A function to determine if a row is expandable.
27
- * @property {Color} [stripedColor] - If present, the table rows will have alternating colors.
28
- * @property {Color} [headerColor='mascarpone'] - The color for the table header.
29
- * @property {Color} [rowColor='custard'] - The default color for each table row.
30
- * @property {Color} [rowBorderColor='oatmeal'] - The default color for each table row border.
31
- * @property {ReactElement} [subTable] - A React element to show when a row is expanded.
32
- * @property {Object} [subRows] - Settings for sub rows.
33
- * @property {function(T): ReactElement} subRows.rows - Function that returns a React element for the sub row.
34
- * @property {boolean} [subRows.showOnExpand=false] - If true, the sub rows will only be shown when the row is expanded.
35
- * @property {RowAction<T>[]} [rowActions] - Array of actions that can be performed on each row.
36
- * @property {function<T>: void} [clickableRow] - Function to apply to a row, to make the entire row clickable, useful for navigation.
37
- * @property {string} [rowPadding] - The Y padding for each row.
38
- * @property {string} [columnPadding] - The X padding for each row.
39
- * @property {string} [noDataContent] - The text to show when there is no available data to map through.
40
18
  */
41
19
  export const Table = ({ columns, data, fixedHeader = true, hasKeyline = false, expandable, subTable, subRows, headerHeight, headerColor = 'mascarpone', rowColor = 'custard', stripedColor, rowBorderColor = 'oatmeal', rowActions, clickableRow, rowPadding, columnPadding, noDataContent, }) => {
42
20
  const showActionsCell = expandable || rowActions;
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAGvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAmB,EACtC,OAAO,EACP,IAAI,EACJ,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,KAAK,EAClB,UAAU,EACV,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,WAAW,GAAG,YAAY,EAC1B,QAAQ,GAAG,SAAS,EACpB,YAAY,EACZ,cAAc,GAAG,SAAS,EAC1B,UAAU,EACV,YAAY,EACZ,UAAU,EACV,aAAa,EACb,aAAa,GACC,EAAE,EAAE;IAClB,MAAM,eAAe,GAAG,UAAU,IAAI,UAAU,CAAA;IAChD,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAA;IAC3E,OAAO,CACL,oBAAC,WAAW;QACV;YACE,oBAAC,WAAW,IACV,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,YA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EAAE,QAAQ,EACb,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,GAC1B,CACH,CAAC,CACE,CACI,CACf,CAAA;AACH,CAAC,CAAA"}
@@ -44,31 +44,51 @@ export interface TableColumn<T> {
44
44
  hideOverflow?: boolean;
45
45
  cell?: RowCellRenderer<T>;
46
46
  }
47
+ /** @template T - The type of data the table displays. */
47
48
  interface CommonTableProps<T> {
49
+ /** Array of columns to display in the table. */
48
50
  columns: TableColumn<T>[];
51
+ /** Sets the height of the header. */
49
52
  headerHeight?: string;
53
+ /** If true, the table header will be fixed/sticky. */
50
54
  fixedHeader?: boolean;
55
+ /** If true, the table header will have a key line. */
51
56
  hasKeyline?: boolean;
57
+ /** If present, the table rows will have alternating colors. */
52
58
  stripedColor?: Color;
59
+ /** A function to determine if a row is expandable. */
53
60
  expandable?: (rowData: T) => boolean;
61
+ /** The color for the table header. */
54
62
  headerColor?: Color;
63
+ /** The default color for each table row. */
55
64
  rowColor?: Color;
65
+ /** The default color for each table row border. */
56
66
  rowBorderColor?: Color;
67
+ /** A React element to show when a row is expanded. */
57
68
  subTable?: {
58
69
  table: (rowData: T) => ReactElement;
59
70
  showOnExpand?: (rowData: T) => boolean;
60
71
  };
72
+ /** Settings for sub rows. */
61
73
  subRows?: {
74
+ /** Function that returns a React element for the sub row. */
62
75
  rows: (rowData: T) => ReactElement | ReactElement[];
76
+ /** If true, the sub rows will only be shown when the row is expanded. */
63
77
  showOnExpand?: (rowData: T) => boolean;
64
78
  };
79
+ /** Function to apply to a row, to make the entire row clickable, useful for navigation. */
65
80
  clickableRow?: (rowData: T) => void;
81
+ /** Array of actions that can be performed on each row. */
66
82
  rowActions?: RowActions<T>;
83
+ /** The Y padding for each row. */
67
84
  rowPadding?: string;
85
+ /** The X padding for each row. */
68
86
  columnPadding?: string;
69
87
  }
70
88
  export interface TableProps<T> extends CommonTableProps<T> {
89
+ /** Array of data to be displayed in the table. */
71
90
  data: T[];
91
+ /** The text to show when there is no available data to map through. */
72
92
  noDataContent?: ReactNode;
73
93
  }
74
94
  export interface TableRowProps<T> extends CommonTableProps<T> {
@@ -20,7 +20,7 @@ const StyledTextArea = styled.textarea `
20
20
  box-sizing: border-box;
21
21
  border-radius: 12px;
22
22
  width: 100%;
23
- padding: 18px 14px;
23
+ padding: 12px 12px;
24
24
  color: ${theme.colors.liquorice};
25
25
  resize: ${({ $resize }) => $resize};
26
26
  cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'text')};
@@ -9,7 +9,7 @@ export const Input = styled.input `
9
9
  outline: none;
10
10
  cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'initial')};
11
11
  opacity: ${({ disabled }) => (disabled ? '0.5' : '1')};
12
- padding: 18px 14px;
12
+ padding: 12px 12px;
13
13
  background-color: ${({ $fallbackStyle }) => $fallbackStyle ? theme.colors.custard : theme.colors.cream};
14
14
  border: 2px solid
15
15
  ${({ $error }) => ($error ? theme.colors.strawberry : theme.colors.oatmeal)};
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/useClickOutside/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAChC,GAAG,EACH,QAAQ,GAIT,EAAE,EAAE;IACH,MAAM,sBAAsB,GAAG,WAAW,CACxC,CAAC,KAAiB,EAAE,EAA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AAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAEzC,gBAAgB,CAAC;QACf,SAAS,EAAE,OAAO;QAClB,GAAG,EAAE,WAAW;QAChB,QAAQ,EAAE,sBAAsB;QAChC,OAAO,EAAE,IAAI;KACd,CAAC,CAAA;IAEF,gBAAgB,CAAC;QACf,SAAS,EAAE,UAAU;QACrB,GAAG,EAAE,WAAW;QAChB,QAAQ,EAAE,sBAAsB;QAChC,OAAO,EAAE,IAAI;KACd,CAAC,CAAA;AACJ,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrshmllw/smores-react",
3
- "version": "9.6.0-crumbs-seach-input-ui.2",
3
+ "version": "9.6.0-crumbs-smol-input.1",
4
4
  "main": "./dist/index.js",
5
5
  "description": "Collection of React components used by Marshmallow Technology",
6
6
  "keywords": [
@@ -57,14 +57,14 @@
57
57
  "@storybook/storybook-deployer": "^2.8.16",
58
58
  "@storybook/test": "^8.0.10",
59
59
  "@storybook/test-runner": "^0.18.0",
60
- "@testing-library/react": "^14.0.0",
60
+ "@testing-library/react": "^15.0.7",
61
61
  "@types/body-scroll-lock": "^3.1.0",
62
62
  "@types/dompurify": "^3.0.5",
63
63
  "@types/node": "^20.1.2",
64
64
  "@types/react": "^18.0.24",
65
65
  "@types/react-dom": "^18.0.8",
66
66
  "@types/testing-library__react": "^10.2.0",
67
- "@typescript-eslint/eslint-plugin": "^6.0.0",
67
+ "@typescript-eslint/eslint-plugin": "^7.0.0",
68
68
  "@typescript-eslint/parser": "^6.2.0",
69
69
  "axe-playwright": "^2.0.1",
70
70
  "conventional-changelog-conventionalcommits": "^7.0.2",
@@ -87,12 +87,12 @@
87
87
  "vitest": "^1.2.2"
88
88
  },
89
89
  "dependencies": {
90
- "@lexical/react": "^0.13.1",
90
+ "@lexical/react": "^0.15.0",
91
91
  "body-scroll-lock": "^4.0.0-beta.0",
92
92
  "date-fns": "^3.6.0",
93
93
  "dompurify": "^3.0.9",
94
94
  "fuse.js": "^7.0.0",
95
- "lexical": "^0.13.1",
95
+ "lexical": "^0.15.0",
96
96
  "polished": "^4.1.3"
97
97
  },
98
98
  "peerDependencies": {