@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/Figure.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 RecipeVariantProps } from "@ndla/styled-system/css";
|
|
10
10
|
import type { RecipeVariant, StyledProps } from "@ndla/styled-system/types";
|
|
11
11
|
declare const figureRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
|
package/lib/Figure.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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");
|
|
4
|
+
let _ark_ui_react_factory = require("@ark-ui/react/factory");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
//#region src/Figure.tsx
|
|
7
7
|
/**
|
|
@@ -111,7 +111,7 @@ const figureRecipe = (0, _ndla_styled_system_css.cva)({
|
|
|
111
111
|
}
|
|
112
112
|
]
|
|
113
113
|
});
|
|
114
|
-
const StyledFigure = (0, _ndla_styled_system_jsx.styled)(
|
|
114
|
+
const StyledFigure = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.figure, {}, { baseComponent: true });
|
|
115
115
|
const Figure = (0, react.forwardRef)(({ size, float, css: cssProp, ...props }, ref) => {
|
|
116
116
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledFigure, {
|
|
117
117
|
css: _ndla_styled_system_css.css.raw(figureRecipe.raw({
|
package/lib/Figure.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Figure.js","names":["ark","css"],"sources":["../src/Figure.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 { type RecipeVariantProps, css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariant, StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst figureRecipe = cva({\n base: {\n position: \"relative\",\n transitionDuration: \"normal\",\n transitionProperty: \"transform, width, height\",\n transitionTimingFunction: \"default\",\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n variants: {\n size: {\n full: {\n width: \"100%\",\n _print: {\n width: \"60%\",\n },\n },\n medium: {\n tablet: {\n width: \"50%\",\n },\n desktop: {\n width: \"65%\",\n },\n _print: {\n width: \"65%\",\n },\n },\n small: {\n tablet: {\n width: \"35%\",\n },\n desktop: {\n width: \"50%\",\n },\n _print: {\n width: \"50%\",\n },\n },\n xsmall: {\n tablet: {\n width: \"25%\",\n },\n desktop: {\n width: \"35%\",\n },\n _print: {\n width: \"35%\",\n },\n },\n },\n float: {\n left: {\n tablet: {\n float: \"left\",\n clear: \"left\",\n },\n _print: {\n float: \"left\",\n clear: \"left\",\n },\n },\n right: {\n tablet: {\n float: \"right\",\n clear: \"right\",\n },\n _print: {\n float: \"right\",\n clear: \"right\",\n },\n },\n },\n },\n defaultVariants: {\n size: \"full\",\n },\n compoundVariants: [\n {\n float: [\"left\", \"right\"],\n css: {\n zIndex: \"base\",\n left: \"auto\",\n marginBlock: \"xsmall\",\n },\n },\n {\n float: \"left\",\n size: [\"medium\", \"small\", \"xsmall\"],\n css: {\n marginInlineEnd: \"medium\",\n tabletDown: { marginInlineEnd: \"0\" },\n },\n },\n {\n float: \"right\",\n size: [\"medium\", \"small\", \"xsmall\"],\n css: {\n marginInlineStart: \"medium\",\n tabletDown: { marginInlineStart: \"0\" },\n },\n },\n {\n float: [\"left\", \"right\"],\n size: [\"full\"],\n css: {\n marginInlineStart: \"0\",\n marginInlineEnd: \"0\",\n },\n },\n ],\n});\n\nexport type FigureVariantProps = NonNullable<RecipeVariantProps<typeof figureRecipe>>;\n\nexport type FigureSize = RecipeVariant<typeof figureRecipe>[\"size\"];\n\nexport type FigureFloat = RecipeVariant<typeof figureRecipe>[\"float\"];\n\nexport interface FigureProps extends HTMLArkProps<\"figure\">, StyledProps, FigureVariantProps {}\n\nconst StyledFigure = styled(ark.figure, {}, { baseComponent: true });\n\nexport const Figure = forwardRef<HTMLElement, FigureProps>(({ size, float, css: cssProp, ...props }, ref) => {\n return <StyledFigure css={css.raw(figureRecipe.raw({ size, float }), cssProp)} {...props} ref={ref} />;\n});\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,gBAA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,gBAAA,GAAA,wBAAA,QAAsBA,
|
|
1
|
+
{"version":3,"file":"Figure.js","names":["ark","css"],"sources":["../src/Figure.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 { type RecipeVariantProps, css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariant, StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst figureRecipe = cva({\n base: {\n position: \"relative\",\n transitionDuration: \"normal\",\n transitionProperty: \"transform, width, height\",\n transitionTimingFunction: \"default\",\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n variants: {\n size: {\n full: {\n width: \"100%\",\n _print: {\n width: \"60%\",\n },\n },\n medium: {\n tablet: {\n width: \"50%\",\n },\n desktop: {\n width: \"65%\",\n },\n _print: {\n width: \"65%\",\n },\n },\n small: {\n tablet: {\n width: \"35%\",\n },\n desktop: {\n width: \"50%\",\n },\n _print: {\n width: \"50%\",\n },\n },\n xsmall: {\n tablet: {\n width: \"25%\",\n },\n desktop: {\n width: \"35%\",\n },\n _print: {\n width: \"35%\",\n },\n },\n },\n float: {\n left: {\n tablet: {\n float: \"left\",\n clear: \"left\",\n },\n _print: {\n float: \"left\",\n clear: \"left\",\n },\n },\n right: {\n tablet: {\n float: \"right\",\n clear: \"right\",\n },\n _print: {\n float: \"right\",\n clear: \"right\",\n },\n },\n },\n },\n defaultVariants: {\n size: \"full\",\n },\n compoundVariants: [\n {\n float: [\"left\", \"right\"],\n css: {\n zIndex: \"base\",\n left: \"auto\",\n marginBlock: \"xsmall\",\n },\n },\n {\n float: \"left\",\n size: [\"medium\", \"small\", \"xsmall\"],\n css: {\n marginInlineEnd: \"medium\",\n tabletDown: { marginInlineEnd: \"0\" },\n },\n },\n {\n float: \"right\",\n size: [\"medium\", \"small\", \"xsmall\"],\n css: {\n marginInlineStart: \"medium\",\n tabletDown: { marginInlineStart: \"0\" },\n },\n },\n {\n float: [\"left\", \"right\"],\n size: [\"full\"],\n css: {\n marginInlineStart: \"0\",\n marginInlineEnd: \"0\",\n },\n },\n ],\n});\n\nexport type FigureVariantProps = NonNullable<RecipeVariantProps<typeof figureRecipe>>;\n\nexport type FigureSize = RecipeVariant<typeof figureRecipe>[\"size\"];\n\nexport type FigureFloat = RecipeVariant<typeof figureRecipe>[\"float\"];\n\nexport interface FigureProps extends HTMLArkProps<\"figure\">, StyledProps, FigureVariantProps {}\n\nconst StyledFigure = styled(ark.figure, {}, { baseComponent: true });\n\nexport const Figure = forwardRef<HTMLElement, FigureProps>(({ size, float, css: cssProp, ...props }, ref) => {\n return <StyledFigure css={css.raw(figureRecipe.raw({ size, float }), cssProp)} {...props} ref={ref} />;\n});\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,gBAAA,GAAA,wBAAA,KAAmB;CACvB,MAAM;EACJ,UAAU;EACV,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,eAAe;GACb,YAAY;GACZ,oBAAoB;EACtB;CACF;CACA,UAAU;EACR,MAAM;GACJ,MAAM;IACJ,OAAO;IACP,QAAQ,EACN,OAAO,MACT;GACF;GACA,QAAQ;IACN,QAAQ,EACN,OAAO,MACT;IACA,SAAS,EACP,OAAO,MACT;IACA,QAAQ,EACN,OAAO,MACT;GACF;GACA,OAAO;IACL,QAAQ,EACN,OAAO,MACT;IACA,SAAS,EACP,OAAO,MACT;IACA,QAAQ,EACN,OAAO,MACT;GACF;GACA,QAAQ;IACN,QAAQ,EACN,OAAO,MACT;IACA,SAAS,EACP,OAAO,MACT;IACA,QAAQ,EACN,OAAO,MACT;GACF;EACF;EACA,OAAO;GACL,MAAM;IACJ,QAAQ;KACN,OAAO;KACP,OAAO;IACT;IACA,QAAQ;KACN,OAAO;KACP,OAAO;IACT;GACF;GACA,OAAO;IACL,QAAQ;KACN,OAAO;KACP,OAAO;IACT;IACA,QAAQ;KACN,OAAO;KACP,OAAO;IACT;GACF;EACF;CACF;CACA,iBAAiB,EACf,MAAM,OACR;CACA,kBAAkB;EAChB;GACE,OAAO,CAAC,QAAQ,OAAO;GACvB,KAAK;IACH,QAAQ;IACR,MAAM;IACN,aAAa;GACf;EACF;EACA;GACE,OAAO;GACP,MAAM;IAAC;IAAU;IAAS;GAAQ;GAClC,KAAK;IACH,iBAAiB;IACjB,YAAY,EAAE,iBAAiB,IAAI;GACrC;EACF;EACA;GACE,OAAO;GACP,MAAM;IAAC;IAAU;IAAS;GAAQ;GAClC,KAAK;IACH,mBAAmB;IACnB,YAAY,EAAE,mBAAmB,IAAI;GACvC;EACF;EACA;GACE,OAAO,CAAC,QAAQ,OAAO;GACvB,MAAM,CAAC,MAAM;GACb,KAAK;IACH,mBAAmB;IACnB,iBAAiB;GACnB;EACF;CACF;AACF,CAAC;AAUD,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,sBAAAA,IAAI,QAAQ,CAAC,GAAG,EAAE,eAAe,KAAK,CAAC;AAEnE,MAAa,UAAA,GAAA,MAAA,aAA+C,EAAE,MAAM,OAAO,KAAK,SAAS,GAAG,SAAS,QAAQ;CAC3G,OAAO,iBAAA,GAAA,kBAAA,KAAC,cAAD;EAAc,KAAKC,wBAAAA,IAAI,IAAI,aAAa,IAAI;GAAE;GAAM;EAAM,CAAC,GAAG,OAAO;EAAG,GAAI;EAAY;CAAM,CAAA;AACvG,CAAC"}
|
package/lib/FileUpload.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 { FileUpload } from "@ark-ui/react";
|
|
8
|
+
import { FileUpload } from "@ark-ui/react/file-upload";
|
|
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";
|
package/lib/FileUpload.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_Text = require("./Text.js");
|
|
2
2
|
const require_Label = require("./Label.js");
|
|
3
|
-
let _ark_ui_react = require("@ark-ui/react");
|
|
4
3
|
let _ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
5
4
|
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
6
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
6
|
let react = require("react");
|
|
7
|
+
let _ark_ui_react_file_upload = require("@ark-ui/react/file-upload");
|
|
8
8
|
//#region src/FileUpload.tsx
|
|
9
9
|
/**
|
|
10
10
|
* Copyright (c) 2024-present, NDLA.
|
|
@@ -14,7 +14,7 @@ let react = require("react");
|
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
const { withProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleContext)((0, _ndla_styled_system_css.sva)({
|
|
17
|
-
slots:
|
|
17
|
+
slots: _ark_ui_react_file_upload.fileUploadAnatomy.keys(),
|
|
18
18
|
base: {
|
|
19
19
|
root: {
|
|
20
20
|
display: "flex",
|
|
@@ -89,17 +89,17 @@ const { withProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleCon
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}));
|
|
92
|
-
const FileUploadHiddenInput =
|
|
93
|
-
const FileUploadContext =
|
|
94
|
-
const FileUploadRoot = withProvider(
|
|
95
|
-
const FileUploadDropzone = withContext(
|
|
96
|
-
const FileUploadTrigger = withContext(
|
|
97
|
-
const FileUploadItemGroup = withContext(
|
|
98
|
-
const FileUploadItemPreview = withContext(
|
|
99
|
-
const FileUploadItem = withContext(
|
|
100
|
-
const FileUploadItemDeleteTrigger = withContext(
|
|
101
|
-
const FileUploadItemPreviewImage = withContext(
|
|
102
|
-
const InternalFileUploadItemName = withContext(
|
|
92
|
+
const FileUploadHiddenInput = _ark_ui_react_file_upload.FileUpload.HiddenInput;
|
|
93
|
+
const FileUploadContext = _ark_ui_react_file_upload.FileUpload.Context;
|
|
94
|
+
const FileUploadRoot = withProvider(_ark_ui_react_file_upload.FileUpload.Root, "root", { baseComponent: true });
|
|
95
|
+
const FileUploadDropzone = withContext(_ark_ui_react_file_upload.FileUpload.Dropzone, "dropzone", { baseComponent: true });
|
|
96
|
+
const FileUploadTrigger = withContext(_ark_ui_react_file_upload.FileUpload.Trigger, "trigger", { baseComponent: true });
|
|
97
|
+
const FileUploadItemGroup = withContext(_ark_ui_react_file_upload.FileUpload.ItemGroup, "itemGroup", { baseComponent: true });
|
|
98
|
+
const FileUploadItemPreview = withContext(_ark_ui_react_file_upload.FileUpload.ItemPreview, "itemPreview", { baseComponent: true });
|
|
99
|
+
const FileUploadItem = withContext(_ark_ui_react_file_upload.FileUpload.Item, "item", { baseComponent: true });
|
|
100
|
+
const FileUploadItemDeleteTrigger = withContext(_ark_ui_react_file_upload.FileUpload.ItemDeleteTrigger, "itemDeleteTrigger", { baseComponent: true });
|
|
101
|
+
const FileUploadItemPreviewImage = withContext(_ark_ui_react_file_upload.FileUpload.ItemPreviewImage, "itemPreviewImage", { baseComponent: true });
|
|
102
|
+
const InternalFileUploadItemName = withContext(_ark_ui_react_file_upload.FileUpload.ItemName, "itemName", { baseComponent: true });
|
|
103
103
|
const FileUploadItemName = (0, react.forwardRef)(({ textStyle = "label.medium", fontWeight = "bold", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
104
104
|
textStyle,
|
|
105
105
|
fontWeight,
|
|
@@ -108,7 +108,7 @@ const FileUploadItemName = (0, react.forwardRef)(({ textStyle = "label.medium",
|
|
|
108
108
|
ref,
|
|
109
109
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalFileUploadItemName, {})
|
|
110
110
|
}));
|
|
111
|
-
const InternalFileUploadItemSizeText = withContext(
|
|
111
|
+
const InternalFileUploadItemSizeText = withContext(_ark_ui_react_file_upload.FileUpload.ItemSizeText, "itemSizeText", { baseComponent: true });
|
|
112
112
|
const FileUploadItemSizeText = (0, react.forwardRef)(({ textStyle = "label.small", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
113
113
|
textStyle,
|
|
114
114
|
ref,
|
|
@@ -116,7 +116,7 @@ const FileUploadItemSizeText = (0, react.forwardRef)(({ textStyle = "label.small
|
|
|
116
116
|
...props,
|
|
117
117
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalFileUploadItemSizeText, {})
|
|
118
118
|
}));
|
|
119
|
-
const InternalFileUploadLabel = withContext(
|
|
119
|
+
const InternalFileUploadLabel = withContext(_ark_ui_react_file_upload.FileUpload.Label, "label");
|
|
120
120
|
const FileUploadLabel = (0, react.forwardRef)(({ textStyle = "label.medium", fontWeight = "light", children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalFileUploadLabel, {
|
|
121
121
|
ref,
|
|
122
122
|
asChild: true,
|
package/lib/FileUpload.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUpload.js","names":["fileUploadAnatomy","FileUpload","Text","Label"],"sources":["../src/FileUpload.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 { FileUpload, fileUploadAnatomy } from \"@ark-ui/react\";\nimport { type RecipeVariantProps, sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef, type RefAttributes } from \"react\";\nimport { Label } from \"./Label\";\nimport { type TextProps, Text } from \"./Text\";\n\nconst fileUploadRecipe = sva({\n slots: fileUploadAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n minHeight: \"100%\",\n },\n dropzone: {\n display: \"flex\",\n gap: \"small\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: \"4xlarge\",\n borderRadius: \"xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n transitionProperty: \"border, border-color\",\n transitionTimingFunction: \"default\",\n transitionDuration: \"normal\",\n _hover: {\n borderStyle: \"dashed\",\n borderColor: \"stroke.hover\",\n _disabled: {\n borderStyle: \"solid\",\n borderColor: \"stroke.subtle\",\n },\n },\n },\n itemGroup: {\n paddingBlockStart: \"medium\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n item: {\n width: \"100%\",\n display: \"grid\",\n gridTemplateAreas: `\n \"preview name delete\" \n \"preview size delete\"`,\n gridTemplateColumns: \"auto 1fr auto\",\n gridColumnGap: \"small\",\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n padding: \"xsmall\",\n },\n itemPreview: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"xxlarge\",\n height: \"xxlarge\",\n gridArea: \"preview\",\n },\n itemName: {\n gridArea: \"name\",\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n },\n itemSizeText: {\n gridArea: \"size\",\n },\n itemDeleteTrigger: {\n gridArea: \"delete\",\n alignSelf: \"center\",\n },\n itemPreviewImage: {\n borderRadius: \"xsmall\",\n objectFit: \"cover\",\n width: \"100%\",\n height: \"100%\",\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(fileUploadRecipe);\n\nexport type FileUploadVariantProps = NonNullable<RecipeVariantProps<typeof fileUploadRecipe>>;\n\nexport interface FileUploadRootProps extends FileUpload.RootProps, FileUploadVariantProps {}\n\nexport const FileUploadHiddenInput = FileUpload.HiddenInput;\nexport const FileUploadContext = FileUpload.Context;\n\nexport const FileUploadRoot = withProvider(FileUpload.Root, \"root\", { baseComponent: true });\n\nexport const FileUploadDropzone = withContext(FileUpload.Dropzone, \"dropzone\", { baseComponent: true });\n\nexport const FileUploadTrigger = withContext(FileUpload.Trigger, \"trigger\", { baseComponent: true });\n\nexport const FileUploadItemGroup = withContext(FileUpload.ItemGroup, \"itemGroup\", { baseComponent: true });\n\nexport const FileUploadItemPreview = withContext(FileUpload.ItemPreview, \"itemPreview\", { baseComponent: true });\n\nexport const FileUploadItem = withContext(FileUpload.Item, \"item\", { baseComponent: true });\n\nexport const FileUploadItemDeleteTrigger = withContext(FileUpload.ItemDeleteTrigger, \"itemDeleteTrigger\", {\n baseComponent: true,\n});\n\nexport const FileUploadItemPreviewImage = withContext(FileUpload.ItemPreviewImage, \"itemPreviewImage\", {\n baseComponent: true,\n});\n\nconst InternalFileUploadItemName = withContext(FileUpload.ItemName, \"itemName\", { baseComponent: true });\n\ninterface FileUploadItemNameProps\n extends Omit<FileUpload.ItemNameProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLParagraphElement> {}\n\nexport const FileUploadItemName = forwardRef<HTMLDivElement, FileUploadItemNameProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", ...props }, ref) => (\n <Text textStyle={textStyle} fontWeight={fontWeight} asChild {...props} ref={ref}>\n {/* Do not use children here whatsoever. The component falls back to the file name only if no children are passed in. It should be up to the consumer if they want to pass in children. */}\n <InternalFileUploadItemName />\n </Text>\n ),\n);\n\nconst InternalFileUploadItemSizeText = withContext(FileUpload.ItemSizeText, \"itemSizeText\", { baseComponent: true });\n\ninterface FileUploadItemSizeTextProps\n extends Omit<FileUpload.ItemSizeTextProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLParagraphElement> {}\n\nexport const FileUploadItemSizeText = forwardRef<HTMLDivElement, FileUploadItemSizeTextProps>(\n ({ textStyle = \"label.small\", ...props }, ref) => (\n <Text textStyle={textStyle} ref={ref} asChild {...props}>\n <InternalFileUploadItemSizeText />\n </Text>\n ),\n);\n\nconst InternalFileUploadLabel = withContext(FileUpload.Label, \"label\");\n\ninterface FileUploadLabelProps\n extends Omit<FileUpload.LabelProps, \"color\">, StyledProps, TextProps, RefAttributes<HTMLLabelElement> {}\n\nexport const FileUploadLabel = forwardRef<HTMLLabelElement, FileUploadLabelProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"light\", children, ...props }, ref) => (\n <InternalFileUploadLabel ref={ref} asChild>\n <Label textStyle={textStyle} fontWeight={fontWeight} {...props}>\n {children}\n </Label>\n </InternalFileUploadLabel>\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;;AA+FA,MAAM,EAAE,cAAc,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KA/EO;CAC3B,OAAOA,
|
|
1
|
+
{"version":3,"file":"FileUpload.js","names":["fileUploadAnatomy","FileUpload","Text","Label"],"sources":["../src/FileUpload.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 { FileUpload, fileUploadAnatomy } from \"@ark-ui/react/file-upload\";\nimport { type RecipeVariantProps, sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef, type RefAttributes } from \"react\";\nimport { Label } from \"./Label\";\nimport { type TextProps, Text } from \"./Text\";\n\nconst fileUploadRecipe = sva({\n slots: fileUploadAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n minHeight: \"100%\",\n },\n dropzone: {\n display: \"flex\",\n gap: \"small\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: \"4xlarge\",\n borderRadius: \"xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n transitionProperty: \"border, border-color\",\n transitionTimingFunction: \"default\",\n transitionDuration: \"normal\",\n _hover: {\n borderStyle: \"dashed\",\n borderColor: \"stroke.hover\",\n _disabled: {\n borderStyle: \"solid\",\n borderColor: \"stroke.subtle\",\n },\n },\n },\n itemGroup: {\n paddingBlockStart: \"medium\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n item: {\n width: \"100%\",\n display: \"grid\",\n gridTemplateAreas: `\n \"preview name delete\" \n \"preview size delete\"`,\n gridTemplateColumns: \"auto 1fr auto\",\n gridColumnGap: \"small\",\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n padding: \"xsmall\",\n },\n itemPreview: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"xxlarge\",\n height: \"xxlarge\",\n gridArea: \"preview\",\n },\n itemName: {\n gridArea: \"name\",\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n },\n itemSizeText: {\n gridArea: \"size\",\n },\n itemDeleteTrigger: {\n gridArea: \"delete\",\n alignSelf: \"center\",\n },\n itemPreviewImage: {\n borderRadius: \"xsmall\",\n objectFit: \"cover\",\n width: \"100%\",\n height: \"100%\",\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(fileUploadRecipe);\n\nexport type FileUploadVariantProps = NonNullable<RecipeVariantProps<typeof fileUploadRecipe>>;\n\nexport interface FileUploadRootProps extends FileUpload.RootProps, FileUploadVariantProps {}\n\nexport const FileUploadHiddenInput = FileUpload.HiddenInput;\nexport const FileUploadContext = FileUpload.Context;\n\nexport const FileUploadRoot = withProvider(FileUpload.Root, \"root\", { baseComponent: true });\n\nexport const FileUploadDropzone = withContext(FileUpload.Dropzone, \"dropzone\", { baseComponent: true });\n\nexport const FileUploadTrigger = withContext(FileUpload.Trigger, \"trigger\", { baseComponent: true });\n\nexport const FileUploadItemGroup = withContext(FileUpload.ItemGroup, \"itemGroup\", { baseComponent: true });\n\nexport const FileUploadItemPreview = withContext(FileUpload.ItemPreview, \"itemPreview\", { baseComponent: true });\n\nexport const FileUploadItem = withContext(FileUpload.Item, \"item\", { baseComponent: true });\n\nexport const FileUploadItemDeleteTrigger = withContext(FileUpload.ItemDeleteTrigger, \"itemDeleteTrigger\", {\n baseComponent: true,\n});\n\nexport const FileUploadItemPreviewImage = withContext(FileUpload.ItemPreviewImage, \"itemPreviewImage\", {\n baseComponent: true,\n});\n\nconst InternalFileUploadItemName = withContext(FileUpload.ItemName, \"itemName\", { baseComponent: true });\n\ninterface FileUploadItemNameProps\n extends Omit<FileUpload.ItemNameProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLParagraphElement> {}\n\nexport const FileUploadItemName = forwardRef<HTMLDivElement, FileUploadItemNameProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", ...props }, ref) => (\n <Text textStyle={textStyle} fontWeight={fontWeight} asChild {...props} ref={ref}>\n {/* Do not use children here whatsoever. The component falls back to the file name only if no children are passed in. It should be up to the consumer if they want to pass in children. */}\n <InternalFileUploadItemName />\n </Text>\n ),\n);\n\nconst InternalFileUploadItemSizeText = withContext(FileUpload.ItemSizeText, \"itemSizeText\", { baseComponent: true });\n\ninterface FileUploadItemSizeTextProps\n extends Omit<FileUpload.ItemSizeTextProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLParagraphElement> {}\n\nexport const FileUploadItemSizeText = forwardRef<HTMLDivElement, FileUploadItemSizeTextProps>(\n ({ textStyle = \"label.small\", ...props }, ref) => (\n <Text textStyle={textStyle} ref={ref} asChild {...props}>\n <InternalFileUploadItemSizeText />\n </Text>\n ),\n);\n\nconst InternalFileUploadLabel = withContext(FileUpload.Label, \"label\");\n\ninterface FileUploadLabelProps\n extends Omit<FileUpload.LabelProps, \"color\">, StyledProps, TextProps, RefAttributes<HTMLLabelElement> {}\n\nexport const FileUploadLabel = forwardRef<HTMLLabelElement, FileUploadLabelProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"light\", children, ...props }, ref) => (\n <InternalFileUploadLabel ref={ref} asChild>\n <Label textStyle={textStyle} fontWeight={fontWeight} {...props}>\n {children}\n </Label>\n </InternalFileUploadLabel>\n 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,yBAAD;CAA8B;CAAK,SAAA;WACjC,iBAAA,GAAA,kBAAA,KAACE,cAAAA,OAAD;EAAkB;EAAuB;EAAY,GAAI;EACtD;CACI,CAAA;AACgB,CAAA,CAE7B"}
|
package/lib/FramedContent.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, RecipeVariantProps } from "@ndla/styled-system/types";
|
|
10
10
|
declare const framedContentRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
|
|
11
11
|
colorTheme: {
|
package/lib/FramedContent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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");
|
|
4
|
+
let _ark_ui_react_factory = require("@ark-ui/react/factory");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
//#region src/FramedContent.tsx
|
|
7
7
|
/**
|
|
@@ -35,7 +35,7 @@ const framedContentRecipe = (0, _ndla_styled_system_css.cva)({
|
|
|
35
35
|
} },
|
|
36
36
|
defaultVariants: { colorTheme: "neutral" }
|
|
37
37
|
});
|
|
38
|
-
const StyledFramedContent = (0, _ndla_styled_system_jsx.styled)(
|
|
38
|
+
const StyledFramedContent = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.div, {}, { baseComponent: true });
|
|
39
39
|
const FramedContent = (0, react.forwardRef)(({ colorTheme, css: cssProp, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledFramedContent, {
|
|
40
40
|
"data-embed-type": "framed-content",
|
|
41
41
|
css: _ndla_styled_system_css.css.raw(framedContentRecipe.raw({ colorTheme }), cssProp),
|
package/lib/FramedContent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FramedContent.js","names":["ark","css"],"sources":["../src/FramedContent.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 { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst framedContentRecipe = cva({\n base: {\n padding: \"medium\",\n border: \"1px solid\",\n borderRadius: \"small\",\n clear: \"both\",\n overflow: \"hidden\",\n },\n variants: {\n colorTheme: {\n neutral: {\n backgroundColor: \"surface.default\",\n borderColor: \"stroke.subtle\",\n },\n brand1: {\n backgroundColor: \"surface.brand.1.subtle\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n backgroundColor: \"surface.brand.2.subtle\",\n borderColor: \"surface.brand.2.strong\",\n },\n },\n },\n defaultVariants: {\n colorTheme: \"neutral\",\n },\n});\n\nexport type FramedContentVariantProps = NonNullable<RecipeVariantProps<typeof framedContentRecipe>>;\n\nexport interface FramedContentProps extends HTMLArkProps<\"div\">, StyledProps, FramedContentVariantProps {}\n\nconst StyledFramedContent = styled(ark.div, {}, { baseComponent: true });\n\nexport const FramedContent = forwardRef<HTMLDivElement, FramedContentProps>(\n ({ colorTheme, css: cssProp, ...props }, ref) => (\n <StyledFramedContent\n data-embed-type=\"framed-content\"\n css={css.raw(framedContentRecipe.raw({ colorTheme }), cssProp)}\n {...props}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,uBAAA,GAAA,wBAAA,KAA0B;CAC9B,MAAM;EACJ,SAAS;EACT,QAAQ;EACR,cAAc;EACd,OAAO;EACP,UAAU;CACZ;CACA,UAAU,EACR,YAAY;EACV,SAAS;GACP,iBAAiB;GACjB,aAAa;EACf;EACA,QAAQ;GACN,iBAAiB;GACjB,aAAa;EACf;EACA,QAAQ;GACN,iBAAiB;GACjB,aAAa;EACf;CACF,EACF;CACA,iBAAiB,EACf,YAAY,UACd;AACF,CAAC;AAMD,MAAM,uBAAA,GAAA,wBAAA,QAA6BA,
|
|
1
|
+
{"version":3,"file":"FramedContent.js","names":["ark","css"],"sources":["../src/FramedContent.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 { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst framedContentRecipe = cva({\n base: {\n padding: \"medium\",\n border: \"1px solid\",\n borderRadius: \"small\",\n clear: \"both\",\n overflow: \"hidden\",\n },\n variants: {\n colorTheme: {\n neutral: {\n backgroundColor: \"surface.default\",\n borderColor: \"stroke.subtle\",\n },\n brand1: {\n backgroundColor: \"surface.brand.1.subtle\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n backgroundColor: \"surface.brand.2.subtle\",\n borderColor: \"surface.brand.2.strong\",\n },\n },\n },\n defaultVariants: {\n colorTheme: \"neutral\",\n },\n});\n\nexport type FramedContentVariantProps = NonNullable<RecipeVariantProps<typeof framedContentRecipe>>;\n\nexport interface FramedContentProps extends HTMLArkProps<\"div\">, StyledProps, FramedContentVariantProps {}\n\nconst StyledFramedContent = styled(ark.div, {}, { baseComponent: true });\n\nexport const FramedContent = forwardRef<HTMLDivElement, FramedContentProps>(\n ({ colorTheme, css: cssProp, ...props }, ref) => (\n <StyledFramedContent\n data-embed-type=\"framed-content\"\n css={css.raw(framedContentRecipe.raw({ colorTheme }), cssProp)}\n {...props}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,uBAAA,GAAA,wBAAA,KAA0B;CAC9B,MAAM;EACJ,SAAS;EACT,QAAQ;EACR,cAAc;EACd,OAAO;EACP,UAAU;CACZ;CACA,UAAU,EACR,YAAY;EACV,SAAS;GACP,iBAAiB;GACjB,aAAa;EACf;EACA,QAAQ;GACN,iBAAiB;GACjB,aAAa;EACf;EACA,QAAQ;GACN,iBAAiB;GACjB,aAAa;EACf;CACF,EACF;CACA,iBAAiB,EACf,YAAY,UACd;AACF,CAAC;AAMD,MAAM,uBAAA,GAAA,wBAAA,QAA6BA,sBAAAA,IAAI,KAAK,CAAC,GAAG,EAAE,eAAe,KAAK,CAAC;AAEvE,MAAa,iBAAA,GAAA,MAAA,aACV,EAAE,YAAY,KAAK,SAAS,GAAG,SAAS,QACvC,iBAAA,GAAA,kBAAA,KAAC,qBAAD;CACE,mBAAgB;CAChB,KAAKC,wBAAAA,IAAI,IAAI,oBAAoB,IAAI,EAAE,WAAW,CAAC,GAAG,OAAO;CAC7D,GAAI;CACC;AACN,CAAA,CAEL"}
|
package/lib/Hero.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 RecipeVariantProps } from "@ndla/styled-system/css";
|
|
10
10
|
import type { StyledProps } from "@ndla/styled-system/types";
|
|
11
11
|
declare const heroRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"root" | "background" | "content", {
|
|
@@ -88,7 +88,7 @@ export type HeroVariantProps = NonNullable<RecipeVariantProps<typeof heroRecipe>
|
|
|
88
88
|
export type HeroVariant = NonNullable<HeroVariantProps>["variant"];
|
|
89
89
|
export interface HeroProps extends HTMLArkProps<"div">, StyledProps, HeroVariantProps {
|
|
90
90
|
}
|
|
91
|
-
export declare const Hero: import("@ndla/styled-system/jsx").StyleContextProvider<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react").PolymorphicProps>, import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"root" | "background" | "content", {
|
|
91
|
+
export declare const Hero: import("@ndla/styled-system/jsx").StyleContextProvider<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react/factory").PolymorphicProps>, import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"root" | "background" | "content", {
|
|
92
92
|
absolute: {
|
|
93
93
|
true: {
|
|
94
94
|
background: {
|
|
@@ -166,8 +166,8 @@ export declare const Hero: import("@ndla/styled-system/jsx").StyleContextProvide
|
|
|
166
166
|
}>>;
|
|
167
167
|
export interface HeroBackgroundProps extends HTMLArkProps<"div">, StyledProps {
|
|
168
168
|
}
|
|
169
|
-
export declare const HeroBackground: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react").PolymorphicProps>>;
|
|
169
|
+
export declare const HeroBackground: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react/factory").PolymorphicProps>>;
|
|
170
170
|
export interface HeroContentProps extends HTMLArkProps<"div">, StyledProps {
|
|
171
171
|
}
|
|
172
|
-
export declare const HeroContent: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react").PolymorphicProps>>;
|
|
172
|
+
export declare const HeroContent: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react/factory").PolymorphicProps>>;
|
|
173
173
|
export {};
|
package/lib/Hero.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
let _ark_ui_react = require("@ark-ui/react");
|
|
2
1
|
let _ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
2
|
+
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
3
|
+
let _ark_ui_react_factory = require("@ark-ui/react/factory");
|
|
3
4
|
//#region src/Hero.tsx
|
|
4
5
|
/**
|
|
5
6
|
* Copyright (c) 2024-present, NDLA.
|
|
@@ -8,7 +9,7 @@ let _ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
|
8
9
|
* LICENSE file in the root directory of this source tree.
|
|
9
10
|
*
|
|
10
11
|
*/
|
|
11
|
-
const { withProvider, withContext } = (0,
|
|
12
|
+
const { withProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleContext)((0, _ndla_styled_system_css.sva)({
|
|
12
13
|
slots: [
|
|
13
14
|
"root",
|
|
14
15
|
"background",
|
|
@@ -62,9 +63,9 @@ const { withProvider, withContext } = (0, require("@ndla/styled-system/jsx").cre
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
}));
|
|
65
|
-
const Hero = withProvider(
|
|
66
|
-
const HeroBackground = withContext(
|
|
67
|
-
const HeroContent = withContext(
|
|
66
|
+
const Hero = withProvider(_ark_ui_react_factory.ark.div, "root", { baseComponent: true });
|
|
67
|
+
const HeroBackground = withContext(_ark_ui_react_factory.ark.div, "background", { baseComponent: true });
|
|
68
|
+
const HeroContent = withContext(_ark_ui_react_factory.ark.div, "content", { baseComponent: true });
|
|
68
69
|
//#endregion
|
|
69
70
|
exports.Hero = Hero;
|
|
70
71
|
exports.HeroBackground = HeroBackground;
|
package/lib/Hero.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hero.js","names":["ark"],"sources":["../src/Hero.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 { type RecipeVariantProps, sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\n\nconst heroRecipe = sva({\n slots: [\"root\", \"background\", \"content\"],\n base: {\n root: {\n width: \"100%\",\n position: \"relative\",\n },\n background: {\n height: \"350px\",\n width: \"100%\",\n zIndex: \"hide\",\n overflow: \"hidden\",\n clipPath: \"polygon(0 0, 100% 0, 100% calc(100% - 5vw), 0 100%)\",\n _print: {\n background: \"none\",\n },\n },\n content: {\n display: \"flex\",\n flexWrap: \"wrap\",\n alignItems: \"flex-end\",\n paddingBlock: \"xsmall\",\n tablet: {\n paddingBlockStart: \"xxlarge\",\n },\n },\n },\n defaultVariants: {\n variant: \"primary\",\n absolute: true,\n },\n variants: {\n absolute: {\n true: {\n background: {\n position: \"absolute\",\n },\n },\n },\n variant: {\n primary: {\n background: {\n background: \"primary\",\n },\n content: {\n \"@media not print\": {\n color: \"text.onAction\",\n },\n },\n },\n brand2Bold: {\n background: {\n background: \"surface.brand.2.bold\",\n },\n content: {\n \"@media not print\": {\n color: \"text.onAction\",\n },\n },\n },\n brand2: {\n background: {\n background: \"surface.brand.2\",\n },\n },\n brand2Moderate: {\n background: {\n background: \"surface.brand.2.moderate\",\n },\n },\n brand1: {\n background: {\n background: \"surface.brand.1\",\n },\n },\n brand1Subtle: {\n background: {\n background: \"surface.brand.1.subtle\",\n },\n },\n brand1Moderate: {\n background: {\n background: \"surface.brand.1.moderate\",\n },\n },\n brand3Moderate: {\n background: {\n background: \"surface.brand.3.moderate\",\n },\n },\n brand4Moderate: {\n background: {\n background: \"surface.brand.4.moderate\",\n },\n },\n brand5Moderate: {\n background: {\n background: \"surface.brand.5.moderate\",\n },\n },\n neutral: {\n background: {\n background: \"surface.infoSubtle\",\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(heroRecipe);\n\nexport type HeroVariantProps = NonNullable<RecipeVariantProps<typeof heroRecipe>>;\n\nexport type HeroVariant = NonNullable<HeroVariantProps>[\"variant\"];\n\nexport interface HeroProps extends HTMLArkProps<\"div\">, StyledProps, HeroVariantProps {}\n\nexport const Hero = withProvider(ark.div, \"root\", { baseComponent: true });\n\nexport interface HeroBackgroundProps extends HTMLArkProps<\"div\">, StyledProps {}\n\nexport const HeroBackground = withContext(ark.div, \"background\", { baseComponent: true });\n\nexport interface HeroContentProps extends HTMLArkProps<\"div\">, StyledProps {}\n\nexport const HeroContent = withContext(ark.div, \"content\", { baseComponent: true });\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Hero.js","names":["ark"],"sources":["../src/Hero.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 { type RecipeVariantProps, sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\n\nconst heroRecipe = sva({\n slots: [\"root\", \"background\", \"content\"],\n base: {\n root: {\n width: \"100%\",\n position: \"relative\",\n },\n background: {\n height: \"350px\",\n width: \"100%\",\n zIndex: \"hide\",\n overflow: \"hidden\",\n clipPath: \"polygon(0 0, 100% 0, 100% calc(100% - 5vw), 0 100%)\",\n _print: {\n background: \"none\",\n },\n },\n content: {\n display: \"flex\",\n flexWrap: \"wrap\",\n alignItems: \"flex-end\",\n paddingBlock: \"xsmall\",\n tablet: {\n paddingBlockStart: \"xxlarge\",\n },\n },\n },\n defaultVariants: {\n variant: \"primary\",\n absolute: true,\n },\n variants: {\n absolute: {\n true: {\n background: {\n position: \"absolute\",\n },\n },\n },\n variant: {\n primary: {\n background: {\n background: \"primary\",\n },\n content: {\n \"@media not print\": {\n color: \"text.onAction\",\n },\n },\n },\n brand2Bold: {\n background: {\n background: \"surface.brand.2.bold\",\n },\n content: {\n \"@media not print\": {\n color: \"text.onAction\",\n },\n },\n },\n brand2: {\n background: {\n background: \"surface.brand.2\",\n },\n },\n brand2Moderate: {\n background: {\n background: \"surface.brand.2.moderate\",\n },\n },\n brand1: {\n background: {\n background: \"surface.brand.1\",\n },\n },\n brand1Subtle: {\n background: {\n background: \"surface.brand.1.subtle\",\n },\n },\n brand1Moderate: {\n background: {\n background: \"surface.brand.1.moderate\",\n },\n },\n brand3Moderate: {\n background: {\n background: \"surface.brand.3.moderate\",\n },\n },\n brand4Moderate: {\n background: {\n background: \"surface.brand.4.moderate\",\n },\n },\n brand5Moderate: {\n background: {\n background: \"surface.brand.5.moderate\",\n },\n },\n neutral: {\n background: {\n background: \"surface.infoSubtle\",\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(heroRecipe);\n\nexport type HeroVariantProps = NonNullable<RecipeVariantProps<typeof heroRecipe>>;\n\nexport type HeroVariant = NonNullable<HeroVariantProps>[\"variant\"];\n\nexport interface HeroProps extends HTMLArkProps<\"div\">, StyledProps, HeroVariantProps {}\n\nexport const Hero = withProvider(ark.div, \"root\", { baseComponent: true });\n\nexport interface HeroBackgroundProps extends HTMLArkProps<\"div\">, StyledProps {}\n\nexport const HeroBackground = withContext(ark.div, \"background\", { baseComponent: true });\n\nexport interface HeroContentProps extends HTMLArkProps<\"div\">, StyledProps {}\n\nexport const HeroContent = withContext(ark.div, \"content\", { baseComponent: true });\n"],"mappings":";;;;;;;;;;;AA0HA,MAAM,EAAE,cAAc,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KA7GC;CACrB,O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AAe,KAAK,CAAC"}
|
package/lib/Image.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/Image.tsx
|
|
6
6
|
/**
|
|
@@ -91,7 +91,7 @@ const StyledImage = (0, _ndla_styled_system_jsx.styled)("img", {
|
|
|
91
91
|
rounded: { borderRadius: "xsmall" }
|
|
92
92
|
} }
|
|
93
93
|
});
|
|
94
|
-
const StyledFallbackElement = (0, _ndla_styled_system_jsx.styled)(
|
|
94
|
+
const StyledFallbackElement = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.div, { base: {
|
|
95
95
|
display: "flex",
|
|
96
96
|
alignItems: "center",
|
|
97
97
|
justifyContent: "center"
|
package/lib/Image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","names":["styled","ark"],"sources":["../src/Image.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 { ark } from \"@ark-ui/react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, StyledVariantProps } from \"@ndla/styled-system/types\";\nimport type { ImageVariantDTO, ImageVariantSize } from \"@ndla/types-backend/image-api\";\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef, useEffect, useState } from \"react\";\n\nexport interface ImageCrop {\n startX: number;\n startY: number;\n endX: number;\n endY: number;\n}\n\nexport interface ImageFocalPoint {\n x: number;\n y: number;\n}\n\ninterface SrcQueryStringOptions {\n width?: number;\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n}\n\nexport const makeSrcQueryString = ({ width, crop, focalPoint, imageLanguage }: SrcQueryStringOptions) => {\n const params = [];\n if (width) {\n params.push(`width=${width}`);\n }\n if (crop) {\n params.push(`cropStartX=${crop.startX}&cropEndX=${crop.endX}&cropStartY=${crop.startY}&cropEndY=${crop.endY}`);\n }\n if (focalPoint) {\n params.push(`focalX=${focalPoint.x}&focalY=${focalPoint.y}`);\n }\n if (imageLanguage) {\n params.push(`language=${imageLanguage}`);\n }\n return params.join(\"&\");\n};\n\ninterface SrcSetOptions {\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n src?: string;\n}\n\nexport const VAR_WIDTHS: Record<ImageVariantSize, number> = {\n icon: 240,\n xsmall: 480,\n small: 800,\n medium: 1080,\n large: 1440,\n xlarge: 1920,\n xxlarge: 2560,\n};\n\nconst IMAGE_WIDTHS = [2720, 2080, 1760, 1440, 1120, 1000, 960, 800, 640, 480, 320, 240, 180];\n\nexport const getVariantSrcSet = (variants: ImageVariantDTO[]) => {\n return variants\n .map((variant) => {\n return `${variant.variantUrl} ${VAR_WIDTHS[variant.size]}w`;\n })\n .join(\", \");\n};\n\nexport const getVariantSizes = (variants: ImageVariantDTO[]) => {\n return variants\n .map((variant, i) => {\n if (i === variants.length - 1) {\n return `${VAR_WIDTHS[variant.size]}px`;\n }\n return `(max-width: ${VAR_WIDTHS[variant.size]}px) ${VAR_WIDTHS[variant.size]}px`;\n })\n .join(\", \");\n};\n\nexport const getSrcSet = ({ src, crop, focalPoint, imageLanguage }: SrcSetOptions) => {\n if (!src) return undefined;\n return IMAGE_WIDTHS.map((width) => {\n const queryString = makeSrcQueryString({ width, crop, focalPoint, imageLanguage });\n const query = queryString.length ? `?${queryString}` : \"\";\n return `${src}${query} ${width}w`;\n }).join(\", \");\n};\n\nconst FALLBACK_WIDTH = 1024;\n\nconst FALLBACK_SIZES = \"(min-width: 1024px) 1024px, 100vw\";\n\nexport interface PictureProps extends StyledProps, ComponentPropsWithRef<\"picture\"> {\n src: string;\n sizes?: string;\n contentType?: string;\n srcSet?: string;\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n}\n\nexport const Picture = forwardRef<HTMLPictureElement, PictureProps>(\n (\n {\n children,\n srcSet: srcSetProp,\n crop,\n focalPoint,\n src,\n imageLanguage,\n contentType,\n sizes = FALLBACK_SIZES,\n ...props\n },\n ref,\n ) => {\n const srcSet = srcSetProp ?? getSrcSet({ src, crop, focalPoint, imageLanguage });\n\n return (\n <styled.picture {...props} ref={ref}>\n {contentType !== \"image/gif\" && <source type={contentType} srcSet={srcSet} sizes={sizes} />}\n {children}\n </styled.picture>\n );\n },\n);\n\nconst StyledImage = styled(\"img\", {\n defaultVariants: { variant: \"regular\" },\n variants: {\n variant: {\n regular: {},\n rounded: {\n borderRadius: \"xsmall\",\n },\n },\n },\n});\n\nconst StyledFallbackElement = styled(\n ark.div,\n {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n },\n { baseComponent: true },\n);\n\ntype ImageVariantProps = StyledVariantProps<typeof StyledImage>;\n\nexport interface ImgProps extends StyledProps, ComponentPropsWithRef<\"img\">, ImageVariantProps {\n alt: string;\n src: string;\n fallbackWidth?: number;\n contentType?: string;\n crop?: ImageCrop;\n imageLanguage?: string;\n focalPoint?: ImageFocalPoint;\n}\n\nexport const Img = forwardRef<HTMLImageElement, ImgProps>(\n ({ fallbackWidth = FALLBACK_WIDTH, crop, focalPoint, imageLanguage, contentType, src, alt, ...props }, ref) => {\n const queryString = makeSrcQueryString({ width: fallbackWidth, crop, focalPoint, imageLanguage });\n const srcWithParms = queryString ? `${src}?${queryString}` : src;\n return <StyledImage alt={alt} src={contentType === \"image/gif\" ? src : srcWithParms} {...props} ref={ref} />;\n },\n);\n\nexport interface ImageProps extends StyledProps, ComponentPropsWithRef<\"img\">, ImageVariantProps {\n alt: string;\n src?: string;\n sizes?: string;\n fallbackWidth?: number;\n contentType?: string;\n imageLanguage?: string;\n crop?: ImageCrop;\n fallbackElement?: ReactNode;\n focalPoint?: ImageFocalPoint;\n variants?: ImageVariantDTO[];\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(\n (\n {\n srcSet: srcSetProp,\n crop,\n focalPoint,\n src,\n contentType,\n imageLanguage,\n fallbackWidth = FALLBACK_WIDTH,\n sizes: sizesProp,\n alt,\n fallbackElement,\n variants,\n ...props\n },\n ref,\n ) => {\n const [hasError, setHasError] = useState(false);\n\n useEffect(() => {\n setHasError(false);\n }, [src, srcSetProp, sizesProp, variants]);\n\n if (!src?.length && !variants?.length && fallbackElement) {\n return (\n <StyledFallbackElement {...props} ref={ref}>\n {fallbackElement}\n </StyledFallbackElement>\n );\n }\n\n const queryString = makeSrcQueryString({ width: fallbackWidth, crop, focalPoint, imageLanguage });\n const fallbackSrc = src && queryString ? `${src}?${queryString}` : src;\n\n return (\n <picture>\n {!!variants?.length && !crop && !focalPoint && contentType !== \"image/gif\" && (\n <source\n type={\"image/webp\"}\n srcSet={getVariantSrcSet(variants)}\n sizes={sizesProp ?? getVariantSizes(variants)}\n />\n )}\n {contentType !== \"image/gif\" && (\n <source\n type={contentType}\n srcSet={getSrcSet({ src, crop, focalPoint, imageLanguage })}\n sizes={sizesProp ?? FALLBACK_SIZES}\n />\n )}\n <StyledImage\n alt={alt}\n src={contentType === \"image/gif\" ? src : fallbackSrc}\n {...props}\n ref={ref}\n data-error={hasError ? \"\" : undefined}\n onError={(e) => {\n setHasError(true);\n props.onError?.(e);\n }}\n onLoad={(e) => {\n setHasError(false);\n props.onLoad?.(e);\n }}\n />\n </picture>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;AAiCA,MAAa,sBAAsB,EAAE,OAAO,MAAM,YAAY,oBAA2C;CACvG,MAAM,SAAS,CAAC;CAChB,IAAI,OACF,OAAO,KAAK,SAAS,OAAO;CAE9B,IAAI,MACF,OAAO,KAAK,cAAc,KAAK,OAAO,YAAY,KAAK,KAAK,cAAc,KAAK,OAA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U,iBACvC,OACE,iBAAA,GAAA,kBAAA,KAAC,uBAAD;EAAuB,GAAI;EAAY;YACpC;CACoB,CAAA;CAI3B,MAAM,cAAc,mBAAmB;EAAE,OAAO;EAAe;EAAM;EAAY;CAAc,CAAC;CAChG,MAAM,cAAc,OAAO,cAAc,GAAG,IAAI,GAAG,gBAAgB;CAEnE,OACE,iBAAA,GAAA,kBAAA,MAAC,WAAD,EAAA,UAAA;EACG,CAAC,CAAC,UAAU,UAAU,CAAC,QAAQ,CAAC,cAAc,gBAAgB,eAC7D,iBAAA,GAAA,kBAAA,KAAC,UAAD;GACE,MAAM;GACN,QAAQ,iBAAiB,QAAQ;GACjC,OAAO,aAAa,gBAAgB,QAAQ;EAC7C,CAAA;EAEF,gBAAgB,eACf,iBAAA,GAAA,kBAAA,KAAC,UAAD;GACE,MAAM;GACN,QAAQ,UAAU;IAAE;IAAK;IAAM;IAAY;GAAc,CAAC;GAC1D,OAAO,aAAa;EACrB,CAAA;EAEH,iBAAA,GAAA,kBAAA,KAAC,aAAD;GACO;GACL,KAAK,gBAAgB,cAAc,MAAM;GACzC,GAAI;GACC;GACL,cAAY,WAAW,KAAK,KAAA;GAC5B,UAAU,MAAM;IACd,YAAY,IAAI;IAChB,MAAM,UAAU,CAAC;GACnB;GACA,SAAS,MAAM;IACb,YAAY,KAAK;IACjB,MAAM,SAAS,CAAC;GAClB;EACD,CAAA;CACM,EAAA,CAAA;AAEb,CACF"}
|
|
1
|
+
{"version":3,"file":"Image.js","names":["styled","ark"],"sources":["../src/Image.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 { ark } from \"@ark-ui/react/factory\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, StyledVariantProps } from \"@ndla/styled-system/types\";\nimport type { ImageVariantDTO, ImageVariantSize } from \"@ndla/types-backend/image-api\";\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef, useEffect, useState } from \"react\";\n\nexport interface ImageCrop {\n startX: number;\n startY: number;\n endX: number;\n endY: number;\n}\n\nexport interface ImageFocalPoint {\n x: number;\n y: number;\n}\n\ninterface SrcQueryStringOptions {\n width?: number;\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n}\n\nexport const makeSrcQueryString = ({ width, crop, focalPoint, imageLanguage }: SrcQueryStringOptions) => {\n const params = [];\n if (width) {\n params.push(`width=${width}`);\n }\n if (crop) {\n params.push(`cropStartX=${crop.startX}&cropEndX=${crop.endX}&cropStartY=${crop.startY}&cropEndY=${crop.endY}`);\n }\n if (focalPoint) {\n params.push(`focalX=${focalPoint.x}&focalY=${focalPoint.y}`);\n }\n if (imageLanguage) {\n params.push(`language=${imageLanguage}`);\n }\n return params.join(\"&\");\n};\n\ninterface SrcSetOptions {\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n src?: string;\n}\n\nexport const VAR_WIDTHS: Record<ImageVariantSize, number> = {\n icon: 240,\n xsmall: 480,\n small: 800,\n medium: 1080,\n large: 1440,\n xlarge: 1920,\n xxlarge: 2560,\n};\n\nconst IMAGE_WIDTHS = [2720, 2080, 1760, 1440, 1120, 1000, 960, 800, 640, 480, 320, 240, 180];\n\nexport const getVariantSrcSet = (variants: ImageVariantDTO[]) => {\n return variants\n .map((variant) => {\n return `${variant.variantUrl} ${VAR_WIDTHS[variant.size]}w`;\n })\n .join(\", \");\n};\n\nexport const getVariantSizes = (variants: ImageVariantDTO[]) => {\n return variants\n .map((variant, i) => {\n if (i === variants.length - 1) {\n return `${VAR_WIDTHS[variant.size]}px`;\n }\n return `(max-width: ${VAR_WIDTHS[variant.size]}px) ${VAR_WIDTHS[variant.size]}px`;\n })\n .join(\", \");\n};\n\nexport const getSrcSet = ({ src, crop, focalPoint, imageLanguage }: SrcSetOptions) => {\n if (!src) return undefined;\n return IMAGE_WIDTHS.map((width) => {\n const queryString = makeSrcQueryString({ width, crop, focalPoint, imageLanguage });\n const query = queryString.length ? `?${queryString}` : \"\";\n return `${src}${query} ${width}w`;\n }).join(\", \");\n};\n\nconst FALLBACK_WIDTH = 1024;\n\nconst FALLBACK_SIZES = \"(min-width: 1024px) 1024px, 100vw\";\n\nexport interface PictureProps extends StyledProps, ComponentPropsWithRef<\"picture\"> {\n src: string;\n sizes?: string;\n contentType?: string;\n srcSet?: string;\n crop?: ImageCrop;\n focalPoint?: ImageFocalPoint;\n imageLanguage?: string;\n}\n\nexport const Picture = forwardRef<HTMLPictureElement, PictureProps>(\n (\n {\n children,\n srcSet: srcSetProp,\n crop,\n focalPoint,\n src,\n imageLanguage,\n contentType,\n sizes = FALLBACK_SIZES,\n ...props\n },\n ref,\n ) => {\n const srcSet = srcSetProp ?? getSrcSet({ src, crop, focalPoint, imageLanguage });\n\n return (\n <styled.picture {...props} ref={ref}>\n {contentType !== \"image/gif\" && <source type={contentType} srcSet={srcSet} sizes={sizes} />}\n {children}\n </styled.picture>\n );\n },\n);\n\nconst StyledImage = styled(\"img\", {\n defaultVariants: { variant: \"regular\" },\n variants: {\n variant: {\n regular: {},\n rounded: {\n borderRadius: \"xsmall\",\n },\n },\n },\n});\n\nconst StyledFallbackElement = styled(\n ark.div,\n {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n },\n { baseComponent: true },\n);\n\ntype ImageVariantProps = StyledVariantProps<typeof StyledImage>;\n\nexport interface ImgProps extends StyledProps, ComponentPropsWithRef<\"img\">, ImageVariantProps {\n alt: string;\n src: string;\n fallbackWidth?: number;\n contentType?: string;\n crop?: ImageCrop;\n imageLanguage?: string;\n focalPoint?: ImageFocalPoint;\n}\n\nexport const Img = forwardRef<HTMLImageElement, ImgProps>(\n ({ fallbackWidth = FALLBACK_WIDTH, crop, focalPoint, imageLanguage, contentType, src, alt, ...props }, ref) => {\n const queryString = makeSrcQueryString({ width: fallbackWidth, crop, focalPoint, imageLanguage });\n const srcWithParms = queryString ? `${src}?${queryString}` : src;\n return <StyledImage alt={alt} src={contentType === \"image/gif\" ? src : srcWithParms} {...props} ref={ref} />;\n },\n);\n\nexport interface ImageProps extends StyledProps, ComponentPropsWithRef<\"img\">, ImageVariantProps {\n alt: string;\n src?: string;\n sizes?: string;\n fallbackWidth?: number;\n contentType?: string;\n imageLanguage?: string;\n crop?: ImageCrop;\n fallbackElement?: ReactNode;\n focalPoint?: ImageFocalPoint;\n variants?: ImageVariantDTO[];\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(\n (\n {\n srcSet: srcSetProp,\n crop,\n focalPoint,\n src,\n contentType,\n imageLanguage,\n fallbackWidth = FALLBACK_WIDTH,\n sizes: sizesProp,\n alt,\n fallbackElement,\n variants,\n ...props\n },\n ref,\n ) => {\n const [hasError, setHasError] = useState(false);\n\n useEffect(() => {\n setHasError(false);\n }, [src, srcSetProp, sizesProp, variants]);\n\n if (!src?.length && !variants?.length && fallbackElement) {\n return (\n <StyledFallbackElement {...props} ref={ref}>\n {fallbackElement}\n </StyledFallbackElement>\n );\n }\n\n const queryString = makeSrcQueryString({ width: fallbackWidth, crop, focalPoint, imageLanguage });\n const fallbackSrc = src && queryString ? `${src}?${queryString}` : src;\n\n return (\n <picture>\n {!!variants?.length && !crop && !focalPoint && contentType !== \"image/gif\" && (\n <source\n type={\"image/webp\"}\n srcSet={getVariantSrcSet(variants)}\n sizes={sizesProp ?? getVariantSizes(variants)}\n />\n )}\n {contentType !== \"image/gif\" && (\n <source\n type={contentType}\n srcSet={getSrcSet({ src, crop, focalPoint, imageLanguage })}\n sizes={sizesProp ?? FALLBACK_SIZES}\n />\n )}\n <StyledImage\n alt={alt}\n src={contentType === \"image/gif\" ? src : fallbackSrc}\n {...props}\n ref={ref}\n data-error={hasError ? \"\" : undefined}\n onError={(e) => {\n setHasError(true);\n props.onError?.(e);\n }}\n onLoad={(e) => {\n setHasError(false);\n props.onLoad?.(e);\n }}\n />\n </picture>\n );\n },\n);\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*/
|
|
8
|
-
import { type HTMLArkProps } from "@ark-ui/react";
|
|
8
|
+
import { type HTMLArkProps } from "@ark-ui/react/factory";
|
|
9
9
|
import type { RecipeVariantProps, StyledProps } from "@ndla/styled-system/types";
|
|
10
10
|
interface InputContainerProps extends HTMLArkProps<"div">, StyledProps {
|
|
11
11
|
}
|
package/lib/Input.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");
|
|
4
|
+
let _ark_ui_react_factory = require("@ark-ui/react/factory");
|
|
5
5
|
let react = require("react");
|
|
6
|
+
let _ark_ui_react_field = require("@ark-ui/react/field");
|
|
6
7
|
let _ndla_util = require("@ndla/util");
|
|
7
8
|
//#region src/Input.tsx
|
|
8
9
|
/**
|
|
@@ -37,7 +38,7 @@ const inputCss = _ndla_styled_system_css.css.raw({
|
|
|
37
38
|
_hover: { boxShadowColor: "stroke.subtle" }
|
|
38
39
|
}
|
|
39
40
|
});
|
|
40
|
-
const StyledInputContainer = (0, _ndla_styled_system_jsx.styled)(
|
|
41
|
+
const StyledInputContainer = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.div, { base: {
|
|
41
42
|
width: "100%",
|
|
42
43
|
display: "flex",
|
|
43
44
|
alignItems: "center",
|
|
@@ -75,7 +76,7 @@ const baseTextAreaCss = _ndla_styled_system_css.css.raw({
|
|
|
75
76
|
resize: "none",
|
|
76
77
|
overflowY: "hidden"
|
|
77
78
|
});
|
|
78
|
-
const StyledInput = (0, _ndla_styled_system_jsx.styled)(
|
|
79
|
+
const StyledInput = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.input, {}, { baseComponent: true });
|
|
79
80
|
const inputRecipe = (0, _ndla_styled_system_css.cva)({
|
|
80
81
|
defaultVariants: { componentSize: "medium" },
|
|
81
82
|
variants: { componentSize: {
|
|
@@ -97,13 +98,13 @@ const Input = (0, react.forwardRef)(({ css: cssProp, componentSize, ...props },
|
|
|
97
98
|
...props
|
|
98
99
|
});
|
|
99
100
|
});
|
|
100
|
-
const FieldInput = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
101
|
+
const FieldInput = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_field.Field.Input, {
|
|
101
102
|
asChild: true,
|
|
102
103
|
...props,
|
|
103
104
|
ref,
|
|
104
105
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Input, {})
|
|
105
106
|
}));
|
|
106
|
-
const StyledTextArea = (0, _ndla_styled_system_jsx.styled)(
|
|
107
|
+
const StyledTextArea = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.textarea, {}, { baseComponent: true });
|
|
107
108
|
const TextArea = (0, react.forwardRef)(({ css: cssProp, autoResize = true, ...props }, ref) => {
|
|
108
109
|
const context = (0, react.useContext)(InputContext);
|
|
109
110
|
const localRef = (0, react.useRef)(null);
|
|
@@ -128,7 +129,7 @@ const TextArea = (0, react.forwardRef)(({ css: cssProp, autoResize = true, ...pr
|
|
|
128
129
|
...props
|
|
129
130
|
});
|
|
130
131
|
});
|
|
131
|
-
const FieldTextArea = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
132
|
+
const FieldTextArea = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_field.Field.Textarea, {
|
|
132
133
|
asChild: true,
|
|
133
134
|
...props,
|
|
134
135
|
ref,
|
package/lib/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["css","ark","Field"],"sources":["../src/Input.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 {
|
|
1
|
+
{"version":3,"file":"Input.js","names":["css","ark","Field"],"sources":["../src/Input.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 { Field } from \"@ark-ui/react/field\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport { composeRefs } from \"@ndla/util\";\nimport { createContext, forwardRef, useCallback, useContext, useEffect, useRef } from \"react\";\n\ninterface InputContextType {}\n\nconst InputContext = createContext<InputContextType | undefined>(undefined);\n\nconst inputCss = css.raw({\n boxShadowColor: \"stroke.subtle\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n background: \"background.default\",\n borderRadius: \"xsmall\",\n _ariaInvalid: {\n boxShadowColor: \"stroke.error\",\n _hover: {\n boxShadowColor: \"stroke.error\",\n },\n _focusWithin: {\n boxShadowColor: \"stroke.error\",\n _hover: {\n boxShadowColor: \"stroke.error\",\n },\n },\n },\n _hover: {\n boxShadowColor: \"stroke.hover\",\n },\n _focusWithin: {\n boxShadow: \"inset 0 0 0 2px var(--shadow-color)\",\n boxShadowColor: \"stroke.default\",\n _hover: {\n boxShadowColor: \"stroke.default\",\n },\n },\n \"&:disabled, &:has(:disabled)\": {\n boxShadowColor: \"stroke.subtle\",\n _hover: {\n boxShadowColor: \"stroke.subtle\",\n },\n },\n});\n\nconst StyledInputContainer = styled(\n ark.div,\n {\n base: {\n width: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n \"& svg\": {\n width: \"medium\",\n height: \"medium\",\n },\n \"&:not(:has(input:first-child,textarea:first-child))\": {\n paddingInlineStart: \"xsmall\",\n },\n \"&:not(:has(input:last-child,textarea:last-child))\": {\n paddingInlineEnd: \"xsmall\",\n },\n },\n },\n { baseComponent: true },\n);\n\ninterface InputContainerProps extends HTMLArkProps<\"div\">, StyledProps {}\n\nexport const InputContainer = forwardRef<HTMLDivElement, InputContainerProps>(\n ({ children, css: cssProp, ...rest }, ref) => (\n <InputContext.Provider value={{}}>\n <StyledInputContainer css={css.raw(inputCss, cssProp)} {...rest} ref={ref}>\n {children}\n </StyledInputContainer>\n </InputContext.Provider>\n ),\n);\n\nconst baseInputCss = css.raw({\n width: \"100%\",\n color: \"text.default\",\n outline: \"none\",\n background: \"none\",\n border: \"0\",\n _disabled: {\n cursor: \"not-allowed\",\n },\n // Chrome messes with input styling when autofilling. Having a really long transitions cancels this out.\n _autofill: {\n transition: \"background-color 600000s 0s, color 600000s 0s\",\n },\n _focus: {\n appearance: \"none\",\n },\n _placeholder: {\n color: \"text.subtle\",\n },\n});\n\nconst baseTextAreaCss = css.raw({\n padding: \"xsmall\",\n minHeight: \"xxlarge\",\n height: \"xxlarge\",\n resize: \"none\",\n overflowY: \"hidden\",\n});\n\nconst StyledInput = styled(ark.input, {}, { baseComponent: true });\n\nconst inputRecipe = cva({\n defaultVariants: {\n componentSize: \"medium\",\n },\n variants: {\n componentSize: {\n small: {\n paddingBlock: \"4xsmall\",\n paddingInline: \"xsmall\",\n },\n medium: {\n minHeight: \"xxlarge\",\n padding: \"xsmall\",\n },\n },\n },\n});\n\ntype InputVariantProps = NonNullable<RecipeVariantProps<typeof inputRecipe>>;\n\nexport interface InputProps extends HTMLArkProps<\"input\">, StyledProps, InputVariantProps {}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(({ css: cssProp, componentSize, ...props }, ref) => {\n const context = useContext(InputContext);\n return (\n <StyledInput\n css={css.raw(inputRecipe.raw({ componentSize }), baseInputCss, context ? undefined : inputCss, cssProp)}\n ref={ref}\n {...props}\n />\n );\n});\n\nexport const FieldInput = forwardRef<HTMLInputElement, InputProps>((props, ref) => (\n <Field.Input asChild {...props} ref={ref}>\n <Input />\n </Field.Input>\n));\n\ninterface TextAreaProps extends HTMLArkProps<\"textarea\">, StyledProps {\n autoResize?: boolean;\n}\n\nconst StyledTextArea = styled(ark.textarea, {}, { baseComponent: true });\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n ({ css: cssProp, autoResize = true, ...props }, ref) => {\n const context = useContext(InputContext);\n const localRef = useRef<HTMLTextAreaElement>(null);\n\n // Automatically resize a textarea based on its content\n const resize = useCallback(() => {\n if (!localRef.current) return;\n localRef.current.style.height = \"0\";\n // TODO: Figure out if we need to add the 3 extra pixels, maybe related to scroll?\n localRef.current.style.height = `${localRef.current.scrollHeight + 3}px`;\n }, []);\n\n useEffect(() => {\n if (!autoResize) return;\n window.addEventListener(\"input\", resize);\n window.addEventListener(\"resize\", resize);\n resize();\n return () => {\n window.removeEventListener(\"input\", resize);\n window.removeEventListener(\"resize\", resize);\n };\n }, [resize, autoResize]);\n\n return (\n <StyledTextArea\n css={css.raw(baseInputCss, context ? undefined : inputCss, baseTextAreaCss, cssProp)}\n ref={composeRefs(ref, localRef)}\n {...props}\n />\n );\n },\n);\n\nexport const FieldTextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>((props, ref) => (\n <Field.Textarea asChild {...props} ref={ref}>\n <TextArea />\n </Field.Textarea>\n));\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAM,gBAAA,GAAA,MAAA,eAA2D,KAAA,CAAS;AAE1E,MAAM,WAAWA,wBAAAA,IAAI,IAAI;CACvB,gBAAgB;CAChB,WAAW;CACX,YAAY;CACZ,cAAc;CACd,cAAc;EACZ,gBAAgB;EAChB,QAAQ,EACN,gBAAgB,eAClB;EACA,cAAc;GACZ,gBAAgB;GAChB,QAAQ,EACN,gBAAgB,eAClB;EACF;CACF;CACA,QAAQ,EACN,gBAAgB,eAClB;CACA,cAAc;EACZ,WAAW;EACX,gBAAgB;EAChB,QAAQ,EACN,gB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OACE,iBAAA,GAAA,kBAAA,KAAC,gBAAD;EACE,KAAKD,wBAAAA,IAAI,IAAI,cAAc,UAAU,KAAA,IAAY,UAAU,iBAAiB,OAAO;EACnF,MAAA,GAAA,WAAA,aAAiB,KAAK,QAAQ;EAC9B,GAAI;CACL,CAAA;AAEL,CACF;AAEA,MAAa,iBAAA,GAAA,MAAA,aAAgE,OAAO,QAClF,iBAAA,GAAA,kBAAA,KAACE,oBAAAA,MAAM,UAAP;CAAgB,SAAA;CAAQ,GAAI;CAAY;WACtC,iBAAA,GAAA,kBAAA,KAAC,UAAD,CAAW,CAAA;AACG,CAAA,CACjB"}
|
package/lib/Label.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 {
|
|
8
|
+
import { type HTMLArkProps } from "@ark-ui/react/factory";
|
|
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 LegendProps extends Omit<HTMLArkProps<"legend">, "color">, StyledProps, TextProps {
|
package/lib/Label.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
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");
|
|
4
|
+
let _ark_ui_react_factory = require("@ark-ui/react/factory");
|
|
5
5
|
let react = require("react");
|
|
6
|
+
let _ark_ui_react_field = require("@ark-ui/react/field");
|
|
7
|
+
let _ark_ui_react_fieldset = require("@ark-ui/react/fieldset");
|
|
6
8
|
//#region src/Label.tsx
|
|
7
9
|
/**
|
|
8
10
|
* Copyright (c) 2024-present, NDLA.
|
|
@@ -11,7 +13,7 @@ let react = require("react");
|
|
|
11
13
|
* LICENSE file in the root directory of this source tree.
|
|
12
14
|
*
|
|
13
15
|
*/
|
|
14
|
-
const StyledLegend = (0, _ndla_styled_system_jsx.styled)(
|
|
16
|
+
const StyledLegend = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.legend, { base: {
|
|
15
17
|
float: "left",
|
|
16
18
|
width: "inherit",
|
|
17
19
|
_disabled: { color: "text.subtle" }
|
|
@@ -26,13 +28,13 @@ const Legend = (0, react.forwardRef)(({ textStyle = "label.medium", fontWeight =
|
|
|
26
28
|
...rest,
|
|
27
29
|
ref
|
|
28
30
|
}));
|
|
29
|
-
const FieldsetLegend = (0, react.forwardRef)(({ children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
31
|
+
const FieldsetLegend = (0, react.forwardRef)(({ children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_fieldset.Fieldset.Legend, {
|
|
30
32
|
asChild: true,
|
|
31
33
|
...props,
|
|
32
34
|
ref,
|
|
33
35
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Legend, { children })
|
|
34
36
|
}));
|
|
35
|
-
const StyledLabel = (0, _ndla_styled_system_jsx.styled)(
|
|
37
|
+
const StyledLabel = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.label, { base: {
|
|
36
38
|
display: "inline-block",
|
|
37
39
|
_disabled: { color: "text.subtle" }
|
|
38
40
|
} }, { baseComponent: true });
|
|
@@ -46,7 +48,7 @@ const Label = (0, react.forwardRef)(({ textStyle = "label.medium", fontWeight =
|
|
|
46
48
|
...rest,
|
|
47
49
|
ref
|
|
48
50
|
}));
|
|
49
|
-
const FieldLabel = (0, react.forwardRef)(({ children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
51
|
+
const FieldLabel = (0, react.forwardRef)(({ children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_field.Field.Label, {
|
|
50
52
|
asChild: true,
|
|
51
53
|
...props,
|
|
52
54
|
ref,
|
package/lib/Label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","names":["ark","css","Fieldset","Field"],"sources":["../src/Label.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 {
|
|
1
|
+
{"version":3,"file":"Label.js","names":["ark","css","Fieldset","Field"],"sources":["../src/Label.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 { 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 StyledLegend = styled(\n ark.legend,\n {\n base: {\n float: \"left\",\n width: \"inherit\",\n _disabled: {\n color: \"text.subtle\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport interface LegendProps extends Omit<HTMLArkProps<\"legend\">, \"color\">, StyledProps, TextProps {}\n\nexport const Legend = forwardRef<HTMLLegendElement, LegendProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", css: cssProp, srOnly, color, ...rest }, ref) => (\n <StyledLegend css={css.raw({ textStyle, fontWeight, srOnly, color }, cssProp)} {...rest} ref={ref} />\n ),\n);\n\nexport interface FieldsetLegendProps extends Omit<Fieldset.LegendProps, \"color\">, TextProps, StyledProps {}\n\nexport const FieldsetLegend = forwardRef<HTMLLegendElement, LegendProps>(({ children, ...props }, ref) => (\n <Fieldset.Legend asChild {...props} ref={ref}>\n <Legend>{children}</Legend>\n </Fieldset.Legend>\n));\n\nconst StyledLabel = styled(\n ark.label,\n {\n base: {\n display: \"inline-block\",\n _disabled: {\n color: \"text.subtle\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport interface LabelProps extends Omit<HTMLArkProps<\"label\">, \"color\">, TextProps, StyledProps {}\n\nexport const Label = forwardRef<HTMLLabelElement, LabelProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", css: cssProp, srOnly, color, ...rest }, ref) => (\n <StyledLabel css={css.raw({ textStyle, fontWeight, srOnly, color }, cssProp)} {...rest} ref={ref} />\n ),\n);\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, LabelProps>(({ children, ...props }, ref) => (\n <Field.Label asChild {...props} ref={ref}>\n <Label>{children}</Label>\n </Field.Label>\n));\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAM,gBAAA,GAAA,wBAAA,QACJA,sBAAAA,IAAI,QACJ,EACE,MAAM;CACJ,OAAO;CACP,OAAO;CACP,WAAW,EACT,OAAO,cACT;AACF,EACF,GACA,EAAE,eAAe,KAAK,CACxB;AAIA,MAAa,UAAA,GAAA,MAAA,aACV,EAAE,YAAY,gBAAgB,aAAa,QAAQ,KAAK,SAAS,QAAQ,OAAO,GAAG,QAAQ,QAC1F,iBAAA,GAAA,kBAAA,KAAC,cAAD;CAAc,KAAKC,wBAAAA,IAAI,IAAI;EAAE;EAAW;EAAY;EAAQ;CAAM,GAAG,OAAO;CAAG,GAAI;CAAW;AAAM,CAAA,CAExG;AAIA,MAAa,kBAAA,GAAA,MAAA,aAA6D,EAAE,UAAU,GAAG,SAAS,QAChG,iBAAA,GAAA,kBAAA,KAACC,uBAAAA,SAAS,QAAV;CAAiB,SAAA;CAAQ,GAAI;CAAY;WACvC,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAS,SAAiB,CAAA;AACX,CAAA,CAClB;AAED,MAAM,eAAA,GAAA,wBAAA,QACJF,sBAAAA,IAAI,OACJ,EACE,MAAM;CACJ,SAAS;CACT,WAAW,EACT,OAAO,cACT;AACF,EACF,GACA,EAAE,eAAe,KAAK,CACxB;AAIA,MAAa,SAAA,GAAA,MAAA,aACV,EAAE,YAAY,gBAAgB,aAAa,QAAQ,KAAK,SAAS,QAAQ,OAAO,GAAG,QAAQ,QAC1F,iBAAA,GAAA,kBAAA,KAAC,aAAD;CAAa,KAAKC,wBAAAA,IAAI,IAAI;EAAE;EAAW;EAAY;EAAQ;CAAM,GAAG,OAAO;CAAG,GAAI;CAAW;AAAM,CAAA,CAEvG;AAEA,MAAa,cAAA,GAAA,MAAA,aAAuD,EAAE,UAAU,GAAG,SAAS,QAC1F,iBAAA,GAAA,kBAAA,KAACE,oBAAAA,MAAM,OAAP;CAAa,SAAA;CAAQ,GAAI;CAAY;WACnC,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAQ,SAAgB,CAAA;AACb,CAAA,CACd"}
|
|
@@ -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, RecipeVariantProps } from "@ndla/styled-system/types";
|
|
10
10
|
import { type PageContentVariantProps } from "./PageContent";
|
|
11
11
|
declare const pageContainerRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_PageContent = require("./PageContent.js");
|
|
2
|
-
require("@ark-ui/react");
|
|
3
2
|
let _ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
4
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
require("@ark-ui/react/factory");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
//#region src/Layout/PageContainer.tsx
|
|
7
7
|
/**
|