@postenbring/hedwig-react
Advanced tools
Comparing version 0.0.0-icon-button-C0L88PWY-20231126142551 to 0.0.0-icon-button-C0L88PWY-20231127102552
@@ -61,3 +61,3 @@ "use strict"; | ||
var import_base = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_badge = require("@postenbring/hedwig-css/dist/badge/badge.css"); | ||
var import_badge = require("@postenbring/hedwig-css/dist/badge.css"); | ||
@@ -64,0 +64,0 @@ // src/badge/badge.tsx |
@@ -1,2 +0,36 @@ | ||
import 'react'; | ||
export { a as Box, c as BoxCloseButton, b as BoxCloseButtonProps, B as BoxProps } from '../index-OpbVH1tp.js'; | ||
import * as React$1 from 'react'; | ||
import { O as OverridableComponent } from '../utils-BfZsjuFH.js'; | ||
interface BoxProps extends React.HTMLAttributes<HTMLDivElement> { | ||
variant?: "light-grey" | "lighter" | "white" | "warning"; | ||
children: React.ReactNode; | ||
/** | ||
* If `true`, the close button will be hidden. | ||
* Use when you want to control the close button using the BoxCloseButton component. | ||
*/ | ||
hideCloseButton?: boolean; | ||
/** | ||
* Callback fired when the component requests to be closed. | ||
* If not set, the component will be closed without any user interaction. | ||
* | ||
* If set, and the handler returns non-true value, the component will not be closed. | ||
* Use this if you want to control the closing of the component, using the `closed` prop | ||
* | ||
* If set, and the handler returns the true, the component will be closed. | ||
* Use this with `window.confirm()` to ask the user to confirm closing the component. | ||
*/ | ||
onClose?: () => boolean | unknown; | ||
/** | ||
* If `true`, the box will be closed and hidden from view | ||
*/ | ||
closed?: boolean; | ||
/** | ||
* Props applied to the close button element. | ||
*/ | ||
closeButtonProps?: BoxCloseButtonProps; | ||
} | ||
declare const Box: OverridableComponent<BoxProps, HTMLDivElement>; | ||
type BoxCloseButtonProps = Omit<React.HTMLAttributes<HTMLButtonElement>, "children">; | ||
declare const BoxCloseButton: React$1.ForwardRefExoticComponent<BoxCloseButtonProps & React$1.RefAttributes<HTMLButtonElement>>; | ||
export { Box, BoxCloseButton, type BoxCloseButtonProps, type BoxProps }; |
@@ -1,2 +0,3 @@ | ||
export { a as Box, c as BoxCloseButton, b as BoxCloseButtonProps, B as BoxProps } from '../index-OpbVH1tp.js'; | ||
export { Box, BoxCloseButton, BoxCloseButtonProps, BoxProps } from './box.js'; | ||
import 'react'; | ||
import '../utils-BfZsjuFH.js'; |
@@ -59,4 +59,3 @@ "use strict"; | ||
var import_base = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_box = require("@postenbring/hedwig-css/dist/box/box.css"); | ||
var import_message = require("@postenbring/hedwig-css/dist/message/message.css"); | ||
var import_box = require("@postenbring/hedwig-css/dist/box.css"); | ||
@@ -63,0 +62,0 @@ // src/box/box.tsx |
@@ -61,4 +61,4 @@ "use strict"; | ||
var import_base = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_button2 = require("@postenbring/hedwig-css/dist/button/button.css"); | ||
var import_icon_button = require("@postenbring/hedwig-css/dist/button/icon-button.css"); | ||
var import_button2 = require("@postenbring/hedwig-css/dist/button.css"); | ||
var import_icon_button = require("@postenbring/hedwig-css/dist/icon-button.css"); | ||
@@ -65,0 +65,0 @@ // src/button/button.tsx |
@@ -8,5 +8,10 @@ export { BaseButton, ButtonProps, PrimaryButton, SecondaryButton } from './button/button.js'; | ||
export { LinkList, LinkListProps } from './list/link-list.js'; | ||
export { a as Box, c as BoxCloseButton, b as BoxCloseButtonProps, B as BoxProps } from './index-OpbVH1tp.js'; | ||
export { Box, BoxCloseButton, BoxCloseButtonProps, BoxProps } from './box/box.js'; | ||
export { Message, MessageProps } from './message/message.js'; | ||
export { Accordion, AccordionProps } from './accordion/accordion.js'; | ||
export { AccordionItem, AccordionItemChildrenType, AccordionItemProps } from './accordion/accordion-item.js'; | ||
export { AccordionTrigger, AccordionTriggerProps } from './accordion/accordion-item-trigger.js'; | ||
export { AccordionContent, AccordionContentProps } from './accordion/accordion-item-content.js'; | ||
import 'react/jsx-runtime'; | ||
import 'react'; | ||
import './utils-BfZsjuFH.js'; |
@@ -52,2 +52,6 @@ "use strict"; | ||
__export(src_exports, { | ||
Accordion: () => Accordion, | ||
AccordionContent: () => AccordionContent, | ||
AccordionItem: () => AccordionItem, | ||
AccordionTrigger: () => AccordionTrigger, | ||
Badge: () => Badge, | ||
@@ -78,4 +82,4 @@ BaseButton: () => BaseButton, | ||
var import_base = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_button2 = require("@postenbring/hedwig-css/dist/button/button.css"); | ||
var import_icon_button = require("@postenbring/hedwig-css/dist/button/icon-button.css"); | ||
var import_button2 = require("@postenbring/hedwig-css/dist/button.css"); | ||
var import_icon_button = require("@postenbring/hedwig-css/dist/icon-button.css"); | ||
@@ -148,3 +152,3 @@ // src/button/button.tsx | ||
var import_base2 = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_link = require("@postenbring/hedwig-css/dist/link/link.css"); | ||
var import_link = require("@postenbring/hedwig-css/dist/link.css"); | ||
@@ -187,3 +191,3 @@ // src/link/link.tsx | ||
var import_base3 = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_badge = require("@postenbring/hedwig-css/dist/badge/badge.css"); | ||
var import_badge = require("@postenbring/hedwig-css/dist/badge.css"); | ||
@@ -235,4 +239,4 @@ // src/badge/badge.tsx | ||
var import_base4 = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_description_list = require("@postenbring/hedwig-css/dist/list/description-list.css"); | ||
var import_list2 = require("@postenbring/hedwig-css/dist/list/list.css"); | ||
var import_description_list = require("@postenbring/hedwig-css/dist/description-list.css"); | ||
var import_list2 = require("@postenbring/hedwig-css/dist/list.css"); | ||
@@ -314,4 +318,3 @@ // src/list/description-list.tsx | ||
var import_base5 = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_box = require("@postenbring/hedwig-css/dist/box/box.css"); | ||
var import_message = require("@postenbring/hedwig-css/dist/message/message.css"); | ||
var import_box = require("@postenbring/hedwig-css/dist/box.css"); | ||
@@ -395,4 +398,4 @@ // src/box/box.tsx | ||
var import_base6 = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_box3 = require("@postenbring/hedwig-css/dist/box/box.css"); | ||
var import_message2 = require("@postenbring/hedwig-css/dist/message/message.css"); | ||
var import_box3 = require("@postenbring/hedwig-css/dist/box.css"); | ||
var import_message = require("@postenbring/hedwig-css/dist/message.css"); | ||
@@ -422,4 +425,163 @@ // src/message/message.tsx | ||
Message.displayName = "Message"; | ||
// src/accordion/index.tsx | ||
var import_fonts7 = require("@postenbring/hedwig-tokens/tokens-output/css/fonts.css"); | ||
var import_tokens7 = require("@postenbring/hedwig-tokens/tokens-output/css/tokens.css"); | ||
var import_base7 = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_accordion = require("@postenbring/hedwig-css/dist/accordion.css"); | ||
// src/accordion/accordion.tsx | ||
var import_react4 = require("react"); | ||
var import_clsx9 = require("clsx"); | ||
var import_typed_classname9 = require("@postenbring/hedwig-css/typed-classname/index.mjs"); | ||
// src/accordion/context.ts | ||
var import_react3 = require("react"); | ||
var AccordionContext = (0, import_react3.createContext)({ | ||
variant: "multiple", | ||
mounted: false, | ||
openItems: [], | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Added default section, without handling | ||
toggleOpenItem: (id) => { | ||
} | ||
}); | ||
var AccordionItemContext = (0, import_react3.createContext)(null); | ||
// src/accordion/accordion.tsx | ||
var import_jsx_runtime10 = require("react/jsx-runtime"); | ||
var Accordion = (0, import_react4.forwardRef)( | ||
(_a, ref) => { | ||
var _b = _a, { as: Component = "div", children, className, variant = "multiple" } = _b, rest = __objRest(_b, ["as", "children", "className", "variant"]); | ||
const [openItems, setOpenItems] = (0, import_react4.useState)([]); | ||
const toggleOpenItem = (itemId) => { | ||
if (variant === "single") { | ||
setOpenItems([itemId]); | ||
} else { | ||
setOpenItems( | ||
openItems.includes(itemId) ? openItems.filter((id) => id !== itemId) : [...openItems, itemId] | ||
); | ||
} | ||
}; | ||
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AccordionContext.Provider, { value: { variant, openItems, toggleOpenItem, mounted: true }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Component, __spreadProps(__spreadValues({}, rest), { className: (0, import_clsx9.clsx)((0, import_typed_classname9.t)("hds-accordion"), className), ref, children })) }); | ||
} | ||
); | ||
Accordion.displayName = "Accordion"; | ||
// src/accordion/accordion-item.tsx | ||
var import_react5 = require("react"); | ||
var import_clsx10 = require("clsx"); | ||
var import_typed_classname10 = require("@postenbring/hedwig-css/typed-classname/index.mjs"); | ||
var import_jsx_runtime11 = require("react/jsx-runtime"); | ||
var AccordionItem = (0, import_react5.forwardRef)( | ||
(_a, ref) => { | ||
var _b = _a, { as: Component = "div", children, className } = _b, rest = __objRest(_b, ["as", "children", "className"]); | ||
const context = (0, import_react5.useContext)(AccordionContext); | ||
const [open, setOpen] = (0, import_react5.useState)(false); | ||
const accordionItemId = (0, import_react5.useId)(); | ||
const handleOpen = () => { | ||
setOpen(!open); | ||
if (context.variant === "single") { | ||
context.toggleOpenItem(accordionItemId); | ||
} | ||
}; | ||
if (!context.mounted) { | ||
throw new Error("Context required. Did you use <AccordionItem/> outside of <Accordion/>?"); | ||
} | ||
(0, import_react5.useEffect)(() => { | ||
if (context.variant === "multiple") { | ||
return; | ||
} | ||
if (open && !context.openItems.includes(accordionItemId)) { | ||
setOpen(false); | ||
} | ||
}, [context.openItems]); | ||
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( | ||
Component, | ||
__spreadProps(__spreadValues({}, rest), { | ||
className: (0, import_clsx10.clsx)( | ||
(0, import_typed_classname10.t)("hds-accordion-item"), | ||
{ | ||
[(0, import_typed_classname10.t)(`hds-accordion-item__expanded`)]: open | ||
}, | ||
className | ||
), | ||
ref, | ||
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AccordionItemContext.Provider, { value: { open, setOpen: handleOpen }, children }) | ||
}) | ||
); | ||
} | ||
); | ||
AccordionItem.displayName = "AccordionItem"; | ||
// src/accordion/accordion-item-trigger.tsx | ||
var import_react6 = require("react"); | ||
var import_typed_classname11 = require("@postenbring/hedwig-css/typed-classname/index.mjs"); | ||
var import_clsx11 = require("clsx"); | ||
var import_jsx_runtime12 = require("react/jsx-runtime"); | ||
function FaArrowDownButNotReally() { | ||
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "v " }); | ||
} | ||
function FaArrowUpButNotReally() { | ||
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "^ " }); | ||
} | ||
var AccordionTrigger = (0, import_react6.forwardRef)((_a, ref) => { | ||
var _b = _a, { as: Component = "button", children, className, onClick } = _b, rest = __objRest(_b, ["as", "children", "className", "onClick"]); | ||
const itemContext = (0, import_react6.useContext)(AccordionItemContext); | ||
if (itemContext === null) { | ||
return null; | ||
} | ||
const expandOrCollapse = (e) => { | ||
itemContext.setOpen(!itemContext.open); | ||
onClick && onClick(e); | ||
}; | ||
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( | ||
Component, | ||
__spreadProps(__spreadValues({}, rest), { | ||
"aria-expanded": itemContext.open, | ||
className: (0, import_clsx11.clsx)((0, import_typed_classname11.t)("hds-accordion-item-trigger"), className), | ||
onClick: expandOrCollapse, | ||
ref, | ||
type: "button", | ||
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [ | ||
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: (0, import_clsx11.clsx)((0, import_typed_classname11.t)("hds-accordion-item-trigger--icon")), children: itemContext.open ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FaArrowUpButNotReally, {}) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FaArrowDownButNotReally, {}) }), | ||
children | ||
] }) | ||
}) | ||
); | ||
}); | ||
AccordionTrigger.displayName = "AccordionTrigger"; | ||
// src/accordion/accordion-item-content.tsx | ||
var import_react7 = require("react"); | ||
var import_clsx12 = require("clsx"); | ||
var import_typed_classname12 = require("@postenbring/hedwig-css/typed-classname/index.mjs"); | ||
var import_jsx_runtime13 = require("react/jsx-runtime"); | ||
var AccordionContent = (0, import_react7.forwardRef)((_a, ref) => { | ||
var _b = _a, { as: Component = "div", children, className } = _b, rest = __objRest(_b, ["as", "children", "className"]); | ||
const context = (0, import_react7.useContext)(AccordionItemContext); | ||
if (context === null) { | ||
return null; | ||
} | ||
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( | ||
Component, | ||
__spreadProps(__spreadValues({}, rest), { | ||
className: (0, import_clsx12.clsx)( | ||
(0, import_typed_classname12.t)("hds-accordion-item-content"), | ||
{ | ||
[(0, import_typed_classname12.t)(`hds-accordion-item-content--closed`)]: !context.open | ||
}, | ||
className | ||
), | ||
ref, | ||
children | ||
}) | ||
); | ||
}); | ||
AccordionContent.displayName = "AccordionContent"; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
Accordion, | ||
AccordionContent, | ||
AccordionItem, | ||
AccordionTrigger, | ||
Badge, | ||
@@ -426,0 +588,0 @@ BaseButton, |
@@ -58,3 +58,3 @@ "use strict"; | ||
var import_base = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_link = require("@postenbring/hedwig-css/dist/link/link.css"); | ||
var import_link = require("@postenbring/hedwig-css/dist/link.css"); | ||
@@ -61,0 +61,0 @@ // src/link/link.tsx |
@@ -63,4 +63,4 @@ "use strict"; | ||
var import_base = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_description_list = require("@postenbring/hedwig-css/dist/list/description-list.css"); | ||
var import_list2 = require("@postenbring/hedwig-css/dist/list/list.css"); | ||
var import_description_list = require("@postenbring/hedwig-css/dist/description-list.css"); | ||
var import_list2 = require("@postenbring/hedwig-css/dist/list.css"); | ||
@@ -67,0 +67,0 @@ // src/list/description-list.tsx |
export { Message, MessageProps } from './message.js'; | ||
import 'react'; | ||
import '../index-OpbVH1tp.js'; | ||
import '../utils-BfZsjuFH.js'; | ||
import '../box/box.js'; |
@@ -58,4 +58,4 @@ "use strict"; | ||
var import_base = require("@postenbring/hedwig-css/dist/base.css"); | ||
var import_box2 = require("@postenbring/hedwig-css/dist/box/box.css"); | ||
var import_message = require("@postenbring/hedwig-css/dist/message/message.css"); | ||
var import_box2 = require("@postenbring/hedwig-css/dist/box.css"); | ||
var import_message = require("@postenbring/hedwig-css/dist/message.css"); | ||
@@ -62,0 +62,0 @@ // src/message/message.tsx |
import React__default from 'react'; | ||
import { B as BoxProps, O as OverridableComponent } from '../index-OpbVH1tp.js'; | ||
import { O as OverridableComponent } from '../utils-BfZsjuFH.js'; | ||
import { BoxProps } from '../box/box.js'; | ||
@@ -4,0 +5,0 @@ type MessageProps = ({ |
{ | ||
"name": "@postenbring/hedwig-react", | ||
"version": "0.0.0-icon-button-C0L88PWY-20231126142551", | ||
"version": "0.0.0-icon-button-C0L88PWY-20231127102552", | ||
"main": "./dist/index.js", | ||
@@ -18,3 +18,3 @@ "module": "./dist/index.mjs", | ||
"typescript": "^5.2.2", | ||
"eslint-config-custom": "0.0.0-icon-button-C0L88PWY-20231126142551", | ||
"eslint-config-custom": "0.0.0-icon-button-C0L88PWY-20231127102552", | ||
"hedwig-tsconfig": "0.0.0" | ||
@@ -24,4 +24,4 @@ }, | ||
"clsx": "^2.0.0", | ||
"@postenbring/hedwig-css": "0.0.0-icon-button-C0L88PWY-20231126142551", | ||
"@postenbring/hedwig-tokens": "0.0.0-icon-button-C0L88PWY-20231126142551" | ||
"@postenbring/hedwig-css": "0.0.0-icon-button-C0L88PWY-20231127102552", | ||
"@postenbring/hedwig-tokens": "0.0.0-icon-button-C0L88PWY-20231127102552" | ||
}, | ||
@@ -28,0 +28,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175209
113
4375
+ Added@postenbring/hedwig-css@0.0.0-icon-button-C0L88PWY-20231127102552(transitive)
+ Added@postenbring/hedwig-tokens@0.0.0-icon-button-C0L88PWY-20231127102552(transitive)
- Removed@parcel/watcher-linux-x64-glibc@2.5.0(transitive)
- Removed@postenbring/hedwig-css@0.0.0-icon-button-C0L88PWY-20231126142551(transitive)
- Removed@postenbring/hedwig-tokens@0.0.0-icon-button-C0L88PWY-20231126142551(transitive)
Updated@postenbring/hedwig-css@0.0.0-icon-button-C0L88PWY-20231127102552
Updated@postenbring/hedwig-tokens@0.0.0-icon-button-C0L88PWY-20231127102552