@infonomic/uikit 5.43.0 → 5.44.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/dist/components/accordion/accordion.js +5 -5
- package/dist/components/accordion/accordion.module.js +1 -1
- package/dist/components/avatar/avatar.module.js +1 -1
- package/dist/components/badge/badge.module.js +1 -1
- package/dist/components/button/button-group.module.js +1 -1
- package/dist/components/button/button.module.js +1 -1
- package/dist/components/button/button_module.css +8 -3
- package/dist/components/button/combo-button.module.js +1 -1
- package/dist/components/button/control-buttons.module.js +1 -1
- package/dist/components/button/copy-button.module.js +1 -1
- package/dist/components/card/card.module.js +1 -1
- package/dist/components/chips/chip.module.js +1 -1
- package/dist/components/chips/chip_module.css +2 -1
- package/dist/components/container/container.module.js +1 -1
- package/dist/components/dropdown/dropdown.js +11 -11
- package/dist/components/dropdown/dropdown.module.js +1 -1
- package/dist/components/forms/calendar.module.js +1 -1
- package/dist/components/forms/checkbox.module.js +1 -1
- package/dist/components/forms/error-text.module.js +1 -1
- package/dist/components/forms/help-text.module.js +1 -1
- package/dist/components/forms/input-adornment.module.js +1 -1
- package/dist/components/forms/input.module.js +1 -1
- package/dist/components/forms/label.module.js +1 -1
- package/dist/components/forms/radio-group.js +1 -1
- package/dist/components/forms/radio-group.module.js +1 -1
- package/dist/components/forms/select.js +1 -1
- package/dist/components/forms/select.module.js +1 -1
- package/dist/components/forms/text-area.module.js +1 -1
- package/dist/components/hamburger/hamburger.astro +23 -15
- package/dist/components/hamburger/hamburger.d.ts +8 -6
- package/dist/components/hamburger/hamburger.d.ts.map +1 -1
- package/dist/components/hamburger/hamburger.js +18 -22
- package/dist/components/hamburger/hamburger.module.css +142 -0
- package/dist/components/hamburger/hamburger.module.js +10 -0
- package/dist/components/hamburger/hamburger_module.css +169 -0
- package/dist/components/notifications/alert.module.js +1 -1
- package/dist/components/notifications/toast.js +1 -1
- package/dist/components/notifications/toast.module.js +1 -1
- package/dist/components/overlay/overlay.module.js +1 -1
- package/dist/components/pager/pagination.module.js +1 -1
- package/dist/components/scroll-area/scroll-area.module.js +1 -1
- package/dist/components/scroll-to-top/scroll-to-top.module.js +1 -1
- package/dist/components/section/section.module.js +1 -1
- package/dist/components/shimmer/shimmer.module.js +1 -1
- package/dist/components/table/table.module.js +1 -1
- package/dist/components/tabs/tabs.module.js +1 -1
- package/dist/components/tabs/tabs_module.css +1 -5
- package/dist/components/tooltip/tooltip.module.js +1 -1
- package/dist/icons/icons.module.js +1 -1
- package/dist/loaders/@types/index.d.ts.map +1 -0
- package/dist/loaders/ellipses.d.ts +1 -1
- package/dist/loaders/ellipses.d.ts.map +1 -1
- package/dist/loaders/ring.d.ts +1 -1
- package/dist/loaders/ring.d.ts.map +1 -1
- package/dist/loaders/spinner.d.ts +1 -1
- package/dist/loaders/spinner.d.ts.map +1 -1
- package/dist/react.js +1 -2
- package/dist/styles/styles.css +1 -1
- package/dist/theme/theme-provider/provider.js +1 -1
- package/dist/utils/externalLinkProps.js +1 -1
- package/dist/utils/findMatch.js +1 -1
- package/dist/utils/isTouchDevice.js +1 -1
- package/dist/utils/objectsToArray.js +1 -1
- package/dist/utils/objectsToString.js +1 -1
- package/dist/widgets/datepicker/datepicker.module.js +1 -1
- package/dist/widgets/drawer/drawer.module.js +1 -1
- package/dist/widgets/drawer/motionDomAnimation.js +1 -1
- package/dist/widgets/drawer/motionDomMax.js +1 -1
- package/dist/widgets/modal/modal.module.js +1 -1
- package/dist/widgets/modal/motionDomAnimation.js +1 -1
- package/dist/widgets/modal/motionDomMax.js +1 -1
- package/dist/widgets/timeline/timeline.module.js +1 -1
- package/package.json +26 -30
- package/src/astro.d.ts +2 -2
- package/src/components/hamburger/hamburger.astro +23 -15
- package/src/components/hamburger/hamburger.module.css +142 -0
- package/src/components/hamburger/hamburger.stories.tsx +35 -0
- package/src/components/hamburger/hamburger.tsx +37 -29
- package/src/loaders/ellipses.tsx +1 -1
- package/src/loaders/ring.tsx +1 -1
- package/src/loaders/spinner.tsx +1 -1
- package/src/styles/components/hamburger.css +8 -6
- package/src/styles/functional/colors.css +97 -202
- package/src/styles/theme/theme.css +1 -1
- package/dist/loaders/types/index.d.ts.map +0 -1
- /package/dist/loaders/{types → @types}/index.d.ts +0 -0
- /package/dist/loaders/{types → @types}/index.js +0 -0
- /package/src/loaders/{types → @types}/index.ts +0 -0
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
---
|
|
2
|
-
//
|
|
2
|
+
// NOTE: In Astro, open/closed state is managed externally
|
|
3
|
+
// (e.g. via nanostores). Toggle the 'infonomic-hamburger-open'
|
|
4
|
+
// class on the button and update aria-expanded from client JS.
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
// Instead we set open / closed state via nanostores.
|
|
6
|
-
// and then apply global classes according.
|
|
7
|
-
// Class overrides for inner span colors are set in
|
|
8
|
-
// Astro app.css
|
|
9
|
-
|
|
10
|
-
interface HamburgerProps {
|
|
6
|
+
interface Props {
|
|
11
7
|
class?: string
|
|
8
|
+
colorScheme?: 'auto' | 'onDark' | 'onLight'
|
|
12
9
|
ariaLabel?: string
|
|
13
10
|
ariaControls?: string
|
|
14
11
|
}
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
import styles from './hamburger.module.css'
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
class: className,
|
|
17
|
+
colorScheme = 'auto',
|
|
18
|
+
ariaLabel = 'Toggle menu',
|
|
19
|
+
ariaControls,
|
|
20
|
+
...rest
|
|
21
|
+
} = Astro.props as Props
|
|
22
|
+
|
|
23
|
+
const colorSchemeClass =
|
|
24
|
+
colorScheme === 'onDark' ? styles.onDark : colorScheme === 'onLight' ? styles.onLight : undefined
|
|
17
25
|
---
|
|
18
26
|
|
|
19
27
|
<button
|
|
20
|
-
|
|
21
|
-
class:list={['
|
|
22
|
-
tabindex="0"
|
|
28
|
+
type="button"
|
|
29
|
+
class:list={['infonomic-hamburger', styles.hamburger, colorSchemeClass, className]}
|
|
23
30
|
aria-label={ariaLabel}
|
|
24
31
|
aria-controls={ariaControls}
|
|
25
|
-
aria-
|
|
32
|
+
aria-expanded="false"
|
|
33
|
+
{...rest}
|
|
26
34
|
>
|
|
27
|
-
<span class=
|
|
28
|
-
<span class=
|
|
35
|
+
<span class:list={['infonomic-hamburger-box', styles.box]} aria-hidden="true">
|
|
36
|
+
<span class:list={['infonomic-hamburger-inner', styles.inner]}></span>
|
|
29
37
|
</span>
|
|
30
38
|
</button>
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
@layer infonomic-base,
|
|
2
|
+
infonomic-functional,
|
|
3
|
+
infonomic-utilities,
|
|
4
|
+
infonomic-theme,
|
|
5
|
+
infonomic-typography,
|
|
6
|
+
infonomic-components;
|
|
7
|
+
|
|
8
|
+
@layer infonomic-components {
|
|
9
|
+
|
|
10
|
+
.hamburger,
|
|
11
|
+
:global(.infonomic-hamburger) {
|
|
12
|
+
--hamburger-color: currentColor;
|
|
13
|
+
--hamburger-focus-ring-color: currentColor;
|
|
14
|
+
|
|
15
|
+
display: flex;
|
|
16
|
+
position: relative;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
z-index: 200;
|
|
20
|
+
width: 42px;
|
|
21
|
+
height: 34px;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
transition-property: opacity, filter;
|
|
25
|
+
transition-duration: 0.15s;
|
|
26
|
+
transition-timing-function: ease;
|
|
27
|
+
font: inherit;
|
|
28
|
+
color: inherit;
|
|
29
|
+
text-transform: none;
|
|
30
|
+
background-color: transparent;
|
|
31
|
+
border: 0;
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: 0;
|
|
34
|
+
border-radius: var(--border-radius-sm);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.hamburger:focus-visible,
|
|
38
|
+
:global(.infonomic-hamburger):focus-visible {
|
|
39
|
+
outline: 2px solid var(--hamburger-focus-ring-color);
|
|
40
|
+
outline-offset: 2px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Box container for the bars */
|
|
44
|
+
.box,
|
|
45
|
+
:global(.infonomic-hamburger-box) {
|
|
46
|
+
width: 24px;
|
|
47
|
+
height: 24px;
|
|
48
|
+
display: block;
|
|
49
|
+
position: relative;
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Inner bar + ::before/::after pseudo-elements form the 3 lines */
|
|
54
|
+
.inner,
|
|
55
|
+
:global(.infonomic-hamburger-inner) {
|
|
56
|
+
display: block;
|
|
57
|
+
top: 50%;
|
|
58
|
+
margin-top: -1px;
|
|
59
|
+
transition-duration: 0.075s;
|
|
60
|
+
transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.inner,
|
|
64
|
+
.inner::before,
|
|
65
|
+
.inner::after,
|
|
66
|
+
:global(.infonomic-hamburger-inner),
|
|
67
|
+
:global(.infonomic-hamburger-inner)::before,
|
|
68
|
+
:global(.infonomic-hamburger-inner)::after {
|
|
69
|
+
position: absolute;
|
|
70
|
+
width: 24px;
|
|
71
|
+
height: 2px;
|
|
72
|
+
border-radius: 0;
|
|
73
|
+
background-color: var(--hamburger-color);
|
|
74
|
+
transition-property: transform;
|
|
75
|
+
transition-duration: 0.15s;
|
|
76
|
+
transition-timing-function: ease;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.inner::before,
|
|
80
|
+
.inner::after,
|
|
81
|
+
:global(.infonomic-hamburger-inner)::before,
|
|
82
|
+
:global(.infonomic-hamburger-inner)::after {
|
|
83
|
+
content: "";
|
|
84
|
+
display: block;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.inner::before,
|
|
88
|
+
:global(.infonomic-hamburger-inner)::before {
|
|
89
|
+
top: -8px;
|
|
90
|
+
transition:
|
|
91
|
+
top 0.075s 0.12s ease,
|
|
92
|
+
opacity 0.075s ease;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.inner::after,
|
|
96
|
+
:global(.infonomic-hamburger-inner)::after {
|
|
97
|
+
bottom: -8px;
|
|
98
|
+
transition:
|
|
99
|
+
bottom 0.075s 0.12s ease,
|
|
100
|
+
transform 0.075s cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Open state */
|
|
104
|
+
.open .inner,
|
|
105
|
+
:global(.infonomic-hamburger-open) :global(.infonomic-hamburger-inner) {
|
|
106
|
+
transform: rotate(45deg);
|
|
107
|
+
transition-delay: 0.12s;
|
|
108
|
+
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.open .inner::before,
|
|
112
|
+
:global(.infonomic-hamburger-open) :global(.infonomic-hamburger-inner)::before {
|
|
113
|
+
top: 0;
|
|
114
|
+
opacity: 0;
|
|
115
|
+
transition:
|
|
116
|
+
top 0.075s ease,
|
|
117
|
+
opacity 0.075s 0.12s ease;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.open .inner::after,
|
|
121
|
+
:global(.infonomic-hamburger-open) :global(.infonomic-hamburger-inner)::after {
|
|
122
|
+
bottom: 0;
|
|
123
|
+
transform: rotate(-90deg);
|
|
124
|
+
transition:
|
|
125
|
+
bottom 0.075s ease,
|
|
126
|
+
transform 0.075s 0.12s cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Color scheme: onDark (white bars for dark backgrounds) */
|
|
130
|
+
.onDark,
|
|
131
|
+
:global(.infonomic-hamburger-on-dark) {
|
|
132
|
+
--hamburger-color: white;
|
|
133
|
+
--hamburger-focus-ring-color: rgba(255, 255, 255, 0.7);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Color scheme: onLight (dark bars for light backgrounds) */
|
|
137
|
+
.onLight,
|
|
138
|
+
:global(.infonomic-hamburger-on-light) {
|
|
139
|
+
--hamburger-color: var(--foreground, #1a1a1a);
|
|
140
|
+
--hamburger-focus-ring-color: var(--foreground, #1a1a1a);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import type { Meta } from '@storybook/react-vite'
|
|
6
|
+
|
|
7
|
+
import { Section } from '../section/section.js'
|
|
8
|
+
import { Hamburger as HamburgerComponent } from './hamburger.js'
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof HamburgerComponent> = {
|
|
11
|
+
/* 👇 The title prop is optional.
|
|
12
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
13
|
+
* to learn how to generate automatic titles
|
|
14
|
+
*/
|
|
15
|
+
title: 'Components/Hamburger',
|
|
16
|
+
component: HamburgerComponent,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default meta
|
|
20
|
+
|
|
21
|
+
export const Hamburger = (): React.JSX.Element => {
|
|
22
|
+
|
|
23
|
+
const [open, setOpen] = useState(false)
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Section style={{ height: '100vh', margin: '2rem auto' }}>
|
|
27
|
+
<HamburgerComponent
|
|
28
|
+
open={open}
|
|
29
|
+
onChange={(open) => {
|
|
30
|
+
setOpen(open)
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</Section>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -1,65 +1,73 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import type React from 'react'
|
|
4
|
-
import { useCallback, useEffect
|
|
4
|
+
import { useCallback, useEffect } from 'react'
|
|
5
5
|
|
|
6
6
|
import cx from 'classnames'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import styles from './hamburger.module.css'
|
|
9
|
+
|
|
10
|
+
type ColorScheme = 'auto' | 'onDark' | 'onLight'
|
|
11
|
+
|
|
12
|
+
export interface HamburgerProps {
|
|
9
13
|
className?: string
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
open: boolean
|
|
13
|
-
|
|
14
|
+
colorScheme?: ColorScheme
|
|
15
|
+
open?: boolean
|
|
16
|
+
onChange?: (open: boolean) => void
|
|
17
|
+
ariaLabel?: string
|
|
18
|
+
ariaControls?: string
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
export function Hamburger({
|
|
17
22
|
className,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
open,
|
|
23
|
+
colorScheme = 'auto',
|
|
24
|
+
open = false,
|
|
21
25
|
onChange,
|
|
26
|
+
ariaLabel = 'Toggle menu',
|
|
27
|
+
ariaControls,
|
|
22
28
|
...other
|
|
23
29
|
}: HamburgerProps): React.JSX.Element {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const handleClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
|
|
27
|
-
setIsOpen(!isOpen)
|
|
28
|
-
onChange(event)
|
|
30
|
+
const handleClick = (): void => {
|
|
31
|
+
onChange?.(!open)
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
const handleEscapeKey = useCallback(
|
|
32
35
|
(event: KeyboardEvent): void => {
|
|
33
|
-
if (event.key === 'Escape') {
|
|
34
|
-
|
|
35
|
-
setIsOpen(false)
|
|
36
|
-
onChange(null)
|
|
37
|
-
}
|
|
36
|
+
if (event.key === 'Escape' && open) {
|
|
37
|
+
onChange?.(false)
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
-
[
|
|
40
|
+
[open, onChange]
|
|
41
41
|
)
|
|
42
42
|
|
|
43
43
|
useEffect(() => {
|
|
44
|
-
setIsOpen(open)
|
|
45
44
|
document.addEventListener('keydown', handleEscapeKey, false)
|
|
46
45
|
return () => {
|
|
47
46
|
document.removeEventListener('keydown', handleEscapeKey, false)
|
|
48
47
|
}
|
|
49
|
-
}, [
|
|
48
|
+
}, [handleEscapeKey])
|
|
50
49
|
|
|
51
50
|
return (
|
|
52
51
|
<button
|
|
52
|
+
type="button"
|
|
53
53
|
onClick={handleClick}
|
|
54
|
-
className={cx(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
className={cx(
|
|
55
|
+
'infonomic-hamburger',
|
|
56
|
+
styles.hamburger,
|
|
57
|
+
{
|
|
58
|
+
[styles.open]: open,
|
|
59
|
+
[styles.onDark]: colorScheme === 'onDark',
|
|
60
|
+
[styles.onLight]: colorScheme === 'onLight',
|
|
61
|
+
},
|
|
62
|
+
className
|
|
63
|
+
)}
|
|
64
|
+
aria-label={ariaLabel}
|
|
65
|
+
aria-controls={ariaControls}
|
|
66
|
+
aria-expanded={open}
|
|
59
67
|
{...other}
|
|
60
68
|
>
|
|
61
|
-
<span className=
|
|
62
|
-
<span className={cx('inner',
|
|
69
|
+
<span className={cx('infonomic-hamburger-box', styles.box)} aria-hidden="true">
|
|
70
|
+
<span className={cx('infonomic-hamburger-inner', styles.inner)} />
|
|
63
71
|
</span>
|
|
64
72
|
</button>
|
|
65
73
|
)
|
package/src/loaders/ellipses.tsx
CHANGED
package/src/loaders/ring.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import type React from 'react'
|
|
|
3
3
|
|
|
4
4
|
import classNames from 'classnames'
|
|
5
5
|
|
|
6
|
-
import type { LoaderProps } from '
|
|
6
|
+
import type { LoaderProps } from './@types/index.js'
|
|
7
7
|
|
|
8
8
|
export function LoaderRing({ color, size = 60, className, style }: LoaderProps): React.JSX.Element {
|
|
9
9
|
const circles = [...Array(4)].map((_, index) => {
|
package/src/loaders/spinner.tsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
/* No longer used in our actual hamburger React and Astro components
|
|
2
|
+
but left here as a reference. */
|
|
1
3
|
@layer infonomic-base,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
infonomic-functional,
|
|
5
|
+
infonomic-utilities,
|
|
6
|
+
infonomic-theme,
|
|
7
|
+
infonomic-typography,
|
|
8
|
+
infonomic-components;
|
|
7
9
|
|
|
8
10
|
@layer infonomic-components {
|
|
9
11
|
.component--hamburger {
|
|
@@ -117,4 +119,4 @@
|
|
|
117
119
|
bottom 0.075s ease,
|
|
118
120
|
transform 0.075s 0.12s cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
119
121
|
}
|
|
120
|
-
}
|
|
122
|
+
}
|