@cratis/showrunner.notes.react 0.0.0-stage → 1.0.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/Buttons/NotesButton.tsx +117 -0
- package/Buttons/index.ts +6 -0
- package/Buttons/menuItems.ts +55 -0
- package/Buttons/notesDialogHeaderActions.tsx +33 -0
- package/Context/componentContext.ts +57 -0
- package/Context/formatLocation.ts +27 -0
- package/Context/index.ts +6 -0
- package/Context/noteContext.ts +139 -0
- package/Feedback/ComponentFeedbackDialog.tsx +150 -0
- package/Feedback/ComponentModeSwitch.tsx +39 -0
- package/Feedback/ContextSummary.tsx +31 -0
- package/Feedback/FeedbackDialog.tsx +64 -0
- package/Feedback/KindAndText.tsx +38 -0
- package/Feedback/SliceChooser.tsx +90 -0
- package/Feedback/SlicesFeedbackDialog.tsx +63 -0
- package/Feedback/index.ts +13 -0
- package/Feedback/kindOptions.ts +35 -0
- package/Feedback/propertySuggestions.ts +38 -0
- package/Feedback/sliceChoice.ts +73 -0
- package/Icons.tsx +29 -0
- package/Labels/NotesLabels.ts +185 -0
- package/Labels/defaultNotesLabels.ts +93 -0
- package/Labels/format.ts +13 -0
- package/Labels/index.ts +7 -0
- package/Labels/resolveLabels.ts +36 -0
- package/MyFeedback/MyFeedbackDialog.tsx +51 -0
- package/MyFeedback/MyFeedbackList.tsx +62 -0
- package/MyFeedback/index.ts +6 -0
- package/MyFeedback/noteStates.ts +75 -0
- package/Provider/NotesContext.ts +111 -0
- package/Provider/NotesProvider.tsx +122 -0
- package/Provider/index.ts +6 -0
- package/Provider/notesVisibility.ts +13 -0
- package/README.md +49 -2
- package/dist/cjs/Buttons/NotesButton.d.ts +8 -0
- package/dist/cjs/Buttons/NotesButton.d.ts.map +1 -0
- package/dist/cjs/Buttons/NotesButton.js +126 -0
- package/dist/cjs/Buttons/NotesButton.js.map +1 -0
- package/dist/cjs/Buttons/index.d.ts +4 -0
- package/dist/cjs/Buttons/index.d.ts.map +1 -0
- package/dist/cjs/Buttons/menuItems.d.ts +10 -0
- package/dist/cjs/Buttons/menuItems.d.ts.map +1 -0
- package/dist/cjs/Buttons/menuItems.js +57 -0
- package/dist/cjs/Buttons/menuItems.js.map +1 -0
- package/dist/cjs/Buttons/notesDialogHeaderActions.d.ts +4 -0
- package/dist/cjs/Buttons/notesDialogHeaderActions.d.ts.map +1 -0
- package/dist/cjs/Buttons/notesDialogHeaderActions.js +37 -0
- package/dist/cjs/Buttons/notesDialogHeaderActions.js.map +1 -0
- package/dist/cjs/Context/componentContext.d.ts +8 -0
- package/dist/cjs/Context/componentContext.d.ts.map +1 -0
- package/dist/cjs/Context/componentContext.js +56 -0
- package/dist/cjs/Context/componentContext.js.map +1 -0
- package/dist/cjs/Context/formatLocation.d.ts +7 -0
- package/dist/cjs/Context/formatLocation.d.ts.map +1 -0
- package/dist/cjs/Context/formatLocation.js +23 -0
- package/dist/cjs/Context/formatLocation.js.map +1 -0
- package/dist/cjs/Context/index.d.ts +4 -0
- package/dist/cjs/Context/index.d.ts.map +1 -0
- package/dist/cjs/Context/noteContext.d.ts +22 -0
- package/dist/cjs/Context/noteContext.d.ts.map +1 -0
- package/dist/cjs/Context/noteContext.js +117 -0
- package/dist/cjs/Context/noteContext.js.map +1 -0
- package/dist/cjs/Feedback/ComponentFeedbackDialog.d.ts +10 -0
- package/dist/cjs/Feedback/ComponentFeedbackDialog.d.ts.map +1 -0
- package/dist/cjs/Feedback/ComponentFeedbackDialog.js +183 -0
- package/dist/cjs/Feedback/ComponentFeedbackDialog.js.map +1 -0
- package/dist/cjs/Feedback/ComponentModeSwitch.d.ts +7 -0
- package/dist/cjs/Feedback/ComponentModeSwitch.d.ts.map +1 -0
- package/dist/cjs/Feedback/ComponentModeSwitch.js +29 -0
- package/dist/cjs/Feedback/ComponentModeSwitch.js.map +1 -0
- package/dist/cjs/Feedback/ContextSummary.d.ts +7 -0
- package/dist/cjs/Feedback/ContextSummary.d.ts.map +1 -0
- package/dist/cjs/Feedback/ContextSummary.js +31 -0
- package/dist/cjs/Feedback/ContextSummary.js.map +1 -0
- package/dist/cjs/Feedback/FeedbackDialog.d.ts +11 -0
- package/dist/cjs/Feedback/FeedbackDialog.d.ts.map +1 -0
- package/dist/cjs/Feedback/FeedbackDialog.js +55 -0
- package/dist/cjs/Feedback/FeedbackDialog.js.map +1 -0
- package/dist/cjs/Feedback/KindAndText.d.ts +7 -0
- package/dist/cjs/Feedback/KindAndText.d.ts.map +1 -0
- package/dist/cjs/Feedback/KindAndText.js +33 -0
- package/dist/cjs/Feedback/KindAndText.js.map +1 -0
- package/dist/cjs/Feedback/SliceChooser.d.ts +9 -0
- package/dist/cjs/Feedback/SliceChooser.d.ts.map +1 -0
- package/dist/cjs/Feedback/SliceChooser.js +113 -0
- package/dist/cjs/Feedback/SliceChooser.js.map +1 -0
- package/dist/cjs/Feedback/SlicesFeedbackDialog.d.ts +8 -0
- package/dist/cjs/Feedback/SlicesFeedbackDialog.d.ts.map +1 -0
- package/dist/cjs/Feedback/SlicesFeedbackDialog.js +74 -0
- package/dist/cjs/Feedback/SlicesFeedbackDialog.js.map +1 -0
- package/dist/cjs/Feedback/index.d.ts +11 -0
- package/dist/cjs/Feedback/index.d.ts.map +1 -0
- package/dist/cjs/Feedback/kindOptions.d.ts +9 -0
- package/dist/cjs/Feedback/kindOptions.d.ts.map +1 -0
- package/dist/cjs/Feedback/kindOptions.js +37 -0
- package/dist/cjs/Feedback/kindOptions.js.map +1 -0
- package/dist/cjs/Feedback/propertySuggestions.d.ts +6 -0
- package/dist/cjs/Feedback/propertySuggestions.d.ts.map +1 -0
- package/dist/cjs/Feedback/propertySuggestions.js +32 -0
- package/dist/cjs/Feedback/propertySuggestions.js.map +1 -0
- package/dist/cjs/Feedback/sliceChoice.d.ts +7 -0
- package/dist/cjs/Feedback/sliceChoice.d.ts.map +1 -0
- package/dist/cjs/Feedback/sliceChoice.js +71 -0
- package/dist/cjs/Feedback/sliceChoice.js.map +1 -0
- package/dist/cjs/Icons.d.ts +4 -0
- package/dist/cjs/Icons.d.ts.map +1 -0
- package/dist/cjs/Icons.js +53 -0
- package/dist/cjs/Icons.js.map +1 -0
- package/dist/cjs/Labels/NotesLabels.d.ts +90 -0
- package/dist/cjs/Labels/NotesLabels.d.ts.map +1 -0
- package/dist/cjs/Labels/defaultNotesLabels.d.ts +3 -0
- package/dist/cjs/Labels/defaultNotesLabels.d.ts.map +1 -0
- package/dist/cjs/Labels/defaultNotesLabels.js +94 -0
- package/dist/cjs/Labels/defaultNotesLabels.js.map +1 -0
- package/dist/cjs/Labels/format.d.ts +2 -0
- package/dist/cjs/Labels/format.d.ts.map +1 -0
- package/dist/cjs/Labels/format.js +15 -0
- package/dist/cjs/Labels/format.js.map +1 -0
- package/dist/cjs/Labels/index.d.ts +5 -0
- package/dist/cjs/Labels/index.d.ts.map +1 -0
- package/dist/cjs/Labels/resolveLabels.d.ts +3 -0
- package/dist/cjs/Labels/resolveLabels.d.ts.map +1 -0
- package/dist/cjs/Labels/resolveLabels.js +35 -0
- package/dist/cjs/Labels/resolveLabels.js.map +1 -0
- package/dist/cjs/MyFeedback/MyFeedbackDialog.d.ts +2 -0
- package/dist/cjs/MyFeedback/MyFeedbackDialog.d.ts.map +1 -0
- package/dist/cjs/MyFeedback/MyFeedbackDialog.js +55 -0
- package/dist/cjs/MyFeedback/MyFeedbackDialog.js.map +1 -0
- package/dist/cjs/MyFeedback/MyFeedbackList.d.ts +10 -0
- package/dist/cjs/MyFeedback/MyFeedbackList.d.ts.map +1 -0
- package/dist/cjs/MyFeedback/MyFeedbackList.js +62 -0
- package/dist/cjs/MyFeedback/MyFeedbackList.js.map +1 -0
- package/dist/cjs/MyFeedback/index.d.ts +4 -0
- package/dist/cjs/MyFeedback/index.d.ts.map +1 -0
- package/dist/cjs/MyFeedback/noteStates.d.ts +8 -0
- package/dist/cjs/MyFeedback/noteStates.d.ts.map +1 -0
- package/dist/cjs/MyFeedback/noteStates.js +90 -0
- package/dist/cjs/MyFeedback/noteStates.js.map +1 -0
- package/dist/cjs/Provider/NotesContext.d.ts +23 -0
- package/dist/cjs/Provider/NotesContext.d.ts.map +1 -0
- package/dist/cjs/Provider/NotesContext.js +51 -0
- package/dist/cjs/Provider/NotesContext.js.map +1 -0
- package/dist/cjs/Provider/NotesProvider.d.ts +11 -0
- package/dist/cjs/Provider/NotesProvider.d.ts.map +1 -0
- package/dist/cjs/Provider/NotesProvider.js +133 -0
- package/dist/cjs/Provider/NotesProvider.js.map +1 -0
- package/dist/cjs/Provider/index.d.ts +4 -0
- package/dist/cjs/Provider/index.d.ts.map +1 -0
- package/dist/cjs/Provider/notesVisibility.d.ts +2 -0
- package/dist/cjs/Provider/notesVisibility.d.ts.map +1 -0
- package/dist/cjs/Provider/notesVisibility.js +16 -0
- package/dist/cjs/Provider/notesVisibility.js.map +1 -0
- package/dist/cjs/index.d.ts +8 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +85 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/esm/Buttons/NotesButton.d.ts +8 -0
- package/dist/esm/Buttons/NotesButton.d.ts.map +1 -0
- package/dist/esm/Buttons/NotesButton.js +124 -0
- package/dist/esm/Buttons/NotesButton.js.map +1 -0
- package/dist/esm/Buttons/index.d.ts +4 -0
- package/dist/esm/Buttons/index.d.ts.map +1 -0
- package/dist/esm/Buttons/index.js +4 -0
- package/dist/esm/Buttons/index.js.map +1 -0
- package/dist/esm/Buttons/menuItems.d.ts +10 -0
- package/dist/esm/Buttons/menuItems.d.ts.map +1 -0
- package/dist/esm/Buttons/menuItems.js +54 -0
- package/dist/esm/Buttons/menuItems.js.map +1 -0
- package/dist/esm/Buttons/notesDialogHeaderActions.d.ts +4 -0
- package/dist/esm/Buttons/notesDialogHeaderActions.d.ts.map +1 -0
- package/dist/esm/Buttons/notesDialogHeaderActions.js +34 -0
- package/dist/esm/Buttons/notesDialogHeaderActions.js.map +1 -0
- package/dist/esm/Context/componentContext.d.ts +8 -0
- package/dist/esm/Context/componentContext.d.ts.map +1 -0
- package/dist/esm/Context/componentContext.js +51 -0
- package/dist/esm/Context/componentContext.js.map +1 -0
- package/dist/esm/Context/formatLocation.d.ts +7 -0
- package/dist/esm/Context/formatLocation.d.ts.map +1 -0
- package/dist/esm/Context/formatLocation.js +21 -0
- package/dist/esm/Context/formatLocation.js.map +1 -0
- package/dist/esm/Context/index.d.ts +4 -0
- package/dist/esm/Context/index.d.ts.map +1 -0
- package/dist/esm/Context/index.js +4 -0
- package/dist/esm/Context/index.js.map +1 -0
- package/dist/esm/Context/noteContext.d.ts +22 -0
- package/dist/esm/Context/noteContext.d.ts.map +1 -0
- package/dist/esm/Context/noteContext.js +110 -0
- package/dist/esm/Context/noteContext.js.map +1 -0
- package/dist/esm/Feedback/ComponentFeedbackDialog.d.ts +10 -0
- package/dist/esm/Feedback/ComponentFeedbackDialog.d.ts.map +1 -0
- package/dist/esm/Feedback/ComponentFeedbackDialog.js +181 -0
- package/dist/esm/Feedback/ComponentFeedbackDialog.js.map +1 -0
- package/dist/esm/Feedback/ComponentModeSwitch.d.ts +7 -0
- package/dist/esm/Feedback/ComponentModeSwitch.d.ts.map +1 -0
- package/dist/esm/Feedback/ComponentModeSwitch.js +27 -0
- package/dist/esm/Feedback/ComponentModeSwitch.js.map +1 -0
- package/dist/esm/Feedback/ContextSummary.d.ts +7 -0
- package/dist/esm/Feedback/ContextSummary.d.ts.map +1 -0
- package/dist/esm/Feedback/ContextSummary.js +29 -0
- package/dist/esm/Feedback/ContextSummary.js.map +1 -0
- package/dist/esm/Feedback/FeedbackDialog.d.ts +11 -0
- package/dist/esm/Feedback/FeedbackDialog.d.ts.map +1 -0
- package/dist/esm/Feedback/FeedbackDialog.js +53 -0
- package/dist/esm/Feedback/FeedbackDialog.js.map +1 -0
- package/dist/esm/Feedback/KindAndText.d.ts +7 -0
- package/dist/esm/Feedback/KindAndText.d.ts.map +1 -0
- package/dist/esm/Feedback/KindAndText.js +31 -0
- package/dist/esm/Feedback/KindAndText.js.map +1 -0
- package/dist/esm/Feedback/SliceChooser.d.ts +9 -0
- package/dist/esm/Feedback/SliceChooser.d.ts.map +1 -0
- package/dist/esm/Feedback/SliceChooser.js +111 -0
- package/dist/esm/Feedback/SliceChooser.js.map +1 -0
- package/dist/esm/Feedback/SlicesFeedbackDialog.d.ts +8 -0
- package/dist/esm/Feedback/SlicesFeedbackDialog.d.ts.map +1 -0
- package/dist/esm/Feedback/SlicesFeedbackDialog.js +72 -0
- package/dist/esm/Feedback/SlicesFeedbackDialog.js.map +1 -0
- package/dist/esm/Feedback/index.d.ts +11 -0
- package/dist/esm/Feedback/index.d.ts.map +1 -0
- package/dist/esm/Feedback/index.js +11 -0
- package/dist/esm/Feedback/index.js.map +1 -0
- package/dist/esm/Feedback/kindOptions.d.ts +9 -0
- package/dist/esm/Feedback/kindOptions.d.ts.map +1 -0
- package/dist/esm/Feedback/kindOptions.js +34 -0
- package/dist/esm/Feedback/kindOptions.js.map +1 -0
- package/dist/esm/Feedback/propertySuggestions.d.ts +6 -0
- package/dist/esm/Feedback/propertySuggestions.d.ts.map +1 -0
- package/dist/esm/Feedback/propertySuggestions.js +29 -0
- package/dist/esm/Feedback/propertySuggestions.js.map +1 -0
- package/dist/esm/Feedback/sliceChoice.d.ts +7 -0
- package/dist/esm/Feedback/sliceChoice.d.ts.map +1 -0
- package/dist/esm/Feedback/sliceChoice.js +65 -0
- package/dist/esm/Feedback/sliceChoice.js.map +1 -0
- package/dist/esm/Icons.d.ts +4 -0
- package/dist/esm/Icons.d.ts.map +1 -0
- package/dist/esm/Icons.js +49 -0
- package/dist/esm/Icons.js.map +1 -0
- package/dist/esm/Labels/NotesLabels.d.ts +90 -0
- package/dist/esm/Labels/NotesLabels.d.ts.map +1 -0
- package/dist/esm/Labels/NotesLabels.js +2 -0
- package/dist/esm/Labels/NotesLabels.js.map +1 -0
- package/dist/esm/Labels/defaultNotesLabels.d.ts +3 -0
- package/dist/esm/Labels/defaultNotesLabels.d.ts.map +1 -0
- package/dist/esm/Labels/defaultNotesLabels.js +92 -0
- package/dist/esm/Labels/defaultNotesLabels.js.map +1 -0
- package/dist/esm/Labels/format.d.ts +2 -0
- package/dist/esm/Labels/format.d.ts.map +1 -0
- package/dist/esm/Labels/format.js +13 -0
- package/dist/esm/Labels/format.js.map +1 -0
- package/dist/esm/Labels/index.d.ts +5 -0
- package/dist/esm/Labels/index.d.ts.map +1 -0
- package/dist/esm/Labels/index.js +5 -0
- package/dist/esm/Labels/index.js.map +1 -0
- package/dist/esm/Labels/resolveLabels.d.ts +3 -0
- package/dist/esm/Labels/resolveLabels.d.ts.map +1 -0
- package/dist/esm/Labels/resolveLabels.js +33 -0
- package/dist/esm/Labels/resolveLabels.js.map +1 -0
- package/dist/esm/MyFeedback/MyFeedbackDialog.d.ts +2 -0
- package/dist/esm/MyFeedback/MyFeedbackDialog.d.ts.map +1 -0
- package/dist/esm/MyFeedback/MyFeedbackDialog.js +53 -0
- package/dist/esm/MyFeedback/MyFeedbackDialog.js.map +1 -0
- package/dist/esm/MyFeedback/MyFeedbackList.d.ts +10 -0
- package/dist/esm/MyFeedback/MyFeedbackList.d.ts.map +1 -0
- package/dist/esm/MyFeedback/MyFeedbackList.js +60 -0
- package/dist/esm/MyFeedback/MyFeedbackList.js.map +1 -0
- package/dist/esm/MyFeedback/index.d.ts +4 -0
- package/dist/esm/MyFeedback/index.d.ts.map +1 -0
- package/dist/esm/MyFeedback/index.js +4 -0
- package/dist/esm/MyFeedback/index.js.map +1 -0
- package/dist/esm/MyFeedback/noteStates.d.ts +8 -0
- package/dist/esm/MyFeedback/noteStates.d.ts.map +1 -0
- package/dist/esm/MyFeedback/noteStates.js +84 -0
- package/dist/esm/MyFeedback/noteStates.js.map +1 -0
- package/dist/esm/Provider/NotesContext.d.ts +23 -0
- package/dist/esm/Provider/NotesContext.d.ts.map +1 -0
- package/dist/esm/Provider/NotesContext.js +44 -0
- package/dist/esm/Provider/NotesContext.js.map +1 -0
- package/dist/esm/Provider/NotesProvider.d.ts +11 -0
- package/dist/esm/Provider/NotesProvider.d.ts.map +1 -0
- package/dist/esm/Provider/NotesProvider.js +131 -0
- package/dist/esm/Provider/NotesProvider.js.map +1 -0
- package/dist/esm/Provider/index.d.ts +4 -0
- package/dist/esm/Provider/index.d.ts.map +1 -0
- package/dist/esm/Provider/index.js +4 -0
- package/dist/esm/Provider/index.js.map +1 -0
- package/dist/esm/Provider/notesVisibility.d.ts +2 -0
- package/dist/esm/Provider/notesVisibility.d.ts.map +1 -0
- package/dist/esm/Provider/notesVisibility.js +14 -0
- package/dist/esm/Provider/notesVisibility.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +27 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/index.ts +10 -0
- package/package.json +84 -5
- package/styles.css +192 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KindAndText.js","sources":["../../../Feedback/KindAndText.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 { RadioGroupField, TextAreaField } from '@cratis/components/CommandForm';\nimport { NoteKind } from '@cratis/showrunner.notes';\nimport { useNotesLabels } from '../Provider/NotesContext.js';\nimport { kindOptions } from './kindOptions.js';\n\n/**\n * The command values {@link KindAndText} binds to.\n */\nexport interface KindAndTextValues {\n /** What kind of feedback it is. */\n kind: NoteKind;\n\n /** What the user writes. */\n text: string;\n}\n\n/**\n * The kind selector and the text field every feedback dialog has.\n */\nexport const KindAndText = <TCommand extends KindAndTextValues>() => {\n const labels = useNotesLabels();\n\n return (\n <div className='notes-kind-and-text'>\n <RadioGroupField<TCommand>\n value={command => command.kind}\n title={labels.kinds.title}\n options={kindOptions(labels)}\n optionValue='value'\n optionLabel='label'\n layout='horizontal' />\n <TextAreaField<TCommand> value={command => command.text} title={labels.feedback.text} rows={5} />\n </div>\n );\n};\n"],"names":["KindAndText","labels","useNotesLabels","_jsxs","div","className","_jsx","RadioGroupField","value","command","kind","title","kinds","options","kindOptions","optionValue","optionLabel","layout","TextAreaField","text","feedback","rows"],"mappings":";;;;;AAmBA;;UAGaA,WAAAA,GAAc,IAAA;AACvB,IAAA,MAAMC,MAAAA,GAASC,cAAAA,EAAAA;AAEf,IAAA,qBACIC,IAAA,CAACC,KAAAA,EAAAA;QAAIC,SAAAA,EAAU,qBAAA;;0BACXC,GAAA,CAACC,eAAAA,EAAAA;gBACGC,KAAAA,EAAOC,CAAAA,OAAAA,GAAWA,OAAAA,CAAQC,IAAI;gBAC9BC,KAAAA,EAAOV,MAAAA,CAAOW,KAAK,CAACD,KAAK;AACzBE,gBAAAA,OAAAA,EAASC,WAAAA,CAAYb,MAAAA,CAAAA;gBACrBc,WAAAA,EAAY,OAAA;gBACZC,WAAAA,EAAY,OAAA;gBACZC,MAAAA,EAAO;;0BACXX,GAAA,CAACY,aAAAA,EAAAA;gBAAwBV,KAAAA,EAAOC,CAAAA,OAAAA,GAAWA,OAAAA,CAAQU,IAAI;gBAAER,KAAAA,EAAOV,MAAAA,CAAOmB,QAAQ,CAACD,IAAI;gBAAEE,IAAAA,EAAM;;;;AAGxG;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LocationParts } from '../Context/formatLocation.js';
|
|
2
|
+
export interface SliceChooserProps {
|
|
3
|
+
active: readonly LocationParts[];
|
|
4
|
+
known: readonly LocationParts[];
|
|
5
|
+
chosen: readonly LocationParts[];
|
|
6
|
+
onChange: (chosen: LocationParts[]) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const SliceChooser: ({ active, known, chosen, onChange }: SliceChooserProps) => import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=SliceChooser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliceChooser.d.ts","sourceRoot":"","sources":["../../../Feedback/SliceChooser.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAkB,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAS7E,MAAM,WAAW,iBAAiB;IAE9B,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAGjC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAGhC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAGjC,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;CAC/C;AAKD,eAAO,MAAM,YAAY,GAAI,qCAAqC,iBAAiB,gCA0DlF,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { TextInput, IconButton, Checkbox } from '@cratis/components/Common';
|
|
3
|
+
import { useState, useId } from 'react';
|
|
4
|
+
import { formatLocation } from '../Context/formatLocation.js';
|
|
5
|
+
import { CloseIcon } from '../Icons.js';
|
|
6
|
+
import { format } from '../Labels/format.js';
|
|
7
|
+
import { useNotesLabels } from '../Provider/NotesContext.js';
|
|
8
|
+
import { distinctSlices, searchSlices, toggleSlice, sliceKey, isChosen } from './sliceChoice.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Chooses the slices a note is about: the ones active on the screen, and a search over all the slices the host knows.
|
|
12
|
+
*/ const SliceChooser = ({ active, known, chosen, onChange })=>{
|
|
13
|
+
const labels = useNotesLabels();
|
|
14
|
+
const [query, setQuery] = useState('');
|
|
15
|
+
const activeId = useId();
|
|
16
|
+
const resultsId = useId();
|
|
17
|
+
const activeSlices = distinctSlices(active);
|
|
18
|
+
const results = searchSlices(known, query);
|
|
19
|
+
const name = (location)=>formatLocation(location, labels.common.locationSeparator, labels.common.unknownLocation);
|
|
20
|
+
const option = (location)=>/*#__PURE__*/ jsx("li", {
|
|
21
|
+
children: /*#__PURE__*/ jsx(Checkbox, {
|
|
22
|
+
label: name(location),
|
|
23
|
+
checked: isChosen(chosen, location),
|
|
24
|
+
onChange: ()=>onChange(toggleSlice(chosen, location))
|
|
25
|
+
})
|
|
26
|
+
}, sliceKey(location));
|
|
27
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
28
|
+
className: "notes-slice-chooser",
|
|
29
|
+
children: [
|
|
30
|
+
/*#__PURE__*/ jsxs("section", {
|
|
31
|
+
"aria-labelledby": activeId,
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ jsx("h3", {
|
|
34
|
+
id: activeId,
|
|
35
|
+
className: "notes-slice-chooser__heading",
|
|
36
|
+
children: labels.slices.active
|
|
37
|
+
}),
|
|
38
|
+
activeSlices.length === 0 ? /*#__PURE__*/ jsx("p", {
|
|
39
|
+
className: "notes-slice-chooser__empty",
|
|
40
|
+
children: labels.slices.noneActive
|
|
41
|
+
}) : /*#__PURE__*/ jsx("ul", {
|
|
42
|
+
className: "notes-slice-chooser__list",
|
|
43
|
+
children: activeSlices.map(option)
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
}),
|
|
47
|
+
/*#__PURE__*/ jsxs("section", {
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ jsx("label", {
|
|
50
|
+
className: "notes-slice-chooser__heading",
|
|
51
|
+
htmlFor: `${resultsId}-search`,
|
|
52
|
+
children: labels.slices.search
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ jsx(TextInput, {
|
|
55
|
+
id: `${resultsId}-search`,
|
|
56
|
+
type: "search",
|
|
57
|
+
value: query,
|
|
58
|
+
placeholder: labels.slices.searchPlaceholder,
|
|
59
|
+
"aria-controls": resultsId,
|
|
60
|
+
onChange: (value)=>setQuery(value)
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ jsx("div", {
|
|
63
|
+
id: resultsId,
|
|
64
|
+
"aria-live": "polite",
|
|
65
|
+
children: query.trim().length > 0 && (results.length === 0 ? /*#__PURE__*/ jsx("p", {
|
|
66
|
+
className: "notes-slice-chooser__empty",
|
|
67
|
+
children: labels.slices.noMatches
|
|
68
|
+
}) : /*#__PURE__*/ jsx("ul", {
|
|
69
|
+
className: "notes-slice-chooser__list",
|
|
70
|
+
"aria-label": labels.slices.results,
|
|
71
|
+
children: results.map(option)
|
|
72
|
+
}))
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
}),
|
|
76
|
+
chosen.length > 0 && /*#__PURE__*/ jsxs("section", {
|
|
77
|
+
children: [
|
|
78
|
+
/*#__PURE__*/ jsx("p", {
|
|
79
|
+
className: "notes-slice-chooser__heading",
|
|
80
|
+
children: format(labels.slices.chosen, {
|
|
81
|
+
count: chosen.length
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
/*#__PURE__*/ jsx("ul", {
|
|
85
|
+
className: "notes-slice-chooser__chosen",
|
|
86
|
+
children: chosen.map((location)=>/*#__PURE__*/ jsxs("li", {
|
|
87
|
+
className: "notes-slice-chooser__chip",
|
|
88
|
+
children: [
|
|
89
|
+
/*#__PURE__*/ jsx("span", {
|
|
90
|
+
children: name(location)
|
|
91
|
+
}),
|
|
92
|
+
/*#__PURE__*/ jsx(IconButton, {
|
|
93
|
+
variant: "ghost",
|
|
94
|
+
size: "small",
|
|
95
|
+
icon: /*#__PURE__*/ jsx(CloseIcon, {}),
|
|
96
|
+
"aria-label": format(labels.slices.remove, {
|
|
97
|
+
slice: name(location)
|
|
98
|
+
}),
|
|
99
|
+
onClick: ()=>onChange(toggleSlice(chosen, location))
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
}, sliceKey(location)))
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export { SliceChooser };
|
|
111
|
+
//# sourceMappingURL=SliceChooser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliceChooser.js","sources":["../../../Feedback/SliceChooser.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 { Checkbox, IconButton, TextInput } from '@cratis/components/Common';\nimport { useId, useState } from 'react';\nimport { formatLocation, LocationParts } from '../Context/formatLocation.js';\nimport { CloseIcon } from '../Icons.js';\nimport { format } from '../Labels/index.js';\nimport { useNotesLabels } from '../Provider/NotesContext.js';\nimport { distinctSlices, isChosen, searchSlices, sliceKey, toggleSlice } from './sliceChoice.js';\n\n/**\n * Props for {@link SliceChooser}.\n */\nexport interface SliceChooserProps {\n /** The slices active on the screen. */\n active: readonly LocationParts[];\n\n /** Every slice the host knows about, to search over. */\n known: readonly LocationParts[];\n\n /** The chosen slices. */\n chosen: readonly LocationParts[];\n\n /** Called with the chosen slices after a change. */\n onChange: (chosen: LocationParts[]) => void;\n}\n\n/**\n * Chooses the slices a note is about: the ones active on the screen, and a search over all the slices the host knows.\n */\nexport const SliceChooser = ({ active, known, chosen, onChange }: SliceChooserProps) => {\n const labels = useNotesLabels();\n const [query, setQuery] = useState('');\n const activeId = useId();\n const resultsId = useId();\n const activeSlices = distinctSlices(active);\n const results = searchSlices(known, query);\n const name = (location: LocationParts) => formatLocation(location, labels.common.locationSeparator, labels.common.unknownLocation);\n\n const option = (location: LocationParts) => (\n <li key={sliceKey(location)}>\n <Checkbox label={name(location)} checked={isChosen(chosen, location)} onChange={() => onChange(toggleSlice(chosen, location))} />\n </li>\n );\n\n return (\n <div className='notes-slice-chooser'>\n <section aria-labelledby={activeId}>\n <h3 id={activeId} className='notes-slice-chooser__heading'>{labels.slices.active}</h3>\n {activeSlices.length === 0\n ? <p className='notes-slice-chooser__empty'>{labels.slices.noneActive}</p>\n : <ul className='notes-slice-chooser__list'>{activeSlices.map(option)}</ul>}\n </section>\n <section>\n <label className='notes-slice-chooser__heading' htmlFor={`${resultsId}-search`}>{labels.slices.search}</label>\n <TextInput\n id={`${resultsId}-search`}\n type='search'\n value={query}\n placeholder={labels.slices.searchPlaceholder}\n aria-controls={resultsId}\n onChange={value => setQuery(value)} />\n <div id={resultsId} aria-live='polite'>\n {query.trim().length > 0 && (results.length === 0\n ? <p className='notes-slice-chooser__empty'>{labels.slices.noMatches}</p>\n : <ul className='notes-slice-chooser__list' aria-label={labels.slices.results}>{results.map(option)}</ul>)}\n </div>\n </section>\n {chosen.length > 0 && (\n <section>\n <p className='notes-slice-chooser__heading'>{format(labels.slices.chosen, { count: chosen.length })}</p>\n <ul className='notes-slice-chooser__chosen'>\n {chosen.map(location => (\n <li key={sliceKey(location)} className='notes-slice-chooser__chip'>\n <span>{name(location)}</span>\n <IconButton\n variant='ghost'\n size='small'\n icon={<CloseIcon />}\n aria-label={format(labels.slices.remove, { slice: name(location) })}\n onClick={() => onChange(toggleSlice(chosen, location))} />\n </li>\n ))}\n </ul>\n </section>\n )}\n </div>\n );\n};\n"],"names":["SliceChooser","active","known","chosen","onChange","labels","useNotesLabels","query","setQuery","useState","activeId","useId","resultsId","activeSlices","distinctSlices","results","searchSlices","name","location","formatLocation","common","locationSeparator","unknownLocation","option","_jsx","li","Checkbox","label","checked","isChosen","toggleSlice","sliceKey","_jsxs","div","className","section","aria-labelledby","h3","id","slices","length","p","noneActive","ul","map","htmlFor","search","TextInput","type","value","placeholder","searchPlaceholder","aria-controls","aria-live","trim","noMatches","aria-label","format","count","span","IconButton","variant","size","icon","CloseIcon","remove","slice","onClick"],"mappings":";;;;;;;;;AA4BA;;AAEC,IACM,MAAMA,YAAAA,GAAe,CAAC,EAAEC,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,EAAqB,GAAA;AAC/E,IAAA,MAAMC,MAAAA,GAASC,cAAAA,EAAAA;AACf,IAAA,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,QAAAA,CAAS,EAAA,CAAA;AACnC,IAAA,MAAMC,QAAAA,GAAWC,KAAAA,EAAAA;AACjB,IAAA,MAAMC,SAAAA,GAAYD,KAAAA,EAAAA;AAClB,IAAA,MAAME,eAAeC,cAAAA,CAAeb,MA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4BAAAA,KAAAA,EAAOvD,OAAOqC;AAAO,yBAAA;;kCACjGhB,GAAA,CAACmB,IAAAA,EAAAA;wBAAGT,SAAAA,EAAU,6BAAA;AACT/B,wBAAAA,QAAAA,EAAAA,MAAAA,CAAOyC,GAAG,CAAC1B,CAAAA,QAAAA,iBACRc,IAAA,CAACP,IAAAA,EAAAA;gCAA4BS,SAAAA,EAAU,2BAAA;;kDACnCV,GAAA,CAACmC,MAAAA,EAAAA;kDAAM1C,IAAAA,CAAKC,QAAAA;;kDACZM,GAAA,CAACoC,UAAAA,EAAAA;wCACGC,OAAAA,EAAQ,OAAA;wCACRC,IAAAA,EAAK,OAAA;AACLC,wCAAAA,IAAAA,gBAAMvC,GAAA,CAACwC,SAAAA,EAAAA,EAAAA,CAAAA;AACPR,wCAAAA,YAAAA,EAAYC,MAAAA,CAAOpD,MAAAA,CAAOkC,MAAM,CAAC0B,MAAM,EAAE;AAAEC,4CAAAA,KAAAA,EAAOjD,IAAAA,CAAKC,QAAAA;AAAU,yCAAA,CAAA;wCACjEiD,OAAAA,EAAS,IAAM/D,QAAAA,CAAS0B,WAAAA,CAAY3B,MAAAA,EAAQe,QAAAA,CAAAA;;;+BAP3Ca,QAAAA,CAASb,QAAAA,CAAAA,CAAAA;;;;;;AAe9C;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NoteContext } from '@cratis/showrunner.notes';
|
|
2
|
+
import { LocationParts } from '../Context/formatLocation.js';
|
|
3
|
+
export interface SlicesFeedbackDialogProps {
|
|
4
|
+
context: NoteContext;
|
|
5
|
+
knownSlices?: readonly LocationParts[];
|
|
6
|
+
}
|
|
7
|
+
export declare const SlicesFeedbackDialog: ({ context, knownSlices }: SlicesFeedbackDialogProps) => import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=SlicesFeedbackDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlicesFeedbackDialog.d.ts","sourceRoot":"","sources":["../../../Feedback/SlicesFeedbackDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAoB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAY7D,MAAM,WAAW,yBAAyB;IAEtC,OAAO,EAAE,WAAW,CAAC;IAGrB,WAAW,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CAC1C;AAOD,eAAO,MAAM,oBAAoB,GAAI,0BAA+B,yBAAyB,gCA2B5F,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useDialogContext, DialogResult } from '@cratis/arc.react/dialogs';
|
|
3
|
+
import { CommandDialog } from '@cratis/components/CommandDialog';
|
|
4
|
+
import { DialogInitialFocus } from '@cratis/components/Dialogs';
|
|
5
|
+
import { Guid } from '@cratis/fundamentals';
|
|
6
|
+
import { GiveNoteOnSlices } from '@cratis/showrunner.notes';
|
|
7
|
+
import { useState, useMemo } from 'react';
|
|
8
|
+
import { toSliceLocation, describeContext } from '../Context/noteContext.js';
|
|
9
|
+
import { useNotesContext } from '../Provider/NotesContext.js';
|
|
10
|
+
import { ContextSummary } from './ContextSummary.js';
|
|
11
|
+
import { defaultKind } from './kindOptions.js';
|
|
12
|
+
import { KindAndText } from './KindAndText.js';
|
|
13
|
+
import { SliceChooser } from './SliceChooser.js';
|
|
14
|
+
import { distinctSlices } from './sliceChoice.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The give feedback on specific slices dialog: the user chooses among the slices active on the screen and searches
|
|
18
|
+
* all the slices the host knows. It sends `GiveNoteOnSlices` and closes with {@link FeedbackGiven}. Open it with
|
|
19
|
+
* `useDialog`.
|
|
20
|
+
*/ const SlicesFeedbackDialog = ({ context, knownSlices = [] })=>{
|
|
21
|
+
const { labels } = useNotesContext();
|
|
22
|
+
const { closeDialog } = useDialogContext();
|
|
23
|
+
const [noteId] = useState(()=>Guid.create());
|
|
24
|
+
const active = useMemo(()=>distinctSlices([
|
|
25
|
+
context.location,
|
|
26
|
+
...context.activeSlices
|
|
27
|
+
]), [
|
|
28
|
+
context
|
|
29
|
+
]);
|
|
30
|
+
const [chosen, setChosen] = useState([]);
|
|
31
|
+
const currentValues = useMemo(()=>({
|
|
32
|
+
slices: chosen.map(toSliceLocation)
|
|
33
|
+
}), [
|
|
34
|
+
chosen
|
|
35
|
+
]);
|
|
36
|
+
return /*#__PURE__*/ jsx(CommandDialog, {
|
|
37
|
+
command: GiveNoteOnSlices,
|
|
38
|
+
title: labels.slices.title,
|
|
39
|
+
okLabel: labels.feedback.send,
|
|
40
|
+
cancelLabel: labels.common.cancel,
|
|
41
|
+
closeAriaLabel: labels.common.close,
|
|
42
|
+
width: "640px",
|
|
43
|
+
initialFocus: DialogInitialFocus.Content,
|
|
44
|
+
initialValues: {
|
|
45
|
+
context,
|
|
46
|
+
noteId,
|
|
47
|
+
kind: defaultKind
|
|
48
|
+
},
|
|
49
|
+
currentValues: currentValues,
|
|
50
|
+
onSuccess: ()=>closeDialog(DialogResult.Ok, {
|
|
51
|
+
noteId
|
|
52
|
+
}),
|
|
53
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
54
|
+
className: "notes-feedback-form",
|
|
55
|
+
children: [
|
|
56
|
+
/*#__PURE__*/ jsx(ContextSummary, {
|
|
57
|
+
text: describeContext(context, labels)
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ jsx(SliceChooser, {
|
|
60
|
+
active: active,
|
|
61
|
+
known: knownSlices,
|
|
62
|
+
chosen: chosen,
|
|
63
|
+
onChange: setChosen
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ jsx(KindAndText, {})
|
|
66
|
+
]
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { SlicesFeedbackDialog };
|
|
72
|
+
//# sourceMappingURL=SlicesFeedbackDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlicesFeedbackDialog.js","sources":["../../../Feedback/SlicesFeedbackDialog.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 { DialogResult, useDialogContext } from '@cratis/arc.react/dialogs';\nimport { CommandDialog } from '@cratis/components/CommandDialog';\nimport { DialogInitialFocus } from '@cratis/components/Dialogs';\nimport { Guid } from '@cratis/fundamentals';\nimport { GiveNoteOnSlices, NoteContext } from '@cratis/showrunner.notes';\nimport { useMemo, useState } from 'react';\nimport { describeContext, toSliceLocation } from '../Context/index.js';\nimport { LocationParts } from '../Context/formatLocation.js';\nimport { useNotesContext } from '../Provider/NotesContext.js';\nimport { ContextSummary } from './ContextSummary.js';\nimport { FeedbackGiven } from './FeedbackDialog.js';\nimport { defaultKind } from './kindOptions.js';\nimport { KindAndText } from './KindAndText.js';\nimport { SliceChooser } from './SliceChooser.js';\nimport { distinctSlices } from './sliceChoice.js';\n\n/**\n * Props for {@link SlicesFeedbackDialog}.\n */\nexport interface SlicesFeedbackDialogProps {\n /** What the user was looking at when they chose to give feedback. */\n context: NoteContext;\n\n /** Every slice the host knows about, to search over. */\n knownSlices?: readonly LocationParts[];\n}\n\n/**\n * The give feedback on specific slices dialog: the user chooses among the slices active on the screen and searches\n * all the slices the host knows. It sends `GiveNoteOnSlices` and closes with {@link FeedbackGiven}. Open it with\n * `useDialog`.\n */\nexport const SlicesFeedbackDialog = ({ context, knownSlices = [] }: SlicesFeedbackDialogProps) => {\n const { labels } = useNotesContext();\n const { closeDialog } = useDialogContext<SlicesFeedbackDialogProps, FeedbackGiven>();\n const [noteId] = useState(() => Guid.create());\n const active = useMemo(() => distinctSlices([context.location, ...context.activeSlices]), [context]);\n const [chosen, setChosen] = useState<LocationParts[]>([]);\n const currentValues = useMemo(() => ({ slices: chosen.map(toSliceLocation) }), [chosen]);\n\n return (\n <CommandDialog<GiveNoteOnSlices>\n command={GiveNoteOnSlices}\n title={labels.slices.title}\n okLabel={labels.feedback.send}\n cancelLabel={labels.common.cancel}\n closeAriaLabel={labels.common.close}\n width='640px'\n initialFocus={DialogInitialFocus.Content}\n initialValues={{ context, noteId, kind: defaultKind }}\n currentValues={currentValues}\n onSuccess={() => closeDialog(DialogResult.Ok, { noteId })}>\n <div className='notes-feedback-form'>\n <ContextSummary text={describeContext(context, labels)} />\n <SliceChooser active={active} known={knownSlices} chosen={chosen} onChange={setChosen} />\n <KindAndText<GiveNoteOnSlices> />\n </div>\n </CommandDialog>\n );\n};\n"],"names":["SlicesFeedbackDialog","context","knownSlices","labels","useNotesContext","closeDialog","useDialogContext","noteId","useState","Guid","create","active","useMemo","distinctSlices","location","activeSlices","chosen","setChosen","currentValues","slices","map","toSliceLocation","_jsx","CommandDialog","command","GiveNoteOnSlices","title","okLabel","feedback","send","cancelLabel","common","cancel","closeAriaLabel","close","width","initialFocus","DialogInitialFocus","Content","initialValues","kind","defaultKind","onSuccess","DialogResult","Ok","_jsxs","div","className","ContextSummary","text","describeContext","SliceChooser","known","onChange","KindAndText"],"mappings":";;;;;;;;;;;;;;;AA8BA;;;;UAKaA,oBAAAA,GAAuB,CAAC,EAAEC,OAAO,EAAEC,WAAAA,GAAc,EAAE,EAA6B,GAAA;IACzF,MAAM,EAAEC,MAAM,EAAE,GAAGC,eAAAA,EAAAA;IACnB,MAAM,EAAEC,WAAW,EAAE,GAAGC,gBAAAA,EAAAA;AACxB,IAAA,MAAM,CAACC,MAAAA,CAAO,GAAGC,QAAAA,CAAS,IAAMC,KAAKC,MAAM,EAAA,CAAA;IAC3C,MAAMC,MAAAA,GAASC,OAAAA,CAAQ,IAAMC,cAAAA,CAAe;AAACZ,YAAAA,OAAAA,CAAQa,QAAQ;AAAKb,YAAAA,GAAAA,OAAAA,CAAQc;SAAa,CAAA,EAAG;AAACd,QAAAA;AAAQ,KAAA,CAAA;AACnG,IAAA,MAAM,CAACe,MAAAA,EAAQC,SAAA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@@
|
|
|
1
|
+
export * from './ComponentFeedbackDialog.js';
|
|
2
|
+
export * from './ComponentModeSwitch.js';
|
|
3
|
+
export * from './ContextSummary.js';
|
|
4
|
+
export * from './FeedbackDialog.js';
|
|
5
|
+
export * from './kindOptions.js';
|
|
6
|
+
export * from './KindAndText.js';
|
|
7
|
+
export * from './propertySuggestions.js';
|
|
8
|
+
export * from './SliceChooser.js';
|
|
9
|
+
export * from './SlicesFeedbackDialog.js';
|
|
10
|
+
export * from './sliceChoice.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Feedback/index.ts"],"names":[],"mappings":"AAGA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './ComponentFeedbackDialog.js';
|
|
2
|
+
export * from './ComponentModeSwitch.js';
|
|
3
|
+
export * from './ContextSummary.js';
|
|
4
|
+
export * from './FeedbackDialog.js';
|
|
5
|
+
export * from './kindOptions.js';
|
|
6
|
+
export * from './KindAndText.js';
|
|
7
|
+
export * from './propertySuggestions.js';
|
|
8
|
+
export * from './SliceChooser.js';
|
|
9
|
+
export * from './SlicesFeedbackDialog.js';
|
|
10
|
+
export * from './sliceChoice.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Feedback/index.ts"],"names":[],"mappings":"AAGA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NoteKind } from '@cratis/showrunner.notes';
|
|
2
|
+
import { NotesLabels } from '../Labels/index.js';
|
|
3
|
+
export type KindOption = {
|
|
4
|
+
readonly value: NoteKind;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function kindOptions(labels: NotesLabels): KindOption[];
|
|
8
|
+
export declare const defaultKind: NoteKind;
|
|
9
|
+
//# sourceMappingURL=kindOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kindOptions.d.ts","sourceRoot":"","sources":["../../../Feedback/kindOptions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKjD,MAAM,MAAM,UAAU,GAAG;IAErB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IAGzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B,CAAC;AAOF,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,EAAE,CAO7D;AAKD,eAAO,MAAM,WAAW,EAAE,QAA8B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { NoteKind } from '@cratis/showrunner.notes';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* Gets the kinds of feedback a user can choose from.
|
|
7
|
+
* @param labels The labels to show.
|
|
8
|
+
* @returns The {@link KindOption}s, in the order they are offered.
|
|
9
|
+
*/ function kindOptions(labels) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
value: NoteKind.problem,
|
|
13
|
+
label: labels.kinds.problem
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: NoteKind.suggestion,
|
|
17
|
+
label: labels.kinds.suggestion
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: NoteKind.question,
|
|
21
|
+
label: labels.kinds.question
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: NoteKind.praise,
|
|
25
|
+
label: labels.kinds.praise
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The kind a note starts as.
|
|
31
|
+
*/ const defaultKind = NoteKind.suggestion;
|
|
32
|
+
|
|
33
|
+
export { defaultKind, kindOptions };
|
|
34
|
+
//# sourceMappingURL=kindOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kindOptions.js","sources":["../../../Feedback/kindOptions.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { NoteKind } from '@cratis/showrunner.notes';\nimport { NotesLabels } from '../Labels/index.js';\n\n/**\n * One choice of the kind field.\n */\nexport type KindOption = {\n /** The kind. */\n readonly value: NoteKind;\n\n /** The label. */\n readonly label: string;\n};\n\n/**\n * Gets the kinds of feedback a user can choose from.\n * @param labels The labels to show.\n * @returns The {@link KindOption}s, in the order they are offered.\n */\nexport function kindOptions(labels: NotesLabels): KindOption[] {\n return [\n { value: NoteKind.problem, label: labels.kinds.problem },\n { value: NoteKind.suggestion, label: labels.kinds.suggestion },\n { value: NoteKind.question, label: labels.kinds.question },\n { value: NoteKind.praise, label: labels.kinds.praise }\n ];\n}\n\n/**\n * The kind a note starts as.\n */\nexport const defaultKind: NoteKind = NoteKind.suggestion;\n"],"names":["kindOptions","labels","value","NoteKind","problem","label","kinds","suggestion","question","praise","defaultKind"],"mappings":";;AAAA;AACA;AAgBA;;;;IAKO,SAASA,WAAAA,CAAYC,MAAmB,EAAA;IAC3C,OAAO;AACH,QAAA;AAAEC,YAAAA,KAAAA,EAAOC,SAASC,OAAO;YAAEC,KAAAA,EAAOJ,MAAAA,CAAOK,KAAK,CAACF;AAAQ,SAAA;AACvD,QAAA;AAAEF,YAAAA,KAAAA,EAAOC,SAASI,UAAU;YAAEF,KAAAA,EAAOJ,MAAAA,CAAOK,KAAK,CAACC;AAAW,SAAA;AAC7D,QAAA;AAAEL,YAAAA,KAAAA,EAAOC,SAASK,QAAQ;YAAEH,KAAAA,EAAOJ,MAAAA,CAAOK,KAAK,CAACE;AAAS,SAAA;AACzD,QAAA;AAAEN,YAAAA,KAAAA,EAAOC,SAASM,MAAM;YAAEJ,KAAAA,EAAOJ,MAAAA,CAAOK,KAAK,CAACG;AAAO;AACxD,KAAA;AACL;AAEA;;AAEC,IACM,MAAMC,WAAAA,GAAwBP,QAAAA,CAASI;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PresentationChange } from '@cratis/components/ComponentPicker';
|
|
2
|
+
import { Guid } from '@cratis/fundamentals';
|
|
3
|
+
import { ISuggestComponentPropertyChange, NoteContext, PickedComponent } from '@cratis/showrunner.notes';
|
|
4
|
+
export declare function propertyValueText(value: unknown): string;
|
|
5
|
+
export declare function propertySuggestions(changes: readonly PresentationChange[], context: NoteContext, component: PickedComponent, noteId: Guid): ISuggestComponentPropertyChange[];
|
|
6
|
+
//# sourceMappingURL=propertySuggestions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertySuggestions.d.ts","sourceRoot":"","sources":["../../../Feedback/propertySuggestions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,+BAA+B,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAOzG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAExD;AAUD,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,SAAS,kBAAkB,EAAE,EACtC,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,eAAe,EAC1B,MAAM,EAAE,IAAI,GAAG,+BAA+B,EAAE,CASnD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
/**
|
|
4
|
+
* Turns the value of a presentation property into the text a suggestion carries.
|
|
5
|
+
* @param value The value; undefined when the property was not set.
|
|
6
|
+
* @returns The text; empty when the property was not set.
|
|
7
|
+
*/ function propertyValueText(value) {
|
|
8
|
+
return value === undefined || value === null ? '' : String(value);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Makes the values of one `SuggestComponentPropertyChange` per changed property.
|
|
12
|
+
* @param changes What the user changed in the property editor.
|
|
13
|
+
* @param context What the user was looking at.
|
|
14
|
+
* @param component The picked component.
|
|
15
|
+
* @param noteId The id the whole picking session shares.
|
|
16
|
+
* @returns The command values, in the order of the changes.
|
|
17
|
+
*/ function propertySuggestions(changes, context, component, noteId) {
|
|
18
|
+
return changes.map((change)=>({
|
|
19
|
+
noteId,
|
|
20
|
+
context,
|
|
21
|
+
component,
|
|
22
|
+
property: change.property,
|
|
23
|
+
currentValue: propertyValueText(change.from),
|
|
24
|
+
suggestedValue: propertyValueText(change.to)
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { propertySuggestions, propertyValueText };
|
|
29
|
+
//# sourceMappingURL=propertySuggestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertySuggestions.js","sources":["../../../Feedback/propertySuggestions.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PresentationChange } from '@cratis/components/ComponentPicker';\nimport { Guid } from '@cratis/fundamentals';\nimport { ISuggestComponentPropertyChange, NoteContext, PickedComponent } from '@cratis/showrunner.notes';\n\n/**\n * Turns the value of a presentation property into the text a suggestion carries.\n * @param value The value; undefined when the property was not set.\n * @returns The text; empty when the property was not set.\n */\nexport function propertyValueText(value: unknown): string {\n return value === undefined || value === null ? '' : String(value);\n}\n\n/**\n * Makes the values of one `SuggestComponentPropertyChange` per changed property.\n * @param changes What the user changed in the property editor.\n * @param context What the user was looking at.\n * @param component The picked component.\n * @param noteId The id the whole picking session shares.\n * @returns The command values, in the order of the changes.\n */\nexport function propertySuggestions(\n changes: readonly PresentationChange[],\n context: NoteContext,\n component: PickedComponent,\n noteId: Guid): ISuggestComponentPropertyChange[] {\n return changes.map(change => ({\n noteId,\n context,\n component,\n property: change.property,\n currentValue: propertyValueText(change.from),\n suggestedValue: propertyValueText(change.to)\n }));\n}\n"],"names":["propertyValueText","value","undefined","String","propertySuggestions","changes","context","component","noteId","map","change","property","currentValue","from","suggestedValue","to"],"mappings":"AAAA;AACA;AAMA;;;;IAKO,SAASA,iBAAAA,CAAkBC,KAAc,EAAA;AAC5C,IAAA,OAAOA,KAAAA,KAAUC,SAAAA,IAAaD,KAAAA,KAAU,IAAA,GAAO,KAAKE,MAAAA,CAAOF,KAAAA,CAAAA;AAC/D;AAEA;;;;;;;IAQO,SAASG,mBAAAA,CACZC,OAAsC,EACtCC,OAAoB,EACpBC,SAA0B,EAC1BC,MAAY,EAAA;AACZ,IAAA,OAAOH,OAAAA,CAAQI,GAAG,CAACC,CAAAA,UAAW;AAC1BF,YAAAA,MAAAA;AACAF,YAAAA,OAAAA;AACAC,YAAAA,SAAAA;AACAI,YAAAA,QAAAA,EAAUD,OAAOC,QAAQ;YACzBC,YAAAA,EAAcZ,iBAAAA,CAAkBU,OAAOG,IAAI,CAAA;YAC3CC,cAAAA,EAAgBd,iBAAAA,CAAkBU,OAAOK,EAAE;SAC/C,CAAA,CAAA;AACJ;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LocationParts } from '../Context/formatLocation.js';
|
|
2
|
+
export declare function sliceKey(location: LocationParts): string;
|
|
3
|
+
export declare function distinctSlices<TLocation extends LocationParts>(locations: readonly TLocation[]): TLocation[];
|
|
4
|
+
export declare function toggleSlice<TLocation extends LocationParts>(chosen: readonly TLocation[], location: TLocation): TLocation[];
|
|
5
|
+
export declare function isChosen(chosen: readonly LocationParts[], location: LocationParts): boolean;
|
|
6
|
+
export declare function searchSlices<TLocation extends LocationParts>(known: readonly TLocation[], query: string): TLocation[];
|
|
7
|
+
//# sourceMappingURL=sliceChoice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sliceChoice.d.ts","sourceRoot":"","sources":["../../../Feedback/sliceChoice.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAO7E,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAExD;AAOD,wBAAgB,cAAc,CAAC,SAAS,SAAS,aAAa,EAAE,SAAS,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,EAAE,CAW5G;AAQD,wBAAgB,WAAW,CAAC,SAAS,SAAS,aAAa,EAAE,MAAM,EAAE,SAAS,SAAS,EAAE,EAAE,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,CAK3H;AAQD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAG3F;AAQD,wBAAgB,YAAY,CAAC,SAAS,SAAS,aAAa,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,CAUrH"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { formatLocation } from '../Context/formatLocation.js';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* Gets what identifies a slice location.
|
|
7
|
+
* @param location The location.
|
|
8
|
+
* @returns A key that is the same for the same location.
|
|
9
|
+
*/ function sliceKey(location) {
|
|
10
|
+
return `${location.module}/${location.feature}/${location.slice}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Removes the slices that repeat an earlier one, and the ones that are empty.
|
|
14
|
+
* @param locations The locations.
|
|
15
|
+
* @returns The distinct, non-empty locations in their order.
|
|
16
|
+
*/ function distinctSlices(locations) {
|
|
17
|
+
const seen = new Set();
|
|
18
|
+
return locations.filter((location)=>{
|
|
19
|
+
const key = sliceKey(location);
|
|
20
|
+
if (key === '//' || seen.has(key)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
seen.add(key);
|
|
24
|
+
return true;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Adds a slice to the chosen ones, or removes it when it is chosen already.
|
|
29
|
+
* @param chosen The chosen slices.
|
|
30
|
+
* @param location The slice to toggle.
|
|
31
|
+
* @returns The chosen slices after the toggle.
|
|
32
|
+
*/ function toggleSlice(chosen, location) {
|
|
33
|
+
const key = sliceKey(location);
|
|
34
|
+
return chosen.some((slice)=>sliceKey(slice) === key) ? chosen.filter((slice)=>sliceKey(slice) !== key) : [
|
|
35
|
+
...chosen,
|
|
36
|
+
location
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Whether a slice is among the chosen ones.
|
|
41
|
+
* @param chosen The chosen slices.
|
|
42
|
+
* @param location The slice.
|
|
43
|
+
* @returns True when it is chosen.
|
|
44
|
+
*/ function isChosen(chosen, location) {
|
|
45
|
+
const key = sliceKey(location);
|
|
46
|
+
return chosen.some((slice)=>sliceKey(slice) === key);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Searches the slices the host knows about.
|
|
50
|
+
* @param known Every slice the host knows about.
|
|
51
|
+
* @param query What the user typed; every word has to be part of the module, feature or slice.
|
|
52
|
+
* @returns The distinct slices that match; none for an empty query.
|
|
53
|
+
*/ function searchSlices(known, query) {
|
|
54
|
+
const words = query.toLowerCase().split(/\s+/).filter((word)=>word.length > 0);
|
|
55
|
+
if (words.length === 0) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
return distinctSlices(known).filter((location)=>{
|
|
59
|
+
const text = formatLocation(location, ' ', '').toLowerCase();
|
|
60
|
+
return words.every((word)=>text.includes(word));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { distinctSlices, isChosen, searchSlices, sliceKey, toggleSlice };
|
|
65
|
+
//# sourceMappingURL=sliceChoice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sliceChoice.js","sources":["../../../Feedback/sliceChoice.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { formatLocation, LocationParts } from '../Context/formatLocation.js';\n\n/**\n * Gets what identifies a slice location.\n * @param location The location.\n * @returns A key that is the same for the same location.\n */\nexport function sliceKey(location: LocationParts): string {\n return `${location.module}/${location.feature}/${location.slice}`;\n}\n\n/**\n * Removes the slices that repeat an earlier one, and the ones that are empty.\n * @param locations The locations.\n * @returns The distinct, non-empty locations in their order.\n */\nexport function distinctSlices<TLocation extends LocationParts>(locations: readonly TLocation[]): TLocation[] {\n const seen = new Set<string>();\n return locations.filter(location => {\n const key = sliceKey(location);\n if (key === '//' || seen.has(key)) {\n return false;\n }\n\n seen.add(key);\n return true;\n });\n}\n\n/**\n * Adds a slice to the chosen ones, or removes it when it is chosen already.\n * @param chosen The chosen slices.\n * @param location The slice to toggle.\n * @returns The chosen slices after the toggle.\n */\nexport function toggleSlice<TLocation extends LocationParts>(chosen: readonly TLocation[], location: TLocation): TLocation[] {\n const key = sliceKey(location);\n return chosen.some(slice => sliceKey(slice) === key)\n ? chosen.filter(slice => sliceKey(slice) !== key)\n : [...chosen, location];\n}\n\n/**\n * Whether a slice is among the chosen ones.\n * @param chosen The chosen slices.\n * @param location The slice.\n * @returns True when it is chosen.\n */\nexport function isChosen(chosen: readonly LocationParts[], location: LocationParts): boolean {\n const key = sliceKey(location);\n return chosen.some(slice => sliceKey(slice) === key);\n}\n\n/**\n * Searches the slices the host knows about.\n * @param known Every slice the host knows about.\n * @param query What the user typed; every word has to be part of the module, feature or slice.\n * @returns The distinct slices that match; none for an empty query.\n */\nexport function searchSlices<TLocation extends LocationParts>(known: readonly TLocation[], query: string): TLocation[] {\n const words = query.toLowerCase().split(/\\s+/).filter(word => word.length > 0);\n if (words.length === 0) {\n return [];\n }\n\n return distinctSlices(known).filter(location => {\n const text = formatLocation(location, ' ', '').toLowerCase();\n return words.every(word => text.includes(word));\n });\n}\n"],"names":["sliceKey","location","module","feature","slice","distinctSlices","locations","seen","Set","filter","key","has","add","toggleSlice","chosen","some","isChosen","searchSlices","known","query","words","toLowerCase","split","word","length","text","formatLocation","every","includes"],"mappings":";;AAAA;AACA;AAIA;;;;IAKO,SAASA,QAAAA,CAASC,QAAuB,EAAA;AAC5C,IAAA,OAAO,CAAA,EAAGA,QAAAA,CAASC,MAAM,CAAC,CAAC,EAAED,QAAAA,CAASE,OAAO,CAAC,CAAC,EAAEF,QAAAA,CAASG,KAAK,CAAA,CAAE;AACrE;AAEA;;;;IAKO,SAASC,cAAAA,CAAgDC,SAA+B,EAAA;AAC3F,IAAA,MAAMC,OAAO,IAAIC,GAAAA,EAAAA;IACjB,OAAOF,SAAAA,CAAUG,MAAM,CAACR,CAAAA,QAAAA,GAAAA;AACpB,QAAA,MAAMS,MAAMV,QAAAA,CAASC,QAAAA,CAAA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CAAOT,MAAM,CAACR,CAAAA,QAAAA,GAAAA;AAChC,QAAA,MAAMwB,IAAAA,GAAOC,cAAAA,CAAezB,QAAAA,EAAU,GAAA,EAAK,IAAIoB,WAAW,EAAA;AAC1D,QAAA,OAAOD,MAAMO,KAAK,CAACJ,CAAAA,IAAAA,GAAQE,IAAAA,CAAKG,QAAQ,CAACL,IAAAA,CAAAA,CAAAA;AAC7C,IAAA,CAAA,CAAA;AACJ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icons.d.ts","sourceRoot":"","sources":["../../Icons.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,mCAIxB,CAAC;AAKF,eAAO,MAAM,WAAW,mCAIvB,CAAC;AAKF,eAAO,MAAM,SAAS,mCAIrB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* The speech bubble icon of the feedback button. Decorative: the button carries the accessible name.
|
|
7
|
+
*/ const FeedbackIcon = ()=>/*#__PURE__*/ jsx("svg", {
|
|
8
|
+
className: "notes-icon",
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
width: "1em",
|
|
11
|
+
height: "1em",
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
focusable: "false",
|
|
14
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
15
|
+
fill: "currentColor",
|
|
16
|
+
d: "M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2zm0 14H5.17L4 17.17V4h16v12z"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* The chevron of the drop-down toggle. Decorative: the toggle carries the accessible name.
|
|
21
|
+
*/ const ChevronIcon = ()=>/*#__PURE__*/ jsx("svg", {
|
|
22
|
+
className: "notes-icon",
|
|
23
|
+
viewBox: "0 0 24 24",
|
|
24
|
+
width: "1em",
|
|
25
|
+
height: "1em",
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
focusable: "false",
|
|
28
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
29
|
+
fill: "currentColor",
|
|
30
|
+
d: "M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* The close icon of a chosen slice's remove button. Decorative: the button carries the accessible name.
|
|
35
|
+
*/ const CloseIcon = ()=>/*#__PURE__*/ jsx("svg", {
|
|
36
|
+
className: "notes-icon",
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
width: "1em",
|
|
39
|
+
height: "1em",
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
focusable: "false",
|
|
42
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
43
|
+
fill: "currentColor",
|
|
44
|
+
d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export { ChevronIcon, CloseIcon, FeedbackIcon };
|
|
49
|
+
//# sourceMappingURL=Icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icons.js","sources":["../../Icons.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\n/**\n * The speech bubble icon of the feedback button. Decorative: the button carries the accessible name.\n */\nexport const FeedbackIcon = () => (\n <svg className='notes-icon' viewBox='0 0 24 24' width='1em' height='1em' aria-hidden='true' focusable='false'>\n <path fill='currentColor' d='M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2zm0 14H5.17L4 17.17V4h16v12z' />\n </svg>\n);\n\n/**\n * The chevron of the drop-down toggle. Decorative: the toggle carries the accessible name.\n */\nexport const ChevronIcon = () => (\n <svg className='notes-icon' viewBox='0 0 24 24' width='1em' height='1em' aria-hidden='true' focusable='false'>\n <path fill='currentColor' d='M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z' />\n </svg>\n);\n\n/**\n * The close icon of a chosen slice's remove button. Decorative: the button carries the accessible name.\n */\nexport const CloseIcon = () => (\n <svg className='notes-icon' viewBox='0 0 24 24' width='1em' height='1em' aria-hidden='true' focusable='false'>\n <path fill='currentColor' d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z' />\n </svg>\n);\n"],"names":["FeedbackIcon","_jsx","svg","className","viewBox","width","height","aria-hidden","focusable","path","fill","d","ChevronIcon","CloseIcon"],"mappings":";;AAAA;AACA;AAEA;;AAEC,IACM,MAAMA,YAAAA,GAAe,kBACxBC,GAAA,CAACC,KAAAA,EAAAA;QAAIC,SAAAA,EAAU,YAAA;QAAaC,OAAAA,EAAQ,WAAA;QAAYC,KAAAA,EAAM,KAAA;QAAMC,MAAAA,EAAO,KAAA;QAAMC,aAAAA,EAAY,MAAA;QAAOC,SAAAA,EAAU,OAAA;AAClG,QAAA,QAAA,gBAAAP,GAAA,CAACQ,MAAAA,EAAAA;YAAKC,IAAAA,EAAK,cAAA;YAAeC,CAAAA,EAAE;;AAElC,KAAA;AAEF;;AAEC,IACM,MAAMC,WAAAA,GAAc,kBACvBX,GAAA,CAACC,KAAAA,EAAAA;QAAIC,SAAAA,EAAU,YAAA;QAAaC,OAAAA,EAAQ,WAAA;QAAYC,KAAAA,EAAM,KAAA;QAAMC,MAAAA,EAAO,KAAA;QAAMC,aAAAA,EAAY,MAAA;QAAOC,SAAAA,EAAU,OAAA;AAClG,QAAA,QAAA,gBAAAP,GAAA,CAACQ,MAAAA,EAAAA;YAAKC,IAAAA,EAAK,cAAA;YAAeC,CAAAA,EAAE;;AAElC,KAAA;AAEF;;AAEC,IACM,MAAME,SAAAA,GAAY,kBACrBZ,GAAA,CAACC,KAAAA,EAAAA;QAAIC,SAAAA,EAAU,YAAA;QAAaC,OAAAA,EAAQ,WAAA;QAAYC,KAAAA,EAAM,KAAA;QAAMC,MAAAA,EAAO,KAAA;QAAMC,aAAAA,EAAY,MAAA;QAAOC,SAAAA,EAAU,OAAA;AAClG,QAAA,QAAA,gBAAAP,GAAA,CAACQ,MAAAA,EAAAA;YAAKC,IAAAA,EAAK,cAAA;YAAeC,CAAAA,EAAE;;AAElC,KAAA;;"}
|