@techsio/ui-kit 0.56.1 → 0.58.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/README.md +128 -133
- package/dist/atoms/action-icon.js +9 -8
- package/dist/atoms/button.js +78 -18
- package/dist/atoms/checkbox.js +77 -17
- package/dist/atoms/hotkeys.js +26 -7
- package/dist/atoms/icon.js +5 -5
- package/dist/atoms/image.js +107 -2
- package/dist/atoms/input.js +57 -9
- package/dist/atoms/label.js +13 -4
- package/dist/atoms/link-button.js +14 -12
- package/dist/atoms/link.js +18 -4
- package/dist/atoms/numeric-input.js +293 -76
- package/dist/atoms/rating.js +306 -73
- package/dist/atoms/skeleton.js +18 -14
- package/dist/atoms/status-text.js +31 -18
- package/dist/atoms/textarea.js +59 -12
- package/dist/atoms/tooltip.js +64 -43
- package/dist/hotkeys.js +1 -0
- package/dist/internal/choice-control.js +173 -0
- package/dist/internal/combobox-query-sync.js +11 -0
- package/dist/internal/date-picker-coordinator.js +56 -40
- package/dist/internal/date-picker-dom.js +44 -0
- package/dist/internal/date-picker-input.js +30 -0
- package/dist/internal/described-by.js +23 -18
- package/dist/internal/form-control-lifecycle.js +122 -0
- package/dist/internal/molecules/command.context.js +1 -0
- package/dist/internal/molecules/drawer.context.js +1 -0
- package/dist/internal/molecules/vertical-navigation.context.js +1 -0
- package/dist/internal/molecules/vertical-navigation.styles.js +9 -2
- package/dist/internal/numeric-input-editing.js +87 -0
- package/dist/internal/organisms/sidebar.context.js +1 -0
- package/dist/internal/organisms/sidebar.focus.js +1 -0
- package/dist/internal/overlay-portal.js +72 -0
- package/dist/internal/reduced-motion.js +1 -0
- package/dist/internal/use-effective-disabled.js +8 -0
- package/dist/molecules/accordion.js +44 -30
- package/dist/molecules/availability-status.js +1 -0
- package/dist/molecules/breadcrumb.js +11 -11
- package/dist/molecules/carousel.js +279 -97
- package/dist/molecules/cascade-select.js +327 -81
- package/dist/molecules/chart.js +276 -38
- package/dist/molecules/color-select.js +181 -62
- package/dist/molecules/combobox.js +535 -182
- package/dist/molecules/command.js +2 -1
- package/dist/molecules/date-picker.js +571 -119
- package/dist/molecules/dialog.js +81 -47
- package/dist/molecules/drawer.js +54 -5
- package/dist/molecules/file-upload.js +373 -37
- package/dist/molecules/form-checkbox.js +65 -22
- package/dist/molecules/form-error-summary.js +29 -5
- package/dist/molecules/form-input.js +26 -30
- package/dist/molecules/form-numeric-input.js +11 -9
- package/dist/molecules/form-textarea.js +26 -23
- package/dist/molecules/menu.js +170 -47
- package/dist/molecules/pagination.js +100 -28
- package/dist/molecules/phone-input.js +172 -37
- package/dist/molecules/popover.js +53 -26
- package/dist/molecules/price-block.js +1 -0
- package/dist/molecules/product-card.js +23 -18
- package/dist/molecules/quantity-field.js +4 -2
- package/dist/molecules/radio-card.js +102 -30
- package/dist/molecules/radio-group.js +108 -31
- package/dist/molecules/search-form.js +116 -13
- package/dist/molecules/select.js +226 -81
- package/dist/molecules/slider.js +141 -30
- package/dist/molecules/steps.js +181 -50
- package/dist/molecules/switch.js +85 -20
- package/dist/molecules/tabs.js +227 -31
- package/dist/molecules/toast.js +146 -51
- package/dist/molecules/totals-summary.js +2 -1
- package/dist/molecules/tour.js +9 -5
- package/dist/molecules/tree-view.js +255 -109
- package/dist/molecules/vertical-navigation.js +8 -4
- package/dist/organisms/data-table.fields.js +25 -5
- package/dist/organisms/data-table.helpers.js +6 -2
- package/dist/organisms/data-table.js +580 -151
- package/dist/organisms/footer.js +18 -11
- package/dist/organisms/gallery.js +61 -24
- package/dist/organisms/header.js +106 -32
- package/dist/organisms/line-item.js +1 -0
- package/dist/organisms/sidebar.js +1 -0
- package/dist/organisms/table.js +22 -7
- package/dist/src/atoms/action-icon.d.ts +10 -10
- package/dist/src/atoms/action-icon.d.ts.map +1 -1
- package/dist/src/atoms/badge.d.ts +3 -3
- package/dist/src/atoms/badge.d.ts.map +1 -1
- package/dist/src/atoms/button.d.ts +35 -24
- package/dist/src/atoms/button.d.ts.map +1 -1
- package/dist/src/atoms/checkbox.d.ts +6 -5
- package/dist/src/atoms/checkbox.d.ts.map +1 -1
- package/dist/src/atoms/hotkeys.d.ts +3 -2
- package/dist/src/atoms/hotkeys.d.ts.map +1 -1
- package/dist/src/atoms/icon.d.ts +18 -17
- package/dist/src/atoms/icon.d.ts.map +1 -1
- package/dist/src/atoms/image.d.ts +14 -6
- package/dist/src/atoms/image.d.ts.map +1 -1
- package/dist/src/atoms/input.d.ts +23 -14
- package/dist/src/atoms/input.d.ts.map +1 -1
- package/dist/src/atoms/label.d.ts +4 -4
- package/dist/src/atoms/label.d.ts.map +1 -1
- package/dist/src/atoms/link-button.d.ts +54 -31
- package/dist/src/atoms/link-button.d.ts.map +1 -1
- package/dist/src/atoms/link.d.ts +30 -9
- package/dist/src/atoms/link.d.ts.map +1 -1
- package/dist/src/atoms/numeric-input.d.ts +23 -19
- package/dist/src/atoms/numeric-input.d.ts.map +1 -1
- package/dist/src/atoms/rating.d.ts +54 -26
- package/dist/src/atoms/rating.d.ts.map +1 -1
- package/dist/src/atoms/skeleton.d.ts +9 -9
- package/dist/src/atoms/skeleton.d.ts.map +1 -1
- package/dist/src/atoms/status-text.d.ts +21 -13
- package/dist/src/atoms/status-text.d.ts.map +1 -1
- package/dist/src/atoms/textarea.d.ts +22 -20
- package/dist/src/atoms/textarea.d.ts.map +1 -1
- package/dist/src/atoms/tooltip.d.ts +5 -5
- package/dist/src/atoms/tooltip.d.ts.map +1 -1
- package/dist/src/hotkeys.d.ts +1 -1
- package/dist/src/hotkeys.d.ts.map +1 -1
- package/dist/src/internal/choice-control.d.ts +18 -0
- package/dist/src/internal/choice-control.d.ts.map +1 -0
- package/dist/src/internal/combobox-query-sync.d.ts +4 -0
- package/dist/src/internal/combobox-query-sync.d.ts.map +1 -0
- package/dist/src/internal/date-picker-coordinator.d.ts +7 -1
- package/dist/src/internal/date-picker-coordinator.d.ts.map +1 -1
- package/dist/src/internal/date-picker-dom.d.ts +10 -0
- package/dist/src/internal/date-picker-dom.d.ts.map +1 -0
- package/dist/src/internal/date-picker-input.d.ts +7 -0
- package/dist/src/internal/date-picker-input.d.ts.map +1 -0
- package/dist/src/internal/described-by.d.ts +7 -1
- package/dist/src/internal/described-by.d.ts.map +1 -1
- package/dist/src/internal/form-control-lifecycle.d.ts +22 -0
- package/dist/src/internal/form-control-lifecycle.d.ts.map +1 -0
- package/dist/src/internal/molecules/vertical-navigation.context.d.ts +1 -1
- package/dist/src/internal/molecules/vertical-navigation.context.d.ts.map +1 -1
- package/dist/src/internal/molecules/vertical-navigation.styles.d.ts +21 -0
- package/dist/src/internal/molecules/vertical-navigation.styles.d.ts.map +1 -1
- package/dist/src/internal/numeric-input-editing.d.ts +13 -0
- package/dist/src/internal/numeric-input-editing.d.ts.map +1 -0
- package/dist/src/internal/overlay-portal.d.ts +18 -0
- package/dist/src/internal/overlay-portal.d.ts.map +1 -0
- package/dist/src/internal/use-effective-disabled.d.ts +4 -0
- package/dist/src/internal/use-effective-disabled.d.ts.map +1 -0
- package/dist/src/molecules/accordion.d.ts +25 -19
- package/dist/src/molecules/accordion.d.ts.map +1 -1
- package/dist/src/molecules/availability-status.d.ts +4 -1
- package/dist/src/molecules/availability-status.d.ts.map +1 -1
- package/dist/src/molecules/breadcrumb.d.ts +2 -2
- package/dist/src/molecules/breadcrumb.d.ts.map +1 -1
- package/dist/src/molecules/carousel.d.ts +51 -52
- package/dist/src/molecules/carousel.d.ts.map +1 -1
- package/dist/src/molecules/cascade-select.d.ts +23 -8
- package/dist/src/molecules/cascade-select.d.ts.map +1 -1
- package/dist/src/molecules/chart.d.ts +7 -1
- package/dist/src/molecules/chart.d.ts.map +1 -1
- package/dist/src/molecules/color-select.d.ts +19 -3
- package/dist/src/molecules/color-select.d.ts.map +1 -1
- package/dist/src/molecules/combobox.d.ts +23 -5
- package/dist/src/molecules/combobox.d.ts.map +1 -1
- package/dist/src/molecules/command.d.ts +1 -1
- package/dist/src/molecules/date-picker.d.ts +7 -3
- package/dist/src/molecules/date-picker.d.ts.map +1 -1
- package/dist/src/molecules/dialog.d.ts +7 -3
- package/dist/src/molecules/dialog.d.ts.map +1 -1
- package/dist/src/molecules/drawer.d.ts +4 -4
- package/dist/src/molecules/drawer.d.ts.map +1 -1
- package/dist/src/molecules/file-upload.d.ts +11 -6
- package/dist/src/molecules/file-upload.d.ts.map +1 -1
- package/dist/src/molecules/form-checkbox.d.ts +7 -2
- package/dist/src/molecules/form-checkbox.d.ts.map +1 -1
- package/dist/src/molecules/form-error-summary.d.ts +4 -3
- package/dist/src/molecules/form-error-summary.d.ts.map +1 -1
- package/dist/src/molecules/form-input.d.ts +5 -6
- package/dist/src/molecules/form-input.d.ts.map +1 -1
- package/dist/src/molecules/form-numeric-input.d.ts +5 -5
- package/dist/src/molecules/form-numeric-input.d.ts.map +1 -1
- package/dist/src/molecules/form-textarea.d.ts +5 -6
- package/dist/src/molecules/form-textarea.d.ts.map +1 -1
- package/dist/src/molecules/menu.d.ts +17 -3
- package/dist/src/molecules/menu.d.ts.map +1 -1
- package/dist/src/molecules/pagination.d.ts +1 -1
- package/dist/src/molecules/pagination.d.ts.map +1 -1
- package/dist/src/molecules/phone-input.d.ts +4 -1
- package/dist/src/molecules/phone-input.d.ts.map +1 -1
- package/dist/src/molecules/popover.d.ts +7 -1
- package/dist/src/molecules/popover.d.ts.map +1 -1
- package/dist/src/molecules/price-block.d.ts +1 -1
- package/dist/src/molecules/price-block.d.ts.map +1 -1
- package/dist/src/molecules/product-card.d.ts +20 -25
- package/dist/src/molecules/product-card.d.ts.map +1 -1
- package/dist/src/molecules/quantity-field.d.ts +1 -1
- package/dist/src/molecules/quantity-field.d.ts.map +1 -1
- package/dist/src/molecules/radio-card.d.ts +10 -3
- package/dist/src/molecules/radio-card.d.ts.map +1 -1
- package/dist/src/molecules/radio-group.d.ts +15 -6
- package/dist/src/molecules/radio-group.d.ts.map +1 -1
- package/dist/src/molecules/search-form.d.ts +37 -12
- package/dist/src/molecules/search-form.d.ts.map +1 -1
- package/dist/src/molecules/select.d.ts +34 -29
- package/dist/src/molecules/select.d.ts.map +1 -1
- package/dist/src/molecules/slider.d.ts +23 -2
- package/dist/src/molecules/slider.d.ts.map +1 -1
- package/dist/src/molecules/steps.d.ts +30 -10
- package/dist/src/molecules/steps.d.ts.map +1 -1
- package/dist/src/molecules/switch.d.ts +54 -33
- package/dist/src/molecules/switch.d.ts.map +1 -1
- package/dist/src/molecules/tabs.d.ts +11 -11
- package/dist/src/molecules/tabs.d.ts.map +1 -1
- package/dist/src/molecules/toast.d.ts +25 -13
- package/dist/src/molecules/toast.d.ts.map +1 -1
- package/dist/src/molecules/totals-summary.d.ts +1 -1
- package/dist/src/molecules/totals-summary.d.ts.map +1 -1
- package/dist/src/molecules/tour.d.ts +1 -1
- package/dist/src/molecules/tour.d.ts.map +1 -1
- package/dist/src/molecules/tree-view.d.ts +16 -20
- package/dist/src/molecules/tree-view.d.ts.map +1 -1
- package/dist/src/molecules/vertical-navigation.d.ts +2 -2
- package/dist/src/molecules/vertical-navigation.d.ts.map +1 -1
- package/dist/src/organisms/data-table.d.ts +24 -3
- package/dist/src/organisms/data-table.d.ts.map +1 -1
- package/dist/src/organisms/data-table.fields.d.ts +4 -1
- package/dist/src/organisms/data-table.fields.d.ts.map +1 -1
- package/dist/src/organisms/data-table.helpers.d.ts +5 -12
- package/dist/src/organisms/data-table.helpers.d.ts.map +1 -1
- package/dist/src/organisms/footer.d.ts +5 -5
- package/dist/src/organisms/footer.d.ts.map +1 -1
- package/dist/src/organisms/gallery.d.ts +11 -9
- package/dist/src/organisms/gallery.d.ts.map +1 -1
- package/dist/src/organisms/header.d.ts +24 -22
- package/dist/src/organisms/header.d.ts.map +1 -1
- package/dist/src/organisms/table.d.ts +14 -14
- package/dist/src/organisms/table.d.ts.map +1 -1
- package/dist/src/templates/accordion.d.ts +8 -6
- package/dist/src/templates/accordion.d.ts.map +1 -1
- package/dist/src/templates/breadcrumb.d.ts +1 -1
- package/dist/src/templates/breadcrumb.d.ts.map +1 -1
- package/dist/src/templates/carousel.d.ts +3 -3
- package/dist/src/templates/carousel.d.ts.map +1 -1
- package/dist/src/templates/facet-filter-panel.d.ts +9 -3
- package/dist/src/templates/facet-filter-panel.d.ts.map +1 -1
- package/dist/src/templates/gallery.d.ts +2 -2
- package/dist/src/templates/gallery.d.ts.map +1 -1
- package/dist/src/templates/numeric-input.d.ts +1 -1
- package/dist/src/templates/numeric-input.d.ts.map +1 -1
- package/dist/src/templates/popover.d.ts +4 -2
- package/dist/src/templates/popover.d.ts.map +1 -1
- package/dist/src/templates/product-card.d.ts +12 -4
- package/dist/src/templates/product-card.d.ts.map +1 -1
- package/dist/src/templates/search-suggestions.d.ts +1 -1
- package/dist/src/templates/select.d.ts +7 -2
- package/dist/src/templates/select.d.ts.map +1 -1
- package/dist/src/templates/tabs.d.ts +8 -7
- package/dist/src/templates/tabs.d.ts.map +1 -1
- package/dist/src/theme/theme-config.d.ts +9 -16
- package/dist/src/theme/theme-config.d.ts.map +1 -1
- package/dist/src/theme/theme-provider.d.ts +16 -21
- package/dist/src/theme/theme-provider.d.ts.map +1 -1
- package/dist/src/theme/theme-toggle.d.ts.map +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/templates/accordion.js +3 -1
- package/dist/templates/breadcrumb.js +11 -4
- package/dist/templates/carousel.js +3 -6
- package/dist/templates/facet-filter-panel.js +121 -52
- package/dist/templates/gallery.js +6 -2
- package/dist/templates/numeric-input.js +6 -1
- package/dist/templates/popover.js +6 -1
- package/dist/templates/product-card.js +52 -26
- package/dist/templates/select.js +6 -1
- package/dist/templates/tabs.js +4 -2
- package/dist/theme/theme-config.js +8 -16
- package/dist/theme/theme-provider.js +89 -63
- package/dist/theme/theme-toggle.js +17 -9
- package/dist/utils.js +11 -1
- package/package.json +9 -5
- package/src/tokens/_base.css +4 -3
- package/src/tokens/_business-atoms.css +103 -0
- package/src/tokens/_foundation-overrides.css +251 -0
- package/src/tokens/_reset.css +10 -10
- package/src/tokens/_scheme-scopes.css +4144 -0
- package/src/tokens/_semantic.css +1 -23
- package/src/tokens/_tokens-base.css +36 -32
- package/src/tokens/_typography.css +2 -1
- package/src/tokens/components/_form-control.css +149 -6
- package/src/tokens/components/_popup-surface.css +15 -29
- package/src/tokens/components/atoms/_action-icon.css +49 -0
- package/src/tokens/components/atoms/_button.css +67 -0
- package/src/tokens/components/atoms/_checkbox.css +47 -4
- package/src/tokens/components/atoms/_hotkeys.css +2 -0
- package/src/tokens/components/atoms/_icon.css +60 -7
- package/src/tokens/components/atoms/_image.css +18 -0
- package/src/tokens/components/atoms/_input.css +20 -0
- package/src/tokens/components/atoms/_label.css +3 -7
- package/src/tokens/components/atoms/_link.css +47 -5
- package/src/tokens/components/atoms/_numeric-input.css +111 -2
- package/src/tokens/components/atoms/_rating.css +55 -6
- package/src/tokens/components/atoms/_skeleton.css +12 -2
- package/src/tokens/components/atoms/_status-text.css +35 -5
- package/src/tokens/components/atoms/_textarea.css +32 -3
- package/src/tokens/components/atoms/_tooltip.css +25 -0
- package/src/tokens/components/molecules/_accordion.css +46 -5
- package/src/tokens/components/molecules/_breadcrumb.css +15 -4
- package/src/tokens/components/molecules/_carousel.css +67 -0
- package/src/tokens/components/molecules/_cascade-select.css +104 -0
- package/src/tokens/components/molecules/_chart.css +12 -14
- package/src/tokens/components/molecules/_color-select.css +21 -0
- package/src/tokens/components/molecules/_combobox.css +81 -0
- package/src/tokens/components/molecules/_command.css +1 -0
- package/src/tokens/components/molecules/_date-picker.css +66 -10
- package/src/tokens/components/molecules/_dialog.css +36 -4
- package/src/tokens/components/molecules/_drawer.css +39 -3
- package/src/tokens/components/molecules/_file-upload.css +16 -1
- package/src/tokens/components/molecules/_menu.css +17 -0
- package/src/tokens/components/molecules/_pagination.css +19 -0
- package/src/tokens/components/molecules/_phone-input.css +20 -5
- package/src/tokens/components/molecules/_popover.css +34 -0
- package/src/tokens/components/molecules/_product-card.css +49 -0
- package/src/tokens/components/molecules/_radio-card.css +35 -0
- package/src/tokens/components/molecules/_radio-group.css +8 -0
- package/src/tokens/components/molecules/_select.css +33 -0
- package/src/tokens/components/molecules/_slider.css +5 -0
- package/src/tokens/components/molecules/_steps.css +52 -0
- package/src/tokens/components/molecules/_switch.css +59 -10
- package/src/tokens/components/molecules/_tabs.css +61 -3
- package/src/tokens/components/molecules/_toast.css +60 -0
- package/src/tokens/components/molecules/_totals-summary.css +22 -22
- package/src/tokens/components/molecules/_tour.css +16 -1
- package/src/tokens/components/molecules/_tree-view.css +27 -3
- package/src/tokens/components/molecules/_vertical-navigation.css +21 -3
- package/src/tokens/components/organisms/_data-table.css +97 -0
- package/src/tokens/components/organisms/_footer.css +9 -0
- package/src/tokens/components/organisms/_gallery.css +11 -0
- package/src/tokens/components/organisms/_header.css +22 -0
- package/src/tokens/components/organisms/_sidebar.css +1 -1
- package/src/tokens/components/organisms/_table.css +31 -0
- package/src/tokens/components/templates/_facet-filter-panel.css +11 -1
- package/src/tokens/figma/akros/variables.css +6 -6
- package/src/tokens/figma/brand-overrides.css +162 -57
- package/src/tokens/figma/business/variables.css +6 -6
- package/src/tokens/figma/cyber/variables.css +115 -38
- package/src/tokens/figma/cyber-dark/variables.css +115 -38
- package/src/tokens/figma/dark/variables.css +4 -4
- package/src/tokens/figma/light/variables.css +43 -40
- package/src/tokens/figma/{neo → n1}/variables.css +114 -114
- package/src/tokens/figma/variables.css +639 -240
- package/src/tokens/theme.css +24 -4
- package/src/tokens/_colors.css +0 -5
- package/src/tokens/figma/neo-dark/variables.css +0 -457
package/dist/molecules/dialog.js
CHANGED
|
@@ -1,44 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { connect, machine } from "@zag-js/dialog";
|
|
2
4
|
import { Portal, normalizeProps, useMachine } from "@zag-js/react";
|
|
3
|
-
import { useId } from "react";
|
|
5
|
+
import { useId, useState } from "react";
|
|
4
6
|
import { tv } from "tailwind-variants";
|
|
5
7
|
import { ActionIcon } from "../atoms/action-icon.js";
|
|
6
8
|
import { Button } from "../atoms/button.js";
|
|
7
|
-
import
|
|
9
|
+
import { OverlayContainerProvider } from "../internal/overlay-portal.js";
|
|
8
10
|
const dialogVariants = tv({
|
|
9
11
|
slots: {
|
|
10
12
|
backdrop: [
|
|
11
|
-
"inset-0
|
|
13
|
+
"dialog-backdrop-layer inset-0"
|
|
12
14
|
],
|
|
13
15
|
positioner: [
|
|
14
|
-
"inset-0
|
|
16
|
+
"dialog-positioner-layer inset-0 flex"
|
|
15
17
|
],
|
|
16
18
|
content: [
|
|
17
|
-
"relative flex flex-col gap-dialog-content p-dialog-content",
|
|
19
|
+
"relative flex min-w-0 max-w-full flex-col gap-dialog-content p-dialog-content",
|
|
18
20
|
"bg-dialog-content-bg text-dialog-content-fg",
|
|
19
21
|
"border-(length:--border-width-dialog) border-dialog-content-border",
|
|
20
|
-
"shadow-dialog-
|
|
21
|
-
"overflow-y-auto",
|
|
22
|
+
"shadow-dialog-panel",
|
|
22
23
|
"focus-visible:outline-(style:--default-ring-style) focus-visible:outline-(length:--default-ring-width)",
|
|
23
24
|
"focus-visible:outline-dialog-ring",
|
|
24
25
|
"focus-visible:outline-offset-(length:--default-ring-offset)"
|
|
25
26
|
],
|
|
27
|
+
scrollViewport: "flex min-h-0 flex-col gap-dialog-content overflow-y-auto",
|
|
26
28
|
title: [
|
|
27
|
-
"
|
|
29
|
+
"dialog-heading-typography break-words pe-dialog-title-safe font-dialog-title text-dialog-title-fg"
|
|
28
30
|
],
|
|
29
31
|
description: [
|
|
30
|
-
"
|
|
32
|
+
"dialog-copy-typography text-dialog-description-fg"
|
|
31
33
|
],
|
|
32
34
|
trigger: [],
|
|
33
35
|
closeTrigger: [
|
|
34
36
|
"absolute end-dialog-close-trigger-offset top-dialog-close-trigger-offset"
|
|
35
37
|
],
|
|
36
|
-
actions: "mt-auto flex shrink-0 justify-end gap-dialog-actions pt-dialog-actions-top"
|
|
38
|
+
actions: "mt-auto flex shrink-0 flex-wrap justify-end gap-dialog-actions pt-dialog-actions-top"
|
|
37
39
|
},
|
|
38
40
|
variants: {
|
|
39
41
|
placement: {
|
|
40
42
|
center: {
|
|
41
|
-
positioner: "items-center justify-center",
|
|
43
|
+
positioner: "items-center justify-center p-dialog-positioner",
|
|
42
44
|
content: "max-h-dialog-center-h-max max-w-dialog-center-w-max rounded-dialog-content-center"
|
|
43
45
|
},
|
|
44
46
|
left: {
|
|
@@ -89,13 +91,33 @@ const dialogVariants = tv({
|
|
|
89
91
|
backdrop: "bg-dialog-backdrop-bg-modal"
|
|
90
92
|
},
|
|
91
93
|
modeless: {
|
|
92
|
-
backdrop: "bg-transparent",
|
|
94
|
+
backdrop: "pointer-events-none bg-transparent",
|
|
93
95
|
positioner: "pointer-events-none",
|
|
94
96
|
content: "pointer-events-auto"
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
},
|
|
98
100
|
compoundVariants: [
|
|
101
|
+
...[
|
|
102
|
+
"xs",
|
|
103
|
+
"sm",
|
|
104
|
+
"md",
|
|
105
|
+
"lg",
|
|
106
|
+
"xl",
|
|
107
|
+
"full"
|
|
108
|
+
].map((size)=>({
|
|
109
|
+
placement: "center",
|
|
110
|
+
size,
|
|
111
|
+
class: {
|
|
112
|
+
content: "full" === size ? "w-full" : ({
|
|
113
|
+
xs: "w-dialog-xs",
|
|
114
|
+
sm: "w-dialog-sm",
|
|
115
|
+
md: "w-dialog-md",
|
|
116
|
+
lg: "w-dialog-lg",
|
|
117
|
+
xl: "w-dialog-xl"
|
|
118
|
+
})[size]
|
|
119
|
+
}
|
|
120
|
+
})),
|
|
99
121
|
{
|
|
100
122
|
placement: [
|
|
101
123
|
"left",
|
|
@@ -224,70 +246,82 @@ const dialogVariants = tv({
|
|
|
224
246
|
position: "fixed"
|
|
225
247
|
}
|
|
226
248
|
});
|
|
227
|
-
function Dialog({ id, open, onOpenChange, initialFocusEl, finalFocusEl, role = "dialog", placement = "center", position = "fixed", size = "md", behavior = "modal", closeOnEscape = true, closeOnInteractOutside = true, preventScroll
|
|
249
|
+
function Dialog({ "aria-label": ariaLabel, id, open, onOpenChange, initialFocusEl, finalFocusEl, role = "dialog", placement = "center", position = "fixed", size = "md", behavior = "modal", closeOnEscape = true, closeOnInteractOutside = true, preventScroll, trapFocus, customTrigger = false, triggerText = "Open", title, description, children, hideCloseButton = false, actions, className, modal, portal = true }) {
|
|
228
250
|
const generatedId = useId();
|
|
229
251
|
const uniqueId = id || generatedId;
|
|
230
|
-
const
|
|
252
|
+
const isModal = modal ?? "modeless" !== behavior;
|
|
253
|
+
const [contentElement, setContentElement] = useState(null);
|
|
254
|
+
const service = useMachine(machine, {
|
|
231
255
|
id: uniqueId,
|
|
232
256
|
onOpenChange,
|
|
233
257
|
role,
|
|
234
258
|
closeOnEscape,
|
|
235
259
|
closeOnInteractOutside,
|
|
236
|
-
preventScroll,
|
|
237
|
-
trapFocus,
|
|
260
|
+
preventScroll: preventScroll ?? isModal,
|
|
261
|
+
trapFocus: trapFocus ?? isModal,
|
|
238
262
|
initialFocusEl,
|
|
239
263
|
finalFocusEl,
|
|
240
|
-
modal,
|
|
264
|
+
modal: isModal,
|
|
265
|
+
"aria-label": ariaLabel,
|
|
241
266
|
...void 0 !== open && {
|
|
242
267
|
open
|
|
243
268
|
}
|
|
244
269
|
});
|
|
245
|
-
const api =
|
|
246
|
-
const { backdrop, positioner, content, trigger: triggerSlot, title: titleSlot, description: descriptionSlot, closeTrigger, actions: actionsSlot } = dialogVariants({
|
|
270
|
+
const api = connect(service, normalizeProps);
|
|
271
|
+
const { backdrop, positioner, content, scrollViewport, trigger: triggerSlot, title: titleSlot, description: descriptionSlot, closeTrigger, actions: actionsSlot } = dialogVariants({
|
|
247
272
|
placement,
|
|
248
273
|
size,
|
|
249
|
-
behavior,
|
|
274
|
+
behavior: isModal ? "modal" : "modeless",
|
|
250
275
|
position
|
|
251
276
|
});
|
|
252
277
|
const dialogContent = ()=>/*#__PURE__*/ jsxs(Fragment, {
|
|
253
278
|
children: [
|
|
254
|
-
/*#__PURE__*/ jsx("div", {
|
|
279
|
+
isModal && /*#__PURE__*/ jsx("div", {
|
|
255
280
|
className: backdrop(),
|
|
256
281
|
...api.getBackdropProps()
|
|
257
282
|
}),
|
|
258
283
|
/*#__PURE__*/ jsx("div", {
|
|
259
284
|
className: positioner(),
|
|
260
285
|
...api.getPositionerProps(),
|
|
261
|
-
children: /*#__PURE__*/
|
|
286
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
262
287
|
className: content({
|
|
263
288
|
className
|
|
264
289
|
}),
|
|
265
290
|
...api.getContentProps(),
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
+
ref: setContentElement,
|
|
292
|
+
children: /*#__PURE__*/ jsxs(OverlayContainerProvider, {
|
|
293
|
+
container: isModal ? contentElement : null,
|
|
294
|
+
children: [
|
|
295
|
+
!hideCloseButton && /*#__PURE__*/ jsx(ActionIcon, {
|
|
296
|
+
className: closeTrigger(),
|
|
297
|
+
icon: "token-icon-dialog-close",
|
|
298
|
+
size: "md",
|
|
299
|
+
tone: "neutral",
|
|
300
|
+
...api.getCloseTriggerProps(),
|
|
301
|
+
"aria-label": "Close dialog"
|
|
302
|
+
}),
|
|
303
|
+
/*#__PURE__*/ jsxs("div", {
|
|
304
|
+
className: scrollViewport(),
|
|
305
|
+
children: [
|
|
306
|
+
title && /*#__PURE__*/ jsx("h2", {
|
|
307
|
+
className: titleSlot(),
|
|
308
|
+
...api.getTitleProps(),
|
|
309
|
+
children: title
|
|
310
|
+
}),
|
|
311
|
+
description && /*#__PURE__*/ jsx("div", {
|
|
312
|
+
className: descriptionSlot(),
|
|
313
|
+
...api.getDescriptionProps(),
|
|
314
|
+
children: description
|
|
315
|
+
}),
|
|
316
|
+
children
|
|
317
|
+
]
|
|
318
|
+
}),
|
|
319
|
+
actions && /*#__PURE__*/ jsx("div", {
|
|
320
|
+
className: actionsSlot(),
|
|
321
|
+
children: actions
|
|
322
|
+
})
|
|
323
|
+
]
|
|
324
|
+
})
|
|
291
325
|
})
|
|
292
326
|
})
|
|
293
327
|
]
|
package/dist/molecules/drawer.js
CHANGED
|
@@ -1,11 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
"use client";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { Portal, mergeProps } from "@zag-js/react";
|
|
5
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
4
6
|
import { ActionIcon } from "../atoms/action-icon.js";
|
|
5
7
|
import { Button } from "../atoms/button.js";
|
|
6
8
|
import { DrawerProvider, DrawerStackProvider, getDrawerPresenceProps, useComposedRefs, useDrawer, useDrawerContext, useDrawerPresence, useDrawerStackContext } from "../internal/molecules/drawer.context.js";
|
|
7
9
|
import { drawerVariants } from "../internal/molecules/drawer.styles.js";
|
|
8
|
-
|
|
10
|
+
import { OverlayContainerProvider, restoreFocusAfterOverlayClose } from "../internal/overlay-portal.js";
|
|
11
|
+
function getDrawerQueryRoot(root) {
|
|
12
|
+
return 9 === root.nodeType || 11 === root.nodeType ? root : root.ownerDocument ?? document;
|
|
13
|
+
}
|
|
14
|
+
function drawer_useDrawer(props = {}) {
|
|
15
|
+
const contentRef = useRef(null);
|
|
16
|
+
const api = useDrawer({
|
|
17
|
+
...props,
|
|
18
|
+
initialFocusEl: props.initialFocusEl ?? ("alertdialog" === props.role ? void 0 : ()=>{
|
|
19
|
+
const content = contentRef.current;
|
|
20
|
+
const active = content?.ownerDocument.activeElement;
|
|
21
|
+
return active && content?.contains(active) ? active : null;
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
const previousOpen = useRef(api.open);
|
|
25
|
+
const triggerRef = useRef(null);
|
|
26
|
+
const cancelRestore = useRef(void 0);
|
|
27
|
+
useLayoutEffect(()=>{
|
|
28
|
+
if (api.open) {
|
|
29
|
+
cancelRestore.current?.();
|
|
30
|
+
const queryRoot = getDrawerQueryRoot(props.getRootNode?.() ?? document);
|
|
31
|
+
const contentId = api.getContentProps().id;
|
|
32
|
+
const triggerId = api.getTriggerProps({
|
|
33
|
+
value: api.triggerValue ?? void 0
|
|
34
|
+
}).id;
|
|
35
|
+
contentRef.current = contentId ? queryRoot.getElementById(contentId) : null;
|
|
36
|
+
triggerRef.current = triggerId ? queryRoot.getElementById(triggerId) : null;
|
|
37
|
+
} else if (previousOpen.current && false !== props.restoreFocus) {
|
|
38
|
+
const content = contentRef.current;
|
|
39
|
+
if (content) cancelRestore.current = restoreFocusAfterOverlayClose(content, ()=>props.finalFocusEl?.() ?? triggerRef.current);
|
|
40
|
+
}
|
|
41
|
+
previousOpen.current = api.open;
|
|
42
|
+
});
|
|
43
|
+
useEffect(()=>()=>cancelRestore.current?.(), []);
|
|
44
|
+
return api;
|
|
45
|
+
}
|
|
9
46
|
const swipeDirectionByPlacement = {
|
|
10
47
|
bottom: "down",
|
|
11
48
|
end: "end",
|
|
@@ -90,9 +127,11 @@ Drawer.Positioner = function({ className, ref, ...props }) {
|
|
|
90
127
|
ref: ref
|
|
91
128
|
});
|
|
92
129
|
};
|
|
93
|
-
Drawer.Content = function({ className, draggable = true, ref, ...props }) {
|
|
130
|
+
Drawer.Content = function({ children, className, draggable = true, ref, ...props }) {
|
|
94
131
|
const { api, presence, styles } = useDrawerContext();
|
|
95
|
-
const
|
|
132
|
+
const [contentElement, setContentElement] = useState(null);
|
|
133
|
+
const externalRef = useComposedRefs(ref, setContentElement);
|
|
134
|
+
const composedRef = useComposedRefs(presence.ref, externalRef);
|
|
96
135
|
if (presence.unmounted) return null;
|
|
97
136
|
const mergedProps = mergeProps(api.getContentProps({
|
|
98
137
|
draggable
|
|
@@ -102,7 +141,14 @@ Drawer.Content = function({ className, draggable = true, ref, ...props }) {
|
|
|
102
141
|
className: styles.content({
|
|
103
142
|
className
|
|
104
143
|
}),
|
|
105
|
-
ref: composedRef
|
|
144
|
+
ref: composedRef,
|
|
145
|
+
children: /*#__PURE__*/ jsx(OverlayContainerProvider, {
|
|
146
|
+
container: api.open && true === mergedProps["aria-modal"] ? contentElement : null,
|
|
147
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
148
|
+
className: "drawer-visible-viewport",
|
|
149
|
+
children: children
|
|
150
|
+
})
|
|
151
|
+
})
|
|
106
152
|
});
|
|
107
153
|
};
|
|
108
154
|
Drawer.Header = function({ className, ref, ...props }) {
|
|
@@ -129,7 +175,10 @@ Drawer.Footer = function({ className, ref, ...props }) {
|
|
|
129
175
|
const { styles } = useDrawerContext();
|
|
130
176
|
return /*#__PURE__*/ jsx("div", {
|
|
131
177
|
className: styles.footer({
|
|
132
|
-
className
|
|
178
|
+
className: [
|
|
179
|
+
"drawer-visible-footer flex-wrap",
|
|
180
|
+
className
|
|
181
|
+
]
|
|
133
182
|
}),
|
|
134
183
|
ref: ref,
|
|
135
184
|
...props
|