Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: navigation menu machine #1919

Draft
wants to merge 149 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
02d2ada
chore: update
segunadebayo Oct 9, 2024
5bb6624
chore: wip
segunadebayo Oct 9, 2024
90e5b24
chore: good progress
segunadebayo Oct 10, 2024
11bb412
chore: more progress
segunadebayo Oct 10, 2024
ffc1b0b
chore: add types
segunadebayo Oct 10, 2024
b99b56c
chore: update anatomy
segunadebayo Oct 10, 2024
84c58a6
refactor: anatomy
segunadebayo Oct 10, 2024
047ad3c
chore: add controls
segunadebayo Oct 10, 2024
5472858
chore: add interaction outside
segunadebayo Oct 10, 2024
7312f80
feat: support arrows in popover type
segunadebayo Oct 11, 2024
c3cd1fa
chore: preserve tab order when using viewport
segunadebayo Oct 11, 2024
2492ffa
fix: improve focus proxy and track indicator
segunadebayo Oct 11, 2024
c55f3d1
chore: update
segunadebayo Oct 12, 2024
9eeb2bd
fix(time-picker): resolve an issue that intl date was not a peer dep
cschroeter Oct 9, 2024
6b65bde
ci(changesets): version packages
github-actions[bot] Oct 9, 2024
b520ac4
docs: changelog
cschroeter Oct 9, 2024
42a5247
fix(time-picker): export missint time type
cschroeter Oct 9, 2024
18bfcb5
ci(changesets): version packages
github-actions[bot] Oct 9, 2024
f682a9d
docs: changelog
cschroeter Oct 9, 2024
1735b73
feat: resize textarea
segunadebayo Oct 12, 2024
b6c3b78
fix(deps): update dependency lucide-react to v0.453.0 (#1945)
renovate[bot] Oct 15, 2024
dd5b721
chore(deps): update thollander/actions-comment-pull-request action to…
renovate[bot] Oct 15, 2024
f411891
chore(deps): update dependency @types/node to v22.7.5 (#1944)
renovate[bot] Oct 15, 2024
a55b85c
chore(deps): update pnpm to v9.12.1 (#1941)
renovate[bot] Oct 15, 2024
d444312
fix(deps): update dependency @playwright/test to v1.48.0 (#1943)
renovate[bot] Oct 16, 2024
7f42a63
fix(deps): update eslint (#1940)
renovate[bot] Oct 16, 2024
fc4a780
fix(deps): update dependency @swc/core to v1.7.36 (#1936)
renovate[bot] Oct 16, 2024
715f241
fix(deps): update dependency @changesets/cli to v2.27.9 (#1933)
renovate[bot] Oct 17, 2024
6e15ced
fix(deps): update dependency vitest to v2.1.3 (#1939)
renovate[bot] Oct 17, 2024
f357d73
fix(deps): update dependency @internationalized/number to v3.5.4 (#1935)
renovate[bot] Oct 17, 2024
28ac2ab
fix(deps): update dependency next to v14.2.15 (#1937)
renovate[bot] Oct 17, 2024
b82d14d
fix(deps): update babel monorepo (#1932)
renovate[bot] Oct 17, 2024
c1db19b
chore(deps): update dependency @types/react-dom to v18.3.1 (#1927)
renovate[bot] Oct 17, 2024
2e59a05
chore(deps): update dependency svelte to v5.0.0-next.269 (#1929)
renovate[bot] Oct 17, 2024
279a850
fix(deps): update dependency ts-morph to v24 (#1926)
renovate[bot] Oct 17, 2024
95c5550
chore(deps): update dependency solid-js to v1.9.2 (#1928)
renovate[bot] Oct 17, 2024
2231b19
chore(deps): update dependency vue to v3.5.12 (#1931)
renovate[bot] Oct 17, 2024
7cca612
chore(deps): update dependency typescript to v5.6.3 (#1930)
renovate[bot] Oct 17, 2024
49c5c69
fix(deps): update dependency vite-plugin-dts to v4.2.4 (#1938)
renovate[bot] Oct 17, 2024
5841ec9
fix(presence): exit when doc visibilty changed
segunadebayo Oct 18, 2024
d7d0de4
fix(popover): focus outside in safari ios
segunadebayo Oct 18, 2024
1599aed
fix(types): add undefined to all machine optional types (#1923)
isBatak Oct 18, 2024
7227d16
chore: update deps
segunadebayo Oct 18, 2024
a3f9a78
refactor: enable exactOptionalPropertyTypes everywhere
segunadebayo Oct 18, 2024
c850e44
refactor: editable autoresize
segunadebayo Oct 18, 2024
4aa63ab
docs: ignore website optional types
segunadebayo Oct 18, 2024
4f6f7f3
refactor: popper package
segunadebayo Oct 18, 2024
904c303
chore: update
segunadebayo Oct 18, 2024
6cc77ff
feat: add slider dragging indicator
segunadebayo Oct 18, 2024
0bf6e6a
docs: add next changelog
segunadebayo Oct 18, 2024
eda930d
Version Packages (#1922)
github-actions[bot] Oct 18, 2024
0de5e0e
chore: fix svelte snippets
anubra266 Oct 23, 2024
f7cfe80
fix: tour title (#1966)
woochanleee Oct 23, 2024
89a33e4
fix(deps): update dependency axe-core to v4.10.2 (#1962)
renovate[bot] Oct 23, 2024
f8e6acf
chore(deps): update pnpm to v9.12.2 (#1960)
renovate[bot] Oct 23, 2024
1dd6afb
chore(deps): update dependency @types/node to v22.7.9 (#1957)
renovate[bot] Oct 23, 2024
ef1da0f
fix(deps): update dependency match-sorter to v7 (#1956)
renovate[bot] Oct 23, 2024
7a527a2
chore(deps): update dependency svelte to v5.0.5 (#1959)
renovate[bot] Oct 23, 2024
c02d0b7
chore(deps): update dependency preact to v10.24.3 (#1958)
renovate[bot] Oct 23, 2024
04cbc2d
fix(deps): update dependency @playwright/test to v1.48.1 (#1961)
renovate[bot] Oct 23, 2024
ea645cf
fix(deps): update dependency vite to v5.4.10 (#1963)
renovate[bot] Oct 23, 2024
a59487b
chore(deps): update dependency svelte to v5.1.2 (#1973)
renovate[bot] Oct 25, 2024
a1fbac2
refactor(tree): redesign tree collection
segunadebayo Oct 25, 2024
172a2fc
fix: rating group when readonly
segunadebayo Oct 25, 2024
b1b23a8
fix(combobox): selection value call
segunadebayo Oct 26, 2024
07cf2c5
fix(tags-input): api.addValue
segunadebayo Oct 26, 2024
1f85ee1
fix: hovercard
segunadebayo Oct 26, 2024
4619e87
docs(toast): add note
segunadebayo Oct 26, 2024
770f05c
fix(deps): update eslint (#1964)
renovate[bot] Oct 26, 2024
ce11dfe
docs: update readme
segunadebayo Oct 26, 2024
598d24a
docs: add next changelog
segunadebayo Oct 26, 2024
00cf36b
Version Packages (#1975)
github-actions[bot] Oct 26, 2024
18d8004
chore: fix typo in changelog
anubra266 Oct 27, 2024
505bb3c
fix(remove-scroll): resolve an issue where styles are not always rest…
cschroeter Oct 28, 2024
0d20850
feat: improve lit-ts example with shared Component class (#1995)
gperdomor Oct 28, 2024
3c6403f
fix: toast group type
segunadebayo Oct 28, 2024
7532ef9
refactor: combobox and selection value
segunadebayo Oct 28, 2024
dca22c8
docs: update compositions
segunadebayo Oct 28, 2024
0d7d7ff
refactor: treeview component
segunadebayo Oct 28, 2024
2812fc9
fix(deps): update dependency vite-plugin-dts to v4.3.0 (#1992)
renovate[bot] Oct 29, 2024
cdac969
fix(deps): update babel monorepo (#1991)
renovate[bot] Oct 29, 2024
e9a5f43
fix(deps): update dependency @playwright/test to v1.48.2 (#1985)
renovate[bot] Oct 29, 2024
b269a05
chore(deps): update dependency solid-js to v1.9.3 (#1983)
renovate[bot] Oct 29, 2024
7240849
chore(deps): update dependency @sveltejs/package to v2.3.7 (#1981)
renovate[bot] Oct 29, 2024
01a7bd2
chore(deps): update dependency @types/react to v18.3.12 (#1982)
renovate[bot] Oct 29, 2024
c3d61e8
fix(deps): update dependency tsup to v8.3.5 (#1988)
renovate[bot] Oct 29, 2024
fc8a76a
chore(deps): update dependency svelte to v5.1.4 (#1984)
renovate[bot] Oct 29, 2024
712c656
test: update snaps
segunadebayo Oct 29, 2024
1949b8b
feat: improving generic component class (#1997)
gperdomor Oct 29, 2024
b39ecd5
chore(lit): update
segunadebayo Oct 29, 2024
2c01c8d
chore: update deps
segunadebayo Oct 29, 2024
e41784e
fix(deps): update dependency next to v14.2.16 (#1987)
renovate[bot] Oct 29, 2024
4c7eeb5
chore(deps): update dependency node to v22 (#1990)
renovate[bot] Oct 29, 2024
f2a94dc
docs: add treeview
segunadebayo Oct 29, 2024
47666d3
docs: add next changelog
segunadebayo Oct 29, 2024
b4a4747
docs: fix typo in toast (#1998)
babakfp Oct 29, 2024
04535cf
Version Packages (#1994)
github-actions[bot] Oct 29, 2024
b0d3497
fix(deps): update dependency @swc/core to v1.7.42 (#1986)
renovate[bot] Nov 1, 2024
f64db6e
chore(deps): lock file maintenance (#2000)
renovate[bot] Nov 1, 2024
b4e8d90
fix(deps): update dependency next to v15 (#1979)
renovate[bot] Nov 2, 2024
be8749e
docs: update snippets for tour and tree view (#2001)
dangvanthanh Nov 3, 2024
57f65a5
fix: clipboard trigger
segunadebayo Nov 4, 2024
00ebe10
fix(aria-hidden): skip empty elements hide (#2011)
healtheloper Nov 4, 2024
0766b69
fix(deps): update eslint (#2009)
renovate[bot] Nov 5, 2024
f3ced3d
fix(deps): update dependency lucide-react to v0.454.0 (#2008)
renovate[bot] Nov 5, 2024
4be2fec
fix(deps): update dependency vitest to v2.1.4 (#2007)
renovate[bot] Nov 5, 2024
3f33f06
fix(deps): update dependency @floating-ui/dom to v1.6.12 (#2006)
renovate[bot] Nov 5, 2024
b71ba7d
fix(deps): update babel monorepo to v7.26.2 (#2005)
renovate[bot] Nov 5, 2024
7508b25
chore(deps): update dependency svelte to v5.1.9 (#2003)
renovate[bot] Nov 5, 2024
95dd5d8
chore(deps): update pnpm to v9.12.3 (#2004)
renovate[bot] Nov 5, 2024
7bd04b8
chore(deps): update dependency @types/node to v22.9.0 (#2002)
renovate[bot] Nov 5, 2024
30a4cde
docs: fix invalid self-closing tags to proper closing tags f… (#2012)
babakfp Nov 6, 2024
ab29fb8
refactor: improve autoresize
segunadebayo Nov 8, 2024
35733d2
fix: tags input delete behavior
segunadebayo Nov 8, 2024
c755d46
refactor: treeview
segunadebayo Nov 9, 2024
8ad3053
refactor: color picker
segunadebayo Nov 9, 2024
b4f1344
docs: add next changelog
segunadebayo Nov 10, 2024
1a3cb3f
Version Packages (#2010)
github-actions[bot] Nov 10, 2024
445e100
fix(time-picker): resolve an issue that intl date was not a peer dep
cschroeter Oct 9, 2024
452b145
ci(changesets): version packages
github-actions[bot] Oct 9, 2024
e79438b
fix(time-picker): export missint time type
cschroeter Oct 9, 2024
ab035ba
ci(changesets): version packages
github-actions[bot] Oct 9, 2024
6eb7d9c
feat: resize textarea
segunadebayo Oct 12, 2024
ec55b19
fix(presence): exit when doc visibilty changed
segunadebayo Oct 18, 2024
1f3c626
fix(popover): focus outside in safari ios
segunadebayo Oct 18, 2024
d7bbc7b
refactor: editable autoresize
segunadebayo Oct 18, 2024
854d953
feat: add slider dragging indicator
segunadebayo Oct 18, 2024
9e317fd
Version Packages (#1922)
github-actions[bot] Oct 18, 2024
867d69b
refactor(tree): redesign tree collection
segunadebayo Oct 25, 2024
fd405fe
fix: rating group when readonly
segunadebayo Oct 25, 2024
359bccc
fix(combobox): selection value call
segunadebayo Oct 26, 2024
fde1250
fix(tags-input): api.addValue
segunadebayo Oct 26, 2024
ab4f569
fix: hovercard
segunadebayo Oct 26, 2024
199a234
Version Packages (#1975)
github-actions[bot] Oct 26, 2024
9a7b693
fix(remove-scroll): resolve an issue where styles are not always rest…
cschroeter Oct 28, 2024
f142fd0
fix: toast group type
segunadebayo Oct 28, 2024
a3db98c
refactor: combobox and selection value
segunadebayo Oct 28, 2024
c3a0e04
refactor: treeview component
segunadebayo Oct 28, 2024
12e64fa
feat: improving generic component class (#1997)
gperdomor Oct 29, 2024
3324281
chore(lit): update
segunadebayo Oct 29, 2024
9fbf8c0
Version Packages (#1994)
github-actions[bot] Oct 29, 2024
2939130
fix: clipboard trigger
segunadebayo Nov 4, 2024
1963c4c
refactor: improve autoresize
segunadebayo Nov 8, 2024
b425fe2
fix: tags input delete behavior
segunadebayo Nov 8, 2024
bee2012
refactor: treeview
segunadebayo Nov 9, 2024
d30abde
refactor: color picker
segunadebayo Nov 9, 2024
d34fab0
Version Packages (#2010)
github-actions[bot] Nov 10, 2024
4733828
Merge remote-tracking branch 'origin' into nav-menu
segunadebayo Nov 10, 2024
1fafbe3
fix: types
segunadebayo Nov 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 163 additions & 0 deletions .xstate/navigation-menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
"use strict";

var _xstate = require("xstate");
const {
actions,
createMachine,
assign
} = _xstate;
const {
choose
} = actions;
const fetchMachine = createMachine({
id: "navigation-menu",
context: {
"isItemOpen && isRootMenu": false,
"isSubmenu": false,
"isSubmenu": false,
"isOpen": false
},
initial: "closed",
entry: ["checkViewportNode"],
exit: ["cleanupObservers"],
on: {
SET_PARENT: {
target: "open",
actions: ["setParentMenu", "setActiveTriggerNode", "syncTriggerRectObserver"]
},
SET_CHILD: {
actions: ["setChildMenu"]
},
TRIGGER_CLICK: [{
cond: "isItemOpen && isRootMenu",
actions: ["clearValue", "setClickCloseRef"]
}, {
target: "open",
actions: ["setValue", "setClickCloseRef"]
}],
TRIGGER_FOCUS: {
actions: ["focusTopLevelEl"]
}
},
on: {
UPDATE_CONTEXT: {
actions: "updateContext"
}
},
states: {
closed: {
entry: ["cleanupObservers", "propagateClose"],
on: {
TRIGGER_ENTER: {
actions: ["clearCloseRefs"]
},
TRIGGER_MOVE: [{
cond: "isSubmenu",
target: "open",
actions: ["setValue"]
}, {
target: "opening",
actions: ["setPointerMoveRef"]
}]
}
},
opening: {
after: {
OPEN_DELAY: {
target: "open",
actions: ["setValue"]
}
},
on: {
TRIGGER_LEAVE: {
target: "closed",
actions: ["clearValue", "clearPointerMoveRef"]
},
CONTENT_FOCUS: {
actions: ["focusContent", "restoreTabOrder"]
},
LINK_FOCUS: {
actions: ["focusLink"]
}
}
},
open: {
tags: ["open"],
activities: ["trackEscapeKey", "trackInteractionOutside", "preserveTabOrder"],
on: {
CONTENT_LEAVE: {
target: "closing"
},
TRIGGER_LEAVE: {
target: "closing",
actions: ["clearPointerMoveRef"]
},
CONTENT_FOCUS: {
actions: ["focusContent", "restoreTabOrder"]
},
LINK_FOCUS: {
actions: ["focusLink"]
},
CONTENT_DISMISS: {
target: "closed",
actions: ["focusTriggerIfNeeded", "clearValue", "clearPointerMoveRef"]
},
CONTENT_ENTER: {
actions: ["restoreTabOrder"]
},
TRIGGER_MOVE: {
cond: "isSubmenu",
actions: ["setValue"]
},
ROOT_CLOSE: {
// clear the previous value so indicator doesn't animate
actions: ["clearPreviousValue", "cleanupObservers"]
}
}
},
closing: {
tags: ["open"],
activities: ["trackInteractionOutside"],
after: {
CLOSE_DELAY: {
target: "closed",
actions: ["clearValue"]
}
},
on: {
CONTENT_DISMISS: {
target: "closed",
actions: ["focusTriggerIfNeeded", "clearValue", "clearPointerMoveRef"]
},
CONTENT_ENTER: {
target: "open",
actions: ["restoreTabOrder"]
},
TRIGGER_ENTER: {
actions: ["clearCloseRefs"]
},
TRIGGER_MOVE: [{
cond: "isOpen",
target: "open",
actions: ["setValue", "setPointerMoveRef"]
}, {
target: "opening",
actions: ["setPointerMoveRef"]
}]
}
}
}
}, {
actions: {
updateContext: assign((context, event) => {
return {
[event.contextKey]: true
};
})
},
guards: {
"isItemOpen && isRootMenu": ctx => ctx["isItemOpen && isRootMenu"],
"isSubmenu": ctx => ctx["isSubmenu"],
"isOpen": ctx => ctx["isOpen"]
}
});
1 change: 1 addition & 0 deletions examples/lit-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@zag-js/interact-outside": "workspace:*",
"@zag-js/live-region": "workspace:*",
"@zag-js/menu": "workspace:*",
"@zag-js/navigation-menu": "workspace:*",
"@zag-js/number-input": "workspace:*",
"@zag-js/number-utils": "workspace:*",
"@zag-js/numeric-range": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions examples/next-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@zag-js/interact-outside": "workspace:*",
"@zag-js/live-region": "workspace:*",
"@zag-js/menu": "workspace:*",
"@zag-js/navigation-menu": "workspace:*",
"@zag-js/number-input": "workspace:*",
"@zag-js/number-utils": "workspace:*",
"@zag-js/numeric-range": "workspace:*",
Expand Down
Loading
Loading