@clicoh/orion-library 1.2.0-beta.19 → 1.2.0-beta.20
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/expresivo/ExpChip/ExpChip.d.ts +30 -0
- package/expresivo/ExpChip/ExpChip.d.ts.map +1 -0
- package/expresivo/ExpChip/ExpChip.jsx +46 -0
- package/expresivo/ExpChip/ExpChip.jsx.map +1 -0
- package/expresivo/ExpChip/index.d.ts +3 -0
- package/expresivo/ExpChip/index.d.ts.map +1 -0
- package/expresivo/ExpChip/index.js +2 -0
- package/expresivo/ExpChip/index.js.map +1 -0
- package/expresivo/index.d.ts +1 -0
- package/expresivo/index.d.ts.map +1 -1
- package/expresivo/index.js +1 -0
- package/expresivo/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type ExpChipTone = 'success' | 'warning' | 'error' | 'info' | 'progress';
|
|
3
|
+
export type ExpChipProps = {
|
|
4
|
+
/** One character or a tiny icon before the label. Decorative. */
|
|
5
|
+
glyph?: ReactNode;
|
|
6
|
+
/** Color of the glyph. */
|
|
7
|
+
tone?: ExpChipTone;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
} & Omit<HTMLAttributes<HTMLSpanElement>, 'children'>;
|
|
10
|
+
/**
|
|
11
|
+
* White pill with a hairline border, for a short fact under the page title,
|
|
12
|
+
* such as a guarantee. The label carries the message; the glyph before it only
|
|
13
|
+
* decorates it.
|
|
14
|
+
*
|
|
15
|
+
* Outside an `ExpScope` it falls back to the core `Badge` `neutral`, with the
|
|
16
|
+
* glyph as its icon.
|
|
17
|
+
*
|
|
18
|
+
* @component
|
|
19
|
+
* @example
|
|
20
|
+
* <ExpChip glyph="✓">Sensitive data protected before the analysis</ExpChip>
|
|
21
|
+
*
|
|
22
|
+
* @param {ExpChipProps} props - The properties of the ExpChip component.
|
|
23
|
+
* @param {ReactNode} [props.glyph] - One character or a tiny icon before the label.
|
|
24
|
+
* @param {'success' | 'warning' | 'error' | 'info' | 'progress'} [props.tone='success'] - Color of the glyph.
|
|
25
|
+
* @param {ReactNode} props.children - Label of the chip.
|
|
26
|
+
*
|
|
27
|
+
* @returns {ReactNode} The chip, or a core `Badge` outside an `ExpScope`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function ExpChip({ glyph, tone, children, ...restProps }: ExpChipProps): ReactNode;
|
|
30
|
+
//# sourceMappingURL=ExpChip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpChip.d.ts","sourceRoot":"","sources":["../../src/expresivo/ExpChip/ExpChip.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;AAEhF,MAAM,MAAM,YAAY,GAAG;IACzB,iEAAiE;IACjE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC,CAAC;AAWtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,IAAgB,EAChB,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,YAAY,GAAG,SAAS,CA4B1B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Badge } from '@clicoh/orion-library';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useExpScope } from '../ExpScope/ExpScope';
|
|
5
|
+
// `warning` takes the dark amber: #FFC34C on white sits below 2:1.
|
|
6
|
+
const toneMap = {
|
|
7
|
+
success: 'text-success dark:text-success-dark',
|
|
8
|
+
warning: 'text-amber dark:text-warning-dark',
|
|
9
|
+
error: 'text-error dark:text-error-dark',
|
|
10
|
+
info: 'text-info dark:text-info-dark',
|
|
11
|
+
progress: 'text-lavender dark:text-lavender-dark',
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* White pill with a hairline border, for a short fact under the page title,
|
|
15
|
+
* such as a guarantee. The label carries the message; the glyph before it only
|
|
16
|
+
* decorates it.
|
|
17
|
+
*
|
|
18
|
+
* Outside an `ExpScope` it falls back to the core `Badge` `neutral`, with the
|
|
19
|
+
* glyph as its icon.
|
|
20
|
+
*
|
|
21
|
+
* @component
|
|
22
|
+
* @example
|
|
23
|
+
* <ExpChip glyph="✓">Sensitive data protected before the analysis</ExpChip>
|
|
24
|
+
*
|
|
25
|
+
* @param {ExpChipProps} props - The properties of the ExpChip component.
|
|
26
|
+
* @param {ReactNode} [props.glyph] - One character or a tiny icon before the label.
|
|
27
|
+
* @param {'success' | 'warning' | 'error' | 'info' | 'progress'} [props.tone='success'] - Color of the glyph.
|
|
28
|
+
* @param {ReactNode} props.children - Label of the chip.
|
|
29
|
+
*
|
|
30
|
+
* @returns {ReactNode} The chip, or a core `Badge` outside an `ExpScope`.
|
|
31
|
+
*/
|
|
32
|
+
export function ExpChip({ glyph, tone = 'success', children, ...restProps }) {
|
|
33
|
+
const inScope = useExpScope();
|
|
34
|
+
if (!inScope) {
|
|
35
|
+
return (<Badge {...restProps} modifier="neutral" icon={glyph}>
|
|
36
|
+
{children}
|
|
37
|
+
</Badge>);
|
|
38
|
+
}
|
|
39
|
+
return (<span {...restProps} className={clsx('border-gray-5 inline-flex items-center gap-1.5 rounded-full border bg-white px-3 py-1 text-xs leading-4 text-black', 'dark:border-gray-1 dark:bg-black-1 dark:text-white', restProps.className)}>
|
|
40
|
+
{!!glyph && (<span aria-hidden="true" className={clsx('font-bold', toneMap[tone])}>
|
|
41
|
+
{glyph}
|
|
42
|
+
</span>)}
|
|
43
|
+
{children}
|
|
44
|
+
</span>);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=ExpChip.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpChip.jsx","sourceRoot":"","sources":["../../src/expresivo/ExpChip/ExpChip.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAYnD,mEAAmE;AACnE,MAAM,OAAO,GAAgC;IAC3C,OAAO,EAAE,qCAAqC;IAC9C,OAAO,EAAE,mCAAmC;IAC5C,KAAK,EAAE,iCAAiC;IACxC,IAAI,EAAE,+BAA+B;IACrC,QAAQ,EAAE,uCAAuC;CAClD,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,KAAK,EACL,IAAI,GAAG,SAAS,EAChB,QAAQ,EACR,GAAG,SAAS,EACC;IACb,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAE9B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CACnD;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,KAAK,CAAC,CACT,CAAC;IACJ,CAAC;IAED,OAAO,CACL,CAAC,IAAI,CACH,IAAI,SAAS,CAAC,CACd,SAAS,CAAC,CAAC,IAAI,CACb,oHAAoH,EACpH,oDAAoD,EACpD,SAAS,CAAC,SAAS,CACpB,CAAC,CAEF;MAAA,CAAC,CAAC,CAAC,KAAK,IAAI,CACV,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CACnE;UAAA,CAAC,KAAK,CACR;QAAA,EAAE,IAAI,CAAC,CACR,CACD;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expresivo/ExpChip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/expresivo/ExpChip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
package/expresivo/index.d.ts
CHANGED
package/expresivo/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/expresivo/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/expresivo/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}
|
package/expresivo/index.js
CHANGED
package/expresivo/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/expresivo/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/expresivo/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}
|