@webority/ui-react 0.56.0 → 0.57.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.
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`feed`,`progress`],o=[`vertical`,`horizontal`],s=[`neutral`,`success`,`warning`,`danger`,`info`],c={done:`check`,current:`clock`,"on-hold":`lock`,rejected:`x`,cancelled:`minus`,skipped:`arrow-right`,upcoming:null};function l({items:l=[],variant:u=`feed`,orientation:d=`vertical`,size:f,className:p=``,style:m,...h}){t(`AppTimeline`,h),e(`AppTimeline`,`variant`,u,a),e(`AppTimeline`,`orientation`,d,o);for(let t of l)e(`AppTimeline`,`items[].tone`,t.tone,s),u===`progress`&&e(`AppTimeline`,`items[].status`,t.status,Object.keys(c));let g=u===`progress`,_=`timeline${g?` timeline--progress`:``}${d===`horizontal`?` timeline--horizontal`:``}${p?` ${p}`:``}`,v=typeof f==`number`&&f>0?f:void 0,y=v?Math.round(v*.54):g?13:12;return r(`ol`,{className:_,style:v?{...m,"--wui-timeline-dot":`${v}px`}:m,...h,children:l.map((e,t)=>{let a=g?e.status:void 0,o=a?` is-${a}`:``,s=e.tone&&e.tone!==`neutral`?` ${e.tone}`:``,l=g?e.icon??(a?c[a]:void 0):e.icon||`circle`;return i(`li`,{className:`timeline-item${o}${s}`,children:[r(`span`,{className:`timeline-dot`,children:l?r(n,{name:l,size:y}):null}),i(`div`,{className:`timeline-body`,children:[g?i(`div`,{className:`timeline-head`,children:[r(`div`,{className:`timeline-title`,children:e.title}),(e.at||e.time)&&i(`span`,{className:`timeline-when`,children:[e.at&&r(`span`,{className:`timeline-at`,children:e.at}),e.time&&r(`span`,{className:`timeline-time`,children:e.time})]})]}):r(`div`,{className:`timeline-title`,children:e.title}),e.description&&r(`div`,{className:`timeline-desc`,children:e.description}),!g&&(e.at||e.time||e.by)&&i(`div`,{className:`timeline-meta`,children:[(e.at||e.time)&&i(`span`,{className:`timeline-when`,children:[e.at&&r(`span`,{className:`timeline-at`,children:e.at}),e.time&&r(`span`,{className:`timeline-time`,children:e.time})]}),e.by&&r(`span`,{className:`timeline-by`,children:e.by})]}),g&&e.by&&r(`div`,{className:`timeline-meta`,children:r(`span`,{className:`timeline-by`,children:e.by})}),e.note&&r(`p`,{className:`timeline-note`,children:e.note})]})]},e.key??`${e.at}-${t}`)})})}export{l as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`feed`,`progress`],o=[`vertical`,`horizontal`],s=[`neutral`,`success`,`warning`,`danger`,`info`],c={done:`check`,current:`clock`,"on-hold":`lock`,rejected:`x`,cancelled:`minus`,skipped:`arrow-right`,upcoming:null},l=e=>typeof e==`string`&&(/^https?:[/][/]/i.test(e)||e.startsWith(`/`)&&e[1]!==`/`&&e[1]!==`\\`)&&![...e].some(e=>e.charCodeAt(0)<=32||e.charCodeAt(0)===127);function u(e){if(!(e.byHref==null||e.byHref===``)){if(!l(e.byHref))throw Error(`<AppTimeline> items[].byHref must be a path starting with one '/', or an http:// or https:// address, with no spaces.`);if(!e.by)throw Error(`<AppTimeline> items[].byHref links the by name, so the item needs by.`)}}var d=e=>e.byHref?r(`a`,{className:`timeline-by-link`,href:e.byHref,children:e.by}):e.by;function f({items:l=[],variant:f=`feed`,orientation:p=`vertical`,size:m,className:h=``,style:g,..._}){t(`AppTimeline`,_),e(`AppTimeline`,`variant`,f,a),e(`AppTimeline`,`orientation`,p,o);for(let t of l)e(`AppTimeline`,`items[].tone`,t.tone,s),u(t),f===`progress`&&e(`AppTimeline`,`items[].status`,t.status,Object.keys(c));let v=f===`progress`,y=`timeline${v?` timeline--progress`:``}${p===`horizontal`?` timeline--horizontal`:``}${h?` ${h}`:``}`,b=typeof m==`number`&&m>0?m:void 0,x=b?Math.round(b*.54):v?13:12;return r(`ol`,{className:y,style:b?{...g,"--wui-timeline-dot":`${b}px`}:g,..._,children:l.map((e,t)=>{let a=v?e.status:void 0,o=a?` is-${a}`:``,s=e.tone&&e.tone!==`neutral`?` ${e.tone}`:``,l=v?e.icon??(a?c[a]:void 0):e.icon||`circle`;return i(`li`,{className:`timeline-item${o}${s}`,children:[r(`span`,{className:`timeline-dot`,children:l?r(n,{name:l,size:x}):null}),i(`div`,{className:`timeline-body`,children:[v?i(`div`,{className:`timeline-head`,children:[r(`div`,{className:`timeline-title`,children:e.title}),(e.at||e.time)&&i(`span`,{className:`timeline-when`,children:[e.at&&r(`span`,{className:`timeline-at`,children:e.at}),e.time&&r(`span`,{className:`timeline-time`,children:e.time})]})]}):r(`div`,{className:`timeline-title`,children:e.title}),e.description&&r(`div`,{className:`timeline-desc`,children:e.description}),!v&&(e.at||e.time||e.by)&&i(`div`,{className:`timeline-meta`,children:[(e.at||e.time)&&i(`span`,{className:`timeline-when`,children:[e.at&&r(`span`,{className:`timeline-at`,children:e.at}),e.time&&r(`span`,{className:`timeline-time`,children:e.time})]}),e.by&&r(`span`,{className:`timeline-by`,children:d(e)})]}),v&&e.by&&r(`div`,{className:`timeline-meta`,children:r(`span`,{className:`timeline-by`,children:d(e)})}),e.note&&r(`p`,{className:`timeline-note`,children:e.note})]})]},e.key??`${e.at}-${t}`)})})}export{f as default};
@@ -20,12 +20,14 @@
20
20
  * tone?: 'neutral'|'success'|'warning'|'danger'|'info',
21
21
  * status?: 'upcoming'|'current'|'done'|'on-hold'|'rejected'|'cancelled'|'skipped',
22
22
  * title: import('react').ReactNode, description?: import('react').ReactNode,
23
- * at?: string, time?: string, by?: string, note?: string }[]} props.items
23
+ * at?: string, time?: string, by?: string, byHref?: string, note?: string }[]} props.items
24
24
  * Feed variant: newest first. Progress variant: first stage first.
25
25
  * `status` drives the dot + rail in the progress variant; `description` is a
26
26
  * plain inline subtext under the title (distinct from the boxed `note`).
27
27
  * `at` is the date and `time` an optional time-of-day shown beside it — both are
28
28
  * pre-formatted strings the caller owns (IST, DD-MMM-YYYY / HH:mm); pass either or both.
29
+ * `byHref` links the `by` name (a path starting with one `/`, or an `http://` / `https://` address);
30
+ * any other value, or `byHref` without `by`, throws.
29
31
  * @param {'feed'|'progress'} [props.variant] Layout mode. Defaults to `feed`.
30
32
  * @param {'vertical'|'horizontal'} [props.orientation] Rail direction — vertical (default) stacks
31
33
  * items top-to-bottom; horizontal lays dots in a row with the body beneath each. Orthogonal to
@@ -47,6 +49,7 @@ export default function AppTimeline({ items, variant, orientation, size, classNa
47
49
  at?: string;
48
50
  time?: string;
49
51
  by?: string;
52
+ byHref?: string;
50
53
  note?: string;
51
54
  }[];
52
55
  variant?: 'feed' | 'progress';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-react",
3
- "version": "0.56.0",
3
+ "version": "0.57.0",
4
4
  "description": "Webority shared React component library — App* primitives on react-bootstrap + the @webority/theme design system.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "sideEffects": false,
29
29
  "dependencies": {
30
- "@webority/ui-elements": "0.56.0",
31
- "@webority/theme": "0.56.0"
30
+ "@webority/theme": "0.57.0",
31
+ "@webority/ui-elements": "0.57.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@webority/analytics": "^0.21.0",