@ndla/primitives 1.0.129-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/NdlaLogo.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 +3 -2
- 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/NdlaLogo.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 +13 -12
- 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/es/Tooltip.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.mjs","names":[],"sources":["../src/Tooltip.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 { Tooltip, tooltipAnatomy } 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\";\n\nconst tooltipRecipe = sva({\n slots: tooltipAnatomy.keys(),\n base: {\n content: {\n background: \"surface.action\",\n textStyle: \"label.small\",\n color: \"text.onAction\",\n paddingInline: \"xxsmall\",\n paddingBlock: \"4xsmall\",\n \"--arrow-size\": \"spacing.xxsmall\",\n \"--arrow-background\": \"colors.surface.action\",\n _open: {\n animation: \"fade-shift-in 0.2s ease-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"fade-shift-out 0.2s ease-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n});\n\nconst { withRootProvider, withContext } = createStyleContext(tooltipRecipe);\n\nexport type TooltipRootProps = Tooltip.RootProps;\nexport const TooltipRoot = withRootProvider(Tooltip.Root);\n\nexport const TooltipArrow = withContext(Tooltip.Arrow, \"arrow\", { baseComponent: true });\n\nexport const TooltipArrowTip = withContext(Tooltip.ArrowTip, \"arrowTip\", { baseComponent: true });\n\nexport const TooltipContentStandalone = withContext(Tooltip.Content, \"content\", { baseComponent: true });\n\ninterface TooltipContentProps extends Tooltip.ContentProps, StyledProps {}\n\nexport const TooltipContent = forwardRef<HTMLDivElement, TooltipContentProps>(({ children, ...props }, ref) => (\n <TooltipPositioner>\n <TooltipContentStandalone {...props} ref={ref}>\n <TooltipArrow>\n <TooltipArrowTip />\n </TooltipArrow>\n {children}\n </TooltipContentStandalone>\n </TooltipPositioner>\n));\n\nexport const TooltipPositioner = withContext(Tooltip.Positioner, \"positioner\", { baseComponent: true });\n\nexport const TooltipTrigger = withContext(Tooltip.Trigger, \"trigger\", { baseComponent: true });\n"],"mappings":";;;;;;;;;;;;;AAyCA,MAAM,EAAE,kBAAkB,gBAAgB,mBA3BpB,IAAI;CACxB,OAAO,eAAe,
|
|
1
|
+
{"version":3,"file":"Tooltip.mjs","names":[],"sources":["../src/Tooltip.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 { Tooltip, tooltipAnatomy } from \"@ark-ui/react/tooltip\";\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\";\n\nconst tooltipRecipe = sva({\n slots: tooltipAnatomy.keys(),\n base: {\n content: {\n background: \"surface.action\",\n textStyle: \"label.small\",\n color: \"text.onAction\",\n paddingInline: \"xxsmall\",\n paddingBlock: \"4xsmall\",\n \"--arrow-size\": \"spacing.xxsmall\",\n \"--arrow-background\": \"colors.surface.action\",\n _open: {\n animation: \"fade-shift-in 0.2s ease-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"fade-shift-out 0.2s ease-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n },\n});\n\nconst { withRootProvider, withContext } = createStyleContext(tooltipRecipe);\n\nexport type TooltipRootProps = Tooltip.RootProps;\nexport const TooltipRoot = withRootProvider(Tooltip.Root);\n\nexport const TooltipArrow = withContext(Tooltip.Arrow, \"arrow\", { baseComponent: true });\n\nexport const TooltipArrowTip = withContext(Tooltip.ArrowTip, \"arrowTip\", { baseComponent: true });\n\nexport const TooltipContentStandalone = withContext(Tooltip.Content, \"content\", { baseComponent: true });\n\ninterface TooltipContentProps extends Tooltip.ContentProps, StyledProps {}\n\nexport const TooltipContent = forwardRef<HTMLDivElement, TooltipContentProps>(({ children, ...props }, ref) => (\n <TooltipPositioner>\n <TooltipContentStandalone {...props} ref={ref}>\n <TooltipArrow>\n <TooltipArrowTip />\n </TooltipArrow>\n {children}\n </TooltipContentStandalone>\n </TooltipPositioner>\n));\n\nexport const TooltipPositioner = withContext(Tooltip.Positioner, \"positioner\", { baseComponent: true });\n\nexport const TooltipTrigger = withContext(Tooltip.Trigger, \"trigger\", { baseComponent: true });\n"],"mappings":";;;;;;;;;;;;;AAyCA,MAAM,EAAE,kBAAkB,gBAAgB,mBA3BpB,IAAI;CACxB,OAAO,eAAe,KAAK;CAC3B,MAAM,EACJ,SAAS;EACP,YAAY;EACZ,WAAW;EACX,OAAO;EACP,eAAe;EACf,cAAc;EACd,gBAAgB;EAChB,sBAAsB;EACtB,OAAO;GACL,WAAW;GACX,eAAe,EACb,WAAW,OACb;EACF;EACA,SAAS;GACP,WAAW;GACX,eAAe,EACb,WAAW,OACb;EACF;CACF,EACF;AACF,CAEyE,CAAC;AAG1E,MAAa,cAAc,iBAAiB,QAAQ,IAAI;AAExD,MAAa,eAAe,YAAY,QAAQ,OAAO,SAAS,EAAE,eAAe,KAAK,CAAC;AAEvF,MAAa,kBAAkB,YAAY,QAAQ,UAAU,YAAY,EAAE,eAAe,KAAK,CAAC;AAEhG,MAAa,2BAA2B,YAAY,QAAQ,SAAS,WAAW,EAAE,eAAe,KAAK,CAAC;AAIvG,MAAa,iBAAiB,YAAiD,EAAE,UAAU,GAAG,SAAS,QACrG,oBAAC,mBAAD,EAAA,UACE,qBAAC,0BAAD;CAA0B,GAAI;CAAY;WAA1C,CACE,oBAAC,cAAD,EAAA,UACE,oBAAC,iBAAD,CAAkB,CAAA,EACN,CAAA,GACb,QACuB;GACT,CAAA,CACpB;AAED,MAAa,oBAAoB,YAAY,QAAQ,YAAY,cAAc,EAAE,eAAe,KAAK,CAAC;AAEtG,MAAa,iBAAiB,YAAY,QAAQ,SAAS,WAAW,EAAE,eAAe,KAAK,CAAC"}
|
package/es/Tree/Tree.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Text } from "../Text.mjs";
|
|
2
|
-
import { TreeView, createTreeCollection, treeViewAnatomy, useTreeView } from "@ark-ui/react";
|
|
3
2
|
import { sva } from "@ndla/styled-system/css";
|
|
4
3
|
import { createStyleContext } from "@ndla/styled-system/jsx";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
6
5
|
import { forwardRef } from "react";
|
|
6
|
+
import { TreeView, createTreeCollection, treeViewAnatomy, useTreeView } from "@ark-ui/react/tree-view";
|
|
7
7
|
//#region src/Tree/Tree.tsx
|
|
8
8
|
/**
|
|
9
9
|
* Copyright (c) 2024-present, NDLA.
|
package/es/Tree/Tree.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.mjs","names":["createTreeCollection","_createTreeCollection","useTreeView","_useTreeView"],"sources":["../../src/Tree/Tree.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 {\n TreeView,\n treeViewAnatomy,\n type TreeNode,\n createTreeCollection as _createTreeCollection,\n useTreeView as _useTreeView,\n} 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, type ElementType, type RefAttributes } from \"react\";\nimport { Text, type TextProps } from \"../Text\";\n\nconst treeRecipe = sva({\n slots: treeViewAnatomy.keys(),\n base: {\n root: {\n width: \"100%\",\n },\n branch: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n branchContent: {\n position: \"relative\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n branchControl: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"3xsmall\",\n borderRadius: \"xsmall\",\n height: \"xxlarge\",\n cursor: \"pointer\",\n paddingInlineStart: \"calc((var(--depth) - 1) * token(spacing.medium))\",\n paddingInlineEnd: \"xsmall\",\n paddingBlock: \"xsmall\",\n transitionDuration: \"normal\",\n transitionProperty: \"background, color\",\n transitionTimingFunction: \"default\",\n _hover: {\n background: \"surface.hover\",\n },\n _selected: {\n background: \"surface.selected\",\n },\n },\n branchIndicator: {\n transformOrigin: \"center\",\n transitionDuration: \"normal\",\n transitionProperty: \"transform\",\n transitionTimingFunction: \"default\",\n _open: {\n transform: \"rotate(90deg)\",\n },\n },\n item: {\n display: \"flex\",\n cursor: \"pointer\",\n position: \"relative\",\n borderRadius: \"xsmall\",\n justifyContent: \"space-between\",\n paddingBlock: \"xsmall\",\n paddingInlineEnd: \"xsmall\",\n paddingInlineStart:\n \"calc(((var(--depth) - 1) * token(spacing.medium)) + token(spacing.xxlarge) + token(spacing.3xsmall))\",\n transitionDuration: \"normal\",\n transitionProperty: \"background, color\",\n transitionTimingFunction: \"default\",\n height: \"xxlarge\",\n alignItems: \"center\",\n\n _hover: {\n background: \"surface.hover\",\n },\n _selected: {\n background: \"surface.selected\",\n _hover: {\n background: \"surface.hover\",\n },\n },\n },\n itemIndicator: {\n color: \"icon.strong\",\n },\n itemText: {\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n },\n branchText: {\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n },\n tree: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(treeRecipe);\n\nexport interface TreeRootProps<T extends TreeNode = TreeNode>\n extends TreeView.RootProps<T>, StyledProps, RefAttributes<HTMLDivElement> {}\n\nconst InternalTreeRoot = withProvider<ElementType<TreeRootProps>>(TreeView.Root, \"root\", { baseComponent: true });\n\nexport const TreeRoot = <T extends TreeNode = TreeNode>(props: TreeRootProps<T>) => <InternalTreeRoot {...props} />;\n\nexport interface TreeRootProviderProps<T extends TreeNode = TreeNode>\n extends TreeView.RootProviderProps<T>, StyledProps {}\n\nconst InternalTreeRootProvider = withProvider<ElementType<TreeRootProviderProps>>(TreeView.RootProvider, \"root\", {\n baseComponent: true,\n});\n\nexport const TreeRootProvider = <T extends TreeNode = TreeNode>(props: TreeRootProviderProps<T>) => (\n <InternalTreeRootProvider {...props} />\n);\n\nexport const TreeBranchContent = withContext(TreeView.BranchContent, \"branchContent\", { baseComponent: true });\n\nexport const TreeBranchControl = withContext(TreeView.BranchControl, \"branchControl\", { baseComponent: true });\n\nexport const TreeBranchIndicator = withContext(TreeView.BranchIndicator, \"branchIndicator\", { baseComponent: true });\n\nexport const TreeBranch = withContext(TreeView.Branch, \"branch\", {\n baseComponent: true,\n});\n\nconst InternalTreeBranchText = withContext(TreeView.BranchText, \"branchText\", { baseComponent: true });\n\ninterface TreeBranchTextProps\n extends Omit<TreeView.BranchTextProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLDivElement> {}\n\nexport const TreeBranchText = forwardRef<HTMLDivElement, TreeBranchTextProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", children, ...props }, ref) => (\n <InternalTreeBranchText asChild {...props} ref={ref}>\n <Text textStyle={textStyle} fontWeight={fontWeight} asChild consumeCss>\n <div>{children}</div>\n </Text>\n </InternalTreeBranchText>\n ),\n);\n\nexport const TreeBranchTrigger = withContext(TreeView.BranchTrigger, \"branchTrigger\", { baseComponent: true });\n\nexport const TreeItemIndicator = withContext(TreeView.ItemIndicator, \"itemIndicator\", { baseComponent: true });\n\nexport const TreeItem = withContext(TreeView.Item, \"item\", { baseComponent: true });\n\nconst InternalTreeItemText = withContext(TreeView.ItemText, \"itemText\", { baseComponent: true });\n\ninterface TreeItemTextProps\n extends Omit<TreeView.ItemTextProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLDivElement> {}\n\nexport const TreeItemText = forwardRef<HTMLDivElement, TreeItemTextProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", children, ...props }, ref) => (\n <InternalTreeItemText asChild {...props} ref={ref}>\n <Text textStyle={textStyle} fontWeight={fontWeight} asChild consumeCss>\n <div>{children}</div>\n </Text>\n </InternalTreeItemText>\n ),\n);\n\nconst InternalTreeLabel = withContext(TreeView.Label, \"label\", { baseComponent: true });\n\ninterface TreeLabelProps\n extends Omit<TreeView.LabelProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLDivElement> {}\n\nexport const TreeLabel = forwardRef<HTMLDivElement, TreeLabelProps>(\n ({ children, textStyle = \"label.medium\", fontWeight = \"bold\", ...props }, ref) => (\n <InternalTreeLabel asChild {...props} ref={ref}>\n <Text textStyle={textStyle} fontWeight={fontWeight} asChild consumeCss>\n <div>{children}</div>\n </Text>\n </InternalTreeLabel>\n ),\n);\n\nexport const Tree = withContext(TreeView.Tree, \"tree\", { baseComponent: true });\n\nexport const createTreeCollection = _createTreeCollection;\n\nexport const TreeNodeProvider = TreeView.NodeProvider;\nexport const TreeNodeContext = TreeView.NodeContext;\nexport const useTreeView = _useTreeView;\n"],"mappings":";;;;;;;;;;;;;;AAgHA,MAAM,EAAE,cAAc,gBAAgB,mBA3FnB,IAAI;CACrB,OAAO,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Tree.mjs","names":["createTreeCollection","_createTreeCollection","useTreeView","_useTreeView"],"sources":["../../src/Tree/Tree.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 {\n TreeView,\n treeViewAnatomy,\n type TreeNode,\n createTreeCollection as _createTreeCollection,\n useTreeView as _useTreeView,\n} from \"@ark-ui/react/tree-view\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef, type ElementType, type RefAttributes } from \"react\";\nimport { Text, type TextProps } from \"../Text\";\n\nconst treeRecipe = sva({\n slots: treeViewAnatomy.keys(),\n base: {\n root: {\n width: \"100%\",\n },\n branch: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n branchContent: {\n position: \"relative\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n branchControl: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"3xsmall\",\n borderRadius: \"xsmall\",\n height: \"xxlarge\",\n cursor: \"pointer\",\n paddingInlineStart: \"calc((var(--depth) - 1) * token(spacing.medium))\",\n paddingInlineEnd: \"xsmall\",\n paddingBlock: \"xsmall\",\n transitionDuration: \"normal\",\n transitionProperty: \"background, color\",\n transitionTimingFunction: \"default\",\n _hover: {\n background: \"surface.hover\",\n },\n _selected: {\n background: \"surface.selected\",\n },\n },\n branchIndicator: {\n transformOrigin: \"center\",\n transitionDuration: \"normal\",\n transitionProperty: \"transform\",\n transitionTimingFunction: \"default\",\n _open: {\n transform: \"rotate(90deg)\",\n },\n },\n item: {\n display: \"flex\",\n cursor: \"pointer\",\n position: \"relative\",\n borderRadius: \"xsmall\",\n justifyContent: \"space-between\",\n paddingBlock: \"xsmall\",\n paddingInlineEnd: \"xsmall\",\n paddingInlineStart:\n \"calc(((var(--depth) - 1) * token(spacing.medium)) + token(spacing.xxlarge) + token(spacing.3xsmall))\",\n transitionDuration: \"normal\",\n transitionProperty: \"background, color\",\n transitionTimingFunction: \"default\",\n height: \"xxlarge\",\n alignItems: \"center\",\n\n _hover: {\n background: \"surface.hover\",\n },\n _selected: {\n background: \"surface.selected\",\n _hover: {\n background: \"surface.hover\",\n },\n },\n },\n itemIndicator: {\n color: \"icon.strong\",\n },\n itemText: {\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n },\n branchText: {\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n },\n tree: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(treeRecipe);\n\nexport interface TreeRootProps<T extends TreeNode = TreeNode>\n extends TreeView.RootProps<T>, StyledProps, RefAttributes<HTMLDivElement> {}\n\nconst InternalTreeRoot = withProvider<ElementType<TreeRootProps>>(TreeView.Root, \"root\", { baseComponent: true });\n\nexport const TreeRoot = <T extends TreeNode = TreeNode>(props: TreeRootProps<T>) => <InternalTreeRoot {...props} />;\n\nexport interface TreeRootProviderProps<T extends TreeNode = TreeNode>\n extends TreeView.RootProviderProps<T>, StyledProps {}\n\nconst InternalTreeRootProvider = withProvider<ElementType<TreeRootProviderProps>>(TreeView.RootProvider, \"root\", {\n baseComponent: true,\n});\n\nexport const TreeRootProvider = <T extends TreeNode = TreeNode>(props: TreeRootProviderProps<T>) => (\n <InternalTreeRootProvider {...props} />\n);\n\nexport const TreeBranchContent = withContext(TreeView.BranchContent, \"branchContent\", { baseComponent: true });\n\nexport const TreeBranchControl = withContext(TreeView.BranchControl, \"branchControl\", { baseComponent: true });\n\nexport const TreeBranchIndicator = withContext(TreeView.BranchIndicator, \"branchIndicator\", { baseComponent: true });\n\nexport const TreeBranch = withContext(TreeView.Branch, \"branch\", {\n baseComponent: true,\n});\n\nconst InternalTreeBranchText = withContext(TreeView.BranchText, \"branchText\", { baseComponent: true });\n\ninterface TreeBranchTextProps\n extends Omit<TreeView.BranchTextProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLDivElement> {}\n\nexport const TreeBranchText = forwardRef<HTMLDivElement, TreeBranchTextProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", children, ...props }, ref) => (\n <InternalTreeBranchText asChild {...props} ref={ref}>\n <Text textStyle={textStyle} fontWeight={fontWeight} asChild consumeCss>\n <div>{children}</div>\n </Text>\n </InternalTreeBranchText>\n ),\n);\n\nexport const TreeBranchTrigger = withContext(TreeView.BranchTrigger, \"branchTrigger\", { baseComponent: true });\n\nexport const TreeItemIndicator = withContext(TreeView.ItemIndicator, \"itemIndicator\", { baseComponent: true });\n\nexport const TreeItem = withContext(TreeView.Item, \"item\", { baseComponent: true });\n\nconst InternalTreeItemText = withContext(TreeView.ItemText, \"itemText\", { baseComponent: true });\n\ninterface TreeItemTextProps\n extends Omit<TreeView.ItemTextProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLDivElement> {}\n\nexport const TreeItemText = forwardRef<HTMLDivElement, TreeItemTextProps>(\n ({ textStyle = \"label.medium\", fontWeight = \"bold\", children, ...props }, ref) => (\n <InternalTreeItemText asChild {...props} ref={ref}>\n <Text textStyle={textStyle} fontWeight={fontWeight} asChild consumeCss>\n <div>{children}</div>\n </Text>\n </InternalTreeItemText>\n ),\n);\n\nconst InternalTreeLabel = withContext(TreeView.Label, \"label\", { baseComponent: true });\n\ninterface TreeLabelProps\n extends Omit<TreeView.LabelProps, \"color\">, TextProps, StyledProps, RefAttributes<HTMLDivElement> {}\n\nexport const TreeLabel = forwardRef<HTMLDivElement, TreeLabelProps>(\n ({ children, textStyle = \"label.medium\", fontWeight = \"bold\", ...props }, ref) => (\n <InternalTreeLabel asChild {...props} ref={ref}>\n <Text textStyle={textStyle} fontWeight={fontWeight} asChild consumeCss>\n <div>{children}</div>\n </Text>\n </InternalTreeLabel>\n ),\n);\n\nexport const Tree = withContext(TreeView.Tree, \"tree\", { baseComponent: true });\n\nexport const createTreeCollection = _createTreeCollection;\n\nexport const TreeNodeProvider = TreeView.NodeProvider;\nexport const TreeNodeContext = TreeView.NodeContext;\nexport const useTreeView = _useTreeView;\n"],"mappings":";;;;;;;;;;;;;;AAgHA,MAAM,EAAE,cAAc,gBAAgB,mBA3FnB,IAAI;CACrB,OAAO,gBAAgB,KAAK;CAC5B,MAAM;EACJ,MAAM,EACJ,OAAO,OACT;EACA,QAAQ;GACN,SAAS;GACT,eAAe;GACf,KAAK;EACP;EACA,eAAe;GACb,UAAU;GACV,SAAS;GACT,eAAe;GACf,KAAK;EACP;EACA,eAAe;GACb,SAAS;GACT,YAAY;GACZ,KAAK;GACL,cAAc;GACd,QAAQ;GACR,QAAQ;GACR,oBAAoB;GACpB,kBAAkB;GAClB,cAAc;GACd,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,QAAQ,EACN,YAAY,gBACd;GACA,WAAW,EACT,YAAY,mBACd;EACF;EACA,iBAAiB;GACf,iBAAiB;GACjB,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,OAAO,EACL,WAAW,gBACb;EACF;EACA,MAAM;GACJ,SAAS;GACT,QAAQ;GACR,UAAU;GACV,cAAc;GACd,gBAAgB;GAChB,cAAc;GACd,kBAAkB;GAClB,oBACE;GACF,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,QAAQ;GACR,YAAY;G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,CAAC;AAE7G,MAAa,oBAAoB,YAAY,SAAS,eAAe,iBAAiB,EAAE,eAAe,KAAK,CAAC;AAE7G,MAAa,WAAW,YAAY,SAAS,MAAM,QAAQ,EAAE,eAAe,KAAK,CAAC;AAElF,MAAM,uBAAuB,YAAY,SAAS,UAAU,YAAY,EAAE,eAAe,KAAK,CAAC;AAK/F,MAAa,eAAe,YACzB,EAAE,YAAY,gBAAgB,aAAa,QAAQ,UAAU,GAAG,SAAS,QACxE,oBAAC,sBAAD;CAAsB,SAAA;CAAQ,GAAI;CAAY;WAC5C,oBAAC,MAAD;EAAiB;EAAuB;EAAY,SAAA;EAAQ,YAAA;YAC1D,oBAAC,OAAD,EAAM,SAAc,CAAA;CAChB,CAAA;AACc,CAAA,CAE1B;AAEA,MAAM,oBAAoB,YAAY,SAAS,OAAO,SAAS,EAAE,eAAe,KAAK,CAAC;AAKtF,MAAa,YAAY,YACtB,EAAE,UAAU,YAAY,gBAAgB,aAAa,QAAQ,GAAG,SAAS,QACxE,oBAAC,mBAAD;CAAmB,SAAA;CAAQ,GAAI;CAAY;WACzC,oBAAC,MAAD;EAAiB;EAAuB;EAAY,SAAA;EAAQ,YAAA;YAC1D,oBAAC,OAAD,EAAM,SAAc,CAAA;CAChB,CAAA;AACW,CAAA,CAEvB;AAEA,MAAa,OAAO,YAAY,SAAS,MAAM,QAAQ,EAAE,eAAe,KAAK,CAAC;AAE9E,MAAaA,yBAAuBC;AAEpC,MAAa,mBAAmB,SAAS;AACzC,MAAa,kBAAkB,SAAS;AACxC,MAAaC,gBAAcC"}
|
package/es/index.mjs
CHANGED
|
@@ -32,6 +32,7 @@ import { NdlaLogoEn, NdlaLogoNb, NdlaLogoText } from "./NdlaLogo.mjs";
|
|
|
32
32
|
import { PaginationContext, PaginationEllipsis, PaginationItem, PaginationNextTrigger, PaginationPrevTrigger, PaginationRoot } from "./Pagination.mjs";
|
|
33
33
|
import { PopoverAnchor, PopoverArrow, PopoverArrowStandalone, PopoverArrowTip, PopoverCloseTrigger, PopoverContent, PopoverContentStandalone, PopoverDescription, PopoverIndicator, PopoverPositioner, PopoverRoot, PopoverRootProvider, PopoverTitle, PopoverTrigger, usePopover } from "./Popover.mjs";
|
|
34
34
|
import { RadioGroupIndicator, RadioGroupItem, RadioGroupItemControl, RadioGroupItemHiddenInput, RadioGroupItemText, RadioGroupLabel, RadioGroupRoot } from "./RadioGroup.mjs";
|
|
35
|
+
import { RainbowSpinner } from "./RainbowSpinner.mjs";
|
|
35
36
|
import { SelectClearTrigger, SelectContent, SelectContentStandalone, SelectControl, SelectHiddenSelect, SelectIndicator, SelectItem, SelectItemGroup, SelectItemGroupLabel, SelectItemIndicator, SelectItemText, SelectLabel, SelectList, SelectPositioner, SelectRoot, SelectTrigger, SelectValueText } from "./Select.mjs";
|
|
36
37
|
import { Skeleton } from "./Skeleton.mjs";
|
|
37
38
|
import { SliderControl, SliderHiddenInput, SliderLabel, SliderRange, SliderRoot, SliderThumb, SliderTrack } from "./Slider.mjs";
|
|
@@ -42,5 +43,5 @@ import { TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger } from "./T
|
|
|
42
43
|
import { ToastActionTrigger, ToastCloseTrigger, ToastDescription, ToastRoot, ToastTitle } from "./Toast.mjs";
|
|
43
44
|
import { TooltipArrow, TooltipArrowTip, TooltipContent, TooltipContentStandalone, TooltipPositioner, TooltipRoot, TooltipTrigger } from "./Tooltip.mjs";
|
|
44
45
|
import { Tree, TreeBranch, TreeBranchContent, TreeBranchControl, TreeBranchIndicator, TreeBranchText, TreeBranchTrigger, TreeItem, TreeItemIndicator, TreeItemText, TreeLabel, TreeNodeContext, TreeNodeProvider, TreeRoot, TreeRootProvider, createTreeCollection, useTreeView } from "./Tree/Tree.mjs";
|
|
45
|
-
import { useFieldContext } from "@ark-ui/react";
|
|
46
|
-
export { AccordionItem, AccordionItemContent, AccordionItemIndicator, AccordionItemTrigger, AccordionRoot, Badge, BleedPageContent, BlockQuote, Button, CardContent, CardHeading, CardImage, CardRoot, CheckboxControl, CheckboxGroup, CheckboxHiddenInput, CheckboxIndicator, CheckboxLabel, CheckboxRoot, ComboboxClearTrigger, ComboboxContent, ComboboxContentStandalone, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxItemGroup, ComboboxItemGroupLabel, ComboboxItemIndicator, ComboboxItemText, ComboboxLabel, ComboboxList, ComboboxPositioner, ComboboxRoot, ComboboxTrigger, DatePickerClearTrigger, DatePickerContent, DatePickerContext, DatePickerControl, DatePickerInput, DatePickerLabel, DatePickerMonthSelect, DatePickerNextTrigger, DatePickerPositioner, DatePickerPresetTrigger, DatePickerPrevTrigger, DatePickerRangeText, DatePickerRoot, DatePickerStandaloneContent, DatePickerTable, DatePickerTableBody, DatePickerTableCell, DatePickerTableCellTrigger, DatePickerTableHead, DatePickerTableHeader, DatePickerTableRow, DatePickerTrigger, DatePickerView, DatePickerViewControl, DatePickerViewTrigger, DatePickerYearSelect, DefinitionList, DialogBackdrop, DialogBody, DialogCloseTrigger, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogPositioner, DialogRoot, DialogRootProvider, DialogStandaloneContent, DialogTitle, DialogTrigger, ErrorMessageActions, ErrorMessageContent, ErrorMessageDescription, ErrorMessageRoot, ErrorMessageTitle, ExpandableBox, ExpandableBoxSummary, FieldErrorMessage, FieldHelper, FieldInput, FieldLabel, FieldRoot, FieldTextArea, FieldsetErrorText, FieldsetHelper, FieldsetLegend, FieldsetRoot, Figure, FileUploadContext, FileUploadDropzone, FileUploadHiddenInput, FileUploadItem, FileUploadItemDeleteTrigger, FileUploadItemGroup, FileUploadItemName, FileUploadItemPreview, FileUploadItemPreviewImage, FileUploadItemSizeText, FileUploadLabel, FileUploadRoot, FileUploadTrigger, FramedContent, Heading, Hero, HeroBackground, HeroContent, IconButton, Image, Img, Input, InputContainer, Label, Legend, ListItemContent, ListItemHeading, ListItemImage, ListItemRoot, MenuContent, MenuContentStandalone, MenuItem, MenuItemGroup, MenuItemGroupLabel, MenuItemText, MenuPositioner, MenuRoot, MenuSeparator, MenuTrigger, MenuTriggerItem, MessageBox, NdlaLogoEn, NdlaLogoNb, NdlaLogoText, OrderedList, PageContainer, PageContent, PaginationContext, PaginationEllipsis, PaginationItem, PaginationNextTrigger, PaginationPrevTrigger, PaginationRoot, Picture, PopoverAnchor, PopoverArrow, PopoverArrowStandalone, PopoverArrowTip, PopoverCloseTrigger, PopoverContent, PopoverContentStandalone, PopoverDescription, PopoverIndicator, PopoverPositioner, PopoverRoot, PopoverRootProvider, PopoverTitle, PopoverTrigger, RadioGroupIndicator, RadioGroupItem, RadioGroupItemControl, RadioGroupItemHiddenInput, RadioGroupItemText, RadioGroupLabel, RadioGroupRoot, SelectClearTrigger, SelectContent, SelectContentStandalone, SelectControl, SelectHiddenSelect, SelectIndicator, SelectItem, SelectItemGroup, SelectItemGroupLabel, SelectItemIndicator, SelectItemText, SelectLabel, SelectList, SelectPositioner, SelectRoot, SelectTrigger, SelectValueText, Skeleton, SliderControl, SliderHiddenInput, SliderLabel, SliderRange, SliderRoot, SliderThumb, SliderTrack, Spinner, SwitchControl, SwitchHiddenInput, SwitchLabel, SwitchRoot, SwitchThumb, Table, TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger, TagsInputClearTrigger, TagsInputControl, TagsInputInput, TagsInputItem, TagsInputItemDeleteTrigger, TagsInputItemInput, TagsInputItemPreview, TagsInputItemText, TagsInputLabel, TagsInputRoot, Text, TextArea, ToastActionTrigger, ToastCloseTrigger, ToastDescription, ToastRoot, ToastTitle, ToggleGroupItem, ToggleGroupRoot, TooltipArrow, TooltipArrowTip, TooltipContent, TooltipContentStandalone, TooltipPositioner, TooltipRoot, TooltipTrigger, Tree, TreeBranch, TreeBranchContent, TreeBranchControl, TreeBranchIndicator, TreeBranchText, TreeBranchTrigger, TreeItem, TreeItemIndicator, TreeItemText, TreeLabel, TreeNodeContext, TreeNodeProvider, TreeRoot, TreeRootProvider, UnOrderedList, buttonBaseRecipe, buttonRecipe, createTreeCollection, getSrcSet, iconButtonRecipe, makeSrcQueryString, useDialog, useFieldContext, usePopover, useTreeView };
|
|
46
|
+
import { useFieldContext } from "@ark-ui/react/field";
|
|
47
|
+
export { AccordionItem, AccordionItemContent, AccordionItemIndicator, AccordionItemTrigger, AccordionRoot, Badge, BleedPageContent, BlockQuote, Button, CardContent, CardHeading, CardImage, CardRoot, CheckboxControl, CheckboxGroup, CheckboxHiddenInput, CheckboxIndicator, CheckboxLabel, CheckboxRoot, ComboboxClearTrigger, ComboboxContent, ComboboxContentStandalone, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxItemGroup, ComboboxItemGroupLabel, ComboboxItemIndicator, ComboboxItemText, ComboboxLabel, ComboboxList, ComboboxPositioner, ComboboxRoot, ComboboxTrigger, DatePickerClearTrigger, DatePickerContent, DatePickerContext, DatePickerControl, DatePickerInput, DatePickerLabel, DatePickerMonthSelect, DatePickerNextTrigger, DatePickerPositioner, DatePickerPresetTrigger, DatePickerPrevTrigger, DatePickerRangeText, DatePickerRoot, DatePickerStandaloneContent, DatePickerTable, DatePickerTableBody, DatePickerTableCell, DatePickerTableCellTrigger, DatePickerTableHead, DatePickerTableHeader, DatePickerTableRow, DatePickerTrigger, DatePickerView, DatePickerViewControl, DatePickerViewTrigger, DatePickerYearSelect, DefinitionList, DialogBackdrop, DialogBody, DialogCloseTrigger, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogPositioner, DialogRoot, DialogRootProvider, DialogStandaloneContent, DialogTitle, DialogTrigger, ErrorMessageActions, ErrorMessageContent, ErrorMessageDescription, ErrorMessageRoot, ErrorMessageTitle, ExpandableBox, ExpandableBoxSummary, FieldErrorMessage, FieldHelper, FieldInput, FieldLabel, FieldRoot, FieldTextArea, FieldsetErrorText, FieldsetHelper, FieldsetLegend, FieldsetRoot, Figure, FileUploadContext, FileUploadDropzone, FileUploadHiddenInput, FileUploadItem, FileUploadItemDeleteTrigger, FileUploadItemGroup, FileUploadItemName, FileUploadItemPreview, FileUploadItemPreviewImage, FileUploadItemSizeText, FileUploadLabel, FileUploadRoot, FileUploadTrigger, FramedContent, Heading, Hero, HeroBackground, HeroContent, IconButton, Image, Img, Input, InputContainer, Label, Legend, ListItemContent, ListItemHeading, ListItemImage, ListItemRoot, MenuContent, MenuContentStandalone, MenuItem, MenuItemGroup, MenuItemGroupLabel, MenuItemText, MenuPositioner, MenuRoot, MenuSeparator, MenuTrigger, MenuTriggerItem, MessageBox, NdlaLogoEn, NdlaLogoNb, NdlaLogoText, OrderedList, PageContainer, PageContent, PaginationContext, PaginationEllipsis, PaginationItem, PaginationNextTrigger, PaginationPrevTrigger, PaginationRoot, Picture, PopoverAnchor, PopoverArrow, PopoverArrowStandalone, PopoverArrowTip, PopoverCloseTrigger, PopoverContent, PopoverContentStandalone, PopoverDescription, PopoverIndicator, PopoverPositioner, PopoverRoot, PopoverRootProvider, PopoverTitle, PopoverTrigger, RadioGroupIndicator, RadioGroupItem, RadioGroupItemControl, RadioGroupItemHiddenInput, RadioGroupItemText, RadioGroupLabel, RadioGroupRoot, RainbowSpinner, SelectClearTrigger, SelectContent, SelectContentStandalone, SelectControl, SelectHiddenSelect, SelectIndicator, SelectItem, SelectItemGroup, SelectItemGroupLabel, SelectItemIndicator, SelectItemText, SelectLabel, SelectList, SelectPositioner, SelectRoot, SelectTrigger, SelectValueText, Skeleton, SliderControl, SliderHiddenInput, SliderLabel, SliderRange, SliderRoot, SliderThumb, SliderTrack, Spinner, SwitchControl, SwitchHiddenInput, SwitchLabel, SwitchRoot, SwitchThumb, Table, TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger, TagsInputClearTrigger, TagsInputControl, TagsInputInput, TagsInputItem, TagsInputItemDeleteTrigger, TagsInputItemInput, TagsInputItemPreview, TagsInputItemText, TagsInputLabel, TagsInputRoot, Text, TextArea, ToastActionTrigger, ToastCloseTrigger, ToastDescription, ToastRoot, ToastTitle, ToggleGroupItem, ToggleGroupRoot, TooltipArrow, TooltipArrowTip, TooltipContent, TooltipContentStandalone, TooltipPositioner, TooltipRoot, TooltipTrigger, Tree, TreeBranch, TreeBranchContent, TreeBranchControl, TreeBranchIndicator, TreeBranchText, TreeBranchTrigger, TreeItem, TreeItemIndicator, TreeItemText, TreeLabel, TreeNodeContext, TreeNodeProvider, TreeRoot, TreeRootProvider, UnOrderedList, buttonBaseRecipe, buttonRecipe, createTreeCollection, getSrcSet, iconButtonRecipe, makeSrcQueryString, useDialog, useFieldContext, usePopover, useTreeView };
|
package/lib/Accordion.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 { Accordion } from "@ark-ui/react";
|
|
8
|
+
import { Accordion } from "@ark-ui/react/accordion";
|
|
9
9
|
import type { RecipeVariantProps, StyledProps } from "@ndla/styled-system/types";
|
|
10
10
|
import type { RefAttributes } from "react";
|
|
11
11
|
declare const accordionRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"root" | "item" | "itemTrigger" | "itemContent" | "itemIndicator", {
|
package/lib/Accordion.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let
|
|
1
|
+
let _ark_ui_react_accordion = require("@ark-ui/react/accordion");
|
|
2
2
|
let _ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
3
3
|
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -11,7 +11,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
const { withProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleContext)((0, _ndla_styled_system_css.sva)({
|
|
14
|
-
slots:
|
|
14
|
+
slots: _ark_ui_react_accordion.accordionAnatomy.keys(),
|
|
15
15
|
base: {
|
|
16
16
|
root: {
|
|
17
17
|
display: "flex",
|
|
@@ -105,16 +105,16 @@ const { withProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleCon
|
|
|
105
105
|
}
|
|
106
106
|
} }
|
|
107
107
|
}));
|
|
108
|
-
const InternalAccordionRoot = withProvider(
|
|
108
|
+
const InternalAccordionRoot = withProvider(_ark_ui_react_accordion.Accordion.Root, "root", { baseComponent: true });
|
|
109
109
|
const AccordionRoot = ({ lazyMount = true, unmountOnExit = true, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalAccordionRoot, {
|
|
110
110
|
lazyMount,
|
|
111
111
|
unmountOnExit,
|
|
112
112
|
...props
|
|
113
113
|
});
|
|
114
|
-
const AccordionItemContent = withContext(
|
|
115
|
-
const AccordionItemIndicator = withContext(
|
|
116
|
-
const AccordionItem = withContext(
|
|
117
|
-
const AccordionItemTrigger = withContext(
|
|
114
|
+
const AccordionItemContent = withContext(_ark_ui_react_accordion.Accordion.ItemContent, "itemContent", { baseComponent: true });
|
|
115
|
+
const AccordionItemIndicator = withContext(_ark_ui_react_accordion.Accordion.ItemIndicator, "itemIndicator", { baseComponent: true });
|
|
116
|
+
const AccordionItem = withContext(_ark_ui_react_accordion.Accordion.Item, "item", { baseComponent: true });
|
|
117
|
+
const AccordionItemTrigger = withContext(_ark_ui_react_accordion.Accordion.ItemTrigger, "itemTrigger", { baseComponent: true });
|
|
118
118
|
//#endregion
|
|
119
119
|
exports.AccordionItem = AccordionItem;
|
|
120
120
|
exports.AccordionItemContent = AccordionItemContent;
|
package/lib/Accordion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","names":["accordionAnatomy","Accordion"],"sources":["../src/Accordion.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 { Accordion, accordionAnatomy } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport type { RefAttributes } from \"react\";\n\nconst accordionRecipe = sva({\n slots: accordionAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n itemTrigger: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n background: \"surface.default\",\n cursor: \"pointer\",\n transitionDuration: \"fast\",\n transitionTimingFunction: \"default\",\n transitionProperty: \"background, border-color, border, border-radius\",\n _closed: {\n transitionProperty: \"background, border-color, border, border-radius\",\n },\n _disabled: {\n cursor: \"not-allowed\",\n background: \"surface.disabled.subtle\",\n boxShadowColor: \"stroke.disabled\",\n color: \"text.disabled\",\n _hover: {\n background: \"surface.disabled.subtle\",\n boxShadowColor: \"stroke.disabled\",\n color: \"text.disabled\",\n },\n },\n },\n itemIndicator: {\n color: \"icon.strong\",\n transformOrigin: \"center\",\n transitionDuration: \"normal\",\n transitionProperty: \"transform\",\n transitionTimingFunction: \"default\",\n _open: {\n transform: \"rotate(180deg)\",\n },\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n itemContent: {\n overflow: \"hidden\",\n // TODO: Is this needed?\n transitionProperty: \"padding-bottom\",\n transitionDuration: \"normal\",\n transitionTimingFunction: \"default\",\n paddingBlock: \"xsmall\",\n paddingInline: \"small\",\n _open: {\n animation: \"collapse-in\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"collapse-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n item: {\n width: \"100%\",\n },\n },\n defaultVariants: {\n variant: \"bordered\",\n },\n variants: {\n variant: {\n clean: {},\n bordered: {\n itemTrigger: {\n paddingInline: \"medium\",\n paddingBlock: \"medium\",\n width: \"100%\",\n borderRadius: \"xsmall\",\n boxShadowColor: \"stroke.subtle\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n _hover: {\n background: \"surface.actionSubtle.hover\",\n boxShadowColor: \"stroke.hover\",\n },\n _open: {\n background: \"surface.actionSubtle.active\",\n boxShadowColor: \"stroke.default\",\n borderBottomRadius: \"sharp\",\n },\n _focusVisible: {\n outline: \"none\",\n boxShadowColor: \"stroke.default\",\n boxShadow: \"inset 0 0 0 3px var(--shadow-color)\",\n },\n },\n itemContent: {\n borderBottomRadius: \"xsmall\",\n borderWidth: \"0 1px 1px\",\n borderStyle: \"solid\",\n borderColor: \"stroke.default\",\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(accordionRecipe);\n\nexport type AccordionVariantProps = NonNullable<RecipeVariantProps<typeof accordionRecipe>>;\n\nexport interface AccordionRootProps\n extends StyledProps, Accordion.RootProps, RefAttributes<HTMLDivElement>, AccordionVariantProps {}\n\nexport const InternalAccordionRoot = withProvider(Accordion.Root, \"root\", { baseComponent: true });\n\nexport const AccordionRoot = ({ lazyMount = true, unmountOnExit = true, ...props }: AccordionRootProps) => (\n <InternalAccordionRoot lazyMount={lazyMount} unmountOnExit={unmountOnExit} {...props} />\n);\n\nexport const AccordionItemContent = withContext(Accordion.ItemContent, \"itemContent\", { baseComponent: true });\n\nexport const AccordionItemIndicator = withContext(Accordion.ItemIndicator, \"itemIndicator\", { baseComponent: true });\n\nexport interface AccordionItemProps extends StyledProps, Accordion.ItemProps {}\n\nexport const AccordionItem = withContext(Accordion.Item, \"item\", { baseComponent: true });\n\nexport const AccordionItemTrigger = withContext(Accordion.ItemTrigger, \"itemTrigger\", { baseComponent: true });\n"],"mappings":";;;;;;;;;;;;AA6HA,MAAM,EAAE,cAAc,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KA/GM;CAC1B,OAAOA,
|
|
1
|
+
{"version":3,"file":"Accordion.js","names":["accordionAnatomy","Accordion"],"sources":["../src/Accordion.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 { Accordion, accordionAnatomy } from \"@ark-ui/react/accordion\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport type { RefAttributes } from \"react\";\n\nconst accordionRecipe = sva({\n slots: accordionAnatomy.keys(),\n base: {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n },\n itemTrigger: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n background: \"surface.default\",\n cursor: \"pointer\",\n transitionDuration: \"fast\",\n transitionTimingFunction: \"default\",\n transitionProperty: \"background, border-color, border, border-radius\",\n _closed: {\n transitionProperty: \"background, border-color, border, border-radius\",\n },\n _disabled: {\n cursor: \"not-allowed\",\n background: \"surface.disabled.subtle\",\n boxShadowColor: \"stroke.disabled\",\n color: \"text.disabled\",\n _hover: {\n background: \"surface.disabled.subtle\",\n boxShadowColor: \"stroke.disabled\",\n color: \"text.disabled\",\n },\n },\n },\n itemIndicator: {\n color: \"icon.strong\",\n transformOrigin: \"center\",\n transitionDuration: \"normal\",\n transitionProperty: \"transform\",\n transitionTimingFunction: \"default\",\n _open: {\n transform: \"rotate(180deg)\",\n },\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n itemContent: {\n overflow: \"hidden\",\n // TODO: Is this needed?\n transitionProperty: \"padding-bottom\",\n transitionDuration: \"normal\",\n transitionTimingFunction: \"default\",\n paddingBlock: \"xsmall\",\n paddingInline: \"small\",\n _open: {\n animation: \"collapse-in\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n _closed: {\n animation: \"collapse-out\",\n _motionReduce: {\n animation: \"none\",\n },\n },\n },\n item: {\n width: \"100%\",\n },\n },\n defaultVariants: {\n variant: \"bordered\",\n },\n variants: {\n variant: {\n clean: {},\n bordered: {\n itemTrigger: {\n paddingInline: \"medium\",\n paddingBlock: \"medium\",\n width: \"100%\",\n borderRadius: \"xsmall\",\n boxShadowColor: \"stroke.subtle\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n _hover: {\n background: \"surface.actionSubtle.hover\",\n boxShadowColor: \"stroke.hover\",\n },\n _open: {\n background: \"surface.actionSubtle.active\",\n boxShadowColor: \"stroke.default\",\n borderBottomRadius: \"sharp\",\n },\n _focusVisible: {\n outline: \"none\",\n boxShadowColor: \"stroke.default\",\n boxShadow: \"inset 0 0 0 3px var(--shadow-color)\",\n },\n },\n itemContent: {\n borderBottomRadius: \"xsmall\",\n borderWidth: \"0 1px 1px\",\n borderStyle: \"solid\",\n borderColor: \"stroke.default\",\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(accordionRecipe);\n\nexport type AccordionVariantProps = NonNullable<RecipeVariantProps<typeof accordionRecipe>>;\n\nexport interface AccordionRootProps\n extends StyledProps, Accordion.RootProps, RefAttributes<HTMLDivElement>, AccordionVariantProps {}\n\nexport const InternalAccordionRoot = withProvider(Accordion.Root, \"root\", { baseComponent: true });\n\nexport const AccordionRoot = ({ lazyMount = true, unmountOnExit = true, ...props }: AccordionRootProps) => (\n <InternalAccordionRoot lazyMount={lazyMount} unmountOnExit={unmountOnExit} {...props} />\n);\n\nexport const AccordionItemContent = withContext(Accordion.ItemContent, \"itemContent\", { baseComponent: true });\n\nexport const AccordionItemIndicator = withContext(Accordion.ItemIndicator, \"itemIndicator\", { baseComponent: true });\n\nexport interface AccordionItemProps extends StyledProps, Accordion.ItemProps {}\n\nexport const AccordionItem = withContext(Accordion.Item, \"item\", { baseComponent: true });\n\nexport const AccordionItemTrigger = withContext(Accordion.ItemTrigger, \"itemTrigger\", { baseComponent: true });\n"],"mappings":";;;;;;;;;;;;AA6HA,MAAM,EAAE,cAAc,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KA/GM;CAC1B,OAAOA,wBAAAA,iBAAiB,KAAK;CAC7B,MAAM;EACJ,MAAM;GACJ,SAAS;GACT,eAAe;GACf,KAAK;EACP;E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A,KAAC,uBAAD;CAAkC;CAA0B;CAAe,GAAI;AAAQ,CAAA;AAGzF,MAAa,uBAAuB,YAAYA,wBAAAA,UAAU,aAAa,eAAe,EAAE,eAAe,KAAK,CAAC;AAE7G,MAAa,yBAAyB,YAAYA,wBAAAA,UAAU,eAAe,iBAAiB,EAAE,eAAe,KAAK,CAAC;AAInH,MAAa,gBAAgB,YAAYA,wBAAAA,UAAU,MAAM,QAAQ,EAAE,eAAe,KAAK,CAAC;AAExF,MAAa,uBAAuB,YAAYA,wBAAAA,UAAU,aAAa,eAAe,EAAE,eAAe,KAAK,CAAC"}
|
package/lib/ArticleLists.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 { HTMLStyledProps, RecipeVariantProps, StyledProps } from "@ndla/styled-system/types";
|
|
10
10
|
declare const orderedListRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
|
|
11
11
|
variant: {
|
package/lib/ArticleLists.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/ArticleLists.tsx
|
|
7
7
|
/**
|
|
@@ -59,7 +59,7 @@ const orderedListRecipe = (0, _ndla_styled_system_css.cva)({
|
|
|
59
59
|
}
|
|
60
60
|
} }
|
|
61
61
|
});
|
|
62
|
-
const StyledOrderedList = (0, _ndla_styled_system_jsx.styled)(
|
|
62
|
+
const StyledOrderedList = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.ol, {}, { baseComponent: true });
|
|
63
63
|
const ListContext = (0, react.createContext)(void 0);
|
|
64
64
|
const useCurrentListContext = () => {
|
|
65
65
|
return (0, react.useContext)(ListContext);
|
package/lib/ArticleLists.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleLists.js","names":["ark","css"],"sources":["../src/ArticleLists.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 { HTMLStyledProps, RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport { createContext, type CSSProperties, forwardRef, useContext, useId, useMemo } from \"react\";\n\nconst orderedListRecipe = cva({\n base: {\n paddingInlineStart: \"large\",\n \"& > li\": {\n marginBlock: \"small\",\n _before: {\n position: \"absolute\",\n transform: \"translateX(calc(-100% - token(spacing.small)))\",\n fontVariantNumeric: \"tabular-nums\",\n },\n },\n },\n defaultVariants: {\n variant: \"numbers\",\n },\n variants: {\n variant: {\n numbers: {\n /** We utilize a CSS variable for the counter name to correctly reset counters when nested inside a letter list.\n * This way, the nested number list won't pick up on any other counters named \"numbers\" higher up in the DOM tree.\n * This fixes the following scenario\n * ol (numbers) -> 1.\n * ol(letters) -> A.\n * ol (numbers) -> 1. (Without the CSS variable, this would be 1.1)\n */\n counterReset: \"var(--counter-name) var(--start, 0)\",\n \"& > li\": {\n counterIncrement: \"var(--counter-name)\",\n _before: {\n content: `counters(var(--counter-name), \".\") \". \"`,\n },\n // If a nested OL is not a letters variant, it's a numbers variant. Keep increasing the margin to account for wider numbers.\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"small\",\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"large\",\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"xxlarge\",\n },\n },\n },\n },\n },\n letters: {\n counterReset: \"letters var(--start, 0)\",\n \"& > li\": {\n counterIncrement: \"letters\",\n _before: {\n content: `counter(letters, upper-alpha) \". \"`,\n },\n \"& > ol[data-variant='letters'] > li\": {\n _before: {\n content: `counter(letters, lower-alpha) \". \"`,\n },\n \"& > ol[data-variant='letters'] > li\": {\n _before: {\n content: `counter(letters, lower-roman) \". \"`,\n },\n },\n },\n },\n },\n },\n },\n});\n\nexport type OrderedListVariantProps = NonNullable<RecipeVariantProps<typeof orderedListRecipe>>;\n\nexport interface OrderedListProps extends StyledProps, HTMLArkProps<\"ol\">, OrderedListVariantProps {}\n\nconst StyledOrderedList = styled(ark.ol, {}, { baseComponent: true });\n\nconst ListContext = createContext<\"numbers\" | \"letters\" | undefined>(undefined);\n\nconst useCurrentListContext = () => {\n const ctx = useContext(ListContext);\n return ctx;\n};\n\nexport const OrderedList = forwardRef<HTMLOListElement, OrderedListProps>(\n ({ variant = \"numbers\", css: cssProp, start, ...props }, ref) => {\n const counterId = useId();\n const currentContext = useCurrentListContext();\n\n const style = useMemo(() => {\n const css: Record<string, any> = { \"--start\": start ? start - 1 : 0 };\n if (variant !== currentContext) {\n css[\"--counter-name\"] = counterId;\n }\n return css as CSSProperties;\n }, [start, variant, currentContext, counterId]);\n\n return (\n <ListContext.Provider value={variant ?? \"numbers\"}>\n <StyledOrderedList\n data-embed-type=\"ordered-list\"\n data-variant={variant}\n start={start}\n type={variant === \"letters\" ? \"A\" : undefined}\n css={css.raw(orderedListRecipe.raw({ variant }), cssProp)}\n style={style}\n ref={ref}\n {...props}\n />\n </ListContext.Provider>\n );\n },\n);\n\nexport interface UnOrderedListProps extends StyledProps, HTMLArkProps<\"ul\"> {}\n\nexport const StyledUnOrderedList = styled(\"ul\", {\n base: {\n listStyle: \"revert\",\n marginInlineStart: \"medium\",\n paddingInlineStart: \"small\",\n \"& ul\": {\n marginInlineStart: \"0\",\n },\n \"& li\": {\n marginBlock: \"small\",\n paddingInlineStart: \"small\",\n _marker: {\n color: \"icon.strong\",\n },\n\n \"& > ol\": {\n marginInlineStart: \"0 !important\",\n },\n },\n\n listStyleType: \"disc\",\n \"& > li > ul\": {\n listStyleType: \"circle\",\n \"& > li > ul\": {\n listStyleType: \"square\",\n },\n },\n },\n});\n\nexport const UnOrderedList = forwardRef<HTMLUListElement, UnOrderedListProps>((props, ref) => {\n const counterId = useId();\n\n const style = useMemo(\n () =>\n ({\n \"--counter-name\": counterId,\n }) as CSSProperties,\n [counterId],\n );\n\n return <StyledUnOrderedList ref={ref} style={style} {...props} />;\n});\n\nexport const DefinitionList = styled(\"dl\", {\n base: {\n \"& dt\": {\n fontWeight: \"bold\",\n },\n \"& dd\": {\n marginInlineStart: \"medium\",\n },\n },\n});\n\nexport type DefinitionListProps = HTMLStyledProps<\"dl\">;\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,qBAAA,GAAA,wBAAA,KAAwB;CAC5B,MAAM;EACJ,oBAAoB;EACpB,UAAU;GACR,aAAa;GACb,SAAS;IACP,UAAU;IACV,WAAW;IACX,oBAAoB;
|
|
1
|
+
{"version":3,"file":"ArticleLists.js","names":["ark","css"],"sources":["../src/ArticleLists.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 { HTMLStyledProps, RecipeVariantProps, StyledProps } from \"@ndla/styled-system/types\";\nimport { createContext, type CSSProperties, forwardRef, useContext, useId, useMemo } from \"react\";\n\nconst orderedListRecipe = cva({\n base: {\n paddingInlineStart: \"large\",\n \"& > li\": {\n marginBlock: \"small\",\n _before: {\n position: \"absolute\",\n transform: \"translateX(calc(-100% - token(spacing.small)))\",\n fontVariantNumeric: \"tabular-nums\",\n },\n },\n },\n defaultVariants: {\n variant: \"numbers\",\n },\n variants: {\n variant: {\n numbers: {\n /** We utilize a CSS variable for the counter name to correctly reset counters when nested inside a letter list.\n * This way, the nested number list won't pick up on any other counters named \"numbers\" higher up in the DOM tree.\n * This fixes the following scenario\n * ol (numbers) -> 1.\n * ol(letters) -> A.\n * ol (numbers) -> 1. (Without the CSS variable, this would be 1.1)\n */\n counterReset: \"var(--counter-name) var(--start, 0)\",\n \"& > li\": {\n counterIncrement: \"var(--counter-name)\",\n _before: {\n content: `counters(var(--counter-name), \".\") \". \"`,\n },\n // If a nested OL is not a letters variant, it's a numbers variant. Keep increasing the margin to account for wider numbers.\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"small\",\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"large\",\n \"& > ol:not([data-variant='letters']) > li\": {\n paddingInlineStart: \"xxlarge\",\n },\n },\n },\n },\n },\n letters: {\n counterReset: \"letters var(--start, 0)\",\n \"& > li\": {\n counterIncrement: \"letters\",\n _before: {\n content: `counter(letters, upper-alpha) \". \"`,\n },\n \"& > ol[data-variant='letters'] > li\": {\n _before: {\n content: `counter(letters, lower-alpha) \". \"`,\n },\n \"& > ol[data-variant='letters'] > li\": {\n _before: {\n content: `counter(letters, lower-roman) \". \"`,\n },\n },\n },\n },\n },\n },\n },\n});\n\nexport type OrderedListVariantProps = NonNullable<RecipeVariantProps<typeof orderedListRecipe>>;\n\nexport interface OrderedListProps extends StyledProps, HTMLArkProps<\"ol\">, OrderedListVariantProps {}\n\nconst StyledOrderedList = styled(ark.ol, {}, { baseComponent: true });\n\nconst ListContext = createContext<\"numbers\" | \"letters\" | undefined>(undefined);\n\nconst useCurrentListContext = () => {\n const ctx = useContext(ListContext);\n return ctx;\n};\n\nexport const OrderedList = forwardRef<HTMLOListElement, OrderedListProps>(\n ({ variant = \"numbers\", css: cssProp, start, ...props }, ref) => {\n const counterId = useId();\n const currentContext = useCurrentListContext();\n\n const style = useMemo(() => {\n const css: Record<string, any> = { \"--start\": start ? start - 1 : 0 };\n if (variant !== currentContext) {\n css[\"--counter-name\"] = counterId;\n }\n return css as CSSProperties;\n }, [start, variant, currentContext, counterId]);\n\n return (\n <ListContext.Provider value={variant ?? \"numbers\"}>\n <StyledOrderedList\n data-embed-type=\"ordered-list\"\n data-variant={variant}\n start={start}\n type={variant === \"letters\" ? \"A\" : undefined}\n css={css.raw(orderedListRecipe.raw({ variant }), cssProp)}\n style={style}\n ref={ref}\n {...props}\n />\n </ListContext.Provider>\n );\n },\n);\n\nexport interface UnOrderedListProps extends StyledProps, HTMLArkProps<\"ul\"> {}\n\nexport const StyledUnOrderedList = styled(\"ul\", {\n base: {\n listStyle: \"revert\",\n marginInlineStart: \"medium\",\n paddingInlineStart: \"small\",\n \"& ul\": {\n marginInlineStart: \"0\",\n },\n \"& li\": {\n marginBlock: \"small\",\n paddingInlineStart: \"small\",\n _marker: {\n color: \"icon.strong\",\n },\n\n \"& > ol\": {\n marginInlineStart: \"0 !important\",\n },\n },\n\n listStyleType: \"disc\",\n \"& > li > ul\": {\n listStyleType: \"circle\",\n \"& > li > ul\": {\n listStyleType: \"square\",\n },\n },\n },\n});\n\nexport const UnOrderedList = forwardRef<HTMLUListElement, UnOrderedListProps>((props, ref) => {\n const counterId = useId();\n\n const style = useMemo(\n () =>\n ({\n \"--counter-name\": counterId,\n }) as CSSProperties,\n [counterId],\n );\n\n return <StyledUnOrderedList ref={ref} style={style} {...props} />;\n});\n\nexport const DefinitionList = styled(\"dl\", {\n base: {\n \"& dt\": {\n fontWeight: \"bold\",\n },\n \"& dd\": {\n marginInlineStart: \"medium\",\n },\n },\n});\n\nexport type DefinitionListProps = HTMLStyledProps<\"dl\">;\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,qBAAA,GAAA,wBAAA,KAAwB;CAC5B,MAAM;EACJ,oB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gBAAc;GACP;GACP,MAAM,YAAY,YAAY,MAAM,KAAA;GACpC,KAAKC,wBAAAA,IAAI,IAAI,kBAAkB,IAAI,EAAE,QAAQ,CAAC,GAAG,OAAO;GACjD;GACF;GACL,GAAI;EACL,CAAA;CACmB,CAAA;AAE1B,CACF;AAIA,MAAa,uBAAA,GAAA,wBAAA,QAA6B,MAAM,EAC9C,MAAM;CACJ,WAAW;CACX,mBAAmB;CACnB,oBAAoB;CACpB,QAAQ,EACN,mBAAmB,IACrB;CACA,QAAQ;EACN,aAAa;EACb,oBAAoB;EACpB,SAAS,EACP,OAAO,cACT;EAEA,UAAU,EACR,mBAAmB,eACrB;CACF;CAEA,eAAe;CACf,eAAe;EACb,eAAe;EACf,eAAe,EACb,eAAe,SACjB;CACF;AACF,EACF,CAAC;AAED,MAAa,iBAAA,GAAA,MAAA,aAAkE,OAAO,QAAQ;CAC5F,MAAM,aAAA,GAAA,MAAA,OAAkB;CAUxB,OAAO,iBAAA,GAAA,kBAAA,KAAC,qBAAD;EAA0B;EAAK,QAAA,GAAA,MAAA,gBANjC,EACC,kBAAkB,UACpB,IACF,CAAC,SAAS,CAGqC;EAAG,GAAI;CAAQ,CAAA;AAClE,CAAC;AAED,MAAa,kBAAA,GAAA,wBAAA,QAAwB,MAAM,EACzC,MAAM;CACJ,QAAQ,EACN,YAAY,OACd;CACA,QAAQ,EACN,mBAAmB,SACrB;AACF,EACF,CAAC"}
|
package/lib/Badge.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 badgeRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
|
package/lib/Badge.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/Badge.tsx
|
|
7
7
|
/**
|
|
@@ -60,7 +60,7 @@ const badgeRecipe = (0, _ndla_styled_system_css.cva)({
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
|
-
const StyledBadge = (0, _ndla_styled_system_jsx.styled)(
|
|
63
|
+
const StyledBadge = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.div, {}, { baseComponent: true });
|
|
64
64
|
const Badge = (0, react.forwardRef)(({ colorTheme, size, css: cssProp, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledBadge, {
|
|
65
65
|
css: _ndla_styled_system_css.css.raw(badgeRecipe.raw({
|
|
66
66
|
colorTheme,
|
package/lib/Badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","names":["ark","css"],"sources":["../src/Badge.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 { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst badgeRecipe = cva({\n base: {\n paddingInline: \"xsmall\",\n borderRadius: \"xsmall\",\n border: \"1px solid\",\n width: \"fit-content\",\n color: \"text.default\",\n },\n defaultVariants: {\n colorTheme: \"neutral\",\n size: \"medium\",\n },\n variants: {\n size: {\n small: {\n textStyle: \"label.small\",\n },\n medium: {\n textStyle: \"label.medium\",\n },\n },\n colorTheme: {\n brand1: {\n backgroundColor: \"surface.brand.1.moderate\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n backgroundColor: \"surface.brand.2.moderate\",\n borderColor: \"surface.brand.2.strong\",\n },\n brand3: {\n backgroundColor: \"surface.brand.3.subtle\",\n borderColor: \"surface.brand.3.strong\",\n },\n neutral: {\n backgroundColor: \"surface.infoSubtle\",\n borderColor: \"stroke.info\",\n },\n danger: {\n backgroundColor: \"surface.dangerSubtle\",\n borderColor: \"surface.danger\",\n },\n success: {\n backgroundColor: \"surface.successSubtle\",\n borderColor: \"surface.success\",\n },\n warning: {\n backgroundColor: \"surface.warningSubtle\",\n borderColor: \"surface.warning\",\n },\n },\n },\n});\n\nexport type BadgeVariantProps = NonNullable<RecipeVariantProps<typeof badgeRecipe>>;\n\nexport type BadgeVariant = NonNullable<BadgeVariantProps>[\"colorTheme\"];\n\nexport interface BadgeProps extends StyledProps, HTMLArkProps<\"div\">, BadgeVariantProps {}\n\nconst StyledBadge = styled(ark.div, {}, { baseComponent: true });\n\nexport const Badge = forwardRef<HTMLDivElement, BadgeProps>(({ colorTheme, size, css: cssProp, ...props }, ref) => (\n <StyledBadge css={css.raw(badgeRecipe.raw({ colorTheme, size }), cssProp)} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,eAAA,GAAA,wBAAA,KAAkB;CACtB,MAAM;EACJ,eAAe;EACf,cAAc;EACd,QAAQ;EACR,OAAO;EACP,OAAO;
|
|
1
|
+
{"version":3,"file":"Badge.js","names":["ark","css"],"sources":["../src/Badge.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 { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst badgeRecipe = cva({\n base: {\n paddingInline: \"xsmall\",\n borderRadius: \"xsmall\",\n border: \"1px solid\",\n width: \"fit-content\",\n color: \"text.default\",\n },\n defaultVariants: {\n colorTheme: \"neutral\",\n size: \"medium\",\n },\n variants: {\n size: {\n small: {\n textStyle: \"label.small\",\n },\n medium: {\n textStyle: \"label.medium\",\n },\n },\n colorTheme: {\n brand1: {\n backgroundColor: \"surface.brand.1.moderate\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n backgroundColor: \"surface.brand.2.moderate\",\n borderColor: \"surface.brand.2.strong\",\n },\n brand3: {\n backgroundColor: \"surface.brand.3.subtle\",\n borderColor: \"surface.brand.3.strong\",\n },\n neutral: {\n backgroundColor: \"surface.infoSubtle\",\n borderColor: \"stroke.info\",\n },\n danger: {\n backgroundColor: \"surface.dangerSubtle\",\n borderColor: \"surface.danger\",\n },\n success: {\n backgroundColor: \"surface.successSubtle\",\n borderColor: \"surface.success\",\n },\n warning: {\n backgroundColor: \"surface.warningSubtle\",\n borderColor: \"surface.warning\",\n },\n },\n },\n});\n\nexport type BadgeVariantProps = NonNullable<RecipeVariantProps<typeof badgeRecipe>>;\n\nexport type BadgeVariant = NonNullable<BadgeVariantProps>[\"colorTheme\"];\n\nexport interface BadgeProps extends StyledProps, HTMLArkProps<\"div\">, BadgeVariantProps {}\n\nconst StyledBadge = styled(ark.div, {}, { baseComponent: true });\n\nexport const Badge = forwardRef<HTMLDivElement, BadgeProps>(({ colorTheme, size, css: cssProp, ...props }, ref) => (\n <StyledBadge css={css.raw(badgeRecipe.raw({ colorTheme, size }), cssProp)} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,eAAA,GAAA,wBAAA,KAAkB;CACtB,MAAM;EACJ,eAAe;EACf,cAAc;EACd,QAAQ;EACR,OAAO;EACP,OAAO;CACT;CACA,iBAAiB;EACf,YAAY;EACZ,MAAM;CACR;CACA,UAAU;EACR,MAAM;GACJ,OAAO,EACL,WAAW,cACb;GACA,QAAQ,EACN,WAAW,eACb;EACF;EACA,YAAY;GACV,QAAQ;IACN,iBAAiB;IACjB,aAAa;GACf;GACA,QAAQ;IACN,iBAAiB;IACjB,aAAa;GACf;GACA,QAAQ;IACN,iBAAiB;IACjB,aAAa;GACf;GACA,SAAS;IACP,iBAAiB;IACjB,aAAa;GACf;GACA,QAAQ;IACN,iBAAiB;IACjB,aAAa;GACf;GACA,SAAS;IACP,iBAAiB;IACjB,aAAa;GACf;GACA,SAAS;IACP,iBAAiB;IACjB,aAAa;GACf;EACF;CACF;AACF,CAAC;AAQD,MAAM,eAAA,GAAA,wBAAA,QAAqBA,sBAAAA,IAAI,KAAK,CAAC,GAAG,EAAE,eAAe,KAAK,CAAC;AAE/D,MAAa,SAAA,GAAA,MAAA,aAAgD,EAAE,YAAY,MAAM,KAAK,SAAS,GAAG,SAAS,QACzG,iBAAA,GAAA,kBAAA,KAAC,aAAD;CAAa,KAAKC,wBAAAA,IAAI,IAAI,YAAY,IAAI;EAAE;EAAY;CAAK,CAAC,GAAG,OAAO;CAAG,GAAI;CAAY;AAAM,CAAA,CAClG"}
|
package/lib/BlockQuote.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 blockQuoteRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
|
package/lib/BlockQuote.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/BlockQuote.tsx
|
|
7
7
|
/**
|
|
@@ -32,7 +32,7 @@ const blockQuoteRecipe = (0, _ndla_styled_system_css.cva)({
|
|
|
32
32
|
} },
|
|
33
33
|
defaultVariants: { variant: "neutral" }
|
|
34
34
|
});
|
|
35
|
-
const StyledBlockQuote = (0, _ndla_styled_system_jsx.styled)(
|
|
35
|
+
const StyledBlockQuote = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.blockquote, {}, { baseComponent: true });
|
|
36
36
|
const BlockQuote = (0, react.forwardRef)(({ variant, css: cssProp, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledBlockQuote, {
|
|
37
37
|
css: _ndla_styled_system_css.css.raw(blockQuoteRecipe.raw({ variant }), cssProp),
|
|
38
38
|
...props,
|
package/lib/BlockQuote.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockQuote.js","names":["ark","css"],"sources":["../src/BlockQuote.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, type HTMLArkProps } from \"@ark-ui/react\";\nimport { type RecipeVariantProps, css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst blockQuoteRecipe = cva({\n base: {\n borderInlineStart: \"4px solid\",\n paddingInline: \"medium\",\n },\n variants: {\n variant: {\n neutral: {\n borderColor: \"stroke.subtle\",\n background: \"surface.default\",\n },\n brand1: {\n background: \"surface.brand.1.subtle\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n background: \"surface.brand.2.subtle\",\n borderColor: \"surface.brand.2.strong\",\n },\n },\n },\n defaultVariants: {\n variant: \"neutral\",\n },\n});\n\nexport type BlockQuoteVariantProps = NonNullable<RecipeVariantProps<typeof blockQuoteRecipe>>;\n\nexport interface BlockQuoteProps extends HTMLArkProps<\"blockquote\">, StyledProps, BlockQuoteVariantProps {}\n\nconst StyledBlockQuote = styled(ark.blockquote, {}, { baseComponent: true });\n\nexport const BlockQuote = forwardRef<HTMLQuoteElement, BlockQuoteProps>(({ variant, css: cssProp, ...props }, ref) => (\n <StyledBlockQuote css={css.raw(blockQuoteRecipe.raw({ variant }), cssProp)} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,oBAAA,GAAA,wBAAA,KAAuB;CAC3B,MAAM;EACJ,mBAAmB;EACnB,eAAe;
|
|
1
|
+
{"version":3,"file":"BlockQuote.js","names":["ark","css"],"sources":["../src/BlockQuote.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, type HTMLArkProps } from \"@ark-ui/react/factory\";\nimport { type RecipeVariantProps, css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst blockQuoteRecipe = cva({\n base: {\n borderInlineStart: \"4px solid\",\n paddingInline: \"medium\",\n },\n variants: {\n variant: {\n neutral: {\n borderColor: \"stroke.subtle\",\n background: \"surface.default\",\n },\n brand1: {\n background: \"surface.brand.1.subtle\",\n borderColor: \"surface.brand.1.strong\",\n },\n brand2: {\n background: \"surface.brand.2.subtle\",\n borderColor: \"surface.brand.2.strong\",\n },\n },\n },\n defaultVariants: {\n variant: \"neutral\",\n },\n});\n\nexport type BlockQuoteVariantProps = NonNullable<RecipeVariantProps<typeof blockQuoteRecipe>>;\n\nexport interface BlockQuoteProps extends HTMLArkProps<\"blockquote\">, StyledProps, BlockQuoteVariantProps {}\n\nconst StyledBlockQuote = styled(ark.blockquote, {}, { baseComponent: true });\n\nexport const BlockQuote = forwardRef<HTMLQuoteElement, BlockQuoteProps>(({ variant, css: cssProp, ...props }, ref) => (\n <StyledBlockQuote css={css.raw(blockQuoteRecipe.raw({ variant }), cssProp)} {...props} ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,oBAAA,GAAA,wBAAA,KAAuB;CAC3B,MAAM;EACJ,mBAAmB;EACnB,eAAe;CACjB;CACA,UAAU,EACR,SAAS;EACP,SAAS;GACP,aAAa;GACb,YAAY;EACd;EACA,QAAQ;GACN,YAAY;GACZ,aAAa;EACf;EACA,QAAQ;GACN,YAAY;GACZ,aAAa;EACf;CACF,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CAAC;AAMD,MAAM,oBAAA,GAAA,wBAAA,QAA0BA,sBAAAA,IAAI,YAAY,CAAC,GAAG,EAAE,eAAe,KAAK,CAAC;AAE3E,MAAa,cAAA,GAAA,MAAA,aAA4D,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,QAC5G,iBAAA,GAAA,kBAAA,KAAC,kBAAD;CAAkB,KAAKC,wBAAAA,IAAI,IAAI,iBAAiB,IAAI,EAAE,QAAQ,CAAC,GAAG,OAAO;CAAG,GAAI;CAAY;AAAM,CAAA,CACnG"}
|
package/lib/Button.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
|
import { type ReactNode } from "react";
|
package/lib/Button.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_Spinner = require("./Spinner.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/Button.tsx
|
|
8
8
|
/**
|
|
@@ -200,7 +200,7 @@ const iconButtonRecipe = (0, _ndla_styled_system_css.cva)({
|
|
|
200
200
|
}
|
|
201
201
|
} }
|
|
202
202
|
});
|
|
203
|
-
const StyledButton = (0, _ndla_styled_system_jsx.styled)(
|
|
203
|
+
const StyledButton = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.button, {}, {
|
|
204
204
|
baseComponent: true,
|
|
205
205
|
defaultProps: { type: "button" }
|
|
206
206
|
});
|
package/lib/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["ark","Spinner","css"],"sources":["../src/Button.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 { type ReactNode, forwardRef, useMemo } from \"react\";\nimport { Spinner } from \"./Spinner\";\n\nexport const buttonBaseRecipe = cva({\n base: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"xxsmall\",\n cursor: \"pointer\",\n textDecoration: \"none\",\n fontWeight: \"bold\",\n transitionProperty: \"all\",\n transitionDuration: \"fast\",\n transitionTimingFunction: \"default\",\n textAlign: \"center\",\n borderRadius: \"xsmall\",\n outline: \"none\",\n boxShadowColor: \"stroke.default\",\n _disabled: {\n cursor: \"not-allowed\",\n color: \"text.onAction\",\n background: \"surface.disabled\",\n boxShadowColor: \"surface.disabled\",\n \"& svg\": {\n color: \"text.onAction\",\n },\n _hover: {\n color: \"text.onAction\",\n background: \"surface.disabled\",\n },\n },\n _focusVisible: {\n boxShadow: \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color)\",\n },\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n },\n variants: {\n variant: {\n primary: {\n color: \"text.onAction\",\n background: \"surface.action\",\n _hover: {\n color: \"text.onAction\",\n background: \"surface.action.hover\",\n },\n _active: {\n color: \"text.onAction\",\n background: \"surface.action.active\",\n },\n _focusVisible: {\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n _on: {\n background: \"surface.action.selected\",\n },\n },\n secondary: {\n color: \"text.strong\",\n background: \"surface.default\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n _hover: {\n background: \"surface.actionSubtle.hover\",\n },\n _active: {\n background: \"surface.actionSubtle.hover.strong\",\n },\n _on: {\n background: \"surface.actionSubtle.active\",\n },\n },\n tertiary: {\n color: \"text.strong\",\n background: \"transparent\",\n _hover: {\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n background: \"surface.actionSubtle.hover\",\n _focusVisible: {\n boxShadow: \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color)\",\n },\n },\n _active: {\n borderColor: \"stroke.default\",\n background: \"surface.actionSubtle.hover.strong\",\n },\n _on: {\n background: \"surface.actionSubtle.active\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n },\n },\n clear: {\n background: \"transparent\",\n color: \"text.strong\",\n _hover: {\n color: \"stroke.hover\",\n },\n },\n clearSubtle: {\n background: \"transparent\",\n color: \"text.onAction\",\n _hover: {\n color: \"surface.actionSubtle.hover.strong\",\n },\n },\n danger: {\n background: \"surface.danger\",\n color: \"text.onAction\",\n _hover: {\n background: \"surface.danger.hover\",\n },\n _active: {\n background: \"surface.danger.active\",\n },\n _focusVisible: {\n boxShadowColor: \"surface.danger\",\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n },\n success: {\n background: \"surface.success\",\n color: \"text.onAction\",\n _hover: {\n background: \"surface.success.hover\",\n },\n _active: {\n background: \"surface.success.active\",\n },\n _focusVisible: {\n boxShadowColor: \"surface.success\",\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n },\n link: {\n background: \"transparent\",\n color: \"text.link\",\n fontWeight: \"normal\",\n textDecoration: \"underline\",\n transitionProperty: \"unset\",\n transitionTimingFunction: \"unset\",\n transitionDuration: \"unset\",\n _hover: {\n textDecoration: \"none\",\n },\n _focusVisible: {\n boxShadow: \"none\",\n outline: \"3px\",\n borderRadius: \"xsmall\",\n outlineColor: \"stroke.default\",\n outlineOffset: \"3px\",\n outlineStyle: \"solid\",\n },\n },\n },\n },\n});\n\nexport const buttonRecipe = cva({\n defaultVariants: {\n size: \"medium\",\n },\n variants: {\n size: {\n medium: {\n textStyle: \"label.medium\",\n paddingInline: \"small\",\n paddingBlock: \"xxsmall\",\n minHeight: \"24\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"medium\",\n height: \"medium\",\n },\n },\n small: {\n textStyle: \"label.small\",\n minHeight: \"large\",\n paddingInline: \"xsmall\",\n paddingBlock: \"4xsmall\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"small\",\n height: \"small\",\n },\n },\n },\n },\n});\n\nexport const iconButtonRecipe = cva({\n base: {\n lineHeight: \"1\",\n minHeight: \"unset\",\n },\n defaultVariants: {\n size: \"medium\",\n },\n variants: {\n size: {\n medium: {\n \"--shadow-width\": \"3px\",\n height: \"xxlarge\",\n width: \"xxlarge\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"medium\",\n height: \"medium\",\n },\n paddingInline: \"xsmall\",\n paddingBlock: \"xsmall\",\n },\n small: {\n \"--shadow-width\": \"2px\",\n height: \"large\",\n width: \"large\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"small\",\n height: \"small\",\n },\n paddingInline: \"xxsmall\",\n paddingBlock: \"xxsmall\",\n },\n },\n },\n});\n\ntype Variant = RecipeVariant<typeof buttonBaseRecipe>[\"variant\"];\n\ntype ButtonVariant = Exclude<Variant, \"clear\" | \"clearSubtle\">;\n\nexport interface ButtonVariantProps extends NonNullable<RecipeVariantProps<typeof buttonRecipe>> {\n variant?: ButtonVariant;\n}\n\nexport interface BaseButtonProps extends HTMLArkProps<\"button\">, StyledProps {\n loading?: boolean;\n loadingContent?: ReactNode;\n replaceContent?: boolean;\n}\n\nexport interface ButtonProps extends BaseButtonProps, ButtonVariantProps {}\n\nconst StyledButton = styled(ark.button, {}, { baseComponent: true, defaultProps: { type: \"button\" } });\n\nexport const BaseButton = forwardRef<HTMLButtonElement, BaseButtonProps>(\n ({ loading, loadingContent: loadingContentProp, replaceContent, onClick: _onClick, children, ...props }, ref) => {\n const ariaDisabled = loading ? { \"aria-disabled\": true } : {};\n\n const onClick = useMemo(() => (loading ? undefined : _onClick), [_onClick, loading]);\n\n const loadingContent = useMemo(() => {\n return replaceContent ? (\n loadingContentProp\n ) : (\n <>\n {loadingContentProp}\n {children}\n </>\n );\n }, [children, loadingContentProp, replaceContent]);\n\n return (\n <StyledButton onClick={onClick} {...ariaDisabled} {...props} ref={ref}>\n {loading ? loadingContent : children}\n </StyledButton>\n );\n },\n);\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ variant, loadingContent, size, css: cssProp, ...props }, ref) => (\n <BaseButton\n {...props}\n loadingContent={loadingContent ?? <Spinner size=\"small\" />}\n css={css.raw(\n buttonBaseRecipe.raw({ variant }),\n variant !== \"link\" ? buttonRecipe.raw({ size }) : undefined,\n cssProp,\n )}\n ref={ref}\n />\n ),\n);\n\ntype IconButtonVariant = Exclude<Variant, \"link\">;\n\nexport interface IconButtonVariantProps extends NonNullable<RecipeVariantProps<typeof iconButtonRecipe>> {\n variant?: IconButtonVariant;\n}\n\nexport interface IconButtonProps extends BaseButtonProps, IconButtonVariantProps {}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ variant, css: cssProp, loadingContent, size, replaceContent = true, ...props }, ref) => (\n <BaseButton\n {...props}\n css={css.raw(buttonBaseRecipe.raw({ variant }), iconButtonRecipe.raw({ size }), cssProp)}\n loadingContent={loadingContent ?? <Spinner size=\"small\" />}\n replaceContent={replaceContent}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAa,oBAAA,GAAA,wBAAA,KAAuB;CAClC,MAAM;EACJ,SAAS;EACT,YAAY;EACZ,gBAAgB;EAChB,KAAK;EACL,QAAQ;EACR,gBAAgB;EAChB,YAAY;EACZ,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,WAAW;EACX,cAAc;EACd,SAAS;EACT,gBAAgB;EAChB,WAAW;GACT,QAAQ;GACR,OAAO;GACP,YAAY;GACZ,gBAAgB;GAChB,SAAS,EACP,OAAO,iBACR;GACD,QAAQ;IACN,OAAO;IACP,YAAY;IACb;GACF;EACD,eAAe,EACb,WAAW,4DACZ;EACD,eAAe;GAC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AA,MAAA,kBAAA,UAAA,EAAA,UAAA,CACG,oBACA,SACA,EAAA,CAAA;IAEJ;EAAC;EAAU;EAAoB;EAAe,CAAC;AAElD,QACE,iBAAA,GAAA,kBAAA,KAAC,cAAD;EAAuB;EAAS,GAAI;EAAc,GAAI;EAAY;YAC/D,UAAU,iBAAiB;EACf,CAAA;EAGpB;AAED,MAAa,UAAA,GAAA,MAAA,aACV,EAAE,SAAS,gBAAgB,MAAM,KAAK,SAAS,GAAG,SAAS,QAC1D,iBAAA,GAAA,kBAAA,KAAC,YAAD;CACE,GAAI;CACJ,gBAAgB,kBAAkB,iBAAA,GAAA,kBAAA,KAACC,gBAAAA,SAAD,EAAS,MAAK,SAAU,CAAA;CAC1D,KAAKC,wBAAAA,IAAI,IACP,iBAAiB,IAAI,EAAE,SAAS,CAAC,EACjC,YAAY,SAAS,aAAa,IAAI,EAAE,MAAM,CAAC,GAAG,KAAA,GAClD,QACD;CACI;CACL,CAAA,CAEL;AAUD,MAAa,cAAA,GAAA,MAAA,aACV,EAAE,SAAS,KAAK,SAAS,gBAAgB,MAAM,iBAAiB,MAAM,GAAG,SAAS,QACjF,iBAAA,GAAA,kBAAA,KAAC,YAAD;CACE,GAAI;CACJ,KAAKA,wBAAAA,IAAI,IAAI,iBAAiB,IAAI,EAAE,SAAS,CAAC,EAAE,iBAAiB,IAAI,EAAE,MAAM,CAAC,EAAE,QAAQ;CACxF,gBAAgB,kBAAkB,iBAAA,GAAA,kBAAA,KAACD,gBAAAA,SAAD,EAAS,MAAK,SAAU,CAAA;CAC1C;CACX;CACL,CAAA,CAEL"}
|
|
1
|
+
{"version":3,"file":"Button.js","names":["ark","Spinner","css"],"sources":["../src/Button.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 { type ReactNode, forwardRef, useMemo } from \"react\";\nimport { Spinner } from \"./Spinner\";\n\nexport const buttonBaseRecipe = cva({\n base: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"xxsmall\",\n cursor: \"pointer\",\n textDecoration: \"none\",\n fontWeight: \"bold\",\n transitionProperty: \"all\",\n transitionDuration: \"fast\",\n transitionTimingFunction: \"default\",\n textAlign: \"center\",\n borderRadius: \"xsmall\",\n outline: \"none\",\n boxShadowColor: \"stroke.default\",\n _disabled: {\n cursor: \"not-allowed\",\n color: \"text.onAction\",\n background: \"surface.disabled\",\n boxShadowColor: \"surface.disabled\",\n \"& svg\": {\n color: \"text.onAction\",\n },\n _hover: {\n color: \"text.onAction\",\n background: \"surface.disabled\",\n },\n },\n _focusVisible: {\n boxShadow: \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color)\",\n },\n _motionReduce: {\n transition: \"none\",\n transitionDuration: \"0s\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n },\n variants: {\n variant: {\n primary: {\n color: \"text.onAction\",\n background: \"surface.action\",\n _hover: {\n color: \"text.onAction\",\n background: \"surface.action.hover\",\n },\n _active: {\n color: \"text.onAction\",\n background: \"surface.action.active\",\n },\n _focusVisible: {\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n _on: {\n background: \"surface.action.selected\",\n },\n },\n secondary: {\n color: \"text.strong\",\n background: \"surface.default\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n _hover: {\n background: \"surface.actionSubtle.hover\",\n },\n _active: {\n background: \"surface.actionSubtle.hover.strong\",\n },\n _on: {\n background: \"surface.actionSubtle.active\",\n },\n },\n tertiary: {\n color: \"text.strong\",\n background: \"transparent\",\n _hover: {\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n background: \"surface.actionSubtle.hover\",\n _focusVisible: {\n boxShadow: \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color)\",\n },\n },\n _active: {\n borderColor: \"stroke.default\",\n background: \"surface.actionSubtle.hover.strong\",\n },\n _on: {\n background: \"surface.actionSubtle.active\",\n boxShadow: \"inset 0 0 0 1px var(--shadow-color)\",\n },\n },\n clear: {\n background: \"transparent\",\n color: \"text.strong\",\n _hover: {\n color: \"stroke.hover\",\n },\n },\n clearSubtle: {\n background: \"transparent\",\n color: \"text.onAction\",\n _hover: {\n color: \"surface.actionSubtle.hover.strong\",\n },\n },\n danger: {\n background: \"surface.danger\",\n color: \"text.onAction\",\n _hover: {\n background: \"surface.danger.hover\",\n },\n _active: {\n background: \"surface.danger.active\",\n },\n _focusVisible: {\n boxShadowColor: \"surface.danger\",\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n },\n success: {\n background: \"surface.success\",\n color: \"text.onAction\",\n _hover: {\n background: \"surface.success.hover\",\n },\n _active: {\n background: \"surface.success.active\",\n },\n _focusVisible: {\n boxShadowColor: \"surface.success\",\n boxShadow:\n \"inset 0 0 0 var(--shadow-width, 3px) var(--shadow-color), inset 0px 0px 0px calc(var(--shadow-width, 3px) * 2) currentcolor\",\n },\n },\n link: {\n background: \"transparent\",\n color: \"text.link\",\n fontWeight: \"normal\",\n textDecoration: \"underline\",\n transitionProperty: \"unset\",\n transitionTimingFunction: \"unset\",\n transitionDuration: \"unset\",\n _hover: {\n textDecoration: \"none\",\n },\n _focusVisible: {\n boxShadow: \"none\",\n outline: \"3px\",\n borderRadius: \"xsmall\",\n outlineColor: \"stroke.default\",\n outlineOffset: \"3px\",\n outlineStyle: \"solid\",\n },\n },\n },\n },\n});\n\nexport const buttonRecipe = cva({\n defaultVariants: {\n size: \"medium\",\n },\n variants: {\n size: {\n medium: {\n textStyle: \"label.medium\",\n paddingInline: \"small\",\n paddingBlock: \"xxsmall\",\n minHeight: \"24\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"medium\",\n height: \"medium\",\n },\n },\n small: {\n textStyle: \"label.small\",\n minHeight: \"large\",\n paddingInline: \"xsmall\",\n paddingBlock: \"4xsmall\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"small\",\n height: \"small\",\n },\n },\n },\n },\n});\n\nexport const iconButtonRecipe = cva({\n base: {\n lineHeight: \"1\",\n minHeight: \"unset\",\n },\n defaultVariants: {\n size: \"medium\",\n },\n variants: {\n size: {\n medium: {\n \"--shadow-width\": \"3px\",\n height: \"xxlarge\",\n width: \"xxlarge\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"medium\",\n height: \"medium\",\n },\n paddingInline: \"xsmall\",\n paddingBlock: \"xsmall\",\n },\n small: {\n \"--shadow-width\": \"2px\",\n height: \"large\",\n width: \"large\",\n \"& svg\": {\n marginInline: \"0\",\n marginBlock: \"0\",\n width: \"small\",\n height: \"small\",\n },\n paddingInline: \"xxsmall\",\n paddingBlock: \"xxsmall\",\n },\n },\n },\n});\n\ntype Variant = RecipeVariant<typeof buttonBaseRecipe>[\"variant\"];\n\ntype ButtonVariant = Exclude<Variant, \"clear\" | \"clearSubtle\">;\n\nexport interface ButtonVariantProps extends NonNullable<RecipeVariantProps<typeof buttonRecipe>> {\n variant?: ButtonVariant;\n}\n\nexport interface BaseButtonProps extends HTMLArkProps<\"button\">, StyledProps {\n loading?: boolean;\n loadingContent?: ReactNode;\n replaceContent?: boolean;\n}\n\nexport interface ButtonProps extends BaseButtonProps, ButtonVariantProps {}\n\nconst StyledButton = styled(ark.button, {}, { baseComponent: true, defaultProps: { type: \"button\" } });\n\nexport const BaseButton = forwardRef<HTMLButtonElement, BaseButtonProps>(\n ({ loading, loadingContent: loadingContentProp, replaceContent, onClick: _onClick, children, ...props }, ref) => {\n const ariaDisabled = loading ? { \"aria-disabled\": true } : {};\n\n const onClick = useMemo(() => (loading ? undefined : _onClick), [_onClick, loading]);\n\n const loadingContent = useMemo(() => {\n return replaceContent ? (\n loadingContentProp\n ) : (\n <>\n {loadingContentProp}\n {children}\n </>\n );\n }, [children, loadingContentProp, replaceContent]);\n\n return (\n <StyledButton onClick={onClick} {...ariaDisabled} {...props} ref={ref}>\n {loading ? loadingContent : children}\n </StyledButton>\n );\n },\n);\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ variant, loadingContent, size, css: cssProp, ...props }, ref) => (\n <BaseButton\n {...props}\n loadingContent={loadingContent ?? <Spinner size=\"small\" />}\n css={css.raw(\n buttonBaseRecipe.raw({ variant }),\n variant !== \"link\" ? buttonRecipe.raw({ size }) : undefined,\n cssProp,\n )}\n ref={ref}\n />\n ),\n);\n\ntype IconButtonVariant = Exclude<Variant, \"link\">;\n\nexport interface IconButtonVariantProps extends NonNullable<RecipeVariantProps<typeof iconButtonRecipe>> {\n variant?: IconButtonVariant;\n}\n\nexport interface IconButtonProps extends BaseButtonProps, IconButtonVariantProps {}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ variant, css: cssProp, loadingContent, size, replaceContent = true, ...props }, ref) => (\n <BaseButton\n {...props}\n css={css.raw(buttonBaseRecipe.raw({ variant }), iconButtonRecipe.raw({ size }), cssProp)}\n loadingContent={loadingContent ?? <Spinner size=\"small\" />}\n replaceContent={replaceContent}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAa,oBAAA,GAAA,wBAAA,KAAuB;CAClC,MAAM;EACJ,SAAS;EACT,YAAY;EACZ,gBAAgB;EAChB,KAAK;EACL,QAAQ;EACR,gBAAgB;EAChB,YAAY;EACZ,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,WAAW;EACX,cAAc;EACd,SAAS;EACT,gBAAgB;EAChB,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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 TextProps } from "../Text";
|
|
11
11
|
declare const cardRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeFn<"root" | "content" | "title" | "image", {
|
|
@@ -27,7 +27,7 @@ declare const cardRecipe: import("@ndla/styled-system/types").SlotRecipeRuntimeF
|
|
|
27
27
|
export type CardVariantProps = NonNullable<RecipeVariantProps<typeof cardRecipe>>;
|
|
28
28
|
export interface CardRootProps extends HTMLArkProps<"article">, StyledProps, CardVariantProps {
|
|
29
29
|
}
|
|
30
|
-
export declare const CardRoot: 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" | "image", {
|
|
30
|
+
export declare const CardRoot: 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" | "image", {
|
|
31
31
|
nonInteractive: {
|
|
32
32
|
true: {};
|
|
33
33
|
false: {
|
|
@@ -46,6 +46,6 @@ export declare const CardRoot: import("@ndla/styled-system/jsx").StyleContextPro
|
|
|
46
46
|
interface CardHeadingProps extends StyledProps, Omit<HTMLArkProps<"p">, "color">, TextProps {
|
|
47
47
|
}
|
|
48
48
|
export declare const CardHeading: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<CardHeadingProps & import("react").RefAttributes<HTMLHeadingElement>>>;
|
|
49
|
-
export declare const CardContent: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react").PolymorphicProps>>;
|
|
49
|
+
export declare const CardContent: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & import("@ark-ui/react/factory").PolymorphicProps>>;
|
|
50
50
|
export declare const CardImage: import("@ndla/styled-system/jsx").StyleContextConsumer<import("react").ForwardRefExoticComponent<Omit<import("..").ImageProps, "ref"> & import("react").RefAttributes<HTMLImageElement>>>;
|
|
51
51
|
export {};
|
package/lib/Card/Card.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_Image = require("../Image.js");
|
|
2
2
|
const require_Text = require("../Text.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");
|
|
6
|
+
let _ark_ui_react_factory = require("@ark-ui/react/factory");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
//#region src/Card/Card.tsx
|
|
9
9
|
/**
|
|
@@ -65,14 +65,14 @@ const { withProvider, withContext } = (0, _ndla_styled_system_jsx.createStyleCon
|
|
|
65
65
|
} }
|
|
66
66
|
} }
|
|
67
67
|
}));
|
|
68
|
-
const CardRoot = withProvider(
|
|
68
|
+
const CardRoot = withProvider(_ark_ui_react_factory.ark.article, "root", { baseComponent: true });
|
|
69
69
|
const CardHeading = withContext((0, react.forwardRef)(({ textStyle = "label.large", fontWeight = "bold", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Heading, {
|
|
70
70
|
textStyle,
|
|
71
71
|
fontWeight,
|
|
72
72
|
...props,
|
|
73
73
|
ref
|
|
74
74
|
})), "title");
|
|
75
|
-
const CardContent = withContext(
|
|
75
|
+
const CardContent = withContext(_ark_ui_react_factory.ark.div, "content", { baseComponent: true });
|
|
76
76
|
const CardImage = withContext(require_Image.Image, "image");
|
|
77
77
|
//#endregion
|
|
78
78
|
exports.CardContent = CardContent;
|
package/lib/Card/Card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","names":["ark","Heading","Image"],"sources":["../../src/Card/Card.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, type HTMLArkProps } from \"@ark-ui/react\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport { Image } from \"../Image\";\nimport { Heading, type TextProps } from \"../Text\";\n\nconst cardRecipe = sva({\n slots: [\"root\", \"title\", \"content\", \"image\"],\n base: {\n root: {\n position: \"relative\",\n outline: \"1px solid\",\n borderRadius: \"xsmall\",\n outlineColor: \"transparent\",\n outlineOffset: \"-1px\",\n height: \"100%\",\n boxShadow: \"xsmall\",\n transitionDuration: \"fast\",\n transitionProperty: \"background, color, outline-color\",\n transitionTimingFunction: \"default\",\n background: \"surface.default\",\n overflow: \"hidden\",\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"small\",\n paddingBlockStart: \"small\",\n paddingBlockEnd: \"medium\",\n paddingInline: \"small\",\n },\n title: {\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n image: {\n height: \"200px\",\n objectFit: \"cover\",\n width: \"100%\",\n },\n },\n defaultVariants: {\n nonInteractive: false,\n },\n variants: {\n nonInteractive: {\n true: {},\n false: {\n root: {\n _hover: {\n background: \"surface.hover\",\n outlineColor: \"stroke.hover\",\n },\n _active: {\n background: \"surface.active\",\n },\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(cardRecipe);\n\nexport type CardVariantProps = NonNullable<RecipeVariantProps<typeof cardRecipe>>;\n\nexport interface CardRootProps extends HTMLArkProps<\"article\">, StyledProps, CardVariantProps {}\n\nexport const CardRoot = withProvider(ark.article, \"root\", { baseComponent: true });\n\ninterface CardHeadingProps extends StyledProps, Omit<HTMLArkProps<\"p\">, \"color\">, TextProps {}\n\nconst InternalCardHeading = forwardRef<HTMLHeadingElement, CardHeadingProps>(\n ({ textStyle = \"label.large\", fontWeight = \"bold\", ...props }, ref) => (\n <Heading textStyle={textStyle} fontWeight={fontWeight} {...props} ref={ref} />\n ),\n);\n\nexport const CardHeading = withContext(InternalCardHeading, \"title\");\n\nexport const CardContent = withContext(ark.div, \"content\", { baseComponent: true });\n\nexport const CardImage = withContext(Image, \"image\");\n"],"mappings":";;;;;;;;;;;;;;;AA0EA,MAAM,EAAE,cAAc,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KA1DC;CACrB,OAAO;EAAC;EAAQ;EAAS;EAAW;
|
|
1
|
+
{"version":3,"file":"Card.js","names":["ark","Heading","Image"],"sources":["../../src/Card/Card.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, type HTMLArkProps } from \"@ark-ui/react/factory\";\nimport { sva } from \"@ndla/styled-system/css\";\nimport { createStyleContext } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\nimport { Image } from \"../Image\";\nimport { Heading, type TextProps } from \"../Text\";\n\nconst cardRecipe = sva({\n slots: [\"root\", \"title\", \"content\", \"image\"],\n base: {\n root: {\n position: \"relative\",\n outline: \"1px solid\",\n borderRadius: \"xsmall\",\n outlineColor: \"transparent\",\n outlineOffset: \"-1px\",\n height: \"100%\",\n boxShadow: \"xsmall\",\n transitionDuration: \"fast\",\n transitionProperty: \"background, color, outline-color\",\n transitionTimingFunction: \"default\",\n background: \"surface.default\",\n overflow: \"hidden\",\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"small\",\n paddingBlockStart: \"small\",\n paddingBlockEnd: \"medium\",\n paddingInline: \"small\",\n },\n title: {\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n image: {\n height: \"200px\",\n objectFit: \"cover\",\n width: \"100%\",\n },\n },\n defaultVariants: {\n nonInteractive: false,\n },\n variants: {\n nonInteractive: {\n true: {},\n false: {\n root: {\n _hover: {\n background: \"surface.hover\",\n outlineColor: \"stroke.hover\",\n },\n _active: {\n background: \"surface.active\",\n },\n },\n },\n },\n },\n});\n\nconst { withProvider, withContext } = createStyleContext(cardRecipe);\n\nexport type CardVariantProps = NonNullable<RecipeVariantProps<typeof cardRecipe>>;\n\nexport interface CardRootProps extends HTMLArkProps<\"article\">, StyledProps, CardVariantProps {}\n\nexport const CardRoot = withProvider(ark.article, \"root\", { baseComponent: true });\n\ninterface CardHeadingProps extends StyledProps, Omit<HTMLArkProps<\"p\">, \"color\">, TextProps {}\n\nconst InternalCardHeading = forwardRef<HTMLHeadingElement, CardHeadingProps>(\n ({ textStyle = \"label.large\", fontWeight = \"bold\", ...props }, ref) => (\n <Heading textStyle={textStyle} fontWeight={fontWeight} {...props} ref={ref} />\n ),\n);\n\nexport const CardHeading = withContext(InternalCardHeading, \"title\");\n\nexport const CardContent = withContext(ark.div, \"content\", { baseComponent: true });\n\nexport const CardImage = withContext(Image, \"image\");\n"],"mappings":";;;;;;;;;;;;;;;AA0EA,MAAM,EAAE,cAAc,iBAAA,GAAA,wBAAA,qBAAA,GAAA,wBAAA,KA1DC;CACrB,OAAO;EAAC;EAAQ;EAAS;EAAW;CAAO;CAC3C,MAAM;EACJ,MAAM;GACJ,UAAU;GACV,SAAS;GACT,cAAc;GACd,cAAc;GACd,eAAe;GACf,QAAQ;GACR,WAAW;GACX,oBAAoB;GACpB,oBAAoB;GACpB,0BAA0B;GAC1B,YAAY;GACZ,UAAU;EACZ;EACA,SAAS;GACP,SAAS;GACT,eAAe;GACf,KAAK;GACL,mBAAmB;GACnB,iBAAiB;GACjB,eAAe;EACjB;EACA,OAAO;GACL,gBAAgB;GAChB,QAAQ,EACN,gBAAgB,OAClB;EACF;EACA,OAAO;GACL,QAAQ;GACR,WAAW;GACX,OAAO;EACT;CACF;CACA,iBAAiB,EACf,gBAAgB,MAClB;CACA,UAAU,EACR,gBAAgB;EACd,MAAM,CAAC;EACP,OAAO,EACL,MAAM;GACJ,QAAQ;IACN,YAAY;IACZ,cAAc;GAChB;GACA,SAAS,EACP,YAAY,iBACd;EACF,EACF;CACF,EACF;AACF,CAEkE,CAAC;AAMnE,MAAa,WAAW,aAAaA,sBAAAA,IAAI,SAAS,QAAQ,EAAE,eAAe,KAAK,CAAC;AAUjF,MAAa,cAAc,aANrB,GAAA,MAAA,aACH,EAAE,YAAY,eAAe,aAAa,QAAQ,GAAG,SAAS,QAC7D,iBAAA,GAAA,kBAAA,KAACC,aAAAA,SAAD;CAAoB;CAAuB;CAAY,GAAI;CAAY;AAAM,CAAA,CAI1C,GAAqB,OAAO;AAEnE,MAAa,cAAc,YAAYD,sBAAAA,IAAI,KAAK,WAAW,EAAE,eAAe,KAAK,CAAC;AAElF,MAAa,YAAY,YAAYE,cAAAA,OAAO,OAAO"}
|
package/lib/Checkbox.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 { Checkbox
|
|
8
|
+
import { Checkbox } from "@ark-ui/react/checkbox";
|
|
9
|
+
import { type HTMLArkProps } from "@ark-ui/react/factory";
|
|
9
10
|
import type { RecipeVariantProps, StyledProps } from "@ndla/styled-system/types";
|
|
10
11
|
import type { RefAttributes } from "react";
|
|
11
12
|
import { type TextProps } from "./Text";
|