@pallasoft/ps-core-components 2.37.0 → 2.38.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.
@@ -4,11 +4,11 @@ exports.PsCappedList = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const ps_capped_list_config_1 = require("../constants/ps-capped-list-config");
7
- const ps_button_1 = require("./ps-button");
7
+ const ps_text_link_1 = require("./ps-text-link");
8
8
  const PsCappedList = ({ getKey, items, renderItem, showAllLabel, visibleRows = ps_capped_list_config_1.PsCappedListConfig.defaultVisibleRows, }) => {
9
9
  const [isExpanded, setIsExpanded] = (0, react_1.useState)(false);
10
10
  const isCapped = !isExpanded && items.length > visibleRows;
11
11
  const shown = isCapped ? items.slice(0, visibleRows) : items;
12
- return ((0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-col gap-2', children: [(0, jsx_runtime_1.jsx)("ul", { className: '-my-2 flex flex-col divide-y divide-line', children: shown.map((item) => ((0, jsx_runtime_1.jsx)("li", { children: renderItem(item) }, getKey(item)))) }), isCapped ? ((0, jsx_runtime_1.jsx)(ps_button_1.PsButton, { className: 'self-start', onClick: () => setIsExpanded(true), size: 'compact', variant: 'surface', children: showAllLabel })) : null] }));
12
+ return ((0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-col gap-2', children: [(0, jsx_runtime_1.jsx)("ul", { className: '-my-2 flex flex-col divide-y divide-line', children: shown.map((item) => ((0, jsx_runtime_1.jsx)("li", { children: renderItem(item) }, getKey(item)))) }), isCapped ? ((0, jsx_runtime_1.jsx)(ps_text_link_1.PsTextLink, { className: 'self-start', onClick: () => setIsExpanded(true), size: 'compact', children: showAllLabel })) : null] }));
13
13
  };
14
14
  exports.PsCappedList = PsCappedList;
@@ -0,0 +1,12 @@
1
+ import type { ElementType, ReactNode } from 'react';
2
+ export interface PsTextLinkProps {
3
+ 'aria-label'?: string;
4
+ 'children': ReactNode;
5
+ 'className'?: string;
6
+ 'href'?: string;
7
+ 'id'?: string;
8
+ 'LinkComponent'?: ElementType;
9
+ 'onClick'?: () => void;
10
+ 'size'?: 'compact' | 'default';
11
+ }
12
+ export declare const PsTextLink: ({ children, className, href, LinkComponent, onClick, size, ...props }: PsTextLinkProps) => import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsTextLink = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const ps_design_system_1 = require("@pallasoft/ps-design-system");
6
+ const ps_text_link_classes_1 = require("../constants/ps-text-link-classes");
7
+ const PsTextLink = ({ children, className, href, LinkComponent, onClick, size = 'default', ...props }) => {
8
+ const linkClassName = ps_design_system_1.PallasoftClassNameService.merge(ps_text_link_classes_1.PsTextLinkClassName, ps_text_link_classes_1.PsTextLinkSizeClassNames[size], className);
9
+ if (href === undefined)
10
+ return ((0, jsx_runtime_1.jsx)("button", { className: linkClassName, onClick: onClick, type: 'button', ...props, children: children }));
11
+ return LinkComponent ? ((0, jsx_runtime_1.jsx)(LinkComponent, { className: linkClassName, onClick: onClick, prefetch: 'intent', to: href, ...props, children: children })) : ((0, jsx_runtime_1.jsx)("a", { className: linkClassName, href: href, onClick: onClick, ...props, children: children }));
12
+ };
13
+ exports.PsTextLink = PsTextLink;
@@ -0,0 +1,5 @@
1
+ export declare const PsTextLinkClassName = "ps-focus-ring inline-flex max-w-full items-center gap-1 rounded-sm font-semibold text-primary underline-offset-4 transition-colors hover:underline";
2
+ export declare const PsTextLinkSizeClassNames: {
3
+ compact: string;
4
+ default: string;
5
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsTextLinkSizeClassNames = exports.PsTextLinkClassName = void 0;
4
+ exports.PsTextLinkClassName = 'ps-focus-ring inline-flex max-w-full items-center gap-1 rounded-sm font-semibold text-primary underline-offset-4 transition-colors hover:underline';
5
+ exports.PsTextLinkSizeClassNames = {
6
+ compact: 'text-xs',
7
+ default: 'text-sm',
8
+ };
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { PsCappedListConfig } from '../constants/ps-capped-list-config.js';
4
- import { PsButton } from './ps-button.js';
4
+ import { PsTextLink } from './ps-text-link.js';
5
5
  export const PsCappedList = ({ getKey, items, renderItem, showAllLabel, visibleRows = PsCappedListConfig.defaultVisibleRows, }) => {
6
6
  const [isExpanded, setIsExpanded] = useState(false);
7
7
  const isCapped = !isExpanded && items.length > visibleRows;
8
8
  const shown = isCapped ? items.slice(0, visibleRows) : items;
9
- return (_jsxs("div", { className: 'flex flex-col gap-2', children: [_jsx("ul", { className: '-my-2 flex flex-col divide-y divide-line', children: shown.map((item) => (_jsx("li", { children: renderItem(item) }, getKey(item)))) }), isCapped ? (_jsx(PsButton, { className: 'self-start', onClick: () => setIsExpanded(true), size: 'compact', variant: 'surface', children: showAllLabel })) : null] }));
9
+ return (_jsxs("div", { className: 'flex flex-col gap-2', children: [_jsx("ul", { className: '-my-2 flex flex-col divide-y divide-line', children: shown.map((item) => (_jsx("li", { children: renderItem(item) }, getKey(item)))) }), isCapped ? (_jsx(PsTextLink, { className: 'self-start', onClick: () => setIsExpanded(true), size: 'compact', children: showAllLabel })) : null] }));
10
10
  };
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
3
+ import { PsTextLinkClassName, PsTextLinkSizeClassNames } from '../constants/ps-text-link-classes.js';
4
+ export const PsTextLink = ({ children, className, href, LinkComponent, onClick, size = 'default', ...props }) => {
5
+ const linkClassName = PallasoftClassNameService.merge(PsTextLinkClassName, PsTextLinkSizeClassNames[size], className);
6
+ if (href === undefined)
7
+ return (_jsx("button", { className: linkClassName, onClick: onClick, type: 'button', ...props, children: children }));
8
+ return LinkComponent ? (_jsx(LinkComponent, { className: linkClassName, onClick: onClick, prefetch: 'intent', to: href, ...props, children: children })) : (_jsx("a", { className: linkClassName, href: href, onClick: onClick, ...props, children: children }));
9
+ };
@@ -0,0 +1,5 @@
1
+ export const PsTextLinkClassName = 'ps-focus-ring inline-flex max-w-full items-center gap-1 rounded-sm font-semibold text-primary underline-offset-4 transition-colors hover:underline';
2
+ export const PsTextLinkSizeClassNames = {
3
+ compact: 'text-xs',
4
+ default: 'text-sm',
5
+ };
package/dist/esm/index.js CHANGED
@@ -7,6 +7,7 @@ export * from './constants/ps-audio-spectrum-config.js';
7
7
  export * from './components/ps-badge.js';
8
8
  export * from './components/ps-button.js';
9
9
  export * from './components/ps-link-button.js';
10
+ export * from './components/ps-text-link.js';
10
11
  export * from './components/ps-pallasoft-mark.js';
11
12
  export * from './components/ps-pallasoft-sign-in-button.js';
12
13
  export * from './components/ps-store-badge.js';
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from './constants/ps-audio-spectrum-config';
7
7
  export * from './components/ps-badge';
8
8
  export * from './components/ps-button';
9
9
  export * from './components/ps-link-button';
10
+ export * from './components/ps-text-link';
10
11
  export * from './components/ps-pallasoft-mark';
11
12
  export * from './components/ps-pallasoft-sign-in-button';
12
13
  export * from './components/ps-store-badge';
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ __exportStar(require("./constants/ps-audio-spectrum-config"), exports);
23
23
  __exportStar(require("./components/ps-badge"), exports);
24
24
  __exportStar(require("./components/ps-button"), exports);
25
25
  __exportStar(require("./components/ps-link-button"), exports);
26
+ __exportStar(require("./components/ps-text-link"), exports);
26
27
  __exportStar(require("./components/ps-pallasoft-mark"), exports);
27
28
  __exportStar(require("./components/ps-pallasoft-sign-in-button"), exports);
28
29
  __exportStar(require("./components/ps-store-badge"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pallasoft/ps-core-components",
3
- "version": "2.37.0",
3
+ "version": "2.38.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/esm/index.js",