@mittwald/flow-react-components 0.2.0-alpha.551 → 0.2.0-alpha.553
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/CHANGELOG.md +8 -0
- package/dist/assets/doc-properties.json +37652 -32936
- package/dist/css/all.css +1 -1
- package/dist/js/_virtual/_.locale.json@bb0db7b5021f874310cbe5b6cc3d9cac.mjs +2 -2
- package/dist/js/components/src/components/Action/Action.mjs +1 -0
- package/dist/js/components/src/components/Action/Action.mjs.map +1 -1
- package/dist/js/components/src/components/Action/models/ActionState.mjs +1 -1
- package/dist/js/components/src/components/Action/models/ActionState.mjs.map +1 -1
- package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs +1 -1
- package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs.map +1 -1
- package/dist/js/components/src/components/Button/Button.mjs +1 -1
- package/dist/js/components/src/components/Button/Button.mjs.map +1 -1
- package/dist/js/components/src/components/CartesianChart/CartesianChart.mjs +120 -25
- package/dist/js/components/src/components/CartesianChart/CartesianChart.mjs.map +1 -1
- package/dist/js/components/src/components/CartesianChart/components/Area/Area.mjs +5 -11
- package/dist/js/components/src/components/CartesianChart/components/Area/Area.mjs.map +1 -1
- package/dist/js/components/src/components/CartesianChart/components/YAxis/YAxis.mjs +1 -1
- package/dist/js/components/src/components/CartesianChart/components/YAxis/YAxis.mjs.map +1 -1
- package/dist/js/components/src/components/Checkbox/Checkbox.mjs +18 -6
- package/dist/js/components/src/components/Checkbox/Checkbox.mjs.map +1 -1
- package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs +15 -3
- package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs.map +1 -1
- package/dist/js/components/src/components/ComboBox/ComboBox.mjs +25 -4
- package/dist/js/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
- package/dist/js/components/src/components/FileField/FileField.mjs +7 -3
- package/dist/js/components/src/components/FileField/FileField.mjs.map +1 -1
- package/dist/js/components/src/components/Markdown/Markdown.mjs +2 -1
- package/dist/js/components/src/components/Markdown/Markdown.mjs.map +1 -1
- package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.mjs +107 -45
- package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.mjs.map +1 -1
- package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.module.scss.mjs +3 -3
- package/dist/js/components/src/components/MarkdownEditor/components/ToolbarButton.mjs +1 -0
- package/dist/js/components/src/components/MarkdownEditor/components/ToolbarButton.mjs.map +1 -1
- package/dist/js/components/src/components/MarkdownEditor/lib/{handleKeyDown.mjs → modifyValueByMarkdownSyntax.mjs} +20 -29
- package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.mjs.map +1 -0
- package/dist/js/components/src/components/MarkdownEditor/lib/{insertAtCursor.mjs → modifyValueByType.mjs} +17 -11
- package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByType.mjs.map +1 -0
- package/dist/js/components/src/components/NumberField/NumberField.mjs +11 -2
- package/dist/js/components/src/components/NumberField/NumberField.mjs.map +1 -1
- package/dist/js/components/src/components/Popover/Popover.mjs +9 -2
- package/dist/js/components/src/components/Popover/Popover.mjs.map +1 -1
- package/dist/js/components/src/components/SearchField/SearchField.mjs +1 -1
- package/dist/js/components/src/components/SearchField/SearchField.mjs.map +1 -1
- package/dist/js/components/src/components/Select/Select.mjs +9 -9
- package/dist/js/components/src/components/Select/Select.mjs.map +1 -1
- package/dist/js/components/src/components/TextArea/TextArea.mjs +10 -5
- package/dist/js/components/src/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/js/components/src/components/TextField/TextField.mjs +9 -2
- package/dist/js/components/src/components/TextField/TextField.mjs.map +1 -1
- package/dist/js/components/src/components/propTypes/index.mjs +2 -0
- package/dist/js/components/src/components/propTypes/index.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs +14 -0
- package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs +22 -11
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.mjs +2 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs +51 -0
- package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs.map +1 -0
- package/dist/js/components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs +57 -0
- package/dist/js/components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs.map +1 -0
- package/dist/js/components/src/integrations/react-hook-form/components/context/formContext.mjs.map +1 -1
- package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs +18 -10
- package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs.map +1 -1
- package/dist/js/react-hook-form.mjs +2 -0
- package/dist/js/react-hook-form.mjs.map +1 -1
- package/dist/types/components/Action/Action.d.ts.map +1 -1
- package/dist/types/components/Action/models/ActionState.d.ts +5 -0
- package/dist/types/components/Action/models/ActionState.d.ts.map +1 -1
- package/dist/types/components/CartesianChart/CartesianChart.d.ts +4 -4
- package/dist/types/components/CartesianChart/CartesianChart.d.ts.map +1 -1
- package/dist/types/components/CartesianChart/components/Area/Area.d.ts.map +1 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts +2 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/types/components/CheckboxButton/CheckboxButton.d.ts +2 -0
- package/dist/types/components/CheckboxButton/CheckboxButton.d.ts.map +1 -1
- package/dist/types/components/ComboBox/ComboBox.d.ts +2 -1
- package/dist/types/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/dist/types/components/FileField/FileField.d.ts +2 -1
- package/dist/types/components/FileField/FileField.d.ts.map +1 -1
- package/dist/types/components/List/typedList.d.ts +1 -1
- package/dist/types/components/Markdown/Markdown.d.ts +2 -1
- package/dist/types/components/Markdown/Markdown.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +7 -3
- package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/MarkdownEditor.test.d.ts +2 -0
- package/dist/types/components/MarkdownEditor/MarkdownEditor.test.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/components/ToolbarButton.d.ts +1 -1
- package/dist/types/components/MarkdownEditor/components/ToolbarButton.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.d.ts +8 -0
- package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.test.d.ts +2 -0
- package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.test.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/lib/modifyValueByType.d.ts +12 -0
- package/dist/types/components/MarkdownEditor/lib/modifyValueByType.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/lib/modifyValueByType.test.d.ts +2 -0
- package/dist/types/components/MarkdownEditor/lib/modifyValueByType.test.d.ts.map +1 -0
- package/dist/types/components/NumberField/NumberField.d.ts +4 -3
- package/dist/types/components/NumberField/NumberField.d.ts.map +1 -1
- package/dist/types/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/components/Select/Select.d.ts.map +1 -1
- package/dist/types/components/TextArea/TextArea.d.ts +4 -7
- package/dist/types/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/types/components/TextField/TextField.d.ts.map +1 -1
- package/dist/types/components/propTypes/index.d.ts +4 -0
- package/dist/types/components/propTypes/index.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/Field.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/Autocomplete.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/Checkbox.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/CheckboxButton.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/CheckboxGroup.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/ComboBox.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/DatePicker.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/DateRangePicker.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/FileField.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/NumberField.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/PasswordCreationField.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/RadioGroup.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/SearchField.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/SegmentedControl.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/Select.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/Slider.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/Switch.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/TextArea.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/TextField.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/TimeField.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts +4 -3
- package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.d.ts +10 -0
- package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.test.d.ts +2 -0
- package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.test.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/ResetButton/index.d.ts +3 -0
- package/dist/types/integrations/react-hook-form/components/ResetButton/index.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.d.ts +10 -0
- package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.test.d.ts +2 -0
- package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.test.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/SubmitButton/index.d.ts +3 -0
- package/dist/types/integrations/react-hook-form/components/SubmitButton/index.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/context/formContext.d.ts +6 -2
- package/dist/types/integrations/react-hook-form/components/context/formContext.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/index.d.ts +2 -0
- package/dist/types/integrations/react-hook-form/index.d.ts.map +1 -1
- package/dist/types/lib/dev/vitest.d.ts +3 -0
- package/dist/types/lib/dev/vitest.d.ts.map +1 -0
- package/dist/types/lib/propsContext/nestedPropsContext/lib.d.ts +2 -0
- package/dist/types/lib/propsContext/nestedPropsContext/lib.d.ts.map +1 -1
- package/dist/types/lib/react/ReactAriaControlledValueFix.d.ts.map +1 -1
- package/package.json +6 -5
- package/dist/js/components/src/components/MarkdownEditor/lib/handleKeyDown.mjs.map +0 -1
- package/dist/js/components/src/components/MarkdownEditor/lib/insertAtCursor.mjs.map +0 -1
- package/dist/types/components/MarkdownEditor/lib/handleKeyDown.d.ts +0 -3
- package/dist/types/components/MarkdownEditor/lib/handleKeyDown.d.ts.map +0 -1
- package/dist/types/components/MarkdownEditor/lib/handleKeyDown.test.d.ts +0 -2
- package/dist/types/components/MarkdownEditor/lib/handleKeyDown.test.d.ts.map +0 -1
- package/dist/types/components/MarkdownEditor/lib/insertAtCursor.d.ts +0 -4
- package/dist/types/components/MarkdownEditor/lib/insertAtCursor.d.ts.map +0 -1
- package/dist/types/components/MarkdownEditor/lib/insertAtCursor.test.d.ts +0 -2
- package/dist/types/components/MarkdownEditor/lib/insertAtCursor.test.d.ts.map +0 -1
- package/dist/types/lib/dev/vitestUserEvent.d.ts +0 -3
- package/dist/types/lib/dev/vitestUserEvent.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
const locales = {"de-DE": { "mode.editor": `
|
|
3
|
+
const locales = {"de-DE": { "mode.editor": `Vorschau beenden`,
|
|
4
4
|
"mode.preview": `Vorschau`,
|
|
5
5
|
"toolbar.bold": `Fett`,
|
|
6
6
|
"toolbar.code": `Code`,
|
|
@@ -10,7 +10,7 @@ const locales = {"de-DE": { "mode.editor": `Editor`,
|
|
|
10
10
|
"toolbar.quote": `Zitat`,
|
|
11
11
|
"toolbar.strikeThrough": `Durchgestrichen`,
|
|
12
12
|
"toolbar.unorderedList": `Liste`,
|
|
13
|
-
},"en-US": { "mode.editor": `
|
|
13
|
+
},"en-US": { "mode.editor": `Exit Preview`,
|
|
14
14
|
"mode.preview": `Preview`,
|
|
15
15
|
"toolbar.bold": `Bold`,
|
|
16
16
|
"toolbar.code": `Code`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.mjs","sources":["../../../../../../src/components/Action/Action.tsx"],"sourcesContent":["import { ActionModel as ActionModel } from \"@/components/Action/models/ActionModel\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { dynamic, PropsContextProvider } from \"@/lib/propsContext\";\nimport { ActionContextProvider } from \"@/components/Action/context\";\nimport { useActionStateContext } from \"@/components/Action/models/ActionStateContext\";\nimport { useConfirmationModalButtonSlot } from \"@/components/Action/hooks/useConfirmationModalButtonSlot\";\nimport { useActionButtonState } from \"@/components/Action/hooks/useActionButtonState\";\nimport type { ComponentPropsContext } from \"@/lib/propsContext/types\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nconst actionButtonContext: ComponentPropsContext<\"Button\"> = {\n onPress: dynamic((props) => {\n const action = ActionModel.use();\n const confirmAction = ActionModel.useConfirmationAction();\n const isConfirmationButton =\n useConfirmationModalButtonSlot(props) === \"primary\";\n const isAbortButton = useConfirmationModalButtonSlot(props) === \"abort\";\n if (isAbortButton) {\n return action.confirmationModalController.close;\n }\n return isConfirmationButton ? confirmAction.execute : action.execute;\n }),\n\n isPending: dynamic((props) => {\n const actionState = useActionButtonState(props);\n return props.isPending ?? actionState === \"isPending\";\n }),\n\n isSucceeded: dynamic((props) => {\n const actionState = useActionButtonState(props);\n return props.isSucceeded ?? actionState === \"isSucceeded\";\n }),\n\n isFailed: dynamic((props) => {\n const actionState = useActionButtonState(props);\n return props.isFailed ?? actionState === \"isFailed\";\n }),\n\n \"aria-disabled\": dynamic((props) => {\n const state = useActionButtonState(props);\n const someActionInContextIsBusy = useActionStateContext().useIsBusy();\n return (\n props[\"aria-disabled\"] ??\n (state === \"isExecuting\" || someActionInContextIsBusy)\n );\n }),\n};\n\nexport const Action = flowComponent(\n \"Action\",\n (props) => {\n const {\n children,\n actionModel: actionModelFromProps,\n ...actionProps\n } = props;\n const newActionModel = ActionModel.useNew(actionProps);\n const actionModel = actionModelFromProps ?? newActionModel;\n\n const propsContext: PropsContext = {\n Button: actionButtonContext,\n\n Link: {\n onPress: dynamic(() => ActionModel.use().execute),\n },\n\n MenuItem: {\n onAction: dynamic(() => ActionModel.use().execute),\n },\n\n Modal: {\n slot: dynamic((props) => {\n const { slot } = props;\n const action = ActionModel.use();\n action.needsConfirmation = slot === \"actionConfirm\";\n return slot;\n }),\n isDismissable: dynamic((props) => {\n const action = ActionModel.use();\n const actionState = action.state.useValue();\n return actionState === \"isExecuting\" || actionState === \"isPending\"\n ? false\n : props.isDismissable;\n }),\n controller: dynamic(() => {\n const action = ActionModel.use();\n return action.needsConfirmation\n ? action.confirmationModalController\n : action.getOverlayController(\"Modal\");\n }),\n ActionGroup: {\n Button: actionButtonContext,\n },\n },\n };\n\n return (\n <ActionContextProvider value={actionModel}>\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n </ActionContextProvider>\n );\n },\n {\n type: \"provider\",\n },\n);\n\nexport default Action;\n"],"names":["props"],"mappings":";;;;;;;;;;;AAUA,MAAM,mBAAA,GAAuD;AAAA,EAC3D,OAAA,EAAS,OAAA,CAAQ,CAAC,KAAA,KAAU;AAC1B,IAAA,MAAM,MAAA,GAAS,YAAY,GAAA,EAAI;AAC/B,IAAA,MAAM,aAAA,GAAgB,YAAY,qBAAA,EAAsB;AACxD,IAAA,MAAM,oBAAA,GACJ,8BAAA,CAA+B,KAAK,CAAA,KAAM,SAAA;AAC5C,IAAA,MAAM,aAAA,GAAgB,8BAAA,CAA+B,KAAK,CAAA,KAAM,OAAA;AAChE,IAAA,IAAI,aAAA,EAAe;AACjB,MAAA,OAAO,OAAO,2BAAA,CAA4B,KAAA;AAAA,IAC5C;AACA,IAAA,OAAO,oBAAA,GAAuB,aAAA,CAAc,OAAA,GAAU,MAAA,CAAO,OAAA;AAAA,EAC/D,CAAC,CAAA;AAAA,EAED,SAAA,EAAW,OAAA,CAAQ,CAAC,KAAA,KAAU;AAC5B,IAAA,MAAM,WAAA,GAAc,qBAAqB,KAAK,CAAA;AAC9C,IAAA,OAAO,KAAA,CAAM,aAAa,WAAA,KAAgB,WAAA;AAAA,EAC5C,CAAC,CAAA;AAAA,EAED,WAAA,EAAa,OAAA,CAAQ,CAAC,KAAA,KAAU;AAC9B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MAAAA,KAAU;AACvB,UAAA,MAAM,EAAE,MAAK,GAAIA,MAAAA;AACjB,UAAA,MAAM,MAAA,GAAS,YAAY,GAAA,EAAI;AAC/B,UAAA,MAAA,CAAO,oBAAoB,IAAA,KAAS,eAAA;AACpC,UAAA,OAAO,IAAA;AAAA,QACT,CAAC,CAAA;AAAA,QACD,aAAA,EAAe,OAAA,CAAQ,CAACA,MAAAA,KAAU;AAChC,UAAA,MAAM,MAAA,GAAS,YAAY,GAAA,EAAI;AAC/B,UAAA,MAAM,WAAA,GAAc,MAAA,CAAO,KAAA,CAAM,QAAA,EAAS;AAC1C,UAAA,OAAO,WAAA,KAAgB,aAAA,IAAiB,WAAA,KAAgB,WAAA,GACpD,QACAA,MAAAA,CAAM,aAAA;AAAA,QACZ,CAAC,CAAA;AAAA,QACD,UAAA,EAAY,QAAQ,MAAM;AACxB,UAAA,MAAM,MAAA,GAAS,YAAY,GAAA,EAAI;AAC/B,UAAA,OAAO,OAAO,iBAAA,GACV,MAAA,CAAO,2BAAA,GACP,MAAA,CAAO,qBAAqB,OAAO,CAAA;AAAA,QACzC,CAAC,CAAA;AAAA,QACD,WAAA,EAAa;AAAA,UACX,MAAA,EAAQ;AAAA;AACV;AACF,KACF;AAEA,IAAA,uBACE,GAAA,CAAC,yBAAsB,KAAA,EAAO,WAAA,EAC5B,8BAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,YAAA,EAC1B,QAAA,EACH,CAAA,EACF,CAAA;AAAA,EAEJ,CAAA;AAAA,EACA;AAAA,IACE,IAAA,EAAM;AAAA;AAEV;;;;"}
|
|
1
|
+
{"version":3,"file":"Action.mjs","sources":["../../../../../../src/components/Action/Action.tsx"],"sourcesContent":["import { ActionModel as ActionModel } from \"@/components/Action/models/ActionModel\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { dynamic, PropsContextProvider } from \"@/lib/propsContext\";\nimport { ActionContextProvider } from \"@/components/Action/context\";\nimport { useActionStateContext } from \"@/components/Action/models/ActionStateContext\";\nimport { useConfirmationModalButtonSlot } from \"@/components/Action/hooks/useConfirmationModalButtonSlot\";\nimport { useActionButtonState } from \"@/components/Action/hooks/useActionButtonState\";\nimport type { ComponentPropsContext } from \"@/lib/propsContext/types\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nconst actionButtonContext: ComponentPropsContext<\"Button\"> = {\n onPress: dynamic((props) => {\n const action = ActionModel.use();\n const confirmAction = ActionModel.useConfirmationAction();\n const isConfirmationButton =\n useConfirmationModalButtonSlot(props) === \"primary\";\n const isAbortButton = useConfirmationModalButtonSlot(props) === \"abort\";\n if (isAbortButton) {\n return action.confirmationModalController.close;\n }\n return isConfirmationButton ? confirmAction.execute : action.execute;\n }),\n\n isPending: dynamic((props) => {\n const actionState = useActionButtonState(props);\n return props.isPending ?? actionState === \"isPending\";\n }),\n\n isSucceeded: dynamic((props) => {\n const actionState = useActionButtonState(props);\n return props.isSucceeded ?? actionState === \"isSucceeded\";\n }),\n\n isFailed: dynamic((props) => {\n const actionState = useActionButtonState(props);\n return props.isFailed ?? actionState === \"isFailed\";\n }),\n\n \"aria-disabled\": dynamic((props) => {\n const state = useActionButtonState(props);\n const someActionInContextIsBusy = useActionStateContext().useIsBusy();\n return (\n props[\"aria-disabled\"] ??\n (state === \"isExecuting\" || someActionInContextIsBusy)\n );\n }),\n};\n\nexport const Action = flowComponent(\n \"Action\",\n (props) => {\n const {\n children,\n actionModel: actionModelFromProps,\n ...actionProps\n } = props;\n const newActionModel = ActionModel.useNew(actionProps);\n const actionModel = actionModelFromProps ?? newActionModel;\n\n const propsContext: PropsContext = {\n Button: actionButtonContext,\n\n SubmitButton: actionButtonContext,\n\n Link: {\n onPress: dynamic(() => ActionModel.use().execute),\n },\n\n MenuItem: {\n onAction: dynamic(() => ActionModel.use().execute),\n },\n\n Modal: {\n slot: dynamic((props) => {\n const { slot } = props;\n const action = ActionModel.use();\n action.needsConfirmation = slot === \"actionConfirm\";\n return slot;\n }),\n isDismissable: dynamic((props) => {\n const action = ActionModel.use();\n const actionState = action.state.useValue();\n return actionState === \"isExecuting\" || actionState === \"isPending\"\n ? false\n : props.isDismissable;\n }),\n controller: dynamic(() => {\n const action = ActionModel.use();\n return action.needsConfirmation\n ? action.confirmationModalController\n : action.getOverlayController(\"Modal\");\n }),\n ActionGroup: {\n Button: actionButtonContext,\n },\n },\n };\n\n return (\n <ActionContextProvider value={actionModel}>\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n </ActionContextProvider>\n );\n },\n {\n type: \"provider\",\n },\n);\n\nexport default Action;\n"],"names":["props"],"mappings":";;;;;;;;;;;AAUA,MAAM,mBAAA,GAAuD;AAAA,EAC3D,OAAA,EAAS,OAAA,CAAQ,CAAC,KAAA,KAAU;AAC1B,IAAA,MAAM,MAAA,GAAS,YAAY,GAAA,EAAI;AAC/B,IAAA,MAAM,aAAA,GAAgB,YAAY,qBAAA,EAAsB;AACxD,IAAA,MAAM,oBAAA,GACJ,8BAAA,CAA+B,KAAK,CAAA,KAAM,SAAA;AAC5C,IAAA,MAAM,aAAA,GAAgB,8BAAA,CAA+B,KAAK,CAAA,KAAM,OAAA;AAChE,IAAA,IAAI,aAAA,EAAe;AACjB,MAAA,OAAO,OAAO,2BAAA,CAA4B,KAAA;AAAA,IAC5C;AACA,IAAA,OAAO,oBAAA,GAAuB,aAAA,CAAc,OAAA,GAAU,MAAA,CAAO,OAAA;AAAA,EAC/D,CAAC,CAAA;AAAA,EAED,SAAA,EAAW,OAAA,CAAQ,CAAC,KAAA,KAAU;AAC5B,IAAA,MAAM,WAAA,GAAc,qBAAqB,KAAK,CAAA;AAC9C,IAAA,OAAO,KAAA,CAAM,aAAa,WAAA,KAAgB,WAAA;AAAA,EAC5C,CAAC,CAAA;AAAA,EAED,WAAA,EAAa,OAAA,CAAQ,CAAC,KAAA,KAAU;AAC9B,IAAA,MAAM,WAAA,GAAc,qBAAqB,KAAK,CAAA;AAC9C,IAAA,OAAO,KAAA,CAAM,eAAe,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AAAA;AACjB,UAAA,MAAM,MAAA,GAAS,YAAY,GAAA,EAAI;AAC/B,UAAA,MAAA,CAAO,oBAAoB,IAAA,KAAS,eAAA;AACpC,UAAA,OAAO,IAAA;AAAA,QACT,CAAC,CAAA;AAAA,QACD,aAAA,EAAe,OAAA,CAAQ,CAACA,MAAAA,KAAU;AAChC,UAAA,MAAM,MAAA,GAAS,YAAY,GAAA,EAAI;AAC/B,UAAA,MAAM,WAAA,GAAc,MAAA,CAAO,KAAA,CAAM,QAAA,EAAS;AAC1C,UAAA,OAAO,WAAA,KAAgB,aAAA,IAAiB,WAAA,KAAgB,WAAA,GACpD,QACAA,MAAAA,CAAM,aAAA;AAAA,QACZ,CAAC,CAAA;AAAA,QACD,UAAA,EAAY,QAAQ,MAAM;AACxB,UAAA,MAAM,MAAA,GAAS,YAAY,GAAA,EAAI;AAC/B,UAAA,OAAO,OAAO,iBAAA,GACV,MAAA,CAAO,2BAAA,GACP,MAAA,CAAO,qBAAqB,OAAO,CAAA;AAAA,QACzC,CAAC,CAAA;AAAA,QACD,WAAA,EAAa;AAAA,UACX,MAAA,EAAQ;AAAA;AACV;AACF,KACF;AAEA,IAAA,uBACE,GAAA,CAAC,yBAAsB,KAAA,EAAO,WAAA,EAC5B,8BAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,YAAA,EAC1B,QAAA,EACH,CAAA,EACF,CAAA;AAAA,EAEJ,CAAA;AAAA,EACA;AAAA,IACE,IAAA,EAAM;AAAA;AAEV;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionState.mjs","sources":["../../../../../../../src/components/Action/models/ActionState.ts"],"sourcesContent":["import {\n action as mobxAction,\n computed,\n makeObservable,\n observable,\n} from \"mobx\";\nimport useSelector from \"@/lib/mobx/useSelector\";\nimport { sleep } from \"@/lib/promises/sleep\";\nimport { useStatic } from \"@/lib/hooks/useStatic\";\n\nexport type ActionStateValue =\n | \"isIdle\"\n | \"isSucceeded\"\n | \"isPending\"\n | \"isExecuting\"\n | \"isFailed\";\n\
|
|
1
|
+
{"version":3,"file":"ActionState.mjs","sources":["../../../../../../../src/components/Action/models/ActionState.ts"],"sourcesContent":["import {\n action as mobxAction,\n computed,\n makeObservable,\n observable,\n} from \"mobx\";\nimport useSelector from \"@/lib/mobx/useSelector\";\nimport { sleep } from \"@/lib/promises/sleep\";\nimport { useStatic } from \"@/lib/hooks/useStatic\";\n\nexport type ActionStateValue =\n | \"isIdle\"\n | \"isSucceeded\"\n | \"isPending\"\n | \"isExecuting\"\n | \"isFailed\";\n\nexport const duration = {\n pending: 1000,\n succeeded: 1500,\n failed: 2000,\n};\n\nexport class ActionState {\n private showFeedback?: boolean;\n public state: ActionStateValue = \"isIdle\";\n private setPendingTimeout: number | undefined;\n public error: unknown;\n private isAsync = false;\n\n public constructor() {\n makeObservable(this, {\n state: observable,\n updateState: mobxAction,\n isBusy: computed,\n });\n }\n\n public static useNew(): ActionState {\n return useStatic(() => new ActionState());\n }\n\n public updateState(newState: ActionStateValue): void {\n this.state = newState;\n }\n\n public useValue(): ActionStateValue {\n return useSelector(() => this.state, [this]);\n }\n\n public useIsBusy(): boolean {\n return useSelector(() => this.isBusy, [this]);\n }\n\n public get isBusy(): boolean {\n return this.state !== \"isIdle\";\n }\n\n public onAsyncStart(): void {\n this.isAsync = true;\n this.updateState(\"isExecuting\");\n this.setPendingTimeout = window.setTimeout(\n () => this.startPending(),\n duration.pending,\n );\n }\n\n public async onSucceeded(): Promise<void> {\n await this.onDone();\n }\n\n public async onFailed(error?: unknown): Promise<void> {\n this.error = error ?? new Error(\"Unknown error\");\n await this.onDone();\n }\n\n public withFeedback(feedback?: boolean): ActionState {\n this.showFeedback = feedback;\n return this;\n }\n\n private async startFailedFeedback(): Promise<void> {\n this.updateState(\"isFailed\");\n await sleep(duration.failed);\n this.resetAfterDone();\n }\n\n private async startSucceededFeedback(): Promise<void> {\n this.updateState(\"isSucceeded\");\n await sleep(duration.succeeded);\n this.resetAfterDone();\n }\n\n private resetAfterDone(): void {\n this.updateState(\"isIdle\");\n this.isAsync = false;\n this.error = undefined;\n }\n\n private async onDone(): Promise<void> {\n if (this.setPendingTimeout) {\n window.clearTimeout(this.setPendingTimeout);\n }\n if (this.error) {\n await this.startFailedFeedback();\n } else if (\n this.showFeedback !== false &&\n (this.showFeedback || this.isAsync)\n ) {\n await this.startSucceededFeedback();\n } else {\n this.resetAfterDone();\n }\n }\n\n private startPending(): void {\n this.updateState(\"isPending\");\n }\n}\n"],"names":["mobxAction"],"mappings":";;;;;AAiBO,MAAM,QAAA,GAAW;AAAA,EACtB,OAAA,EAAS,GAAA;AAAA,EACT,SAAA,EAAW,IAAA;AAAA,EACX,MAAA,EAAQ;AACV;AAEO,MAAM,WAAA,CAAY;AAAA,EACf,YAAA;AAAA,EACD,KAAA,GAA0B,QAAA;AAAA,EACzB,iBAAA;AAAA,EACD,KAAA;AAAA,EACC,OAAA,GAAU,KAAA;AAAA,EAEX,WAAA,GAAc;AACnB,IAAA,cAAA,CAAe,IAAA,EAAM;AAAA,MACnB,KAAA,EAAO,UAAA;AAAA,MACP,WAAA,EAAaA,MAAA;AAAA,MACb,MAAA,EAAQ;AAAA,KACT,CAAA;AAAA,EACH;AAAA,EAEA,OAAc,MAAA,GAAsB;AAClC,IAAA,OAAO,SAAA,CAAU,MAAM,IAAI,WAAA,EAAa,CAAA;AAAA,EAC1C;AAAA,EAEO,YAAY,QAAA,EAAkC;AACnD,IAAA,IAAA,CAAK,KAAA,GAAQ,QAAA;AAAA,EACf;AAAA,EAEO,QAAA,GAA6B;AAClC,IAAA,OAAO,YAAY,MAAM,IAAA,CAAK,KAAA,EAAO,CAAC,IAAI,CAAC,CAAA;AAAA,EAC7C;AAAA,EAEO,SAAA,GAAqB;AAC1B,IAAA,OAAO,YAAY,MAAM,IAAA,CAAK,MAAA,EAAQ,CAAC,IAAI,CAAC,CAAA;AAAA,EAC9C;AAAA,EAEA,IAAW,MAAA,GAAkB;AAC3B,IAAA,OAAO,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AA,CAAO,YAAA,CAAa,KAAK,iBAAiB,CAAA;AAAA,IAC5C;AACA,IAAA,IAAI,KAAK,KAAA,EAAO;AACd,MAAA,MAAM,KAAK,mBAAA,EAAoB;AAAA,IACjC,WACE,IAAA,CAAK,YAAA,KAAiB,UACrB,IAAA,CAAK,YAAA,IAAgB,KAAK,OAAA,CAAA,EAC3B;AACA,MAAA,MAAM,KAAK,sBAAA,EAAuB;AAAA,IACpC,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,cAAA,EAAe;AAAA,IACtB;AAAA,EACF;AAAA,EAEQ,YAAA,GAAqB;AAC3B,IAAA,IAAA,CAAK,YAAY,WAAW,CAAA;AAAA,EAC9B;AACF;;;;"}
|
|
@@ -61,7 +61,7 @@ const Autocomplete = flowComponent("Autocomplete", (props) => {
|
|
|
61
61
|
} = useFieldComponent(props);
|
|
62
62
|
const propsContext = {
|
|
63
63
|
SearchField: inputProps,
|
|
64
|
-
TextField: inputProps,
|
|
64
|
+
TextField: { ...inputProps, inputContext: Aria.AutocompleteContext },
|
|
65
65
|
Option: {
|
|
66
66
|
tunnelId: "options"
|
|
67
67
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.mjs","sources":["../../../../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import { useRef, type PropsWithChildren } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport * as Aria from \"react-aria-components\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { SearchFieldProps } from \"@/components/SearchField\";\nimport type { TextFieldProps } from \"@/components/TextField\";\nimport Options from \"@/components/Options\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport locales from \"./locales/*.locale.json\";\nimport Text from \"@/components/Text\";\nimport styles from \"./Autocomplete.module.scss\";\nimport {\n UNSAFE_PortalProvider,\n useFocusWithin,\n useLocalizedStringFormatter,\n} from \"react-aria\";\nimport { emitElementValueChange } from \"@/lib/react/emitElementValueChange\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nexport interface AutocompleteProps\n extends PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps,\n Omit<Aria.AutocompleteProps, \"children\" | \"onInputChange\" | \"inputValue\"> {\n isInvalid?: boolean;\n}\n\n/** @flr-generate all */\nexport const Autocomplete = flowComponent(\"Autocomplete\", (props) => {\n const { children, isInvalid, ...rest } = props;\n\n const { contains } = Aria.useFilter({ sensitivity: \"base\" });\n const stringFormatter = useLocalizedStringFormatter(locales);\n const container = useRef(null);\n const triggerRef = useRef<HTMLInputElement>(null);\n\n const controller = useOverlayController(\"Popover\", {\n reuseControllerFromContext: false,\n });\n\n const focusWithin = useFocusWithin({\n onBlurWithin: controller.close,\n });\n\n const inputProps: SearchFieldProps & TextFieldProps = {\n onKeyDown: (e) => {\n if (e.key === \"Enter\" && controller.isOpen) {\n e.preventDefault();\n }\n },\n isInvalid,\n ref: triggerRef,\n };\n\n const renderEmptyState = () => (\n <Text className={styles.empty}>\n {stringFormatter.format(\"autocomplete.empty\")}\n </Text>\n );\n\n const handleOnInputChange = (value: string) => {\n if (!value) {\n controller.close();\n } else if (!controller.isOpen) {\n controller.open();\n }\n };\n\n const handleOptionAction = (key: Aria.Key) => {\n const inputElement = triggerRef.current;\n if (inputElement) {\n // Set value on input element and trigger change event\n emitElementValueChange(inputElement, String(key));\n }\n controller.close();\n };\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n const propsContext: PropsContext = {\n SearchField: inputProps,\n TextField: inputProps,\n Option: {\n tunnelId: \"options\",\n },\n Popover: {\n className: styles.popover,\n },\n ...fieldPropsContext,\n };\n\n return (\n <div {...fieldProps}>\n <FieldErrorCaptureContext>\n <PropsContextProvider props={propsContext}>\n <div {...focusWithin.focusWithinProps} ref={container}>\n <UNSAFE_PortalProvider getContainer={() => container.current}>\n <Aria.Autocomplete\n onInputChange={handleOnInputChange}\n filter={contains}\n disableAutoFocusFirst\n {...rest}\n >\n {children}\n <Options\n onAction={handleOptionAction}\n triggerRef={triggerRef}\n controller={controller}\n renderEmptyState={renderEmptyState}\n isNonModal\n placement=\"bottom start\"\n >\n <TunnelExit id=\"options\" />\n </Options>\n </Aria.Autocomplete>\n </UNSAFE_PortalProvider>\n </div>\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Autocomplete;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgCO,MAAM,YAAA,GAAe,aAAA,CAAc,cAAA,EAAgB,CAAC,KAAA,KAAU;AACnE,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,GAAG,MAAK,GAAI,KAAA;AAEzC,EAAA,MAAM,EAAE,UAAS,GAAI,IAAA,CAAK,UAAU,EAAE,WAAA,EAAa,QAAQ,CAAA;AAC3D,EAAA,MAAM,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAC3D,EAAA,MAAM,SAAA,GAAY,OAAO,IAAI,CAAA;AAC7B,EAAA,MAAM,UAAA,GAAa,OAAyB,IAAI,CAAA;AAEhD,EAAA,MAAM,UAAA,GAAa,qBAAqB,SAAA,EAAW;AAAA,IACjD,0BAAA,EAA4B;AAAA,GAC7B,CAAA;AAED,EAAA,MAAM,cAAc,cAAA,CAAe;AAAA,IACjC,cAAc,UAAA,CAAW;AAAA,GAC1B,CAAA;AAED,EAAA,MAAM,UAAA,GAAgD;AAAA,IACpD,SAAA,EAAW,CAAC,CAAA,KAAM;AAChB,MAAA,IAAI,CAAA,CAAE,GAAA,KAAQ,OAAA,IAAW,UAAA,CAAW,MAAA,EAAQ;AAC1C,QAAA,CAAA,CAAE,cAAA,EAAe;AAAA,MACnB;AAAA,IACF,CAAA;AAAA,IACA,SAAA;AAAA,IACA,GAAA,EAAK;AAAA,GACP;AAEA,EAAA,MAAM,gBAAA,GAAmB,sBACvB,GAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAW,OAAO,KAAA,EACrB,QAAA,EAAA,eAAA,CAAgB,MAAA,CAAO,oBAAoB,CAAA,EAC9C,CAAA;AAGF,EAAA,MAAM,mBAAA,GAAsB,CAAC,KAAA,KAAkB;AAC7C,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,UAAA,CAAW,KAAA,EAAM;AAAA,IACnB,CAAA,MAAA,IAAW,CAAC,UAAA,CAAW,MAAA,EAAQ;AAC7B,MAAA,UAAA,CAAW,IAAA,EAAK;AAAA,IAClB;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,kBAAA,GAAqB,CAAC,GAAA,KAAkB;AAC5C,IAAA,MAAM,eAAe,UAAA,CAAW,OAAA;AAChC,IAAA,IAAI,YAAA,EAAc;AAEhB,MAAA,sBAAA,CAAuB,YAAA,EAAc,MAAA,CAAO,GAAG,CAAC,CAAA;AAAA,IAClD;AACA,IAAA,UAAA,CAAW,KAAA,EAAM;AAAA,EACnB,CAAA;AAEA,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,WAAA,EAAa,UAAA;AAAA,IACb,
|
|
1
|
+
{"version":3,"file":"Autocomplete.mjs","sources":["../../../../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import { useRef, type PropsWithChildren } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport * as Aria from \"react-aria-components\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { SearchFieldProps } from \"@/components/SearchField\";\nimport type { TextFieldProps } from \"@/components/TextField\";\nimport Options from \"@/components/Options\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport locales from \"./locales/*.locale.json\";\nimport Text from \"@/components/Text\";\nimport styles from \"./Autocomplete.module.scss\";\nimport {\n UNSAFE_PortalProvider,\n useFocusWithin,\n useLocalizedStringFormatter,\n} from \"react-aria\";\nimport { emitElementValueChange } from \"@/lib/react/emitElementValueChange\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nexport interface AutocompleteProps\n extends PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps,\n Omit<Aria.AutocompleteProps, \"children\" | \"onInputChange\" | \"inputValue\"> {\n isInvalid?: boolean;\n}\n\n/** @flr-generate all */\nexport const Autocomplete = flowComponent(\"Autocomplete\", (props) => {\n const { children, isInvalid, ...rest } = props;\n\n const { contains } = Aria.useFilter({ sensitivity: \"base\" });\n const stringFormatter = useLocalizedStringFormatter(locales);\n const container = useRef(null);\n const triggerRef = useRef<HTMLInputElement>(null);\n\n const controller = useOverlayController(\"Popover\", {\n reuseControllerFromContext: false,\n });\n\n const focusWithin = useFocusWithin({\n onBlurWithin: controller.close,\n });\n\n const inputProps: SearchFieldProps & TextFieldProps = {\n onKeyDown: (e) => {\n if (e.key === \"Enter\" && controller.isOpen) {\n e.preventDefault();\n }\n },\n isInvalid,\n ref: triggerRef,\n };\n\n const renderEmptyState = () => (\n <Text className={styles.empty}>\n {stringFormatter.format(\"autocomplete.empty\")}\n </Text>\n );\n\n const handleOnInputChange = (value: string) => {\n if (!value) {\n controller.close();\n } else if (!controller.isOpen) {\n controller.open();\n }\n };\n\n const handleOptionAction = (key: Aria.Key) => {\n const inputElement = triggerRef.current;\n if (inputElement) {\n // Set value on input element and trigger change event\n emitElementValueChange(inputElement, String(key));\n }\n controller.close();\n };\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n const propsContext: PropsContext = {\n SearchField: inputProps,\n TextField: { ...inputProps, inputContext: Aria.AutocompleteContext },\n Option: {\n tunnelId: \"options\",\n },\n Popover: {\n className: styles.popover,\n },\n ...fieldPropsContext,\n };\n\n return (\n <div {...fieldProps}>\n <FieldErrorCaptureContext>\n <PropsContextProvider props={propsContext}>\n <div {...focusWithin.focusWithinProps} ref={container}>\n <UNSAFE_PortalProvider getContainer={() => container.current}>\n <Aria.Autocomplete\n onInputChange={handleOnInputChange}\n filter={contains}\n disableAutoFocusFirst\n {...rest}\n >\n {children}\n <Options\n onAction={handleOptionAction}\n triggerRef={triggerRef}\n controller={controller}\n renderEmptyState={renderEmptyState}\n isNonModal\n placement=\"bottom start\"\n >\n <TunnelExit id=\"options\" />\n </Options>\n </Aria.Autocomplete>\n </UNSAFE_PortalProvider>\n </div>\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Autocomplete;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgCO,MAAM,YAAA,GAAe,aAAA,CAAc,cAAA,EAAgB,CAAC,KAAA,KAAU;AACnE,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,GAAG,MAAK,GAAI,KAAA;AAEzC,EAAA,MAAM,EAAE,UAAS,GAAI,IAAA,CAAK,UAAU,EAAE,WAAA,EAAa,QAAQ,CAAA;AAC3D,EAAA,MAAM,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAC3D,EAAA,MAAM,SAAA,GAAY,OAAO,IAAI,CAAA;AAC7B,EAAA,MAAM,UAAA,GAAa,OAAyB,IAAI,CAAA;AAEhD,EAAA,MAAM,UAAA,GAAa,qBAAqB,SAAA,EAAW;AAAA,IACjD,0BAAA,EAA4B;AAAA,GAC7B,CAAA;AAED,EAAA,MAAM,cAAc,cAAA,CAAe;AAAA,IACjC,cAAc,UAAA,CAAW;AAAA,GAC1B,CAAA;AAED,EAAA,MAAM,UAAA,GAAgD;AAAA,IACpD,SAAA,EAAW,CAAC,CAAA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AAW,MAAA,CAAO;AAAA,KACpB;AAAA,IACA,GAAG;AAAA,GACL;AAEA,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAK,GAAG,UAAA,EACP,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,4BACC,QAAA,kBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,YAAA,EAC3B,8BAAC,KAAA,EAAA,EAAK,GAAG,WAAA,CAAY,gBAAA,EAAkB,KAAK,SAAA,EAC1C,QAAA,kBAAA,GAAA,CAAC,yBAAsB,YAAA,EAAc,MAAM,UAAU,OAAA,EACnD,QAAA,kBAAA,IAAA;AAAA,MAAC,IAAA,CAAK,YAAA;AAAA,MAAL;AAAA,QACC,aAAA,EAAe,mBAAA;AAAA,QACf,MAAA,EAAQ,QAAA;AAAA,QACR,qBAAA,EAAqB,IAAA;AAAA,QACpB,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,QAAA;AAAA,0BACD,GAAA;AAAA,YAAC,OAAA;AAAA,YAAA;AAAA,cACC,QAAA,EAAU,kBAAA;AAAA,cACV,UAAA;AAAA,cACA,UAAA;AAAA,cACA,gBAAA;AAAA,cACA,UAAA,EAAU,IAAA;AAAA,cACV,SAAA,EAAU,cAAA;AAAA,cAEV,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,EAAA,EAAG,SAAA,EAAU;AAAA;AAAA;AAC3B;AAAA;AAAA,KACF,EACF,CAAA,EACF,CAAA,EACF,CAAA,EACF,CAAA;AAAA,wBACC,cAAA,EAAA,EAAe;AAAA,GAAA,EAClB,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -104,7 +104,7 @@ const Button = flowComponent("Button", (props) => {
|
|
|
104
104
|
className: rootClassName,
|
|
105
105
|
ref,
|
|
106
106
|
slot,
|
|
107
|
-
"data-readonly":
|
|
107
|
+
...isReadOnly === true ? { "data-readonly": true } : {},
|
|
108
108
|
...restProps,
|
|
109
109
|
children: [
|
|
110
110
|
/* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children: /* @__PURE__ */ jsx(Wrap, { if: !unstyled, children: /* @__PURE__ */ jsx("span", { className: styles.content, children: /* @__PURE__ */ jsx(Wrap, { if: isStringContent, children: /* @__PURE__ */ jsx(Text, { className: styles.text, children }) }) }) }) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","sources":["../../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport styles from \"./Button.module.scss\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { IconFailed, IconSucceeded } from \"@/components/Icon/components/icons\";\nimport { Wrap } from \"@/components/Wrap\";\nimport { Text } from \"@/components/Text\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport LoadingSpinner from \"@/components/LoadingSpinner/LoadingSpinner\";\nimport { useAriaAnnounceActionState } from \"@/components/Action/lib/ariaLive\";\n\nexport interface ButtonProps\n extends PropsWithChildren<Aria.ButtonProps>,\n FlowComponentProps<HTMLButtonElement> {\n /** Slot for button placement in action groups. */\n slot?: string;\n /** The color of the button. @default \"primary\" */\n color?: \"primary\" | \"accent\" | \"secondary\" | \"danger\" | \"dark\" | \"light\";\n /** The visual variant of the button. @default \"solid\" */\n variant?: \"plain\" | \"solid\" | \"soft\" | \"outline\";\n /** The size of the button. @default \"m\" */\n size?: \"m\" | \"s\";\n /** Disables button but keeps it focusable. */\n \"aria-disabled\"?: boolean;\n /** Whether the button is in a pending state. */\n isPending?: boolean;\n /** Whether the button is in a succeeded state. */\n isSucceeded?: boolean;\n /** Whether the button is in a failed state. */\n isFailed?: boolean;\n /** Whether the button is in a read only state. */\n isReadOnly?: boolean;\n /** @internal */\n unstyled?: boolean;\n /** @internal */\n ariaSlot?: string | null;\n}\n\nconst disablePendingProps = (props: ButtonProps) => {\n if (\n props.isPending ||\n props.isSucceeded ||\n props.isFailed ||\n props[\"aria-disabled\"] ||\n props.isReadOnly\n ) {\n props = { ...props };\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.type = \"button\";\n }\n\n return props;\n};\n\n/** @flr-generate all */\nexport const Button = flowComponent(\"Button\", (props) => {\n props = disablePendingProps(props);\n\n const {\n color = \"primary\",\n variant = \"solid\",\n children,\n className,\n size = \"m\",\n isPending,\n isSucceeded,\n isFailed,\n \"aria-disabled\": ariaDisabled,\n ref,\n slot: ignoredSlotProp,\n ariaSlot: slot,\n unstyled,\n isReadOnly,\n ...restProps\n } = props;\n\n const rootClassName = unstyled\n ? className\n : clsx(\n styles.button,\n isPending && styles.isPending,\n isSucceeded && styles.isSucceeded,\n isFailed && styles.isFailed,\n styles[`size-${size}`],\n styles[color],\n styles[variant],\n className,\n /**\n * Workaround warning: The Aria.Button does not support \"aria-disabled\"\n * by now, so this Button will be visually disabled via CSS.\n */\n ariaDisabled && styles.ariaDisabled,\n );\n\n useAriaAnnounceActionState(\n isPending\n ? \"isPending\"\n : isSucceeded\n ? \"isSucceeded\"\n : isFailed\n ? \"isFailed\"\n : \"isIdle\",\n );\n\n const propsContext: PropsContext = {\n Icon: {\n className: styles.icon,\n \"aria-hidden\": true,\n size,\n },\n Text: {\n className: styles.text,\n },\n Avatar: {\n className: styles.avatar,\n },\n CounterBadge: {\n className: styles.counterBadge,\n },\n Image: {\n className: styles.image,\n },\n };\n\n const StateIconComponent = isSucceeded\n ? IconSucceeded\n : isFailed\n ? IconFailed\n : isPending\n ? LoadingSpinner\n : undefined;\n\n const stateIcon = StateIconComponent && (\n <StateIconComponent\n size={size}\n className={styles.stateIcon}\n status={isFailed ? \"danger\" : isSucceeded ? \"success\" : undefined}\n />\n );\n\n const isStringContent = typeof children === \"string\";\n\n return (\n <Aria.Button\n className={rootClassName}\n ref={ref}\n slot={slot}\n data-readonly
|
|
1
|
+
{"version":3,"file":"Button.mjs","sources":["../../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport styles from \"./Button.module.scss\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { IconFailed, IconSucceeded } from \"@/components/Icon/components/icons\";\nimport { Wrap } from \"@/components/Wrap\";\nimport { Text } from \"@/components/Text\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport LoadingSpinner from \"@/components/LoadingSpinner/LoadingSpinner\";\nimport { useAriaAnnounceActionState } from \"@/components/Action/lib/ariaLive\";\n\nexport interface ButtonProps\n extends PropsWithChildren<Aria.ButtonProps>,\n FlowComponentProps<HTMLButtonElement> {\n /** Slot for button placement in action groups. */\n slot?: string;\n /** The color of the button. @default \"primary\" */\n color?: \"primary\" | \"accent\" | \"secondary\" | \"danger\" | \"dark\" | \"light\";\n /** The visual variant of the button. @default \"solid\" */\n variant?: \"plain\" | \"solid\" | \"soft\" | \"outline\";\n /** The size of the button. @default \"m\" */\n size?: \"m\" | \"s\";\n /** Disables button but keeps it focusable. */\n \"aria-disabled\"?: boolean;\n /** Whether the button is in a pending state. */\n isPending?: boolean;\n /** Whether the button is in a succeeded state. */\n isSucceeded?: boolean;\n /** Whether the button is in a failed state. */\n isFailed?: boolean;\n /** Whether the button is in a read only state. */\n isReadOnly?: boolean;\n /** @internal */\n unstyled?: boolean;\n /** @internal */\n ariaSlot?: string | null;\n}\n\nconst disablePendingProps = (props: ButtonProps) => {\n if (\n props.isPending ||\n props.isSucceeded ||\n props.isFailed ||\n props[\"aria-disabled\"] ||\n props.isReadOnly\n ) {\n props = { ...props };\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.type = \"button\";\n }\n\n return props;\n};\n\n/** @flr-generate all */\nexport const Button = flowComponent(\"Button\", (props) => {\n props = disablePendingProps(props);\n\n const {\n color = \"primary\",\n variant = \"solid\",\n children,\n className,\n size = \"m\",\n isPending,\n isSucceeded,\n isFailed,\n \"aria-disabled\": ariaDisabled,\n ref,\n slot: ignoredSlotProp,\n ariaSlot: slot,\n unstyled,\n isReadOnly,\n ...restProps\n } = props;\n\n const rootClassName = unstyled\n ? className\n : clsx(\n styles.button,\n isPending && styles.isPending,\n isSucceeded && styles.isSucceeded,\n isFailed && styles.isFailed,\n styles[`size-${size}`],\n styles[color],\n styles[variant],\n className,\n /**\n * Workaround warning: The Aria.Button does not support \"aria-disabled\"\n * by now, so this Button will be visually disabled via CSS.\n */\n ariaDisabled && styles.ariaDisabled,\n );\n\n useAriaAnnounceActionState(\n isPending\n ? \"isPending\"\n : isSucceeded\n ? \"isSucceeded\"\n : isFailed\n ? \"isFailed\"\n : \"isIdle\",\n );\n\n const propsContext: PropsContext = {\n Icon: {\n className: styles.icon,\n \"aria-hidden\": true,\n size,\n },\n Text: {\n className: styles.text,\n },\n Avatar: {\n className: styles.avatar,\n },\n CounterBadge: {\n className: styles.counterBadge,\n },\n Image: {\n className: styles.image,\n },\n };\n\n const StateIconComponent = isSucceeded\n ? IconSucceeded\n : isFailed\n ? IconFailed\n : isPending\n ? LoadingSpinner\n : undefined;\n\n const stateIcon = StateIconComponent && (\n <StateIconComponent\n size={size}\n className={styles.stateIcon}\n status={isFailed ? \"danger\" : isSucceeded ? \"success\" : undefined}\n />\n );\n\n const isStringContent = typeof children === \"string\";\n\n return (\n <Aria.Button\n className={rootClassName}\n ref={ref}\n slot={slot}\n {...(isReadOnly === true ? { \"data-readonly\": true } : {})}\n {...restProps}\n >\n <PropsContextProvider props={propsContext}>\n <Wrap if={!unstyled}>\n <span className={styles.content}>\n <Wrap if={isStringContent}>\n <Text className={styles.text}>{children}</Text>\n </Wrap>\n </span>\n </Wrap>\n </PropsContextProvider>\n {stateIcon}\n </Aria.Button>\n );\n});\n\nexport default Button;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,MAAM,mBAAA,GAAsB,CAAC,KAAA,KAAuB;AAClD,EAAA,IACE,KAAA,CAAM,SAAA,IACN,KAAA,CAAM,WAAA,IACN,KAAA,CAAM,YACN,KAAA,CAAM,eAAe,CAAA,IACrB,KAAA,CAAM,UAAA,EACN;AACA,IAAA,KAAA,GAAQ,EAAE,GAAG,KAAA,EAAM;AACnB,IAAA,KAAA,CAAM,OAAA,GAAU,MAAA;AAChB,IAAA,KAAA,CAAM,YAAA,GAAe,MAAA;AACrB,IAAA,KAAA,CAAM,UAAA,GAAa,MAAA;AACnB,IAAA,KAAA,CAAM,aAAA,GAAgB,MAAA;AACtB,IAAA,KAAA,CAAM,SAAA,GAAY,MAAA;AAClB,IAAA,KAAA,CAAM,SAAA,GAAY,MAAA;AAClB,IAAA,KAAA,CAAM,OAAA,GAAU,MAAA;AAChB,IAAA,KAAA,CAAM,IAAA,GAAO,QAAA;AAAA,EACf;AAEA,EAAA,OAAO,KAAA;AACT,CAAA;AAGO,MAAM,MAAA,GAAS,aAAA,CAAc,QAAA,EAAU,CAAC,KAAA,KAAU;AACvD,EAAA,KAAA,GAAQ,oBAAoB,KAAK,CAAA;AAEjC,EAAA,MAAM;AAAA,IACJ,KAAA,GAAQ,SAAA;AAAA,IACR,OAAA,GAAU,OAAA;AAAA,IACV,QAAA;AAAA,IACA,SAAA;AAAA,IACA,IAAA,GAAO,GAAA;AAAA,IACP,SAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAA,EAAiB,YAAA;AAAA,IACjB,GAAA;AAAA,IACA,IAAA,EAAM,eAAA;AAAA,IACN,QAAA,EAAU,IAAA;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AA,GAAW,QAAA,GAAW,WAAA,GAAc,SAAA,GAAY;AAAA;AAAA,GAC1D;AAGF,EAAA,MAAM,eAAA,GAAkB,OAAO,QAAA,KAAa,QAAA;AAE5C,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA,CAAK,MAAA;AAAA,IAAL;AAAA,MACC,SAAA,EAAW,aAAA;AAAA,MACX,GAAA;AAAA,MACA,IAAA;AAAA,MACC,GAAI,UAAA,KAAe,IAAA,GAAO,EAAE,eAAA,EAAiB,IAAA,KAAS,EAAC;AAAA,MACvD,GAAG,SAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,YAAA,EAC3B,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAI,CAAC,QAAA,EACT,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAW,MAAA,CAAO,OAAA,EACtB,8BAAC,IAAA,EAAA,EAAK,EAAA,EAAI,eAAA,EACR,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAW,MAAA,CAAO,IAAA,EAAO,QAAA,EAAS,CAAA,EAC1C,CAAA,EACF,CAAA,EACF,CAAA,EACF,CAAA;AAAA,QACC;AAAA;AAAA;AAAA,GACH;AAEJ,CAAC;;;;"}
|
|
@@ -2,12 +2,116 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import * as Recharts from 'recharts';
|
|
5
|
-
import { Children,
|
|
6
|
-
import { Area } from './components/Area/Area.mjs';
|
|
5
|
+
import { Children, useRef, useState, useEffect } from 'react';
|
|
7
6
|
import clsx from 'clsx';
|
|
8
7
|
import styles from './CartesianChart.module.scss.mjs';
|
|
9
8
|
import { Wrap } from '../Wrap/Wrap.mjs';
|
|
9
|
+
import '../AccentBox/AccentBox.mjs';
|
|
10
|
+
import '../../lib/propsContext/propsContext.mjs';
|
|
11
|
+
import '../../lib/propsContext/components/PropsContextProvider.mjs';
|
|
12
|
+
import '../Button/Button.mjs';
|
|
13
|
+
import '@tabler/icons-react';
|
|
14
|
+
import '../Icon/Icon.mjs';
|
|
15
|
+
import '../../views/IconView.mjs';
|
|
16
|
+
import '@mittwald/react-tunnel';
|
|
17
|
+
import '../SuspenseTrigger/SuspenseTrigger.mjs';
|
|
18
|
+
import 'react-aria';
|
|
19
|
+
import '../Action/Action.mjs';
|
|
20
|
+
import '@react-aria/live-announcer';
|
|
21
|
+
import '../ActionGroup/ActionGroup.mjs';
|
|
22
|
+
import '../Alert/Alert.mjs';
|
|
23
|
+
import '../AlertBadge/AlertBadge.mjs';
|
|
24
|
+
import '../Align/Align.mjs';
|
|
25
|
+
import '../Autocomplete/Autocomplete.mjs';
|
|
26
|
+
import '../Avatar/Avatar.mjs';
|
|
27
|
+
import '../Badge/Badge.mjs';
|
|
28
|
+
import 'react-aria-components';
|
|
29
|
+
import 'mobx';
|
|
30
|
+
import '../../lib/controller/overlay/context.mjs';
|
|
31
|
+
import 'remeda';
|
|
32
|
+
import '@react-aria/utils';
|
|
33
|
+
import 'dot-prop';
|
|
34
|
+
import '../Heading/Heading.mjs';
|
|
35
|
+
import '../Text/Text.mjs';
|
|
10
36
|
import { CartesianGrid } from './components/CartesianGrid/CartesianGrid.mjs';
|
|
37
|
+
import '../Checkbox/Checkbox.mjs';
|
|
38
|
+
import '../CheckboxButton/CheckboxButton.mjs';
|
|
39
|
+
import '../CheckboxGroup/CheckboxGroup.mjs';
|
|
40
|
+
import '../../lib/propsContext/inherit/PropsContextLevelProvider.mjs';
|
|
41
|
+
import 'react-syntax-highlighter';
|
|
42
|
+
import '../CopyButton/CopyButton.mjs';
|
|
43
|
+
import '../ColumnLayout/ColumnLayout.mjs';
|
|
44
|
+
import '../ComboBox/ComboBox.mjs';
|
|
45
|
+
import '../../lib/propsContext/components/ComponentPropsContextProvider.mjs';
|
|
46
|
+
import '../Content/Content.mjs';
|
|
47
|
+
import '../ContextMenu/ContextMenu.mjs';
|
|
48
|
+
import '../MenuItem/MenuItem.mjs';
|
|
49
|
+
import '../ContextMenu/components/ContextMenuTrigger/ContextMenuTrigger.mjs';
|
|
50
|
+
import '../ContextMenu/components/ContextMenuSection/ContextMenuSection.mjs';
|
|
51
|
+
import '../ContextualHelp/ContextualHelp.mjs';
|
|
52
|
+
import '../ContextualHelp/components/ContextualHelpTrigger/ContextualHelpTrigger.mjs';
|
|
53
|
+
import '../CounterBadge/CounterBadge.mjs';
|
|
54
|
+
import '../CountryOptions/CountryOptions.mjs';
|
|
55
|
+
import '../DatePicker/DatePicker.mjs';
|
|
56
|
+
import '../DateRangePicker/DateRangePicker.mjs';
|
|
57
|
+
import '../FieldDescription/FieldDescription.mjs';
|
|
58
|
+
import '../FieldError/FieldError.mjs';
|
|
59
|
+
import '../FileCard/FileCard.mjs';
|
|
60
|
+
import '../FileCardList/FileCardList.mjs';
|
|
61
|
+
import '../FileDropZone/FileDropZone.mjs';
|
|
62
|
+
import '../FileField/FileField.mjs';
|
|
63
|
+
import '../Header/Header.mjs';
|
|
64
|
+
import '../Image/Image.mjs';
|
|
65
|
+
import '../Initials/Initials.mjs';
|
|
66
|
+
import '../Label/Label.mjs';
|
|
67
|
+
import '../LayoutCard/LayoutCard.mjs';
|
|
68
|
+
import '../OverlayTrigger/components/MenuTrigger/MenuTrigger.mjs';
|
|
69
|
+
import '../../views/DialogTriggerView.mjs';
|
|
70
|
+
import '../LightBox/LightBox.mjs';
|
|
71
|
+
import '../Link/Link.mjs';
|
|
72
|
+
import 'invariant';
|
|
73
|
+
import '../../views/ListItemViewContentView.mjs';
|
|
74
|
+
import '../../views/ButtonView.mjs';
|
|
75
|
+
import '../../views/ContextMenuTriggerView.mjs';
|
|
76
|
+
import '../List/components/ListSummary/ListSummary.mjs';
|
|
77
|
+
import '../List/listContext.mjs';
|
|
78
|
+
import '../List/List.mjs';
|
|
79
|
+
import 'react-markdown';
|
|
80
|
+
import 'remark-gfm';
|
|
81
|
+
import '../MarkdownEditor/MarkdownEditor.mjs';
|
|
82
|
+
import '../Message/Message.mjs';
|
|
83
|
+
import '../MessageThread/MessageThread.mjs';
|
|
84
|
+
import '../Modal/Modal.mjs';
|
|
85
|
+
import '../Navigation/Navigation.mjs';
|
|
86
|
+
import '../Navigation/components/NavigationGroup/NavigationGroup.mjs';
|
|
87
|
+
import '../NotificationProvider/NotificationProvider.mjs';
|
|
88
|
+
import 'luxon';
|
|
89
|
+
import '../NumberField/NumberField.mjs';
|
|
90
|
+
import '../Option/Option.mjs';
|
|
91
|
+
import '../../views/OverlayContentView.mjs';
|
|
92
|
+
import '../../views/ClearPropsContextView.mjs';
|
|
93
|
+
import '../../views/LoadingSpinnerView.mjs';
|
|
94
|
+
import '../PasswordCreationField/PasswordCreationField.mjs';
|
|
95
|
+
import '../Popover/components/PopoverTrigger/PopoverTrigger.mjs';
|
|
96
|
+
import '../Popover/Popover.mjs';
|
|
97
|
+
import '../ProgressBar/ProgressBar.mjs';
|
|
98
|
+
import '../RadioGroup/RadioGroup.mjs';
|
|
99
|
+
import '../RadioGroup/components/Radio/Radio.mjs';
|
|
100
|
+
import '../RadioGroup/components/RadioButton/RadioButton.mjs';
|
|
101
|
+
import '../SearchField/SearchField.mjs';
|
|
102
|
+
import '../Section/Section.mjs';
|
|
103
|
+
import '../SegmentedControl/SegmentedControl.mjs';
|
|
104
|
+
import '../SegmentedControl/components/Segment/Segment.mjs';
|
|
105
|
+
import '../Select/Select.mjs';
|
|
106
|
+
import '../SettingsProvider/SettingsProvider.mjs';
|
|
107
|
+
import '../Slider/Slider.mjs';
|
|
108
|
+
import '../Switch/Switch.mjs';
|
|
109
|
+
import '../Tabs/Tabs.mjs';
|
|
110
|
+
import '../Tabs/components/Tab/context.mjs';
|
|
111
|
+
import '../TextArea/TextArea.mjs';
|
|
112
|
+
import '../TextField/TextField.mjs';
|
|
113
|
+
import '../TimeField/TimeField.mjs';
|
|
114
|
+
import '../TranslationProvider/TranslationProvider.mjs';
|
|
11
115
|
|
|
12
116
|
const CartesianChart = (props) => {
|
|
13
117
|
const {
|
|
@@ -20,28 +124,13 @@ const CartesianChart = (props) => {
|
|
|
20
124
|
...rest
|
|
21
125
|
} = props;
|
|
22
126
|
const rootClassName = clsx(styles.cartesianChart, className);
|
|
23
|
-
const areasWithoutDots = [];
|
|
24
|
-
const areasWithDots = [];
|
|
25
127
|
const otherChildren = [];
|
|
26
128
|
const gridChildren = [];
|
|
27
|
-
Children.forEach(children, (child
|
|
129
|
+
Children.forEach(children, (child) => {
|
|
28
130
|
if (!child) return;
|
|
29
131
|
const element = child;
|
|
30
132
|
if (element.type === CartesianGrid) {
|
|
31
133
|
gridChildren.push(element);
|
|
32
|
-
} else if (element.type === Area) {
|
|
33
|
-
areasWithoutDots.push(
|
|
34
|
-
cloneElement(element, {
|
|
35
|
-
onlyDots: false,
|
|
36
|
-
key: `area-${index}`
|
|
37
|
-
})
|
|
38
|
-
);
|
|
39
|
-
areasWithDots.push(
|
|
40
|
-
cloneElement(element, {
|
|
41
|
-
onlyDots: true,
|
|
42
|
-
key: `area-dots-${index}`
|
|
43
|
-
})
|
|
44
|
-
);
|
|
45
134
|
} else {
|
|
46
135
|
otherChildren.push(element);
|
|
47
136
|
}
|
|
@@ -79,13 +168,19 @@ const CartesianChart = (props) => {
|
|
|
79
168
|
{
|
|
80
169
|
style: { height, flex: flexGrow ? 1 : void 0 },
|
|
81
170
|
ref: chartContainerRef,
|
|
82
|
-
children: /* @__PURE__ */ jsx(Recharts.ResponsiveContainer, { children: /* @__PURE__ */ jsxs(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
171
|
+
children: /* @__PURE__ */ jsx(Recharts.ResponsiveContainer, { children: /* @__PURE__ */ jsxs(
|
|
172
|
+
Recharts.ComposedChart,
|
|
173
|
+
{
|
|
174
|
+
data,
|
|
175
|
+
className: rootClassName,
|
|
176
|
+
...rest,
|
|
177
|
+
children: [
|
|
178
|
+
!showEmptyView && gridChildren,
|
|
179
|
+
otherChildren,
|
|
180
|
+
showEmptyView && viewDimensions && /* @__PURE__ */ jsx("foreignObject", { ...viewDimensions, children: /* @__PURE__ */ jsx("div", { className: styles.emptyViewContainer, children: /* @__PURE__ */ jsx(EmptyView, { data }) }) })
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
) })
|
|
89
184
|
}
|
|
90
185
|
) });
|
|
91
186
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartesianChart.mjs","sources":["../../../../../../src/components/CartesianChart/CartesianChart.tsx"],"sourcesContent":["import * as Recharts from \"recharts\";\nimport
|
|
1
|
+
{"version":3,"file":"CartesianChart.mjs","sources":["../../../../../../src/components/CartesianChart/CartesianChart.tsx"],"sourcesContent":["import * as Recharts from \"recharts\";\nimport React, {\n Children,\n useEffect,\n useRef,\n useState,\n type ComponentProps,\n type FC,\n type PropsWithChildren,\n type ReactElement,\n type SVGProps,\n} from \"react\";\nimport clsx from \"clsx\";\nimport styles from \"./CartesianChart.module.scss\";\nimport Wrap from \"../Wrap\";\nimport { CartesianGrid } from \"../public\";\n\nexport interface CartesianChartEmptyViewProps {\n data?: ComponentProps<typeof Recharts.ComposedChart>[\"data\"];\n}\n\nexport interface CartesianChartProps\n extends Pick<\n ComponentProps<typeof Recharts.ComposedChart>,\n \"data\" | \"className\" | \"syncId\" | \"syncMethod\"\n >,\n PropsWithChildren {\n height?: string;\n /** View that is provided when data is empty/undefined */\n emptyView?: React.ComponentType<CartesianChartEmptyViewProps>;\n /**\n * Allow the height controlling container to set flex-grow: 1. Can only be\n * used in combination with `height`\n */\n flexGrow?: boolean;\n}\n\n/** @flr-generate all */\nexport const CartesianChart: FC<CartesianChartProps> = (props) => {\n const {\n children,\n data,\n className,\n height,\n flexGrow,\n emptyView: EmptyView,\n ...rest\n } = props;\n const rootClassName = clsx(styles.cartesianChart, className);\n\n const otherChildren: ReactElement[] = [];\n const gridChildren: ReactElement[] = [];\n\n Children.forEach(children, (child) => {\n if (!child) return;\n const element = child as ReactElement;\n\n if (element.type === CartesianGrid) {\n gridChildren.push(element);\n } else {\n otherChildren.push(element);\n }\n });\n\n const showEmptyView = (!data || data.length === 0) && EmptyView;\n\n const chartContainerRef = useRef<HTMLDivElement>(null);\n const [viewDimensions, setViewDimensions] = useState<Partial<\n SVGProps<SVGForeignObjectElement>\n > | null>(null);\n\n // resizing the foreignObject for the EmptyView on size changes\n useEffect(() => {\n if (showEmptyView) {\n const updateDimensions = () => {\n const svg = chartContainerRef.current?.querySelector(\n \"svg\",\n ) as SVGSVGElement | null;\n if (!svg) return;\n\n const clip = svg.querySelector(\"clipPath rect\");\n if (clip) {\n const x = parseFloat(clip.getAttribute(\"x\") ?? \"0\");\n const y = parseFloat(clip.getAttribute(\"y\") ?? \"0\");\n const width = parseFloat(clip.getAttribute(\"width\") ?? \"0\");\n const height = parseFloat(clip.getAttribute(\"height\") ?? \"0\");\n setViewDimensions({ x, y, width, height });\n }\n };\n\n updateDimensions();\n\n const container = chartContainerRef.current;\n const observer = new ResizeObserver(updateDimensions);\n if (container) observer.observe(container);\n\n return () => {\n observer.disconnect();\n };\n }\n }, []);\n\n return (\n <Wrap if={height}>\n <div\n style={{ height, flex: flexGrow ? 1 : undefined }}\n ref={chartContainerRef}\n >\n <Recharts.ResponsiveContainer>\n <Recharts.ComposedChart\n data={data}\n className={rootClassName}\n {...rest}\n >\n {!showEmptyView && gridChildren}\n {otherChildren}\n {showEmptyView && viewDimensions && (\n <foreignObject {...viewDimensions}>\n <div className={styles.emptyViewContainer}>\n <EmptyView data={data} />\n </div>\n </foreignObject>\n )}\n </Recharts.ComposedChart>\n </Recharts.ResponsiveContainer>\n </div>\n </Wrap>\n );\n};\n\nexport default CartesianChart;\n"],"names":["height"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA;AAAA,UACV,GAAG,IAAA;AAAA,UAEH,QAAA,EAAA;AAAA,YAAA,CAAC,aAAA,IAAiB,YAAA;AAAA,YAClB,aAAA;AAAA,YACA,aAAA,IAAiB,cAAA,oBAChB,GAAA,CAAC,eAAA,EAAA,EAAe,GAAG,cAAA,EACjB,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAO,kBAAA,EACrB,QAAA,kBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,IAAA,EAAY,GACzB,CAAA,EACF;AAAA;AAAA;AAAA,OAEJ,EACF;AAAA;AAAA,GACF,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -7,23 +7,17 @@ import tokens from '../../../../../../design-tokens/dist/variables.json.mjs';
|
|
|
7
7
|
import { AreaDot } from '../AreaDot/AreaDot.mjs';
|
|
8
8
|
|
|
9
9
|
const Area = (props) => {
|
|
10
|
-
const {
|
|
11
|
-
color = "sea-green",
|
|
12
|
-
stackId = 1,
|
|
13
|
-
fillOpacity = 1,
|
|
14
|
-
onlyDots = true,
|
|
15
|
-
...rest
|
|
16
|
-
} = props;
|
|
10
|
+
const { color = "sea-green", stackId = 1, fillOpacity = 1, ...rest } = props;
|
|
17
11
|
return /* @__PURE__ */ jsx(
|
|
18
12
|
Recharts.Area,
|
|
19
13
|
{
|
|
20
14
|
stackId,
|
|
21
15
|
fillOpacity,
|
|
22
16
|
...rest,
|
|
23
|
-
activeDot:
|
|
24
|
-
fill:
|
|
25
|
-
stroke:
|
|
26
|
-
strokeWidth:
|
|
17
|
+
activeDot: /* @__PURE__ */ jsx(AreaDot, { color: `var(--color--categorical--${color})` }),
|
|
18
|
+
fill: `var(--color--categorical--${color})`,
|
|
19
|
+
stroke: tokens.area["border-color"].value,
|
|
20
|
+
strokeWidth: tokens.area["border-width"].value
|
|
27
21
|
}
|
|
28
22
|
);
|
|
29
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Area.mjs","sources":["../../../../../../../../src/components/CartesianChart/components/Area/Area.tsx"],"sourcesContent":["import { type FC } from \"react\";\nimport * as Recharts from \"recharts\";\nimport tokens from \"@mittwald/flow-design-tokens/variables.json\";\nimport { AreaDot } from \"../AreaDot\";\nimport type { CategoricalColor } from \"@/lib/tokens/CategoricalColors\";\n\nexport interface AreaProps\n extends Pick<\n Recharts.AreaProps,\n | \"className\"\n | \"dataKey\"\n | \"stackId\"\n | \"fillOpacity\"\n | \"key\"\n | \"xAxisId\"\n | \"yAxisId\"\n | \"type\"\n | \"unit\"\n > {\n /** The color of the area. @default \"sea-green\" */\n color?: CategoricalColor;\n
|
|
1
|
+
{"version":3,"file":"Area.mjs","sources":["../../../../../../../../src/components/CartesianChart/components/Area/Area.tsx"],"sourcesContent":["import { type FC } from \"react\";\nimport * as Recharts from \"recharts\";\nimport tokens from \"@mittwald/flow-design-tokens/variables.json\";\nimport { AreaDot } from \"../AreaDot\";\nimport type { CategoricalColor } from \"@/lib/tokens/CategoricalColors\";\n\nexport interface AreaProps\n extends Pick<\n Recharts.AreaProps,\n | \"className\"\n | \"dataKey\"\n | \"stackId\"\n | \"fillOpacity\"\n | \"key\"\n | \"xAxisId\"\n | \"yAxisId\"\n | \"type\"\n | \"unit\"\n > {\n /** The color of the area. @default \"sea-green\" */\n color?: CategoricalColor;\n}\n\n/** @flr-generate all */\nexport const Area: FC<AreaProps> = (props) => {\n const { color = \"sea-green\", stackId = 1, fillOpacity = 1, ...rest } = props;\n\n return (\n <Recharts.Area\n stackId={stackId}\n fillOpacity={fillOpacity}\n {...rest}\n activeDot={<AreaDot color={`var(--color--categorical--${color})`} />}\n fill={`var(--color--categorical--${color})`}\n stroke={tokens.area[\"border-color\"].value}\n strokeWidth={tokens.area[\"border-width\"].value}\n />\n );\n};\n\nexport default Area;\n"],"names":[],"mappings":";;;;;;AAwBO,MAAM,IAAA,GAAsB,CAAC,KAAA,KAAU;AAC5C,EAAA,MAAM,EAAE,QAAQ,WAAA,EAAa,OAAA,GAAU,GAAG,WAAA,GAAc,CAAA,EAAG,GAAG,IAAA,EAAK,GAAI,KAAA;AAEvE,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA,CAAS,IAAA;AAAA,IAAT;AAAA,MACC,OAAA;AAAA,MACA,WAAA;AAAA,MACC,GAAG,IAAA;AAAA,MACJ,2BAAW,GAAA,CAAC,OAAA,EAAA,EAAQ,KAAA,EAAO,CAAA,0BAAA,EAA6B,KAAK,CAAA,CAAA,CAAA,EAAK,CAAA;AAAA,MAClE,IAAA,EAAM,6BAA6B,KAAK,CAAA,CAAA,CAAA;AAAA,MACxC,MAAA,EAAQ,MAAA,CAAO,IAAA,CAAK,cAAc,CAAA,CAAE,KAAA;AAAA,MACpC,WAAA,EAAa,MAAA,CAAO,IAAA,CAAK,cAAc,CAAA,CAAE;AAAA;AAAA,GAC3C;AAEJ;;;;"}
|
|
@@ -5,7 +5,7 @@ import * as Recharts from 'recharts';
|
|
|
5
5
|
import tokens from '../../../../../../design-tokens/dist/variables.json.mjs';
|
|
6
6
|
|
|
7
7
|
const YAxis = (props) => {
|
|
8
|
-
const { domain
|
|
8
|
+
const { domain, ...rest } = props;
|
|
9
9
|
return /* @__PURE__ */ jsx(
|
|
10
10
|
Recharts.YAxis,
|
|
11
11
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YAxis.mjs","sources":["../../../../../../../../src/components/CartesianChart/components/YAxis/YAxis.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport * as Recharts from \"recharts\";\nimport tokens from \"@mittwald/flow-design-tokens/variables.json\";\n\nexport type YAxisProps = Pick<\n Recharts.YAxisProps,\n | \"className\"\n | \"dataKey\"\n | \"orientation\"\n | \"allowDecimals\"\n | \"interval\"\n | \"minTickGap\"\n | \"scale\"\n | \"type\"\n | \"domain\"\n | \"hide\"\n | \"unit\"\n | \"tickFormatter\"\n>;\n\n/** @flr-generate all */\nexport const YAxis: FC<YAxisProps> = (props) => {\n const { domain
|
|
1
|
+
{"version":3,"file":"YAxis.mjs","sources":["../../../../../../../../src/components/CartesianChart/components/YAxis/YAxis.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport * as Recharts from \"recharts\";\nimport tokens from \"@mittwald/flow-design-tokens/variables.json\";\n\nexport type YAxisProps = Pick<\n Recharts.YAxisProps,\n | \"className\"\n | \"dataKey\"\n | \"orientation\"\n | \"allowDecimals\"\n | \"interval\"\n | \"minTickGap\"\n | \"scale\"\n | \"type\"\n | \"domain\"\n | \"hide\"\n | \"unit\"\n | \"tickFormatter\"\n>;\n\n/** @flr-generate all */\nexport const YAxis: FC<YAxisProps> = (props) => {\n const { domain, ...rest } = props;\n\n return (\n <Recharts.YAxis\n {...rest}\n allowDataOverflow\n domain={domain}\n fontSize={tokens.axis[\"font-size\"].value}\n tick={{\n fill: tokens.axis[\"text-color\"].value,\n }}\n tickMargin={parseInt(tokens.axis.spacing.value)}\n tickSize={parseInt(tokens.axis[\"tick-size\"].value)}\n />\n );\n};\n\nexport default YAxis;\n"],"names":[],"mappings":";;;;AAqBO,MAAM,KAAA,GAAwB,CAAC,KAAA,KAAU;AAC9C,EAAA,MAAM,EAAE,MAAA,EAAQ,GAAG,IAAA,EAAK,GAAI,KAAA;AAE5B,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA,CAAS,KAAA;AAAA,IAAT;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,iBAAA,EAAiB,IAAA;AAAA,MACjB,MAAA;AAAA,MACA,QAAA,EAAU,MAAA,CAAO,IAAA,CAAK,WAAW,CAAA,CAAE,KAAA;AAAA,MACnC,IAAA,EAAM;AAAA,QACJ,IAAA,EAAM,MAAA,CAAO,IAAA,CAAK,YAAY,CAAA,CAAE;AAAA,OAClC;AAAA,MACA,UAAA,EAAY,QAAA,CAAS,MAAA,CAAO,IAAA,CAAK,QAAQ,KAAK,CAAA;AAAA,MAC9C,UAAU,QAAA,CAAS,MAAA,CAAO,IAAA,CAAK,WAAW,EAAE,KAAK;AAAA;AAAA,GACnD;AAEJ;;;;"}
|
|
@@ -19,7 +19,7 @@ import { useObjectRef } from '@react-aria/utils';
|
|
|
19
19
|
import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
|
|
20
20
|
|
|
21
21
|
const Checkbox = flowComponent("Checkbox", (props) => {
|
|
22
|
-
const { children, className, ref, inputClassName, ...rest } = props;
|
|
22
|
+
const { children, className, ref, inputClassName, inputRef, ...rest } = props;
|
|
23
23
|
const {
|
|
24
24
|
FieldErrorView,
|
|
25
25
|
FieldErrorCaptureContext,
|
|
@@ -27,7 +27,11 @@ const Checkbox = flowComponent("Checkbox", (props) => {
|
|
|
27
27
|
fieldProps
|
|
28
28
|
} = useFieldComponent(props);
|
|
29
29
|
const localCheckboxRef = useObjectRef(ref);
|
|
30
|
-
|
|
30
|
+
const localInputCheckboxRef = useObjectRef(inputRef);
|
|
31
|
+
useMakeFocusable(
|
|
32
|
+
localCheckboxRef,
|
|
33
|
+
() => localInputCheckboxRef.current?.focus()
|
|
34
|
+
);
|
|
31
35
|
return /* @__PURE__ */ jsxs(
|
|
32
36
|
"div",
|
|
33
37
|
{
|
|
@@ -35,10 +39,18 @@ const Checkbox = flowComponent("Checkbox", (props) => {
|
|
|
35
39
|
className: clsx(styles.checkbox, className, fieldProps.className),
|
|
36
40
|
ref: localCheckboxRef,
|
|
37
41
|
children: [
|
|
38
|
-
/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(
|
|
43
|
+
Aria.Checkbox,
|
|
44
|
+
{
|
|
45
|
+
...rest,
|
|
46
|
+
inputRef: localInputCheckboxRef,
|
|
47
|
+
className: clsx(inputClassName, styles.input),
|
|
48
|
+
children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs(PropsContextProvider, { props: fieldPropsContext, children: [
|
|
49
|
+
isSelected ? /* @__PURE__ */ jsx(IconCheckboxChecked, { className: styles.icon }) : isIndeterminate ? /* @__PURE__ */ jsx(IconCheckboxIndeterminate, { className: styles.icon }) : /* @__PURE__ */ jsx(IconCheckboxEmpty, { className: styles.icon }),
|
|
50
|
+
children
|
|
51
|
+
] })
|
|
52
|
+
}
|
|
53
|
+
) }),
|
|
42
54
|
/* @__PURE__ */ jsx(FieldErrorView, {})
|
|
43
55
|
]
|
|
44
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.mjs","sources":["../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import {\n IconCheckboxChecked,\n IconCheckboxEmpty,\n IconCheckboxIndeterminate,\n} from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport clsx from \"clsx\";\nimport type { PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Checkbox.module.scss\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface CheckboxProps\n extends PropsWithChildren<Omit<Aria.CheckboxProps, \"children\">>,\n FlowComponentProps {\n inputClassName?: string;\n}\n\n/** @flr-generate all */\nexport const Checkbox = flowComponent(\"Checkbox\", (props) => {\n const { children, className, ref, inputClassName, ...rest } = props;\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n const localCheckboxRef = useObjectRef(ref);\n useMakeFocusable(localCheckboxRef);\n\n return (\n <div\n {...fieldProps}\n className={clsx(styles.checkbox, className, fieldProps.className)}\n ref={localCheckboxRef}\n >\n <FieldErrorCaptureContext>\n <Aria.Checkbox
|
|
1
|
+
{"version":3,"file":"Checkbox.mjs","sources":["../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import {\n IconCheckboxChecked,\n IconCheckboxEmpty,\n IconCheckboxIndeterminate,\n} from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport clsx from \"clsx\";\nimport type { PropsWithChildren, RefObject } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Checkbox.module.scss\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface CheckboxProps\n extends PropsWithChildren<Omit<Aria.CheckboxProps, \"children\">>,\n FlowComponentProps {\n inputClassName?: string;\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\n/** @flr-generate all */\nexport const Checkbox = flowComponent(\"Checkbox\", (props) => {\n const { children, className, ref, inputClassName, inputRef, ...rest } = props;\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n const localCheckboxRef = useObjectRef(ref);\n const localInputCheckboxRef = useObjectRef(inputRef);\n useMakeFocusable(localCheckboxRef, () =>\n localInputCheckboxRef.current?.focus(),\n );\n\n return (\n <div\n {...fieldProps}\n className={clsx(styles.checkbox, className, fieldProps.className)}\n ref={localCheckboxRef}\n >\n <FieldErrorCaptureContext>\n <Aria.Checkbox\n {...rest}\n inputRef={localInputCheckboxRef}\n className={clsx(inputClassName, styles.input)}\n >\n {({ isSelected, isIndeterminate }) => (\n <PropsContextProvider props={fieldPropsContext}>\n {isSelected ? (\n <IconCheckboxChecked className={styles.icon} />\n ) : isIndeterminate ? (\n <IconCheckboxIndeterminate className={styles.icon} />\n ) : (\n <IconCheckboxEmpty className={styles.icon} />\n )}\n {children}\n </PropsContextProvider>\n )}\n </Aria.Checkbox>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Checkbox;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,MAAM,QAAA,GAAW,aAAA,CAAc,UAAA,EAAY,CAAC,KAAA,KAAU;AAC3D,EAAA,MAAM,EAAE,UAAU,SAAA,EAAW,GAAA,EAAK,gBAAgB,QAAA,EAAU,GAAG,MAAK,GAAI,KAAA;AAExE,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,MAAM,gBAAA,GAAmB,aAAa,GAAG,CAAA;AACzC,EAAA,MAAM,qBAAA,GAAwB,aAAa,QAAQ,CAAA;AACnD,EAAA,gBAAA;AAAA,IAAiB,gBAAA;AAAA,IAAkB,MACjC,qBAAA,CAAsB,OAAA,EAAS,KAAA;AAAM,GACvC;AAEA,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACE,GAAG,UAAA;AAAA,MACJ,WAAW,IAAA,CAAK,MAAA,CAAO,QAAA,EAAU,SAAA,EAAW,WAAW,SAAS,CAAA;AAAA,MAChE,GAAA,EAAK,gBAAA;AAAA,MAEL,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,wBAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,UAAC,IAAA,CAAK,QAAA;AAAA,UAAL;AAAA,YACE,GAAG,IAAA;AAAA,YACJ,QAAA,EAAU,qBAAA;AAAA,YACV,SAAA,EAAW,IAAA,CAAK,cAAA,EAAgB,MAAA,CAAO,KAAK,CAAA;AAAA,YAE3C,QAAA,EAAA,CAAC,EAAE,UAAA,EAAY,eAAA,uBACd,IAAA,CAAC,oBAAA,EAAA,EAAqB,OAAO,iBAAA,EAC1B,QAAA,EAAA;AAAA,cAAA,UAAA,uBACE,mBAAA,EAAA,EAAoB,SAAA,EAAW,MAAA,CAAO,IAAA,EAAM,IAC3C,eAAA,mBACF,GAAA,CAAC,yBAAA,EAAA,EAA0B,SAAA,EAAW,OAAO,IAAA,EAAM,CAAA,uBAElD,iBAAA,EAAA,EAAkB,SAAA,EAAW,OAAO,IAAA,EAAM,CAAA;AAAA,cAE5C;AAAA,aAAA,EACH;AAAA;AAAA,SAEJ,EACF,CAAA;AAAA,4BACC,cAAA,EAAA,EAAe;AAAA;AAAA;AAAA,GAClB;AAEJ,CAAC;;;;"}
|
|
@@ -12,7 +12,7 @@ import { useObjectRef } from '@react-aria/utils';
|
|
|
12
12
|
import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
|
|
13
13
|
|
|
14
14
|
const CheckboxButton = flowComponent("CheckboxButton", (props) => {
|
|
15
|
-
const { children, className, ref, inputClassName, ...rest } = props;
|
|
15
|
+
const { children, className, ref, inputRef, inputClassName, ...rest } = props;
|
|
16
16
|
const {
|
|
17
17
|
fieldPropsContext,
|
|
18
18
|
fieldProps,
|
|
@@ -29,7 +29,11 @@ const CheckboxButton = flowComponent("CheckboxButton", (props) => {
|
|
|
29
29
|
...fieldPropsContext
|
|
30
30
|
};
|
|
31
31
|
const localCheckboxButtonRef = useObjectRef(ref);
|
|
32
|
-
|
|
32
|
+
const localInputCheckboxRef = useObjectRef(inputRef);
|
|
33
|
+
useMakeFocusable(
|
|
34
|
+
localCheckboxButtonRef,
|
|
35
|
+
() => localInputCheckboxRef.current?.focus()
|
|
36
|
+
);
|
|
33
37
|
return /* @__PURE__ */ jsxs(
|
|
34
38
|
"div",
|
|
35
39
|
{
|
|
@@ -37,7 +41,15 @@ const CheckboxButton = flowComponent("CheckboxButton", (props) => {
|
|
|
37
41
|
className: clsx(fieldProps.className, styles.checkboxButton, className),
|
|
38
42
|
ref: localCheckboxButtonRef,
|
|
39
43
|
children: [
|
|
40
|
-
/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(
|
|
44
|
+
/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(
|
|
45
|
+
Checkbox,
|
|
46
|
+
{
|
|
47
|
+
...rest,
|
|
48
|
+
inputRef: localInputCheckboxRef,
|
|
49
|
+
inputClassName: clsx(inputClassName, styles.input),
|
|
50
|
+
children: /* @__PURE__ */ jsx(PropsContextProvider, { props: mergedPropsContext, children })
|
|
51
|
+
}
|
|
52
|
+
) }),
|
|
41
53
|
/* @__PURE__ */ jsx(FieldErrorView, {})
|
|
42
54
|
]
|
|
43
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxButton.mjs","sources":["../../../../../../src/components/CheckboxButton/CheckboxButton.tsx"],"sourcesContent":["import styles from \"./CheckboxButton.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport type { CheckboxProps } from \"@/components/Checkbox\";\nimport { Checkbox } from \"@/components/Checkbox\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface CheckboxButtonProps
|
|
1
|
+
{"version":3,"file":"CheckboxButton.mjs","sources":["../../../../../../src/components/CheckboxButton/CheckboxButton.tsx"],"sourcesContent":["import styles from \"./CheckboxButton.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport type { CheckboxProps } from \"@/components/Checkbox\";\nimport { Checkbox } from \"@/components/Checkbox\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport type { RefObject } from \"react\";\n\nexport interface CheckboxButtonProps extends CheckboxProps, FlowComponentProps {\n inputRef?: RefObject<HTMLInputElement | null>;\n}\n\n/** @flr-generate all */\nexport const CheckboxButton = flowComponent(\"CheckboxButton\", (props) => {\n const { children, className, ref, inputRef, inputClassName, ...rest } = props;\n\n const {\n fieldPropsContext,\n fieldProps,\n FieldErrorView,\n FieldErrorCaptureContext,\n } = useFieldComponent(props);\n\n const mergedPropsContext: PropsContext = {\n Text: {\n className: styles.label,\n },\n Content: {\n className: styles.content,\n },\n ...fieldPropsContext,\n };\n\n const localCheckboxButtonRef = useObjectRef(ref);\n const localInputCheckboxRef = useObjectRef(inputRef);\n\n useMakeFocusable(localCheckboxButtonRef, () =>\n localInputCheckboxRef.current?.focus(),\n );\n\n return (\n <div\n {...fieldProps}\n className={clsx(fieldProps.className, styles.checkboxButton, className)}\n ref={localCheckboxButtonRef}\n >\n <FieldErrorCaptureContext>\n <Checkbox\n {...rest}\n inputRef={localInputCheckboxRef}\n inputClassName={clsx(inputClassName, styles.input)}\n >\n <PropsContextProvider props={mergedPropsContext}>\n {children}\n </PropsContextProvider>\n </Checkbox>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default CheckboxButton;\n"],"names":[],"mappings":";;;;;;;;;;;AAkBO,MAAM,cAAA,GAAiB,aAAA,CAAc,gBAAA,EAAkB,CAAC,KAAA,KAAU;AACvE,EAAA,MAAM,EAAE,UAAU,SAAA,EAAW,GAAA,EAAK,UAAU,cAAA,EAAgB,GAAG,MAAK,GAAI,KAAA;AAExE,EAAA,MAAM;AAAA,IACJ,iBAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,E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