@tcn/ui 0.0.1 → 0.0.3
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/actions/button/button/button.d.ts.map +1 -1
- package/dist/actions/button/button/button.js +12 -4
- package/dist/actions/button/button/button.js.map +1 -1
- package/dist/drawer_bottom.css +1 -1
- package/dist/drawer_end.css +1 -1
- package/dist/drawer_start.css +1 -1
- package/dist/drawer_top.css +1 -1
- package/dist/form/field/common/status_input/status_input.js.map +1 -1
- package/dist/form/field/h_field/h_field.d.ts.map +1 -1
- package/dist/form/field/h_field/h_field.js.map +1 -1
- package/dist/form/field/v_field/v_field.d.ts.map +1 -1
- package/dist/form/field/v_field/v_field.js.map +1 -1
- package/dist/form/field_presenters/options_field_presenter.d.ts.map +1 -1
- package/dist/form/field_presenters/options_field_presenter.js.map +1 -1
- package/dist/form/form_field.d.ts.map +1 -1
- package/dist/form/form_field.js.map +1 -1
- package/dist/form/index.d.ts +14 -5
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +27 -8
- package/dist/form/index.js.map +1 -1
- package/dist/h_body.css +1 -0
- package/dist/inputs/phone_number_input/phone_number_input.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.js +60 -51
- package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
- package/dist/layouts/body/h_body.d.ts +6 -0
- package/dist/layouts/body/h_body.d.ts.map +1 -0
- package/dist/layouts/body/h_body.js +21 -0
- package/dist/layouts/body/h_body.js.map +1 -0
- package/dist/layouts/body/v_body.d.ts +6 -0
- package/dist/layouts/body/v_body.d.ts.map +1 -0
- package/dist/layouts/body/v_body.js +21 -0
- package/dist/layouts/body/v_body.js.map +1 -0
- package/dist/layouts/divider/divider.d.ts +2 -2
- package/dist/layouts/divider/divider.d.ts.map +1 -1
- package/dist/layouts/divider/divider.js +17 -16
- package/dist/layouts/divider/divider.js.map +1 -1
- package/dist/layouts/footer/footer.d.ts +1 -1
- package/dist/layouts/footer/footer.d.ts.map +1 -1
- package/dist/layouts/footer/footer.js +5 -5
- package/dist/layouts/footer/footer.js.map +1 -1
- package/dist/layouts/header/header.d.ts +1 -1
- package/dist/layouts/header/header.d.ts.map +1 -1
- package/dist/layouts/header/header.js +10 -10
- package/dist/layouts/header/header.js.map +1 -1
- package/dist/layouts/index.d.ts +2 -4
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +20 -24
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/utility_bar/utility_bar.d.ts +1 -1
- package/dist/layouts/utility_bar/utility_bar.d.ts.map +1 -1
- package/dist/layouts/utility_bar/utility_bar.js +13 -8
- package/dist/layouts/utility_bar/utility_bar.js.map +1 -1
- package/dist/overlay/index.d.ts +6 -0
- package/dist/overlay/index.d.ts.map +1 -0
- package/dist/overlay/index.js +14 -0
- package/dist/overlay/index.js.map +1 -0
- package/dist/panel.css +1 -1
- package/dist/panel.module-DwGKncon.js +5 -0
- package/dist/panel.module-DwGKncon.js.map +1 -0
- package/dist/stack.css +1 -1
- package/dist/stacks/types/styles.d.ts +2 -2
- package/dist/stacks/types/styles.d.ts.map +1 -1
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.js +1 -1
- package/dist/surfaces/drawers/drawer_bottom/drawer_bottom.js.map +1 -0
- package/dist/surfaces/drawers/drawer_end/drawer_end.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_end/drawer_end.js +2 -2
- package/dist/surfaces/drawers/drawer_end/drawer_end.js.map +1 -0
- package/dist/surfaces/drawers/drawer_start/drawer_start.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_start/drawer_start.js +1 -1
- package/dist/surfaces/drawers/drawer_start/drawer_start.js.map +1 -0
- package/dist/surfaces/drawers/drawer_top/drawer_top.d.ts.map +1 -0
- package/dist/{layouts → surfaces}/drawers/drawer_top/drawer_top.js +1 -1
- package/dist/surfaces/drawers/drawer_top/drawer_top.js.map +1 -0
- package/dist/surfaces/index.d.ts +4 -0
- package/dist/surfaces/index.d.ts.map +1 -1
- package/dist/surfaces/index.js +20 -12
- package/dist/surfaces/index.js.map +1 -1
- package/dist/surfaces/panel/h_panel.d.ts +1 -1
- package/dist/surfaces/panel/h_panel.d.ts.map +1 -1
- package/dist/surfaces/panel/h_panel.js +44 -33
- package/dist/surfaces/panel/h_panel.js.map +1 -1
- package/dist/surfaces/panel/v_panel.d.ts +1 -1
- package/dist/surfaces/panel/v_panel.d.ts.map +1 -1
- package/dist/surfaces/panel/v_panel.js +36 -31
- package/dist/surfaces/panel/v_panel.js.map +1 -1
- package/dist/themes/index.js +82 -20
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/themes/ergo/ergo_theme.css +1 -1
- package/dist/typography/title/title.d.ts +1 -1
- package/dist/typography/title/title.d.ts.map +1 -1
- package/dist/typography/title/title.js +16 -16
- package/dist/typography/title/title.js.map +1 -1
- package/dist/v_body.css +1 -0
- package/package.json +3 -3
- package/src/actions/button/button/button.tsx +10 -4
- package/src/form/field/common/status_input/status_input.tsx +1 -1
- package/src/form/field/h_field/h_field.tsx +1 -1
- package/src/form/field/v_field/v_field.tsx +1 -1
- package/src/form/field_presenters/options_field_presenter.ts +1 -1
- package/src/form/form_field.tsx +1 -1
- package/src/form/index.ts +50 -5
- package/src/inputs/phone_number_input/phone_number_input.tsx +9 -4
- package/src/layouts/body/h_body.module.css +5 -0
- package/src/layouts/body/h_body.tsx +23 -0
- package/src/layouts/body/v_body.module.css +5 -0
- package/src/layouts/body/v_body.tsx +23 -0
- package/src/layouts/divider/divider.tsx +5 -4
- package/src/layouts/footer/footer.tsx +4 -4
- package/src/layouts/header/header.tsx +4 -4
- package/src/layouts/index.ts +2 -4
- package/src/layouts/utility_bar/utility_bar.tsx +9 -4
- package/src/overlay/index.ts +5 -0
- package/src/stacks/stack.module.css +54 -5
- package/src/stacks/stacks.mdx +28 -28
- package/src/stacks/types/styles.ts +2 -2
- package/src/surfaces/index.ts +4 -0
- package/src/surfaces/panel/__stories__/panel.stories.tsx +68 -0
- package/src/surfaces/panel/__stories__/panel_stories.module.css +13 -0
- package/src/surfaces/panel/h_panel.tsx +18 -6
- package/src/surfaces/panel/panel.module.css +2 -7
- package/src/surfaces/panel/v_panel.tsx +11 -5
- package/src/themes/themes/ergo/ergo_theme.css +72 -10
- package/src/typography/title/title.tsx +2 -2
- package/dist/form/field/form_field.d.ts +0 -6
- package/dist/form/field/form_field.d.ts.map +0 -1
- package/dist/form/field/form_field.js +0 -18
- package/dist/form/field/form_field.js.map +0 -1
- package/dist/layouts/drawers/drawer_bottom/drawer_bottom.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_bottom/drawer_bottom.js.map +0 -1
- package/dist/layouts/drawers/drawer_end/drawer_end.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_end/drawer_end.js.map +0 -1
- package/dist/layouts/drawers/drawer_start/drawer_start.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_start/drawer_start.js.map +0 -1
- package/dist/layouts/drawers/drawer_top/drawer_top.d.ts.map +0 -1
- package/dist/layouts/drawers/drawer_top/drawer_top.js.map +0 -1
- package/dist/panel.module-CtikcmYB.js +0 -5
- package/dist/panel.module-CtikcmYB.js.map +0 -1
- package/src/form/field/form_field.tsx +0 -29
- /package/dist/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.d.ts +0 -0
- /package/dist/{layouts → surfaces}/drawers/drawer_end/drawer_end.d.ts +0 -0
- /package/dist/{layouts → surfaces}/drawers/drawer_start/drawer_start.d.ts +0 -0
- /package/dist/{layouts → surfaces}/drawers/drawer_top/drawer_top.d.ts +0 -0
- /package/src/{layouts → surfaces}/drawers/__stories__/drawers.stories.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_bottom/drawer_bottom.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_end/drawer_end.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_end/drawer_end.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_start/drawer_start.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_start/drawer_start.tsx +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_top/drawer_top.module.css +0 -0
- /package/src/{layouts → surfaces}/drawers/drawer_top/drawer_top.tsx +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import cln from 'classnames';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import
|
|
2
|
+
import cln from 'classnames';
|
|
3
|
+
import { BaseButton, type BaseButtonProps } from '../base_button/base_button.js';
|
|
4
4
|
import styles from './button.module.css';
|
|
5
5
|
|
|
6
6
|
export interface ButtonProps extends BaseButtonProps {}
|
|
@@ -10,9 +10,15 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function
|
|
|
10
10
|
ref
|
|
11
11
|
) {
|
|
12
12
|
return (
|
|
13
|
-
<BaseButton
|
|
13
|
+
<BaseButton
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cln(styles.button, 'button', 'tcn-button', className)}
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
14
18
|
{typeof children === 'string' ? (
|
|
15
|
-
<span className={cln(styles['button-text'], 'button-text')}>
|
|
19
|
+
<span className={cln(styles['button-text'], 'button-text', 'tcn-button-text')}>
|
|
20
|
+
{children}
|
|
21
|
+
</span>
|
|
16
22
|
) : (
|
|
17
23
|
children
|
|
18
24
|
)}
|
|
@@ -9,7 +9,7 @@ import classNames from 'classnames';
|
|
|
9
9
|
import styles from './status_input.module.css';
|
|
10
10
|
|
|
11
11
|
/*
|
|
12
|
-
TODO: I really want to make these
|
|
12
|
+
TODO: I really want to make these themeable.
|
|
13
13
|
The way we do that is simply put a div placeholder with
|
|
14
14
|
a class that the theme can override. They can use svgs as
|
|
15
15
|
backgrounds for icons. This would make it so the component
|
|
@@ -4,7 +4,7 @@ import type { WithDetailedHTMLProps } from '../../../stacks/types/as.js';
|
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import React, { useState } from 'react';
|
|
6
6
|
import styles from './h_field.module.css';
|
|
7
|
-
import { FieldInput } from '../common/types.js';
|
|
7
|
+
import type { FieldInput } from '../common/types.js';
|
|
8
8
|
import { FieldHeader } from '../common/field_header.js';
|
|
9
9
|
import { FieldControl } from '../common/field_control/field_control.js';
|
|
10
10
|
import { FieldStatusInput } from '../common/status_input/status_input.js';
|
|
@@ -7,7 +7,7 @@ import styles from './v_field.module.css';
|
|
|
7
7
|
import { FieldControl } from '../common/field_control/field_control.js';
|
|
8
8
|
import { FieldHeader } from '../common/field_header.js';
|
|
9
9
|
import { FieldStatusInput } from '../common/status_input/status_input.js';
|
|
10
|
-
import { FieldInput } from '../common/types.js';
|
|
10
|
+
import type { FieldInput } from '../common/types.js';
|
|
11
11
|
|
|
12
12
|
export interface VFieldOwnProps extends FieldInput {
|
|
13
13
|
children: React.ReactNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Signal } from '@tcn/state';
|
|
2
|
-
import { FieldOptions, FieldPresenter, FieldState } from './field_presenter.js';
|
|
2
|
+
import { type FieldOptions, FieldPresenter, type FieldState } from './field_presenter.js';
|
|
3
3
|
|
|
4
4
|
export interface OptionsFieldState<TValue = string, TOption = string>
|
|
5
5
|
extends FieldState<TValue> {
|
package/src/form/form_field.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
import { useSignalValue } from '@tcn/state';
|
|
3
|
-
import { FieldPresenter, FieldState } from './field_presenters/field_presenter.js';
|
|
3
|
+
import { FieldPresenter, type FieldState } from './field_presenters/field_presenter.js';
|
|
4
4
|
|
|
5
5
|
export function FormField<T>({
|
|
6
6
|
field,
|
package/src/form/index.ts
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export {
|
|
2
|
+
type FieldControlOwnProps,
|
|
3
|
+
type FieldControlProps,
|
|
4
|
+
FieldControl,
|
|
5
|
+
} from './field/common/field_control/field_control.js';
|
|
6
|
+
export {
|
|
7
|
+
AdornmentMap,
|
|
8
|
+
type StatusInputState,
|
|
9
|
+
type StatusInputOwnProps,
|
|
10
|
+
type StatusInputProps,
|
|
11
|
+
FieldStatusInput,
|
|
12
|
+
} from './field/common/status_input/status_input.js';
|
|
13
|
+
export {
|
|
14
|
+
FieldDescription,
|
|
15
|
+
type FieldDescriptionOwnProps,
|
|
16
|
+
} from './field/common/field_description.js';
|
|
17
|
+
export {
|
|
18
|
+
type FieldErrorMessageOwnProps,
|
|
19
|
+
FieldErrorMessage,
|
|
20
|
+
} from './field/common/field_error.js';
|
|
21
|
+
export {
|
|
22
|
+
FieldHeader,
|
|
23
|
+
type FieldHeaderProps,
|
|
24
|
+
type FieldHeaderOwnProps,
|
|
25
|
+
} from './field/common/field_header.js';
|
|
26
|
+
export { FieldLabel, type FieldLabelOwnProps } from './field/common/field_label.js';
|
|
27
|
+
export type { FieldInput } from './field/common/types.js';
|
|
28
|
+
export {
|
|
29
|
+
HField,
|
|
30
|
+
type HFieldProps,
|
|
31
|
+
type HFieldOwnProps,
|
|
32
|
+
} from './field/h_field/h_field.js';
|
|
33
|
+
export {
|
|
34
|
+
VField,
|
|
35
|
+
type VFieldProps,
|
|
36
|
+
type VFieldOwnProps,
|
|
37
|
+
} from './field/v_field/v_field.js';
|
|
38
|
+
export { Field, type FieldProps } from './field/field.js';
|
|
39
|
+
export {
|
|
40
|
+
FieldPresenter,
|
|
41
|
+
type FieldState,
|
|
42
|
+
type FieldOptions,
|
|
43
|
+
} from './field_presenters/field_presenter.js';
|
|
44
|
+
export {
|
|
45
|
+
OptionsFieldPresenter,
|
|
46
|
+
type OptionsFieldState,
|
|
47
|
+
type OptionsFieldOptions,
|
|
48
|
+
} from './field_presenters/options_field_presenter.js';
|
|
49
|
+
export { FieldSet, type FieldSetProps } from './field_set/field_set.js';
|
|
50
|
+
export { FormField } from './form_field.js';
|
|
@@ -51,10 +51,10 @@ function createCountryOptions(allowedCountryCodes?: string[]) {
|
|
|
51
51
|
});
|
|
52
52
|
return countryList
|
|
53
53
|
.filter(c => Boolean(allowedMap[c.value]))
|
|
54
|
-
.map(
|
|
54
|
+
.map(i => {
|
|
55
55
|
return (
|
|
56
56
|
<Option
|
|
57
|
-
key={
|
|
57
|
+
key={i.value}
|
|
58
58
|
value={i.value}
|
|
59
59
|
label={i.selectedLabel}
|
|
60
60
|
keywords={i.keywords}
|
|
@@ -64,9 +64,14 @@ function createCountryOptions(allowedCountryCodes?: string[]) {
|
|
|
64
64
|
);
|
|
65
65
|
});
|
|
66
66
|
} else {
|
|
67
|
-
return countryList.map(
|
|
67
|
+
return countryList.map(i => {
|
|
68
68
|
return (
|
|
69
|
-
<Option
|
|
69
|
+
<Option
|
|
70
|
+
key={i.value}
|
|
71
|
+
value={i.value}
|
|
72
|
+
label={i.selectedLabel}
|
|
73
|
+
keywords={i.keywords}
|
|
74
|
+
>
|
|
70
75
|
{i.optionLabel}
|
|
71
76
|
</Option>
|
|
72
77
|
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import styles from './h_body.module.css';
|
|
5
|
+
|
|
6
|
+
export interface HBodyProps extends Omit<HStackProps, 'as'> {}
|
|
7
|
+
|
|
8
|
+
export const HBody = React.forwardRef<HTMLElement, HBodyProps>(function HBody(
|
|
9
|
+
{ children, className, overflowX = 'auto', ...props }: HBodyProps,
|
|
10
|
+
ref
|
|
11
|
+
) {
|
|
12
|
+
return (
|
|
13
|
+
<HStack
|
|
14
|
+
ref={ref}
|
|
15
|
+
as="div"
|
|
16
|
+
overflowX={overflowX}
|
|
17
|
+
className={classNames(styles['h-body'], className, 'tcn-h-body', 'body')}
|
|
18
|
+
{...props}
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
</HStack>
|
|
22
|
+
);
|
|
23
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VStack, type VStackProps } from '../../stacks/v_stack.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import styles from './v_body.module.css';
|
|
5
|
+
|
|
6
|
+
export interface VBodyProps extends Omit<VStackProps, 'as'> {}
|
|
7
|
+
|
|
8
|
+
export const VBody = React.forwardRef<HTMLElement, VBodyProps>(function VBody(
|
|
9
|
+
{ children, className, overflowY = 'auto', ...props }: VBodyProps,
|
|
10
|
+
ref
|
|
11
|
+
) {
|
|
12
|
+
return (
|
|
13
|
+
<VStack
|
|
14
|
+
ref={ref}
|
|
15
|
+
as="div"
|
|
16
|
+
overflowY={overflowY}
|
|
17
|
+
className={classNames(styles['v-body'], className, 'tcn-body', 'tcn-v-body')}
|
|
18
|
+
{...props}
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
</VStack>
|
|
22
|
+
);
|
|
23
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { WithDetailedHTMLProps } from '../../stacks/types/as.js';
|
|
1
|
+
import React, { type CSSProperties } from 'react';
|
|
3
2
|
import classnames from 'classnames';
|
|
4
|
-
import
|
|
3
|
+
import type { WithDetailedHTMLProps } from '../../stacks/types/as.js';
|
|
4
|
+
import type { Emphasis, Size } from '../../utils/index.js';
|
|
5
5
|
import styles from './divider.module.css';
|
|
6
6
|
|
|
7
7
|
export type DividerOrientation =
|
|
@@ -59,7 +59,7 @@ export const Divider: React.FC<DividerProps> = ({
|
|
|
59
59
|
data-thickness={thickness}
|
|
60
60
|
data-length={length}
|
|
61
61
|
data-orientation={orientation}
|
|
62
|
-
className={classnames(styles[`divider`], 'divider', className)}
|
|
62
|
+
className={classnames(styles[`divider`], 'divider', 'tcn-divider', className)}
|
|
63
63
|
{...props}
|
|
64
64
|
>
|
|
65
65
|
<div
|
|
@@ -71,6 +71,7 @@ export const Divider: React.FC<DividerProps> = ({
|
|
|
71
71
|
className={classnames(
|
|
72
72
|
styles[`divider-line`],
|
|
73
73
|
'divider-line',
|
|
74
|
+
'tcn-divider-line',
|
|
74
75
|
'material',
|
|
75
76
|
className
|
|
76
77
|
)}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
1
|
import React from 'react';
|
|
4
|
-
import
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
5
4
|
import type { Hierarchy, Size } from '../../utils/index.js';
|
|
5
|
+
import styles from './footer.module.css';
|
|
6
6
|
|
|
7
7
|
export interface FooterProps extends Omit<HStackProps, 'as' | 'children'> {
|
|
8
8
|
hierarchy?: Hierarchy;
|
|
@@ -18,7 +18,7 @@ export const Footer = React.forwardRef<HTMLElement, FooterProps>(function Footer
|
|
|
18
18
|
<HStack
|
|
19
19
|
ref={ref}
|
|
20
20
|
as="footer"
|
|
21
|
-
className={classNames(styles.footer, className, 'footer')}
|
|
21
|
+
className={classNames(styles.footer, className, 'footer', 'tcn-footer')}
|
|
22
22
|
data-hierarchy={hierarchy}
|
|
23
23
|
data-size={size}
|
|
24
24
|
{...props}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
1
|
import React from 'react';
|
|
4
|
-
import
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
5
4
|
import type { Hierarchy, Size } from '../../utils/index.js';
|
|
5
|
+
import styles from './header.module.css';
|
|
6
6
|
|
|
7
7
|
// UtilityBar
|
|
8
8
|
export interface HeaderProps extends Omit<HStackProps, 'as'> {
|
|
@@ -25,7 +25,7 @@ export const Header = React.forwardRef<HTMLElement, HeaderProps>(function Header
|
|
|
25
25
|
<HStack
|
|
26
26
|
ref={ref}
|
|
27
27
|
as="header"
|
|
28
|
-
className={classNames(styles.header, className, 'header')}
|
|
28
|
+
className={classNames(styles.header, className, 'tcn-header', 'header')}
|
|
29
29
|
data-hierarchy={hierarchy}
|
|
30
30
|
data-size={size}
|
|
31
31
|
height={height}
|
package/src/layouts/index.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export * from './column/column.js';
|
|
2
2
|
export * from './divider/divider.js';
|
|
3
|
-
export * from './drawers/drawer_bottom/drawer_bottom.js';
|
|
4
|
-
export * from './drawers/drawer_top/drawer_top.js';
|
|
5
|
-
export * from './drawers/drawer_start/drawer_start.js';
|
|
6
|
-
export * from './drawers/drawer_end/drawer_end.js';
|
|
7
3
|
export * from './footer/footer.js';
|
|
8
4
|
export * from './grid/grid.js';
|
|
9
5
|
export * from './header/header.js';
|
|
@@ -12,3 +8,5 @@ export * from './list/list.js';
|
|
|
12
8
|
export * from './list/section_header.js';
|
|
13
9
|
export * from './sidebar_end/sidebar_end.js';
|
|
14
10
|
export * from './sidebar_start/sidebar_start.js';
|
|
11
|
+
export * from './body/h_body.js';
|
|
12
|
+
export * from './body/v_body.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
1
|
import React from 'react';
|
|
4
|
-
import
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { HStack, type HStackProps } from '../../stacks/h_stack.js';
|
|
5
4
|
import type { Hierarchy, Size } from '../../utils/index.js';
|
|
5
|
+
import styles from './utility_bar.module.css';
|
|
6
6
|
|
|
7
7
|
// UtilityBar
|
|
8
8
|
export interface UtilityBarProps extends Omit<HStackProps, 'as'> {
|
|
@@ -26,7 +26,12 @@ export const UtilityBar = React.forwardRef<HTMLElement, UtilityBarProps>(
|
|
|
26
26
|
<HStack
|
|
27
27
|
ref={ref}
|
|
28
28
|
as="header"
|
|
29
|
-
className={classNames(
|
|
29
|
+
className={classNames(
|
|
30
|
+
styles['utility-bar'],
|
|
31
|
+
className,
|
|
32
|
+
'utility-bar',
|
|
33
|
+
'tcn-utility-bar'
|
|
34
|
+
)}
|
|
30
35
|
data-hierarchy={hierarchy}
|
|
31
36
|
data-size={size}
|
|
32
37
|
height={height}
|
|
@@ -20,7 +20,8 @@ HStack CSS
|
|
|
20
20
|
display: inline-grid;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.box[data-height="flex"]
|
|
23
|
+
.box[data-height="flex"],
|
|
24
|
+
.box[data-height="fill"] {
|
|
24
25
|
height: auto;
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -127,13 +128,30 @@ HStack CSS
|
|
|
127
128
|
:where(.h-stack > .h-stack[data-width="flex"]),
|
|
128
129
|
:where(.h-stack > .z-stack[data-width="flex"]),
|
|
129
130
|
:where(.h-stack > .v-stack[data-width="flex"]),
|
|
130
|
-
:where(.h-stack > .stack-flex[data-width="flex"])
|
|
131
|
+
:where(.h-stack > .stack-flex[data-width="flex"]),
|
|
132
|
+
:where(.h-stack > .h-stack[data-width="fill"]),
|
|
133
|
+
:where(.h-stack > .z-stack[data-width="fill"]),
|
|
134
|
+
:where(.h-stack > .v-stack[data-width="fill"]),
|
|
135
|
+
:where(.h-stack > .stack-flex[data-width="fill"]),
|
|
136
|
+
:where(.h-stack > .box[data-width="fill"]) {
|
|
131
137
|
flex-grow: 1;
|
|
132
138
|
flex-shrink: 0;
|
|
133
139
|
flex-basis: 0%;
|
|
134
140
|
width: auto;
|
|
135
141
|
}
|
|
136
142
|
|
|
143
|
+
:where(.h-stack > .h-stack[data-height="flex"]),
|
|
144
|
+
:where(.h-stack > .z-stack[data-height="flex"]),
|
|
145
|
+
:where(.h-stack > .v-stack[data-height="flex"]),
|
|
146
|
+
:where(.h-stack > .stack-flex[data-height="flex"]),
|
|
147
|
+
:where(.h-stack > .h-stack[data-height="fill"]),
|
|
148
|
+
:where(.h-stack > .z-stack[data-height="fill"]),
|
|
149
|
+
:where(.h-stack > .v-stack[data-height="fill"]),
|
|
150
|
+
:where(.h-stack > .stack-flex[data-height="fill"]),
|
|
151
|
+
:where(.h-stack > .box[data-height="fill"]) {
|
|
152
|
+
height: 100%;
|
|
153
|
+
}
|
|
154
|
+
|
|
137
155
|
:where(.reveal-layout .h-stack:after),
|
|
138
156
|
:where(.reveal-h-stack .h-stack:after) {
|
|
139
157
|
content: "";
|
|
@@ -189,17 +207,38 @@ HStack CSS
|
|
|
189
207
|
:where(.v-stack > .h-stack[data-height="flex"]),
|
|
190
208
|
:where(.v-stack > .z-stack[data-height="flex"]),
|
|
191
209
|
:where(.v-stack > .v-stack[data-height="flex"]),
|
|
192
|
-
:where(.v-stack > .stack-flex[data-height="flex"])
|
|
210
|
+
:where(.v-stack > .stack-flex[data-height="flex"]),
|
|
211
|
+
:where(.v-stack > .h-stack[data-height="fill"]),
|
|
212
|
+
:where(.v-stack > .z-stack[data-height="fill"]),
|
|
213
|
+
:where(.v-stack > .v-stack[data-height="fill"]),
|
|
214
|
+
:where(.v-stack > .stack-flex[data-height="fill"]),
|
|
215
|
+
:where(.v-stack > .box[data-height="fill"]) {
|
|
193
216
|
flex-grow: 1;
|
|
194
217
|
flex-shrink: 0;
|
|
195
218
|
flex-basis: 0%;
|
|
196
219
|
height: auto;
|
|
197
220
|
}
|
|
198
221
|
|
|
222
|
+
:where(.v-stack > .h-stack[data-width="flex"]),
|
|
223
|
+
:where(.v-stack > .z-stack[data-width="flex"]),
|
|
224
|
+
:where(.v-stack > .v-stack[data-width="flex"]),
|
|
225
|
+
:where(.v-stack > .stack-flex[data-width="flex"]),
|
|
226
|
+
:where(.v-stack > .h-stack[data-width="fill"]),
|
|
227
|
+
:where(.v-stack > .z-stack[data-width="fill"]),
|
|
228
|
+
:where(.v-stack > .v-stack[data-width="fill"]),
|
|
229
|
+
:where(.v-stack > .stack-flex[data-width="fill"]),
|
|
230
|
+
:where(.v-stack > .box[data-width="fill"]) {
|
|
231
|
+
width: 100%;
|
|
232
|
+
}
|
|
233
|
+
|
|
199
234
|
:where(.v-stack[data-height="auto"] > .h-stack[data-height="flex"]),
|
|
200
235
|
:where(.v-stack[data-height="auto"] > .z-stack[data-height="flex"]),
|
|
201
236
|
:where(.v-stack[data-height="auto"] > .v-stack[data-height="flex"]),
|
|
202
|
-
:where(.v-stack[data-height="auto"] > .stack-flex[data-height="flex"])
|
|
237
|
+
:where(.v-stack[data-height="auto"] > .stack-flex[data-height="flex"]),
|
|
238
|
+
:where(.v-stack[data-height="auto"] > .h-stack[data-height="fill"]),
|
|
239
|
+
:where(.v-stack[data-height="auto"] > .z-stack[data-height="fill"]),
|
|
240
|
+
:where(.v-stack[data-height="auto"] > .v-stack[data-height="fill"]),
|
|
241
|
+
:where(.v-stack[data-height="auto"] > .stack-flex[data-height="fill"]) {
|
|
203
242
|
flex-basis: auto;
|
|
204
243
|
}
|
|
205
244
|
|
|
@@ -259,12 +298,18 @@ ZStack CSS
|
|
|
259
298
|
|
|
260
299
|
:where(.z-stack > .h-stack[data-height="flex"]),
|
|
261
300
|
:where(.z-stack > .v-stack[data-height="flex"]),
|
|
301
|
+
:where(.z-stack > .h-stack[data-height="fill"]),
|
|
302
|
+
:where(.z-stack > .v-stack[data-height="fill"]),
|
|
303
|
+
:where(.z-stack > .stack-flex[data-height="fill"]),
|
|
262
304
|
:where(.z-stack > .stack-flex[data-height="default"]) {
|
|
263
305
|
height: 100%;
|
|
264
306
|
}
|
|
265
307
|
|
|
266
308
|
:where(.z-stack > .h-stack[data-width="flex"]),
|
|
267
309
|
:where(.z-stack > .v-stack[data-width="flex"]),
|
|
310
|
+
:where(.z-stack > .h-stack[data-width="fill"]),
|
|
311
|
+
:where(.z-stack > .v-stack[data-width="fill"]),
|
|
312
|
+
:where(.z-stack > .stack-flex[data-width="fill"]),
|
|
268
313
|
:where(.z-stack > .stack-flex[data-width="default"]) {
|
|
269
314
|
width: 100%;
|
|
270
315
|
}
|
|
@@ -311,7 +356,11 @@ Defaults CSS
|
|
|
311
356
|
:where(.h-stack[data-width="auto"] > .h-stack[data-width="flex"]),
|
|
312
357
|
:where(.h-stack[data-width="auto"] > .z-stack[data-width="flex"]),
|
|
313
358
|
:where(.h-stack[data-width="auto"] > .v-stack[data-width="flex"]),
|
|
314
|
-
:where(.h-stack[data-width="auto"] > .stack-flex[data-width="flex"])
|
|
359
|
+
:where(.h-stack[data-width="auto"] > .stack-flex[data-width="flex"]),
|
|
360
|
+
:where(.h-stack[data-width="auto"] > .h-stack[data-width="fill"]),
|
|
361
|
+
:where(.h-stack[data-width="auto"] > .z-stack[data-width="fill"]),
|
|
362
|
+
:where(.h-stack[data-width="auto"] > .v-stack[data-width="fill"]),
|
|
363
|
+
:where(.h-stack[data-width="auto"] > .stack-flex[data-width="fill"]) {
|
|
315
364
|
flex-basis: auto;
|
|
316
365
|
}
|
|
317
366
|
|
package/src/stacks/stacks.mdx
CHANGED
|
@@ -34,14 +34,14 @@ Here is the list of components that you will use with stacks:
|
|
|
34
34
|
### HStack
|
|
35
35
|
|
|
36
36
|
This example uses `HStack` to arrange elements horizontally. It places a `Box` on either
|
|
37
|
-
side and a `Box` with width set to `
|
|
38
|
-
components are set to occupy 25% of the width each, while the `Box` with width set to `
|
|
37
|
+
side and a `Box` with width set to `fill` in the middle, creating a simple, evenly spaced layout. The `Box`
|
|
38
|
+
components are set to occupy 25% of the width each, while the `Box` with width set to `fill` automatically
|
|
39
39
|
takes up the remaining space.
|
|
40
40
|
|
|
41
41
|
<StyleBox height="auto" padding="10px" border="1px solid #ccc">
|
|
42
42
|
<HStack height="100px">
|
|
43
43
|
<Rect color="#abdef0" width="25%">25%</Rect>
|
|
44
|
-
<Rect color="#89d9c8" width="
|
|
44
|
+
<Rect color="#89d9c8" width="fill">fill</Rect>
|
|
45
45
|
<Rect color="#abdef0" width="25%">25%</Rect>
|
|
46
46
|
</HStack>
|
|
47
47
|
</StyleBox>
|
|
@@ -49,22 +49,22 @@ takes up the remaining space.
|
|
|
49
49
|
```tsx
|
|
50
50
|
<HStack height="100px">
|
|
51
51
|
<Box width="25%">25%</Box>
|
|
52
|
-
<Box width="
|
|
52
|
+
<Box width="fill">fill</Box>
|
|
53
53
|
<Box width="25%">25%</Box>
|
|
54
54
|
</HStack>
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
---
|
|
58
58
|
|
|
59
|
-
Here, two `Box` components with width set to `
|
|
60
|
-
evenly share the available space between them, making it ideal for creating
|
|
59
|
+
Here, two `Box` components with width set to `fill` are placed between `Box` elements. Each `Box` will
|
|
60
|
+
evenly share the available space between them, making it ideal for creating fillible
|
|
61
61
|
layouts where multiple components need equal space.
|
|
62
62
|
|
|
63
63
|
<StyleBox height="auto" padding="10px" border="1px solid #ccc">
|
|
64
64
|
<HStack height="100px">
|
|
65
65
|
<Rect color="#abdef0" width="25%">25%</Rect>
|
|
66
|
-
<Rect color="#89d9c8" width="
|
|
67
|
-
<Rect color="#89d9c8" width="
|
|
66
|
+
<Rect color="#89d9c8" width="fill">fill</Rect>
|
|
67
|
+
<Rect color="#89d9c8" width="fill">fill</Rect>
|
|
68
68
|
<Rect color="#abdef0" width="25%">25%</Rect>
|
|
69
69
|
</HStack>
|
|
70
70
|
</StyleBox>
|
|
@@ -72,15 +72,15 @@ layouts where multiple components need equal space.
|
|
|
72
72
|
```tsx
|
|
73
73
|
<HStack height="100px">
|
|
74
74
|
<Box width="25%">25%</Box>
|
|
75
|
-
<Box width="
|
|
76
|
-
<Box width="
|
|
75
|
+
<Box width="fill">fill</Box>
|
|
76
|
+
<Box width="fill">fill</Box>
|
|
77
77
|
<Box width="25%">25%</Box>
|
|
78
78
|
</HStack>
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
---
|
|
82
82
|
|
|
83
|
-
Using `Spacer` components between the `Box` components with width set to `
|
|
83
|
+
Using `Spacer` components between the `Box` components with width set to `fill` evenly distributes space
|
|
84
84
|
between the elements. This is useful when you want to create consistent gaps between
|
|
85
85
|
components without needing to specify exact widths.
|
|
86
86
|
|
|
@@ -88,9 +88,9 @@ components without needing to specify exact widths.
|
|
|
88
88
|
<HStack height="100px">
|
|
89
89
|
<Rect color="#abdef0" width="25%">25%</Rect>
|
|
90
90
|
<Spacer />
|
|
91
|
-
<Rect color="#89d9c8" width="
|
|
91
|
+
<Rect color="#89d9c8" width="fill">fill</Rect>
|
|
92
92
|
<Spacer />
|
|
93
|
-
<Rect color="#89d9c8" width="
|
|
93
|
+
<Rect color="#89d9c8" width="fill">fill</Rect>
|
|
94
94
|
<Spacer />
|
|
95
95
|
<Rect color="#abdef0" width="25%">25%</Rect>
|
|
96
96
|
</HStack>
|
|
@@ -100,9 +100,9 @@ components without needing to specify exact widths.
|
|
|
100
100
|
<HStack height="100px">
|
|
101
101
|
<Box width="25%">25%</Box>
|
|
102
102
|
<Spacer />
|
|
103
|
-
<Box width="
|
|
103
|
+
<Box width="fill">fill</Box>
|
|
104
104
|
<Spacer />
|
|
105
|
-
<Box width="
|
|
105
|
+
<Box width="fill">fill</Box>
|
|
106
106
|
<Spacer />
|
|
107
107
|
<Box width="25%">25%</Box>
|
|
108
108
|
</HStack>
|
|
@@ -118,9 +118,9 @@ automatically fill the available space.
|
|
|
118
118
|
<HStack height="100px">
|
|
119
119
|
<Rect width="25%" color="#abdef0">25%</Rect>
|
|
120
120
|
<Spacer width="10px" />
|
|
121
|
-
<Rect width="
|
|
121
|
+
<Rect width="fill" color="#89d9c8">fill</Rect>
|
|
122
122
|
<Spacer width="10px" />
|
|
123
|
-
<Rect width="
|
|
123
|
+
<Rect width="fill" color="#89d9c8">fill</Rect>
|
|
124
124
|
<Spacer width="10px" />
|
|
125
125
|
<Rect width="25%" color="#abdef0">25%</Rect>
|
|
126
126
|
</HStack>
|
|
@@ -130,9 +130,9 @@ automatically fill the available space.
|
|
|
130
130
|
<HStack height="100px">
|
|
131
131
|
<Box width="25%">25%</Box>
|
|
132
132
|
<Spacer width="10px" />
|
|
133
|
-
<Box width="
|
|
133
|
+
<Box width="fill">fill</Box>
|
|
134
134
|
<Spacer width="10px" />
|
|
135
|
-
<Box width="
|
|
135
|
+
<Box width="fill">fill</Box>
|
|
136
136
|
<Spacer width="10px" />
|
|
137
137
|
<Box width="25%">25%</Box>
|
|
138
138
|
</HStack>
|
|
@@ -143,13 +143,13 @@ automatically fill the available space.
|
|
|
143
143
|
### VStack
|
|
144
144
|
|
|
145
145
|
This example uses `VStack` to arrange elements vertically. The `Box` components at the top
|
|
146
|
-
and bottom occupy 25% of the height each, while the `Box` with height set to `
|
|
146
|
+
and bottom occupy 25% of the height each, while the `Box` with height set to `fill` fills the remaining space,
|
|
147
147
|
making it ideal for creating header-body-footer layouts.
|
|
148
148
|
|
|
149
149
|
<StyleBox height="400px" padding="10px" border="1px solid #ccc">
|
|
150
150
|
<VStack height="100%">
|
|
151
151
|
<Rect height="25%" color="#abdef0">25%</Rect>
|
|
152
|
-
<Rect height="
|
|
152
|
+
<Rect height="fill" color="#89d9c8">fill</Rect>
|
|
153
153
|
<Rect height="25%" color="#abdef0">25%</Rect>
|
|
154
154
|
</VStack>
|
|
155
155
|
</StyleBox>
|
|
@@ -157,7 +157,7 @@ making it ideal for creating header-body-footer layouts.
|
|
|
157
157
|
```tsx
|
|
158
158
|
<VStack height="100%">
|
|
159
159
|
<Box height="25%">25%</Box>
|
|
160
|
-
<Box height="
|
|
160
|
+
<Box height="fill">fill</Box>
|
|
161
161
|
<Box height="25%">25%</Box>
|
|
162
162
|
</VStack>
|
|
163
163
|
```
|
|
@@ -170,7 +170,7 @@ prop to create consistent gaps between the header, body, and footer sections.
|
|
|
170
170
|
<StyleBox height="400px" width="100%" padding="10px" border="1px solid #ccc">
|
|
171
171
|
<VStack height="100%" gap="10px">
|
|
172
172
|
<Rect height="40px" color="#abdef0">Header</Rect>
|
|
173
|
-
<Rect height="
|
|
173
|
+
<Rect height="fill" color="#ededed">Body</Rect>
|
|
174
174
|
<Rect height="40px" color="#abdef0">Footer</Rect>
|
|
175
175
|
</VStack>
|
|
176
176
|
</StyleBox>
|
|
@@ -178,7 +178,7 @@ prop to create consistent gaps between the header, body, and footer sections.
|
|
|
178
178
|
```tsx
|
|
179
179
|
<VStack height="100%" gap="10px">
|
|
180
180
|
<Box height="40px">Header</Box>
|
|
181
|
-
<Box height="
|
|
181
|
+
<Box height="fill">Body</Box>
|
|
182
182
|
<Box height="40px">Footer</Box>
|
|
183
183
|
</VStack>
|
|
184
184
|
```
|
|
@@ -192,9 +192,9 @@ between the header, sidebar, and footer sections.
|
|
|
192
192
|
<StyleBox height="400px" width="100%" padding="10px" border="1px solid #ccc">
|
|
193
193
|
<VStack height="100%" gap="10px">
|
|
194
194
|
<Rect height="40px" color="#abdef0">Header</Rect>
|
|
195
|
-
<HStack height="
|
|
195
|
+
<HStack height="fill" gap="10px">
|
|
196
196
|
<Rect width="200px" minWidth="200px" height="100%" zIndex="1" enableResizeOnEnd color="#ededed">Sidebar</Rect>
|
|
197
|
-
<Rect width="
|
|
197
|
+
<Rect width="fill" height="100%" color="#ededed">
|
|
198
198
|
<VStack width="100%" height="100%" overflowY="auto">
|
|
199
199
|
<Grid itemHeight={100} itemWidth={100} columnAmount={4} gap="10px" padding="10px">
|
|
200
200
|
<Rect width="100%" height="100%" color="#abdef0">1</Rect>
|
|
@@ -218,9 +218,9 @@ between the header, sidebar, and footer sections.
|
|
|
218
218
|
```tsx
|
|
219
219
|
<VStack height="100%" gap="10px">
|
|
220
220
|
<Box height="40px">Header</Box>
|
|
221
|
-
<HStack height="
|
|
221
|
+
<HStack height="fill" gap="10px">
|
|
222
222
|
<Box width="200px" minWidth="200px" height="100%" zIndex="1" enableResizeOnEnd>Sidebar</Box>
|
|
223
|
-
<VStack width="
|
|
223
|
+
<VStack width="fill" height="100%" overflowY="auto">
|
|
224
224
|
<Grid itemHeight={100} itemWidth={100} columnAmount={4} gap="10px" padding="10px">
|
|
225
225
|
<Box width="100%" height="100%">1</Box>
|
|
226
226
|
<Box width="100%" height="100%">2</Box>
|
|
@@ -3,10 +3,10 @@ import { Alignment } from './alignment.js';
|
|
|
3
3
|
export interface StackStyleProps {
|
|
4
4
|
hAlign?: Alignment;
|
|
5
5
|
vAlign?: Alignment;
|
|
6
|
-
width?: 'default' | 'flex' | 'auto' | string | number;
|
|
6
|
+
width?: 'default' | 'flex' | 'auto' | 'fill' | string | number;
|
|
7
7
|
minWidth?: string | number;
|
|
8
8
|
maxWidth?: string | number;
|
|
9
|
-
height?: 'default' | 'flex' | 'auto' | string | number;
|
|
9
|
+
height?: 'default' | 'flex' | 'auto' | 'fill' | string | number;
|
|
10
10
|
minHeight?: string | number;
|
|
11
11
|
maxHeight?: string | number;
|
|
12
12
|
growWeight?: number;
|