@nice2dev/ui 1.0.5 → 1.0.8
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/README.md +253 -207
- package/dist/NiceAPIFlow.doc-DnQLPUie.js +30 -0
- package/dist/NiceAPIFlow.doc-Dx4qw1lm.cjs +6 -0
- package/dist/NiceBranchManager.doc-BXjiENlD.cjs +6 -0
- package/dist/NiceBranchManager.doc-xLB82YwU.js +30 -0
- package/dist/NiceButton-B5RXLDwI.cjs +1 -0
- package/dist/NiceButton-CDiS45Ya.cjs +1 -0
- package/dist/NiceButton-D9l39Rs7.js +595 -0
- package/dist/NiceButton-DmTHNHet.js +450 -0
- package/dist/NiceCodeTemplate.doc-BWxTE4C_.cjs +6 -0
- package/dist/NiceCodeTemplate.doc-CA2U5F-v.js +30 -0
- package/dist/NiceDataBranchGraph.doc-CkitupWc.js +29 -0
- package/dist/NiceDataBranchGraph.doc-DDUgipqH.cjs +5 -0
- package/dist/NiceDataBranchManager.doc-B0ODKOs4.js +30 -0
- package/dist/NiceDataBranchManager.doc-CC5o8ihs.cjs +6 -0
- package/dist/NiceDataConflictResolver.doc-CdzScNie.cjs +5 -0
- package/dist/NiceDataConflictResolver.doc-V8vxYAeo.js +29 -0
- package/dist/NiceDataDiffViewer.doc-CR14Bq3A.cjs +6 -0
- package/dist/NiceDataDiffViewer.doc-w2I2QjhX.js +30 -0
- package/dist/NiceDataMapper.doc-C7jSyHRM.js +30 -0
- package/dist/NiceDataMapper.doc-DXjQHz87.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-CV32WC_w.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-DtuYb3nx.js +30 -0
- package/dist/NiceDataSnapshot.doc-CFLkY3ry.js +30 -0
- package/dist/NiceDataSnapshot.doc-CpZyQ17u.cjs +6 -0
- package/dist/NiceErrorBoundary-BAeqfoSc.cjs +1 -0
- package/dist/NiceErrorBoundary-D1hh5GGe.js +732 -0
- package/dist/NiceErrorBoundary-Dta4TGee.cjs +1 -0
- package/dist/NiceErrorBoundary-niMx1aSJ.js +837 -0
- package/dist/NiceEventOrchestrator.doc-C4SJfIDV.js +30 -0
- package/dist/NiceEventOrchestrator.doc-CxjsLxBG.cjs +6 -0
- package/dist/NiceGitBlame.doc-BG3_K9_0.cjs +6 -0
- package/dist/NiceGitBlame.doc-DrJABEat.js +30 -0
- package/dist/NiceGitConflictResolver.doc-BK7hAfz6.js +30 -0
- package/dist/NiceGitConflictResolver.doc-CgroGM9_.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-BAwgcY_3.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-BXKJeP-E.js +30 -0
- package/dist/NiceGitGraph.doc-B-WtGuzn.cjs +5 -0
- package/dist/NiceGitGraph.doc-DxnDPCgC.js +29 -0
- package/dist/NiceGitHooks.doc-BrEizvMp.js +29 -0
- package/dist/NiceGitHooks.doc-C4EdV5zj.cjs +5 -0
- package/dist/NiceMergeRequestBuilder.doc-C5p8mYuh.cjs +6 -0
- package/dist/NiceMergeRequestBuilder.doc-Ct9RCmU8.js +30 -0
- package/dist/NiceModuleLifecyclePanel-BapdidD6.js +4776 -0
- package/dist/NiceModuleLifecyclePanel-Brg1RLwi.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-CsFsm534.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-I_TXRiiY.js +5053 -0
- package/dist/NicePinCodeInput-4q8yULuo.js +13359 -0
- package/dist/NicePinCodeInput-CrMfdxxc.js +15287 -0
- package/dist/NicePinCodeInput-D0aF9MK8.cjs +692 -0
- package/dist/NicePinCodeInput-eD2q8nGa.cjs +692 -0
- package/dist/NicePinCodeInput.css +1 -0
- package/dist/NicePipelineEditor.doc-0eGt8zbX.cjs +5 -0
- package/dist/NicePipelineEditor.doc-DTmaOebn.js +29 -0
- package/dist/NicePipelineMonitor.doc-67CmsRcf.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-mSMdhuG8.js +29 -0
- package/dist/NiceSavedQueryPanel-BZNvqSQW.cjs +596 -0
- package/dist/NiceSavedQueryPanel-CUAsdOjJ.js +6190 -0
- package/dist/NiceSavedQueryPanel-DUw8plYP.js +5666 -0
- package/dist/NiceSavedQueryPanel-xpk09zy1.cjs +596 -0
- package/dist/NiceSavedQueryPanel.css +1 -0
- package/dist/NiceStateDesigner.doc-B36u0hNU.js +29 -0
- package/dist/NiceStateDesigner.doc-MPmvNHSx.cjs +5 -0
- package/dist/NiceStockChart-CHlOnWzN.cjs +287 -0
- package/dist/NiceStockChart-Cpmv9_Cc.js +2341 -0
- package/dist/NiceStockChart.css +1 -0
- package/dist/NiceTestBuilder.doc-BFInj8GJ.js +30 -0
- package/dist/NiceTestBuilder.doc-CB03U_uR.cjs +6 -0
- package/dist/NiceToggle-C1UKGXmJ.js +209 -0
- package/dist/NiceToggle-CaY1u82g.js +277 -0
- package/dist/NiceToggle-DFJFQv_Z.cjs +1 -0
- package/dist/NiceToggle-lVi-ETi0.cjs +1 -0
- package/dist/NiceWindow-D1awkyFl.js +1636 -0
- package/dist/NiceWindow-IdHAcP70.cjs +1 -0
- package/dist/NiceWindow-SiCaREbq.js +1408 -0
- package/dist/NiceWindow-yARTUJsg.cjs +1 -0
- package/dist/charts-Bx_kNBsE.js +4280 -0
- package/dist/charts-DECVsCHX.cjs +754 -0
- package/dist/charts.cjs +1 -0
- package/dist/charts.css +1 -0
- package/dist/charts.d.ts +1043 -0
- package/dist/charts.mjs +23 -0
- package/dist/core-BZBTsGWN.cjs +96 -0
- package/dist/core-BpghV7Ls.js +17555 -0
- package/dist/core-CfXsl755.js +16305 -0
- package/dist/core-DGJSUW64.cjs +96 -0
- package/dist/data-branching-De4ExX-S.cjs +1 -0
- package/dist/data-branching-DiRfob1f.js +6071 -0
- package/dist/data-branching.cjs +1 -0
- package/dist/data-branching.d.ts +401 -0
- package/dist/data-branching.mjs +9 -0
- package/dist/data.cjs +1 -0
- package/dist/data.d.ts +2003 -0
- package/dist/data.mjs +21 -0
- package/dist/devops-BnYinjkT.cjs +17 -0
- package/dist/devops-Ckh57eti.js +7198 -0
- package/dist/devops.cjs +1 -0
- package/dist/devops.d.ts +758 -0
- package/dist/devops.mjs +12 -0
- package/dist/editors.cjs +1 -0
- package/dist/editors.d.ts +2728 -0
- package/dist/editors.mjs +66 -0
- package/dist/feedback.cjs +1 -0
- package/dist/feedback.d.ts +339 -0
- package/dist/feedback.mjs +16 -0
- package/dist/index-C853adw1.cjs +6199 -0
- package/dist/index-CBIZ6mTQ.cjs +5734 -0
- package/dist/index-CIl98Vbm.js +72951 -0
- package/dist/index-CNwVELPJ.js +62857 -0
- package/dist/index-CUx_-gKK.cjs +1 -0
- package/dist/index-x8mRM4Jc.js +17 -0
- package/dist/index.cjs +1 -7866
- package/dist/index.css +1 -0
- package/dist/index.d.ts +4888 -180
- package/dist/index.mjs +1021 -105889
- package/dist/lazy.cjs +1 -0
- package/dist/lazy.d.ts +1880 -0
- package/dist/lazy.mjs +98 -0
- package/dist/navigation.cjs +1 -0
- package/dist/navigation.d.ts +1862 -0
- package/dist/navigation.mjs +576 -0
- package/dist/no-code-BCuadkm4.cjs +332 -0
- package/dist/no-code-TL7PyulA.js +7005 -0
- package/dist/no-code.cjs +1 -0
- package/dist/no-code.d.ts +870 -0
- package/dist/no-code.mjs +13 -0
- package/dist/overlays.cjs +1 -0
- package/dist/overlays.d.ts +706 -0
- package/dist/overlays.mjs +482 -0
- package/package.json +51 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.nice-chart-ai{--ai-primary: #6366f1;--ai-primary-light: #818cf8;--ai-bg: #f8fafc;--ai-border: #e2e8f0;--ai-text: #334155;--ai-text-muted: #64748b;--ai-success: #22c55e;--ai-panel-bg: #ffffff;position:relative;display:flex;flex-direction:column;border-radius:8px;overflow:hidden;border:1px solid var(--ai-border);background:var(--ai-panel-bg)}[data-theme=dark] .nice-chart-ai,.nice-chart-ai.dark{--ai-primary: #818cf8;--ai-primary-light: #a5b4fc;--ai-bg: #1e293b;--ai-border: #334155;--ai-text: #e2e8f0;--ai-text-muted: #94a3b8;--ai-success: #4ade80;--ai-panel-bg: #0f172a}.nice-chart-ai__toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 16px;background:var(--ai-bg);border-bottom:1px solid var(--ai-border);flex-wrap:wrap}.nice-chart-ai__toolbar-left{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.nice-chart-ai__badge{display:inline-flex;align-items:center;justify-content:center;padding:3px 10px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:#fff;background:linear-gradient(135deg,var(--ai-primary) 0%,var(--ai-primary-light) 100%);border-radius:4px}.nice-chart-ai__suggestion{display:flex;align-items:center;gap:6px;font-size:13px}.nice-chart-ai__suggestion-icon{font-size:14px}.nice-chart-ai__suggestion-text{color:var(--ai-text);font-weight:500}.nice-chart-ai__suggestion-reason{color:var(--ai-text-muted);font-size:12px;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nice-chart-ai__loading{font-size:12px;color:var(--ai-primary);animation:pulse-opacity 1.5s ease-in-out infinite}@keyframes pulse-opacity{0%,to{opacity:.5}50%{opacity:1}}.nice-chart-ai__toolbar-center{display:flex;align-items:center}.nice-chart-ai__type-selector{display:flex;gap:4px;padding:4px;background:var(--ai-panel-bg);border:1px solid var(--ai-border);border-radius:6px}.nice-chart-ai__type-btn{display:flex;align-items:center;justify-content:center;width:32px;height:28px;padding:0;font-size:14px;background:transparent;border:none;border-radius:4px;cursor:pointer;transition:all .15s ease}.nice-chart-ai__type-btn:hover{background:var(--ai-bg)}.nice-chart-ai__type-btn--active{background:var(--ai-primary);box-shadow:0 2px 4px #6366f14d}.nice-chart-ai__toolbar-right{display:flex;align-items:center;gap:8px}.nice-chart-ai__auto-btn,.nice-chart-ai__insights-btn{display:inline-flex;align-items:center;gap:4px;padding:6px 12px;font-size:12px;font-weight:500;color:var(--ai-text);background:transparent;border:1px solid var(--ai-border);border-radius:4px;cursor:pointer;transition:all .15s ease}.nice-chart-ai__auto-btn:hover:not(:disabled),.nice-chart-ai__insights-btn:hover:not(:disabled){background:var(--ai-primary);color:#fff;border-color:var(--ai-primary)}.nice-chart-ai__auto-btn:disabled,.nice-chart-ai__insights-btn:disabled{opacity:.5;cursor:not-allowed}.nice-chart-ai__chart-wrapper{flex:1;min-height:300px;padding:16px}.nice-chart-ai__insights{position:absolute;top:60px;right:16px;width:320px;max-height:calc(100% - 80px);background:var(--ai-panel-bg);border:1px solid var(--ai-border);border-radius:8px;box-shadow:0 10px 25px #00000026;display:flex;flex-direction:column;z-index:10;animation:fadeIn .2s ease-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}.nice-chart-ai__insights--loading{justify-content:center;align-items:center;min-height:150px}.nice-chart-ai__loading-content{display:flex;flex-direction:column;align-items:center;gap:12px;color:var(--ai-primary);font-size:14px}.nice-chart-ai__spinner{width:24px;height:24px;border:3px solid var(--ai-border);border-top-color:var(--ai-primary);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.nice-chart-ai__insights-header{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;background:var(--ai-bg);border-bottom:1px solid var(--ai-border);border-radius:8px 8px 0 0}.nice-chart-ai__insights-header h4{margin:0;font-size:14px;font-weight:600;color:var(--ai-text)}.nice-chart-ai__insights-close{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;font-size:14px;color:var(--ai-text-muted);background:transparent;border:none;border-radius:4px;cursor:pointer;transition:all .15s ease}.nice-chart-ai__insights-close:hover{color:var(--ai-text);background:var(--ai-border)}.nice-chart-ai__insights-list{flex:1;margin:0;padding:12px 14px;list-style:none;overflow-y:auto}.nice-chart-ai__insight{display:flex;align-items:flex-start;gap:8px;padding:8px 0;font-size:13px;line-height:1.5;color:var(--ai-text);border-bottom:1px solid var(--ai-border)}.nice-chart-ai__insight:last-child{border-bottom:none}.nice-chart-ai__insight-icon{color:var(--ai-primary);font-weight:700}.nice-chart-ai__insights-footer{padding:10px 14px;border-top:1px solid var(--ai-border)}.nice-chart-ai__refresh{width:100%;padding:8px;font-size:12px;font-weight:500;color:var(--ai-primary);background:transparent;border:1px solid var(--ai-border);border-radius:4px;cursor:pointer;transition:all .15s ease}.nice-chart-ai__refresh:hover:not(:disabled){background:var(--ai-bg);border-color:var(--ai-primary)}.nice-chart-ai__refresh:disabled{opacity:.5;cursor:not-allowed}@media(max-width:768px){.nice-chart-ai__toolbar{flex-direction:column;align-items:stretch;gap:10px}.nice-chart-ai__toolbar-left,.nice-chart-ai__toolbar-right{justify-content:center}.nice-chart-ai__toolbar-center{order:-1;justify-content:center}.nice-chart-ai__insights{position:static;width:100%;max-height:none;margin-top:0;border-radius:0;border-left:none;border-right:none;box-shadow:none}.nice-chart-ai__suggestion-reason{display:none}}@media(max-width:480px){.nice-chart-ai__type-selector{width:100%;justify-content:center}.nice-chart-ai__auto-btn,.nice-chart-ai__insights-btn{flex:1;justify-content:center}}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const e = "https://nice2dev.com/schemas/component-doc-v1.json", t = "NiceTestBuilder", s = "Visual test case builder with assertions, mocks, and test scenario management.", i = "no-code", n = "1.0.7", o = "stable", c = [{ name: "testSuite", type: "TestSuite", required: !0, description: "Test suite configuration" }, { name: "onChange", type: "(suite: TestSuite) => void", description: "Suite change callback" }, { name: "onRun", type: "(tests: TestCase[]) => Promise<TestResult[]>", description: "Run tests callback" }, { name: "mockProviders", type: "MockProvider[]", description: "Available mock providers" }], a = [{ title: "Test Builder", description: "Build test cases visually", code: `<NiceTestBuilder
|
|
2
|
+
testSuite={currentSuite}
|
|
3
|
+
onChange={handleSuiteChange}
|
|
4
|
+
onRun={handleRunTests}
|
|
5
|
+
mockProviders={mocks}
|
|
6
|
+
/>` }], r = { role: "application", ariaLabel: "Visual test builder" }, u = ["NiceTestRunner", "NiceAPIFlow"], l = {
|
|
7
|
+
$schema: e,
|
|
8
|
+
name: t,
|
|
9
|
+
description: s,
|
|
10
|
+
category: i,
|
|
11
|
+
since: n,
|
|
12
|
+
status: o,
|
|
13
|
+
props: c,
|
|
14
|
+
examples: a,
|
|
15
|
+
accessibility: r,
|
|
16
|
+
seeAlso: u
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
e as $schema,
|
|
20
|
+
r as accessibility,
|
|
21
|
+
i as category,
|
|
22
|
+
l as default,
|
|
23
|
+
s as description,
|
|
24
|
+
a as examples,
|
|
25
|
+
t as name,
|
|
26
|
+
c as props,
|
|
27
|
+
u as seeAlso,
|
|
28
|
+
n as since,
|
|
29
|
+
o as status
|
|
30
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",s="NiceTestBuilder",t="Visual test case builder with assertions, mocks, and test scenario management.",i="no-code",n="1.0.7",c="stable",o=[{name:"testSuite",type:"TestSuite",required:!0,description:"Test suite configuration"},{name:"onChange",type:"(suite: TestSuite) => void",description:"Suite change callback"},{name:"onRun",type:"(tests: TestCase[]) => Promise<TestResult[]>",description:"Run tests callback"},{name:"mockProviders",type:"MockProvider[]",description:"Available mock providers"}],a=[{title:"Test Builder",description:"Build test cases visually",code:`<NiceTestBuilder
|
|
2
|
+
testSuite={currentSuite}
|
|
3
|
+
onChange={handleSuiteChange}
|
|
4
|
+
onRun={handleRunTests}
|
|
5
|
+
mockProviders={mocks}
|
|
6
|
+
/>`}],r={role:"application",ariaLabel:"Visual test builder"},l=["NiceTestRunner","NiceAPIFlow"],u={$schema:e,name:s,description:t,category:i,since:n,status:c,props:o,examples:a,accessibility:r,seeAlso:l};exports.$schema=e;exports.accessibility=r;exports.category=i;exports.default=u;exports.description=t;exports.examples=a;exports.name=s;exports.props=o;exports.seeAlso=l;exports.since=n;exports.status=c;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { jsxs as v, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import ne, { forwardRef as R, useCallback as D, useMemo as S } from "react";
|
|
3
|
+
import { a as j, b as A, u as H, c as E, d as K, e as ce, C as te, N as L } from "./core-CfXsl755.js";
|
|
4
|
+
const ie = R(({
|
|
5
|
+
label: r,
|
|
6
|
+
helperText: p,
|
|
7
|
+
error: i,
|
|
8
|
+
required: N,
|
|
9
|
+
disabled: c,
|
|
10
|
+
readOnly: o,
|
|
11
|
+
size: _ = "md",
|
|
12
|
+
name: f,
|
|
13
|
+
id: b,
|
|
14
|
+
className: C,
|
|
15
|
+
style: d,
|
|
16
|
+
accessMode: x,
|
|
17
|
+
displayStyle: k,
|
|
18
|
+
value: s,
|
|
19
|
+
onChange: n,
|
|
20
|
+
onBlur: u,
|
|
21
|
+
onKeyDown: g,
|
|
22
|
+
placeholder: y,
|
|
23
|
+
min: m,
|
|
24
|
+
max: h,
|
|
25
|
+
step: t = 1,
|
|
26
|
+
precision: M,
|
|
27
|
+
prefix: O,
|
|
28
|
+
suffix: U,
|
|
29
|
+
showStepper: F = !0,
|
|
30
|
+
submitOnEnter: T,
|
|
31
|
+
onSubmit: G,
|
|
32
|
+
showKeyboardHints: J
|
|
33
|
+
}, P) => {
|
|
34
|
+
const w = j(x, b);
|
|
35
|
+
if (w === "hidden") return null;
|
|
36
|
+
w === "disabled" && (c = !0), w === "readOnly" && (o = !0);
|
|
37
|
+
const { t: I } = A(), q = H(b), Q = E("input", k), V = K("input", k), $ = D((l) => {
|
|
38
|
+
let a = l;
|
|
39
|
+
return m !== void 0 && (a = Math.max(m, a)), h !== void 0 && (a = Math.min(h, a)), M !== void 0 && (a = parseFloat(a.toFixed(M))), a;
|
|
40
|
+
}, [m, h, M]), X = D((l) => {
|
|
41
|
+
const a = l.target.value;
|
|
42
|
+
if (a === "") {
|
|
43
|
+
n?.(null);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const W = parseFloat(a);
|
|
47
|
+
isNaN(W) || n?.($(W));
|
|
48
|
+
}, [n, $]), Y = D(() => {
|
|
49
|
+
n?.($((s ?? 0) + t));
|
|
50
|
+
}, [s, t, n, $]), Z = D(() => {
|
|
51
|
+
n?.($((s ?? 0) - t));
|
|
52
|
+
}, [s, t, n, $]), z = ce({
|
|
53
|
+
enabled: T,
|
|
54
|
+
onSubmit: G
|
|
55
|
+
}), ee = D((l) => {
|
|
56
|
+
z(l), g?.(l);
|
|
57
|
+
}, [z, g]), B = S(() => {
|
|
58
|
+
const l = [];
|
|
59
|
+
return T && l.push(te.submit), F && (l.push({ key: "ArrowUp", description: I("shortcuts.increment", "Increase value") }), l.push({ key: "ArrowDown", description: I("shortcuts.decrement", "Decrease value") })), l;
|
|
60
|
+
}, [T, F, I]);
|
|
61
|
+
return /* @__PURE__ */ v("div", { className: `nice-field ${C || ""}`, style: d, children: [
|
|
62
|
+
r && /* @__PURE__ */ v("label", { htmlFor: q, className: `nice-field__label ${N ? "nice-field__label--required" : ""}`, children: [
|
|
63
|
+
r,
|
|
64
|
+
J && B.length > 0 && /* @__PURE__ */ e(L, { shortcuts: B, size: "sm" })
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ v("div", { className: `nice-input nice-input--${_} nice-input--ds-${V} ${i ? "nice-input--error" : ""} ${c ? "nice-input--disabled" : ""} ${o ? "nice-input--readonly" : ""}`, style: Q, children: [
|
|
67
|
+
O && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: O }),
|
|
68
|
+
F && !o && /* @__PURE__ */ e("button", { type: "button", className: "nice-input__clear", onClick: Z, disabled: c, "aria-label": I("controls.decrement", "Decrement"), children: "−" }),
|
|
69
|
+
/* @__PURE__ */ e(
|
|
70
|
+
"input",
|
|
71
|
+
{
|
|
72
|
+
ref: P,
|
|
73
|
+
id: q,
|
|
74
|
+
className: "nice-input__native",
|
|
75
|
+
type: "number",
|
|
76
|
+
name: f,
|
|
77
|
+
value: s ?? "",
|
|
78
|
+
placeholder: y,
|
|
79
|
+
min: m,
|
|
80
|
+
max: h,
|
|
81
|
+
step: t,
|
|
82
|
+
disabled: c,
|
|
83
|
+
readOnly: o,
|
|
84
|
+
"aria-invalid": !!i,
|
|
85
|
+
onChange: X,
|
|
86
|
+
onBlur: u,
|
|
87
|
+
onKeyDown: ee
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
F && !o && /* @__PURE__ */ e("button", { type: "button", className: "nice-input__clear", onClick: Y, disabled: c, "aria-label": I("controls.increment", "Increment"), children: "+" }),
|
|
91
|
+
U && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: U })
|
|
92
|
+
] }),
|
|
93
|
+
i && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: i }),
|
|
94
|
+
!i && p && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: p })
|
|
95
|
+
] });
|
|
96
|
+
});
|
|
97
|
+
ie.displayName = "NiceNumberInput";
|
|
98
|
+
const se = R(({
|
|
99
|
+
label: r,
|
|
100
|
+
checked: p = !1,
|
|
101
|
+
indeterminate: i = !1,
|
|
102
|
+
onChange: N,
|
|
103
|
+
disabled: c,
|
|
104
|
+
size: o = "md",
|
|
105
|
+
name: _,
|
|
106
|
+
id: f,
|
|
107
|
+
className: b,
|
|
108
|
+
style: C,
|
|
109
|
+
error: d,
|
|
110
|
+
accessMode: x,
|
|
111
|
+
displayStyle: k,
|
|
112
|
+
showKeyboardHints: s
|
|
113
|
+
}, n) => {
|
|
114
|
+
const u = j(x, f);
|
|
115
|
+
if (u === "hidden") return null;
|
|
116
|
+
(u === "disabled" || u === "readOnly") && (c = !0);
|
|
117
|
+
const { t: g } = A(), y = H(f);
|
|
118
|
+
K("toggle", k);
|
|
119
|
+
const m = S(() => [
|
|
120
|
+
{ key: "Space", description: g("shortcuts.toggle", "Toggle") }
|
|
121
|
+
], [g]), h = ne.useCallback((t) => {
|
|
122
|
+
t && (t.indeterminate = i), typeof n == "function" ? n(t) : n && (n.current = t);
|
|
123
|
+
}, [i, n]);
|
|
124
|
+
return /* @__PURE__ */ v("div", { className: b, style: C, children: [
|
|
125
|
+
/* @__PURE__ */ v(
|
|
126
|
+
"label",
|
|
127
|
+
{
|
|
128
|
+
className: `nice-checkbox ${o !== "md" ? `nice-checkbox--${o}` : ""} ${c ? "nice-checkbox--disabled" : ""}`,
|
|
129
|
+
htmlFor: y,
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ e(
|
|
132
|
+
"input",
|
|
133
|
+
{
|
|
134
|
+
ref: h,
|
|
135
|
+
id: y,
|
|
136
|
+
type: "checkbox",
|
|
137
|
+
className: "nice-checkbox__input",
|
|
138
|
+
name: _,
|
|
139
|
+
checked: p,
|
|
140
|
+
disabled: c,
|
|
141
|
+
"aria-invalid": !!d,
|
|
142
|
+
onChange: (t) => N?.(t.target.checked)
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ e("span", { className: "nice-checkbox__box", children: /* @__PURE__ */ e("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: i ? /* @__PURE__ */ e("line", { x1: "2", y1: "6", x2: "10", y2: "6" }) : /* @__PURE__ */ e("polyline", { points: "2 6 5 9 10 3" }) }) }),
|
|
146
|
+
r && /* @__PURE__ */ e("span", { children: r }),
|
|
147
|
+
s && /* @__PURE__ */ e(L, { shortcuts: m, size: "sm" })
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
d && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: d })
|
|
152
|
+
] });
|
|
153
|
+
});
|
|
154
|
+
se.displayName = "NiceCheckbox";
|
|
155
|
+
const le = R(({
|
|
156
|
+
label: r,
|
|
157
|
+
checked: p = !1,
|
|
158
|
+
onChange: i,
|
|
159
|
+
disabled: N,
|
|
160
|
+
size: c = "md",
|
|
161
|
+
name: o,
|
|
162
|
+
id: _,
|
|
163
|
+
className: f,
|
|
164
|
+
style: b,
|
|
165
|
+
accessMode: C,
|
|
166
|
+
displayStyle: d,
|
|
167
|
+
showKeyboardHints: x
|
|
168
|
+
}, k) => {
|
|
169
|
+
const s = j(C, _);
|
|
170
|
+
if (s === "hidden") return null;
|
|
171
|
+
(s === "disabled" || s === "readOnly") && (N = !0);
|
|
172
|
+
const { t: n } = A(), u = H(_), g = E("toggle", d), y = K("toggle", d), m = S(() => [
|
|
173
|
+
{ key: "Space", description: n("shortcuts.toggle", "Toggle on/off") }
|
|
174
|
+
], [n]);
|
|
175
|
+
return /* @__PURE__ */ v(
|
|
176
|
+
"label",
|
|
177
|
+
{
|
|
178
|
+
className: `nice-toggle nice-toggle--ds-${y} ${c !== "md" ? `nice-toggle--${c}` : ""} ${N ? "nice-toggle--disabled" : ""} ${f || ""}`,
|
|
179
|
+
htmlFor: u,
|
|
180
|
+
style: { ...g, ...b },
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ e(
|
|
183
|
+
"input",
|
|
184
|
+
{
|
|
185
|
+
ref: k,
|
|
186
|
+
id: u,
|
|
187
|
+
type: "checkbox",
|
|
188
|
+
className: "nice-toggle__input",
|
|
189
|
+
name: o,
|
|
190
|
+
checked: p,
|
|
191
|
+
disabled: N,
|
|
192
|
+
role: "switch",
|
|
193
|
+
"aria-checked": p,
|
|
194
|
+
onChange: (h) => i?.(h.target.checked)
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
/* @__PURE__ */ e("span", { className: "nice-toggle__track", children: /* @__PURE__ */ e("span", { className: "nice-toggle__thumb" }) }),
|
|
198
|
+
r && /* @__PURE__ */ e("span", { children: r }),
|
|
199
|
+
x && /* @__PURE__ */ e(L, { shortcuts: m, size: "sm" })
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
});
|
|
204
|
+
le.displayName = "NiceToggle";
|
|
205
|
+
export {
|
|
206
|
+
se as N,
|
|
207
|
+
ie as a,
|
|
208
|
+
le as b
|
|
209
|
+
};
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { jsxs as v, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import ne, { forwardRef as j, useCallback as D, useMemo as R } from "react";
|
|
3
|
+
import { f as S, g as A, b as H, h as E, i as K, j as ce, C as te, N as L } from "./core-BpghV7Ls.js";
|
|
4
|
+
const ie = j(
|
|
5
|
+
({
|
|
6
|
+
label: r,
|
|
7
|
+
helperText: p,
|
|
8
|
+
error: i,
|
|
9
|
+
required: N,
|
|
10
|
+
disabled: c,
|
|
11
|
+
readOnly: o,
|
|
12
|
+
size: _ = "md",
|
|
13
|
+
name: f,
|
|
14
|
+
id: b,
|
|
15
|
+
className: C,
|
|
16
|
+
style: d,
|
|
17
|
+
accessMode: x,
|
|
18
|
+
displayStyle: k,
|
|
19
|
+
value: s,
|
|
20
|
+
onChange: n,
|
|
21
|
+
onBlur: u,
|
|
22
|
+
onKeyDown: g,
|
|
23
|
+
placeholder: y,
|
|
24
|
+
min: m,
|
|
25
|
+
max: h,
|
|
26
|
+
step: t = 1,
|
|
27
|
+
precision: M,
|
|
28
|
+
prefix: O,
|
|
29
|
+
suffix: U,
|
|
30
|
+
showStepper: F = !0,
|
|
31
|
+
submitOnEnter: T,
|
|
32
|
+
onSubmit: G,
|
|
33
|
+
showKeyboardHints: J
|
|
34
|
+
}, P) => {
|
|
35
|
+
const w = S(x, b);
|
|
36
|
+
if (w === "hidden")
|
|
37
|
+
return null;
|
|
38
|
+
w === "disabled" && (c = !0), w === "readOnly" && (o = !0);
|
|
39
|
+
const { t: I } = A(), q = H(b), Q = E("input", k), V = K("input", k), $ = D(
|
|
40
|
+
(l) => {
|
|
41
|
+
let a = l;
|
|
42
|
+
return m !== void 0 && (a = Math.max(m, a)), h !== void 0 && (a = Math.min(h, a)), M !== void 0 && (a = parseFloat(a.toFixed(M))), a;
|
|
43
|
+
},
|
|
44
|
+
[m, h, M]
|
|
45
|
+
), X = D(
|
|
46
|
+
(l) => {
|
|
47
|
+
const a = l.target.value;
|
|
48
|
+
if (a === "") {
|
|
49
|
+
n?.(null);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const W = parseFloat(a);
|
|
53
|
+
isNaN(W) || n?.($(W));
|
|
54
|
+
},
|
|
55
|
+
[n, $]
|
|
56
|
+
), Y = D(() => {
|
|
57
|
+
n?.($((s ?? 0) + t));
|
|
58
|
+
}, [s, t, n, $]), Z = D(() => {
|
|
59
|
+
n?.($((s ?? 0) - t));
|
|
60
|
+
}, [s, t, n, $]), z = ce({
|
|
61
|
+
enabled: T,
|
|
62
|
+
onSubmit: G
|
|
63
|
+
}), ee = D(
|
|
64
|
+
(l) => {
|
|
65
|
+
z(l), g?.(l);
|
|
66
|
+
},
|
|
67
|
+
[z, g]
|
|
68
|
+
), B = R(() => {
|
|
69
|
+
const l = [];
|
|
70
|
+
return T && l.push(te.submit), F && (l.push({ key: "ArrowUp", description: I("shortcuts.increment", "Increase value") }), l.push({ key: "ArrowDown", description: I("shortcuts.decrement", "Decrease value") })), l;
|
|
71
|
+
}, [T, F, I]);
|
|
72
|
+
return /* @__PURE__ */ v("div", { className: `nice-field ${C || ""}`, style: d, children: [
|
|
73
|
+
r && /* @__PURE__ */ v(
|
|
74
|
+
"label",
|
|
75
|
+
{
|
|
76
|
+
htmlFor: q,
|
|
77
|
+
className: `nice-field__label ${N ? "nice-field__label--required" : ""}`,
|
|
78
|
+
children: [
|
|
79
|
+
r,
|
|
80
|
+
J && B.length > 0 && /* @__PURE__ */ e(L, { shortcuts: B, size: "sm" })
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ v(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: `nice-input nice-input--${_} nice-input--ds-${V} ${i ? "nice-input--error" : ""} ${c ? "nice-input--disabled" : ""} ${o ? "nice-input--readonly" : ""}`,
|
|
88
|
+
style: Q,
|
|
89
|
+
children: [
|
|
90
|
+
O && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: O }),
|
|
91
|
+
F && !o && /* @__PURE__ */ e(
|
|
92
|
+
"button",
|
|
93
|
+
{
|
|
94
|
+
type: "button",
|
|
95
|
+
className: "nice-input__clear",
|
|
96
|
+
onClick: Z,
|
|
97
|
+
disabled: c,
|
|
98
|
+
"aria-label": I("controls.decrement", "Decrement"),
|
|
99
|
+
children: "−"
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ e(
|
|
103
|
+
"input",
|
|
104
|
+
{
|
|
105
|
+
ref: P,
|
|
106
|
+
id: q,
|
|
107
|
+
className: "nice-input__native",
|
|
108
|
+
type: "number",
|
|
109
|
+
name: f,
|
|
110
|
+
value: s ?? "",
|
|
111
|
+
placeholder: y,
|
|
112
|
+
min: m,
|
|
113
|
+
max: h,
|
|
114
|
+
step: t,
|
|
115
|
+
disabled: c,
|
|
116
|
+
readOnly: o,
|
|
117
|
+
"aria-invalid": !!i,
|
|
118
|
+
onChange: X,
|
|
119
|
+
onBlur: u,
|
|
120
|
+
onKeyDown: ee
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
F && !o && /* @__PURE__ */ e(
|
|
124
|
+
"button",
|
|
125
|
+
{
|
|
126
|
+
type: "button",
|
|
127
|
+
className: "nice-input__clear",
|
|
128
|
+
onClick: Y,
|
|
129
|
+
disabled: c,
|
|
130
|
+
"aria-label": I("controls.increment", "Increment"),
|
|
131
|
+
children: "+"
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
U && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: U })
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
i && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: i }),
|
|
139
|
+
!i && p && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: p })
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
ie.displayName = "NiceNumberInput";
|
|
144
|
+
const se = j(
|
|
145
|
+
({
|
|
146
|
+
label: r,
|
|
147
|
+
checked: p = !1,
|
|
148
|
+
indeterminate: i = !1,
|
|
149
|
+
onChange: N,
|
|
150
|
+
disabled: c,
|
|
151
|
+
size: o = "md",
|
|
152
|
+
name: _,
|
|
153
|
+
id: f,
|
|
154
|
+
className: b,
|
|
155
|
+
style: C,
|
|
156
|
+
error: d,
|
|
157
|
+
accessMode: x,
|
|
158
|
+
displayStyle: k,
|
|
159
|
+
showKeyboardHints: s
|
|
160
|
+
}, n) => {
|
|
161
|
+
const u = S(x, f);
|
|
162
|
+
if (u === "hidden")
|
|
163
|
+
return null;
|
|
164
|
+
(u === "disabled" || u === "readOnly") && (c = !0);
|
|
165
|
+
const { t: g } = A(), y = H(f);
|
|
166
|
+
K("toggle", k);
|
|
167
|
+
const m = R(
|
|
168
|
+
() => [{ key: "Space", description: g("shortcuts.toggle", "Toggle") }],
|
|
169
|
+
[g]
|
|
170
|
+
), h = ne.useCallback(
|
|
171
|
+
(t) => {
|
|
172
|
+
t && (t.indeterminate = i), typeof n == "function" ? n(t) : n && (n.current = t);
|
|
173
|
+
},
|
|
174
|
+
[i, n]
|
|
175
|
+
);
|
|
176
|
+
return /* @__PURE__ */ v("div", { className: b, style: C, children: [
|
|
177
|
+
/* @__PURE__ */ v(
|
|
178
|
+
"label",
|
|
179
|
+
{
|
|
180
|
+
className: `nice-checkbox ${o !== "md" ? `nice-checkbox--${o}` : ""} ${c ? "nice-checkbox--disabled" : ""}`,
|
|
181
|
+
htmlFor: y,
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ e(
|
|
184
|
+
"input",
|
|
185
|
+
{
|
|
186
|
+
ref: h,
|
|
187
|
+
id: y,
|
|
188
|
+
type: "checkbox",
|
|
189
|
+
className: "nice-checkbox__input",
|
|
190
|
+
name: _,
|
|
191
|
+
checked: p,
|
|
192
|
+
disabled: c,
|
|
193
|
+
"aria-invalid": !!d,
|
|
194
|
+
onChange: (t) => N?.(t.target.checked)
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
/* @__PURE__ */ e("span", { className: "nice-checkbox__box", children: /* @__PURE__ */ e(
|
|
198
|
+
"svg",
|
|
199
|
+
{
|
|
200
|
+
viewBox: "0 0 12 12",
|
|
201
|
+
fill: "none",
|
|
202
|
+
stroke: "currentColor",
|
|
203
|
+
strokeWidth: "2",
|
|
204
|
+
strokeLinecap: "round",
|
|
205
|
+
strokeLinejoin: "round",
|
|
206
|
+
children: i ? /* @__PURE__ */ e("line", { x1: "2", y1: "6", x2: "10", y2: "6" }) : /* @__PURE__ */ e("polyline", { points: "2 6 5 9 10 3" })
|
|
207
|
+
}
|
|
208
|
+
) }),
|
|
209
|
+
r && /* @__PURE__ */ e("span", { children: r }),
|
|
210
|
+
s && /* @__PURE__ */ e(L, { shortcuts: m, size: "sm" })
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
d && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: d })
|
|
215
|
+
] });
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
se.displayName = "NiceCheckbox";
|
|
219
|
+
const le = j(
|
|
220
|
+
({
|
|
221
|
+
label: r,
|
|
222
|
+
checked: p = !1,
|
|
223
|
+
onChange: i,
|
|
224
|
+
disabled: N,
|
|
225
|
+
size: c = "md",
|
|
226
|
+
name: o,
|
|
227
|
+
id: _,
|
|
228
|
+
className: f,
|
|
229
|
+
style: b,
|
|
230
|
+
accessMode: C,
|
|
231
|
+
displayStyle: d,
|
|
232
|
+
showKeyboardHints: x
|
|
233
|
+
}, k) => {
|
|
234
|
+
const s = S(C, _);
|
|
235
|
+
if (s === "hidden")
|
|
236
|
+
return null;
|
|
237
|
+
(s === "disabled" || s === "readOnly") && (N = !0);
|
|
238
|
+
const { t: n } = A(), u = H(_), g = E("toggle", d), y = K("toggle", d), m = R(
|
|
239
|
+
() => [{ key: "Space", description: n("shortcuts.toggle", "Toggle on/off") }],
|
|
240
|
+
[n]
|
|
241
|
+
);
|
|
242
|
+
return /* @__PURE__ */ v(
|
|
243
|
+
"label",
|
|
244
|
+
{
|
|
245
|
+
className: `nice-toggle nice-toggle--ds-${y} ${c !== "md" ? `nice-toggle--${c}` : ""} ${N ? "nice-toggle--disabled" : ""} ${f || ""}`,
|
|
246
|
+
htmlFor: u,
|
|
247
|
+
style: { ...g, ...b },
|
|
248
|
+
children: [
|
|
249
|
+
/* @__PURE__ */ e(
|
|
250
|
+
"input",
|
|
251
|
+
{
|
|
252
|
+
ref: k,
|
|
253
|
+
id: u,
|
|
254
|
+
type: "checkbox",
|
|
255
|
+
className: "nice-toggle__input",
|
|
256
|
+
name: o,
|
|
257
|
+
checked: p,
|
|
258
|
+
disabled: N,
|
|
259
|
+
role: "switch",
|
|
260
|
+
"aria-checked": p,
|
|
261
|
+
onChange: (h) => i?.(h.target.checked)
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
/* @__PURE__ */ e("span", { className: "nice-toggle__track", children: /* @__PURE__ */ e("span", { className: "nice-toggle__thumb" }) }),
|
|
265
|
+
r && /* @__PURE__ */ e("span", { children: r }),
|
|
266
|
+
x && /* @__PURE__ */ e(L, { shortcuts: m, size: "sm" })
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
le.displayName = "NiceToggle";
|
|
273
|
+
export {
|
|
274
|
+
se as N,
|
|
275
|
+
ie as a,
|
|
276
|
+
le as b
|
|
277
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),i=require("react"),s=require("./core-BZBTsGWN.cjs"),K=i.forwardRef(({label:d,helperText:x,error:l,required:g,disabled:n,readOnly:r,size:b="md",name:f,id:j,className:$,style:m,accessMode:v,displayStyle:k,value:o,onChange:c,onBlur:h,onKeyDown:_,placeholder:y,min:p,max:N,step:t=1,precision:D,prefix:R,suffix:F,showStepper:M=!0,submitOnEnter:T,onSubmit:U,showKeyboardHints:z},B)=>{const w=s.useNiceAccessMode(v,j);if(w==="hidden")return null;w==="disabled"&&(n=!0),w==="readOnly"&&(r=!0);const{t:I}=s.useNiceTranslation(),A=s.useControlId(j),W=s.useComponentDisplayStyle("input",k),E=s.useComponentDisplayClass("input",k),C=i.useCallback(a=>{let u=a;return p!==void 0&&(u=Math.max(p,u)),N!==void 0&&(u=Math.min(N,u)),D!==void 0&&(u=parseFloat(u.toFixed(D))),u},[p,N,D]),G=i.useCallback(a=>{const u=a.target.value;if(u===""){c?.(null);return}const H=parseFloat(u);isNaN(H)||c?.(C(H))},[c,C]),J=i.useCallback(()=>{c?.(C((o??0)+t))},[o,t,c,C]),P=i.useCallback(()=>{c?.(C((o??0)-t))},[o,t,c,C]),S=s.useSubmitOnEnter({enabled:T,onSubmit:U}),Q=i.useCallback(a=>{S(a),_?.(a)},[S,_]),q=i.useMemo(()=>{const a=[];return T&&a.push(s.COMMON_SHORTCUTS.submit),M&&(a.push({key:"ArrowUp",description:I("shortcuts.increment","Increase value")}),a.push({key:"ArrowDown",description:I("shortcuts.decrement","Decrease value")})),a},[T,M,I]);return e.jsxs("div",{className:`nice-field ${$||""}`,style:m,children:[d&&e.jsxs("label",{htmlFor:A,className:`nice-field__label ${g?"nice-field__label--required":""}`,children:[d,z&&q.length>0&&e.jsx(s.NiceKeyboardHint,{shortcuts:q,size:"sm"})]}),e.jsxs("div",{className:`nice-input nice-input--${b} nice-input--ds-${E} ${l?"nice-input--error":""} ${n?"nice-input--disabled":""} ${r?"nice-input--readonly":""}`,style:W,children:[R&&e.jsx("span",{className:"nice-input__icon",children:R}),M&&!r&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:P,disabled:n,"aria-label":I("controls.decrement","Decrement"),children:"−"}),e.jsx("input",{ref:B,id:A,className:"nice-input__native",type:"number",name:f,value:o??"",placeholder:y,min:p,max:N,step:t,disabled:n,readOnly:r,"aria-invalid":!!l,onChange:G,onBlur:h,onKeyDown:Q}),M&&!r&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:J,disabled:n,"aria-label":I("controls.increment","Increment"),children:"+"}),F&&e.jsx("span",{className:"nice-input__icon",children:F})]}),l&&e.jsx("div",{className:"nice-field__error",role:"alert",children:l}),!l&&x&&e.jsx("div",{className:"nice-field__helper",children:x})]})});K.displayName="NiceNumberInput";const L=i.forwardRef(({label:d,checked:x=!1,indeterminate:l=!1,onChange:g,disabled:n,size:r="md",name:b,id:f,className:j,style:$,error:m,accessMode:v,displayStyle:k,showKeyboardHints:o},c)=>{const h=s.useNiceAccessMode(v,f);if(h==="hidden")return null;(h==="disabled"||h==="readOnly")&&(n=!0);const{t:_}=s.useNiceTranslation(),y=s.useControlId(f);s.useComponentDisplayClass("toggle",k);const p=i.useMemo(()=>[{key:"Space",description:_("shortcuts.toggle","Toggle")}],[_]),N=i.useCallback(t=>{t&&(t.indeterminate=l),typeof c=="function"?c(t):c&&(c.current=t)},[l,c]);return e.jsxs("div",{className:j,style:$,children:[e.jsxs("label",{className:`nice-checkbox ${r!=="md"?`nice-checkbox--${r}`:""} ${n?"nice-checkbox--disabled":""}`,htmlFor:y,children:[e.jsx("input",{ref:N,id:y,type:"checkbox",className:"nice-checkbox__input",name:b,checked:x,disabled:n,"aria-invalid":!!m,onChange:t=>g?.(t.target.checked)}),e.jsx("span",{className:"nice-checkbox__box",children:e.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l?e.jsx("line",{x1:"2",y1:"6",x2:"10",y2:"6"}):e.jsx("polyline",{points:"2 6 5 9 10 3"})})}),d&&e.jsx("span",{children:d}),o&&e.jsx(s.NiceKeyboardHint,{shortcuts:p,size:"sm"})]}),m&&e.jsx("div",{className:"nice-field__error",role:"alert",children:m})]})});L.displayName="NiceCheckbox";const O=i.forwardRef(({label:d,checked:x=!1,onChange:l,disabled:g,size:n="md",name:r,id:b,className:f,style:j,accessMode:$,displayStyle:m,showKeyboardHints:v},k)=>{const o=s.useNiceAccessMode($,b);if(o==="hidden")return null;(o==="disabled"||o==="readOnly")&&(g=!0);const{t:c}=s.useNiceTranslation(),h=s.useControlId(b),_=s.useComponentDisplayStyle("toggle",m),y=s.useComponentDisplayClass("toggle",m),p=i.useMemo(()=>[{key:"Space",description:c("shortcuts.toggle","Toggle on/off")}],[c]);return e.jsxs("label",{className:`nice-toggle nice-toggle--ds-${y} ${n!=="md"?`nice-toggle--${n}`:""} ${g?"nice-toggle--disabled":""} ${f||""}`,htmlFor:h,style:{..._,...j},children:[e.jsx("input",{ref:k,id:h,type:"checkbox",className:"nice-toggle__input",name:r,checked:x,disabled:g,role:"switch","aria-checked":x,onChange:N=>l?.(N.target.checked)}),e.jsx("span",{className:"nice-toggle__track",children:e.jsx("span",{className:"nice-toggle__thumb"})}),d&&e.jsx("span",{children:d}),v&&e.jsx(s.NiceKeyboardHint,{shortcuts:p,size:"sm"})]})});O.displayName="NiceToggle";exports.NiceCheckbox=L;exports.NiceNumberInput=K;exports.NiceToggle=O;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),i=require("react"),s=require("./core-DGJSUW64.cjs"),K=i.forwardRef(({label:d,helperText:x,error:l,required:g,disabled:n,readOnly:r,size:b="md",name:f,id:j,className:$,style:m,accessMode:v,displayStyle:k,value:o,onChange:c,onBlur:h,onKeyDown:_,placeholder:y,min:p,max:N,step:t=1,precision:D,prefix:R,suffix:F,showStepper:M=!0,submitOnEnter:T,onSubmit:U,showKeyboardHints:z},B)=>{const w=s.useNiceAccessMode(v,j);if(w==="hidden")return null;w==="disabled"&&(n=!0),w==="readOnly"&&(r=!0);const{t:I}=s.useNiceTranslation(),A=s.useControlId(j),W=s.useComponentDisplayStyle("input",k),E=s.useComponentDisplayClass("input",k),C=i.useCallback(a=>{let u=a;return p!==void 0&&(u=Math.max(p,u)),N!==void 0&&(u=Math.min(N,u)),D!==void 0&&(u=parseFloat(u.toFixed(D))),u},[p,N,D]),G=i.useCallback(a=>{const u=a.target.value;if(u===""){c?.(null);return}const H=parseFloat(u);isNaN(H)||c?.(C(H))},[c,C]),J=i.useCallback(()=>{c?.(C((o??0)+t))},[o,t,c,C]),P=i.useCallback(()=>{c?.(C((o??0)-t))},[o,t,c,C]),S=s.useSubmitOnEnter({enabled:T,onSubmit:U}),Q=i.useCallback(a=>{S(a),_?.(a)},[S,_]),q=i.useMemo(()=>{const a=[];return T&&a.push(s.COMMON_SHORTCUTS.submit),M&&(a.push({key:"ArrowUp",description:I("shortcuts.increment","Increase value")}),a.push({key:"ArrowDown",description:I("shortcuts.decrement","Decrease value")})),a},[T,M,I]);return e.jsxs("div",{className:`nice-field ${$||""}`,style:m,children:[d&&e.jsxs("label",{htmlFor:A,className:`nice-field__label ${g?"nice-field__label--required":""}`,children:[d,z&&q.length>0&&e.jsx(s.NiceKeyboardHint,{shortcuts:q,size:"sm"})]}),e.jsxs("div",{className:`nice-input nice-input--${b} nice-input--ds-${E} ${l?"nice-input--error":""} ${n?"nice-input--disabled":""} ${r?"nice-input--readonly":""}`,style:W,children:[R&&e.jsx("span",{className:"nice-input__icon",children:R}),M&&!r&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:P,disabled:n,"aria-label":I("controls.decrement","Decrement"),children:"−"}),e.jsx("input",{ref:B,id:A,className:"nice-input__native",type:"number",name:f,value:o??"",placeholder:y,min:p,max:N,step:t,disabled:n,readOnly:r,"aria-invalid":!!l,onChange:G,onBlur:h,onKeyDown:Q}),M&&!r&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:J,disabled:n,"aria-label":I("controls.increment","Increment"),children:"+"}),F&&e.jsx("span",{className:"nice-input__icon",children:F})]}),l&&e.jsx("div",{className:"nice-field__error",role:"alert",children:l}),!l&&x&&e.jsx("div",{className:"nice-field__helper",children:x})]})});K.displayName="NiceNumberInput";const L=i.forwardRef(({label:d,checked:x=!1,indeterminate:l=!1,onChange:g,disabled:n,size:r="md",name:b,id:f,className:j,style:$,error:m,accessMode:v,displayStyle:k,showKeyboardHints:o},c)=>{const h=s.useNiceAccessMode(v,f);if(h==="hidden")return null;(h==="disabled"||h==="readOnly")&&(n=!0);const{t:_}=s.useNiceTranslation(),y=s.useControlId(f);s.useComponentDisplayClass("toggle",k);const p=i.useMemo(()=>[{key:"Space",description:_("shortcuts.toggle","Toggle")}],[_]),N=i.useCallback(t=>{t&&(t.indeterminate=l),typeof c=="function"?c(t):c&&(c.current=t)},[l,c]);return e.jsxs("div",{className:j,style:$,children:[e.jsxs("label",{className:`nice-checkbox ${r!=="md"?`nice-checkbox--${r}`:""} ${n?"nice-checkbox--disabled":""}`,htmlFor:y,children:[e.jsx("input",{ref:N,id:y,type:"checkbox",className:"nice-checkbox__input",name:b,checked:x,disabled:n,"aria-invalid":!!m,onChange:t=>g?.(t.target.checked)}),e.jsx("span",{className:"nice-checkbox__box",children:e.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l?e.jsx("line",{x1:"2",y1:"6",x2:"10",y2:"6"}):e.jsx("polyline",{points:"2 6 5 9 10 3"})})}),d&&e.jsx("span",{children:d}),o&&e.jsx(s.NiceKeyboardHint,{shortcuts:p,size:"sm"})]}),m&&e.jsx("div",{className:"nice-field__error",role:"alert",children:m})]})});L.displayName="NiceCheckbox";const O=i.forwardRef(({label:d,checked:x=!1,onChange:l,disabled:g,size:n="md",name:r,id:b,className:f,style:j,accessMode:$,displayStyle:m,showKeyboardHints:v},k)=>{const o=s.useNiceAccessMode($,b);if(o==="hidden")return null;(o==="disabled"||o==="readOnly")&&(g=!0);const{t:c}=s.useNiceTranslation(),h=s.useControlId(b),_=s.useComponentDisplayStyle("toggle",m),y=s.useComponentDisplayClass("toggle",m),p=i.useMemo(()=>[{key:"Space",description:c("shortcuts.toggle","Toggle on/off")}],[c]);return e.jsxs("label",{className:`nice-toggle nice-toggle--ds-${y} ${n!=="md"?`nice-toggle--${n}`:""} ${g?"nice-toggle--disabled":""} ${f||""}`,htmlFor:h,style:{..._,...j},children:[e.jsx("input",{ref:k,id:h,type:"checkbox",className:"nice-toggle__input",name:r,checked:x,disabled:g,role:"switch","aria-checked":x,onChange:N=>l?.(N.target.checked)}),e.jsx("span",{className:"nice-toggle__track",children:e.jsx("span",{className:"nice-toggle__thumb"})}),d&&e.jsx("span",{children:d}),v&&e.jsx(s.NiceKeyboardHint,{shortcuts:p,size:"sm"})]})});O.displayName="NiceToggle";exports.NiceCheckbox=L;exports.NiceNumberInput=K;exports.NiceToggle=O;
|