@ndla/primitives 1.0.130-alpha.0 → 1.0.132-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/panda.buildinfo.json +25 -1
- package/dist/styles.css +100 -4
- package/es/Accordion.mjs +1 -1
- package/es/Accordion.mjs.map +1 -1
- package/es/ArticleLists.mjs +1 -1
- package/es/ArticleLists.mjs.map +1 -1
- package/es/Badge.mjs +1 -1
- package/es/Badge.mjs.map +1 -1
- package/es/BlockQuote.mjs +1 -1
- package/es/BlockQuote.mjs.map +1 -1
- package/es/Button.mjs +1 -1
- package/es/Button.mjs.map +1 -1
- package/es/Card/Card.mjs +1 -1
- package/es/Card/Card.mjs.map +1 -1
- package/es/Checkbox.mjs +2 -1
- package/es/Checkbox.mjs.map +1 -1
- package/es/Combobox.mjs +1 -1
- package/es/Combobox.mjs.map +1 -1
- package/es/DatePicker.mjs +1 -1
- package/es/DatePicker.mjs.map +1 -1
- package/es/Dialog.mjs +1 -1
- package/es/Dialog.mjs.map +1 -1
- package/es/ErrorMessage/ErrorMessage.mjs +1 -1
- package/es/ErrorMessage/ErrorMessage.mjs.map +1 -1
- package/es/ExpandableBox.mjs +1 -1
- package/es/ExpandableBox.mjs.map +1 -1
- package/es/Field.mjs +2 -1
- package/es/Field.mjs.map +1 -1
- package/es/FieldErrorMessage.mjs +2 -1
- package/es/FieldErrorMessage.mjs.map +1 -1
- package/es/FieldHelper.mjs +2 -1
- package/es/FieldHelper.mjs.map +1 -1
- package/es/Figure.mjs +1 -1
- package/es/Figure.mjs.map +1 -1
- package/es/FileUpload.mjs +1 -1
- package/es/FileUpload.mjs.map +1 -1
- package/es/FramedContent.mjs +1 -1
- package/es/FramedContent.mjs.map +1 -1
- package/es/Hero.mjs +1 -1
- package/es/Hero.mjs.map +1 -1
- package/es/Image.mjs +1 -1
- package/es/Image.mjs.map +1 -1
- package/es/Input.mjs +2 -1
- package/es/Input.mjs.map +1 -1
- package/es/Label.mjs +3 -1
- package/es/Label.mjs.map +1 -1
- package/es/Layout/PageContainer.mjs +1 -1
- package/es/Layout/PageContainer.mjs.map +1 -1
- package/es/Layout/PageContent.mjs +1 -1
- package/es/Layout/PageContent.mjs.map +1 -1
- package/es/ListItem/ListItem.mjs +1 -1
- package/es/ListItem/ListItem.mjs.map +1 -1
- package/es/Menu.mjs +1 -1
- package/es/Menu.mjs.map +1 -1
- package/es/MessageBox.mjs +1 -1
- package/es/MessageBox.mjs.map +1 -1
- package/es/Pagination.mjs +1 -1
- package/es/Pagination.mjs.map +1 -1
- package/es/Popover.mjs +1 -1
- package/es/Popover.mjs.map +1 -1
- package/es/RadioGroup.mjs +2 -1
- package/es/RadioGroup.mjs.map +1 -1
- package/es/RainbowSpinner.mjs +66 -0
- package/es/RainbowSpinner.mjs.map +1 -0
- package/es/Select.mjs +1 -1
- package/es/Select.mjs.map +1 -1
- package/es/Skeleton.mjs +1 -1
- package/es/Skeleton.mjs.map +1 -1
- package/es/Slider.mjs +1 -1
- package/es/Slider.mjs.map +1 -1
- package/es/Spinner.mjs +1 -1
- package/es/Spinner.mjs.map +1 -1
- package/es/Switch.mjs +1 -1
- package/es/Switch.mjs.map +1 -1
- package/es/Table.mjs +1 -1
- package/es/Table.mjs.map +1 -1
- package/es/Tabs.mjs +1 -1
- package/es/Tabs.mjs.map +1 -1
- package/es/TagsInput.mjs +1 -1
- package/es/TagsInput.mjs.map +1 -1
- package/es/Text.mjs +1 -1
- package/es/Text.mjs.map +1 -1
- package/es/Toast.mjs +1 -1
- package/es/Toast.mjs.map +1 -1
- package/es/ToggleGroup.mjs +1 -1
- package/es/ToggleGroup.mjs.map +1 -1
- package/es/Tooltip.mjs +1 -1
- package/es/Tooltip.mjs.map +1 -1
- package/es/Tree/Tree.mjs +1 -1
- package/es/Tree/Tree.mjs.map +1 -1
- package/es/index.mjs +3 -2
- package/lib/Accordion.d.ts +1 -1
- package/lib/Accordion.js +7 -7
- package/lib/Accordion.js.map +1 -1
- package/lib/ArticleLists.d.ts +1 -1
- package/lib/ArticleLists.js +2 -2
- package/lib/ArticleLists.js.map +1 -1
- package/lib/Badge.d.ts +1 -1
- package/lib/Badge.js +2 -2
- package/lib/Badge.js.map +1 -1
- package/lib/BlockQuote.d.ts +1 -1
- package/lib/BlockQuote.js +2 -2
- package/lib/BlockQuote.js.map +1 -1
- package/lib/Button.d.ts +1 -1
- package/lib/Button.js +2 -2
- package/lib/Button.js.map +1 -1
- package/lib/Card/Card.d.ts +3 -3
- package/lib/Card/Card.js +3 -3
- package/lib/Card/Card.js.map +1 -1
- package/lib/Checkbox.d.ts +2 -1
- package/lib/Checkbox.js +9 -8
- package/lib/Checkbox.js.map +1 -1
- package/lib/Combobox.d.ts +1 -1
- package/lib/Combobox.js +16 -16
- package/lib/Combobox.js.map +1 -1
- package/lib/DatePicker.d.ts +2 -2
- package/lib/DatePicker.js +26 -26
- package/lib/DatePicker.js.map +1 -1
- package/lib/Dialog.d.ts +2 -2
- package/lib/Dialog.js +12 -12
- package/lib/Dialog.js.map +1 -1
- package/lib/ErrorMessage/ErrorMessage.d.ts +4 -4
- package/lib/ErrorMessage/ErrorMessage.js +4 -4
- package/lib/ErrorMessage/ErrorMessage.js.map +1 -1
- package/lib/ExpandableBox.d.ts +1 -1
- package/lib/ExpandableBox.js +3 -3
- package/lib/ExpandableBox.js.map +1 -1
- package/lib/Field.d.ts +2 -1
- package/lib/Field.js +4 -3
- package/lib/Field.js.map +1 -1
- package/lib/FieldErrorMessage.d.ts +2 -1
- package/lib/FieldErrorMessage.js +4 -3
- package/lib/FieldErrorMessage.js.map +1 -1
- package/lib/FieldHelper.d.ts +2 -1
- package/lib/FieldHelper.js +4 -3
- package/lib/FieldHelper.js.map +1 -1
- package/lib/Figure.d.ts +1 -1
- package/lib/Figure.js +2 -2
- package/lib/Figure.js.map +1 -1
- package/lib/FileUpload.d.ts +1 -1
- package/lib/FileUpload.js +15 -15
- package/lib/FileUpload.js.map +1 -1
- package/lib/FramedContent.d.ts +1 -1
- package/lib/FramedContent.js +2 -2
- package/lib/FramedContent.js.map +1 -1
- package/lib/Hero.d.ts +4 -4
- package/lib/Hero.js +6 -5
- package/lib/Hero.js.map +1 -1
- package/lib/Image.js +2 -2
- package/lib/Image.js.map +1 -1
- package/lib/Input.d.ts +1 -1
- package/lib/Input.js +7 -6
- package/lib/Input.js.map +1 -1
- package/lib/Label.d.ts +2 -1
- package/lib/Label.js +7 -5
- package/lib/Label.js.map +1 -1
- package/lib/Layout/PageContainer.d.ts +1 -1
- package/lib/Layout/PageContainer.js +1 -1
- package/lib/Layout/PageContainer.js.map +1 -1
- package/lib/Layout/PageContent.d.ts +2 -2
- package/lib/Layout/PageContent.js +3 -3
- package/lib/Layout/PageContent.js.map +1 -1
- package/lib/ListItem/ListItem.d.ts +3 -3
- package/lib/ListItem/ListItem.js +3 -3
- package/lib/ListItem/ListItem.js.map +1 -1
- package/lib/Menu.d.ts +1 -1
- package/lib/Menu.js +12 -12
- package/lib/Menu.js.map +1 -1
- package/lib/MessageBox.d.ts +1 -1
- package/lib/MessageBox.js +2 -2
- package/lib/MessageBox.js.map +1 -1
- package/lib/Pagination.d.ts +1 -1
- package/lib/Pagination.js +10 -9
- package/lib/Pagination.js.map +1 -1
- package/lib/Popover.d.ts +2 -2
- package/lib/Popover.js +15 -15
- package/lib/Popover.js.map +1 -1
- package/lib/RadioGroup.d.ts +1 -1
- package/lib/RadioGroup.js +12 -11
- package/lib/RadioGroup.js.map +1 -1
- package/lib/RainbowSpinner.d.ts +26 -0
- package/lib/RainbowSpinner.js +66 -0
- package/lib/RainbowSpinner.js.map +1 -0
- package/lib/Select.d.ts +1 -1
- package/lib/Select.js +18 -18
- package/lib/Select.js.map +1 -1
- package/lib/Skeleton.d.ts +2 -2
- package/lib/Skeleton.js +3 -2
- package/lib/Skeleton.js.map +1 -1
- package/lib/Slider.d.ts +1 -1
- package/lib/Slider.js +9 -9
- package/lib/Slider.js.map +1 -1
- package/lib/Spinner.d.ts +1 -1
- package/lib/Spinner.js +2 -2
- package/lib/Spinner.js.map +1 -1
- package/lib/Switch.d.ts +1 -1
- package/lib/Switch.js +7 -7
- package/lib/Switch.js.map +1 -1
- package/lib/Table.d.ts +2 -2
- package/lib/Table.js +3 -2
- package/lib/Table.js.map +1 -1
- package/lib/Tabs.d.ts +1 -1
- package/lib/Tabs.js +6 -6
- package/lib/Tabs.js.map +1 -1
- package/lib/TagsInput.d.ts +1 -1
- package/lib/TagsInput.js +12 -12
- package/lib/TagsInput.js.map +1 -1
- package/lib/Text.d.ts +1 -1
- package/lib/Text.js +3 -3
- package/lib/Text.js.map +1 -1
- package/lib/Toast.d.ts +1 -1
- package/lib/Toast.js +7 -7
- package/lib/Toast.js.map +1 -1
- package/lib/ToggleGroup.d.ts +1 -1
- package/lib/ToggleGroup.js +6 -5
- package/lib/ToggleGroup.js.map +1 -1
- package/lib/Tooltip.d.ts +1 -1
- package/lib/Tooltip.js +8 -8
- package/lib/Tooltip.js.map +1 -1
- package/lib/Tree/Tree.d.ts +2 -2
- package/lib/Tree/Tree.js +19 -19
- package/lib/Tree/Tree.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -3
- package/package.json +5 -5
package/lib/DatePicker.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_Label = require("./Label.js");
|
|
2
|
-
let _ark_ui_react = require("@ark-ui/react");
|
|
3
2
|
let _ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
4
3
|
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
5
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
5
|
let react = require("react");
|
|
6
|
+
let _ark_ui_react_date_picker = require("@ark-ui/react/date-picker");
|
|
7
7
|
//#region src/DatePicker.tsx
|
|
8
8
|
/**
|
|
9
9
|
* Copyright (c) 2024-present, NDLA.
|
|
@@ -13,7 +13,7 @@ let react = require("react");
|
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
15
|
const { withProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleContext)((0, _ndla_styled_system_css.sva)({
|
|
16
|
-
slots:
|
|
16
|
+
slots: _ark_ui_react_date_picker.datePickerAnatomy.keys(),
|
|
17
17
|
base: {
|
|
18
18
|
root: {
|
|
19
19
|
display: "flex",
|
|
@@ -71,16 +71,16 @@ const { withProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleCon
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}));
|
|
74
|
-
const DatePickerRoot = withProvider(
|
|
75
|
-
const DatePickerClearTrigger = withContext(
|
|
74
|
+
const DatePickerRoot = withProvider(_ark_ui_react_date_picker.DatePicker.Root, "root", { baseComponent: true });
|
|
75
|
+
const DatePickerClearTrigger = withContext(_ark_ui_react_date_picker.DatePicker.ClearTrigger, "clearTrigger", { baseComponent: true });
|
|
76
76
|
const DatePickerContent = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DatePickerPositioner, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DatePickerStandaloneContent, {
|
|
77
77
|
...props,
|
|
78
78
|
ref
|
|
79
79
|
}) }));
|
|
80
|
-
const DatePickerStandaloneContent = withContext(
|
|
81
|
-
const DatePickerControl = withContext(
|
|
82
|
-
const DatePickerInput = withContext(
|
|
83
|
-
const InternalDatePickerLabel = withContext(
|
|
80
|
+
const DatePickerStandaloneContent = withContext(_ark_ui_react_date_picker.DatePicker.Content, "content", { baseComponent: true });
|
|
81
|
+
const DatePickerControl = withContext(_ark_ui_react_date_picker.DatePicker.Control, "control", { baseComponent: true });
|
|
82
|
+
const DatePickerInput = withContext(_ark_ui_react_date_picker.DatePicker.Input, "input", { baseComponent: true });
|
|
83
|
+
const InternalDatePickerLabel = withContext(_ark_ui_react_date_picker.DatePicker.Label, "label");
|
|
84
84
|
const DatePickerLabel = ({ textStyle = "label.medium", fontWeight = "bold", ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalDatePickerLabel, {
|
|
85
85
|
asChild: true,
|
|
86
86
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Label.Label, {
|
|
@@ -89,24 +89,24 @@ const DatePickerLabel = ({ textStyle = "label.medium", fontWeight = "bold", ...p
|
|
|
89
89
|
...props
|
|
90
90
|
})
|
|
91
91
|
});
|
|
92
|
-
const DatePickerMonthSelect = withContext(
|
|
93
|
-
const DatePickerNextTrigger = withContext(
|
|
94
|
-
const DatePickerPositioner = withContext(
|
|
95
|
-
const DatePickerPresetTrigger = withContext(
|
|
96
|
-
const DatePickerPrevTrigger = withContext(
|
|
97
|
-
const DatePickerRangeText = withContext(
|
|
98
|
-
const DatePickerTableBody = withContext(
|
|
99
|
-
const DatePickerTableCell = withContext(
|
|
100
|
-
const DatePickerTableCellTrigger = withContext(
|
|
101
|
-
const DatePickerTableHead = withContext(
|
|
102
|
-
const DatePickerTableHeader = withContext(
|
|
103
|
-
const DatePickerTable = withContext(
|
|
104
|
-
const DatePickerTableRow = withContext(
|
|
105
|
-
const DatePickerTrigger = withContext(
|
|
106
|
-
const DatePickerViewControl = withContext(
|
|
107
|
-
const DatePickerView = withContext(
|
|
108
|
-
const DatePickerViewTrigger = withContext(
|
|
109
|
-
const DatePickerYearSelect = withContext(
|
|
92
|
+
const DatePickerMonthSelect = withContext(_ark_ui_react_date_picker.DatePicker.MonthSelect, "monthSelect", { baseComponent: true });
|
|
93
|
+
const DatePickerNextTrigger = withContext(_ark_ui_react_date_picker.DatePicker.NextTrigger, "nextTrigger", { baseComponent: true });
|
|
94
|
+
const DatePickerPositioner = withContext(_ark_ui_react_date_picker.DatePicker.Positioner, "positioner", { baseComponent: true });
|
|
95
|
+
const DatePickerPresetTrigger = withContext(_ark_ui_react_date_picker.DatePicker.PresetTrigger, "presetTrigger", { baseComponent: true });
|
|
96
|
+
const DatePickerPrevTrigger = withContext(_ark_ui_react_date_picker.DatePicker.PrevTrigger, "prevTrigger", { baseComponent: true });
|
|
97
|
+
const DatePickerRangeText = withContext(_ark_ui_react_date_picker.DatePicker.RangeText, "rangeText", { baseComponent: true });
|
|
98
|
+
const DatePickerTableBody = withContext(_ark_ui_react_date_picker.DatePicker.TableBody, "tableBody", { baseComponent: true });
|
|
99
|
+
const DatePickerTableCell = withContext(_ark_ui_react_date_picker.DatePicker.TableCell, "tableCell", { baseComponent: true });
|
|
100
|
+
const DatePickerTableCellTrigger = withContext(_ark_ui_react_date_picker.DatePicker.TableCellTrigger, "tableCellTrigger", { baseComponent: true });
|
|
101
|
+
const DatePickerTableHead = withContext(_ark_ui_react_date_picker.DatePicker.TableHead, "tableHead", { baseComponent: true });
|
|
102
|
+
const DatePickerTableHeader = withContext(_ark_ui_react_date_picker.DatePicker.TableHeader, "tableHeader", { baseComponent: true });
|
|
103
|
+
const DatePickerTable = withContext(_ark_ui_react_date_picker.DatePicker.Table, "table", { baseComponent: true });
|
|
104
|
+
const DatePickerTableRow = withContext(_ark_ui_react_date_picker.DatePicker.TableRow, "tableRow", { baseComponent: true });
|
|
105
|
+
const DatePickerTrigger = withContext(_ark_ui_react_date_picker.DatePicker.Trigger, "trigger", { baseComponent: true });
|
|
106
|
+
const DatePickerViewControl = withContext(_ark_ui_react_date_picker.DatePicker.ViewControl, "viewControl", { baseComponent: true });
|
|
107
|
+
const DatePickerView = withContext(_ark_ui_react_date_picker.DatePicker.View, "view", { baseComponent: true });
|
|
108
|
+
const DatePickerViewTrigger = withContext(_ark_ui_react_date_picker.DatePicker.ViewTrigger, "viewTrigger", { baseComponent: true });
|
|
109
|
+
const DatePickerYearSelect = withContext(_ark_ui_react_date_picker.DatePicker.YearSelect, "yearSelect", { baseComponent: true });
|
|
110
110
|
//#endregion
|
|
111
111
|
exports.DatePickerClearTrigger = DatePickerClearTrigger;
|
|
112
112
|
exports.DatePickerContent = DatePickerContent;
|
package/lib/DatePicker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.js","names":["datePickerAnatomy","DatePicker","Label"],"sources":["../src/DatePicker.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { DatePicker, datePickerAnatomy } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext, type StyledProps } from \"@ndla/styled-system/jsx\";\nimport { forwardRef, type RefAttributes } from \"react\";\nimport { Label } from \"./Label\";\nimport type { TextProps } from \"./Text\";\n\nconst datePickerRecipe = sva({\n slots: datePickerAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n content: {\n background: \"surface.default\",\n borderRadius: \"xsmall\",\n boxShadow: \"large\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n padding: \"xsmall\",\n zIndex: \"dropdown\",\n _open: {\n animation: \"fade-shift-in 0.25s ease-in-out\",\n },\n _closed: {\n animation: \"fade-shift-out 0.25s ease-in-out\",\n },\n },\n control: {\n display: \"flex\",\n width: \"fit-content\",\n gap: \"xsmall\",\n },\n label: {},\n tableHeader: {},\n viewControl: {\n display: \"flex\",\n gap: \"5xsmall\",\n justifyContent: \"space-between\",\n },\n table: {\n width: \"100%\",\n borderCollapse: \"separate\",\n borderSpacing: \"5xsmall\",\n margin: \"-5xsmall\",\n },\n tableCell: {\n textAlign: \"center\",\n },\n tableCellTrigger: {\n width: \"100%\",\n \"&[data-today]\": {\n _before: {\n content: \"'-'\",\n color: \"stroke.default\",\n position: \"absolute\",\n marginBlockStart: \"medium\",\n },\n },\n \"&[data-outside-range]\": {\n color: \"text.subtle\",\n fontWeight: \"normal\",\n },\n },\n view: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n },\n});\nconst { withProvider, withContext } = createStyleContext(datePickerRecipe);\n\nexport interface DatePickerRootProps extends DatePicker.RootProps, StyledProps {\n translations: DatePicker.RootProps[\"translations\"];\n locale: DatePicker.RootProps[\"locale\"];\n}\n\nexport const DatePickerRoot = withProvider(DatePicker.Root, \"root\", { baseComponent: true });\n\nexport const DatePickerClearTrigger = withContext(DatePicker.ClearTrigger, \"clearTrigger\", {\n baseComponent: true,\n});\n\ninterface DatePickerContentProps extends DatePicker.ContentProps, StyledProps {}\n\nexport const DatePickerContent = forwardRef<HTMLDivElement, DatePickerContentProps>((props, ref) => (\n <DatePickerPositioner>\n <DatePickerStandaloneContent {...props} ref={ref} />\n </DatePickerPositioner>\n));\n\nexport const DatePickerStandaloneContent = withContext(DatePicker.Content, \"content\", { baseComponent: true });\n\nexport const DatePickerControl = withContext(DatePicker.Control, \"control\", { baseComponent: true });\n\nexport const DatePickerInput = withContext(DatePicker.Input, \"input\", { baseComponent: true });\n\ninterface DatePickerLabelProps\n extends Omit<DatePicker.LabelProps, \"color\">, StyledProps, TextProps, RefAttributes<HTMLLabelElement> {}\n\nconst InternalDatePickerLabel = withContext(DatePicker.Label, \"label\");\n\nexport const DatePickerLabel = ({\n textStyle = \"label.medium\",\n fontWeight = \"bold\",\n ...props\n}: DatePickerLabelProps) => (\n <InternalDatePickerLabel asChild>\n <Label textStyle={textStyle} fontWeight={fontWeight} {...props} />\n </InternalDatePickerLabel>\n);\n\nexport const DatePickerMonthSelect = withContext(DatePicker.MonthSelect, \"monthSelect\", { baseComponent: true });\n\ninterface DatePickerNextTrigger extends DatePicker.NextTriggerProps, StyledProps {}\n\nexport const DatePickerNextTrigger = withContext(DatePicker.NextTrigger, \"nextTrigger\", { baseComponent: true });\n\nexport const DatePickerPositioner = withContext(DatePicker.Positioner, \"positioner\", { baseComponent: true });\n\nexport const DatePickerPresetTrigger = withContext(DatePicker.PresetTrigger, \"presetTrigger\", { baseComponent: true });\n\nexport const DatePickerPrevTrigger = withContext(DatePicker.PrevTrigger, \"prevTrigger\", { baseComponent: true });\n\nexport const DatePickerRangeText = withContext(DatePicker.RangeText, \"rangeText\", { baseComponent: true });\n\nexport const DatePickerTableBody = withContext(DatePicker.TableBody, \"tableBody\", { baseComponent: true });\n\nexport const DatePickerTableCell = withContext(DatePicker.TableCell, \"tableCell\", { baseComponent: true });\n\nexport const DatePickerTableCellTrigger = withContext(DatePicker.TableCellTrigger, \"tableCellTrigger\", {\n baseComponent: true,\n});\n\nexport const DatePickerTableHead = withContext(DatePicker.TableHead, \"tableHead\", { baseComponent: true });\n\nexport const DatePickerTableHeader = withContext(DatePicker.TableHeader, \"tableHeader\", { baseComponent: true });\n\nexport const DatePickerTable = withContext(DatePicker.Table, \"table\", { baseComponent: true });\n\nexport const DatePickerTableRow = withContext(DatePicker.TableRow, \"tableRow\", { baseComponent: true });\n\nexport const DatePickerTrigger = withContext(DatePicker.Trigger, \"trigger\", { baseComponent: true });\n\nexport const DatePickerViewControl = withContext(DatePicker.ViewControl, \"viewControl\", { baseComponent: true });\n\nexport const DatePickerView = withContext(DatePicker.View, \"view\", { baseComponent: true });\n\nexport const DatePickerViewTrigger = withContext(DatePicker.ViewTrigger, \"viewTrigger\", { baseComponent: true });\n\nexport const DatePickerYearSelect = withContext(DatePicker.YearSelect, \"yearSelect\", { baseComponent: true });\n\nexport { DatePickerContext } from \"@ark-ui/react\";\n"],"mappings":";;;;;;;;;;;;;;AAkFA,MAAM,EAAE,cAAc,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KAnEO;CAC3B,OAAOA,
|
|
1
|
+
{"version":3,"file":"DatePicker.js","names":["datePickerAnatomy","DatePicker","Label"],"sources":["../src/DatePicker.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { DatePicker, datePickerAnatomy } from \"@ark-ui/react/date-picker\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext, type StyledProps } from \"@ndla/styled-system/jsx\";\nimport { forwardRef, type RefAttributes } from \"react\";\nimport { Label } from \"./Label\";\nimport type { TextProps } from \"./Text\";\n\nconst datePickerRecipe = sva({\n slots: datePickerAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n content: {\n background: \"surface.default\",\n borderRadius: \"xsmall\",\n boxShadow: \"large\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n padding: \"xsmall\",\n zIndex: \"dropdown\",\n _open: {\n animation: \"fade-shift-in 0.25s ease-in-out\",\n },\n _closed: {\n animation: \"fade-shift-out 0.25s ease-in-out\",\n },\n },\n control: {\n display: \"flex\",\n width: \"fit-content\",\n gap: \"xsmall\",\n },\n label: {},\n tableHeader: {},\n viewControl: {\n display: \"flex\",\n gap: \"5xsmall\",\n justifyContent: \"space-between\",\n },\n table: {\n width: \"100%\",\n borderCollapse: \"separate\",\n borderSpacing: \"5xsmall\",\n margin: \"-5xsmall\",\n },\n tableCell: {\n textAlign: \"center\",\n },\n tableCellTrigger: {\n width: \"100%\",\n \"&[data-today]\": {\n _before: {\n content: \"'-'\",\n color: \"stroke.default\",\n position: \"absolute\",\n marginBlockStart: \"medium\",\n },\n },\n \"&[data-outside-range]\": {\n color: \"text.subtle\",\n fontWeight: \"normal\",\n },\n },\n view: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n },\n});\nconst { withProvider, withContext } = createStyleContext(datePickerRecipe);\n\nexport interface DatePickerRootProps extends DatePicker.RootProps, StyledProps {\n translations: DatePicker.RootProps[\"translations\"];\n locale: DatePicker.RootProps[\"locale\"];\n}\n\nexport const DatePickerRoot = withProvider(DatePicker.Root, \"root\", { baseComponent: true });\n\nexport const DatePickerClearTrigger = withContext(DatePicker.ClearTrigger, \"clearTrigger\", {\n baseComponent: true,\n});\n\ninterface DatePickerContentProps extends DatePicker.ContentProps, StyledProps {}\n\nexport const DatePickerContent = forwardRef<HTMLDivElement, DatePickerContentProps>((props, ref) => (\n <DatePickerPositioner>\n <DatePickerStandaloneContent {...props} ref={ref} />\n </DatePickerPositioner>\n));\n\nexport const DatePickerStandaloneContent = withContext(DatePicker.Content, \"content\", { baseComponent: true });\n\nexport const DatePickerControl = withContext(DatePicker.Control, \"control\", { baseComponent: true });\n\nexport const DatePickerInput = withContext(DatePicker.Input, \"input\", { baseComponent: true });\n\ninterface DatePickerLabelProps\n extends Omit<DatePicker.LabelProps, \"color\">, StyledProps, TextProps, RefAttributes<HTMLLabelElement> {}\n\nconst InternalDatePickerLabel = withContext(DatePicker.Label, \"label\");\n\nexport const DatePickerLabel = ({\n textStyle = \"label.medium\",\n fontWeight = \"bold\",\n ...props\n}: DatePickerLabelProps) => (\n <InternalDatePickerLabel asChild>\n <Label textStyle={textStyle} fontWeight={fontWeight} {...props} />\n </InternalDatePickerLabel>\n);\n\nexport const DatePickerMonthSelect = withContext(DatePicker.MonthSelect, \"monthSelect\", { baseComponent: true });\n\ninterface DatePickerNextTrigger extends DatePicker.NextTriggerProps, StyledProps {}\n\nexport const DatePickerNextTrigger = withContext(DatePicker.NextTrigger, \"nextTrigger\", { baseComponent: true });\n\nexport const DatePickerPositioner = withContext(DatePicker.Positioner, \"positioner\", { baseComponent: true });\n\nexport const DatePickerPresetTrigger = withContext(DatePicker.PresetTrigger, \"presetTrigger\", { baseComponent: true });\n\nexport const DatePickerPrevTrigger = withContext(DatePicker.PrevTrigger, \"prevTrigger\", { baseComponent: true });\n\nexport const DatePickerRangeText = withContext(DatePicker.RangeText, \"rangeText\", { baseComponent: true });\n\nexport const DatePickerTableBody = withContext(DatePicker.TableBody, \"tableBody\", { baseComponent: true });\n\nexport const DatePickerTableCell = withContext(DatePicker.TableCell, \"tableCell\", { baseComponent: true });\n\nexport const DatePickerTableCellTrigger = withContext(DatePicker.TableCellTrigger, \"tableCellTrigger\", {\n baseComponent: true,\n});\n\nexport const DatePickerTableHead = withContext(DatePicker.TableHead, \"tableHead\", { baseComponent: true });\n\nexport const DatePickerTableHeader = withContext(DatePicker.TableHeader, \"tableHeader\", { baseComponent: true });\n\nexport const DatePickerTable = withContext(DatePicker.Table, \"table\", { baseComponent: true });\n\nexport const DatePickerTableRow = withContext(DatePicker.TableRow, \"tableRow\", { baseComponent: true });\n\nexport const DatePickerTrigger = withContext(DatePicker.Trigger, \"trigger\", { baseComponent: true });\n\nexport const DatePickerViewControl = withContext(DatePicker.ViewControl, \"viewControl\", { baseComponent: true });\n\nexport const DatePickerView = withContext(DatePicker.View, \"view\", { baseComponent: true });\n\nexport const DatePickerViewTrigger = withContext(DatePicker.ViewTrigger, \"viewTrigger\", { baseComponent: true });\n\nexport const DatePickerYearSelect = withContext(DatePicker.YearSelect, \"yearSelect\", { baseComponent: true });\n\nexport { DatePickerContext } from \"@ark-ui/react/date-picker\";\n"],"mappings":";;;;;;;;;;;;;;AAkFA,MAAM,EAAE,cAAc,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KAnEO;CAC3B,OAAOA,0BAAAA,kBAAkB,KAAK;CAC9B,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;EACP;EACA,SAAS;GACP,YAAY;GACZ,cAAc;GACd,WAAW;GACX,SAAS;GACT,eAAe;GACf,KAAK;GACL,SAAS;GACT,QAAQ;GACR,OAAO,EACL,WAAW,kCACb;GACA,SAAS,EACP,WAAW,mCACb;EACF;EACA,SAAS;GACP,SAAS;GACT,OAAO;GACP,KAAK;EACP;EACA,OAAO,CAAC;EACR,aAAa,CAAC;EACd,aAAa;GACX,SAAS;GACT,KAAK;GACL,gBAAgB;EAClB;EACA,OAAO;GACL,OAAO;GACP,gBAAgB;GAChB,eAAe;GACf,QAAQ;EACV;EACA,WAAW,EACT,WAAW,SACb;EACA,kBAAkB;GAChB,OAAO;GACP,iBAAiB,EACf,SAAS;IACP,SAAS;IACT,OAAO;IACP,UAAU;IACV,kBAAkB;GACpB,EACF;GACA,yBAAyB;IACvB,OAAO;IACP,YAAY;GACd;EACF;EACA,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;EACP;CACF;AACF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from "@ark-ui/react/dialog";
|
|
9
9
|
import { type RecipeVariantProps } from "@ndla/styled-system/css";
|
|
10
10
|
import type { StyledProps } from "@ndla/styled-system/types";
|
|
11
11
|
import { type RefAttributes } from "react";
|
|
@@ -334,5 +334,5 @@ export declare const DialogRootProvider: import("@ndla/styled-system/jsx").Style
|
|
|
334
334
|
};
|
|
335
335
|
};
|
|
336
336
|
}>>;
|
|
337
|
-
export declare const useDialog: (props?: import("@ark-ui/react").UseDialogProps) => import("@ark-ui/react").UseDialogReturn;
|
|
337
|
+
export declare const useDialog: (props?: import("@ark-ui/react/dialog").UseDialogProps) => import("@ark-ui/react/dialog").UseDialogReturn;
|
|
338
338
|
export {};
|
package/lib/Dialog.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_Text = require("./Text.js");
|
|
2
|
-
let _ark_ui_react = require("@ark-ui/react");
|
|
3
2
|
let _ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
4
3
|
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
5
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
5
|
let react = require("react");
|
|
6
|
+
let _ark_ui_react_dialog = require("@ark-ui/react/dialog");
|
|
7
7
|
//#region src/Dialog.tsx
|
|
8
8
|
/**
|
|
9
9
|
* Copyright (c) 2024-present, NDLA.
|
|
@@ -13,7 +13,7 @@ let react = require("react");
|
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
15
|
const { withRootProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleContext)((0, _ndla_styled_system_css.sva)({
|
|
16
|
-
slots:
|
|
16
|
+
slots: _ark_ui_react_dialog.dialogAnatomy.keys(),
|
|
17
17
|
base: {
|
|
18
18
|
backdrop: {
|
|
19
19
|
position: "fixed",
|
|
@@ -215,20 +215,20 @@ const { withRootProvider, withContext } = (0, _ndla_styled_system_jsx.createStyl
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
}));
|
|
218
|
-
const InternalDialogRoot = withRootProvider(
|
|
218
|
+
const InternalDialogRoot = withRootProvider(_ark_ui_react_dialog.Dialog.Root);
|
|
219
219
|
const DialogRoot = ({ lazyMount = true, unmountOnExit = true, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalDialogRoot, {
|
|
220
220
|
lazyMount,
|
|
221
221
|
unmountOnExit,
|
|
222
222
|
...props
|
|
223
223
|
});
|
|
224
|
-
const DialogBackdrop = withContext(
|
|
225
|
-
const DialogStandaloneContent = withContext(
|
|
226
|
-
const DialogPositioner = withContext(
|
|
224
|
+
const DialogBackdrop = withContext(_ark_ui_react_dialog.Dialog.Backdrop, "backdrop", { baseComponent: true });
|
|
225
|
+
const DialogStandaloneContent = withContext(_ark_ui_react_dialog.Dialog.Content, "content", { baseComponent: true });
|
|
226
|
+
const DialogPositioner = withContext(_ark_ui_react_dialog.Dialog.Positioner, "positioner", { baseComponent: true });
|
|
227
227
|
const DialogContent = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogBackdrop, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogPositioner, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogStandaloneContent, {
|
|
228
228
|
ref,
|
|
229
229
|
...props
|
|
230
230
|
}) })] }));
|
|
231
|
-
const InternalDialogDescription = withContext(
|
|
231
|
+
const InternalDialogDescription = withContext(_ark_ui_react_dialog.Dialog.Description, "description");
|
|
232
232
|
const DialogDescription = ({ textStyle = "body.large", children, ...rest }) => {
|
|
233
233
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalDialogDescription, {
|
|
234
234
|
asChild: true,
|
|
@@ -239,7 +239,7 @@ const DialogDescription = ({ textStyle = "body.large", children, ...rest }) => {
|
|
|
239
239
|
})
|
|
240
240
|
});
|
|
241
241
|
};
|
|
242
|
-
const InternalDialogTitle = withContext(
|
|
242
|
+
const InternalDialogTitle = withContext(_ark_ui_react_dialog.Dialog.Title, "title");
|
|
243
243
|
const DialogTitle = ({ textStyle = "title.medium", children, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalDialogTitle, {
|
|
244
244
|
asChild: true,
|
|
245
245
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Heading, {
|
|
@@ -248,8 +248,8 @@ const DialogTitle = ({ textStyle = "title.medium", children, ...rest }) => /* @_
|
|
|
248
248
|
children
|
|
249
249
|
})
|
|
250
250
|
});
|
|
251
|
-
const DialogTrigger = withContext(
|
|
252
|
-
const DialogCloseTrigger = withContext(
|
|
251
|
+
const DialogTrigger = withContext(_ark_ui_react_dialog.Dialog.Trigger, "trigger", { baseComponent: true });
|
|
252
|
+
const DialogCloseTrigger = withContext(_ark_ui_react_dialog.Dialog.CloseTrigger, "closeTrigger", { baseComponent: true });
|
|
253
253
|
const DialogHeader = (0, _ndla_styled_system_jsx.styled)("div", { base: {
|
|
254
254
|
display: "flex",
|
|
255
255
|
paddingInline: "medium",
|
|
@@ -275,8 +275,8 @@ const DialogFooter = (0, _ndla_styled_system_jsx.styled)("div", { base: {
|
|
|
275
275
|
paddingBlockStart: "small",
|
|
276
276
|
paddingBlockEnd: "medium"
|
|
277
277
|
} });
|
|
278
|
-
const DialogRootProvider = withRootProvider(
|
|
279
|
-
const useDialog =
|
|
278
|
+
const DialogRootProvider = withRootProvider(_ark_ui_react_dialog.Dialog.RootProvider);
|
|
279
|
+
const useDialog = _ark_ui_react_dialog.useDialog;
|
|
280
280
|
//#endregion
|
|
281
281
|
exports.DialogBackdrop = DialogBackdrop;
|
|
282
282
|
exports.DialogBody = DialogBody;
|
package/lib/Dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","names":["dialogAnatomy","Dialog","Text","Heading","_useDialog"],"sources":["../src/Dialog.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Dialog, dialogAnatomy, useDialog as _useDialog } from \"@ark-ui/react\";\nimport { type RecipeVariantProps, sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext, styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef, type RefAttributes } from \"react\";\nimport { Heading, Text, type TextProps } from \"./Text\";\n\nconst dialogRecipe = sva({\n slots: dialogAnatomy.keys(),\n base: {\n backdrop: {\n position: \"fixed\",\n height: \"100vh\",\n width: \"100vw\",\n left: \"0\",\n top: \"0\",\n // TODO: Consider if this should be a token. It's probably consistent enough between dark and light mode to be a token.\n background: \"rgba(1, 1, 1, 0.3)\",\n _open: {\n animation: \"backdrop-in\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"backdrop-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n positioner: {\n position: \"fixed\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n left: \"0\",\n top: \"0\",\n width: \"100vw\",\n height: \"100dvh\",\n },\n content: {\n \"--margin\": \"token(sizes.medium)\",\n position: \"relative\",\n background: \"surface.default\",\n boxShadow: \"xlarge\",\n height: \"min-content\",\n maxWidth: \"95%\",\n maxHeight: \"95%\",\n margin: \"auto\",\n overflowY: \"auto\",\n borderRadius: { base: \"sharp\", tablet: \"small\" },\n paddingBlockStart: \"env(safe-area-inset-top)\",\n paddingBlockEnd: \"env(safe-area-inset-bottom)\",\n paddingInlineStart: \"env(safe-area-inset-left)\",\n paddingInlineEnd: \"env(safe-area-inset-right)\",\n tabletDown: {\n \"--margin\": \"0px\",\n minWidth: \"100%\",\n minHeight: \"100%\",\n },\n },\n },\n defaultVariants: {\n size: \"medium\",\n position: \"center\",\n variant: \"dialog\",\n context: \"dialog\",\n },\n compoundVariants: [\n {\n variant: \"drawer\",\n position: \"left\",\n css: {\n content: {\n minHeight: \"100%\",\n maxHeight: \"100%\",\n width: \"var(--size)\",\n _open: {\n animation: \"drawer-in-left\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"drawer-out-left\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n },\n {\n variant: \"drawer\",\n position: \"right\",\n css: {\n content: {\n minHeight: \"100%\",\n maxHeight: \"100%\",\n width: \"var(--size)\",\n _open: {\n animation: \"drawer-in-right\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"drawer-out-right\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n },\n {\n variant: \"drawer\",\n position: \"top\",\n css: {\n content: {\n minWidth: \"100%\",\n maxWidth: \"100%\",\n height: \"var(--size)\",\n _open: {\n animation: \"drawer-in-top\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"drawer-out-top\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n },\n {\n variant: \"drawer\",\n position: \"bottom\",\n css: {\n content: {\n minWidth: \"100%\",\n maxWidth: \"100%\",\n height: \"var(--size)\",\n _open: {\n animation: \"drawer-in-bottom\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"drawer-out-bottom\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n },\n {\n variant: \"drawer\",\n size: \"xsmall\",\n css: {\n content: {\n \"--size\": \"sizes.surface.3xsmall\",\n },\n },\n },\n {\n variant: \"drawer\",\n size: \"small\",\n css: {\n content: {\n \"--size\": \"sizes.surface.xsmall\",\n },\n },\n },\n {\n variant: \"drawer\",\n size: \"medium\",\n css: {\n content: {\n \"--size\": \"sizes.surface.medium\",\n },\n },\n },\n {\n variant: \"drawer\",\n size: \"large\",\n css: {\n content: {\n \"--size\": \"sizes.surface.xlarge\",\n },\n },\n },\n ],\n variants: {\n context: {\n dialog: {\n positioner: {\n zIndex: \"modal\",\n },\n backdrop: {\n zIndex: \"overlay\",\n },\n },\n alert: {\n positioner: {\n zIndex: \"alertModal\",\n },\n backdrop: {\n zIndex: \"alertModalOverlay\",\n },\n },\n },\n variant: {\n drawer: {\n content: {\n \"--margin\": \"0px\",\n borderRadius: { base: \"sharp\", tablet: \"sharp\" },\n },\n },\n dialog: {\n content: {\n width: \"var(--size)\",\n _open: {\n animation: \"dialog-in\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"dialog-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n },\n position: {\n left: {\n content: {\n marginInlineStart: \"var(--margin)\",\n },\n },\n center: {},\n right: {\n content: {\n marginInlineEnd: \"var(--margin)\",\n },\n },\n bottom: {\n content: {\n marginBlockEnd: \"var(--margin)\",\n },\n },\n top: {\n content: {\n marginBlockStart: \"var(--margin)\",\n },\n },\n },\n size: {\n full: {\n content: {\n \"--margin\": \"0px\",\n minHeight: \"100%\",\n minWidth: \"100%\",\n borderRadius: \"sharp\",\n },\n },\n xsmall: {\n content: {\n \"--size\": \"sizes.surface.xsmall\",\n },\n },\n small: {\n content: {\n \"--size\": \"sizes.surface.medium\",\n },\n },\n medium: {\n content: {\n \"--size\": \"sizes.surface.xlarge\",\n },\n },\n large: {\n content: {\n \"--size\": \"sizes.surface.4xlarge\",\n },\n },\n },\n },\n});\n\nconst { withRootProvider, withContext } = createStyleContext(dialogRecipe);\n\nexport type DialogVariantProps = NonNullable<RecipeVariantProps<typeof dialogRecipe>>;\n\nexport interface DialogRootProps extends Dialog.RootProps, DialogVariantProps {}\n\nexport const InternalDialogRoot = withRootProvider(Dialog.Root);\n\nexport const DialogRoot = ({ lazyMount = true, unmountOnExit = true, ...props }: DialogRootProps) => (\n <InternalDialogRoot lazyMount={lazyMount} unmountOnExit={unmountOnExit} {...props} />\n);\n\nexport const DialogBackdrop = withContext(Dialog.Backdrop, \"backdrop\", { baseComponent: true });\n\nexport const DialogStandaloneContent = withContext(Dialog.Content, \"content\", { baseComponent: true });\n\nexport const DialogPositioner = withContext(Dialog.Positioner, \"positioner\", { baseComponent: true });\n\ninterface DialogContentProps extends Dialog.ContentProps, StyledProps {}\n\nexport const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>((props, ref) => (\n <>\n <DialogBackdrop />\n <DialogPositioner>\n <DialogStandaloneContent ref={ref} {...props} />\n </DialogPositioner>\n </>\n));\n\nconst InternalDialogDescription = withContext(Dialog.Description, \"description\");\n\ninterface DialogDescriptionProps\n extends Omit<Dialog.DescriptionProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLParagraphElement> {}\n\nexport const DialogDescription = ({ textStyle = \"body.large\", children, ...rest }: DialogDescriptionProps) => {\n return (\n <InternalDialogDescription asChild>\n <Text textStyle={textStyle} {...rest}>\n {children}\n </Text>\n </InternalDialogDescription>\n );\n};\n\nconst InternalDialogTitle = withContext(Dialog.Title, \"title\");\n\ninterface DialogTitleProps\n extends Omit<Dialog.TitleProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLHeadingElement> {}\n\nexport const DialogTitle = ({ textStyle = \"title.medium\", children, ...rest }: DialogTitleProps) => (\n <InternalDialogTitle asChild>\n <Heading textStyle={textStyle} {...rest}>\n {children}\n </Heading>\n </InternalDialogTitle>\n);\n\nexport const DialogTrigger = withContext(Dialog.Trigger, \"trigger\", { baseComponent: true });\n\nexport const DialogCloseTrigger = withContext(Dialog.CloseTrigger, \"closeTrigger\", { baseComponent: true });\n\nexport const DialogHeader = styled(\"div\", {\n base: {\n display: \"flex\",\n paddingInline: \"medium\",\n paddingBlockStart: \"medium\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n gap: \"xsmall\",\n },\n});\n\nexport const DialogBody = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n paddingInline: \"medium\",\n paddingBlockStart: \"small\",\n paddingBlockEnd: \"medium\",\n },\n});\n\nexport const DialogFooter = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"3xsmall\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n paddingInline: \"medium\",\n paddingBlockStart: \"small\",\n paddingBlockEnd: \"medium\",\n },\n});\n\nexport const DialogRootProvider = withRootProvider(Dialog.RootProvider);\n\nexport const useDialog = _useDialog;\n"],"mappings":";;;;;;;;;;;;;;AAoTA,MAAM,EAAE,kBAAkB,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KArSD;CACvB,OAAOA,cAAAA,cAAc,KAAK;CAC1B,MAAM;EACJ,UAAU;GACR,UAAU;GACV,QAAQ;GACR,OAAO;GACP,MAAM;GACN,KAAK;GAEL,YAAY;GACZ,OAAO;IACL,WAAW;IACX,eAAe,EACb,WAAW,OACb;GACF;GACA,SAAS;IACP,WAAW;IACX,eAAe,EACb,WAAW,OACb;GACF;EACF;EACA,YAAY;GACV,UAAU;GACV,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,UAAU;GACV,MAAM;GACN,KAAK;GACL,OAAO;GACP,QAAQ;EACV;EACA,SAAS;GACP,YAAY;GACZ,UAAU;GACV,YAAY;GACZ,WAAW;GACX,QAAQ;GACR,UAAU;GACV,WAAW;GACX,QAAQ;GACR,WAAW;GACX,cAAc;IAAE,MAAM;IAAS,QAAQ;GAAQ;GAC/C,mBAAmB;GACnB,iBAAiB;GACjB,oBAAoB;GACpB,kBAAkB;GAClB,YAAY;IACV,YAAY;IACZ,UAAU;IACV,WAAW;GACb;EACF;CACF;CACA,iBAAiB;EACf,MAAM;EACN,UAAU;EACV,SAAS;EACT,SAAS;CACX;CACA,kBAAkB;EAChB;GACE,SAAS;GACT,UAAU;GACV,KAAK,EACH,SAAS;IACP,WAAW;IACX,WAAW;IACX,OAAO;IACP,OAAO;KACL,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;IACA,SAAS;KACP,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;GACF,EACF;EACF;EACA;GACE,SAAS;GACT,UAAU;GACV,KAAK,EACH,SAAS;IACP,WAAW;IACX,WAAW;IACX,OAAO;IACP,OAAO;KACL,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;IACA,SAAS;KACP,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;GACF,EACF;EACF;EACA;GACE,SAAS;GACT,UAAU;GACV,KAAK,EACH,SAAS;IACP,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;KACL,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;IACA,SAAS;KACP,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;GACF,EACF;EACF;EACA;GACE,SAAS;GACT,UAAU;GACV,KAAK,EACH,SAAS;IACP,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;KACL,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;IACA,SAAS;KACP,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;GACF,EACF;EACF;EACA;GACE,SAAS;GACT,MAAM;GACN,KAAK,EACH,SAAS,EACP,UAAU,wBACZ,EACF;EACF;EACA;GACE,SAAS;GACT,MAAM;GACN,KAAK,EACH,SAAS,EACP,UAAU,uBACZ,EACF;EACF;EACA;GACE,SAAS;GACT,MAAM;GACN,KAAK,EACH,SAAS,EACP,UAAU,uBACZ,EACF;EACF;EACA;GACE,SAAS;GACT,MAAM;GACN,KAAK,EACH,SAAS,EACP,UAAU,uBACZ,EACF;EACF;CACF;CACA,UAAU;EACR,SAAS;GACP,QAAQ;IACN,YAAY,EACV,QAAQ,QACV;IACA,UAAU,EACR,QAAQ,UACV;GACF;GACA,OAAO;IACL,YAAY,EACV,QAAQ,aACV;IACA,UAAU,EACR,QAAQ,oBACV;GACF;EACF;EACA,SAAS;GACP,QAAQ,EACN,SAAS;IACP,YAAY;IACZ,cAAc;KAAE,MAAM;KAAS,QAAQ;IAAQ;GACjD,EACF;GACA,QAAQ,EACN,SAAS;IACP,OAAO;IACP,OAAO;KACL,WAAW;KACX,eAAe,EACb,WAAW,OACb;IAC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Aa,qBAAqB,iBAAiBA,cAAAA,OAAO,YAAY;AAEtE,MAAa,YAAYG,cAAAA"}
|
|
1
|
+
{"version":3,"file":"Dialog.js","names":["dialogAnatomy","Dialog","Text","Heading","_useDialog"],"sources":["../src/Dialog.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Dialog, dialogAnatomy, useDialog as _useDialog } from \"@ark-ui/react/dialog\";\nimport { type RecipeVariantProps, sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext, styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef, type RefAttributes } from \"react\";\nimport { Heading, Text, type TextProps } from \"./Text\";\n\nconst dialogRecipe = sva({\n slots: dialogAnatomy.keys(),\n base: {\n backdrop: {\n position: \"fixed\",\n height: \"100vh\",\n width: \"100vw\",\n left: \"0\",\n top: \"0\",\n // TODO: Consider if this should be a token. It's probably consistent enough between dark and light mode to be a token.\n background: \"rgba(1, 1, 1, 0.3)\",\n _open: {\n animation: \"backdrop-in\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"backdrop-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n positioner: {\n position: \"fixed\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n left: \"0\",\n top: \"0\",\n width: \"100vw\",\n height: \"100dvh\",\n },\n content: {\n \"--margin\": \"token(sizes.medium)\",\n position: \"relative\",\n background: \"surface.default\",\n boxShadow: \"xlarge\",\n height: \"min-content\",\n maxWidth: \"95%\",\n maxHeight: \"95%\",\n margin: \"auto\",\n overflowY: \"auto\",\n borderRadius: { base: \"sharp\", tablet: \"small\" },\n paddingBlockStart: \"env(safe-area-inset-top)\",\n paddingBlockEnd: \"env(safe-area-inset-bottom)\",\n paddingInlineStart: \"env(safe-area-inset-left)\",\n paddingInlineEnd: \"env(safe-area-inset-right)\",\n tabletDown: {\n \"--margin\": \"0px\",\n minWidth: \"100%\",\n minHeight: \"100%\",\n },\n },\n },\n defaultVariants: {\n size: \"medium\",\n position: \"center\",\n variant: \"dialog\",\n context: \"dialog\",\n },\n compoundVariants: [\n {\n variant: \"drawer\",\n position: \"left\",\n css: {\n content: {\n minHeight: \"100%\",\n maxHeight: \"100%\",\n width: \"var(--size)\",\n _open: {\n animation: \"drawer-in-left\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"drawer-out-left\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n },\n {\n variant: \"drawer\",\n position: \"right\",\n css: {\n content: {\n minHeight: \"100%\",\n maxHeight: \"100%\",\n width: \"var(--size)\",\n _open: {\n animation: \"drawer-in-right\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"drawer-out-right\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n },\n {\n variant: \"drawer\",\n position: \"top\",\n css: {\n content: {\n minWidth: \"100%\",\n maxWidth: \"100%\",\n height: \"var(--size)\",\n _open: {\n animation: \"drawer-in-top\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"drawer-out-top\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n },\n {\n variant: \"drawer\",\n position: \"bottom\",\n css: {\n content: {\n minWidth: \"100%\",\n maxWidth: \"100%\",\n height: \"var(--size)\",\n _open: {\n animation: \"drawer-in-bottom\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"drawer-out-bottom\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n },\n {\n variant: \"drawer\",\n size: \"xsmall\",\n css: {\n content: {\n \"--size\": \"sizes.surface.3xsmall\",\n },\n },\n },\n {\n variant: \"drawer\",\n size: \"small\",\n css: {\n content: {\n \"--size\": \"sizes.surface.xsmall\",\n },\n },\n },\n {\n variant: \"drawer\",\n size: \"medium\",\n css: {\n content: {\n \"--size\": \"sizes.surface.medium\",\n },\n },\n },\n {\n variant: \"drawer\",\n size: \"large\",\n css: {\n content: {\n \"--size\": \"sizes.surface.xlarge\",\n },\n },\n },\n ],\n variants: {\n context: {\n dialog: {\n positioner: {\n zIndex: \"modal\",\n },\n backdrop: {\n zIndex: \"overlay\",\n },\n },\n alert: {\n positioner: {\n zIndex: \"alertModal\",\n },\n backdrop: {\n zIndex: \"alertModalOverlay\",\n },\n },\n },\n variant: {\n drawer: {\n content: {\n \"--margin\": \"0px\",\n borderRadius: { base: \"sharp\", tablet: \"sharp\" },\n },\n },\n dialog: {\n content: {\n width: \"var(--size)\",\n _open: {\n animation: \"dialog-in\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"dialog-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n },\n position: {\n left: {\n content: {\n marginInlineStart: \"var(--margin)\",\n },\n },\n center: {},\n right: {\n content: {\n marginInlineEnd: \"var(--margin)\",\n },\n },\n bottom: {\n content: {\n marginBlockEnd: \"var(--margin)\",\n },\n },\n top: {\n content: {\n marginBlockStart: \"var(--margin)\",\n },\n },\n },\n size: {\n full: {\n content: {\n \"--margin\": \"0px\",\n minHeight: \"100%\",\n minWidth: \"100%\",\n borderRadius: \"sharp\",\n },\n },\n xsmall: {\n content: {\n \"--size\": \"sizes.surface.xsmall\",\n },\n },\n small: {\n content: {\n \"--size\": \"sizes.surface.medium\",\n },\n },\n medium: {\n content: {\n \"--size\": \"sizes.surface.xlarge\",\n },\n },\n large: {\n content: {\n \"--size\": \"sizes.surface.4xlarge\",\n },\n },\n },\n },\n});\n\nconst { withRootProvider, withContext } = createStyleContext(dialogRecipe);\n\nexport type DialogVariantProps = NonNullable<RecipeVariantProps<typeof dialogRecipe>>;\n\nexport interface DialogRootProps extends Dialog.RootProps, DialogVariantProps {}\n\nexport const InternalDialogRoot = withRootProvider(Dialog.Root);\n\nexport const DialogRoot = ({ lazyMount = true, unmountOnExit = true, ...props }: DialogRootProps) => (\n <InternalDialogRoot lazyMount={lazyMount} unmountOnExit={unmountOnExit} {...props} />\n);\n\nexport const DialogBackdrop = withContext(Dialog.Backdrop, \"backdrop\", { baseComponent: true });\n\nexport const DialogStandaloneContent = withContext(Dialog.Content, \"content\", { baseComponent: true });\n\nexport const DialogPositioner = withContext(Dialog.Positioner, \"positioner\", { baseComponent: true });\n\ninterface DialogContentProps extends Dialog.ContentProps, StyledProps {}\n\nexport const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>((props, ref) => (\n <>\n <DialogBackdrop />\n <DialogPositioner>\n <DialogStandaloneContent ref={ref} {...props} />\n </DialogPositioner>\n </>\n));\n\nconst InternalDialogDescription = withContext(Dialog.Description, \"description\");\n\ninterface DialogDescriptionProps\n extends Omit<Dialog.DescriptionProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLParagraphElement> {}\n\nexport const DialogDescription = ({ textStyle = \"body.large\", children, ...rest }: DialogDescriptionProps) => {\n return (\n <InternalDialogDescription asChild>\n <Text textStyle={textStyle} {...rest}>\n {children}\n </Text>\n </InternalDialogDescription>\n );\n};\n\nconst InternalDialogTitle = withContext(Dialog.Title, \"title\");\n\ninterface DialogTitleProps\n extends Omit<Dialog.TitleProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLHeadingElement> {}\n\nexport const DialogTitle = ({ textStyle = \"title.medium\", children, ...rest }: DialogTitleProps) => (\n <InternalDialogTitle asChild>\n <Heading textStyle={textStyle} {...rest}>\n {children}\n </Heading>\n </InternalDialogTitle>\n);\n\nexport const DialogTrigger = withContext(Dialog.Trigger, \"trigger\", { baseComponent: true });\n\nexport const DialogCloseTrigger = withContext(Dialog.CloseTrigger, \"closeTrigger\", { baseComponent: true });\n\nexport const DialogHeader = styled(\"div\", {\n base: {\n display: \"flex\",\n paddingInline: \"medium\",\n paddingBlockStart: \"medium\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n gap: \"xsmall\",\n },\n});\n\nexport const DialogBody = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n paddingInline: \"medium\",\n paddingBlockStart: \"small\",\n paddingBlockEnd: \"medium\",\n },\n});\n\nexport const DialogFooter = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"3xsmall\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n paddingInline: \"medium\",\n paddingBlockStart: \"small\",\n paddingBlockEnd: \"medium\",\n },\n});\n\nexport const DialogRootProvider = withRootProvider(Dialog.RootProvider);\n\nexport const useDialog = _useDialog;\n"],"mappings":";;;;;;;;;;;;;;AAoTA,MAAM,EAAE,kBAAkB,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KArSD;CACvB,OAAOA,qBAAAA,cAAc,KAAK;CAC1B,MAAM;EACJ,UAAU;GACR,UAAU;GACV,QAAQ;GACR,OAAO;GACP,MAAM;GACN,KAAK;GAEL,YAAY;GACZ,OAAO;IACL,WAAW;IACX,eAAe,EACb,WAAW,OACb;GACF;GACA,SAAS;IACP,WAAW;IACX,eAAe,EACb,WAAW,OACb;GACF;EACF;EACA,YAAY;GACV,UAAU;GACV,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,UAAU;GACV,MAAM;GACN,KAAK;GACL,OAAO;GACP,QAAQ;EACV;EACA,SAAS;GACP,YAAY;GACZ,UAAU;GACV,YAAY;GACZ,WAAW;GACX,QAAQ;GACR,UAAU;GACV,WAAW;GACX,QAAQ;GACR,WAAW;GACX,cAAc;IAAE,MAAM;IAAS,QAAQ;GAAQ;GAC/C,mBAAmB;GACnB,iBAAiB;GACjB,oBAAoB;GACpB,kBAAkB;GAClB,YAAY;IACV,YAAY;IACZ,UAAU;IACV,WAAW;GACb;EACF;CACF;CACA,iBAAiB;EACf,MAAM;EACN,UAAU;EACV,SAAS;EACT,SAAS;CACX;CACA,kBAAkB;EAChB;GACE,SAAS;GACT,UAAU;GACV,KAAK,EACH,SAAS;IACP,WAAW;IACX,WAAW;IACX,OAAO;IACP,OAAO;KACL,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;IACA,SAAS;KACP,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;GACF,EACF;EACF;EACA;GACE,SAAS;GACT,UAAU;GACV,KAAK,EACH,SAAS;IACP,WAAW;IACX,WAAW;IACX,OAAO;IACP,OAAO;KACL,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;IACA,SAAS;KACP,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;GACF,EACF;EACF;EACA;GACE,SAAS;GACT,UAAU;GACV,KAAK,EACH,SAAS;IACP,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;KACL,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;IACA,SAAS;KACP,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;GACF,EACF;EACF;EACA;GACE,SAAS;GACT,UAAU;GACV,KAAK,EACH,SAAS;IACP,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;KACL,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;IACA,SAAS;KACP,WAAW;KACX,eAAe,EACb,WAAW,OACb;IACF;GACF,EACF;EACF;EACA;GACE,SAAS;GACT,MAAM;GACN,KAAK,EACH,SAAS,EACP,UAAU,wBACZ,EACF;EACF;EACA;GACE,SAAS;GACT,MAAM;GACN,KAAK,EACH,SAAS,EACP,UAAU,uBACZ,EACF;EACF;EACA;GACE,SAAS;GACT,MAAM;GACN,KAAK,EACH,SAAS,EACP,UAAU,uBACZ,EACF;EACF;EACA;GACE,SAAS;GACT,MAAM;GACN,KAAK,EACH,SAAS,EACP,UAAU,uBACZ,EACF;EACF;CACF;CACA,UAAU;EACR,SAAS;GACP,QAAQ;IACN,YAAY,EACV,QAAQ,QACV;IACA,UAAU,EACR,QAAQ,UACV;GACF;GACA,OAAO;IACL,YAAY,EACV,QAAQ,aACV;IACA,UAAU,EACR,QAAQ,oBACV;GACF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CACnB,iBAAiB;AACnB,EACF,CAAC;AAED,MAAa,gBAAA,GAAA,wBAAA,QAAsB,OAAO,EACxC,MAAM;CACJ,SAAS;CACT,KAAK;CACL,YAAY;CACZ,gBAAgB;CAChB,eAAe;CACf,mBAAmB;CACnB,iBAAiB;AACnB,EACF,CAAC;AAED,MAAa,qBAAqB,iBAAiBA,qBAAAA,OAAO,YAAY;AAEtE,MAAa,YAAYG,qBAAAA"}
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import { type HTMLArkProps } from "@ark-ui/react";
|
|
8
|
+
import { type HTMLArkProps } from "@ark-ui/react/factory";
|
|
9
9
|
import type { StyledProps } from "@ndla/styled-system/types";
|
|
10
10
|
import { type TextProps } from "../Text";
|
|
11
|
-
export declare const ErrorMessageRoot: import("@ndla/styled-system/jsx").StyleContextProvider<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLElement> & import("react").HTMLAttributes<HTMLElement> & import("@ark-ui/react").PolymorphicProps>, import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"root" | "content" | "title" | "description" | "actions", import("@ndla/styled-system/types").SlotRecipeVariantRecord<"root" | "content" | "title" | "description" | "actions">>>;
|
|
12
|
-
export declare const ErrorMessageContent: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react").PolymorphicProps>>;
|
|
13
|
-
export declare const ErrorMessageActions: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react").PolymorphicProps>>;
|
|
11
|
+
export declare const ErrorMessageRoot: import("@ndla/styled-system/jsx").StyleContextProvider<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLElement> & import("react").HTMLAttributes<HTMLElement> & import("@ark-ui/react/factory").PolymorphicProps>, import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"root" | "content" | "title" | "description" | "actions", import("@ndla/styled-system/types").SlotRecipeVariantRecord<"root" | "content" | "title" | "description" | "actions">>>;
|
|
12
|
+
export declare const ErrorMessageContent: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react/factory").PolymorphicProps>>;
|
|
13
|
+
export declare const ErrorMessageActions: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react/factory").PolymorphicProps>>;
|
|
14
14
|
interface ErrorMessageTitleProps extends Omit<HTMLArkProps<"h1">, "color">, StyledProps, TextProps {
|
|
15
15
|
}
|
|
16
16
|
export declare const ErrorMessageTitle: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<ErrorMessageTitleProps & import("react").RefAttributes<HTMLHeadingElement>>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_Text = require("../Text.js");
|
|
2
|
-
let _ark_ui_react = require("@ark-ui/react");
|
|
3
2
|
let _ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
4
3
|
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
5
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let _ark_ui_react_factory = require("@ark-ui/react/factory");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
//#region src/ErrorMessage/ErrorMessage.tsx
|
|
8
8
|
/**
|
|
@@ -43,9 +43,9 @@ const { withProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleCon
|
|
|
43
43
|
description: { textAlign: "center" }
|
|
44
44
|
}
|
|
45
45
|
}));
|
|
46
|
-
const ErrorMessageRoot = withProvider(
|
|
47
|
-
const ErrorMessageContent = withContext(
|
|
48
|
-
const ErrorMessageActions = withContext(
|
|
46
|
+
const ErrorMessageRoot = withProvider(_ark_ui_react_factory.ark.article, "root", { baseComponent: true });
|
|
47
|
+
const ErrorMessageContent = withContext(_ark_ui_react_factory.ark.div, "content", { baseComponent: true });
|
|
48
|
+
const ErrorMessageActions = withContext(_ark_ui_react_factory.ark.div, "actions", { baseComponent: true });
|
|
49
49
|
const ErrorMessageTitle = withContext((0, react.forwardRef)(({ textStyle = "heading.small", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Heading, {
|
|
50
50
|
textStyle,
|
|
51
51
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorMessage.js","names":["ark","Heading","Text"],"sources":["../../src/ErrorMessage/ErrorMessage.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport { Heading, Text, type TextProps } from \"../Text\";\n\nconst errorMessageRecipe = sva({\n slots: [\"root\", \"content\", \"actions\", \"title\", \"description\"],\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xxlarge\",\n alignItems: \"center\",\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"center\",\n },\n actions: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n alignItems: \"center\",\n },\n title: {\n textAlign: \"center\",\n },\n description: {\n textAlign: \"center\",\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(errorMessageRecipe);\n\nexport const ErrorMessageRoot = withProvider(ark.article, \"root\", { baseComponent: true });\n\nexport const ErrorMessageContent = withContext(ark.div, \"content\", { baseComponent: true });\n\nexport const ErrorMessageActions = withContext(ark.div, \"actions\", { baseComponent: true });\n\ninterface ErrorMessageTitleProps extends Omit<HTMLArkProps<\"h1\">, \"color\">, StyledProps, TextProps {}\n\nconst InternalErrorMessageTitle = forwardRef<HTMLHeadingElement, ErrorMessageTitleProps>(\n ({ textStyle = \"heading.small\", ...props }, ref) => <Heading textStyle={textStyle} {...props} ref={ref} />,\n);\n\nexport const ErrorMessageTitle = withContext(InternalErrorMessageTitle, \"title\");\n\ninterface ErrorMessageDescriptionProps extends Omit<HTMLArkProps<\"p\">, \"color\">, StyledProps, TextProps {}\n\nconst InternalErrorMessageDescription = forwardRef<HTMLParagraphElement, ErrorMessageDescriptionProps>(\n ({ textStyle = \"body.xlarge\", ...props }, ref) => <Text textStyle={textStyle} {...props} ref={ref} />,\n);\n\nexport const ErrorMessageDescription = withContext(InternalErrorMessageDescription, \"description\");\n"],"mappings":";;;;;;;;;;;;;;AA6CA,MAAM,EAAE,cAAc,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KA9BS;CAC7B,OAAO;EAAC;EAAQ;EAAW;EAAW;EAAS;CAAa;CAC5D,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;GACL,YAAY;EACd;EACA,SAAS;GACP,SAAS;GACT,eAAe;GACf,KAAK;GACL,YAAY;EACd;EACA,SAAS;GACP,SAAS;GACT,eAAe;GACf,KAAK;GACL,YAAY;EACd;EACA,OAAO,EACL,WAAW,SACb;EACA,aAAa,EACX,WAAW,SACb;CACF;AACF,CAE0E,CAAC;AAE3E,MAAa,mBAAmB,aAAaA,
|
|
1
|
+
{"version":3,"file":"ErrorMessage.js","names":["ark","Heading","Text"],"sources":["../../src/ErrorMessage/ErrorMessage.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type HTMLArkProps, ark } from \"@ark-ui/react/factory\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport { Heading, Text, type TextProps } from \"../Text\";\n\nconst errorMessageRecipe = sva({\n slots: [\"root\", \"content\", \"actions\", \"title\", \"description\"],\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xxlarge\",\n alignItems: \"center\",\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"center\",\n },\n actions: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n alignItems: \"center\",\n },\n title: {\n textAlign: \"center\",\n },\n description: {\n textAlign: \"center\",\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(errorMessageRecipe);\n\nexport const ErrorMessageRoot = withProvider(ark.article, \"root\", { baseComponent: true });\n\nexport const ErrorMessageContent = withContext(ark.div, \"content\", { baseComponent: true });\n\nexport const ErrorMessageActions = withContext(ark.div, \"actions\", { baseComponent: true });\n\ninterface ErrorMessageTitleProps extends Omit<HTMLArkProps<\"h1\">, \"color\">, StyledProps, TextProps {}\n\nconst InternalErrorMessageTitle = forwardRef<HTMLHeadingElement, ErrorMessageTitleProps>(\n ({ textStyle = \"heading.small\", ...props }, ref) => <Heading textStyle={textStyle} {...props} ref={ref} />,\n);\n\nexport const ErrorMessageTitle = withContext(InternalErrorMessageTitle, \"title\");\n\ninterface ErrorMessageDescriptionProps extends Omit<HTMLArkProps<\"p\">, \"color\">, StyledProps, TextProps {}\n\nconst InternalErrorMessageDescription = forwardRef<HTMLParagraphElement, ErrorMessageDescriptionProps>(\n ({ textStyle = \"body.xlarge\", ...props }, ref) => <Text textStyle={textStyle} {...props} ref={ref} />,\n);\n\nexport const ErrorMessageDescription = withContext(InternalErrorMessageDescription, \"description\");\n"],"mappings":";;;;;;;;;;;;;;AA6CA,MAAM,EAAE,cAAc,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KA9BS;CAC7B,OAAO;EAAC;EAAQ;EAAW;EAAW;EAAS;CAAa;CAC5D,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;GACL,YAAY;EACd;EACA,SAAS;GACP,SAAS;GACT,eAAe;GACf,KAAK;GACL,YAAY;EACd;EACA,SAAS;GACP,SAAS;GACT,eAAe;GACf,KAAK;GACL,YAAY;EACd;EACA,OAAO,EACL,WAAW,SACb;EACA,aAAa,EACX,WAAW,SACb;CACF;AACF,CAE0E,CAAC;AAE3E,MAAa,mBAAmB,aAAaA,sBAAAA,IAAI,SAAS,QAAQ,EAAE,eAAe,KAAK,CAAC;AAEzF,MAAa,sBAAsB,YAAYA,sBAAAA,IAAI,KAAK,WAAW,EAAE,eAAe,KAAK,CAAC;AAE1F,MAAa,sBAAsB,YAAYA,sBAAAA,IAAI,KAAK,WAAW,EAAE,eAAe,KAAK,CAAC;AAQ1F,MAAa,oBAAoB,aAJ3B,GAAA,MAAA,aACH,EAAE,YAAY,iBAAiB,GAAG,SAAS,QAAQ,iBAAA,GAAA,kBAAA,KAACC,aAAAA,SAAD;CAAoB;CAAW,GAAI;CAAY;AAAM,CAAA,CAG9D,GAA2B,OAAO;AAQ/E,MAAa,0BAA0B,aAJjC,GAAA,MAAA,aACH,EAAE,YAAY,eAAe,GAAG,SAAS,QAAQ,iBAAA,GAAA,kBAAA,KAACC,aAAAA,MAAD;CAAiB;CAAW,GAAI;CAAY;AAAM,CAAA,CAGnD,GAAiC,aAAa"}
|
package/lib/ExpandableBox.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import { type HTMLArkProps } from "@ark-ui/react";
|
|
8
|
+
import { type HTMLArkProps } from "@ark-ui/react/factory";
|
|
9
9
|
import type { StyledProps } from "@ndla/styled-system/types";
|
|
10
10
|
export interface ExpandableBoxProps extends HTMLArkProps<"details">, StyledProps {
|
|
11
11
|
}
|
package/lib/ExpandableBox.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
let _ark_ui_react = require("@ark-ui/react");
|
|
2
1
|
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
3
2
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
3
|
+
let _ark_ui_react_factory = require("@ark-ui/react/factory");
|
|
4
4
|
let react = require("react");
|
|
5
5
|
//#region src/ExpandableBox.tsx
|
|
6
6
|
/**
|
|
@@ -10,7 +10,7 @@ let react = require("react");
|
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
|
-
const StyledExpandableBox = (0, _ndla_styled_system_jsx.styled)(
|
|
13
|
+
const StyledExpandableBox = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.details, { base: {
|
|
14
14
|
transitionDuration: "fast",
|
|
15
15
|
width: "100%",
|
|
16
16
|
position: "relative",
|
|
@@ -54,7 +54,7 @@ const ExpandableBox = (0, react.forwardRef)((props, ref) => {
|
|
|
54
54
|
ref
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
|
-
const StyledExpandableBoxSummary = (0, _ndla_styled_system_jsx.styled)(
|
|
57
|
+
const StyledExpandableBoxSummary = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.summary, { base: {
|
|
58
58
|
cursor: "pointer",
|
|
59
59
|
margin: "-medium",
|
|
60
60
|
padding: "medium",
|
package/lib/ExpandableBox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandableBox.js","names":["ark"],"sources":["../src/ExpandableBox.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type HTMLArkProps, ark } from \"@ark-ui/react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef, useEffect } from \"react\";\n\nexport interface ExpandableBoxProps extends HTMLArkProps<\"details\">, StyledProps {}\n\nconst StyledExpandableBox = styled(\n ark.details,\n {\n base: {\n transitionDuration: \"fast\",\n width: \"100%\",\n position: \"relative\",\n border: \"1px solid\",\n borderRadius: \"xsmall\",\n borderColor: \"stroke.subtle\",\n padding: \"medium\",\n clear: \"both\",\n overflow: \"hidden\",\n _open: {\n padding: \"medium\",\n \"& summary, [data-embed-type='expandable-box-summary']\": {\n marginBlockEnd: \"-xxsmall\",\n },\n },\n },\n },\n { baseComponent: true },\n);\n\nconst onBeforePrint = (_: Event) => {\n const detailsElements = document.querySelectorAll(\"details\");\n detailsElements.forEach((details) => {\n if (!details.hasAttribute(\"open\")) {\n details.setAttribute(\"data-print-open\", \"true\");\n details.setAttribute(\"open\", \"true\");\n }\n });\n};\n\nconst onAfterPrint = (_: Event) => {\n const detailsElements = document.querySelectorAll(\"details[data-print-open]\");\n detailsElements.forEach((details) => {\n details.removeAttribute(\"data-print-open\");\n details.removeAttribute(\"open\");\n });\n};\n\nexport const ExpandableBox = forwardRef<HTMLDetailsElement, ExpandableBoxProps>((props, ref) => {\n useEffect(() => {\n window.addEventListener(\"beforeprint\", onBeforePrint);\n window.addEventListener(\"afterprint\", onAfterPrint);\n return () => {\n window.removeEventListener(\"beforeprint\", onBeforePrint);\n window.removeEventListener(\"afterprint\", onAfterPrint);\n };\n }, []);\n return <StyledExpandableBox {...props} data-embed-type=\"expandable-box\" ref={ref} />;\n});\n\nexport interface ExpandableBoxSummaryProps extends HTMLArkProps<\"summary\">, StyledProps {}\n\nconst StyledExpandableBoxSummary = styled(\n ark.summary,\n {\n base: {\n cursor: \"pointer\",\n margin: \"-medium\",\n padding: \"medium\",\n textStyle: \"label.large!\",\n _hover: {\n color: \"text.action\",\n },\n \"& > *\": {\n display: \"inline!\",\n textStyle: \"label.large!\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ExpandableBoxSummary = forwardRef<HTMLElement, ExpandableBoxSummaryProps>((props, ref) => (\n <StyledExpandableBoxSummary {...props} data-embed-type=\"expandable-box-summary\" ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,uBAAA,GAAA,wBAAA,QACJA,
|
|
1
|
+
{"version":3,"file":"ExpandableBox.js","names":["ark"],"sources":["../src/ExpandableBox.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type HTMLArkProps, ark } from \"@ark-ui/react/factory\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef, useEffect } from \"react\";\n\nexport interface ExpandableBoxProps extends HTMLArkProps<\"details\">, StyledProps {}\n\nconst StyledExpandableBox = styled(\n ark.details,\n {\n base: {\n transitionDuration: \"fast\",\n width: \"100%\",\n position: \"relative\",\n border: \"1px solid\",\n borderRadius: \"xsmall\",\n borderColor: \"stroke.subtle\",\n padding: \"medium\",\n clear: \"both\",\n overflow: \"hidden\",\n _open: {\n padding: \"medium\",\n \"& summary, [data-embed-type='expandable-box-summary']\": {\n marginBlockEnd: \"-xxsmall\",\n },\n },\n },\n },\n { baseComponent: true },\n);\n\nconst onBeforePrint = (_: Event) => {\n const detailsElements = document.querySelectorAll(\"details\");\n detailsElements.forEach((details) => {\n if (!details.hasAttribute(\"open\")) {\n details.setAttribute(\"data-print-open\", \"true\");\n details.setAttribute(\"open\", \"true\");\n }\n });\n};\n\nconst onAfterPrint = (_: Event) => {\n const detailsElements = document.querySelectorAll(\"details[data-print-open]\");\n detailsElements.forEach((details) => {\n details.removeAttribute(\"data-print-open\");\n details.removeAttribute(\"open\");\n });\n};\n\nexport const ExpandableBox = forwardRef<HTMLDetailsElement, ExpandableBoxProps>((props, ref) => {\n useEffect(() => {\n window.addEventListener(\"beforeprint\", onBeforePrint);\n window.addEventListener(\"afterprint\", onAfterPrint);\n return () => {\n window.removeEventListener(\"beforeprint\", onBeforePrint);\n window.removeEventListener(\"afterprint\", onAfterPrint);\n };\n }, []);\n return <StyledExpandableBox {...props} data-embed-type=\"expandable-box\" ref={ref} />;\n});\n\nexport interface ExpandableBoxSummaryProps extends HTMLArkProps<\"summary\">, StyledProps {}\n\nconst StyledExpandableBoxSummary = styled(\n ark.summary,\n {\n base: {\n cursor: \"pointer\",\n margin: \"-medium\",\n padding: \"medium\",\n textStyle: \"label.large!\",\n _hover: {\n color: \"text.action\",\n },\n \"& > *\": {\n display: \"inline!\",\n textStyle: \"label.large!\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ExpandableBoxSummary = forwardRef<HTMLElement, ExpandableBoxSummaryProps>((props, ref) => (\n <StyledExpandableBoxSummary {...props} data-embed-type=\"expandable-box-summary\" ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,uBAAA,GAAA,wBAAA,QACJA,sBAAAA,IAAI,SACJ,EACE,MAAM;CACJ,oBAAoB;CACpB,OAAO;CACP,UAAU;CACV,QAAQ;CACR,cAAc;CACd,aAAa;CACb,SAAS;CACT,OAAO;CACP,UAAU;CACV,OAAO;EACL,SAAS;EACT,yDAAyD,EACvD,gBAAgB,WAClB;CACF;AACF,EACF,GACA,EAAE,eAAe,KAAK,CACxB;AAEA,MAAM,iBAAiB,MAAa;CAElC,SADiC,iBAAiB,SACpC,EAAE,SAAS,YAAY;EACnC,IAAI,CAAC,QAAQ,aAAa,MAAM,GAAG;GACjC,QAAQ,aAAa,mBAAmB,MAAM;GAC9C,QAAQ,aAAa,QAAQ,MAAM;EACrC;CACF,CAAC;AACH;AAEA,MAAM,gBAAgB,MAAa;CAEjC,SADiC,iBAAiB,0BACpC,EAAE,SAAS,YAAY;EACnC,QAAQ,gBAAgB,iBAAiB;EACzC,QAAQ,gBAAgB,MAAM;CAChC,CAAC;AACH;AAEA,MAAa,iBAAA,GAAA,MAAA,aAAoE,OAAO,QAAQ;CAC9F,CAAA,GAAA,MAAA,iBAAgB;EACd,OAAO,iBAAiB,eAAe,aAAa;EACpD,OAAO,iBAAiB,cAAc,YAAY;EAClD,aAAa;GACX,OAAO,oBAAoB,eAAe,aAAa;GACvD,OAAO,oBAAoB,cAAc,YAAY;EACvD;CACF,GAAG,CAAC,CAAC;CACL,OAAO,iBAAA,GAAA,kBAAA,KAAC,qBAAD;EAAqB,GAAI;EAAO,mBAAgB;EAAsB;CAAM,CAAA;AACrF,CAAC;AAID,MAAM,8BAAA,GAAA,wBAAA,QACJA,sBAAAA,IAAI,SACJ,EACE,MAAM;CACJ,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,WAAW;CACX,QAAQ,EACN,OAAO,cACT;CACA,SAAS;EACP,SAAS;EACT,WAAW;CACb;AACF,EACF,GACA,EAAE,eAAe,KAAK,CACxB;AAEA,MAAa,wBAAA,GAAA,MAAA,aAA2E,OAAO,QAC7F,iBAAA,GAAA,kBAAA,KAAC,4BAAD;CAA4B,GAAI;CAAO,mBAAgB;CAA8B;AAAM,CAAA,CAC5F"}
|
package/lib/Field.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import { Field
|
|
8
|
+
import { Field } from "@ark-ui/react/field";
|
|
9
|
+
import { Fieldset } from "@ark-ui/react/fieldset";
|
|
9
10
|
export declare const FieldRoot: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<Field.RootProps & import("react").RefAttributes<HTMLDivElement>>, {}>;
|
|
10
11
|
export declare const FieldsetRoot: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<Fieldset.RootProps & import("react").RefAttributes<HTMLFieldSetElement>>, {}>;
|
package/lib/Field.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
let _ark_ui_react = require("@ark-ui/react");
|
|
2
1
|
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
2
|
+
let _ark_ui_react_field = require("@ark-ui/react/field");
|
|
3
|
+
let _ark_ui_react_fieldset = require("@ark-ui/react/fieldset");
|
|
3
4
|
//#region src/Field.tsx
|
|
4
5
|
/**
|
|
5
6
|
* Copyright (c) 2024-present, NDLA.
|
|
@@ -13,8 +14,8 @@ const rootStyle = {
|
|
|
13
14
|
flexDirection: "column",
|
|
14
15
|
gap: "3xsmall"
|
|
15
16
|
};
|
|
16
|
-
const FieldRoot = (0, _ndla_styled_system_jsx.styled)(
|
|
17
|
-
const FieldsetRoot = (0, _ndla_styled_system_jsx.styled)(
|
|
17
|
+
const FieldRoot = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_field.Field.Root, { base: rootStyle }, { baseComponent: true });
|
|
18
|
+
const FieldsetRoot = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_fieldset.Fieldset.Root, { base: rootStyle }, { baseComponent: true });
|
|
18
19
|
//#endregion
|
|
19
20
|
exports.FieldRoot = FieldRoot;
|
|
20
21
|
exports.FieldsetRoot = FieldsetRoot;
|
package/lib/Field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","names":["Field","Fieldset"],"sources":["../src/Field.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Field
|
|
1
|
+
{"version":3,"file":"Field.js","names":["Field","Fieldset"],"sources":["../src/Field.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Field } from \"@ark-ui/react/field\";\nimport { Fieldset } from \"@ark-ui/react/fieldset\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { SystemStyleObject } from \"@ndla/styled-system/types\";\n\nconst rootStyle: SystemStyleObject = {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n};\n\nexport const FieldRoot = styled(Field.Root, { base: rootStyle }, { baseComponent: true });\n\nexport const FieldsetRoot = styled(Fieldset.Root, { base: rootStyle }, { baseComponent: true });\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,YAA+B;CACnC,SAAS;CACT,eAAe;CACf,KAAK;AACP;AAEA,MAAa,aAAA,GAAA,wBAAA,QAAmBA,oBAAAA,MAAM,MAAM,EAAE,MAAM,UAAU,GAAG,EAAE,eAAe,KAAK,CAAC;AAExF,MAAa,gBAAA,GAAA,wBAAA,QAAsBC,uBAAAA,SAAS,MAAM,EAAE,MAAM,UAAU,GAAG,EAAE,eAAe,KAAK,CAAC"}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import { Field
|
|
8
|
+
import { Field } from "@ark-ui/react/field";
|
|
9
|
+
import { Fieldset } from "@ark-ui/react/fieldset";
|
|
9
10
|
import type { StyledProps } from "@ndla/styled-system/types";
|
|
10
11
|
import type { TextProps } from "./Text";
|
|
11
12
|
export interface FieldErrorMessageProps extends Omit<Field.ErrorTextProps, "color">, TextProps, StyledProps {
|
package/lib/FieldErrorMessage.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
let _ark_ui_react = require("@ark-ui/react");
|
|
2
1
|
let _ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
3
2
|
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
4
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
4
|
let react = require("react");
|
|
5
|
+
let _ark_ui_react_field = require("@ark-ui/react/field");
|
|
6
|
+
let _ark_ui_react_fieldset = require("@ark-ui/react/fieldset");
|
|
6
7
|
//#region src/FieldErrorMessage.tsx
|
|
7
8
|
/**
|
|
8
9
|
* Copyright (c) 2024-present, NDLA.
|
|
@@ -16,7 +17,7 @@ const errorTextStyling = {
|
|
|
16
17
|
whiteSpace: "pre-line",
|
|
17
18
|
justifyContent: "center"
|
|
18
19
|
};
|
|
19
|
-
const StyledFieldErrorText = (0, _ndla_styled_system_jsx.styled)(
|
|
20
|
+
const StyledFieldErrorText = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_field.Field.ErrorText, { base: errorTextStyling }, { baseComponent: true });
|
|
20
21
|
const FieldErrorMessage = (0, react.forwardRef)(({ textStyle = "label.small", fontWeight, css: cssProp, color, srOnly, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledFieldErrorText, {
|
|
21
22
|
css: _ndla_styled_system_css.css.raw({
|
|
22
23
|
textStyle,
|
|
@@ -27,7 +28,7 @@ const FieldErrorMessage = (0, react.forwardRef)(({ textStyle = "label.small", fo
|
|
|
27
28
|
...props,
|
|
28
29
|
ref
|
|
29
30
|
}));
|
|
30
|
-
const StyledFieldsetErrorText = (0, _ndla_styled_system_jsx.styled)(
|
|
31
|
+
const StyledFieldsetErrorText = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_fieldset.Fieldset.ErrorText, { base: errorTextStyling }, { baseComponent: true });
|
|
31
32
|
const FieldsetErrorText = (0, react.forwardRef)(({ textStyle = "label.small", fontWeight, css: cssProp, color, srOnly, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledFieldsetErrorText, {
|
|
32
33
|
css: _ndla_styled_system_css.css.raw({
|
|
33
34
|
textStyle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldErrorMessage.js","names":["Field","css","Fieldset"],"sources":["../src/FieldErrorMessage.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Field
|
|
1
|
+
{"version":3,"file":"FieldErrorMessage.js","names":["Field","css","Fieldset"],"sources":["../src/FieldErrorMessage.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Field } from \"@ark-ui/react/field\";\nimport { Fieldset } from \"@ark-ui/react/fieldset\";\nimport { css } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, SystemStyleObject } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport type { TextProps } from \"./Text\";\n\nconst errorTextStyling: SystemStyleObject = {\n color: \"text.error\",\n whiteSpace: \"pre-line\",\n justifyContent: \"center\",\n};\n\nconst StyledFieldErrorText = styled(\n Field.ErrorText,\n {\n base: errorTextStyling,\n },\n { baseComponent: true },\n);\n\nexport interface FieldErrorMessageProps extends Omit<Field.ErrorTextProps, \"color\">, TextProps, StyledProps {}\n\nexport const FieldErrorMessage = forwardRef<HTMLSpanElement, FieldErrorMessageProps>(\n ({ textStyle = \"label.small\", fontWeight, css: cssProp, color, srOnly, ...props }, ref) => (\n <StyledFieldErrorText css={css.raw({ textStyle, fontWeight, color, srOnly }, cssProp)} {...props} ref={ref} />\n ),\n);\n\nconst StyledFieldsetErrorText = styled(\n Fieldset.ErrorText,\n {\n base: errorTextStyling,\n },\n { baseComponent: true },\n);\n\nexport interface FieldsetErrorTextProps extends Omit<Fieldset.ErrorTextProps, \"color\">, TextProps, StyledProps {}\n\nexport const FieldsetErrorText = forwardRef<HTMLSpanElement, FieldsetErrorTextProps>(\n ({ textStyle = \"label.small\", fontWeight, css: cssProp, color, srOnly, ...props }, ref) => (\n <StyledFieldsetErrorText css={css.raw({ textStyle, fontWeight, color, srOnly }, cssProp)} {...props} ref={ref} />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,mBAAsC;CAC1C,OAAO;CACP,YAAY;CACZ,gBAAgB;AAClB;AAEA,MAAM,wBAAA,GAAA,wBAAA,QACJA,oBAAAA,MAAM,WACN,EACE,MAAM,iBACR,GACA,EAAE,eAAe,KAAK,CACxB;AAIA,MAAa,qBAAA,GAAA,MAAA,aACV,EAAE,YAAY,eAAe,YAAY,KAAK,SAAS,OAAO,QAAQ,GAAG,SAAS,QACjF,iBAAA,GAAA,kBAAA,KAAC,sBAAD;CAAsB,KAAKC,wBAAAA,IAAI,IAAI;EAAE;EAAW;EAAY;EAAO;CAAO,GAAG,OAAO;CAAG,GAAI;CAAY;AAAM,CAAA,CAEjH;AAEA,MAAM,2BAAA,GAAA,wBAAA,QACJC,uBAAAA,SAAS,WACT,EACE,MAAM,iBACR,GACA,EAAE,eAAe,KAAK,CACxB;AAIA,MAAa,qBAAA,GAAA,MAAA,aACV,EAAE,YAAY,eAAe,YAAY,KAAK,SAAS,OAAO,QAAQ,GAAG,SAAS,QACjF,iBAAA,GAAA,kBAAA,KAAC,yBAAD;CAAyB,KAAKD,wBAAAA,IAAI,IAAI;EAAE;EAAW;EAAY;EAAO;CAAO,GAAG,OAAO;CAAG,GAAI;CAAY;AAAM,CAAA,CAEpH"}
|
package/lib/FieldHelper.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import { Field
|
|
8
|
+
import { Field } from "@ark-ui/react/field";
|
|
9
|
+
import { Fieldset } from "@ark-ui/react/fieldset";
|
|
9
10
|
import type { StyledProps } from "@ndla/styled-system/types";
|
|
10
11
|
import type { TextProps } from "./Text";
|
|
11
12
|
export interface FieldHelperProps extends Omit<Field.HelperTextProps, "color">, TextProps, StyledProps {
|
package/lib/FieldHelper.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
let _ark_ui_react = require("@ark-ui/react");
|
|
2
1
|
let _ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
3
2
|
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
4
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
4
|
let react = require("react");
|
|
5
|
+
let _ark_ui_react_field = require("@ark-ui/react/field");
|
|
6
|
+
let _ark_ui_react_fieldset = require("@ark-ui/react/fieldset");
|
|
6
7
|
//#region src/FieldHelper.tsx
|
|
7
8
|
/**
|
|
8
9
|
* Copyright (c) 2025-present, NDLA.
|
|
@@ -11,7 +12,7 @@ let react = require("react");
|
|
|
11
12
|
* LICENSE file in the root directory of this source tree.
|
|
12
13
|
*
|
|
13
14
|
*/
|
|
14
|
-
const StyledFieldHelper = (0, _ndla_styled_system_jsx.styled)(
|
|
15
|
+
const StyledFieldHelper = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_field.Field.HelperText, {}, { baseComponent: true });
|
|
15
16
|
const FieldHelper = (0, react.forwardRef)(({ textStyle = "label.small", fontWeight, color, srOnly, css: cssProp, ...props }, ref) => {
|
|
16
17
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledFieldHelper, {
|
|
17
18
|
css: _ndla_styled_system_css.css.raw({
|
|
@@ -24,7 +25,7 @@ const FieldHelper = (0, react.forwardRef)(({ textStyle = "label.small", fontWeig
|
|
|
24
25
|
ref
|
|
25
26
|
});
|
|
26
27
|
});
|
|
27
|
-
const StyledFieldsetHelper = (0, _ndla_styled_system_jsx.styled)(
|
|
28
|
+
const StyledFieldsetHelper = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_fieldset.Fieldset.HelperText, {}, { baseComponent: true });
|
|
28
29
|
const FieldsetHelper = (0, react.forwardRef)(({ textStyle = "label.small", fontWeight, color, srOnly, css: cssProp, ...props }, ref) => {
|
|
29
30
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledFieldsetHelper, {
|
|
30
31
|
css: _ndla_styled_system_css.css.raw({
|
package/lib/FieldHelper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldHelper.js","names":["Field","css","Fieldset"],"sources":["../src/FieldHelper.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Field
|
|
1
|
+
{"version":3,"file":"FieldHelper.js","names":["Field","css","Fieldset"],"sources":["../src/FieldHelper.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Field } from \"@ark-ui/react/field\";\nimport { Fieldset } from \"@ark-ui/react/fieldset\";\nimport { css } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport type { TextProps } from \"./Text\";\n\nconst StyledFieldHelper = styled(Field.HelperText, {}, { baseComponent: true });\n\nexport interface FieldHelperProps extends Omit<Field.HelperTextProps, \"color\">, TextProps, StyledProps {}\n\nexport const FieldHelper = forwardRef<HTMLSpanElement, FieldHelperProps>(\n ({ textStyle = \"label.small\", fontWeight, color, srOnly, css: cssProp, ...props }, ref) => {\n return <StyledFieldHelper css={css.raw({ textStyle, fontWeight, color, srOnly }, cssProp)} {...props} ref={ref} />;\n },\n);\n\nconst StyledFieldsetHelper = styled(Fieldset.HelperText, {}, { baseComponent: true });\n\nexport interface FieldsetHelperProps extends Omit<Fieldset.HelperTextProps, \"color\">, TextProps, StyledProps {}\n\nexport const FieldsetHelper = forwardRef<HTMLSpanElement, FieldsetHelperProps>(\n ({ textStyle = \"label.small\", fontWeight, color, srOnly, css: cssProp, ...props }, ref) => {\n return (\n <StyledFieldsetHelper css={css.raw({ textStyle, fontWeight, color, srOnly }, cssProp)} {...props} ref={ref} />\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,qBAAA,GAAA,wBAAA,QAA2BA,oBAAAA,MAAM,YAAY,CAAC,GAAG,EAAE,eAAe,KAAK,CAAC;AAI9E,MAAa,eAAA,GAAA,MAAA,aACV,EAAE,YAAY,eAAe,YAAY,OAAO,QAAQ,KAAK,SAAS,GAAG,SAAS,QAAQ;CACzF,OAAO,iBAAA,GAAA,kBAAA,KAAC,mBAAD;EAAmB,KAAKC,wBAAAA,IAAI,IAAI;GAAE;GAAW;GAAY;GAAO;EAAO,GAAG,OAAO;EAAG,GAAI;EAAY;CAAM,CAAA;AACnH,CACF;AAEA,MAAM,wBAAA,GAAA,wBAAA,QAA8BC,uBAAAA,SAAS,YAAY,CAAC,GAAG,EAAE,eAAe,KAAK,CAAC;AAIpF,MAAa,kBAAA,GAAA,MAAA,aACV,EAAE,YAAY,eAAe,YAAY,OAAO,QAAQ,KAAK,SAAS,GAAG,SAAS,QAAQ;CACzF,OACE,iBAAA,GAAA,kBAAA,KAAC,sBAAD;EAAsB,KAAKD,wBAAAA,IAAI,IAAI;GAAE;GAAW;GAAY;GAAO;EAAO,GAAG,OAAO;EAAG,GAAI;EAAY;CAAM,CAAA;AAEjH,CACF"}
|