aidos-ui 4.0.4 → 4.0.6
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/LICENSE +1 -1
- package/README.md +23 -3
- package/dist/index.d.ts +801 -68
- package/dist/index.js +3934 -68
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +6 -2
- package/dist/jsx-dev-runtime.js +87 -42
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +2 -2
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/vite-plugin-jss-debug.d.ts +3 -1
- package/dist/vite-plugin-jss-debug.js +57 -74
- package/dist/vite-plugin-jss-debug.js.map +1 -1
- package/package.json +61 -27
- package/.prettierrc +0 -4
- package/CLAUDE.md +0 -72
- package/dist/Badge.d.ts +0 -6
- package/dist/Badge.js +0 -22
- package/dist/Badge.js.map +0 -1
- package/dist/BaseButton.d.ts +0 -14
- package/dist/BaseButton.js +0 -23
- package/dist/BaseButton.js.map +0 -1
- package/dist/BaseInput.d.ts +0 -14
- package/dist/BaseInput.js +0 -15
- package/dist/BaseInput.js.map +0 -1
- package/dist/BaseLink.d.ts +0 -18
- package/dist/BaseLink.js +0 -29
- package/dist/BaseLink.js.map +0 -1
- package/dist/BaseList.d.ts +0 -6
- package/dist/BaseList.js +0 -14
- package/dist/BaseList.js.map +0 -1
- package/dist/BaseListAddOn.d.ts +0 -5
- package/dist/BaseListAddOn.js +0 -7
- package/dist/BaseListAddOn.js.map +0 -1
- package/dist/BaseListItem.d.ts +0 -26
- package/dist/BaseListItem.js +0 -29
- package/dist/BaseListItem.js.map +0 -1
- package/dist/BaseView.d.ts +0 -12
- package/dist/BaseView.js +0 -26
- package/dist/BaseView.js.map +0 -1
- package/dist/Box.d.ts +0 -4
- package/dist/Box.js +0 -6
- package/dist/Box.js.map +0 -1
- package/dist/Button.d.ts +0 -20
- package/dist/Button.js +0 -19
- package/dist/Button.js.map +0 -1
- package/dist/Calendar.d.ts +0 -18
- package/dist/Calendar.js +0 -57
- package/dist/Calendar.js.map +0 -1
- package/dist/Card.d.ts +0 -4
- package/dist/Card.js +0 -14
- package/dist/Card.js.map +0 -1
- package/dist/Checkbox.d.ts +0 -11
- package/dist/Checkbox.js +0 -32
- package/dist/Checkbox.js.map +0 -1
- package/dist/Circle.d.ts +0 -5
- package/dist/Circle.js +0 -12
- package/dist/Circle.js.map +0 -1
- package/dist/Column.d.ts +0 -6
- package/dist/Column.js +0 -7
- package/dist/Column.js.map +0 -1
- package/dist/DarkMode.d.ts +0 -13
- package/dist/DarkMode.js +0 -62
- package/dist/DarkMode.js.map +0 -1
- package/dist/DateInput.d.ts +0 -13
- package/dist/DateInput.js +0 -29
- package/dist/DateInput.js.map +0 -1
- package/dist/DatePicker.d.ts +0 -11
- package/dist/DatePicker.js +0 -34
- package/dist/DatePicker.js.map +0 -1
- package/dist/DatetimeInput.d.ts +0 -13
- package/dist/DatetimeInput.js +0 -31
- package/dist/DatetimeInput.js.map +0 -1
- package/dist/DesignBook.d.ts +0 -1
- package/dist/DesignBook.js +0 -55
- package/dist/DesignBook.js.map +0 -1
- package/dist/Dialog.d.ts +0 -17
- package/dist/Dialog.js +0 -92
- package/dist/Dialog.js.map +0 -1
- package/dist/Dropdown.d.ts +0 -14
- package/dist/Dropdown.js +0 -65
- package/dist/Dropdown.js.map +0 -1
- package/dist/Emitter.d.ts +0 -6
- package/dist/Emitter.js +0 -19
- package/dist/Emitter.js.map +0 -1
- package/dist/FlexLayout.d.ts +0 -11
- package/dist/FlexLayout.js +0 -18
- package/dist/FlexLayout.js.map +0 -1
- package/dist/Icon.d.ts +0 -12
- package/dist/Icon.js +0 -60
- package/dist/Icon.js.map +0 -1
- package/dist/IconButton.d.ts +0 -11
- package/dist/IconButton.js +0 -34
- package/dist/IconButton.js.map +0 -1
- package/dist/IconLink.d.ts +0 -9
- package/dist/IconLink.js +0 -32
- package/dist/IconLink.js.map +0 -1
- package/dist/IconType.d.ts +0 -1
- package/dist/IconType.js +0 -2
- package/dist/IconType.js.map +0 -1
- package/dist/Interactable.d.ts +0 -50
- package/dist/Interactable.js +0 -169
- package/dist/Interactable.js.map +0 -1
- package/dist/JSSComment.d.ts +0 -10
- package/dist/JSSComment.js +0 -52
- package/dist/JSSComment.js.map +0 -1
- package/dist/Link.d.ts +0 -22
- package/dist/Link.js +0 -29
- package/dist/Link.js.map +0 -1
- package/dist/List.d.ts +0 -15
- package/dist/List.js +0 -29
- package/dist/List.js.map +0 -1
- package/dist/ListButtonItem.d.ts +0 -14
- package/dist/ListButtonItem.js +0 -11
- package/dist/ListButtonItem.js.map +0 -1
- package/dist/ListDivider.d.ts +0 -1
- package/dist/ListDivider.js +0 -12
- package/dist/ListDivider.js.map +0 -1
- package/dist/ListHeaderItem.d.ts +0 -10
- package/dist/ListHeaderItem.js +0 -15
- package/dist/ListHeaderItem.js.map +0 -1
- package/dist/ListItem.d.ts +0 -9
- package/dist/ListItem.js +0 -9
- package/dist/ListItem.js.map +0 -1
- package/dist/ListLinkItem.d.ts +0 -16
- package/dist/ListLinkItem.js +0 -11
- package/dist/ListLinkItem.js.map +0 -1
- package/dist/ListSpacer.d.ts +0 -1
- package/dist/ListSpacer.js +0 -13
- package/dist/ListSpacer.js.map +0 -1
- package/dist/MenuIcon.d.ts +0 -5
- package/dist/MenuIcon.js +0 -31
- package/dist/MenuIcon.js.map +0 -1
- package/dist/NextJSRouter.d.ts +0 -1
- package/dist/NextJSRouter.js +0 -37
- package/dist/NextJSRouter.js.map +0 -1
- package/dist/NextJSRouterState.d.ts +0 -38
- package/dist/NextJSRouterState.js +0 -111
- package/dist/NextJSRouterState.js.map +0 -1
- package/dist/OnVisible.d.ts +0 -5
- package/dist/OnVisible.js +0 -28
- package/dist/OnVisible.js.map +0 -1
- package/dist/Popover.d.ts +0 -22
- package/dist/Popover.js +0 -90
- package/dist/Popover.js.map +0 -1
- package/dist/ProgressBar.d.ts +0 -7
- package/dist/ProgressBar.js +0 -42
- package/dist/ProgressBar.js.map +0 -1
- package/dist/ProgressCircle.d.ts +0 -5
- package/dist/ProgressCircle.js +0 -12
- package/dist/ProgressCircle.js.map +0 -1
- package/dist/Providers.d.ts +0 -9
- package/dist/Providers.js +0 -16
- package/dist/Providers.js.map +0 -1
- package/dist/RangeInput.d.ts +0 -14
- package/dist/RangeInput.js +0 -32
- package/dist/RangeInput.js.map +0 -1
- package/dist/ResultOrError.d.ts +0 -13
- package/dist/ResultOrError.js +0 -7
- package/dist/ResultOrError.js.map +0 -1
- package/dist/RootView.d.ts +0 -5
- package/dist/RootView.js +0 -35
- package/dist/RootView.js.map +0 -1
- package/dist/Row.d.ts +0 -6
- package/dist/Row.js +0 -7
- package/dist/Row.js.map +0 -1
- package/dist/Select.d.ts +0 -9
- package/dist/Select.js +0 -17
- package/dist/Select.js.map +0 -1
- package/dist/StackContext.d.ts +0 -8
- package/dist/StackContext.js +0 -25
- package/dist/StackContext.js.map +0 -1
- package/dist/StaticCheckbox.d.ts +0 -16
- package/dist/StaticCheckbox.js +0 -48
- package/dist/StaticCheckbox.js.map +0 -1
- package/dist/Storage.d.ts +0 -13
- package/dist/Storage.js +0 -146
- package/dist/Storage.js.map +0 -1
- package/dist/Stream.d.ts +0 -9
- package/dist/Stream.js +0 -36
- package/dist/Stream.js.map +0 -1
- package/dist/Sublist.d.ts +0 -12
- package/dist/Sublist.js +0 -18
- package/dist/Sublist.js.map +0 -1
- package/dist/SubmitIconInput.d.ts +0 -8
- package/dist/SubmitIconInput.js +0 -25
- package/dist/SubmitIconInput.js.map +0 -1
- package/dist/Tabs.d.ts +0 -23
- package/dist/Tabs.js +0 -39
- package/dist/Tabs.js.map +0 -1
- package/dist/Text.d.ts +0 -25
- package/dist/Text.js +0 -52
- package/dist/Text.js.map +0 -1
- package/dist/TextArea.d.ts +0 -11
- package/dist/TextArea.js +0 -27
- package/dist/TextArea.js.map +0 -1
- package/dist/TextInput.d.ts +0 -15
- package/dist/TextInput.js +0 -61
- package/dist/TextInput.js.map +0 -1
- package/dist/TextInputWithState.d.ts +0 -8
- package/dist/TextInputWithState.js +0 -14
- package/dist/TextInputWithState.js.map +0 -1
- package/dist/TextPairing.d.ts +0 -21
- package/dist/TextPairing.js +0 -26
- package/dist/TextPairing.js.map +0 -1
- package/dist/TimeInput.d.ts +0 -15
- package/dist/TimeInput.js +0 -58
- package/dist/TimeInput.js.map +0 -1
- package/dist/Tooltip.d.ts +0 -11
- package/dist/Tooltip.js +0 -73
- package/dist/Tooltip.js.map +0 -1
- package/dist/aria.d.ts +0 -8
- package/dist/aria.js +0 -42
- package/dist/aria.js.map +0 -1
- package/dist/guid.d.ts +0 -1
- package/dist/guid.js +0 -7
- package/dist/guid.js.map +0 -1
- package/dist/hash.d.ts +0 -1
- package/dist/hash.js +0 -20
- package/dist/hash.js.map +0 -1
- package/dist/isServer.d.ts +0 -1
- package/dist/isServer.js +0 -4
- package/dist/isServer.js.map +0 -1
- package/dist/jss.d.ts +0 -122
- package/dist/jss.js +0 -515
- package/dist/jss.js.map +0 -1
- package/dist/numberToBase.d.ts +0 -1
- package/dist/numberToBase.js +0 -44
- package/dist/numberToBase.js.map +0 -1
- package/dist/stateMachineContextFactory.d.ts +0 -36
- package/dist/stateMachineContextFactory.js +0 -48
- package/dist/stateMachineContextFactory.js.map +0 -1
- package/dist/useCookie.d.ts +0 -9
- package/dist/useCookie.js +0 -67
- package/dist/useCookie.js.map +0 -1
- package/dist/useKeyboard.d.ts +0 -8
- package/dist/useKeyboard.js +0 -26
- package/dist/useKeyboard.js.map +0 -1
- package/dist/useNavigation.d.ts +0 -5
- package/dist/useNavigation.js +0 -79
- package/dist/useNavigation.js.map +0 -1
- package/dist/usePromise.d.ts +0 -1
- package/dist/usePromise.js +0 -12
- package/dist/usePromise.js.map +0 -1
- package/dist/useRefEffect.d.ts +0 -1
- package/dist/useRefEffect.js +0 -15
- package/dist/useRefEffect.js.map +0 -1
- package/jss-debug-loader.mjs +0 -44
- package/next-env.d.ts +0 -6
- package/next.config.js +0 -33
- package/scripts/embeddings.js +0 -93
- package/scripts/openai_embeddings.js +0 -100
- package/scripts/publish.js +0 -28
- package/scripts/test_embeddings.js +0 -47
- package/src/Badge.tsx +0 -36
- package/src/BaseButton.tsx +0 -62
- package/src/BaseInput.tsx +0 -63
- package/src/BaseLink.tsx +0 -80
- package/src/BaseList.tsx +0 -26
- package/src/BaseListAddOn.tsx +0 -10
- package/src/BaseListItem.tsx +0 -119
- package/src/BaseView.tsx +0 -57
- package/src/Box.tsx +0 -20
- package/src/Button.tsx +0 -90
- package/src/Calendar.tsx +0 -123
- package/src/Card.tsx +0 -30
- package/src/Checkbox.tsx +0 -63
- package/src/Circle.tsx +0 -24
- package/src/Column.tsx +0 -12
- package/src/DarkMode.tsx +0 -100
- package/src/DateInput.tsx +0 -63
- package/src/DatePicker.tsx +0 -67
- package/src/DatetimeInput.tsx +0 -64
- package/src/DesignBook.tsx +0 -677
- package/src/Dialog.tsx +0 -150
- package/src/Dropdown.tsx +0 -146
- package/src/Emitter.ts +0 -26
- package/src/FlexLayout.tsx +0 -53
- package/src/Icon.tsx +0 -80
- package/src/IconButton.tsx +0 -81
- package/src/IconLink.tsx +0 -59
- package/src/IconType.ts +0 -787
- package/src/Interactable.tsx +0 -210
- package/src/JSSComment.tsx +0 -56
- package/src/Link.tsx +0 -110
- package/src/List.tsx +0 -58
- package/src/ListButtonItem.tsx +0 -69
- package/src/ListDivider.tsx +0 -13
- package/src/ListHeaderItem.tsx +0 -45
- package/src/ListItem.tsx +0 -24
- package/src/ListLinkItem.tsx +0 -76
- package/src/ListSpacer.tsx +0 -14
- package/src/MenuIcon.tsx +0 -50
- package/src/NextJSRouter.tsx +0 -60
- package/src/NextJSRouterState.tsx +0 -154
- package/src/OnVisible.tsx +0 -42
- package/src/Popover.tsx +0 -145
- package/src/ProgressBar.tsx +0 -63
- package/src/ProgressCircle.tsx +0 -38
- package/src/Providers.tsx +0 -33
- package/src/RangeInput.tsx +0 -82
- package/src/ResultOrError.ts +0 -15
- package/src/RootView.tsx +0 -55
- package/src/Row.tsx +0 -12
- package/src/Select.tsx +0 -39
- package/src/StackContext.tsx +0 -52
- package/src/StaticCheckbox.tsx +0 -72
- package/src/Storage.tsx +0 -198
- package/src/Stream.tsx +0 -50
- package/src/Sublist.tsx +0 -61
- package/src/SubmitIconInput.tsx +0 -45
- package/src/Tabs.tsx +0 -110
- package/src/Text.tsx +0 -111
- package/src/TextArea.tsx +0 -58
- package/src/TextInput.tsx +0 -123
- package/src/TextInputWithState.tsx +0 -32
- package/src/TextPairing.tsx +0 -115
- package/src/TimeInput.tsx +0 -109
- package/src/Tooltip.tsx +0 -109
- package/src/aria.ts +0 -72
- package/src/docs/mdx.tsx +0 -137
- package/src/docs/pages.ts +0 -115
- package/src/docs/searchIndex.ts +0 -1
- package/src/examples/ExampleDialog.tsx +0 -28
- package/src/guid.ts +0 -7
- package/src/hash.ts +0 -21
- package/src/index.ts +0 -68
- package/src/isServer.ts +0 -3
- package/src/jss.tsx +0 -712
- package/src/jsx-dev-runtime.ts +0 -74
- package/src/jsx-runtime.ts +0 -2
- package/src/numberToBase.ts +0 -52
- package/src/pages/Badge.mdx +0 -152
- package/src/pages/Button.mdx +0 -163
- package/src/pages/Calendar.mdx +0 -254
- package/src/pages/Card.mdx +0 -147
- package/src/pages/Checkbox.mdx +0 -131
- package/src/pages/Dialog.mdx +0 -197
- package/src/pages/FlexLayout.mdx +0 -211
- package/src/pages/Hashing.mdx +0 -211
- package/src/pages/Icon.mdx +0 -171
- package/src/pages/IconButton.mdx +0 -155
- package/src/pages/Link.mdx +0 -160
- package/src/pages/List.mdx +0 -262
- package/src/pages/ListHeader.mdx +0 -220
- package/src/pages/Popover.mdx +0 -223
- package/src/pages/ProgressBar.mdx +0 -200
- package/src/pages/ProgressCircle.mdx +0 -218
- package/src/pages/RangeInput.mdx +0 -237
- package/src/pages/Tabs.mdx +0 -281
- package/src/pages/Text.mdx +0 -154
- package/src/pages/TextInput.mdx +0 -235
- package/src/pages/TextPairing.mdx +0 -204
- package/src/pages/TimeInput.mdx +0 -178
- package/src/pages/Tooltip.mdx +0 -115
- package/src/pages/_app.tsx +0 -466
- package/src/pages/_document.tsx +0 -30
- package/src/pages/css-in-js.mdx +0 -240
- package/src/pages/index.mdx +0 -58
- package/src/pages/navigation.mdx +0 -158
- package/src/pages/prism.css +0 -3
- package/src/pages/useCookie.mdx +0 -176
- package/src/pages/useKeyboard.mdx +0 -257
- package/src/pages/useNavigation.mdx +0 -258
- package/src/pages/usePromise.mdx +0 -280
- package/src/pages/useRefEffect.mdx +0 -251
- package/src/stateMachineContextFactory.tsx +0 -111
- package/src/useCookie.tsx +0 -95
- package/src/useKeyboard.tsx +0 -43
- package/src/useNavigation.tsx +0 -89
- package/src/usePromise.tsx +0 -18
- package/src/useRefEffect.tsx +0 -18
- package/src/vite-plugin-jss-debug.ts +0 -77
- package/tsconfig.build.json +0 -23
- package/tsconfig.json +0 -38
package/src/Checkbox.tsx
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { BaseInput, BaseInputProps } from "./BaseInput";
|
|
3
|
-
import {} from "./BaseView";
|
|
4
|
-
import { Size, toClassnames } from "./jss";
|
|
5
|
-
import { StaticCheckbox, sizes } from "./StaticCheckbox";
|
|
6
|
-
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
interface CheckboxProps extends BaseInputProps {
|
|
9
|
-
checked: boolean;
|
|
10
|
-
onClick: () => void;
|
|
11
|
-
size: Size;
|
|
12
|
-
value?: undefined;
|
|
13
|
-
onChange?: undefined;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function Checkbox({
|
|
17
|
-
checked,
|
|
18
|
-
onClick,
|
|
19
|
-
size,
|
|
20
|
-
...inputProps
|
|
21
|
-
}: CheckboxProps) {
|
|
22
|
-
return (
|
|
23
|
-
<label
|
|
24
|
-
className={toClassnames({
|
|
25
|
-
position: "relative",
|
|
26
|
-
display: "flex",
|
|
27
|
-
justifyContent: "center",
|
|
28
|
-
alignItems: "center",
|
|
29
|
-
height: sizes[size],
|
|
30
|
-
width: sizes[size],
|
|
31
|
-
":has(:focus-visible)": {
|
|
32
|
-
outline: "2px solid var(--outline)",
|
|
33
|
-
borderRadius: "50%",
|
|
34
|
-
},
|
|
35
|
-
":has(:active)": {
|
|
36
|
-
transform: "scale(0.92)",
|
|
37
|
-
},
|
|
38
|
-
})}
|
|
39
|
-
>
|
|
40
|
-
<StaticCheckbox checked={checked} size={size} />
|
|
41
|
-
<BaseInput
|
|
42
|
-
{...inputProps}
|
|
43
|
-
type="checkbox"
|
|
44
|
-
role="checkbox"
|
|
45
|
-
aria-checked={`${checked}`}
|
|
46
|
-
tabIndex={0}
|
|
47
|
-
checked={checked}
|
|
48
|
-
onChange={onClick}
|
|
49
|
-
jss={{
|
|
50
|
-
position: "absolute",
|
|
51
|
-
opacity: 0,
|
|
52
|
-
cursor: "pointer",
|
|
53
|
-
top: 0,
|
|
54
|
-
bottom: 0,
|
|
55
|
-
left: 0,
|
|
56
|
-
right: 0,
|
|
57
|
-
width: "100%",
|
|
58
|
-
height: "100%",
|
|
59
|
-
}}
|
|
60
|
-
/>
|
|
61
|
-
</label>
|
|
62
|
-
);
|
|
63
|
-
}
|
package/src/Circle.tsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Box, BoxProps } from "./Box";
|
|
3
|
-
|
|
4
|
-
interface CircleProps extends BoxProps {}
|
|
5
|
-
|
|
6
|
-
export function Circle({
|
|
7
|
-
jss,
|
|
8
|
-
padding = "medium",
|
|
9
|
-
...otherProps
|
|
10
|
-
}: CircleProps) {
|
|
11
|
-
return (
|
|
12
|
-
<Box
|
|
13
|
-
padding={padding}
|
|
14
|
-
jss={[
|
|
15
|
-
{
|
|
16
|
-
borderRadius: "50%",
|
|
17
|
-
overflow: "hidden",
|
|
18
|
-
},
|
|
19
|
-
jss,
|
|
20
|
-
]}
|
|
21
|
-
{...otherProps}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
}
|
package/src/Column.tsx
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { FlexLayout, FlexLayoutProps } from "./FlexLayout";
|
|
3
|
-
|
|
4
|
-
export interface ColumnProps extends FlexLayoutProps {
|
|
5
|
-
direction?: "column";
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const Column = React.forwardRef(
|
|
9
|
-
(props: ColumnProps, ref?: React.Ref<HTMLDivElement>) => {
|
|
10
|
-
return <FlexLayout ref={ref} direction="column" {...props} />;
|
|
11
|
-
}
|
|
12
|
-
);
|
package/src/DarkMode.tsx
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, useContext, useEffect, useState } from "react";
|
|
2
|
-
import { IconButton } from "./IconButton";
|
|
3
|
-
import { BaseView } from "./BaseView";
|
|
4
|
-
import { isServer } from "./isServer";
|
|
5
|
-
|
|
6
|
-
type State = {
|
|
7
|
-
enabled: boolean;
|
|
8
|
-
toggle: () => void;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const DarkModeContext = React.createContext<State>({
|
|
12
|
-
enabled: false,
|
|
13
|
-
toggle: () => {},
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
if (!isServer()) {
|
|
17
|
-
const darkMode = document.cookie
|
|
18
|
-
.split(";")
|
|
19
|
-
.map((c) => c.trim())
|
|
20
|
-
.filter((c) => c.startsWith("dark-mode="))
|
|
21
|
-
.map((s) => s.split("=")[1])
|
|
22
|
-
.map((s) => s)
|
|
23
|
-
.pop();
|
|
24
|
-
|
|
25
|
-
if (darkMode === "true") {
|
|
26
|
-
document.body.classList.add("dark-mode");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function DarkModeProvider({
|
|
31
|
-
children,
|
|
32
|
-
enabled,
|
|
33
|
-
toggle,
|
|
34
|
-
}: {
|
|
35
|
-
children: ReactNode;
|
|
36
|
-
enabled: boolean;
|
|
37
|
-
toggle: () => void;
|
|
38
|
-
}) {
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
const statusBarMeta = document.head.querySelector(
|
|
41
|
-
'meta[name="apple-mobile-web-app-status-bar-style"]'
|
|
42
|
-
);
|
|
43
|
-
const themeColorMeta = document.head.querySelector(
|
|
44
|
-
'meta[name="theme-color"]'
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
if (enabled) {
|
|
48
|
-
document.body.classList.add("dark-mode");
|
|
49
|
-
if (statusBarMeta != null) {
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
statusBarMeta.content = "black-translucent";
|
|
52
|
-
}
|
|
53
|
-
if (themeColorMeta != null) {
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
themeColorMeta.content = "rgb(42, 43, 46)";
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
document.body.classList.remove("dark-mode");
|
|
59
|
-
if (statusBarMeta != null) {
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
statusBarMeta.content = "default";
|
|
62
|
-
}
|
|
63
|
-
if (themeColorMeta != null) {
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
themeColorMeta.content = "rgb(239, 239, 244)";
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, [enabled]);
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<DarkModeContext.Provider value={{ enabled, toggle }}>
|
|
72
|
-
{children}
|
|
73
|
-
</DarkModeContext.Provider>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function DarkModeToggle() {
|
|
78
|
-
const darkMode = useContext(DarkModeContext);
|
|
79
|
-
|
|
80
|
-
const [show, setShow] = useState(false);
|
|
81
|
-
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
setShow(true);
|
|
84
|
-
}, []);
|
|
85
|
-
|
|
86
|
-
if (!show) {
|
|
87
|
-
return <BaseView jss={{ width: 32, height: 32 }} />;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<IconButton
|
|
92
|
-
aria-label="Toggle dark mode"
|
|
93
|
-
icon={darkMode.enabled ? "fa-sun-o" : "fa-moon-o"}
|
|
94
|
-
size="medium"
|
|
95
|
-
onClick={darkMode.toggle}
|
|
96
|
-
color="primary"
|
|
97
|
-
bare
|
|
98
|
-
/>
|
|
99
|
-
);
|
|
100
|
-
}
|
package/src/DateInput.tsx
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
|
-
import { BaseInput, BaseInputProps } from "./BaseInput";
|
|
3
|
-
import { Box } from "./Box";
|
|
4
|
-
import { Icon } from "./Icon";
|
|
5
|
-
import { IconType } from "./IconType";
|
|
6
|
-
import { Row } from "./Row";
|
|
7
|
-
import { JSS } from "./jss";
|
|
8
|
-
|
|
9
|
-
export interface DateInputProps extends BaseInputProps {
|
|
10
|
-
onDateChange: (date: Date) => void;
|
|
11
|
-
date: Date;
|
|
12
|
-
icon?: IconType;
|
|
13
|
-
addOn?: ReactNode;
|
|
14
|
-
onChange?: undefined;
|
|
15
|
-
jss?: JSS;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const DateInput = React.forwardRef(
|
|
19
|
-
(
|
|
20
|
-
{ date, onDateChange, jss, icon, addOn, ...inputProps }: DateInputProps,
|
|
21
|
-
ref?: React.Ref<HTMLInputElement>
|
|
22
|
-
) => {
|
|
23
|
-
return (
|
|
24
|
-
<Row
|
|
25
|
-
jss={{
|
|
26
|
-
backgroundColor: "inherit",
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
{icon && (
|
|
30
|
-
<Box padding="medium">
|
|
31
|
-
<Icon size="medium" color="secondary" icon={icon} />
|
|
32
|
-
</Box>
|
|
33
|
-
)}
|
|
34
|
-
<BaseInput
|
|
35
|
-
{...inputProps}
|
|
36
|
-
type="date"
|
|
37
|
-
ref={ref}
|
|
38
|
-
value={date.toISOString().substring(0, 10)}
|
|
39
|
-
onChange={(e) => onDateChange(new Date(e.target.value))}
|
|
40
|
-
jss={[
|
|
41
|
-
{
|
|
42
|
-
flexGrow: 1,
|
|
43
|
-
backgroundColor: "inherit",
|
|
44
|
-
color: "var(--primary-text)",
|
|
45
|
-
outline: "none",
|
|
46
|
-
border: "none",
|
|
47
|
-
fontSize: 20,
|
|
48
|
-
lineHeight: 24 / 20,
|
|
49
|
-
"::placeholder": {
|
|
50
|
-
color: "var(--subtle-text);",
|
|
51
|
-
},
|
|
52
|
-
":disabled": {
|
|
53
|
-
color: "var(--subtle-text);",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
jss,
|
|
57
|
-
]}
|
|
58
|
-
/>
|
|
59
|
-
{addOn}
|
|
60
|
-
</Row>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
);
|
package/src/DatePicker.tsx
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from "react";
|
|
2
|
-
import { Text } from "./Text";
|
|
3
|
-
import { TextColor, toClassnames } from "./jss";
|
|
4
|
-
|
|
5
|
-
const styles = {
|
|
6
|
-
dateInput: {
|
|
7
|
-
border: "1px solid var(--divider)",
|
|
8
|
-
backgroundColor: "var(--primary-background)",
|
|
9
|
-
padding: "var(--spacing-m)",
|
|
10
|
-
color: "var(--primary-text)",
|
|
11
|
-
fontSize: 20,
|
|
12
|
-
lineHeight: 24 / 20,
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export interface DatePickerProps {
|
|
17
|
-
id: string;
|
|
18
|
-
label: string;
|
|
19
|
-
date: Date;
|
|
20
|
-
color?: TextColor;
|
|
21
|
-
min?: string;
|
|
22
|
-
max?: string;
|
|
23
|
-
onDateChange: (date: Date) => void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function DatePicker({
|
|
27
|
-
id,
|
|
28
|
-
label,
|
|
29
|
-
color = "primary",
|
|
30
|
-
date,
|
|
31
|
-
onDateChange,
|
|
32
|
-
}: DatePickerProps) {
|
|
33
|
-
const initialDate = useRef(date);
|
|
34
|
-
const year = initialDate.current.getFullYear();
|
|
35
|
-
const month = initialDate.current.getMonth();
|
|
36
|
-
const day = initialDate.current.getDate();
|
|
37
|
-
const min = new Date(year - 1, month, day).toISOString().substring(0, 10);
|
|
38
|
-
const max = new Date(year + 1, month, day).toISOString().substring(0, 10);
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<>
|
|
42
|
-
<label htmlFor={id}>
|
|
43
|
-
<Text size="small" color={color}>
|
|
44
|
-
{label}
|
|
45
|
-
</Text>
|
|
46
|
-
</label>
|
|
47
|
-
<input
|
|
48
|
-
min={min}
|
|
49
|
-
max={max}
|
|
50
|
-
className={toClassnames(styles.dateInput)}
|
|
51
|
-
type="date"
|
|
52
|
-
id={id}
|
|
53
|
-
value={date.toISOString().substring(0, 10)}
|
|
54
|
-
onChange={(event) => {
|
|
55
|
-
let parsedDate;
|
|
56
|
-
try {
|
|
57
|
-
parsedDate = new Date(event.target.value);
|
|
58
|
-
} finally {
|
|
59
|
-
if (parsedDate != null) {
|
|
60
|
-
onDateChange(parsedDate);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}}
|
|
64
|
-
></input>
|
|
65
|
-
</>
|
|
66
|
-
);
|
|
67
|
-
}
|
package/src/DatetimeInput.tsx
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
|
-
import { BaseInput, BaseInputProps } from "./BaseInput";
|
|
3
|
-
import { Box } from "./Box";
|
|
4
|
-
import { Icon } from "./Icon";
|
|
5
|
-
import { IconType } from "./IconType";
|
|
6
|
-
import { Row } from "./Row";
|
|
7
|
-
import { JSS } from "./jss";
|
|
8
|
-
|
|
9
|
-
export interface DatetimeInputProps extends BaseInputProps {
|
|
10
|
-
onDateChange: (date: Date) => void;
|
|
11
|
-
date: Date;
|
|
12
|
-
icon?: IconType;
|
|
13
|
-
addOn?: ReactNode;
|
|
14
|
-
onChange?: undefined;
|
|
15
|
-
jss?: JSS;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const styles = {
|
|
19
|
-
root: {
|
|
20
|
-
backgroundColor: "var(--primary-background)",
|
|
21
|
-
},
|
|
22
|
-
input: {
|
|
23
|
-
padding: "var(--spacing-m)",
|
|
24
|
-
flexGrow: 1,
|
|
25
|
-
backgroundColor: "var(--primary-background)",
|
|
26
|
-
color: "var(--primary-text)",
|
|
27
|
-
outline: "none",
|
|
28
|
-
border: "none",
|
|
29
|
-
fontSize: 20,
|
|
30
|
-
lineHeight: 24 / 20,
|
|
31
|
-
"::placeholder": {
|
|
32
|
-
color: "var(--subtle-text);",
|
|
33
|
-
},
|
|
34
|
-
":disabled": {
|
|
35
|
-
color: "var(--subtle-text);",
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const DatetimeInput = React.forwardRef(
|
|
41
|
-
(
|
|
42
|
-
{ date, onDateChange, jss, icon, addOn, ...inputProps }: DatetimeInputProps,
|
|
43
|
-
ref?: React.Ref<HTMLInputElement>
|
|
44
|
-
) => {
|
|
45
|
-
return (
|
|
46
|
-
<Row jss={styles.root}>
|
|
47
|
-
{icon && (
|
|
48
|
-
<Box padding="medium">
|
|
49
|
-
<Icon size="medium" color="secondary" icon={icon} />
|
|
50
|
-
</Box>
|
|
51
|
-
)}
|
|
52
|
-
<BaseInput
|
|
53
|
-
{...inputProps}
|
|
54
|
-
type="datetime-local"
|
|
55
|
-
ref={ref}
|
|
56
|
-
value={date.toISOString().substring(0, 16)}
|
|
57
|
-
onChange={(e) => onDateChange(new Date(e.target.value))}
|
|
58
|
-
jss={[styles.input, jss]}
|
|
59
|
-
/>
|
|
60
|
-
{addOn}
|
|
61
|
-
</Row>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
);
|