alicia-design-system 1.110.13 → 1.111.0
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/cjs/alicia-ui/common/Buttons/ButtonBrand.d.ts +34 -0
- package/dist/cjs/alicia-ui/common/Buttons/ButtonBrand.js +37 -0
- package/dist/cjs/alicia-ui/common/Buttons/ButtonBrand.js.map +1 -0
- package/dist/cjs/alicia-ui/common/List/ListBrand.d.ts +38 -0
- package/dist/cjs/alicia-ui/common/List/ListBrand.js +90 -0
- package/dist/cjs/alicia-ui/common/List/ListBrand.js.map +1 -0
- package/dist/cjs/alicia-ui/common/List/ListBrand.types.d.ts +140 -0
- package/dist/cjs/alicia-ui/common/List/ListBrand.types.js +3 -0
- package/dist/cjs/alicia-ui/common/List/ListBrand.types.js.map +1 -0
- package/dist/cjs/alicia-ui/common/Search/SearchBrand.d.ts +4 -0
- package/dist/cjs/alicia-ui/common/Search/SearchBrand.js +89 -0
- package/dist/cjs/alicia-ui/common/Search/SearchBrand.js.map +1 -0
- package/dist/cjs/alicia-ui/common/Search/SearchBrand.types.d.ts +171 -0
- package/dist/cjs/alicia-ui/common/Search/SearchBrand.types.js +3 -0
- package/dist/cjs/alicia-ui/common/Search/SearchBrand.types.js.map +1 -0
- package/dist/cjs/alicia-ui/common/Table/Table.js +3 -2
- package/dist/cjs/alicia-ui/common/Table/Table.js.map +1 -1
- package/dist/cjs/brand/index.d.ts +24 -0
- package/dist/cjs/brand/index.js +35 -0
- package/dist/cjs/brand/index.js.map +1 -0
- package/dist/cjs/styles/aliciaDesignTheme.d.ts +88 -0
- package/dist/cjs/styles/aliciaDesignTheme.js +401 -0
- package/dist/cjs/styles/aliciaDesignTheme.js.map +1 -0
- package/dist/cjs/styles/chakraTheme.d.ts +1 -1
- package/dist/cjs/styles/chakraTheme.js +2 -1
- package/dist/cjs/styles/chakraTheme.js.map +1 -1
- package/dist/esm/alicia-ui/common/Buttons/ButtonBrand.d.ts +34 -0
- package/dist/esm/alicia-ui/common/Buttons/ButtonBrand.js +34 -0
- package/dist/esm/alicia-ui/common/Buttons/ButtonBrand.js.map +1 -0
- package/dist/esm/alicia-ui/common/List/ListBrand.d.ts +38 -0
- package/dist/esm/alicia-ui/common/List/ListBrand.js +85 -0
- package/dist/esm/alicia-ui/common/List/ListBrand.js.map +1 -0
- package/dist/esm/alicia-ui/common/List/ListBrand.types.d.ts +140 -0
- package/dist/esm/alicia-ui/common/List/ListBrand.types.js +2 -0
- package/dist/esm/alicia-ui/common/List/ListBrand.types.js.map +1 -0
- package/dist/esm/alicia-ui/common/Search/SearchBrand.d.ts +4 -0
- package/dist/esm/alicia-ui/common/Search/SearchBrand.js +84 -0
- package/dist/esm/alicia-ui/common/Search/SearchBrand.js.map +1 -0
- package/dist/esm/alicia-ui/common/Search/SearchBrand.types.d.ts +171 -0
- package/dist/esm/alicia-ui/common/Search/SearchBrand.types.js +2 -0
- package/dist/esm/alicia-ui/common/Search/SearchBrand.types.js.map +1 -0
- package/dist/esm/alicia-ui/common/Table/Table.js +3 -2
- package/dist/esm/alicia-ui/common/Table/Table.js.map +1 -1
- package/dist/esm/brand/index.d.ts +24 -0
- package/dist/esm/brand/index.js +24 -0
- package/dist/esm/brand/index.js.map +1 -0
- package/dist/esm/styles/aliciaDesignTheme.d.ts +88 -0
- package/dist/esm/styles/aliciaDesignTheme.js +398 -0
- package/dist/esm/styles/aliciaDesignTheme.js.map +1 -0
- package/dist/esm/styles/chakraTheme.d.ts +1 -1
- package/dist/esm/styles/chakraTheme.js +2 -1
- package/dist/esm/styles/chakraTheme.js.map +1 -1
- package/package.json +14 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ButtonProps } from '@chakra-ui/react';
|
|
3
|
+
export type ButtonBrandProps = ButtonProps;
|
|
4
|
+
/**
|
|
5
|
+
* Brand-aware button component.
|
|
6
|
+
*
|
|
7
|
+
* Styles are defined in `aliciaDesignTheme.ts` via `buttonBrandRecipe`.
|
|
8
|
+
* The recipe is registered globally as `recipes.button`, extending Chakra's
|
|
9
|
+
* built-in button recipe — so existing buttons using `solid`, `outline` etc.
|
|
10
|
+
* are completely unaffected.
|
|
11
|
+
*
|
|
12
|
+
* Import via the `/brand` subpath:
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { Button } from 'alicia-design-system/brand';
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example Primary CTA
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <Button variant="primary" onClick={handleClick}>
|
|
20
|
+
* Plan een gesprek
|
|
21
|
+
* </Button>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example Secondary
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Button variant="secondary">Bekijk platform</Button>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example Compact for header
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <Button variant="primary" size="compact">Header CTA</Button>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Button = void 0;
|
|
4
|
+
const react_1 = require("@chakra-ui/react");
|
|
5
|
+
// ─── Component ────────────────────────────────────────────────────────────────
|
|
6
|
+
/**
|
|
7
|
+
* Brand-aware button component.
|
|
8
|
+
*
|
|
9
|
+
* Styles are defined in `aliciaDesignTheme.ts` via `buttonBrandRecipe`.
|
|
10
|
+
* The recipe is registered globally as `recipes.button`, extending Chakra's
|
|
11
|
+
* built-in button recipe — so existing buttons using `solid`, `outline` etc.
|
|
12
|
+
* are completely unaffected.
|
|
13
|
+
*
|
|
14
|
+
* Import via the `/brand` subpath:
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { Button } from 'alicia-design-system/brand';
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example Primary CTA
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Button variant="primary" onClick={handleClick}>
|
|
22
|
+
* Plan een gesprek
|
|
23
|
+
* </Button>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example Secondary
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Button variant="secondary">Bekijk platform</Button>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example Compact for header
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <Button variant="primary" size="compact">Header CTA</Button>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
exports.Button = react_1.Button;
|
|
37
|
+
//# sourceMappingURL=ButtonBrand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonBrand.js","sourceRoot":"","sources":["../../../../../src/alicia-ui/common/Buttons/ButtonBrand.tsx"],"names":[],"mappings":";;;AAAA,4CAA4E;AAM5E,iFAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACU,QAAA,MAAM,GAAG,cAAY,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type CustomListItemProps, type ListProps } from './ListBrand.types';
|
|
2
|
+
export type { ListOption, ListProps, CustomListItemProps, } from './ListBrand.types';
|
|
3
|
+
export declare const CustomListItem: (props: CustomListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
/**
|
|
5
|
+
* Brand-aware ordered/unordered list component.
|
|
6
|
+
*
|
|
7
|
+
* Import via the `/brand` subpath to use the Alicia design tokens:
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { List } from 'alicia-design-system/brand';
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @example Plain ordered list
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <List
|
|
15
|
+
* list={steps}
|
|
16
|
+
* type="ordered"
|
|
17
|
+
* bubbleProps={{ bg: 'volt.500', color: 'ink.900' }}
|
|
18
|
+
* enableVisualEffects
|
|
19
|
+
* />
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example Card variant with staggered entrance
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <List
|
|
25
|
+
* list={steps}
|
|
26
|
+
* type="ordered"
|
|
27
|
+
* variant="card"
|
|
28
|
+
* title="Wat ga je doen?"
|
|
29
|
+
* cardBg="forest.600"
|
|
30
|
+
* bubbleProps={{ bg: 'volt.500', color: 'ink.900' }}
|
|
31
|
+
* itemLabelProps={{ color: 'white' }}
|
|
32
|
+
* itemDescriptionProps={{ color: 'whiteAlpha.700' }}
|
|
33
|
+
* dividerColor="border.onForest"
|
|
34
|
+
* enableVisualEffects
|
|
35
|
+
* />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare const List: (props: ListProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.List = exports.CustomListItem = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@chakra-ui/react");
|
|
6
|
+
const polished_1 = require("polished");
|
|
7
|
+
const icons_1 = require("../../icons");
|
|
8
|
+
const CustomListItem = (props) => {
|
|
9
|
+
const { data, type = 'ordered', bubbleProps, itemLabelProps, itemDescriptionProps, itemProps, withRightIcon, enableVisualEffects, } = props;
|
|
10
|
+
const isClickable = props.isClickable === true;
|
|
11
|
+
const isSelected = isClickable && props.selectedValue === data.value;
|
|
12
|
+
const selectedBg = isClickable ? props.selectedItemColor : undefined;
|
|
13
|
+
const isCard = props.variant === 'card';
|
|
14
|
+
const itemDelay = enableVisualEffects
|
|
15
|
+
? (isCard ? 0.3 : 0) + data.index * 0.15
|
|
16
|
+
: 0;
|
|
17
|
+
const handleClick = () => {
|
|
18
|
+
if (isClickable) {
|
|
19
|
+
props.onItemClick({ value: data.value, label: data.label });
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const ArrowIcon = (0, icons_1.ArrowForwardCircleIcon)({
|
|
23
|
+
fillColor: 'currentColor',
|
|
24
|
+
});
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.List.Item, Object.assign({ css: {
|
|
26
|
+
listStyle: 'none',
|
|
27
|
+
'&[data-selected=true]': { background: selectedBg },
|
|
28
|
+
}, display: "flex", gap: (0, polished_1.rem)(16), alignItems: "center", py: (0, polished_1.rem)(18), cursor: isClickable ? 'pointer' : 'auto', transition: "background 0.15s ease", px: isClickable ? (0, polished_1.rem)(8) : 0, _hover: isClickable ? { bg: selectedBg } : undefined }, itemProps, { "data-testid": "list-brand-item", "data-selected": isSelected, animationStyle: enableVisualEffects ? 'alicia.fadeUp' : undefined, style: enableVisualEffects ? { animationDelay: `${itemDelay}s` } : undefined, onClick: handleClick, children: [type === 'ordered' && ((0, jsx_runtime_1.jsx)(react_1.Box, Object.assign({ borderRadius: "full", w: (0, polished_1.rem)(44), h: (0, polished_1.rem)(44), flexShrink: 0, justifyContent: "center", alignItems: "center", display: "flex" }, bubbleProps, { children: (0, jsx_runtime_1.jsx)(react_1.Text, { textStyle: "body.md", fontWeight: "700", fontVariantNumeric: "tabular-nums", children: data.index + 1 }) }))), (0, jsx_runtime_1.jsxs)(react_1.Stack, { gap: (0, polished_1.rem)(4), flex: 1, children: [(0, jsx_runtime_1.jsx)(react_1.Text, Object.assign({ textStyle: "body.lg", fontWeight: "600" }, itemLabelProps, { children: data.label })), (data === null || data === void 0 ? void 0 : data.description) && ((0, jsx_runtime_1.jsx)(react_1.Text, Object.assign({ as: "span", textStyle: "body.md" }, itemDescriptionProps, { children: data === null || data === void 0 ? void 0 : data.description })))] }), withRightIcon && ((0, jsx_runtime_1.jsx)(ArrowIcon, { flexShrink: 0, width: (0, polished_1.rem)(30), height: (0, polished_1.rem)(30) }))] })));
|
|
29
|
+
};
|
|
30
|
+
exports.CustomListItem = CustomListItem;
|
|
31
|
+
// ─── List ─────────────────────────────────────────────────────────────────────
|
|
32
|
+
/**
|
|
33
|
+
* Brand-aware ordered/unordered list component.
|
|
34
|
+
*
|
|
35
|
+
* Import via the `/brand` subpath to use the Alicia design tokens:
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { List } from 'alicia-design-system/brand';
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example Plain ordered list
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <List
|
|
43
|
+
* list={steps}
|
|
44
|
+
* type="ordered"
|
|
45
|
+
* bubbleProps={{ bg: 'volt.500', color: 'ink.900' }}
|
|
46
|
+
* enableVisualEffects
|
|
47
|
+
* />
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example Card variant with staggered entrance
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <List
|
|
53
|
+
* list={steps}
|
|
54
|
+
* type="ordered"
|
|
55
|
+
* variant="card"
|
|
56
|
+
* title="Wat ga je doen?"
|
|
57
|
+
* cardBg="forest.600"
|
|
58
|
+
* bubbleProps={{ bg: 'volt.500', color: 'ink.900' }}
|
|
59
|
+
* itemLabelProps={{ color: 'white' }}
|
|
60
|
+
* itemDescriptionProps={{ color: 'whiteAlpha.700' }}
|
|
61
|
+
* dividerColor="border.onForest"
|
|
62
|
+
* enableVisualEffects
|
|
63
|
+
* />
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
const List = (props) => {
|
|
67
|
+
var _a;
|
|
68
|
+
const fx = (_a = props.enableVisualEffects) !== null && _a !== void 0 ? _a : false;
|
|
69
|
+
const { dividerColor } = props;
|
|
70
|
+
const listItems = props.list.flatMap(({ value, label, description }, index) => {
|
|
71
|
+
const item = ((0, jsx_runtime_1.jsx)(exports.CustomListItem, Object.assign({ data: { value, label, description, index } }, props), `item-${index}`));
|
|
72
|
+
if (index < props.list.length - 1) {
|
|
73
|
+
return [
|
|
74
|
+
item,
|
|
75
|
+
(0, jsx_runtime_1.jsx)(react_1.Separator, { borderColor: dividerColor }, `sep-${index}`),
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
return [item];
|
|
79
|
+
});
|
|
80
|
+
const list = ((0, jsx_runtime_1.jsx)(react_1.List.Root, { "data-testid": "list-brand-root", children: listItems }));
|
|
81
|
+
const wrapWithCard = (list) => {
|
|
82
|
+
var _a;
|
|
83
|
+
if (props.variant !== 'card')
|
|
84
|
+
return null;
|
|
85
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Box, { bg: (_a = props.cardBg) !== null && _a !== void 0 ? _a : 'forest.500', borderRadius: "xl", p: (0, polished_1.rem)(32), boxShadow: "card", "data-testid": "list-brand-card", animationStyle: fx ? 'alicia.fadeUp' : undefined, children: [(props.title || props.subtitle) && ((0, jsx_runtime_1.jsxs)(react_1.Stack, { gap: (0, polished_1.rem)(4), mb: (0, polished_1.rem)(24), children: [props.title && ((0, jsx_runtime_1.jsx)(react_1.Text, Object.assign({ textStyle: "heading.lg", fontWeight: "700" }, props.itemLabelProps, { children: props.title }))), props.subtitle && ((0, jsx_runtime_1.jsx)(react_1.Text, Object.assign({ textStyle: "body.lg" }, props.itemDescriptionProps, { children: props.subtitle })))] })), list] }));
|
|
86
|
+
};
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Flex, { flexDirection: "column", w: "inherit", children: props.variant === 'card' ? wrapWithCard(list) : list }));
|
|
88
|
+
};
|
|
89
|
+
exports.List = List;
|
|
90
|
+
//# sourceMappingURL=ListBrand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListBrand.js","sourceRoot":"","sources":["../../../../../src/alicia-ui/common/List/ListBrand.tsx"],"names":[],"mappings":";;;;AAAA,4CAO0B;AAC1B,uCAA+B;AAE/B,uCAAqD;AAS9C,MAAM,cAAc,GAAG,CAAC,KAA0B,EAAE,E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* Type definitions for the brand List component.
|
|
3
|
+
* See ListBrand.tsx for implementation.
|
|
4
|
+
*/
|
|
5
|
+
import { type BoxProps, type SystemStyleObject, type TextProps } from '@chakra-ui/react';
|
|
6
|
+
export type ListOption = {
|
|
7
|
+
/** Unique identifier for this item. Used as the selected value in clickable mode. */
|
|
8
|
+
value: string;
|
|
9
|
+
/** Primary text label displayed on the item row. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Optional secondary text shown below the label. */
|
|
12
|
+
description?: string;
|
|
13
|
+
};
|
|
14
|
+
/** Props present on every variant / clickable state. */
|
|
15
|
+
type ListBaseProps = {
|
|
16
|
+
/** Array of items to render in the list. */
|
|
17
|
+
list: ListOption[];
|
|
18
|
+
/**
|
|
19
|
+
* Render style of the list.
|
|
20
|
+
* - `'ordered'` — each item shows a numbered circular bubble on the left.
|
|
21
|
+
* - `'unordered'` — plain list with no bubble.
|
|
22
|
+
* @default 'ordered'
|
|
23
|
+
*/
|
|
24
|
+
type?: 'ordered' | 'unordered';
|
|
25
|
+
/**
|
|
26
|
+
* When `true`, an arrow icon is appended to the right of every item.
|
|
27
|
+
* Icon color is fixed to the `text` token.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
withRightIcon?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Override any Chakra `Box` props on the numbered bubble (the circular
|
|
33
|
+
* icon shown when `type="ordered"`).
|
|
34
|
+
*
|
|
35
|
+
* Defaults: `borderRadius="full"`, `w=44px`, `h=44px`.
|
|
36
|
+
*
|
|
37
|
+
* Use `bg` and `color` to set the bubble background and number colour:
|
|
38
|
+
* @example
|
|
39
|
+
* bubbleProps={{ bg: 'volt.500', color: 'ink.900' }}
|
|
40
|
+
*/
|
|
41
|
+
bubbleProps?: BoxProps;
|
|
42
|
+
/**
|
|
43
|
+
* Override any Chakra `Text` props on each item's label (primary line).
|
|
44
|
+
*
|
|
45
|
+
* Defaults: `textStyle="body.lg"`, `fontWeight="600"`.
|
|
46
|
+
* @example
|
|
47
|
+
* itemLabelProps={{ color: 'white', fontWeight: '700' }}
|
|
48
|
+
*/
|
|
49
|
+
itemLabelProps?: TextProps;
|
|
50
|
+
/**
|
|
51
|
+
* Override any Chakra `Text` props on each item's description (secondary line).
|
|
52
|
+
*
|
|
53
|
+
* Default: `textStyle="body.md"`.
|
|
54
|
+
* @example
|
|
55
|
+
* itemDescriptionProps={{ color: 'whiteAlpha.700' }}
|
|
56
|
+
*/
|
|
57
|
+
itemDescriptionProps?: TextProps;
|
|
58
|
+
/**
|
|
59
|
+
* Override Chakra style tokens on each item row (`<li>` rendered as Flex).
|
|
60
|
+
*
|
|
61
|
+
* Defaults: `py="4.5"`, `gap=4`, `alignItems="center"`.
|
|
62
|
+
* @example
|
|
63
|
+
* itemProps={{ py: 6, gap: 6 }}
|
|
64
|
+
*/
|
|
65
|
+
itemProps?: SystemStyleObject;
|
|
66
|
+
/**
|
|
67
|
+
* Token or CSS value for the hairline divider drawn between items.
|
|
68
|
+
* @example
|
|
69
|
+
* dividerColor="border.onForest" // on dark forest card
|
|
70
|
+
* dividerColor="border" // on light background
|
|
71
|
+
*/
|
|
72
|
+
dividerColor?: string;
|
|
73
|
+
/**
|
|
74
|
+
* When `true`, items and the card container fade up on mount using the
|
|
75
|
+
* `alicia.fadeUp` animation style defined in `aliciaDesignTheme.ts`.
|
|
76
|
+
* Items are staggered by 150 ms each.
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
enableVisualEffects?: boolean;
|
|
80
|
+
};
|
|
81
|
+
/** Default variant — plain list with no card wrapper. */
|
|
82
|
+
type PlainVariant = {
|
|
83
|
+
variant?: 'plain';
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Card variant — wraps the list in a styled container with optional
|
|
87
|
+
* title and subtitle. Typically used on dark (`forest`) backgrounds.
|
|
88
|
+
*/
|
|
89
|
+
type CardVariant = {
|
|
90
|
+
variant: 'card';
|
|
91
|
+
/** Optional heading shown above the list inside the card. */
|
|
92
|
+
title?: string;
|
|
93
|
+
/** Optional supporting text shown below the title. */
|
|
94
|
+
subtitle?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Background color token for the card container.
|
|
97
|
+
* @default 'forest.500'
|
|
98
|
+
*/
|
|
99
|
+
cardBg?: string;
|
|
100
|
+
};
|
|
101
|
+
type VariantProps = PlainVariant | CardVariant;
|
|
102
|
+
/** Non-interactive list — items cannot be selected. */
|
|
103
|
+
type NotClickable = {
|
|
104
|
+
/** @default false */
|
|
105
|
+
isClickable?: false;
|
|
106
|
+
/** Not available when `isClickable` is false. */
|
|
107
|
+
onItemClick?: never;
|
|
108
|
+
/** Not available when `isClickable` is false. */
|
|
109
|
+
selectedValue?: never;
|
|
110
|
+
/** Not available when `isClickable` is false. */
|
|
111
|
+
selectedItemColor?: never;
|
|
112
|
+
};
|
|
113
|
+
/** Interactive list — items can be tapped/clicked and one can be pre-selected. */
|
|
114
|
+
type IsClickable = {
|
|
115
|
+
/** Set to `true` to enable row selection. */
|
|
116
|
+
isClickable: true;
|
|
117
|
+
/**
|
|
118
|
+
* Callback fired when the user clicks an item.
|
|
119
|
+
* Receives the full `ListOption` object (`{ value, label }`).
|
|
120
|
+
*/
|
|
121
|
+
onItemClick: (item: ListOption) => void;
|
|
122
|
+
/** Value of the currently selected item (controlled). */
|
|
123
|
+
selectedValue?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Background color token applied to the hovered / selected row.
|
|
126
|
+
* @example selectedItemColor="forest.50"
|
|
127
|
+
*/
|
|
128
|
+
selectedItemColor?: string;
|
|
129
|
+
};
|
|
130
|
+
type ClickableProps = NotClickable | IsClickable;
|
|
131
|
+
export type ListProps = ListBaseProps & VariantProps & ClickableProps;
|
|
132
|
+
export type CustomListItemProps = ListProps & {
|
|
133
|
+
data: {
|
|
134
|
+
value: string;
|
|
135
|
+
label: string;
|
|
136
|
+
description?: string;
|
|
137
|
+
index: number;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListBrand.types.js","sourceRoot":"","sources":["../../../../../src/alicia-ui/common/List/ListBrand.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Search = exports.boldedText = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_2 = require("@chakra-ui/react");
|
|
7
|
+
const polished_1 = require("polished");
|
|
8
|
+
const pi_1 = require("react-icons/pi");
|
|
9
|
+
const rx_1 = require("react-icons/rx");
|
|
10
|
+
const lu_1 = require("react-icons/lu");
|
|
11
|
+
const boldedText = ({ text, shouldBeBold }) => {
|
|
12
|
+
const textArray = text.split(RegExp(shouldBeBold, 'ig'));
|
|
13
|
+
const match = text.match(RegExp(shouldBeBold, 'ig'));
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Text, { lineClamp: 1, fontSize: (0, polished_1.rem)(16), children: textArray.map((item, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [item, index !== textArray.length - 1 && match ? ((0, jsx_runtime_1.jsx)("b", { children: match[index] })) : null] }, index))) }));
|
|
15
|
+
};
|
|
16
|
+
exports.boldedText = boldedText;
|
|
17
|
+
const Search = ({ query, options = [], loading = false, isError, withRightIcon = true, customRightIcon = undefined, setQuery, onClickItem, renderItem = undefined, emptyMessage = 'No results found', result = {
|
|
18
|
+
styles: {
|
|
19
|
+
bg: 'white',
|
|
20
|
+
hoverBg: 'volt.200',
|
|
21
|
+
},
|
|
22
|
+
}, loadingSkeleton = {
|
|
23
|
+
count: 3,
|
|
24
|
+
styles: {
|
|
25
|
+
bg: 'neutral.50',
|
|
26
|
+
hoverBg: 'neutral.100',
|
|
27
|
+
},
|
|
28
|
+
}, inputProps, }) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
31
|
+
const hasQuery = query !== '' && query !== undefined;
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Flex, { direction: "column", width: "100%", "data-testid": "search-container", children: [(0, jsx_runtime_1.jsxs)(react_2.Flex, Object.assign({ width: "inherit", border: "input", borderRadius: "lg", _focusWithin: {
|
|
33
|
+
borderColor: 'border.focus',
|
|
34
|
+
boxShadow: 'focus',
|
|
35
|
+
}, px: (0, polished_1.rem)(16), py: (0, polished_1.rem)(9), bg: "white" }, (isError && {
|
|
36
|
+
color: 'critical.500',
|
|
37
|
+
borderColor: 'critical.500',
|
|
38
|
+
boxShadow: 'error',
|
|
39
|
+
_focusWithin: {
|
|
40
|
+
borderColor: 'critical.500',
|
|
41
|
+
boxShadow: 'error',
|
|
42
|
+
},
|
|
43
|
+
}), { justifyContent: "space-between", alignItems: "center", gap: (0, polished_1.rem)(8) }, ((inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled) && {
|
|
44
|
+
opacity: 0.5,
|
|
45
|
+
cursor: 'not-allowed',
|
|
46
|
+
}), { children: [(0, jsx_runtime_1.jsx)(react_2.Input, Object.assign({ defaultValue: query, ref: inputRef, autoFocus: true, px: (0, polished_1.rem)(2), py: (0, polished_1.rem)(1), border: "none", boxShadow: "none", _focusVisible: {
|
|
47
|
+
boxShadow: 'none',
|
|
48
|
+
borderColor: 'transparent',
|
|
49
|
+
outline: 'none',
|
|
50
|
+
}, css: {
|
|
51
|
+
'&:focus, &:focus-visible': {
|
|
52
|
+
outline: 'none',
|
|
53
|
+
boxShadow: 'none',
|
|
54
|
+
},
|
|
55
|
+
}, _placeholder: {
|
|
56
|
+
color: 'fg.subtle',
|
|
57
|
+
}, textStyle: "body.lg", onChange: (e) => setQuery(e.target.value) }, inputProps)), (0, jsx_runtime_1.jsx)(react_2.Flex, Object.assign({ as: react_2.chakra.button, boxSize: (0, polished_1.rem)(20), cursor: "pointer", "data-testid": "search-clear-button", onClick: () => {
|
|
58
|
+
setQuery('');
|
|
59
|
+
if (inputRef.current) {
|
|
60
|
+
inputRef.current.value = '';
|
|
61
|
+
}
|
|
62
|
+
} }, (isError && {
|
|
63
|
+
color: 'critical.500',
|
|
64
|
+
}), ((inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled) && {
|
|
65
|
+
opacity: 0.5,
|
|
66
|
+
cursor: 'not-allowed',
|
|
67
|
+
}), { children: hasQuery ? ((0, jsx_runtime_1.jsx)(react_2.Icon, { "aria-label": "Clear search", as: rx_1.RxCross2, height: (0, polished_1.rem)(20), width: (0, polished_1.rem)(20) })) : ((0, jsx_runtime_1.jsx)(react_2.Icon, { "aria-label": "Search", as: pi_1.PiMagnifyingGlassBold, height: (0, polished_1.rem)(20), width: (0, polished_1.rem)(20) })) }))] })), (0, jsx_runtime_1.jsx)(react_2.Flex, { my: (0, polished_1.rem)(12), direction: "column", children: (0, jsx_runtime_1.jsxs)(react_2.List.Root, { gap: (0, polished_1.rem)(8), children: [loading
|
|
68
|
+
? Array.from({ length: (_a = loadingSkeleton.count) !== null && _a !== void 0 ? _a : 3 }).map((_, i) => {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Skeleton, Object.assign({ as: react_2.List.Item, "data-testid": `search-skeleton-${i}`, css: { display: 'block' }, border: "default", borderRadius: "sm", px: (0, polished_1.rem)(12), py: (0, polished_1.rem)(4), height: (0, polished_1.rem)(60), loading: true }, ((loadingSkeleton === null || loadingSkeleton === void 0 ? void 0 : loadingSkeleton.styles) && {
|
|
71
|
+
bg: (_a = loadingSkeleton === null || loadingSkeleton === void 0 ? void 0 : loadingSkeleton.styles) === null || _a === void 0 ? void 0 : _a.bg,
|
|
72
|
+
hoverBg: (_b = loadingSkeleton === null || loadingSkeleton === void 0 ? void 0 : loadingSkeleton.styles) === null || _b === void 0 ? void 0 : _b.hoverBg,
|
|
73
|
+
})), i));
|
|
74
|
+
})
|
|
75
|
+
: options.map((option, i) => {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
return ((0, jsx_runtime_1.jsx)(react_2.List.Item, { as: react_2.chakra.button, "data-testid": `search-option-${i}`, color: "text", cursor: "pointer", onClick: () => onClickItem(option), fontSize: (0, polished_1.rem)(16), display: "block", bg: (_a = result === null || result === void 0 ? void 0 : result.styles) === null || _a === void 0 ? void 0 : _a.bg, borderRadius: "sm", px: (0, polished_1.rem)(18), py: (0, polished_1.rem)(4), transition: "transform .15s,background .15s", _hover: {
|
|
78
|
+
bg: (_b = result === null || result === void 0 ? void 0 : result.styles) === null || _b === void 0 ? void 0 : _b.hoverBg,
|
|
79
|
+
transform: 'translateY(-1px)',
|
|
80
|
+
}, boxShadow: "searchOption", children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { py: (0, polished_1.rem)(12), direction: "row", justifyContent: "space-between", gap: (0, polished_1.rem)(8), alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_2.Flex, { overflow: "auto", flexWrap: "wrap", children: renderItem
|
|
81
|
+
? renderItem(option)
|
|
82
|
+
: (0, exports.boldedText)({
|
|
83
|
+
text: option.label,
|
|
84
|
+
shouldBeBold: query !== null && query !== void 0 ? query : '',
|
|
85
|
+
}) }), withRightIcon && ((0, jsx_runtime_1.jsx)(react_2.Flex, { boxSize: (0, polished_1.rem)(20), children: customRightIcon !== null && customRightIcon !== void 0 ? customRightIcon : ((0, jsx_runtime_1.jsx)(react_2.Icon, { className: "hover-arrow", as: lu_1.LuArrowRight, width: (0, polished_1.rem)(20), height: (0, polished_1.rem)(20), "aria-label": "Arrow right" })) }))] }) }, i));
|
|
86
|
+
}), !loading && options.length === 0 && hasQuery && ((0, jsx_runtime_1.jsx)(react_2.List.Item, { as: react_2.Flex, justifyContent: "center", alignItems: "center", px: (0, polished_1.rem)(12), py: (0, polished_1.rem)(4), "data-testid": "search-empty-message", children: (0, jsx_runtime_1.jsx)(react_2.Text, { textStyle: "caption", color: "gray.500", children: emptyMessage }) }))] }) })] }));
|
|
87
|
+
};
|
|
88
|
+
exports.Search = Search;
|
|
89
|
+
//# sourceMappingURL=SearchBrand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchBrand.js","sourceRoot":"","sources":["../../../../../src/alicia-ui/common/Search/SearchBrand.tsx"],"names":[],"mappings":";;;;AAAA,iCAA6C;AAC7C,4CAQ0B;AAC1B,uCAA+B;AAC/B,uCAAuD;AACvD,uCAA0C;AAC1C,uCAA8C;AAGvC,MAAM,UAAU,GAAG,CAAC,EAAE,IAAI,EAAE,YAAY,EAAa,EAAE,EAAE;IAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;IACzD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;IAErD,OAAO,CACL,uBAAC,YAAI,IAAC,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAA,cAAG,EAAC,EAAE,CAAC,YAClC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9B,wBAAC,gBAAQ,eACN,IAAI,EACJ,KAAK,KAAK,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CACzC,wCAAI,KAAK,CAAC,KAAK,CAAC,GAAK,CACtB,CAAC,CAAC,CAAC,IAAI,KAJK,KAAK,CAKT,CACZ,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,UAAU,cAgBrB;AAEK,MAAM,MAAM,GAAoB,CAAC,EACtC,KAAK,EACL,OAAO,GAAG,EAAE,EACZ,OAAO,GAAG,KAAK,EACf,OAAO,EACP,aAAa,GAAG,IAAI,EACpB,eAAe,GAAG,SAAS,EAC3B,QAAQ,EACR,WAAW,EACX,UAAU,GAAG,SAAS,EACtB,YAAY,GAA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AAC,YAAI,IAAC,OAAO,EAAE,IAAA,cAAG,EAAC,EAAE,CAAC,YACnB,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,CAClB,uBAAC,YAAI,IACH,SAAS,EAAC,aAAa,EACvB,EAAE,EAAE,iBAAY,EAChB,KAAK,EAAE,IAAA,cAAG,EAAC,EAAE,CAAC,EACd,MAAM,EAAE,IAAA,cAAG,EAAC,EAAE,CAAC,gBACJ,aAAa,GACxB,CACH,GACI,CACR,IACI,IA/CF,CAAC,CAgDI,CACb,CAAA;6BAAA,CAAC,EACL,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,IAAI,CAC/C,uBAAC,YAAI,CAAC,IAAI,IACR,EAAE,EAAE,YAAI,EACR,cAAc,EAAC,QAAQ,EACvB,UAAU,EAAC,QAAQ,EACnB,EAAE,EAAE,IAAA,cAAG,EAAC,EAAE,CAAC,EACX,EAAE,EAAE,IAAA,cAAG,EAAC,CAAC,CAAC,iBACE,sBAAsB,YAElC,uBAAC,YAAI,IAAC,SAAS,EAAC,SAAS,EAAC,KAAK,EAAC,UAAU,YACvC,YAAY,GACR,GACG,CACb,IACS,GACP,IACF,CACR,CAAC;AACJ,CAAC,CAAC;AArNW,QAAA,MAAM,UAqNjB"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { InputProps } from '@chakra-ui/react';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the `Search` (SearchBrand) component.
|
|
5
|
+
*
|
|
6
|
+
* Extends Chakra UI's `InputProps` so any native `<Input>` prop (e.g.
|
|
7
|
+
* `placeholder`, `isDisabled`, `autoFocus`) can be forwarded directly to the
|
|
8
|
+
* underlying input element.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Search
|
|
13
|
+
* query={query}
|
|
14
|
+
* options={filteredOptions}
|
|
15
|
+
* isError={false}
|
|
16
|
+
* loading={false}
|
|
17
|
+
* setQuery={setQuery}
|
|
18
|
+
* onClickItem={(option) => console.log(option)}
|
|
19
|
+
* result={{ styles: { bg: 'neutral.50', hoverBg: 'volt.200' } }}
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export type SearchProps = {
|
|
24
|
+
/**
|
|
25
|
+
* The props to be applied to the input.
|
|
26
|
+
* @default {}
|
|
27
|
+
* @example
|
|
28
|
+
* inputProps={{
|
|
29
|
+
* 'data-testid': 'search-input',
|
|
30
|
+
* placeholder: 'Search',
|
|
31
|
+
* }}
|
|
32
|
+
*/
|
|
33
|
+
inputProps?: InputProps;
|
|
34
|
+
/**
|
|
35
|
+
* The list of items to display in the dropdown.
|
|
36
|
+
* Can be plain objects of any shape or typed `Option` values.
|
|
37
|
+
* Pass an empty array to show the empty-state message when `query` is set.
|
|
38
|
+
*/
|
|
39
|
+
options: any[] | Option[];
|
|
40
|
+
/**
|
|
41
|
+
* When `true` the input border and icons switch to the error/critical colour
|
|
42
|
+
* token and a red box-shadow is applied.
|
|
43
|
+
*/
|
|
44
|
+
isError: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The current search string that drives both the controlled input value and
|
|
47
|
+
* the bold-highlight logic inside the default `renderItem`.
|
|
48
|
+
* Cleared automatically when the user clicks the ✕ icon.
|
|
49
|
+
*/
|
|
50
|
+
query?: string;
|
|
51
|
+
/**
|
|
52
|
+
* When `true` skeleton placeholder rows are rendered instead of the real
|
|
53
|
+
* option list, indicating an in-flight async search request.
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
loading?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to show an icon on the right side of each result row.
|
|
59
|
+
* Defaults to a right-arrow icon (`LuArrowRight`).
|
|
60
|
+
* @default true
|
|
61
|
+
*/
|
|
62
|
+
withRightIcon?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* A custom React element to replace the default right-arrow icon that
|
|
65
|
+
* appears on each result row when `withRightIcon` is `true`.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* customRightIcon={<Icon as={LuStar} color="volt.500" />}
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
customRightIcon?: ReactElement;
|
|
73
|
+
/**
|
|
74
|
+
* Text shown in the list when there are no results and `query` is non-empty.
|
|
75
|
+
* @default 'No results found'
|
|
76
|
+
*/
|
|
77
|
+
emptyMessage?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Called with the clicked option when the user selects a result row.
|
|
80
|
+
* Receives the raw item from `options` (typed `Option` or a custom object).
|
|
81
|
+
*/
|
|
82
|
+
onClickItem: (value: any | Option) => void;
|
|
83
|
+
/**
|
|
84
|
+
* Controlled setter for the search query string.
|
|
85
|
+
* Should update whatever state is passed as `query`.
|
|
86
|
+
* Also called with an empty string when the user clicks the clear (✕) button.
|
|
87
|
+
*/
|
|
88
|
+
setQuery: (value: string) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Optional custom renderer for each result row.
|
|
91
|
+
* When omitted, the default renderer bolds the portion of `option.label`
|
|
92
|
+
* that matches the current `query`.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* renderItem={(option) => (
|
|
97
|
+
* <Flex direction="column">
|
|
98
|
+
* <Text fontWeight="bold">{option.label}</Text>
|
|
99
|
+
* <Text fontSize="sm" color="fg.subtle">{option.value}</Text>
|
|
100
|
+
* </Flex>
|
|
101
|
+
* )}
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
renderItem?: (value: any | Option) => ReactElement;
|
|
105
|
+
/**
|
|
106
|
+
* Chakra colour tokens applied to each result row.
|
|
107
|
+
*
|
|
108
|
+
* - `bg` – background colour of a result row at rest.
|
|
109
|
+
* - `hoverBg` – background colour on mouse-over / focus.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* result={{ styles: { bg: 'neutral.50', hoverBg: 'volt.200' } }}
|
|
113
|
+
*/
|
|
114
|
+
result?: {
|
|
115
|
+
styles?: {
|
|
116
|
+
/** Background colour token for a result row at rest. */
|
|
117
|
+
bg?: string;
|
|
118
|
+
/** Background colour token for a result row on hover/focus. */
|
|
119
|
+
hoverBg?: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Configuration for the loading-skeleton rows shown while `loading` is `true`.
|
|
124
|
+
*
|
|
125
|
+
* - `count` – number of skeleton rows to render. @default 3
|
|
126
|
+
* - `styles.bg` – skeleton background colour token.
|
|
127
|
+
* - `styles.hoverBg` – skeleton hover colour token (visual consistency).
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* loadingSkeleton={{ count: 5, styles: { bg: 'blue.50', hoverBg: 'blue.100' } }}
|
|
131
|
+
*/
|
|
132
|
+
loadingSkeleton?: {
|
|
133
|
+
/** Number of skeleton placeholder rows to render. @default 3 */
|
|
134
|
+
count?: number;
|
|
135
|
+
styles?: {
|
|
136
|
+
/** Background colour token for skeleton rows. */
|
|
137
|
+
bg?: string;
|
|
138
|
+
/** Hover background colour token for skeleton rows. */
|
|
139
|
+
hoverBg?: string;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* A simple label/value pair used as the canonical item shape for the `options`
|
|
145
|
+
* array and `onClickItem` / `renderItem` callbacks.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* const option: Option = { label: 'Huisarts', value: 'huisarts' };
|
|
149
|
+
*/
|
|
150
|
+
export type Option = {
|
|
151
|
+
/** Human-readable display name shown in the result row. */
|
|
152
|
+
label: string;
|
|
153
|
+
/** Unique identifier / machine-readable key for the option. */
|
|
154
|
+
value: string;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Arguments for the `boldedText` helper that wraps a substring match in `<b>`.
|
|
158
|
+
*
|
|
159
|
+
* Used internally by the default `renderItem` to highlight the portion of
|
|
160
|
+
* `text` that matches the current search `query`.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* boldedText({ text: 'Huisarts', shouldBeBold: 'huis' })
|
|
164
|
+
* // → <Text>…<b>Huis</b>arts</Text>
|
|
165
|
+
*/
|
|
166
|
+
export type BoldTextI = {
|
|
167
|
+
/** The full string to display. */
|
|
168
|
+
text: string;
|
|
169
|
+
/** The substring (case-insensitive) that should be wrapped in `<b>`. */
|
|
170
|
+
shouldBeBold: string;
|
|
171
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchBrand.types.js","sourceRoot":"","sources":["../../../../../src/alicia-ui/common/Search/SearchBrand.types.ts"],"names":[],"mappings":""}
|