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/jsx-dev-runtime.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// Custom JSX dev runtime that injects <!-- ComponentName --> comments
|
|
2
|
-
// into the DOM at component boundaries.
|
|
3
|
-
//
|
|
4
|
-
// Usage: in tsconfig.json, set "jsxImportSource": "aidos-ui/src"
|
|
5
|
-
// (or wherever this file is importable from)
|
|
6
|
-
|
|
7
|
-
export { Fragment } from "react/jsx-dev-runtime";
|
|
8
|
-
import { jsxDEV as _jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
9
|
-
import { JSSComment } from "./JSSComment";
|
|
10
|
-
|
|
11
|
-
const wrapCache = new WeakMap<Function, Function>();
|
|
12
|
-
|
|
13
|
-
function getWrapped(type: Function): Function {
|
|
14
|
-
let wrapped = wrapCache.get(type);
|
|
15
|
-
if (wrapped) return wrapped;
|
|
16
|
-
|
|
17
|
-
const name = (type as any).displayName || type.name;
|
|
18
|
-
|
|
19
|
-
wrapped = function JSSBoundary(props: any) {
|
|
20
|
-
return _jsxDEV(
|
|
21
|
-
Fragment,
|
|
22
|
-
{
|
|
23
|
-
children: [
|
|
24
|
-
_jsxDEV(JSSComment, { name }, undefined, false, undefined, undefined),
|
|
25
|
-
_jsxDEV(type as any, props, undefined, false, undefined, undefined),
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
undefined,
|
|
29
|
-
true,
|
|
30
|
-
undefined,
|
|
31
|
-
undefined
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
(wrapped as any).displayName = name;
|
|
36
|
-
wrapCache.set(type, wrapped);
|
|
37
|
-
|
|
38
|
-
return wrapped;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Skip our own wrapper components by name
|
|
42
|
-
const SKIP_NAMES = new Set(["JSSComment", "JSSBoundary"]);
|
|
43
|
-
|
|
44
|
-
function isUserComponent(type: any, source: any): boolean {
|
|
45
|
-
if (typeof type !== "function") return false;
|
|
46
|
-
const name = type.displayName || type.name;
|
|
47
|
-
if (!name || !/^[A-Z]/.test(name)) return false;
|
|
48
|
-
if (SKIP_NAMES.has(name)) return false;
|
|
49
|
-
// Use the source fileName from the JSX transform to skip node_modules
|
|
50
|
-
if (source?.fileName?.includes("node_modules")) return false;
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function jsxDEV(
|
|
55
|
-
type: any,
|
|
56
|
-
props: any,
|
|
57
|
-
key: any,
|
|
58
|
-
isStaticChildren: boolean,
|
|
59
|
-
source: any,
|
|
60
|
-
self: any
|
|
61
|
-
) {
|
|
62
|
-
if (isUserComponent(type, source)) {
|
|
63
|
-
return _jsxDEV(
|
|
64
|
-
getWrapped(type) as any,
|
|
65
|
-
props,
|
|
66
|
-
key,
|
|
67
|
-
isStaticChildren,
|
|
68
|
-
source,
|
|
69
|
-
self
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return _jsxDEV(type, props, key, isStaticChildren, source, self);
|
|
74
|
-
}
|
package/src/jsx-runtime.ts
DELETED
package/src/numberToBase.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const LETTERS_26 = [
|
|
2
|
-
"a",
|
|
3
|
-
"b",
|
|
4
|
-
"c",
|
|
5
|
-
"d",
|
|
6
|
-
"e",
|
|
7
|
-
"f",
|
|
8
|
-
"g",
|
|
9
|
-
"h",
|
|
10
|
-
"i",
|
|
11
|
-
"j",
|
|
12
|
-
"k",
|
|
13
|
-
"l",
|
|
14
|
-
"m",
|
|
15
|
-
"n",
|
|
16
|
-
"o",
|
|
17
|
-
"p",
|
|
18
|
-
"q",
|
|
19
|
-
"r",
|
|
20
|
-
"s",
|
|
21
|
-
"t",
|
|
22
|
-
"u",
|
|
23
|
-
"v",
|
|
24
|
-
"w",
|
|
25
|
-
"x",
|
|
26
|
-
"y",
|
|
27
|
-
"z",
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
export function numberToBase(
|
|
31
|
-
number: number,
|
|
32
|
-
base: Array<string> = LETTERS_26
|
|
33
|
-
): string {
|
|
34
|
-
if (number <= -1) {
|
|
35
|
-
return "";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
let result = [];
|
|
39
|
-
|
|
40
|
-
// To make numbers 1 indexed
|
|
41
|
-
number += 1;
|
|
42
|
-
|
|
43
|
-
while (number >= base.length) {
|
|
44
|
-
const index = number % base.length;
|
|
45
|
-
number = Math.floor(number / base.length) - 1;
|
|
46
|
-
result.push(base[index]);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
result.push(base[number]);
|
|
50
|
-
|
|
51
|
-
return result.reverse().join("");
|
|
52
|
-
}
|
package/src/pages/Badge.mdx
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { Badge } from "../Badge";
|
|
2
|
-
import { Row } from "../Row";
|
|
3
|
-
import { Column } from "../Column";
|
|
4
|
-
import { Span } from "../Text";
|
|
5
|
-
import { IconButton } from "../IconButton";
|
|
6
|
-
|
|
7
|
-
# Badge
|
|
8
|
-
|
|
9
|
-
A small circular indicator used to draw attention to specific UI elements. Common uses include notification counts, status indicators, and visual markers.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Props
|
|
14
|
-
|
|
15
|
-
| Prop | Type | Default | Description |
|
|
16
|
-
|------|------|---------|-------------|
|
|
17
|
-
| `size` | `Size` | `"medium"` | Badge size: `"xsmall"` (4px), `"small"` (6px), `"medium"` (12px), `"large"` (18px), `"xlarge"` (24px) |
|
|
18
|
-
| `color` | `Color` | `"highlight"` | Background color from theme |
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Sizes
|
|
23
|
-
|
|
24
|
-
<Row gap="large" align="center" justify="center" padding="medium">
|
|
25
|
-
<Column align="center" gap="small">
|
|
26
|
-
<Badge size="xsmall" />
|
|
27
|
-
<Span size="small" color="secondary">xsmall</Span>
|
|
28
|
-
</Column>
|
|
29
|
-
<Column align="center" gap="small">
|
|
30
|
-
<Badge size="small" />
|
|
31
|
-
<Span size="small" color="secondary">small</Span>
|
|
32
|
-
</Column>
|
|
33
|
-
<Column align="center" gap="small">
|
|
34
|
-
<Badge size="medium" />
|
|
35
|
-
<Span size="small" color="secondary">medium</Span>
|
|
36
|
-
</Column>
|
|
37
|
-
<Column align="center" gap="small">
|
|
38
|
-
<Badge size="large" />
|
|
39
|
-
<Span size="small" color="secondary">large</Span>
|
|
40
|
-
</Column>
|
|
41
|
-
<Column align="center" gap="small">
|
|
42
|
-
<Badge size="xlarge" />
|
|
43
|
-
<Span size="small" color="secondary">xlarge</Span>
|
|
44
|
-
</Column>
|
|
45
|
-
</Row>
|
|
46
|
-
|
|
47
|
-
```js
|
|
48
|
-
<Badge size="xsmall" /> // 4px
|
|
49
|
-
<Badge size="small" /> // 6px
|
|
50
|
-
<Badge size="medium" /> // 12px (default)
|
|
51
|
-
<Badge size="large" /> // 18px
|
|
52
|
-
<Badge size="xlarge" /> // 24px
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Colors
|
|
58
|
-
|
|
59
|
-
<Row gap="large" align="center" justify="center" padding="medium">
|
|
60
|
-
<Column align="center" gap="small">
|
|
61
|
-
<Badge color="highlight" />
|
|
62
|
-
<Span size="small" color="secondary">highlight</Span>
|
|
63
|
-
</Column>
|
|
64
|
-
<Column align="center" gap="small">
|
|
65
|
-
<Badge color="negative" />
|
|
66
|
-
<Span size="small" color="secondary">negative</Span>
|
|
67
|
-
</Column>
|
|
68
|
-
<Column align="center" gap="small">
|
|
69
|
-
<Badge color="warning" />
|
|
70
|
-
<Span size="small" color="secondary">warning</Span>
|
|
71
|
-
</Column>
|
|
72
|
-
<Column align="center" gap="small">
|
|
73
|
-
<Badge color="divider" />
|
|
74
|
-
<Span size="small" color="secondary">divider</Span>
|
|
75
|
-
</Column>
|
|
76
|
-
</Row>
|
|
77
|
-
|
|
78
|
-
```js
|
|
79
|
-
<Badge color="highlight" /> // Accent/brand color
|
|
80
|
-
<Badge color="negative" /> // Error/alert
|
|
81
|
-
<Badge color="warning" /> // Warning
|
|
82
|
-
<Badge color="divider" /> // Neutral/muted
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Common use cases
|
|
88
|
-
|
|
89
|
-
### Notification indicator
|
|
90
|
-
|
|
91
|
-
<Row gap="medium" align="center" padding="medium">
|
|
92
|
-
<Row jss={{ position: "relative" }}>
|
|
93
|
-
<IconButton bare icon="fa-bell" size="large" color="secondary" onClick={() => {}} />
|
|
94
|
-
<Badge size="small" color="negative" jss={{ position: "absolute", top: 0, right: 0 }} />
|
|
95
|
-
</Row>
|
|
96
|
-
<Span color="secondary">Unread notifications</Span>
|
|
97
|
-
</Row>
|
|
98
|
-
|
|
99
|
-
```js
|
|
100
|
-
<Row jss={{ position: "relative" }}>
|
|
101
|
-
<IconButton bare icon="fa-bell" size="large" color="secondary" onClick={() => {}} />
|
|
102
|
-
<Badge
|
|
103
|
-
size="small"
|
|
104
|
-
color="negative"
|
|
105
|
-
jss={{ position: "absolute", top: 0, right: 0 }}
|
|
106
|
-
/>
|
|
107
|
-
</Row>
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Status indicator
|
|
111
|
-
|
|
112
|
-
<Column gap="small" padding="medium">
|
|
113
|
-
<Row gap="small" align="center">
|
|
114
|
-
<Badge size="small" color="highlight" />
|
|
115
|
-
<Span>Online</Span>
|
|
116
|
-
</Row>
|
|
117
|
-
<Row gap="small" align="center">
|
|
118
|
-
<Badge size="small" color="warning" />
|
|
119
|
-
<Span>Away</Span>
|
|
120
|
-
</Row>
|
|
121
|
-
<Row gap="small" align="center">
|
|
122
|
-
<Badge size="small" color="divider" />
|
|
123
|
-
<Span>Offline</Span>
|
|
124
|
-
</Row>
|
|
125
|
-
</Column>
|
|
126
|
-
|
|
127
|
-
```js
|
|
128
|
-
<Row gap="small" align="center">
|
|
129
|
-
<Badge size="small" color="highlight" />
|
|
130
|
-
<Span>Online</Span>
|
|
131
|
-
</Row>
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
## Visual markers
|
|
137
|
-
|
|
138
|
-
Use badges to highlight new or important items:
|
|
139
|
-
|
|
140
|
-
<Row gap="medium" align="center" padding="medium">
|
|
141
|
-
<Row gap="small" align="center">
|
|
142
|
-
<Span>New feature</Span>
|
|
143
|
-
<Badge size="xsmall" color="highlight" />
|
|
144
|
-
</Row>
|
|
145
|
-
</Row>
|
|
146
|
-
|
|
147
|
-
```js
|
|
148
|
-
<Row gap="small" align="center">
|
|
149
|
-
<Span>New feature</Span>
|
|
150
|
-
<Badge size="xsmall" color="highlight" />
|
|
151
|
-
</Row>
|
|
152
|
-
```
|
package/src/pages/Button.mdx
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { Button } from "../Button";
|
|
2
|
-
import { Row } from "../Row";
|
|
3
|
-
import { Column } from "../Column";
|
|
4
|
-
import { Icon } from "../Icon";
|
|
5
|
-
|
|
6
|
-
# Button
|
|
7
|
-
|
|
8
|
-
The `Button` component enables users to trigger actions with a single click. It supports multiple color variants for different semantic purposes and can include icons.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## Props
|
|
13
|
-
|
|
14
|
-
| Prop | Type | Required | Default | Description |
|
|
15
|
-
|------|------|----------|---------|-------------|
|
|
16
|
-
| `children` | `string` | Yes | - | Button text label |
|
|
17
|
-
| `color` | `InteractableColor` | Yes | - | `"positive"`, `"primary"`, `"negative"`, `"dark"`, `"light"` |
|
|
18
|
-
| `onClick` | `function` | Yes | - | Click handler |
|
|
19
|
-
| `bare` | `boolean` | No | `false` | Removes background for a lighter appearance |
|
|
20
|
-
| `border` | `boolean` | No | `false` | Adds a border matching the text color |
|
|
21
|
-
| `disabled` | `boolean` | No | `false` | Disables interaction |
|
|
22
|
-
| `icon` | `IconType` | No | - | Icon to display alongside text |
|
|
23
|
-
| `iconPosition` | `"left"` \| `"right"` | No | `"left"` | Icon placement relative to text |
|
|
24
|
-
| `iconSize` | `Size` | No | `"medium"` | Icon size |
|
|
25
|
-
| `size` | `Size` | No | `"medium"` | Text size |
|
|
26
|
-
| `padding` | `Padding` | No | `"medium"` | Internal padding |
|
|
27
|
-
| `bold` | `boolean` | No | `false` | Bold text |
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## Color variants
|
|
32
|
-
|
|
33
|
-
Each color variant communicates a different intent to users:
|
|
34
|
-
|
|
35
|
-
- **Positive**: Confirmations, submissions, primary actions
|
|
36
|
-
- **Primary**: Secondary or neutral actions
|
|
37
|
-
- **Negative**: Destructive actions like delete or remove
|
|
38
|
-
- **Dark/Light**: Theme-specific variants for special contexts
|
|
39
|
-
|
|
40
|
-
<Row gap="large" align="center" padding="large" justify="center">
|
|
41
|
-
<Button color="positive" onClick={() => {}}>Positive</Button>
|
|
42
|
-
<Button color="primary" onClick={() => {}}>Primary</Button>
|
|
43
|
-
<Button color="negative" onClick={() => {}}>Negative</Button>
|
|
44
|
-
<Button color="dark" onClick={() => {}}>Dark</Button>
|
|
45
|
-
<Button color="light" onClick={() => {}}>Light</Button>
|
|
46
|
-
</Row>
|
|
47
|
-
|
|
48
|
-
```js
|
|
49
|
-
<Button color="positive" onClick={() => {}}>Positive</Button>
|
|
50
|
-
<Button color="primary" onClick={() => {}}>Primary</Button>
|
|
51
|
-
<Button color="negative" onClick={() => {}}>Negative</Button>
|
|
52
|
-
<Button color="dark" onClick={() => {}}>Dark</Button>
|
|
53
|
-
<Button color="light" onClick={() => {}}>Light</Button>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Bare variant
|
|
59
|
-
|
|
60
|
-
The `bare` prop removes the background color, creating a lighter appearance that integrates well within complex layouts or when you need a less prominent action.
|
|
61
|
-
|
|
62
|
-
<Row gap="large" align="center" padding="large" justify="center">
|
|
63
|
-
<Button bare color="positive" onClick={() => {}}>Positive</Button>
|
|
64
|
-
<Button bare color="primary" onClick={() => {}}>Primary</Button>
|
|
65
|
-
<Button bare color="negative" onClick={() => {}}>Negative</Button>
|
|
66
|
-
<Button bare color="dark" onClick={() => {}}>Dark</Button>
|
|
67
|
-
<Button bare color="light" onClick={() => {}}>Light</Button>
|
|
68
|
-
</Row>
|
|
69
|
-
|
|
70
|
-
```js
|
|
71
|
-
<Button bare color="positive" onClick={() => {}}>Positive</Button>
|
|
72
|
-
<Button bare color="primary" onClick={() => {}}>Primary</Button>
|
|
73
|
-
<Button bare color="negative" onClick={() => {}}>Negative</Button>
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## With border
|
|
79
|
-
|
|
80
|
-
Add a `border` prop to give buttons a defined edge. Works well with `bare` for outlined button styles.
|
|
81
|
-
|
|
82
|
-
<Row gap="large" align="center" padding="large" justify="center">
|
|
83
|
-
<Button border bare color="positive" onClick={() => {}}>Positive</Button>
|
|
84
|
-
<Button border bare color="primary" onClick={() => {}}>Primary</Button>
|
|
85
|
-
<Button border bare color="negative" onClick={() => {}}>Negative</Button>
|
|
86
|
-
</Row>
|
|
87
|
-
|
|
88
|
-
```js
|
|
89
|
-
<Button border bare color="positive" onClick={() => {}}>Outlined</Button>
|
|
90
|
-
<Button border bare color="primary" onClick={() => {}}>Outlined</Button>
|
|
91
|
-
<Button border bare color="negative" onClick={() => {}}>Outlined</Button>
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## With icon
|
|
97
|
-
|
|
98
|
-
Buttons can include icons to reinforce their purpose. Use `icon` to specify the icon and `iconPosition` to place it on the left or right.
|
|
99
|
-
|
|
100
|
-
<Row gap="large" align="center" padding="large" justify="center">
|
|
101
|
-
<Button color="positive" icon="fa-check" onClick={() => {}}>Confirm</Button>
|
|
102
|
-
<Button color="negative" icon="fa-trash" onClick={() => {}}>Delete</Button>
|
|
103
|
-
<Button color="primary" icon="fa-arrow-right" iconPosition="right" onClick={() => {}}>Next</Button>
|
|
104
|
-
</Row>
|
|
105
|
-
|
|
106
|
-
```js
|
|
107
|
-
<Button color="positive" icon="fa-check" onClick={() => {}}>
|
|
108
|
-
Confirm
|
|
109
|
-
</Button>
|
|
110
|
-
|
|
111
|
-
<Button color="negative" icon="fa-trash" onClick={() => {}}>
|
|
112
|
-
Delete
|
|
113
|
-
</Button>
|
|
114
|
-
|
|
115
|
-
<Button color="primary" icon="fa-arrow-right" iconPosition="right" onClick={() => {}}>
|
|
116
|
-
Next
|
|
117
|
-
</Button>
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## Disabled state
|
|
123
|
-
|
|
124
|
-
Disabled buttons prevent interaction and display a muted appearance. The component uses `aria-disabled` for accessibility.
|
|
125
|
-
|
|
126
|
-
<Row gap="large" align="center" padding="large" justify="center">
|
|
127
|
-
<Button color="positive" disabled onClick={() => {}}>Disabled</Button>
|
|
128
|
-
<Button bare color="positive" disabled onClick={() => {}}>Disabled bare</Button>
|
|
129
|
-
<Button border bare color="positive" disabled onClick={() => {}}>Disabled outlined</Button>
|
|
130
|
-
</Row>
|
|
131
|
-
|
|
132
|
-
```js
|
|
133
|
-
<Button color="positive" disabled onClick={() => {}}>
|
|
134
|
-
Disabled
|
|
135
|
-
</Button>
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
## Sizes
|
|
141
|
-
|
|
142
|
-
Control text size with the `size` prop. Available sizes: `"xsmall"`, `"small"`, `"medium"`, `"large"`, `"xlarge"`.
|
|
143
|
-
|
|
144
|
-
<Row gap="large" align="center" padding="large" justify="center">
|
|
145
|
-
<Button color="positive" size="small" onClick={() => {}}>Small</Button>
|
|
146
|
-
<Button color="positive" size="medium" onClick={() => {}}>Medium</Button>
|
|
147
|
-
<Button color="positive" size="large" onClick={() => {}}>Large</Button>
|
|
148
|
-
</Row>
|
|
149
|
-
|
|
150
|
-
```js
|
|
151
|
-
<Button color="positive" size="small" onClick={() => {}}>Small</Button>
|
|
152
|
-
<Button color="positive" size="medium" onClick={() => {}}>Medium</Button>
|
|
153
|
-
<Button color="positive" size="large" onClick={() => {}}>Large</Button>
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## Accessibility
|
|
159
|
-
|
|
160
|
-
- Buttons use semantic `<button>` elements
|
|
161
|
-
- Disabled state is communicated via `aria-disabled` attribute
|
|
162
|
-
- Focus states are clearly visible with outline styling
|
|
163
|
-
- Click handlers are ignored when disabled, preventing accidental actions
|
package/src/pages/Calendar.mdx
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { Calendar } from "../Calendar";
|
|
2
|
-
import { Box } from "../Box";
|
|
3
|
-
import { Row } from "../Row";
|
|
4
|
-
import { Column } from "../Column";
|
|
5
|
-
import { Badge } from "../Badge";
|
|
6
|
-
import { Span, H3 } from "../Text";
|
|
7
|
-
import { cssVar } from "../jss";
|
|
8
|
-
|
|
9
|
-
# Calendar
|
|
10
|
-
|
|
11
|
-
A flexible calendar grid component for displaying months. Fully customizable through render callbacks for both header cells (weekday names) and day cells.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Props
|
|
16
|
-
|
|
17
|
-
| Prop | Type | Default | Description |
|
|
18
|
-
|------|------|---------|-------------|
|
|
19
|
-
| `date` | `Date` | Required | The month to display (uses year and month from this date) |
|
|
20
|
-
| `header` | `(props) => JSX.Element` | Required | Render function for weekday header cells |
|
|
21
|
-
| `cell` | `(props) => JSX.Element` | Required | Render function for day cells |
|
|
22
|
-
| `jss` | `JSS` | - | Custom styles for the calendar grid |
|
|
23
|
-
|
|
24
|
-
### Header render props
|
|
25
|
-
|
|
26
|
-
| Property | Type | Description |
|
|
27
|
-
|----------|------|-------------|
|
|
28
|
-
| `weekday` | `string` | Localized weekday abbreviation (Mon, Tue, etc.) |
|
|
29
|
-
|
|
30
|
-
### Cell render props
|
|
31
|
-
|
|
32
|
-
| Property | Type | Description |
|
|
33
|
-
|----------|------|-------------|
|
|
34
|
-
| `date` | `Date` | The date for this cell |
|
|
35
|
-
| `today` | `boolean` | Whether this date is today |
|
|
36
|
-
| `outOfMonth` | `boolean` | Whether this date is outside the current month |
|
|
37
|
-
| `top` | `boolean` | Whether this cell is in the top row |
|
|
38
|
-
| `bottom` | `boolean` | Whether this cell is in the bottom row |
|
|
39
|
-
| `left` | `boolean` | Whether this cell is in the leftmost column |
|
|
40
|
-
| `right` | `boolean` | Whether this cell is in the rightmost column |
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Basic usage
|
|
45
|
-
|
|
46
|
-
<Calendar
|
|
47
|
-
date={new Date()}
|
|
48
|
-
header={({ weekday }) => (
|
|
49
|
-
<Box padding="small" jss={{ textAlign: "center" }}>
|
|
50
|
-
<Span bold color="secondary" size="small">{weekday}</Span>
|
|
51
|
-
</Box>
|
|
52
|
-
)}
|
|
53
|
-
cell={({ today, date, outOfMonth }) => (
|
|
54
|
-
<Box padding="small" relative={true} jss={{ opacity: outOfMonth ? 0.3 : 1, textAlign: "center" }}>
|
|
55
|
-
{today && (
|
|
56
|
-
<Badge
|
|
57
|
-
size="xlarge"
|
|
58
|
-
color="highlight"
|
|
59
|
-
jss={{
|
|
60
|
-
position: "absolute",
|
|
61
|
-
top: "50%",
|
|
62
|
-
left: "50%",
|
|
63
|
-
transform: "translate(-50%, -50%)",
|
|
64
|
-
zIndex: 0,
|
|
65
|
-
}}
|
|
66
|
-
/>
|
|
67
|
-
)}
|
|
68
|
-
<Span jss={{ position: "relative", zIndex: 1 }} color={today ? "light" : "primary"}>
|
|
69
|
-
{date.getDate()}
|
|
70
|
-
</Span>
|
|
71
|
-
</Box>
|
|
72
|
-
)}
|
|
73
|
-
/>
|
|
74
|
-
|
|
75
|
-
```js
|
|
76
|
-
<Calendar
|
|
77
|
-
date={new Date()}
|
|
78
|
-
header={({ weekday }) => (
|
|
79
|
-
<Box padding="small" jss={{ textAlign: "center" }}>
|
|
80
|
-
<Span bold color="secondary" size="small">{weekday}</Span>
|
|
81
|
-
</Box>
|
|
82
|
-
)}
|
|
83
|
-
cell={({ today, date, outOfMonth }) => (
|
|
84
|
-
<Box padding="small" jss={{ opacity: outOfMonth ? 0.3 : 1 }}>
|
|
85
|
-
{today && <Badge color="highlight" />}
|
|
86
|
-
<Span>{date.getDate()}</Span>
|
|
87
|
-
</Box>
|
|
88
|
-
)}
|
|
89
|
-
/>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
## With today indicator
|
|
95
|
-
|
|
96
|
-
<Calendar
|
|
97
|
-
date={new Date()}
|
|
98
|
-
header={({ weekday }) => (
|
|
99
|
-
<Box>
|
|
100
|
-
<H3>{weekday}</H3>
|
|
101
|
-
</Box>
|
|
102
|
-
)}
|
|
103
|
-
cell={({ today, date, outOfMonth }) => (
|
|
104
|
-
<Box relative={true} jss={{ opacity: outOfMonth ? 0.2 : 1 }}>
|
|
105
|
-
{today && (
|
|
106
|
-
<Badge
|
|
107
|
-
jss={{
|
|
108
|
-
position: "absolute",
|
|
109
|
-
top: "50%",
|
|
110
|
-
transform: "translateY(-50%) translateX(-75%)",
|
|
111
|
-
right: "50%",
|
|
112
|
-
}}
|
|
113
|
-
/>
|
|
114
|
-
)}
|
|
115
|
-
<Span>{date.getDate()}</Span>
|
|
116
|
-
</Box>
|
|
117
|
-
)}
|
|
118
|
-
/>
|
|
119
|
-
|
|
120
|
-
```js
|
|
121
|
-
<Calendar
|
|
122
|
-
date={new Date()}
|
|
123
|
-
header={({ weekday }) => (
|
|
124
|
-
<Box>
|
|
125
|
-
<H3>{weekday}</H3>
|
|
126
|
-
</Box>
|
|
127
|
-
)}
|
|
128
|
-
cell={({ today, date, outOfMonth }) => (
|
|
129
|
-
<Box relative={true} jss={{ opacity: outOfMonth ? 0.2 : 1 }}>
|
|
130
|
-
{today && (
|
|
131
|
-
<Badge
|
|
132
|
-
jss={{
|
|
133
|
-
position: "absolute",
|
|
134
|
-
top: "50%",
|
|
135
|
-
transform: "translateY(-50%) translateX(-75%)",
|
|
136
|
-
right: "50%",
|
|
137
|
-
}}
|
|
138
|
-
/>
|
|
139
|
-
)}
|
|
140
|
-
<Span>{date.getDate()}</Span>
|
|
141
|
-
</Box>
|
|
142
|
-
)}
|
|
143
|
-
/>
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## Using position props
|
|
149
|
-
|
|
150
|
-
The cell render props include position information for styling borders and corners:
|
|
151
|
-
|
|
152
|
-
```js
|
|
153
|
-
<Calendar
|
|
154
|
-
date={new Date()}
|
|
155
|
-
header={({ weekday }) => <Span>{weekday}</Span>}
|
|
156
|
-
cell={({ date, outOfMonth, top, bottom, left, right }) => (
|
|
157
|
-
<Box
|
|
158
|
-
jss={{
|
|
159
|
-
opacity: outOfMonth ? 0.3 : 1,
|
|
160
|
-
borderTop: top ? "1px solid var(--divider)" : "none",
|
|
161
|
-
borderBottom: bottom ? "1px solid var(--divider)" : "none",
|
|
162
|
-
borderLeft: left ? "1px solid var(--divider)" : "none",
|
|
163
|
-
borderRight: right ? "1px solid var(--divider)" : "none",
|
|
164
|
-
borderTopLeftRadius: top && left ? 8 : 0,
|
|
165
|
-
borderTopRightRadius: top && right ? 8 : 0,
|
|
166
|
-
borderBottomLeftRadius: bottom && left ? 8 : 0,
|
|
167
|
-
borderBottomRightRadius: bottom && right ? 8 : 0,
|
|
168
|
-
}}
|
|
169
|
-
>
|
|
170
|
-
<Span>{date.getDate()}</Span>
|
|
171
|
-
</Box>
|
|
172
|
-
)}
|
|
173
|
-
/>
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
## Interactive calendar
|
|
179
|
-
|
|
180
|
-
Create a date picker by adding click handlers:
|
|
181
|
-
|
|
182
|
-
```js
|
|
183
|
-
function DatePicker() {
|
|
184
|
-
const [selected, setSelected] = useState(null);
|
|
185
|
-
const [month, setMonth] = useState(new Date());
|
|
186
|
-
|
|
187
|
-
return (
|
|
188
|
-
<Column gap="medium">
|
|
189
|
-
<Row justify="space-between" align="center">
|
|
190
|
-
<IconButton
|
|
191
|
-
icon="fa-chevron-left"
|
|
192
|
-
onClick={() => setMonth(new Date(month.getFullYear(), month.getMonth() - 1))}
|
|
193
|
-
/>
|
|
194
|
-
<Span bold>
|
|
195
|
-
{month.toLocaleDateString("en-US", { month: "long", year: "numeric" })}
|
|
196
|
-
</Span>
|
|
197
|
-
<IconButton
|
|
198
|
-
icon="fa-chevron-right"
|
|
199
|
-
onClick={() => setMonth(new Date(month.getFullYear(), month.getMonth() + 1))}
|
|
200
|
-
/>
|
|
201
|
-
</Row>
|
|
202
|
-
<Calendar
|
|
203
|
-
date={month}
|
|
204
|
-
header={({ weekday }) => <Span size="small">{weekday}</Span>}
|
|
205
|
-
cell={({ date, outOfMonth, today }) => {
|
|
206
|
-
const isSelected = selected?.toDateString() === date.toDateString();
|
|
207
|
-
return (
|
|
208
|
-
<BaseButton
|
|
209
|
-
bare
|
|
210
|
-
onClick={() => !outOfMonth && setSelected(date)}
|
|
211
|
-
jss={{
|
|
212
|
-
opacity: outOfMonth ? 0.3 : 1,
|
|
213
|
-
backgroundColor: isSelected ? "var(--highlight)" : "transparent",
|
|
214
|
-
borderRadius: "50%",
|
|
215
|
-
}}
|
|
216
|
-
>
|
|
217
|
-
<Span color={isSelected ? "light" : "primary"}>
|
|
218
|
-
{date.getDate()}
|
|
219
|
-
</Span>
|
|
220
|
-
</BaseButton>
|
|
221
|
-
);
|
|
222
|
-
}}
|
|
223
|
-
/>
|
|
224
|
-
</Column>
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
## Grid layout
|
|
232
|
-
|
|
233
|
-
The Calendar uses CSS Grid with 7 columns (Mon-Sun). The header row and day cells flow naturally into the grid:
|
|
234
|
-
|
|
235
|
-
```js
|
|
236
|
-
// Custom grid styling
|
|
237
|
-
<Calendar
|
|
238
|
-
date={new Date()}
|
|
239
|
-
jss={{
|
|
240
|
-
gap: 4,
|
|
241
|
-
padding: 16,
|
|
242
|
-
backgroundColor: "var(--secondary-background)",
|
|
243
|
-
borderRadius: 12,
|
|
244
|
-
}}
|
|
245
|
-
header={...}
|
|
246
|
-
cell={...}
|
|
247
|
-
/>
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
---
|
|
251
|
-
|
|
252
|
-
## Localization
|
|
253
|
-
|
|
254
|
-
Weekday names are automatically localized using `Intl.DateTimeFormat` with UK English locale (week starts Monday). The calendar always displays Monday through Sunday.
|