@webority/ui-react 0.55.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{shortcutAria as n,shortcutChip as r}from"../lib/shortcutChip.js";import i from"./withTooltip.js";import a from"./AppIcon.js";import{Button as o}from"react-bootstrap";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l={primary:`primary`,secondary:`secondary`,outline:`outline-primary`,ghost:`ghost`,danger:`danger`,success:`success`,"secondary-danger":`secondary-danger`,"outline-danger":`outline-danger`,light:`light`,warning:`warning`,subtle:`subtle`,"outline-light":`outline-light`},u={sm:14,md:16,lg:20};function d(e,t,n){if(!e)return null;let r=t===`left`?`me-2`:`ms-2`;return typeof e==`string`?s(a,{name:e,size:u[n]??u.md,className:r}):s(`span`,{className:`d-inline-flex ${r}`,children:e})}function f({children:a,variant:f=`primary`,size:p=`md`,type:m=`button`,loading:h=!1,disabled:g=!1,block:_=!1,leftIcon:v=null,rightIcon:y=null,href:b,static:x=!1,tooltip:S,tooltipPlacement:C,shortcut:w,className:T=``,...E}){if(t(`AppButton`,E),e(`AppButton`,`variant`,f,Object.keys(l)),e(`AppButton`,`size`,p,Object.keys(u)),x)return i(c(`span`,{className:[`btn`,`btn-${l[f]??`primary`}`,p===`sm`?`btn-sm`:p===`lg`?`btn-lg`:``,_?`w-100`:``,`btn-static`,T].filter(Boolean).join(` `),...E,children:[d(v,`left`,p),a,d(y,`right`,p)]}),S,C);let D=[_?`w-100`:``,h?`is-loading`:``,T].filter(Boolean).join(` `),O=(E.as===void 0||E.as===`button`)&&b===void 0&&E.to===void 0,k=O?{}:{role:void 0,tabIndex:g||h?-1:void 0},A=S!=null&&S!==``;return i(c(o,{type:O?m:void 0,href:b,variant:l[f]??`primary`,size:p===`md`?void 0:p,disabled:g||h,"aria-busy":h||void 0,"aria-keyshortcuts":n(w),className:D||void 0,...k,...E,children:[h&&s(`span`,{className:`spinner-border spinner-border-sm me-2`,"aria-hidden":`true`}),!h&&d(v,`left`,p),a,!h&&d(y,`right`,p),!A&&r(w)]}),S,C,w)}export{f as default};
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import{shortcutAria as n,shortcutChip as r}from"../lib/shortcutChip.js";import i from"./withTooltip.js";import a from"./AppIcon.js";import{Button as o}from"react-bootstrap";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l={primary:`primary`,secondary:`secondary`,outline:`outline-primary`,ghost:`ghost`,danger:`danger`,success:`success`,"secondary-danger":`secondary-danger`,"outline-danger":`outline-danger`,light:`light`,warning:`warning`,subtle:`subtle`,"outline-light":`outline-light`,"outline-secondary":`outline-secondary`},u={sm:14,md:16,lg:20};function d(e,t,n){if(!e)return null;let r=t===`left`?`me-2`:`ms-2`;return typeof e==`string`?s(a,{name:e,size:u[n]??u.md,className:r}):s(`span`,{className:`d-inline-flex ${r}`,children:e})}function f({children:a,variant:f=`primary`,size:p=`md`,type:m=`button`,loading:h=!1,disabled:g=!1,block:_=!1,leftIcon:v=null,rightIcon:y=null,href:b,static:x=!1,tooltip:S,tooltipPlacement:C,shortcut:w,className:T=``,...E}){if(t(`AppButton`,E),e(`AppButton`,`variant`,f,Object.keys(l)),e(`AppButton`,`size`,p,Object.keys(u)),x)return i(c(`span`,{className:[`btn`,`btn-${l[f]??`primary`}`,p===`sm`?`btn-sm`:p===`lg`?`btn-lg`:``,_?`w-100`:``,`btn-static`,T].filter(Boolean).join(` `),...E,children:[d(v,`left`,p),a,d(y,`right`,p)]}),S,C);let D=[_?`w-100`:``,h?`is-loading`:``,T].filter(Boolean).join(` `),O=(E.as===void 0||E.as===`button`)&&b===void 0&&E.to===void 0,k=O?{}:{role:void 0,tabIndex:g||h?-1:void 0},A=S!=null&&S!==``;return i(c(o,{type:O?m:void 0,href:b,variant:l[f]??`primary`,size:p===`md`?void 0:p,disabled:g||h,"aria-busy":h||void 0,"aria-keyshortcuts":n(w),className:D||void 0,...k,...E,children:[h&&s(`span`,{className:`spinner-border spinner-border-sm me-2`,"aria-hidden":`true`}),!h&&d(v,`left`,p),a,!h&&d(y,`right`,p),!A&&r(w)]}),S,C,w)}export{f as default};
|
|
@@ -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:
|
|
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};
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @param {() => void} [props.onClick] Called when the main button is pressed.
|
|
14
14
|
* @param {string} [props.href] Make the main button a link.
|
|
15
15
|
* @param {'button'|'submit'|'reset'} [props.type='button'] The main button's type.
|
|
16
|
-
* @param {'primary'|'secondary'|'outline'|'ghost'|'danger'|'success'|'secondary-danger'|'outline-danger'|'light'|'warning'|'subtle'|'outline-light'} [props.variant='primary'] Both halves share it.
|
|
16
|
+
* @param {'primary'|'secondary'|'outline'|'ghost'|'danger'|'success'|'secondary-danger'|'outline-danger'|'light'|'warning'|'subtle'|'outline-light'|'outline-secondary'} [props.variant='primary'] Both halves share it.
|
|
17
17
|
* @param {'sm'|'md'|'lg'} [props.size='md']
|
|
18
18
|
* @param {boolean} [props.disabled=false] Disables both halves.
|
|
19
19
|
* @param {boolean} [props.loading=false] Shows the spinner on the main button and disables both halves.
|
|
@@ -40,7 +40,7 @@ export default function AppSplitButton({ label, items, onClick, href, type, vari
|
|
|
40
40
|
onClick?: () => void;
|
|
41
41
|
href?: string;
|
|
42
42
|
type?: 'button' | 'submit' | 'reset';
|
|
43
|
-
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'success' | 'secondary-danger' | 'outline-danger' | 'light' | 'warning' | 'subtle' | 'outline-light';
|
|
43
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'success' | 'secondary-danger' | 'outline-danger' | 'light' | 'warning' | 'subtle' | 'outline-light' | 'outline-secondary';
|
|
44
44
|
size?: 'sm' | 'md' | 'lg';
|
|
45
45
|
disabled?: boolean;
|
|
46
46
|
loading?: boolean;
|
|
@@ -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.
|
|
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/theme": "0.
|
|
31
|
-
"@webority/ui-elements": "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",
|