aidos-ui 3.0.0 → 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.
Files changed (81) hide show
  1. package/README.md +2 -2
  2. package/dist/Badge.d.ts +1 -2
  3. package/dist/BaseLink.d.ts +1 -1
  4. package/dist/BaseList.d.ts +1 -1
  5. package/dist/BaseListAddOn.d.ts +1 -1
  6. package/dist/BaseListItem.d.ts +1 -2
  7. package/dist/BaseListItem.js +3 -1
  8. package/dist/BaseListItem.js.map +1 -1
  9. package/dist/BaseView.d.ts +1 -1
  10. package/dist/Box.d.ts +1 -2
  11. package/dist/Card.d.ts +1 -1
  12. package/dist/Checkbox.d.ts +1 -2
  13. package/dist/Circle.d.ts +1 -2
  14. package/dist/Column.d.ts +1 -1
  15. package/dist/DarkMode.d.ts +2 -2
  16. package/dist/DatePicker.d.ts +1 -2
  17. package/dist/DesignBook.d.ts +1 -2
  18. package/dist/Dialog.d.ts +2 -2
  19. package/dist/Dropdown.d.ts +1 -2
  20. package/dist/FlexLayout.d.ts +1 -1
  21. package/dist/Icon.d.ts +1 -1
  22. package/dist/List.d.ts +5 -2
  23. package/dist/List.js +22 -10
  24. package/dist/List.js.map +1 -1
  25. package/dist/ListButtonItem.d.ts +1 -2
  26. package/dist/ListButtonItem.js +4 -2
  27. package/dist/ListButtonItem.js.map +1 -1
  28. package/dist/ListDivider.d.ts +1 -2
  29. package/dist/ListHeaderItem.d.ts +2 -3
  30. package/dist/ListHeaderItem.js +4 -2
  31. package/dist/ListHeaderItem.js.map +1 -1
  32. package/dist/ListItem.d.ts +1 -2
  33. package/dist/ListItem.js +3 -1
  34. package/dist/ListItem.js.map +1 -1
  35. package/dist/ListLinkItem.d.ts +1 -2
  36. package/dist/ListLinkItem.js +4 -2
  37. package/dist/ListLinkItem.js.map +1 -1
  38. package/dist/ListSpacer.d.ts +1 -2
  39. package/dist/Popover.d.ts +2 -2
  40. package/dist/ProgressBar.d.ts +1 -2
  41. package/dist/ProgressCircle.d.ts +1 -2
  42. package/dist/Providers.d.ts +1 -1
  43. package/dist/RootView.d.ts +1 -1
  44. package/dist/Router.d.ts +1 -2
  45. package/dist/RouterState.d.ts +1 -1
  46. package/dist/Row.d.ts +1 -1
  47. package/dist/StackContext.d.ts +1 -1
  48. package/dist/StaticCheckbox.d.ts +1 -2
  49. package/dist/Sublist.d.ts +3 -3
  50. package/dist/Sublist.js +2 -2
  51. package/dist/Sublist.js.map +1 -1
  52. package/dist/SubmitIconInput.d.ts +1 -2
  53. package/dist/Tabs.d.ts +1 -1
  54. package/dist/Text.d.ts +8 -8
  55. package/dist/TextInputWithState.d.ts +1 -1
  56. package/dist/TextPairing.d.ts +1 -1
  57. package/dist/Tooltip.d.ts +1 -1
  58. package/dist/jss.d.ts +2 -2
  59. package/dist/stateMachineContextFactory.d.ts +1 -1
  60. package/package.json +10 -3
  61. package/scripts/embeddings.js +93 -0
  62. package/scripts/openai_embeddings.js +100 -0
  63. package/scripts/publish.js +1 -0
  64. package/scripts/test_embeddings.js +47 -0
  65. package/src/BaseListItem.tsx +3 -2
  66. package/src/List.tsx +33 -16
  67. package/src/ListButtonItem.tsx +3 -3
  68. package/src/ListHeaderItem.tsx +3 -3
  69. package/src/ListItem.tsx +4 -2
  70. package/src/ListLinkItem.tsx +3 -3
  71. package/src/Sublist.tsx +4 -4
  72. package/src/docs/mdx.tsx +99 -0
  73. package/src/docs/pages.ts +112 -0
  74. package/src/docs/searchIndex.ts +1 -0
  75. package/src/pages/Badge.mdx +1 -1
  76. package/src/pages/Button.mdx +4 -4
  77. package/src/pages/Link.mdx +3 -3
  78. package/src/pages/List.mdx +107 -21
  79. package/src/pages/ListHeader.mdx +12 -16
  80. package/src/pages/_app.tsx +117 -240
  81. package/src/pages/index.mdx +1 -1
@@ -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
  >
@@ -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={!props.bare}
20
+ withDivider={!bare}
19
21
  {...props}
20
22
  jsStyle={props.jsStyle}
21
23
  ref={ref}
@@ -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
  >
package/src/Sublist.tsx CHANGED
@@ -4,18 +4,19 @@ import { Icon } from "./Icon";
4
4
  import { Box } from "./Box";
5
5
  import { Row } from "./Row";
6
6
  import { JSStyle } from "./jss";
7
+ import { useListContext } from "./List";
7
8
 
8
9
  export function Sublist({
9
10
  children,
10
11
  label,
12
+ labelBold,
11
13
  initialState = { collapsed: false },
12
14
  jsStyle,
13
15
  secondaryAddOn,
14
- bare,
15
16
  }: {
16
- bare?: boolean;
17
17
  children: React.ReactNode;
18
18
  label: string;
19
+ labelBold?: boolean;
19
20
  initialState?: {
20
21
  collapsed: boolean;
21
22
  };
@@ -23,12 +24,11 @@ export function Sublist({
23
24
  secondaryAddOn?: ReactNode;
24
25
  }) {
25
26
  const [collapsed, setCollapsed] = React.useState(initialState.collapsed);
26
-
27
27
  return (
28
28
  <>
29
29
  <ListButtonItem
30
- bare={bare}
31
30
  headline={label}
31
+ headlineBold={labelBold}
32
32
  onClick={() => setCollapsed((x) => !x)}
33
33
  jsStyle={jsStyle}
34
34
  addOn={
@@ -0,0 +1,99 @@
1
+ import { MDXProvider } from "@mdx-js/react";
2
+ import React from "react";
3
+ import { PropsWithChildren } from "react";
4
+ import { H1, H2, H3, Li, P, Span } from "../Text";
5
+ import { BaseLink } from "../BaseLink";
6
+ import { BaseView } from "../BaseView";
7
+ import { ListDivider } from "../ListDivider";
8
+ import { cssVar } from "../jss";
9
+ import { Roboto } from "next/font/google";
10
+
11
+ const monospace = Roboto({ weight: "400", subsets: ["latin"] });
12
+
13
+ const components: any = {
14
+ h1: (props) => (
15
+ <H1 jsStyle={{ marginBottom: cssVar("--spacing-xl") }} {...props} />
16
+ ),
17
+ h2: (props) => (
18
+ <H2
19
+ id={labelToID(props.children)}
20
+ jsStyle={{ marginBottom: cssVar("--spacing-l") }}
21
+ {...props}
22
+ />
23
+ ),
24
+ h3: (props) => {
25
+ return <H3 id={labelToID(props.children)} {...props} />;
26
+ },
27
+ p: (props) => (
28
+ <P jsStyle={{ marginBottom: cssVar("--spacing-m") }} {...props} />
29
+ ),
30
+ span: (props) => <Span {...props} />,
31
+ li: (props) => (
32
+ <Li jsStyle={{ marginBottom: cssVar("--spacing-s") }} {...props} />
33
+ ),
34
+ a: (props) => {
35
+ return (
36
+ <BaseLink
37
+ bare
38
+ color="positive"
39
+ jsStyle={{
40
+ display: "inline-block",
41
+ paddingBottom: cssVar("--spacing-s"),
42
+ paddingTop: cssVar("--spacing-s"),
43
+ }}
44
+ href={props.href}
45
+ >
46
+ {props.children}
47
+ </BaseLink>
48
+ );
49
+ },
50
+ hr: () => (
51
+ <BaseView
52
+ jsStyle={{
53
+ marginBottom: cssVar("--spacing-xxl"),
54
+ marginTop: cssVar("--spacing-xxl"),
55
+ }}
56
+ >
57
+ <ListDivider />
58
+ </BaseView>
59
+ ),
60
+ pre: (props) => {
61
+ return (
62
+ <pre
63
+ style={{ borderRadius: cssVar("--border-radius-l") }}
64
+ className={props.children.props.className}
65
+ tabIndex={0}
66
+ >
67
+ <code className={props.children.props.className}>
68
+ {props.children.props.children}
69
+ </code>
70
+ </pre>
71
+ );
72
+ },
73
+ code: ({ children }) => (
74
+ <span
75
+ className={monospace.className}
76
+ style={{
77
+ color: cssVar("--primary-text"),
78
+ backgroundColor: cssVar("--secondary-background"),
79
+ borderRadius: cssVar("--border-radius-m"),
80
+ padding: cssVar("--spacing-xs"),
81
+ border: `1px solid ${cssVar("--divider")}`,
82
+ display: "inline-block",
83
+ }}
84
+ >
85
+ {children}
86
+ </span>
87
+ ),
88
+ };
89
+
90
+ export function labelToID(string: string): string {
91
+ return string
92
+ .replace(/[A-Z]/g, (m) => m.toLowerCase())
93
+ .replace(/\s/g, "-")
94
+ .replace(/\?/g, "");
95
+ }
96
+
97
+ export function DocsMDXProvider({ children }: PropsWithChildren<{}>) {
98
+ return <MDXProvider components={components}>{children}</MDXProvider>;
99
+ }
@@ -0,0 +1,112 @@
1
+ import { Size } from "../jss";
2
+
3
+ type PageLink = {
4
+ type: "link";
5
+ page: string;
6
+ name?: string;
7
+ headlineSize?: Size;
8
+ headlineBold?: boolean;
9
+ };
10
+
11
+ type Page =
12
+ | PageLink
13
+ | {
14
+ type: "section";
15
+ label: string;
16
+ content: Array<PageLink>;
17
+ };
18
+
19
+ export const pages: Array<Page> = [
20
+ {
21
+ type: "link",
22
+ page: "",
23
+ name: "Aidos UI",
24
+ headlineSize: "large",
25
+ headlineBold: true,
26
+ },
27
+ {
28
+ type: "section",
29
+ label: "CSS",
30
+ content: [{ type: "link", page: "css-in-js", name: "jss" }],
31
+ },
32
+ {
33
+ type: "section",
34
+ label: "Primary components",
35
+ content: [
36
+ { type: "link", page: "FlexLayout" },
37
+ { type: "link", page: "Text" },
38
+ { type: "link", page: "TextPairing" },
39
+ { type: "link", page: "Icon" },
40
+ ],
41
+ },
42
+ {
43
+ type: "section",
44
+ label: "Buttons and links",
45
+ content: [
46
+ { type: "link", page: "Button" },
47
+ { type: "link", page: "Link" },
48
+ { type: "link", page: "IconButton" },
49
+ ],
50
+ },
51
+ {
52
+ type: "section",
53
+ label: "Inputs",
54
+ content: [
55
+ { type: "link", page: "TextInput" },
56
+ { type: "link", page: "RangeInput" },
57
+ { type: "link", page: "TimeInput" },
58
+ { type: "link", page: "Checkbox" },
59
+ ],
60
+ },
61
+ {
62
+ type: "section",
63
+ label: "List components",
64
+ content: [
65
+ { type: "link", page: "List" },
66
+ { type: "link", page: "ListHeader" },
67
+ { type: "link", page: "navigation", name: "List navigation" },
68
+ ],
69
+ },
70
+ {
71
+ type: "section",
72
+ label: "Modals",
73
+ content: [
74
+ { type: "link", page: "Dialog" },
75
+ { type: "link", page: "Popover" },
76
+ { type: "link", page: "Tooltip" },
77
+ ],
78
+ },
79
+ {
80
+ type: "section",
81
+ label: "Visual indicators",
82
+ content: [
83
+ { type: "link", page: "Badge" },
84
+ { type: "link", page: "ProgressBar" },
85
+ { type: "link", page: "ProgressCircle" },
86
+ ],
87
+ },
88
+ {
89
+ type: "section",
90
+ label: "Complex components",
91
+ content: [
92
+ { type: "link", page: "Tabs" },
93
+ { type: "link", page: "Calendar" },
94
+ ],
95
+ },
96
+ {
97
+ type: "section",
98
+ label: "Hooks",
99
+ content: [
100
+ { type: "link", page: "useCookie" },
101
+ { type: "link", page: "useNavigation" },
102
+ { type: "link", page: "useKeyboard" },
103
+ { type: "link", page: "useRefEffect" },
104
+ { type: "link", page: "usePromise" },
105
+ ],
106
+ },
107
+ {
108
+ type: "section",
109
+ label: "Utils",
110
+ content: [{ type: "link", page: "Hashing" }],
111
+ },
112
+ ];