@cratis/components 4.37.0 → 4.38.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.
Files changed (31) hide show
  1. package/compat-manifest.json +11 -11
  2. package/dist/esm/CommandDialog/CommandStepperContent.js +1 -0
  3. package/dist/esm/CommandDialog/CommandStepperContent.js.map +1 -1
  4. package/dist/esm/CommandDialog/StepperCommandDialog.js +1 -0
  5. package/dist/esm/CommandDialog/StepperCommandDialog.js.map +1 -1
  6. package/dist/esm/Common/Breadcrumbs.d.ts +1 -1
  7. package/dist/esm/Common/Breadcrumbs.d.ts.map +1 -1
  8. package/dist/esm/Common/Breadcrumbs.js.map +1 -1
  9. package/dist/esm/Common/CratisComponentsProvider.d.ts +9 -0
  10. package/dist/esm/Common/CratisComponentsProvider.d.ts.map +1 -1
  11. package/dist/esm/Common/CratisComponentsProvider.js +4 -2
  12. package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
  13. package/dist/esm/Common/DatePickerInputImplementation.js +1 -0
  14. package/dist/esm/Common/DatePickerInputImplementation.js.map +1 -1
  15. package/dist/esm/DataTables/ColumnFilterMenu.js +1 -0
  16. package/dist/esm/DataTables/ColumnFilterMenu.js.map +1 -1
  17. package/dist/esm/DataTables/TablePaginatorImplementation.js +1 -0
  18. package/dist/esm/DataTables/TablePaginatorImplementation.js.map +1 -1
  19. package/dist/esm/DataTables/useDataTableMessages.js +1 -0
  20. package/dist/esm/DataTables/useDataTableMessages.js.map +1 -1
  21. package/dist/esm/Dialogs/DialogImplementation.js +1 -0
  22. package/dist/esm/Dialogs/DialogImplementation.js.map +1 -1
  23. package/dist/esm/Dropdown/DropdownImplementation.js +1 -0
  24. package/dist/esm/Dropdown/DropdownImplementation.js.map +1 -1
  25. package/dist/esm/Toolbar/Toolbar.js +1 -0
  26. package/dist/esm/Toolbar/Toolbar.js.map +1 -1
  27. package/dist/esm/Toolbar/ToolbarFolder.js +1 -0
  28. package/dist/esm/Toolbar/ToolbarFolder.js.map +1 -1
  29. package/dist/esm/index.d.ts +1 -1
  30. package/dist/esm/index.d.ts.map +1 -1
  31. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CratisComponentsProvider.js","sources":["../../../Common/CratisComponentsProvider.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo, type ReactNode } from 'react';\nimport { I18nProvider } from 'react-aria-components/I18nProvider';\nimport { merge } from 'ts-deepmerge';\nimport { Toaster, type ToasterProps } from '../Notifications/Toaster';\nimport { unstable_RendererRoot } from '../renderer/RendererContext';\nimport type { CratisRendererSetup, unstable_UiLibrary } from '../renderer/manifest';\nimport type { CratisOverlayEnvironment } from '../renderer/overlayEnvironment';\nimport { CratisComponentsContext } from '../configuration/CratisComponentsContext';\nimport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\n\nconst RendererRoot = unstable_RendererRoot;\n\nexport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\nexport { useCratisComponentsConfig } from '../configuration/CratisComponentsContext';\n\n/** Localizable labels owned by the Cratis paginator. */\nexport interface CratisPaginatorMessages {\n /** Pagination navigation-region name. */\n navigation?: string;\n /** First-page action label. */\n first?: string;\n /** Previous-page action label. */\n previous?: string;\n /** Next-page action label. */\n next?: string;\n /** Last-page action label. */\n last?: string;\n /** Builds a numbered page button's accessible name from its one-based page number. */\n page?: (page: number) => string;\n /** Accessible name for the numbered-page group. */\n pages?: string;\n /** Builds the visible range text from the one-based start, the clamped end and the total. Defaults to `start–end of total`. */\n range?: (start: number, end: number, total: number) => string;\n}\n\n/** Localizable labels owned by the Cratis date picker composition. */\nexport interface CratisDatePickerMessages {\n /** Today action label. */\n today?: string;\n /** Clear action label. */\n clear?: string;\n /** Calendar-trigger label. */\n openCalendar?: string;\n /** Previous-month action label. */\n previousMonth?: string;\n /** Next-month action label. */\n nextMonth?: string;\n /**\n * Accessible name for the segmented date input when neither an explicit\n * `aria-label` nor a `placeholder` is supplied. Previously an orphaned\n * `'Date'` literal with no override path.\n */\n label?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Dropdown} composition. */\nexport interface CratisDropdownMessages {\n /** Accessible name for the options-popover trigger. */\n showOptions?: string;\n /** Accessible name for the clear-selection action. */\n clearSelection?: string;\n}\n\n/**\n * Localizable action and dismissal labels shared by every Cratis-owned dialog\n * surface — {@link Dialog}, {@link CommandDialog}, and {@link StepperCommandDialog}.\n */\nexport interface CratisDialogMessages {\n /** Primary confirmation label (the `Ok` action in `DialogButtons.Ok*`). */\n ok?: string;\n /** Cancellation label (the `Cancel` action, and the Stepper footer Cancel). */\n cancel?: string;\n /** Affirmative label (the `Yes` action in `DialogButtons.YesNo*`). */\n yes?: string;\n /** Negative label (the `No` action in `DialogButtons.YesNo*`). */\n no?: string;\n /** Accessible name for the header close (×) action. */\n close?: string;\n /**\n * Polite announcement made when a confirm is refused and the dialog stays open\n * (validation failure or business rule). Defaults to\n * 'The action was not completed. Review the dialog and try again.'\n */\n refused?: string;\n}\n\n/** Localizable navigation labels owned by {@link CommandStepper} / {@link StepperCommandDialog}. */\nexport interface CratisStepperMessages {\n /** Advance-to-next-step action label. */\n next?: string;\n /** Return-to-previous-step action label. */\n previous?: string;\n /** Final-step submit action label. */\n submit?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toaster}. */\nexport interface CratisNotificationsMessages {\n /** Accessible name for a toast's dismiss action. */\n dismiss?: string;\n /** Accessible name for the toast region landmark. */\n region?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link DataTableCore} composition. */\nexport interface CratisDataTableMessages {\n /** Accessible name for a single-selection row control. */\n selectRow?: string;\n /** Accessible name for the select-all control in a multiple-selection header. */\n selectAllRows?: string;\n /** Placeholder for the loaded-page search input. */\n search?: string;\n /** Accessible name for the loaded-page search input. */\n searchAriaLabel?: string;\n /** Message shown while loading an empty table. */\n loading?: string;\n /** Message shown when a query fails. */\n failed?: string;\n /** Message shown when a query denies access. */\n unauthorized?: string;\n /** Message shown when a search or filter leaves no rows on the loaded page. */\n filteredEmpty?: string;\n /** Message shown when a search or filter leaves no rows in server mode. */\n filteredEmptyServer?: string;\n}\n\n/** Localizable accessible names for the Cratis filter panel and its searches. */\nexport interface CratisFilterMessages {\n /** FilterPanel dialog name. Defaults to 'Filters'. */\n label?: string;\n /**\n * Search-input name for FilterPanel, its option groups, and standalone CheckboxListFilter.\n * Unset by default so an effective search placeholder retains precedence over 'Search'.\n * PivotViewer supplies group-specific names instead of using this shared name for its groups.\n */\n searchAriaLabel?: string;\n}\n\n/** Localizable labels owned by the Cratis column-filter popup. */\nexport interface CratisColumnFilterMessages {\n /** Builds the filter-trigger accessible name from the effective field. */\n filterTriggerAriaLabel?: (field: string) => string;\n /** Builds the value-control accessible name from the effective field. */\n valueAriaLabel?: (field: string) => string;\n /** Accessible name for the match-mode selector. */\n matchModeAriaLabel?: string;\n /** Localizes a match mode while retaining its default label as fallback input. */\n matchModeLabel?: (mode: string, defaultLabel: string) => string;\n /** Clear action label. */\n clear?: string;\n /** Apply action label. */\n apply?: string;\n /** Boolean true option label. */\n true?: string;\n /** Boolean false option label. */\n false?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toolbar} composition. */\nexport interface CratisToolbarMessages {\n /** Accessible toolbar name used when neither `aria-label` nor `aria-labelledby` is supplied. */\n label?: string;\n /** Accessible name of the close button in a drawer {@link ToolbarFolder}. Defaults to 'Close'. */\n closeDrawer?: string;\n}\n\n/** Components-owned message groups. */\nexport interface CratisComponentsMessages {\n /** Paginator labels. */\n paginator?: CratisPaginatorMessages;\n /** Date-picker labels. */\n datePicker?: CratisDatePickerMessages;\n /** Dropdown labels. */\n dropdown?: CratisDropdownMessages;\n /** Dialog action/dismissal labels shared by Dialog, CommandDialog, and StepperCommandDialog. */\n dialog?: CratisDialogMessages;\n /** Stepper navigation labels shared by CommandStepper and StepperCommandDialog. */\n stepper?: CratisStepperMessages;\n /** Toaster labels. */\n notifications?: CratisNotificationsMessages;\n /** DataTable search, selection, and query-state messages. */\n dataTable?: CratisDataTableMessages;\n /** FilterPanel dialog and search-input accessible names. */\n filter?: CratisFilterMessages;\n /** Column-filter popup labels and match-mode copy. */\n columnFilter?: CratisColumnFilterMessages;\n /** Toolbar accessible-name fallback. */\n toolbar?: CratisToolbarMessages;\n}\n\n/**\n * Components-owned icon vocabulary. Every name is a concept the library draws in more than one\n * place; registering one replaces that concept's built-in glyph everywhere it is drawn, without\n * touching the surrounding element, its part, or its accessible name.\n *\n * Resolution per site is `per-component prop → provider icon → built-in glyph`: a named prop such\n * as `Dialog`'s `closeIcon` means \"this one call site\" and keeps winning, while the provider\n * replaces the built-in default for the whole product. Registering nothing renders exactly what the\n * library renders today, because the built-in glyph stays at its call site and is never part of\n * {@link cratisDefaults}.\n *\n * A name registered as `null` draws no glyph while the button, its part, and its accessible name\n * remain — the same meaning `closeIcon={null}` already has.\n */\nexport interface CratisComponentsIcons {\n /** Dismissal mark. Drawn by `Dialog`'s header close, `Toaster`'s dismiss, `ChatSidebar`, the `Chat` panel, and the PivotViewer detail panel. Defaults to `×`. */\n close?: ReactNode;\n /** Remove-this-value mark. Drawn by `TagGroup`'s tag remove, `Chip`'s remove control, and `CommandForm`'s chips field. Defaults to `×`. */\n remove?: ReactNode;\n /** Expand/collapse chevron on a closed-by-default surface. Drawn by `Dropdown`'s trigger and `ComboBox`'s trigger. Defaults to `⌄` (`▾` in `ComboBox`). */\n expand?: ReactNode;\n /** Ascending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▲`. */\n sortAscending?: ReactNode;\n /** Descending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▼`. */\n sortDescending?: ReactNode;\n /** Step-backwards mark. Drawn by `TablePaginator`'s previous page and the date picker's previous month. Defaults to `‹`. */\n previous?: ReactNode;\n /** Step-forwards mark. Drawn by `TablePaginator`'s next page and the date picker's next month. Defaults to `›`. */\n next?: ReactNode;\n /** Clear-the-current-value mark. Drawn by `Dropdown`'s clear-selection action and the PivotViewer filter panel's clear action. Defaults to `×`. */\n clear?: ReactNode;\n}\n\ninterface LegacyLocaleMessages {\n today?: string;\n clear?: string;\n aria?: {\n navigation?: string;\n firstPageLabel?: string;\n prevPageLabel?: string;\n nextPageLabel?: string;\n lastPageLabel?: string;\n };\n [message: string]: unknown;\n}\n\n/** Renderer-independent application configuration for Components. */\nexport interface CratisComponentsConfig {\n /** BCP 47 locale used by React Aria for dates, numbers, and interaction announcements. */\n locale?: string;\n /** Cratis-owned labels not supplied by the platform's internationalization APIs. */\n messages?: CratisComponentsMessages;\n /** Cratis-owned icon vocabulary replacing the built-in glyphs the library draws. */\n icons?: CratisComponentsIcons;\n /**\n * @deprecated Use {@link messages}; React Aria supplies its own locale data.\n */\n locales?: Record<string, LegacyLocaleMessages>;\n}\n\n/** Props for the application-root Components provider. */\nexport interface CratisComponentsProviderProps {\n /** Locale and Components-owned messages. */\n value?: CratisComponentsConfig;\n /** Mounts the global toaster with defaults or explicit options. */\n toaster?: boolean | ToasterProps;\n /**\n * Selects one stable presentation library. The broader generic manifest and ordered,\n * last-wins composition form remain experimental.\n */\n library?: unstable_UiLibrary | readonly unstable_UiLibrary[];\n /** Experimental profile-promise behavior. Defaults to strict. */\n libraryMode?: 'strict' | 'degrade';\n /** Terminal slot fallback behavior. Defaults to the built-in Core implementation. */\n rendererFallback?: 'core' | 'throw';\n /** Host environment for overlay portal containers. */\n overlayEnvironment?: CratisOverlayEnvironment;\n /**\n * Non-secret renderer setup attestations. Values are booleans so credentials and license\n * tokens never cross the Components provider boundary.\n */\n rendererSetup?: CratisRendererSetup;\n /** Application content. */\n children: ReactNode;\n}\n\n/**\n * Deep-merges consumer configuration over {@link cratisDefaults}.\n *\n * `icons` merges by name only. An icon value is an opaque node — often a React element — so it is\n * carried over by identity instead of being deep-merged into, while a partial map still leaves every\n * unregistered name to its built-in glyph.\n */\nexport const mergeCratisComponentsConfig = (\n value: CratisComponentsConfig | undefined,\n): CratisComponentsConfig => {\n const { icons, ...rest } = value ?? {};\n const merged = merge(cratisDefaults, rest) as CratisComponentsConfig;\n return icons ? { ...merged, icons: { ...cratisDefaults.icons, ...icons } } : merged;\n};\n\nconst withLegacyLocaleMessages = (\n config: CratisComponentsConfig,\n explicitMessages: CratisComponentsMessages | undefined,\n): CratisComponentsConfig => {\n const legacy = config.locale ? config.locales?.[config.locale] : undefined;\n if (!legacy) return config;\n return {\n ...config,\n messages: {\n ...config.messages,\n paginator: {\n ...config.messages?.paginator,\n navigation:\n explicitMessages?.paginator?.navigation ??\n legacy.aria?.navigation ??\n config.messages?.paginator?.navigation,\n first:\n explicitMessages?.paginator?.first ??\n legacy.aria?.firstPageLabel ??\n config.messages?.paginator?.first,\n previous:\n explicitMessages?.paginator?.previous ??\n legacy.aria?.prevPageLabel ??\n config.messages?.paginator?.previous,\n next:\n explicitMessages?.paginator?.next ??\n legacy.aria?.nextPageLabel ??\n config.messages?.paginator?.next,\n last:\n explicitMessages?.paginator?.last ??\n legacy.aria?.lastPageLabel ??\n config.messages?.paginator?.last,\n },\n datePicker: {\n ...config.messages?.datePicker,\n today:\n explicitMessages?.datePicker?.today ??\n legacy.today ??\n config.messages?.datePicker?.today,\n clear:\n explicitMessages?.datePicker?.clear ??\n legacy.clear ??\n config.messages?.datePicker?.clear,\n openCalendar:\n explicitMessages?.datePicker?.openCalendar ??\n config.messages?.datePicker?.openCalendar,\n previousMonth:\n explicitMessages?.datePicker?.previousMonth ??\n config.messages?.datePicker?.previousMonth,\n nextMonth:\n explicitMessages?.datePicker?.nextMonth ??\n config.messages?.datePicker?.nextMonth,\n },\n },\n };\n};\n\nconst validLocale = (locale: string | undefined) => {\n if (!locale) return 'en-US';\n try {\n return new Intl.Locale(locale).toString();\n } catch {\n return 'en-US';\n }\n};\n\n/** Application root for locale, labels, and the optional app-wide toaster. */\nexport const CratisComponentsProvider = ({\n value,\n toaster,\n library,\n libraryMode,\n rendererFallback,\n overlayEnvironment,\n rendererSetup,\n children,\n}: CratisComponentsProviderProps) => {\n const resolved = useMemo(\n () =>\n withLegacyLocaleMessages(mergeCratisComponentsConfig(value), value?.messages),\n [value],\n );\n\n return (\n <RendererRoot\n library={library}\n libraryMode={libraryMode}\n rendererFallback={rendererFallback}\n overlayEnvironment={overlayEnvironment}\n rendererSetup={rendererSetup}\n >\n <CratisComponentsContext.Provider value={resolved}>\n <I18nProvider locale={validLocale(resolved.locale)}>\n {children}\n {toaster && (\n <Toaster {...(typeof toaster === 'object' ? toaster : {})} />\n )}\n </I18nProvider>\n </CratisComponentsContext.Provider>\n </RendererRoot>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAaA,MAAM,YAAY,GAAG,qBAAqB;AAiRnC,MAAM,2BAA2B,GAAG,CACvC,KAAyC,KACjB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,EAAE,IAAI,CAA2B;IACpE,OAAO,KAAK,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAAM;AACvF;AAEA,MAAM,wBAAwB,GAAG,CAC7B,MAA8B,EAC9B,gBAAsD,KAC9B;IACxB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS;AAC1E,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,MAAM;IAC1B,OAAO;AACH,QAAA,GAAG,MAAM;AACT,QAAA,QAAQ,EAAE;YACN,GAAG,MAAM,CAAC,QAAQ;AAClB,YAAA,SAAS,EAAE;AACP,gBAAA,GAAG,MAAM,CAAC,QAAQ,EAAE,SAAS;AAC7B,gBAAA,UAAU,EACN,gBAAgB,EAAE,SAAS,EAAE,UAAU;oBACvC,MAAM,CAAC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A,CACU,EAAA,CACgB,EAAA,CACxB;AAEvB;;"}
1
+ {"version":3,"file":"CratisComponentsProvider.js","sources":["../../../Common/CratisComponentsProvider.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo, type ReactNode } from 'react';\nimport { I18nProvider } from 'react-aria-components/I18nProvider';\nimport { RouterProvider } from 'react-aria-components';\nimport { merge } from 'ts-deepmerge';\nimport { Toaster, type ToasterProps } from '../Notifications/Toaster';\nimport { unstable_RendererRoot } from '../renderer/RendererContext';\nimport type { CratisRendererSetup, unstable_UiLibrary } from '../renderer/manifest';\nimport type { CratisOverlayEnvironment } from '../renderer/overlayEnvironment';\nimport { CratisComponentsContext } from '../configuration/CratisComponentsContext';\nimport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\n\nconst RendererRoot = unstable_RendererRoot;\n\nexport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\nexport { useCratisComponentsConfig } from '../configuration/CratisComponentsContext';\n\n/** Localizable labels owned by the Cratis paginator. */\nexport interface CratisPaginatorMessages {\n /** Pagination navigation-region name. */\n navigation?: string;\n /** First-page action label. */\n first?: string;\n /** Previous-page action label. */\n previous?: string;\n /** Next-page action label. */\n next?: string;\n /** Last-page action label. */\n last?: string;\n /** Builds a numbered page button's accessible name from its one-based page number. */\n page?: (page: number) => string;\n /** Accessible name for the numbered-page group. */\n pages?: string;\n /** Builds the visible range text from the one-based start, the clamped end and the total. Defaults to `start–end of total`. */\n range?: (start: number, end: number, total: number) => string;\n}\n\n/** Localizable labels owned by the Cratis date picker composition. */\nexport interface CratisDatePickerMessages {\n /** Today action label. */\n today?: string;\n /** Clear action label. */\n clear?: string;\n /** Calendar-trigger label. */\n openCalendar?: string;\n /** Previous-month action label. */\n previousMonth?: string;\n /** Next-month action label. */\n nextMonth?: string;\n /**\n * Accessible name for the segmented date input when neither an explicit\n * `aria-label` nor a `placeholder` is supplied. Previously an orphaned\n * `'Date'` literal with no override path.\n */\n label?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Dropdown} composition. */\nexport interface CratisDropdownMessages {\n /** Accessible name for the options-popover trigger. */\n showOptions?: string;\n /** Accessible name for the clear-selection action. */\n clearSelection?: string;\n}\n\n/**\n * Localizable action and dismissal labels shared by every Cratis-owned dialog\n * surface — {@link Dialog}, {@link CommandDialog}, and {@link StepperCommandDialog}.\n */\nexport interface CratisDialogMessages {\n /** Primary confirmation label (the `Ok` action in `DialogButtons.Ok*`). */\n ok?: string;\n /** Cancellation label (the `Cancel` action, and the Stepper footer Cancel). */\n cancel?: string;\n /** Affirmative label (the `Yes` action in `DialogButtons.YesNo*`). */\n yes?: string;\n /** Negative label (the `No` action in `DialogButtons.YesNo*`). */\n no?: string;\n /** Accessible name for the header close (×) action. */\n close?: string;\n /**\n * Polite announcement made when a confirm is refused and the dialog stays open\n * (validation failure or business rule). Defaults to\n * 'The action was not completed. Review the dialog and try again.'\n */\n refused?: string;\n}\n\n/** Localizable navigation labels owned by {@link CommandStepper} / {@link StepperCommandDialog}. */\nexport interface CratisStepperMessages {\n /** Advance-to-next-step action label. */\n next?: string;\n /** Return-to-previous-step action label. */\n previous?: string;\n /** Final-step submit action label. */\n submit?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toaster}. */\nexport interface CratisNotificationsMessages {\n /** Accessible name for a toast's dismiss action. */\n dismiss?: string;\n /** Accessible name for the toast region landmark. */\n region?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link DataTableCore} composition. */\nexport interface CratisDataTableMessages {\n /** Accessible name for a single-selection row control. */\n selectRow?: string;\n /** Accessible name for the select-all control in a multiple-selection header. */\n selectAllRows?: string;\n /** Placeholder for the loaded-page search input. */\n search?: string;\n /** Accessible name for the loaded-page search input. */\n searchAriaLabel?: string;\n /** Message shown while loading an empty table. */\n loading?: string;\n /** Message shown when a query fails. */\n failed?: string;\n /** Message shown when a query denies access. */\n unauthorized?: string;\n /** Message shown when a search or filter leaves no rows on the loaded page. */\n filteredEmpty?: string;\n /** Message shown when a search or filter leaves no rows in server mode. */\n filteredEmptyServer?: string;\n}\n\n/** Localizable accessible names for the Cratis filter panel and its searches. */\nexport interface CratisFilterMessages {\n /** FilterPanel dialog name. Defaults to 'Filters'. */\n label?: string;\n /**\n * Search-input name for FilterPanel, its option groups, and standalone CheckboxListFilter.\n * Unset by default so an effective search placeholder retains precedence over 'Search'.\n * PivotViewer supplies group-specific names instead of using this shared name for its groups.\n */\n searchAriaLabel?: string;\n}\n\n/** Localizable labels owned by the Cratis column-filter popup. */\nexport interface CratisColumnFilterMessages {\n /** Builds the filter-trigger accessible name from the effective field. */\n filterTriggerAriaLabel?: (field: string) => string;\n /** Builds the value-control accessible name from the effective field. */\n valueAriaLabel?: (field: string) => string;\n /** Accessible name for the match-mode selector. */\n matchModeAriaLabel?: string;\n /** Localizes a match mode while retaining its default label as fallback input. */\n matchModeLabel?: (mode: string, defaultLabel: string) => string;\n /** Clear action label. */\n clear?: string;\n /** Apply action label. */\n apply?: string;\n /** Boolean true option label. */\n true?: string;\n /** Boolean false option label. */\n false?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toolbar} composition. */\nexport interface CratisToolbarMessages {\n /** Accessible toolbar name used when neither `aria-label` nor `aria-labelledby` is supplied. */\n label?: string;\n /** Accessible name of the close button in a drawer {@link ToolbarFolder}. Defaults to 'Close'. */\n closeDrawer?: string;\n}\n\n/** Components-owned message groups. */\nexport interface CratisComponentsMessages {\n /** Paginator labels. */\n paginator?: CratisPaginatorMessages;\n /** Date-picker labels. */\n datePicker?: CratisDatePickerMessages;\n /** Dropdown labels. */\n dropdown?: CratisDropdownMessages;\n /** Dialog action/dismissal labels shared by Dialog, CommandDialog, and StepperCommandDialog. */\n dialog?: CratisDialogMessages;\n /** Stepper navigation labels shared by CommandStepper and StepperCommandDialog. */\n stepper?: CratisStepperMessages;\n /** Toaster labels. */\n notifications?: CratisNotificationsMessages;\n /** DataTable search, selection, and query-state messages. */\n dataTable?: CratisDataTableMessages;\n /** FilterPanel dialog and search-input accessible names. */\n filter?: CratisFilterMessages;\n /** Column-filter popup labels and match-mode copy. */\n columnFilter?: CratisColumnFilterMessages;\n /** Toolbar accessible-name fallback. */\n toolbar?: CratisToolbarMessages;\n}\n\n/**\n * Components-owned icon vocabulary. Every name is a concept the library draws in more than one\n * place; registering one replaces that concept's built-in glyph everywhere it is drawn, without\n * touching the surrounding element, its part, or its accessible name.\n *\n * Resolution per site is `per-component prop → provider icon → built-in glyph`: a named prop such\n * as `Dialog`'s `closeIcon` means \"this one call site\" and keeps winning, while the provider\n * replaces the built-in default for the whole product. Registering nothing renders exactly what the\n * library renders today, because the built-in glyph stays at its call site and is never part of\n * {@link cratisDefaults}.\n *\n * A name registered as `null` draws no glyph while the button, its part, and its accessible name\n * remain — the same meaning `closeIcon={null}` already has.\n */\nexport interface CratisComponentsIcons {\n /** Dismissal mark. Drawn by `Dialog`'s header close, `Toaster`'s dismiss, `ChatSidebar`, the `Chat` panel, and the PivotViewer detail panel. Defaults to `×`. */\n close?: ReactNode;\n /** Remove-this-value mark. Drawn by `TagGroup`'s tag remove, `Chip`'s remove control, and `CommandForm`'s chips field. Defaults to `×`. */\n remove?: ReactNode;\n /** Expand/collapse chevron on a closed-by-default surface. Drawn by `Dropdown`'s trigger and `ComboBox`'s trigger. Defaults to `⌄` (`▾` in `ComboBox`). */\n expand?: ReactNode;\n /** Ascending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▲`. */\n sortAscending?: ReactNode;\n /** Descending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▼`. */\n sortDescending?: ReactNode;\n /** Step-backwards mark. Drawn by `TablePaginator`'s previous page and the date picker's previous month. Defaults to `‹`. */\n previous?: ReactNode;\n /** Step-forwards mark. Drawn by `TablePaginator`'s next page and the date picker's next month. Defaults to `›`. */\n next?: ReactNode;\n /** Clear-the-current-value mark. Drawn by `Dropdown`'s clear-selection action and the PivotViewer filter panel's clear action. Defaults to `×`. */\n clear?: ReactNode;\n}\n\ninterface LegacyLocaleMessages {\n today?: string;\n clear?: string;\n aria?: {\n navigation?: string;\n firstPageLabel?: string;\n prevPageLabel?: string;\n nextPageLabel?: string;\n lastPageLabel?: string;\n };\n [message: string]: unknown;\n}\n\n/** Application routing callbacks used by Components links. */\nexport interface CratisComponentsRouter {\n /** Navigate to the original link destination for an ordinary same-origin activation. */\n navigate: (href: string) => void;\n /** Resolve a destination to the rendered href, for example to include a router basename. */\n useHref?: (href: string) => string;\n}\n\n/** Renderer-independent application configuration for Components. */\nexport interface CratisComponentsConfig {\n /** Optional client-side router. Omit to retain native or inherited routing behavior. */\n router?: CratisComponentsRouter;\n /** BCP 47 locale used by React Aria for dates, numbers, and interaction announcements. */\n locale?: string;\n /** Cratis-owned labels not supplied by the platform's internationalization APIs. */\n messages?: CratisComponentsMessages;\n /** Cratis-owned icon vocabulary replacing the built-in glyphs the library draws. */\n icons?: CratisComponentsIcons;\n /**\n * @deprecated Use {@link messages}; React Aria supplies its own locale data.\n */\n locales?: Record<string, LegacyLocaleMessages>;\n}\n\n/** Props for the application-root Components provider. */\nexport interface CratisComponentsProviderProps {\n /** Locale and Components-owned messages. */\n value?: CratisComponentsConfig;\n /** Mounts the global toaster with defaults or explicit options. */\n toaster?: boolean | ToasterProps;\n /**\n * Selects one stable presentation library. The broader generic manifest and ordered,\n * last-wins composition form remain experimental.\n */\n library?: unstable_UiLibrary | readonly unstable_UiLibrary[];\n /** Experimental profile-promise behavior. Defaults to strict. */\n libraryMode?: 'strict' | 'degrade';\n /** Terminal slot fallback behavior. Defaults to the built-in Core implementation. */\n rendererFallback?: 'core' | 'throw';\n /** Host environment for overlay portal containers. */\n overlayEnvironment?: CratisOverlayEnvironment;\n /**\n * Non-secret renderer setup attestations. Values are booleans so credentials and license\n * tokens never cross the Components provider boundary.\n */\n rendererSetup?: CratisRendererSetup;\n /** Application content. */\n children: ReactNode;\n}\n\n/**\n * Deep-merges consumer configuration over {@link cratisDefaults}.\n *\n * `icons` merges by name only. An icon value is an opaque node — often a React element — so it is\n * carried over by identity instead of being deep-merged into, while a partial map still leaves every\n * unregistered name to its built-in glyph.\n */\nexport const mergeCratisComponentsConfig = (\n value: CratisComponentsConfig | undefined,\n): CratisComponentsConfig => {\n const { icons, ...rest } = value ?? {};\n const merged = merge(cratisDefaults, rest) as CratisComponentsConfig;\n return icons ? { ...merged, icons: { ...cratisDefaults.icons, ...icons } } : merged;\n};\n\nconst withLegacyLocaleMessages = (\n config: CratisComponentsConfig,\n explicitMessages: CratisComponentsMessages | undefined,\n): CratisComponentsConfig => {\n const legacy = config.locale ? config.locales?.[config.locale] : undefined;\n if (!legacy) return config;\n return {\n ...config,\n messages: {\n ...config.messages,\n paginator: {\n ...config.messages?.paginator,\n navigation:\n explicitMessages?.paginator?.navigation ??\n legacy.aria?.navigation ??\n config.messages?.paginator?.navigation,\n first:\n explicitMessages?.paginator?.first ??\n legacy.aria?.firstPageLabel ??\n config.messages?.paginator?.first,\n previous:\n explicitMessages?.paginator?.previous ??\n legacy.aria?.prevPageLabel ??\n config.messages?.paginator?.previous,\n next:\n explicitMessages?.paginator?.next ??\n legacy.aria?.nextPageLabel ??\n config.messages?.paginator?.next,\n last:\n explicitMessages?.paginator?.last ??\n legacy.aria?.lastPageLabel ??\n config.messages?.paginator?.last,\n },\n datePicker: {\n ...config.messages?.datePicker,\n today:\n explicitMessages?.datePicker?.today ??\n legacy.today ??\n config.messages?.datePicker?.today,\n clear:\n explicitMessages?.datePicker?.clear ??\n legacy.clear ??\n config.messages?.datePicker?.clear,\n openCalendar:\n explicitMessages?.datePicker?.openCalendar ??\n config.messages?.datePicker?.openCalendar,\n previousMonth:\n explicitMessages?.datePicker?.previousMonth ??\n config.messages?.datePicker?.previousMonth,\n nextMonth:\n explicitMessages?.datePicker?.nextMonth ??\n config.messages?.datePicker?.nextMonth,\n },\n },\n };\n};\n\nconst validLocale = (locale: string | undefined) => {\n if (!locale) return 'en-US';\n try {\n return new Intl.Locale(locale).toString();\n } catch {\n return 'en-US';\n }\n};\n\n/** Application root for locale, labels, and the optional app-wide toaster. */\nexport const CratisComponentsProvider = ({\n value,\n toaster,\n library,\n libraryMode,\n rendererFallback,\n overlayEnvironment,\n rendererSetup,\n children,\n}: CratisComponentsProviderProps) => {\n const resolved = useMemo(\n () =>\n withLegacyLocaleMessages(mergeCratisComponentsConfig(value), value?.messages),\n [value],\n );\n\n const content = (\n <I18nProvider locale={validLocale(resolved.locale)}>\n {children}\n {toaster && <Toaster {...(typeof toaster === 'object' ? toaster : {})} />}\n </I18nProvider>\n );\n\n return (\n <RendererRoot\n library={library}\n libraryMode={libraryMode}\n rendererFallback={rendererFallback}\n overlayEnvironment={overlayEnvironment}\n rendererSetup={rendererSetup}\n >\n <CratisComponentsContext.Provider value={resolved}>\n {resolved.router ? (\n <RouterProvider navigate={resolved.router.navigate} useHref={resolved.router.useHref}>\n {content}\n </RouterProvider>\n ) : content}\n </CratisComponentsContext.Provider>\n </RendererRoot>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;AAcA,MAAM,YAAY,GAAG,qBAAqB;AA2RnC,MAAM,2BAA2B,GAAG,CACvC,KAAyC,KACjB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,EAAE,IAAI,CAA2B;IACpE,OAAO,KAAK,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAAM;AACvF;AAEA,MAAM,wBAAwB,GAAG,CAC7B,MAA8B,EAC9B,gBAAsD,KAC9B;IACxB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS;AAC1E,IAAA,IAAI,CAAC,MAAM;A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,EAAE,CAAC,EAAA,CAAI,CAAA,EAAA,CAC9D,CAClB;AAED,IAAA,QACIA,GAAA,CAAC,YAAY,EAAA,EACT,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,EAAA,QAAA,EAE5BA,GAAA,CAAC,uBAAuB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,QAAQ,EAAA,QAAA,EAC5C,QAAQ,CAAC,MAAM,IACZA,IAAC,cAAc,EAAA,EAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,YAC/E,OAAO,EAAA,CACK,IACjB,OAAO,EAAA,CACoB,EAAA,CACxB;AAEvB;;"}
@@ -6,6 +6,7 @@ import { Heading } from 'react-aria-components/Heading';
6
6
  import { UNSAFE_PortalProvider } from 'react-aria';
7
7
  import { unstable_useOverlayEnvironment } from '../renderer/RendererContext.js';
8
8
  import 'react-aria-components/I18nProvider';
9
+ import 'react-aria-components';
9
10
  import 'ts-deepmerge';
10
11
  import 'react-dom';
11
12
  import { useCratisComponentsConfig } from '../configuration/CratisComponentsContext.js';
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerInputImplementation.js","sources":["../../../Common/DatePickerInputImplementation.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport {\n Button,\n Calendar,\n CalendarCell,\n CalendarGrid,\n CalendarGridBody,\n CalendarGridHeader,\n CalendarHeaderCell,\n DateInput,\n DatePicker as AriaDatePicker,\n DateSegment,\n Group,\n Popover,\n type DateValue,\n} from 'react-aria-components/DatePicker';\nimport { Dialog } from 'react-aria-components/Dialog';\nimport { Heading } from 'react-aria-components/Heading';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { useCratisComponentsConfig } from './CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport { OVERLAY_OFFSET, zIndexAboveDialog } from '../renderer/dialogStack';\nimport { useNearestDialogZIndex } from '../renderer/DialogStackContext';\nimport { asReactAriaButtonProps } from './reactAriaProps';\nimport {\n fromDate,\n getLocalTimeZone,\n today,\n toCalendarDate,\n} from '@internationalized/date';\nimport type { DatePickerInputProps } from './DatePickerInput';\nimport { classNames } from '../ClassNames/classNames';\n\nconst asDateValue = (\n value: Date | null,\n showTime: boolean | undefined,\n): DateValue | null => {\n if (!value) return null;\n const zoned = fromDate(value, getLocalTimeZone());\n return showTime ? zoned : toCalendarDate(zoned);\n};\n\nconst asDate = (value: DateValue | null): Date | null =>\n value ? value.toDate(getLocalTimeZone()) : null;\n\n/**\n * An internationalized date or date-time picker with Cratis-owned markup parts.\n * The public boundary remains `Date | null`; React Aria's calendar values stay internal.\n */\nexport const DatePickerInputImplementation = ({\n value,\n onChange,\n onBlur,\n invalid,\n disabled,\n readOnly,\n id,\n showButtonBar,\n isNonModal = false,\n placeholder,\n showIcon = true,\n showTime,\n hourFormat,\n minDate,\n maxDate,\n className,\n style,\n pt,\n todayLabel,\n clearLabel,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n}: DatePickerInputProps) => {\n const [isPickerOpen, setIsPickerOpen] = useState(false);\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const nearestDialogZIndex = useNearestDialogZIndex();\n const resolvedPopoverZIndex =\n nearestDialogZIndex === null\n ? 'var(--cratis-z-index-overlay)'\n : zIndexAboveDialog(nearestDialogZIndex, OVERLAY_OFFSET);\n const { messages } = useCratisComponentsConfig();\n const datePickerMessages = messages?.datePicker;\n const icon = useCratisIcon();\n const resolvedTodayLabel = todayLabel ?? datePickerMessages?.today ?? 'Today';\n const resolvedClearLabel = clearLabel ?? datePickerMessages?.clear ?? 'Clear';\n const timeZone = getLocalTimeZone();\n const minValue = asDateValue(minDate ?? null, showTime) ?? undefined;\n const maxValue = asDateValue(maxDate ?? null, showTime) ?? undefined;\n const todayDate = today(timeZone).toDate(timeZone);\n // Compare the same granularity that the action emits. In date-time mode the Today action\n // retains its existing local-midnight value, which can legitimately fall before a same-day\n // minDate carrying a later time.\n const todayValue = asDateValue(todayDate, showTime)!;\n const isTodayOutOfBounds =\n (minValue !== undefined && todayValue.compare(minValue) < 0) ||\n (maxValue !== undefined && todayValue.compare(maxValue) > 0);\n const rootClassName = classNames(\n 'cratis-date-picker',\n pt?.root?.className,\n className,\n );\n const inputId = id ?? pt?.input?.id;\n const effectiveDisabled = disabled ?? pt?.input?.disabled ?? false;\n const effectiveReadOnly = readOnly ?? pt?.input?.readOnly ?? false;\n const effectiveInvalid = invalid ?? pt?.input?.['aria-invalid'] ?? false;\n const actionsDisabled = effectiveDisabled || effectiveReadOnly;\n const clearDisabled = actionsDisabled || pt?.clear?.disabled || false;\n const effectivePlaceholder = placeholder ?? pt?.input?.placeholder;\n const effectiveAriaLabel =\n ariaLabel ??\n pt?.input?.['aria-label'] ??\n effectivePlaceholder ??\n datePickerMessages?.label ??\n 'Date';\n const effectiveAriaLabelledby = ariaLabelledby ?? pt?.input?.['aria-labelledby'];\n const effectiveAriaDescribedby = ariaDescribedby ?? pt?.input?.['aria-describedby'];\n const inputPartAttributes = {\n ...pt?.input,\n id: undefined,\n className: undefined,\n style: undefined,\n disabled: undefined,\n readOnly: undefined,\n placeholder: undefined,\n 'aria-label': undefined,\n 'aria-labelledby': undefined,\n 'aria-describedby': undefined,\n 'aria-invalid': undefined,\n };\n\n return (\n <div\n {...pt?.root}\n className={rootClassName}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-open={isPickerOpen || undefined}\n data-selected={value !== null || undefined}\n onBlur={onBlur}\n >\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <AriaDatePicker\n value={asDateValue(value, showTime)}\n onChange={(next) => onChange(asDate(next), { source: 'user' })}\n isDisabled={effectiveDisabled}\n isReadOnly={effectiveReadOnly}\n isInvalid={effectiveInvalid}\n isOpen={isPickerOpen}\n onOpenChange={(nextIsOpen) => {\n if (!nextIsOpen || !effectiveReadOnly) setIsPickerOpen(nextIsOpen);\n }}\n minValue={minValue}\n maxValue={maxValue}\n granularity={showTime ? 'minute' : 'day'}\n hourCycle={\n hourFormat === '12' ? 12 : hourFormat === '24' ? 24 : undefined\n }\n aria-label={effectiveAriaLabel}\n aria-labelledby={effectiveAriaLabelledby}\n aria-describedby={effectiveAriaDescribedby}\n className='cratis-date-picker__picker'\n >\n {({ isOpen }) => (\n <>\n <Group\n {...pt?.group}\n id={inputId}\n aria-invalid={effectiveInvalid || undefined}\n className={classNames(\n 'cratis-date-picker__group',\n pt?.group?.className,\n )}\n data-cratis-part='group'\n data-empty={value === null || undefined}\n render={(groupProps) => (\n <div\n {...groupProps}\n data-open={isOpen || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={value !== null || undefined}\n />\n )}\n >\n <DateInput\n {...inputPartAttributes}\n className={classNames(\n 'cratis-date-picker__input',\n pt?.input?.className,\n )}\n style={pt?.input?.style}\n data-cratis-part='input'\n data-placeholder={effectivePlaceholder}\n render={(inputProps) => (\n <div\n {...inputProps}\n data-open={isOpen || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={value !== null || undefined}\n />\n )}\n >\n {(segment) => (\n <DateSegment\n {...pt?.segment}\n segment={segment}\n className={classNames(\n 'cratis-date-picker__segment',\n pt?.segment?.className,\n )}\n data-cratis-part='segment'\n render={(segmentProps) => (\n <span\n {...segmentProps}\n data-invalid={\n effectiveInvalid || undefined\n }\n data-disabled={\n effectiveDisabled || undefined\n }\n data-readonly={\n effectiveReadOnly || undefined\n }\n />\n )}\n />\n )}\n </DateInput>\n {value === null && effectivePlaceholder && (\n <span\n {...pt?.placeholder}\n className={classNames(\n 'cratis-date-picker__placeholder',\n pt?.placeholder?.className,\n )}\n data-cratis-part='placeholder'\n aria-hidden='true'\n >\n {effectivePlaceholder}\n </span>\n )}\n {showIcon && (\n <Button\n {...asReactAriaButtonProps(pt?.trigger)}\n isDisabled={\n effectiveDisabled || effectiveReadOnly\n }\n className={classNames(\n 'cratis-date-picker__trigger',\n pt?.trigger?.className,\n )}\n data-cratis-part='trigger'\n render={(triggerProps) => (\n <button\n {...triggerProps}\n data-open={isOpen || undefined}\n data-invalid={\n effectiveInvalid || undefined\n }\n data-disabled={\n effectiveDisabled ||\n effectiveReadOnly ||\n undefined\n }\n data-readonly={\n effectiveReadOnly || undefined\n }\n data-selected={\n value !== null || undefined\n }\n />\n )}\n aria-label={\n pt?.trigger?.['aria-label'] ??\n datePickerMessages?.openCalendar ??\n 'Open calendar'\n }\n >\n <span aria-hidden='true'>▦</span>\n </Button>\n )}\n </Group>\n <Popover\n {...pt?.popover}\n isNonModal={isNonModal}\n className={classNames(\n 'cratis-date-picker__popover',\n pt?.popover?.className,\n )}\n style={{\n zIndex: resolvedPopoverZIndex,\n ...pt?.popover?.style,\n }}\n data-cratis-part='popover'\n data-open\n placement='bottom start'\n >\n <Dialog\n {...pt?.dialog}\n className={classNames(\n 'cratis-date-picker__dialog',\n pt?.dialog?.className,\n )}\n data-cratis-part='dialog'\n data-open\n >\n <Calendar\n {...pt?.calendar}\n className={classNames(\n 'cratis-date-picker__calendar',\n pt?.calendar?.className,\n )}\n data-cratis-part='calendar'\n data-open\n >\n <header\n {...pt?.header}\n className={classNames(\n 'cratis-date-picker__header',\n pt?.header?.className,\n )}\n data-cratis-part='header'\n >\n <Button\n {...asReactAriaButtonProps(pt?.previous)}\n slot='previous'\n className={classNames(\n 'cratis-date-picker__nav',\n pt?.previous?.className,\n )}\n data-cratis-part='previous'\n aria-label={\n pt?.previous?.['aria-label'] ??\n datePickerMessages?.previousMonth ??\n 'Previous month'\n }\n >\n <span aria-hidden='true'>\n {icon('previous', '‹')}\n </span>\n </Button>\n <Heading\n {...pt?.heading}\n className={classNames(\n 'cratis-date-picker__heading',\n pt?.heading?.className,\n )}\n data-cratis-part='heading'\n />\n <Button\n {...asReactAriaButtonProps(pt?.next)}\n slot='next'\n className={classNames(\n 'cratis-date-picker__nav',\n pt?.next?.className,\n )}\n data-cratis-part='next'\n aria-label={\n pt?.next?.['aria-label'] ??\n datePickerMessages?.nextMonth ??\n 'Next month'\n }\n >\n <span aria-hidden='true'>\n {icon('next', '›')}\n </span>\n </Button>\n </header>\n <CalendarGrid\n {...pt?.grid}\n className={classNames(\n 'cratis-date-picker__grid',\n pt?.grid?.className,\n )}\n data-cratis-part='grid'\n >\n <CalendarGridHeader>\n {(day) => (\n <CalendarHeaderCell>\n {day}\n </CalendarHeaderCell>\n )}\n </CalendarGridHeader>\n <CalendarGridBody>\n {(date) => (\n <CalendarCell\n {...pt?.cell}\n date={date}\n className={classNames(\n 'cratis-date-picker__cell',\n pt?.cell?.className,\n )}\n data-cratis-part='cell'\n />\n )}\n </CalendarGridBody>\n </CalendarGrid>\n </Calendar>\n {showButtonBar && (\n <div\n {...pt?.buttonBar}\n className={classNames(\n 'cratis-date-picker__button-bar',\n pt?.buttonBar?.className,\n )}\n data-cratis-part='button-bar'\n >\n <button\n {...pt?.today}\n type='button'\n className={classNames(\n 'cratis-date-picker__action',\n pt?.today?.className,\n )}\n data-cratis-part='today'\n data-disabled={\n actionsDisabled || isTodayOutOfBounds || undefined\n }\n disabled={actionsDisabled || isTodayOutOfBounds}\n aria-disabled={\n actionsDisabled || isTodayOutOfBounds || undefined\n }\n onClick={(event) => {\n if (actionsDisabled || isTodayOutOfBounds) return;\n onChange(todayDate, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n >\n {resolvedTodayLabel}\n </button>\n <button\n {...pt?.clear}\n type='button'\n className={classNames(\n 'cratis-date-picker__action',\n pt?.clear?.className,\n )}\n data-cratis-part='clear'\n data-disabled={clearDisabled || undefined}\n disabled={clearDisabled}\n aria-disabled={clearDisabled || pt?.clear?.['aria-disabled'] || undefined}\n onClick={(event) => {\n if (clearDisabled) return;\n onChange(null, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n >\n {resolvedClearLabel}\n </button>\n </div>\n )}\n </Dialog>\n </Popover>\n </>\n )}\n </AriaDatePicker>\n </UNSAFE_PortalProvider>\n </div>\n );\n};\n"],"names":["_jsx","AriaDatePicker","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,MAAM,WAAW,GAAG,CAChB,KAAkB,EAClB,QAA6B,KACX;AAClB,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,IAAI;IACvB,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,CAAC;AACjD,IAAA,OAAO,QAAQ,GAAG,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC;AACnD,CAAC;AAED,MAAM,MAAM,GAAG,CAAC,KAAuB,KACnC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC,GAAG,IAAI;AAM5C,MAAM,6BAA6B,GAAG,CAAC,EAC1C,KAAK,EACL,QAAQ,EACR,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,EAAE,EACF,aAAa,EACb,UAAU,GAAG,KAAK,EAClB,WAAW,EACX,QAAQ,GAAG,IAAI,EACf,QAAQ,EACR,UAAU,EACV,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,EACL,EAAE,EACF,UAAU,EACV,UAAU,EACV,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,GAChB,KAAI;IACvB,MAAM,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,QAAQ,EAAE,aAAa,EAAA,eAAA,EACR,aAAa,IAAI,EAAE,EAAE,KAAK,GAAG,eAAe,CAAC,IAAI,SAAS,EACzE,OAAO,EAAE,CAAC,KAAK,KAAI;AACf,oDAAA,IAAI,aAAa;wDAAE;oDACnB,QAAQ,CAAC,IAAI,EAAE;AACX,wDAAA,MAAM,EAAE,MAAM;wDACd,WAAW,EAAE,KAAK,CAAC,WAAW;AACjC,qDAAA,CAAC;AACN,gDAAA,CAAC,EAAA,QAAA,EAEA,kBAAkB,EAAA,CACd,CAAA,EAAA,CACP,CACT,CAAA,EAAA,CACI,EAAA,CACH,CAAA,EAAA,CACX,CACN,EAAA,CACY,EAAA,CACG,EAAA,CACtB;AAEd;;"}
1
+ {"version":3,"file":"DatePickerInputImplementation.js","sources":["../../../Common/DatePickerInputImplementation.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport {\n Button,\n Calendar,\n CalendarCell,\n CalendarGrid,\n CalendarGridBody,\n CalendarGridHeader,\n CalendarHeaderCell,\n DateInput,\n DatePicker as AriaDatePicker,\n DateSegment,\n Group,\n Popover,\n type DateValue,\n} from 'react-aria-components/DatePicker';\nimport { Dialog } from 'react-aria-components/Dialog';\nimport { Heading } from 'react-aria-components/Heading';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { useCratisComponentsConfig } from './CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport { OVERLAY_OFFSET, zIndexAboveDialog } from '../renderer/dialogStack';\nimport { useNearestDialogZIndex } from '../renderer/DialogStackContext';\nimport { asReactAriaButtonProps } from './reactAriaProps';\nimport {\n fromDate,\n getLocalTimeZone,\n today,\n toCalendarDate,\n} from '@internationalized/date';\nimport type { DatePickerInputProps } from './DatePickerInput';\nimport { classNames } from '../ClassNames/classNames';\n\nconst asDateValue = (\n value: Date | null,\n showTime: boolean | undefined,\n): DateValue | null => {\n if (!value) return null;\n const zoned = fromDate(value, getLocalTimeZone());\n return showTime ? zoned : toCalendarDate(zoned);\n};\n\nconst asDate = (value: DateValue | null): Date | null =>\n value ? value.toDate(getLocalTimeZone()) : null;\n\n/**\n * An internationalized date or date-time picker with Cratis-owned markup parts.\n * The public boundary remains `Date | null`; React Aria's calendar values stay internal.\n */\nexport const DatePickerInputImplementation = ({\n value,\n onChange,\n onBlur,\n invalid,\n disabled,\n readOnly,\n id,\n showButtonBar,\n isNonModal = false,\n placeholder,\n showIcon = true,\n showTime,\n hourFormat,\n minDate,\n maxDate,\n className,\n style,\n pt,\n todayLabel,\n clearLabel,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n}: DatePickerInputProps) => {\n const [isPickerOpen, setIsPickerOpen] = useState(false);\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const nearestDialogZIndex = useNearestDialogZIndex();\n const resolvedPopoverZIndex =\n nearestDialogZIndex === null\n ? 'var(--cratis-z-index-overlay)'\n : zIndexAboveDialog(nearestDialogZIndex, OVERLAY_OFFSET);\n const { messages } = useCratisComponentsConfig();\n const datePickerMessages = messages?.datePicker;\n const icon = useCratisIcon();\n const resolvedTodayLabel = todayLabel ?? datePickerMessages?.today ?? 'Today';\n const resolvedClearLabel = clearLabel ?? datePickerMessages?.clear ?? 'Clear';\n const timeZone = getLocalTimeZone();\n const minValue = asDateValue(minDate ?? null, showTime) ?? undefined;\n const maxValue = asDateValue(maxDate ?? null, showTime) ?? undefined;\n const todayDate = today(timeZone).toDate(timeZone);\n // Compare the same granularity that the action emits. In date-time mode the Today action\n // retains its existing local-midnight value, which can legitimately fall before a same-day\n // minDate carrying a later time.\n const todayValue = asDateValue(todayDate, showTime)!;\n const isTodayOutOfBounds =\n (minValue !== undefined && todayValue.compare(minValue) < 0) ||\n (maxValue !== undefined && todayValue.compare(maxValue) > 0);\n const rootClassName = classNames(\n 'cratis-date-picker',\n pt?.root?.className,\n className,\n );\n const inputId = id ?? pt?.input?.id;\n const effectiveDisabled = disabled ?? pt?.input?.disabled ?? false;\n const effectiveReadOnly = readOnly ?? pt?.input?.readOnly ?? false;\n const effectiveInvalid = invalid ?? pt?.input?.['aria-invalid'] ?? false;\n const actionsDisabled = effectiveDisabled || effectiveReadOnly;\n const clearDisabled = actionsDisabled || pt?.clear?.disabled || false;\n const effectivePlaceholder = placeholder ?? pt?.input?.placeholder;\n const effectiveAriaLabel =\n ariaLabel ??\n pt?.input?.['aria-label'] ??\n effectivePlaceholder ??\n datePickerMessages?.label ??\n 'Date';\n const effectiveAriaLabelledby = ariaLabelledby ?? pt?.input?.['aria-labelledby'];\n const effectiveAriaDescribedby = ariaDescribedby ?? pt?.input?.['aria-describedby'];\n const inputPartAttributes = {\n ...pt?.input,\n id: undefined,\n className: undefined,\n style: undefined,\n disabled: undefined,\n readOnly: undefined,\n placeholder: undefined,\n 'aria-label': undefined,\n 'aria-labelledby': undefined,\n 'aria-describedby': undefined,\n 'aria-invalid': undefined,\n };\n\n return (\n <div\n {...pt?.root}\n className={rootClassName}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-open={isPickerOpen || undefined}\n data-selected={value !== null || undefined}\n onBlur={onBlur}\n >\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <AriaDatePicker\n value={asDateValue(value, showTime)}\n onChange={(next) => onChange(asDate(next), { source: 'user' })}\n isDisabled={effectiveDisabled}\n isReadOnly={effectiveReadOnly}\n isInvalid={effectiveInvalid}\n isOpen={isPickerOpen}\n onOpenChange={(nextIsOpen) => {\n if (!nextIsOpen || !effectiveReadOnly) setIsPickerOpen(nextIsOpen);\n }}\n minValue={minValue}\n maxValue={maxValue}\n granularity={showTime ? 'minute' : 'day'}\n hourCycle={\n hourFormat === '12' ? 12 : hourFormat === '24' ? 24 : undefined\n }\n aria-label={effectiveAriaLabel}\n aria-labelledby={effectiveAriaLabelledby}\n aria-describedby={effectiveAriaDescribedby}\n className='cratis-date-picker__picker'\n >\n {({ isOpen }) => (\n <>\n <Group\n {...pt?.group}\n id={inputId}\n aria-invalid={effectiveInvalid || undefined}\n className={classNames(\n 'cratis-date-picker__group',\n pt?.group?.className,\n )}\n data-cratis-part='group'\n data-empty={value === null || undefined}\n render={(groupProps) => (\n <div\n {...groupProps}\n data-open={isOpen || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={value !== null || undefined}\n />\n )}\n >\n <DateInput\n {...inputPartAttributes}\n className={classNames(\n 'cratis-date-picker__input',\n pt?.input?.className,\n )}\n style={pt?.input?.style}\n data-cratis-part='input'\n data-placeholder={effectivePlaceholder}\n render={(inputProps) => (\n <div\n {...inputProps}\n data-open={isOpen || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-disabled={effectiveDisabled || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={value !== null || undefined}\n />\n )}\n >\n {(segment) => (\n <DateSegment\n {...pt?.segment}\n segment={segment}\n className={classNames(\n 'cratis-date-picker__segment',\n pt?.segment?.className,\n )}\n data-cratis-part='segment'\n render={(segmentProps) => (\n <span\n {...segmentProps}\n data-invalid={\n effectiveInvalid || undefined\n }\n data-disabled={\n effectiveDisabled || undefined\n }\n data-readonly={\n effectiveReadOnly || undefined\n }\n />\n )}\n />\n )}\n </DateInput>\n {value === null && effectivePlaceholder && (\n <span\n {...pt?.placeholder}\n className={classNames(\n 'cratis-date-picker__placeholder',\n pt?.placeholder?.className,\n )}\n data-cratis-part='placeholder'\n aria-hidden='true'\n >\n {effectivePlaceholder}\n </span>\n )}\n {showIcon && (\n <Button\n {...asReactAriaButtonProps(pt?.trigger)}\n isDisabled={\n effectiveDisabled || effectiveReadOnly\n }\n className={classNames(\n 'cratis-date-picker__trigger',\n pt?.trigger?.className,\n )}\n data-cratis-part='trigger'\n render={(triggerProps) => (\n <button\n {...triggerProps}\n data-open={isOpen || undefined}\n data-invalid={\n effectiveInvalid || undefined\n }\n data-disabled={\n effectiveDisabled ||\n effectiveReadOnly ||\n undefined\n }\n data-readonly={\n effectiveReadOnly || undefined\n }\n data-selected={\n value !== null || undefined\n }\n />\n )}\n aria-label={\n pt?.trigger?.['aria-label'] ??\n datePickerMessages?.openCalendar ??\n 'Open calendar'\n }\n >\n <span aria-hidden='true'>▦</span>\n </Button>\n )}\n </Group>\n <Popover\n {...pt?.popover}\n isNonModal={isNonModal}\n className={classNames(\n 'cratis-date-picker__popover',\n pt?.popover?.className,\n )}\n style={{\n zIndex: resolvedPopoverZIndex,\n ...pt?.popover?.style,\n }}\n data-cratis-part='popover'\n data-open\n placement='bottom start'\n >\n <Dialog\n {...pt?.dialog}\n className={classNames(\n 'cratis-date-picker__dialog',\n pt?.dialog?.className,\n )}\n data-cratis-part='dialog'\n data-open\n >\n <Calendar\n {...pt?.calendar}\n className={classNames(\n 'cratis-date-picker__calendar',\n pt?.calendar?.className,\n )}\n data-cratis-part='calendar'\n data-open\n >\n <header\n {...pt?.header}\n className={classNames(\n 'cratis-date-picker__header',\n pt?.header?.className,\n )}\n data-cratis-part='header'\n >\n <Button\n {...asReactAriaButtonProps(pt?.previous)}\n slot='previous'\n className={classNames(\n 'cratis-date-picker__nav',\n pt?.previous?.className,\n )}\n data-cratis-part='previous'\n aria-label={\n pt?.previous?.['aria-label'] ??\n datePickerMessages?.previousMonth ??\n 'Previous month'\n }\n >\n <span aria-hidden='true'>\n {icon('previous', '‹')}\n </span>\n </Button>\n <Heading\n {...pt?.heading}\n className={classNames(\n 'cratis-date-picker__heading',\n pt?.heading?.className,\n )}\n data-cratis-part='heading'\n />\n <Button\n {...asReactAriaButtonProps(pt?.next)}\n slot='next'\n className={classNames(\n 'cratis-date-picker__nav',\n pt?.next?.className,\n )}\n data-cratis-part='next'\n aria-label={\n pt?.next?.['aria-label'] ??\n datePickerMessages?.nextMonth ??\n 'Next month'\n }\n >\n <span aria-hidden='true'>\n {icon('next', '›')}\n </span>\n </Button>\n </header>\n <CalendarGrid\n {...pt?.grid}\n className={classNames(\n 'cratis-date-picker__grid',\n pt?.grid?.className,\n )}\n data-cratis-part='grid'\n >\n <CalendarGridHeader>\n {(day) => (\n <CalendarHeaderCell>\n {day}\n </CalendarHeaderCell>\n )}\n </CalendarGridHeader>\n <CalendarGridBody>\n {(date) => (\n <CalendarCell\n {...pt?.cell}\n date={date}\n className={classNames(\n 'cratis-date-picker__cell',\n pt?.cell?.className,\n )}\n data-cratis-part='cell'\n />\n )}\n </CalendarGridBody>\n </CalendarGrid>\n </Calendar>\n {showButtonBar && (\n <div\n {...pt?.buttonBar}\n className={classNames(\n 'cratis-date-picker__button-bar',\n pt?.buttonBar?.className,\n )}\n data-cratis-part='button-bar'\n >\n <button\n {...pt?.today}\n type='button'\n className={classNames(\n 'cratis-date-picker__action',\n pt?.today?.className,\n )}\n data-cratis-part='today'\n data-disabled={\n actionsDisabled || isTodayOutOfBounds || undefined\n }\n disabled={actionsDisabled || isTodayOutOfBounds}\n aria-disabled={\n actionsDisabled || isTodayOutOfBounds || undefined\n }\n onClick={(event) => {\n if (actionsDisabled || isTodayOutOfBounds) return;\n onChange(todayDate, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n >\n {resolvedTodayLabel}\n </button>\n <button\n {...pt?.clear}\n type='button'\n className={classNames(\n 'cratis-date-picker__action',\n pt?.clear?.className,\n )}\n data-cratis-part='clear'\n data-disabled={clearDisabled || undefined}\n disabled={clearDisabled}\n aria-disabled={clearDisabled || pt?.clear?.['aria-disabled'] || undefined}\n onClick={(event) => {\n if (clearDisabled) return;\n onChange(null, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n >\n {resolvedClearLabel}\n </button>\n </div>\n )}\n </Dialog>\n </Popover>\n </>\n )}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T,CAAA,EAAA,CACI,EAAA,CACH,CAAA,EAAA,CACX,CACN,EAAA,CACY,EAAA,CACG,EAAA,CACtB;AAEd;;"}
@@ -6,6 +6,7 @@ import { Popover } from 'react-aria-components/Popover';
6
6
  import { Button as Button$1 } from '../Common/Button.js';
7
7
  import { DatePickerInput } from '../Common/DatePickerInput.js';
8
8
  import 'react-aria-components/I18nProvider';
9
+ import 'react-aria-components';
9
10
  import 'ts-deepmerge';
10
11
  import 'react-dom';
11
12
  import { useCratisComponentsConfig } from '../configuration/CratisComponentsContext.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnFilterMenu.js","sources":["../../../DataTables/ColumnFilterMenu.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type CSSProperties,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\nimport { Button as AriaButton } from 'react-aria-components/Button';\nimport { Dialog as AriaDialog, DialogTrigger } from 'react-aria-components/Dialog';\nimport { Popover } from 'react-aria-components/Popover';\nimport { Button, type ButtonParts } from '../Common/Button';\nimport { DatePickerInput } from '../Common/DatePickerInput';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { asReactAriaButtonProps } from '../Common/reactAriaProps';\nimport { Dropdown, type DropdownParts } from '../Dropdown/Dropdown';\nimport type { ChangeHandler } from '../types/ChangeHandler';\nimport {\n DataTableFilterMatchMode,\n type DataTableFilterConstraint,\n type DataTableFilterMatchMode as FilterMatchMode,\n} from './DataTableFilterMeta';\nimport { classNames } from '../ClassNames/classNames';\n\n/** Value editor used by a built-in column filter. */\nexport type ColumnFilterDataType = 'text' | 'numeric' | 'date' | 'boolean';\n\n/** One selectable value offered by a column filter that filters over a known set. */\nexport interface ColumnFilterOption {\n /** The text shown for this value in the filter menu. */\n label: string;\n /** The value written into the filter constraint when this option is picked. */\n value: unknown;\n}\n\n/** Localizable labels owned by the column filter popup. */\nexport interface ColumnFilterMenuLabels {\n /** Builds the filter-trigger accessible name from the effective field. */\n filterTriggerAriaLabel: (field: string) => string;\n /** Builds the value-control accessible name from the effective field. */\n valueAriaLabel: (field: string) => string;\n /** Accessible name for the match-mode selector. */\n matchModeAriaLabel: string;\n /** Localizes a match mode while retaining its default label as fallback input. */\n matchModeLabel: (mode: FilterMatchMode, defaultLabel: string) => string;\n /** Clear action label. */\n clear: string;\n /** Apply action label. */\n apply: string;\n /** Boolean true option label. */\n true: string;\n /** Boolean false option label. */\n false: string;\n}\n\ninterface ColumnFilterOverlayAttributes {\n id?: string;\n className?: string;\n style?: CSSProperties;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n}\n\n/** Stable Cratis-owned parts for a column filter popup. */\nexport interface ColumnFilterMenuParts {\n /** Header-cell filter trigger. */\n trigger?: Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'>;\n /** Portaled filter popover. */\n popover?: ColumnFilterOverlayAttributes;\n /** Semantic filter dialog/menu. */\n menu?: ColumnFilterOverlayAttributes;\n /** Match-mode Dropdown parts. */\n matchMode?: DropdownParts;\n /** Built-in value input, or root class/style for date/boolean controls. */\n input?: InputHTMLAttributes<HTMLInputElement>;\n /** Clear/apply action row. */\n actions?: HTMLAttributes<HTMLDivElement>;\n /** Clear Button parts. */\n clear?: ButtonParts;\n /** Apply Button parts. */\n apply?: ButtonParts;\n}\n\n/** Default English labels for the column filter popup. */\nexport const defaultColumnFilterMenuLabels: ColumnFilterMenuLabels = {\n filterTriggerAriaLabel: (field) => `Filter by ${field}`,\n valueAriaLabel: (field) => `Filter value for ${field}`,\n matchModeAriaLabel: 'Match mode',\n matchModeLabel: (_mode, defaultLabel) => defaultLabel,\n clear: 'Clear',\n apply: 'Apply',\n true: 'True',\n false: 'False',\n};\n\n/** State and actions supplied to a custom column filter value editor. */\nexport interface ColumnFilterElementOptions {\n /** Effective filtered field. */\n field: string;\n /** Current draft value. */\n value: unknown;\n /** Current draft match mode. */\n matchMode: FilterMatchMode;\n /** Updates the draft value and may describe how the custom editor produced it. */\n onChange: ChangeHandler<unknown>;\n /** Updates the draft match mode independently of the value. */\n onMatchModeChange: (matchMode: FilterMatchMode) => void;\n /** Applies the draft filter. */\n onApply: (event: SyntheticEvent) => void;\n /** Clears the field filter. */\n onClear: (event: SyntheticEvent) => void;\n}\n\n/** Custom renderer for a column filter's value editor. */\nexport type ColumnFilterElement = (options: ColumnFilterElementOptions) => ReactNode;\n\n/** Props for the Cratis-owned draft/apply column filter popup. */\nexport interface ColumnFilterMenuProps {\n /** Effective row field being filtered. */\n field: string;\n /** Built-in value editor and match-mode family. */\n dataType?: ColumnFilterDataType;\n /** Placeholder for the value editor. */\n placeholder?: string;\n /** Whether the match-mode selector is shown. */\n showMatchModes?: boolean;\n /** Custom value editor replacing the built-in control. */\n filterElement?: ColumnFilterElement;\n /** The values this column can be filtered by, offered as a list instead of a free-form input. */\n filterOptions?: ColumnFilterOption[];\n /** Partial localization overrides. */\n labels?: Partial<ColumnFilterMenuLabels>;\n /** Stable part attributes. */\n pt?: ColumnFilterMenuParts;\n /** Currently applied constraint. */\n constraint?: DataTableFilterConstraint;\n /** Applies one draft constraint. */\n onApply: (constraint: DataTableFilterConstraint) => void;\n /** Removes the field constraint. */\n onClear: () => void;\n}\n\ninterface MatchModeOption {\n label: string;\n value: FilterMatchMode;\n}\n\n// A column that filters over a known set of values has only two questions worth asking of it - is it\n// this one, or is it not - so the free-text and numeric comparisons are not offered for it.\nconst valueMatchModeOptions: MatchModeOption[] = [\n { label: 'Equals', value: DataTableFilterMatchMode.Equals },\n { label: 'Not equals', value: DataTableFilterMatchMode.NotEquals },\n];\n\nconst optionsFor = (dataType: ColumnFilterDataType): MatchModeOption[] => {\n switch (dataType) {\n case 'numeric':\n return [\n ['Equals', DataTableFilterMatchMode.Equals],\n ['Not equals', DataTableFilterMatchMode.NotEquals],\n ['Less than', DataTableFilterMatchMode.LessThan],\n ['Less than or equal', DataTableFilterMatchMode.LessThanOrEqual],\n ['Greater than', DataTableFilterMatchMode.GreaterThan],\n ['Greater than or equal', DataTableFilterMatchMode.GreaterThanOrEqual],\n ].map(([label, value]) => ({ label, value }) as MatchModeOption);\n case 'date':\n return [\n ['Date is', DataTableFilterMatchMode.DateIs],\n ['Date is not', DataTableFilterMatchMode.DateIsNot],\n ['Before', DataTableFilterMatchMode.DateBefore],\n ['After', DataTableFilterMatchMode.DateAfter],\n ].map(([label, value]) => ({ label, value }) as MatchModeOption);\n case 'boolean':\n return [{ label: 'Equals', value: DataTableFilterMatchMode.Equals }];\n default:\n return [\n ['Contains', DataTableFilterMatchMode.Contains],\n ['Starts with', DataTableFilterMatchMode.StartsWith],\n ['Ends with', DataTableFilterMatchMode.EndsWith],\n ['Equals', DataTableFilterMatchMode.Equals],\n ['Not contains', DataTableFilterMatchMode.NotContains],\n ['Not equals', DataTableFilterMatchMode.NotEquals],\n ].map(([label, value]) => ({ label, value }) as MatchModeOption);\n }\n};\n\nconst defaultModeFor = (dataType: ColumnFilterDataType): FilterMatchMode => {\n if (dataType === 'text') return DataTableFilterMatchMode.Contains;\n if (dataType === 'date') return DataTableFilterMatchMode.DateIs;\n return DataTableFilterMatchMode.Equals;\n};\n\n/** Cratis-owned column filter popup with draft/apply behavior. */\nexport const ColumnFilterMenu = ({\n field,\n dataType = 'text',\n placeholder,\n showMatchModes = true,\n filterElement,\n filterOptions,\n labels,\n pt,\n constraint,\n onApply,\n onClear,\n}: ColumnFilterMenuProps) => {\n const [draftValue, setDraftValue] = useState<unknown>(constraint?.value ?? null);\n const [draftMode, setDraftMode] = useState<FilterMatchMode>(\n constraint?.matchMode ?? defaultModeFor(dataType),\n );\n const [isOpen, setIsOpen] = useState(false);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const popoverRef = useRef<HTMLElement | null>(null);\n // Sticky on purpose: React detaches the popover's ref during the same commit that closes the\n // menu, before the effect cleanup below runs, so the last element we saw is the only handle we\n // still have on the popover that is going away.\n const capturePopover = useCallback((element: HTMLElement | null) => {\n if (element) popoverRef.current = element;\n }, []);\n\n useEffect(() => {\n setDraftValue(constraint?.value ?? null);\n setDraftMode(constraint?.matchMode ?? defaultModeFor(dataType));\n }, [constraint, dataType]);\n\n // Restore focus to the trigger on close, but only when the close actually dropped focus.\n //\n // React Aria's FocusScope already draws that distinction - at teardown it asks whether the\n // active element is still inside the dying scope or has already fallen to `document.body`, and\n // it leaves focus alone otherwise. Its weakness is only the timing: it defers the real restore\n // to a `requestAnimationFrame` that re-tests `activeElement === body`, which lands a frame after\n // focus has visibly left the trigger's neighborhood and silently does nothing if anything else\n // claims focus first. We keep its question and drop its delay: the same predicate is evaluated\n // synchronously in this cleanup, so the restore happens in the commit that closed the menu.\n //\n // \"Dropped\" has to be read at the moment this cleanup runs, while the popover is still exiting.\n // Focus is typically still on the popover's own content (its value input), which is about to be\n // removed - that is a drop in progress, not a destination. So a drop is: nothing focused, the\n // body, a node already detached from the document, or anything inside this menu's own popover.\n // Focus anywhere else is somewhere the user deliberately went, such as another column's filter\n // trigger, and must be left alone.\n useEffect(() => {\n if (!isOpen) return;\n return () => {\n const trigger = triggerRef.current;\n if (!trigger) return;\n const ownerDocument = trigger.ownerDocument;\n const focusedElement = ownerDocument.activeElement;\n const focusWasDropped =\n !focusedElement ||\n focusedElement === ownerDocument.body ||\n !focusedElement.isConnected ||\n popoverRef.current?.contains(focusedElement) === true;\n if (focusWasDropped) trigger.focus();\n };\n }, [isOpen]);\n\n const { messages } = useCratisComponentsConfig();\n const columnFilterMessages = messages?.columnFilter;\n const resolvedLabels: ColumnFilterMenuLabels = {\n filterTriggerAriaLabel:\n labels?.filterTriggerAriaLabel ??\n columnFilterMessages?.filterTriggerAriaLabel ??\n defaultColumnFilterMenuLabels.filterTriggerAriaLabel,\n valueAriaLabel:\n labels?.valueAriaLabel ??\n columnFilterMessages?.valueAriaLabel ??\n defaultColumnFilterMenuLabels.valueAriaLabel,\n matchModeAriaLabel:\n labels?.matchModeAriaLabel ??\n columnFilterMessages?.matchModeAriaLabel ??\n defaultColumnFilterMenuLabels.matchModeAriaLabel,\n matchModeLabel:\n labels?.matchModeLabel ??\n columnFilterMessages?.matchModeLabel ??\n defaultColumnFilterMenuLabels.matchModeLabel,\n clear: labels?.clear ?? columnFilterMessages?.clear ?? defaultColumnFilterMenuLabels.clear,\n apply: labels?.apply ?? columnFilterMessages?.apply ?? defaultColumnFilterMenuLabels.apply,\n true: labels?.true ?? columnFilterMessages?.true ?? defaultColumnFilterMenuLabels.true,\n false: labels?.false ?? columnFilterMessages?.false ?? defaultColumnFilterMenuLabels.false,\n };\n const modeOptions = (filterOptions ? valueMatchModeOptions : optionsFor(dataType)).map(\n (option) => ({\n ...option,\n label: resolvedLabels.matchModeLabel(option.value, option.label),\n }),\n );\n if (!modeOptions.some((option) => option.value === draftMode)) {\n modeOptions.push({\n label: resolvedLabels.matchModeLabel(draftMode, String(draftMode)),\n value: draftMode,\n });\n }\n\n const hasConstraint =\n constraint?.value !== null &&\n constraint?.value !== undefined &&\n constraint?.value !== '';\n\n const clear = (event?: SyntheticEvent) => {\n setDraftValue(null);\n onClear();\n event?.preventDefault();\n };\n const apply = (event?: SyntheticEvent) => {\n onApply({ value: draftValue, matchMode: draftMode });\n event?.preventDefault();\n };\n\n const valueInput = filterOptions\n ? (\n <Dropdown\n value={draftValue}\n options={filterOptions}\n optionLabel='label'\n optionValue='value'\n placeholder={placeholder}\n showClear\n onChange={(value) => setDraftValue(() => value)}\n aria-label={resolvedLabels.valueAriaLabel(field)}\n className={pt?.input?.className}\n style={pt?.input?.style}\n />\n )\n : filterElement\n ? filterElement({\n field,\n value: draftValue,\n matchMode: draftMode,\n onChange: (value) => setDraftValue(() => value),\n onMatchModeChange: (matchMode) => setDraftMode(matchMode),\n onApply: apply,\n onClear: clear,\n })\n : (() => {\n switch (dataType) {\n case 'numeric':\n return (\n <input\n {...pt?.input}\n type='number'\n aria-label={resolvedLabels.valueAriaLabel(field)}\n value={typeof draftValue === 'number' ? draftValue : ''}\n placeholder={placeholder}\n className={classNames(\n 'cratis-filter-menu__input',\n pt?.input?.className,\n )}\n onChange={(event) =>\n setDraftValue(\n event.target.value === ''\n ? null\n : event.target.valueAsNumber,\n )\n }\n />\n );\n case 'date':\n return (\n <DatePickerInput\n value={draftValue instanceof Date ? draftValue : null}\n onChange={(value) => setDraftValue(value)}\n showIcon\n aria-label={resolvedLabels.valueAriaLabel(field)}\n className={pt?.input?.className}\n style={pt?.input?.style}\n />\n );\n case 'boolean':\n return (\n <Dropdown\n value={draftValue}\n options={[\n { label: resolvedLabels.true, value: true },\n { label: resolvedLabels.false, value: false },\n ]}\n placeholder={placeholder}\n showClear\n onChange={(value) => setDraftValue(value)}\n aria-label={resolvedLabels.valueAriaLabel(field)}\n className={pt?.input?.className}\n style={pt?.input?.style}\n />\n );\n default:\n return (\n <input\n {...pt?.input}\n value={typeof draftValue === 'string' ? draftValue : ''}\n aria-label={resolvedLabels.valueAriaLabel(field)}\n placeholder={placeholder}\n className={classNames(\n 'cratis-filter-menu__input',\n pt?.input?.className,\n )}\n onChange={(event) => setDraftValue(event.target.value)}\n />\n );\n }\n })();\n\n return (\n <DialogTrigger isOpen={isOpen} onOpenChange={setIsOpen}>\n <AriaButton\n {...asReactAriaButtonProps(pt?.trigger)}\n ref={triggerRef}\n aria-label={resolvedLabels.filterTriggerAriaLabel(field)}\n className={classNames(\n 'cratis-filter-trigger',\n pt?.trigger?.className,\n )}\n data-active={hasConstraint || undefined}\n data-selected={hasConstraint || undefined}\n data-open={isOpen || undefined}\n data-cratis-part='filter-trigger'\n >\n <svg\n className='cratis-filter-trigger__icon'\n viewBox='0 0 16 16'\n fill='currentColor'\n aria-hidden='true'\n focusable='false'\n >\n <path d='M1.5 2.5A.5.5 0 0 1 2 2h12a.5.5 0 0 1 .38.82L10 8.1v4.52a.5.5 0 0 1-.24.43l-3 1.8A.5.5 0 0 1 6 14.42V8.1L1.62 2.82a.5.5 0 0 1-.12-.32Z' />\n </svg>\n </AriaButton>\n <Popover\n {...pt?.popover}\n ref={capturePopover}\n className={classNames(\n 'cratis-filter-popover',\n pt?.popover?.className,\n )}\n data-cratis-part='filter-popover'\n data-open={isOpen || undefined}\n placement='bottom end'\n >\n <AriaDialog\n {...pt?.menu}\n className={classNames('cratis-filter-menu', pt?.menu?.className)}\n data-cratis-part='filter-menu'\n data-open={isOpen || undefined}\n aria-label={resolvedLabels.filterTriggerAriaLabel(field)}\n >\n {showMatchModes && (\n <Dropdown\n value={draftMode}\n options={modeOptions}\n optionLabel='label'\n optionValue='value'\n onChange={(value) => setDraftMode(value)}\n aria-label={resolvedLabels.matchModeAriaLabel}\n pt={pt?.matchMode}\n />\n )}\n {valueInput}\n <div\n {...pt?.actions}\n className={classNames(\n 'cratis-filter-menu-actions',\n pt?.actions?.className,\n )}\n data-cratis-part='filter-actions'\n >\n <Button\n variant='outline'\n onClick={clear}\n label={resolvedLabels.clear}\n pt={pt?.clear}\n />\n <Button\n onClick={apply}\n label={resolvedLabels.apply}\n pt={pt?.apply}\n />\n </div>\n </AriaDialog>\n </Popover>\n </DialogTrigger>\n );\n};\n"],"names":["_jsx","_jsxs","AriaButton","AriaDialog","Button"],"mappings":";;;;;;;;;;;;;;;;;;AA6FO,MAAM,6BAA6B,GAA2B;IACjE,sBAAsB,EAAE,CAAC,KAAK,KAAK,CAAA,UAAA,EAAa,KAAK,CAAA,CAAE;IACvD,cAAc,EAAE,CAAC,KAAK,KAAK,CAAA,iBAAA,EAAoB,KAAK,CAAA,CAAE;AACtD,IAAA,kBAAkB,EAAE,YAAY;IAChC,cAAc,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,YAAY;AACrD,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,O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,QAAM,EAAA,EACH,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,KAAK,EACd,KAAK,EAAE,cAAc,CAAC,KAAK,EAC3B,EAAE,EAAE,EAAE,EAAE,KAAK,EAAA,CACf,EACFJ,GAAA,CAACI,QAAM,EAAA,EACH,OAAO,EAAE,KAAK,EACd,KAAK,EAAE,cAAc,CAAC,KAAK,EAC3B,EAAE,EAAE,EAAE,EAAE,KAAK,EAAA,CACf,CAAA,EAAA,CACA,CAAA,EAAA,CACG,EAAA,CACP,CAAA,EAAA,CACE;AAExB;;"}
1
+ {"version":3,"file":"ColumnFilterMenu.js","sources":["../../../DataTables/ColumnFilterMenu.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type CSSProperties,\n type HTMLAttributes,\n type InputHTMLAttributes,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\nimport { Button as AriaButton } from 'react-aria-components/Button';\nimport { Dialog as AriaDialog, DialogTrigger } from 'react-aria-components/Dialog';\nimport { Popover } from 'react-aria-components/Popover';\nimport { Button, type ButtonParts } from '../Common/Button';\nimport { DatePickerInput } from '../Common/DatePickerInput';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { asReactAriaButtonProps } from '../Common/reactAriaProps';\nimport { Dropdown, type DropdownParts } from '../Dropdown/Dropdown';\nimport type { ChangeHandler } from '../types/ChangeHandler';\nimport {\n DataTableFilterMatchMode,\n type DataTableFilterConstraint,\n type DataTableFilterMatchMode as FilterMatchMode,\n} from './DataTableFilterMeta';\nimport { classNames } from '../ClassNames/classNames';\n\n/** Value editor used by a built-in column filter. */\nexport type ColumnFilterDataType = 'text' | 'numeric' | 'date' | 'boolean';\n\n/** One selectable value offered by a column filter that filters over a known set. */\nexport interface ColumnFilterOption {\n /** The text shown for this value in the filter menu. */\n label: string;\n /** The value written into the filter constraint when this option is picked. */\n value: unknown;\n}\n\n/** Localizable labels owned by the column filter popup. */\nexport interface ColumnFilterMenuLabels {\n /** Builds the filter-trigger accessible name from the effective field. */\n filterTriggerAriaLabel: (field: string) => string;\n /** Builds the value-control accessible name from the effective field. */\n valueAriaLabel: (field: string) => string;\n /** Accessible name for the match-mode selector. */\n matchModeAriaLabel: string;\n /** Localizes a match mode while retaining its default label as fallback input. */\n matchModeLabel: (mode: FilterMatchMode, defaultLabel: string) => string;\n /** Clear action label. */\n clear: string;\n /** Apply action label. */\n apply: string;\n /** Boolean true option label. */\n true: string;\n /** Boolean false option label. */\n false: string;\n}\n\ninterface ColumnFilterOverlayAttributes {\n id?: string;\n className?: string;\n style?: CSSProperties;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n}\n\n/** Stable Cratis-owned parts for a column filter popup. */\nexport interface ColumnFilterMenuParts {\n /** Header-cell filter trigger. */\n trigger?: Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'>;\n /** Portaled filter popover. */\n popover?: ColumnFilterOverlayAttributes;\n /** Semantic filter dialog/menu. */\n menu?: ColumnFilterOverlayAttributes;\n /** Match-mode Dropdown parts. */\n matchMode?: DropdownParts;\n /** Built-in value input, or root class/style for date/boolean controls. */\n input?: InputHTMLAttributes<HTMLInputElement>;\n /** Clear/apply action row. */\n actions?: HTMLAttributes<HTMLDivElement>;\n /** Clear Button parts. */\n clear?: ButtonParts;\n /** Apply Button parts. */\n apply?: ButtonParts;\n}\n\n/** Default English labels for the column filter popup. */\nexport const defaultColumnFilterMenuLabels: ColumnFilterMenuLabels = {\n filterTriggerAriaLabel: (field) => `Filter by ${field}`,\n valueAriaLabel: (field) => `Filter value for ${field}`,\n matchModeAriaLabel: 'Match mode',\n matchModeLabel: (_mode, defaultLabel) => defaultLabel,\n clear: 'Clear',\n apply: 'Apply',\n true: 'True',\n false: 'False',\n};\n\n/** State and actions supplied to a custom column filter value editor. */\nexport interface ColumnFilterElementOptions {\n /** Effective filtered field. */\n field: string;\n /** Current draft value. */\n value: unknown;\n /** Current draft match mode. */\n matchMode: FilterMatchMode;\n /** Updates the draft value and may describe how the custom editor produced it. */\n onChange: ChangeHandler<unknown>;\n /** Updates the draft match mode independently of the value. */\n onMatchModeChange: (matchMode: FilterMatchMode) => void;\n /** Applies the draft filter. */\n onApply: (event: SyntheticEvent) => void;\n /** Clears the field filter. */\n onClear: (event: SyntheticEvent) => void;\n}\n\n/** Custom renderer for a column filter's value editor. */\nexport type ColumnFilterElement = (options: ColumnFilterElementOptions) => ReactNode;\n\n/** Props for the Cratis-owned draft/apply column filter popup. */\nexport interface ColumnFilterMenuProps {\n /** Effective row field being filtered. */\n field: string;\n /** Built-in value editor and match-mode family. */\n dataType?: ColumnFilterDataType;\n /** Placeholder for the value editor. */\n placeholder?: string;\n /** Whether the match-mode selector is shown. */\n showMatchModes?: boolean;\n /** Custom value editor replacing the built-in control. */\n filterElement?: ColumnFilterElement;\n /** The values this column can be filtered by, offered as a list instead of a free-form input. */\n filterOptions?: ColumnFilterOption[];\n /** Partial localization overrides. */\n labels?: Partial<ColumnFilterMenuLabels>;\n /** Stable part attributes. */\n pt?: ColumnFilterMenuParts;\n /** Currently applied constraint. */\n constraint?: DataTableFilterConstraint;\n /** Applies one draft constraint. */\n onApply: (constraint: DataTableFilterConstraint) => void;\n /** Removes the field constraint. */\n onClear: () => void;\n}\n\ninterface MatchModeOption {\n label: string;\n value: FilterMatchMode;\n}\n\n// A column that filters over a known set of values has only two questions worth asking of it - is it\n// this one, or is it not - so the free-text and numeric comparisons are not offered for it.\nconst valueMatchModeOptions: MatchModeOption[] = [\n { label: 'Equals', value: DataTableFilterMatchMode.Equals },\n { label: 'Not equals', value: DataTableFilterMatchMode.NotEquals },\n];\n\nconst optionsFor = (dataType: ColumnFilterDataType): MatchModeOption[] => {\n switch (dataType) {\n case 'numeric':\n return [\n ['Equals', DataTableFilterMatchMode.Equals],\n ['Not equals', DataTableFilterMatchMode.NotEquals],\n ['Less than', DataTableFilterMatchMode.LessThan],\n ['Less than or equal', DataTableFilterMatchMode.LessThanOrEqual],\n ['Greater than', DataTableFilterMatchMode.GreaterThan],\n ['Greater than or equal', DataTableFilterMatchMode.GreaterThanOrEqual],\n ].map(([label, value]) => ({ label, value }) as MatchModeOption);\n case 'date':\n return [\n ['Date is', DataTableFilterMatchMode.DateIs],\n ['Date is not', DataTableFilterMatchMode.DateIsNot],\n ['Before', DataTableFilterMatchMode.DateBefore],\n ['After', DataTableFilterMatchMode.DateAfter],\n ].map(([label, value]) => ({ label, value }) as MatchModeOption);\n case 'boolean':\n return [{ label: 'Equals', value: DataTableFilterMatchMode.Equals }];\n default:\n return [\n ['Contains', DataTableFilterMatchMode.Contains],\n ['Starts with', DataTableFilterMatchMode.StartsWith],\n ['Ends with', DataTableFilterMatchMode.EndsWith],\n ['Equals', DataTableFilterMatchMode.Equals],\n ['Not contains', DataTableFilterMatchMode.NotContains],\n ['Not equals', DataTableFilterMatchMode.NotEquals],\n ].map(([label, value]) => ({ label, value }) as MatchModeOption);\n }\n};\n\nconst defaultModeFor = (dataType: ColumnFilterDataType): FilterMatchMode => {\n if (dataType === 'text') return DataTableFilterMatchMode.Contains;\n if (dataType === 'date') return DataTableFilterMatchMode.DateIs;\n return DataTableFilterMatchMode.Equals;\n};\n\n/** Cratis-owned column filter popup with draft/apply behavior. */\nexport const ColumnFilterMenu = ({\n field,\n dataType = 'text',\n placeholder,\n showMatchModes = true,\n filterElement,\n filterOptions,\n labels,\n pt,\n constraint,\n onApply,\n onClear,\n}: ColumnFilterMenuProps) => {\n const [draftValue, setDraftValue] = useState<unknown>(constraint?.value ?? null);\n const [draftMode, setDraftMode] = useState<FilterMatchMode>(\n constraint?.matchMode ?? defaultModeFor(dataType),\n );\n const [isOpen, setIsOpen] = useState(false);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const popoverRef = useRef<HTMLElement | null>(null);\n // Sticky on purpose: React detaches the popover's ref during the same commit that closes the\n // menu, before the effect cleanup below runs, so the last element we saw is the only handle we\n // still have on the popover that is going away.\n const capturePopover = useCallback((element: HTMLElement | null) => {\n if (element) popoverRef.current = element;\n }, []);\n\n useEffect(() => {\n setDraftValue(constraint?.value ?? null);\n setDraftMode(constraint?.matchMode ?? defaultModeFor(dataType));\n }, [constraint, dataType]);\n\n // Restore focus to the trigger on close, but only when the close actually dropped focus.\n //\n // React Aria's FocusScope already draws that distinction - at teardown it asks whether the\n // active element is still inside the dying scope or has already fallen to `document.body`, and\n // it leaves focus alone otherwise. Its weakness is only the timing: it defers the real restore\n // to a `requestAnimationFrame` that re-tests `activeElement === body`, which lands a frame after\n // focus has visibly left the trigger's neighborhood and silently does nothing if anything else\n // claims focus first. We keep its question and drop its delay: the same predicate is evaluated\n // synchronously in this cleanup, so the restore happens in the commit that closed the menu.\n //\n // \"Dropped\" has to be read at the moment this cleanup runs, while the popover is still exiting.\n // Focus is typically still on the popover's own content (its value input), which is about to be\n // removed - that is a drop in progress, not a destination. So a drop is: nothing focused, the\n // body, a node already detached from the document, or anything inside this menu's own popover.\n // Focus anywhere else is somewhere the user deliberately went, such as another column's filter\n // trigger, and must be left alone.\n useEffect(() => {\n if (!isOpen) return;\n return () => {\n const trigger = triggerRef.current;\n if (!trigger) return;\n const ownerDocument = trigger.ownerDocument;\n const focusedElement = ownerDocument.activeElement;\n const focusWasDropped =\n !focusedElement ||\n focusedElement === ownerDocument.body ||\n !focusedElement.isConnected ||\n popoverRef.current?.contains(focusedElement) === true;\n if (focusWasDropped) trigger.focus();\n };\n }, [isOpen]);\n\n const { messages } = useCratisComponentsConfig();\n const columnFilterMessages = messages?.columnFilter;\n const resolvedLabels: ColumnFilterMenuLabels = {\n filterTriggerAriaLabel:\n labels?.filterTriggerAriaLabel ??\n columnFilterMessages?.filterTriggerAriaLabel ??\n defaultColumnFilterMenuLabels.filterTriggerAriaLabel,\n valueAriaLabel:\n labels?.valueAriaLabel ??\n columnFilterMessages?.valueAriaLabel ??\n defaultColumnFilterMenuLabels.valueAriaLabel,\n matchModeAriaLabel:\n labels?.matchModeAriaLabel ??\n columnFilterMessages?.matchModeAriaLabel ??\n defaultColumnFilterMenuLabels.matchModeAriaLabel,\n matchModeLabel:\n labels?.matchModeLabel ??\n columnFilterMessages?.matchModeLabel ??\n defaultColumnFilterMenuLabels.matchModeLabel,\n clear: labels?.clear ?? columnFilterMessages?.clear ?? defaultColumnFilterMenuLabels.clear,\n apply: labels?.apply ?? columnFilterMessages?.apply ?? defaultColumnFilterMenuLabels.apply,\n true: labels?.true ?? columnFilterMessages?.true ?? defaultColumnFilterMenuLabels.true,\n false: labels?.false ?? columnFilterMessages?.false ?? defaultColumnFilterMenuLabels.false,\n };\n const modeOptions = (filterOptions ? valueMatchModeOptions : optionsFor(dataType)).map(\n (option) => ({\n ...option,\n label: resolvedLabels.matchModeLabel(option.value, option.label),\n }),\n );\n if (!modeOptions.some((option) => option.value === draftMode)) {\n modeOptions.push({\n label: resolvedLabels.matchModeLabel(draftMode, String(draftMode)),\n value: draftMode,\n });\n }\n\n const hasConstraint =\n constraint?.value !== null &&\n constraint?.value !== undefined &&\n constraint?.value !== '';\n\n const clear = (event?: SyntheticEvent) => {\n setDraftValue(null);\n onClear();\n event?.preventDefault();\n };\n const apply = (event?: SyntheticEvent) => {\n onApply({ value: draftValue, matchMode: draftMode });\n event?.preventDefault();\n };\n\n const valueInput = filterOptions\n ? (\n <Dropdown\n value={draftValue}\n options={filterOptions}\n optionLabel='label'\n optionValue='value'\n placeholder={placeholder}\n showClear\n onChange={(value) => setDraftValue(() => value)}\n aria-label={resolvedLabels.valueAriaLabel(field)}\n className={pt?.input?.className}\n style={pt?.input?.style}\n />\n )\n : filterElement\n ? filterElement({\n field,\n value: draftValue,\n matchMode: draftMode,\n onChange: (value) => setDraftValue(() => value),\n onMatchModeChange: (matchMode) => setDraftMode(matchMode),\n onApply: apply,\n onClear: clear,\n })\n : (() => {\n switch (dataType) {\n case 'numeric':\n return (\n <input\n {...pt?.input}\n type='number'\n aria-label={resolvedLabels.valueAriaLabel(field)}\n value={typeof draftValue === 'number' ? draftValue : ''}\n placeholder={placeholder}\n className={classNames(\n 'cratis-filter-menu__input',\n pt?.input?.className,\n )}\n onChange={(event) =>\n setDraftValue(\n event.target.value === ''\n ? null\n : event.target.valueAsNumber,\n )\n }\n />\n );\n case 'date':\n return (\n <DatePickerInput\n value={draftValue instanceof Date ? draftValue : null}\n onChange={(value) => setDraftValue(value)}\n showIcon\n aria-label={resolvedLabels.valueAriaLabel(field)}\n className={pt?.input?.className}\n style={pt?.input?.style}\n />\n );\n case 'boolean':\n return (\n <Dropdown\n value={draftValue}\n options={[\n { label: resolvedLabels.true, value: true },\n { label: resolvedLabels.false, value: false },\n ]}\n placeholder={placeholder}\n showClear\n onChange={(value) => setDraftValue(value)}\n aria-label={resolvedLabels.valueAriaLabel(field)}\n className={pt?.input?.className}\n style={pt?.input?.style}\n />\n );\n default:\n return (\n <input\n {...pt?.input}\n value={typeof draftValue === 'string' ? draftValue : ''}\n aria-label={resolvedLabels.valueAriaLabel(field)}\n placeholder={placeholder}\n className={classNames(\n 'cratis-filter-menu__input',\n pt?.input?.className,\n )}\n onChange={(event) => setDraftValue(event.target.value)}\n />\n );\n }\n })();\n\n return (\n <DialogTrigger isOpen={isOpen} onOpenChange={setIsOpen}>\n <AriaButton\n {...asReactAriaButtonProps(pt?.trigger)}\n ref={triggerRef}\n aria-label={resolvedLabels.filterTriggerAriaLabel(field)}\n className={classNames(\n 'cratis-filter-trigger',\n pt?.trigger?.className,\n )}\n data-active={hasConstraint || undefined}\n data-selected={hasConstraint || undefined}\n data-open={isOpen || undefined}\n data-cratis-part='filter-trigger'\n >\n <svg\n className='cratis-filter-trigger__icon'\n viewBox='0 0 16 16'\n fill='currentColor'\n aria-hidden='true'\n focusable='false'\n >\n <path d='M1.5 2.5A.5.5 0 0 1 2 2h12a.5.5 0 0 1 .38.82L10 8.1v4.52a.5.5 0 0 1-.24.43l-3 1.8A.5.5 0 0 1 6 14.42V8.1L1.62 2.82a.5.5 0 0 1-.12-.32Z' />\n </svg>\n </AriaButton>\n <Popover\n {...pt?.popover}\n ref={capturePopover}\n className={classNames(\n 'cratis-filter-popover',\n pt?.popover?.className,\n )}\n data-cratis-part='filter-popover'\n data-open={isOpen || undefined}\n placement='bottom end'\n >\n <AriaDialog\n {...pt?.menu}\n className={classNames('cratis-filter-menu', pt?.menu?.className)}\n data-cratis-part='filter-menu'\n data-open={isOpen || undefined}\n aria-label={resolvedLabels.filterTriggerAriaLabel(field)}\n >\n {showMatchModes && (\n <Dropdown\n value={draftMode}\n options={modeOptions}\n optionLabel='label'\n optionValue='value'\n onChange={(value) => setDraftMode(value)}\n aria-label={resolvedLabels.matchModeAriaLabel}\n pt={pt?.matchMode}\n />\n )}\n {valueInput}\n <div\n {...pt?.actions}\n className={classNames(\n 'cratis-filter-menu-actions',\n pt?.actions?.className,\n )}\n data-cratis-part='filter-actions'\n >\n <Button\n variant='outline'\n onClick={clear}\n label={resolvedLabels.clear}\n pt={pt?.clear}\n />\n <Button\n onClick={apply}\n label={resolvedLabels.apply}\n pt={pt?.apply}\n />\n </div>\n </AriaDialog>\n </Popover>\n </DialogTrigger>\n );\n};\n"],"names":["_jsx","_jsxs","AriaButton","AriaDialog","Button"],"mappings":";;;;;;;;;;;;;;;;;;;AA6FO,MAAM,6BAA6B,GAA2B;IACjE,sBAAsB,EAAE,CAAC,KAAK,KAAK,CAAA,UAAA,EAAa,KAAK,CAAA,CAAE;IACvD,cAAc,EAAE,CAAC,KAAK,KAAK,CAAA,iBAAA,EAAoB,KAAK,CAAA,CAAE;AACtD,IAAA,kBAAkB,EAAE,YAAY;IAChC,cAAc,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,YAAY;AACrD,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,OAAO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AM,EAAA,EACH,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,KAAK,EACd,KAAK,EAAE,cAAc,CAAC,KAAK,EAC3B,EAAE,EAAE,EAAE,EAAE,KAAK,EAAA,CACf,EACFJ,GAAA,CAACI,QAAM,EAAA,EACH,OAAO,EAAE,KAAK,EACd,KAAK,EAAE,cAAc,CAAC,KAAK,EAC3B,EAAE,EAAE,EAAE,EAAE,KAAK,EAAA,CACf,CAAA,EAAA,CACA,CAAA,EAAA,CACG,EAAA,CACP,CAAA,EAAA,CACE;AAExB;;"}
@@ -2,6 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { Button } from '../Common/Button.js';
3
3
  import 'react';
4
4
  import 'react-aria-components/I18nProvider';
5
+ import 'react-aria-components';
5
6
  import 'ts-deepmerge';
6
7
  import 'react-dom';
7
8
  import { useCratisComponentsConfig } from '../configuration/CratisComponentsContext.js';
@@ -1 +1 @@
1
- {"version":3,"file":"TablePaginatorImplementation.js","sources":["../../../DataTables/TablePaginatorImplementation.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Button } from '../Common/Button';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport type { TablePaginatorProps } from './TablePaginator';\nimport { paginatorRange } from './paginatorRange';\nimport { TablePaginatorPages } from './TablePaginatorPages';\n\n/**\n * A minimal first/previous/next/last paginator. The\n * Cratis data tables drive paging through Arc's paging hook rather than the\n * table's internal pagination — so this renders the page controls wired to a\n * simple `onPageChange(pageIndex)` callback.\n */\nexport const TablePaginatorImplementation = ({\n page,\n pageCount,\n onPageChange,\n totalItems,\n pageSize,\n pageLinks = false,\n ariaLabels,\n className,\n pt,\n}: TablePaginatorProps) => {\n const { messages } = useCratisComponentsConfig();\n const paginatorMessages = messages?.paginator;\n const icon = useCratisIcon();\n const isFirst = page <= 0;\n const isLast = page >= pageCount - 1;\n const rangeReport = paginatorRange(\n page,\n pageSize,\n totalItems,\n ariaLabels?.range ?? paginatorMessages?.range,\n );\n const labels = {\n navigation:\n ariaLabels?.navigation ?? paginatorMessages?.navigation ?? 'Pagination',\n first: ariaLabels?.first ?? paginatorMessages?.first ?? 'First page',\n previous: ariaLabels?.previous ?? paginatorMessages?.previous ?? 'Previous page',\n next: ariaLabels?.next ?? paginatorMessages?.next ?? 'Next page',\n last: ariaLabels?.last ?? paginatorMessages?.last ?? 'Last page',\n page:\n ariaLabels?.page ??\n paginatorMessages?.page ??\n ((number: number) => `Page ${number}`),\n pages: ariaLabels?.pages ?? paginatorMessages?.pages ?? 'Pages',\n };\n\n return (\n <div\n {...pt?.root}\n role='navigation'\n aria-label={labels.navigation}\n data-cratis-part='root'\n className={['cratis-table-paginator', pt?.root?.className, className]\n .filter(Boolean)\n .join(' ')}\n >\n {rangeReport && (\n <span\n {...pt?.range}\n className={['cratis-table-paginator-range', pt?.range?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='range'\n >\n {rangeReport}\n </span>\n )}\n <Button\n variant='ghost'\n disabled={isFirst}\n onClick={() => onPageChange(0)}\n aria-label={labels.first}\n pt={pt?.first}\n >\n <span aria-hidden='true'>«</span>\n </Button>\n <Button\n variant='ghost'\n disabled={isFirst}\n onClick={() => onPageChange(page - 1)}\n aria-label={labels.previous}\n pt={pt?.previous}\n >\n <span aria-hidden='true'>{icon('previous', '‹')}</span>\n </Button>\n {pageLinks ? (\n <TablePaginatorPages\n page={page}\n pageCount={pageCount}\n pageLinks={pageLinks}\n onPageChange={onPageChange}\n pt={pt}\n pageLabel={labels.page}\n pagesLabel={labels.pages}\n />\n ) : (\n <span\n {...pt?.info}\n className={['cratis-table-paginator-info', pt?.info?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='info'\n >\n {page + 1} / {Math.max(pageCount, 1)}\n </span>\n )}\n <Button\n variant='ghost'\n disabled={isLast}\n onClick={() => onPageChange(page + 1)}\n aria-label={labels.next}\n pt={pt?.next}\n >\n <span aria-hidden='true'>{icon('next', '›')}</span>\n </Button>\n <Button\n variant='ghost'\n disabled={isLast}\n onClick={() => onPageChange(pageCount - 1)}\n aria-label={labels.last}\n pt={pt?.last}\n >\n <span aria-hidden='true'>»</span>\n </Button>\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;AAgBO,MAAM,4BAA4B,GAAG,CAAC,EACzC,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,UAAU,EACV,SAAS,EACT,EAAE,GACgB,KAAI;AACtB,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,yBAAyB,EAAE;AAChD,IAAA,MAAM,iBAAiB,GAAG,QAAQ,EAAE,SAAS;AAC7C,IAAA,MAAM,IAAI,GAAG,aAAa,EAAE;AAC5B,IAAA,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC;AACzB,IAAA,MAAM,MAAM,GAAG,IAAI,IAAI,SAAS,GAAG,CAAC;AACpC,IAAA,MAAM,WAAW,GAAG,cAAc,CAC9B,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,UAAU,EAAE,KAAK,IAAI,iBAAiB,EAAE,KAAK,CAChD;AACD,IAAA,MAAM,MAAM,GAAG;QACX,UAAU,EACN,UAAU,EAAE,UAAU,IAAI,iBAAiB,EAAE,UAAU,IAAI,YAAY;QAC3E,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,iBAAiB,EAAE,KAAK,IAAI,YAAY;QACpE,QAAQ,EAAE,UAAU,EAAE,QAAQ,IAAI,iBAAiB,EAAE,QAAQ,IAAI,eAAe;QAChF,IAAI,EAAE,UAAU,EAAE,IAAI,IAAI,iBAAiB,EAAE,IAAI,IAAI,WAAW;QAChE,IAAI,EAAE,UAAU,EAAE,IAAI,IAAI,iBAAiB,EAAE,IAAI,IAAI,WAAW;QAChE,IAAI,EACA,UAAU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C,SAAS,GAAG,CAAC,CAAC,EAAA,YAAA,EAC9B,MAAM,CAAC,IAAI,EACvB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAA,QAAA,EAEZA,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAkB,MAAM,EAAA,QAAA,EAAA,QAAA,EAAA,CAAS,EAAA,CAC5B,CAAA,EAAA,CACP;AAEd;;"}
1
+ {"version":3,"file":"TablePaginatorImplementation.js","sources":["../../../DataTables/TablePaginatorImplementation.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Button } from '../Common/Button';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport type { TablePaginatorProps } from './TablePaginator';\nimport { paginatorRange } from './paginatorRange';\nimport { TablePaginatorPages } from './TablePaginatorPages';\n\n/**\n * A minimal first/previous/next/last paginator. The\n * Cratis data tables drive paging through Arc's paging hook rather than the\n * table's internal pagination — so this renders the page controls wired to a\n * simple `onPageChange(pageIndex)` callback.\n */\nexport const TablePaginatorImplementation = ({\n page,\n pageCount,\n onPageChange,\n totalItems,\n pageSize,\n pageLinks = false,\n ariaLabels,\n className,\n pt,\n}: TablePaginatorProps) => {\n const { messages } = useCratisComponentsConfig();\n const paginatorMessages = messages?.paginator;\n const icon = useCratisIcon();\n const isFirst = page <= 0;\n const isLast = page >= pageCount - 1;\n const rangeReport = paginatorRange(\n page,\n pageSize,\n totalItems,\n ariaLabels?.range ?? paginatorMessages?.range,\n );\n const labels = {\n navigation:\n ariaLabels?.navigation ?? paginatorMessages?.navigation ?? 'Pagination',\n first: ariaLabels?.first ?? paginatorMessages?.first ?? 'First page',\n previous: ariaLabels?.previous ?? paginatorMessages?.previous ?? 'Previous page',\n next: ariaLabels?.next ?? paginatorMessages?.next ?? 'Next page',\n last: ariaLabels?.last ?? paginatorMessages?.last ?? 'Last page',\n page:\n ariaLabels?.page ??\n paginatorMessages?.page ??\n ((number: number) => `Page ${number}`),\n pages: ariaLabels?.pages ?? paginatorMessages?.pages ?? 'Pages',\n };\n\n return (\n <div\n {...pt?.root}\n role='navigation'\n aria-label={labels.navigation}\n data-cratis-part='root'\n className={['cratis-table-paginator', pt?.root?.className, className]\n .filter(Boolean)\n .join(' ')}\n >\n {rangeReport && (\n <span\n {...pt?.range}\n className={['cratis-table-paginator-range', pt?.range?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='range'\n >\n {rangeReport}\n </span>\n )}\n <Button\n variant='ghost'\n disabled={isFirst}\n onClick={() => onPageChange(0)}\n aria-label={labels.first}\n pt={pt?.first}\n >\n <span aria-hidden='true'>«</span>\n </Button>\n <Button\n variant='ghost'\n disabled={isFirst}\n onClick={() => onPageChange(page - 1)}\n aria-label={labels.previous}\n pt={pt?.previous}\n >\n <span aria-hidden='true'>{icon('previous', '‹')}</span>\n </Button>\n {pageLinks ? (\n <TablePaginatorPages\n page={page}\n pageCount={pageCount}\n pageLinks={pageLinks}\n onPageChange={onPageChange}\n pt={pt}\n pageLabel={labels.page}\n pagesLabel={labels.pages}\n />\n ) : (\n <span\n {...pt?.info}\n className={['cratis-table-paginator-info', pt?.info?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='info'\n >\n {page + 1} / {Math.max(pageCount, 1)}\n </span>\n )}\n <Button\n variant='ghost'\n disabled={isLast}\n onClick={() => onPageChange(page + 1)}\n aria-label={labels.next}\n pt={pt?.next}\n >\n <span aria-hidden='true'>{icon('next', '›')}</span>\n </Button>\n <Button\n variant='ghost'\n disabled={isLast}\n onClick={() => onPageChange(pageCount - 1)}\n aria-label={labels.last}\n pt={pt?.last}\n >\n <span aria-hidden='true'>»</span>\n </Button>\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;AAgBO,MAAM,4BAA4B,GAAG,CAAC,EACzC,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,UAAU,E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'react-aria-components';
4
5
  import 'ts-deepmerge';
5
6
  import 'react-dom';
6
7
  import { useCratisComponentsConfig } from '../configuration/CratisComponentsContext.js';
@@ -1 +1 @@
1
- {"version":3,"file":"useDataTableMessages.js","sources":["../../../DataTables/useDataTableMessages.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport type { DataTableMessageOverrides } from './DataTableMessageOverrides';\nimport type { DataTableMessages } from './DataTableMessages';\n\n/**\n * Resolves each table message from its prop, then the provider's `dataTable` messages, then the default.\n * @param overrides The messages passed as props.\n * @param isServerMode Whether the server, not the loaded page, applies search and filters.\n * @returns The messages to show.\n */\nexport const useDataTableMessages = (\n overrides: DataTableMessageOverrides,\n isServerMode = false,\n): DataTableMessages => {\n const { messages } = useCratisComponentsConfig();\n const dataTableMessages = messages?.dataTable;\n return {\n resolvedSelectionAriaLabel:\n overrides.selectionAriaLabel ?? dataTableMessages?.selectRow ?? 'Select row',\n resolvedSelectAllAriaLabel:\n overrides.selectAllAriaLabel ??\n dataTableMessages?.selectAllRows ??\n 'Select all rows',\n resolvedGlobalSearchPlaceholder:\n overrides.globalSearchPlaceholder ?? dataTableMessages?.search ?? 'Search…',\n resolvedGlobalSearchAriaLabel:\n overrides.globalSearchAriaLabel ??\n dataTableMessages?.searchAriaLabel ??\n 'Search table',\n resolvedLoadingMessage:\n overrides.loadingMessage ?? dataTableMessages?.loading ?? 'Loading…',\n resolvedFailureMessage:\n overrides.failureMessage ??\n dataTableMessages?.failed ??\n 'Could not load data.',\n resolvedUnauthorizedMessage:\n overrides.unauthorizedMessage ??\n dataTableMessages?.unauthorized ??\n 'You are not authorized to view this data.',\n resolvedFilteredEmptyMessage:\n overrides.filteredEmptyMessage ??\n (isServerMode\n ? (dataTableMessages?.filteredEmptyServer ?? 'No rows match the search.')\n : (dataTableMessages?.filteredEmpty ??\n 'No rows on this page match the search.')),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;AAaO,MAAM,oBAAoB,GAAG,CAChC,SAAoC,EACpC,YAAY,GAAG,KAAK,KACD;AACnB,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,yBAAyB,EAAE;AAChD,IAAA,MAAM,iBAAiB,GAAG,QAAQ,EAAE,SAAS;IAC7C,OAAO;QACH,0BAA0B,EACtB,SAAS,CAAC,kBAAkB,IAAI,iBAAiB,EAAE,SAAS,IAAI,YAAY;QAChF,0BAA0B,EACtB,SAAS,CAAC,kBAAkB;AAC5B,YAAA,iBAAiB,EAAE,aAAa;YAChC,iBAAiB;QACrB,+BAA+B,EAC3B,SAAS,CAAC,uBAAuB,IAAI,iBAAiB,EAAE,MAAM,IAAI,SAAS;QAC/E,6BAA6B,EACzB,SAAS,CAAC,qBAAqB;AAC/B,YAAA,iBAAiB,EAAE,eAAe;YAClC,cAAc;QAClB,sBAAsB,EAClB,SAAS,CAAC,cAAc,IAAI,iBAAiB,EAAE,OAAO,IAAI,UAAU;QACxE,sBAAsB,EAClB,SAAS,CAAC,cAAc;AACxB,YAAA,iBAAiB,EAAE,MAAM;YACzB,sBAAsB;QAC1B,2BAA2B,EACvB,SAAS,CAAC,mBAAmB;AAC7B,YAAA,iBAAiB,EAAE,YAAY;YAC/B,2CAA2C;QAC/C,4BAA4B,EACxB,SAAS,CAAC,oBAAoB;AAC9B,aAAC;AACG,mBAAG,iBAAiB,EAAE,mBAAmB,IAAI,2BAA2B;AACxE,mBAAG,iBAAiB,EAAE,aAAa;AACjC,oBAAA,wCAAwC,CAAC,CAAC;KACvD;AACL;;"}
1
+ {"version":3,"file":"useDataTableMessages.js","sources":["../../../DataTables/useDataTableMessages.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport type { DataTableMessageOverrides } from './DataTableMessageOverrides';\nimport type { DataTableMessages } from './DataTableMessages';\n\n/**\n * Resolves each table message from its prop, then the provider's `dataTable` messages, then the default.\n * @param overrides The messages passed as props.\n * @param isServerMode Whether the server, not the loaded page, applies search and filters.\n * @returns The messages to show.\n */\nexport const useDataTableMessages = (\n overrides: DataTableMessageOverrides,\n isServerMode = false,\n): DataTableMessages => {\n const { messages } = useCratisComponentsConfig();\n const dataTableMessages = messages?.dataTable;\n return {\n resolvedSelectionAriaLabel:\n overrides.selectionAriaLabel ?? dataTableMessages?.selectRow ?? 'Select row',\n resolvedSelectAllAriaLabel:\n overrides.selectAllAriaLabel ??\n dataTableMessages?.selectAllRows ??\n 'Select all rows',\n resolvedGlobalSearchPlaceholder:\n overrides.globalSearchPlaceholder ?? dataTableMessages?.search ?? 'Search…',\n resolvedGlobalSearchAriaLabel:\n overrides.globalSearchAriaLabel ??\n dataTableMessages?.searchAriaLabel ??\n 'Search table',\n resolvedLoadingMessage:\n overrides.loadingMessage ?? dataTableMessages?.loading ?? 'Loading…',\n resolvedFailureMessage:\n overrides.failureMessage ??\n dataTableMessages?.failed ??\n 'Could not load data.',\n resolvedUnauthorizedMessage:\n overrides.unauthorizedMessage ??\n dataTableMessages?.unauthorized ??\n 'You are not authorized to view this data.',\n resolvedFilteredEmptyMessage:\n overrides.filteredEmptyMessage ??\n (isServerMode\n ? (dataTableMessages?.filteredEmptyServer ?? 'No rows match the search.')\n : (dataTableMessages?.filteredEmpty ??\n 'No rows on this page match the search.')),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;AAaO,MAAM,oBAAoB,GAAG,CAChC,SAAoC,EACpC,YAAY,GAAG,KAAK,KACD;AACnB,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,yBAAyB,EAAE;AAChD,IAAA,MAAM,iBAAiB,GAAG,QAAQ,EAAE,SAAS;IAC7C,OAAO;QACH,0BAA0B,EACtB,SAAS,CAAC,kBAAkB,IAAI,iBAAiB,EAAE,SAAS,IAAI,YAAY;QAChF,0BAA0B,EACtB,SAAS,CAAC,kBAAkB;AAC5B,YAAA,iBAAiB,EAAE,aAAa;YAChC,iBAAiB;QACrB,+BAA+B,EAC3B,SAAS,CAAC,uBAAuB,IAAI,iBAAiB,EAAE,MAAM,IAAI,SAAS;QAC/E,6BAA6B,EACzB,SAAS,CAAC,qBAAqB;AAC/B,YAAA,iBAAiB,EAAE,eAAe;YAClC,cAAc;QAClB,sBAAsB,EAClB,SAAS,CAAC,cAAc,IAAI,iBAAiB,EAAE,OAAO,IAAI,UAAU;QACxE,sBAAsB,EAClB,SAAS,CAAC,cAAc;AACxB,YAAA,iBAAiB,EAAE,MAAM;YACzB,sBAAsB;QAC1B,2BAA2B,EACvB,SAAS,CAAC,mBAAmB;AAC7B,YAAA,iBAAiB,EAAE,YAAY;YAC/B,2CAA2C;QAC/C,4BAA4B,EACxB,SAAS,CAAC,oBAAoB;AAC9B,aAAC;AACG,mBAAG,iBAAiB,EAAE,mBAAmB,IAAI,2BAA2B;AACxE,mBAAG,iBAAiB,EAAE,aAAa;AACjC,oBAAA,wCAAwC,CAAC,CAAC;KACvD;AACL;;"}
@@ -8,6 +8,7 @@ import { unstable_useOverlayEnvironment } from '../renderer/RendererContext.js';
8
8
  import { DialogInitialFocus } from './DialogInitialFocus.js';
9
9
  import { resolveDialogDismissal } from './resolveDialogDismissal.js';
10
10
  import 'react-aria-components/I18nProvider';
11
+ import 'react-aria-components';
11
12
  import 'ts-deepmerge';
12
13
  import 'react-dom';
13
14
  import { useCratisComponentsConfig } from '../configuration/CratisComponentsContext.js';