@mittwald/flow-react-components 1.6.0-next.67 → 1.6.0-next.69

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.
Files changed (42) hide show
  1. package/dist/assets/component-index.json +1 -1
  2. package/dist/assets/doc-properties.json +1 -1
  3. package/dist/css/all-layered.css +1 -1
  4. package/dist/css/all.css +1 -1
  5. package/dist/js/_virtual/_22.locale.mjs +6 -2
  6. package/dist/js/default.mjs +2 -1
  7. package/dist/js/packages/components/src/components/CodeEditor/CodeEditor.mjs +17 -8
  8. package/dist/js/packages/components/src/components/CodeEditor/CodeEditor.mjs.map +1 -1
  9. package/dist/js/packages/components/src/components/FileCard/components/FileSizeText/FileSizeText.mjs +25 -6
  10. package/dist/js/packages/components/src/components/FileCard/components/FileSizeText/FileSizeText.mjs.map +1 -1
  11. package/dist/js/packages/components/src/components/LightBox/LightBox.mjs +16 -8
  12. package/dist/js/packages/components/src/components/LightBox/LightBox.mjs.map +1 -1
  13. package/dist/js/packages/components/src/components/LightBox/LightBox.module.mjs +3 -1
  14. package/dist/js/packages/components/src/components/LightBox/LightBox.module.mjs.map +1 -1
  15. package/dist/js/packages/components/src/components/LightBox/components/LightBoxGallery/LightBoxGallery.mjs +15 -12
  16. package/dist/js/packages/components/src/components/LightBox/components/LightBoxGallery/LightBoxGallery.mjs.map +1 -1
  17. package/dist/js/packages/components/src/components/LightBox/components/LightBoxGallery/LightBoxGallery.module.mjs.map +1 -1
  18. package/dist/js/packages/components/src/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.mjs +7 -6
  19. package/dist/js/packages/components/src/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.mjs.map +1 -1
  20. package/dist/js/packages/components/src/components/LightBox/components/LightBoxZoom/LightBoxZoom.mjs +82 -0
  21. package/dist/js/packages/components/src/components/LightBox/components/LightBoxZoom/LightBoxZoom.mjs.map +1 -0
  22. package/dist/js/packages/components/src/components/LightBox/components/LightBoxZoom/LightBoxZoom.module.mjs +20 -0
  23. package/dist/js/packages/components/src/components/LightBox/components/LightBoxZoom/LightBoxZoom.module.mjs.map +1 -0
  24. package/dist/js/packages/components/src/components/LightBox/components/LightBoxZoom/hooks/useZoom.mjs +282 -0
  25. package/dist/js/packages/components/src/components/LightBox/components/LightBoxZoom/hooks/useZoom.mjs.map +1 -0
  26. package/dist/js/packages/components/src/components/LightBox/components/LightBoxZoom/lib/zoomTransform.mjs +58 -0
  27. package/dist/js/packages/components/src/components/LightBox/components/LightBoxZoom/lib/zoomTransform.mjs.map +1 -0
  28. package/dist/js/packages/components/src/lib/dom/getCspNonce.mjs +16 -0
  29. package/dist/js/packages/components/src/lib/dom/getCspNonce.mjs.map +1 -0
  30. package/dist/js/packages/components/src/views/LightBoxZoomView.mjs +15 -0
  31. package/dist/js/packages/components/src/views/LightBoxZoomView.mjs.map +1 -0
  32. package/dist/types/components/LightBox/LightBox.d.ts +6 -0
  33. package/dist/types/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.d.ts +3 -4
  34. package/dist/types/components/LightBox/components/LightBoxZoom/LightBoxZoom.d.ts +12 -0
  35. package/dist/types/components/LightBox/components/LightBoxZoom/hooks/useZoom.d.ts +16 -0
  36. package/dist/types/components/LightBox/components/LightBoxZoom/index.d.ts +2 -0
  37. package/dist/types/components/LightBox/components/LightBoxZoom/lib/zoomTransform.d.ts +43 -0
  38. package/dist/types/components/LightBox/components/LightBoxZoom/view.d.ts +7 -0
  39. package/dist/types/components/LightBox/index.d.ts +1 -0
  40. package/dist/types/lib/dom/getCspNonce.d.ts +6 -0
  41. package/dist/types/views/LightBoxZoomView.d.ts +4 -0
  42. package/package.json +10 -10
@@ -7,14 +7,18 @@ var __locale_default = {
7
7
  "gallery": "Bildergalerie",
8
8
  "indicator": "{current} von {count}",
9
9
  "next": "Nächstes",
10
- "previous": "Vorheriges"
10
+ "previous": "Vorheriges",
11
+ "zoom": "Zoombare Ansicht",
12
+ "zoomDescription": "Klick oder Eingabe vergrößert. Plus und Minus ändern die Vergrößerung, die Pfeiltasten verschieben das vergrößerte Bild."
11
13
  },
12
14
  "en-US": {
13
15
  "close": "Close",
14
16
  "gallery": "Image gallery",
15
17
  "indicator": "{current} of {count}",
16
18
  "next": "Next",
17
- "previous": "Previous"
19
+ "previous": "Previous",
20
+ "zoom": "Zoomable view",
21
+ "zoomDescription": "Click or press Enter to zoom. Plus and minus change the zoom, the arrow keys move the zoomed image."
18
22
  }
19
23
  };
20
24
  export { __locale_default as default };
@@ -274,6 +274,7 @@ import { LabeledValue } from "./packages/components/src/components/LabeledValue/
274
274
  import { LayoutCard } from "./packages/components/src/components/LayoutCard/LayoutCard.mjs";
275
275
  import { LightBoxTrigger } from "./packages/components/src/components/LightBox/components/LightBoxTrigger/LightBoxTrigger.mjs";
276
276
  import { LightBoxGallery } from "./packages/components/src/components/LightBox/components/LightBoxGallery/LightBoxGallery.mjs";
277
+ import { LightBoxZoom } from "./packages/components/src/components/LightBox/components/LightBoxZoom/LightBoxZoom.mjs";
277
278
  import { LightBoxGalleryItem } from "./packages/components/src/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.mjs";
278
279
  import { OverlayContent } from "./packages/components/src/components/Overlay/components/OverlayContent.mjs";
279
280
  import { Overlay } from "./packages/components/src/components/Overlay/Overlay.mjs";
@@ -341,4 +342,4 @@ import { Tab } from "./packages/components/src/components/Tabs/components/Tab/Ta
341
342
  import { TextField } from "./packages/components/src/components/TextField/TextField.mjs";
342
343
  import { Truncate } from "./packages/components/src/components/Truncate/Truncate.mjs";
343
344
  import { TunnelEntry } from "./packages/components/src/components/TunnelEntry/TunnelEntry.mjs";
344
- export { AbortActionError, AccentBox, Accordion, AccordionGroup, Action, ActionBatch, ActionGroup, Activity, Alert, AlertBadge, AlertIcon, AlertText, Align, Area, AreaDot, Autocomplete, Avatar, AvatarStack, Badge, Bar, BigNumber, Breadcrumb, BrowserOnly, Button, CartesianChart, CartesianGrid, ChartGrid, ChartLegend, ChartTooltip, Chat, Checkbox, CheckboxButton, CheckboxGroup, ClearPropsContext, CoachMark, CodeBlock, CodeEditor, Color, ColumnLayout, Combine, ComboBox, ComponentDefaultsContext, ComponentDefaultsProvider, ComponentPropsContextProvider, Content, ContextMenu, ContextMenuContent, ContextMenuSection, ContextMenuTrigger, ContextualHelp, ContextualHelpTrigger, CopyButton, CounterBadge, CountryOptions, DatePicker, DateRangePicker, DeprecationWarningContext, DeprecationWarningProvider, DialogTrigger, Div, DonutChart, EmptyView, EmptyViewContainer, FieldDescription, FieldError, FileCard, FileCardList, FileDropZone, FileField, Flex, GridList, GridListItem, Header, HeaderNavigation, Heading, Icon, IconAI, IconAIHosting, IconAnalytics, IconApp, IconAscending, IconAttachment, IconAutoresponder, IconBackLink, IconBackup, IconBold, IconCamera, IconCertificate, IconChangelog, IconCheck, IconCheckboxChecked, IconCheckboxEmpty, IconCheckboxIndeterminate, IconChevronDown, IconChevronLeft, IconChevronRight, IconChevronUp, IconClose, IconCode, IconContainer, IconContextMenu, IconContextMenuVertical, IconContract, IconContractPartner, IconContributor, IconCopy, IconCronjob, IconCustomer, IconDanger, IconDashboard, IconDatabase, IconDate, IconDelete, IconDeliveryBox, IconDescending, IconDesktop, IconDirectory, IconDnsSubZone, IconDnsZone, IconDomain, IconDownload, IconEdit, IconEmail, IconEmailArchive, IconExtension, IconExternalLink, IconFailed, IconFeedback, IconFile, IconFilter, IconForwardAddress, IconForwardLink, IconHide, IconHome, IconImage, IconInfo, IconInvite, IconInvoice, IconItalic, IconKnowledgeHint, IconLanguage, IconLeadFyndr, IconLink, IconLock, IconLockOpen, IconLogout, IconMainUser, IconMarketplace, IconMaximize, IconMember, IconMenu, IconMinimize, IconMinus, IconMittwald, IconMobile, IconMonitoring, IconMove, IconNewsletter, IconNotification, IconNumber, IconOrder, IconOrderedList, IconPassword, IconPath, IconPause, IconPayment, IconPending, IconPicture, IconPlus, IconProject, IconQuote, IconRadioOff, IconRadioOn, IconRedo, IconRefresh, IconRegistry, IconSave, IconSearch, IconSecurity, IconSend, IconServer, IconSetProvider, IconSettings, IconShare, IconShow, IconSorting, IconSsh, IconSshKey, IconSshSftp, IconStack, IconStar, IconStarFilled, IconStart, IconStrikeThrough, IconSubdomain, IconSucceeded, IconSuccess, IconSupport, IconTerminate, IconTicket, IconTime, IconUnavailable, IconUndo, IconUnorderedList, IconUpload, IconUser, IconVhost, IconView, IconVolume, IconWarning, IllustratedMessage, Image, ImageCropper, Initials, InlineCode, IntlProvider, Kbd, Label, LabeledValue, LayoutCard, Legend, LegendItem, LightBox, LightBoxGallery, LightBoxGalleryItem, LightBoxTrigger, Line, Link, List, ListFilter, ListItem, ListItemView, ListItemViewContent, ListLoaderAsync, ListSorting, ListStaticData, ListSummary, LoadingSpinner, Markdown, MarkdownEditor, MenuItem, MenuTrigger, Message, MessageSeparator, MessageThread, Modal, ModalTrigger, Navigation, NavigationGroup, Notification, NotificationController, NotificationProvider, NumberField, Option, Overlay, OverlayContent, OverlayController, OverlayTrigger, PasswordCreationField, Popover, PopoverContent, PopoverTrigger, ProgressBar, PropsContextProvider, Radio, RadioButton, RadioGroup, RangeCalendar, Rating, RatingSegment, Render, RouterProvider, SearchField, Section, Segment, SegmentedControl, Select, Separator, SettingsProvider, Skeleton, SkeletonMode, SkeletonText, Slider, SortingFunctions, SuspenseTrigger, Switch, Tab, TabNavigation, TabTitle, Table, TableBody, TableCell, TableColumn, TableFooterRow, TableHeader, TableRow, Tabs, Text, TextArea, TextField, ThemedHtml, TimeField, Tooltip, TooltipTrigger, TranslationProvider, Truncate, TunnelEntry, TypedArea, TypedBar, TypedChartGrid, TypedChartLegend, TypedChartTooltip, TypedLine, TypedList, TypedListFilter, TypedListItem, TypedListLoaderAsync, TypedListSorting, TypedListStaticData, TypedXAxis, TypedYAxis, Wrap, XAxis, YAxis, abortAction, builtInComponentDefaults, dynamic, eventHandlerContext, flags, getRemoteEvent, getResolvedTheme, getTheme, iconCategories, isDateRangeValue, overlayTriggersTunneledTo, propsContext, resolveDateRangeFilterValue, setTheme, sortByDachFirst, themeHtmlAttribute, typedCartesianChart, typedList, useAriaAnnounceSuspense, useComponentDefaults, useControlledRemoteValueProps, useDesignTokens, useIsMounted, useLanguage, useList, useListMetadata, useLocalizedStringFormatter, useModalController, useNotificationController, useOnChange, useOverlayController, useProps, useTheme as useStoredTheme, useResolvedTheme as useTheme, useTranslationProvider, useWarnDeprecation };
345
+ export { AbortActionError, AccentBox, Accordion, AccordionGroup, Action, ActionBatch, ActionGroup, Activity, Alert, AlertBadge, AlertIcon, AlertText, Align, Area, AreaDot, Autocomplete, Avatar, AvatarStack, Badge, Bar, BigNumber, Breadcrumb, BrowserOnly, Button, CartesianChart, CartesianGrid, ChartGrid, ChartLegend, ChartTooltip, Chat, Checkbox, CheckboxButton, CheckboxGroup, ClearPropsContext, CoachMark, CodeBlock, CodeEditor, Color, ColumnLayout, Combine, ComboBox, ComponentDefaultsContext, ComponentDefaultsProvider, ComponentPropsContextProvider, Content, ContextMenu, ContextMenuContent, ContextMenuSection, ContextMenuTrigger, ContextualHelp, ContextualHelpTrigger, CopyButton, CounterBadge, CountryOptions, DatePicker, DateRangePicker, DeprecationWarningContext, DeprecationWarningProvider, DialogTrigger, Div, DonutChart, EmptyView, EmptyViewContainer, FieldDescription, FieldError, FileCard, FileCardList, FileDropZone, FileField, Flex, GridList, GridListItem, Header, HeaderNavigation, Heading, Icon, IconAI, IconAIHosting, IconAnalytics, IconApp, IconAscending, IconAttachment, IconAutoresponder, IconBackLink, IconBackup, IconBold, IconCamera, IconCertificate, IconChangelog, IconCheck, IconCheckboxChecked, IconCheckboxEmpty, IconCheckboxIndeterminate, IconChevronDown, IconChevronLeft, IconChevronRight, IconChevronUp, IconClose, IconCode, IconContainer, IconContextMenu, IconContextMenuVertical, IconContract, IconContractPartner, IconContributor, IconCopy, IconCronjob, IconCustomer, IconDanger, IconDashboard, IconDatabase, IconDate, IconDelete, IconDeliveryBox, IconDescending, IconDesktop, IconDirectory, IconDnsSubZone, IconDnsZone, IconDomain, IconDownload, IconEdit, IconEmail, IconEmailArchive, IconExtension, IconExternalLink, IconFailed, IconFeedback, IconFile, IconFilter, IconForwardAddress, IconForwardLink, IconHide, IconHome, IconImage, IconInfo, IconInvite, IconInvoice, IconItalic, IconKnowledgeHint, IconLanguage, IconLeadFyndr, IconLink, IconLock, IconLockOpen, IconLogout, IconMainUser, IconMarketplace, IconMaximize, IconMember, IconMenu, IconMinimize, IconMinus, IconMittwald, IconMobile, IconMonitoring, IconMove, IconNewsletter, IconNotification, IconNumber, IconOrder, IconOrderedList, IconPassword, IconPath, IconPause, IconPayment, IconPending, IconPicture, IconPlus, IconProject, IconQuote, IconRadioOff, IconRadioOn, IconRedo, IconRefresh, IconRegistry, IconSave, IconSearch, IconSecurity, IconSend, IconServer, IconSetProvider, IconSettings, IconShare, IconShow, IconSorting, IconSsh, IconSshKey, IconSshSftp, IconStack, IconStar, IconStarFilled, IconStart, IconStrikeThrough, IconSubdomain, IconSucceeded, IconSuccess, IconSupport, IconTerminate, IconTicket, IconTime, IconUnavailable, IconUndo, IconUnorderedList, IconUpload, IconUser, IconVhost, IconView, IconVolume, IconWarning, IllustratedMessage, Image, ImageCropper, Initials, InlineCode, IntlProvider, Kbd, Label, LabeledValue, LayoutCard, Legend, LegendItem, LightBox, LightBoxGallery, LightBoxGalleryItem, LightBoxTrigger, LightBoxZoom, Line, Link, List, ListFilter, ListItem, ListItemView, ListItemViewContent, ListLoaderAsync, ListSorting, ListStaticData, ListSummary, LoadingSpinner, Markdown, MarkdownEditor, MenuItem, MenuTrigger, Message, MessageSeparator, MessageThread, Modal, ModalTrigger, Navigation, NavigationGroup, Notification, NotificationController, NotificationProvider, NumberField, Option, Overlay, OverlayContent, OverlayController, OverlayTrigger, PasswordCreationField, Popover, PopoverContent, PopoverTrigger, ProgressBar, PropsContextProvider, Radio, RadioButton, RadioGroup, RangeCalendar, Rating, RatingSegment, Render, RouterProvider, SearchField, Section, Segment, SegmentedControl, Select, Separator, SettingsProvider, Skeleton, SkeletonMode, SkeletonText, Slider, SortingFunctions, SuspenseTrigger, Switch, Tab, TabNavigation, TabTitle, Table, TableBody, TableCell, TableColumn, TableFooterRow, TableHeader, TableRow, Tabs, Text, TextArea, TextField, ThemedHtml, TimeField, Tooltip, TooltipTrigger, TranslationProvider, Truncate, TunnelEntry, TypedArea, TypedBar, TypedChartGrid, TypedChartLegend, TypedChartTooltip, TypedLine, TypedList, TypedListFilter, TypedListItem, TypedListLoaderAsync, TypedListSorting, TypedListStaticData, TypedXAxis, TypedYAxis, Wrap, XAxis, YAxis, abortAction, builtInComponentDefaults, dynamic, eventHandlerContext, flags, getRemoteEvent, getResolvedTheme, getTheme, iconCategories, isDateRangeValue, overlayTriggersTunneledTo, propsContext, resolveDateRangeFilterValue, setTheme, sortByDachFirst, themeHtmlAttribute, typedCartesianChart, typedList, useAriaAnnounceSuspense, useComponentDefaults, useControlledRemoteValueProps, useDesignTokens, useIsMounted, useLanguage, useList, useListMetadata, useLocalizedStringFormatter, useModalController, useNotificationController, useOnChange, useOverlayController, useProps, useTheme as useStoredTheme, useResolvedTheme as useTheme, useTranslationProvider, useWarnDeprecation };
@@ -11,12 +11,17 @@ import CodeEditor_module_default from "./CodeEditor.module.mjs";
11
11
  import { defaultLightTheme } from "./themes/defaultEditorTheme.mjs";
12
12
  import { useCodeEditorExtensions } from "./hooks/useCodeEditorExtensions.mjs";
13
13
  import { CopyButton } from "../CopyButton/CopyButton.mjs";
14
+ import { getCspNonce } from "../../lib/dom/getCspNonce.mjs";
14
15
  import clsx from "clsx";
15
16
  import { useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
16
17
  import { jsx, jsxs } from "react/jsx-runtime";
17
18
  import { useObjectRef } from "react-aria";
18
19
  import CodeMirror, { EditorView } from "@uiw/react-codemirror";
19
20
  // src/components/CodeEditor/CodeEditor.tsx
21
+ var cspNonceExtensions = () => {
22
+ const nonce = getCspNonce();
23
+ return nonce ? [EditorView.cspNonce.of(nonce)] : [];
24
+ };
20
25
  /**
21
26
  * @flr-generate all
22
27
  * @flowStatus new
@@ -88,14 +93,18 @@ var CodeEditor = flowComponent("CodeEditor", (props) => {
88
93
  * `onChange` is a new object. All three are stable, so a render with
89
94
  * unchanged props leaves the editor as it is.
90
95
  */
91
- const allExtensions = useMemo(() => [...enabledExtensions, EditorView.contentAttributes.of({
92
- ...labelledBy ? { "aria-labelledby": labelledBy } : {},
93
- ...ariaLabel ? { "aria-label": ariaLabel } : {},
94
- ...describedBy ? { "aria-describedby": describedBy } : {},
95
- ...isRequired ? { "aria-required": "true" } : {},
96
- ...isInvalid ? { "aria-invalid": "true" } : {},
97
- ...isDisabled ? { "aria-disabled": "true" } : {}
98
- })], [
96
+ const allExtensions = useMemo(() => [
97
+ ...enabledExtensions,
98
+ ...cspNonceExtensions(),
99
+ EditorView.contentAttributes.of({
100
+ ...labelledBy ? { "aria-labelledby": labelledBy } : {},
101
+ ...ariaLabel ? { "aria-label": ariaLabel } : {},
102
+ ...describedBy ? { "aria-describedby": describedBy } : {},
103
+ ...isRequired ? { "aria-required": "true" } : {},
104
+ ...isInvalid ? { "aria-invalid": "true" } : {},
105
+ ...isDisabled ? { "aria-disabled": "true" } : {}
106
+ })
107
+ ], [
99
108
  enabledExtensions,
100
109
  labelledBy,
101
110
  ariaLabel,
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor.mjs","names":["styles"],"sources":["../../../../../../../src/components/CodeEditor/CodeEditor.tsx"],"sourcesContent":["import type { ReactCodeMirrorProps, Statistics } from \"@uiw/react-codemirror\";\nimport CodeMirror, { EditorView } from \"@uiw/react-codemirror\";\nimport {\n useCallback,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { joinIds, useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport styles from \"./CodeEditor.module.scss\";\nimport { type CodeEditorLanguage } from \"@/components/CodeEditor/languages\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useObjectRef } from \"react-aria\";\nimport { defaultLightTheme } from \"@/components/CodeEditor/themes/defaultEditorTheme\";\nimport {\n type CodeEditorSetup,\n useCodeEditorExtensions,\n} from \"@/components/CodeEditor/hooks/useCodeEditorExtensions\";\nimport { CopyButton } from \"@/components/CopyButton\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\nimport { useSkeletonMode } from \"@/components/SkeletonMode/skeletonModeContext\";\n\nexport interface CodeEditorProps\n extends\n Omit<ReactCodeMirrorProps, \"theme\" | \"lang\" | \"basicSetup\" | \"readOnly\">,\n CodeEditorSetup,\n FlowComponentProps {\n /** The initial code of an uncontrolled editor. */\n defaultValue?: string;\n /**\n * Whether the code can be read but not edited.\n *\n * @default false\n */\n isReadOnly?: boolean;\n /**\n * Whether the editor is disabled. The code can neither be edited, focused nor\n * copied.\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Whether the editor is displayed as invalid.\n *\n * @default false\n */\n isInvalid?: boolean;\n /** The elements class name. */\n className?: string;\n /**\n * The language the code is highlighted as. A language the editor does not\n * know is shown as plain text.\n */\n language?: CodeEditorLanguage | (string & {});\n /**\n * Whether a button to copy the code to the clipboard is shown.\n *\n * @default true\n */\n copyable?: boolean;\n /**\n * Whether the field must be filled in. Only marks the editor as required for\n * assistive technology — the editor does not validate itself.\n *\n * @default false\n */\n isRequired?: boolean;\n /**\n * @internal Set by `<Field />` on every form field. The editor has no\n * react-aria validation to forward it to and drops it.\n */\n validationBehavior?: unknown;\n}\n\n/**\n * @flr-generate all\n * @flowStatus new\n */\nexport const CodeEditor = flowComponent(\"CodeEditor\", (props) => {\n const {\n ref,\n children,\n className,\n language,\n extensions,\n isReadOnly,\n isDisabled,\n isInvalid,\n isRequired,\n validationBehavior: _ignoredValidationBehavior,\n value,\n onChange,\n onStatistics,\n showLineNumbers = true,\n showCodeFolding = true,\n showCodeIndentationMakers = true,\n showLinterMarkers = true,\n showActiveLineMarker = true,\n copyable = true,\n editable = true,\n height,\n minHeight,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n wrapperProps,\n controlProps,\n fieldPropsContext,\n } = useFieldComponent(props, \"CodeEditor\");\n\n const rootClassName = clsx(\n wrapperProps.className,\n styles.codeEditor,\n className,\n );\n\n const labelId = useId();\n const descriptionId = useId();\n\n /**\n * Both are optional. Their refs tell whether they are rendered, so the editor\n * never references an element that does not exist – a dangling id fails HTML\n * validators and a11y checks. The callbacks are stable: a new one per render\n * would detach and re-attach on every render.\n */\n const [hasLabel, setHasLabel] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n const labelRef = useCallback((element: Element | null) => {\n setHasLabel(!!element);\n }, []);\n const descriptionRef = useCallback((element: Element | null) => {\n setHasDescription(!!element);\n }, []);\n\n /**\n * The label and the field description are declared as children of the code\n * editor, but must be rendered outside of the editor itself. They are\n * tunneled out of the editor – just like the field error. Their ids are the\n * ones the editor references.\n */\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n ...fieldPropsContext.Label,\n id: labelId,\n ref: labelRef,\n tunnel: { id: \"label\", component: \"CodeEditor\" },\n },\n FieldDescription: {\n ...fieldPropsContext.FieldDescription,\n id: descriptionId,\n ref: descriptionRef,\n tunnel: { id: \"fieldDescription\", component: \"CodeEditor\" },\n },\n };\n\n const enabledExtensions = useCodeEditorExtensions(language, extensions, {\n showLineNumbers: showLineNumbers,\n showCodeIndentationMakers: showCodeIndentationMakers,\n showCodeFolding: showCodeFolding,\n showLinterMarkers: showLinterMarkers,\n });\n\n /**\n * The editable element of CodeMirror is the `.cm-content` element – not the\n * root element the props are applied to. Its ARIA attributes are set through\n * the content attributes facet.\n *\n * Without a label, an `aria-label` names the editor instead.\n */\n const labelledBy = joinIds(ariaLabelledBy, hasLabel && labelId);\n const describedBy = joinIds(\n hasDescription && descriptionId,\n controlProps[\"aria-describedby\"],\n );\n\n /**\n * CodeMirror reconfigures the editor whenever `extensions`, `basicSetup` or\n * `onChange` is a new object. All three are stable, so a render with\n * unchanged props leaves the editor as it is.\n */\n const allExtensions = useMemo(\n () => [\n ...enabledExtensions,\n EditorView.contentAttributes.of({\n ...(labelledBy ? { \"aria-labelledby\": labelledBy } : {}),\n ...(ariaLabel ? { \"aria-label\": ariaLabel } : {}),\n ...(describedBy ? { \"aria-describedby\": describedBy } : {}),\n ...(isRequired ? { \"aria-required\": \"true\" } : {}),\n ...(isInvalid ? { \"aria-invalid\": \"true\" } : {}),\n ...(isDisabled ? { \"aria-disabled\": \"true\" } : {}),\n }),\n ],\n [\n enabledExtensions,\n labelledBy,\n ariaLabel,\n describedBy,\n isRequired,\n isInvalid,\n isDisabled,\n ],\n );\n\n /*\n * A new `onChange` on every render would reconfigure the editor as well.\n * CodeMirror's update listener captures `onStatistics` along with it, so both\n * call the latest handler through a ref.\n */\n const handlersRef = useRef({ onChange, onStatistics });\n useLayoutEffect(() => {\n handlersRef.current = { onChange, onStatistics };\n });\n const stableOnChange = useCallback(\n (value: string) => handlersRef.current.onChange(value),\n [],\n );\n const stableOnStatistics = useCallback(\n (statistics: Statistics) => handlersRef.current.onStatistics?.(statistics),\n [],\n );\n\n const isEditable = editable && !isDisabled;\n const highlightActiveLine = showActiveLineMarker && !isDisabled;\n const basicSetup = useMemo(\n () => ({\n highlightActiveLine,\n highlightActiveLineGutter: highlightActiveLine,\n autocompletion: false,\n lineNumbers: false,\n foldGutter: false,\n highlightSelectionMatches: false,\n bracketMatching: isEditable,\n }),\n [highlightActiveLine, isEditable],\n );\n\n const localRef = useObjectRef(ref);\n\n useMakeFocusable(localRef);\n\n const isSkeleton = useSkeletonMode();\n\n /* No CodeMirror: one surface, as high as the code in the editor's line\n height. The children still render, so a label or a field description\n tunnels out and follows its own skeleton rule. */\n const skeleton = (\n <div\n className={clsx(\n styles.codeMirror,\n isReadOnly && styles.readonly,\n styles.skeleton,\n )}\n >\n <div\n className={styles.skeletonLines}\n style={{ height: height ?? minHeight }}\n >\n {(value ?? \"\").split(\"\\n\").map((line, index) => (\n <div key={index}>{line || \" \"}</div>\n ))}\n </div>\n {children}\n </div>\n );\n\n const editor = (\n <CodeMirror\n {...rest}\n value={value}\n onChange={stableOnChange}\n onStatistics={stableOnStatistics}\n basicSetup={basicSetup}\n theme={defaultLightTheme}\n data-invalid={isInvalid || undefined}\n data-disabled={isDisabled || undefined}\n readOnly={isReadOnly || isDisabled}\n editable={isEditable}\n className={clsx(styles.codeMirror, isReadOnly && styles.readonly)}\n ref={(codeMirrorRef) => {\n if (codeMirrorRef?.editor) {\n localRef.current = codeMirrorRef.editor;\n }\n }}\n extensions={allExtensions}\n height={height ?? minHeight}\n >\n {copyable && (\n <CopyButton\n className={styles.copyButton}\n size=\"s\"\n variant=\"soft\"\n text={value}\n isDisabled={isDisabled}\n />\n )}\n {children}\n </CodeMirror>\n );\n\n return (\n <div\n className={rootClassName}\n data-disabled={isDisabled || undefined}\n inert={isSkeleton || undefined}\n >\n <PropsContextProvider props={propsContext}>\n <UiComponentTunnelExit id=\"label\" component=\"CodeEditor\" />\n <FieldErrorCaptureContext>\n {isSkeleton ? skeleton : editor}\n </FieldErrorCaptureContext>\n <UiComponentTunnelExit id=\"fieldDescription\" component=\"CodeEditor\" />\n <FieldErrorView />\n </PropsContextProvider>\n </div>\n );\n});\n\nexport default CodeEditor;\n"],"mappings":"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"}
1
+ {"version":3,"file":"CodeEditor.mjs","names":["styles"],"sources":["../../../../../../../src/components/CodeEditor/CodeEditor.tsx"],"sourcesContent":["import type { ReactCodeMirrorProps, Statistics } from \"@uiw/react-codemirror\";\nimport CodeMirror, { EditorView } from \"@uiw/react-codemirror\";\nimport {\n useCallback,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { joinIds, useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport styles from \"./CodeEditor.module.scss\";\nimport { type CodeEditorLanguage } from \"@/components/CodeEditor/languages\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useObjectRef } from \"react-aria\";\nimport { defaultLightTheme } from \"@/components/CodeEditor/themes/defaultEditorTheme\";\nimport {\n type CodeEditorSetup,\n useCodeEditorExtensions,\n} from \"@/components/CodeEditor/hooks/useCodeEditorExtensions\";\nimport { CopyButton } from \"@/components/CopyButton\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\nimport { useSkeletonMode } from \"@/components/SkeletonMode/skeletonModeContext\";\nimport { getCspNonce } from \"@/lib/dom/getCspNonce\";\n\n/*\n * CodeMirror injects its base styles as a `<style>` element. A CSP without\n * `'unsafe-inline'` blocks it unless it carries the page's nonce – the editor\n * then loses its layout, e.g. the selection layer grows it while text is\n * selected.\n */\nconst cspNonceExtensions = () => {\n const nonce = getCspNonce();\n return nonce ? [EditorView.cspNonce.of(nonce)] : [];\n};\n\nexport interface CodeEditorProps\n extends\n Omit<ReactCodeMirrorProps, \"theme\" | \"lang\" | \"basicSetup\" | \"readOnly\">,\n CodeEditorSetup,\n FlowComponentProps {\n /** The initial code of an uncontrolled editor. */\n defaultValue?: string;\n /**\n * Whether the code can be read but not edited.\n *\n * @default false\n */\n isReadOnly?: boolean;\n /**\n * Whether the editor is disabled. The code can neither be edited, focused nor\n * copied.\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Whether the editor is displayed as invalid.\n *\n * @default false\n */\n isInvalid?: boolean;\n /** The elements class name. */\n className?: string;\n /**\n * The language the code is highlighted as. A language the editor does not\n * know is shown as plain text.\n */\n language?: CodeEditorLanguage | (string & {});\n /**\n * Whether a button to copy the code to the clipboard is shown.\n *\n * @default true\n */\n copyable?: boolean;\n /**\n * Whether the field must be filled in. Only marks the editor as required for\n * assistive technology — the editor does not validate itself.\n *\n * @default false\n */\n isRequired?: boolean;\n /**\n * @internal Set by `<Field />` on every form field. The editor has no\n * react-aria validation to forward it to and drops it.\n */\n validationBehavior?: unknown;\n}\n\n/**\n * @flr-generate all\n * @flowStatus new\n */\nexport const CodeEditor = flowComponent(\"CodeEditor\", (props) => {\n const {\n ref,\n children,\n className,\n language,\n extensions,\n isReadOnly,\n isDisabled,\n isInvalid,\n isRequired,\n validationBehavior: _ignoredValidationBehavior,\n value,\n onChange,\n onStatistics,\n showLineNumbers = true,\n showCodeFolding = true,\n showCodeIndentationMakers = true,\n showLinterMarkers = true,\n showActiveLineMarker = true,\n copyable = true,\n editable = true,\n height,\n minHeight,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n wrapperProps,\n controlProps,\n fieldPropsContext,\n } = useFieldComponent(props, \"CodeEditor\");\n\n const rootClassName = clsx(\n wrapperProps.className,\n styles.codeEditor,\n className,\n );\n\n const labelId = useId();\n const descriptionId = useId();\n\n /**\n * Both are optional. Their refs tell whether they are rendered, so the editor\n * never references an element that does not exist – a dangling id fails HTML\n * validators and a11y checks. The callbacks are stable: a new one per render\n * would detach and re-attach on every render.\n */\n const [hasLabel, setHasLabel] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n const labelRef = useCallback((element: Element | null) => {\n setHasLabel(!!element);\n }, []);\n const descriptionRef = useCallback((element: Element | null) => {\n setHasDescription(!!element);\n }, []);\n\n /**\n * The label and the field description are declared as children of the code\n * editor, but must be rendered outside of the editor itself. They are\n * tunneled out of the editor – just like the field error. Their ids are the\n * ones the editor references.\n */\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n ...fieldPropsContext.Label,\n id: labelId,\n ref: labelRef,\n tunnel: { id: \"label\", component: \"CodeEditor\" },\n },\n FieldDescription: {\n ...fieldPropsContext.FieldDescription,\n id: descriptionId,\n ref: descriptionRef,\n tunnel: { id: \"fieldDescription\", component: \"CodeEditor\" },\n },\n };\n\n const enabledExtensions = useCodeEditorExtensions(language, extensions, {\n showLineNumbers: showLineNumbers,\n showCodeIndentationMakers: showCodeIndentationMakers,\n showCodeFolding: showCodeFolding,\n showLinterMarkers: showLinterMarkers,\n });\n\n /**\n * The editable element of CodeMirror is the `.cm-content` element – not the\n * root element the props are applied to. Its ARIA attributes are set through\n * the content attributes facet.\n *\n * Without a label, an `aria-label` names the editor instead.\n */\n const labelledBy = joinIds(ariaLabelledBy, hasLabel && labelId);\n const describedBy = joinIds(\n hasDescription && descriptionId,\n controlProps[\"aria-describedby\"],\n );\n\n /**\n * CodeMirror reconfigures the editor whenever `extensions`, `basicSetup` or\n * `onChange` is a new object. All three are stable, so a render with\n * unchanged props leaves the editor as it is.\n */\n const allExtensions = useMemo(\n () => [\n ...enabledExtensions,\n ...cspNonceExtensions(),\n EditorView.contentAttributes.of({\n ...(labelledBy ? { \"aria-labelledby\": labelledBy } : {}),\n ...(ariaLabel ? { \"aria-label\": ariaLabel } : {}),\n ...(describedBy ? { \"aria-describedby\": describedBy } : {}),\n ...(isRequired ? { \"aria-required\": \"true\" } : {}),\n ...(isInvalid ? { \"aria-invalid\": \"true\" } : {}),\n ...(isDisabled ? { \"aria-disabled\": \"true\" } : {}),\n }),\n ],\n [\n enabledExtensions,\n labelledBy,\n ariaLabel,\n describedBy,\n isRequired,\n isInvalid,\n isDisabled,\n ],\n );\n\n /*\n * A new `onChange` on every render would reconfigure the editor as well.\n * CodeMirror's update listener captures `onStatistics` along with it, so both\n * call the latest handler through a ref.\n */\n const handlersRef = useRef({ onChange, onStatistics });\n useLayoutEffect(() => {\n handlersRef.current = { onChange, onStatistics };\n });\n const stableOnChange = useCallback(\n (value: string) => handlersRef.current.onChange(value),\n [],\n );\n const stableOnStatistics = useCallback(\n (statistics: Statistics) => handlersRef.current.onStatistics?.(statistics),\n [],\n );\n\n const isEditable = editable && !isDisabled;\n const highlightActiveLine = showActiveLineMarker && !isDisabled;\n const basicSetup = useMemo(\n () => ({\n highlightActiveLine,\n highlightActiveLineGutter: highlightActiveLine,\n autocompletion: false,\n lineNumbers: false,\n foldGutter: false,\n highlightSelectionMatches: false,\n bracketMatching: isEditable,\n }),\n [highlightActiveLine, isEditable],\n );\n\n const localRef = useObjectRef(ref);\n\n useMakeFocusable(localRef);\n\n const isSkeleton = useSkeletonMode();\n\n /* No CodeMirror: one surface, as high as the code in the editor's line\n height. The children still render, so a label or a field description\n tunnels out and follows its own skeleton rule. */\n const skeleton = (\n <div\n className={clsx(\n styles.codeMirror,\n isReadOnly && styles.readonly,\n styles.skeleton,\n )}\n >\n <div\n className={styles.skeletonLines}\n style={{ height: height ?? minHeight }}\n >\n {(value ?? \"\").split(\"\\n\").map((line, index) => (\n <div key={index}>{line || \" \"}</div>\n ))}\n </div>\n {children}\n </div>\n );\n\n const editor = (\n <CodeMirror\n {...rest}\n value={value}\n onChange={stableOnChange}\n onStatistics={stableOnStatistics}\n basicSetup={basicSetup}\n theme={defaultLightTheme}\n data-invalid={isInvalid || undefined}\n data-disabled={isDisabled || undefined}\n readOnly={isReadOnly || isDisabled}\n editable={isEditable}\n className={clsx(styles.codeMirror, isReadOnly && styles.readonly)}\n ref={(codeMirrorRef) => {\n if (codeMirrorRef?.editor) {\n localRef.current = codeMirrorRef.editor;\n }\n }}\n extensions={allExtensions}\n height={height ?? minHeight}\n >\n {copyable && (\n <CopyButton\n className={styles.copyButton}\n size=\"s\"\n variant=\"soft\"\n text={value}\n isDisabled={isDisabled}\n />\n )}\n {children}\n </CodeMirror>\n );\n\n return (\n <div\n className={rootClassName}\n data-disabled={isDisabled || undefined}\n inert={isSkeleton || undefined}\n >\n <PropsContextProvider props={propsContext}>\n <UiComponentTunnelExit id=\"label\" component=\"CodeEditor\" />\n <FieldErrorCaptureContext>\n {isSkeleton ? skeleton : editor}\n </FieldErrorCaptureContext>\n <UiComponentTunnelExit id=\"fieldDescription\" component=\"CodeEditor\" />\n <FieldErrorView />\n </PropsContextProvider>\n </div>\n );\n});\n\nexport default CodeEditor;\n"],"mappings":"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"}
@@ -3,17 +3,36 @@
3
3
  import { Text } from "../../../Text/Text.mjs";
4
4
  import FileCard_module_default from "../../FileCard.module.mjs";
5
5
  import { jsx } from "react/jsx-runtime";
6
+ import { useNumberFormatter } from "react-aria";
6
7
  // src/components/FileCard/components/FileSizeText/FileSizeText.tsx
8
+ var units = [
9
+ "byte",
10
+ "kilobyte",
11
+ "megabyte",
12
+ "gigabyte",
13
+ "terabyte",
14
+ "petabyte"
15
+ ];
16
+ var getUnit = (sizeInBytes) => {
17
+ let index = Math.min(Math.max(Math.floor(Math.log10(sizeInBytes) / 3), 0), units.length - 1);
18
+ if (index < units.length - 1 && Math.round(sizeInBytes / 1e3 ** index * 10) / 10 >= 1e3) index++;
19
+ return {
20
+ unit: units[index] ?? "byte",
21
+ value: sizeInBytes / 1e3 ** index
22
+ };
23
+ };
7
24
  var FileSizeText = (props) => {
8
25
  const { sizeInBytes } = props;
26
+ const { unit, value } = getUnit(sizeInBytes);
27
+ const formatter = useNumberFormatter({
28
+ style: "unit",
29
+ unit,
30
+ unitDisplay: unit === "byte" ? "long" : "short",
31
+ maximumFractionDigits: 1
32
+ });
9
33
  return /* @__PURE__ */ jsx(Text, {
10
34
  className: FileCard_module_default.subTitle,
11
- children: new Intl.NumberFormat("en-US", {
12
- notation: "compact",
13
- style: "unit",
14
- unit: "byte",
15
- unitDisplay: "narrow"
16
- }).format(sizeInBytes)
35
+ children: formatter.format(value)
17
36
  });
18
37
  };
19
38
  export { FileSizeText, FileSizeText as default };
@@ -1 +1 @@
1
- {"version":3,"file":"FileSizeText.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/FileCard/components/FileSizeText/FileSizeText.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { Text } from \"@/components/Text\";\nimport styles from \"@/components/FileCard/FileCard.module.scss\";\n\ninterface Props {\n sizeInBytes: number;\n}\n\nexport const FileSizeText: FC<Props> = (props) => {\n const { sizeInBytes } = props;\n\n return (\n <Text className={styles.subTitle}>\n {new Intl.NumberFormat(\"en-US\", {\n notation: \"compact\",\n style: \"unit\",\n unit: \"byte\",\n unitDisplay: \"narrow\",\n }).format(sizeInBytes)}\n </Text>\n );\n};\n\nexport default FileSizeText;\n"],"mappings":";;;;;;AAQA,IAAa,gBAA2B,UAAU;CAChD,MAAM,EAAE,gBAAgB;CAExB,OACE,oBAAC,MAAD;EAAM,WAAWA,wBAAO;EACrB,UAAA,IAAI,KAAK,aAAa,SAAS;GAC9B,UAAU;GACV,OAAO;GACP,MAAM;GACN,aAAa;EACf,CAAC,CAAC,CAAC,OAAO,WAAW;CACjB,CAAA;AAEV"}
1
+ {"version":3,"file":"FileSizeText.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/FileCard/components/FileSizeText/FileSizeText.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { useNumberFormatter } from \"react-aria\";\nimport { Text } from \"@/components/Text\";\nimport styles from \"@/components/FileCard/FileCard.module.scss\";\n\ninterface Props {\n sizeInBytes: number;\n}\n\nconst units = [\n \"byte\",\n \"kilobyte\",\n \"megabyte\",\n \"gigabyte\",\n \"terabyte\",\n \"petabyte\",\n] as const;\n\nconst getUnit = (sizeInBytes: number) => {\n let index = Math.min(\n Math.max(Math.floor(Math.log10(sizeInBytes) / 3), 0),\n units.length - 1,\n );\n\n // 999,960 bytes would otherwise round to \"1,000 kB\"\n if (\n index < units.length - 1 &&\n Math.round((sizeInBytes / 1000 ** index) * 10) / 10 >= 1000\n ) {\n index++;\n }\n\n return { unit: units[index] ?? \"byte\", value: sizeInBytes / 1000 ** index };\n};\n\nexport const FileSizeText: FC<Props> = (props) => {\n const { sizeInBytes } = props;\n const { unit, value } = getUnit(sizeInBytes);\n\n const formatter = useNumberFormatter({\n style: \"unit\",\n unit,\n unitDisplay: unit === \"byte\" ? \"long\" : \"short\",\n maximumFractionDigits: 1,\n });\n\n return <Text className={styles.subTitle}>{formatter.format(value)}</Text>;\n};\n\nexport default FileSizeText;\n"],"mappings":";;;;;;;AASA,IAAM,QAAQ;CACZ;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,IAAM,WAAW,gBAAwB;CACvC,IAAI,QAAQ,KAAK,IACf,KAAK,IAAI,KAAK,MAAM,KAAK,MAAM,WAAW,IAAI,CAAC,GAAG,CAAC,GACnD,MAAM,SAAS,CACjB;CAGA,IACE,QAAQ,MAAM,SAAS,KACvB,KAAK,MAAO,cAAc,OAAQ,QAAS,EAAE,IAAI,MAAM,KAEvD;CAGF,OAAO;EAAE,MAAM,MAAM,UAAU;EAAQ,OAAO,cAAc,OAAQ;CAAM;AAC5E;AAEA,IAAa,gBAA2B,UAAU;CAChD,MAAM,EAAE,gBAAgB;CACxB,MAAM,EAAE,MAAM,UAAU,QAAQ,WAAW;CAE3C,MAAM,YAAY,mBAAmB;EACnC,OAAO;EACP;EACA,aAAa,SAAS,SAAS,SAAS;EACxC,uBAAuB;CACzB,CAAC;CAED,OAAO,oBAAC,MAAD;EAAM,WAAWA,wBAAO;EAAW,UAAA,UAAU,OAAO,KAAK;CAAQ,CAAA;AAC1E"}
@@ -10,13 +10,14 @@ import DivView from "../../views/DivView.mjs";
10
10
  import __locale_default from "../../../../../_virtual/_22.locale.mjs";
11
11
  import { Overlay } from "../Overlay/Overlay.mjs";
12
12
  import LightBox_module_default from "./LightBox.module.mjs";
13
+ import LightBoxZoomView from "../../views/LightBoxZoomView.mjs";
13
14
  import clsx from "clsx";
14
15
  import { jsx, jsxs } from "react/jsx-runtime";
15
16
  import { useLocalizedStringFormatter } from "react-aria";
16
17
  // src/components/LightBox/LightBox.tsx
17
18
  var LightBox = flowComponent("LightBox", (props) => {
18
- const { controller: controllerFromProps, children, ref: ignoredRef, className, fitScreen = true, ...rest } = props;
19
- const rootClassName = clsx(LightBox_module_default.lightBox, fitScreen && LightBox_module_default.fitScreen, className);
19
+ const { controller: controllerFromProps, children, ref: ignoredRef, className, fitScreen = true, withZoom, ...rest } = props;
20
+ const rootClassName = clsx(LightBox_module_default.lightBox, (fitScreen || withZoom) && LightBox_module_default.fitScreen, className);
20
21
  const propsContext = {
21
22
  ActionGroup: {
22
23
  preserveOrder: true,
@@ -31,11 +32,18 @@ var LightBox = flowComponent("LightBox", (props) => {
31
32
  component: "LightBox"
32
33
  }
33
34
  },
34
- LightBoxGallery: { className: LightBox_module_default.gallery }
35
+ LightBoxGallery: {
36
+ className: LightBox_module_default.gallery,
37
+ LightBoxGalleryItem: { withZoom }
38
+ }
35
39
  };
36
40
  const controllerFromContext = useOverlayController("LightBox", { reuseControllerFromContext: true });
37
41
  const controller = controllerFromProps ?? controllerFromContext;
38
42
  const stringFormatter = useLocalizedStringFormatter(__locale_default, "LightBox");
43
+ const zoomableContent = /* @__PURE__ */ jsx(LightBoxZoomView, {
44
+ className: LightBox_module_default.zoom,
45
+ children
46
+ });
39
47
  return /* @__PURE__ */ jsx(Overlay, {
40
48
  overlayType: "LightBox",
41
49
  className: rootClassName,
@@ -45,18 +53,18 @@ var LightBox = flowComponent("LightBox", (props) => {
45
53
  props: propsContext,
46
54
  children: [/* @__PURE__ */ jsx(DivView, {
47
55
  className: LightBox_module_default.content,
48
- children
56
+ children: withZoom ? zoomableContent : children
49
57
  }), /* @__PURE__ */ jsxs(DivView, {
50
58
  className: LightBox_module_default.actions,
51
- children: [/* @__PURE__ */ jsx(ButtonView, {
59
+ children: [/* @__PURE__ */ jsx(UiComponentTunnelExit, {
60
+ id: "actionGroup",
61
+ component: "LightBox"
62
+ }), /* @__PURE__ */ jsx(ButtonView, {
52
63
  color: "light-static",
53
64
  variant: "solid",
54
65
  onPress: () => controller.close(),
55
66
  "aria-label": stringFormatter.format("close"),
56
67
  children: /* @__PURE__ */ jsx(IconClose, {})
57
- }), /* @__PURE__ */ jsx(UiComponentTunnelExit, {
58
- id: "actionGroup",
59
- component: "LightBox"
60
68
  })]
61
69
  })]
62
70
  })
@@ -1 +1 @@
1
- {"version":3,"file":"LightBox.mjs","names":["styles","locales"],"sources":["../../../../../../../src/components/LightBox/LightBox.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsWithChildren } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { Overlay } from \"@/components/Overlay/Overlay\";\nimport clsx from \"clsx\";\nimport type { OverlayController } from \"@/lib/controller\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { IconClose } from \"@/components/Icon/components/icons\";\nimport styles from \"./LightBox.module.scss\";\nimport DivView from \"@/views/DivView\";\nimport ButtonView from \"@/views/ButtonView\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"./locales/*.locale.json\";\n\nexport interface LightBoxProps\n extends PropsWithChildren, FlowComponentProps, PropsWithClassName {\n /** An overlay controller to control the light box state. */\n controller?: OverlayController;\n /**\n * Whether content can be displayed larger than the available space in the\n * screen. @default true\n */\n fitScreen?: boolean;\n}\n\nexport const LightBox = flowComponent(\"LightBox\", (props) => {\n const {\n controller: controllerFromProps,\n children,\n ref: ignoredRef,\n className,\n fitScreen = true,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.lightBox,\n fitScreen && styles.fitScreen,\n className,\n );\n\n const propsContext: PropsContext = {\n ActionGroup: {\n preserveOrder: true,\n spacing: \"m\",\n className: styles.actionGroup,\n Button: { variant: \"solid\", color: \"light-static\" },\n tunnel: {\n id: \"actionGroup\",\n component: \"LightBox\",\n },\n },\n LightBoxGallery: {\n className: styles.gallery,\n },\n };\n\n const controllerFromContext = useOverlayController(\"LightBox\", {\n reuseControllerFromContext: true,\n });\n\n const controller = controllerFromProps ?? controllerFromContext;\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"LightBox\");\n\n return (\n <Overlay\n overlayType=\"LightBox\"\n className={rootClassName}\n controller={controller}\n {...rest}\n >\n <PropsContextProvider props={propsContext}>\n <DivView className={styles.content}>{children}</DivView>\n <DivView className={styles.actions}>\n <ButtonView\n color=\"light-static\"\n variant=\"solid\"\n onPress={() => controller.close()}\n aria-label={stringFormatter.format(\"close\")}\n >\n <IconClose />\n </ButtonView>\n <UiComponentTunnelExit id=\"actionGroup\" component=\"LightBox\" />\n </DivView>\n </PropsContextProvider>\n </Overlay>\n );\n});\n\nexport default LightBox;\n"],"mappings":";;;;;;;;;;;;;;;;AA+BA,IAAa,WAAW,cAAc,aAAa,UAAU;CAC3D,MAAM,EACJ,YAAY,qBACZ,UACA,KAAK,YACL,WACA,YAAY,MACZ,GAAG,SACD;CAEJ,MAAM,gBAAgB,KACpBA,wBAAO,UACP,aAAaA,wBAAO,WACpB,SACF;CAEA,MAAM,eAA6B;EACjC,aAAa;GACX,eAAe;GACf,SAAS;GACT,WAAWA,wBAAO;GAClB,QAAQ;IAAE,SAAS;IAAS,OAAO;GAAe;GAClD,QAAQ;IACN,IAAI;IACJ,WAAW;GACb;EACF;EACA,iBAAiB,EACf,WAAWA,wBAAO,QACpB;CACF;CAEA,MAAM,wBAAwB,qBAAqB,YAAY,EAC7D,4BAA4B,KAC9B,CAAC;CAED,MAAM,aAAa,uBAAuB;CAE1C,MAAM,kBAAkB,4BAA4BC,kBAAS,UAAU;CAEvE,OACE,oBAAC,SAAD;EACE,aAAY;EACZ,WAAW;EACC;EACZ,GAAI;EAEJ,UAAA,qBAAC,sBAAD;GAAsB,OAAO;GAA7B,UAAA,CACE,oBAAC,SAAD;IAAS,WAAWD,wBAAO;IAAU;GAAkB,CAAA,GACvD,qBAAC,SAAD;IAAS,WAAWA,wBAAO;IAA3B,UAAA,CACE,oBAAC,YAAD;KACE,OAAM;KACN,SAAQ;KACR,eAAe,WAAW,MAAM;KAChC,cAAY,gBAAgB,OAAO,OAAO;KAE1C,UAAA,oBAAC,WAAD,CAAY,CAAA;IACF,CAAA,GACZ,oBAAC,uBAAD;KAAuB,IAAG;KAAc,WAAU;IAAY,CAAA,CACvD;GACW,CAAA,CAAA;;CACf,CAAA;AAEb,CAAC"}
1
+ {"version":3,"file":"LightBox.mjs","names":["styles","locales"],"sources":["../../../../../../../src/components/LightBox/LightBox.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsWithChildren } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { Overlay } from \"@/components/Overlay/Overlay\";\nimport clsx from \"clsx\";\nimport type { OverlayController } from \"@/lib/controller\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { IconClose } from \"@/components/Icon/components/icons\";\nimport styles from \"./LightBox.module.scss\";\nimport DivView from \"@/views/DivView\";\nimport ButtonView from \"@/views/ButtonView\";\nimport LightBoxZoomView from \"@/views/LightBoxZoomView\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"./locales/*.locale.json\";\n\nexport interface LightBoxProps\n extends PropsWithChildren, FlowComponentProps, PropsWithClassName {\n /** An overlay controller to control the light box state. */\n controller?: OverlayController;\n /**\n * Whether content can be displayed larger than the available space in the\n * screen. @default true\n */\n fitScreen?: boolean;\n /**\n * Whether the content can be zoomed. Applies to the items of a\n * `LightBoxGallery` as well. The content then always fits the screen,\n * whatever `fitScreen` says. @default false\n */\n withZoom?: boolean;\n}\n\nexport const LightBox = flowComponent(\"LightBox\", (props) => {\n const {\n controller: controllerFromProps,\n children,\n ref: ignoredRef,\n className,\n fitScreen = true,\n withZoom,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.lightBox,\n (fitScreen || withZoom) && styles.fitScreen,\n className,\n );\n\n const propsContext: PropsContext = {\n ActionGroup: {\n preserveOrder: true,\n spacing: \"m\",\n className: styles.actionGroup,\n Button: { variant: \"solid\", color: \"light-static\" },\n tunnel: {\n id: \"actionGroup\",\n component: \"LightBox\",\n },\n },\n LightBoxGallery: {\n className: styles.gallery,\n LightBoxGalleryItem: { withZoom },\n },\n };\n\n const controllerFromContext = useOverlayController(\"LightBox\", {\n reuseControllerFromContext: true,\n });\n\n const controller = controllerFromProps ?? controllerFromContext;\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"LightBox\");\n\n const zoomableContent = (\n <LightBoxZoomView className={styles.zoom}>{children}</LightBoxZoomView>\n );\n\n return (\n <Overlay\n overlayType=\"LightBox\"\n className={rootClassName}\n controller={controller}\n {...rest}\n >\n <PropsContextProvider props={propsContext}>\n <DivView className={styles.content}>\n {withZoom ? zoomableContent : children}\n </DivView>\n <DivView className={styles.actions}>\n <UiComponentTunnelExit id=\"actionGroup\" component=\"LightBox\" />\n <ButtonView\n color=\"light-static\"\n variant=\"solid\"\n onPress={() => controller.close()}\n aria-label={stringFormatter.format(\"close\")}\n >\n <IconClose />\n </ButtonView>\n </DivView>\n </PropsContextProvider>\n </Overlay>\n );\n});\n\nexport default LightBox;\n"],"mappings":";;;;;;;;;;;;;;;;;AAsCA,IAAa,WAAW,cAAc,aAAa,UAAU;CAC3D,MAAM,EACJ,YAAY,qBACZ,UACA,KAAK,YACL,WACA,YAAY,MACZ,UACA,GAAG,SACD;CAEJ,MAAM,gBAAgB,KACpBA,wBAAO,WACN,aAAa,aAAaA,wBAAO,WAClC,SACF;CAEA,MAAM,eAA6B;EACjC,aAAa;GACX,eAAe;GACf,SAAS;GACT,WAAWA,wBAAO;GAClB,QAAQ;IAAE,SAAS;IAAS,OAAO;GAAe;GAClD,QAAQ;IACN,IAAI;IACJ,WAAW;GACb;EACF;EACA,iBAAiB;GACf,WAAWA,wBAAO;GAClB,qBAAqB,EAAE,SAAS;EAClC;CACF;CAEA,MAAM,wBAAwB,qBAAqB,YAAY,EAC7D,4BAA4B,KAC9B,CAAC;CAED,MAAM,aAAa,uBAAuB;CAE1C,MAAM,kBAAkB,4BAA4BC,kBAAS,UAAU;CAEvE,MAAM,kBACJ,oBAAC,kBAAD;EAAkB,WAAWD,wBAAO;EAAO;CAA2B,CAAA;CAGxE,OACE,oBAAC,SAAD;EACE,aAAY;EACZ,WAAW;EACC;EACZ,GAAI;EAEJ,UAAA,qBAAC,sBAAD;GAAsB,OAAO;GAA7B,UAAA,CACE,oBAAC,SAAD;IAAS,WAAWA,wBAAO;IACxB,UAAA,WAAW,kBAAkB;GACvB,CAAA,GACT,qBAAC,SAAD;IAAS,WAAWA,wBAAO;IAA3B,UAAA,CACE,oBAAC,uBAAD;KAAuB,IAAG;KAAc,WAAU;IAAY,CAAA,GAC9D,oBAAC,YAAD;KACE,OAAM;KACN,SAAQ;KACR,eAAe,WAAW,MAAM;KAChC,cAAY,gBAAgB,OAAO,OAAO;KAE1C,UAAA,oBAAC,WAAD,CAAY,CAAA;IACF,CAAA,CACL;GACW,CAAA,CAAA;;CACf,CAAA;AAEb,CAAC"}
@@ -3,6 +3,7 @@
3
3
  // src/components/LightBox/LightBox.module.scss
4
4
  var lightBox = "flow--light-box";
5
5
  var content = "flow--light-box--content";
6
+ var zoom = "flow--light-box--zoom";
6
7
  var fitScreen = "flow--light-box--fit-screen";
7
8
  var actions = "flow--light-box--actions";
8
9
  var actionGroup = "flow--light-box--action-group";
@@ -10,11 +11,12 @@ var gallery = "flow--light-box--gallery";
10
11
  var LightBox_module_default = {
11
12
  lightBox,
12
13
  content,
14
+ zoom,
13
15
  fitScreen,
14
16
  actions,
15
17
  actionGroup,
16
18
  gallery
17
19
  };
18
- export { actionGroup, actions, content, LightBox_module_default as default, fitScreen, gallery, lightBox };
20
+ export { actionGroup, actions, content, LightBox_module_default as default, fitScreen, gallery, lightBox, zoom };
19
21
 
20
22
  //# sourceMappingURL=LightBox.module.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"LightBox.module.mjs","names":[],"sources":["../../../../../../../src/components/LightBox/LightBox.module.scss"],"sourcesContent":[".lightBox {\n /* Overlay.module.scss lays the viewport out. */\n > :global(.flow--overlay--viewport) {\n /* react-aria's own modal wrapper — no className from Flow, so its\n default `react-aria-Modal` class is the handle. */\n > :global(.react-aria-Modal) {\n display: flex;\n justify-content: center;\n width: inherit;\n max-height: var(--visual-viewport-height);\n }\n }\n\n [role=\"dialog\"] {\n outline: none;\n display: flex;\n justify-content: center;\n max-width: var(--light-box--max-width);\n max-height: var(--light-box--max-height);\n }\n\n .content {\n overflow: auto;\n\n // The image is a consumer child — Flow `Image` or a bare `<img>`.\n // stylelint-disable-next-line selector-max-type -- bare `<img>` has no class\n > img {\n width: 100%;\n }\n }\n\n &.fitScreen {\n .content {\n > * {\n max-height: var(--light-box--max-height);\n }\n }\n }\n\n .actions,\n .actionGroup {\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n }\n\n .actions {\n row-gap: var(--light-box--spacing);\n padding-inline-start: var(--light-box--spacing);\n }\n\n .gallery {\n width: var(--light-box--max-width);\n }\n\n &:has(.gallery) {\n .actions {\n display: none;\n }\n }\n}\n\n@media (max-width: 768px) {\n .lightBox {\n [role=\"dialog\"] {\n max-width: var(--light-box--max-width-mobile);\n max-height: var(--light-box--max-height-mobile);\n }\n\n &.fitScreen {\n .content {\n > * {\n max-height: var(--light-box--max-height-mobile);\n }\n }\n }\n\n .gallery {\n width: var(--light-box--max-width-mobile);\n }\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"LightBox.module.mjs","names":[],"sources":["../../../../../../../src/components/LightBox/LightBox.module.scss"],"sourcesContent":[".lightBox {\n /* Overlay.module.scss lays the viewport out. */\n > :global(.flow--overlay--viewport) {\n /* react-aria's own modal wrapper — no className from Flow, so its\n default `react-aria-Modal` class is the handle. */\n > :global(.react-aria-Modal) {\n display: flex;\n justify-content: center;\n width: inherit;\n max-height: var(--visual-viewport-height);\n }\n }\n\n [role=\"dialog\"] {\n outline: none;\n display: flex;\n justify-content: center;\n max-width: var(--light-box--max-width);\n max-height: var(--light-box--max-height);\n }\n\n .content {\n overflow: auto;\n\n // The image is a consumer child — Flow `Image` or a bare `<img>`.\n // stylelint-disable selector-max-type -- bare `<img>` has no class\n > img,\n .zoom > * > img {\n width: 100%;\n }\n // stylelint-enable selector-max-type\n }\n\n /* The zoom wraps the content twice: the area it zooms and what it scales. */\n &.fitScreen {\n .content {\n > *,\n .zoom > *,\n .zoom > * > * {\n max-height: var(--light-box--max-height);\n }\n\n /* Zoomed content may cover the whole screen. */\n &:has(> .zoom) {\n overflow: visible;\n }\n }\n }\n\n /* In the screen's top right corner, over the content. */\n .actions {\n position: fixed;\n top: var(--light-box--spacing);\n inset-inline-end: var(--light-box--spacing);\n display: flex;\n column-gap: var(--light-box--spacing);\n }\n\n .actionGroup {\n flex-wrap: nowrap;\n }\n\n .gallery {\n width: var(--light-box--max-width);\n }\n\n &:has(.gallery) {\n .actions {\n display: none;\n }\n }\n}\n\n@media (max-width: 768px) {\n .lightBox {\n [role=\"dialog\"] {\n max-width: var(--light-box--max-width-mobile);\n max-height: var(--light-box--max-height-mobile);\n }\n\n &.fitScreen {\n .content {\n > *,\n .zoom > *,\n .zoom > * > * {\n max-height: var(--light-box--max-height-mobile);\n }\n }\n }\n\n .gallery {\n width: var(--light-box--max-width-mobile);\n }\n }\n}\n"],"mappings":""}
@@ -19,34 +19,36 @@ var LightBoxGallery = flowComponent("LightBoxGallery", (props) => {
19
19
  const count = React.Children.count(children);
20
20
  const isFirst = currentIndex === 0;
21
21
  const isLast = currentIndex === count - 1;
22
- const pointerStartX = useRef(null);
22
+ const swipeStart = useRef(null);
23
23
  const swipeThreshold = 50;
24
24
  const containerRef = useRef(null);
25
+ const itemRef = useRef(null);
25
26
  useEffect(() => {
26
27
  const container = containerRef.current;
27
28
  const focused = document.activeElement;
28
29
  if (container && (!container.contains(focused) || focused?.matches(":disabled"))) container.focus();
29
30
  }, [currentIndex]);
30
31
  const paginate = (direction) => {
31
- setIndex((prev) => {
32
- const next = prev + direction;
33
- if (next < 0) return 0;
34
- if (next >= count) return count - 1;
35
- return next;
36
- });
32
+ const next = Math.min(Math.max(currentIndex + direction, 0), count - 1);
33
+ if (next === currentIndex) return;
34
+ if (itemRef.current?.contains(document.activeElement)) containerRef.current?.focus();
35
+ setIndex(next);
37
36
  };
38
37
  const handlePointerDown = (e) => {
39
38
  if (!e.isPrimary) return;
40
- pointerStartX.current = e.clientX;
39
+ swipeStart.current = {
40
+ pointerId: e.pointerId,
41
+ x: e.clientX
42
+ };
41
43
  };
42
44
  const handlePointerUp = (e) => {
43
- if (pointerStartX.current === null) return;
44
- const distance = pointerStartX.current - e.clientX;
45
+ if (swipeStart.current?.pointerId !== e.pointerId) return;
46
+ const distance = swipeStart.current.x - e.clientX;
45
47
  if (Math.abs(distance) > swipeThreshold) paginate(distance > 0 ? 1 : -1);
46
- pointerStartX.current = null;
48
+ swipeStart.current = null;
47
49
  };
48
50
  const handlePointerCancel = () => {
49
- pointerStartX.current = null;
51
+ swipeStart.current = null;
50
52
  };
51
53
  const handleKeyDown = (e) => {
52
54
  switch (e.key) {
@@ -73,6 +75,7 @@ var LightBoxGallery = flowComponent("LightBoxGallery", (props) => {
73
75
  "aria-label": stringFormatter.format("gallery"),
74
76
  children: [/* @__PURE__ */ jsx("div", {
75
77
  className: LightBoxGallery_module_default.galleryItem,
78
+ ref: itemRef,
76
79
  children: children[currentIndex]
77
80
  }, currentIndex), /* @__PURE__ */ jsxs("div", {
78
81
  className: LightBoxGallery_module_default.controls,
@@ -1 +1 @@
1
- {"version":3,"file":"LightBoxGallery.mjs","names":["locales","styles"],"sources":["../../../../../../../../../src/components/LightBox/components/LightBoxGallery/LightBoxGallery.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport React, { type ReactNode, useEffect, useRef, useState } from \"react\";\nimport {\n IconChevronLeft,\n IconChevronRight,\n} from \"@/components/Icon/components/icons\";\nimport styles from \"./LightBoxGallery.module.scss\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"../../locales/*.locale.json\";\nimport Button from \"@/components/Button\";\nimport { Controls } from \"@/components/LightBox/components/LightBoxGallery/Controls\";\n\nexport interface LightBoxGalleryProps\n extends PropsWithClassName, FlowComponentProps {\n children: ReactNode[];\n defaultIndex?: number;\n}\n\n/** @flr-generate all */\nexport const LightBoxGallery = flowComponent(\"LightBoxGallery\", (props) => {\n const { children, className, defaultIndex = 0, ref } = props;\n\n const [currentIndex, setIndex] = useState(defaultIndex);\n\n const count = React.Children.count(children);\n\n const isFirst = currentIndex === 0;\n const isLast = currentIndex === count - 1;\n\n const pointerStartX = useRef<number | null>(null);\n const swipeThreshold = 50;\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n // A paging button that gets disabled keeps the focus but no longer receives\n // keys, so Escape would stop closing the light box.\n useEffect(() => {\n const container = containerRef.current;\n const focused = document.activeElement;\n if (\n container &&\n (!container.contains(focused) || focused?.matches(\":disabled\"))\n ) {\n container.focus();\n }\n }, [currentIndex]);\n\n const paginate = (direction: number) => {\n setIndex((prev) => {\n const next = prev + direction;\n\n if (next < 0) return 0;\n if (next >= count) return count - 1;\n\n return next;\n });\n };\n\n const handlePointerDown = (e: React.PointerEvent) => {\n if (!e.isPrimary) return;\n pointerStartX.current = e.clientX;\n };\n\n const handlePointerUp = (e: React.PointerEvent) => {\n if (pointerStartX.current === null) return;\n\n const distance = pointerStartX.current - e.clientX;\n\n if (Math.abs(distance) > swipeThreshold) {\n paginate(distance > 0 ? 1 : -1);\n }\n\n pointerStartX.current = null;\n };\n\n const handlePointerCancel = () => {\n pointerStartX.current = null;\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case \"ArrowLeft\":\n if (!isFirst) paginate(-1);\n break;\n case \"ArrowRight\":\n if (!isLast) paginate(1);\n break;\n }\n };\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"LightBox\");\n\n return (\n <div ref={ref} className={clsx(styles.lightBoxGallery, className)}>\n <div\n ref={containerRef}\n className={styles.content}\n onPointerDown={handlePointerDown}\n onPointerUp={handlePointerUp}\n onPointerCancel={handlePointerCancel}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={stringFormatter.format(\"gallery\")}\n >\n <div className={styles.galleryItem} key={currentIndex}>\n {children[currentIndex]}\n </div>\n\n <div className={styles.controls}>\n <Button\n aria-label={stringFormatter.format(\"previous\")}\n onPress={() => paginate(-1)}\n color=\"light-static\"\n className={styles.previousButton}\n isDisabled={isFirst}\n >\n <IconChevronLeft />\n </Button>\n\n <Controls count={count} currentIndex={currentIndex} />\n\n <Button\n aria-label={stringFormatter.format(\"next\")}\n onPress={() => paginate(1)}\n color=\"light-static\"\n className={styles.nextButton}\n isDisabled={isLast}\n >\n <IconChevronRight />\n </Button>\n </div>\n </div>\n </div>\n );\n});\n\nexport default LightBoxGallery;\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAa,kBAAkB,cAAc,oBAAoB,UAAU;CACzE,MAAM,EAAE,UAAU,WAAW,eAAe,GAAG,QAAQ;CAEvD,MAAM,CAAC,cAAc,YAAY,SAAS,YAAY;CAEtD,MAAM,QAAQ,MAAM,SAAS,MAAM,QAAQ;CAE3C,MAAM,UAAU,iBAAiB;CACjC,MAAM,SAAS,iBAAiB,QAAQ;CAExC,MAAM,gBAAgB,OAAsB,IAAI;CAChD,MAAM,iBAAiB;CAEvB,MAAM,eAAe,OAAuB,IAAI;CAIhD,gBAAgB;EACd,MAAM,YAAY,aAAa;EAC/B,MAAM,UAAU,SAAS;EACzB,IACE,cACC,CAAC,UAAU,SAAS,OAAO,KAAK,SAAS,QAAQ,WAAW,IAE7D,UAAU,MAAM;CAEpB,GAAG,CAAC,YAAY,CAAC;CAEjB,MAAM,YAAY,cAAsB;EACtC,UAAU,SAAS;GACjB,MAAM,OAAO,OAAO;GAEpB,IAAI,OAAO,GAAG,OAAO;GACrB,IAAI,QAAQ,OAAO,OAAO,QAAQ;GAElC,OAAO;EACT,CAAC;CACH;CAEA,MAAM,qBAAqB,MAA0B;EACnD,IAAI,CAAC,EAAE,WAAW;EAClB,cAAc,UAAU,EAAE;CAC5B;CAEA,MAAM,mBAAmB,MAA0B;EACjD,IAAI,cAAc,YAAY,MAAM;EAEpC,MAAM,WAAW,cAAc,UAAU,EAAE;EAE3C,IAAI,KAAK,IAAI,QAAQ,IAAI,gBACvB,SAAS,WAAW,IAAI,IAAI,EAAE;EAGhC,cAAc,UAAU;CAC1B;CAEA,MAAM,4BAA4B;EAChC,cAAc,UAAU;CAC1B;CAEA,MAAM,iBAAiB,MAA2B;EAChD,QAAQ,EAAE,KAAV;GACE,KAAK;IACH,IAAI,CAAC,SAAS,SAAS,EAAE;IACzB;GACF,KAAK,cACH,IAAI,CAAC,QAAQ,SAAS,CAAC;EAE3B;CACF;CAEA,MAAM,kBAAkB,4BAA4BA,kBAAS,UAAU;CAEvE,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,KAAKC,+BAAO,iBAAiB,SAAS;EAC9D,UAAA,qBAAC,OAAD;GACE,KAAK;GACL,WAAWA,+BAAO;GAClB,eAAe;GACf,aAAa;GACb,iBAAiB;GACjB,UAAU;GACV,WAAW;GACX,MAAK;GACL,wBAAqB;GACrB,cAAY,gBAAgB,OAAO,SAAS;GAV9C,UAAA,CAYE,oBAAC,OAAD;IAAK,WAAWA,+BAAO;IACpB,UAAA,SAAS;GACP,GAFoC,YAEpC,GAEL,qBAAC,OAAD;IAAK,WAAWA,+BAAO;IAAvB,UAAA;KACE,oBAAC,QAAD;MACE,cAAY,gBAAgB,OAAO,UAAU;MAC7C,eAAe,SAAS,EAAE;MAC1B,OAAM;MACN,WAAWA,+BAAO;MAClB,YAAY;MAEZ,UAAA,oBAAC,iBAAD,CAAkB,CAAA;KACZ,CAAA;KAER,oBAAC,UAAD;MAAiB;MAAqB;KAAe,CAAA;KAErD,oBAAC,QAAD;MACE,cAAY,gBAAgB,OAAO,MAAM;MACzC,eAAe,SAAS,CAAC;MACzB,OAAM;MACN,WAAWA,+BAAO;MAClB,YAAY;MAEZ,UAAA,oBAAC,kBAAD,CAAmB,CAAA;KACb,CAAA;IACL;GACF,CAAA,CAAA;;CACF,CAAA;AAET,CAAC"}
1
+ {"version":3,"file":"LightBoxGallery.mjs","names":["locales","styles"],"sources":["../../../../../../../../../src/components/LightBox/components/LightBoxGallery/LightBoxGallery.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport React, { type ReactNode, useEffect, useRef, useState } from \"react\";\nimport {\n IconChevronLeft,\n IconChevronRight,\n} from \"@/components/Icon/components/icons\";\nimport styles from \"./LightBoxGallery.module.scss\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"../../locales/*.locale.json\";\nimport Button from \"@/components/Button\";\nimport { Controls } from \"@/components/LightBox/components/LightBoxGallery/Controls\";\n\nexport interface LightBoxGalleryProps\n extends PropsWithClassName, FlowComponentProps {\n children: ReactNode[];\n defaultIndex?: number;\n}\n\n/** @flr-generate all */\nexport const LightBoxGallery = flowComponent(\"LightBoxGallery\", (props) => {\n const { children, className, defaultIndex = 0, ref } = props;\n\n const [currentIndex, setIndex] = useState(defaultIndex);\n\n const count = React.Children.count(children);\n\n const isFirst = currentIndex === 0;\n const isLast = currentIndex === count - 1;\n\n const swipeStart = useRef<{ pointerId: number; x: number } | null>(null);\n const swipeThreshold = 50;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const itemRef = useRef<HTMLDivElement>(null);\n\n // A paging button that gets disabled keeps the focus but no longer receives\n // keys, so Escape would stop closing the light box.\n useEffect(() => {\n const container = containerRef.current;\n const focused = document.activeElement;\n if (\n container &&\n (!container.contains(focused) || focused?.matches(\":disabled\"))\n ) {\n container.focus();\n }\n }, [currentIndex]);\n\n const paginate = (direction: number) => {\n const next = Math.min(Math.max(currentIndex + direction, 0), count - 1);\n if (next === currentIndex) return;\n\n /* The item remounts, which would drop a focus inside it. */\n if (itemRef.current?.contains(document.activeElement)) {\n containerRef.current?.focus();\n }\n setIndex(next);\n };\n\n const handlePointerDown = (e: React.PointerEvent) => {\n if (!e.isPrimary) return;\n swipeStart.current = { pointerId: e.pointerId, x: e.clientX };\n };\n\n /* A pinch in the zoom keeps the release of its first finger, so a later\n press of another pointer must not read as a swipe. */\n const handlePointerUp = (e: React.PointerEvent) => {\n if (swipeStart.current?.pointerId !== e.pointerId) return;\n\n const distance = swipeStart.current.x - e.clientX;\n\n if (Math.abs(distance) > swipeThreshold) {\n paginate(distance > 0 ? 1 : -1);\n }\n\n swipeStart.current = null;\n };\n\n const handlePointerCancel = () => {\n swipeStart.current = null;\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case \"ArrowLeft\":\n if (!isFirst) paginate(-1);\n break;\n case \"ArrowRight\":\n if (!isLast) paginate(1);\n break;\n }\n };\n\n const stringFormatter = useLocalizedStringFormatter(locales, \"LightBox\");\n\n return (\n <div ref={ref} className={clsx(styles.lightBoxGallery, className)}>\n <div\n ref={containerRef}\n className={styles.content}\n onPointerDown={handlePointerDown}\n onPointerUp={handlePointerUp}\n onPointerCancel={handlePointerCancel}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={stringFormatter.format(\"gallery\")}\n >\n <div className={styles.galleryItem} key={currentIndex} ref={itemRef}>\n {children[currentIndex]}\n </div>\n\n <div className={styles.controls}>\n <Button\n aria-label={stringFormatter.format(\"previous\")}\n onPress={() => paginate(-1)}\n color=\"light-static\"\n className={styles.previousButton}\n isDisabled={isFirst}\n >\n <IconChevronLeft />\n </Button>\n\n <Controls count={count} currentIndex={currentIndex} />\n\n <Button\n aria-label={stringFormatter.format(\"next\")}\n onPress={() => paginate(1)}\n color=\"light-static\"\n className={styles.nextButton}\n isDisabled={isLast}\n >\n <IconChevronRight />\n </Button>\n </div>\n </div>\n </div>\n );\n});\n\nexport default LightBoxGallery;\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAa,kBAAkB,cAAc,oBAAoB,UAAU;CACzE,MAAM,EAAE,UAAU,WAAW,eAAe,GAAG,QAAQ;CAEvD,MAAM,CAAC,cAAc,YAAY,SAAS,YAAY;CAEtD,MAAM,QAAQ,MAAM,SAAS,MAAM,QAAQ;CAE3C,MAAM,UAAU,iBAAiB;CACjC,MAAM,SAAS,iBAAiB,QAAQ;CAExC,MAAM,aAAa,OAAgD,IAAI;CACvE,MAAM,iBAAiB;CAEvB,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,UAAU,OAAuB,IAAI;CAI3C,gBAAgB;EACd,MAAM,YAAY,aAAa;EAC/B,MAAM,UAAU,SAAS;EACzB,IACE,cACC,CAAC,UAAU,SAAS,OAAO,KAAK,SAAS,QAAQ,WAAW,IAE7D,UAAU,MAAM;CAEpB,GAAG,CAAC,YAAY,CAAC;CAEjB,MAAM,YAAY,cAAsB;EACtC,MAAM,OAAO,KAAK,IAAI,KAAK,IAAI,eAAe,WAAW,CAAC,GAAG,QAAQ,CAAC;EACtE,IAAI,SAAS,cAAc;EAG3B,IAAI,QAAQ,SAAS,SAAS,SAAS,aAAa,GAClD,aAAa,SAAS,MAAM;EAE9B,SAAS,IAAI;CACf;CAEA,MAAM,qBAAqB,MAA0B;EACnD,IAAI,CAAC,EAAE,WAAW;EAClB,WAAW,UAAU;GAAE,WAAW,EAAE;GAAW,GAAG,EAAE;EAAQ;CAC9D;CAIA,MAAM,mBAAmB,MAA0B;EACjD,IAAI,WAAW,SAAS,cAAc,EAAE,WAAW;EAEnD,MAAM,WAAW,WAAW,QAAQ,IAAI,EAAE;EAE1C,IAAI,KAAK,IAAI,QAAQ,IAAI,gBACvB,SAAS,WAAW,IAAI,IAAI,EAAE;EAGhC,WAAW,UAAU;CACvB;CAEA,MAAM,4BAA4B;EAChC,WAAW,UAAU;CACvB;CAEA,MAAM,iBAAiB,MAA2B;EAChD,QAAQ,EAAE,KAAV;GACE,KAAK;IACH,IAAI,CAAC,SAAS,SAAS,EAAE;IACzB;GACF,KAAK,cACH,IAAI,CAAC,QAAQ,SAAS,CAAC;EAE3B;CACF;CAEA,MAAM,kBAAkB,4BAA4BA,kBAAS,UAAU;CAEvE,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,KAAKC,+BAAO,iBAAiB,SAAS;EAC9D,UAAA,qBAAC,OAAD;GACE,KAAK;GACL,WAAWA,+BAAO;GAClB,eAAe;GACf,aAAa;GACb,iBAAiB;GACjB,UAAU;GACV,WAAW;GACX,MAAK;GACL,wBAAqB;GACrB,cAAY,gBAAgB,OAAO,SAAS;GAV9C,UAAA,CAYE,oBAAC,OAAD;IAAK,WAAWA,+BAAO;IAAgC,KAAK;IACzD,UAAA,SAAS;GACP,GAFoC,YAEpC,GAEL,qBAAC,OAAD;IAAK,WAAWA,+BAAO;IAAvB,UAAA;KACE,oBAAC,QAAD;MACE,cAAY,gBAAgB,OAAO,UAAU;MAC7C,eAAe,SAAS,EAAE;MAC1B,OAAM;MACN,WAAWA,+BAAO;MAClB,YAAY;MAEZ,UAAA,oBAAC,iBAAD,CAAkB,CAAA;KACZ,CAAA;KAER,oBAAC,UAAD;MAAiB;MAAqB;KAAe,CAAA;KAErD,oBAAC,QAAD;MACE,cAAY,gBAAgB,OAAO,MAAM;MACzC,eAAe,SAAS,CAAC;MACzB,OAAM;MACN,WAAWA,+BAAO;MAClB,YAAY;MAEZ,UAAA,oBAAC,kBAAD,CAAmB,CAAA;KACb,CAAA;IACL;GACF,CAAA,CAAA;;CACF,CAAA;AAET,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"LightBoxGallery.module.mjs","names":[],"sources":["../../../../../../../../../src/components/LightBox/components/LightBoxGallery/LightBoxGallery.module.scss"],"sourcesContent":[".lightBoxGallery {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n --button-size: calc(\n var(--icon--size--m) + 2 * var(--button--padding-icon-only)\n );\n --button-size-plus-spacing: calc(\n var(--button-size) + var(--light-box--spacing)\n );\n --indicator-height: calc(var(--light-box--spacing) + var(--icon--size--m));\n\n .content {\n display: flex;\n flex-direction: column;\n width: 100%;\n justify-content: center;\n\n &:focus {\n outline: none;\n }\n }\n\n .galleryItem {\n position: relative;\n margin: 0 auto;\n user-select: none;\n max-height: var(--gallery-item-max-height);\n }\n\n .actions {\n position: absolute;\n top: 0;\n inset-inline-end: calc(var(--button-size-plus-spacing) * -1);\n display: flex;\n flex-direction: column;\n row-gap: var(--light-box--spacing);\n }\n\n .actionGroup {\n flex-direction: column;\n }\n\n /* The item's height is indefinite, so a percentage size here is cyclic and\n engines resolve it differently (WebKit stretched the image). An explicit\n cap scales the image down along its aspect ratio instead. */\n .image {\n animation: fade-in var(--transition--duration--default) ease-in forwards;\n max-height: var(--gallery-item-max-height);\n pointer-events: none;\n }\n\n @keyframes fade-in {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n }\n\n .indicators {\n display: flex;\n justify-content: center;\n column-gap: var(--light-box--indicator-spacing);\n color: var(--light-box--content-color);\n }\n\n .indicator {\n display: block;\n width: var(--light-box--indicator-size);\n height: var(--light-box--indicator-size);\n border: var(--light-box--indicator-border-width)\n var(--light-box--indicator-border-style) var(--light-box--content-color);\n border-radius: var(--light-box--indicator-corner-radius);\n\n &.current {\n background-color: var(--light-box--content-color);\n }\n }\n}\n\n@media (min-width: 768px) {\n .content {\n padding-inline: calc(\n var(--button-size-plus-spacing) + var(--light-box--spacing)\n );\n padding-bottom: var(--indicator-height);\n height: var(--light-box--max-height);\n }\n\n .galleryItem {\n --gallery-item-max-height: calc(\n var(--light-box--max-height) - var(--indicator-height)\n );\n }\n\n .indicators {\n position: absolute;\n bottom: calc(var(--light-box--spacing) / 2);\n inset-inline: 0;\n }\n\n .previousButton,\n .nextButton {\n position: absolute;\n top: calc(50% - var(--button-size) / 2);\n }\n\n .previousButton {\n inset-inline-start: 0;\n }\n\n .nextButton {\n inset-inline-end: 0;\n }\n}\n\n@media (max-width: 768px) {\n .content {\n padding-inline: var(--button-size-plus-spacing);\n padding-bottom: var(--button-size-plus-spacing);\n height: var(--light-box--max-height-mobile);\n }\n\n .galleryItem {\n --gallery-item-max-height: calc(\n var(--light-box--max-height) - var(--button-size-plus-spacing)\n );\n }\n\n .controls {\n display: flex;\n position: absolute;\n bottom: 0;\n inset-inline: 0;\n justify-content: space-between;\n align-items: center;\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"LightBoxGallery.module.mjs","names":[],"sources":["../../../../../../../../../src/components/LightBox/components/LightBoxGallery/LightBoxGallery.module.scss"],"sourcesContent":[".lightBoxGallery {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n --button-size: calc(\n var(--icon--size--m) + 2 * var(--button--padding-icon-only)\n );\n --button-size-plus-spacing: calc(\n var(--button-size) + var(--light-box--spacing)\n );\n --indicator-height: calc(var(--light-box--spacing) + var(--icon--size--m));\n\n .content {\n display: flex;\n flex-direction: column;\n width: 100%;\n justify-content: center;\n\n &:focus {\n outline: none;\n }\n }\n\n .galleryItem {\n position: relative;\n margin: 0 auto;\n user-select: none;\n max-height: var(--gallery-item-max-height);\n }\n\n /* In the screen's top right corner, as the light box places its own. */\n .actions {\n position: fixed;\n top: var(--light-box--spacing);\n inset-inline-end: var(--light-box--spacing);\n display: flex;\n column-gap: var(--light-box--spacing);\n }\n\n .actionGroup {\n flex-wrap: nowrap;\n }\n\n /* The item's height is indefinite, so a percentage size here is cyclic and\n engines resolve it differently (WebKit stretched the image). An explicit\n cap scales the image down along its aspect ratio instead. */\n .image {\n animation: fade-in var(--transition--duration--default) ease-in forwards;\n max-height: var(--gallery-item-max-height);\n pointer-events: none;\n }\n\n @keyframes fade-in {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n }\n\n .indicators {\n display: flex;\n justify-content: center;\n column-gap: var(--light-box--indicator-spacing);\n color: var(--light-box--content-color);\n }\n\n .indicator {\n display: block;\n width: var(--light-box--indicator-size);\n height: var(--light-box--indicator-size);\n border: var(--light-box--indicator-border-width)\n var(--light-box--indicator-border-style) var(--light-box--content-color);\n border-radius: var(--light-box--indicator-corner-radius);\n\n &.current {\n background-color: var(--light-box--content-color);\n }\n }\n}\n\n@media (min-width: 768px) {\n .content {\n padding-inline: calc(\n var(--button-size-plus-spacing) + var(--light-box--spacing)\n );\n padding-bottom: var(--indicator-height);\n height: var(--light-box--max-height);\n }\n\n .galleryItem {\n --gallery-item-max-height: calc(\n var(--light-box--max-height) - var(--indicator-height)\n );\n }\n\n /* At the screen's edges, as far in as the light box's actions. */\n .indicators {\n position: fixed;\n bottom: var(--light-box--spacing);\n inset-inline: 0;\n }\n\n .previousButton,\n .nextButton {\n position: fixed;\n top: calc(50% - var(--button-size) / 2);\n }\n\n .previousButton {\n inset-inline-start: var(--light-box--spacing);\n }\n\n .nextButton {\n inset-inline-end: var(--light-box--spacing);\n }\n}\n\n@media (max-width: 768px) {\n .content {\n padding-inline: var(--button-size-plus-spacing);\n padding-bottom: var(--button-size-plus-spacing);\n height: var(--light-box--max-height-mobile);\n }\n\n .galleryItem {\n --gallery-item-max-height: calc(\n var(--light-box--max-height) - var(--button-size-plus-spacing)\n );\n }\n\n /* At the screen's bottom edge, as far in as the light box's actions. */\n .controls {\n display: flex;\n position: fixed;\n bottom: var(--light-box--spacing);\n inset-inline: var(--light-box--spacing);\n justify-content: space-between;\n align-items: center;\n }\n}\n"],"mappings":""}
@@ -8,12 +8,13 @@ import { UiComponentTunnelExit } from "../../../UiComponentTunnel/UiComponentTun
8
8
  import { useOverlayController } from "../../../../lib/controller/overlay/useOverlayController.mjs";
9
9
  import LightBoxGallery_module_default from "../LightBoxGallery/LightBoxGallery.module.mjs";
10
10
  import __locale_default from "../../../../../../../_virtual/_22.locale.mjs";
11
+ import { LightBoxZoom } from "../LightBoxZoom/LightBoxZoom.mjs";
11
12
  import { jsx, jsxs } from "react/jsx-runtime";
12
13
  import { useLocalizedStringFormatter } from "react-aria";
13
14
  // src/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.tsx
14
15
  /** @flr-generate all */
15
16
  var LightBoxGalleryItem = flowComponent("LightBoxGalleryItem", (props) => {
16
- const { children } = props;
17
+ const { children, withZoom } = props;
17
18
  const controller = useOverlayController("Modal");
18
19
  const propsContext = {
19
20
  ActionGroup: {
@@ -30,16 +31,16 @@ var LightBoxGalleryItem = flowComponent("LightBoxGalleryItem", (props) => {
30
31
  const stringFormatter = useLocalizedStringFormatter(__locale_default);
31
32
  return /* @__PURE__ */ jsxs(PropsContextProvider, {
32
33
  props: propsContext,
33
- children: [children, /* @__PURE__ */ jsxs("div", {
34
+ children: [withZoom ? /* @__PURE__ */ jsx(LightBoxZoom, { children }) : children, /* @__PURE__ */ jsxs("div", {
34
35
  className: LightBoxGallery_module_default.actions,
35
- children: [/* @__PURE__ */ jsx(Button, {
36
+ children: [/* @__PURE__ */ jsx(UiComponentTunnelExit, {
37
+ id: "actionGroup",
38
+ component: "LightBoxGalleryItem"
39
+ }), /* @__PURE__ */ jsx(Button, {
36
40
  "aria-label": stringFormatter.format("close"),
37
41
  color: "light-static",
38
42
  onPress: () => controller.close(),
39
43
  children: /* @__PURE__ */ jsx(IconClose, {})
40
- }), /* @__PURE__ */ jsx(UiComponentTunnelExit, {
41
- id: "actionGroup",
42
- component: "LightBoxGalleryItem"
43
44
  })]
44
45
  })]
45
46
  });
@@ -1 +1 @@
1
- {"version":3,"file":"LightBoxGalleryItem.mjs","names":["styles","locales"],"sources":["../../../../../../../../../src/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport styles from \"@/components/LightBox/components/LightBoxGallery/LightBoxGallery.module.scss\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { IconClose } from \"@/components/Icon/components/icons\";\nimport { useOverlayController } from \"@/lib/hooks\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"../../locales/*.locale.json\";\nimport { Button } from \"@/components/Button\";\nimport type { PropsWithChildren } from \"react\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\n/* Renders no element of its own, so there is no ref to expose. */\nexport type LightBoxGalleryItemProps = PropsWithChildren &\n Omit<FlowComponentProps, \"ref\">;\n\n/** @flr-generate all */\nexport const LightBoxGalleryItem = flowComponent(\n \"LightBoxGalleryItem\",\n (props) => {\n const { children } = props;\n\n const controller = useOverlayController(\"Modal\");\n\n const propsContext: PropsContext = {\n ActionGroup: {\n spacing: \"m\",\n className: styles.actionGroup,\n Button: { color: \"light-static\" },\n tunnel: { id: \"actionGroup\", component: \"LightBoxGalleryItem\" },\n },\n Image: { className: styles.image },\n };\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n return (\n <PropsContextProvider props={propsContext}>\n {children}\n <div className={styles.actions}>\n <Button\n aria-label={stringFormatter.format(\"close\")}\n color=\"light-static\"\n onPress={() => controller.close()}\n >\n <IconClose />\n </Button>\n <UiComponentTunnelExit\n id=\"actionGroup\"\n component=\"LightBoxGalleryItem\"\n />\n </div>\n </PropsContextProvider>\n );\n },\n);\n\nexport default LightBoxGalleryItem;\n"],"mappings":";;;;;;;;;;;;;;AAmBA,IAAa,sBAAsB,cACjC,wBACC,UAAU;CACT,MAAM,EAAE,aAAa;CAErB,MAAM,aAAa,qBAAqB,OAAO;CAE/C,MAAM,eAA6B;EACjC,aAAa;GACX,SAAS;GACT,WAAWA,+BAAO;GAClB,QAAQ,EAAE,OAAO,eAAe;GAChC,QAAQ;IAAE,IAAI;IAAe,WAAW;GAAsB;EAChE;EACA,OAAO,EAAE,WAAWA,+BAAO,MAAM;CACnC;CAEA,MAAM,kBAAkB,4BAA4BC,gBAAO;CAE3D,OACE,qBAAC,sBAAD;EAAsB,OAAO;EAA7B,UAAA,CACG,UACD,qBAAC,OAAD;GAAK,WAAWD,+BAAO;GAAvB,UAAA,CACE,oBAAC,QAAD;IACE,cAAY,gBAAgB,OAAO,OAAO;IAC1C,OAAM;IACN,eAAe,WAAW,MAAM;IAEhC,UAAA,oBAAC,WAAD,CAAY,CAAA;GACN,CAAA,GACR,oBAAC,uBAAD;IACE,IAAG;IACH,WAAU;GACX,CAAA,CACE;EACe,CAAA,CAAA;;AAE1B,CACF"}
1
+ {"version":3,"file":"LightBoxGalleryItem.mjs","names":["styles","locales","_jsx"],"sources":["../../../../../../../../../src/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport styles from \"@/components/LightBox/components/LightBoxGallery/LightBoxGallery.module.scss\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { IconClose } from \"@/components/Icon/components/icons\";\nimport { useOverlayController } from \"@/lib/hooks\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"../../locales/*.locale.json\";\nimport { Button } from \"@/components/Button\";\nimport type { PropsWithChildren } from \"react\";\nimport { LightBoxZoom } from \"@/components/LightBox/components/LightBoxZoom\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\n/* Renders no element of its own, so there is no ref to expose. */\nexport interface LightBoxGalleryItemProps\n extends PropsWithChildren, Omit<FlowComponentProps, \"ref\"> {\n /**\n * @internal Set by the `withZoom` of the surrounding `LightBox`: whether the\n * item's content can be zoomed.\n */\n withZoom?: boolean;\n}\n\n/** @flr-generate all */\nexport const LightBoxGalleryItem = flowComponent(\n \"LightBoxGalleryItem\",\n (props) => {\n const { children, withZoom } = props;\n\n const controller = useOverlayController(\"Modal\");\n\n const propsContext: PropsContext = {\n ActionGroup: {\n spacing: \"m\",\n className: styles.actionGroup,\n Button: { color: \"light-static\" },\n tunnel: { id: \"actionGroup\", component: \"LightBoxGalleryItem\" },\n },\n Image: { className: styles.image },\n };\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const zoomableContent = <LightBoxZoom>{children}</LightBoxZoom>;\n\n return (\n <PropsContextProvider props={propsContext}>\n {withZoom ? zoomableContent : children}\n <div className={styles.actions}>\n <UiComponentTunnelExit\n id=\"actionGroup\"\n component=\"LightBoxGalleryItem\"\n />\n <Button\n aria-label={stringFormatter.format(\"close\")}\n color=\"light-static\"\n onPress={() => controller.close()}\n >\n <IconClose />\n </Button>\n </div>\n </PropsContextProvider>\n );\n },\n);\n\nexport default LightBoxGalleryItem;\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,IAAa,sBAAsB,cACjC,wBACC,UAAU;CACT,MAAM,EAAE,UAAU,aAAa;CAE/B,MAAM,aAAa,qBAAqB,OAAO;CAE/C,MAAM,eAA6B;EACjC,aAAa;GACX,SAAS;GACT,WAAWA,+BAAO;GAClB,QAAQ,EAAE,OAAO,eAAe;GAChC,QAAQ;IAAE,IAAI;IAAe,WAAW;GAAsB;EAChE;EACA,OAAO,EAAE,WAAWA,+BAAO,MAAM;CACnC;CAEA,MAAM,kBAAkB,4BAA4BC,gBAAO;CAI3D,OACE,qBAAC,sBAAD;EAAsB,OAAO;EAA7B,UAAA,CACG,WAJmBC,oBAAC,cAAD,EAAe,SAAuB,CAI9C,IAAkB,UAC9B,qBAAC,OAAD;GAAK,WAAWF,+BAAO;GAAvB,UAAA,CACE,oBAAC,uBAAD;IACE,IAAG;IACH,WAAU;GACX,CAAA,GACD,oBAAC,QAAD;IACE,cAAY,gBAAgB,OAAO,OAAO;IAC1C,OAAM;IACN,eAAe,WAAW,MAAM;IAEhC,UAAA,oBAAC,WAAD,CAAY,CAAA;GACN,CAAA,CACL;EACe,CAAA,CAAA;;AAE1B,CACF"}
@@ -0,0 +1,82 @@
1
+ "use client"
2
+ /* */
3
+ import { useLocalizedStringFormatter } from "../../../TranslationProvider/useLocalizedStringFormatter.mjs";
4
+ import __locale_default from "../../../../../../../_virtual/_22.locale.mjs";
5
+ import LightBoxZoom_module_default from "./LightBoxZoom.module.mjs";
6
+ import { visibleArea } from "./lib/zoomTransform.mjs";
7
+ import { useZoom } from "./hooks/useZoom.mjs";
8
+ import clsx from "clsx";
9
+ import { createContext, useCallback, useContext, useId, useLayoutEffect, useRef, useState } from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ // src/components/LightBox/components/LightBoxZoom/LightBoxZoom.tsx
12
+ /**
13
+ * Lets a nested zoom switch the surrounding one off: a `LightBox` with
14
+ * `withZoom` wraps its content, and the items of a `LightBoxGallery` in it zoom
15
+ * on their own.
16
+ */
17
+ var NestedZoomContext = createContext(void 0);
18
+ /**
19
+ * The zoomable area of a `LightBox` with `withZoom`. Not a `flowComponent`: it
20
+ * passes the light box's props context through to its children.
21
+ *
22
+ * @flr-generate all
23
+ */
24
+ var LightBoxZoom = (props) => {
25
+ const { children, className } = props;
26
+ const registerWithSurroundingZoom = useContext(NestedZoomContext);
27
+ const [nestedZoomCount, setNestedZoomCount] = useState(0);
28
+ const isEnabled = nestedZoomCount === 0;
29
+ const registerNestedZoom = useCallback(() => {
30
+ setNestedZoomCount((count) => count + 1);
31
+ return () => setNestedZoomCount((count) => count - 1);
32
+ }, []);
33
+ useLayoutEffect(() => registerWithSurroundingZoom?.(), [registerWithSurroundingZoom]);
34
+ const ref = useRef(null);
35
+ const { transform, frame, isZoomed, isAnimated, isDragging, handlers } = useZoom(ref, isEnabled);
36
+ const descriptionId = useId();
37
+ const stringFormatter = useLocalizedStringFormatter(__locale_default, "LightBox");
38
+ const rootClassName = clsx(LightBoxZoom_module_default.lightBoxZoom, isZoomed && LightBoxZoom_module_default.zoomed, isDragging && LightBoxZoom_module_default.dragging, className);
39
+ const contentStyle = { transform: `translate(${transform.x}px, ${transform.y}px) scale(${transform.scale})` };
40
+ const focusRingStyle = isZoomed && frame ? {
41
+ ...visibleArea(transform, frame),
42
+ right: "auto",
43
+ bottom: "auto"
44
+ } : void 0;
45
+ const passThrough = /* @__PURE__ */ jsx("div", {
46
+ className,
47
+ children: /* @__PURE__ */ jsx("div", { children })
48
+ });
49
+ const zoom = /* @__PURE__ */ jsxs("div", {
50
+ ref,
51
+ className: rootClassName,
52
+ role: "group",
53
+ "aria-label": stringFormatter.format("zoom"),
54
+ "aria-describedby": descriptionId,
55
+ tabIndex: 0,
56
+ onDragStart: (event) => event.preventDefault(),
57
+ ...handlers,
58
+ children: [
59
+ /* @__PURE__ */ jsx("div", {
60
+ className: clsx(LightBoxZoom_module_default.content, isAnimated && LightBoxZoom_module_default.animated),
61
+ style: contentStyle,
62
+ children
63
+ }),
64
+ /* @__PURE__ */ jsx("span", {
65
+ className: LightBoxZoom_module_default.focusRing,
66
+ style: focusRingStyle
67
+ }),
68
+ /* @__PURE__ */ jsx("span", {
69
+ id: descriptionId,
70
+ hidden: true,
71
+ children: stringFormatter.format("zoomDescription")
72
+ })
73
+ ]
74
+ });
75
+ return /* @__PURE__ */ jsx(NestedZoomContext, {
76
+ value: registerNestedZoom,
77
+ children: isEnabled ? zoom : passThrough
78
+ });
79
+ };
80
+ export { LightBoxZoom, LightBoxZoom as default };
81
+
82
+ //# sourceMappingURL=LightBoxZoom.mjs.map