@nice2dev/ui 1.3.8 → 1.3.10
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/CHANGELOG.md +107 -0
- package/dist/NiceColorPicker-BLwYNSXJ.cjs +1 -0
- package/dist/NiceColorPicker-DS59tNkP.js +552 -0
- package/dist/NiceDataGrid-CL2_7fS7.cjs +10 -0
- package/dist/NiceDataGrid-CpJrRN_H.js +2269 -0
- package/dist/NiceForm-BQj-K7p7.cjs +1 -0
- package/dist/NiceForm-HQ4h7hX_.js +5023 -0
- package/dist/NiceGantt-BygumlaY.cjs +1 -0
- package/dist/NiceGantt-DTC7OH-v.js +334 -0
- package/dist/NiceHtmlEditor-BtpuaLln.js +901 -0
- package/dist/NiceHtmlEditor-C1OVtLQ6.cjs +10 -0
- package/dist/NiceMention-CVxxCVtQ.js +11668 -0
- package/dist/NiceMention-Te66Oid1.cjs +430 -0
- package/dist/NiceModuleLifecyclePanel-DCrFyUH8.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-Mt80MdET.js +7441 -0
- package/dist/NicePagination-CKsAP38Q.cjs +1 -0
- package/dist/NicePagination-zOed5QxG.js +202 -0
- package/dist/NicePivotGrid-Clue9FM5.js +1184 -0
- package/dist/NicePivotGrid-Cnkr9WkC.cjs +152 -0
- package/dist/NiceSavedQueryPanel-B8hVgWR2.cjs +587 -0
- package/dist/NiceSavedQueryPanel-BFtY9GOP.js +6002 -0
- package/dist/NiceSavedQueryPanel-NgG58w6i.js +6226 -0
- package/dist/NiceSavedQueryPanel-lTWY2plm.cjs +587 -0
- package/dist/NiceScheduler-BWwqFKEc.js +1712 -0
- package/dist/NiceScheduler-DqWEJU7g.cjs +5 -0
- package/dist/NiceSelect-BNPXs6FQ.cjs +1 -0
- package/dist/NiceSelect-DEruWHan.js +495 -0
- package/dist/NiceTree.doc-AIR9cRQp.js +40 -0
- package/dist/NiceTree.doc-DGrIAx3G.cjs +16 -0
- package/dist/NiceWindow-D3V7A69Q.js +2247 -0
- package/dist/NiceWindow-pgR4c-kQ.cjs +1 -0
- package/dist/core-lazy-Bjdu111n.js +351 -0
- package/dist/core-lazy-Bx_8BOlG.cjs +1 -0
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +189 -14
- package/dist/data.mjs +3 -3
- package/dist/devops-CqhA0rjL.js +9130 -0
- package/dist/devops-cgRBnZVX.cjs +18 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.mjs +7 -7
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +1 -1
- package/dist/index.cjs +130 -130
- package/dist/index.css +1 -1
- package/dist/index.d.ts +193 -17
- package/dist/index.mjs +14780 -14657
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +15 -15
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +2 -0
- package/dist/navigation.mjs +3 -3
- package/dist/no-code-BQqK8mvU.cjs +331 -0
- package/dist/no-code-Cppb-xz3.js +8320 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.mjs +1 -1
- package/dist/pickerCommons-BA3-D5RC.js +663 -0
- package/dist/pickerCommons-KrBqCBDn.cjs +1 -0
- package/dist/style.css +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,112 @@
|
|
|
1
1
|
# [1.0.27] — 2026-06-07
|
|
2
2
|
|
|
3
|
+
## 1.3.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e5b7da8: **NiceTreeGrid: lazy children, whole subtrees, own selection summary. Test ids on 61 more controls.**
|
|
8
|
+
|
|
9
|
+
- **`loadChildren` + `hasChildren`:** a row can get its children when it is first opened. While they
|
|
10
|
+
load, a "Loading…" row stands under it. A failed load shows a row with a retry button. The grid
|
|
11
|
+
keeps what it loaded.
|
|
12
|
+
- Flat rows can bring deeper levels along (`parentKeyField`), nested rows through
|
|
13
|
+
`childrenField`.
|
|
14
|
+
- A row that is checked before it loads checks its children when they arrive.
|
|
15
|
+
- `hasChildren` alone (without `loadChildren`) gives an expander and a loading row until the host
|
|
16
|
+
adds the children to `data`.
|
|
17
|
+
- **Whole subtrees:** `rowActions={['expandSubtree']}` adds a row button that opens everything below
|
|
18
|
+
a row (loading lazy rows on the way) and closes it all once it is open. Alt- or Shift-click on an
|
|
19
|
+
expander and Shift+→ / Shift+← do the same without the button.
|
|
20
|
+
- **`checkedSummary`:** `false` hides "{checked} of {total} selected"; a function renders your own
|
|
21
|
+
from `checked`, `total`, `leafKeys` and `rows`, e.g. to count an item that has a row under several
|
|
22
|
+
parents once.
|
|
23
|
+
- **Expanding while searching:** rows the user opens or closes during a search now go through
|
|
24
|
+
`onExpandedChange` and stay that way after the search. The rows the search opens by itself are
|
|
25
|
+
still not reported and close again.
|
|
26
|
+
- **Fix: `*` opened only the last sibling:** each sibling's change started from the same set. It now
|
|
27
|
+
opens all of them.
|
|
28
|
+
- **Test ids:** `NiceBaseProps` declares `data-testid`, and 61 controls built on it dropped it. Among
|
|
29
|
+
them are NiceCard, NiceCheckbox, NiceToggle, NiceTabs, NiceAccordion, NiceBreadcrumb,
|
|
30
|
+
NiceTreeView, NiceTreeList, NiceForm, NicePagination and NiceMenu. They all render it on their
|
|
31
|
+
root element now.
|
|
32
|
+
- `NiceCard` also takes `testId` and forwards `id` to the card element.
|
|
33
|
+
- The CI gate `Test ids on standard controls` now covers `NiceBaseProps` controls too, and
|
|
34
|
+
counts a `{...rest}` spread on an element as forwarding.
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [e5b7da8]
|
|
37
|
+
- @nice2dev/i18n@1.3.10
|
|
38
|
+
- @nice2dev/ui-core@1.3.10
|
|
39
|
+
|
|
40
|
+
## 1.3.9
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- df3a74d: **NiceTreeGrid: a tree with cascading checkboxes, columns and search** — for picking modules in
|
|
45
|
+
packages, with informational rows in between.
|
|
46
|
+
|
|
47
|
+
- `checkable` with `checkedKeys` / `defaultCheckedKeys` / `onCheckedChange(keys, info)`: checking a
|
|
48
|
+
parent checks every row below it; a parent is checked when all of them are, indeterminate when
|
|
49
|
+
some are.
|
|
50
|
+
- `checkStrategy`: `'all'` (default), `'leaves'` or `'parents'`. A parent key in the value checks
|
|
51
|
+
its subtree, and keys of rows not in `data` are kept.
|
|
52
|
+
- `isRowCheckable(row)`: `false` makes a row informational, with no checkbox. A module whose
|
|
53
|
+
children are only categories counts as a leaf; a group header is counted through.
|
|
54
|
+
- `isRowDisabled(row)`: locks a row and its subtree, which keep their state.
|
|
55
|
+
- Checkbox options:
|
|
56
|
+
- `checkboxPlacement`: `'tree'` (after the expander) or `'column'`;
|
|
57
|
+
- `checkOnRowClick`;
|
|
58
|
+
- `showCheckedCount` (a "3/7" badge);
|
|
59
|
+
- a header "select all", which acts on the results while searching.
|
|
60
|
+
- Search:
|
|
61
|
+
- `searchText` / `defaultSearchText` / `onSearchChange`, `searchFields`, `searchFilter`,
|
|
62
|
+
`searchKeepDescendants`;
|
|
63
|
+
- opens the rows above every match without touching the user's expansion (`searchAutoExpand`);
|
|
64
|
+
- marks matches (`highlightMatches`) and shows "No results".
|
|
65
|
+
- Toolbar and expansion:
|
|
66
|
+
- `showOnlyChecked` / `defaultShowOnlyChecked` / `onShowOnlyCheckedChange`;
|
|
67
|
+
- `toolbarActions` (expand all, collapse all, show selected only, clear selection);
|
|
68
|
+
- `defaultExpandedKeys`, `rowClassName`, `getRowLabel`.
|
|
69
|
+
- `virtualScroll` / `rowHeight` / `height` for thousands of rows.
|
|
70
|
+
- Keyboard and ARIA (APG treegrid):
|
|
71
|
+
- one tab stop; arrows, Home / End, `*` and letters move between rows; Space checks, Enter
|
|
72
|
+
clicks, PageUp / PageDown move by 10;
|
|
73
|
+
- `aria-level` / `aria-expanded` / `aria-posinset` / `aria-setsize` on the rows.
|
|
74
|
+
- Takes `NiceStandardProps`: `testId` / `data-testid`, `id`, `accessMode`, `aria-label`.
|
|
75
|
+
- New types: `NiceTreeGridCheckInfo`, `NiceTreeGridToolbarAction`, `NiceTreeCheckState`,
|
|
76
|
+
`NiceTreeCheckStrategy`. 9 new `treeGrid.*` keys in the six dictionaries.
|
|
77
|
+
|
|
78
|
+
**Behaviour changes in NiceTreeGrid:**
|
|
79
|
+
|
|
80
|
+
- Focus moves to rows: expander buttons and checkboxes leave the tab order.
|
|
81
|
+
- A search reveals matches inside collapsed rows.
|
|
82
|
+
- Passing only `onExpandedChange` or only `onSelectionChange` (without the value prop) now updates
|
|
83
|
+
the view.
|
|
84
|
+
- `defaultExpandAll` also opens rows that arrive after mount, until the user toggles one.
|
|
85
|
+
|
|
86
|
+
**NiceTreeList (`selectable`)** now uses the same cascade:
|
|
87
|
+
|
|
88
|
+
- Nested `children` data renders; it used to show only the roots.
|
|
89
|
+
- A parent's key comes and goes with its descendants. Ticking every child one by one adds it, and
|
|
90
|
+
unticking one removes it. Past two levels, the parent's state used to be wrong.
|
|
91
|
+
- Keys come in document order, and a parent key in `selectedKeys` checks its subtree.
|
|
92
|
+
- `render` gets the real row index instead of `0`.
|
|
93
|
+
|
|
94
|
+
**NiceTreeView (`showCheckboxes` + `selectionMode="multiple"`):**
|
|
95
|
+
|
|
96
|
+
- A disabled node's checkbox is really disabled, and a parent's toggle leaves it alone.
|
|
97
|
+
- A parent no longer stays indeterminate with nothing checked.
|
|
98
|
+
- Parent keys come and go automatically, and lazily loaded children of a checked node arrive
|
|
99
|
+
checked.
|
|
100
|
+
- `node.expanded` now opens the node at mount when expansion is uncontrolled.
|
|
101
|
+
|
|
102
|
+
**ui-core:** `useTreeFocus` finds the visible items in one pass. A flat tree of ~2900 rows took a
|
|
103
|
+
minute in jsdom; it now takes a quarter of a second.
|
|
104
|
+
|
|
105
|
+
- Updated dependencies [f5f6251]
|
|
106
|
+
- Updated dependencies [df3a74d]
|
|
107
|
+
- @nice2dev/i18n@1.3.9
|
|
108
|
+
- @nice2dev/ui-core@1.3.9
|
|
109
|
+
|
|
3
110
|
## 1.3.8
|
|
4
111
|
|
|
5
112
|
### Patch Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),P=require("@nice2dev/ui-core"),k=require("react"),me=require("react-dom"),he=require("./devops-cgRBnZVX.cjs"),fe=["#ef4444","#f97316","#f59e0b","#84cc16","#10b981","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#ec4899","#64748b","#1e293b"];function ge(){return"#"+Math.floor(Math.random()*16777215).toString(16).padStart(6,"0")}function ve(a){const u=/^#?([0-9a-f]{6})$/i.exec(a.trim());if(!u)return{r:0,g:0,b:0};const h=parseInt(u[1],16);return{r:h>>16&255,g:h>>8&255,b:h&255}}function be(a,u,h){const p=r=>Math.max(0,Math.min(255,Math.round(r))).toString(16).padStart(2,"0");return`#${p(a)}${p(u)}${p(h)}`}function xe(a,u,h){const p=a/255,r=u/255,i=h/255,n=Math.max(p,r,i),b=Math.min(p,r,i),d=(n+b)/2;let o=0,c=0;if(n!==b){const _=n-b;switch(c=d>.5?_/(2-n-b):_/(n+b),n){case p:o=(r-i)/_+(r<i?6:0);break;case r:o=(i-p)/_+2;break;case i:o=(p-r)/_+4;break}o*=60}return{h:Math.round(o),s:Math.round(c*100),l:Math.round(d*100)}}function _e(a,u,h){const p=u/100,r=h/100,i=(1-Math.abs(2*r-1))*p,n=i*(1-Math.abs(a/60%2-1)),b=r-i/2;let d=0,o=0,c=0;return a<60?[d,o,c]=[i,n,0]:a<120?[d,o,c]=[n,i,0]:a<180?[d,o,c]=[0,i,n]:a<240?[d,o,c]=[0,n,i]:a<300?[d,o,c]=[n,0,i]:[d,o,c]=[i,0,n],{r:Math.round((d+b)*255),g:Math.round((o+b)*255),b:Math.round((c+b)*255)}}function ke(a,u,h){const p=a/255,r=u/255,i=h/255,n=Math.max(p,r,i),b=Math.min(p,r,i),d=n-b;let o=0;d!==0&&(n===p?o=(r-i)/d%6:n===r?o=(i-p)/d+2:o=(p-r)/d+4,o*=60,o<0&&(o+=360));const c=n===0?0:d/n;return{h:Math.round(o),s:Math.round(c*100),v:Math.round(n*100)}}function ye(a,u,h){const p=u/100,r=h/100,i=r*p,n=i*(1-Math.abs(a/60%2-1)),b=r-i;let d=0,o=0,c=0;return a<60?[d,o,c]=[i,n,0]:a<120?[d,o,c]=[n,i,0]:a<180?[d,o,c]=[0,i,n]:a<240?[d,o,c]=[0,n,i]:a<300?[d,o,c]=[n,0,i]:[d,o,c]=[i,0,n],{r:Math.round((d+b)*255),g:Math.round((o+b)*255),b:Math.round((c+b)*255)}}function Ne(a){let u=a.trim();const h=/var\([^,]+,\s*(#[0-9a-fA-F]{3,8})\s*\)/.exec(u);h&&(u=h[1]);const p=/^#?([0-9a-f]{3})$/i.exec(u);p&&(u=`#${p[1].split("").map(n=>n+n).join("")}`);const r=/^#?([0-9a-f]{6})$/i.exec(u),i=/^#?([0-9a-f]{8})$/i.exec(u);if(i){const n=i[1];return{r:parseInt(n.slice(0,2),16),g:parseInt(n.slice(2,4),16),b:parseInt(n.slice(4,6),16),a:parseInt(n.slice(6,8),16)/255}}if(r){const n=parseInt(r[1],16);return{r:n>>16&255,g:n>>8&255,b:n&255,a:1}}return{r:0,g:0,b:0,a:1}}function je(a,u,h,p,r){const i=b=>Math.max(0,Math.min(255,Math.round(b))).toString(16).padStart(2,"0"),n=`#${i(a)}${i(u)}${i(h)}`;return r?`${n}${i(p*255)}`:n}const Me=Object.assign(k.forwardRef(({label:a,helperText:u,error:h,required:p,disabled:r,id:i,className:n,style:b,accessMode:d,displayStyle:o,value:c="#3b82f6",onChange:_,presets:B=fe,showInput:X=!1,showRandom:Y=!1,withAlpha:S=!1,compact:I=!1,showKeyboardHints:J,size:Q="md",labelPlacement:Z,errorPlacement:L,labelWidth:T,controlWidth:D,loading:O},F)=>{const A=P.useNiceAccessMode(d,i),W=A==="hidden";(A==="disabled"||A==="readOnly")&&(r=!0);const{t:v}=P.useNiceTranslation(),$=P.useControlId(i);P.useComponentDisplayClass("input",o);const ee=k.useCallback(()=>{r||_?.(ge())},[r,_]),[M,C]=k.useState(!1),[q,re]=k.useState(null),[K,ne]=k.useState(""),U=k.useRef(null),E=k.useRef(null);k.useLayoutEffect(()=>{if(!M||!E.current)return;ne(he.scopeThemeClass(E.current));const m=()=>{const l=E.current?.getBoundingClientRect();if(!l)return;const N=280,w=360;let x=l.left,j=l.bottom+6;x+N>window.innerWidth-8&&(x=Math.max(8,window.innerWidth-N-8)),j+w>window.innerHeight-8&&(j=Math.max(8,l.top-w-6)),re({left:x,top:j})};return m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[M]),k.useEffect(()=>{if(!M)return;const m=l=>{const N=l.target;U.current?.contains(N)||E.current?.contains(N)||C(!1)};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[M]),P.useOverlayFocus(U,{open:M,modal:!1,onClose:()=>C(!1)});const V=k.useRef(null);P.useRovingFocus(V,{orientation:"grid",itemSelector:".nice-color-picker__preset",wrap:!0});const te=k.useMemo(()=>[{key:"Enter",description:v("shortcuts.openPicker","Open color picker")},{key:"Arrow keys",description:v("shortcuts.navigatePresets","Navigate presets")}],[v]);return W?null:t.jsxs("div",{className:`nice-field nice-field--${Q} ${Z==="left"?"nice-field--label-left":""} ${I?"nice-color-picker--compact":""} ${O?"nice-field--loading":""} ${n||""}`,style:{...b,...T!=null&&{"--nice-field-label-width":typeof T=="number"?`${T}px`:T},...D!=null&&{"--nice-field-control-width":typeof D=="number"?`${D}px`:D}},"aria-busy":O||void 0,children:[a&&t.jsxs("label",{htmlFor:$,className:`nice-field__label ${p?"nice-field__label--required":""}`,children:[a,J&&t.jsx(P.NiceKeyboardHint,{shortcuts:te,size:"sm"})]}),t.jsx("div",{className:"nice-field__control",children:t.jsxs("div",{className:"nice-color-picker",children:[t.jsxs("div",{className:"nice-color-picker__preview-row",children:[t.jsx("div",{ref:E,className:"nice-color-picker__swatch",id:$,style:{background:c},onClick:m=>{m.stopPropagation(),r||C(l=>!l)},onKeyDown:m=>{!r&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),C(l=>!l))},role:"button",tabIndex:r?-1:0,"aria-disabled":r||void 0,"aria-label":v("colorPicker.openPalette","Open color palette"),"aria-haspopup":"dialog","aria-expanded":M,children:t.jsx("input",{ref:m=>{typeof F=="function"?F(m):F&&(F.current=m)},type:"hidden",value:c,disabled:r,readOnly:!0})}),X&&t.jsx("div",{className:"nice-input nice-input--sm",style:I?{flex:1,minWidth:0}:{width:100},children:t.jsx("input",{className:"nice-input__native",type:"text",value:c,disabled:r,onChange:m=>_?.(m.target.value),maxLength:S?9:7,"aria-label":v("colorPicker.hexValue","Hex value")})}),Y&&!I&&t.jsx("button",{type:"button",className:"nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",onClick:ee,disabled:r,title:v("colorPicker.random","Random"),"aria-label":v("colorPicker.random","Random"),style:{fontSize:"0.65rem",textTransform:"uppercase",letterSpacing:"0.05em"},children:v("colorPicker.random","Random")}),O&&t.jsx("span",{className:"nice-field__spinner",children:t.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),L==="right"&&h&&t.jsx("div",{id:`${$}-error`,className:"nice-field__error",role:"alert",children:h}),L==="right"&&!h&&u&&t.jsx("div",{id:`${$}-helper`,className:"nice-field__helper",children:u})]}),M&&q&&typeof document<"u"&&me.createPortal(t.jsx("div",{ref:U,className:`nice-color-picker__popup nice-color-picker__popup--portal ${K}`,"data-theme":K==="nice-dark"?"dark":K==="nice-light"?"light":void 0,role:"dialog","aria-label":v("colorPicker.palette","Color palette"),style:{position:"fixed",left:q.left,top:q.top},onClick:m=>m.stopPropagation(),children:(()=>{const m=Ne(c),l={r:m.r,g:m.g,b:m.b},N=S?m.a:1,w=xe(l.r,l.g,l.b),x=ke(l.r,l.g,l.b),j=(e,f,g,s=N)=>_?.(je(e,f,g,s,S)),ie=(e,f,g)=>j(e,f,g),oe=(e,f,g)=>{const s=_e(e,f,g);j(s.r,s.g,s.b)},z=(e,f,g)=>{const s=ye(e,f,g);j(s.r,s.g,s.b)},G=e=>j(l.r,l.g,l.b,e),se=e=>{if(r)return;const f=e.currentTarget,g=y=>{const R=f.getBoundingClientRect(),le=Math.max(0,Math.min(R.width,y.clientX-R.left)),ue=Math.max(0,Math.min(R.height,y.clientY-R.top)),pe=Math.round(le/R.width*100),de=100-Math.round(ue/R.height*100);z(x.h,pe,de)};g(e);const s=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",s)};document.addEventListener("pointermove",g),document.addEventListener("pointerup",s)},ae=`hsl(${x.h}, 100%, 50%)`,ce=e=>{if(r)return;const f=e.shiftKey?10:1;let{s:g,v:s}=x;if(e.key==="ArrowLeft")g-=f;else if(e.key==="ArrowRight")g+=f;else if(e.key==="ArrowDown")s-=f;else if(e.key==="ArrowUp")s+=f;else if(e.key==="PageDown")s-=10;else if(e.key==="PageUp")s+=10;else if(e.key==="Home")g=0;else if(e.key==="End")g=100;else return;e.preventDefault(),z(x.h,Math.max(0,Math.min(100,g)),Math.max(0,Math.min(100,s)))},H={h:v("colorPicker.hue","Hue"),s:v("colorPicker.saturation","Saturation"),l:v("colorPicker.lightness","Lightness"),r:v("colorPicker.red","Red"),g:v("colorPicker.green","Green"),b:v("colorPicker.blue","Blue")};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"nice-color-picker__popup-header",children:t.jsx("input",{type:"text",className:"nice-input__native nice-color-picker__popup-hex",value:c,disabled:r,onChange:e=>_?.(e.target.value),maxLength:S?9:7,"aria-label":v("colorPicker.hexValue","Hex value")})}),t.jsx("input",{type:"range",min:0,max:360,value:x.h,disabled:r,onChange:e=>z(Number(e.target.value),x.s,x.v),className:"nice-color-picker__hue-slider","aria-label":v("colorPicker.hue","Hue")}),t.jsx("div",{className:"nice-color-picker__sv",style:{background:`linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${ae})`},onPointerDown:se,onKeyDown:ce,role:"slider",tabIndex:r?-1:0,"aria-label":v("colorPicker.svPalette","Saturation/value palette"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":x.s,"aria-valuetext":`${H.s} ${x.s}%, ${v("colorPicker.brightness","Brightness")} ${x.v}%`,children:t.jsx("span",{className:"nice-color-picker__sv-marker",style:{left:`${x.s}%`,top:`${100-x.v}%`}})}),t.jsxs("div",{className:"nice-color-picker__sliders",children:[t.jsx("div",{className:"nice-color-picker__slider-col",children:["h","s","l"].map(e=>{const f=e==="h"?360:100,g=w[e],s=y=>oe(e==="h"?y:w.h,e==="s"?y:w.s,e==="l"?y:w.l);return t.jsxs("div",{className:"nice-color-picker__slider-row",children:[t.jsx("label",{className:"nice-color-picker__slider-label",children:e.toUpperCase()}),t.jsx("input",{type:"range",min:0,max:f,value:g,disabled:r,onChange:y=>s(Number(y.target.value)),"aria-label":H[e]}),t.jsx("input",{type:"number",min:0,max:f,value:g,disabled:r,onChange:y=>s(Number(y.target.value)||0),className:"nice-input__native nice-color-picker__slider-num","aria-label":H[e]})]},e)})}),t.jsx("div",{className:"nice-color-picker__slider-col",children:["r","g","b"].map(e=>{const f=l[e],g=s=>ie(e==="r"?s:l.r,e==="g"?s:l.g,e==="b"?s:l.b);return t.jsxs("div",{className:"nice-color-picker__slider-row",children:[t.jsx("label",{className:"nice-color-picker__slider-label",children:e.toUpperCase()}),t.jsx("input",{type:"range",min:0,max:255,value:f,disabled:r,onChange:s=>g(Number(s.target.value)),"aria-label":H[e]}),t.jsx("input",{type:"number",min:0,max:255,value:f,disabled:r,onChange:s=>g(Number(s.target.value)||0),className:"nice-input__native nice-color-picker__slider-num","aria-label":H[e]})]},e)})})]}),S&&t.jsxs("div",{className:"nice-color-picker__alpha-row",children:[t.jsx("label",{className:"nice-color-picker__slider-label",children:"A"}),t.jsx("input",{type:"range",min:0,max:100,value:Math.round(N*100),disabled:r,onChange:e=>G(Number(e.target.value)/100),className:"nice-color-picker__alpha-slider",style:{background:`linear-gradient(to right, transparent, rgb(${l.r},${l.g},${l.b}))`},"aria-label":v("colorPicker.alpha","Alpha")}),t.jsx("input",{type:"number",min:0,max:100,value:Math.round(N*100),disabled:r,onChange:e=>G((Number(e.target.value)||0)/100),className:"nice-input__native nice-color-picker__slider-num","aria-label":v("colorPicker.alpha","Alpha")})]}),B.length>0&&t.jsx("div",{ref:V,className:"nice-color-picker__popup-presets",role:"group","aria-label":v("colorPicker.presets","Preset colors"),children:B.map(e=>t.jsx("div",{className:`nice-color-picker__preset ${c===e?"nice-color-picker__preset--active":""}`,style:{background:e},onClick:()=>{_?.(e),C(!1)},role:"button","aria-label":e,"aria-pressed":c===e,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),_?.(e),C(!1))}},e))})]})})()}),document.body)]})}),L!=="right"&&h&&t.jsx("div",{id:`${$}-error`,className:"nice-field__error",role:"alert",children:h}),L!=="right"&&!h&&u&&t.jsx("div",{id:`${$}-helper`,className:"nice-field__helper",children:u})]})}),{displayName:"NiceColorPicker"});exports.NiceColorPicker=Me;exports.hexToRgb=ve;exports.rgbToHex=be;
|