@heliosgraphics/ui 2.0.0-alpha.98 → 2.0.1-alpha.0
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/components/Button/Button.spec.tsx +1 -1
- package/components/ButtonGroup/ButtonGroup.spec.tsx +1 -1
- package/components/Checkbox/Checkbox.types.ts +2 -2
- package/components/Clock/Clock.tsx +1 -17
- package/components/Clock/Clock.utils.ts +16 -0
- package/components/Debug/Debug.tsx +1 -1
- package/components/Dialog/Dialog.meta.ts +2 -2
- package/components/Dialog/Dialog.tsx +3 -2
- package/components/Dialog/Dialog.types.ts +1 -1
- package/components/Dot/Dot.spec.tsx +1 -1
- package/components/Flex/Flex.tsx +6 -1
- package/components/Flex/Flex.utils.spec.ts +3 -3
- package/components/Input/Input.meta.ts +1 -1
- package/components/Input/Input.tsx +2 -2
- package/components/Input/Input.types.ts +1 -1
- package/components/Layout/components/LayoutAside/components/LayoutAsideToggle/LayoutAsideToggle.tsx +2 -0
- package/components/Layout/components/LayoutAside/index.ts +3 -3
- package/components/Layout/components/LayoutMain/components/LayoutMainContent/LayoutMainContent.tsx +7 -1
- package/components/Layout/components/LayoutMain/index.ts +1 -1
- package/components/Layout/index.ts +1 -1
- package/components/Markdown/Markdown.utils.spec.ts +1 -1
- package/components/Menu/components/MenuFilter/MenuFilter.tsx +1 -1
- package/components/Menu/index.ts +3 -3
- package/components/Radio/Radio.meta.ts +3 -3
- package/components/Radio/Radio.types.ts +3 -3
- package/components/Segments/Segments.tsx +3 -3
- package/components/Segments/components/SegmentButton/SegmentButton.tsx +17 -3
- package/components/Segments/index.ts +1 -1
- package/components/Separator/Separator.spec.tsx +1 -1
- package/components/Setup/Setup.tsx +1 -1
- package/components/Tabs/Tabs.tsx +0 -2
- package/components/Text/Text.utils.spec.ts +1 -1
- package/components/Timestamp/Timestamp.meta.ts +2 -2
- package/components/Timestamp/Timestamp.tsx +2 -2
- package/components/Timestamp/Timestamp.types.ts +1 -1
- package/components/Toggle/Toggle.meta.ts +3 -3
- package/components/Toggle/Toggle.types.ts +3 -3
- package/contexts/LayoutContext/LayoutContext.tsx +3 -3
- package/contexts/LayoutContext/LayoutContext.types.ts +1 -1
- package/hooks/useLayoutContext.tsx +1 -1
- package/package.json +4 -10
- /package/components/Segments/{Segments.context.ts → Segments.utils.ts} +0 -0
- /package/components/Setup/{Setup.components.css → Setup.global.css} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChangeEventHandler } from "react"
|
|
2
2
|
import type { HeliosColorType } from "../../types/colors"
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface CheckboxBaseProps {
|
|
5
5
|
color?: HeliosColorType
|
|
6
6
|
description?: string
|
|
7
7
|
isChecked?: boolean
|
|
@@ -14,4 +14,4 @@ export interface BaseCheckboxProps {
|
|
|
14
14
|
onChange?: ChangeEventHandler<HTMLInputElement>
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export interface CheckboxProps extends
|
|
17
|
+
export interface CheckboxProps extends CheckboxBaseProps {}
|
|
@@ -2,26 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { useId, useState, useEffect } from "react"
|
|
4
4
|
import styles from "./Clock.module.css"
|
|
5
|
+
import { getRotation } from "./Clock.utils"
|
|
5
6
|
import type { FC } from "react"
|
|
6
7
|
import type { ClockProps } from "./Clock.types"
|
|
7
8
|
|
|
8
|
-
const getRotation = (time: Date, type: "hours" | "minutes" | "seconds"): string => {
|
|
9
|
-
const hours = time.getHours() % 12
|
|
10
|
-
const minutes = time.getMinutes()
|
|
11
|
-
const seconds = time.getSeconds()
|
|
12
|
-
|
|
13
|
-
switch (type) {
|
|
14
|
-
case "hours":
|
|
15
|
-
return `rotate(${(hours + minutes / 60) * 30 - 180}, 0, 0)`
|
|
16
|
-
case "minutes":
|
|
17
|
-
return `rotate(${minutes * 6 - 180}, 0, 0)`
|
|
18
|
-
case "seconds":
|
|
19
|
-
return `rotate(${seconds * 6 - 180}, 0, 0)`
|
|
20
|
-
default:
|
|
21
|
-
return ""
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
9
|
export const Clock: FC<ClockProps> = () => {
|
|
26
10
|
const titleId: string = useId()
|
|
27
11
|
const [time, setTime] = useState(() => new Date())
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const getRotation = (time: Date, type: "hours" | "minutes" | "seconds"): string => {
|
|
2
|
+
const hours = time.getHours() % 12
|
|
3
|
+
const minutes = time.getMinutes()
|
|
4
|
+
const seconds = time.getSeconds()
|
|
5
|
+
|
|
6
|
+
switch (type) {
|
|
7
|
+
case "hours":
|
|
8
|
+
return `rotate(${(hours + minutes / 60) * 30 - 180}, 0, 0)`
|
|
9
|
+
case "minutes":
|
|
10
|
+
return `rotate(${minutes * 6 - 180}, 0, 0)`
|
|
11
|
+
case "seconds":
|
|
12
|
+
return `rotate(${seconds * 6 - 180}, 0, 0)`
|
|
13
|
+
default:
|
|
14
|
+
return ""
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -19,7 +19,7 @@ export const Debug: FC<DebugProps> = ({ color = "gray", appearance = "dark" }) =
|
|
|
19
19
|
const [isClosed, setIsClosed] = useState(false)
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<Flex className={debugClasses} data-ui-component="Debug">
|
|
22
|
+
<Flex className={debugClasses} role="status" data-ui-component="Debug">
|
|
23
23
|
<Flex isColumn={true} gap={4}>
|
|
24
24
|
<Text type="micro" fontFamily="mono" emphasis="secondary">
|
|
25
25
|
color: {color}, appearance: {appearance}
|
|
@@ -12,7 +12,7 @@ export const meta: HeliosAttributeMeta<DialogBaseProps> = {
|
|
|
12
12
|
{
|
|
13
13
|
id: "ui-dialog-no-padding",
|
|
14
14
|
description: "default dialog without content padding",
|
|
15
|
-
content: `<Dialog isOpen={IS_OPEN} onClose={ON_TOGGLE_OPEN} title="Hello World" isNarrow={IS_NARROW} isCentered={IS_CENTERED}
|
|
15
|
+
content: `<Dialog isOpen={IS_OPEN} onClose={ON_TOGGLE_OPEN} title="Hello World" isNarrow={IS_NARROW} isCentered={IS_CENTERED} hasNoPadding={true}>{CHILDREN}</Dialog>`,
|
|
16
16
|
},
|
|
17
17
|
],
|
|
18
18
|
_status: "nominal",
|
|
@@ -29,7 +29,7 @@ export const meta: HeliosAttributeMeta<DialogBaseProps> = {
|
|
|
29
29
|
type: "boolean",
|
|
30
30
|
isOptional: true,
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
hasNoPadding: {
|
|
33
33
|
type: "boolean",
|
|
34
34
|
description: "Removes padding from the Dialog content.",
|
|
35
35
|
isOptional: true,
|
|
@@ -16,7 +16,7 @@ export const Dialog: FC<DialogProps> = ({
|
|
|
16
16
|
isOpen,
|
|
17
17
|
isCentered,
|
|
18
18
|
onClose,
|
|
19
|
-
|
|
19
|
+
hasNoPadding,
|
|
20
20
|
role,
|
|
21
21
|
}) => {
|
|
22
22
|
const dialogRef = useRef<HTMLDialogElement | null>(null)
|
|
@@ -69,7 +69,7 @@ export const Dialog: FC<DialogProps> = ({
|
|
|
69
69
|
})
|
|
70
70
|
const dialogFlexClasses: string = getClasses(styles.dialog__header, "sticky top-0 z-50 ui-bg-glass")
|
|
71
71
|
const dialogContentClasses: string = getClasses(styles.dialog__content, {
|
|
72
|
-
[styles.dialog__contentNoPadding]:
|
|
72
|
+
[styles.dialog__contentNoPadding]: hasNoPadding,
|
|
73
73
|
})
|
|
74
74
|
|
|
75
75
|
return (
|
|
@@ -79,6 +79,7 @@ export const Dialog: FC<DialogProps> = ({
|
|
|
79
79
|
onClick={onDialogClose}
|
|
80
80
|
onCancel={onCancel}
|
|
81
81
|
role={role}
|
|
82
|
+
aria-modal="true"
|
|
82
83
|
data-ui-component="Dialog"
|
|
83
84
|
>
|
|
84
85
|
{!!title && (
|
package/components/Flex/Flex.tsx
CHANGED
|
@@ -15,7 +15,12 @@ export const Flex: FC<FlexProps> = (props) => {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const a11yProps = restProps.onClick
|
|
18
|
-
? {
|
|
18
|
+
? {
|
|
19
|
+
role: (restProps.role ?? "button") as string,
|
|
20
|
+
tabIndex: restProps.tabIndex ?? 0,
|
|
21
|
+
onKeyDown: handleKeyDown,
|
|
22
|
+
"aria-label": restProps["aria-label"],
|
|
23
|
+
}
|
|
19
24
|
: {}
|
|
20
25
|
|
|
21
26
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { it, describe, expect } from "
|
|
1
|
+
import { it, describe, expect } from "bun:test"
|
|
2
2
|
import { getFlexUtility, getSafeFlexProps } from "./Flex.utils"
|
|
3
3
|
import type { FlexProps } from "./Flex.types"
|
|
4
4
|
|
|
@@ -86,11 +86,11 @@ describe("getSafeFlexProps", () => {
|
|
|
86
86
|
xAlign: "start",
|
|
87
87
|
yAlign: "start",
|
|
88
88
|
}
|
|
89
|
-
const MOCK_FLEX_ATTRIBUTES_SAFE
|
|
89
|
+
const MOCK_FLEX_ATTRIBUTES_SAFE = {
|
|
90
90
|
children: null,
|
|
91
91
|
className: "xo",
|
|
92
92
|
draggable: true,
|
|
93
|
-
}
|
|
93
|
+
} as Record<string, unknown>
|
|
94
94
|
|
|
95
95
|
it("Generates without invalid attributes", () =>
|
|
96
96
|
expect(getSafeFlexProps(MOCK_FLEX_ATTRIBUTES)).toEqual(MOCK_FLEX_ATTRIBUTES_SAFE))
|
|
@@ -43,7 +43,7 @@ export const meta: HeliosAttributeMeta<InputProps> = {
|
|
|
43
43
|
onKeyUp: { type: "string", isOptional: true },
|
|
44
44
|
placeholder: { type: "string", isOptional: true },
|
|
45
45
|
results: { type: "Array<ResultItem>", isOptional: true },
|
|
46
|
-
|
|
46
|
+
isResultsVisible: { type: "boolean", isOptional: true },
|
|
47
47
|
type: {
|
|
48
48
|
type: '"text" | "email" | "date" | "time" | "password"',
|
|
49
49
|
isOptional: true,
|
|
@@ -36,7 +36,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
36
36
|
onKeyUp,
|
|
37
37
|
placeholder,
|
|
38
38
|
results,
|
|
39
|
-
|
|
39
|
+
isResultsVisible,
|
|
40
40
|
type = "text",
|
|
41
41
|
value,
|
|
42
42
|
},
|
|
@@ -56,7 +56,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
56
56
|
})
|
|
57
57
|
.filter(Boolean) || []
|
|
58
58
|
|
|
59
|
-
const showingResults: boolean = Boolean(!!filteredItems?.length &&
|
|
59
|
+
const showingResults: boolean = Boolean(!!filteredItems?.length && isResultsVisible)
|
|
60
60
|
|
|
61
61
|
const inputClasses: string = getClasses(styles.input, "relative flex flex-column", className, {
|
|
62
62
|
[styles.inputDisabled]: isDisabled,
|
package/components/Layout/components/LayoutAside/components/LayoutAsideToggle/LayoutAsideToggle.tsx
CHANGED
|
@@ -21,6 +21,8 @@ export const LayoutAsideToggle: FC<LayoutAsideToggleProps> = () => {
|
|
|
21
21
|
data-ui-layout-ignore="true"
|
|
22
22
|
onClick={isMenuVisible ? onAsideClose : onNavigationToggle}
|
|
23
23
|
size="small"
|
|
24
|
+
aria-expanded={isMenuVisible}
|
|
25
|
+
aria-label={isMenuVisible ? "Close navigation" : "Open navigation"}
|
|
24
26
|
/>
|
|
25
27
|
</ButtonGroup>
|
|
26
28
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LayoutAsideComposition } from "./LayoutAside.types"
|
|
2
|
-
import { LayoutAsideContent } from "./components/LayoutAsideContent
|
|
3
|
-
import { LayoutAsideFooter } from "./components/LayoutAsideFooter
|
|
4
|
-
import { LayoutAsideToggle } from "./components/LayoutAsideToggle
|
|
2
|
+
import { LayoutAsideContent } from "./components/LayoutAsideContent"
|
|
3
|
+
import { LayoutAsideFooter } from "./components/LayoutAsideFooter"
|
|
4
|
+
import { LayoutAsideToggle } from "./components/LayoutAsideToggle"
|
|
5
5
|
import { LayoutAside as LAC } from "./LayoutAside"
|
|
6
6
|
|
|
7
7
|
const LayoutAsideComponent = LAC as LayoutAsideComposition
|
package/components/Layout/components/LayoutMain/components/LayoutMainContent/LayoutMainContent.tsx
CHANGED
|
@@ -34,7 +34,13 @@ export const LayoutMainContent: FC<LayoutMainContentProps> = (props) => {
|
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
|
-
<section
|
|
37
|
+
<section
|
|
38
|
+
{...safeProps}
|
|
39
|
+
ref={contentRef}
|
|
40
|
+
className={mainContentClasses}
|
|
41
|
+
role="main"
|
|
42
|
+
data-ui-component="Main.Content"
|
|
43
|
+
>
|
|
38
44
|
{props.children}
|
|
39
45
|
</section>
|
|
40
46
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LayoutMainComposition } from "./LayoutMain.types"
|
|
2
|
-
import { LayoutMainContent } from "./components/LayoutMainContent
|
|
2
|
+
import { LayoutMainContent } from "./components/LayoutMainContent"
|
|
3
3
|
import { LayoutMain as SC } from "./LayoutMain"
|
|
4
4
|
|
|
5
5
|
const LayoutMainComponent = SC as LayoutMainComposition
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LayoutComposition } from "./Layout.types"
|
|
2
2
|
import { LayoutAside } from "./components/LayoutAside"
|
|
3
3
|
import { LayoutMain } from "./components/LayoutMain"
|
|
4
|
-
import { LayoutNavigation } from "./components/LayoutNavigation
|
|
4
|
+
import { LayoutNavigation } from "./components/LayoutNavigation"
|
|
5
5
|
import { LayoutSubNavigation } from "./components/LayoutSubNavigation"
|
|
6
6
|
import { Layout as LC } from "./Layout"
|
|
7
7
|
import type { LayoutAsideComposition } from "./components/LayoutAside/LayoutAside.types"
|
|
@@ -8,7 +8,7 @@ export const MenuFilter: FC<MenuFilterProps> = ({ value, onClear, onChange }) =>
|
|
|
8
8
|
const menuFilterClasses: string = getClasses(styles.menuFilter, "ui-bg-glass")
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
|
-
<div className={menuFilterClasses} data-ui-component="Menu.Filter">
|
|
11
|
+
<div className={menuFilterClasses} role="search" data-ui-component="Menu.Filter">
|
|
12
12
|
<Input
|
|
13
13
|
{...(onClear && { onClear })}
|
|
14
14
|
placeholder="Search"
|
package/components/Menu/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MenuComposition } from "./Menu.types"
|
|
2
|
-
import { MenuCategory } from "./components/MenuCategory
|
|
3
|
-
import { MenuFilter } from "./components/MenuFilter
|
|
4
|
-
import { MenuItem } from "./components/MenuItem
|
|
2
|
+
import { MenuCategory } from "./components/MenuCategory"
|
|
3
|
+
import { MenuFilter } from "./components/MenuFilter"
|
|
4
|
+
import { MenuItem } from "./components/MenuItem"
|
|
5
5
|
import { Menu as SC } from "./Menu"
|
|
6
6
|
|
|
7
7
|
const MenuComponent = SC as MenuComposition
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HeliosAttributeMeta } from "../../types/meta"
|
|
2
|
-
import type {
|
|
2
|
+
import type { RadioBaseProps } from "./Radio.types"
|
|
3
3
|
|
|
4
|
-
export const meta: HeliosAttributeMeta<
|
|
4
|
+
export const meta: HeliosAttributeMeta<RadioBaseProps> = {
|
|
5
5
|
_patterns: [
|
|
6
6
|
{
|
|
7
7
|
id: "ui-radio-default",
|
|
@@ -11,7 +11,7 @@ export const meta: HeliosAttributeMeta<BaseRadioProps> = {
|
|
|
11
11
|
],
|
|
12
12
|
_status: "nominal",
|
|
13
13
|
_category: "core",
|
|
14
|
-
_extends: ["
|
|
14
|
+
_extends: ["CheckboxBaseProps"],
|
|
15
15
|
name: {
|
|
16
16
|
type: "string",
|
|
17
17
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CheckboxBaseProps } from "../Checkbox/Checkbox.types"
|
|
2
2
|
|
|
3
|
-
export interface
|
|
3
|
+
export interface RadioBaseProps {
|
|
4
4
|
name: string
|
|
5
5
|
value: string
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export type RadioProps =
|
|
8
|
+
export type RadioProps = RadioBaseProps & CheckboxBaseProps
|
|
@@ -4,7 +4,7 @@ import { type FC, useState, useRef, useEffect, useCallback } from "react"
|
|
|
4
4
|
import { Flex } from "../Flex"
|
|
5
5
|
import styles from "./Segments.module.css"
|
|
6
6
|
import { getClasses } from "@heliosgraphics/utils"
|
|
7
|
-
import { SegmentsContext } from "./Segments.
|
|
7
|
+
import { SegmentsContext } from "./Segments.utils"
|
|
8
8
|
import type { SegmentsProps } from "./Segments.types"
|
|
9
9
|
|
|
10
10
|
export const Segments: FC<SegmentsProps> = ({ children, isFullWidth, isSmall, defaultValue }) => {
|
|
@@ -32,12 +32,12 @@ export const Segments: FC<SegmentsProps> = ({ children, isFullWidth, isSmall, de
|
|
|
32
32
|
}, [activeValue])
|
|
33
33
|
|
|
34
34
|
useEffect(() => {
|
|
35
|
-
const
|
|
35
|
+
const frameId: number = requestAnimationFrame(updateSliderPosition)
|
|
36
36
|
|
|
37
37
|
globalThis.addEventListener("resize", updateSliderPosition)
|
|
38
38
|
|
|
39
39
|
return (): void => {
|
|
40
|
-
|
|
40
|
+
cancelAnimationFrame(frameId)
|
|
41
41
|
globalThis.removeEventListener("resize", updateSliderPosition)
|
|
42
42
|
}
|
|
43
43
|
}, [updateSliderPosition])
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
1
3
|
import styles from "./SegmentButton.module.css"
|
|
2
4
|
import { getClasses } from "@heliosgraphics/utils"
|
|
3
5
|
import { Icon } from "../../../Icon"
|
|
4
|
-
import { useSegments } from "../../Segments.
|
|
5
|
-
import { useCallback, type FC } from "react"
|
|
6
|
+
import { useSegments } from "../../Segments.utils"
|
|
7
|
+
import { useCallback, useEffect, type FC } from "react"
|
|
6
8
|
import type { HeliosIconType } from "../../../../types/icons"
|
|
7
9
|
import type { SegmentButtonProps } from "./SegmentButton.types"
|
|
8
10
|
|
|
@@ -17,6 +19,12 @@ export const SegmentButton: FC<SegmentButtonProps> = ({
|
|
|
17
19
|
const { activeValue, onSelect, registerRef } = useSegments()
|
|
18
20
|
const isActive: boolean = isActiveProp ?? value === activeValue
|
|
19
21
|
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (isActiveProp) {
|
|
24
|
+
onSelect(value)
|
|
25
|
+
}
|
|
26
|
+
}, [isActiveProp, value, onSelect])
|
|
27
|
+
|
|
20
28
|
const segmentButtonClasses: string = getClasses(styles.segmentButton, {
|
|
21
29
|
[styles.segmentButtonActive]: isActive,
|
|
22
30
|
})
|
|
@@ -36,7 +44,13 @@ export const SegmentButton: FC<SegmentButtonProps> = ({
|
|
|
36
44
|
)
|
|
37
45
|
|
|
38
46
|
return (
|
|
39
|
-
<button
|
|
47
|
+
<button
|
|
48
|
+
ref={handleRef}
|
|
49
|
+
className={segmentButtonClasses}
|
|
50
|
+
onClick={handleClick}
|
|
51
|
+
aria-pressed={isActive}
|
|
52
|
+
data-ui-component="SegmentButton"
|
|
53
|
+
>
|
|
40
54
|
{iconL && <Icon icon={iconL} size={16} />}
|
|
41
55
|
{value}
|
|
42
56
|
{iconRight && <Icon icon={iconRight} size={16} />}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SegmentsComposition } from "./Segments.types"
|
|
2
|
-
import { SegmentButton } from "./components/SegmentButton
|
|
2
|
+
import { SegmentButton } from "./components/SegmentButton"
|
|
3
3
|
import { Segments as SC } from "./Segments"
|
|
4
4
|
|
|
5
5
|
const SegmentedComponent = SC as SegmentsComposition
|
package/components/Tabs/Tabs.tsx
CHANGED
|
@@ -6,7 +6,7 @@ export const meta: HeliosAttributeMeta<TimestampProps> = {
|
|
|
6
6
|
{
|
|
7
7
|
id: "ui-timestamp-default",
|
|
8
8
|
description: "default",
|
|
9
|
-
content: `<Timestamp date={DATE}
|
|
9
|
+
content: `<Timestamp date={DATE} isRelative={false} format={DATE_FORMAT}/>`,
|
|
10
10
|
},
|
|
11
11
|
],
|
|
12
12
|
_status: "nominal",
|
|
@@ -17,6 +17,6 @@ export const meta: HeliosAttributeMeta<TimestampProps> = {
|
|
|
17
17
|
isOptional: true,
|
|
18
18
|
default: "{ year: numeric, month: long, day: numeric }",
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
isRelative: { type: "boolean", isOptional: true },
|
|
21
21
|
text: { type: "string", isOptional: true },
|
|
22
22
|
}
|
|
@@ -2,13 +2,13 @@ import { getIsValid, formatDate, getFromNow } from "../../utils/date"
|
|
|
2
2
|
import type { FC } from "react"
|
|
3
3
|
import type { TimestampProps } from "./Timestamp.types"
|
|
4
4
|
|
|
5
|
-
export const Timestamp: FC<TimestampProps> = ({ date,
|
|
5
|
+
export const Timestamp: FC<TimestampProps> = ({ date, isRelative, text, format }) => {
|
|
6
6
|
const fromNowDate = getFromNow(date)
|
|
7
7
|
const isValid: boolean = getIsValid(date)
|
|
8
8
|
const parsedIsoString: string = date && isValid ? new Date(Date.parse(date))?.toISOString() : ""
|
|
9
9
|
|
|
10
10
|
const timestampDate: string = isValid ? parsedIsoString : ""
|
|
11
|
-
const formattedDate: string =
|
|
11
|
+
const formattedDate: string = isRelative ? fromNowDate : formatDate(date, format)
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<time dateTime={timestampDate} suppressHydrationWarning={true} data-ui-component="Timestamp">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HeliosAttributeMeta } from "../../types/meta"
|
|
2
|
-
import type {
|
|
2
|
+
import type { ToggleBaseProps } from "./Toggle.types"
|
|
3
3
|
|
|
4
|
-
export const meta: HeliosAttributeMeta<
|
|
4
|
+
export const meta: HeliosAttributeMeta<ToggleBaseProps> = {
|
|
5
5
|
_patterns: [
|
|
6
6
|
{
|
|
7
7
|
id: "ui-toggle-default",
|
|
@@ -26,7 +26,7 @@ export const meta: HeliosAttributeMeta<BaseToggleProps> = {
|
|
|
26
26
|
],
|
|
27
27
|
_status: "nominal",
|
|
28
28
|
_category: "core",
|
|
29
|
-
_extends: ["
|
|
29
|
+
_extends: ["CheckboxBaseProps"],
|
|
30
30
|
intent: {
|
|
31
31
|
type: "HeliosIntentionType",
|
|
32
32
|
default: "neutral",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { HeliosIntentionType } from "../../types/intentions"
|
|
2
|
-
import type {
|
|
2
|
+
import type { CheckboxBaseProps } from "../Checkbox/Checkbox.types"
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface ToggleBaseProps {
|
|
5
5
|
intent?: HeliosIntentionType
|
|
6
6
|
style?: "toggle" | "switch"
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export type ToggleProps =
|
|
9
|
+
export type ToggleProps = ToggleBaseProps & CheckboxBaseProps
|
|
@@ -69,7 +69,7 @@ const LayoutProvider: FC<LayoutProviderProps> = ({ children, breakpoint = 960 })
|
|
|
69
69
|
}
|
|
70
70
|
}, [breakpoint])
|
|
71
71
|
|
|
72
|
-
const
|
|
72
|
+
const isNavigationVisible: boolean = isWideEnough || isMenuVisible
|
|
73
73
|
|
|
74
74
|
const onNavigationToggle = useCallback((): void => setIsMenuVisible((prev) => !prev), [])
|
|
75
75
|
const onAsideClose = useCallback((): void => setIsMenuVisible(false), [])
|
|
@@ -82,9 +82,9 @@ const LayoutProvider: FC<LayoutProviderProps> = ({ children, breakpoint = 960 })
|
|
|
82
82
|
isWideEnough,
|
|
83
83
|
onAsideClose,
|
|
84
84
|
onNavigationToggle,
|
|
85
|
-
|
|
85
|
+
isNavigationVisible,
|
|
86
86
|
}),
|
|
87
|
-
[hasMounted, isMenuVisible, isWideEnough,
|
|
87
|
+
[hasMounted, isMenuVisible, isWideEnough, isNavigationVisible, onAsideClose, onNavigationToggle],
|
|
88
88
|
)
|
|
89
89
|
|
|
90
90
|
return <LayoutContext.Provider value={contextValue}>{children}</LayoutContext.Provider>
|
|
@@ -11,7 +11,7 @@ const DEFAULT_LAYOUT_CONTEXT: LayoutContextProps = {
|
|
|
11
11
|
isWideEnough: true,
|
|
12
12
|
onAsideClose: () => {},
|
|
13
13
|
onNavigationToggle: () => {},
|
|
14
|
-
|
|
14
|
+
isNavigationVisible: true,
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export const useLayoutContext = (): LayoutContextProps => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heliosgraphics/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-alpha.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css",
|
|
@@ -35,10 +35,8 @@
|
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
37
|
"pub:components": "bun publish --access public",
|
|
38
|
-
"test": "
|
|
39
|
-
"test:
|
|
40
|
-
"test:update": "NODE_ENV=test vitest run --update",
|
|
41
|
-
"test:watch": "NODE_ENV=test vitest",
|
|
38
|
+
"test": "bun test",
|
|
39
|
+
"test:watch": "bun test --watch",
|
|
42
40
|
"ts:watch": "tsc --noEmit --incremental --watch"
|
|
43
41
|
},
|
|
44
42
|
"dependencies": {
|
|
@@ -52,17 +50,13 @@
|
|
|
52
50
|
"devDependencies": {
|
|
53
51
|
"@testing-library/react": "^16.3.2",
|
|
54
52
|
"@types/node": "^25",
|
|
55
|
-
"@vitejs/plugin-react": "^5.1.4",
|
|
56
|
-
"@vitest/coverage-v8": "^4.0.18",
|
|
57
53
|
"esbuild": "^0.27.3",
|
|
58
54
|
"esbuild-css-modules-plugin": "^3.1.5",
|
|
59
55
|
"glob": "^13.0.6",
|
|
60
56
|
"jsdom": "^28.1.0",
|
|
61
57
|
"next": "^16.1.6",
|
|
62
58
|
"prettier": "^3.8.1",
|
|
63
|
-
"typescript": "^5.9.3"
|
|
64
|
-
"vite": "^7.3.1",
|
|
65
|
-
"vitest": "^4.0.18"
|
|
59
|
+
"typescript": "^5.9.3"
|
|
66
60
|
},
|
|
67
61
|
"peerDependencies": {
|
|
68
62
|
"@types/react": "^19",
|
|
File without changes
|
|
File without changes
|