@d4gger/design-system 4.0.0 → 4.0.1
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/brand-effects.css +5 -3
- package/dist/components/alert/Alert.cjs +17 -3
- package/dist/components/alert/Alert.cjs.map +2 -2
- package/dist/components/alert/Alert.d.cts +6 -0
- package/dist/components/alert/Alert.d.cts.map +1 -1
- package/dist/components/alert/Alert.d.mts +6 -0
- package/dist/components/alert/Alert.d.mts.map +1 -1
- package/dist/components/alert/Alert.d.ts +6 -0
- package/dist/components/alert/Alert.d.ts.map +1 -1
- package/dist/components/alert/Alert.js +17 -3
- package/dist/components/alert/Alert.js.map +2 -2
- package/dist/components/alert.css +62 -5
- package/dist/components/bottom-dock.css +8 -0
- package/dist/components/bottomDock/BottomDock.cjs +1 -1
- package/dist/components/bottomDock/BottomDock.cjs.map +2 -2
- package/dist/components/bottomDock/BottomDock.js +1 -1
- package/dist/components/bottomDock/BottomDock.js.map +2 -2
- package/dist/components/bottomDock/bottomDock.props.cjs +1 -1
- package/dist/components/bottomDock/bottomDock.props.cjs.map +2 -2
- package/dist/components/bottomDock/bottomDock.props.d.cts +2 -2
- package/dist/components/bottomDock/bottomDock.props.d.cts.map +1 -1
- package/dist/components/bottomDock/bottomDock.props.d.mts +2 -2
- package/dist/components/bottomDock/bottomDock.props.d.mts.map +1 -1
- package/dist/components/bottomDock/bottomDock.props.d.ts +2 -2
- package/dist/components/bottomDock/bottomDock.props.d.ts.map +1 -1
- package/dist/components/bottomDock/bottomDock.props.js +1 -1
- package/dist/components/bottomDock/bottomDock.props.js.map +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/collapsible/Collapsible.cjs +10 -0
- package/dist/components/collapsible/Collapsible.cjs.map +2 -2
- package/dist/components/collapsible/Collapsible.d.cts.map +1 -1
- package/dist/components/collapsible/Collapsible.d.mts.map +1 -1
- package/dist/components/collapsible/Collapsible.d.ts.map +1 -1
- package/dist/components/collapsible/Collapsible.js +10 -0
- package/dist/components/collapsible/Collapsible.js.map +2 -2
- package/dist/components/dialog.css +1 -1
- package/dist/components/environment-ribbon.css +73 -0
- package/dist/components/environmentRibbon/EnvironmentRibbon.cjs +69 -0
- package/dist/components/environmentRibbon/EnvironmentRibbon.cjs.map +7 -0
- package/dist/components/environmentRibbon/EnvironmentRibbon.d.cts +15 -0
- package/dist/components/environmentRibbon/EnvironmentRibbon.d.cts.map +1 -0
- package/dist/components/environmentRibbon/EnvironmentRibbon.d.mts +15 -0
- package/dist/components/environmentRibbon/EnvironmentRibbon.d.mts.map +1 -0
- package/dist/components/environmentRibbon/EnvironmentRibbon.d.ts +15 -0
- package/dist/components/environmentRibbon/EnvironmentRibbon.d.ts.map +1 -0
- package/dist/components/environmentRibbon/EnvironmentRibbon.js +39 -0
- package/dist/components/environmentRibbon/EnvironmentRibbon.js.map +7 -0
- package/dist/components/environmentRibbon/environmentRibbon.props.cjs +39 -0
- package/dist/components/environmentRibbon/environmentRibbon.props.cjs.map +7 -0
- package/dist/components/environmentRibbon/environmentRibbon.props.d.cts +18 -0
- package/dist/components/environmentRibbon/environmentRibbon.props.d.cts.map +1 -0
- package/dist/components/environmentRibbon/environmentRibbon.props.d.mts +18 -0
- package/dist/components/environmentRibbon/environmentRibbon.props.d.mts.map +1 -0
- package/dist/components/environmentRibbon/environmentRibbon.props.d.ts +18 -0
- package/dist/components/environmentRibbon/environmentRibbon.props.d.ts.map +1 -0
- package/dist/components/environmentRibbon/environmentRibbon.props.js +19 -0
- package/dist/components/environmentRibbon/environmentRibbon.props.js.map +7 -0
- package/dist/components/field.css +5 -0
- package/dist/components/icon/Icon.cjs +16 -0
- package/dist/components/icon/Icon.cjs.map +2 -2
- package/dist/components/icon/Icon.d.cts +25 -1
- package/dist/components/icon/Icon.d.cts.map +1 -1
- package/dist/components/icon/Icon.d.mts +25 -1
- package/dist/components/icon/Icon.d.mts.map +1 -1
- package/dist/components/icon/Icon.d.ts +25 -1
- package/dist/components/icon/Icon.d.ts.map +1 -1
- package/dist/components/icon/Icon.js +21 -0
- package/dist/components/icon/Icon.js.map +2 -2
- package/dist/components/icon/icons.cjs +12 -0
- package/dist/components/icon/icons.cjs.map +2 -2
- package/dist/components/icon/icons.d.cts +30 -0
- package/dist/components/icon/icons.d.cts.map +1 -1
- package/dist/components/icon/icons.d.mts +30 -0
- package/dist/components/icon/icons.d.mts.map +1 -1
- package/dist/components/icon/icons.d.ts +30 -0
- package/dist/components/icon/icons.d.ts.map +1 -1
- package/dist/components/icon/icons.js +12 -0
- package/dist/components/icon/icons.js.map +2 -2
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.cjs.map +2 -2
- package/dist/components/index.d.cts +1 -0
- package/dist/components/index.d.cts.map +1 -1
- package/dist/components/index.d.mts +1 -0
- package/dist/components/index.d.mts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +2 -2
- package/dist/components/notification-center.css +17 -9
- package/dist/components/notificationCenter/NotificationCenter.cjs +7 -2
- package/dist/components/notificationCenter/NotificationCenter.cjs.map +2 -2
- package/dist/components/notificationCenter/NotificationCenter.d.cts +2 -0
- package/dist/components/notificationCenter/NotificationCenter.d.cts.map +1 -1
- package/dist/components/notificationCenter/NotificationCenter.d.mts +2 -0
- package/dist/components/notificationCenter/NotificationCenter.d.mts.map +1 -1
- package/dist/components/notificationCenter/NotificationCenter.d.ts +2 -0
- package/dist/components/notificationCenter/NotificationCenter.d.ts.map +1 -1
- package/dist/components/notificationCenter/NotificationCenter.js +7 -2
- package/dist/components/notificationCenter/NotificationCenter.js.map +2 -2
- package/dist/components/page-header.css +21 -0
- package/dist/components/pageHeader/PageHeader.cjs +10 -2
- package/dist/components/pageHeader/PageHeader.cjs.map +2 -2
- package/dist/components/pageHeader/PageHeader.d.cts.map +1 -1
- package/dist/components/pageHeader/PageHeader.d.mts.map +1 -1
- package/dist/components/pageHeader/PageHeader.d.ts.map +1 -1
- package/dist/components/pageHeader/PageHeader.js +10 -2
- package/dist/components/pageHeader/PageHeader.js.map +2 -2
- package/dist/components/pageHeader/pageHeader.props.cjs +7 -1
- package/dist/components/pageHeader/pageHeader.props.cjs.map +2 -2
- package/dist/components/pageHeader/pageHeader.props.d.cts +5 -0
- package/dist/components/pageHeader/pageHeader.props.d.cts.map +1 -1
- package/dist/components/pageHeader/pageHeader.props.d.mts +5 -0
- package/dist/components/pageHeader/pageHeader.props.d.mts.map +1 -1
- package/dist/components/pageHeader/pageHeader.props.d.ts +5 -0
- package/dist/components/pageHeader/pageHeader.props.d.ts.map +1 -1
- package/dist/components/pageHeader/pageHeader.props.js +7 -1
- package/dist/components/pageHeader/pageHeader.props.js.map +2 -2
- package/dist/components/sidebar/Sidebar.cjs +6 -2
- package/dist/components/sidebar/Sidebar.cjs.map +2 -2
- package/dist/components/sidebar/Sidebar.d.cts +8 -0
- package/dist/components/sidebar/Sidebar.d.cts.map +1 -1
- package/dist/components/sidebar/Sidebar.d.mts +8 -0
- package/dist/components/sidebar/Sidebar.d.mts.map +1 -1
- package/dist/components/sidebar/Sidebar.d.ts +8 -0
- package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.js +6 -2
- package/dist/components/sidebar/Sidebar.js.map +2 -2
- package/dist/components/sidebar.css +58 -13
- package/dist/components.css +1 -0
- package/dist/docs/README.md +1 -0
- package/dist/docs/component-contract.md +5 -3
- package/dist/docs/component-index.json +9 -1
- package/dist/docs/components/alert.md +28 -8
- package/dist/docs/components/bottom-dock.md +4 -4
- package/dist/docs/components/card.md +1 -1
- package/dist/docs/components/collapsible.md +5 -0
- package/dist/docs/components/dialog.md +1 -1
- package/dist/docs/components/environment-ribbon.md +126 -0
- package/dist/docs/components/field.md +2 -0
- package/dist/docs/components/icon.md +1 -0
- package/dist/docs/components/notification-center.md +14 -9
- package/dist/docs/components/page-header.md +18 -6
- package/dist/docs/components/sidebar.md +17 -6
- package/dist/docs/consumer-guide.md +11 -4
- package/dist/styles.css +270 -30
- package/dist/tokens.css +2 -0
- package/package.json +1 -1
package/dist/brand-effects.css
CHANGED
|
@@ -16,10 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
.dsx-brand-ambient {
|
|
18
18
|
background-color: var(--dsx-color-background);
|
|
19
|
+
/* The three washes are multiples of the theme-aware ambient strength (G-16, 2026-10-05): at the dark value of 10% they are the
|
|
20
|
+
22% / 12% / 8% they always were, and light, which is raised, gets the same proportions. */
|
|
19
21
|
background-image:
|
|
20
|
-
radial-gradient(ellipse 900px 500px at 15% -5%, color-mix(in srgb, var(--dsx-color-primary)
|
|
21
|
-
radial-gradient(ellipse 700px 400px at 88% 8%, color-mix(in srgb, var(--dsx-color-secondary)
|
|
22
|
-
radial-gradient(ellipse 600px 300px at 50% 100%, color-mix(in srgb, var(--dsx-color-primary) 8
|
|
22
|
+
radial-gradient(ellipse 900px 500px at 15% -5%, color-mix(in srgb, var(--dsx-color-primary) calc(var(--dsx-effect-ambient-strength) * 2.2), transparent), transparent 55%),
|
|
23
|
+
radial-gradient(ellipse 700px 400px at 88% 8%, color-mix(in srgb, var(--dsx-color-secondary) calc(var(--dsx-effect-ambient-strength) * 1.2), transparent), transparent 50%),
|
|
24
|
+
radial-gradient(ellipse 600px 300px at 50% 100%, color-mix(in srgb, var(--dsx-color-primary) calc(var(--dsx-effect-ambient-strength) * 0.8), transparent), transparent 60%),
|
|
23
25
|
linear-gradient(180deg, var(--dsx-color-surface) 0%, var(--dsx-color-background) 50%);
|
|
24
26
|
background-repeat: no-repeat;
|
|
25
27
|
}
|
|
@@ -46,6 +46,11 @@ const AlertAction = React.forwardRef(
|
|
|
46
46
|
({ className, ...props }, forwardedRef) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...props, ref: forwardedRef, className: (0, import_classnames.default)("dsx-alert__action", className) })
|
|
47
47
|
);
|
|
48
48
|
AlertAction.displayName = "AlertAction";
|
|
49
|
+
const isAlertAction = (node) => React.isValidElement(node) && node.type === AlertAction;
|
|
50
|
+
function splitAlertChildren(children) {
|
|
51
|
+
const nodes = React.Children.toArray(children);
|
|
52
|
+
return { actions: nodes.filter(isAlertAction), body: nodes.filter((node) => !isAlertAction(node)) };
|
|
53
|
+
}
|
|
49
54
|
const AlertRoot = React.forwardRef((props, forwardedRef) => {
|
|
50
55
|
const {
|
|
51
56
|
asChild,
|
|
@@ -62,9 +67,13 @@ const AlertRoot = React.forwardRef((props, forwardedRef) => {
|
|
|
62
67
|
const Comp = asChild ? import_react_slot.Slot : "div";
|
|
63
68
|
const fallbackIcon = variant === "success" ? "check-circle" : variant === "default" ? "info" : "alert-triangle";
|
|
64
69
|
const child = asChild ? React.Children.only(children) : null;
|
|
70
|
+
const { actions, body } = splitAlertChildren(child ? child.props.children : children);
|
|
65
71
|
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
66
72
|
icon === null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": "true", className: "dsx-alert__icon", children: icon ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.Icon, { name: fallbackIcon, size: "md", strokeWidth: "var(--dsx-icon-stroke-width-strong, 2.25)" }) }),
|
|
67
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsx-alert__main", children: [
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsx-alert__content", children: body }),
|
|
75
|
+
actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsx-alert__actions", children: actions }) : null
|
|
76
|
+
] })
|
|
68
77
|
] });
|
|
69
78
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
79
|
Comp,
|
|
@@ -88,16 +97,21 @@ const AlertTitle = React.forwardRef((props, forwardedRef) => {
|
|
|
88
97
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, { ...titleProps, ref: forwardedRef, className: (0, import_classnames.default)("dsx-alert__title", className) });
|
|
89
98
|
});
|
|
90
99
|
AlertTitle.displayName = "AlertTitle";
|
|
100
|
+
const isLineClamp = (value) => typeof value === "number" && Number.isInteger(value) && value >= 1;
|
|
91
101
|
const AlertDescription = React.forwardRef(
|
|
92
102
|
(props, forwardedRef) => {
|
|
93
|
-
const {
|
|
103
|
+
const { lineClamp, style, ...ownProps } = props;
|
|
104
|
+
const { asChild, className, ...descriptionProps } = (0, import_extractProps.extractProps)(ownProps, import_alert.alertDescriptionPropDefs);
|
|
94
105
|
const Comp = asChild ? import_react_slot.Slot : "p";
|
|
106
|
+
const clamp = isLineClamp(lineClamp) ? lineClamp : void 0;
|
|
95
107
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
108
|
Comp,
|
|
97
109
|
{
|
|
98
110
|
...descriptionProps,
|
|
99
111
|
ref: forwardedRef,
|
|
100
|
-
className: (0, import_classnames.default)("dsx-alert__description", className)
|
|
112
|
+
className: (0, import_classnames.default)("dsx-alert__description", className),
|
|
113
|
+
"data-line-clamp": clamp,
|
|
114
|
+
style: clamp ? { ...style, "--dsx-alert-line-clamp": clamp } : style
|
|
101
115
|
}
|
|
102
116
|
);
|
|
103
117
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/alert/Alert.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\nimport classNames from 'classnames'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { extractProps } from '../../_internal/helpers/extractProps'\nimport { Icon } from '../icon/Icon'\nimport { alertDescriptionPropDefs, alertPropDefs, alertTitlePropDefs } from './alert.props'\n\nimport type { GetPropDefTypes } from '../../_internal/props/propDef'\n\ntype AlertActionElement = React.ComponentRef<'div'>\n\nconst AlertAction = React.forwardRef<AlertActionElement, React.ComponentPropsWithoutRef<'div'>>(\n ({ className, ...props }, forwardedRef) => (\n <div {...props} ref={forwardedRef} className={classNames('dsx-alert__action', className)} />\n ),\n)\nAlertAction.displayName = 'AlertAction'\n\ntype AlertElement = React.ComponentRef<'div'>\ntype AlertOwnProps = GetPropDefTypes<typeof alertPropDefs> & {\n icon?: React.ReactNode\n}\n\ninterface AlertProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'>, AlertOwnProps {}\n\nconst AlertRoot = React.forwardRef<AlertElement, AlertProps>((props, forwardedRef) => {\n const {\n asChild,\n className,\n color,\n highContrast = false,\n icon,\n children,\n role,\n size = 'md',\n variant = 'default',\n ...alertProps\n } = extractProps(props, alertPropDefs)\n const Comp = asChild ? Slot : 'div'\n const fallbackIcon = variant === 'success' ? 'check-circle' : variant === 'default' ? 'info' : 'alert-triangle'\n const child = asChild ? React.Children.only(children) as React.ReactElement<{ children?: React.ReactNode }> : null\n const content = <>\n {icon === null ? null : (\n <span aria-hidden=\"true\" className=\"dsx-alert__icon\">\n {icon ?? <Icon name={fallbackIcon} size=\"md\" strokeWidth=\"var(--dsx-icon-stroke-width-strong, 2.25)\" />}\n </span>\n )}\n <div className=\"dsx-alert__content\">{
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,wBAAuB;AACvB,wBAAqB;AAErB,0BAA6B;AAC7B,kBAAqB;AACrB,mBAA4E;AAQxE;AAFJ,MAAM,cAAc,MAAM;AAAA,EACxB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,iBACxB,4CAAC,SAAK,GAAG,OAAO,KAAK,cAAc,eAAW,kBAAAA,SAAW,qBAAqB,SAAS,GAAG;AAE9F;AACA,YAAY,cAAc;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\nimport classNames from 'classnames'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { extractProps } from '../../_internal/helpers/extractProps'\nimport { Icon } from '../icon/Icon'\nimport { alertDescriptionPropDefs, alertPropDefs, alertTitlePropDefs } from './alert.props'\n\nimport type { GetPropDefTypes } from '../../_internal/props/propDef'\n\ntype AlertActionElement = React.ComponentRef<'div'>\n\nconst AlertAction = React.forwardRef<AlertActionElement, React.ComponentPropsWithoutRef<'div'>>(\n ({ className, ...props }, forwardedRef) => (\n <div {...props} ref={forwardedRef} className={classNames('dsx-alert__action', className)} />\n ),\n)\nAlertAction.displayName = 'AlertAction'\n\nconst isAlertAction = (node: React.ReactNode): boolean => React.isValidElement(node) && node.type === AlertAction\n\n// An `Alert.Action` that is a direct child sits beside the content, not inside it, in one `.dsx-alert__actions` group: the\n// group trails the row, and wraps below the text as a whole when it is narrow, under the text and not under the icon (the\n// icon is one column, the text and the group are the other: `.dsx-alert__main`). A consumer who nests an action in their own\n// wrapper keeps it in the content.\nfunction splitAlertChildren(children: React.ReactNode): { actions: React.ReactNode[]; body: React.ReactNode[] } {\n const nodes = React.Children.toArray(children)\n return { actions: nodes.filter(isAlertAction), body: nodes.filter((node) => !isAlertAction(node)) }\n}\n\ntype AlertElement = React.ComponentRef<'div'>\ntype AlertOwnProps = GetPropDefTypes<typeof alertPropDefs> & {\n icon?: React.ReactNode\n}\n\ninterface AlertProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'>, AlertOwnProps {}\n\nconst AlertRoot = React.forwardRef<AlertElement, AlertProps>((props, forwardedRef) => {\n const {\n asChild,\n className,\n color,\n highContrast = false,\n icon,\n children,\n role,\n size = 'md',\n variant = 'default',\n ...alertProps\n } = extractProps(props, alertPropDefs)\n const Comp = asChild ? Slot : 'div'\n const fallbackIcon = variant === 'success' ? 'check-circle' : variant === 'default' ? 'info' : 'alert-triangle'\n const child = asChild ? React.Children.only(children) as React.ReactElement<{ children?: React.ReactNode }> : null\n const { actions, body } = splitAlertChildren(child ? child.props.children : children)\n const content = <>\n {icon === null ? null : (\n <span aria-hidden=\"true\" className=\"dsx-alert__icon\">\n {icon ?? <Icon name={fallbackIcon} size=\"md\" strokeWidth=\"var(--dsx-icon-stroke-width-strong, 2.25)\" />}\n </span>\n )}\n <div className=\"dsx-alert__main\">\n <div className=\"dsx-alert__content\">{body}</div>\n {actions.length > 0 ? <div className=\"dsx-alert__actions\">{actions}</div> : null}\n </div>\n </>\n\n return (\n <Comp\n {...alertProps}\n ref={forwardedRef}\n role={role ?? 'alert'}\n className={classNames('dsx-alert', className)}\n data-accent-color={color}\n data-high-contrast={highContrast ? 'true' : undefined}\n data-size={size}\n data-variant={variant}\n >\n {child ? React.cloneElement(child, undefined, content) : content}\n </Comp>\n )\n})\nAlertRoot.displayName = 'Alert'\n\ntype AlertTitleElement = React.ComponentRef<'h5'>\ntype AlertTitleOwnProps = GetPropDefTypes<typeof alertTitlePropDefs>\n\ninterface AlertTitleProps extends React.ComponentPropsWithoutRef<'h5'>, AlertTitleOwnProps {}\n\nconst AlertTitle = React.forwardRef<AlertTitleElement, AlertTitleProps>((props, forwardedRef) => {\n const { asChild, className, ...titleProps } = extractProps(props, alertTitlePropDefs)\n const Comp = asChild ? Slot : 'h5'\n\n return <Comp {...titleProps} ref={forwardedRef} className={classNames('dsx-alert__title', className)} />\n})\nAlertTitle.displayName = 'AlertTitle'\n\ntype AlertDescriptionElement = React.ComponentRef<'p'>\ntype AlertDescriptionOwnProps = GetPropDefTypes<typeof alertDescriptionPropDefs>\n\ninterface AlertDescriptionProps\n extends React.ComponentPropsWithoutRef<'p'>,\n AlertDescriptionOwnProps {\n /**\n * Clamp the text to this many lines (a whole number of 1 or more); the rest is clipped with an ellipsis. Anything else\n * leaves the text unclamped. Whether the text is clipped, and how to reveal it, is the consumer's: it can measure the\n * element (`scrollHeight > clientHeight`) and drop the prop to show everything.\n */\n lineClamp?: number\n}\n\nconst isLineClamp = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 1\n\nconst AlertDescription = React.forwardRef<AlertDescriptionElement, AlertDescriptionProps>(\n (props, forwardedRef) => {\n // `lineClamp` is behaviour-only, so it stays out of extractProps (it has no class mapping and would leak to the DOM).\n const { lineClamp, style, ...ownProps } = props\n const { asChild, className, ...descriptionProps } = extractProps(ownProps, alertDescriptionPropDefs)\n const Comp = asChild ? Slot : 'p'\n const clamp = isLineClamp(lineClamp) ? lineClamp : undefined\n\n return (\n <Comp\n {...descriptionProps}\n ref={forwardedRef}\n className={classNames('dsx-alert__description', className)}\n data-line-clamp={clamp}\n style={clamp ? ({ ...style, '--dsx-alert-line-clamp': clamp } as React.CSSProperties) : style}\n />\n )\n },\n)\nAlertDescription.displayName = 'AlertDescription'\n\nconst Alert: typeof AlertRoot & {\n Title: typeof AlertTitle\n Description: typeof AlertDescription\n Action: typeof AlertAction\n} = Object.assign(AlertRoot, {\n Title: AlertTitle,\n Description: AlertDescription,\n Action: AlertAction,\n})\n\nexport { Alert, AlertAction, AlertDescription, AlertRoot, AlertTitle }\nexport type { AlertDescriptionProps, AlertProps, AlertTitleProps }\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,wBAAuB;AACvB,wBAAqB;AAErB,0BAA6B;AAC7B,kBAAqB;AACrB,mBAA4E;AAQxE;AAFJ,MAAM,cAAc,MAAM;AAAA,EACxB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,iBACxB,4CAAC,SAAK,GAAG,OAAO,KAAK,cAAc,eAAW,kBAAAA,SAAW,qBAAqB,SAAS,GAAG;AAE9F;AACA,YAAY,cAAc;AAE1B,MAAM,gBAAgB,CAAC,SAAmC,MAAM,eAAe,IAAI,KAAK,KAAK,SAAS;AAMtG,SAAS,mBAAmB,UAAoF;AAC9G,QAAM,QAAQ,MAAM,SAAS,QAAQ,QAAQ;AAC7C,SAAO,EAAE,SAAS,MAAM,OAAO,aAAa,GAAG,MAAM,MAAM,OAAO,CAA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,SAAS,WAAW,GAAG,WAAW,QAAI,kCAAa,OAAO,+BAAkB;AACpF,QAAM,OAAO,UAAU,yBAAO;AAE9B,SAAO,4CAAC,QAAM,GAAG,YAAY,KAAK,cAAc,eAAW,kBAAAA,SAAW,oBAAoB,SAAS,GAAG;AACxG,CAAC;AACD,WAAW,cAAc;AAgBzB,MAAM,cAAc,CAAC,UACnB,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,KAAK,SAAS;AAEnE,MAAM,mBAAmB,MAAM;AAAA,EAC7B,CAAC,OAAO,iBAAiB;AAEvB,UAAM,EAAE,WAAW,OAAO,GAAG,SAAS,IAAI;AAC1C,UAAM,EAAE,SAAS,WAAW,GAAG,iBAAiB,QAAI,kCAAa,UAAU,qCAAwB;AACnG,UAAM,OAAO,UAAU,yBAAO;AAC9B,UAAM,QAAQ,YAAY,SAAS,IAAI,YAAY;AAEnD,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,eAAW,kBAAAA,SAAW,0BAA0B,SAAS;AAAA,QACzD,mBAAiB;AAAA,QACjB,OAAO,QAAS,EAAE,GAAG,OAAO,0BAA0B,MAAM,IAA4B;AAAA;AAAA,IAC1F;AAAA,EAEJ;AACF;AACA,iBAAiB,cAAc;AAE/B,MAAM,QAIF,OAAO,OAAO,WAAW;AAAA,EAC3B,OAAO;AAAA,EACP,aAAa;AAAA,EACb,QAAQ;AACV,CAAC;",
|
|
6
6
|
"names": ["classNames"]
|
|
7
7
|
}
|
|
@@ -14,6 +14,12 @@ interface AlertTitleProps extends React.ComponentPropsWithoutRef<'h5'>, AlertTit
|
|
|
14
14
|
declare const AlertTitle: React.ForwardRefExoticComponent<AlertTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
15
15
|
type AlertDescriptionOwnProps = GetPropDefTypes<typeof alertDescriptionPropDefs>;
|
|
16
16
|
interface AlertDescriptionProps extends React.ComponentPropsWithoutRef<'p'>, AlertDescriptionOwnProps {
|
|
17
|
+
/**
|
|
18
|
+
* Clamp the text to this many lines (a whole number of 1 or more); the rest is clipped with an ellipsis. Anything else
|
|
19
|
+
* leaves the text unclamped. Whether the text is clipped, and how to reveal it, is the consumer's: it can measure the
|
|
20
|
+
* element (`scrollHeight > clientHeight`) and drop the prop to show everything.
|
|
21
|
+
*/
|
|
22
|
+
lineClamp?: number;
|
|
17
23
|
}
|
|
18
24
|
declare const AlertDescription: React.ForwardRefExoticComponent<AlertDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
19
25
|
declare const Alert: typeof AlertRoot & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.cts","sourceRoot":"","sources":["../../../src/components/alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAE3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAIpE,QAAA,MAAM,WAAW,mKAIhB,CAAA;
|
|
1
|
+
{"version":3,"file":"Alert.d.cts","sourceRoot":"","sources":["../../../src/components/alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAE3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAIpE,QAAA,MAAM,WAAW,mKAIhB,CAAA;AAeD,KAAK,aAAa,GAAG,eAAe,CAAC,OAAO,aAAa,CAAC,GAAG;IAC3D,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB,CAAA;AAED,UAAU,UAAW,SAAQ,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa;CAAG;AAEnG,QAAA,MAAM,SAAS,mFA2Cb,CAAA;AAIF,KAAK,kBAAkB,GAAG,eAAe,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEpE,UAAU,eAAgB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,kBAAkB;CAAG;AAE7F,QAAA,MAAM,UAAU,4FAKd,CAAA;AAIF,KAAK,wBAAwB,GAAG,eAAe,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEhF,UAAU,qBACR,SAAQ,KAAK,CAAC,wBAAwB,CAAC,GAAG,CAAC,EACzC,wBAAwB;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAKD,QAAA,MAAM,gBAAgB,oGAkBrB,CAAA;AAGD,QAAA,MAAM,KAAK,EAAE,OAAO,SAAS,GAAG;IAC9B,KAAK,EAAE,OAAO,UAAU,CAAA;IACxB,WAAW,EAAE,OAAO,gBAAgB,CAAA;IACpC,MAAM,EAAE,OAAO,WAAW,CAAA;CAK1B,CAAA;AAEF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,CAAA;AACtE,YAAY,EAAE,qBAAqB,EAAE,UAAU,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -14,6 +14,12 @@ interface AlertTitleProps extends React.ComponentPropsWithoutRef<'h5'>, AlertTit
|
|
|
14
14
|
declare const AlertTitle: React.ForwardRefExoticComponent<AlertTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
15
15
|
type AlertDescriptionOwnProps = GetPropDefTypes<typeof alertDescriptionPropDefs>;
|
|
16
16
|
interface AlertDescriptionProps extends React.ComponentPropsWithoutRef<'p'>, AlertDescriptionOwnProps {
|
|
17
|
+
/**
|
|
18
|
+
* Clamp the text to this many lines (a whole number of 1 or more); the rest is clipped with an ellipsis. Anything else
|
|
19
|
+
* leaves the text unclamped. Whether the text is clipped, and how to reveal it, is the consumer's: it can measure the
|
|
20
|
+
* element (`scrollHeight > clientHeight`) and drop the prop to show everything.
|
|
21
|
+
*/
|
|
22
|
+
lineClamp?: number;
|
|
17
23
|
}
|
|
18
24
|
declare const AlertDescription: React.ForwardRefExoticComponent<AlertDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
19
25
|
declare const Alert: typeof AlertRoot & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.mts","sourceRoot":"","sources":["../../../src/components/alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAE3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAIpE,QAAA,MAAM,WAAW,mKAIhB,CAAA;
|
|
1
|
+
{"version":3,"file":"Alert.d.mts","sourceRoot":"","sources":["../../../src/components/alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAE3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAIpE,QAAA,MAAM,WAAW,mKAIhB,CAAA;AAeD,KAAK,aAAa,GAAG,eAAe,CAAC,OAAO,aAAa,CAAC,GAAG;IAC3D,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB,CAAA;AAED,UAAU,UAAW,SAAQ,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa;CAAG;AAEnG,QAAA,MAAM,SAAS,mFA2Cb,CAAA;AAIF,KAAK,kBAAkB,GAAG,eAAe,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEpE,UAAU,eAAgB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,kBAAkB;CAAG;AAE7F,QAAA,MAAM,UAAU,4FAKd,CAAA;AAIF,KAAK,wBAAwB,GAAG,eAAe,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEhF,UAAU,qBACR,SAAQ,KAAK,CAAC,wBAAwB,CAAC,GAAG,CAAC,EACzC,wBAAwB;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAKD,QAAA,MAAM,gBAAgB,oGAkBrB,CAAA;AAGD,QAAA,MAAM,KAAK,EAAE,OAAO,SAAS,GAAG;IAC9B,KAAK,EAAE,OAAO,UAAU,CAAA;IACxB,WAAW,EAAE,OAAO,gBAAgB,CAAA;IACpC,MAAM,EAAE,OAAO,WAAW,CAAA;CAK1B,CAAA;AAEF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,CAAA;AACtE,YAAY,EAAE,qBAAqB,EAAE,UAAU,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -14,6 +14,12 @@ interface AlertTitleProps extends React.ComponentPropsWithoutRef<'h5'>, AlertTit
|
|
|
14
14
|
declare const AlertTitle: React.ForwardRefExoticComponent<AlertTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
15
15
|
type AlertDescriptionOwnProps = GetPropDefTypes<typeof alertDescriptionPropDefs>;
|
|
16
16
|
interface AlertDescriptionProps extends React.ComponentPropsWithoutRef<'p'>, AlertDescriptionOwnProps {
|
|
17
|
+
/**
|
|
18
|
+
* Clamp the text to this many lines (a whole number of 1 or more); the rest is clipped with an ellipsis. Anything else
|
|
19
|
+
* leaves the text unclamped. Whether the text is clipped, and how to reveal it, is the consumer's: it can measure the
|
|
20
|
+
* element (`scrollHeight > clientHeight`) and drop the prop to show everything.
|
|
21
|
+
*/
|
|
22
|
+
lineClamp?: number;
|
|
17
23
|
}
|
|
18
24
|
declare const AlertDescription: React.ForwardRefExoticComponent<AlertDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
19
25
|
declare const Alert: typeof AlertRoot & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/components/alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAE3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAIpE,QAAA,MAAM,WAAW,mKAIhB,CAAA;
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/components/alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAE3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAIpE,QAAA,MAAM,WAAW,mKAIhB,CAAA;AAeD,KAAK,aAAa,GAAG,eAAe,CAAC,OAAO,aAAa,CAAC,GAAG;IAC3D,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB,CAAA;AAED,UAAU,UAAW,SAAQ,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa;CAAG;AAEnG,QAAA,MAAM,SAAS,mFA2Cb,CAAA;AAIF,KAAK,kBAAkB,GAAG,eAAe,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEpE,UAAU,eAAgB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,kBAAkB;CAAG;AAE7F,QAAA,MAAM,UAAU,4FAKd,CAAA;AAIF,KAAK,wBAAwB,GAAG,eAAe,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEhF,UAAU,qBACR,SAAQ,KAAK,CAAC,wBAAwB,CAAC,GAAG,CAAC,EACzC,wBAAwB;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAKD,QAAA,MAAM,gBAAgB,oGAkBrB,CAAA;AAGD,QAAA,MAAM,KAAK,EAAE,OAAO,SAAS,GAAG;IAC9B,KAAK,EAAE,OAAO,UAAU,CAAA;IACxB,WAAW,EAAE,OAAO,gBAAgB,CAAA;IACpC,MAAM,EAAE,OAAO,WAAW,CAAA;CAK1B,CAAA;AAEF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,CAAA;AACtE,YAAY,EAAE,qBAAqB,EAAE,UAAU,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -9,6 +9,11 @@ const AlertAction = React.forwardRef(
|
|
|
9
9
|
({ className, ...props }, forwardedRef) => /* @__PURE__ */ jsx("div", { ...props, ref: forwardedRef, className: classNames("dsx-alert__action", className) })
|
|
10
10
|
);
|
|
11
11
|
AlertAction.displayName = "AlertAction";
|
|
12
|
+
const isAlertAction = (node) => React.isValidElement(node) && node.type === AlertAction;
|
|
13
|
+
function splitAlertChildren(children) {
|
|
14
|
+
const nodes = React.Children.toArray(children);
|
|
15
|
+
return { actions: nodes.filter(isAlertAction), body: nodes.filter((node) => !isAlertAction(node)) };
|
|
16
|
+
}
|
|
12
17
|
const AlertRoot = React.forwardRef((props, forwardedRef) => {
|
|
13
18
|
const {
|
|
14
19
|
asChild,
|
|
@@ -25,9 +30,13 @@ const AlertRoot = React.forwardRef((props, forwardedRef) => {
|
|
|
25
30
|
const Comp = asChild ? Slot : "div";
|
|
26
31
|
const fallbackIcon = variant === "success" ? "check-circle" : variant === "default" ? "info" : "alert-triangle";
|
|
27
32
|
const child = asChild ? React.Children.only(children) : null;
|
|
33
|
+
const { actions, body } = splitAlertChildren(child ? child.props.children : children);
|
|
28
34
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29
35
|
icon === null ? null : /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "dsx-alert__icon", children: icon ?? /* @__PURE__ */ jsx(Icon, { name: fallbackIcon, size: "md", strokeWidth: "var(--dsx-icon-stroke-width-strong, 2.25)" }) }),
|
|
30
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ jsxs("div", { className: "dsx-alert__main", children: [
|
|
37
|
+
/* @__PURE__ */ jsx("div", { className: "dsx-alert__content", children: body }),
|
|
38
|
+
actions.length > 0 ? /* @__PURE__ */ jsx("div", { className: "dsx-alert__actions", children: actions }) : null
|
|
39
|
+
] })
|
|
31
40
|
] });
|
|
32
41
|
return /* @__PURE__ */ jsx(
|
|
33
42
|
Comp,
|
|
@@ -51,16 +60,21 @@ const AlertTitle = React.forwardRef((props, forwardedRef) => {
|
|
|
51
60
|
return /* @__PURE__ */ jsx(Comp, { ...titleProps, ref: forwardedRef, className: classNames("dsx-alert__title", className) });
|
|
52
61
|
});
|
|
53
62
|
AlertTitle.displayName = "AlertTitle";
|
|
63
|
+
const isLineClamp = (value) => typeof value === "number" && Number.isInteger(value) && value >= 1;
|
|
54
64
|
const AlertDescription = React.forwardRef(
|
|
55
65
|
(props, forwardedRef) => {
|
|
56
|
-
const {
|
|
66
|
+
const { lineClamp, style, ...ownProps } = props;
|
|
67
|
+
const { asChild, className, ...descriptionProps } = extractProps(ownProps, alertDescriptionPropDefs);
|
|
57
68
|
const Comp = asChild ? Slot : "p";
|
|
69
|
+
const clamp = isLineClamp(lineClamp) ? lineClamp : void 0;
|
|
58
70
|
return /* @__PURE__ */ jsx(
|
|
59
71
|
Comp,
|
|
60
72
|
{
|
|
61
73
|
...descriptionProps,
|
|
62
74
|
ref: forwardedRef,
|
|
63
|
-
className: classNames("dsx-alert__description", className)
|
|
75
|
+
className: classNames("dsx-alert__description", className),
|
|
76
|
+
"data-line-clamp": clamp,
|
|
77
|
+
style: clamp ? { ...style, "--dsx-alert-line-clamp": clamp } : style
|
|
64
78
|
}
|
|
65
79
|
);
|
|
66
80
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/alert/Alert.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\nimport classNames from 'classnames'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { extractProps } from '../../_internal/helpers/extractProps'\nimport { Icon } from '../icon/Icon'\nimport { alertDescriptionPropDefs, alertPropDefs, alertTitlePropDefs } from './alert.props'\n\nimport type { GetPropDefTypes } from '../../_internal/props/propDef'\n\ntype AlertActionElement = React.ComponentRef<'div'>\n\nconst AlertAction = React.forwardRef<AlertActionElement, React.ComponentPropsWithoutRef<'div'>>(\n ({ className, ...props }, forwardedRef) => (\n <div {...props} ref={forwardedRef} className={classNames('dsx-alert__action', className)} />\n ),\n)\nAlertAction.displayName = 'AlertAction'\n\ntype AlertElement = React.ComponentRef<'div'>\ntype AlertOwnProps = GetPropDefTypes<typeof alertPropDefs> & {\n icon?: React.ReactNode\n}\n\ninterface AlertProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'>, AlertOwnProps {}\n\nconst AlertRoot = React.forwardRef<AlertElement, AlertProps>((props, forwardedRef) => {\n const {\n asChild,\n className,\n color,\n highContrast = false,\n icon,\n children,\n role,\n size = 'md',\n variant = 'default',\n ...alertProps\n } = extractProps(props, alertPropDefs)\n const Comp = asChild ? Slot : 'div'\n const fallbackIcon = variant === 'success' ? 'check-circle' : variant === 'default' ? 'info' : 'alert-triangle'\n const child = asChild ? React.Children.only(children) as React.ReactElement<{ children?: React.ReactNode }> : null\n const content = <>\n {icon === null ? null : (\n <span aria-hidden=\"true\" className=\"dsx-alert__icon\">\n {icon ?? <Icon name={fallbackIcon} size=\"md\" strokeWidth=\"var(--dsx-icon-stroke-width-strong, 2.25)\" />}\n </span>\n )}\n <div className=\"dsx-alert__content\">{
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;AACvB,OAAO,gBAAgB;AACvB,SAAS,YAAY;AAErB,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AACrB,SAAS,0BAA0B,eAAe,0BAA0B;AAQxE,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\nimport classNames from 'classnames'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { extractProps } from '../../_internal/helpers/extractProps'\nimport { Icon } from '../icon/Icon'\nimport { alertDescriptionPropDefs, alertPropDefs, alertTitlePropDefs } from './alert.props'\n\nimport type { GetPropDefTypes } from '../../_internal/props/propDef'\n\ntype AlertActionElement = React.ComponentRef<'div'>\n\nconst AlertAction = React.forwardRef<AlertActionElement, React.ComponentPropsWithoutRef<'div'>>(\n ({ className, ...props }, forwardedRef) => (\n <div {...props} ref={forwardedRef} className={classNames('dsx-alert__action', className)} />\n ),\n)\nAlertAction.displayName = 'AlertAction'\n\nconst isAlertAction = (node: React.ReactNode): boolean => React.isValidElement(node) && node.type === AlertAction\n\n// An `Alert.Action` that is a direct child sits beside the content, not inside it, in one `.dsx-alert__actions` group: the\n// group trails the row, and wraps below the text as a whole when it is narrow, under the text and not under the icon (the\n// icon is one column, the text and the group are the other: `.dsx-alert__main`). A consumer who nests an action in their own\n// wrapper keeps it in the content.\nfunction splitAlertChildren(children: React.ReactNode): { actions: React.ReactNode[]; body: React.ReactNode[] } {\n const nodes = React.Children.toArray(children)\n return { actions: nodes.filter(isAlertAction), body: nodes.filter((node) => !isAlertAction(node)) }\n}\n\ntype AlertElement = React.ComponentRef<'div'>\ntype AlertOwnProps = GetPropDefTypes<typeof alertPropDefs> & {\n icon?: React.ReactNode\n}\n\ninterface AlertProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'>, AlertOwnProps {}\n\nconst AlertRoot = React.forwardRef<AlertElement, AlertProps>((props, forwardedRef) => {\n const {\n asChild,\n className,\n color,\n highContrast = false,\n icon,\n children,\n role,\n size = 'md',\n variant = 'default',\n ...alertProps\n } = extractProps(props, alertPropDefs)\n const Comp = asChild ? Slot : 'div'\n const fallbackIcon = variant === 'success' ? 'check-circle' : variant === 'default' ? 'info' : 'alert-triangle'\n const child = asChild ? React.Children.only(children) as React.ReactElement<{ children?: React.ReactNode }> : null\n const { actions, body } = splitAlertChildren(child ? child.props.children : children)\n const content = <>\n {icon === null ? null : (\n <span aria-hidden=\"true\" className=\"dsx-alert__icon\">\n {icon ?? <Icon name={fallbackIcon} size=\"md\" strokeWidth=\"var(--dsx-icon-stroke-width-strong, 2.25)\" />}\n </span>\n )}\n <div className=\"dsx-alert__main\">\n <div className=\"dsx-alert__content\">{body}</div>\n {actions.length > 0 ? <div className=\"dsx-alert__actions\">{actions}</div> : null}\n </div>\n </>\n\n return (\n <Comp\n {...alertProps}\n ref={forwardedRef}\n role={role ?? 'alert'}\n className={classNames('dsx-alert', className)}\n data-accent-color={color}\n data-high-contrast={highContrast ? 'true' : undefined}\n data-size={size}\n data-variant={variant}\n >\n {child ? React.cloneElement(child, undefined, content) : content}\n </Comp>\n )\n})\nAlertRoot.displayName = 'Alert'\n\ntype AlertTitleElement = React.ComponentRef<'h5'>\ntype AlertTitleOwnProps = GetPropDefTypes<typeof alertTitlePropDefs>\n\ninterface AlertTitleProps extends React.ComponentPropsWithoutRef<'h5'>, AlertTitleOwnProps {}\n\nconst AlertTitle = React.forwardRef<AlertTitleElement, AlertTitleProps>((props, forwardedRef) => {\n const { asChild, className, ...titleProps } = extractProps(props, alertTitlePropDefs)\n const Comp = asChild ? Slot : 'h5'\n\n return <Comp {...titleProps} ref={forwardedRef} className={classNames('dsx-alert__title', className)} />\n})\nAlertTitle.displayName = 'AlertTitle'\n\ntype AlertDescriptionElement = React.ComponentRef<'p'>\ntype AlertDescriptionOwnProps = GetPropDefTypes<typeof alertDescriptionPropDefs>\n\ninterface AlertDescriptionProps\n extends React.ComponentPropsWithoutRef<'p'>,\n AlertDescriptionOwnProps {\n /**\n * Clamp the text to this many lines (a whole number of 1 or more); the rest is clipped with an ellipsis. Anything else\n * leaves the text unclamped. Whether the text is clipped, and how to reveal it, is the consumer's: it can measure the\n * element (`scrollHeight > clientHeight`) and drop the prop to show everything.\n */\n lineClamp?: number\n}\n\nconst isLineClamp = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 1\n\nconst AlertDescription = React.forwardRef<AlertDescriptionElement, AlertDescriptionProps>(\n (props, forwardedRef) => {\n // `lineClamp` is behaviour-only, so it stays out of extractProps (it has no class mapping and would leak to the DOM).\n const { lineClamp, style, ...ownProps } = props\n const { asChild, className, ...descriptionProps } = extractProps(ownProps, alertDescriptionPropDefs)\n const Comp = asChild ? Slot : 'p'\n const clamp = isLineClamp(lineClamp) ? lineClamp : undefined\n\n return (\n <Comp\n {...descriptionProps}\n ref={forwardedRef}\n className={classNames('dsx-alert__description', className)}\n data-line-clamp={clamp}\n style={clamp ? ({ ...style, '--dsx-alert-line-clamp': clamp } as React.CSSProperties) : style}\n />\n )\n },\n)\nAlertDescription.displayName = 'AlertDescription'\n\nconst Alert: typeof AlertRoot & {\n Title: typeof AlertTitle\n Description: typeof AlertDescription\n Action: typeof AlertAction\n} = Object.assign(AlertRoot, {\n Title: AlertTitle,\n Description: AlertDescription,\n Action: AlertAction,\n})\n\nexport { Alert, AlertAction, AlertDescription, AlertRoot, AlertTitle }\nexport type { AlertDescriptionProps, AlertProps, AlertTitleProps }\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AACvB,OAAO,gBAAgB;AACvB,SAAS,YAAY;AAErB,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AACrB,SAAS,0BAA0B,eAAe,0BAA0B;AAQxE,SAwCc,UAxCd,KA8CA,YA9CA;AAFJ,MAAM,cAAc,MAAM;AAAA,EACxB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,iBACxB,oBAAC,SAAK,GAAG,OAAO,KAAK,cAAc,WAAW,WAAW,qBAAqB,SAAS,GAAG;AAE9F;AACA,YAAY,cAAc;AAE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|
31
|
-
|
|
29
|
+
/* The icon is one column; the text and the actions are the other. Only this column wraps, so actions that drop below the text
|
|
30
|
+
start under the text and not under the icon (G-15, 2026-10-05). The gap is the alert's own, per size. */
|
|
31
|
+
.dsx-alert__main {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex: 1 1 0;
|
|
32
34
|
flex-wrap: wrap;
|
|
33
|
-
|
|
35
|
+
align-items: flex-start;
|
|
36
|
+
gap: inherit;
|
|
37
|
+
min-width: 0;
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
/* The basis is the width the text needs to read before the actions wrap below it; min() keeps it from overflowing a column
|
|
41
|
+
narrower than that. */
|
|
36
42
|
.dsx-alert__content {
|
|
37
43
|
display: grid;
|
|
38
44
|
gap: var(--dsx-space-xs);
|
|
39
|
-
flex: 1;
|
|
45
|
+
flex: 1 1 min(calc(var(--dsx-size-xl) * 5), 100%);
|
|
40
46
|
min-width: 0;
|
|
41
47
|
overflow-wrap: anywhere;
|
|
42
48
|
}
|
|
43
49
|
|
|
50
|
+
/* The direct-child Alert.Actions are one group. The content grows to push the group to the end of the row, and when the text
|
|
51
|
+
would drop under its readable width the group wraps below it as a whole, at the start of the column. It has no auto margin:
|
|
52
|
+
that would push a wrapped group to the far edge. Its own buttons wrap inside it when even the group is too wide. */
|
|
53
|
+
.dsx-alert__actions {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex: 0 0 auto;
|
|
56
|
+
flex-wrap: wrap;
|
|
57
|
+
align-items: flex-start;
|
|
58
|
+
gap: var(--dsx-space-sm);
|
|
59
|
+
max-width: 100%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.dsx-alert__action {
|
|
63
|
+
align-self: flex-start;
|
|
64
|
+
justify-content: flex-start;
|
|
65
|
+
flex-wrap: wrap;
|
|
66
|
+
gap: var(--dsx-space-sm);
|
|
67
|
+
}
|
|
68
|
+
|
|
44
69
|
.dsx-alert[data-variant='warning'] { border-color: var(--dsx-color-warning); }
|
|
45
70
|
.dsx-alert[data-variant='success'] { border-color: var(--dsx-color-success); }
|
|
46
71
|
.dsx-alert[data-variant='destructive'] { border-color: var(--dsx-color-error); }
|
|
@@ -85,3 +110,35 @@
|
|
|
85
110
|
min-width: var(--dsx-size-lg);
|
|
86
111
|
min-height: var(--dsx-size-lg);
|
|
87
112
|
}
|
|
113
|
+
|
|
114
|
+
/* With a trailing action, the icon, the first line of text and the action share one centre at any width: all
|
|
115
|
+
three get a control-height row, and the first line's box is that tall (`::first-line`). Alerts without an
|
|
116
|
+
action are untouched. Kept last so it wins over the size rules above. */
|
|
117
|
+
:where(.dsx-alert:has(> .dsx-alert__main > .dsx-alert__actions)) :is(.dsx-alert__icon, .dsx-alert__action) {
|
|
118
|
+
min-height: var(--dsx-size-lg);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:where(.dsx-alert:has(> .dsx-alert__main > .dsx-alert__actions)) .dsx-alert__content > :where(:first-child)::first-line {
|
|
122
|
+
line-height: var(--dsx-size-lg);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* `lineClamp` on Alert.Description: the text stops after that many lines with an ellipsis. */
|
|
126
|
+
.dsx-alert__description[data-line-clamp] {
|
|
127
|
+
display: -webkit-box;
|
|
128
|
+
-webkit-box-orient: vertical;
|
|
129
|
+
-webkit-line-clamp: var(--dsx-alert-line-clamp);
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Whether `::first-line` reaches into a clamped description depends on the engine (Chromium draws it as a block
|
|
134
|
+
container, WebKit and Gecko as a legacy flexbox), so the control-height first line above is switched off for it and
|
|
135
|
+
the same centring is done with padding in every engine: the first line sits on the middle of the control row (`lh`
|
|
136
|
+
is the element's own line height). */
|
|
137
|
+
:where(.dsx-alert:has(> .dsx-alert__main > .dsx-alert__actions)) .dsx-alert__description[data-line-clamp] {
|
|
138
|
+
padding-block-start: calc((var(--dsx-size-lg) - 1lh) / 2);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* Same specificity as the first-line rule it switches off (0,1,1), so source order decides: this one comes last. */
|
|
142
|
+
:where(.dsx-alert:has(> .dsx-alert__main > .dsx-alert__actions)) .dsx-alert__description:where([data-line-clamp])::first-line {
|
|
143
|
+
line-height: inherit;
|
|
144
|
+
}
|
|
@@ -70,6 +70,14 @@
|
|
|
70
70
|
padding: var(--dsx-space-xs) var(--dsx-space-sm);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/* labels="none": icon-only items share the width. The label stays in the accessible name; the active
|
|
74
|
+
item is carried by its container fill and aria-current. For widths where five labels do not fit. */
|
|
75
|
+
.dsx-bottom-dock:where([data-labels='none']) .dsx-bottom-dock__item {
|
|
76
|
+
flex: 1 1 0;
|
|
77
|
+
gap: 0;
|
|
78
|
+
padding: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
.dsx-bottom-dock__icon {
|
|
74
82
|
position: relative;
|
|
75
83
|
display: inline-flex;
|
|
@@ -68,7 +68,7 @@ const BottomDockItem = React.forwardRef(({ children, ...props }, forwardedRef) =
|
|
|
68
68
|
const { isActive = false, type = "button", ...restProps } = props;
|
|
69
69
|
const { asChild, className, ...itemProps } = (0, import_extractProps.extractProps)(restProps, import_bottomDock.bottomDockItemPropDefs);
|
|
70
70
|
const { labels } = React.useContext(BottomDockContext);
|
|
71
|
-
const labelHidden = labels === "active" && !isActive;
|
|
71
|
+
const labelHidden = labels === "none" || labels === "active" && !isActive;
|
|
72
72
|
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
73
73
|
const itemContext = React.useMemo(() => ({ labelHidden }), [labelHidden]);
|
|
74
74
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BottomDockItemContext.Provider, { value: itemContext, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/bottomDock/BottomDock.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\nimport classNames from 'classnames'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { extractProps } from '../../_internal/helpers/extractProps'\nimport { VisuallyHidden } from '../visuallyHidden/VisuallyHidden'\nimport { bottomDockItemPropDefs, bottomDockPropDefs } from './bottomDock.props'\n\nimport type { GetPropDefTypes } from '../../_internal/props/propDef'\n\ntype BottomDockOwnProps = GetPropDefTypes<typeof bottomDockPropDefs>\ntype BottomDockItemOwnProps = GetPropDefTypes<typeof bottomDockItemPropDefs>\n\ninterface BottomDockProps extends React.HTMLAttributes<HTMLElement>, BottomDockOwnProps {}\ninterface BottomDockItemProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'>,\n BottomDockItemOwnProps {\n type?: 'button' | 'submit' | 'reset'\n}\ntype BottomDockPartProps = React.HTMLAttributes<HTMLSpanElement>\n\ntype BottomDockContextValue = { labels: 'active' | 'always' }\ntype BottomDockItemContextValue = { labelHidden: boolean }\n\nconst BottomDockContext = React.createContext<BottomDockContextValue>({ labels: 'active' })\nconst BottomDockItemContext = React.createContext<BottomDockItemContextValue>({ labelHidden: false })\n\nconst BottomDock = React.forwardRef<HTMLElement, BottomDockProps>(({ children, ...props }, forwardedRef) => {\n const { placement = 'fixed', labels = 'active', ...restProps } = props\n const { asChild, className, ...dockProps } = extractProps(restProps, bottomDockPropDefs)\n const Comp = asChild ? Slot : 'nav'\n const context = React.useMemo<BottomDockContextValue>(() => ({ labels }), [labels])\n\n return (\n <BottomDockContext.Provider value={context}>\n <Comp\n aria-label=\"Bottom navigation\"\n {...dockProps}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock', className)}\n data-slot=\"bottom-dock\"\n data-placement={placement}\n data-labels={labels}\n >\n {children}\n </Comp>\n </BottomDockContext.Provider>\n )\n})\nBottomDock.displayName = 'BottomDock'\n\nconst BottomDockItem = React.forwardRef<HTMLButtonElement, BottomDockItemProps>(({ children, ...props }, forwardedRef) => {\n const { isActive = false, type = 'button', ...restProps } = props\n const { asChild, className, ...itemProps } = extractProps(restProps, bottomDockItemPropDefs)\n const { labels } = React.useContext(BottomDockContext)\n const labelHidden = labels === 'active' && !isActive\n const Comp = asChild ? Slot : 'button'\n const itemContext = React.useMemo<BottomDockItemContextValue>(() => ({ labelHidden }), [labelHidden])\n\n return (\n <BottomDockItemContext.Provider value={itemContext}>\n <Comp\n aria-current={isActive ? 'page' : undefined}\n {...itemProps}\n {...(asChild ? {} : { type })}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__item', className)}\n data-slot=\"bottom-dock-item\"\n data-active={isActive ? 'true' : undefined}\n data-label={labelHidden ? 'hidden' : 'visible'}\n >\n {children}\n </Comp>\n </BottomDockItemContext.Provider>\n )\n})\nBottomDockItem.displayName = 'BottomDockItem'\n\nconst BottomDockIcon = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => (\n <span\n {...props}\n ref={forwardedRef}\n aria-hidden=\"true\"\n className={classNames('dsx-bottom-dock__icon', className)}\n data-slot=\"bottom-dock-icon\"\n >\n {children}\n </span>\n ),\n)\nBottomDockIcon.displayName = 'BottomDockIcon'\n\nconst BottomDockLabel = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => {\n const { labelHidden } = React.useContext(BottomDockItemContext)\n const label = (\n <span\n {...props}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__label', className)}\n data-slot=\"bottom-dock-label\"\n >\n {children}\n </span>\n )\n\n return labelHidden ? <VisuallyHidden asChild>{label}</VisuallyHidden> : label\n },\n)\nBottomDockLabel.displayName = 'BottomDockLabel'\n\nconst BottomDockBadge = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => (\n <span\n {...props}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__badge', className)}\n data-slot=\"bottom-dock-badge\"\n >\n {children}\n </span>\n ),\n)\nBottomDockBadge.displayName = 'BottomDockBadge'\n\nconst BottomDockRoot: typeof BottomDock & {\n Item: typeof BottomDockItem\n Icon: typeof BottomDockIcon\n Label: typeof BottomDockLabel\n Badge: typeof BottomDockBadge\n} = Object.assign(BottomDock, {\n Item: BottomDockItem,\n Icon: BottomDockIcon,\n Label: BottomDockLabel,\n Badge: BottomDockBadge,\n})\n\nexport {\n BottomDockRoot as BottomDock,\n BottomDockBadge,\n BottomDockIcon,\n BottomDockItem,\n BottomDockLabel,\n}\nexport type {\n BottomDockItemProps,\n BottomDockPartProps,\n BottomDockProps,\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,wBAAuB;AACvB,wBAAqB;AAErB,0BAA6B;AAC7B,4BAA+B;AAC/B,wBAA2D;AA6BrD;AAXN,MAAM,oBAAoB,MAAM,cAAsC,EAAE,QAAQ,SAAS,CAAC;AAC1F,MAAM,wBAAwB,MAAM,cAA0C,EAAE,aAAa,MAAM,CAAC;AAEpG,MAAM,aAAa,MAAM,WAAyC,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,iBAAiB;AAC1G,QAAM,EAAE,YAAY,SAAS,SAAS,UAAU,GAAG,UAAU,IAAI;AACjE,QAAM,EAAE,SAAS,WAAW,GAAG,UAAU,QAAI,kCAAa,WAAW,oCAAkB;AACvF,QAAM,OAAO,UAAU,yBAAO;AAC9B,QAAM,UAAU,MAAM,QAAgC,OAAO,EAAE,OAAO,IAAI,CAAC,MAAM,CAAC;AAElF,SACE,4CAAC,kBAAkB,UAAlB,EAA2B,OAAO,SACjC;AAAA,IAAC;AAAA;AAAA,MACC,cAAW;AAAA,MACV,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,eAAW,kBAAAA,SAAW,mBAAmB,SAAS;AAAA,MAClD,aAAU;AAAA,MACV,kBAAgB;AAAA,MAChB,eAAa;AAAA,MAEZ;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;AACD,WAAW,cAAc;AAEzB,MAAM,iBAAiB,MAAM,WAAmD,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,iBAAiB;AACxH,QAAM,EAAE,WAAW,OAAO,OAAO,UAAU,GAAG,UAAU,IAAI;AAC5D,QAAM,EAAE,SAAS,WAAW,GAAG,UAAU,QAAI,kCAAa,WAAW,wCAAsB;AAC3F,QAAM,EAAE,OAAO,IAAI,MAAM,WAAW,iBAAiB;AACrD,QAAM,cAAc,WAAW,YAAY,CAAC;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\nimport classNames from 'classnames'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { extractProps } from '../../_internal/helpers/extractProps'\nimport { VisuallyHidden } from '../visuallyHidden/VisuallyHidden'\nimport { bottomDockItemPropDefs, bottomDockPropDefs } from './bottomDock.props'\n\nimport type { GetPropDefTypes } from '../../_internal/props/propDef'\n\ntype BottomDockOwnProps = GetPropDefTypes<typeof bottomDockPropDefs>\ntype BottomDockItemOwnProps = GetPropDefTypes<typeof bottomDockItemPropDefs>\n\ninterface BottomDockProps extends React.HTMLAttributes<HTMLElement>, BottomDockOwnProps {}\ninterface BottomDockItemProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'>,\n BottomDockItemOwnProps {\n type?: 'button' | 'submit' | 'reset'\n}\ntype BottomDockPartProps = React.HTMLAttributes<HTMLSpanElement>\n\ntype BottomDockContextValue = { labels: 'active' | 'always' | 'none' }\ntype BottomDockItemContextValue = { labelHidden: boolean }\n\nconst BottomDockContext = React.createContext<BottomDockContextValue>({ labels: 'active' })\nconst BottomDockItemContext = React.createContext<BottomDockItemContextValue>({ labelHidden: false })\n\nconst BottomDock = React.forwardRef<HTMLElement, BottomDockProps>(({ children, ...props }, forwardedRef) => {\n const { placement = 'fixed', labels = 'active', ...restProps } = props\n const { asChild, className, ...dockProps } = extractProps(restProps, bottomDockPropDefs)\n const Comp = asChild ? Slot : 'nav'\n const context = React.useMemo<BottomDockContextValue>(() => ({ labels }), [labels])\n\n return (\n <BottomDockContext.Provider value={context}>\n <Comp\n aria-label=\"Bottom navigation\"\n {...dockProps}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock', className)}\n data-slot=\"bottom-dock\"\n data-placement={placement}\n data-labels={labels}\n >\n {children}\n </Comp>\n </BottomDockContext.Provider>\n )\n})\nBottomDock.displayName = 'BottomDock'\n\nconst BottomDockItem = React.forwardRef<HTMLButtonElement, BottomDockItemProps>(({ children, ...props }, forwardedRef) => {\n const { isActive = false, type = 'button', ...restProps } = props\n const { asChild, className, ...itemProps } = extractProps(restProps, bottomDockItemPropDefs)\n const { labels } = React.useContext(BottomDockContext)\n const labelHidden = labels === 'none' || (labels === 'active' && !isActive)\n const Comp = asChild ? Slot : 'button'\n const itemContext = React.useMemo<BottomDockItemContextValue>(() => ({ labelHidden }), [labelHidden])\n\n return (\n <BottomDockItemContext.Provider value={itemContext}>\n <Comp\n aria-current={isActive ? 'page' : undefined}\n {...itemProps}\n {...(asChild ? {} : { type })}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__item', className)}\n data-slot=\"bottom-dock-item\"\n data-active={isActive ? 'true' : undefined}\n data-label={labelHidden ? 'hidden' : 'visible'}\n >\n {children}\n </Comp>\n </BottomDockItemContext.Provider>\n )\n})\nBottomDockItem.displayName = 'BottomDockItem'\n\nconst BottomDockIcon = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => (\n <span\n {...props}\n ref={forwardedRef}\n aria-hidden=\"true\"\n className={classNames('dsx-bottom-dock__icon', className)}\n data-slot=\"bottom-dock-icon\"\n >\n {children}\n </span>\n ),\n)\nBottomDockIcon.displayName = 'BottomDockIcon'\n\nconst BottomDockLabel = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => {\n const { labelHidden } = React.useContext(BottomDockItemContext)\n const label = (\n <span\n {...props}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__label', className)}\n data-slot=\"bottom-dock-label\"\n >\n {children}\n </span>\n )\n\n return labelHidden ? <VisuallyHidden asChild>{label}</VisuallyHidden> : label\n },\n)\nBottomDockLabel.displayName = 'BottomDockLabel'\n\nconst BottomDockBadge = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => (\n <span\n {...props}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__badge', className)}\n data-slot=\"bottom-dock-badge\"\n >\n {children}\n </span>\n ),\n)\nBottomDockBadge.displayName = 'BottomDockBadge'\n\nconst BottomDockRoot: typeof BottomDock & {\n Item: typeof BottomDockItem\n Icon: typeof BottomDockIcon\n Label: typeof BottomDockLabel\n Badge: typeof BottomDockBadge\n} = Object.assign(BottomDock, {\n Item: BottomDockItem,\n Icon: BottomDockIcon,\n Label: BottomDockLabel,\n Badge: BottomDockBadge,\n})\n\nexport {\n BottomDockRoot as BottomDock,\n BottomDockBadge,\n BottomDockIcon,\n BottomDockItem,\n BottomDockLabel,\n}\nexport type {\n BottomDockItemProps,\n BottomDockPartProps,\n BottomDockProps,\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,wBAAuB;AACvB,wBAAqB;AAErB,0BAA6B;AAC7B,4BAA+B;AAC/B,wBAA2D;AA6BrD;AAXN,MAAM,oBAAoB,MAAM,cAAsC,EAAE,QAAQ,SAAS,CAAC;AAC1F,MAAM,wBAAwB,MAAM,cAA0C,EAAE,aAAa,MAAM,CAAC;AAEpG,MAAM,aAAa,MAAM,WAAyC,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,iBAAiB;AAC1G,QAAM,EAAE,YAAY,SAAS,SAAS,UAAU,GAAG,UAAU,IAAI;AACjE,QAAM,EAAE,SAAS,WAAW,GAAG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,iBAAiB,MAAM;AAAA,EAC3B,CAAC,EAAE,UAAU,WAAW,GAAG,MAAM,GAAG,iBAClC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,eAAY;AAAA,MACZ,eAAW,kBAAAA,SAAW,yBAAyB,SAAS;AAAA,MACxD,aAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;AACA,eAAe,cAAc;AAE7B,MAAM,kBAAkB,MAAM;AAAA,EAC5B,CAAC,EAAE,UAAU,WAAW,GAAG,MAAM,GAAG,iBAAiB;AACnD,UAAM,EAAE,YAAY,IAAI,MAAM,WAAW,qBAAqB;AAC9D,UAAM,QACJ;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,eAAW,kBAAAA,SAAW,0BAA0B,SAAS;AAAA,QACzD,aAAU;AAAA,QAET;AAAA;AAAA,IACH;AAGF,WAAO,cAAc,4CAAC,wCAAe,SAAO,MAAE,iBAAM,IAAoB;AAAA,EAC1E;AACF;AACA,gBAAgB,cAAc;AAE9B,MAAM,kBAAkB,MAAM;AAAA,EAC5B,CAAC,EAAE,UAAU,WAAW,GAAG,MAAM,GAAG,iBAClC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,eAAW,kBAAAA,SAAW,0BAA0B,SAAS;AAAA,MACzD,aAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;AACA,gBAAgB,cAAc;AAE9B,MAAM,iBAKF,OAAO,OAAO,YAAY;AAAA,EAC5B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AACT,CAAC;",
|
|
6
6
|
"names": ["classNames"]
|
|
7
7
|
}
|
|
@@ -31,7 +31,7 @@ const BottomDockItem = React.forwardRef(({ children, ...props }, forwardedRef) =
|
|
|
31
31
|
const { isActive = false, type = "button", ...restProps } = props;
|
|
32
32
|
const { asChild, className, ...itemProps } = extractProps(restProps, bottomDockItemPropDefs);
|
|
33
33
|
const { labels } = React.useContext(BottomDockContext);
|
|
34
|
-
const labelHidden = labels === "active" && !isActive;
|
|
34
|
+
const labelHidden = labels === "none" || labels === "active" && !isActive;
|
|
35
35
|
const Comp = asChild ? Slot : "button";
|
|
36
36
|
const itemContext = React.useMemo(() => ({ labelHidden }), [labelHidden]);
|
|
37
37
|
return /* @__PURE__ */ jsx(BottomDockItemContext.Provider, { value: itemContext, children: /* @__PURE__ */ jsx(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/bottomDock/BottomDock.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\nimport classNames from 'classnames'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { extractProps } from '../../_internal/helpers/extractProps'\nimport { VisuallyHidden } from '../visuallyHidden/VisuallyHidden'\nimport { bottomDockItemPropDefs, bottomDockPropDefs } from './bottomDock.props'\n\nimport type { GetPropDefTypes } from '../../_internal/props/propDef'\n\ntype BottomDockOwnProps = GetPropDefTypes<typeof bottomDockPropDefs>\ntype BottomDockItemOwnProps = GetPropDefTypes<typeof bottomDockItemPropDefs>\n\ninterface BottomDockProps extends React.HTMLAttributes<HTMLElement>, BottomDockOwnProps {}\ninterface BottomDockItemProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'>,\n BottomDockItemOwnProps {\n type?: 'button' | 'submit' | 'reset'\n}\ntype BottomDockPartProps = React.HTMLAttributes<HTMLSpanElement>\n\ntype BottomDockContextValue = { labels: 'active' | 'always' }\ntype BottomDockItemContextValue = { labelHidden: boolean }\n\nconst BottomDockContext = React.createContext<BottomDockContextValue>({ labels: 'active' })\nconst BottomDockItemContext = React.createContext<BottomDockItemContextValue>({ labelHidden: false })\n\nconst BottomDock = React.forwardRef<HTMLElement, BottomDockProps>(({ children, ...props }, forwardedRef) => {\n const { placement = 'fixed', labels = 'active', ...restProps } = props\n const { asChild, className, ...dockProps } = extractProps(restProps, bottomDockPropDefs)\n const Comp = asChild ? Slot : 'nav'\n const context = React.useMemo<BottomDockContextValue>(() => ({ labels }), [labels])\n\n return (\n <BottomDockContext.Provider value={context}>\n <Comp\n aria-label=\"Bottom navigation\"\n {...dockProps}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock', className)}\n data-slot=\"bottom-dock\"\n data-placement={placement}\n data-labels={labels}\n >\n {children}\n </Comp>\n </BottomDockContext.Provider>\n )\n})\nBottomDock.displayName = 'BottomDock'\n\nconst BottomDockItem = React.forwardRef<HTMLButtonElement, BottomDockItemProps>(({ children, ...props }, forwardedRef) => {\n const { isActive = false, type = 'button', ...restProps } = props\n const { asChild, className, ...itemProps } = extractProps(restProps, bottomDockItemPropDefs)\n const { labels } = React.useContext(BottomDockContext)\n const labelHidden = labels === 'active' && !isActive\n const Comp = asChild ? Slot : 'button'\n const itemContext = React.useMemo<BottomDockItemContextValue>(() => ({ labelHidden }), [labelHidden])\n\n return (\n <BottomDockItemContext.Provider value={itemContext}>\n <Comp\n aria-current={isActive ? 'page' : undefined}\n {...itemProps}\n {...(asChild ? {} : { type })}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__item', className)}\n data-slot=\"bottom-dock-item\"\n data-active={isActive ? 'true' : undefined}\n data-label={labelHidden ? 'hidden' : 'visible'}\n >\n {children}\n </Comp>\n </BottomDockItemContext.Provider>\n )\n})\nBottomDockItem.displayName = 'BottomDockItem'\n\nconst BottomDockIcon = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => (\n <span\n {...props}\n ref={forwardedRef}\n aria-hidden=\"true\"\n className={classNames('dsx-bottom-dock__icon', className)}\n data-slot=\"bottom-dock-icon\"\n >\n {children}\n </span>\n ),\n)\nBottomDockIcon.displayName = 'BottomDockIcon'\n\nconst BottomDockLabel = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => {\n const { labelHidden } = React.useContext(BottomDockItemContext)\n const label = (\n <span\n {...props}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__label', className)}\n data-slot=\"bottom-dock-label\"\n >\n {children}\n </span>\n )\n\n return labelHidden ? <VisuallyHidden asChild>{label}</VisuallyHidden> : label\n },\n)\nBottomDockLabel.displayName = 'BottomDockLabel'\n\nconst BottomDockBadge = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => (\n <span\n {...props}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__badge', className)}\n data-slot=\"bottom-dock-badge\"\n >\n {children}\n </span>\n ),\n)\nBottomDockBadge.displayName = 'BottomDockBadge'\n\nconst BottomDockRoot: typeof BottomDock & {\n Item: typeof BottomDockItem\n Icon: typeof BottomDockIcon\n Label: typeof BottomDockLabel\n Badge: typeof BottomDockBadge\n} = Object.assign(BottomDock, {\n Item: BottomDockItem,\n Icon: BottomDockIcon,\n Label: BottomDockLabel,\n Badge: BottomDockBadge,\n})\n\nexport {\n BottomDockRoot as BottomDock,\n BottomDockBadge,\n BottomDockIcon,\n BottomDockItem,\n BottomDockLabel,\n}\nexport type {\n BottomDockItemProps,\n BottomDockPartProps,\n BottomDockProps,\n}\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;AACvB,OAAO,gBAAgB;AACvB,SAAS,YAAY;AAErB,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB,0BAA0B;AA6BrD;AAXN,MAAM,oBAAoB,MAAM,cAAsC,EAAE,QAAQ,SAAS,CAAC;AAC1F,MAAM,wBAAwB,MAAM,cAA0C,EAAE,aAAa,MAAM,CAAC;AAEpG,MAAM,aAAa,MAAM,WAAyC,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,iBAAiB;AAC1G,QAAM,EAAE,YAAY,SAAS,SAAS,UAAU,GAAG,UAAU,IAAI;AACjE,QAAM,EAAE,SAAS,WAAW,GAAG,UAAU,IAAI,aAAa,WAAW,kBAAkB;AACvF,QAAM,OAAO,UAAU,OAAO;AAC9B,QAAM,UAAU,MAAM,QAAgC,OAAO,EAAE,OAAO,IAAI,CAAC,MAAM,CAAC;AAElF,SACE,oBAAC,kBAAkB,UAAlB,EAA2B,OAAO,SACjC;AAAA,IAAC;AAAA;AAAA,MACC,cAAW;AAAA,MACV,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,WAAW,WAAW,mBAAmB,SAAS;AAAA,MAClD,aAAU;AAAA,MACV,kBAAgB;AAAA,MAChB,eAAa;AAAA,MAEZ;AAAA;AAAA,EACH,GACF;AAEJ,CAAC;AACD,WAAW,cAAc;AAEzB,MAAM,iBAAiB,MAAM,WAAmD,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,iBAAiB;AACxH,QAAM,EAAE,WAAW,OAAO,OAAO,UAAU,GAAG,UAAU,IAAI;AAC5D,QAAM,EAAE,SAAS,WAAW,GAAG,UAAU,IAAI,aAAa,WAAW,sBAAsB;AAC3F,QAAM,EAAE,OAAO,IAAI,MAAM,WAAW,iBAAiB;AACrD,QAAM,cAAc,WAAW,YAAY,CAAC;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\nimport classNames from 'classnames'\nimport { Slot } from '@radix-ui/react-slot'\n\nimport { extractProps } from '../../_internal/helpers/extractProps'\nimport { VisuallyHidden } from '../visuallyHidden/VisuallyHidden'\nimport { bottomDockItemPropDefs, bottomDockPropDefs } from './bottomDock.props'\n\nimport type { GetPropDefTypes } from '../../_internal/props/propDef'\n\ntype BottomDockOwnProps = GetPropDefTypes<typeof bottomDockPropDefs>\ntype BottomDockItemOwnProps = GetPropDefTypes<typeof bottomDockItemPropDefs>\n\ninterface BottomDockProps extends React.HTMLAttributes<HTMLElement>, BottomDockOwnProps {}\ninterface BottomDockItemProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'>,\n BottomDockItemOwnProps {\n type?: 'button' | 'submit' | 'reset'\n}\ntype BottomDockPartProps = React.HTMLAttributes<HTMLSpanElement>\n\ntype BottomDockContextValue = { labels: 'active' | 'always' | 'none' }\ntype BottomDockItemContextValue = { labelHidden: boolean }\n\nconst BottomDockContext = React.createContext<BottomDockContextValue>({ labels: 'active' })\nconst BottomDockItemContext = React.createContext<BottomDockItemContextValue>({ labelHidden: false })\n\nconst BottomDock = React.forwardRef<HTMLElement, BottomDockProps>(({ children, ...props }, forwardedRef) => {\n const { placement = 'fixed', labels = 'active', ...restProps } = props\n const { asChild, className, ...dockProps } = extractProps(restProps, bottomDockPropDefs)\n const Comp = asChild ? Slot : 'nav'\n const context = React.useMemo<BottomDockContextValue>(() => ({ labels }), [labels])\n\n return (\n <BottomDockContext.Provider value={context}>\n <Comp\n aria-label=\"Bottom navigation\"\n {...dockProps}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock', className)}\n data-slot=\"bottom-dock\"\n data-placement={placement}\n data-labels={labels}\n >\n {children}\n </Comp>\n </BottomDockContext.Provider>\n )\n})\nBottomDock.displayName = 'BottomDock'\n\nconst BottomDockItem = React.forwardRef<HTMLButtonElement, BottomDockItemProps>(({ children, ...props }, forwardedRef) => {\n const { isActive = false, type = 'button', ...restProps } = props\n const { asChild, className, ...itemProps } = extractProps(restProps, bottomDockItemPropDefs)\n const { labels } = React.useContext(BottomDockContext)\n const labelHidden = labels === 'none' || (labels === 'active' && !isActive)\n const Comp = asChild ? Slot : 'button'\n const itemContext = React.useMemo<BottomDockItemContextValue>(() => ({ labelHidden }), [labelHidden])\n\n return (\n <BottomDockItemContext.Provider value={itemContext}>\n <Comp\n aria-current={isActive ? 'page' : undefined}\n {...itemProps}\n {...(asChild ? {} : { type })}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__item', className)}\n data-slot=\"bottom-dock-item\"\n data-active={isActive ? 'true' : undefined}\n data-label={labelHidden ? 'hidden' : 'visible'}\n >\n {children}\n </Comp>\n </BottomDockItemContext.Provider>\n )\n})\nBottomDockItem.displayName = 'BottomDockItem'\n\nconst BottomDockIcon = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => (\n <span\n {...props}\n ref={forwardedRef}\n aria-hidden=\"true\"\n className={classNames('dsx-bottom-dock__icon', className)}\n data-slot=\"bottom-dock-icon\"\n >\n {children}\n </span>\n ),\n)\nBottomDockIcon.displayName = 'BottomDockIcon'\n\nconst BottomDockLabel = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => {\n const { labelHidden } = React.useContext(BottomDockItemContext)\n const label = (\n <span\n {...props}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__label', className)}\n data-slot=\"bottom-dock-label\"\n >\n {children}\n </span>\n )\n\n return labelHidden ? <VisuallyHidden asChild>{label}</VisuallyHidden> : label\n },\n)\nBottomDockLabel.displayName = 'BottomDockLabel'\n\nconst BottomDockBadge = React.forwardRef<HTMLSpanElement, BottomDockPartProps>(\n ({ children, className, ...props }, forwardedRef) => (\n <span\n {...props}\n ref={forwardedRef}\n className={classNames('dsx-bottom-dock__badge', className)}\n data-slot=\"bottom-dock-badge\"\n >\n {children}\n </span>\n ),\n)\nBottomDockBadge.displayName = 'BottomDockBadge'\n\nconst BottomDockRoot: typeof BottomDock & {\n Item: typeof BottomDockItem\n Icon: typeof BottomDockIcon\n Label: typeof BottomDockLabel\n Badge: typeof BottomDockBadge\n} = Object.assign(BottomDock, {\n Item: BottomDockItem,\n Icon: BottomDockIcon,\n Label: BottomDockLabel,\n Badge: BottomDockBadge,\n})\n\nexport {\n BottomDockRoot as BottomDock,\n BottomDockBadge,\n BottomDockIcon,\n BottomDockItem,\n BottomDockLabel,\n}\nexport type {\n BottomDockItemProps,\n BottomDockPartProps,\n BottomDockProps,\n}\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AACvB,OAAO,gBAAgB;AACvB,SAAS,YAAY;AAErB,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAA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YAAY;AAAA,EAC5B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AACT,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -26,7 +26,7 @@ __export(bottomDock_props_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(bottomDock_props_exports);
|
|
27
27
|
var import_asChild = require("../../_internal/props/asChild.prop");
|
|
28
28
|
const bottomDockPlacements = ["fixed", "contained"];
|
|
29
|
-
const bottomDockLabelModes = ["active", "always"];
|
|
29
|
+
const bottomDockLabelModes = ["active", "always", "none"];
|
|
30
30
|
const bottomDockPropDefs = {
|
|
31
31
|
...import_asChild.asChildPropDef,
|
|
32
32
|
placement: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/bottomDock/bottomDock.props.ts"],
|
|
4
|
-
"sourcesContent": ["import { asChildPropDef } from '../../_internal/props/asChild.prop'\n\nimport type { PropDef } from '../../_internal/props/propDef'\n\nconst bottomDockPlacements = ['fixed', 'contained'] as const\nconst bottomDockLabelModes = ['active', 'always'] as const\n\nconst bottomDockPropDefs = {\n ...asChildPropDef,\n placement: {\n type: 'enum',\n values: bottomDockPlacements,\n default: 'fixed',\n },\n labels: {\n type: 'enum',\n values: bottomDockLabelModes,\n default: 'active',\n },\n} satisfies {\n asChild: PropDef\n placement: PropDef<(typeof bottomDockPlacements)[number]>\n labels: PropDef<(typeof bottomDockLabelModes)[number]>\n}\n\nconst bottomDockItemPropDefs = {\n ...asChildPropDef,\n isActive: {\n type: 'boolean',\n },\n} satisfies {\n asChild: PropDef\n isActive: PropDef\n}\n\nexport { bottomDockItemPropDefs, bottomDockLabelModes, bottomDockPlacements, bottomDockPropDefs }\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+B;AAI/B,MAAM,uBAAuB,CAAC,SAAS,WAAW;AAClD,MAAM,uBAAuB,CAAC,UAAU,
|
|
4
|
+
"sourcesContent": ["import { asChildPropDef } from '../../_internal/props/asChild.prop'\n\nimport type { PropDef } from '../../_internal/props/propDef'\n\nconst bottomDockPlacements = ['fixed', 'contained'] as const\nconst bottomDockLabelModes = ['active', 'always', 'none'] as const\n\nconst bottomDockPropDefs = {\n ...asChildPropDef,\n placement: {\n type: 'enum',\n values: bottomDockPlacements,\n default: 'fixed',\n },\n labels: {\n type: 'enum',\n values: bottomDockLabelModes,\n default: 'active',\n },\n} satisfies {\n asChild: PropDef\n placement: PropDef<(typeof bottomDockPlacements)[number]>\n labels: PropDef<(typeof bottomDockLabelModes)[number]>\n}\n\nconst bottomDockItemPropDefs = {\n ...asChildPropDef,\n isActive: {\n type: 'boolean',\n },\n} satisfies {\n asChild: PropDef\n isActive: PropDef\n}\n\nexport { bottomDockItemPropDefs, bottomDockLabelModes, bottomDockPlacements, bottomDockPropDefs }\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+B;AAI/B,MAAM,uBAAuB,CAAC,SAAS,WAAW;AAClD,MAAM,uBAAuB,CAAC,UAAU,UAAU,MAAM;AAExD,MAAM,qBAAqB;AAAA,EACzB,GAAG;AAAA,EACH,WAAW;AAAA,IACT,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AACF;AAMA,MAAM,yBAAyB;AAAA,EAC7B,GAAG;AAAA,EACH,UAAU;AAAA,IACR,MAAM;AAAA,EACR;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const bottomDockPlacements: readonly ["fixed", "contained"];
|
|
2
|
-
declare const bottomDockLabelModes: readonly ["active", "always"];
|
|
2
|
+
declare const bottomDockLabelModes: readonly ["active", "always", "none"];
|
|
3
3
|
declare const bottomDockPropDefs: {
|
|
4
4
|
placement: {
|
|
5
5
|
type: "enum";
|
|
@@ -8,7 +8,7 @@ declare const bottomDockPropDefs: {
|
|
|
8
8
|
};
|
|
9
9
|
labels: {
|
|
10
10
|
type: "enum";
|
|
11
|
-
values: readonly ["active", "always"];
|
|
11
|
+
values: readonly ["active", "always", "none"];
|
|
12
12
|
default: "active";
|
|
13
13
|
};
|
|
14
14
|
asChild: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottomDock.props.d.cts","sourceRoot":"","sources":["../../../src/components/bottomDock/bottomDock.props.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,oBAAoB,iCAAkC,CAAA;AAC5D,QAAA,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"bottomDock.props.d.cts","sourceRoot":"","sources":["../../../src/components/bottomDock/bottomDock.props.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,oBAAoB,iCAAkC,CAAA;AAC5D,QAAA,MAAM,oBAAoB,uCAAwC,CAAA;AAElE,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;CAgBvB,CAAA;AAED,QAAA,MAAM,sBAAsB;;;;;;;;CAQ3B,CAAA;AAED,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const bottomDockPlacements: readonly ["fixed", "contained"];
|
|
2
|
-
declare const bottomDockLabelModes: readonly ["active", "always"];
|
|
2
|
+
declare const bottomDockLabelModes: readonly ["active", "always", "none"];
|
|
3
3
|
declare const bottomDockPropDefs: {
|
|
4
4
|
placement: {
|
|
5
5
|
type: "enum";
|
|
@@ -8,7 +8,7 @@ declare const bottomDockPropDefs: {
|
|
|
8
8
|
};
|
|
9
9
|
labels: {
|
|
10
10
|
type: "enum";
|
|
11
|
-
values: readonly ["active", "always"];
|
|
11
|
+
values: readonly ["active", "always", "none"];
|
|
12
12
|
default: "active";
|
|
13
13
|
};
|
|
14
14
|
asChild: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottomDock.props.d.mts","sourceRoot":"","sources":["../../../src/components/bottomDock/bottomDock.props.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,oBAAoB,iCAAkC,CAAA;AAC5D,QAAA,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"bottomDock.props.d.mts","sourceRoot":"","sources":["../../../src/components/bottomDock/bottomDock.props.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,oBAAoB,iCAAkC,CAAA;AAC5D,QAAA,MAAM,oBAAoB,uCAAwC,CAAA;AAElE,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;CAgBvB,CAAA;AAED,QAAA,MAAM,sBAAsB;;;;;;;;CAQ3B,CAAA;AAED,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const bottomDockPlacements: readonly ["fixed", "contained"];
|
|
2
|
-
declare const bottomDockLabelModes: readonly ["active", "always"];
|
|
2
|
+
declare const bottomDockLabelModes: readonly ["active", "always", "none"];
|
|
3
3
|
declare const bottomDockPropDefs: {
|
|
4
4
|
placement: {
|
|
5
5
|
type: "enum";
|
|
@@ -8,7 +8,7 @@ declare const bottomDockPropDefs: {
|
|
|
8
8
|
};
|
|
9
9
|
labels: {
|
|
10
10
|
type: "enum";
|
|
11
|
-
values: readonly ["active", "always"];
|
|
11
|
+
values: readonly ["active", "always", "none"];
|
|
12
12
|
default: "active";
|
|
13
13
|
};
|
|
14
14
|
asChild: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottomDock.props.d.ts","sourceRoot":"","sources":["../../../src/components/bottomDock/bottomDock.props.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,oBAAoB,iCAAkC,CAAA;AAC5D,QAAA,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"bottomDock.props.d.ts","sourceRoot":"","sources":["../../../src/components/bottomDock/bottomDock.props.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,oBAAoB,iCAAkC,CAAA;AAC5D,QAAA,MAAM,oBAAoB,uCAAwC,CAAA;AAElE,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;CAgBvB,CAAA;AAED,QAAA,MAAM,sBAAsB;;;;;;;;CAQ3B,CAAA;AAED,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { asChildPropDef } from "../../_internal/props/asChild.prop.js";
|
|
2
2
|
const bottomDockPlacements = ["fixed", "contained"];
|
|
3
|
-
const bottomDockLabelModes = ["active", "always"];
|
|
3
|
+
const bottomDockLabelModes = ["active", "always", "none"];
|
|
4
4
|
const bottomDockPropDefs = {
|
|
5
5
|
...asChildPropDef,
|
|
6
6
|
placement: {
|