aidos-ui 3.0.1 → 3.0.2
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/BaseListItem.d.ts +0 -1
- package/dist/BaseListItem.js +3 -1
- package/dist/BaseListItem.js.map +1 -1
- package/dist/List.d.ts +3 -0
- package/dist/List.js +21 -17
- package/dist/List.js.map +1 -1
- package/dist/ListButtonItem.d.ts +0 -1
- package/dist/ListButtonItem.js +4 -2
- package/dist/ListButtonItem.js.map +1 -1
- package/dist/ListHeaderItem.d.ts +1 -2
- package/dist/ListHeaderItem.js +4 -2
- package/dist/ListHeaderItem.js.map +1 -1
- package/dist/ListItem.d.ts +0 -1
- package/dist/ListItem.js +3 -1
- package/dist/ListItem.js.map +1 -1
- package/dist/ListLinkItem.d.ts +0 -1
- package/dist/ListLinkItem.js +4 -2
- package/dist/ListLinkItem.js.map +1 -1
- package/dist/Sublist.d.ts +1 -2
- package/dist/Sublist.js +2 -2
- package/dist/Sublist.js.map +1 -1
- package/package.json +3 -1
- package/scripts/embeddings.js +3 -3
- package/scripts/openai_embeddings.js +100 -0
- package/src/BaseListItem.tsx +3 -2
- package/src/List.tsx +30 -23
- package/src/ListButtonItem.tsx +3 -3
- package/src/ListHeaderItem.tsx +3 -3
- package/src/ListItem.tsx +4 -2
- package/src/ListLinkItem.tsx +3 -3
- package/src/Sublist.tsx +1 -4
- package/src/docs/searchIndex.ts +1 -0
- package/src/pages/List.mdx +8 -20
- package/src/pages/ListHeader.mdx +12 -16
- package/src/pages/_app.tsx +8 -16
- package/public/index.json +0 -1
package/dist/BaseListItem.d.ts
CHANGED
|
@@ -22,6 +22,5 @@ export interface BaseListItemProps extends RowProps {
|
|
|
22
22
|
role?: undefined;
|
|
23
23
|
gap?: Spacing;
|
|
24
24
|
selected?: boolean;
|
|
25
|
-
bare?: boolean;
|
|
26
25
|
}
|
|
27
26
|
export declare const BaseListItem: React.ForwardRefExoticComponent<Omit<BaseListItemProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
package/dist/BaseListItem.js
CHANGED
|
@@ -5,7 +5,9 @@ import { Row } from "./Row";
|
|
|
5
5
|
import { cssVar } from "./jss";
|
|
6
6
|
import { TextPairing } from "./TextPairing";
|
|
7
7
|
import { BaseView } from "./BaseView";
|
|
8
|
-
|
|
8
|
+
import { useListContext } from "./List";
|
|
9
|
+
export const BaseListItem = React.forwardRef(({ children, jsStyle, withDivider = true, headline, headlineSize = "medium", headlineColor = "primary", headlineAddOn, body, bodySize = "small", bodyColor = "secondary", addOn, addOnPosition, outerAddOn, disabled = false, padding = "medium", gap = "medium", selected, headlineBold, ...otherProps }, ref) => {
|
|
10
|
+
const { bare } = useListContext();
|
|
9
11
|
const content = (_jsx(TextPairing, { headlineBold: headlineBold, padding: padding, gap: gap, addOn: addOn, addOnPosition: addOnPosition, headline: headline, headlineSize: headlineSize, headlineColor: disabled ? "subtle" : bare && selected ? "highlight" : headlineColor, headlineAddOn: headlineAddOn, body: body, bodySize: bodySize, bodyColor: disabled ? "subtle" : bodyColor, grow: true, shrink: false }));
|
|
10
12
|
return (_jsxs(_Fragment, { children: [_jsxs(Row, { ...otherProps, ref: ref, relative: true, tag: "li", role: "row", jsStyle: [
|
|
11
13
|
!bare && {
|
package/dist/BaseListItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseListItem.js","sourceRoot":"","sources":["../src/BaseListItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAY,MAAM,OAAO,CAAC;AACtC,OAAO,EAA+C,MAAM,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseListItem.js","sourceRoot":"","sources":["../src/BaseListItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAY,MAAM,OAAO,CAAC;AACtC,OAAO,EAA+C,MAAM,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAwBxC,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAC1C,CACE,EACE,QAAQ,EACR,OAAO,EACP,WAAW,GAAG,IAAI,EAClB,QAAQ,EACR,YAAY,GAAG,QAAQ,EACvB,aAAa,GAAG,SAAS,EACzB,aAAa,EACb,IAAI,EACJ,QAAQ,GAAG,OAAO,EAClB,SAAS,GAAG,WAAW,EACvB,KAAK,EACL,aAAa,EACb,UAAU,EACV,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,QAAQ,EAClB,GAAG,GAAG,QAAQ,EACd,QAAQ,EACR,YAAY,EACZ,GAAG,UAAU,EACK,EACpB,GAA4B,EAC5B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,CAAC;IAElC,MAAM,OAAO,GAAG,CACd,KAAC,WAAW,IACV,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,aAAa,EACX,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,EAEtE,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAC1C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,KAAK,GACb,CACH,CAAC;IAEF,OAAO,CACL,8BACE,MAAC,GAAG,OACE,UAAU,EACd,GAAG,EAAE,GAAG,EACR,QAAQ,QACR,GAAG,EAAC,IAAI,EACR,IAAI,EAAC,KAAK,EACV,OAAO,EAAE;oBACP,CAAC,IAAI,IAAI;wBACP,CAAC,gBAAgB,CAAC,EAAE;4BAClB,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,CAAC;4BAChD,oBAAoB,EAAE,MAAM,CAAC,mBAAmB,CAAC;yBAClD;wBACD,CAAC,eAAe,CAAC,EAAE;4BACjB,sBAAsB,EAAE,MAAM,CAAC,mBAAmB,CAAC;4BACnD,uBAAuB,EAAE,MAAM,CAAC,mBAAmB,CAAC;yBACrD;qBACF;oBACD,OAAO;iBACR,aAED,KAAC,GAAG,IACF,IAAI,QACJ,IAAI,EAAC,UAAU,EACf,OAAO,EAAE;4BACP,QAAQ,EAAE,QAAQ;yBACnB,YAEA,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,GAClB,EACL,UAAU,IAAI,KAAC,QAAQ,IAAC,IAAI,EAAC,UAAU,YAAE,UAAU,GAAY,IAC5D,EACL,WAAW,IAAI,KAAC,WAAW,KAAG,IAC9B,CACJ,CAAC;AACJ,CAAC,CACF,CAAC"}
|
package/dist/List.d.ts
CHANGED
|
@@ -8,4 +8,7 @@ interface ListProps extends BaseListProps {
|
|
|
8
8
|
carded?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare function List({ ariaLabel, jsStyle, autofocus, navigation, bare, carded, ...otherProps }: ListProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const useListContext: () => {
|
|
12
|
+
bare: boolean;
|
|
13
|
+
};
|
|
11
14
|
export {};
|
package/dist/List.js
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useContext, useMemo } from "react";
|
|
2
3
|
import { BaseList } from "./BaseList";
|
|
3
4
|
import { useNavigation } from "./useNavigation";
|
|
4
5
|
import { cssVar } from "./jss";
|
|
6
|
+
const ListContext = React.createContext({ bare: false });
|
|
5
7
|
export function List({ ariaLabel, jsStyle, autofocus = false, navigation = true, bare, carded = true, ...otherProps }) {
|
|
6
8
|
const rootRef = useNavigation({ autofocus, enabled: navigation });
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
!
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
const contextValue = useMemo(() => ({ bare }), [bare]);
|
|
10
|
+
return (_jsx(ListContext.Provider, { value: contextValue, children: _jsx(BaseList, { role: "grid", "aria-label": ariaLabel, ref: rootRef, jsStyle: [
|
|
11
|
+
{ overflow: "hidden" },
|
|
12
|
+
!bare && {
|
|
13
|
+
backgroundColor: cssVar("--overlay-background"),
|
|
14
|
+
},
|
|
15
|
+
!bare &&
|
|
16
|
+
!carded && {
|
|
17
|
+
borderBottom: `1px solid ${cssVar("--divider")}`,
|
|
18
|
+
borderTop: `1px solid ${cssVar("--divider")}`,
|
|
19
|
+
},
|
|
20
|
+
!bare &&
|
|
21
|
+
carded && {
|
|
22
|
+
border: `1px solid ${cssVar("--divider")}`,
|
|
23
|
+
borderRadius: cssVar("--border-radius-l"),
|
|
24
|
+
},
|
|
25
|
+
jsStyle,
|
|
26
|
+
], ...otherProps }) }));
|
|
24
27
|
}
|
|
28
|
+
export const useListContext = () => useContext(ListContext);
|
|
25
29
|
//# sourceMappingURL=List.js.map
|
package/dist/List.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sourceRoot":"","sources":["../src/List.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"List.js","sourceRoot":"","sources":["../src/List.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAW/B,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAEzD,MAAM,UAAU,IAAI,CAAC,EACnB,SAAS,EACT,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,IAAI,EACjB,IAAI,EACJ,MAAM,GAAG,IAAI,EACb,GAAG,UAAU,EACH;IACV,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IAClE,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvD,OAAO,CACL,KAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YACvC,KAAC,QAAQ,IACP,IAAI,EAAC,MAAM,gBACC,SAAS,EACrB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE;gBACP,EAAE,QAAQ,EAAE,QAAQ,EAAE;gBACtB,CAAC,IAAI,IAAI;oBACP,eAAe,EAAE,MAAM,CAAC,sBAAsB,CAAC;iBAChD;gBACD,CAAC,IAAI;oBACH,CAAC,MAAM,IAAI;oBACT,YAAY,EAAE,aAAa,MAAM,CAAC,WAAW,CAAC,EAAE;oBAChD,SAAS,EAAE,aAAa,MAAM,CAAC,WAAW,CAAC,EAAE;iBAC9C;gBACH,CAAC,IAAI;oBACH,MAAM,IAAI;oBACR,MAAM,EAAE,aAAa,MAAM,CAAC,WAAW,CAAC,EAAE;oBAC1C,YAAY,EAAE,MAAM,CAAC,mBAAmB,CAAC;iBAC1C;gBACH,OAAO;aACR,KACG,UAAU,GACd,GACmB,CACxB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC"}
|
package/dist/ListButtonItem.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ interface ListButtonItemProps extends BaseListItemProps {
|
|
|
8
8
|
body?: string;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
selected?: boolean;
|
|
11
|
-
bare?: boolean;
|
|
12
11
|
children?: void;
|
|
13
12
|
}
|
|
14
13
|
export declare const ListButtonItem: React.ForwardRefExoticComponent<Omit<ListButtonItemProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
package/dist/ListButtonItem.js
CHANGED
|
@@ -3,7 +3,9 @@ import React from "react";
|
|
|
3
3
|
import { BaseListItem } from "./BaseListItem";
|
|
4
4
|
import { getGlyphColor, getInteractableListItemJSStyles, } from "./Interactable";
|
|
5
5
|
import { BaseButton } from "./BaseButton";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { useListContext } from "./List";
|
|
7
|
+
export const ListButtonItem = React.forwardRef(({ onClick, color = "secondary", disabled = false, padding = "medium", jsStyle, gap, selected, ...otherProps }, ref) => {
|
|
8
|
+
const { bare } = useListContext();
|
|
9
|
+
return (_jsx(BaseListItem, { withDivider: !bare, disabled: disabled, padding: "none", gap: gap, headlineColor: getGlyphColor(color, disabled, true), bodyColor: getGlyphColor(color, disabled, true), selected: selected, "aria-selected": selected, ...otherProps, jsStyle: jsStyle, children: ({ content }) => (_jsx(BaseButton, { padding: padding, disabled: disabled, animateInteraction: false, bare: true, color: bare ? "secondary" : color, ref: ref, jsStyle: getInteractableListItemJSStyles({ bare, selected }), onClick: onClick, children: content })) }));
|
|
8
10
|
});
|
|
9
11
|
//# sourceMappingURL=ListButtonItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListButtonItem.js","sourceRoot":"","sources":["../src/ListButtonItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAEL,aAAa,EACb,+BAA+B,GAChC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ListButtonItem.js","sourceRoot":"","sources":["../src/ListButtonItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAEL,aAAa,EACb,+BAA+B,GAChC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAaxC,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAC5C,CACE,EACE,OAAO,EACP,KAAK,GAAG,WAAW,EACnB,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,QAAQ,EAClB,OAAO,EACP,GAAG,EACH,QAAQ,EACR,GAAG,UAAU,EACO,EACtB,GAAkC,EAClC,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,CAAC;IAElC,OAAO,CACL,KAAC,YAAY,IACX,WAAW,EAAE,CAAC,IAAI,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAC,MAAM,EACd,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,EACnD,SAAS,EAAE,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,EAC/C,QAAQ,EAAE,QAAQ,mBACH,QAAQ,KACnB,UAAU,EACd,OAAO,EAAE,OAAO,YAEf,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAChB,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,kBAAkB,EAAE,KAAK,EACzB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,EACjC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,+BAA+B,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAC5D,OAAO,EAAE,OAAO,YAEf,OAAO,GACG,CACd,GACY,CAChB,CAAC;AACJ,CAAC,CACF,CAAC"}
|
package/dist/ListHeaderItem.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { Position } from "./jss";
|
|
3
|
-
export declare function ListHeaderItem({
|
|
4
|
-
bare?: boolean;
|
|
3
|
+
export declare function ListHeaderItem({ highlight, headline, body, withDivider, addOn, addOnPosition, }: {
|
|
5
4
|
highlight?: boolean;
|
|
6
5
|
headline: string;
|
|
7
6
|
body?: string;
|
package/dist/ListHeaderItem.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { BaseListItem } from "./BaseListItem";
|
|
3
3
|
import { cssVar } from "./jss";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { useListContext } from "./List";
|
|
5
|
+
export function ListHeaderItem({ highlight, headline, body, withDivider, addOn, addOnPosition, }) {
|
|
6
|
+
const { bare } = useListContext();
|
|
7
|
+
return (_jsx(BaseListItem, { headline: headline, headlineColor: highlight ? (bare ? "highlight" : "light") : "primary", headlineBold: true, body: body, addOn: addOn, addOnPosition: addOnPosition, withDivider: bare ? false : withDivider, jsStyle: bare
|
|
6
8
|
? null
|
|
7
9
|
: {
|
|
8
10
|
backgroundColor: highlight
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListHeaderItem.js","sourceRoot":"","sources":["../src/ListHeaderItem.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAY,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ListHeaderItem.js","sourceRoot":"","sources":["../src/ListHeaderItem.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAY,MAAM,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,MAAM,UAAU,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,KAAK,EACL,aAAa,GAQd;IACC,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,CAAC;IAElC,OAAO,CACL,KAAC,YAAY,IACX,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,EACrE,YAAY,EAAE,IAAI,EAClB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,EACvC,OAAO,EACL,IAAI;YACF,CAAC,CAAC,IAAI;YACN,CAAC,CAAC;gBACE,eAAe,EAAE,SAAS;oBACxB,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;oBACvB,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC;aACrC,YAGN,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,GACZ,CAChB,CAAC;AACJ,CAAC"}
|
package/dist/ListItem.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { BaseListItemProps } from "./BaseListItem";
|
|
|
3
3
|
interface ListItemProps extends BaseListItemProps {
|
|
4
4
|
headline: string;
|
|
5
5
|
body?: string;
|
|
6
|
-
bare?: boolean;
|
|
7
6
|
children?: void;
|
|
8
7
|
}
|
|
9
8
|
export declare const ListItem: React.ForwardRefExoticComponent<Omit<ListItemProps, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
package/dist/ListItem.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { BaseListItem } from "./BaseListItem";
|
|
4
|
+
import { useListContext } from "./List";
|
|
4
5
|
export const ListItem = React.forwardRef((props, ref) => {
|
|
5
|
-
|
|
6
|
+
const { bare } = useListContext();
|
|
7
|
+
return (_jsx(BaseListItem, { withDivider: !bare, ...props, jsStyle: props.jsStyle, ref: ref, children: ({ content }) => content }));
|
|
6
8
|
});
|
|
7
9
|
//# sourceMappingURL=ListItem.js.map
|
package/dist/ListItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","sourceRoot":"","sources":["../src/ListItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ListItem.js","sourceRoot":"","sources":["../src/ListItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AASxC,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CACtC,CAAC,KAAoB,EAAE,GAA8B,EAAE,EAAE;IACvD,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,CAAC;IAElC,OAAO,CACL,KAAC,YAAY,IACX,WAAW,EAAE,CAAC,IAAI,KACd,KAAK,EACT,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,GAAG,EAAE,GAAG,YAEP,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,GACZ,CAChB,CAAC;AACJ,CAAC,CACF,CAAC"}
|
package/dist/ListLinkItem.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ interface ListLinkItemProps extends BaseListItemProps {
|
|
|
10
10
|
body?: string;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
selected?: boolean;
|
|
13
|
-
bare?: boolean;
|
|
14
13
|
target?: string;
|
|
15
14
|
}
|
|
16
15
|
export declare const ListLinkItem: React.ForwardRefExoticComponent<Omit<ListLinkItemProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
package/dist/ListLinkItem.js
CHANGED
|
@@ -3,7 +3,9 @@ import React from "react";
|
|
|
3
3
|
import { BaseListItem } from "./BaseListItem";
|
|
4
4
|
import { getGlyphColor, getInteractableListItemJSStyles, } from "./Interactable";
|
|
5
5
|
import { BaseLink } from "./BaseLink";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { useListContext } from "./List";
|
|
7
|
+
export const ListLinkItem = React.forwardRef(({ onClick, href, disabled = false, padding = "medium", jsStyle, gap, selected, color = "secondary", target, ...otherProps }, ref) => {
|
|
8
|
+
const { bare } = useListContext();
|
|
9
|
+
return (_jsx(BaseListItem, { withDivider: !bare, disabled: disabled, "aria-selected": selected, padding: "none", gap: gap, headlineColor: getGlyphColor(color, disabled, true), bodyColor: getGlyphColor(color, disabled, true), selected: selected, ...otherProps, jsStyle: jsStyle, children: ({ content }) => (_jsx(BaseLink, { target: target, padding: padding, "aria-current": selected ? "page" : undefined, disabled: disabled, animateInteraction: false, bare: true, color: color, href: href, ref: ref, jsStyle: getInteractableListItemJSStyles({ bare, selected }), onClick: onClick, children: content })) }));
|
|
8
10
|
});
|
|
9
11
|
//# sourceMappingURL=ListLinkItem.js.map
|
package/dist/ListLinkItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListLinkItem.js","sourceRoot":"","sources":["../src/ListLinkItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAEL,aAAa,EACb,+BAA+B,GAChC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ListLinkItem.js","sourceRoot":"","sources":["../src/ListLinkItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAEL,aAAa,EACb,+BAA+B,GAChC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAexC,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAC1C,CACE,EACE,OAAO,EACP,IAAI,EACJ,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,QAAQ,EAClB,OAAO,EACP,GAAG,EACH,QAAQ,EACR,KAAK,GAAG,WAAW,EACnB,MAAM,EACN,GAAG,UAAU,EACK,EACpB,GAAkC,EAClC,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,EAAE,CAAC;IAElC,OAAO,CACL,KAAC,YAAY,IACX,WAAW,EAAE,CAAC,IAAI,EAClB,QAAQ,EAAE,QAAQ,mBACH,QAAQ,EACvB,OAAO,EAAC,MAAM,EACd,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,EACnD,SAAS,EAAE,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,EAC/C,QAAQ,EAAE,QAAQ,KACd,UAAU,EACd,OAAO,EAAE,OAAO,YAEf,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAChB,KAAC,QAAQ,IACP,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,kBACF,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC3C,QAAQ,EAAE,QAAQ,EAClB,kBAAkB,EAAE,KAAK,EACzB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,+BAA+B,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAC5D,OAAO,EAAE,OAAO,YAEf,OAAO,GACC,CACZ,GACY,CAChB,CAAC;AACJ,CAAC,CACF,CAAC"}
|
package/dist/Sublist.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import { JSStyle } from "./jss";
|
|
3
|
-
export declare function Sublist({ children, label, labelBold, initialState, jsStyle, secondaryAddOn,
|
|
4
|
-
bare?: boolean;
|
|
3
|
+
export declare function Sublist({ children, label, labelBold, initialState, jsStyle, secondaryAddOn, }: {
|
|
5
4
|
children: React.ReactNode;
|
|
6
5
|
label: string;
|
|
7
6
|
labelBold?: boolean;
|
package/dist/Sublist.js
CHANGED
|
@@ -4,9 +4,9 @@ import { ListButtonItem } from "./ListButtonItem";
|
|
|
4
4
|
import { Icon } from "./Icon";
|
|
5
5
|
import { Box } from "./Box";
|
|
6
6
|
import { Row } from "./Row";
|
|
7
|
-
export function Sublist({ children, label, labelBold, initialState = { collapsed: false }, jsStyle, secondaryAddOn,
|
|
7
|
+
export function Sublist({ children, label, labelBold, initialState = { collapsed: false }, jsStyle, secondaryAddOn, }) {
|
|
8
8
|
const [collapsed, setCollapsed] = React.useState(initialState.collapsed);
|
|
9
|
-
return (_jsxs(_Fragment, { children: [_jsx(ListButtonItem, {
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsx(ListButtonItem, { headline: label, headlineBold: labelBold, onClick: () => setCollapsed((x) => !x), jsStyle: jsStyle, addOn: _jsxs(Row, { gap: "medium", align: "center", children: [secondaryAddOn, _jsx(Box, { padding: "medium", jsStyle: [
|
|
10
10
|
{
|
|
11
11
|
transition: "transform 0.15s ease-in",
|
|
12
12
|
},
|
package/dist/Sublist.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sublist.js","sourceRoot":"","sources":["../src/Sublist.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Sublist.js","sourceRoot":"","sources":["../src/Sublist.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAI5B,MAAM,UAAU,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,YAAY,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EACnC,OAAO,EACP,cAAc,GAUf;IACC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IACzE,OAAO,CACL,8BACE,KAAC,cAAc,IACb,QAAQ,EAAE,KAAK,EACf,YAAY,EAAE,SAAS,EACvB,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EACtC,OAAO,EAAE,OAAO,EAChB,KAAK,EACH,MAAC,GAAG,IAAC,GAAG,EAAC,QAAQ,EAAC,KAAK,EAAC,QAAQ,aAC7B,cAAc,EACf,KAAC,GAAG,IACF,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE;gCACP;oCACE,UAAU,EAAE,yBAAyB;iCACtC;gCACD,CAAC,SAAS,IAAI;oCACZ,SAAS,EAAE,gBAAgB;iCAC5B;6BACF,YAED,KAAC,IAAI,IACH,KAAK,EAAC,SAAS,EACf,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,wBAAwB,GAC7B,GACE,IACF,EAER,aAAa,EAAC,KAAK,EACnB,KAAK,EAAC,WAAW,GACjB,EACD,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,IAC3B,CACJ,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aidos-ui",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "A simple UI framework",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,9 +27,11 @@
|
|
|
27
27
|
"@types/react-dom": "^18.0.10",
|
|
28
28
|
"@xenova/transformers": "^2.4.2",
|
|
29
29
|
"csstype": "^3.1.1",
|
|
30
|
+
"dotenv": "^16.3.1",
|
|
30
31
|
"install": "^0.13.0",
|
|
31
32
|
"next": "latest",
|
|
32
33
|
"npm": "^9.8.0",
|
|
34
|
+
"openai": "^3.3.0",
|
|
33
35
|
"prismjs": "^1.29.0",
|
|
34
36
|
"process": "^0.11.10",
|
|
35
37
|
"react-dom": "latest",
|
package/scripts/embeddings.js
CHANGED
|
@@ -10,7 +10,7 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
10
10
|
const __dirname = path.dirname(__filename);
|
|
11
11
|
const __rootdir = path.join(__dirname, "..");
|
|
12
12
|
const __pages = path.join(__rootdir, "src", "pages");
|
|
13
|
-
const
|
|
13
|
+
const __target = path.join(__rootdir, "src", "docs");
|
|
14
14
|
|
|
15
15
|
const generateEmbeddings = await pipeline(
|
|
16
16
|
"feature-extraction",
|
|
@@ -50,8 +50,8 @@ for (const file of files) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
await fs.writeFile(
|
|
53
|
-
path.join(
|
|
54
|
-
JSON.stringify({ index })
|
|
53
|
+
path.join(__target, "searchIndex.ts"),
|
|
54
|
+
`export const index = ${JSON.stringify({ index })}`
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
function parseChildren(children) {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import fs from "fs/promises";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { unified } from "unified";
|
|
5
|
+
import remarkParse from "remark-parse";
|
|
6
|
+
import remarkMdx from "remark-mdx";
|
|
7
|
+
import { Configuration, OpenAIApi } from "openai";
|
|
8
|
+
import dotenv from "dotenv";
|
|
9
|
+
|
|
10
|
+
dotenv.config();
|
|
11
|
+
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = path.dirname(__filename);
|
|
14
|
+
const __rootdir = path.join(__dirname, "..");
|
|
15
|
+
const __pages = path.join(__rootdir, "src", "pages");
|
|
16
|
+
const __target = path.join(__rootdir, "src", "docs");
|
|
17
|
+
|
|
18
|
+
const configuration = new Configuration({
|
|
19
|
+
organization: "org-Q89d8tyY2MChQVFEbhp27pB3",
|
|
20
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
21
|
+
});
|
|
22
|
+
const openai = new OpenAIApi(configuration);
|
|
23
|
+
|
|
24
|
+
const files = await fs.readdir(__pages);
|
|
25
|
+
|
|
26
|
+
const index = [];
|
|
27
|
+
|
|
28
|
+
for (const file of files) {
|
|
29
|
+
if (path.extname(file) !== ".mdx") {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const filepath = path.join(__pages, file);
|
|
34
|
+
const filename = path.parse(file).name;
|
|
35
|
+
const content = await fs.readFile(filepath, "utf-8");
|
|
36
|
+
const sections = parseContent(content);
|
|
37
|
+
|
|
38
|
+
const embeddings = await Promise.all(
|
|
39
|
+
sections.map(async ({ text, heading, headingDepth }) => {
|
|
40
|
+
const embedding = await openai
|
|
41
|
+
.createEmbedding({
|
|
42
|
+
model: "text-embedding-ada-002",
|
|
43
|
+
input: text,
|
|
44
|
+
})
|
|
45
|
+
.then((response) => response.data[0].embedding);
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
heading,
|
|
49
|
+
headingDepth,
|
|
50
|
+
filename,
|
|
51
|
+
embedding: Array.from(embedding.data),
|
|
52
|
+
};
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
index.push(...embeddings);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
await fs.writeFile(
|
|
60
|
+
path.join(__target, "searchIndex.ts"),
|
|
61
|
+
`export const index = ${JSON.stringify({ index })}`
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
function parseChildren(children) {
|
|
65
|
+
const result = [];
|
|
66
|
+
|
|
67
|
+
for (const node of children) {
|
|
68
|
+
if (node.type === "text") {
|
|
69
|
+
result.push(node.value);
|
|
70
|
+
} else if (node.type === "inlineCode") {
|
|
71
|
+
result.push(node.value);
|
|
72
|
+
} else if (node.type === "link") {
|
|
73
|
+
result.push(parseChildren(node.children));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return result.join(" ");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function parseContent(content) {
|
|
81
|
+
const ast = unified().use(remarkParse).use(remarkMdx).parse(content);
|
|
82
|
+
const result = [];
|
|
83
|
+
let headingDepth = 1;
|
|
84
|
+
let heading = "";
|
|
85
|
+
|
|
86
|
+
for (const node of ast.children) {
|
|
87
|
+
if (node.type === "paragraph") {
|
|
88
|
+
result.push({
|
|
89
|
+
text: heading + ": " + parseChildren(node.children),
|
|
90
|
+
heading,
|
|
91
|
+
headingDepth,
|
|
92
|
+
});
|
|
93
|
+
} else if (node.type === "heading") {
|
|
94
|
+
headingDepth = node.depth;
|
|
95
|
+
heading = parseChildren(node.children);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return result;
|
|
100
|
+
}
|
package/src/BaseListItem.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import { JSStyle, Size, Position, Spacing, TextColor, cssVar } from "./jss";
|
|
|
6
6
|
import { InteractableColor } from "./Interactable";
|
|
7
7
|
import { TextPairing } from "./TextPairing";
|
|
8
8
|
import { BaseView } from "./BaseView";
|
|
9
|
+
import { useListContext } from "./List";
|
|
9
10
|
|
|
10
11
|
// @ts-ignore
|
|
11
12
|
export interface BaseListItemProps extends RowProps {
|
|
@@ -27,7 +28,6 @@ export interface BaseListItemProps extends RowProps {
|
|
|
27
28
|
role?: undefined;
|
|
28
29
|
gap?: Spacing;
|
|
29
30
|
selected?: boolean;
|
|
30
|
-
bare?: boolean;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export const BaseListItem = React.forwardRef(
|
|
@@ -50,12 +50,13 @@ export const BaseListItem = React.forwardRef(
|
|
|
50
50
|
padding = "medium",
|
|
51
51
|
gap = "medium",
|
|
52
52
|
selected,
|
|
53
|
-
bare,
|
|
54
53
|
headlineBold,
|
|
55
54
|
...otherProps
|
|
56
55
|
}: BaseListItemProps,
|
|
57
56
|
ref?: React.Ref<HTMLElement>
|
|
58
57
|
) => {
|
|
58
|
+
const { bare } = useListContext();
|
|
59
|
+
|
|
59
60
|
const content = (
|
|
60
61
|
<TextPairing
|
|
61
62
|
headlineBold={headlineBold}
|
package/src/List.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useContext, useMemo } from "react";
|
|
2
2
|
import { BaseList, BaseListProps } from "./BaseList";
|
|
3
3
|
import { useNavigation } from "./useNavigation";
|
|
4
4
|
import { cssVar } from "./jss";
|
|
@@ -12,6 +12,8 @@ interface ListProps extends BaseListProps {
|
|
|
12
12
|
carded?: boolean;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
const ListContext = React.createContext({ bare: false });
|
|
16
|
+
|
|
15
17
|
export function List({
|
|
16
18
|
ariaLabel,
|
|
17
19
|
jsStyle,
|
|
@@ -22,30 +24,35 @@ export function List({
|
|
|
22
24
|
...otherProps
|
|
23
25
|
}: ListProps) {
|
|
24
26
|
const rootRef = useNavigation({ autofocus, enabled: navigation });
|
|
27
|
+
const contextValue = useMemo(() => ({ bare }), [bare]);
|
|
25
28
|
|
|
26
29
|
return (
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
!bare &&
|
|
37
|
-
!carded && {
|
|
38
|
-
borderBottom: `1px solid ${cssVar("--divider")}`,
|
|
39
|
-
borderTop: `1px solid ${cssVar("--divider")}`,
|
|
40
|
-
},
|
|
41
|
-
!bare &&
|
|
42
|
-
carded && {
|
|
43
|
-
border: `1px solid ${cssVar("--divider")}`,
|
|
44
|
-
borderRadius: cssVar("--border-radius-l"),
|
|
30
|
+
<ListContext.Provider value={contextValue}>
|
|
31
|
+
<BaseList
|
|
32
|
+
role="grid"
|
|
33
|
+
aria-label={ariaLabel}
|
|
34
|
+
ref={rootRef}
|
|
35
|
+
jsStyle={[
|
|
36
|
+
{ overflow: "hidden" },
|
|
37
|
+
!bare && {
|
|
38
|
+
backgroundColor: cssVar("--overlay-background"),
|
|
45
39
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
!bare &&
|
|
41
|
+
!carded && {
|
|
42
|
+
borderBottom: `1px solid ${cssVar("--divider")}`,
|
|
43
|
+
borderTop: `1px solid ${cssVar("--divider")}`,
|
|
44
|
+
},
|
|
45
|
+
!bare &&
|
|
46
|
+
carded && {
|
|
47
|
+
border: `1px solid ${cssVar("--divider")}`,
|
|
48
|
+
borderRadius: cssVar("--border-radius-l"),
|
|
49
|
+
},
|
|
50
|
+
jsStyle,
|
|
51
|
+
]}
|
|
52
|
+
{...otherProps}
|
|
53
|
+
/>
|
|
54
|
+
</ListContext.Provider>
|
|
50
55
|
);
|
|
51
56
|
}
|
|
57
|
+
|
|
58
|
+
export const useListContext = () => useContext(ListContext);
|
package/src/ListButtonItem.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getInteractableListItemJSStyles,
|
|
8
8
|
} from "./Interactable";
|
|
9
9
|
import { BaseButton } from "./BaseButton";
|
|
10
|
+
import { useListContext } from "./List";
|
|
10
11
|
|
|
11
12
|
// @ts-ignore
|
|
12
13
|
interface ListButtonItemProps extends BaseListItemProps {
|
|
@@ -16,7 +17,6 @@ interface ListButtonItemProps extends BaseListItemProps {
|
|
|
16
17
|
body?: string;
|
|
17
18
|
disabled?: boolean;
|
|
18
19
|
selected?: boolean;
|
|
19
|
-
bare?: boolean;
|
|
20
20
|
children?: void;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -30,11 +30,12 @@ export const ListButtonItem = React.forwardRef(
|
|
|
30
30
|
jsStyle,
|
|
31
31
|
gap,
|
|
32
32
|
selected,
|
|
33
|
-
bare,
|
|
34
33
|
...otherProps
|
|
35
34
|
}: ListButtonItemProps,
|
|
36
35
|
ref?: React.Ref<HTMLButtonElement>
|
|
37
36
|
) => {
|
|
37
|
+
const { bare } = useListContext();
|
|
38
|
+
|
|
38
39
|
return (
|
|
39
40
|
<BaseListItem
|
|
40
41
|
withDivider={!bare}
|
|
@@ -45,7 +46,6 @@ export const ListButtonItem = React.forwardRef(
|
|
|
45
46
|
bodyColor={getGlyphColor(color, disabled, true)}
|
|
46
47
|
selected={selected}
|
|
47
48
|
aria-selected={selected}
|
|
48
|
-
bare={bare}
|
|
49
49
|
{...otherProps}
|
|
50
50
|
jsStyle={jsStyle}
|
|
51
51
|
>
|
package/src/ListHeaderItem.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import { BaseListItem } from "./BaseListItem";
|
|
3
3
|
import { Position, cssVar } from "./jss";
|
|
4
|
+
import { useListContext } from "./List";
|
|
4
5
|
|
|
5
6
|
export function ListHeaderItem({
|
|
6
|
-
bare,
|
|
7
7
|
highlight,
|
|
8
8
|
headline,
|
|
9
9
|
body,
|
|
@@ -11,7 +11,6 @@ export function ListHeaderItem({
|
|
|
11
11
|
addOn,
|
|
12
12
|
addOnPosition,
|
|
13
13
|
}: {
|
|
14
|
-
bare?: boolean;
|
|
15
14
|
highlight?: boolean;
|
|
16
15
|
headline: string;
|
|
17
16
|
body?: string;
|
|
@@ -19,9 +18,10 @@ export function ListHeaderItem({
|
|
|
19
18
|
addOn?: ReactNode;
|
|
20
19
|
addOnPosition?: Position;
|
|
21
20
|
}) {
|
|
21
|
+
const { bare } = useListContext();
|
|
22
|
+
|
|
22
23
|
return (
|
|
23
24
|
<BaseListItem
|
|
24
|
-
bare={bare}
|
|
25
25
|
headline={headline}
|
|
26
26
|
headlineColor={highlight ? (bare ? "highlight" : "light") : "primary"}
|
|
27
27
|
headlineBold={true}
|
package/src/ListItem.tsx
CHANGED
|
@@ -2,20 +2,22 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { BaseListItem, BaseListItemProps } from "./BaseListItem";
|
|
4
4
|
import { cssVar } from "./jss";
|
|
5
|
+
import { useListContext } from "./List";
|
|
5
6
|
|
|
6
7
|
// @ts-ignore
|
|
7
8
|
interface ListItemProps extends BaseListItemProps {
|
|
8
9
|
headline: string;
|
|
9
10
|
body?: string;
|
|
10
|
-
bare?: boolean;
|
|
11
11
|
children?: void;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const ListItem = React.forwardRef(
|
|
15
15
|
(props: ListItemProps, ref?: React.Ref<HTMLLIElement>) => {
|
|
16
|
+
const { bare } = useListContext();
|
|
17
|
+
|
|
16
18
|
return (
|
|
17
19
|
<BaseListItem
|
|
18
|
-
withDivider={!
|
|
20
|
+
withDivider={!bare}
|
|
19
21
|
{...props}
|
|
20
22
|
jsStyle={props.jsStyle}
|
|
21
23
|
ref={ref}
|
package/src/ListLinkItem.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getInteractableListItemJSStyles,
|
|
8
8
|
} from "./Interactable";
|
|
9
9
|
import { BaseLink } from "./BaseLink";
|
|
10
|
+
import { useListContext } from "./List";
|
|
10
11
|
|
|
11
12
|
// @ts-ignore
|
|
12
13
|
interface ListLinkItemProps extends BaseListItemProps {
|
|
@@ -18,7 +19,6 @@ interface ListLinkItemProps extends BaseListItemProps {
|
|
|
18
19
|
body?: string;
|
|
19
20
|
disabled?: boolean;
|
|
20
21
|
selected?: boolean;
|
|
21
|
-
bare?: boolean;
|
|
22
22
|
target?: string;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -32,13 +32,14 @@ export const ListLinkItem = React.forwardRef(
|
|
|
32
32
|
jsStyle,
|
|
33
33
|
gap,
|
|
34
34
|
selected,
|
|
35
|
-
bare,
|
|
36
35
|
color = "secondary",
|
|
37
36
|
target,
|
|
38
37
|
...otherProps
|
|
39
38
|
}: ListLinkItemProps,
|
|
40
39
|
ref?: React.Ref<HTMLAnchorElement>
|
|
41
40
|
) => {
|
|
41
|
+
const { bare } = useListContext();
|
|
42
|
+
|
|
42
43
|
return (
|
|
43
44
|
<BaseListItem
|
|
44
45
|
withDivider={!bare}
|
|
@@ -49,7 +50,6 @@ export const ListLinkItem = React.forwardRef(
|
|
|
49
50
|
headlineColor={getGlyphColor(color, disabled, true)}
|
|
50
51
|
bodyColor={getGlyphColor(color, disabled, true)}
|
|
51
52
|
selected={selected}
|
|
52
|
-
bare={bare}
|
|
53
53
|
{...otherProps}
|
|
54
54
|
jsStyle={jsStyle}
|
|
55
55
|
>
|