wimui 0.27.0 → 0.28.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/data-display/Barcode/Barcode.cjs +2 -0
- package/dist/components/data-display/Barcode/Barcode.d.ts +86 -0
- package/dist/components/data-display/Barcode/Barcode.js +79 -0
- package/dist/components/data-display/Barcode/barcode.module.cjs +2 -0
- package/dist/components/data-display/Barcode/barcode.module.js +12 -0
- package/dist/components/data-display/Barcode/encode.cjs +2 -0
- package/dist/components/data-display/Barcode/encode.d.ts +28 -0
- package/dist/components/data-display/Barcode/encode.js +95 -0
- package/dist/components/data-display/Barcode/warn-unencodable-value.cjs +2 -0
- package/dist/components/data-display/Barcode/warn-unencodable-value.d.ts +3 -0
- package/dist/components/data-display/Barcode/warn-unencodable-value.js +4 -0
- package/dist/data-display-core.d.ts +1 -0
- package/dist/data-display.cjs +1 -1
- package/dist/data-display.js +2 -1
- package/dist/i18n/generated/keys.d.ts +1 -1
- package/dist/i18n/generated/resources.cjs +1 -1
- package/dist/i18n/generated/resources.js +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +39 -38
- package/dist/llms-full.txt +15 -1
- package/dist/llms.txt +2 -1
- package/dist/locales/en/common.json +6 -0
- package/dist/locales/en/components.json +2 -1
- package/dist/locales/ja/common.json +6 -0
- package/dist/locales/ja/components.json +2 -1
- package/dist/locales/pt/common.json +6 -0
- package/dist/locales/pt/components.json +2 -1
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../hooks/useMergedRef.cjs"),r=require("./encode.cjs"),i=require("./warn-unencodable-value.cjs"),a=require("./barcode.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l={code128:`Code 128`,ean13:`EAN-13`},u=11,d=o.default.forwardRef(({value:e,format:d=`code128`,height:f=64,moduleWidth:p=2,showValue:m=!0,label:h,className:g,..._},v)=>{let{t:y}=t.useWimTranslation(`common`),b=r.encodeBarcode(e,d),x=o.default.useRef(null),[S,C]=o.default.useState(!1);o.default.useLayoutEffect(()=>{let e=x.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>C(e.scrollWidth>e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[b?.modules,p]);let w=n.useMergedRef(v,x);if(!b){i.warnUnencodableValue(e,d,l[d]);let t=y(`barcode.invalid`,{format:l[d]});return(0,c.jsxs)(`div`,{ref:w,"data-invalid":`true`,className:(0,s.default)(`wim-barcode`,a.default.root,a.default.invalid,g),..._,children:[(0,c.jsx)(`span`,{className:a.default.invalidMessage,children:t}),(0,c.jsx)(`span`,{className:a.default.invalidValue,children:e})]})}let T=b.modules.length+u*2,E=T*p,D=u,O=r.toRuns(b.modules).map(([e,t])=>{let n=D;return D+=t,e?{x:n,width:t}:null});return(0,c.jsxs)(`div`,{ref:w,role:`img`,tabIndex:S?0:void 0,"aria-label":h??y(`barcode.aria_label`,{value:b.text}),"data-format":d,className:(0,s.default)(`wim-barcode`,a.default.root,g),..._,children:[(0,c.jsx)(`svg`,{className:a.default.symbol,width:E,height:f,viewBox:`0 0 ${T} ${f}`,preserveAspectRatio:`none`,shapeRendering:`crispEdges`,"aria-hidden":`true`,children:O.map(e=>e?(0,c.jsx)(`rect`,{x:e.x,y:0,width:e.width,height:f},e.x):null)}),m?(0,c.jsx)(`span`,{className:a.default.value,children:b.text}):null]})});d.displayName=`Barcode`,exports.Barcode=d;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BarcodeFormat } from './encode';
|
|
3
|
+
export type { BarcodeFormat };
|
|
4
|
+
export type BarcodeProps = Omit<React.ComponentPropsWithoutRef<"div">, "children"> & {
|
|
5
|
+
/**
|
|
6
|
+
* Value to encode. For `ean13`, 12 digits (the check digit is calculated) or
|
|
7
|
+
* 13 digits (the check digit is verified).
|
|
8
|
+
*/
|
|
9
|
+
value: string;
|
|
10
|
+
/**
|
|
11
|
+
* Symbology to encode `value` in.
|
|
12
|
+
* @default "code128"
|
|
13
|
+
*/
|
|
14
|
+
format?: BarcodeFormat;
|
|
15
|
+
/**
|
|
16
|
+
* Height of the bars, in px.
|
|
17
|
+
* @default 64
|
|
18
|
+
*/
|
|
19
|
+
height?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Width of the narrowest bar, in px. Below 2 most phone cameras stop reading
|
|
22
|
+
* the symbol on screen.
|
|
23
|
+
* @default 2
|
|
24
|
+
*/
|
|
25
|
+
moduleWidth?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the value is printed under the bars.
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
showValue?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Accessible name. Defaults to the value, so that a screen reader can read out
|
|
33
|
+
* what a scanner would read.
|
|
34
|
+
*/
|
|
35
|
+
label?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Draws a scannable 1D barcode — Code 128 for logistics, tickets and internal
|
|
39
|
+
* SKUs, EAN-13 for retail product codes.
|
|
40
|
+
*
|
|
41
|
+
* Two things are deliberate. **The symbol keeps dark bars on a light background
|
|
42
|
+
* in both themes**: laser and CCD scanners are built for that polarity and read
|
|
43
|
+
* an inverted symbol unreliably, so following the theme here would produce a
|
|
44
|
+
* barcode that looks right and does not scan. And **a value that cannot be
|
|
45
|
+
* encoded is never drawn** — an approximate barcode scans to the wrong thing,
|
|
46
|
+
* which is worse than one that is visibly missing. For the same reason the
|
|
47
|
+
* symbol is never scaled down to fit a narrow container: it scrolls instead,
|
|
48
|
+
* because a squeezed symbol looks identical and stops being read.
|
|
49
|
+
*
|
|
50
|
+
* Composition Contract:
|
|
51
|
+
* - Managed by: App consumption
|
|
52
|
+
* - Scroll lock: No
|
|
53
|
+
*/
|
|
54
|
+
export declare const Barcode: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children"> & {
|
|
55
|
+
/**
|
|
56
|
+
* Value to encode. For `ean13`, 12 digits (the check digit is calculated) or
|
|
57
|
+
* 13 digits (the check digit is verified).
|
|
58
|
+
*/
|
|
59
|
+
value: string;
|
|
60
|
+
/**
|
|
61
|
+
* Symbology to encode `value` in.
|
|
62
|
+
* @default "code128"
|
|
63
|
+
*/
|
|
64
|
+
format?: BarcodeFormat;
|
|
65
|
+
/**
|
|
66
|
+
* Height of the bars, in px.
|
|
67
|
+
* @default 64
|
|
68
|
+
*/
|
|
69
|
+
height?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Width of the narrowest bar, in px. Below 2 most phone cameras stop reading
|
|
72
|
+
* the symbol on screen.
|
|
73
|
+
* @default 2
|
|
74
|
+
*/
|
|
75
|
+
moduleWidth?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Whether the value is printed under the bars.
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
showValue?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Accessible name. Defaults to the value, so that a screen reader can read out
|
|
83
|
+
* what a scanner would read.
|
|
84
|
+
*/
|
|
85
|
+
label?: string;
|
|
86
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
|
+
import { useMergedRef as t } from "../../../hooks/useMergedRef.js";
|
|
4
|
+
import { encodeBarcode as n, toRuns as r } from "./encode.js";
|
|
5
|
+
import { warnUnencodableValue as i } from "./warn-unencodable-value.js";
|
|
6
|
+
import a from "./barcode.module.js";
|
|
7
|
+
import o from "react";
|
|
8
|
+
import s from "classnames";
|
|
9
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/data-display/Barcode/Barcode.tsx
|
|
11
|
+
var u = {
|
|
12
|
+
code128: "Code 128",
|
|
13
|
+
ean13: "EAN-13"
|
|
14
|
+
}, d = 11, f = o.forwardRef(({ value: f, format: p = "code128", height: m = 64, moduleWidth: h = 2, showValue: g = !0, label: _, className: v, ...y }, b) => {
|
|
15
|
+
let { t: x } = e("common"), S = n(f, p), C = o.useRef(null), [w, T] = o.useState(!1);
|
|
16
|
+
o.useLayoutEffect(() => {
|
|
17
|
+
let e = C.current;
|
|
18
|
+
if (!e || typeof ResizeObserver > "u") return;
|
|
19
|
+
let t = () => T(e.scrollWidth > e.clientWidth);
|
|
20
|
+
t();
|
|
21
|
+
let n = new ResizeObserver(t);
|
|
22
|
+
return n.observe(e), () => n.disconnect();
|
|
23
|
+
}, [S?.modules, h]);
|
|
24
|
+
let E = t(b, C);
|
|
25
|
+
if (!S) {
|
|
26
|
+
i(f, p, u[p]);
|
|
27
|
+
let e = x("barcode.invalid", { format: u[p] });
|
|
28
|
+
return /* @__PURE__ */ l("div", {
|
|
29
|
+
ref: E,
|
|
30
|
+
"data-invalid": "true",
|
|
31
|
+
className: s("wim-barcode", a.root, a.invalid, v),
|
|
32
|
+
...y,
|
|
33
|
+
children: [/* @__PURE__ */ c("span", {
|
|
34
|
+
className: a.invalidMessage,
|
|
35
|
+
children: e
|
|
36
|
+
}), /* @__PURE__ */ c("span", {
|
|
37
|
+
className: a.invalidValue,
|
|
38
|
+
children: f
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
let D = S.modules.length + d * 2, O = D * h, k = d, A = r(S.modules).map(([e, t]) => {
|
|
43
|
+
let n = k;
|
|
44
|
+
return k += t, e ? {
|
|
45
|
+
x: n,
|
|
46
|
+
width: t
|
|
47
|
+
} : null;
|
|
48
|
+
});
|
|
49
|
+
return /* @__PURE__ */ l("div", {
|
|
50
|
+
ref: E,
|
|
51
|
+
role: "img",
|
|
52
|
+
tabIndex: w ? 0 : void 0,
|
|
53
|
+
"aria-label": _ ?? x("barcode.aria_label", { value: S.text }),
|
|
54
|
+
"data-format": p,
|
|
55
|
+
className: s("wim-barcode", a.root, v),
|
|
56
|
+
...y,
|
|
57
|
+
children: [/* @__PURE__ */ c("svg", {
|
|
58
|
+
className: a.symbol,
|
|
59
|
+
width: O,
|
|
60
|
+
height: m,
|
|
61
|
+
viewBox: `0 0 ${D} ${m}`,
|
|
62
|
+
preserveAspectRatio: "none",
|
|
63
|
+
shapeRendering: "crispEdges",
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
children: A.map((e) => e ? /* @__PURE__ */ c("rect", {
|
|
66
|
+
x: e.x,
|
|
67
|
+
y: 0,
|
|
68
|
+
width: e.width,
|
|
69
|
+
height: m
|
|
70
|
+
}, e.x) : null)
|
|
71
|
+
}), g ? /* @__PURE__ */ c("span", {
|
|
72
|
+
className: a.value,
|
|
73
|
+
children: S.text
|
|
74
|
+
}) : null]
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
f.displayName = "Barcode";
|
|
78
|
+
//#endregion
|
|
79
|
+
export { f as Barcode };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var e=`_root_1goq6_34`,t=`_symbol_1goq6_64`,n=`_value_1goq6_78`,r=`_invalid_1goq6_94`,i=`_invalidMessage_1goq6_100`,a=`_invalidValue_1goq6_106`,o={root:e,symbol:t,value:n,invalid:r,invalidMessage:i,invalidValue:a};exports.default=o,exports.invalid=r,exports.invalidMessage=i,exports.invalidValue=a,exports.root=e,exports.symbol=t,exports.value=n;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/data-display/Barcode/barcode.module.scss
|
|
3
|
+
var e = "_root_1goq6_34", t = "_symbol_1goq6_64", n = "_value_1goq6_78", r = "_invalid_1goq6_94", i = "_invalidMessage_1goq6_100", a = "_invalidValue_1goq6_106", o = {
|
|
4
|
+
root: e,
|
|
5
|
+
symbol: t,
|
|
6
|
+
value: n,
|
|
7
|
+
invalid: r,
|
|
8
|
+
invalidMessage: i,
|
|
9
|
+
invalidValue: a
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { o as default, r as invalid, i as invalidMessage, a as invalidValue, e as root, t as symbol, n as value };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var e=`212222.222122.222221.121223.121322.131222.122213.122312.132212.221213.221312.231212.112232.122132.122231.113222.123122.123221.223211.221132.221231.213212.223112.312131.311222.321122.321221.312212.322112.322211.212123.212321.232121.111323.131123.131321.112313.132113.132311.211313.231113.231311.112133.112331.132131.113123.113321.133121.313121.211331.231131.213113.213311.213131.311123.311321.331121.312113.312311.332111.314111.221411.431111.111224.111422.121124.121421.141122.141221.112214.112412.122114.122411.142112.142211.241211.221114.413111.241112.134111.111242.121142.121241.114212.124112.124211.411212.421112.421211.212141.214121.412121.111143.111341.131141.114113.114311.411113.411311.113141.114131.311141.411131.211412.211214.211232`.split(`.`),t=`2331112`,n=104,r=105,i=103,a=e=>{let t=``;for(let n=0;n<e.length;n+=1)t+=(n%2==0?`1`:`0`).repeat(Number(e[n]));return t},o=o=>{if(o.length===0)return null;let s=[];if(/^\d+$/.test(o)&&o.length%2==0){s.push(r);for(let e=0;e<o.length;e+=2)s.push(Number(o.slice(e,e+2)))}else{if(!/^[\x20-\x7e]+$/.test(o))return null;s.push(n);for(let e of o)s.push(e.charCodeAt(0)-32)}let c=s.reduce((e,t,n)=>e+t*(n===0?1:n),0)%i;return s.push(c),{modules:s.map(t=>a(e[t])).join(``)+a(t),text:o}},s=[`0001101`,`0011001`,`0010011`,`0111101`,`0100011`,`0110001`,`0101111`,`0111011`,`0110111`,`0001011`],c=[`0100111`,`0110011`,`0011011`,`0100001`,`0011101`,`0111001`,`0000101`,`0010001`,`0001001`,`0010111`],l=[`1110010`,`1100110`,`1101100`,`1000010`,`1011100`,`1001110`,`1010000`,`1000100`,`1001000`,`1110100`],u=[`LLLLLL`,`LLGLGG`,`LLGGLG`,`LLGGGL`,`LGLLGG`,`LGGLLG`,`LGGGLL`,`LGLGLG`,`LGLGGL`,`LGGLGL`],d=`101`,f=`01010`,p=e=>{let t=0;for(let n=0;n<12;n+=1)t+=Number(e[n])*(n%2==0?1:3);return(10-t%10)%10},m=e=>{if(!/^\d{12,13}$/.test(e))return null;let t=e.slice(0,12),n=p(t);if(e.length===13&&Number(e[12])!==n)return null;let r=`${t}${n}`,i=u[Number(r[0])],a=``;for(let e=0;e<6;e+=1){let t=Number(r[e+1]);a+=i[e]===`L`?s[t]:c[t]}let o=``;for(let e=7;e<13;e+=1)o+=l[Number(r[e])];return{modules:`${d}${a}${f}${o}${d}`,text:r}},h=(e,t)=>t===`ean13`?m(e):o(e),g=e=>{let t=[];for(let n of e){let e=n===`1`,r=t[t.length-1];r&&r[0]===e?r[1]+=1:t.push([e,1])}return t};exports.ean13CheckDigit=p,exports.encodeBarcode=h,exports.toRuns=g;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1 次元シンボル体系のエンコーダ。**描画から切り離してある**のは、バーの並びが
|
|
3
|
+
* 規格で決まっていて単体で検証できるものだからで、`Barcode.tsx` 側は
|
|
4
|
+
* 「1 と 0 の列をどう塗るか」だけを持つ。
|
|
5
|
+
*
|
|
6
|
+
* 対応は Code 128 と EAN-13 の 2 つ。前者は物流・チケット・社内 SKU、後者は
|
|
7
|
+
* 小売の商品コードで、この 2 つで「バーコードを出したい」の大半が埋まる。
|
|
8
|
+
* 体系を増やすのは後方互換なので、要求が出てから足せばよい。
|
|
9
|
+
*/
|
|
10
|
+
export type BarcodeFormat = "code128" | "ean13";
|
|
11
|
+
export type EncodedBarcode = {
|
|
12
|
+
/** 1 = bar, 0 = space. One character per module. */
|
|
13
|
+
modules: string;
|
|
14
|
+
/** Human-readable interpretation printed under the bars. */
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
/** Test seam: the raw pattern table, so its invariants can be measured. */
|
|
18
|
+
export declare const code128Patterns: () => readonly string[];
|
|
19
|
+
/** 右から重み 1,3,1,3… を掛けて 10 の補数を取る(GS1 のモジュラス 10)。 */
|
|
20
|
+
export declare const ean13CheckDigit: (first12: string) => number;
|
|
21
|
+
/**
|
|
22
|
+
* Encodes `value` into a module string, or returns `null` when the value cannot
|
|
23
|
+
* be represented in `format` — an unencodable value must not be drawn, because a
|
|
24
|
+
* barcode that scans to the wrong thing is worse than one that is missing.
|
|
25
|
+
*/
|
|
26
|
+
export declare const encodeBarcode: (value: string, format: BarcodeFormat) => EncodedBarcode | null;
|
|
27
|
+
/** Consecutive runs of the same module, as `[isBar, width]` pairs. */
|
|
28
|
+
export declare const toRuns: (modules: string) => Array<[boolean, number]>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/data-display/Barcode/encode.ts
|
|
3
|
+
var e = /* @__PURE__ */ "212222.222122.222221.121223.121322.131222.122213.122312.132212.221213.221312.231212.112232.122132.122231.113222.123122.123221.223211.221132.221231.213212.223112.312131.311222.321122.321221.312212.322112.322211.212123.212321.232121.111323.131123.131321.112313.132113.132311.211313.231113.231311.112133.112331.132131.113123.113321.133121.313121.211331.231131.213113.213311.213131.311123.311321.331121.312113.312311.332111.314111.221411.431111.111224.111422.121124.121421.141122.141221.112214.112412.122114.122411.142112.142211.241211.221114.413111.241112.134111.111242.121142.121241.114212.124112.124211.411212.421112.421211.212141.214121.412121.111143.111341.131141.114113.114311.411113.411311.113141.114131.311141.411131.211412.211214.211232".split("."), t = "2331112", n = 104, r = 105, i = 103, a = (e) => {
|
|
4
|
+
let t = "";
|
|
5
|
+
for (let n = 0; n < e.length; n += 1) t += (n % 2 == 0 ? "1" : "0").repeat(Number(e[n]));
|
|
6
|
+
return t;
|
|
7
|
+
}, o = (o) => {
|
|
8
|
+
if (o.length === 0) return null;
|
|
9
|
+
let s = [];
|
|
10
|
+
if (/^\d+$/.test(o) && o.length % 2 == 0) {
|
|
11
|
+
s.push(r);
|
|
12
|
+
for (let e = 0; e < o.length; e += 2) s.push(Number(o.slice(e, e + 2)));
|
|
13
|
+
} else {
|
|
14
|
+
if (!/^[\x20-\x7e]+$/.test(o)) return null;
|
|
15
|
+
s.push(n);
|
|
16
|
+
for (let e of o) s.push(e.charCodeAt(0) - 32);
|
|
17
|
+
}
|
|
18
|
+
let c = s.reduce((e, t, n) => e + t * (n === 0 ? 1 : n), 0) % i;
|
|
19
|
+
return s.push(c), {
|
|
20
|
+
modules: s.map((t) => a(e[t])).join("") + a(t),
|
|
21
|
+
text: o
|
|
22
|
+
};
|
|
23
|
+
}, s = [
|
|
24
|
+
"0001101",
|
|
25
|
+
"0011001",
|
|
26
|
+
"0010011",
|
|
27
|
+
"0111101",
|
|
28
|
+
"0100011",
|
|
29
|
+
"0110001",
|
|
30
|
+
"0101111",
|
|
31
|
+
"0111011",
|
|
32
|
+
"0110111",
|
|
33
|
+
"0001011"
|
|
34
|
+
], c = [
|
|
35
|
+
"0100111",
|
|
36
|
+
"0110011",
|
|
37
|
+
"0011011",
|
|
38
|
+
"0100001",
|
|
39
|
+
"0011101",
|
|
40
|
+
"0111001",
|
|
41
|
+
"0000101",
|
|
42
|
+
"0010001",
|
|
43
|
+
"0001001",
|
|
44
|
+
"0010111"
|
|
45
|
+
], l = [
|
|
46
|
+
"1110010",
|
|
47
|
+
"1100110",
|
|
48
|
+
"1101100",
|
|
49
|
+
"1000010",
|
|
50
|
+
"1011100",
|
|
51
|
+
"1001110",
|
|
52
|
+
"1010000",
|
|
53
|
+
"1000100",
|
|
54
|
+
"1001000",
|
|
55
|
+
"1110100"
|
|
56
|
+
], u = [
|
|
57
|
+
"LLLLLL",
|
|
58
|
+
"LLGLGG",
|
|
59
|
+
"LLGGLG",
|
|
60
|
+
"LLGGGL",
|
|
61
|
+
"LGLLGG",
|
|
62
|
+
"LGGLLG",
|
|
63
|
+
"LGGGLL",
|
|
64
|
+
"LGLGLG",
|
|
65
|
+
"LGLGGL",
|
|
66
|
+
"LGGLGL"
|
|
67
|
+
], d = "101", f = "01010", p = (e) => {
|
|
68
|
+
let t = 0;
|
|
69
|
+
for (let n = 0; n < 12; n += 1) t += Number(e[n]) * (n % 2 == 0 ? 1 : 3);
|
|
70
|
+
return (10 - t % 10) % 10;
|
|
71
|
+
}, m = (e) => {
|
|
72
|
+
if (!/^\d{12,13}$/.test(e)) return null;
|
|
73
|
+
let t = e.slice(0, 12), n = p(t);
|
|
74
|
+
if (e.length === 13 && Number(e[12]) !== n) return null;
|
|
75
|
+
let r = `${t}${n}`, i = u[Number(r[0])], a = "";
|
|
76
|
+
for (let e = 0; e < 6; e += 1) {
|
|
77
|
+
let t = Number(r[e + 1]);
|
|
78
|
+
a += i[e] === "L" ? s[t] : c[t];
|
|
79
|
+
}
|
|
80
|
+
let o = "";
|
|
81
|
+
for (let e = 7; e < 13; e += 1) o += l[Number(r[e])];
|
|
82
|
+
return {
|
|
83
|
+
modules: `${d}${a}${f}${o}${d}`,
|
|
84
|
+
text: r
|
|
85
|
+
};
|
|
86
|
+
}, h = (e, t) => t === "ean13" ? m(e) : o(e), g = (e) => {
|
|
87
|
+
let t = [];
|
|
88
|
+
for (let n of e) {
|
|
89
|
+
let e = n === "1", r = t[t.length - 1];
|
|
90
|
+
r && r[0] === e ? r[1] += 1 : t.push([e, 1]);
|
|
91
|
+
}
|
|
92
|
+
return t;
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
export { p as ean13CheckDigit, h as encodeBarcode, g as toRuns };
|
|
@@ -31,3 +31,4 @@ export * from './components/data-display/Leaderboard/Leaderboard';
|
|
|
31
31
|
export * from './components/data-display/RelativeTime/RelativeTime';
|
|
32
32
|
export * from './components/data-display/Countdown/Countdown';
|
|
33
33
|
export * from './components/data-display/Presence/Presence';
|
|
34
|
+
export * from './components/data-display/Barcode/Barcode';
|
package/dist/data-display.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./components/data-display/Card/Card.cjs"),t=require("./components/data-display/Badge/Badge.cjs"),n=require("./components/data-display/Calendar/Calendar.cjs"),r=require("./components/data-display/Chip/Chip.cjs"),i=require("./components/data-display/VirtualList/VirtualList.cjs"),a=require("./components/data-display/TreeView/TreeView.cjs"),o=require("./components/data-display/Tag/Tag.cjs"),s=require("./components/data-display/Accordion/Accordion.cjs"),c=require("./components/data-display/Avatar/Avatar.cjs"),l=require("./components/data-display/AvatarGroup/AvatarGroup.cjs"),u=require("./components/data-display/Calendar/RangeCalendar.cjs"),d=require("./components/data-display/Carousel/Carousel.cjs"),f=require("./components/data-display/Table/useTableSort.cjs"),p=require("./components/data-display/Table/Table.cjs"),m=require("./components/data-display/DataGrid/DataGrid.cjs"),h=require("./components/data-display/DescriptionList/DescriptionList.cjs"),g=require("./components/data-display/EmptyState/EmptyState.cjs"),_=require("./components/data-display/Kanban/Kanban.cjs"),v=require("./components/data-display/List/List.cjs"),y=require("./components/data-display/Marquee/Marquee.cjs"),b=require("./components/data-display/Stats/Stats.cjs"),x=require("./components/data-display/Timeline/Timeline.cjs"),S=require("./components/data-display/FAQSection/FAQSection.cjs"),C=require("./components/data-display/InfiniteScroll/InfiniteScroll.cjs"),w=require("./components/data-display/SortableList/SortableList.cjs"),T=require("./components/data-display/SwipeAction/SwipeAction.cjs"),E=require("./components/data-display/PullToRefresh/PullToRefresh.cjs"),D=require("./components/data-display/JsonViewer/JsonViewer.cjs"),O=require("./components/data-display/CalendarHeatmap/CalendarHeatmap.cjs"),k=require("./components/data-display/Reaction/Reaction.cjs"),A=require("./components/data-display/Leaderboard/Leaderboard.cjs"),j=require("./components/data-display/RelativeTime/RelativeTime.cjs"),M=require("./components/data-display/Countdown/Countdown.cjs"),N=require("./components/data-display/Presence/Presence.cjs");exports.Accordion=s.Accordion,exports.AccordionContent=s.AccordionContent,exports.AccordionItem=s.AccordionItem,exports.AccordionTrigger=s.AccordionTrigger,exports.Avatar=c.Avatar,exports.AvatarGroup=l.AvatarGroup,exports.Badge=t.Badge,exports.Calendar=n.Calendar,exports.CalendarHeatmap=O.CalendarHeatmap,exports.Card=e.Card,exports.CardBody=e.CardBody,exports.CardFooter=e.CardFooter,exports.CardHeader=e.CardHeader,exports.Carousel=d.Carousel,exports.Chip=r.Chip,exports.Countdown=M.Countdown,exports.DataGrid=m.DataGrid,exports.DescriptionList=h.DescriptionList,exports.DescriptionListDetails=h.DescriptionListDetails,exports.DescriptionListItem=h.DescriptionListItem,exports.DescriptionListTerm=h.DescriptionListTerm,exports.EmptyState=g.EmptyState,exports.FAQSection=S.FAQSection,exports.InfiniteScroll=C.InfiniteScroll,exports.JsonViewer=D.JsonViewer,exports.Kanban=_.Kanban,exports.KanbanBoard=_.KanbanBoard,exports.KanbanCard=_.KanbanCard,exports.KanbanColumn=_.KanbanColumn,exports.Leaderboard=A.Leaderboard,exports.List=v.List,exports.ListItem=v.ListItem,exports.Marquee=y.Marquee,exports.Presence=N.Presence,exports.PullToRefresh=E.PullToRefresh,exports.RangeCalendar=u.RangeCalendar,exports.Reaction=k.Reaction,exports.RelativeTime=j.RelativeTime,exports.SortableList=w.SortableList,exports.SortableListDragHandle=w.SortableListDragHandle,exports.SortableListItem=w.SortableListItem,exports.Stats=b.Stats,exports.StatsDescription=b.StatsDescription,exports.StatsLabel=b.StatsLabel,exports.StatsTrend=b.StatsTrend,exports.StatsValue=b.StatsValue,exports.SwipeAction=T.SwipeAction,exports.Table=p.Table,exports.TableBody=p.TableBody,exports.TableCell=p.TableCell,exports.TableFooter=p.TableFooter,exports.TableHead=p.TableHead,exports.TableHeader=p.TableHeader,exports.TableRow=p.TableRow,exports.Tag=o.Tag,exports.Timeline=x.Timeline,exports.TimelineConnector=x.TimelineConnector,exports.TimelineContent=x.TimelineContent,exports.TimelineItem=x.TimelineItem,exports.TimelineOppositeContent=x.TimelineOppositeContent,exports.TimelinePoint=x.TimelinePoint,exports.TimelineSeparator=x.TimelineSeparator,exports.TreeView=a.TreeView,exports.TreeViewItem=a.TreeViewItem,exports.VirtualList=i.VirtualList,exports.getNextSortDirection=f.getNextSortDirection,exports.useTableSort=f.useTableSort;
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./components/data-display/Card/Card.cjs"),t=require("./components/data-display/Badge/Badge.cjs"),n=require("./components/data-display/Calendar/Calendar.cjs"),r=require("./components/data-display/Chip/Chip.cjs"),i=require("./components/data-display/VirtualList/VirtualList.cjs"),a=require("./components/data-display/TreeView/TreeView.cjs"),o=require("./components/data-display/Tag/Tag.cjs"),s=require("./components/data-display/Accordion/Accordion.cjs"),c=require("./components/data-display/Avatar/Avatar.cjs"),l=require("./components/data-display/AvatarGroup/AvatarGroup.cjs"),u=require("./components/data-display/Calendar/RangeCalendar.cjs"),d=require("./components/data-display/Carousel/Carousel.cjs"),f=require("./components/data-display/Table/useTableSort.cjs"),p=require("./components/data-display/Table/Table.cjs"),m=require("./components/data-display/DataGrid/DataGrid.cjs"),h=require("./components/data-display/DescriptionList/DescriptionList.cjs"),g=require("./components/data-display/EmptyState/EmptyState.cjs"),_=require("./components/data-display/Kanban/Kanban.cjs"),v=require("./components/data-display/List/List.cjs"),y=require("./components/data-display/Marquee/Marquee.cjs"),b=require("./components/data-display/Stats/Stats.cjs"),x=require("./components/data-display/Timeline/Timeline.cjs"),S=require("./components/data-display/FAQSection/FAQSection.cjs"),C=require("./components/data-display/InfiniteScroll/InfiniteScroll.cjs"),w=require("./components/data-display/SortableList/SortableList.cjs"),T=require("./components/data-display/SwipeAction/SwipeAction.cjs"),E=require("./components/data-display/PullToRefresh/PullToRefresh.cjs"),D=require("./components/data-display/JsonViewer/JsonViewer.cjs"),O=require("./components/data-display/CalendarHeatmap/CalendarHeatmap.cjs"),k=require("./components/data-display/Reaction/Reaction.cjs"),A=require("./components/data-display/Leaderboard/Leaderboard.cjs"),j=require("./components/data-display/RelativeTime/RelativeTime.cjs"),M=require("./components/data-display/Countdown/Countdown.cjs"),N=require("./components/data-display/Presence/Presence.cjs"),P=require("./components/data-display/Barcode/Barcode.cjs");exports.Accordion=s.Accordion,exports.AccordionContent=s.AccordionContent,exports.AccordionItem=s.AccordionItem,exports.AccordionTrigger=s.AccordionTrigger,exports.Avatar=c.Avatar,exports.AvatarGroup=l.AvatarGroup,exports.Badge=t.Badge,exports.Barcode=P.Barcode,exports.Calendar=n.Calendar,exports.CalendarHeatmap=O.CalendarHeatmap,exports.Card=e.Card,exports.CardBody=e.CardBody,exports.CardFooter=e.CardFooter,exports.CardHeader=e.CardHeader,exports.Carousel=d.Carousel,exports.Chip=r.Chip,exports.Countdown=M.Countdown,exports.DataGrid=m.DataGrid,exports.DescriptionList=h.DescriptionList,exports.DescriptionListDetails=h.DescriptionListDetails,exports.DescriptionListItem=h.DescriptionListItem,exports.DescriptionListTerm=h.DescriptionListTerm,exports.EmptyState=g.EmptyState,exports.FAQSection=S.FAQSection,exports.InfiniteScroll=C.InfiniteScroll,exports.JsonViewer=D.JsonViewer,exports.Kanban=_.Kanban,exports.KanbanBoard=_.KanbanBoard,exports.KanbanCard=_.KanbanCard,exports.KanbanColumn=_.KanbanColumn,exports.Leaderboard=A.Leaderboard,exports.List=v.List,exports.ListItem=v.ListItem,exports.Marquee=y.Marquee,exports.Presence=N.Presence,exports.PullToRefresh=E.PullToRefresh,exports.RangeCalendar=u.RangeCalendar,exports.Reaction=k.Reaction,exports.RelativeTime=j.RelativeTime,exports.SortableList=w.SortableList,exports.SortableListDragHandle=w.SortableListDragHandle,exports.SortableListItem=w.SortableListItem,exports.Stats=b.Stats,exports.StatsDescription=b.StatsDescription,exports.StatsLabel=b.StatsLabel,exports.StatsTrend=b.StatsTrend,exports.StatsValue=b.StatsValue,exports.SwipeAction=T.SwipeAction,exports.Table=p.Table,exports.TableBody=p.TableBody,exports.TableCell=p.TableCell,exports.TableFooter=p.TableFooter,exports.TableHead=p.TableHead,exports.TableHeader=p.TableHeader,exports.TableRow=p.TableRow,exports.Tag=o.Tag,exports.Timeline=x.Timeline,exports.TimelineConnector=x.TimelineConnector,exports.TimelineContent=x.TimelineContent,exports.TimelineItem=x.TimelineItem,exports.TimelineOppositeContent=x.TimelineOppositeContent,exports.TimelinePoint=x.TimelinePoint,exports.TimelineSeparator=x.TimelineSeparator,exports.TreeView=a.TreeView,exports.TreeViewItem=a.TreeViewItem,exports.VirtualList=i.VirtualList,exports.getNextSortDirection=f.getNextSortDirection,exports.useTableSort=f.useTableSort;
|
package/dist/data-display.js
CHANGED
|
@@ -33,4 +33,5 @@ import { Leaderboard as le } from "./components/data-display/Leaderboard/Leaderb
|
|
|
33
33
|
import { RelativeTime as ue } from "./components/data-display/RelativeTime/RelativeTime.js";
|
|
34
34
|
import { Countdown as de } from "./components/data-display/Countdown/Countdown.js";
|
|
35
35
|
import { Presence as fe } from "./components/data-display/Presence/Presence.js";
|
|
36
|
-
|
|
36
|
+
import { Barcode as pe } from "./components/data-display/Barcode/Barcode.js";
|
|
37
|
+
export { d as Accordion, f as AccordionContent, p as AccordionItem, m as AccordionTrigger, h as Avatar, g as AvatarGroup, i as Badge, pe as Barcode, a as Calendar, se as CalendarHeatmap, e as Card, t as CardBody, n as CardFooter, r as CardHeader, v as Carousel, o as Chip, de as Countdown, O as DataGrid, k as DescriptionList, A as DescriptionListDetails, j as DescriptionListItem, M as DescriptionListTerm, N as EmptyState, $ as FAQSection, ee as InfiniteScroll, oe as JsonViewer, P as Kanban, F as KanbanBoard, I as KanbanCard, L as KanbanColumn, le as Leaderboard, R as List, z as ListItem, B as Marquee, fe as Presence, ae as PullToRefresh, _ as RangeCalendar, ce as Reaction, ue as RelativeTime, te as SortableList, ne as SortableListDragHandle, re as SortableListItem, V as Stats, H as StatsDescription, U as StatsLabel, W as StatsTrend, G as StatsValue, ie as SwipeAction, x as Table, S as TableBody, C as TableCell, w as TableFooter, T as TableHead, E as TableHeader, D as TableRow, u as Tag, K as Timeline, q as TimelineConnector, J as TimelineContent, Y as TimelineItem, X as TimelineOppositeContent, Z as TimelinePoint, Q as TimelineSeparator, c as TreeView, l as TreeViewItem, s as VirtualList, y as getNextSortDirection, b as useTableSort };
|