@gnome-ui/react 1.47.0 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/EntryRow/EntryRow.module.css.cjs +1 -1
- package/dist/components/EntryRow/EntryRow.module.css.cjs.map +1 -1
- package/dist/components/EntryRow/EntryRow.module.css.js +10 -10
- package/dist/components/EntryRow/EntryRow.module.css.js.map +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.cjs +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.cjs.map +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.d.ts +11 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.js +136 -24
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.js.map +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.module.css.cjs +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.module.css.cjs.map +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.module.css.js +22 -10
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.module.css.js.map +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcherItem.cjs +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcherItem.cjs.map +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcherItem.d.ts +4 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcherItem.js +7 -6
- package/dist/components/InlineViewSwitcher/InlineViewSwitcherItem.js.map +1 -1
- package/dist/components/InlineViewSwitcher/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -14,4 +14,7 @@ export interface InlineViewSwitcherItemProps extends ButtonHTMLAttributes<HTMLBu
|
|
|
14
14
|
* Can be icon-only, label-only, or icon + label. For icon-only items always
|
|
15
15
|
* provide an `aria-label` so screen readers can identify the view.
|
|
16
16
|
*/
|
|
17
|
-
export declare const InlineViewSwitcherItem:
|
|
17
|
+
export declare const InlineViewSwitcherItem: {
|
|
18
|
+
({ name, label, icon, disabled, className, ...props }: InlineViewSwitcherItemProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
@@ -4,18 +4,18 @@ import { useInlineViewSwitcher as n } from "./InlineViewSwitcher.js";
|
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/InlineViewSwitcher/InlineViewSwitcherItem.tsx
|
|
6
6
|
var a = ({ name: a, label: o, icon: s, disabled: c, className: l, ...u }) => {
|
|
7
|
-
let { value: d, onValueChange: f } = n(),
|
|
7
|
+
let { value: d, onValueChange: f, compact: p } = n(), m = d === a, h = !!o && !(p && s), g = !!s && !h;
|
|
8
8
|
return /* @__PURE__ */ i("button", {
|
|
9
9
|
type: "button",
|
|
10
10
|
role: "radio",
|
|
11
|
-
"aria-checked":
|
|
12
|
-
tabIndex:
|
|
11
|
+
"aria-checked": m,
|
|
12
|
+
tabIndex: m ? 0 : -1,
|
|
13
13
|
disabled: c,
|
|
14
14
|
onClick: () => f(a),
|
|
15
15
|
className: [
|
|
16
16
|
t.item,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
m ? t.active : null,
|
|
18
|
+
g ? t.iconOnly : null,
|
|
19
19
|
l
|
|
20
20
|
].filter(Boolean).join(" "),
|
|
21
21
|
...u,
|
|
@@ -26,12 +26,13 @@ var a = ({ name: a, label: o, icon: s, disabled: c, className: l, ...u }) => {
|
|
|
26
26
|
size: "md",
|
|
27
27
|
"aria-hidden": !0
|
|
28
28
|
})
|
|
29
|
-
}),
|
|
29
|
+
}), h && /* @__PURE__ */ r("span", {
|
|
30
30
|
className: t.itemLabel,
|
|
31
31
|
children: o
|
|
32
32
|
})]
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
|
+
a.displayName = "InlineViewSwitcherItem";
|
|
35
36
|
//#endregion
|
|
36
37
|
export { a as InlineViewSwitcherItem };
|
|
37
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineViewSwitcherItem.js","names":[],"sources":["../../../src/components/InlineViewSwitcher/InlineViewSwitcherItem.tsx"],"sourcesContent":["import type { IconDefinition } from '@gnome-ui/icons';\nimport type { ButtonHTMLAttributes } from 'react';\n\nimport { Icon } from '../Icon';\n\nimport { useInlineViewSwitcher } from './InlineViewSwitcher';\nimport styles from './InlineViewSwitcher.module.css';\n\nexport interface InlineViewSwitcherItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** String identifier — used as the switcher's `value` when this item is active. */\n name: string;\n /** Visible label. */\n label?: string;\n /** Icon from `@gnome-ui/icons`. */\n icon?: IconDefinition;\n}\n\n/**\n * Individual view option inside an `InlineViewSwitcher`.\n *\n * Can be icon-only, label-only, or icon + label. For icon-only items always\n * provide an `aria-label` so screen readers can identify the view.\n */\nexport const InlineViewSwitcherItem = ({\n name,\n label,\n icon,\n disabled,\n className,\n ...props\n}: InlineViewSwitcherItemProps) => {\n const { value, onValueChange } = useInlineViewSwitcher();\n const active = value === name;\n const
|
|
1
|
+
{"version":3,"file":"InlineViewSwitcherItem.js","names":[],"sources":["../../../src/components/InlineViewSwitcher/InlineViewSwitcherItem.tsx"],"sourcesContent":["import type { IconDefinition } from '@gnome-ui/icons';\nimport type { ButtonHTMLAttributes } from 'react';\n\nimport { Icon } from '../Icon';\n\nimport { useInlineViewSwitcher } from './InlineViewSwitcher';\nimport styles from './InlineViewSwitcher.module.css';\n\nexport interface InlineViewSwitcherItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** String identifier — used as the switcher's `value` when this item is active. */\n name: string;\n /** Visible label. */\n label?: string;\n /** Icon from `@gnome-ui/icons`. */\n icon?: IconDefinition;\n}\n\n/**\n * Individual view option inside an `InlineViewSwitcher`.\n *\n * Can be icon-only, label-only, or icon + label. For icon-only items always\n * provide an `aria-label` so screen readers can identify the view.\n */\nexport const InlineViewSwitcherItem = ({\n name,\n label,\n icon,\n disabled,\n className,\n ...props\n}: InlineViewSwitcherItemProps) => {\n const { value, onValueChange, compact } = useInlineViewSwitcher();\n const active = value === name;\n // In compact mode, hide the label when an icon is present as a fallback\n const showLabel = !!label && !(compact && icon);\n const isIconOnly = !!icon && !showLabel;\n\n return (\n <button\n type=\"button\"\n role=\"radio\"\n aria-checked={active}\n tabIndex={active ? 0 : -1}\n disabled={disabled}\n onClick={() => onValueChange(name)}\n className={[\n styles.item,\n active ? styles.active : null,\n isIconOnly ? styles.iconOnly : null,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n {...props}\n >\n {icon && (\n <span className={styles.itemIcon}>\n <Icon icon={icon} size=\"md\" aria-hidden />\n </span>\n )}\n {showLabel && <span className={styles.itemLabel}>{label}</span>}\n </button>\n );\n};\n\nInlineViewSwitcherItem.displayName = 'InlineViewSwitcherItem';\n"],"mappings":";;;;;AAuBA,IAAa,KAA0B,EACrC,SACA,UACA,SACA,aACA,cACA,GAAG,QAC8B;CACjC,IAAM,EAAE,UAAO,kBAAe,eAAY,EAAsB,GAC1D,IAAS,MAAU,GAEnB,IAAY,CAAC,CAAC,KAAS,EAAE,KAAW,IACpC,IAAa,CAAC,CAAC,KAAQ,CAAC;CAE9B,OACE,kBAAC,UAAD;EACE,MAAK;EACL,MAAK;EACL,gBAAc;EACd,UAAU,IAAS,IAAI;EACb;EACV,eAAe,EAAc,CAAI;EACjC,WAAW;GACT,EAAO;GACP,IAAS,EAAO,SAAS;GACzB,IAAa,EAAO,WAAW;GAC/B;EACF,EACG,OAAO,OAAO,EACd,KAAK,GAAG;EACX,GAAI;YAfN,CAiBG,KACC,kBAAC,QAAD;GAAM,WAAW,EAAO;aACtB,kBAAC,GAAD;IAAY;IAAM,MAAK;IAAK,eAAA;GAAa,CAAA;EACrC,CAAA,GAEP,KAAa,kBAAC,QAAD;GAAM,WAAW,EAAO;aAAY;EAAY,CAAA,CACxD;;AAEZ;AAEA,EAAuB,cAAc"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { InlineViewSwitcherProps, InlineViewSwitcherVariant, } from './InlineViewSwitcher';
|
|
1
|
+
export type { InlineViewSwitcherOverflow, InlineViewSwitcherProps, InlineViewSwitcherVariant, } from './InlineViewSwitcher';
|
|
2
2
|
export { InlineViewSwitcher } from './InlineViewSwitcher';
|
|
3
3
|
export type { InlineViewSwitcherItemProps } from './InlineViewSwitcherItem';
|
|
4
4
|
export { InlineViewSwitcherItem } from './InlineViewSwitcherItem';
|