@cratis/scene.primereact 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/button/PrimeButton.js.map +1 -1
- package/dist/cjs/button/PrimeButtonGroup.js.map +1 -1
- package/dist/cjs/button/PrimeSpeedDial.js.map +1 -1
- package/dist/cjs/button/PrimeSplitButton.js.map +1 -1
- package/dist/cjs/button/SplitButton.js.map +1 -1
- package/dist/cjs/data/Column.js.map +1 -1
- package/dist/cjs/data/Pagination.js.map +1 -1
- package/dist/cjs/data/PrimeColumn.js.map +1 -1
- package/dist/cjs/data/PrimeDataTable.js.map +1 -1
- package/dist/cjs/data/PrimeDataView.js.map +1 -1
- package/dist/cjs/data/PrimeOrderList.js.map +1 -1
- package/dist/cjs/data/PrimeOrganizationChart.js.map +1 -1
- package/dist/cjs/data/PrimePaginator.js.map +1 -1
- package/dist/cjs/data/PrimePickList.js.map +1 -1
- package/dist/cjs/data/PrimeTimeline.js.map +1 -1
- package/dist/cjs/data/PrimeTree.js.map +1 -1
- package/dist/cjs/data/columnDefinitions.js.map +1 -1
- package/dist/cjs/data/primeTreeNodes.js.map +1 -1
- package/dist/cjs/data/selectOptions.js.map +1 -1
- package/dist/cjs/form/PrimeAutoComplete.js.map +1 -1
- package/dist/cjs/form/PrimeCalendar.js.map +1 -1
- package/dist/cjs/form/PrimeCheckbox.js.map +1 -1
- package/dist/cjs/form/PrimeChips.js.map +1 -1
- package/dist/cjs/form/PrimeColorPicker.js.map +1 -1
- package/dist/cjs/form/PrimeDropdown.js.map +1 -1
- package/dist/cjs/form/PrimeFloatLabel.js.map +1 -1
- package/dist/cjs/form/PrimeIconField.js.map +1 -1
- package/dist/cjs/form/PrimeInputNumber.js.map +1 -1
- package/dist/cjs/form/PrimeInputText.js.map +1 -1
- package/dist/cjs/form/PrimeInputTextarea.js.map +1 -1
- package/dist/cjs/form/PrimeKnob.js.map +1 -1
- package/dist/cjs/form/PrimeListBox.js.map +1 -1
- package/dist/cjs/form/PrimeMultiSelect.js.map +1 -1
- package/dist/cjs/form/PrimePassword.js.map +1 -1
- package/dist/cjs/form/PrimeRadioButton.js.map +1 -1
- package/dist/cjs/form/PrimeRating.js.map +1 -1
- package/dist/cjs/form/PrimeSelectButton.js.map +1 -1
- package/dist/cjs/form/PrimeSlider.js.map +1 -1
- package/dist/cjs/form/PrimeToggleSwitch.js.map +1 -1
- package/dist/cjs/form/PrimeTreeSelect.js.map +1 -1
- package/dist/cjs/form/TreeSelect.js.map +1 -1
- package/dist/cjs/media/Image.js.map +1 -1
- package/dist/cjs/media/PrimeCarousel.js.map +1 -1
- package/dist/cjs/media/PrimeGalleria.js.map +1 -1
- package/dist/cjs/media/PrimeImage.js.map +1 -1
- package/dist/cjs/menu/Dock.js.map +1 -1
- package/dist/cjs/menu/DockPosition.js.map +1 -1
- package/dist/cjs/menu/MegaMenu.js.map +1 -1
- package/dist/cjs/menu/MenuItemAction.js.map +1 -1
- package/dist/cjs/menu/MenuItemContent.js.map +1 -1
- package/dist/cjs/menu/Menubar.js.map +1 -1
- package/dist/cjs/menu/PanelMenu.js.map +1 -1
- package/dist/cjs/menu/PrimeBreadcrumb.js.map +1 -1
- package/dist/cjs/menu/PrimeContextMenu.js.map +1 -1
- package/dist/cjs/menu/PrimeDock.js.map +1 -1
- package/dist/cjs/menu/PrimeMegaMenu.js.map +1 -1
- package/dist/cjs/menu/PrimeMenu.js.map +1 -1
- package/dist/cjs/menu/PrimeMenubar.js.map +1 -1
- package/dist/cjs/menu/PrimePanelMenu.js.map +1 -1
- package/dist/cjs/menu/PrimeSteps.js.map +1 -1
- package/dist/cjs/menu/PrimeTabMenu.js.map +1 -1
- package/dist/cjs/menu/PrimeTieredMenu.js.map +1 -1
- package/dist/cjs/menu/Steps.js.map +1 -1
- package/dist/cjs/menu/TabMenu.js.map +1 -1
- package/dist/cjs/menu/TieredMenu.js.map +1 -1
- package/dist/cjs/menuItems.js.map +1 -1
- package/dist/cjs/messages/PrimeInlineMessage.js.map +1 -1
- package/dist/cjs/messages/PrimeMessage.js.map +1 -1
- package/dist/cjs/messages/PrimeToast.js.map +1 -1
- package/dist/cjs/misc/BlockUI.js.map +1 -1
- package/dist/cjs/misc/PrimeAvatar.js.map +1 -1
- package/dist/cjs/misc/PrimeBadge.js.map +1 -1
- package/dist/cjs/misc/PrimeBlockUI.js.map +1 -1
- package/dist/cjs/misc/PrimeChip.js.map +1 -1
- package/dist/cjs/misc/PrimeInplace.js.map +1 -1
- package/dist/cjs/misc/PrimeProgressBar.js.map +1 -1
- package/dist/cjs/misc/PrimeProgressSpinner.js.map +1 -1
- package/dist/cjs/misc/PrimeScrollTop.js.map +1 -1
- package/dist/cjs/misc/PrimeSkeleton.js.map +1 -1
- package/dist/cjs/misc/PrimeTag.js.map +1 -1
- package/dist/cjs/misc/PrimeTerminal.js.map +1 -1
- package/dist/cjs/misc/ScrollTop.js.map +1 -1
- package/dist/cjs/overlay/ConfirmDialog.js.map +1 -1
- package/dist/cjs/overlay/PrimeConfirmDialog.js.map +1 -1
- package/dist/cjs/overlay/PrimeDialog.js.map +1 -1
- package/dist/cjs/overlay/PrimeOverlayPanel.js.map +1 -1
- package/dist/cjs/overlay/PrimeSidebar.js.map +1 -1
- package/dist/cjs/overlay/PrimeTooltip.js.map +1 -1
- package/dist/cjs/panel/PrimeAccordion.js.map +1 -1
- package/dist/cjs/panel/PrimeCard.js.map +1 -1
- package/dist/cjs/panel/PrimeDivider.js.map +1 -1
- package/dist/cjs/panel/PrimeFieldset.js.map +1 -1
- package/dist/cjs/panel/PrimePanel.js.map +1 -1
- package/dist/cjs/panel/PrimeScrollPanel.js.map +1 -1
- package/dist/cjs/panel/PrimeSplitter.js.map +1 -1
- package/dist/cjs/panel/PrimeStepper.js.map +1 -1
- package/dist/cjs/panel/PrimeTabView.js.map +1 -1
- package/dist/cjs/panel/PrimeToolbar.js.map +1 -1
- package/dist/cjs/primeReactComponents.js.map +1 -1
- package/dist/cjs/primeReactPackage.js.map +1 -1
- package/dist/cjs/properties.js.map +1 -1
- package/dist/cjs/screen/PrimeAction.js.map +1 -1
- package/dist/cjs/screen/PrimeField.js.map +1 -1
- package/dist/cjs/screen/PrimeSection.js.map +1 -1
- package/dist/cjs/screen/PrimeSummary.js.map +1 -1
- package/dist/cjs/screen/PrimeText.js.map +1 -1
- package/dist/cjs/screen/PrimeTitle.js.map +1 -1
- package/dist/cjs/theme/PrimeReactThemeFamily.js.map +1 -1
- package/dist/cjs/theme/primeReactThemePreset.js.map +1 -1
- package/dist/cjs/theme/primeReactThemes.js.map +1 -1
- package/dist/cjs/theme/themePresets.js.map +1 -1
- package/dist/cjs/theme/usePrimeReactTheme.js.map +1 -1
- package/dist/cjs/treeNodes.js.map +1 -1
- package/dist/esm/button/PrimeButton.js.map +1 -1
- package/dist/esm/button/PrimeButtonGroup.js.map +1 -1
- package/dist/esm/button/PrimeSpeedDial.js.map +1 -1
- package/dist/esm/button/PrimeSplitButton.js.map +1 -1
- package/dist/esm/button/SplitButton.js.map +1 -1
- package/dist/esm/data/Column.js.map +1 -1
- package/dist/esm/data/Pagination.js.map +1 -1
- package/dist/esm/data/PrimeColumn.js.map +1 -1
- package/dist/esm/data/PrimeDataTable.js.map +1 -1
- package/dist/esm/data/PrimeDataView.js.map +1 -1
- package/dist/esm/data/PrimeOrderList.js.map +1 -1
- package/dist/esm/data/PrimeOrganizationChart.js.map +1 -1
- package/dist/esm/data/PrimePaginator.js.map +1 -1
- package/dist/esm/data/PrimePickList.js.map +1 -1
- package/dist/esm/data/PrimeTimeline.js.map +1 -1
- package/dist/esm/data/PrimeTree.js.map +1 -1
- package/dist/esm/data/columnDefinitions.js.map +1 -1
- package/dist/esm/data/primeTreeNodes.js.map +1 -1
- package/dist/esm/data/selectOptions.js.map +1 -1
- package/dist/esm/form/PrimeAutoComplete.js.map +1 -1
- package/dist/esm/form/PrimeCalendar.js.map +1 -1
- package/dist/esm/form/PrimeCheckbox.js.map +1 -1
- package/dist/esm/form/PrimeChips.js.map +1 -1
- package/dist/esm/form/PrimeColorPicker.js.map +1 -1
- package/dist/esm/form/PrimeDropdown.js.map +1 -1
- package/dist/esm/form/PrimeFloatLabel.js.map +1 -1
- package/dist/esm/form/PrimeIconField.js.map +1 -1
- package/dist/esm/form/PrimeInputNumber.js.map +1 -1
- package/dist/esm/form/PrimeInputText.js.map +1 -1
- package/dist/esm/form/PrimeInputTextarea.js.map +1 -1
- package/dist/esm/form/PrimeKnob.js.map +1 -1
- package/dist/esm/form/PrimeListBox.js.map +1 -1
- package/dist/esm/form/PrimeMultiSelect.js.map +1 -1
- package/dist/esm/form/PrimePassword.js.map +1 -1
- package/dist/esm/form/PrimeRadioButton.js.map +1 -1
- package/dist/esm/form/PrimeRating.js.map +1 -1
- package/dist/esm/form/PrimeSelectButton.js.map +1 -1
- package/dist/esm/form/PrimeSlider.js.map +1 -1
- package/dist/esm/form/PrimeToggleSwitch.js.map +1 -1
- package/dist/esm/form/PrimeTreeSelect.js.map +1 -1
- package/dist/esm/form/TreeSelect.js.map +1 -1
- package/dist/esm/media/Image.js.map +1 -1
- package/dist/esm/media/PrimeCarousel.js.map +1 -1
- package/dist/esm/media/PrimeGalleria.js.map +1 -1
- package/dist/esm/media/PrimeImage.js.map +1 -1
- package/dist/esm/menu/Dock.js.map +1 -1
- package/dist/esm/menu/DockPosition.js.map +1 -1
- package/dist/esm/menu/MegaMenu.js.map +1 -1
- package/dist/esm/menu/MenuItemAction.js.map +1 -1
- package/dist/esm/menu/MenuItemContent.js.map +1 -1
- package/dist/esm/menu/Menubar.js.map +1 -1
- package/dist/esm/menu/PanelMenu.js.map +1 -1
- package/dist/esm/menu/PrimeBreadcrumb.js.map +1 -1
- package/dist/esm/menu/PrimeContextMenu.js.map +1 -1
- package/dist/esm/menu/PrimeDock.js.map +1 -1
- package/dist/esm/menu/PrimeMegaMenu.js.map +1 -1
- package/dist/esm/menu/PrimeMenu.js.map +1 -1
- package/dist/esm/menu/PrimeMenubar.js.map +1 -1
- package/dist/esm/menu/PrimePanelMenu.js.map +1 -1
- package/dist/esm/menu/PrimeSteps.js.map +1 -1
- package/dist/esm/menu/PrimeTabMenu.js.map +1 -1
- package/dist/esm/menu/PrimeTieredMenu.js.map +1 -1
- package/dist/esm/menu/Steps.js.map +1 -1
- package/dist/esm/menu/TabMenu.js.map +1 -1
- package/dist/esm/menu/TieredMenu.js.map +1 -1
- package/dist/esm/menuItems.js.map +1 -1
- package/dist/esm/messages/PrimeInlineMessage.js.map +1 -1
- package/dist/esm/messages/PrimeMessage.js.map +1 -1
- package/dist/esm/messages/PrimeToast.js.map +1 -1
- package/dist/esm/misc/BlockUI.js.map +1 -1
- package/dist/esm/misc/PrimeAvatar.js.map +1 -1
- package/dist/esm/misc/PrimeBadge.js.map +1 -1
- package/dist/esm/misc/PrimeBlockUI.js.map +1 -1
- package/dist/esm/misc/PrimeChip.js.map +1 -1
- package/dist/esm/misc/PrimeInplace.js.map +1 -1
- package/dist/esm/misc/PrimeProgressBar.js.map +1 -1
- package/dist/esm/misc/PrimeProgressSpinner.js.map +1 -1
- package/dist/esm/misc/PrimeScrollTop.js.map +1 -1
- package/dist/esm/misc/PrimeSkeleton.js.map +1 -1
- package/dist/esm/misc/PrimeTag.js.map +1 -1
- package/dist/esm/misc/PrimeTerminal.js.map +1 -1
- package/dist/esm/misc/ScrollTop.js.map +1 -1
- package/dist/esm/overlay/ConfirmDialog.js.map +1 -1
- package/dist/esm/overlay/PrimeConfirmDialog.js.map +1 -1
- package/dist/esm/overlay/PrimeDialog.js.map +1 -1
- package/dist/esm/overlay/PrimeOverlayPanel.js.map +1 -1
- package/dist/esm/overlay/PrimeSidebar.js.map +1 -1
- package/dist/esm/overlay/PrimeTooltip.js.map +1 -1
- package/dist/esm/panel/PrimeAccordion.js.map +1 -1
- package/dist/esm/panel/PrimeCard.js.map +1 -1
- package/dist/esm/panel/PrimeDivider.js.map +1 -1
- package/dist/esm/panel/PrimeFieldset.js.map +1 -1
- package/dist/esm/panel/PrimePanel.js.map +1 -1
- package/dist/esm/panel/PrimeScrollPanel.js.map +1 -1
- package/dist/esm/panel/PrimeSplitter.js.map +1 -1
- package/dist/esm/panel/PrimeStepper.js.map +1 -1
- package/dist/esm/panel/PrimeTabView.js.map +1 -1
- package/dist/esm/panel/PrimeToolbar.js.map +1 -1
- package/dist/esm/primeReactComponents.js.map +1 -1
- package/dist/esm/primeReactPackage.js.map +1 -1
- package/dist/esm/properties.js.map +1 -1
- package/dist/esm/screen/PrimeAction.js.map +1 -1
- package/dist/esm/screen/PrimeField.js.map +1 -1
- package/dist/esm/screen/PrimeSection.js.map +1 -1
- package/dist/esm/screen/PrimeSummary.js.map +1 -1
- package/dist/esm/screen/PrimeText.js.map +1 -1
- package/dist/esm/screen/PrimeTitle.js.map +1 -1
- package/dist/esm/theme/PrimeReactThemeFamily.js.map +1 -1
- package/dist/esm/theme/primeReactThemePreset.js.map +1 -1
- package/dist/esm/theme/primeReactThemes.js.map +1 -1
- package/dist/esm/theme/themePresets.js.map +1 -1
- package/dist/esm/theme/usePrimeReactTheme.js.map +1 -1
- package/dist/esm/treeNodes.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimePassword.js","sources":["../../../form/PrimePassword.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 { InputPassword } from 'primereact/inputpassword';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:password` component - a masked field, named `InputPassword` by PrimeReact 11.\n *\n * v11 pared this back to what a password field actually is: an input that renders as `type=\"password\"`\n * until something flips `mask`. The v10 `feedback` strength meter and the `toggleMask` eye button are\n * both gone from the component - there is no prompt/weak/medium/strong panel and no built-in reveal\n * control to switch on - so neither property is read here. `mask` is exposed instead, which is the one\n * knob that survived and the one an authored screen can actually mean: a preview that starts revealed.\n * A screen that needs a reveal button now owns that button, because only the screen knows where it goes.\n */\nexport function PrimePassword({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState(stringProperty(element, 'value', ''));\n return (\n <InputPassword\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value ?? '')}\n mask={booleanProperty(element, 'mask', true)}\n placeholder={stringProperty(element, 'placeholder')}\n disabled={booleanProperty(element, 'disabled', false)}\n />\n );\n}\n"],"names":["PrimePassword","element","value","setValue","useState","stringProperty","_jsx","InputPassword","data-scene-id","id","onValueChange","event","mask","booleanProperty","placeholder","disabled"],"mappings":";;;;;AAQA;;;;;;;;;AASC,IACM,SAASA,aAAAA,CAAc,EAAEC,OAAO,EAA4B,EAAA;AAC/D,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAASC,cAAAA,CAAeJ,SAAS,OAAA,EAAS,EAAA,CAAA,CAAA;AACpE,IAAA,qBACIK,GAAA,CAACC,aAAAA,EAAAA;AACGC,QAAAA,eAAAA,EAAeP,QAAQQ,EAAE;QACzBP,KAAAA,EAAOA,KAAAA;AACPQ,QAAAA,aAAAA,EAAe,CAACC,KAAAA,GAAUR,QAAAA,CAASQ,KAAAA,CAAMT,KAAK,IAAI,EAAA,CAAA;QAClDU,IAAAA,EAAMC,eAAAA,CAAgBZ,SAAS,MAAA,EAAQ,IAAA,CAAA;AACvCa,QAAAA,WAAAA,EAAaT,eAAeJ,OAAAA,EAAS,aAAA,CAAA;QACrCc,QAAAA,EAAUF,eAAAA,CAAgBZ,SAAS,UAAA,EAAY,KAAA;;AAG3D
|
|
1
|
+
{"version":3,"file":"PrimePassword.js","sources":["../../../form/PrimePassword.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 { InputPassword } from 'primereact/inputpassword';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:password` component - a masked field, named `InputPassword` by PrimeReact 11.\n *\n * v11 pared this back to what a password field actually is: an input that renders as `type=\"password\"`\n * until something flips `mask`. The v10 `feedback` strength meter and the `toggleMask` eye button are\n * both gone from the component - there is no prompt/weak/medium/strong panel and no built-in reveal\n * control to switch on - so neither property is read here. `mask` is exposed instead, which is the one\n * knob that survived and the one an authored screen can actually mean: a preview that starts revealed.\n * A screen that needs a reveal button now owns that button, because only the screen knows where it goes.\n */\nexport function PrimePassword({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState(stringProperty(element, 'value', ''));\n return (\n <InputPassword\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value ?? '')}\n mask={booleanProperty(element, 'mask', true)}\n placeholder={stringProperty(element, 'placeholder')}\n disabled={booleanProperty(element, 'disabled', false)}\n />\n );\n}\n"],"names":["PrimePassword","element","value","setValue","useState","stringProperty","_jsx","InputPassword","data-scene-id","id","onValueChange","event","mask","booleanProperty","placeholder","disabled"],"mappings":";;;;;AAQA;;;;;;;;;AASC,IACM,SAASA,aAAAA,CAAc,EAAEC,OAAO,EAA4B,EAAA;AAC/D,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAASC,cAAAA,CAAeJ,SAAS,OAAA,EAAS,EAAA,CAAA,CAAA;AACpE,IAAA,qBACIK,GAAA,CAACC,aAAAA,EAAAA;AACGC,QAAAA,eAAAA,EAAeP,QAAQQ,EAAE;QACzBP,KAAAA,EAAOA,KAAAA;AACPQ,QAAAA,aAAAA,EAAe,CAACC,KAAAA,GAAUR,QAAAA,CAASQ,KAAAA,CAAMT,KAAK,IAAI,EAAA,CAAA;QAClDU,IAAAA,EAAMC,eAAAA,CAAgBZ,SAAS,MAAA,EAAQ,IAAA,CAAA;AACvCa,QAAAA,WAAAA,EAAaT,eAAeJ,OAAAA,EAAS,aAAA,CAAA;QACrCc,QAAAA,EAAUF,eAAAA,CAAgBZ,SAAS,UAAA,EAAY,KAAA;;AAG3D;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeRadioButton.js","sources":["../../../form/PrimeRadioButton.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 { RadioButton } from 'primereact/radiobutton';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, optionsProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:radioButton` component - one exclusive choice out of several.\n *\n * PrimeReact's RadioButton is a single button, but a lone radio button is never what a screen means: the\n * choice is the group. The adapter therefore renders the whole group from `options`, sharing one\n * `name` so the browser enforces exclusivity, and falls back to a single button when only a `label` was\n * given.\n *\n * PrimeReact 11 splits each button into `Root` (the real radio input and its state), `Box` and\n * `Indicator`, and reports selection as `onCheckedChange`. Only the transition *into* checked is acted\n * on: the browser also fires the sibling losing its check, and treating that as a selection would clear\n * the value a moment after the user set it.\n */\nexport function PrimeRadioButton({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<string | undefined>(stringProperty(element, 'value'));\n const options = optionsProperty(element, 'options');\n const choices = options.length > 0 ? options : [{ label: stringProperty(element, 'label', 'Option'), value: element.id }];\n const disabled = booleanProperty(element, 'disabled', false);\n return (\n <div data-scene-id={element.id} className='flex flex-col gap-2'>\n {choices.map((choice) => (\n <div key={choice.value} className='flex items-center gap-2'>\n <RadioButton.Root\n inputId={`${element.id}-${choice.value}`}\n name={element.id}\n value={choice.value}\n checked={value === choice.value}\n onCheckedChange={(event) => {\n if (event.checked) setValue(choice.value);\n }}\n disabled={disabled}>\n <RadioButton.Box>\n <RadioButton.Indicator />\n </RadioButton.Box>\n </RadioButton.Root>\n <label htmlFor={`${element.id}-${choice.value}`}>{choice.label}</label>\n </div>\n ))}\n </div>\n );\n}\n"],"names":["PrimeRadioButton","element","value","setValue","useState","stringProperty","options","optionsProperty","choices","length","label","id","disabled","booleanProperty","_jsx","div","data-scene-id","className","map","choice","_jsxs","RadioButton","Root","inputId","name","checked","onCheckedChange","event","Box","Indicator","htmlFor"],"mappings":";;;;;AAQA;;;;;;;;;;;;AAYC,IACM,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAA4B,EAAA;AAClE,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAA6BC,eAAeJ,OAAAA,EAAS,OAAA,CAAA,CAAA;IAC/E,MAAMK,OAAAA,GAAUC,gBAAgBN,OAAAA,EAAS,SAAA,CAAA;AACzC,IAAA,MAAMO,OAAAA,GAAUF,OAAAA,CAAQG,MAAM,GAAG,IAAIH,OAAAA,GAAU;AAAC,QAAA;YAAEI,KAAAA,EAAOL,cAAAA,CAAeJ,SAAS,OAAA,EAAS,QAAA,CAAA;AAAWC,YAAAA,KAAAA,EAAOD,QAAQU;AAAG;AAAE,KAAA;IACzH,MAAMC,QAAAA,GAAWC,eAAAA,CAAgBZ,OAAAA,EAAS,UAAA,EAAY,KAAA,CAAA;AACtD,IAAA,qBACIa,GAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAef,QAAQU,EAAE;QAAEM,SAAAA,EAAU,qBAAA;AACrCT,QAAAA,QAAAA,EAAAA,OAAAA,CAAQU,GAAG,CAAC,CAACC,MAAAA,iBACVC,IAAA,CAACL,KAAAA,EAAAA;gBAAuBE,SAAAA,EAAU,yBAAA;;AAC9B,kCAAAH,GAAA,CAACO,YAAYC,IAAI,EAAA;wBACbC,OAAAA,EAAS,CAAA,EAAGtB,QAAQU,EAAE,CAAC,CAAC,EAAEQ,MAAAA,CAAOjB,KAAK,CAAA,CAAE;AACxCsB,wBAAAA,IAAAA,EAAMvB,QAAQU,EAAE;AAChBT,wBAAAA,KAAAA,EAAOiB,OAAOjB,KAAK;wBACnBuB,OAAAA,EAASvB,KAAAA,KAAUiB,OAAOjB,KAAK;AAC/BwB,wBAAAA,eAAAA,EAAiB,CAACC,KAAAA,GAAAA;AACd,4BAAA,IAAIA,KAAAA,CAAMF,OAAO,EAAEtB,QAAAA,CAASgB,OAAOjB,KAAK,CAAA;AAC5C,wBAAA,CAAA;wBACAU,QAAAA,EAAUA,QAAAA;gDACVE,GAAA,CAACO,YAAYO,GAAG,EAAA;oDACZd,GAAA,CAACO,YAAYQ,SAAS,EAAA,EAAA;;;kCAG9Bf,GAAA,CAACJ,OAAAA,EAAAA;wBAAMoB,OAAAA,EAAS,CAAA,EAAG7B,QAAQU,EAAE,CAAC,CAAC,EAAEQ,MAAAA,CAAOjB,KAAK,CAAA,CAAE;AAAGiB,wBAAAA,QAAAA,EAAAA,MAAAA,CAAOT;;;AAdnDS,aAAAA,EAAAA,MAAAA,CAAOjB,KAAK,CAAA;;AAmBtC
|
|
1
|
+
{"version":3,"file":"PrimeRadioButton.js","sources":["../../../form/PrimeRadioButton.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 { RadioButton } from 'primereact/radiobutton';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, optionsProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:radioButton` component - one exclusive choice out of several.\n *\n * PrimeReact's RadioButton is a single button, but a lone radio button is never what a screen means: the\n * choice is the group. The adapter therefore renders the whole group from `options`, sharing one\n * `name` so the browser enforces exclusivity, and falls back to a single button when only a `label` was\n * given.\n *\n * PrimeReact 11 splits each button into `Root` (the real radio input and its state), `Box` and\n * `Indicator`, and reports selection as `onCheckedChange`. Only the transition *into* checked is acted\n * on: the browser also fires the sibling losing its check, and treating that as a selection would clear\n * the value a moment after the user set it.\n */\nexport function PrimeRadioButton({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<string | undefined>(stringProperty(element, 'value'));\n const options = optionsProperty(element, 'options');\n const choices = options.length > 0 ? options : [{ label: stringProperty(element, 'label', 'Option'), value: element.id }];\n const disabled = booleanProperty(element, 'disabled', false);\n return (\n <div data-scene-id={element.id} className='flex flex-col gap-2'>\n {choices.map((choice) => (\n <div key={choice.value} className='flex items-center gap-2'>\n <RadioButton.Root\n inputId={`${element.id}-${choice.value}`}\n name={element.id}\n value={choice.value}\n checked={value === choice.value}\n onCheckedChange={(event) => {\n if (event.checked) setValue(choice.value);\n }}\n disabled={disabled}>\n <RadioButton.Box>\n <RadioButton.Indicator />\n </RadioButton.Box>\n </RadioButton.Root>\n <label htmlFor={`${element.id}-${choice.value}`}>{choice.label}</label>\n </div>\n ))}\n </div>\n );\n}\n"],"names":["PrimeRadioButton","element","value","setValue","useState","stringProperty","options","optionsProperty","choices","length","label","id","disabled","booleanProperty","_jsx","div","data-scene-id","className","map","choice","_jsxs","RadioButton","Root","inputId","name","checked","onCheckedChange","event","Box","Indicator","htmlFor"],"mappings":";;;;;AAQA;;;;;;;;;;;;AAYC,IACM,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAA4B,EAAA;AAClE,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAA6BC,eAAeJ,OAAAA,EAAS,OAAA,CAAA,CAAA;IAC/E,MAAMK,OAAAA,GAAUC,gBAAgBN,OAAAA,EAAS,SAAA,CAAA;AACzC,IAAA,MAAMO,OAAAA,GAAUF,OAAAA,CAAQG,MAAM,GAAG,IAAIH,OAAAA,GAAU;AAAC,QAAA;YAAEI,KAAAA,EAAOL,cAAAA,CAAeJ,SAAS,OAAA,EAAS,QAAA,CAAA;AAAWC,YAAAA,KAAAA,EAAOD,QAAQU;AAAG;AAAE,KAAA;IACzH,MAAMC,QAAAA,GAAWC,eAAAA,CAAgBZ,OAAAA,EAAS,UAAA,EAAY,KAAA,CAAA;AACtD,IAAA,qBACIa,GAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAef,QAAQU,EAAE;QAAEM,SAAAA,EAAU,qBAAA;AACrCT,QAAAA,QAAAA,EAAAA,OAAAA,CAAQU,GAAG,CAAC,CAACC,MAAAA,iBACVC,IAAA,CAACL,KAAAA,EAAAA;gBAAuBE,SAAAA,EAAU,yBAAA;;AAC9B,kCAAAH,GAAA,CAACO,YAAYC,IAAI,EAAA;wBACbC,OAAAA,EAAS,CAAA,EAAGtB,QAAQU,EAAE,CAAC,CAAC,EAAEQ,MAAAA,CAAOjB,KAAK,CAAA,CAAE;AACxCsB,wBAAAA,IAAAA,EAAMvB,QAAQU,EAAE;AAChBT,wBAAAA,KAAAA,EAAOiB,OAAOjB,KAAK;wBACnBuB,OAAAA,EAASvB,KAAAA,KAAUiB,OAAOjB,KAAK;AAC/BwB,wBAAAA,eAAAA,EAAiB,CAACC,KAAAA,GAAAA;AACd,4BAAA,IAAIA,KAAAA,CAAMF,OAAO,EAAEtB,QAAAA,CAASgB,OAAOjB,KAAK,CAAA;AAC5C,wBAAA,CAAA;wBACAU,QAAAA,EAAUA,QAAAA;gDACVE,GAAA,CAACO,YAAYO,GAAG,EAAA;oDACZd,GAAA,CAACO,YAAYQ,SAAS,EAAA,EAAA;;;kCAG9Bf,GAAA,CAACJ,OAAAA,EAAAA;wBAAMoB,OAAAA,EAAS,CAAA,EAAG7B,QAAQU,EAAE,CAAC,CAAC,EAAEQ,MAAAA,CAAOjB,KAAK,CAAA,CAAE;AAAGiB,wBAAAA,QAAAA,EAAAA,MAAAA,CAAOT;;;AAdnDS,aAAAA,EAAAA,MAAAA,CAAOjB,KAAK,CAAA;;AAmBtC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeRating.js","sources":["../../../form/PrimeRating.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 { Rating } from 'primereact/rating';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty } from '../properties';\n\n/**\n * The `PrimeReact:rating` component - a star rating.\n *\n * `stars` is no longer a prop the component reads: PrimeReact 11 takes the stars as children, so the\n * count is what this adapter builds the `Rating.Option` list from, and the icons are ours to name -\n * `On` and `Off` are the filled and empty faces of one star. The upside of the change is that a rating\n * of hearts or flames is now a different icon class rather than a different component.\n *\n * v10's `cancel` property is not read. It rendered an extra leading icon that reset the rating to none;\n * v11 has no such part and no \"clear\" affordance, so there is nothing left to switch on.\n */\nexport function PrimeRating({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<number | undefined>(numberProperty(element, 'value'));\n const stars = numberProperty(element, 'stars', 5);\n return (\n <Rating.Root\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value)}\n readOnly={booleanProperty(element, 'readOnly', false)}\n disabled={booleanProperty(element, 'disabled', false)}>\n {Array.from({ length: stars }, (_, index) => (\n <Rating.Option key={index} index={index} aria-label={`${index + 1} of ${stars}`}>\n <Rating.On>\n <i className='pi pi-star-fill' />\n </Rating.On>\n <Rating.Off>\n <i className='pi pi-star' />\n </Rating.Off>\n </Rating.Option>\n ))}\n </Rating.Root>\n );\n}\n"],"names":["PrimeRating","element","value","setValue","useState","numberProperty","stars","_jsx","Rating","Root","data-scene-id","id","onValueChange","event","readOnly","booleanProperty","disabled","Array","from","length","_","index","_jsxs","Option","aria-label","On","i","className","Off"],"mappings":";;;;;AAQA;;;;;;;;;;AAUC,IACM,SAASA,WAAAA,CAAY,EAAEC,OAAO,EAA4B,EAAA;AAC7D,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAA6BC,eAAeJ,OAAAA,EAAS,OAAA,CAAA,CAAA;IAC/E,MAAMK,KAAAA,GAAQD,cAAAA,CAAeJ,OAAAA,EAAS,OAAA,EAAS,CAAA,CAAA;IAC/C,qBACIM,GAAA,CAACC,OAAOC,IAAI,EAAA;AACRC,QAAAA,eAAAA,EAAeT,QAAQU,EAAE;QACzBT,KAAAA,EAAOA,KAAAA;AACPU,QAAAA,aAAAA,EAAe,CAACC,KAAAA,GAAUV,QAAAA,CAASU,KAAAA,CAAMX,KAAK,CAAA;QAC9CY,QAAAA,EAAUC,eAAAA,CAAgBd,SAAS,UAAA,EAAY,KAAA,CAAA;QAC/Ce,QAAAA,EAAUD,eAAAA,CAAgBd,SAAS,UAAA,EAAY,KAAA,CAAA;AAC9CgB,QAAAA,QAAAA,EAAAA,KAAAA,CAAMC,IAAI,CAAC;YAAEC,MAAAA,EAAQb;AAAM,SAAA,EAAG,CAACc,CAAAA,EAAGC,KAAAA,iBAC/BC,IAAA,CAACd,OAAOe,MAAM,EAAA;gBAAaF,KAAAA,EAAOA,KAAAA;AAAOG,gBAAAA,YAAAA,EAAY,CAAA,EAAGH,KAAAA,GAAQ,CAAA,CAAE,IAAI,EAAEf,KAAAA,CAAAA,CAAO;;AAC3E,kCAAAC,GAAA,CAACC,OAAOiB,EAAE,EAAA;AACN,wBAAA,QAAA,gBAAAlB,GAAA,CAACmB,GAAAA,EAAAA;4BAAEC,SAAAA,EAAU;;;AAEjB,kCAAApB,GAAA,CAACC,OAAOoB,GAAG,EAAA;AACP,wBAAA,QAAA,gBAAArB,GAAA,CAACmB,GAAAA,EAAAA;4BAAEC,SAAAA,EAAU;;;;AALDN,aAAAA,EAAAA,KAAAA,CAAAA;;AAWpC
|
|
1
|
+
{"version":3,"file":"PrimeRating.js","sources":["../../../form/PrimeRating.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 { Rating } from 'primereact/rating';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty } from '../properties';\n\n/**\n * The `PrimeReact:rating` component - a star rating.\n *\n * `stars` is no longer a prop the component reads: PrimeReact 11 takes the stars as children, so the\n * count is what this adapter builds the `Rating.Option` list from, and the icons are ours to name -\n * `On` and `Off` are the filled and empty faces of one star. The upside of the change is that a rating\n * of hearts or flames is now a different icon class rather than a different component.\n *\n * v10's `cancel` property is not read. It rendered an extra leading icon that reset the rating to none;\n * v11 has no such part and no \"clear\" affordance, so there is nothing left to switch on.\n */\nexport function PrimeRating({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<number | undefined>(numberProperty(element, 'value'));\n const stars = numberProperty(element, 'stars', 5);\n return (\n <Rating.Root\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value)}\n readOnly={booleanProperty(element, 'readOnly', false)}\n disabled={booleanProperty(element, 'disabled', false)}>\n {Array.from({ length: stars }, (_, index) => (\n <Rating.Option key={index} index={index} aria-label={`${index + 1} of ${stars}`}>\n <Rating.On>\n <i className='pi pi-star-fill' />\n </Rating.On>\n <Rating.Off>\n <i className='pi pi-star' />\n </Rating.Off>\n </Rating.Option>\n ))}\n </Rating.Root>\n );\n}\n"],"names":["PrimeRating","element","value","setValue","useState","numberProperty","stars","_jsx","Rating","Root","data-scene-id","id","onValueChange","event","readOnly","booleanProperty","disabled","Array","from","length","_","index","_jsxs","Option","aria-label","On","i","className","Off"],"mappings":";;;;;AAQA;;;;;;;;;;AAUC,IACM,SAASA,WAAAA,CAAY,EAAEC,OAAO,EAA4B,EAAA;AAC7D,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAA6BC,eAAeJ,OAAAA,EAAS,OAAA,CAAA,CAAA;IAC/E,MAAMK,KAAAA,GAAQD,cAAAA,CAAeJ,OAAAA,EAAS,OAAA,EAAS,CAAA,CAAA;IAC/C,qBACIM,GAAA,CAACC,OAAOC,IAAI,EAAA;AACRC,QAAAA,eAAAA,EAAeT,QAAQU,EAAE;QACzBT,KAAAA,EAAOA,KAAAA;AACPU,QAAAA,aAAAA,EAAe,CAACC,KAAAA,GAAUV,QAAAA,CAASU,KAAAA,CAAMX,KAAK,CAAA;QAC9CY,QAAAA,EAAUC,eAAAA,CAAgBd,SAAS,UAAA,EAAY,KAAA,CAAA;QAC/Ce,QAAAA,EAAUD,eAAAA,CAAgBd,SAAS,UAAA,EAAY,KAAA,CAAA;AAC9CgB,QAAAA,QAAAA,EAAAA,KAAAA,CAAMC,IAAI,CAAC;YAAEC,MAAAA,EAAQb;AAAM,SAAA,EAAG,CAACc,CAAAA,EAAGC,KAAAA,iBAC/BC,IAAA,CAACd,OAAOe,MAAM,EAAA;gBAAaF,KAAAA,EAAOA,KAAAA;AAAOG,gBAAAA,YAAAA,EAAY,CAAA,EAAGH,KAAAA,GAAQ,CAAA,CAAE,IAAI,EAAEf,KAAAA,CAAAA,CAAO;;AAC3E,kCAAAC,GAAA,CAACC,OAAOiB,EAAE,EAAA;AACN,wBAAA,QAAA,gBAAAlB,GAAA,CAACmB,GAAAA,EAAAA;4BAAEC,SAAAA,EAAU;;;AAEjB,kCAAApB,GAAA,CAACC,OAAOoB,GAAG,EAAA;AACP,wBAAA,QAAA,gBAAArB,GAAA,CAACmB,GAAAA,EAAAA;4BAAEC,SAAAA,EAAU;;;;AALDN,aAAAA,EAAAA,KAAAA,CAAAA;;AAWpC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeSelectButton.js","sources":["../../../form/PrimeSelectButton.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 { ToggleButton } from 'primereact/togglebutton';\nimport { ToggleButtonGroup } from 'primereact/togglebuttongroup';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, optionsProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:selectButton` component - a small set of choices shown as joined toggle buttons.\n * PrimeReact 11 calls it `ToggleButtonGroup`.\n *\n * v10 took the choices as an `options` array and rendered the buttons itself; v11 takes them as children,\n * so the mapping that used to be `optionLabel` / `optionValue` is a `map` here. The group still owns the\n * selection - each `ToggleButton` only declares its `value` and reads its pressed state from the group's\n * context - which is what keeps `multiple` a single prop on the group rather than a rule every button\n * would otherwise have to agree on.\n */\nexport function PrimeSelectButton({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<unknown>(stringProperty(element, 'value'));\n return (\n <ToggleButtonGroup\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value)}\n multiple={booleanProperty(element, 'multiple', false)}\n disabled={booleanProperty(element, 'disabled', false)}>\n {optionsProperty(element, 'options').map((option) => (\n <ToggleButton.Root key={option.value} value={option.value}>\n {option.label}\n </ToggleButton.Root>\n ))}\n </ToggleButtonGroup>\n );\n}\n"],"names":["PrimeSelectButton","element","value","setValue","useState","stringProperty","_jsx","ToggleButtonGroup","data-scene-id","id","onValueChange","event","multiple","booleanProperty","disabled","optionsProperty","map","option","ToggleButton","Root","label"],"mappings":";;;;;;AASA;;;;;;;;;AASC,IACM,SAASA,iBAAAA,CAAkB,EAAEC,OAAO,EAA4B,EAAA;AACnE,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAAkBC,eAAeJ,OAAAA,EAAS,OAAA,CAAA,CAAA;AACpE,IAAA,qBACIK,GAAA,CAACC,iBAAAA,EAAAA;AACGC,QAAAA,eAAAA,EAAeP,QAAQQ,EAAE;QACzBP,KAAAA,EAAOA,KAAAA;AACPQ,QAAAA,aAAAA,EAAe,CAACC,KAAAA,GAAUR,QAAAA,CAASQ,KAAAA,CAAMT,KAAK,CAAA;QAC9CU,QAAAA,EAAUC,eAAAA,CAAgBZ,SAAS,UAAA,EAAY,KAAA,CAAA;QAC/Ca,QAAAA,EAAUD,eAAAA,CAAgBZ,SAAS,UAAA,EAAY,KAAA,CAAA;kBAC9Cc,eAAAA,CAAgBd,OAAAA,EAAS,WAAWe,GAAG,CAAC,CAACC,MAAAA,iBACtCX,GAAA,CAACY,aAAaC,IAAI,EAAA;AAAoBjB,gBAAAA,KAAAA,EAAOe,OAAOf,KAAK;AACpDe,gBAAAA,QAAAA,EAAAA,MAAAA,CAAOG;AADYH,aAAAA,EAAAA,MAAAA,CAAOf,KAAK,CAAA;;AAMpD
|
|
1
|
+
{"version":3,"file":"PrimeSelectButton.js","sources":["../../../form/PrimeSelectButton.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 { ToggleButton } from 'primereact/togglebutton';\nimport { ToggleButtonGroup } from 'primereact/togglebuttongroup';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, optionsProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:selectButton` component - a small set of choices shown as joined toggle buttons.\n * PrimeReact 11 calls it `ToggleButtonGroup`.\n *\n * v10 took the choices as an `options` array and rendered the buttons itself; v11 takes them as children,\n * so the mapping that used to be `optionLabel` / `optionValue` is a `map` here. The group still owns the\n * selection - each `ToggleButton` only declares its `value` and reads its pressed state from the group's\n * context - which is what keeps `multiple` a single prop on the group rather than a rule every button\n * would otherwise have to agree on.\n */\nexport function PrimeSelectButton({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<unknown>(stringProperty(element, 'value'));\n return (\n <ToggleButtonGroup\n data-scene-id={element.id}\n value={value}\n onValueChange={(event) => setValue(event.value)}\n multiple={booleanProperty(element, 'multiple', false)}\n disabled={booleanProperty(element, 'disabled', false)}>\n {optionsProperty(element, 'options').map((option) => (\n <ToggleButton.Root key={option.value} value={option.value}>\n {option.label}\n </ToggleButton.Root>\n ))}\n </ToggleButtonGroup>\n );\n}\n"],"names":["PrimeSelectButton","element","value","setValue","useState","stringProperty","_jsx","ToggleButtonGroup","data-scene-id","id","onValueChange","event","multiple","booleanProperty","disabled","optionsProperty","map","option","ToggleButton","Root","label"],"mappings":";;;;;;AASA;;;;;;;;;AASC,IACM,SAASA,iBAAAA,CAAkB,EAAEC,OAAO,EAA4B,EAAA;AACnE,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAAkBC,eAAeJ,OAAAA,EAAS,OAAA,CAAA,CAAA;AACpE,IAAA,qBACIK,GAAA,CAACC,iBAAAA,EAAAA;AACGC,QAAAA,eAAAA,EAAeP,QAAQQ,EAAE;QACzBP,KAAAA,EAAOA,KAAAA;AACPQ,QAAAA,aAAAA,EAAe,CAACC,KAAAA,GAAUR,QAAAA,CAASQ,KAAAA,CAAMT,KAAK,CAAA;QAC9CU,QAAAA,EAAUC,eAAAA,CAAgBZ,SAAS,UAAA,EAAY,KAAA,CAAA;QAC/Ca,QAAAA,EAAUD,eAAAA,CAAgBZ,SAAS,UAAA,EAAY,KAAA,CAAA;kBAC9Cc,eAAAA,CAAgBd,OAAAA,EAAS,WAAWe,GAAG,CAAC,CAACC,MAAAA,iBACtCX,GAAA,CAACY,aAAaC,IAAI,EAAA;AAAoBjB,gBAAAA,KAAAA,EAAOe,OAAOf,KAAK;AACpDe,gBAAAA,QAAAA,EAAAA,MAAAA,CAAOG;AADYH,aAAAA,EAAAA,MAAAA,CAAOf,KAAK,CAAA;;AAMpD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeSlider.js","sources":["../../../form/PrimeSlider.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 { Slider } from 'primereact/slider';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty } from '../properties';\n\n/**\n * The `PrimeReact:slider` component - a value picked along a track.\n *\n * Given a width because Slider renders as a zero-height track that collapses to nothing in an\n * auto-sized container - the one piece of layout it cannot supply for itself.\n *\n * PrimeReact 11 exposes the track, the filled range and the handle as separate parts, which is what makes\n * a range slider a matter of rendering a second `Handle` rather than a `range` prop. This adapter renders\n * one, so the value stays a single number; `onValueChange` still reports `number[]` for the range case,\n * hence the narrowing on the way back in.\n */\nexport function PrimeSlider({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState(numberProperty(element, 'value', 50));\n return (\n <div data-scene-id={element.id} className='w-64'>\n <Slider.Root\n value={value}\n onValueChange={(event) => setValue(typeof event.value === 'number' ? event.value : value)}\n min={numberProperty(element, 'min', 0)}\n max={numberProperty(element, 'max', 100)}\n step={numberProperty(element, 'step', 1)}\n disabled={booleanProperty(element, 'disabled', false)}>\n <Slider.Track>\n <Slider.Range />\n </Slider.Track>\n <Slider.Handle />\n </Slider.Root>\n </div>\n );\n}\n"],"names":["PrimeSlider","element","value","setValue","useState","numberProperty","_jsx","div","data-scene-id","id","className","_jsxs","Slider","Root","onValueChange","event","min","max","step","disabled","booleanProperty","Track","Range","Handle"],"mappings":";;;;;AAQA;;;;;;;;;;AAUC,IACM,SAASA,WAAAA,CAAY,EAAEC,OAAO,EAA4B,EAAA;AAC7D,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAASC,cAAAA,CAAeJ,SAAS,OAAA,EAAS,EAAA,CAAA,CAAA;AACpE,IAAA,qBACIK,GAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAeP,QAAQQ,EAAE;QAAEC,SAAAA,EAAU,MAAA;gCACtCC,IAAA,CAACC,OAAOC,IAAI,EAAA;YACRX,KAAAA,EAAOA,KAAAA;YACPY,aAAAA,EAAe,CAACC,KAAAA,GAAUZ,QAAAA,CAAS,OAAOY,KAAAA,CAAMb,KAAK,KAAK,QAAA,GAAWa,KAAAA,CAAMb,KAAK,GAAGA,KAAAA,CAAAA;YACnFc,GAAAA,EAAKX,cAAAA,CAAeJ,SAAS,KAAA,EAAO,CAAA,CAAA;YACpCgB,GAAAA,EAAKZ,cAAAA,CAAeJ,SAAS,KAAA,EAAO,GAAA,CAAA;YACpCiB,IAAAA,EAAMb,cAAAA,CAAeJ,SAAS,MAAA,EAAQ,CAAA,CAAA;YACtCkB,QAAAA,EAAUC,eAAAA,CAAgBnB,SAAS,UAAA,EAAY,KAAA,CAAA;;AAC/C,8BAAAK,GAAA,CAACM,OAAOS,KAAK,EAAA;4CACTf,GAAA,CAACM,OAAOU,KAAK,EAAA,EAAA;;AAEjB,8BAAAhB,GAAA,CAACM,OAAOW,MAAM,EAAA,EAAA;;;;AAI9B
|
|
1
|
+
{"version":3,"file":"PrimeSlider.js","sources":["../../../form/PrimeSlider.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 { Slider } from 'primereact/slider';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty } from '../properties';\n\n/**\n * The `PrimeReact:slider` component - a value picked along a track.\n *\n * Given a width because Slider renders as a zero-height track that collapses to nothing in an\n * auto-sized container - the one piece of layout it cannot supply for itself.\n *\n * PrimeReact 11 exposes the track, the filled range and the handle as separate parts, which is what makes\n * a range slider a matter of rendering a second `Handle` rather than a `range` prop. This adapter renders\n * one, so the value stays a single number; `onValueChange` still reports `number[]` for the range case,\n * hence the narrowing on the way back in.\n */\nexport function PrimeSlider({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState(numberProperty(element, 'value', 50));\n return (\n <div data-scene-id={element.id} className='w-64'>\n <Slider.Root\n value={value}\n onValueChange={(event) => setValue(typeof event.value === 'number' ? event.value : value)}\n min={numberProperty(element, 'min', 0)}\n max={numberProperty(element, 'max', 100)}\n step={numberProperty(element, 'step', 1)}\n disabled={booleanProperty(element, 'disabled', false)}>\n <Slider.Track>\n <Slider.Range />\n </Slider.Track>\n <Slider.Handle />\n </Slider.Root>\n </div>\n );\n}\n"],"names":["PrimeSlider","element","value","setValue","useState","numberProperty","_jsx","div","data-scene-id","id","className","_jsxs","Slider","Root","onValueChange","event","min","max","step","disabled","booleanProperty","Track","Range","Handle"],"mappings":";;;;;AAQA;;;;;;;;;;AAUC,IACM,SAASA,WAAAA,CAAY,EAAEC,OAAO,EAA4B,EAAA;AAC7D,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAASC,cAAAA,CAAeJ,SAAS,OAAA,EAAS,EAAA,CAAA,CAAA;AACpE,IAAA,qBACIK,GAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAeP,QAAQQ,EAAE;QAAEC,SAAAA,EAAU,MAAA;gCACtCC,IAAA,CAACC,OAAOC,IAAI,EAAA;YACRX,KAAAA,EAAOA,KAAAA;YACPY,aAAAA,EAAe,CAACC,KAAAA,GAAUZ,QAAAA,CAAS,OAAOY,KAAAA,CAAMb,KAAK,KAAK,QAAA,GAAWa,KAAAA,CAAMb,KAAK,GAAGA,KAAAA,CAAAA;YACnFc,GAAAA,EAAKX,cAAAA,CAAeJ,SAAS,KAAA,EAAO,CAAA,CAAA;YACpCgB,GAAAA,EAAKZ,cAAAA,CAAeJ,SAAS,KAAA,EAAO,GAAA,CAAA;YACpCiB,IAAAA,EAAMb,cAAAA,CAAeJ,SAAS,MAAA,EAAQ,CAAA,CAAA;YACtCkB,QAAAA,EAAUC,eAAAA,CAAgBnB,SAAS,UAAA,EAAY,KAAA,CAAA;;AAC/C,8BAAAK,GAAA,CAACM,OAAOS,KAAK,EAAA;4CACTf,GAAA,CAACM,OAAOU,KAAK,EAAA,EAAA;;AAEjB,8BAAAhB,GAAA,CAACM,OAAOW,MAAM,EAAA,EAAA;;;;AAI9B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeToggleSwitch.js","sources":["../../../form/PrimeToggleSwitch.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 { ToggleSwitch } from 'primereact/toggleswitch';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:toggleSwitch` component.\n *\n * The abstract name has always been `toggleSwitch` even while PrimeReact 10 called the component\n * `InputSwitch` - a Scene name follows what the thing is rather than what one library happens to call it\n * this major version - and v11 renaming it `ToggleSwitch` is the library catching up rather than the\n * package moving.\n *\n * `Root` renders the hidden checkbox that carries the state and the accessible name, and the visible\n * switch is `Control` plus the `Handle` that slides inside it. That is why `inputId` and not `id` is what\n * the label points at: the label has to reach the input, not the wrapper.\n */\nexport function PrimeToggleSwitch({ element }: RegisteredComponentProps) {\n const [checked, setChecked] = useState(booleanProperty(element, 'checked', false));\n const label = stringProperty(element, 'label');\n return (\n <div data-scene-id={element.id} className='flex items-center gap-2'>\n <ToggleSwitch.Root\n inputId={element.id}\n checked={checked}\n onCheckedChange={(event) => setChecked(event.checked)}\n disabled={booleanProperty(element, 'disabled', false)}>\n <ToggleSwitch.Control>\n <ToggleSwitch.Handle />\n </ToggleSwitch.Control>\n </ToggleSwitch.Root>\n {label !== undefined && <label htmlFor={element.id}>{label}</label>}\n </div>\n );\n}\n"],"names":["PrimeToggleSwitch","element","checked","setChecked","useState","booleanProperty","label","stringProperty","_jsxs","div","data-scene-id","id","className","_jsx","ToggleSwitch","Root","inputId","onCheckedChange","event","disabled","Control","Handle","undefined","htmlFor"],"mappings":";;;;;AAQA;;;;;;;;;;;AAWC,IACM,SAASA,iBAAAA,CAAkB,EAAEC,OAAO,EAA4B,EAAA;AACnE,IAAA,MAAM,CAACC,OAAAA,EAASC,UAAAA,CAAW,GAAGC,QAAAA,CAASC,eAAAA,CAAgBJ,SAAS,SAAA,EAAW,KAAA,CAAA,CAAA;IAC3E,MAAMK,KAAAA,GAAQC,eAAeN,OAAAA,EAAS,OAAA,CAAA;AACtC,IAAA,qBACIO,IAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAeT,QAAQU,EAAE;QAAEC,SAAAA,EAAU,yBAAA;;AACtC,0BAAAC,GAAA,CAACC,aAAaC,IAAI,EAAA;AACdC,gBAAAA,OAAAA,EAASf,QAAQU,EAAE;gBACnBT,OAAAA,EAASA,OAAAA;AACTe,gBAAAA,eAAAA,EAAiB,CAACC,KAAAA,GAAUf,UAAAA,CAAWe,KAAAA,CAAMhB,OAAO,CAAA;gBACpDiB,QAAAA,EAAUd,eAAAA,CAAgBJ,SAAS,UAAA,EAAY,KAAA,CAAA;wCAC/CY,GAAA,CAACC,aAAaM,OAAO,EAAA;4CACjBP,GAAA,CAACC,aAAaO,MAAM,EAAA,EAAA;;;AAG3Bf,YAAAA,KAAAA,KAAUgB,2BAAaT,GAAA,CAACP,OAAAA,EAAAA;AAAMiB,gBAAAA,OAAAA,EAAStB,QAAQU,EAAE;AAAGL,gBAAAA,QAAAA,EAAAA;;;;AAGjE
|
|
1
|
+
{"version":3,"file":"PrimeToggleSwitch.js","sources":["../../../form/PrimeToggleSwitch.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 { ToggleSwitch } from 'primereact/toggleswitch';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:toggleSwitch` component.\n *\n * The abstract name has always been `toggleSwitch` even while PrimeReact 10 called the component\n * `InputSwitch` - a Scene name follows what the thing is rather than what one library happens to call it\n * this major version - and v11 renaming it `ToggleSwitch` is the library catching up rather than the\n * package moving.\n *\n * `Root` renders the hidden checkbox that carries the state and the accessible name, and the visible\n * switch is `Control` plus the `Handle` that slides inside it. That is why `inputId` and not `id` is what\n * the label points at: the label has to reach the input, not the wrapper.\n */\nexport function PrimeToggleSwitch({ element }: RegisteredComponentProps) {\n const [checked, setChecked] = useState(booleanProperty(element, 'checked', false));\n const label = stringProperty(element, 'label');\n return (\n <div data-scene-id={element.id} className='flex items-center gap-2'>\n <ToggleSwitch.Root\n inputId={element.id}\n checked={checked}\n onCheckedChange={(event) => setChecked(event.checked)}\n disabled={booleanProperty(element, 'disabled', false)}>\n <ToggleSwitch.Control>\n <ToggleSwitch.Handle />\n </ToggleSwitch.Control>\n </ToggleSwitch.Root>\n {label !== undefined && <label htmlFor={element.id}>{label}</label>}\n </div>\n );\n}\n"],"names":["PrimeToggleSwitch","element","checked","setChecked","useState","booleanProperty","label","stringProperty","_jsxs","div","data-scene-id","id","className","_jsx","ToggleSwitch","Root","inputId","onCheckedChange","event","disabled","Control","Handle","undefined","htmlFor"],"mappings":";;;;;AAQA;;;;;;;;;;;AAWC,IACM,SAASA,iBAAAA,CAAkB,EAAEC,OAAO,EAA4B,EAAA;AACnE,IAAA,MAAM,CAACC,OAAAA,EAASC,UAAAA,CAAW,GAAGC,QAAAA,CAASC,eAAAA,CAAgBJ,SAAS,SAAA,EAAW,KAAA,CAAA,CAAA;IAC3E,MAAMK,KAAAA,GAAQC,eAAeN,OAAAA,EAAS,OAAA,CAAA;AACtC,IAAA,qBACIO,IAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAeT,QAAQU,EAAE;QAAEC,SAAAA,EAAU,yBAAA;;AACtC,0BAAAC,GAAA,CAACC,aAAaC,IAAI,EAAA;AACdC,gBAAAA,OAAAA,EAASf,QAAQU,EAAE;gBACnBT,OAAAA,EAASA,OAAAA;AACTe,gBAAAA,eAAAA,EAAiB,CAACC,KAAAA,GAAUf,UAAAA,CAAWe,KAAAA,CAAMhB,OAAO,CAAA;gBACpDiB,QAAAA,EAAUd,eAAAA,CAAgBJ,SAAS,UAAA,EAAY,KAAA,CAAA;wCAC/CY,GAAA,CAACC,aAAaM,OAAO,EAAA;4CACjBP,GAAA,CAACC,aAAaO,MAAM,EAAA,EAAA;;;AAG3Bf,YAAAA,KAAAA,KAAUgB,2BAAaT,GAAA,CAACP,OAAAA,EAAAA;AAAMiB,gBAAAA,OAAAA,EAAStB,QAAQU,EAAE;AAAGL,gBAAAA,QAAAA,EAAAA;;;;AAGjE;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeTreeSelect.js","sources":["../../../form/PrimeTreeSelect.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 { RegisteredComponentProps } from '@cratis/scene.react';\nimport { TreeSelect } from './TreeSelect';\nimport { booleanProperty, stringProperty } from '../properties';\nimport { treeNodesProperty } from '../treeNodes';\n\n/**\n * The `PrimeReact:treeSelect` component - a dropdown whose choices are a hierarchy.\n *\n * The abstract name outlived the component: PrimeReact 11 removed `TreeSelect` with no replacement and no\n * headless hook, so what this adapts is {@link TreeSelect}, this package's own, built from v11's\n * `Popover` and `Tree`. Keeping the name is the point - a screen that already says `treeSelect` neither\n * knows nor needs to know that the thing behind it changed owner.\n *\n * v10's `filter` property is not read, because the replacement does not filter; see {@link TreeSelect}\n * for what else was left out and why.\n */\nexport function PrimeTreeSelect({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<string | undefined>(stringProperty(element, 'value'));\n return (\n <div data-scene-id={element.id}>\n <TreeSelect\n value={value}\n onChange={setValue}\n options={treeNodesProperty(element, 'options')}\n placeholder={stringProperty(element, 'placeholder', 'Select')}\n disabled={booleanProperty(element, 'disabled', false)}\n />\n </div>\n );\n}\n"],"names":["PrimeTreeSelect","element","value","setValue","useState","stringProperty","_jsx","div","data-scene-id","id","TreeSelect","onChange","options","treeNodesProperty","placeholder","disabled","booleanProperty"],"mappings":";;;;;;AASA;;;;;;;;;;AAUC,IACM,SAASA,eAAAA,CAAgB,EAAEC,OAAO,EAA4B,EAAA;AACjE,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAA6BC,eAAeJ,OAAAA,EAAS,OAAA,CAAA,CAAA;AAC/E,IAAA,qBACIK,GAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAeP,QAAQQ,EAAE;AAC1B,QAAA,QAAA,gBAAAH,GAAA,CAACI,UAAAA,EAAAA;YACGR,KAAAA,EAAOA,KAAAA;YACPS,QAAAA,EAAUR,QAAAA;AACVS,YAAAA,OAAAA,EAASC,kBAAkBZ,OAAAA,EAAS,SAAA,CAAA;YACpCa,WAAAA,EAAaT,cAAAA,CAAeJ,SAAS,aAAA,EAAe,QAAA,CAAA;YACpDc,QAAAA,EAAUC,eAAAA,CAAgBf,SAAS,UAAA,EAAY,KAAA;;;AAI/D
|
|
1
|
+
{"version":3,"file":"PrimeTreeSelect.js","sources":["../../../form/PrimeTreeSelect.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 { RegisteredComponentProps } from '@cratis/scene.react';\nimport { TreeSelect } from './TreeSelect';\nimport { booleanProperty, stringProperty } from '../properties';\nimport { treeNodesProperty } from '../treeNodes';\n\n/**\n * The `PrimeReact:treeSelect` component - a dropdown whose choices are a hierarchy.\n *\n * The abstract name outlived the component: PrimeReact 11 removed `TreeSelect` with no replacement and no\n * headless hook, so what this adapts is {@link TreeSelect}, this package's own, built from v11's\n * `Popover` and `Tree`. Keeping the name is the point - a screen that already says `treeSelect` neither\n * knows nor needs to know that the thing behind it changed owner.\n *\n * v10's `filter` property is not read, because the replacement does not filter; see {@link TreeSelect}\n * for what else was left out and why.\n */\nexport function PrimeTreeSelect({ element }: RegisteredComponentProps) {\n const [value, setValue] = useState<string | undefined>(stringProperty(element, 'value'));\n return (\n <div data-scene-id={element.id}>\n <TreeSelect\n value={value}\n onChange={setValue}\n options={treeNodesProperty(element, 'options')}\n placeholder={stringProperty(element, 'placeholder', 'Select')}\n disabled={booleanProperty(element, 'disabled', false)}\n />\n </div>\n );\n}\n"],"names":["PrimeTreeSelect","element","value","setValue","useState","stringProperty","_jsx","div","data-scene-id","id","TreeSelect","onChange","options","treeNodesProperty","placeholder","disabled","booleanProperty"],"mappings":";;;;;;AASA;;;;;;;;;;AAUC,IACM,SAASA,eAAAA,CAAgB,EAAEC,OAAO,EAA4B,EAAA;AACjE,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAA6BC,eAAeJ,OAAAA,EAAS,OAAA,CAAA,CAAA;AAC/E,IAAA,qBACIK,GAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAeP,QAAQQ,EAAE;AAC1B,QAAA,QAAA,gBAAAH,GAAA,CAACI,UAAAA,EAAAA;YACGR,KAAAA,EAAOA,KAAAA;YACPS,QAAAA,EAAUR,QAAAA;AACVS,YAAAA,OAAAA,EAASC,kBAAkBZ,OAAAA,EAAS,SAAA,CAAA;YACpCa,WAAAA,EAAaT,cAAAA,CAAeJ,SAAS,aAAA,EAAe,QAAA,CAAA;YACpDc,QAAAA,EAAUC,eAAAA,CAAgBf,SAAS,UAAA,EAAY,KAAA;;;AAI/D;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeSelect.js","sources":["../../../form/TreeSelect.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 { ReactNode, useMemo, useState } from 'react';\nimport { Popover } from 'primereact/popover';\nimport { Tree, type TreeNodeData } from 'primereact/tree';\nimport { TreeNode } from '../TreeNode';\n\n/**\n * What a {@link TreeSelect} needs from its host.\n *\n * Deliberately the small subset of PrimeReact 10's `TreeSelect` that a Scene element can actually author.\n * The component is Cratis-owned (see {@link TreeSelect}), so this is a promise this package has to keep\n * on its own - every prop added here is one more thing to implement, and a hierarchy picker earns its\n * keep long before it grows options.\n */\nexport interface TreeSelectProps {\n /**\n * The key of the selected node. Controlled, because the only thing worth selecting from a tree is a\n * node's identity and the host is what knows what to do with it.\n */\n value?: string;\n\n /**\n * The hierarchy to choose from, in Scene's own {@link TreeNode} shape rather than PrimeReact's -\n * `TreeNode` is this package's type since v11 removed `primereact/treenode`, and translating it is\n * this component's job rather than every caller's.\n */\n options: TreeNode[];\n\n /**\n * What the trigger shows when nothing is selected.\n */\n placeholder?: string;\n\n /**\n * Whether the trigger refuses to open.\n */\n disabled?: boolean;\n\n /**\n * Called with the newly selected node's key. Selecting also closes the panel, because a single-select\n * picker has nothing left to ask once it has an answer.\n */\n onChange?: (value: string) => void;\n}\n\n/**\n * A dropdown whose choices are a hierarchy - Cratis-owned, because PrimeReact 11 removed `TreeSelect`\n * outright and left neither a replacement component nor a headless hook to build one from.\n *\n * It is assembled from the two v11 pieces that did survive and together cover the behavior: `Popover`\n * provides the trigger, the portal and the outside-click and Escape handling, and `Tree` provides the\n * node list, the expand/collapse state and keyboard navigation. Nothing here re-implements either - the\n * component is the seam between them, plus the translation from Scene's {@link TreeNode} to the\n * `TreeNodeData` the tree wants.\n *\n * What it deliberately does not carry over from v10, so that no caller is misled into expecting it:\n * **checkbox multi-select** - selection is single, `onChange` yields one key, and there is no partial or\n * \"n selected\" state to reason about; and **filtering** - v10's `filter` prop searched the node labels\n * and rebuilt the visible tree around the matches, which is a real amount of behavior (match, keep\n * ancestors, force-expand, restore on clear) and belongs in the component only once something actually\n * needs it.\n */\nexport function TreeSelect({ value, options, placeholder, disabled, onChange }: TreeSelectProps) {\n const [open, setOpen] = useState(false);\n const nodes = useMemo(() => toTreeNodeData(options), [options]);\n const label = findLabel(nodes, value);\n\n return (\n <Popover.Root open={open} onOpenChange={(event) => setOpen(event.value === true)}>\n <Popover.Trigger disabled={disabled}>\n <span>{label ?? placeholder}</span>\n <i className='pi pi-chevron-down' />\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Positioner>\n <Popover.Popup>\n <Popover.Content>\n <Tree.Root\n value={nodes}\n selectionMode='single'\n selectionKeys={value === undefined ? {} : { [value]: true }}\n onSelectionChange={(event) => {\n const selected = Object.keys(event.value).find((key) => event.value[key] === true);\n if (selected === undefined) return;\n onChange?.(selected);\n setOpen(false);\n }}>\n <Tree.Nodes>\n {(row) => (\n <Tree.Node uKey={row.node.key}>\n <Tree.Content>\n <Tree.Toggle>\n <Tree.ToggleIndicator>\n <i className={row.expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'} />\n </Tree.ToggleIndicator>\n </Tree.Toggle>\n <Tree.Label>{row.node.label}</Tree.Label>\n </Tree.Content>\n </Tree.Node>\n )}\n </Tree.Nodes>\n </Tree.Root>\n </Popover.Content>\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n}\n\n/**\n * Converts Scene's {@link TreeNode} model into the one PrimeReact 11's `Tree` reads.\n *\n * The two shapes agree on everything that matters except one thing: `key` is optional on a Scene node and\n * required on a PrimeReact one, because the tree keys expansion and selection off it. A missing key is\n * synthesized from the node's position, which is unique and stable across re-renders - the same rule\n * `toTreeNodes` applies, repeated here so this component is correct even when handed nodes that did not\n * come through it.\n *\n * @param nodes The Scene nodes to convert.\n * @param parentKey The key of the node these belong to, used to build unique child keys.\n * @returns The converted nodes, in order.\n */\nfunction toTreeNodeData(nodes: TreeNode[], parentKey = ''): TreeNodeData[] {\n return nodes.map((node, index) => {\n const key = node.key ?? (parentKey === '' ? `${index}` : `${parentKey}-${index}`);\n return {\n key,\n label: node.label,\n icon: node.icon,\n children: node.children === undefined ? undefined : toTreeNodeData(node.children, key),\n };\n });\n}\n\n/**\n * Finds the label to show on the trigger for a selected key.\n *\n * The selection is a key rather than a node because that is all the tree reports, so the label has to be\n * looked back up - and it has to search the whole hierarchy, since the selected node is very rarely a\n * root one.\n *\n * @param nodes The converted nodes to search.\n * @param key The selected key, or `undefined` when nothing is selected.\n * @returns The node's label, or `undefined` when nothing is selected or the key matches no node.\n */\nfunction findLabel(nodes: TreeNodeData[], key: string | undefined): ReactNode {\n if (key === undefined) return undefined;\n for (const node of nodes) {\n if (node.key === key) return node.label;\n const found = node.children === undefined ? undefined : findLabel(node.children, key);\n if (found !== undefined) return found;\n }\n\n return undefined;\n}\n"],"names":["TreeSelect","value","options","placeholder","disabled","onChange","open","setOpen","useState","nodes","useMemo","toTreeNodeData","label","findLabel","_jsxs","Popover","Root","onOpenChange","event","Trigger","_jsx","span","i","className","Portal","Positioner","Popup","Content","Tree","selectionMode","selectionKeys","undefined","onSelectionChange","selected","Object","keys","find","key","Nodes","row","Node","uKey","node","Toggle","ToggleIndicator","expanded","Label","parentKey","map","index","icon","children","found"],"mappings":";;;;;AA+CA;;;;;;;;;;;;;;;;AAgBC,IACM,SAASA,UAAAA,CAAW,EAAEC,KAAK,EAAEC,OAAO,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,QAAQ,EAAmB,EAAA;AAC3F,IAAA,MAAM,CAACC,IAAAA,EAAMC,OAAAA,CAAQ,GAAGC,QAAAA,CAAS,KAAA,CAAA;AACjC,IAAA,MAAMC,KAAAA,GAAQC,OAAAA,CAAQ,IAAMC,cAAAA,CAAeT,OAAAA,CAAAA,EAAU;AAACA,QAAAA;AAAQ,KAAA,CAAA;IAC9D,MAAMU,KAAAA,GAAQC,UAAUJ,KAAAA,EAAOR,KAAAA,CAAAA;IAE/B,qBACIa,IAAA,CAACC,QAAQC,IAAI,EAAA;QAACV,IAAAA,EAAMA,IAAAA;AAAMW,QAAAA,YAAAA,EAAc,CAACC,KAAAA,GAAUX,OAAAA,CAAQW,KAAAA,CAAMjB,KAAK,KAAK,IAAA,CAAA;;AACvE,0BAAAa,IAAA,CAACC,QAAQI,OAAO,EAAA;gBAACf,QAAAA,EAAUA,QAAAA;;kCACvBgB,GAAA,CAACC,MAAAA,EAAAA;kCAAMT,KAAAA,IAAST;;kCAChBiB,GAAA,CAACE,GAAAA,EAAAA;wBAAEC,SAAAA,EAAU;;;;AAEjB,0BAAAH,GAAA,CAACL,QAAQS,MAAM,EAAA;wCACXJ,GAAA,CAACL,QAAQU,UAAU,EAAA;4CACfL,GAAA,CAACL,QAAQW,KAAK,EAAA;gDACVN,GAAA,CAACL,QAAQY,OAAO,EAAA;oDACZP,GAAA,CAACQ,KAAKZ,IAAI,EAAA;gCACNf,KAAAA,EAAOQ,KAAAA;gCACPoB,aAAAA,EAAc,QAAA;gCACdC,aAAAA,EAAe7B,KAAAA,KAAU8B,SAAAA,GAAY,EA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AAO,GAAG,CAAA,EAAGF,SAAAA,CAAU,CAAC,EAAEE,OAAO,CAAD;QAC/E,OAAO;AACHZ,YAAAA,GAAAA;AACAzB,YAAAA,KAAAA,EAAO8B,KAAK9B,KAAK;AACjBsC,YAAAA,IAAAA,EAAMR,KAAKQ,IAAI;YACfC,QAAAA,EAAUT,IAAAA,CAAKS,QAAQ,KAAKpB,SAAAA,GAAYA,YAAYpB,cAAAA,CAAe+B,IAAAA,CAAKS,QAAQ,EAAEd,GAAAA;AACtF,SAAA;AACJ,IAAA,CAAA,CAAA;AACJ;AAEA;;;;;;;;;;AAUC,IACD,SAASxB,SAAAA,CAAUJ,KAAqB,EAAE4B,GAAuB,EAAA;IAC7D,IAAIA,GAAAA,KAAQN,WAAW,OAAOA,SAAAA;IAC9B,KAAK,MAAMW,QAAQjC,KAAAA,CAAO;AACtB,QAAA,IAAIiC,KAAKL,GAAG,KAAKA,GAAAA,EAAK,OAAOK,KAAK9B,KAAK;QACvC,MAAMwC,KAAAA,GAAQV,KAAKS,QAAQ,KAAKpB,YAAYA,SAAAA,GAAYlB,SAAAA,CAAU6B,IAAAA,CAAKS,QAAQ,EAAEd,GAAAA,CAAAA;QACjF,IAAIe,KAAAA,KAAUrB,WAAW,OAAOqB,KAAAA;AACpC,IAAA;IAEA,OAAOrB,SAAAA;AACX;;;;"}
|
|
1
|
+
{"version":3,"file":"TreeSelect.js","sources":["../../../form/TreeSelect.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 { ReactNode, useMemo, useState } from 'react';\nimport { Popover } from 'primereact/popover';\nimport { Tree, type TreeNodeData } from 'primereact/tree';\nimport { TreeNode } from '../TreeNode';\n\n/**\n * What a {@link TreeSelect} needs from its host.\n *\n * Deliberately the small subset of PrimeReact 10's `TreeSelect` that a Scene element can actually author.\n * The component is Cratis-owned (see {@link TreeSelect}), so this is a promise this package has to keep\n * on its own - every prop added here is one more thing to implement, and a hierarchy picker earns its\n * keep long before it grows options.\n */\nexport interface TreeSelectProps {\n /**\n * The key of the selected node. Controlled, because the only thing worth selecting from a tree is a\n * node's identity and the host is what knows what to do with it.\n */\n value?: string;\n\n /**\n * The hierarchy to choose from, in Scene's own {@link TreeNode} shape rather than PrimeReact's -\n * `TreeNode` is this package's type since v11 removed `primereact/treenode`, and translating it is\n * this component's job rather than every caller's.\n */\n options: TreeNode[];\n\n /**\n * What the trigger shows when nothing is selected.\n */\n placeholder?: string;\n\n /**\n * Whether the trigger refuses to open.\n */\n disabled?: boolean;\n\n /**\n * Called with the newly selected node's key. Selecting also closes the panel, because a single-select\n * picker has nothing left to ask once it has an answer.\n */\n onChange?: (value: string) => void;\n}\n\n/**\n * A dropdown whose choices are a hierarchy - Cratis-owned, because PrimeReact 11 removed `TreeSelect`\n * outright and left neither a replacement component nor a headless hook to build one from.\n *\n * It is assembled from the two v11 pieces that did survive and together cover the behavior: `Popover`\n * provides the trigger, the portal and the outside-click and Escape handling, and `Tree` provides the\n * node list, the expand/collapse state and keyboard navigation. Nothing here re-implements either - the\n * component is the seam between them, plus the translation from Scene's {@link TreeNode} to the\n * `TreeNodeData` the tree wants.\n *\n * What it deliberately does not carry over from v10, so that no caller is misled into expecting it:\n * **checkbox multi-select** - selection is single, `onChange` yields one key, and there is no partial or\n * \"n selected\" state to reason about; and **filtering** - v10's `filter` prop searched the node labels\n * and rebuilt the visible tree around the matches, which is a real amount of behavior (match, keep\n * ancestors, force-expand, restore on clear) and belongs in the component only once something actually\n * needs it.\n */\nexport function TreeSelect({ value, options, placeholder, disabled, onChange }: TreeSelectProps) {\n const [open, setOpen] = useState(false);\n const nodes = useMemo(() => toTreeNodeData(options), [options]);\n const label = findLabel(nodes, value);\n\n return (\n <Popover.Root open={open} onOpenChange={(event) => setOpen(event.value === true)}>\n <Popover.Trigger disabled={disabled}>\n <span>{label ?? placeholder}</span>\n <i className='pi pi-chevron-down' />\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Positioner>\n <Popover.Popup>\n <Popover.Content>\n <Tree.Root\n value={nodes}\n selectionMode='single'\n selectionKeys={value === undefined ? {} : { [value]: true }}\n onSelectionChange={(event) => {\n const selected = Object.keys(event.value).find((key) => event.value[key] === true);\n if (selected === undefined) return;\n onChange?.(selected);\n setOpen(false);\n }}>\n <Tree.Nodes>\n {(row) => (\n <Tree.Node uKey={row.node.key}>\n <Tree.Content>\n <Tree.Toggle>\n <Tree.ToggleIndicator>\n <i className={row.expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'} />\n </Tree.ToggleIndicator>\n </Tree.Toggle>\n <Tree.Label>{row.node.label}</Tree.Label>\n </Tree.Content>\n </Tree.Node>\n )}\n </Tree.Nodes>\n </Tree.Root>\n </Popover.Content>\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n}\n\n/**\n * Converts Scene's {@link TreeNode} model into the one PrimeReact 11's `Tree` reads.\n *\n * The two shapes agree on everything that matters except one thing: `key` is optional on a Scene node and\n * required on a PrimeReact one, because the tree keys expansion and selection off it. A missing key is\n * synthesized from the node's position, which is unique and stable across re-renders - the same rule\n * `toTreeNodes` applies, repeated here so this component is correct even when handed nodes that did not\n * come through it.\n *\n * @param nodes The Scene nodes to convert.\n * @param parentKey The key of the node these belong to, used to build unique child keys.\n * @returns The converted nodes, in order.\n */\nfunction toTreeNodeData(nodes: TreeNode[], parentKey = ''): TreeNodeData[] {\n return nodes.map((node, index) => {\n const key = node.key ?? (parentKey === '' ? `${index}` : `${parentKey}-${index}`);\n return {\n key,\n label: node.label,\n icon: node.icon,\n children: node.children === undefined ? undefined : toTreeNodeData(node.children, key),\n };\n });\n}\n\n/**\n * Finds the label to show on the trigger for a selected key.\n *\n * The selection is a key rather than a node because that is all the tree reports, so the label has to be\n * looked back up - and it has to search the whole hierarchy, since the selected node is very rarely a\n * root one.\n *\n * @param nodes The converted nodes to search.\n * @param key The selected key, or `undefined` when nothing is selected.\n * @returns The node's label, or `undefined` when nothing is selected or the key matches no node.\n */\nfunction findLabel(nodes: TreeNodeData[], key: string | undefined): ReactNode {\n if (key === undefined) return undefined;\n for (const node of nodes) {\n if (node.key === key) return node.label;\n const found = node.children === undefined ? undefined : findLabel(node.children, key);\n if (found !== undefined) return found;\n }\n\n return undefined;\n}\n"],"names":["TreeSelect","value","options","placeholder","disabled","onChange","open","setOpen","useState","nodes","useMemo","toTreeNodeData","label","findLabel","_jsxs","Popover","Root","onOpenChange","event","Trigger","_jsx","span","i","className","Portal","Positioner","Popup","Content","Tree","selectionMode","selectionKeys","undefined","onSelectionChange","selected","Object","keys","find","key","Nodes","row","Node","uKey","node","Toggle","ToggleIndicator","expanded","Label","parentKey","map","index","icon","children","found"],"mappings":";;;;;AA+CA;;;;;;;;;;;;;;;;AAgBC,IACM,SAASA,UAAAA,CAAW,EAAEC,KAAK,EAAEC,OAAO,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,QAAQ,EAAmB,EAAA;AAC3F,IAAA,MAAM,CAACC,IAAAA,EAAMC,OAAAA,CAAQ,GAAGC,QAAAA,CAAS,KAAA,CAAA;AACjC,IAAA,MAAMC,KAAAA,GAAQC,OAAAA,CAAQ,IAAMC,cAAAA,CAAeT,OAAAA,CAAAA,EAAU;AAACA,QAAAA;AAAQ,KAAA,CAAA;IAC9D,MAAMU,KAAAA,GAAQC,UAAUJ,KAAAA,EAAOR,KAAAA,CAAAA;IAE/B,qBACIa,IAAA,CAACC,QAAQC,IAAI,EAAA;QAACV,IAAAA,EAAMA,IAAAA;AAAMW,QAAAA,YAAAA,EAAc,CAACC,KAAAA,GAAUX,OAAAA,CAAQW,KAAAA,CAAMjB,KAAK,KAAK,IAAA,CAAA;;AACvE,0BAAAa,IAAA,CAACC,QAAQI,OAAO,EAAA;gBAACf,QAAAA,EAAUA,QAAAA;;kCACvBgB,GAAA,CAACC,MAAAA,EAAAA;kCAAMT,KAAAA,IAAST;;kCAChBiB,GAAA,CAACE,GAAAA,EAAAA;wBAAEC,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],"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 { HTMLAttributes, useState } from 'react';\nimport { Dialog } from 'primereact/dialog';\n\n/**\n * Configuration for {@link Image}.\n */\nexport interface ImageProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {\n /**\n * Where the picture comes from. Optional because a screen under construction routinely names an image\n * before it has one, and that is not a failure worth taking a page down for.\n */\n src?: string;\n\n /**\n * The alternative text. Defaults to empty, which marks the image decorative - an image with no\n * authored alternative is decorative until someone says otherwise, and inventing text from the file\n * name would put a URL fragment in front of a screen reader.\n */\n alt?: string;\n\n /**\n * The rendered width, as any CSS length or a bare pixel count.\n */\n width?: string;\n\n /**\n * The rendered height, as any CSS length or a bare pixel count.\n */\n height?: string;\n\n /**\n * Whether clicking the image opens it full size in an overlay. Off by default: a picture that grows\n * when clicked is a promise, and one made on every thumbnail in a layout is usually a mistake.\n */\n preview?: boolean;\n}\n\n/**\n * A picture, optionally openable full size in an overlay.\n *\n * Cratis owns this component. PrimeReact 10 had `Image`; PrimeReact 11 removed it with no replacement and\n * no headless hook, while `image` remains a name this package's manifest publishes. The plain case is a\n * plain `img` - there was never much to a themed image - and the preview reuses PrimeReact 11's `Dialog`,\n * which survived, so the overlay keeps the application's focus trapping, escape handling and stacking\n * rather than growing a second, worse implementation of all three here.\n *\n * With no `src`, an empty element is rendered rather than a broken `img`. That keeps whatever identifying\n * attributes the caller passed in the document, which is what lets a design-time tool still find and\n * select the element it has not finished authoring.\n *\n * What it deliberately does not carry over from v10: the preview toolbar - zoom in and out, rotate, flip,\n * download - which is a viewer rather than an image and is exactly what the `galleria` component is for;\n * `indicatorIcon` and the hover indicator overlay; the `imageStyle` / `previewStyle` prop pairs, since\n * `className` and `style` already reach the element; and `zoomInDisabled` / `zoomOutDisabled`, which only\n * ever meant anything to that toolbar.\n */\nexport function Image({ src, alt = '', width, height, preview = false, className, ...rest }: ImageProps) {\n const [open, setOpen] = useState(false);\n\n if (src === undefined || src === '') return <span {...rest} className={className} />;\n\n const image = <img src={src} alt={alt} width={width} height={height} className='max-w-full' />;\n\n if (!preview) {\n return (\n <span {...rest} className={className}>\n {image}\n </span>\n );\n }\n\n return (\n <span {...rest} className={className}>\n <button\n type='button'\n className='cursor-zoom-in border-0 bg-transparent p-0'\n aria-label={alt === '' ? 'Open image preview' : `Open preview of ${alt}`}\n onClick={() => setOpen(true)}>\n {image}\n </button>\n <Dialog.Root open={open} onOpenChange={(event) => setOpen(event.value === true)} modal dismissable>\n <Dialog.Portal>\n <Dialog.Backdrop />\n <Dialog.Positioner>\n <Dialog.Popup>\n <Dialog.Header>\n <Dialog.Title>{alt === '' ? 'Preview' : alt}</Dialog.Title>\n <Dialog.Close aria-label='Close preview'>\n <i className='pi pi-times' aria-hidden='true' />\n </Dialog.Close>\n </Dialog.Header>\n <Dialog.Content>\n <img src={src} alt={alt} className='max-h-[80vh] max-w-[80vw]' />\n </Dialog.Content>\n </Dialog.Popup>\n </Dialog.Positioner>\n </Dialog.Portal>\n </Dialog.Root>\n </span>\n );\n}\n"],"names":["Image","src","alt","width","height","preview","className","rest","open","setOpen","useState","undefined","_jsx","span","image","img","_jsxs","button","type","aria-label","onClick","Dialog","Root","onOpenChange","event","value","modal","dismissable","Portal","Backdrop","Positioner","Popup","Header","Title","Close","i","aria-hidden","Content"],"mappings":";;;;AAwCA;;;;;;;;;;;;;;;;;;AAkBC,IACM,SAASA,KAAAA,CAAM,EAAEC,GAAG,EAAEC,MAAM,EAAE,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAAA,GAAU,KAAK,EAAEC,SAAS,EAAE,GAAGC,IAAAA,EAAkB,EAAA;AACnG,IAAA,MAAM,CAACC,IAAAA,EAAMC,OAAAA,CAAQ,GAAGC,QAAAA,CAAS,KAAA,CAAA;AAEjC,IAAA,IAAIT,GAAAA,KAAQU,SAAAA,IAAaV,GAAAA,KAAQ,EAAA,EAAI,qBAAOW,GAAA,CAACC,M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,EAAA;;AACT,kDAAAf,IAAA,CAACK,OAAOW,MAAM,EAAA;;AACV,0DAAApB,GAAA,CAACS,OAAOY,KAAK,EAAA;AAAE/B,gDAAAA,QAAAA,EAAAA,GAAAA,KAAQ,KAAK,SAAA,GAAYA;;AACxC,0DAAAU,GAAA,CAACS,OAAOa,KAAK,EAAA;gDAACf,YAAAA,EAAW,eAAA;AACrB,gDAAA,QAAA,gBAAAP,GAAA,CAACuB,GAAAA,EAAAA;oDAAE7B,SAAAA,EAAU,aAAA;oDAAc8B,aAAAA,EAAY;;;;;AAG/C,kDAAAxB,GAAA,CAACS,OAAOgB,OAAO,EAAA;AACX,wCAAA,QAAA,gBAAAzB,GAAA,CAACG,KAAAA,EAAAA;4CAAId,GAAAA,EAAKA,GAAAA;4CAAKC,GAAAA,EAAKA,GAAAA;4CAAKI,SAAAA,EAAU;;;;;;;;;;;AAQnE
|
|
1
|
+
{"version":3,"file":"Image.js","sources":["../../../media/Image.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 { HTMLAttributes, useState } from 'react';\nimport { Dialog } from 'primereact/dialog';\n\n/**\n * Configuration for {@link Image}.\n */\nexport interface ImageProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {\n /**\n * Where the picture comes from. Optional because a screen under construction routinely names an image\n * before it has one, and that is not a failure worth taking a page down for.\n */\n src?: string;\n\n /**\n * The alternative text. Defaults to empty, which marks the image decorative - an image with no\n * authored alternative is decorative until someone says otherwise, and inventing text from the file\n * name would put a URL fragment in front of a screen reader.\n */\n alt?: string;\n\n /**\n * The rendered width, as any CSS length or a bare pixel count.\n */\n width?: string;\n\n /**\n * The rendered height, as any CSS length or a bare pixel count.\n */\n height?: string;\n\n /**\n * Whether clicking the image opens it full size in an overlay. Off by default: a picture that grows\n * when clicked is a promise, and one made on every thumbnail in a layout is usually a mistake.\n */\n preview?: boolean;\n}\n\n/**\n * A picture, optionally openable full size in an overlay.\n *\n * Cratis owns this component. PrimeReact 10 had `Image`; PrimeReact 11 removed it with no replacement and\n * no headless hook, while `image` remains a name this package's manifest publishes. The plain case is a\n * plain `img` - there was never much to a themed image - and the preview reuses PrimeReact 11's `Dialog`,\n * which survived, so the overlay keeps the application's focus trapping, escape handling and stacking\n * rather than growing a second, worse implementation of all three here.\n *\n * With no `src`, an empty element is rendered rather than a broken `img`. That keeps whatever identifying\n * attributes the caller passed in the document, which is what lets a design-time tool still find and\n * select the element it has not finished authoring.\n *\n * What it deliberately does not carry over from v10: the preview toolbar - zoom in and out, rotate, flip,\n * download - which is a viewer rather than an image and is exactly what the `galleria` component is for;\n * `indicatorIcon` and the hover indicator overlay; the `imageStyle` / `previewStyle` prop pairs, since\n * `className` and `style` already reach the element; and `zoomInDisabled` / `zoomOutDisabled`, which only\n * ever meant anything to that toolbar.\n */\nexport function Image({ src, alt = '', width, height, preview = false, className, ...rest }: ImageProps) {\n const [open, setOpen] = useState(false);\n\n if (src === undefined || src === '') return <span {...rest} className={className} />;\n\n const image = <img src={src} alt={alt} width={width} height={height} className='max-w-full' />;\n\n if (!preview) {\n return (\n <span {...rest} className={className}>\n {image}\n </span>\n );\n }\n\n return (\n <span {...rest} className={className}>\n <button\n type='button'\n className='cursor-zoom-in border-0 bg-transparent p-0'\n aria-label={alt === '' ? 'Open image preview' : `Open preview of ${alt}`}\n onClick={() => setOpen(true)}>\n {image}\n </button>\n <Dialog.Root open={open} onOpenChange={(event) => setOpen(event.value === true)} modal dismissable>\n <Dialog.Portal>\n <Dialog.Backdrop />\n <Dialog.Positioner>\n <Dialog.Popup>\n <Dialog.Header>\n <Dialog.Title>{alt === '' ? 'Preview' : alt}</Dialog.Title>\n <Dialog.Close aria-label='Close preview'>\n <i className='pi pi-times' aria-hidden='true' />\n </Dialog.Close>\n </Dialog.Header>\n <Dialog.Content>\n <img src={src} alt={alt} className='max-h-[80vh] max-w-[80vw]' />\n </Dialog.Content>\n </Dialog.Popup>\n </Dialog.Positioner>\n </Dialog.Portal>\n </Dialog.Root>\n </span>\n );\n}\n"],"names":["Image","src","alt","width","height","preview","className","rest","open","setOpen","useState","undefined","_jsx","span","image","img","_jsxs","button","type","aria-label","onClick","Dialog","Root","onOpenChange","event","value","modal","dismissable","Portal","Backdrop","Positioner","Popup","Header","Title","Close","i","aria-hidden","Content"],"mappings":";;;;AAwCA;;;;;;;;;;;;;;;;;;AAkBC,IACM,SAASA,KAAAA,CAAM,EAAEC,GAAG,EAAEC,MAAM,EAAE,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAAA,GAAU,KAAK,EAAEC,SAAS,EAAE,GAAGC,IAAAA,EAAkB,EAAA;AACnG,IAAA,MAAM,CAACC,IAAAA,EAAMC,OAAAA,CAAQ,GAAGC,QAAAA,CAAS,KAAA,CAAA;AAEjC,IAAA,IAAIT,GAAAA,KAAQU,SAAAA,IAAaV,GAAAA,KAAQ,EAAA,EAAI,qBAAOW,GAAA,CAACC,MAAAA,EAAAA;AAAM,QAAA,GAAGN,IAAI;QAAED,SAAAA,EAAWA;;AAEvE,IAAA,MAAMQ,sBAAQF,GAAA,CAACG,KAAAA,EAAAA;QAAId,GAAAA,EAAKA,GAAAA;QAAKC,GAAAA,EAAKA,GAAAA;QAAKC,KAAAA,EAAOA,KAAAA;QAAOC,MAAAA,EAAQA,MAAAA;QAAQE,SAAAA,EAAU;;AAE/E,IAAA,IAAI,CAACD,OAAAA,EAAS;AACV,QAAA,qBACIO,GAAA,CAACC,MAAAA,EAAAA;AAAM,YAAA,GAAGN,IAAI;YAAED,SAAAA,EAAWA,SAAAA;AACtBQ,YAAAA,QAAAA,EAAAA;;AAGb,IAAA;AAEA,IAAA,qBACIE,IAAA,CAACH,MAAAA,EAAAA;AAAM,QAAA,GAAGN,IAAI;QAAED,SAAAA,EAAWA,SAAAA;;0BACvBM,GAAA,CAACK,QAAAA,EAAAA;gBACGC,IAAAA,EAAK,QAAA;gBACLZ,SAAAA,EAAU,4CAAA;AACVa,gB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eCarousel.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 { Carousel } from 'primereact/carousel';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, recordArrayProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:carousel` component - a row of items paged through horizontally.\n *\n * The item body is built from the `titleField` and `descriptionField` properties, for the same reason\n * `dataView` does it: the element carries records, not markup, and something has to decide which two\n * fields a reader sees. PrimeReact 11 takes that as children rather than as an `itemTemplate` callback,\n * which is why the mapping is written out here instead of passed in.\n *\n * v10's `numScroll` has no v11 counterpart and is not read: the new carousel scrolls by a page, and a page\n * is `numVisible` items. Honoring a `numScroll` that differs from it would mean re-implementing paging\n * against a component that has its own.\n *\n * Navigation and page indicators appear only when there is more than one page's worth of items. A control\n * that cannot do anything is worse than an absent one - it invites a click and answers with nothing.\n */\nexport function PrimeCarousel({ element }: RegisteredComponentProps) {\n const items = recordArrayProperty(element, 'items');\n const titleField = stringProperty(element, 'titleField', 'title');\n const descriptionField = stringProperty(element, 'descriptionField', 'description');\n const numVisible = numberProperty(element, 'numVisible', 3);\n return (\n <Carousel.Root data-scene-id={element.id} slidesPerPage={numVisible} loop={booleanProperty(element, 'circular', false)}>\n <Carousel.Content>\n {items.map((item, index) => (\n <Carousel.Item key={index}>\n <div className='m-2 flex flex-col gap-1 border p-3'>\n <span className='font-semibold'>{String(item[titleField] ?? '')}</span>\n <span className='text-sm opacity-75'>{String(item[descriptionField] ?? '')}</span>\n </div>\n </Carousel.Item>\n ))}\n </Carousel.Content>\n {items.length > numVisible && (\n <>\n <Carousel.Prev aria-label='Previous items'>\n <i className='pi pi-chevron-left' aria-hidden='true' />\n </Carousel.Prev>\n <Carousel.Next aria-label='Next items'>\n <i className='pi pi-chevron-right' aria-hidden='true' />\n </Carousel.Next>\n <Carousel.Indicators />\n </>\n )}\n </Carousel.Root>\n );\n}\n"],"names":["PrimeCarousel","element","items","recordArrayProperty","titleField","stringProperty","descriptionField","numVisible","numberProperty","_jsxs","Carousel","Root","data-scene-id","id","slidesPerPage","loop","booleanProperty","_jsx","Content","map","item","index","Item","div","className","span","String","length","_Fragment","Prev","aria-label","i","aria-hidden","Next","Indicators"],"mappings":";;;;AAOA;;;;;;;;;;;;;;AAcC,IACM,SAASA,aAAAA,CAAc,EAAEC,OAAO,EAA4B,EAAA;IAC/D,MAAMC,KAAAA,GAAQC,oBAAoBF,OAAAA,EAAS,OAAA,CAAA;IAC3C,MAAMG,UAAAA,GAAaC,cAAAA,CAAeJ,OAAAA,EAAS,YAAA,EAAc,OAAA,CAAA;IACzD,MAAMK,gBAAAA,GAAmBD,cAAAA,CAAeJ,OAAAA,EAAS,kBAAA,EAAoB,aAAA,CAAA;IACrE,MAAMM,UAAAA,GAAaC,cAAAA,CAAeP,OAAAA,EAAS,YAAA,EAAc,CAAA,CAAA;IACzD,qBACIQ,IAAA,CAACC,SAASC,IAAI,EAAA;AAACC,QAAAA,eAAAA,EAAeX,QAAQY,EAAE;QAAEC,aAAAA,EAAeP,UAAAA;QAAYQ,IAAAA,EAAMC,eAAAA,CAAgBf,SAAS,UAAA,EAAY,KAAA,CAAA;;AAC5G,0BAAAgB,GAAA,CAACP,SAASQ,OAAO,EAAA;AACZhB,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMiB,GAAG,CAAC,CAACC,MAAMC,KAAAA,iBACdJ,GAAA,CAACP,SAASY,IAAI,EAAA;AACV,wBAAA,QAAA,gBAAAb,IAAA,CAACc,KAAAA,EAAAA;4BAAIC,SAAAA,EAAU,oCAAA;;8CACXP,GAAA,CAACQ,MAAAA,EAAAA;oCAAKD,SAAAA,EAAU,eAAA;8CAAiBE,MAAAA,CAAON,IAAI,CAAChB,UAAAA,CAAW,IAAI,EAAA;;8CAC5Da,GAAA,CAACQ,MAAAA,EAAAA;oCAAKD,SAAAA,EAAU,oBAAA;8CAAsBE,MAAAA,CAAON,IAAI,CAACd,gBAAAA,CAAiB,IAAI,EAAA;;;;AAH3De,qBAAAA,EAAAA,KAAAA,CAAAA;;YAQ3BnB,KAAAA,CAAMyB,MAAM,GAAGpB,UAAAA,kBACZE,IAAA,CAAAmB,QAAA,EAAA;;AACI,kCAAAX,GAAA,CAACP,SAASmB,IAAI,EAAA;wBAACC,YAAAA,EAAW,gBAAA;AACtB,wBAAA,QAAA,gBAAAb,GAAA,CAACc,GAAAA,EAAAA;4BAAEP,SAAAA,EAAU,oBAAA;4BAAqBQ,aAAAA,EAAY;;;AAElD,kCAAAf,GAAA,CAACP,SAASuB,IAAI,EAAA;wBAACH,YAAAA,EAAW,YAAA;AACtB,wBAAA,QAAA,gBAAAb,GAAA,CAACc,GAAAA,EAAAA;4BAAEP,SAAAA,EAAU,qBAAA;4BAAsBQ,aAAAA,EAAY;;;AAEnD,kCAAAf,GAAA,CAACP,SAASwB,UAAU,EAAA,EAAA;;;;;AAKxC
|
|
1
|
+
{"version":3,"file":"PrimeCarousel.js","sources":["../../../media/PrimeCarousel.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 { Carousel } from 'primereact/carousel';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, recordArrayProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:carousel` component - a row of items paged through horizontally.\n *\n * The item body is built from the `titleField` and `descriptionField` properties, for the same reason\n * `dataView` does it: the element carries records, not markup, and something has to decide which two\n * fields a reader sees. PrimeReact 11 takes that as children rather than as an `itemTemplate` callback,\n * which is why the mapping is written out here instead of passed in.\n *\n * v10's `numScroll` has no v11 counterpart and is not read: the new carousel scrolls by a page, and a page\n * is `numVisible` items. Honoring a `numScroll` that differs from it would mean re-implementing paging\n * against a component that has its own.\n *\n * Navigation and page indicators appear only when there is more than one page's worth of items. A control\n * that cannot do anything is worse than an absent one - it invites a click and answers with nothing.\n */\nexport function PrimeCarousel({ element }: RegisteredComponentProps) {\n const items = recordArrayProperty(element, 'items');\n const titleField = stringProperty(element, 'titleField', 'title');\n const descriptionField = stringProperty(element, 'descriptionField', 'description');\n const numVisible = numberProperty(element, 'numVisible', 3);\n return (\n <Carousel.Root data-scene-id={element.id} slidesPerPage={numVisible} loop={booleanProperty(element, 'circular', false)}>\n <Carousel.Content>\n {items.map((item, index) => (\n <Carousel.Item key={index}>\n <div className='m-2 flex flex-col gap-1 border p-3'>\n <span className='font-semibold'>{String(item[titleField] ?? '')}</span>\n <span className='text-sm opacity-75'>{String(item[descriptionField] ?? '')}</span>\n </div>\n </Carousel.Item>\n ))}\n </Carousel.Content>\n {items.length > numVisible && (\n <>\n <Carousel.Prev aria-label='Previous items'>\n <i className='pi pi-chevron-left' aria-hidden='true' />\n </Carousel.Prev>\n <Carousel.Next aria-label='Next items'>\n <i className='pi pi-chevron-right' aria-hidden='true' />\n </Carousel.Next>\n <Carousel.Indicators />\n </>\n )}\n </Carousel.Root>\n );\n}\n"],"names":["PrimeCarousel","element","items","recordArrayProperty","titleField","stringProperty","descriptionField","numVisible","numberProperty","_jsxs","Carousel","Root","data-scene-id","id","slidesPerPage","loop","booleanProperty","_jsx","Content","map","item","index","Item","div","className","span","String","length","_Fragment","Prev","aria-label","i","aria-hidden","Next","Indicators"],"mappings":";;;;AAOA;;;;;;;;;;;;;;AAcC,IACM,SAASA,aAAAA,CAAc,EAAEC,OAAO,EAA4B,EAAA;IAC/D,MAAMC,KAAAA,GAAQC,oBAAoBF,OAAAA,EAAS,OAAA,CAAA;IAC3C,MAAMG,UAAAA,GAAaC,cAAAA,CAAeJ,OAAAA,EAAS,YAAA,EAAc,OAAA,CAAA;IACzD,MAAMK,gBAAAA,GAAmBD,cAAAA,CAAeJ,OAAAA,EAAS,kBAAA,EAAoB,aAAA,CAAA;IACrE,MAAMM,UAAAA,GAAaC,cAAAA,CAAeP,OAAAA,EAAS,YAAA,EAAc,CAAA,CAAA;IACzD,qBACIQ,IAAA,CA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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeGalleria.js","sources":["../../../media/PrimeGalleria.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 { Gallery } from 'primereact/gallery';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, recordArrayProperty } from '../properties';\n\n/**\n * The `PrimeReact:galleria` component - a gallery with thumbnails and a large view.\n *\n * PrimeReact 11 renamed the module to `gallery` and turned it into a composition, which removes the\n * awkwardness the v10 adapter had to work around: there are no `item` and `thumbnail` render-prop\n * templates to supply, only two lists the adapter writes out itself. Each entry is still read as\n * `{ src, thumbnail, alt }`, with the thumbnail falling back to the full image - the common case for a\n * small gallery that has no separately generated thumbnails.\n *\n * The abstract name stays `galleria`. Renaming it would be renaming Scene's vocabulary because PrimeReact\n * renamed a module, and every screen that says `galleria` today would have to be edited to say the same\n * thing.\n *\n * Navigation and the thumbnail rail are rendered only when there is something to navigate: a single image\n * needs no previous and next, and no items at all leave a bare, empty gallery rather than a frame of\n * chrome around nothing.\n */\nexport function PrimeGalleria({ element }: RegisteredComponentProps) {\n const items = recordArrayProperty(element, 'items');\n const showThumbnails = booleanProperty(element, 'showThumbnails', true);\n return (\n <Gallery.Root data-scene-id={element.id} style={{ maxWidth: `${numberProperty(element, 'maxWidth', 480)}px` }}>\n <Gallery.Content>\n {items.map((item, index) => (\n <Gallery.Item key={index}>\n <img src={String(item.src ?? '')} alt={String(item.alt ?? '')} className='block w-full' />\n </Gallery.Item>\n ))}\n {items.length > 1 && (\n <>\n <Gallery.Prev aria-label='Previous image'>\n <i className='pi pi-chevron-left' aria-hidden='true' />\n </Gallery.Prev>\n <Gallery.Next aria-label='Next image'>\n <i className='pi pi-chevron-right' aria-hidden='true' />\n </Gallery.Next>\n </>\n )}\n </Gallery.Content>\n {showThumbnails && items.length > 1 && (\n <Gallery.Thumbnail slidesPerPage={numberProperty(element, 'numVisible', 5)} loop={booleanProperty(element, 'circular', true)}>\n <Gallery.ThumbnailContent>\n {items.map((item, index) => (\n <Gallery.ThumbnailItem key={index} index={index}>\n <img src={String(item.thumbnail ?? item.src ?? '')} alt={String(item.alt ?? '')} className='block h-12' />\n </Gallery.ThumbnailItem>\n ))}\n </Gallery.ThumbnailContent>\n </Gallery.Thumbnail>\n )}\n </Gallery.Root>\n );\n}\n"],"names":["PrimeGalleria","element","items","recordArrayProperty","showThumbnails","booleanProperty","_jsxs","Gallery","Root","data-scene-id","id","style","maxWidth","numberProperty","Content","map","item","index","_jsx","Item","img","src","String","alt","className","length","_Fragment","Prev","aria-label","i","aria-hidden","Next","Thumbnail","slidesPerPage","loop","ThumbnailContent","ThumbnailItem","thumbnail"],"mappings":";;;;AAOA;;;;;;;;;;;;;;;;AAgBC,IACM,SAASA,aAAAA,CAAc,EAAEC,OAAO,EAA4B,EAAA;IAC/D,MAAMC,KAAAA,GAAQC,oBAAoBF,OAAAA,EAAS,OAAA,CAAA;IAC3C,MAAMG,cAAAA,GAAiBC,eAAAA,CAAgBJ,OAAAA,EAAS,gBAAA,EAAkB,IAAA,CAAA;IAClE,qBACIK,IAAA,CAACC,QAAQC,IAAI,EAAA;AAACC,QAAAA,eAAAA,EAAeR,QAAQS,EAAE;QAAEC,KAAAA,EAAO;AAAEC,YAAAA,QAAAA,EAAU,GAAGC,cAAAA,CAAeZ,OAAAA,EAAS,UAAA,EAAY,GAAA,CAAA,CAAK,EAAE;AAAE,SAAA;;AACxG,0BAAAK,IAAA,CAACC,QAAQO,OAAO,EAAA;;AACXZ,oBAAAA,KAAAA,CAAMa,GAAG,CAAC,CAACC,MAAMC,KAAAA,iBACdC,GAAA,CAACX,QAAQY,IAAI,EAAA;AACT,4BAAA,QAAA,gBAAAD,GAAA,CAACE,KAAAA,EAAAA;gCAAIC,GAAAA,EAAKC,MAAAA,CAAON,IAAAA,CAAKK,GAAG,IAAI,EAAA,CAAA;gCAAKE,GAAAA,EAAKD,MAAAA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CAAKC,SAAAA,EAAU;;AADnEP,yBAAAA,EAAAA,KAAAA,CAAAA;;;;;AASxD
|
|
1
|
+
{"version":3,"file":"PrimeGalleria.js","sources":["../../../media/PrimeGalleria.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 { Gallery } from 'primereact/gallery';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, recordArrayProperty } from '../properties';\n\n/**\n * The `PrimeReact:galleria` component - a gallery with thumbnails and a large view.\n *\n * PrimeReact 11 renamed the module to `gallery` and turned it into a composition, which removes the\n * awkwardness the v10 adapter had to work around: there are no `item` and `thumbnail` render-prop\n * templates to supply, only two lists the adapter writes out itself. Each entry is still read as\n * `{ src, thumbnail, alt }`, with the thumbnail falling back to the full image - the common case for a\n * small gallery that has no separately generated thumbnails.\n *\n * The abstract name stays `galleria`. Renaming it would be renaming Scene's vocabulary because PrimeReact\n * renamed a module, and every screen that says `galleria` today would have to be edited to say the same\n * thing.\n *\n * Navigation and the thumbnail rail are rendered only when there is something to navigate: a single image\n * needs no previous and next, and no items at all leave a bare, empty gallery rather than a frame of\n * chrome around nothing.\n */\nexport function PrimeGalleria({ element }: RegisteredComponentProps) {\n const items = recordArrayProperty(element, 'items');\n const showThumbnails = booleanProperty(element, 'showThumbnails', true);\n return (\n <Gallery.Root data-scene-id={element.id} style={{ maxWidth: `${numberProperty(element, 'maxWidth', 480)}px` }}>\n <Gallery.Content>\n {items.map((item, index) => (\n <Gallery.Item key={index}>\n <img src={String(item.src ?? '')} alt={String(item.alt ?? '')} className='block w-full' />\n </Gallery.Item>\n ))}\n {items.length > 1 && (\n <>\n <Gallery.Prev aria-label='Previous image'>\n <i className='pi pi-chevron-left' aria-hidden='true' />\n </Gallery.Prev>\n <Gallery.Next aria-label='Next image'>\n <i className='pi pi-chevron-right' aria-hidden='true' />\n </Gallery.Next>\n </>\n )}\n </Gallery.Content>\n {showThumbnails && items.length > 1 && (\n <Gallery.Thumbnail slidesPerPage={numberProperty(element, 'numVisible', 5)} loop={booleanProperty(element, 'circular', true)}>\n <Gallery.ThumbnailContent>\n {items.map((item, index) => (\n <Gallery.ThumbnailItem key={index} index={index}>\n <img src={String(item.thumbnail ?? item.src ?? '')} alt={String(item.alt ?? '')} className='block h-12' />\n </Gallery.ThumbnailItem>\n ))}\n </Gallery.ThumbnailContent>\n </Gallery.Thumbnail>\n )}\n </Gallery.Root>\n );\n}\n"],"names":["PrimeGalleria","element","items","recordArrayProperty","showThumbnails","booleanProperty","_jsxs","Gallery","Root","data-scene-id","id","style","maxWidth","numberProperty","Content","map","item","index","_jsx","Item","img","src","String","alt","className","length","_Fragment","Prev","aria-label","i","aria-hidden","Next","Thumbnail","slidesPerPage","loop","ThumbnailContent","ThumbnailItem","thumbnail"],"mappings":";;;;AAOA;;;;;;;;;;;;;;;;AAgBC,IACM,SAASA,aAAAA,CAAc,EAAEC,OAAO,EAA4B,EAAA;IAC/D,MAAMC,KAAAA,GAAQC,oBAAoBF,OAAAA,EAAS,OAAA,CAAA;IAC3C,MAAMG,cAAAA,GAAiBC,eAAAA,CAAgBJ,OAAAA,EAAS,gBAAA,EAAkB,IAAA,CAAA;IAClE,qBACIK,IAAA,CAACC,QAAQC,IAAI,EAAA;AAACC,QAAAA,eAAAA,EAAeR,QAAQS,EAAE;QAAEC,KAAAA,EAAO;AAAEC,YAAAA,QAAAA,EAAU,GAAGC,cAAAA,CAAeZ,OAAAA,EAAS,UAAA,EAAY,GAAA,CAAA,CAAK,EAAE;AAAE,SAAA;;AACxG,0BAAAK,IAAA,CAACC,QAAQO,OAAO,EAAA;;AACXZ,oBAAAA,KAAAA,CAAMa,GAAG,CAAC,CAACC,MAAMC,KAAAA,iBACdC,GAAA,CAACX,QAAQY,IAAI,EAAA;AACT,4BAAA,QAAA,gBAAAD,GAAA,CAACE,KAAAA,EAAAA;gCAAIC,GAAAA,EAAKC,MAAAA,CAAON,IAAAA,C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AAKD,MAAAA,CAAON,IAAAA,CAAKO,GAAG,IAAI,EAAA,CAAA;gCAAKC,SAAAA,EAAU;;AADnEP,yBAAAA,EAAAA,KAAAA,CAAAA;;;;;AASxD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimeImage.js","sources":["../../../media/PrimeImage.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 { RegisteredComponentProps } from '@cratis/scene.react';\nimport { Image } from './Image';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:image` component - an image with an optional full-screen preview.\n *\n * PrimeReact 11 removed `Image` with no replacement and no headless hook, so the adapter renders Cratis's\n * own {@link Image}. The element's authored contract is unchanged, which is the point: which library\n * happens to draw an `img` is not something a screen should have to be rewritten over.\n *\n * `alt` defaults to an empty string rather than to the file name: an image with no authored alternative\n * text is decorative until someone says otherwise, and inventing one would put a URL fragment in front of\n * a screen reader.\n */\nexport function PrimeImage({ element }: RegisteredComponentProps) {\n return (\n <Image\n data-scene-id={element.id}\n src={stringProperty(element, 'src')}\n alt={stringProperty(element, 'alt', '')}\n width={stringProperty(element, 'width')}\n height={stringProperty(element, 'height')}\n preview={booleanProperty(element, 'preview', false)}\n />\n );\n}\n"],"names":["PrimeImage","element","_jsx","Image","data-scene-id","id","src","stringProperty","alt","width","height","preview","booleanProperty"],"mappings":";;;;AAAA;AACA;AAMA;;;;;;;;;;AAUC,IACM,SAASA,UAAAA,CAAW,EAAEC,OAAO,EAA4B,EAAA;AAC5D,IAAA,qBACIC,GAAA,CAACC,KAAAA,EAAAA;AACGC,QAAAA,eAAAA,EAAeH,QAAQI,EAAE;AACzBC,QAAAA,GAAAA,EAAKC,eAAeN,OAAAA,EAAS,KAAA,CAAA;QAC7BO,GAAAA,EAAKD,cAAAA,CAAeN,SAAS,KAAA,EAAO,EAAA,CAAA;AACpCQ,QAAAA,KAAAA,EAAOF,eAAeN,OAAAA,EAAS,OAAA,CAAA;AAC/BS,QAAAA,MAAAA,EAAQH,eAAeN,OAAAA,EAAS,QAAA,CAAA;QAChCU,OAAAA,EAASC,eAAAA,CAAgBX,SAAS,SAAA,EAAW,KAAA;;AAGzD
|
|
1
|
+
{"version":3,"file":"PrimeImage.js","sources":["../../../media/PrimeImage.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 { RegisteredComponentProps } from '@cratis/scene.react';\nimport { Image } from './Image';\nimport { booleanProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:image` component - an image with an optional full-screen preview.\n *\n * PrimeReact 11 removed `Image` with no replacement and no headless hook, so the adapter renders Cratis's\n * own {@link Image}. The element's authored contract is unchanged, which is the point: which library\n * happens to draw an `img` is not something a screen should have to be rewritten over.\n *\n * `alt` defaults to an empty string rather than to the file name: an image with no authored alternative\n * text is decorative until someone says otherwise, and inventing one would put a URL fragment in front of\n * a screen reader.\n */\nexport function PrimeImage({ element }: RegisteredComponentProps) {\n return (\n <Image\n data-scene-id={element.id}\n src={stringProperty(element, 'src')}\n alt={stringProperty(element, 'alt', '')}\n width={stringProperty(element, 'width')}\n height={stringProperty(element, 'height')}\n preview={booleanProperty(element, 'preview', false)}\n />\n );\n}\n"],"names":["PrimeImage","element","_jsx","Image","data-scene-id","id","src","stringProperty","alt","width","height","preview","booleanProperty"],"mappings":";;;;AAAA;AACA;AAMA;;;;;;;;;;AAUC,IACM,SAASA,UAAAA,CAAW,EAAEC,OAAO,EAA4B,EAAA;AAC5D,IAAA,qBACIC,GAAA,CAACC,KAAAA,EAAAA;AACGC,QAAAA,eAAAA,EAAeH,QAAQI,EAAE;AACzBC,QAAAA,GAAAA,EAAKC,eAAeN,OAAAA,EAAS,KAAA,CAAA;QAC7BO,GAAAA,EAAKD,cAAAA,CAAeN,SAAS,KAAA,EAAO,EAAA,CAAA;AACpCQ,QAAAA,KAAAA,EAAOF,eAAeN,OAAAA,EAAS,OAAA,CAAA;AAC/BS,QAAAA,MAAAA,EAAQH,eAAeN,OAAAA,EAAS,QAAA,CAAA;QAChCU,OAAAA,EAASC,eAAAA,CAAgBX,SAAS,SAAA,EAAW,KAAA;;AAGzD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dock.js","sources":["../../../menu/Dock.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 { CSSProperties, HTMLAttributes } from 'react';\nimport { MenuItem } from '../MenuItem';\nimport { DockPosition } from './DockPosition';\n\nconst dockStyle: CSSProperties = {\n position: 'absolute',\n background: 'var(--scene-surface-overlay)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n color: 'var(--scene-text-color)',\n};\n\nconst entryStyle: CSSProperties = {\n background: 'transparent',\n border: 'none',\n color: 'inherit',\n cursor: 'pointer',\n font: 'inherit',\n fontSize: '1.5rem',\n lineHeight: 1,\n textDecoration: 'none',\n};\n\n/**\n * Where the dock sits within its container, for one edge.\n *\n * The offset lives here rather than in four CSS classes because this package ships no component\n * stylesheets, and because the two axes are genuinely coupled: an edge decides both which side is pinned\n * and which axis is centered, so writing them together is what keeps them consistent.\n */\nfunction anchor(position: DockPosition): CSSProperties {\n switch (position) {\n case DockPosition.Top:\n return { top: 0, left: '50%', transform: 'translateX(-50%)' };\n case DockPosition.Left:\n return { left: 0, top: '50%', transform: 'translateY(-50%)' };\n case DockPosition.Right:\n return { right: 0, top: '50%', transform: 'translateY(-50%)' };\n default:\n return { bottom: 0, left: '50%', transform: 'translateX(-50%)' };\n }\n}\n\n/**\n * The configuration {@link Dock} takes.\n */\nexport interface DockProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * The entries to show. Each is shown as its icon alone, with its label as the accessible name.\n */\n items?: MenuItem[];\n\n /**\n * The edge of the containing box to anchor against.\n */\n position?: DockPosition;\n}\n\n/**\n * A small strip of icons anchored to one edge of its container. Cratis-owned.\n *\n * This exists because PrimeReact 11 removed `primereact/dock` outright, with no successor and no headless\n * hook. It positions itself absolutely, so it expects a positioned container to sit in - dropped straight\n * into a page it would pin itself to the page, which is why the Scene adapter wraps it in a sized relative\n * box.\n *\n * Entries are icon-only, and that is precisely why each one carries its label as `aria-label` and as a\n * `title`: a control whose only content is a decorative glyph has no accessible name at all otherwise, and\n * a dock is exactly the shape of component where that gets forgotten. An entry with no icon still renders,\n * as a neutral placeholder glyph, so a half-authored screen shows a gap rather than an invisible control.\n *\n * What it deliberately does not carry over from the v10 `Dock`: there is no magnification of the icon under\n * the pointer, which was the component's signature effect and is pure decoration; there are no tooltips\n * beyond the browser's own `title`; and item templates are not supported.\n */\nexport function Dock({ items = [], position = DockPosition.Bottom, ...rest }: DockProps) {\n const vertical = position === DockPosition.Left || position === DockPosition.Right;\n\n return (\n <div\n {...rest}\n role='toolbar'\n aria-orientation={vertical ? 'vertical' : 'horizontal'}\n className={vertical ? 'flex flex-col items-center gap-2 p-3' : 'flex items-center gap-2 p-3'}\n style={{ ...dockStyle, ...anchor(position) }}>\n {items.map((item, index) =>\n item.url === undefined ? (\n <button\n key={index}\n type='button'\n style={entryStyle}\n disabled={item.disabled}\n title={item.label}\n aria-label={item.label}\n onClick={() => item.command?.()}>\n <i className={item.icon ?? 'pi pi-circle'} aria-hidden='true' />\n </button>\n ) : (\n <a key={index} href={item.url} style={entryStyle} title={item.label} aria-label={item.label}>\n <i className={item.icon ?? 'pi pi-circle'} aria-hidden='true' />\n </a>\n )\n )}\n </div>\n );\n}\n"],"names":["dockStyle","position","background","border","borderRadius","color","entryStyle","cursor","font","fontSize","lineHeight","textDecoration","anchor","DockPosition","Top","top","left","transform","Left","Right","right","bottom","Dock","items","Bottom","rest","vertical","_jsx","div","role","aria-orientation","className","style","map","item","index","url","undefined","button","type","disabled","title","label","aria-label","onClick","command","i","icon","aria-hidden","a","href"],"mappings":";;;AAAA;AACA;AAM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,EAAAA,KAAAA,CAAAA;;AAO5B
|
|
1
|
+
{"version":3,"file":"Dock.js","sources":["../../../menu/Dock.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 { CSSProperties, HTMLAttributes } from 'react';\nimport { MenuItem } from '../MenuItem';\nimport { DockPosition } from './DockPosition';\n\nconst dockStyle: CSSProperties = {\n position: 'absolute',\n background: 'var(--scene-surface-overlay)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n color: 'var(--scene-text-color)',\n};\n\nconst entryStyle: CSSProperties = {\n background: 'transparent',\n border: 'none',\n color: 'inherit',\n cursor: 'pointer',\n font: 'inherit',\n fontSize: '1.5rem',\n lineHeight: 1,\n textDecoration: 'none',\n};\n\n/**\n * Where the dock sits within its container, for one edge.\n *\n * The offset lives here rather than in four CSS classes because this package ships no component\n * stylesheets, and because the two axes are genuinely coupled: an edge decides both which side is pinned\n * and which axis is centered, so writing them together is what keeps them consistent.\n */\nfunction anchor(position: DockPosition): CSSProperties {\n switch (position) {\n case DockPosition.Top:\n return { top: 0, left: '50%', transform: 'translateX(-50%)' };\n case DockPosition.Left:\n return { left: 0, top: '50%', transform: 'translateY(-50%)' };\n case DockPosition.Right:\n return { right: 0, top: '50%', transform: 'translateY(-50%)' };\n default:\n return { bottom: 0, left: '50%', transform: 'translateX(-50%)' };\n }\n}\n\n/**\n * The configuration {@link Dock} takes.\n */\nexport interface DockProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * The entries to show. Each is shown as its icon alone, with its label as the accessible name.\n */\n items?: MenuItem[];\n\n /**\n * The edge of the containing box to anchor against.\n */\n position?: DockPosition;\n}\n\n/**\n * A small strip of icons anchored to one edge of its container. Cratis-owned.\n *\n * This exists because PrimeReact 11 removed `primereact/dock` outright, with no successor and no headless\n * hook. It positions itself absolutely, so it expects a positioned container to sit in - dropped straight\n * into a page it would pin itself to the page, which is why the Scene adapter wraps it in a sized relative\n * box.\n *\n * Entries are icon-only, and that is precisely why each one carries its label as `aria-label` and as a\n * `title`: a control whose only content is a decorative glyph has no accessible name at all otherwise, and\n * a dock is exactly the shape of component where that gets forgotten. An entry with no icon still renders,\n * as a neutral placeholder glyph, so a half-authored screen shows a gap rather than an invisible control.\n *\n * What it deliberately does not carry over from the v10 `Dock`: there is no magnification of the icon under\n * the pointer, which was the component's signature effect and is pure decoration; there are no tooltips\n * beyond the browser's own `title`; and item templates are not supported.\n */\nexport function Dock({ items = [], position = DockPosition.Bottom, ...rest }: DockProps) {\n const vertical = position === DockPosition.Left || position === DockPosition.Right;\n\n return (\n <div\n {...rest}\n role='toolbar'\n aria-orientation={vertical ? 'vertical' : 'horizontal'}\n className={vertical ? 'flex flex-col items-center gap-2 p-3' : 'flex items-center gap-2 p-3'}\n style={{ ...dockStyle, ...anchor(position) }}>\n {items.map((item, index) =>\n item.url === undefined ? (\n <button\n key={index}\n type='button'\n style={entryStyle}\n disabled={item.disabled}\n title={item.label}\n aria-label={item.label}\n onClick={() => item.command?.()}>\n <i className={item.icon ?? 'pi pi-circle'} aria-hidden='true' />\n </button>\n ) : (\n <a key={index} href={item.url} style={entryStyle} title={item.label} aria-label={item.label}>\n <i className={item.icon ?? 'pi pi-circle'} aria-hidden='true' />\n </a>\n )\n )}\n </div>\n );\n}\n"],"names":["dockStyle","position","background","border","borderRadius","color","entryStyle","cursor","font","fontSize","lineHeight","textDecoration","anchor","DockPosition","Top","top","left","transform","Left","Right","right","bottom","Dock","items","Bottom","rest","vertical","_jsx","div","role","aria-orientation","className","style","map","item","index","url","undefined","button","type","disabled","title","label","aria-label","onClick","command","i","icon","aria-hidden","a","href"],"mappings":";;;AAAA;AACA;AAMA,MAAMA,SAAAA,GAA2B;IAC7BC,QAAAA,EAAU,UAAA;IACVC,UAAAA,EAAY,8BAAA;IACZC,MAAAA,EAAQ,uCAAA;IACRC,YAAAA,EAAc,oCAAA;IACdC,KAAAA,EAAO;AACX,CAA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the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * The edge a {@link Dock} is anchored to.\n *\n * This is an enum rather than a union of string literals so the four edges are discoverable from the type\n * itself and a `switch` over them stays exhaustive: adding a fifth edge becomes a compile error at every\n * place that maps an edge onto a position, instead of a silently missing case. The values are the same\n * lowercase words a screen authors, so an authored `position` maps straight onto a member.\n */\nexport enum DockPosition {\n /**\n * Anchored to the top edge, laid out across.\n */\n Top = 'top',\n\n /**\n * Anchored to the bottom edge, laid out across. The macOS-style default.\n */\n Bottom = 'bottom',\n\n /**\n * Anchored to the left edge, laid out down.\n */\n Left = 'left',\n\n /**\n * Anchored to the right edge, laid out down.\n */\n Right = 'right',\n}\n"],"names":["DockPosition"],"mappings":"AAAA;AACA;AAEA;;;;;;;IAQO,IAAKA,YAAAA,iBAAAA,SAAAA,YAAAA,EAAAA;AACR;;AAEC,QAAA,YAAA,CAAA,KAAA,CAAA,GAAA,KAAA;AAGD;;AAEC,QAAA,YAAA,CAAA,QAAA,CAAA,GAAA,QAAA;AAGD;;AAEC,QAAA,YAAA,CAAA,MAAA,CAAA,GAAA,MAAA;AAGD;;AAEC,QAAA,YAAA,CAAA,OAAA,CAAA,GAAA,OAAA;AAlBOA,IAAAA,OAAAA,YAAAA;AAoBX,CAAA,CAAA,EAAA
|
|
1
|
+
{"version":3,"file":"DockPosition.js","sources":["../../../menu/DockPosition.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\n/**\n * The edge a {@link Dock} is anchored to.\n *\n * This is an enum rather than a union of string literals so the four edges are discoverable from the type\n * itself and a `switch` over them stays exhaustive: adding a fifth edge becomes a compile error at every\n * place that maps an edge onto a position, instead of a silently missing case. The values are the same\n * lowercase words a screen authors, so an authored `position` maps straight onto a member.\n */\nexport enum DockPosition {\n /**\n * Anchored to the top edge, laid out across.\n */\n Top = 'top',\n\n /**\n * Anchored to the bottom edge, laid out across. The macOS-style default.\n */\n Bottom = 'bottom',\n\n /**\n * Anchored to the left edge, laid out down.\n */\n Left = 'left',\n\n /**\n * Anchored to the right edge, laid out down.\n */\n Right = 'right',\n}\n"],"names":["DockPosition"],"mappings":"AAAA;AACA;AAEA;;;;;;;IAQO,IAAKA,YAAAA,iBAAAA,SAAAA,YAAAA,EAAAA;AACR;;AAEC,QAAA,YAAA,CAAA,KAAA,CAAA,GAAA,KAAA;AAGD;;AAEC,QAAA,YAAA,CAAA,QAAA,CAAA,GAAA,QAAA;AAGD;;AAEC,QAAA,YAAA,CAAA,MAAA,CAAA,GAAA,MAAA;AAGD;;AAEC,QAAA,YAAA,CAAA,OAAA,CAAA,GAAA,OAAA;AAlBOA,IAAAA,OAAAA,YAAAA;AAoBX,CAAA,CAAA,EAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MegaMenu.js","sources":["../../../menu/MegaMenu.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 { CSSProperties, HTMLAttributes, useEffect, useState } from 'react';\nimport { MenuItem } from '../MenuItem';\nimport { MenuItemAction } from './MenuItemAction';\nimport { MenuItemContent } from './MenuItemContent';\n\nconst barStyle: CSSProperties = {\n background: 'var(--scene-surface-card)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n color: 'var(--scene-text-color)',\n};\n\nconst triggerStyle: CSSProperties = {\n background: 'transparent',\n border: 'none',\n color: 'inherit',\n cursor: 'pointer',\n font: 'inherit',\n textDecoration: 'none',\n};\n\nconst panelStyle: CSSProperties = {\n position: 'absolute',\n top: '100%',\n left: 0,\n zIndex: 1,\n background: 'var(--scene-surface-overlay)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n};\n\nconst columnHeadingStyle: CSSProperties = { color: 'var(--scene-text-muted-color)' };\n\nconst columnItemStyle: CSSProperties = { ...triggerStyle, width: '100%', textAlign: 'left' };\n\n/**\n * The configuration {@link MegaMenu} takes.\n */\nexport interface MegaMenuProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * The commands to show. Each top-level entry's children are the columns of its panel, and each\n * column's own children are the commands in that column.\n */\n items?: MenuItem[];\n}\n\n/**\n * A horizontal bar whose panels lay their commands out in labeled columns. Cratis-owned.\n *\n * This exists because PrimeReact 11 removed `primereact/megamenu` outright, with no successor and no\n * headless hook, so a screen that authored a mega menu had nothing left to render. It is a separate\n * component from {@link Menubar} rather than a flag on it because the two read genuinely different item\n * models - a menubar's children are commands, a mega menu's children are columns - and collapsing that\n * into a boolean would make both harder to read than keeping them apart.\n *\n * The column model is where this deliberately departs from v10. PrimeReact 10 spelled columns as an array\n * of arrays, so an entry's `items` held column groups rather than menu entries. Scene's item reader\n * follows nested *objects* and drops nested arrays, which means that shape never reached the component\n * intact anyway. Columns are therefore one ordinary level of nesting here: an entry's children are\n * columns, and a column's children are its commands. The same authored model now survives the reader.\n *\n * What it otherwise does not carry over from v10: there is no vertical orientation, so the `orientation`\n * property a v10 screen may have set is ignored rather than half-honored; panels open on click only,\n * never on hover; and item templates are not supported.\n */\nexport function MegaMenu({ items = [], ...rest }: MegaMenuProps) {\n const [openIndex, setOpenIndex] = useState<number | undefined>(undefined);\n\n useEffect(() => {\n const close = () => setOpenIndex(undefined);\n document.addEventListener('click', close);\n return () => document.removeEventListener('click', close);\n }, []);\n\n return (\n <div\n {...rest}\n role='menubar'\n className='relative flex items-center gap-2 p-3'\n style={barStyle}\n onKeyDown={(event) => {\n if (event.key === 'Escape') setOpenIndex(undefined);\n }}>\n {items.map((item, index) => {\n const columns = item.items ?? [];\n\n return (\n <div key={index} role='none' className='relative'>\n {columns.length > 0 ? (\n <>\n <button\n type='button'\n role='menuitem'\n className='inline-flex items-center gap-2'\n style={triggerStyle}\n disabled={item.disabled}\n aria-haspopup='true'\n aria-expanded={openIndex === index}\n onClick={(event) => {\n event.stopPropagation();\n setOpenIndex(openIndex === index ? undefined : index);\n }}>\n <MenuItemContent item={item} />\n <i className='pi pi-angle-down' aria-hidden='true' />\n </button>\n {openIndex === index && (\n <div role='menu' aria-label={item.label} className='flex gap-4 p-3' style={panelStyle}>\n {columns.map((column, columnIndex) => (\n <div key={columnIndex} role='group' aria-label={column.label} className='flex flex-col gap-1'>\n <span className='text-sm font-semibold' style={columnHeadingStyle}>\n {column.label}\n </span>\n {(column.items ?? []).map((child, childIndex) => (\n <MenuItemAction\n key={childIndex}\n item={child}\n role='menuitem'\n className='flex items-center gap-2'\n style={columnItemStyle}\n />\n ))}\n </div>\n ))}\n </div>\n )}\n </>\n ) : (\n <MenuItemAction item={item} role='menuitem' className='inline-flex items-center gap-2' style={triggerStyle} />\n )}\n </div>\n );\n })}\n </div>\n );\n}\n"],"names":["barStyle","background","border","borderRadius","color","triggerStyle","cursor","font","textDecoration","panelStyle","position","top","left","zIndex","columnHeadingStyle","columnItemStyle","width","textAlign","MegaMenu","items","rest","openIndex","setOpenIndex","useState","undefined","useEffect","close","document","addEventListener","removeEventListener","_jsx","div","role","className","style","onKeyDown","event","key","map","item","index","columns","length","_jsxs","_Fragment","button","type","disabled","aria-haspopup","aria-expanded","onClick","stopPropagation","MenuItemContent","i","aria-hidden","aria-label","label","column","columnIndex","span","child","childIndex","MenuItemAction"],"mappings":";;;;;AAQA,MAAMA,QAAAA,GAA0B;IAC5BC,UAAAA,EAAY,2BAAA;IACZC,MAAAA,EAAQ,uCAAA;IACRC,YAAAA,EAAc,oCAAA;IACdC,KAAAA,EAAO;AACX,CAAA;AAEA,MAAMC,YAAAA,GAA8B;IAChCJ,UAAAA,EAAY,aAAA;IACZC,MAAAA,EAAQ,MAAA;IACRE,KAAAA,EAAO,SAAA;IACPE,MAAAA,EAAQ,SAAA;IACRC,IAAAA,EAAM,SAAA;IACNC,cAAAA,EAAgB;AACpB,CAAA;AAEA,MAAMC,UAAAA,GAA4B;IAC9BC,QAAAA,EAAU,UAAA;IACVC,GAAAA,EAAK,MAAA;IACLC,IAA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;4CAAK1B,SAAAA,EAAU,uBAAA;4CAAwBC,KAAAA,EAAOpB,kBAAAA;AAC1C2C,4CAAAA,QAAAA,EAAAA,MAAAA,CAAOD;;wCAEVC,CAAAA,MAAAA,CAAOtC,KAAK,IAAI,EAAC,EAAGmB,GAAG,CAAC,CAACsB,KAAAA,EAAOC,UAAAA,iBAC9B/B,GAAA,CAACgC,cAAAA,EAAAA;gDAEGvB,IAAAA,EAAMqB,KAAAA;gDACN5B,IAAAA,EAAK,UAAA;gDACLC,SAAAA,EAAU,yBAAA;gDACVC,KAAAA,EAAOnB;AAJF8C,6CAAAA,EAAAA,UAAAA,CAAAA;;AANPH,iCAAAA,EAAAA,WAAAA,CAAAA;;;mCAmB1B5B,GAAA,CAACgC,cAAAA,EAAAA;oBAAevB,IAAAA,EAAMA,IAAAA;oBAAMP,IAAAA,EAAK,UAAA;oBAAWC,SAAAA,EAAU,gCAAA;oBAAiCC,KAAAA,EAAO7B;;AAxC5FmC,aAAAA,EAAAA,KAAAA,CAAAA;AA4ClB,QAAA,CAAA;;AAGZ;;;;"}
|
|
1
|
+
{"version":3,"file":"MegaMenu.js","sources":["../../../menu/MegaMenu.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 { CSSProperties, HTMLAttributes, useEffect, useState } from 'react';\nimport { MenuItem } from '../MenuItem';\nimport { MenuItemAction } from './MenuItemAction';\nimport { MenuItemContent } from './MenuItemContent';\n\nconst barStyle: CSSProperties = {\n background: 'var(--scene-surface-card)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n color: 'var(--scene-text-color)',\n};\n\nconst triggerStyle: CSSProperties = {\n background: 'transparent',\n border: 'none',\n color: 'inherit',\n cursor: 'pointer',\n font: 'inherit',\n textDecoration: 'none',\n};\n\nconst panelStyle: CSSProperties = {\n position: 'absolute',\n top: '100%',\n left: 0,\n zIndex: 1,\n background: 'var(--scene-surface-overlay)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n};\n\nconst columnHeadingStyle: CSSProperties = { color: 'var(--scene-text-muted-color)' };\n\nconst columnItemStyle: CSSProperties = { ...triggerStyle, width: '100%', textAlign: 'left' };\n\n/**\n * The configuration {@link MegaMenu} takes.\n */\nexport interface MegaMenuProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * The commands to show. Each top-level entry's children are the columns of its panel, and each\n * column's own children are the commands in that column.\n */\n items?: MenuItem[];\n}\n\n/**\n * A horizontal bar whose panels lay their commands out in labeled columns. Cratis-owned.\n *\n * This exists because PrimeReact 11 removed `primereact/megamenu` outright, with no successor and no\n * headless hook, so a screen that authored a mega menu had nothing left to render. It is a separate\n * component from {@link Menubar} rather than a flag on it because the two read genuinely different item\n * models - a menubar's children are commands, a mega menu's children are columns - and collapsing that\n * into a boolean would make both harder to read than keeping them apart.\n *\n * The column model is where this deliberately departs from v10. PrimeReact 10 spelled columns as an array\n * of arrays, so an entry's `items` held column groups rather than menu entries. Scene's item reader\n * follows nested *objects* and drops nested arrays, which means that shape never reached the component\n * intact anyway. Columns are therefore one ordinary level of nesting here: an entry's children are\n * columns, and a column's children are its commands. The same authored model now survives the reader.\n *\n * What it otherwise does not carry over from v10: there is no vertical orientation, so the `orientation`\n * property a v10 screen may have set is ignored rather than half-honored; panels open on click only,\n * never on hover; and item templates are not supported.\n */\nexport function MegaMenu({ items = [], ...rest }: MegaMenuProps) {\n const [openIndex, setOpenIndex] = useState<number | undefined>(undefined);\n\n useEffect(() => {\n const close = () => setOpenIndex(undefined);\n document.addEventListener('click', close);\n return () => document.removeEventListener('click', close);\n }, []);\n\n return (\n <div\n {...rest}\n role='menubar'\n className='relative flex items-center gap-2 p-3'\n style={barStyle}\n onKeyDown={(event) => {\n if (event.key === 'Escape') setOpenIndex(undefined);\n }}>\n {items.map((item, index) => {\n const columns = item.items ?? [];\n\n return (\n <div key={index} role='none' className='relative'>\n {columns.length > 0 ? (\n <>\n <button\n type='button'\n role='menuitem'\n className='inline-flex items-center gap-2'\n style={triggerStyle}\n disabled={item.disabled}\n aria-haspopup='true'\n aria-expanded={openIndex === index}\n onClick={(event) => {\n event.stopPropagation();\n setOpenIndex(openIndex === index ? undefined : index);\n }}>\n <MenuItemContent item={item} />\n <i className='pi pi-angle-down' aria-hidden='true' />\n </button>\n {openIndex === index && (\n <div role='menu' aria-label={item.label} className='flex gap-4 p-3' style={panelStyle}>\n {columns.map((column, columnIndex) => (\n <div key={columnIndex} role='group' aria-label={column.label} className='flex flex-col gap-1'>\n <span className='text-sm font-semibold' style={columnHeadingStyle}>\n {column.label}\n </span>\n {(column.items ?? []).map((child, childIndex) => (\n <MenuItemAction\n key={childIndex}\n item={child}\n role='menuitem'\n className='flex items-center gap-2'\n style={columnItemStyle}\n />\n ))}\n </div>\n ))}\n </div>\n )}\n </>\n ) : (\n <MenuItemAction item={item} role='menuitem' className='inline-flex items-center gap-2' style={triggerStyle} />\n )}\n </div>\n );\n })}\n </div>\n );\n}\n"],"names":["barStyle","background","border","borderRadius","color","triggerStyle","cursor","font","textDecoration","panelStyle","position","top","left","zIndex","columnHeadingStyle","columnItemStyle","width","textAlign","MegaMenu","items","rest","openIndex","setOpenIndex","useState","undefined","useEffect","close","document","addEventListener","removeEventListener","_jsx","div","role","className","style","onKeyDown","event","key","map","item","index","columns","length","_jsxs","_Fragment","button","type","disabled","aria-haspopup","aria-expanded","onClick","stopPropagation","MenuItemContent","i","aria-hidden","aria-label","label","column","columnIndex","span","child","childIndex","MenuItemAction"],"mappings":";;;;;AAQA,MAAMA,QAAAA,GAA0B;IAC5BC,UAAAA,EAAY,2BAAA;IACZC,MAAAA,EAAQ,uCAAA;IACRC,YAAAA,EAAc,oCAAA;IACdC,KAAAA,EAAO;AACX,CAAA;AAEA,MAAMC,YAAAA,GAA8B;IAChCJ,UAAAA,EAAY,aAAA;IACZC,MAAAA,EAAQ,MAAA;IACRE,KAAAA,EAAO,SAAA;IACP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f,IAAA,CAACZ,KAAAA,EAAAA;oCAAsBC,IAAAA,EAAK,OAAA;AAAQuB,oCAAAA,YAAAA,EAAYE,OAAOD,KAAK;oCAAEvB,SAAAA,EAAU,qBAAA;;sDACpEH,GAAA,CAAC6B,MAAAA,EAAAA;4CAAK1B,SAAAA,EAAU,uBAAA;4CAAwBC,KAAAA,EAAOpB,kBAAAA;AAC1C2C,4CAAAA,QAAAA,EAAAA,MAAAA,CAAOD;;wCAEVC,CAAAA,MAAAA,CAAOtC,KAAK,IAAI,EAAC,EAAGmB,GAAG,CAAC,CAACsB,KAAAA,EAAOC,UAAAA,iBAC9B/B,GAAA,CAACgC,cAAAA,EAAAA;gDAEGvB,IAAAA,EAAMqB,KAAAA;gDACN5B,IAAAA,EAAK,UAAA;gDACLC,SAAAA,EAAU,yBAAA;gDACVC,KAAAA,EAAOnB;AAJF8C,6CAAAA,EAAAA,UAAAA,CAAAA;;AANPH,iCAAAA,EAAAA,WAAAA,CAAAA;;;mCAmB1B5B,GAAA,CAACgC,cAAAA,EAAAA;oBAAevB,IAAAA,EAAMA,IAAAA;oBAAMP,IAAAA,EAAK,UAAA;oBAAWC,SAAAA,EAAU,gCAAA;oBAAiCC,KAAAA,EAAO7B;;AAxC5FmC,aAAAA,EAAAA,KAAAA,CAAAA;AA4ClB,QAAA,CAAA;;AAGZ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItemAction.js","sources":["../../../menu/MenuItemAction.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 { AriaRole, CSSProperties } from 'react';\nimport { MenuItem } from '../MenuItem';\nimport { MenuItemContent } from './MenuItemContent';\n\n/**\n * The configuration {@link MenuItemAction} takes.\n */\nexport interface MenuItemActionProps {\n /**\n * The entry to make selectable.\n */\n item: MenuItem;\n\n /**\n * The ARIA role the entry plays inside its container - `menuitem` inside a menu, left unset inside a\n * plain navigation bar where the surrounding markup already says what the entry is.\n */\n role?: AriaRole;\n\n /**\n * Whether this entry is the one the user is currently on, which is announced as `aria-current`.\n */\n current?: boolean;\n\n /**\n * Classes for the entry, so each menu can keep its own layout while sharing this behavior.\n */\n className?: string;\n\n /**\n * Inline styling for the entry. This package ships no component stylesheets - a `.css` import would\n * not survive the `tsc` build - so chrome that cannot be expressed with the shared utility classes is\n * written here.\n */\n style?: CSSProperties;\n\n /**\n * Invoked after the entry's own `command`, so a menu can close itself or record a selection.\n */\n onActivate?: () => void;\n}\n\n/**\n * One selectable menu entry, rendered as a link when it navigates and as a button when it commands.\n *\n * The distinction is not cosmetic and it is the reason this is shared rather than repeated. An entry\n * carrying a `url` is navigation: it belongs in an anchor so it can be opened in a new tab, copied,\n * followed by a screen reader's link list and reached the way every other link on the page is. An entry\n * carrying a `command` changes something on the current screen, which is what a button is for. Getting\n * that wrong is invisible to a sighted mouse user and immediately wrong for everyone else, so the five\n * Cratis-owned menus that need a selectable entry all defer the choice to here.\n *\n * A disabled entry is always a button, even when it has a `url`, because there is no way to disable an\n * anchor - `aria-disabled` still leaves it clickable and focusable. Rendering the button lets the\n * platform's own disabled semantics do the work.\n */\nexport function MenuItemAction({ item, role, current, className, style, onActivate }: MenuItemActionProps) {\n const activate = () => {\n item.command?.();\n onActivate?.();\n };\n\n if (item.url !== undefined && item.disabled !== true) {\n return (\n <a\n href={item.url}\n role={role}\n className={className}\n style={style}\n aria-current={current === true ? 'page' : undefined}\n onClick={activate}>\n <MenuItemContent item={item} />\n </a>\n );\n }\n\n return (\n <button\n type='button'\n role={role}\n className={className}\n style={style}\n disabled={item.disabled}\n aria-current={current === true ? 'page' : undefined}\n onClick={activate}>\n <MenuItemContent item={item} />\n </button>\n );\n}\n"],"names":["MenuItemAction","item","role","current","className","style","onActivate","activate","command","url","undefined","disabled","_jsx","a","href","aria-current","onClick","MenuItemContent","button","type"],"mappings":";;;AAAA;AACA;AA4CA;;;;;;;;;;;;;AAaC,IACM,SAASA,cAAAA,CAAe,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEC,KAAK,EAAEC,UAAU,EAAuB,EAAA;AACrG,IAAA,MAAMC,QAAAA,GAAW,IAAA;AACbN,QAAAA,IAAAA,CAAKO,OAAO,IAAA;AACZF,QAAAA,UAAAA,IAAAA;AACJ,IAAA,CAAA;AAEA,IAAA,IAAIL,KAAKQ,GAAG,KAAKC,aAAaT,IAAAA,CAAKU,QAAQ,KAAK,IAAA,EAAM;AAClD,QAAA,qBACIC,GAAA,CAACC,GAAAA,EAAAA;AACGC,YAAAA,IAAAA,EAAMb,KAAKQ,GAAG;YACdP,IAAAA,EAAMA,IAAAA;YACNE,SAAAA,EAAWA,SAAAA;YACXC,KAAAA,EAAOA,KAAAA;YACPU,cAAAA,EAAcZ,OAAAA,KAAY,OAAO,MAAA,GAASO,SAAAA;YAC1CM,OAAAA,EAAST,QAAAA;AACT,YAAA,QAAA,gBAAAK,GAAA,CAACK,eAAAA,EAAAA;gBAAgBhB,IAAAA,EAAMA;;;AAGnC,IAAA;AAEA,IAAA,qBACIW,GAAA,CAACM,QAAAA,EAAAA;QACGC,IAAAA,EAAK,QAAA;QACLjB,IAAAA,EAAMA,IAAAA;QACNE,SAAAA,EAAWA,SAAAA;QACXC,KAAAA,EAAOA,KAAAA;AACPM,QAAAA,QAAAA,EAAUV,KAAKU,QAAQ;QACvBI,cAAAA,EAAcZ,OAAAA,KAAY,OAAO,MAAA,GAASO,SAAAA;QAC1CM,OAAAA,EAAST,QAAAA;AACT,QAAA,QAAA,gBAAAK,GAAA,CAACK,eAAAA,EAAAA;YAAgBhB,IAAAA,EAAMA;;;AAGnC
|
|
1
|
+
{"version":3,"file":"MenuItemAction.js","sources":["../../../menu/MenuItemAction.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 { AriaRole, CSSProperties } from 'react';\nimport { MenuItem } from '../MenuItem';\nimport { MenuItemContent } from './MenuItemContent';\n\n/**\n * The configuration {@link MenuItemAction} takes.\n */\nexport interface MenuItemActionProps {\n /**\n * The entry to make selectable.\n */\n item: MenuItem;\n\n /**\n * The ARIA role the entry plays inside its container - `menuitem` inside a menu, left unset inside a\n * plain navigation bar where the surrounding markup already says what the entry is.\n */\n role?: AriaRole;\n\n /**\n * Whether this entry is the one the user is currently on, which is announced as `aria-current`.\n */\n current?: boolean;\n\n /**\n * Classes for the entry, so each menu can keep its own layout while sharing this behavior.\n */\n className?: string;\n\n /**\n * Inline styling for the entry. This package ships no component stylesheets - a `.css` import would\n * not survive the `tsc` build - so chrome that cannot be expressed with the shared utility classes is\n * written here.\n */\n style?: CSSProperties;\n\n /**\n * Invoked after the entry's own `command`, so a menu can close itself or record a selection.\n */\n onActivate?: () => void;\n}\n\n/**\n * One selectable menu entry, rendered as a link when it navigates and as a button when it commands.\n *\n * The distinction is not cosmetic and it is the reason this is shared rather than repeated. An entry\n * carrying a `url` is navigation: it belongs in an anchor so it can be opened in a new tab, copied,\n * followed by a screen reader's link list and reached the way every other link on the page is. An entry\n * carrying a `command` changes something on the current screen, which is what a button is for. Getting\n * that wrong is invisible to a sighted mouse user and immediately wrong for everyone else, so the five\n * Cratis-owned menus that need a selectable entry all defer the choice to here.\n *\n * A disabled entry is always a button, even when it has a `url`, because there is no way to disable an\n * anchor - `aria-disabled` still leaves it clickable and focusable. Rendering the button lets the\n * platform's own disabled semantics do the work.\n */\nexport function MenuItemAction({ item, role, current, className, style, onActivate }: MenuItemActionProps) {\n const activate = () => {\n item.command?.();\n onActivate?.();\n };\n\n if (item.url !== undefined && item.disabled !== true) {\n return (\n <a\n href={item.url}\n role={role}\n className={className}\n style={style}\n aria-current={current === true ? 'page' : undefined}\n onClick={activate}>\n <MenuItemContent item={item} />\n </a>\n );\n }\n\n return (\n <button\n type='button'\n role={role}\n className={className}\n style={style}\n disabled={item.disabled}\n aria-current={current === true ? 'page' : undefined}\n onClick={activate}>\n <MenuItemContent item={item} />\n </button>\n );\n}\n"],"names":["MenuItemAction","item","role","current","className","style","onActivate","activate","command","url","undefined","disabled","_jsx","a","href","aria-current","onClick","MenuItemContent","button","type"],"mappings":";;;AAAA;AACA;AA4CA;;;;;;;;;;;;;AAaC,IACM,SAASA,cAAAA,CAAe,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEC,KAAK,EAAEC,UAAU,EAAuB,EAAA;AACrG,IAAA,MAAMC,QAAAA,GAAW,IAAA;AACbN,QAAAA,IAAAA,CAAKO,OAAO,IAAA;AACZF,QAAAA,UAAAA,IAAAA;AACJ,IAAA,CAAA;AAEA,IAAA,IAAIL,KAAKQ,GAAG,KAAKC,aAAaT,IAAAA,CAAKU,QAAQ,KAAK,IAAA,EAAM;AAClD,QAAA,qBACIC,GAAA,CAACC,GAAAA,EAAAA;AACGC,YAAAA,IAAAA,EAAMb,KAAKQ,GAAG;YACdP,IAAAA,EAAMA,IAAAA;YACNE,SAAAA,EAAWA,SAAAA;YACXC,KAAAA,EAAOA,KAAAA;YACPU,cAAAA,EAAcZ,OAAAA,KAAY,OAAO,MAAA,GAASO,SAAAA;YAC1CM,OAAAA,EAAST,QAAAA;AACT,YAAA,QAAA,gBAAAK,GAAA,CAACK,eAAAA,EAAAA;gBAAgBhB,IAAAA,EAAMA;;;AAGnC,IAAA;AAEA,IAAA,qBACIW,GAAA,CAACM,QAAAA,EAAAA;QACGC,IAAAA,EAAK,QAAA;QACLjB,IAAAA,EAAMA,IAAAA;QACNE,SAAAA,EAAWA,SAAAA;QACXC,KAAAA,EAAOA,KAAAA;AACPM,QAAAA,QAAAA,EAAUV,KAAKU,QAAQ;QACvBI,cAAAA,EAAcZ,OAAAA,KAAY,OAAO,MAAA,GAASO,SAAAA;QAC1CM,OAAAA,EAAST,QAAAA;AACT,QAAA,QAAA,gBAAAK,GAAA,CAACK,eAAAA,EAAAA;YAAgBhB,IAAAA,EAAMA;;;AAGnC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItemContent.js","sources":["../../../menu/MenuItemContent.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 { MenuItem } from '../MenuItem';\n\n/**\n * The configuration {@link MenuItemContent} takes.\n */\nexport interface MenuItemContentProps {\n /**\n * The entry whose icon and label to show.\n */\n item: MenuItem;\n}\n\n/**\n * The inside of one menu entry - its icon and its label - without the element that makes it selectable.\n *\n * Seven of the components in this folder are Cratis-owned replacements for menus PrimeReact 11 removed,\n * and each of them wraps an entry in a different element: a menubar puts it in a button, a tiered menu in\n * a list row, a dock in an icon-only control. What never differs is the inside, so it is written once\n * here instead of seven times, where six copies would eventually drift apart.\n *\n * Sharing it also settles one accessibility decision in a single place rather than repeatedly: the label\n * already carries the meaning, so the icon beside it is decoration and is hidden from assistive\n * technology. Left to each component, that is exactly the kind of detail one of them would quietly get\n * wrong.\n */\nexport function MenuItemContent({ item }: MenuItemContentProps) {\n return (\n <>\n {item.icon !== undefined && <i className={item.icon} aria-hidden='true' />}\n {item.label !== undefined && <span>{item.label}</span>}\n </>\n );\n}\n"],"names":["MenuItemContent","item","_jsxs","_Fragment","icon","undefined","_jsx","i","className","aria-hidden","label","span"],"mappings":";;AAAA;AACA;AAcA;;;;;;;;;;;;AAYC,IACM,SAASA,eAAAA,CAAgB,EAAEC,IAAI,EAAwB,EAAA;IAC1D,qBACIC,IAAA,CAAAC,QAAA,EAAA;;YACKF,IAAAA,CAAKG,IAAI,KAAKC,SAAAA,kBAAaC,GAAA,CAACC,GAAAA,EAAAA;AAAEC,gBAAAA,SAAAA,EAAWP,KAAKG,IAAI;gBAAEK,aAAAA,EAAY;;YAChER,IAAAA,CAAKS,KAAK,KAAKL,SAAAA,kBAAaC,GAAA,CAACK,MAAAA,EAAAA;AAAMV,gBAAAA,QAAAA,EAAAA,IAAAA,CAAKS;;;;AAGrD
|
|
1
|
+
{"version":3,"file":"MenuItemContent.js","sources":["../../../menu/MenuItemContent.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 { MenuItem } from '../MenuItem';\n\n/**\n * The configuration {@link MenuItemContent} takes.\n */\nexport interface MenuItemContentProps {\n /**\n * The entry whose icon and label to show.\n */\n item: MenuItem;\n}\n\n/**\n * The inside of one menu entry - its icon and its label - without the element that makes it selectable.\n *\n * Seven of the components in this folder are Cratis-owned replacements for menus PrimeReact 11 removed,\n * and each of them wraps an entry in a different element: a menubar puts it in a button, a tiered menu in\n * a list row, a dock in an icon-only control. What never differs is the inside, so it is written once\n * here instead of seven times, where six copies would eventually drift apart.\n *\n * Sharing it also settles one accessibility decision in a single place rather than repeatedly: the label\n * already carries the meaning, so the icon beside it is decoration and is hidden from assistive\n * technology. Left to each component, that is exactly the kind of detail one of them would quietly get\n * wrong.\n */\nexport function MenuItemContent({ item }: MenuItemContentProps) {\n return (\n <>\n {item.icon !== undefined && <i className={item.icon} aria-hidden='true' />}\n {item.label !== undefined && <span>{item.label}</span>}\n </>\n );\n}\n"],"names":["MenuItemContent","item","_jsxs","_Fragment","icon","undefined","_jsx","i","className","aria-hidden","label","span"],"mappings":";;AAAA;AACA;AAcA;;;;;;;;;;;;AAYC,IACM,SAASA,eAAAA,CAAgB,EAAEC,IAAI,EAAwB,EAAA;IAC1D,qBACIC,IAAA,CAAAC,QAAA,EAAA;;YACKF,IAAAA,CAAKG,IAAI,KAAKC,SAAAA,kBAAaC,GAAA,CAACC,GAAAA,EAAAA;AAAEC,gBAAAA,SAAAA,EAAWP,KAAKG,IAAI;gBAAEK,aAAAA,EAAY;;YAChER,IAAAA,CAAKS,KAAK,KAAKL,SAAAA,kBAAaC,GAAA,CAACK,MAAAA,EAAAA;AAAMV,gBAAAA,QAAAA,EAAAA,IAAAA,CAAKS;;;;AAGrD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menubar.js","sources":["../../../menu/Menubar.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 { CSSProperties, HTMLAttributes, ReactNode, useEffect, useState } from 'react';\nimport { MenuItem } from '../MenuItem';\nimport { MenuItemAction } from './MenuItemAction';\nimport { MenuItemContent } from './MenuItemContent';\n\nconst barStyle: CSSProperties = {\n background: 'var(--scene-surface-card)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n color: 'var(--scene-text-color)',\n};\n\nconst triggerStyle: CSSProperties = {\n background: 'transparent',\n border: 'none',\n color: 'inherit',\n cursor: 'pointer',\n font: 'inherit',\n textDecoration: 'none',\n};\n\nconst panelStyle: CSSProperties = {\n position: 'absolute',\n top: '100%',\n left: 0,\n zIndex: 1,\n minWidth: '12rem',\n background: 'var(--scene-surface-overlay)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n};\n\nconst panelItemStyle: CSSProperties = { ...triggerStyle, width: '100%', textAlign: 'left' };\n\nconst separatorStyle: CSSProperties = { border: 'none', borderTop: '1px solid var(--scene-surface-border)', margin: 0 };\n\n/**\n * The configuration {@link Menubar} takes.\n */\nexport interface MenubarProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * The commands to show, top level across the bar and one level of children in a dropdown.\n */\n items?: MenuItem[];\n\n /**\n * Content pinned before the commands - branding, in a real application.\n */\n start?: ReactNode;\n\n /**\n * Content pinned after the commands - account and status controls, in a real application.\n */\n end?: ReactNode;\n}\n\n/**\n * A horizontal bar of commands, each of which may drop down a panel of its children. Cratis-owned.\n *\n * This exists because PrimeReact 11 removed `primereact/menubar` outright, with no successor component\n * and no headless hook to rebuild it from - unlike `menu`, `breadcrumb` and `contextmenu`, which survived\n * as compositional part namespaces. Scene still has to render an element authored as a menubar, so the\n * component is Scene's now. It follows `ActionMenubar` in `@cratis/components`, which is the same answer\n * Cratis already reached for its own bar of actions after the v11 removal.\n *\n * What it deliberately does not carry over from the v10 `Menubar`: submenus nest exactly one level rather\n * than arbitrarily deep (author a `tieredMenu` when a third level is genuinely needed); panels open on\n * click only, never on hover; there is no responsive collapse to a hamburger at narrow widths; there is\n * no roving-focus keyboard model across the bar, only the tab order and Escape the browser and this\n * component give for free; and item templates are not supported, since a Scene item model has no place to\n * put a React node.\n *\n * A panel does close when the pointer goes elsewhere on the page. That is not a feature carried over so\n * much as the absence of a defect - a dropdown that survives a click on the rest of the screen is broken,\n * not minimal.\n */\nexport function Menubar({ items = [], start, end, ...rest }: MenubarProps) {\n const [openIndex, setOpenIndex] = useState<number | undefined>(undefined);\n\n useEffect(() => {\n const close = () => setOpenIndex(undefined);\n document.addEventListener('click', close);\n return () => document.removeEventListener('click', close);\n }, []);\n\n return (\n <div\n {...rest}\n className='relative flex items-center gap-2 p-3'\n style={barStyle}\n onKeyDown={(event) => {\n if (event.key === 'Escape') setOpenIndex(undefined);\n }}>\n {start}\n <div role='menubar' className='flex items-center gap-2'>\n {items.map((item, index) => {\n const children = item.items ?? [];\n\n return (\n <div key={index} role='none' className='relative'>\n {children.length > 0 ? (\n <>\n <button\n type='button'\n role='menuitem'\n className='inline-flex items-center gap-2'\n style={triggerStyle}\n disabled={item.disabled}\n aria-haspopup='true'\n aria-expanded={openIndex === index}\n onClick={(event) => {\n event.stopPropagation();\n setOpenIndex(openIndex === index ? undefined : index);\n }}>\n <MenuItemContent item={item} />\n <i className='pi pi-angle-down' aria-hidden='true' />\n </button>\n {openIndex === index && (\n <div role='menu' aria-label={item.label} className='flex flex-col' style={panelStyle}>\n {children.map((child, childIndex) =>\n child.separator === true ? (\n <hr key={childIndex} style={separatorStyle} />\n ) : (\n <MenuItemAction\n key={childIndex}\n item={child}\n role='menuitem'\n className='flex items-center gap-2 p-3'\n style={panelItemStyle}\n />\n )\n )}\n </div>\n )}\n </>\n ) : (\n <MenuItemAction item={item} role='menuitem' className='inline-flex items-center gap-2' style={triggerStyle} />\n )}\n </div>\n );\n })}\n </div>\n {end}\n </div>\n );\n}\n"],"names":["barStyle","background","border","borderRadius","color","triggerStyle","cursor","font","textDecoration","panelStyle","position","top","left","zIndex","minWidth","panelItemStyle","width","textAlign","separatorStyle","borderTop","margin","Menubar","items","start","end","rest","openIndex","setOpenIndex","useState","undefined","useEffect","close","document","addEventListener","removeEventListener","_jsxs","div","className","style","onKeyDown","event","key","_jsx","role","map","item","index","children","length","_Fragment","button","type","disabled","aria-haspopup","aria-expanded","onClick","stopPropagation","MenuItemContent","i","aria-hidden","aria-label","label","child","childIndex","separator","hr","MenuItemAction"],"mappings":";;;;;AAQA,MAAMA,QAAAA,GAA0B;IAC5BC,UAAAA,EAAY,2BAAA;IACZC,MAAAA,EAAQ,uCAAA;IACRC,YAAAA,EAAc,oCAAA;IACdC,KAAAA,EAAO;AACX,CAAA;AAEA,MAAMC,YAAAA,GAA8B;IAChCJ,UAAAA,EAAY,aAAA;IACZC,MAAAA,EAAQ,MAAA;IACRE,KAAAA,EAAO,SAAA;IACPE,MAAAA,EAAQ,SAAA;IACRC,IAAAA,EAAM,SAAA;IACNC,cAAAA,EAAgB;AACpB,CAAA;AAEA,MAAMC,UAAAA,GAA4B;IAC9BC,QAAAA,EAAU,UAAA;IACVC,GAAAA,EAAK,MAAA;IACLC,IAAAA,EAAM,CAAA;IACNC,MAAAA,EAAQ,CAAA;IACRC,QAAAA,EAAU,OAAA;IACVb,UAAAA,EAAY,8BAAA;IACZC,MAAAA,EAAQ,uCAAA;IACRC,YAAAA,EAAc;AAClB,CAAA;AAEA,MAAMY,cAAAA,GAAgC;AAAE,IAAA,GAAGV,YAAY;IAAEW,KAAAA,EAAO,MAAA;IAAQC,SAAAA,EAAW;AAAO,CAAA;AAE1F,MAAMC,cAAAA,GAAgC;IAAEhB,MAAAA,EAAQ,MAAA;IAAQiB,SAAAA,EAAW,uCAAA;IAAyCC,MAAAA,EAAQ;AAAE,CAAA;AAsBtH;;;;;;;;;;;;;;;;;;;AAmBC,IACM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K,UAAA;4BAAWN,SAAAA,EAAU,gCAAA;4BAAiCC,KAAAA,EAAOjC;;AArC5FyC,qBAAAA,EAAAA,KAAAA,CAAAA;AAyClB,gBAAA,CAAA;;AAEHtB,YAAAA;;;AAGb;;;;"}
|
|
1
|
+
{"version":3,"file":"Menubar.js","sources":["../../../menu/Menubar.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 { CSSProperties, HTMLAttributes, ReactNode, useEffect, useState } from 'react';\nimport { MenuItem } from '../MenuItem';\nimport { MenuItemAction } from './MenuItemAction';\nimport { MenuItemContent } from './MenuItemContent';\n\nconst barStyle: CSSProperties = {\n background: 'var(--scene-surface-card)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n color: 'var(--scene-text-color)',\n};\n\nconst triggerStyle: CSSProperties = {\n background: 'transparent',\n border: 'none',\n color: 'inherit',\n cursor: 'pointer',\n font: 'inherit',\n textDecoration: 'none',\n};\n\nconst panelStyle: CSSProperties = {\n position: 'absolute',\n top: '100%',\n left: 0,\n zIndex: 1,\n minWidth: '12rem',\n background: 'var(--scene-surface-overlay)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n};\n\nconst panelItemStyle: CSSProperties = { ...triggerStyle, width: '100%', textAlign: 'left' };\n\nconst separatorStyle: CSSProperties = { border: 'none', borderTop: '1px solid var(--scene-surface-border)', margin: 0 };\n\n/**\n * The configuration {@link Menubar} takes.\n */\nexport interface MenubarProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * The commands to show, top level across the bar and one level of children in a dropdown.\n */\n items?: MenuItem[];\n\n /**\n * Content pinned before the commands - branding, in a real application.\n */\n start?: ReactNode;\n\n /**\n * Content pinned after the commands - account and status controls, in a real application.\n */\n end?: ReactNode;\n}\n\n/**\n * A horizontal bar of commands, each of which may drop down a panel of its children. Cratis-owned.\n *\n * This exists because PrimeReact 11 removed `primereact/menubar` outright, with no successor component\n * and no headless hook to rebuild it from - unlike `menu`, `breadcrumb` and `contextmenu`, which survived\n * as compositional part namespaces. Scene still has to render an element authored as a menubar, so the\n * component is Scene's now. It follows `ActionMenubar` in `@cratis/components`, which is the same answer\n * Cratis already reached for its own bar of actions after the v11 removal.\n *\n * What it deliberately does not carry over from the v10 `Menubar`: submenus nest exactly one level rather\n * than arbitrarily deep (author a `tieredMenu` when a third level is genuinely needed); panels open on\n * click only, never on hover; there is no responsive collapse to a hamburger at narrow widths; there is\n * no roving-focus keyboard model across the bar, only the tab order and Escape the browser and this\n * component give for free; and item templates are not supported, since a Scene item model has no place to\n * put a React node.\n *\n * A panel does close when the pointer goes elsewhere on the page. That is not a feature carried over so\n * much as the absence of a defect - a dropdown that survives a click on the rest of the screen is broken,\n * not minimal.\n */\nexport function Menubar({ items = [], start, end, ...rest }: MenubarProps) {\n const [openIndex, setOpenIndex] = useState<number | undefined>(undefined);\n\n useEffect(() => {\n const close = () => setOpenIndex(undefined);\n document.addEventListener('click', close);\n return () => document.removeEventListener('click', close);\n }, []);\n\n return (\n <div\n {...rest}\n className='relative flex items-center gap-2 p-3'\n style={barStyle}\n onKeyDown={(event) => {\n if (event.key === 'Escape') setOpenIndex(undefined);\n }}>\n {start}\n <div role='menubar' className='flex items-center gap-2'>\n {items.map((item, index) => {\n const children = item.items ?? [];\n\n return (\n <div key={index} role='none' className='relative'>\n {children.length > 0 ? (\n <>\n <button\n type='button'\n role='menuitem'\n className='inline-flex items-center gap-2'\n style={triggerStyle}\n disabled={item.disabled}\n aria-haspopup='true'\n aria-expanded={openIndex === index}\n onClick={(event) => {\n event.stopPropagation();\n setOpenIndex(openIndex === index ? undefined : index);\n }}>\n <MenuItemContent item={item} />\n <i className='pi pi-angle-down' aria-hidden='true' />\n </button>\n {openIndex === index && (\n <div role='menu' aria-label={item.label} className='flex flex-col' style={panelStyle}>\n {children.map((child, childIndex) =>\n child.separator === true ? (\n <hr key={childIndex} style={separatorStyle} />\n ) : (\n <MenuItemAction\n key={childIndex}\n item={child}\n role='menuitem'\n className='flex items-center gap-2 p-3'\n style={panelItemStyle}\n />\n )\n )}\n </div>\n )}\n </>\n ) : (\n <MenuItemAction item={item} role='menuitem' className='inline-flex items-center gap-2' style={triggerStyle} />\n )}\n </div>\n );\n })}\n </div>\n {end}\n </div>\n );\n}\n"],"names":["barStyle","background","border","borderRadius","color","triggerStyle","cursor","font","textDecoration","panelStyle","position","top","left","zIndex","minWidth","panelItemStyle","width","textAlign","separatorStyle","borderTop","margin","Menubar","items","start","end","rest","openIndex","setOpenIndex","useState","undefined","useEffect","close","document","addEventListener","removeEventListener","_jsxs","div","className","style","onKeyDown","event","key","_jsx","role","map","item","index","children","length","_Fragment","button","type","disabled","aria-haspopup","aria-expanded","onClick","stopPropagation","MenuItemContent","i","aria-hidden","aria-label","label","child","childIndex","separator","hr","MenuItemAction"],"mappings":";;;;;AAQA,MAAMA,QAAAA,GAA0B;IAC5BC,UAAAA,EAAY,2BAAA;IACZC,MAAAA,EAAQ,uCAAA;IACRC,YAAAA,EAAc,oCAAA;IACdC,KAAAA,EAAO;AACX,CAAA;AAEA,MAAMC,YAAAA,GAA8B;IAChCJ,UAAAA,EAAY,aAAA;IACZC,MAAAA,EAAQ,MAAA;IACRE,KAAAA,EAAO,SAAA;IACPE,MAAAA,EAAQ,SAAA;IACRC,IAAAA,EAAM,SAAA;IACNC,cAAAA,EAAgB;AACpB,CAAA;AAEA,MAAMC,UAAAA,GAA4B;IAC9BC,QAAAA,EAAU,UAAA;IACVC,GAAAA,EAAK,MAAA;IACLC,IAAAA,EAAM,CAAA;IACNC,MAAAA,EAAQ,CAAA;IACRC,QAAAA,EAAU,OAAA;IACVb,UAAAA,EAAY,8BAAA;IACZC,MAAAA,EAAQ,uCAAA;IACRC,YAAAA,EAAc;AAClB,CAAA;AAEA,MAAMY,cAAAA,GAAgC;AAAE,IAAA,GAAGV,YAAY;IAAEW,KAAAA,EAAO,MAAA;IAAQC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AK,UAAA;4CACLN,SAAAA,EAAU,6BAAA;4CACVC,KAAAA,EAAOvB;AAJFgD,yCAAAA,EAAAA,UAAAA,CAAAA;;;2CAY7BrB,GAAA,CAACwB,cAAAA,EAAAA;4BAAerB,IAAAA,EAAMA,IAAAA;4BAAMF,IAAAA,EAAK,UAAA;4BAAWN,SAAAA,EAAU,gCAAA;4BAAiCC,KAAAA,EAAOjC;;AArC5FyC,qBAAAA,EAAAA,KAAAA,CAAAA;AAyClB,gBAAA,CAAA;;AAEHtB,YAAAA;;;AAGb;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelMenu.js","sources":["../../../menu/PanelMenu.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 { CSSProperties, HTMLAttributes } from 'react';\nimport { Accordion } from 'primereact/accordion';\nimport { MenuItem } from '../MenuItem';\nimport { MenuItemAction } from './MenuItemAction';\nimport { MenuItemContent } from './MenuItemContent';\n\nconst rootStyle: CSSProperties = { color: 'var(--scene-text-color)', width: '16rem' };\n\nconst headerStyle: CSSProperties = {\n background: 'var(--scene-surface-card)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n color: 'inherit',\n cursor: 'pointer',\n font: 'inherit',\n justifyContent: 'space-between',\n textAlign: 'left',\n textDecoration: 'none',\n width: '100%',\n};\n\nconst listStyle: CSSProperties = { listStyle: 'none', margin: 0, padding: 0 };\n\nconst childStyle: CSSProperties = {\n background: 'transparent',\n border: 'none',\n color: 'inherit',\n cursor: 'pointer',\n font: 'inherit',\n textAlign: 'left',\n textDecoration: 'none',\n width: '100%',\n};\n\n/**\n * The configuration {@link PanelMenu} takes.\n *\n * `defaultValue` is omitted from the inherited attributes because the props are spread onto\n * `Accordion.Root`, which has a `defaultValue` of its own meaning \"the panels open to begin with\".\n * `HTMLAttributes` declares the form-control `defaultValue` (which includes `readonly string[]`), and the\n * two are not assignable. Dropping it is the honest resolution: a `<div>` has no default value, so nothing\n * is lost, and leaving both in scope would let a caller set one and silently get the other.\n */\nexport interface PanelMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue'> {\n /**\n * The commands to show. A top-level entry with children becomes an expandable panel; one without\n * stays a plain row.\n */\n items?: MenuItem[];\n\n /**\n * Whether more than one panel may be open at once.\n */\n multiple?: boolean;\n}\n\n/**\n * A vertical menu whose sections expand in place, accordion style. Cratis-owned.\n *\n * This exists because PrimeReact 11 removed `primereact/panelmenu` outright. Unlike the other removals in\n * this folder, though, the mechanism it needed did survive: `primereact/accordion` is exactly the\n * expand-collapse behavior a panel menu is, so this composes the v11 `Accordion` parts rather than\n * hand-rolling open state. That is worth doing rather than clever - the accordion already brings the\n * `aria-expanded` and `aria-controls` wiring between a trigger and its content, the disabled handling, and\n * the single-versus-multiple open policy, and every one of those is a thing a hand-rolled version would\n * get subtly wrong. What is Cratis's here is only the mapping from a Scene item model onto those parts.\n *\n * What it deliberately does not carry over from the v10 `PanelMenu`: sections expand exactly one level\n * deep rather than nesting arbitrarily, because an accordion panel holds content and not another\n * accordion; there is no keyboard model beyond the accordion's own; and item templates are not supported.\n */\nexport function PanelMenu({ items = [], multiple = false, ...rest }: PanelMenuProps) {\n return (\n <Accordion.Root {...rest} multiple={multiple} className='flex flex-col gap-1' style={rootStyle}>\n {items.map((item, index) => {\n const children = item.items ?? [];\n\n if (children.length === 0) return <MenuItemAction key={index} item={item} className='flex items-center gap-2 p-3' style={headerStyle} />;\n\n return (\n <Accordion.Panel key={index} value={String(index)} disabled={item.disabled}>\n <Accordion.Header>\n <Accordion.Trigger className='flex items-center gap-2 p-3' style={headerStyle}>\n <MenuItemContent item={item} />\n <Accordion.Indicator>\n <i className='pi pi-chevron-down' aria-hidden='true' />\n </Accordion.Indicator>\n </Accordion.Trigger>\n </Accordion.Header>\n <Accordion.Content>\n <ul role='menu' aria-label={item.label} style={listStyle}>\n {children.map((child, childIndex) => (\n <li key={childIndex} role='none'>\n <MenuItemAction item={child} role='menuitem' className='flex items-center gap-2 p-3' style={childStyle} />\n </li>\n ))}\n </ul>\n </Accordion.Content>\n </Accordion.Panel>\n );\n })}\n </Accordion.Root>\n );\n}\n"],"names":["rootStyle","color","width","headerStyle","background","border","borderRadius","cursor","font","justifyContent","textAlign","textDecoration","listStyle","margin","padding","childStyle","PanelMenu","items","multiple","rest","_jsx","Accordion","Root","className","style","map","item","index","children","length","MenuItemAction","_jsxs","Panel","value","String","disabled","Header","Trigger","MenuItemContent","Indicator","i","aria-hidden","Content","ul","role","aria-label","label","child","childIndex","li"],"mappings":";;;;;AAAA;AACA;AAQA,MAAMA,SAAAA,GAA2B;IAAEC,KAAAA,EAAO,yBAAA;IAA2BC,KAAAA,EAAO;AAAQ,CAAA;AAEpF,MAAMC,WAAAA,GAA6B;IAC/BC,UAAAA,EAAY,2BAAA;IACZC,MAAAA,EAAQ,uCAAA;IACRC,YAAAA,EAAc,oCAAA;IACdL,KAAAA,EAAO,SAAA;IACPM,MAAAA,EAAQ,SAAA;IACRC,IAAAA,EAAM,SAAA;IACNC,cAAAA,EAAgB,eAAA;IAChBC,SAAAA,EAAW,MAAA;IACXC,cAAAA,EAAgB,MAAA;IAChBT,KAAAA,EAAO;AACX,CAAA;AAEA,MAAMU,SAAAA,GAA2B;IAAEA,SAAAA,EAAW,MAAA;IAAQC,MAAAA,EAAQ,CAAA;IAAGC,OAAAA,EAAS;AAAE,CAAA;AAE5E,MAAMC,UAAAA,GAA4B;IAC9BX,UAAAA,EAAY,aAAA;IACZC,MAAAA,EAAQ,MAAA;IACRJ,KAAAA,EAAO,SAAA;IACPM,MAAAA,EAAQ,SAAA;IACRC,IAAAA,EAAM,SAAA;IACNE,SAAAA,EAAW,MAAA;IACXC,cAAAA,EAAgB,MAAA;IAChBT,KAAAA,EAAO;AACX,CAAA;AAwBA;;;;;;;;;;;;;;IAeO,SAASc,SAAAA,CAAU,EAAEC,KAAAA,GAAQ,EAAE,EAA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,4BAAAA,YAAAA,EAAYnB,KAAKoB,KAAK;4BAAEtB,KAAAA,EAAOZ,SAAAA;AAC1CgB,4BAAAA,QAAAA,EAAAA,QAAAA,CAASH,GAAG,CAAC,CAACsB,KAAAA,EAAOC,2BAClB5B,GAAA,CAAC6B,IAAAA,EAAAA;oCAAoBL,IAAAA,EAAK,MAAA;AACtB,oCAAA,QAAA,gBAAAxB,GAAA,CAACU,cAAAA,EAAAA;wCAAeJ,IAAAA,EAAMqB,KAAAA;wCAAOH,IAAAA,EAAK,UAAA;wCAAWrB,SAAAA,EAAU,6BAAA;wCAA8BC,KAAAA,EAAOT;;AADvFiC,iCAAAA,EAAAA,UAAAA,CAAAA;;;;AAZHrB,aAAAA,EAAAA,KAAAA,CAAAA;AAoB9B,QAAA,CAAA;;AAGZ
|
|
1
|
+
{"version":3,"file":"PanelMenu.js","sources":["../../../menu/PanelMenu.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 { CSSProperties, HTMLAttributes } from 'react';\nimport { Accordion } from 'primereact/accordion';\nimport { MenuItem } from '../MenuItem';\nimport { MenuItemAction } from './MenuItemAction';\nimport { MenuItemContent } from './MenuItemContent';\n\nconst rootStyle: CSSProperties = { color: 'var(--scene-text-color)', width: '16rem' };\n\nconst headerStyle: CSSProperties = {\n background: 'var(--scene-surface-card)',\n border: '1px solid var(--scene-surface-border)',\n borderRadius: 'var(--scene-content-border-radius)',\n color: 'inherit',\n cursor: 'pointer',\n font: 'inherit',\n justifyContent: 'space-between',\n textAlign: 'left',\n textDecoration: 'none',\n width: '100%',\n};\n\nconst listStyle: CSSProperties = { listStyle: 'none', margin: 0, padding: 0 };\n\nconst childStyle: CSSProperties = {\n background: 'transparent',\n border: 'none',\n color: 'inherit',\n cursor: 'pointer',\n font: 'inherit',\n textAlign: 'left',\n textDecoration: 'none',\n width: '100%',\n};\n\n/**\n * The configuration {@link PanelMenu} takes.\n *\n * `defaultValue` is omitted from the inherited attributes because the props are spread onto\n * `Accordion.Root`, which has a `defaultValue` of its own meaning \"the panels open to begin with\".\n * `HTMLAttributes` declares the form-control `defaultValue` (which includes `readonly string[]`), and the\n * two are not assignable. Dropping it is the honest resolution: a `<div>` has no default value, so nothing\n * is lost, and leaving both in scope would let a caller set one and silently get the other.\n */\nexport interface PanelMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue'> {\n /**\n * The commands to show. A top-level entry with children becomes an expandable panel; one without\n * stays a plain row.\n */\n items?: MenuItem[];\n\n /**\n * Whether more than one panel may be open at once.\n */\n multiple?: boolean;\n}\n\n/**\n * A vertical menu whose sections expand in place, accordion style. Cratis-owned.\n *\n * This exists because PrimeReact 11 removed `primereact/panelmenu` outright. Unlike the other removals in\n * this folder, though, the mechanism it needed did survive: `primereact/accordion` is exactly the\n * expand-collapse behavior a panel menu is, so this composes the v11 `Accordion` parts rather than\n * hand-rolling open state. That is worth doing rather than clever - the accordion already brings the\n * `aria-expanded` and `aria-controls` wiring between a trigger and its content, the disabled handling, and\n * the single-versus-multiple open policy, and every one of those is a thing a hand-rolled version would\n * get subtly wrong. What is Cratis's here is only the mapping from a Scene item model onto those parts.\n *\n * What it deliberately does not carry over from the v10 `PanelMenu`: sections expand exactly one level\n * deep rather than nesting arbitrarily, because an accordion panel holds content and not another\n * accordion; there is no keyboard model beyond the accordion's own; and item templates are not supported.\n */\nexport function PanelMenu({ items = [], multiple = false, ...rest }: PanelMenuProps) {\n return (\n <Accordion.Root {...rest} multiple={multiple} className='flex flex-col gap-1' style={rootStyle}>\n {items.map((item, index) => {\n const children = item.items ?? [];\n\n if (children.length === 0) return <MenuItemAction key={index} item={item} className='flex items-center gap-2 p-3' style={headerStyle} />;\n\n return (\n <Accordion.Panel key={index} value={String(index)} disabled={item.disabled}>\n <Accordion.Header>\n <Accordion.Trigger className='flex items-center gap-2 p-3' style={headerStyle}>\n <MenuItemContent item={item} />\n <Accordion.Indicator>\n <i className='pi pi-chevron-down' aria-hidden='true' />\n </Accordion.Indicator>\n </Accordion.Trigger>\n </Accordion.Header>\n <Accordion.Content>\n <ul role='menu' aria-label={item.label} style={listStyle}>\n {children.map((child, childIndex) => (\n <li key={childIndex} role='none'>\n <MenuItemAction item={child} role='menuitem' className='flex items-center gap-2 p-3' style={childStyle} />\n </li>\n ))}\n </ul>\n </Accordion.Content>\n </Accordion.Panel>\n );\n })}\n </Accordion.Root>\n );\n}\n"],"names":["rootStyle","color","width","headerStyle","background","border","borderRadius","cursor","font","justifyContent","textAlign","textDecoration","listStyle","margin","padding","childStyle","PanelMenu","items","multiple","rest","_jsx","Accordion","Root","className","style","map","item","index","children","length","MenuItemAction","_jsxs","Panel","value","String","disabled","Header","Trigger","MenuItemContent","Indicator","i","aria-hidden","Content","ul","role","aria-label","label","child","childIndex","li"],"mappings":";;;;;AAAA;AACA;AAQA,MAAMA,SAAAA,GAA2B;IAAEC,KAAAA,EAAO,yBAAA;IAA2BC,KAAAA,EAAO;AAAQ,CAAA;AAEpF,MAAMC,WAAAA,GAA6B;IAC/BC,UAAAA,EAAY,2BAAA;IACZC,MAAAA,EAAQ,uCAAA;IACRC,YAAAA,EAAc,oCAAA;IACdL,KAAAA,EAAO,SAAA;IACPM,MAAAA,EAAQ,SAAA;IACRC,IAAAA,EAAM,SAAA;IACNC,cAAAA,EAAgB,eAAA;IAChBC,SAAAA,EAAW,MAAA;IACXC,cAAAA,EAAgB,MAAA;IAChBT,KAAAA,EAAO;AACX,CAAA;AAEA,MAAMU,SAAAA,GAA2B;IAAEA,SAAAA,EAAW,MAAA;IAAQC,MAAAA,EAAQ,CAAA;IAAGC,OAAAA,EAAS;AAAE,CAAA;AAE5E,MAAMC,UAAAA,GAA4B;IAC9BX,UAAAA,EAAY,aAAA;IACZC,MAAAA,EAAQ,MAAA;IACRJ,KAAAA,EAAO,SAAA;IACPM,MAAAA,EAAQ,SAAA;IACRC,IAAAA,EAAM,SAAA;IACNE,SAAAA,EAAW,MAAA;IACX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