@nice2dev/social 1.1.10 → 1.2.1
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/README.md +11 -9
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +273 -272
- package/dist/style.css +1 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,112 @@
|
|
|
1
1
|
# @nice2dev/social — Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8c82c30: 1.2.1 — the decisions that waited since 1.2.0, and the debts the CI gates were holding. One API
|
|
8
|
+
change, agreed: `NiceIconSuggestorAI` suggests Nice icons only. Two stylesheets to import if you use
|
|
9
|
+
the packages: `@nice2dev/social/style.css`, `@nice2dev/ui-science/style.css`. Upgrade notes:
|
|
10
|
+
`documentation/omniverk/OMNIVERK_UPGRADE_1.2.1.md`.
|
|
11
|
+
|
|
12
|
+
**Tree-shaking.** An import from a package no longer brings the whole package. Module-level
|
|
13
|
+
statements that may have a side effect — a `displayName` assigned after each component (now
|
|
14
|
+
`Object.assign` inside `/* @__PURE__ */`, or under a development check for plain functions),
|
|
15
|
+
unannotated `forwardRef` / `memo` / `createContext` / icon-factory calls, spreads, registries filled
|
|
16
|
+
at import, `<style>` tags injected at import, a direct `eval` in ui-math — are gone. One import from
|
|
17
|
+
each of 53 packages: 5066.5 kB → 1171.6 kB (`@nice2dev/ui` 1928.2 kB → 12.9 kB, icon packs 48–275 kB
|
|
18
|
+
→ 1.6–2.6 kB). `defaultViewRegistry` has the Nice\* input controls from the start, each loading its
|
|
19
|
+
module on first render; sixteen controls add their styles to `<head>` on first render.
|
|
20
|
+
|
|
21
|
+
**Dead code.** 405 source files no entry point imported (never on npm) are deleted;
|
|
22
|
+
`NiceClipboardStack` (`@nice2dev/ui`) and `NiceSampleBrowser` (`@nice2dev/ui-audio`), finished and
|
|
23
|
+
documented, are exported.
|
|
24
|
+
|
|
25
|
+
**ui-mobile draws Nice icons.** New peer `@nice2dev/icons ^1.2.0`; `TabIcons`, `DrawerIcons`,
|
|
26
|
+
`HeaderIcons`, the `NiceSwipeActions` presets and the `NiceInfiniteScroll` states are `Ntd*` icons
|
|
27
|
+
instead of pasted `<svg>`, simple glyphs are CSS marks. `@nice2dev/icons` adds `NtdReply` and
|
|
28
|
+
`NtdInbox`; an icon no longer throws without `window.matchMedia`.
|
|
29
|
+
|
|
30
|
+
**`NiceIconSuggestorAI` (breaking, agreed).** `AIIconLibrary` is `'nice'`; `svgPath` and `unicode`
|
|
31
|
+
left `AISuggestedIcon`; the preview is a `<NiceIcon>`, "Copy SVG" is "Copy JSX".
|
|
32
|
+
|
|
33
|
+
**Peer ranges.** Every internal `@nice2dev/*` peer is `^1.2.0` (was as wide as `^1.0.20`), except
|
|
34
|
+
`@nice2dev/icons ^1.2.1` where a package draws an icon new in 1.2.1: ui-mobile (`NtdReply`,
|
|
35
|
+
`NtdInbox`), ui-audio (`NtdMicrophoneOff`) and ui-security (`NtdBackspace`). ui-security, licensing
|
|
36
|
+
(`^1.2.0`) and templates (`^1.2.0`) gain the `@nice2dev/icons` peer: their glyph icons (`⌫`, `←`,
|
|
37
|
+
`→`, `↑`, `↓`) are Nice icons now. `@nice2dev/icons` adds `NtdBackspace`.
|
|
38
|
+
|
|
39
|
+
**Class names inside components.** 834 class names in library stylesheets had no `nice-` prefix
|
|
40
|
+
(`.tab-button`, `.status-badge`, `.selected`, …) and styled every element of that name on the page.
|
|
41
|
+
They follow `nice-{block}__{element}--{modifier}` now — no change on screen. The class theme hooks
|
|
42
|
+
next to `[data-theme]` on seven controls (`dark` on the AI chart / data grid / code and HTML
|
|
43
|
+
editors / form builder, `light-theme` on `NiceMAM` and `NiceVideoAnnotator`) are `nice-dark` /
|
|
44
|
+
`nice-light`; `NiceLowPowerMode` marks `<html>` with `nice-lpm-no-animations` /
|
|
45
|
+
`nice-lpm-reduced-quality`; the `NiceVideoEditor` of `@nice2dev/ui-video` styles its elements under
|
|
46
|
+
`nice-video-studio`, so they no longer collide with the `NiceVideoEditor` of `@nice2dev/ui`.
|
|
47
|
+
Rules for classes nothing rendered are gone, among them the stylesheet of `NiceGanttChart`, which
|
|
48
|
+
left ui-erp in 1.0.10.
|
|
49
|
+
|
|
50
|
+
**Translations.** About 3,400 UI texts in 32 packages were hard-coded; they go through `t()` now,
|
|
51
|
+
with the English text unchanged and pl / de / fr / es / uk in `@nice2dev/i18n` (ui-diagrams,
|
|
52
|
+
ui-presentations and ui-math in their own dictionaries). In `@nice2dev/events` and
|
|
53
|
+
`@nice2dev/admin` that includes column headers, option labels and the statuses and roles they used
|
|
54
|
+
to print raw (`checked-in`, `no-show`) — English labels for those come from the dictionary. ui-3d and ui-graphics read the app's
|
|
55
|
+
global translator, as ui-audio does since 1.2.0 — their own provider overrides it. ui-audio's
|
|
56
|
+
controls used 631 keys the dictionary did not have (English in every language), and the radio
|
|
57
|
+
player showed raw keys (`search_stations`). Texts that were hard-coded **in Polish** — in
|
|
58
|
+
`NiceSidebarNav`, `NiceNetworkDiscoveryPanel`, the backup and smart-home controls,
|
|
59
|
+
`NiceSavedQueryPanel`, `NiceNotificationPreferences`, the ui-buildings panels, the ui-printing
|
|
60
|
+
template editor and the photo editor — default to English now; Polish is in the dictionary. English
|
|
61
|
+
plurals glued on (`result{s}`) are two keys. `presentationsTranslator(lang)` (ui-presentations)
|
|
62
|
+
translates outside its provider.
|
|
63
|
+
|
|
64
|
+
**List props are optional.** 170 list props (`items`, `columns`, `data`, …) in 15 packages that
|
|
65
|
+
were required without a default are optional, with a stable empty default; every one of those
|
|
66
|
+
controls mounts without data (tested). `NiceStockChart` without data no longer computes NaN
|
|
67
|
+
coordinates.
|
|
68
|
+
|
|
69
|
+
**Unstyled components get stylesheets.** 98 components rendered class names no stylesheet had —
|
|
70
|
+
admin panels, auth forms, events rounds and pickers, the ERP invoice / purchase order / VAT table /
|
|
71
|
+
HR dashboard, the radio player, `NiceInbox`, PWA prompts, `NiceViewRenderer`, shells, smart-home,
|
|
72
|
+
… The fixed layout that sat in inline style objects is in classes now, so an app can override it;
|
|
73
|
+
values that depend on data stay inline. **`@nice2dev/social` and `@nice2dev/ui-science` ship a
|
|
74
|
+
stylesheet — import `@nice2dev/social/style.css` / `@nice2dev/ui-science/style.css`.** ui-science's
|
|
75
|
+
`sideEffects` is `["*.css"]`. Colours, spacing and radii in every stylesheet come from theme tokens
|
|
76
|
+
(visible in dark themes: `NiceRecipe` difficulty badges, transcoder states, warehouse heat map).
|
|
77
|
+
|
|
78
|
+
**Icons only from Nice.** About 130 glyphs (`×`, `→`, `↑`) and 100 pasted `<svg>` used as icons
|
|
79
|
+
are Nice icons; 11 `<svg>` stay as the control's own graphic (logos, spinners, checkbox mark). `NiceIcon`
|
|
80
|
+
gains `pin`, `mic-off`, `log-out`, `chevrons-left`, `chevrons-right`, `zoom-in`, `zoom-out`,
|
|
81
|
+
`navigation`, `refresh-ccw`, `minimize` and `smartphone`; `@nice2dev/icons` gains
|
|
82
|
+
`NtdMicrophoneOff`. The `icon` fields of the module, menu, tab, mode, quick-action, scene and admin
|
|
83
|
+
widget DTOs, notification channels and view toolbar items are rendered through `NiceIcon` — they
|
|
84
|
+
used to be printed as text. `NiceRatings` `thumbs` draws shapes instead of emoji.
|
|
85
|
+
|
|
86
|
+
**Dialogs instead of `window.prompt` / `confirm` / `alert`.** New `useNiceDialogs()` — `prompt`,
|
|
87
|
+
`confirm` and `alert` as promises on `NicePromptDialog` / `NiceConfirmDialog` — and
|
|
88
|
+
`NiceConfirmDialog.showReject`. Seventeen controls asked through the browser's blocking dialogs and
|
|
89
|
+
use the library's now (`NiceFileManager`, `NiceHtmlEditor`, `NiceViewRenderer` action `confirm`, the 3D,
|
|
90
|
+
vector and pixel editors, …). Keys pressed in `NicePromptDialog` / `NiceConfirmDialog` no longer
|
|
91
|
+
reach the page's shortcuts (Escape still closes them), and `NicePromptDialog`'s backdrop covers the
|
|
92
|
+
whole viewport.
|
|
93
|
+
|
|
94
|
+
**Smaller fixes.** `NiceFileManager.items` is optional. `NiceMLStudio` status badges: `draft`,
|
|
95
|
+
`registered`, `archived`, `cancelled` get a neutral colour, deploying / stopped deployments theirs.
|
|
96
|
+
Component docs (`doc.json`) list only props the components have. `NiceMobileTabs`: tabs beyond
|
|
97
|
+
`maxTabs` open from "More" (it only logged). `NiceInventoryManager`: new `onCreatePurchaseOrder`;
|
|
98
|
+
without it the "Create PO" button is gone (it only logged). Keyboard: `NiceNavShell` tabs follow the
|
|
99
|
+
WAI-ARIA tabs pattern, clickable `NiceDeviceTile` / `NiceCardGroup` cards and animated icons with
|
|
100
|
+
`trigger="click"` are focusable. ui-math: `CalculatorService.evaluate` parses instead of running
|
|
101
|
+
`new Function` (`asin`, `sinh`, `ceil`, exponents and `angleUnit` were wrong); `ExpressionParser`
|
|
102
|
+
takes `functions`, `constants`, `ignoreCase` and `strict`, multiplies implicitly (`2x`) and reads `^`
|
|
103
|
+
right to left. `InvoiceLine.vatRate` and `VatRate.rate` are documented as fractions (0.23).
|
|
104
|
+
`AmqpServerBinding` is `Record<string, never>`.
|
|
105
|
+
|
|
106
|
+
## 1.2.0
|
|
107
|
+
|
|
108
|
+
No changes in this release.
|
|
109
|
+
|
|
3
110
|
## 1.1.10
|
|
4
111
|
|
|
5
112
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -18,20 +18,22 @@ npm install @nice2dev/social
|
|
|
18
18
|
|
|
19
19
|
## Components
|
|
20
20
|
|
|
21
|
-
| Component
|
|
22
|
-
|
|
23
|
-
| `NiceComments`
|
|
24
|
-
| `NiceRatings`
|
|
25
|
-
| `NiceSocialPanel`
|
|
26
|
-
| `NiceTagCloud`
|
|
27
|
-
| `NiceUserList`
|
|
28
|
-
| `NiceWiki`
|
|
29
|
-
| `NiceActivityFeed` | Chronological activity feed with grouping
|
|
21
|
+
| Component | Description |
|
|
22
|
+
| ------------------ | ------------------------------------------------------------ |
|
|
23
|
+
| `NiceComments` | Threaded comments with replies, reactions, and moderation |
|
|
24
|
+
| `NiceRatings` | Star/emoji/score ratings with aggregation display |
|
|
25
|
+
| `NiceSocialPanel` | Likes, shares, and bookmarks action panel |
|
|
26
|
+
| `NiceTagCloud` | Weighted tag cloud with click handling |
|
|
27
|
+
| `NiceUserList` | User list with avatars, online status, and filtering |
|
|
28
|
+
| `NiceWiki` | Wiki module with page tree sidebar and content viewer/editor |
|
|
29
|
+
| `NiceActivityFeed` | Chronological activity feed with grouping |
|
|
30
30
|
|
|
31
31
|
## Usage
|
|
32
32
|
|
|
33
33
|
```tsx
|
|
34
34
|
import { NiceComments, NiceRatings, NiceActivityFeed } from '@nice2dev/social';
|
|
35
|
+
// since 1.2.1 the components' styles ship as a stylesheet of their own
|
|
36
|
+
import '@nice2dev/social/style.css';
|
|
35
37
|
|
|
36
38
|
function CommunityPage({ entityId }) {
|
|
37
39
|
return (
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),U=l.forwardRef(function(u,M){const{comments:m,currentUserId:n,onSubmit:o,onEdit:_,onDelete:g,onReact:r,readOnly:b=!1,maxDepth:$=4,reactions:S=["👍","❤️","😂","😮","😢"],placeholder:N="Write a comment…",className:k,style:w}=u,[x,s]=l.useState(""),[h,v]=l.useState(null),[t,i]=l.useState(""),[c,a]=l.useState(null),[y,E]=l.useState(""),L=new Map;for(const d of m){const A=d.parentId??"__root__";L.has(A)||L.set(A,[]),L.get(A).push(d)}const R=l.useCallback(()=>{!x.trim()||!o||(o(x.trim()),s(""))},[x,o]),P=l.useCallback(()=>{!t.trim()||!o||!h||(o(t.trim(),h),i(""),v(null))},[t,h,o]),C=l.useCallback(()=>{!c||!y.trim()||!_||(_(c,y.trim()),a(null),E(""))},[c,y,_]),I=(d,A)=>{const F=n&&d.authorId===n,p=L.get(d.id)??[];return e.jsxs("div",{className:"nice-comments__item",style:{marginLeft:A*24},children:[e.jsxs("div",{className:"nice-comments__header",children:[d.authorAvatarUrl&&e.jsx("img",{src:d.authorAvatarUrl,alt:"",className:"nice-comments__avatar"}),e.jsx("strong",{className:"nice-comments__author",children:d.authorName}),e.jsx("time",{className:"nice-comments__time",children:d.createdAt}),d.isEdited&&e.jsx("span",{className:"nice-comments__edited",children:"(edited)"})]}),c===d.id?e.jsxs("div",{className:"nice-comments__edit-form",children:[e.jsx("textarea",{value:y,onChange:j=>E(j.target.value)}),e.jsx("button",{onClick:C,children:"Save"}),e.jsx("button",{onClick:()=>a(null),children:"Cancel"})]}):e.jsx("p",{className:"nice-comments__content",children:d.isDeleted?e.jsx("em",{children:"Comment deleted"}):d.content}),!d.isDeleted&&d.reactions&&e.jsx("div",{className:"nice-comments__reactions",children:Object.entries(d.reactions).map(([j,f])=>e.jsxs("button",{className:"nice-comments__reaction",onClick:()=>r==null?void 0:r(d.id,j),children:[j," ",f]},j))}),!d.isDeleted&&!b&&e.jsxs("div",{className:"nice-comments__actions",children:[r&&S.map(j=>e.jsx("button",{onClick:()=>r(d.id,j),title:j,children:j},j)),A<$&&e.jsx("button",{onClick:()=>{v(d.id),i("")},children:"Reply"}),F&&_&&e.jsx("button",{onClick:()=>{a(d.id),E(d.content)},children:"Edit"}),F&&g&&e.jsx("button",{onClick:()=>g(d.id),children:"Delete"})]}),h===d.id&&e.jsxs("div",{className:"nice-comments__reply-form",children:[e.jsx("textarea",{value:t,onChange:j=>i(j.target.value),placeholder:"Write a reply…"}),e.jsx("button",{onClick:P,disabled:!t.trim(),children:"Send"}),e.jsx("button",{onClick:()=>v(null),children:"Cancel"})]}),p.map(j=>I(j,A+1))]},d.id)},D=L.get("__root__")??[];return e.jsxs("div",{ref:M,className:`nice-comments ${k??""}`,style:w,children:[!b&&e.jsxs("div",{className:"nice-comments__new",children:[e.jsx("textarea",{value:x,onChange:d=>s(d.target.value),placeholder:N}),e.jsx("button",{onClick:R,disabled:!x.trim(),children:"Post"})]}),D.length===0?e.jsx("p",{className:"nice-comments__empty",children:"No comments yet."}):D.map(d=>I(d,0))]})}),z={star:"polygon(50% 2%, 62% 36%, 98% 37%, 69% 59%, 79% 94%, 50% 73%, 21% 94%, 31% 59%, 2% 37%, 38% 36%)",heart:"polygon(50% 92%, 12% 54%, 4% 40%, 4% 25%, 10% 13%, 22% 6%, 34% 6%, 44% 12%, 50% 21%, 56% 12%, 66% 6%, 78% 6%, 90% 13%, 96% 25%, 96% 40%, 88% 54%)",share:"polygon(42% 8%, 92% 8%, 92% 58%, 75% 41%, 27% 89%, 11% 73%, 59% 25%)"},O=({shape:T,filled:u=!0})=>e.jsx("span",{"aria-hidden":"true",className:`nice-social-shape nice-social-shape--${T}`,style:{display:"inline-block",width:"1em",height:"1em",verticalAlign:"-0.125em",background:"currentColor",clipPath:z[T],opacity:u?1:.35}}),B=l.forwardRef(function(u,M){const{value:m,max:n=5,mode:o="stars",aggregation:_,onChange:g,readOnly:r=!1,size:b="md",showValue:$=!1,label:S,emojiSet:N=["😢","😕","😐","🙂","😍"],className:k,style:w}=u,[x,s]=l.useState(null),h=x!==null?x+1:m??0,v=l.useCallback(c=>{r||!g||g(c+1)},[r,g]),t=()=>{const c=[];for(let a=0;a<n;a++){const y=a<h;let E;o==="emoji"?E=N[a]??N[N.length-1]:o==="hearts"?E=e.jsx(O,{shape:"heart",filled:y}):o==="thumbs"?E=y?"👍":"👎":E=e.jsx(O,{shape:"star",filled:y}),c.push(e.jsx("span",{className:`nice-ratings__symbol ${y?"nice-ratings__symbol--active":""}`,onClick:()=>v(a),onMouseEnter:()=>!r&&s(a),onMouseLeave:()=>!r&&s(null),role:r?void 0:"button",tabIndex:r?void 0:0,onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&v(a)},children:E},a))}return c},i=()=>e.jsxs("div",{className:"nice-ratings__numeric",children:[e.jsx("input",{type:"number",min:0,max:n,step:.5,value:m??0,onChange:c=>g==null?void 0:g(parseFloat(c.target.value)||0),readOnly:r,className:"nice-ratings__numeric-input"}),e.jsxs("span",{className:"nice-ratings__numeric-max",children:["/ ",n]})]});return e.jsxs("div",{ref:M,className:`nice-ratings nice-ratings--${b} nice-ratings--${o} ${r?"nice-ratings--readonly":""} ${k??""}`,style:w,children:[S&&e.jsx("span",{className:"nice-ratings__label",children:S}),e.jsxs("div",{className:"nice-ratings__body",children:[o==="numeric"?i():t(),$&&o!=="numeric"&&e.jsxs("span",{className:"nice-ratings__value",children:[h," / ",n]})]}),_&&e.jsxs("div",{className:"nice-ratings__aggregation",children:[e.jsx("span",{className:"nice-ratings__avg",children:_.average.toFixed(1)}),e.jsxs("span",{className:"nice-ratings__count",children:["(",_.count," ratings)"]}),_.distribution&&e.jsx("div",{className:"nice-ratings__distribution",children:Object.entries(_.distribution).sort(([c],[a])=>+a-+c).map(([c,a])=>e.jsxs("div",{className:"nice-ratings__distribution-row",children:[e.jsx("span",{children:c}),e.jsx("div",{className:"nice-ratings__bar",children:e.jsx("div",{className:"nice-ratings__bar-fill",style:{width:`${_.count?a/_.count*100:0}%`}})}),e.jsx("span",{children:a})]},c))})]})]})}),K=l.forwardRef(function(u,M){const{stats:m,userState:n,onLike:o,onShare:_,onBookmark:g,direction:r="horizontal",size:b="md",showCounts:$=!0,showLabels:S=!1,className:N,style:k}=u,w=l.useCallback(s=>s>=1e6?(s/1e6).toFixed(1)+"M":s>=1e3?(s/1e3).toFixed(1)+"K":s.toString(),[]),x=[{key:"like",shape:"heart",label:"Like",count:m.likes,isActive:(n==null?void 0:n.liked)??!1,onClick:o},{key:"share",shape:"share",label:"Share",count:m.shares,isActive:(n==null?void 0:n.shared)??!1,onClick:_},{key:"bookmark",shape:"star",label:"Bookmark",count:m.bookmarks,isActive:(n==null?void 0:n.bookmarked)??!1,onClick:g}];return e.jsx("div",{ref:M,className:`nice-social-panel nice-social-panel--${r} nice-social-panel--${b} ${N??""}`,style:k,children:x.map(s=>e.jsxs("button",{className:`nice-social-panel__btn nice-social-panel__btn--${s.key} ${s.isActive?"nice-social-panel__btn--active":""}`,onClick:s.onClick,title:s.label,"aria-label":s.label,"aria-pressed":s.isActive,children:[e.jsx("span",{className:"nice-social-panel__icon",children:e.jsx(O,{shape:s.shape,filled:s.isActive||s.shape==="share"})}),S&&e.jsx("span",{className:"nice-social-panel__label",children:s.label}),$&&e.jsx("span",{className:"nice-social-panel__count",children:w(s.count)})]},s.key))})}),H=l.forwardRef(function(u,M){const{tags:m,onTagClick:n,minFontSize:o=12,maxFontSize:_=36,sortBy:g="weight",maxTags:r,selectedIds:b,className:$,style:S}=u,N=l.useMemo(()=>{let s=[...m];if(g==="weight")s.sort((h,v)=>v.weight-h.weight);else if(g==="alphabetical")s.sort((h,v)=>h.label.localeCompare(v.label));else for(let h=s.length-1;h>0;h--){const v=Math.floor(Math.random()*(h+1));[s[h],s[v]]=[s[v],s[h]]}return r&&s.length>r&&(s=s.slice(0,r)),s},[m,g,r]),{minW:k,maxW:w}=l.useMemo(()=>{if(N.length===0)return{minW:0,maxW:1};const s=N.map(h=>h.weight);return{minW:Math.min(...s),maxW:Math.max(...s)}},[N]),x=s=>{if(w===k)return(o+_)/2;const h=(s-k)/(w-k);return o+h*(_-o)};return e.jsx("div",{ref:M,className:`nice-tag-cloud ${$??""}`,style:S,children:N.length===0?e.jsx("p",{className:"nice-tag-cloud__empty",children:"No tags."}):N.map(s=>{const h=b==null?void 0:b.includes(s.id),v=x(s.weight);return e.jsx("span",{className:`nice-tag-cloud__tag ${h?"nice-tag-cloud__tag--selected":""}`,style:{fontSize:v,color:s.color,cursor:n?"pointer":void 0},onClick:()=>n==null?void 0:n(s),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&n&&n(s)},title:`${s.label} (${s.weight})`,children:s.label},s.id)})})}),q={online:"#22c55e",away:"#eab308",busy:"#ef4444",offline:"#9ca3af"},V=l.forwardRef(function(u,M){const{users:m,onUserClick:n,onAction:o,actions:_=[],searchable:g=!1,statusFilter:r,showStatus:b=!0,layout:$="list",groupByRole:S=!1,className:N,style:k}=u,[w,x]=l.useState(""),s=l.useMemo(()=>{let t=m;if(r&&r.length>0&&(t=t.filter(i=>i.status&&r.includes(i.status))),w.trim()){const i=w.toLowerCase();t=t.filter(c=>{var a,y;return c.name.toLowerCase().includes(i)||((a=c.email)==null?void 0:a.toLowerCase().includes(i))||((y=c.role)==null?void 0:y.toLowerCase().includes(i))})}return t},[m,r,w]),h=l.useMemo(()=>{if(!S)return{"":s};const t={};for(const i of s){const c=i.role??"Other";t[c]||(t[c]=[]),t[c].push(i)}return t},[s,S]),v=t=>e.jsxs("div",{className:`nice-user-list__item nice-user-list__item--${$}`,onClick:()=>n==null?void 0:n(t),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:i=>{i.key==="Enter"&&n&&n(t)},children:[e.jsxs("div",{className:"nice-user-list__avatar-wrap",children:[t.avatarUrl?e.jsx("img",{src:t.avatarUrl,alt:t.name,className:"nice-user-list__avatar"}):e.jsx("span",{className:"nice-user-list__avatar-placeholder",children:t.name.charAt(0).toUpperCase()}),b&&t.status&&e.jsx("span",{className:"nice-user-list__status-dot",style:{backgroundColor:q[t.status]},title:t.status})]}),e.jsxs("div",{className:"nice-user-list__info",children:[e.jsx("span",{className:"nice-user-list__name",children:t.name}),t.email&&e.jsx("span",{className:"nice-user-list__email",children:t.email}),t.role&&e.jsx("span",{className:"nice-user-list__role",children:t.role})]}),_.length>0&&e.jsx("div",{className:"nice-user-list__actions",children:_.map(i=>e.jsx("button",{className:"nice-user-list__action-btn",onClick:c=>{c.stopPropagation(),o==null||o(t,i)},children:i},i))})]},t.id);return e.jsxs("div",{ref:M,className:`nice-user-list nice-user-list--${$} ${N??""}`,style:k,children:[g&&e.jsx("input",{type:"text",value:w,onChange:t=>x(t.target.value),placeholder:"Search users…",className:"nice-user-list__search"}),s.length===0?e.jsx("p",{className:"nice-user-list__empty",children:"No users found."}):Object.entries(h).map(([t,i])=>e.jsxs("div",{className:"nice-user-list__group",children:[S&&t&&e.jsxs("h4",{className:"nice-user-list__group-title",children:[t," (",i.length,")"]}),i.map(v)]},t))]})});function Y(T){if(!T)return"";let u=T;return u=u.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,""),u=u.replace(/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,""),u=u.replace(/(href|src|action)\s*=\s*(?:"javascript:[^"]*"|'javascript:[^']*')/gi,'$1=""'),u=u.replace(/(href|src|action)\s*=\s*(?:"vbscript:[^"]*"|'vbscript:[^']*')/gi,'$1=""'),u=u.replace(/<\/?(iframe|object|embed|form)\b[^>]*>/gi,""),u}const G=l.forwardRef(function(u,M){const{pages:m,selectedPageId:n,onSelectPage:o,onSavePage:_,onDeletePage:g,onCreatePage:r,editable:b=!1,searchable:$=!0,renderHtml:S=!1,sidebarWidth:N=260,className:k,style:w}=u,[x,s]=l.useState(""),[h,v]=l.useState(!1),[t,i]=l.useState(""),[c,a]=l.useState(""),[y,E]=l.useState(""),[L,R]=l.useState(!1),P=l.useMemo(()=>{if(m.some(f=>f.children&&f.children.length>0))return m.filter(f=>!f.parentId);const p=new Map;for(const f of m)p.set(f.id,{...f,children:[]});const j=[];for(const f of p.values())f.parentId&&p.has(f.parentId)?p.get(f.parentId).children.push(f):j.push(f);return j},[m]),C=l.useMemo(()=>m.find(p=>p.id===n),[m,n]),I=l.useMemo(()=>{if(!x.trim())return P;const p=x.toLowerCase(),j=new Set(m.filter(f=>f.title.toLowerCase().includes(p)).map(f=>f.id));return m.filter(f=>j.has(f.id))},[P,m,x]),D=l.useCallback(()=>{C&&(i(C.title),a(C.content??""),v(!0))},[C]),d=l.useCallback(()=>{!C||!_||(_(C.id,c,t),v(!1))},[C,c,t,_]),A=l.useCallback(()=>{!y.trim()||!r||(r(n??null,y.trim()),E(""),R(!1))},[y,n,r]),F=(p,j=0)=>{var f;return e.jsxs("div",{children:[e.jsx("div",{className:`nice-wiki__page-item ${p.id===n?"nice-wiki__page-item--active":""}`,style:{paddingLeft:12+j*16},onClick:()=>o==null?void 0:o(p),role:"button",tabIndex:0,onKeyDown:W=>{W.key==="Enter"&&(o==null||o(p))},children:p.title}),(f=p.children)==null?void 0:f.map(W=>F(W,j+1))]},p.id)};return e.jsxs("div",{ref:M,className:`nice-wiki ${k??""}`,style:{display:"flex",...w},children:[e.jsxs("div",{className:"nice-wiki__sidebar",style:{width:N,minWidth:N},children:[e.jsxs("div",{className:"nice-wiki__sidebar-header",children:[e.jsx("strong",{children:"Wiki"}),b&&r&&e.jsx("button",{onClick:()=>R(!L),title:"New page",children:"+"})]}),L&&e.jsxs("div",{className:"nice-wiki__new-page",children:[e.jsx("input",{type:"text",value:y,onChange:p=>E(p.target.value),placeholder:"New page title"}),e.jsx("button",{onClick:A,disabled:!y.trim(),children:"Create"})]}),$&&e.jsx("input",{type:"text",className:"nice-wiki__search",value:x,onChange:p=>s(p.target.value),placeholder:"Search pages…"}),e.jsx("div",{className:"nice-wiki__tree",children:I.length===0?e.jsx("p",{className:"nice-wiki__empty",children:"No pages."}):I.map(p=>F(p))})]}),e.jsx("div",{className:"nice-wiki__content",children:C?h?e.jsxs("div",{className:"nice-wiki__editor",children:[e.jsx("input",{type:"text",className:"nice-wiki__edit-title",value:t,onChange:p=>i(p.target.value)}),e.jsx("textarea",{className:"nice-wiki__edit-body",value:c,onChange:p=>a(p.target.value),rows:20}),e.jsxs("div",{className:"nice-wiki__edit-actions",children:[e.jsx("button",{onClick:d,children:"Save"}),e.jsx("button",{onClick:()=>v(!1),children:"Cancel"})]})]}):e.jsxs("div",{className:"nice-wiki__viewer",children:[e.jsxs("div",{className:"nice-wiki__viewer-header",children:[e.jsx("h2",{children:C.title}),e.jsxs("div",{className:"nice-wiki__viewer-meta",children:[C.lastEditedBy&&e.jsxs("span",{children:["Edited by ",C.lastEditedBy]}),C.lastEditedAt&&e.jsxs("span",{children:[" on ",C.lastEditedAt]})]}),b&&e.jsxs("div",{className:"nice-wiki__viewer-actions",children:[e.jsx("button",{onClick:D,children:"Edit"}),g&&e.jsx("button",{onClick:()=>g(C.id),children:"Delete"})]})]}),S?e.jsx("div",{className:"nice-wiki__viewer-body",dangerouslySetInnerHTML:{__html:Y(C.content??"")}}):e.jsx("div",{className:"nice-wiki__viewer-body",children:C.content??e.jsx("em",{children:"No content."})})]}):e.jsx("div",{className:"nice-wiki__placeholder",children:"Select a page from the sidebar."})})]})}),J={comment:"var(--nice-color-primary, #3b82f6)",like:"var(--nice-color-error, #ef4444)",share:"var(--nice-color-info, #0ea5e9)",create:"var(--nice-color-success, #22c55e)",update:"var(--nice-color-warning, #f59e0b)",delete:"var(--nice-color-error, #ef4444)",join:"var(--nice-color-success, #22c55e)",leave:"var(--nice-text-muted, #6b7280)",upload:"var(--nice-color-accent, #8b5cf6)",mention:"var(--nice-color-primary, #3b82f6)",custom:"var(--nice-text-muted, #6b7280)"},Q=l.forwardRef(function(u,M){const{events:m,onEventClick:n,groupByDate:o=!0,typeFilter:_,showFilters:g=!1,maxEvents:r,onLoadMore:b,hasMore:$=!1,className:S,style:N}=u,[k,w]=l.useState(new Set),x=_??(k.size>0?Array.from(k):void 0),s=l.useMemo(()=>{let i=m;if(x&&x.length>0){const c=new Set(x);i=i.filter(a=>c.has(a.type))}return r&&(i=i.slice(0,r)),i},[m,x,r]),h=l.useMemo(()=>{if(!o)return[{label:"",events:s}];const i=new Map;for(const c of s){const a=c.timestamp.slice(0,10);i.has(a)||i.set(a,[]),i.get(a).push(c)}return Array.from(i.entries()).map(([c,a])=>({label:c,events:a}))},[s,o]),v=l.useMemo(()=>{const i=new Set(m.map(c=>c.type));return Array.from(i).sort()},[m]),t=i=>{w(c=>{const a=new Set(c);return a.has(i)?a.delete(i):a.add(i),a})};return e.jsxs("div",{ref:M,className:`nice-activity-feed ${S??""}`,style:N,children:[g&&!_&&e.jsxs("div",{className:"nice-activity-feed__filters",children:[v.map(i=>e.jsx("button",{className:`nice-activity-feed__filter-chip ${k.has(i)?"nice-activity-feed__filter-chip--active":""}`,onClick:()=>t(i),children:i},i)),k.size>0&&e.jsx("button",{className:"nice-activity-feed__filter-clear",onClick:()=>w(new Set),children:"Clear"})]}),s.length===0?e.jsx("p",{className:"nice-activity-feed__empty",children:"No activity."}):h.map(({label:i,events:c})=>e.jsxs("div",{className:"nice-activity-feed__group",children:[o&&i&&e.jsx("div",{className:"nice-activity-feed__date-label",children:i}),c.map(a=>e.jsxs("div",{className:"nice-activity-feed__event",onClick:()=>n==null?void 0:n(a),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:y=>{y.key==="Enter"&&n&&n(a)},children:[e.jsx("span",{className:`nice-activity-feed__icon nice-activity-feed__icon--${a.type}`,title:a.type,"aria-hidden":"true",style:{display:"inline-block",width:10,height:10,marginTop:4,flexShrink:0,borderRadius:"50%",background:J[a.type]}}),e.jsxs("div",{className:"nice-activity-feed__body",children:[a.actorAvatarUrl&&e.jsx("img",{src:a.actorAvatarUrl,alt:"",className:"nice-activity-feed__avatar"}),e.jsxs("span",{className:"nice-activity-feed__message",children:[e.jsx("strong",{children:a.actorName})," ",a.message,a.targetLabel&&e.jsxs(e.Fragment,{children:[" ",e.jsx("em",{children:a.targetLabel})]})]}),e.jsx("time",{className:"nice-activity-feed__time",children:a.timestamp})]})]},a.id))]},i||"__all")),$&&b&&e.jsx("button",{className:"nice-activity-feed__load-more",onClick:b,children:"Load more"})]})});exports.NiceActivityFeed=Q;exports.NiceComments=U;exports.NiceRatings=B;exports.NiceSocialPanel=K;exports.NiceTagCloud=H;exports.NiceUserList=V;exports.NiceWiki=G;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),U=l.forwardRef(function(u,M){const{comments:m,currentUserId:n,onSubmit:o,onEdit:_,onDelete:g,onReact:r,readOnly:b=!1,maxDepth:$=4,reactions:S=["👍","❤️","😂","😮","😢"],placeholder:y="Write a comment…",className:k,style:w}=u,[x,s]=l.useState(""),[h,v]=l.useState(null),[t,i]=l.useState(""),[c,a]=l.useState(null),[N,L]=l.useState(""),T=new Map;for(const d of m){const A=d.parentId??"__root__";T.has(A)||T.set(A,[]),T.get(A).push(d)}const P=l.useCallback(()=>{!x.trim()||!o||(o(x.trim()),s(""))},[x,o]),R=l.useCallback(()=>{!t.trim()||!o||!h||(o(t.trim(),h),i(""),v(null))},[t,h,o]),C=l.useCallback(()=>{!c||!N.trim()||!_||(_(c,N.trim()),a(null),L(""))},[c,N,_]),I=(d,A)=>{const F=n&&d.authorId===n,p=T.get(d.id)??[];return e.jsxs("div",{className:"nice-comments__item",style:{marginLeft:A*24},children:[e.jsxs("div",{className:"nice-comments__header",children:[d.authorAvatarUrl&&e.jsx("img",{src:d.authorAvatarUrl,alt:"",className:"nice-comments__avatar"}),e.jsx("strong",{className:"nice-comments__author",children:d.authorName}),e.jsx("time",{className:"nice-comments__time",children:d.createdAt}),d.isEdited&&e.jsx("span",{className:"nice-comments__edited",children:"(edited)"})]}),c===d.id?e.jsxs("div",{className:"nice-comments__edit-form",children:[e.jsx("textarea",{value:N,onChange:j=>L(j.target.value)}),e.jsx("button",{onClick:C,children:"Save"}),e.jsx("button",{onClick:()=>a(null),children:"Cancel"})]}):e.jsx("p",{className:"nice-comments__content",children:d.isDeleted?e.jsx("em",{children:"Comment deleted"}):d.content}),!d.isDeleted&&d.reactions&&e.jsx("div",{className:"nice-comments__reactions",children:Object.entries(d.reactions).map(([j,f])=>e.jsxs("button",{className:"nice-comments__reaction",onClick:()=>r==null?void 0:r(d.id,j),children:[j," ",f]},j))}),!d.isDeleted&&!b&&e.jsxs("div",{className:"nice-comments__actions",children:[r&&S.map(j=>e.jsx("button",{onClick:()=>r(d.id,j),title:j,children:j},j)),A<$&&e.jsx("button",{onClick:()=>{v(d.id),i("")},children:"Reply"}),F&&_&&e.jsx("button",{onClick:()=>{a(d.id),L(d.content)},children:"Edit"}),F&&g&&e.jsx("button",{onClick:()=>g(d.id),children:"Delete"})]}),h===d.id&&e.jsxs("div",{className:"nice-comments__reply-form",children:[e.jsx("textarea",{value:t,onChange:j=>i(j.target.value),placeholder:"Write a reply…"}),e.jsx("button",{onClick:R,disabled:!t.trim(),children:"Send"}),e.jsx("button",{onClick:()=>v(null),children:"Cancel"})]}),p.map(j=>I(j,A+1))]},d.id)},D=T.get("__root__")??[];return e.jsxs("div",{ref:M,className:`nice-comments ${k??""}`,style:w,children:[!b&&e.jsxs("div",{className:"nice-comments__new",children:[e.jsx("textarea",{value:x,onChange:d=>s(d.target.value),placeholder:y}),e.jsx("button",{onClick:P,disabled:!x.trim(),children:"Post"})]}),D.length===0?e.jsx("p",{className:"nice-comments__empty",children:"No comments yet."}):D.map(d=>I(d,0))]})}),z={star:"polygon(50% 2%, 62% 36%, 98% 37%, 69% 59%, 79% 94%, 50% 73%, 21% 94%, 31% 59%, 2% 37%, 38% 36%)",heart:"polygon(50% 92%, 12% 54%, 4% 40%, 4% 25%, 10% 13%, 22% 6%, 34% 6%, 44% 12%, 50% 21%, 56% 12%, 66% 6%, 78% 6%, 90% 13%, 96% 25%, 96% 40%, 88% 54%)",share:"polygon(42% 8%, 92% 8%, 92% 58%, 75% 41%, 27% 89%, 11% 73%, 59% 25%)",thumb:"polygon(6% 46%, 24% 46%, 24% 40%, 40% 36%, 50% 8%, 58% 6%, 64% 12%, 62% 36%, 88% 38%, 94% 46%, 90% 56%, 94% 64%, 90% 74%, 92% 82%, 86% 92%, 24% 92%, 24% 90%, 6% 90%)","thumb-down":"polygon(6% 54%, 24% 54%, 24% 60%, 40% 64%, 50% 92%, 58% 94%, 64% 88%, 62% 64%, 88% 62%, 94% 54%, 90% 44%, 94% 36%, 90% 26%, 92% 18%, 86% 8%, 24% 8%, 24% 10%, 6% 10%)"},W=({shape:E,filled:u=!0})=>e.jsx("span",{"aria-hidden":"true",className:`nice-social-shape nice-social-shape--${E}`,style:{display:"inline-block",width:"1em",height:"1em",verticalAlign:"-0.125em",background:"currentColor",clipPath:z[E],opacity:u?1:.35}}),B=l.forwardRef(function(u,M){const{value:m,max:n=5,mode:o="stars",aggregation:_,onChange:g,readOnly:r=!1,size:b="md",showValue:$=!1,label:S,emojiSet:y=["😢","😕","😐","🙂","😍"],className:k,style:w}=u,[x,s]=l.useState(null),h=x!==null?x+1:m??0,v=l.useCallback(c=>{r||!g||g(c+1)},[r,g]),t=()=>{const c=[];for(let a=0;a<n;a++){const N=a<h;let L;o==="emoji"?L=y[a]??y[y.length-1]:o==="hearts"?L=e.jsx(W,{shape:"heart",filled:N}):o==="thumbs"?L=e.jsx(W,{shape:N?"thumb":"thumb-down",filled:N}):L=e.jsx(W,{shape:"star",filled:N}),c.push(e.jsx("span",{className:`nice-ratings__symbol ${N?"nice-ratings__symbol--active":""}`,onClick:()=>v(a),onMouseEnter:()=>!r&&s(a),onMouseLeave:()=>!r&&s(null),role:r?void 0:"button",tabIndex:r?void 0:0,onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&v(a)},children:L},a))}return c},i=()=>e.jsxs("div",{className:"nice-ratings__numeric",children:[e.jsx("input",{type:"number",min:0,max:n,step:.5,value:m??0,onChange:c=>g==null?void 0:g(parseFloat(c.target.value)||0),readOnly:r,className:"nice-ratings__numeric-input"}),e.jsxs("span",{className:"nice-ratings__numeric-max",children:["/ ",n]})]});return e.jsxs("div",{ref:M,className:`nice-ratings nice-ratings--${b} nice-ratings--${o} ${r?"nice-ratings--readonly":""} ${k??""}`,style:w,children:[S&&e.jsx("span",{className:"nice-ratings__label",children:S}),e.jsxs("div",{className:"nice-ratings__body",children:[o==="numeric"?i():t(),$&&o!=="numeric"&&e.jsxs("span",{className:"nice-ratings__value",children:[h," / ",n]})]}),_&&e.jsxs("div",{className:"nice-ratings__aggregation",children:[e.jsx("span",{className:"nice-ratings__avg",children:_.average.toFixed(1)}),e.jsxs("span",{className:"nice-ratings__count",children:["(",_.count," ratings)"]}),_.distribution&&e.jsx("div",{className:"nice-ratings__distribution",children:Object.entries(_.distribution).sort(([c],[a])=>+a-+c).map(([c,a])=>e.jsxs("div",{className:"nice-ratings__distribution-row",children:[e.jsx("span",{children:c}),e.jsx("div",{className:"nice-ratings__bar",children:e.jsx("div",{className:"nice-ratings__bar-fill",style:{width:`${_.count?a/_.count*100:0}%`}})}),e.jsx("span",{children:a})]},c))})]})]})}),K=l.forwardRef(function(u,M){const{stats:m,userState:n,onLike:o,onShare:_,onBookmark:g,direction:r="horizontal",size:b="md",showCounts:$=!0,showLabels:S=!1,className:y,style:k}=u,w=l.useCallback(s=>s>=1e6?(s/1e6).toFixed(1)+"M":s>=1e3?(s/1e3).toFixed(1)+"K":s.toString(),[]),x=[{key:"like",shape:"heart",label:"Like",count:m.likes,isActive:(n==null?void 0:n.liked)??!1,onClick:o},{key:"share",shape:"share",label:"Share",count:m.shares,isActive:(n==null?void 0:n.shared)??!1,onClick:_},{key:"bookmark",shape:"star",label:"Bookmark",count:m.bookmarks,isActive:(n==null?void 0:n.bookmarked)??!1,onClick:g}];return e.jsx("div",{ref:M,className:`nice-social-panel nice-social-panel--${r} nice-social-panel--${b} ${y??""}`,style:k,children:x.map(s=>e.jsxs("button",{className:`nice-social-panel__btn nice-social-panel__btn--${s.key} ${s.isActive?"nice-social-panel__btn--active":""}`,onClick:s.onClick,title:s.label,"aria-label":s.label,"aria-pressed":s.isActive,children:[e.jsx("span",{className:"nice-social-panel__icon",children:e.jsx(W,{shape:s.shape,filled:s.isActive||s.shape==="share"})}),S&&e.jsx("span",{className:"nice-social-panel__label",children:s.label}),$&&e.jsx("span",{className:"nice-social-panel__count",children:w(s.count)})]},s.key))})}),H=l.forwardRef(function(u,M){const{tags:m,onTagClick:n,minFontSize:o=12,maxFontSize:_=36,sortBy:g="weight",maxTags:r,selectedIds:b,className:$,style:S}=u,y=l.useMemo(()=>{let s=[...m];if(g==="weight")s.sort((h,v)=>v.weight-h.weight);else if(g==="alphabetical")s.sort((h,v)=>h.label.localeCompare(v.label));else for(let h=s.length-1;h>0;h--){const v=Math.floor(Math.random()*(h+1));[s[h],s[v]]=[s[v],s[h]]}return r&&s.length>r&&(s=s.slice(0,r)),s},[m,g,r]),{minW:k,maxW:w}=l.useMemo(()=>{if(y.length===0)return{minW:0,maxW:1};const s=y.map(h=>h.weight);return{minW:Math.min(...s),maxW:Math.max(...s)}},[y]),x=s=>{if(w===k)return(o+_)/2;const h=(s-k)/(w-k);return o+h*(_-o)};return e.jsx("div",{ref:M,className:`nice-tag-cloud ${$??""}`,style:S,children:y.length===0?e.jsx("p",{className:"nice-tag-cloud__empty",children:"No tags."}):y.map(s=>{const h=b==null?void 0:b.includes(s.id),v=x(s.weight);return e.jsx("span",{className:`nice-tag-cloud__tag ${h?"nice-tag-cloud__tag--selected":""}`,style:{fontSize:v,color:s.color},onClick:()=>n==null?void 0:n(s),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&n&&n(s)},title:`${s.label} (${s.weight})`,children:s.label},s.id)})})}),q={online:"#22c55e",away:"#eab308",busy:"#ef4444",offline:"#9ca3af"},V=l.forwardRef(function(u,M){const{users:m,onUserClick:n,onAction:o,actions:_=[],searchable:g=!1,statusFilter:r,showStatus:b=!0,layout:$="list",groupByRole:S=!1,className:y,style:k}=u,[w,x]=l.useState(""),s=l.useMemo(()=>{let t=m;if(r&&r.length>0&&(t=t.filter(i=>i.status&&r.includes(i.status))),w.trim()){const i=w.toLowerCase();t=t.filter(c=>{var a,N;return c.name.toLowerCase().includes(i)||((a=c.email)==null?void 0:a.toLowerCase().includes(i))||((N=c.role)==null?void 0:N.toLowerCase().includes(i))})}return t},[m,r,w]),h=l.useMemo(()=>{if(!S)return{"":s};const t={};for(const i of s){const c=i.role??"Other";t[c]||(t[c]=[]),t[c].push(i)}return t},[s,S]),v=t=>e.jsxs("div",{className:`nice-user-list__item nice-user-list__item--${$}`,onClick:()=>n==null?void 0:n(t),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:i=>{i.key==="Enter"&&n&&n(t)},children:[e.jsxs("div",{className:"nice-user-list__avatar-wrap",children:[t.avatarUrl?e.jsx("img",{src:t.avatarUrl,alt:t.name,className:"nice-user-list__avatar"}):e.jsx("span",{className:"nice-user-list__avatar-placeholder",children:t.name.charAt(0).toUpperCase()}),b&&t.status&&e.jsx("span",{className:"nice-user-list__status-dot",style:{backgroundColor:q[t.status]},title:t.status})]}),e.jsxs("div",{className:"nice-user-list__info",children:[e.jsx("span",{className:"nice-user-list__name",children:t.name}),t.email&&e.jsx("span",{className:"nice-user-list__email",children:t.email}),t.role&&e.jsx("span",{className:"nice-user-list__role",children:t.role})]}),_.length>0&&e.jsx("div",{className:"nice-user-list__actions",children:_.map(i=>e.jsx("button",{className:"nice-user-list__action-btn",onClick:c=>{c.stopPropagation(),o==null||o(t,i)},children:i},i))})]},t.id);return e.jsxs("div",{ref:M,className:`nice-user-list nice-user-list--${$} ${y??""}`,style:k,children:[g&&e.jsx("input",{type:"text",value:w,onChange:t=>x(t.target.value),placeholder:"Search users…",className:"nice-user-list__search"}),s.length===0?e.jsx("p",{className:"nice-user-list__empty",children:"No users found."}):Object.entries(h).map(([t,i])=>e.jsxs("div",{className:"nice-user-list__group",children:[S&&t&&e.jsxs("h4",{className:"nice-user-list__group-title",children:[t," (",i.length,")"]}),i.map(v)]},t))]})});function Y(E){if(!E)return"";let u=E;return u=u.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,""),u=u.replace(/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,""),u=u.replace(/(href|src|action)\s*=\s*(?:"javascript:[^"]*"|'javascript:[^']*')/gi,'$1=""'),u=u.replace(/(href|src|action)\s*=\s*(?:"vbscript:[^"]*"|'vbscript:[^']*')/gi,'$1=""'),u=u.replace(/<\/?(iframe|object|embed|form)\b[^>]*>/gi,""),u}const G=l.forwardRef(function(u,M){const{pages:m,selectedPageId:n,onSelectPage:o,onSavePage:_,onDeletePage:g,onCreatePage:r,editable:b=!1,searchable:$=!0,renderHtml:S=!1,sidebarWidth:y=260,className:k,style:w}=u,[x,s]=l.useState(""),[h,v]=l.useState(!1),[t,i]=l.useState(""),[c,a]=l.useState(""),[N,L]=l.useState(""),[T,P]=l.useState(!1),R=l.useMemo(()=>{if(m.some(f=>f.children&&f.children.length>0))return m.filter(f=>!f.parentId);const p=new Map;for(const f of m)p.set(f.id,{...f,children:[]});const j=[];for(const f of p.values())f.parentId&&p.has(f.parentId)?p.get(f.parentId).children.push(f):j.push(f);return j},[m]),C=l.useMemo(()=>m.find(p=>p.id===n),[m,n]),I=l.useMemo(()=>{if(!x.trim())return R;const p=x.toLowerCase(),j=new Set(m.filter(f=>f.title.toLowerCase().includes(p)).map(f=>f.id));return m.filter(f=>j.has(f.id))},[R,m,x]),D=l.useCallback(()=>{C&&(i(C.title),a(C.content??""),v(!0))},[C]),d=l.useCallback(()=>{!C||!_||(_(C.id,c,t),v(!1))},[C,c,t,_]),A=l.useCallback(()=>{!N.trim()||!r||(r(n??null,N.trim()),L(""),P(!1))},[N,n,r]),F=(p,j=0)=>{var f;return e.jsxs("div",{children:[e.jsx("div",{className:`nice-wiki__page-item ${p.id===n?"nice-wiki__page-item--active":""}`,style:{paddingLeft:12+j*16},onClick:()=>o==null?void 0:o(p),role:"button",tabIndex:0,onKeyDown:O=>{O.key==="Enter"&&(o==null||o(p))},children:p.title}),(f=p.children)==null?void 0:f.map(O=>F(O,j+1))]},p.id)};return e.jsxs("div",{ref:M,className:`nice-wiki ${k??""}`,style:{display:"flex",...w},children:[e.jsxs("div",{className:"nice-wiki__sidebar",style:{width:y,minWidth:y},children:[e.jsxs("div",{className:"nice-wiki__sidebar-header",children:[e.jsx("strong",{children:"Wiki"}),b&&r&&e.jsx("button",{onClick:()=>P(!T),title:"New page",children:"+"})]}),T&&e.jsxs("div",{className:"nice-wiki__new-page",children:[e.jsx("input",{type:"text",value:N,onChange:p=>L(p.target.value),placeholder:"New page title"}),e.jsx("button",{onClick:A,disabled:!N.trim(),children:"Create"})]}),$&&e.jsx("input",{type:"text",className:"nice-wiki__search",value:x,onChange:p=>s(p.target.value),placeholder:"Search pages…"}),e.jsx("div",{className:"nice-wiki__tree",children:I.length===0?e.jsx("p",{className:"nice-wiki__empty",children:"No pages."}):I.map(p=>F(p))})]}),e.jsx("div",{className:"nice-wiki__content",children:C?h?e.jsxs("div",{className:"nice-wiki__editor",children:[e.jsx("input",{type:"text",className:"nice-wiki__edit-title",value:t,onChange:p=>i(p.target.value)}),e.jsx("textarea",{className:"nice-wiki__edit-body",value:c,onChange:p=>a(p.target.value),rows:20}),e.jsxs("div",{className:"nice-wiki__edit-actions",children:[e.jsx("button",{onClick:d,children:"Save"}),e.jsx("button",{onClick:()=>v(!1),children:"Cancel"})]})]}):e.jsxs("div",{className:"nice-wiki__viewer",children:[e.jsxs("div",{className:"nice-wiki__viewer-header",children:[e.jsx("h2",{children:C.title}),e.jsxs("div",{className:"nice-wiki__viewer-meta",children:[C.lastEditedBy&&e.jsxs("span",{children:["Edited by ",C.lastEditedBy]}),C.lastEditedAt&&e.jsxs("span",{children:[" on ",C.lastEditedAt]})]}),b&&e.jsxs("div",{className:"nice-wiki__viewer-actions",children:[e.jsx("button",{onClick:D,children:"Edit"}),g&&e.jsx("button",{onClick:()=>g(C.id),children:"Delete"})]})]}),S?e.jsx("div",{className:"nice-wiki__viewer-body",dangerouslySetInnerHTML:{__html:Y(C.content??"")}}):e.jsx("div",{className:"nice-wiki__viewer-body",children:C.content??e.jsx("em",{children:"No content."})})]}):e.jsx("div",{className:"nice-wiki__placeholder",children:"Select a page from the sidebar."})})]})}),J={comment:"var(--nice-color-primary, #3b82f6)",like:"var(--nice-color-error, #ef4444)",share:"var(--nice-color-info, #0ea5e9)",create:"var(--nice-color-success, #22c55e)",update:"var(--nice-color-warning, #f59e0b)",delete:"var(--nice-color-error, #ef4444)",join:"var(--nice-color-success, #22c55e)",leave:"var(--nice-text-muted, #6b7280)",upload:"var(--nice-color-accent, #8b5cf6)",mention:"var(--nice-color-primary, #3b82f6)",custom:"var(--nice-text-muted, #6b7280)"},Q=l.forwardRef(function(u,M){const{events:m,onEventClick:n,groupByDate:o=!0,typeFilter:_,showFilters:g=!1,maxEvents:r,onLoadMore:b,hasMore:$=!1,className:S,style:y}=u,[k,w]=l.useState(new Set),x=_??(k.size>0?Array.from(k):void 0),s=l.useMemo(()=>{let i=m;if(x&&x.length>0){const c=new Set(x);i=i.filter(a=>c.has(a.type))}return r&&(i=i.slice(0,r)),i},[m,x,r]),h=l.useMemo(()=>{if(!o)return[{label:"",events:s}];const i=new Map;for(const c of s){const a=c.timestamp.slice(0,10);i.has(a)||i.set(a,[]),i.get(a).push(c)}return Array.from(i.entries()).map(([c,a])=>({label:c,events:a}))},[s,o]),v=l.useMemo(()=>{const i=new Set(m.map(c=>c.type));return Array.from(i).sort()},[m]),t=i=>{w(c=>{const a=new Set(c);return a.has(i)?a.delete(i):a.add(i),a})};return e.jsxs("div",{ref:M,className:`nice-activity-feed ${S??""}`,style:y,children:[g&&!_&&e.jsxs("div",{className:"nice-activity-feed__filters",children:[v.map(i=>e.jsx("button",{className:`nice-activity-feed__filter-chip ${k.has(i)?"nice-activity-feed__filter-chip--active":""}`,onClick:()=>t(i),children:i},i)),k.size>0&&e.jsx("button",{className:"nice-activity-feed__filter-clear",onClick:()=>w(new Set),children:"Clear"})]}),s.length===0?e.jsx("p",{className:"nice-activity-feed__empty",children:"No activity."}):h.map(({label:i,events:c})=>e.jsxs("div",{className:"nice-activity-feed__group",children:[o&&i&&e.jsx("div",{className:"nice-activity-feed__date-label",children:i}),c.map(a=>e.jsxs("div",{className:"nice-activity-feed__event",onClick:()=>n==null?void 0:n(a),role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:N=>{N.key==="Enter"&&n&&n(a)},children:[e.jsx("span",{className:`nice-activity-feed__icon nice-activity-feed__icon--${a.type}`,title:a.type,"aria-hidden":"true",style:{background:J[a.type]}}),e.jsxs("div",{className:"nice-activity-feed__body",children:[a.actorAvatarUrl&&e.jsx("img",{src:a.actorAvatarUrl,alt:"",className:"nice-activity-feed__avatar"}),e.jsxs("span",{className:"nice-activity-feed__message",children:[e.jsx("strong",{children:a.actorName})," ",a.message,a.targetLabel&&e.jsxs(e.Fragment,{children:[" ",e.jsx("em",{children:a.targetLabel})]})]}),e.jsx("time",{className:"nice-activity-feed__time",children:a.timestamp})]})]},a.id))]},i||"__all")),$&&b&&e.jsx("button",{className:"nice-activity-feed__load-more",onClick:b,children:"Load more"})]})});exports.NiceActivityFeed=Q;exports.NiceComments=U;exports.NiceRatings=B;exports.NiceSocialPanel=K;exports.NiceTagCloud=H;exports.NiceUserList=V;exports.NiceWiki=G;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e, Fragment as H } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as W, useState as L, useCallback as D, useMemo as P } from "react";
|
|
3
|
-
const X = W(
|
|
4
|
-
function(u,
|
|
3
|
+
const X = /* @__PURE__ */ W(
|
|
4
|
+
function(u, A) {
|
|
5
5
|
const {
|
|
6
6
|
comments: m,
|
|
7
7
|
currentUserId: s,
|
|
@@ -12,22 +12,22 @@ const X = W(
|
|
|
12
12
|
readOnly: w = !1,
|
|
13
13
|
maxDepth: E = 4,
|
|
14
14
|
reactions: $ = ["👍", "❤️", "😂", "😮", "😢"],
|
|
15
|
-
placeholder:
|
|
15
|
+
placeholder: k = "Write a comment…",
|
|
16
16
|
className: C,
|
|
17
17
|
style: x
|
|
18
|
-
} = u, [v, i] = L(""), [h, g] = L(null), [
|
|
18
|
+
} = u, [v, i] = L(""), [h, g] = L(null), [n, t] = L(""), [c, a] = L(null), [b, T] = L(""), F = /* @__PURE__ */ new Map();
|
|
19
19
|
for (const d of m) {
|
|
20
20
|
const M = d.parentId ?? "__root__";
|
|
21
21
|
F.has(M) || F.set(M, []), F.get(M).push(d);
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const z = D(() => {
|
|
24
24
|
!v.trim() || !o || (o(v.trim()), i(""));
|
|
25
|
-
}, [v, o]),
|
|
26
|
-
!
|
|
27
|
-
}, [
|
|
28
|
-
!c || !
|
|
29
|
-
}, [c,
|
|
30
|
-
const
|
|
25
|
+
}, [v, o]), R = D(() => {
|
|
26
|
+
!n.trim() || !o || !h || (o(n.trim(), h), t(""), g(null));
|
|
27
|
+
}, [n, h, o]), S = D(() => {
|
|
28
|
+
!c || !b.trim() || !_ || (_(c, b.trim()), a(null), T(""));
|
|
29
|
+
}, [c, b, _]), O = (d, M) => {
|
|
30
|
+
const j = s && d.authorId === s, p = F.get(d.id) ?? [];
|
|
31
31
|
return /* @__PURE__ */ l("div", { className: "nice-comments__item", style: { marginLeft: M * 24 }, children: [
|
|
32
32
|
/* @__PURE__ */ l("div", { className: "nice-comments__header", children: [
|
|
33
33
|
d.authorAvatarUrl && /* @__PURE__ */ e("img", { src: d.authorAvatarUrl, alt: "", className: "nice-comments__avatar" }),
|
|
@@ -36,9 +36,9 @@ const X = W(
|
|
|
36
36
|
d.isEdited && /* @__PURE__ */ e("span", { className: "nice-comments__edited", children: "(edited)" })
|
|
37
37
|
] }),
|
|
38
38
|
c === d.id ? /* @__PURE__ */ l("div", { className: "nice-comments__edit-form", children: [
|
|
39
|
-
/* @__PURE__ */ e("textarea", { value:
|
|
39
|
+
/* @__PURE__ */ e("textarea", { value: b, onChange: (y) => T(y.target.value) }),
|
|
40
40
|
/* @__PURE__ */ e("button", { onClick: S, children: "Save" }),
|
|
41
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
41
|
+
/* @__PURE__ */ e("button", { onClick: () => a(null), children: "Cancel" })
|
|
42
42
|
] }) : /* @__PURE__ */ e("p", { className: "nice-comments__content", children: d.isDeleted ? /* @__PURE__ */ e("em", { children: "Comment deleted" }) : d.content }),
|
|
43
43
|
!d.isDeleted && d.reactions && /* @__PURE__ */ e("div", { className: "nice-comments__reactions", children: Object.entries(d.reactions).map(([y, f]) => /* @__PURE__ */ l(
|
|
44
44
|
"button",
|
|
@@ -64,43 +64,43 @@ const X = W(
|
|
|
64
64
|
children: "Reply"
|
|
65
65
|
}
|
|
66
66
|
),
|
|
67
|
-
|
|
67
|
+
j && _ && /* @__PURE__ */ e(
|
|
68
68
|
"button",
|
|
69
69
|
{
|
|
70
70
|
onClick: () => {
|
|
71
|
-
|
|
71
|
+
a(d.id), T(d.content);
|
|
72
72
|
},
|
|
73
73
|
children: "Edit"
|
|
74
74
|
}
|
|
75
75
|
),
|
|
76
|
-
|
|
76
|
+
j && N && /* @__PURE__ */ e("button", { onClick: () => N(d.id), children: "Delete" })
|
|
77
77
|
] }),
|
|
78
78
|
h === d.id && /* @__PURE__ */ l("div", { className: "nice-comments__reply-form", children: [
|
|
79
79
|
/* @__PURE__ */ e(
|
|
80
80
|
"textarea",
|
|
81
81
|
{
|
|
82
|
-
value:
|
|
82
|
+
value: n,
|
|
83
83
|
onChange: (y) => t(y.target.value),
|
|
84
84
|
placeholder: "Write a reply…"
|
|
85
85
|
}
|
|
86
86
|
),
|
|
87
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
87
|
+
/* @__PURE__ */ e("button", { onClick: R, disabled: !n.trim(), children: "Send" }),
|
|
88
88
|
/* @__PURE__ */ e("button", { onClick: () => g(null), children: "Cancel" })
|
|
89
89
|
] }),
|
|
90
90
|
p.map((y) => O(y, M + 1))
|
|
91
91
|
] }, d.id);
|
|
92
92
|
}, U = F.get("__root__") ?? [];
|
|
93
|
-
return /* @__PURE__ */ l("div", { ref:
|
|
93
|
+
return /* @__PURE__ */ l("div", { ref: A, className: `nice-comments ${C ?? ""}`, style: x, children: [
|
|
94
94
|
!w && /* @__PURE__ */ l("div", { className: "nice-comments__new", children: [
|
|
95
95
|
/* @__PURE__ */ e(
|
|
96
96
|
"textarea",
|
|
97
97
|
{
|
|
98
98
|
value: v,
|
|
99
99
|
onChange: (d) => i(d.target.value),
|
|
100
|
-
placeholder:
|
|
100
|
+
placeholder: k
|
|
101
101
|
}
|
|
102
102
|
),
|
|
103
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
103
|
+
/* @__PURE__ */ e("button", { onClick: z, disabled: !v.trim(), children: "Post" })
|
|
104
104
|
] }),
|
|
105
105
|
U.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-comments__empty", children: "No comments yet." }) : U.map((d) => O(d, 0))
|
|
106
106
|
] });
|
|
@@ -108,27 +108,30 @@ const X = W(
|
|
|
108
108
|
), V = {
|
|
109
109
|
star: "polygon(50% 2%, 62% 36%, 98% 37%, 69% 59%, 79% 94%, 50% 73%, 21% 94%, 31% 59%, 2% 37%, 38% 36%)",
|
|
110
110
|
heart: "polygon(50% 92%, 12% 54%, 4% 40%, 4% 25%, 10% 13%, 22% 6%, 34% 6%, 44% 12%, 50% 21%, 56% 12%, 66% 6%, 78% 6%, 90% 13%, 96% 25%, 96% 40%, 88% 54%)",
|
|
111
|
-
share: "polygon(42% 8%, 92% 8%, 92% 58%, 75% 41%, 27% 89%, 11% 73%, 59% 25%)"
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
share: "polygon(42% 8%, 92% 8%, 92% 58%, 75% 41%, 27% 89%, 11% 73%, 59% 25%)",
|
|
112
|
+
// a thumbs-up: cuff on the left, fist with the thumb raised; thumb-down is it mirrored vertically
|
|
113
|
+
thumb: "polygon(6% 46%, 24% 46%, 24% 40%, 40% 36%, 50% 8%, 58% 6%, 64% 12%, 62% 36%, 88% 38%, 94% 46%, 90% 56%, 94% 64%, 90% 74%, 92% 82%, 86% 92%, 24% 92%, 24% 90%, 6% 90%)",
|
|
114
|
+
"thumb-down": "polygon(6% 54%, 24% 54%, 24% 60%, 40% 64%, 50% 92%, 58% 94%, 64% 88%, 62% 64%, 88% 62%, 94% 54%, 90% 44%, 94% 36%, 90% 26%, 92% 18%, 86% 8%, 24% 8%, 24% 10%, 6% 10%)"
|
|
115
|
+
}, B = ({
|
|
116
|
+
shape: I,
|
|
114
117
|
filled: u = !0
|
|
115
118
|
}) => /* @__PURE__ */ e(
|
|
116
119
|
"span",
|
|
117
120
|
{
|
|
118
121
|
"aria-hidden": "true",
|
|
119
|
-
className: `nice-social-shape nice-social-shape--${
|
|
122
|
+
className: `nice-social-shape nice-social-shape--${I}`,
|
|
120
123
|
style: {
|
|
121
124
|
display: "inline-block",
|
|
122
125
|
width: "1em",
|
|
123
126
|
height: "1em",
|
|
124
127
|
verticalAlign: "-0.125em",
|
|
125
128
|
background: "currentColor",
|
|
126
|
-
clipPath: V[
|
|
129
|
+
clipPath: V[I],
|
|
127
130
|
opacity: u ? 1 : 0.35
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
), Z = W(
|
|
131
|
-
function(u,
|
|
133
|
+
), Z = /* @__PURE__ */ W(
|
|
134
|
+
function(u, A) {
|
|
132
135
|
const {
|
|
133
136
|
value: m,
|
|
134
137
|
max: s = 5,
|
|
@@ -139,7 +142,7 @@ const X = W(
|
|
|
139
142
|
size: w = "md",
|
|
140
143
|
showValue: E = !1,
|
|
141
144
|
label: $,
|
|
142
|
-
emojiSet:
|
|
145
|
+
emojiSet: k = ["😢", "😕", "😐", "🙂", "😍"],
|
|
143
146
|
className: C,
|
|
144
147
|
style: x
|
|
145
148
|
} = u, [v, i] = L(null), h = v !== null ? v + 1 : m ?? 0, g = D(
|
|
@@ -147,27 +150,27 @@ const X = W(
|
|
|
147
150
|
r || !N || N(c + 1);
|
|
148
151
|
},
|
|
149
152
|
[r, N]
|
|
150
|
-
),
|
|
153
|
+
), n = () => {
|
|
151
154
|
const c = [];
|
|
152
|
-
for (let
|
|
153
|
-
const
|
|
154
|
-
let
|
|
155
|
-
o === "emoji" ?
|
|
155
|
+
for (let a = 0; a < s; a++) {
|
|
156
|
+
const b = a < h;
|
|
157
|
+
let T;
|
|
158
|
+
o === "emoji" ? T = k[a] ?? k[k.length - 1] : o === "hearts" ? T = /* @__PURE__ */ e(B, { shape: "heart", filled: b }) : o === "thumbs" ? T = /* @__PURE__ */ e(B, { shape: b ? "thumb" : "thumb-down", filled: b }) : T = /* @__PURE__ */ e(B, { shape: "star", filled: b }), c.push(
|
|
156
159
|
/* @__PURE__ */ e(
|
|
157
160
|
"span",
|
|
158
161
|
{
|
|
159
|
-
className: `nice-ratings__symbol ${
|
|
160
|
-
onClick: () => g(
|
|
161
|
-
onMouseEnter: () => !r && i(
|
|
162
|
+
className: `nice-ratings__symbol ${b ? "nice-ratings__symbol--active" : ""}`,
|
|
163
|
+
onClick: () => g(a),
|
|
164
|
+
onMouseEnter: () => !r && i(a),
|
|
162
165
|
onMouseLeave: () => !r && i(null),
|
|
163
166
|
role: r ? void 0 : "button",
|
|
164
167
|
tabIndex: r ? void 0 : 0,
|
|
165
168
|
onKeyDown: (F) => {
|
|
166
|
-
(F.key === "Enter" || F.key === " ") && g(
|
|
169
|
+
(F.key === "Enter" || F.key === " ") && g(a);
|
|
167
170
|
},
|
|
168
|
-
children:
|
|
171
|
+
children: T
|
|
169
172
|
},
|
|
170
|
-
|
|
173
|
+
a
|
|
171
174
|
)
|
|
172
175
|
);
|
|
173
176
|
}
|
|
@@ -194,13 +197,13 @@ const X = W(
|
|
|
194
197
|
return /* @__PURE__ */ l(
|
|
195
198
|
"div",
|
|
196
199
|
{
|
|
197
|
-
ref:
|
|
200
|
+
ref: A,
|
|
198
201
|
className: `nice-ratings nice-ratings--${w} nice-ratings--${o} ${r ? "nice-ratings--readonly" : ""} ${C ?? ""}`,
|
|
199
202
|
style: x,
|
|
200
203
|
children: [
|
|
201
204
|
$ && /* @__PURE__ */ e("span", { className: "nice-ratings__label", children: $ }),
|
|
202
205
|
/* @__PURE__ */ l("div", { className: "nice-ratings__body", children: [
|
|
203
|
-
o === "numeric" ? t() :
|
|
206
|
+
o === "numeric" ? t() : n(),
|
|
204
207
|
E && o !== "numeric" && /* @__PURE__ */ l("span", { className: "nice-ratings__value", children: [
|
|
205
208
|
h,
|
|
206
209
|
" / ",
|
|
@@ -214,26 +217,26 @@ const X = W(
|
|
|
214
217
|
_.count,
|
|
215
218
|
" ratings)"
|
|
216
219
|
] }),
|
|
217
|
-
_.distribution && /* @__PURE__ */ e("div", { className: "nice-ratings__distribution", children: Object.entries(_.distribution).sort(([c], [
|
|
220
|
+
_.distribution && /* @__PURE__ */ e("div", { className: "nice-ratings__distribution", children: Object.entries(_.distribution).sort(([c], [a]) => +a - +c).map(([c, a]) => /* @__PURE__ */ l("div", { className: "nice-ratings__distribution-row", children: [
|
|
218
221
|
/* @__PURE__ */ e("span", { children: c }),
|
|
219
222
|
/* @__PURE__ */ e("div", { className: "nice-ratings__bar", children: /* @__PURE__ */ e(
|
|
220
223
|
"div",
|
|
221
224
|
{
|
|
222
225
|
className: "nice-ratings__bar-fill",
|
|
223
226
|
style: {
|
|
224
|
-
width: `${_.count ?
|
|
227
|
+
width: `${_.count ? a / _.count * 100 : 0}%`
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
230
|
) }),
|
|
228
|
-
/* @__PURE__ */ e("span", { children:
|
|
231
|
+
/* @__PURE__ */ e("span", { children: a })
|
|
229
232
|
] }, c)) })
|
|
230
233
|
] })
|
|
231
234
|
]
|
|
232
235
|
}
|
|
233
236
|
);
|
|
234
237
|
}
|
|
235
|
-
), ee = W(
|
|
236
|
-
function(u,
|
|
238
|
+
), ee = /* @__PURE__ */ W(
|
|
239
|
+
function(u, A) {
|
|
237
240
|
const {
|
|
238
241
|
stats: m,
|
|
239
242
|
userState: s,
|
|
@@ -244,7 +247,7 @@ const X = W(
|
|
|
244
247
|
size: w = "md",
|
|
245
248
|
showCounts: E = !0,
|
|
246
249
|
showLabels: $ = !1,
|
|
247
|
-
className:
|
|
250
|
+
className: k,
|
|
248
251
|
style: C
|
|
249
252
|
} = u, x = D((i) => i >= 1e6 ? (i / 1e6).toFixed(1) + "M" : i >= 1e3 ? (i / 1e3).toFixed(1) + "K" : i.toString(), []), v = [
|
|
250
253
|
{
|
|
@@ -275,8 +278,8 @@ const X = W(
|
|
|
275
278
|
return /* @__PURE__ */ e(
|
|
276
279
|
"div",
|
|
277
280
|
{
|
|
278
|
-
ref:
|
|
279
|
-
className: `nice-social-panel nice-social-panel--${r} nice-social-panel--${w} ${
|
|
281
|
+
ref: A,
|
|
282
|
+
className: `nice-social-panel nice-social-panel--${r} nice-social-panel--${w} ${k ?? ""}`,
|
|
280
283
|
style: C,
|
|
281
284
|
children: v.map((i) => /* @__PURE__ */ l(
|
|
282
285
|
"button",
|
|
@@ -287,7 +290,7 @@ const X = W(
|
|
|
287
290
|
"aria-label": i.label,
|
|
288
291
|
"aria-pressed": i.isActive,
|
|
289
292
|
children: [
|
|
290
|
-
/* @__PURE__ */ e("span", { className: "nice-social-panel__icon", children: /* @__PURE__ */ e(
|
|
293
|
+
/* @__PURE__ */ e("span", { className: "nice-social-panel__icon", children: /* @__PURE__ */ e(B, { shape: i.shape, filled: i.isActive || i.shape === "share" }) }),
|
|
291
294
|
$ && /* @__PURE__ */ e("span", { className: "nice-social-panel__label", children: i.label }),
|
|
292
295
|
E && /* @__PURE__ */ e("span", { className: "nice-social-panel__count", children: x(i.count) })
|
|
293
296
|
]
|
|
@@ -297,8 +300,8 @@ const X = W(
|
|
|
297
300
|
}
|
|
298
301
|
);
|
|
299
302
|
}
|
|
300
|
-
), ie = W(
|
|
301
|
-
function(u,
|
|
303
|
+
), ie = /* @__PURE__ */ W(
|
|
304
|
+
function(u, A) {
|
|
302
305
|
const {
|
|
303
306
|
tags: m,
|
|
304
307
|
onTagClick: s,
|
|
@@ -309,7 +312,7 @@ const X = W(
|
|
|
309
312
|
selectedIds: w,
|
|
310
313
|
className: E,
|
|
311
314
|
style: $
|
|
312
|
-
} = u,
|
|
315
|
+
} = u, k = P(() => {
|
|
313
316
|
let i = [...m];
|
|
314
317
|
if (N === "weight")
|
|
315
318
|
i.sort((h, g) => g.weight - h.weight);
|
|
@@ -322,32 +325,28 @@ const X = W(
|
|
|
322
325
|
}
|
|
323
326
|
return r && i.length > r && (i = i.slice(0, r)), i;
|
|
324
327
|
}, [m, N, r]), { minW: C, maxW: x } = P(() => {
|
|
325
|
-
if (
|
|
328
|
+
if (k.length === 0)
|
|
326
329
|
return { minW: 0, maxW: 1 };
|
|
327
|
-
const i =
|
|
330
|
+
const i = k.map((h) => h.weight);
|
|
328
331
|
return { minW: Math.min(...i), maxW: Math.max(...i) };
|
|
329
|
-
}, [
|
|
332
|
+
}, [k]), v = (i) => {
|
|
330
333
|
if (x === C)
|
|
331
334
|
return (o + _) / 2;
|
|
332
335
|
const h = (i - C) / (x - C);
|
|
333
336
|
return o + h * (_ - o);
|
|
334
337
|
};
|
|
335
|
-
return /* @__PURE__ */ e("div", { ref:
|
|
338
|
+
return /* @__PURE__ */ e("div", { ref: A, className: `nice-tag-cloud ${E ?? ""}`, style: $, children: k.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-tag-cloud__empty", children: "No tags." }) : k.map((i) => {
|
|
336
339
|
const h = w == null ? void 0 : w.includes(i.id), g = v(i.weight);
|
|
337
340
|
return /* @__PURE__ */ e(
|
|
338
341
|
"span",
|
|
339
342
|
{
|
|
340
343
|
className: `nice-tag-cloud__tag ${h ? "nice-tag-cloud__tag--selected" : ""}`,
|
|
341
|
-
style: {
|
|
342
|
-
fontSize: g,
|
|
343
|
-
color: i.color,
|
|
344
|
-
cursor: s ? "pointer" : void 0
|
|
345
|
-
},
|
|
344
|
+
style: { fontSize: g, color: i.color },
|
|
346
345
|
onClick: () => s == null ? void 0 : s(i),
|
|
347
346
|
role: s ? "button" : void 0,
|
|
348
347
|
tabIndex: s ? 0 : void 0,
|
|
349
|
-
onKeyDown: (
|
|
350
|
-
(
|
|
348
|
+
onKeyDown: (n) => {
|
|
349
|
+
(n.key === "Enter" || n.key === " ") && s && s(i);
|
|
351
350
|
},
|
|
352
351
|
title: `${i.label} (${i.weight})`,
|
|
353
352
|
children: i.label
|
|
@@ -361,8 +360,8 @@ const X = W(
|
|
|
361
360
|
away: "#eab308",
|
|
362
361
|
busy: "#ef4444",
|
|
363
362
|
offline: "#9ca3af"
|
|
364
|
-
}, te = W(
|
|
365
|
-
function(u,
|
|
363
|
+
}, te = /* @__PURE__ */ W(
|
|
364
|
+
function(u, A) {
|
|
366
365
|
const {
|
|
367
366
|
users: m,
|
|
368
367
|
onUserClick: s,
|
|
@@ -373,62 +372,62 @@ const X = W(
|
|
|
373
372
|
showStatus: w = !0,
|
|
374
373
|
layout: E = "list",
|
|
375
374
|
groupByRole: $ = !1,
|
|
376
|
-
className:
|
|
375
|
+
className: k,
|
|
377
376
|
style: C
|
|
378
377
|
} = u, [x, v] = L(""), i = P(() => {
|
|
379
|
-
let
|
|
380
|
-
if (r && r.length > 0 && (
|
|
378
|
+
let n = m;
|
|
379
|
+
if (r && r.length > 0 && (n = n.filter((t) => t.status && r.includes(t.status))), x.trim()) {
|
|
381
380
|
const t = x.toLowerCase();
|
|
382
|
-
|
|
381
|
+
n = n.filter(
|
|
383
382
|
(c) => {
|
|
384
|
-
var
|
|
385
|
-
return c.name.toLowerCase().includes(t) || ((
|
|
383
|
+
var a, b;
|
|
384
|
+
return c.name.toLowerCase().includes(t) || ((a = c.email) == null ? void 0 : a.toLowerCase().includes(t)) || ((b = c.role) == null ? void 0 : b.toLowerCase().includes(t));
|
|
386
385
|
}
|
|
387
386
|
);
|
|
388
387
|
}
|
|
389
|
-
return
|
|
388
|
+
return n;
|
|
390
389
|
}, [m, r, x]), h = P(() => {
|
|
391
390
|
if (!$)
|
|
392
391
|
return { "": i };
|
|
393
|
-
const
|
|
392
|
+
const n = {};
|
|
394
393
|
for (const t of i) {
|
|
395
394
|
const c = t.role ?? "Other";
|
|
396
|
-
|
|
395
|
+
n[c] || (n[c] = []), n[c].push(t);
|
|
397
396
|
}
|
|
398
|
-
return
|
|
399
|
-
}, [i, $]), g = (
|
|
397
|
+
return n;
|
|
398
|
+
}, [i, $]), g = (n) => /* @__PURE__ */ l(
|
|
400
399
|
"div",
|
|
401
400
|
{
|
|
402
401
|
className: `nice-user-list__item nice-user-list__item--${E}`,
|
|
403
|
-
onClick: () => s == null ? void 0 : s(
|
|
402
|
+
onClick: () => s == null ? void 0 : s(n),
|
|
404
403
|
role: s ? "button" : void 0,
|
|
405
404
|
tabIndex: s ? 0 : void 0,
|
|
406
405
|
onKeyDown: (t) => {
|
|
407
|
-
t.key === "Enter" && s && s(
|
|
406
|
+
t.key === "Enter" && s && s(n);
|
|
408
407
|
},
|
|
409
408
|
children: [
|
|
410
409
|
/* @__PURE__ */ l("div", { className: "nice-user-list__avatar-wrap", children: [
|
|
411
|
-
|
|
412
|
-
w &&
|
|
410
|
+
n.avatarUrl ? /* @__PURE__ */ e("img", { src: n.avatarUrl, alt: n.name, className: "nice-user-list__avatar" }) : /* @__PURE__ */ e("span", { className: "nice-user-list__avatar-placeholder", children: n.name.charAt(0).toUpperCase() }),
|
|
411
|
+
w && n.status && /* @__PURE__ */ e(
|
|
413
412
|
"span",
|
|
414
413
|
{
|
|
415
414
|
className: "nice-user-list__status-dot",
|
|
416
|
-
style: { backgroundColor: q[
|
|
417
|
-
title:
|
|
415
|
+
style: { backgroundColor: q[n.status] },
|
|
416
|
+
title: n.status
|
|
418
417
|
}
|
|
419
418
|
)
|
|
420
419
|
] }),
|
|
421
420
|
/* @__PURE__ */ l("div", { className: "nice-user-list__info", children: [
|
|
422
|
-
/* @__PURE__ */ e("span", { className: "nice-user-list__name", children:
|
|
423
|
-
|
|
424
|
-
|
|
421
|
+
/* @__PURE__ */ e("span", { className: "nice-user-list__name", children: n.name }),
|
|
422
|
+
n.email && /* @__PURE__ */ e("span", { className: "nice-user-list__email", children: n.email }),
|
|
423
|
+
n.role && /* @__PURE__ */ e("span", { className: "nice-user-list__role", children: n.role })
|
|
425
424
|
] }),
|
|
426
425
|
_.length > 0 && /* @__PURE__ */ e("div", { className: "nice-user-list__actions", children: _.map((t) => /* @__PURE__ */ e(
|
|
427
426
|
"button",
|
|
428
427
|
{
|
|
429
428
|
className: "nice-user-list__action-btn",
|
|
430
429
|
onClick: (c) => {
|
|
431
|
-
c.stopPropagation(), o == null || o(
|
|
430
|
+
c.stopPropagation(), o == null || o(n, t);
|
|
432
431
|
},
|
|
433
432
|
children: t
|
|
434
433
|
},
|
|
@@ -436,13 +435,13 @@ const X = W(
|
|
|
436
435
|
)) })
|
|
437
436
|
]
|
|
438
437
|
},
|
|
439
|
-
|
|
438
|
+
n.id
|
|
440
439
|
);
|
|
441
440
|
return /* @__PURE__ */ l(
|
|
442
441
|
"div",
|
|
443
442
|
{
|
|
444
|
-
ref:
|
|
445
|
-
className: `nice-user-list nice-user-list--${E} ${
|
|
443
|
+
ref: A,
|
|
444
|
+
className: `nice-user-list nice-user-list--${E} ${k ?? ""}`,
|
|
446
445
|
style: C,
|
|
447
446
|
children: [
|
|
448
447
|
N && /* @__PURE__ */ e(
|
|
@@ -450,172 +449,182 @@ const X = W(
|
|
|
450
449
|
{
|
|
451
450
|
type: "text",
|
|
452
451
|
value: x,
|
|
453
|
-
onChange: (
|
|
452
|
+
onChange: (n) => v(n.target.value),
|
|
454
453
|
placeholder: "Search users…",
|
|
455
454
|
className: "nice-user-list__search"
|
|
456
455
|
}
|
|
457
456
|
),
|
|
458
|
-
i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-user-list__empty", children: "No users found." }) : Object.entries(h).map(([
|
|
459
|
-
$ &&
|
|
460
|
-
|
|
457
|
+
i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-user-list__empty", children: "No users found." }) : Object.entries(h).map(([n, t]) => /* @__PURE__ */ l("div", { className: "nice-user-list__group", children: [
|
|
458
|
+
$ && n && /* @__PURE__ */ l("h4", { className: "nice-user-list__group-title", children: [
|
|
459
|
+
n,
|
|
461
460
|
" (",
|
|
462
461
|
t.length,
|
|
463
462
|
")"
|
|
464
463
|
] }),
|
|
465
464
|
t.map(g)
|
|
466
|
-
] },
|
|
465
|
+
] }, n))
|
|
467
466
|
]
|
|
468
467
|
}
|
|
469
468
|
);
|
|
470
469
|
}
|
|
471
470
|
);
|
|
472
|
-
function Y(
|
|
473
|
-
if (!
|
|
471
|
+
function Y(I) {
|
|
472
|
+
if (!I)
|
|
474
473
|
return "";
|
|
475
|
-
let u =
|
|
474
|
+
let u = I;
|
|
476
475
|
return u = u.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ""), u = u.replace(/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, ""), u = u.replace(/(href|src|action)\s*=\s*(?:"javascript:[^"]*"|'javascript:[^']*')/gi, '$1=""'), u = u.replace(/(href|src|action)\s*=\s*(?:"vbscript:[^"]*"|'vbscript:[^']*')/gi, '$1=""'), u = u.replace(/<\/?(iframe|object|embed|form)\b[^>]*>/gi, ""), u;
|
|
477
476
|
}
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
"div",
|
|
523
|
-
{
|
|
524
|
-
className: `nice-wiki__page-item ${p.id === s ? "nice-wiki__page-item--active" : ""}`,
|
|
525
|
-
style: { paddingLeft: 12 + y * 16 },
|
|
526
|
-
onClick: () => o == null ? void 0 : o(p),
|
|
527
|
-
role: "button",
|
|
528
|
-
tabIndex: 0,
|
|
529
|
-
onKeyDown: (B) => {
|
|
530
|
-
B.key === "Enter" && (o == null || o(p));
|
|
531
|
-
},
|
|
532
|
-
children: p.title
|
|
533
|
-
}
|
|
534
|
-
),
|
|
535
|
-
(f = p.children) == null ? void 0 : f.map((B) => R(B, y + 1))
|
|
536
|
-
] }, p.id);
|
|
537
|
-
};
|
|
538
|
-
return /* @__PURE__ */ l("div", { ref: T, className: `nice-wiki ${C ?? ""}`, style: { display: "flex", ...x }, children: [
|
|
539
|
-
/* @__PURE__ */ l("div", { className: "nice-wiki__sidebar", style: { width: b, minWidth: b }, children: [
|
|
540
|
-
/* @__PURE__ */ l("div", { className: "nice-wiki__sidebar-header", children: [
|
|
541
|
-
/* @__PURE__ */ e("strong", { children: "Wiki" }),
|
|
542
|
-
w && r && /* @__PURE__ */ e("button", { onClick: () => j(!F), title: "New page", children: "+" })
|
|
543
|
-
] }),
|
|
544
|
-
F && /* @__PURE__ */ l("div", { className: "nice-wiki__new-page", children: [
|
|
477
|
+
const ne = /* @__PURE__ */ W(
|
|
478
|
+
function(u, A) {
|
|
479
|
+
const {
|
|
480
|
+
pages: m,
|
|
481
|
+
selectedPageId: s,
|
|
482
|
+
onSelectPage: o,
|
|
483
|
+
onSavePage: _,
|
|
484
|
+
onDeletePage: N,
|
|
485
|
+
onCreatePage: r,
|
|
486
|
+
editable: w = !1,
|
|
487
|
+
searchable: E = !0,
|
|
488
|
+
renderHtml: $ = !1,
|
|
489
|
+
sidebarWidth: k = 260,
|
|
490
|
+
className: C,
|
|
491
|
+
style: x
|
|
492
|
+
} = u, [v, i] = L(""), [h, g] = L(!1), [n, t] = L(""), [c, a] = L(""), [b, T] = L(""), [F, z] = L(!1), R = P(() => {
|
|
493
|
+
if (m.some((f) => f.children && f.children.length > 0))
|
|
494
|
+
return m.filter((f) => !f.parentId);
|
|
495
|
+
const p = /* @__PURE__ */ new Map();
|
|
496
|
+
for (const f of m)
|
|
497
|
+
p.set(f.id, { ...f, children: [] });
|
|
498
|
+
const y = [];
|
|
499
|
+
for (const f of p.values())
|
|
500
|
+
f.parentId && p.has(f.parentId) ? p.get(f.parentId).children.push(f) : y.push(f);
|
|
501
|
+
return y;
|
|
502
|
+
}, [m]), S = P(
|
|
503
|
+
() => m.find((p) => p.id === s),
|
|
504
|
+
[m, s]
|
|
505
|
+
), O = P(() => {
|
|
506
|
+
if (!v.trim())
|
|
507
|
+
return R;
|
|
508
|
+
const p = v.toLowerCase(), y = new Set(
|
|
509
|
+
m.filter((f) => f.title.toLowerCase().includes(p)).map((f) => f.id)
|
|
510
|
+
);
|
|
511
|
+
return m.filter((f) => y.has(f.id));
|
|
512
|
+
}, [R, m, v]), U = D(() => {
|
|
513
|
+
S && (t(S.title), a(S.content ?? ""), g(!0));
|
|
514
|
+
}, [S]), d = D(() => {
|
|
515
|
+
!S || !_ || (_(S.id, c, n), g(!1));
|
|
516
|
+
}, [S, c, n, _]), M = D(() => {
|
|
517
|
+
!b.trim() || !r || (r(s ?? null, b.trim()), T(""), z(!1));
|
|
518
|
+
}, [b, s, r]), j = (p, y = 0) => {
|
|
519
|
+
var f;
|
|
520
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
545
521
|
/* @__PURE__ */ e(
|
|
546
|
-
"
|
|
522
|
+
"div",
|
|
547
523
|
{
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
524
|
+
className: `nice-wiki__page-item ${p.id === s ? "nice-wiki__page-item--active" : ""}`,
|
|
525
|
+
style: { paddingLeft: 12 + y * 16 },
|
|
526
|
+
onClick: () => o == null ? void 0 : o(p),
|
|
527
|
+
role: "button",
|
|
528
|
+
tabIndex: 0,
|
|
529
|
+
onKeyDown: (K) => {
|
|
530
|
+
K.key === "Enter" && (o == null || o(p));
|
|
531
|
+
},
|
|
532
|
+
children: p.title
|
|
552
533
|
}
|
|
553
534
|
),
|
|
554
|
-
|
|
555
|
-
] })
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
/* @__PURE__ */ l("div", { className: "nice-wiki__viewer-header", children: [
|
|
593
|
-
/* @__PURE__ */ e("h2", { children: S.title }),
|
|
594
|
-
/* @__PURE__ */ l("div", { className: "nice-wiki__viewer-meta", children: [
|
|
595
|
-
S.lastEditedBy && /* @__PURE__ */ l("span", { children: [
|
|
596
|
-
"Edited by ",
|
|
597
|
-
S.lastEditedBy
|
|
535
|
+
(f = p.children) == null ? void 0 : f.map((K) => j(K, y + 1))
|
|
536
|
+
] }, p.id);
|
|
537
|
+
};
|
|
538
|
+
return /* @__PURE__ */ l(
|
|
539
|
+
"div",
|
|
540
|
+
{
|
|
541
|
+
ref: A,
|
|
542
|
+
className: `nice-wiki ${C ?? ""}`,
|
|
543
|
+
style: { display: "flex", ...x },
|
|
544
|
+
children: [
|
|
545
|
+
/* @__PURE__ */ l("div", { className: "nice-wiki__sidebar", style: { width: k, minWidth: k }, children: [
|
|
546
|
+
/* @__PURE__ */ l("div", { className: "nice-wiki__sidebar-header", children: [
|
|
547
|
+
/* @__PURE__ */ e("strong", { children: "Wiki" }),
|
|
548
|
+
w && r && /* @__PURE__ */ e("button", { onClick: () => z(!F), title: "New page", children: "+" })
|
|
549
|
+
] }),
|
|
550
|
+
F && /* @__PURE__ */ l("div", { className: "nice-wiki__new-page", children: [
|
|
551
|
+
/* @__PURE__ */ e(
|
|
552
|
+
"input",
|
|
553
|
+
{
|
|
554
|
+
type: "text",
|
|
555
|
+
value: b,
|
|
556
|
+
onChange: (p) => T(p.target.value),
|
|
557
|
+
placeholder: "New page title"
|
|
558
|
+
}
|
|
559
|
+
),
|
|
560
|
+
/* @__PURE__ */ e("button", { onClick: M, disabled: !b.trim(), children: "Create" })
|
|
561
|
+
] }),
|
|
562
|
+
E && /* @__PURE__ */ e(
|
|
563
|
+
"input",
|
|
564
|
+
{
|
|
565
|
+
type: "text",
|
|
566
|
+
className: "nice-wiki__search",
|
|
567
|
+
value: v,
|
|
568
|
+
onChange: (p) => i(p.target.value),
|
|
569
|
+
placeholder: "Search pages…"
|
|
570
|
+
}
|
|
571
|
+
),
|
|
572
|
+
/* @__PURE__ */ e("div", { className: "nice-wiki__tree", children: O.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-wiki__empty", children: "No pages." }) : O.map((p) => j(p)) })
|
|
598
573
|
] }),
|
|
599
|
-
S
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
574
|
+
/* @__PURE__ */ e("div", { className: "nice-wiki__content", children: S ? h ? /* @__PURE__ */ l("div", { className: "nice-wiki__editor", children: [
|
|
575
|
+
/* @__PURE__ */ e(
|
|
576
|
+
"input",
|
|
577
|
+
{
|
|
578
|
+
type: "text",
|
|
579
|
+
className: "nice-wiki__edit-title",
|
|
580
|
+
value: n,
|
|
581
|
+
onChange: (p) => t(p.target.value)
|
|
582
|
+
}
|
|
583
|
+
),
|
|
584
|
+
/* @__PURE__ */ e(
|
|
585
|
+
"textarea",
|
|
586
|
+
{
|
|
587
|
+
className: "nice-wiki__edit-body",
|
|
588
|
+
value: c,
|
|
589
|
+
onChange: (p) => a(p.target.value),
|
|
590
|
+
rows: 20
|
|
591
|
+
}
|
|
592
|
+
),
|
|
593
|
+
/* @__PURE__ */ l("div", { className: "nice-wiki__edit-actions", children: [
|
|
594
|
+
/* @__PURE__ */ e("button", { onClick: d, children: "Save" }),
|
|
595
|
+
/* @__PURE__ */ e("button", { onClick: () => g(!1), children: "Cancel" })
|
|
596
|
+
] })
|
|
597
|
+
] }) : /* @__PURE__ */ l("div", { className: "nice-wiki__viewer", children: [
|
|
598
|
+
/* @__PURE__ */ l("div", { className: "nice-wiki__viewer-header", children: [
|
|
599
|
+
/* @__PURE__ */ e("h2", { children: S.title }),
|
|
600
|
+
/* @__PURE__ */ l("div", { className: "nice-wiki__viewer-meta", children: [
|
|
601
|
+
S.lastEditedBy && /* @__PURE__ */ l("span", { children: [
|
|
602
|
+
"Edited by ",
|
|
603
|
+
S.lastEditedBy
|
|
604
|
+
] }),
|
|
605
|
+
S.lastEditedAt && /* @__PURE__ */ l("span", { children: [
|
|
606
|
+
" on ",
|
|
607
|
+
S.lastEditedAt
|
|
608
|
+
] })
|
|
609
|
+
] }),
|
|
610
|
+
w && /* @__PURE__ */ l("div", { className: "nice-wiki__viewer-actions", children: [
|
|
611
|
+
/* @__PURE__ */ e("button", { onClick: U, children: "Edit" }),
|
|
612
|
+
N && /* @__PURE__ */ e("button", { onClick: () => N(S.id), children: "Delete" })
|
|
613
|
+
] })
|
|
614
|
+
] }),
|
|
615
|
+
$ ? /* @__PURE__ */ e(
|
|
616
|
+
"div",
|
|
617
|
+
{
|
|
618
|
+
className: "nice-wiki__viewer-body",
|
|
619
|
+
dangerouslySetInnerHTML: { __html: Y(S.content ?? "") }
|
|
620
|
+
}
|
|
621
|
+
) : /* @__PURE__ */ e("div", { className: "nice-wiki__viewer-body", children: S.content ?? /* @__PURE__ */ e("em", { children: "No content." }) })
|
|
622
|
+
] }) : /* @__PURE__ */ e("div", { className: "nice-wiki__placeholder", children: "Select a page from the sidebar." }) })
|
|
623
|
+
]
|
|
624
|
+
}
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
), G = {
|
|
619
628
|
comment: "var(--nice-color-primary, #3b82f6)",
|
|
620
629
|
like: "var(--nice-color-error, #ef4444)",
|
|
621
630
|
share: "var(--nice-color-info, #0ea5e9)",
|
|
@@ -627,8 +636,8 @@ const ae = W(function(u, T) {
|
|
|
627
636
|
upload: "var(--nice-color-accent, #8b5cf6)",
|
|
628
637
|
mention: "var(--nice-color-primary, #3b82f6)",
|
|
629
638
|
custom: "var(--nice-text-muted, #6b7280)"
|
|
630
|
-
},
|
|
631
|
-
function(u,
|
|
639
|
+
}, ae = /* @__PURE__ */ W(
|
|
640
|
+
function(u, A) {
|
|
632
641
|
const {
|
|
633
642
|
events: m,
|
|
634
643
|
onEventClick: s,
|
|
@@ -639,12 +648,12 @@ const ae = W(function(u, T) {
|
|
|
639
648
|
onLoadMore: w,
|
|
640
649
|
hasMore: E = !1,
|
|
641
650
|
className: $,
|
|
642
|
-
style:
|
|
651
|
+
style: k
|
|
643
652
|
} = u, [C, x] = L(/* @__PURE__ */ new Set()), v = _ ?? (C.size > 0 ? Array.from(C) : void 0), i = P(() => {
|
|
644
653
|
let t = m;
|
|
645
654
|
if (v && v.length > 0) {
|
|
646
655
|
const c = new Set(v);
|
|
647
|
-
t = t.filter((
|
|
656
|
+
t = t.filter((a) => c.has(a.type));
|
|
648
657
|
}
|
|
649
658
|
return r && (t = t.slice(0, r)), t;
|
|
650
659
|
}, [m, v, r]), h = P(() => {
|
|
@@ -652,26 +661,26 @@ const ae = W(function(u, T) {
|
|
|
652
661
|
return [{ label: "", events: i }];
|
|
653
662
|
const t = /* @__PURE__ */ new Map();
|
|
654
663
|
for (const c of i) {
|
|
655
|
-
const
|
|
656
|
-
t.has(
|
|
664
|
+
const a = c.timestamp.slice(0, 10);
|
|
665
|
+
t.has(a) || t.set(a, []), t.get(a).push(c);
|
|
657
666
|
}
|
|
658
|
-
return Array.from(t.entries()).map(([c,
|
|
667
|
+
return Array.from(t.entries()).map(([c, a]) => ({ label: c, events: a }));
|
|
659
668
|
}, [i, o]), g = P(() => {
|
|
660
669
|
const t = new Set(m.map((c) => c.type));
|
|
661
670
|
return Array.from(t).sort();
|
|
662
|
-
}, [m]),
|
|
671
|
+
}, [m]), n = (t) => {
|
|
663
672
|
x((c) => {
|
|
664
|
-
const
|
|
665
|
-
return
|
|
673
|
+
const a = new Set(c);
|
|
674
|
+
return a.has(t) ? a.delete(t) : a.add(t), a;
|
|
666
675
|
});
|
|
667
676
|
};
|
|
668
|
-
return /* @__PURE__ */ l("div", { ref:
|
|
677
|
+
return /* @__PURE__ */ l("div", { ref: A, className: `nice-activity-feed ${$ ?? ""}`, style: k, children: [
|
|
669
678
|
N && !_ && /* @__PURE__ */ l("div", { className: "nice-activity-feed__filters", children: [
|
|
670
679
|
g.map((t) => /* @__PURE__ */ e(
|
|
671
680
|
"button",
|
|
672
681
|
{
|
|
673
682
|
className: `nice-activity-feed__filter-chip ${C.has(t) ? "nice-activity-feed__filter-chip--active" : ""}`,
|
|
674
|
-
onClick: () =>
|
|
683
|
+
onClick: () => n(t),
|
|
675
684
|
children: t
|
|
676
685
|
},
|
|
677
686
|
t
|
|
@@ -687,57 +696,49 @@ const ae = W(function(u, T) {
|
|
|
687
696
|
] }),
|
|
688
697
|
i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-activity-feed__empty", children: "No activity." }) : h.map(({ label: t, events: c }) => /* @__PURE__ */ l("div", { className: "nice-activity-feed__group", children: [
|
|
689
698
|
o && t && /* @__PURE__ */ e("div", { className: "nice-activity-feed__date-label", children: t }),
|
|
690
|
-
c.map((
|
|
699
|
+
c.map((a) => /* @__PURE__ */ l(
|
|
691
700
|
"div",
|
|
692
701
|
{
|
|
693
702
|
className: "nice-activity-feed__event",
|
|
694
|
-
onClick: () => s == null ? void 0 : s(
|
|
703
|
+
onClick: () => s == null ? void 0 : s(a),
|
|
695
704
|
role: s ? "button" : void 0,
|
|
696
705
|
tabIndex: s ? 0 : void 0,
|
|
697
|
-
onKeyDown: (
|
|
698
|
-
|
|
706
|
+
onKeyDown: (b) => {
|
|
707
|
+
b.key === "Enter" && s && s(a);
|
|
699
708
|
},
|
|
700
709
|
children: [
|
|
701
710
|
/* @__PURE__ */ e(
|
|
702
711
|
"span",
|
|
703
712
|
{
|
|
704
|
-
className: `nice-activity-feed__icon nice-activity-feed__icon--${
|
|
705
|
-
title:
|
|
713
|
+
className: `nice-activity-feed__icon nice-activity-feed__icon--${a.type}`,
|
|
714
|
+
title: a.type,
|
|
706
715
|
"aria-hidden": "true",
|
|
707
|
-
style: {
|
|
708
|
-
display: "inline-block",
|
|
709
|
-
width: 10,
|
|
710
|
-
height: 10,
|
|
711
|
-
marginTop: 4,
|
|
712
|
-
flexShrink: 0,
|
|
713
|
-
borderRadius: "50%",
|
|
714
|
-
background: G[n.type]
|
|
715
|
-
}
|
|
716
|
+
style: { background: G[a.type] }
|
|
716
717
|
}
|
|
717
718
|
),
|
|
718
719
|
/* @__PURE__ */ l("div", { className: "nice-activity-feed__body", children: [
|
|
719
|
-
|
|
720
|
+
a.actorAvatarUrl && /* @__PURE__ */ e(
|
|
720
721
|
"img",
|
|
721
722
|
{
|
|
722
|
-
src:
|
|
723
|
+
src: a.actorAvatarUrl,
|
|
723
724
|
alt: "",
|
|
724
725
|
className: "nice-activity-feed__avatar"
|
|
725
726
|
}
|
|
726
727
|
),
|
|
727
728
|
/* @__PURE__ */ l("span", { className: "nice-activity-feed__message", children: [
|
|
728
|
-
/* @__PURE__ */ e("strong", { children:
|
|
729
|
+
/* @__PURE__ */ e("strong", { children: a.actorName }),
|
|
729
730
|
" ",
|
|
730
|
-
|
|
731
|
-
|
|
731
|
+
a.message,
|
|
732
|
+
a.targetLabel && /* @__PURE__ */ l(H, { children: [
|
|
732
733
|
" ",
|
|
733
|
-
/* @__PURE__ */ e("em", { children:
|
|
734
|
+
/* @__PURE__ */ e("em", { children: a.targetLabel })
|
|
734
735
|
] })
|
|
735
736
|
] }),
|
|
736
|
-
/* @__PURE__ */ e("time", { className: "nice-activity-feed__time", children:
|
|
737
|
+
/* @__PURE__ */ e("time", { className: "nice-activity-feed__time", children: a.timestamp })
|
|
737
738
|
] })
|
|
738
739
|
]
|
|
739
740
|
},
|
|
740
|
-
|
|
741
|
+
a.id
|
|
741
742
|
))
|
|
742
743
|
] }, t || "__all")),
|
|
743
744
|
E && w && /* @__PURE__ */ e("button", { className: "nice-activity-feed__load-more", onClick: w, children: "Load more" })
|
|
@@ -745,11 +746,11 @@ const ae = W(function(u, T) {
|
|
|
745
746
|
}
|
|
746
747
|
);
|
|
747
748
|
export {
|
|
748
|
-
|
|
749
|
+
ae as NiceActivityFeed,
|
|
749
750
|
X as NiceComments,
|
|
750
751
|
Z as NiceRatings,
|
|
751
752
|
ee as NiceSocialPanel,
|
|
752
753
|
ie as NiceTagCloud,
|
|
753
754
|
te as NiceUserList,
|
|
754
|
-
|
|
755
|
+
ne as NiceWiki
|
|
755
756
|
};
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:is(.nice-user-list,.nice-activity-feed,.nice-comments,.nice-ratings) :where(button){display:inline-flex;align-items:center;justify-content:center;gap:var(--nice-space-1, 4px);padding:var(--nice-space-1, 4px) var(--nice-space-2-5, 10px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #fff);color:var(--nice-text-primary, inherit);font:inherit;font-size:var(--nice-font-size-sm, .8125rem);cursor:pointer}:is(.nice-user-list,.nice-activity-feed,.nice-comments,.nice-ratings) :where(button:hover:not(:disabled)){background:var(--nice-bg-secondary, #f8fafc);border-color:var(--nice-border-strong, #cbd5e1)}:is(.nice-user-list,.nice-activity-feed,.nice-comments,.nice-ratings) :where(button:disabled){opacity:.5;cursor:not-allowed}:is(.nice-user-list,.nice-activity-feed,.nice-comments,.nice-ratings) :where(input[type=text],input[type=number],textarea){box-sizing:border-box;min-width:0;padding:var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #fff);color:var(--nice-text-primary, inherit);font:inherit}:is(.nice-user-list,.nice-activity-feed,.nice-comments,.nice-ratings) :where(button,input,textarea,[role=button]):focus-visible{outline:none;box-shadow:var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6))}.nice-comments{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);min-width:0;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-comments__new,.nice-comments__reply-form,.nice-comments__edit-form{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--nice-space-2, 8px)}.nice-comments__new textarea,.nice-comments__reply-form textarea,.nice-comments__edit-form textarea{flex:1 1 100%;min-height:64px;resize:vertical}.nice-comments__new>button:last-child,.nice-comments__reply-form>button:nth-of-type(1),.nice-comments__edit-form>button:nth-of-type(1){border-color:var(--nice-color-primary, #3b82f6);background:var(--nice-color-primary, #3b82f6);color:var(--nice-text-on-primary, #fff)}.nice-comments__empty{margin:0;padding:var(--nice-space-4, 16px);color:var(--nice-text-muted, #94a3b8);text-align:center}.nice-comments__item{display:flex;flex-direction:column;gap:var(--nice-space-1, 4px);padding:var(--nice-space-2, 8px) 0 var(--nice-space-2, 8px) var(--nice-space-3, 12px);border-left:2px solid var(--nice-border-color, #e2e8f0)}.nice-comments__header{display:flex;flex-wrap:wrap;align-items:center;gap:var(--nice-space-1-5, 6px)}.nice-comments__avatar{width:24px;height:24px;border-radius:var(--nice-radius-circle, 50%);object-fit:cover}.nice-comments__author{font-weight:var(--nice-font-weight-semibold, 600)}.nice-comments__time,.nice-comments__edited{color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-xs, .75rem)}.nice-comments__content{margin:0;line-height:var(--nice-line-height, 1.5);white-space:pre-wrap}.nice-comments__content em{color:var(--nice-text-muted, #94a3b8)}.nice-comments__reactions{display:flex;flex-wrap:wrap;gap:var(--nice-space-1, 4px)}.nice-comments__reaction{padding:0 var(--nice-space-2, 8px);border-radius:var(--nice-radius-full, 9999px);font-size:var(--nice-font-size-xs, .75rem);font-variant-numeric:tabular-nums}.nice-comments__actions{display:flex;flex-wrap:wrap;gap:var(--nice-space-0-5, 2px)}.nice-comments__actions>button{padding:var(--nice-space-0-5, 2px) var(--nice-space-1-5, 6px);border-color:transparent;background:transparent;color:var(--nice-text-secondary, #64748b);font-size:var(--nice-font-size-xs, .75rem)}.nice-comments__actions>button:hover:not(:disabled){border-color:transparent;background:var(--nice-bg-secondary, #f1f5f9);color:var(--nice-text-primary, inherit)}.nice-ratings{display:inline-flex;flex-direction:column;gap:var(--nice-space-1-5, 6px);color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-md, .875rem)}.nice-ratings__label{color:var(--nice-text-secondary, #64748b);font-size:var(--nice-font-size-sm, .8125rem);font-weight:var(--nice-font-weight-medium, 500)}.nice-ratings__body{display:inline-flex;align-items:center;gap:var(--nice-space-0-5, 2px)}.nice-ratings__symbol{display:inline-flex;padding:var(--nice-space-0-5, 2px);border-radius:var(--nice-radius-sm, 4px);color:var(--nice-color-warning, #f59e0b);font-size:1.25em;line-height:1;cursor:pointer;transition:transform var(--nice-transition-fast, .12s ease)}.nice-ratings--sm .nice-ratings__symbol{font-size:1em}.nice-ratings--lg .nice-ratings__symbol{font-size:1.75em}.nice-ratings--hearts .nice-ratings__symbol{color:var(--nice-color-danger, #ef4444)}.nice-ratings--thumbs .nice-ratings__symbol{color:var(--nice-color-primary, #3b82f6)}.nice-ratings__symbol:hover{transform:scale(1.12)}.nice-ratings__symbol:focus-visible{outline:none;box-shadow:var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6))}.nice-ratings--readonly .nice-ratings__symbol{cursor:default}.nice-ratings--readonly .nice-ratings__symbol:hover{transform:none}.nice-ratings__value{margin-left:var(--nice-space-1-5, 6px);color:var(--nice-text-secondary, #64748b);font-size:var(--nice-font-size-sm, .8125rem);font-variant-numeric:tabular-nums}.nice-ratings__numeric{display:inline-flex;align-items:center;gap:var(--nice-space-1-5, 6px)}.nice-ratings__numeric-input{width:72px;text-align:right}.nice-ratings__numeric-max{color:var(--nice-text-muted, #94a3b8)}.nice-ratings__aggregation{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--nice-space-1, 4px) var(--nice-space-2, 8px)}.nice-ratings__avg{font-size:var(--nice-font-size-xxl, 1.25rem);font-variant-numeric:tabular-nums;font-weight:var(--nice-font-weight-bold, 700)}.nice-ratings__count{color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-sm, .8125rem)}.nice-ratings__distribution{display:flex;flex-basis:100%;flex-direction:column;gap:var(--nice-space-0-5, 2px);min-width:200px}.nice-ratings__distribution-row{display:grid;grid-template-columns:1.5em 1fr 2.5em;align-items:center;gap:var(--nice-space-2, 8px);color:var(--nice-text-secondary, #64748b);font-size:var(--nice-font-size-xs, .75rem);font-variant-numeric:tabular-nums}.nice-ratings__distribution-row>span:last-child{text-align:right}.nice-ratings__bar{height:6px;overflow:hidden;border-radius:var(--nice-radius-full, 9999px);background:var(--nice-bg-tertiary, #e2e8f0)}.nice-ratings__bar-fill{height:100%;border-radius:inherit;background:var(--nice-color-warning, #f59e0b)}.nice-social-panel{display:inline-flex;flex-wrap:wrap;gap:var(--nice-space-1-5, 6px);color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-social-panel--vertical{flex-direction:column;align-items:stretch}.nice-social-panel--sm{font-size:var(--nice-font-size-xs, .75rem)}.nice-social-panel--lg{font-size:var(--nice-font-size-md, .875rem)}.nice-social-panel__btn{display:inline-flex;align-items:center;gap:var(--nice-space-1-5, 6px);padding:var(--nice-space-1, 4px) var(--nice-space-2-5, 10px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-full, 9999px);background:var(--nice-bg-primary, #fff);color:var(--nice-text-secondary, #64748b);font:inherit;cursor:pointer;transition:background-color var(--nice-transition-fast, .12s ease),border-color var(--nice-transition-fast, .12s ease)}.nice-social-panel--lg .nice-social-panel__btn{padding:var(--nice-space-1-5, 6px) var(--nice-space-3, 12px)}.nice-social-panel__btn:hover{border-color:var(--nice-border-strong, #cbd5e1);color:var(--nice-text-primary, inherit)}.nice-social-panel__btn:focus-visible{outline:none;box-shadow:var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6))}.nice-social-panel__btn--active{border-color:currentColor}.nice-social-panel__btn--like.nice-social-panel__btn--active{background:color-mix(in srgb,var(--nice-color-danger, #ef4444) 10%,transparent);color:var(--nice-color-danger, #ef4444)}.nice-social-panel__btn--bookmark.nice-social-panel__btn--active{background:color-mix(in srgb,var(--nice-color-warning, #f59e0b) 12%,transparent);color:var(--nice-color-warning, #b45309)}.nice-social-panel__icon{display:inline-flex}.nice-social-panel__count{font-variant-numeric:tabular-nums;font-weight:var(--nice-font-weight-semibold, 600)}.nice-tag-cloud{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--nice-space-1, 4px) var(--nice-space-2-5, 10px);color:var(--nice-text-primary, inherit);line-height:1.3}.nice-tag-cloud__empty{margin:0;color:var(--nice-text-muted, #94a3b8)}.nice-tag-cloud__tag{padding:0 var(--nice-space-1, 4px);border-radius:var(--nice-radius-sm, 4px);white-space:nowrap}.nice-tag-cloud__tag[role=button]{cursor:pointer}.nice-tag-cloud__tag[role=button]:hover{text-decoration:underline}.nice-tag-cloud__tag[role=button]:focus-visible{outline:none;box-shadow:var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6))}.nice-tag-cloud__tag--selected{background:color-mix(in srgb,var(--nice-color-primary, #3b82f6) 14%,transparent);font-weight:var(--nice-font-weight-semibold, 600)}.nice-user-list{display:flex;flex-direction:column;gap:var(--nice-space-2, 8px);min-width:0;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-user-list__search{width:100%}.nice-user-list__empty{margin:0;padding:var(--nice-space-4, 16px);color:var(--nice-text-muted, #94a3b8);text-align:center}.nice-user-list__group{display:flex;flex-direction:column;gap:var(--nice-space-0-5, 2px)}.nice-user-list--grid .nice-user-list__group{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:var(--nice-space-2, 8px)}.nice-user-list__group-title{grid-column:1 / -1;margin:var(--nice-space-1, 4px) 0;color:var(--nice-text-secondary, #64748b);font-size:var(--nice-font-size-xs, .75rem);font-weight:var(--nice-font-weight-semibold, 600);letter-spacing:.04em;text-transform:uppercase}.nice-user-list__item{display:flex;align-items:center;gap:var(--nice-space-2-5, 10px);padding:var(--nice-space-1-5, 6px) var(--nice-space-2, 8px);border-radius:var(--nice-radius-md, 6px)}.nice-user-list__item--grid{flex-direction:column;padding:var(--nice-space-3, 12px);border:1px solid var(--nice-border-color, #e2e8f0);text-align:center}.nice-user-list__item[role=button]{cursor:pointer}.nice-user-list__item[role=button]:hover{background:var(--nice-bg-secondary, #f8fafc)}.nice-user-list__item[role=button]:focus-visible{outline:none;box-shadow:var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6))}.nice-user-list__avatar-wrap{position:relative;flex-shrink:0}.nice-user-list__avatar,.nice-user-list__avatar-placeholder{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:var(--nice-radius-circle, 50%);object-fit:cover}.nice-user-list__avatar-placeholder{background:color-mix(in srgb,var(--nice-color-primary, #3b82f6) 16%,transparent);color:var(--nice-color-primary, #3b82f6);font-weight:var(--nice-font-weight-semibold, 600)}.nice-user-list__status-dot{position:absolute;right:0;bottom:0;width:10px;height:10px;border:2px solid var(--nice-bg-primary, #fff);border-radius:var(--nice-radius-circle, 50%)}.nice-user-list__info{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.nice-user-list__name{overflow:hidden;font-weight:var(--nice-font-weight-medium, 500);text-overflow:ellipsis;white-space:nowrap}.nice-user-list__email{overflow:hidden;color:var(--nice-text-secondary, #64748b);font-size:var(--nice-font-size-xs, .75rem);text-overflow:ellipsis;white-space:nowrap}.nice-user-list__role{align-self:flex-start;margin-top:var(--nice-space-0-5, 2px);padding:0 var(--nice-space-1-5, 6px);border-radius:var(--nice-radius-full, 9999px);background:var(--nice-bg-secondary, #f1f5f9);color:var(--nice-text-secondary, #64748b);font-size:var(--nice-font-size-xxs, .625rem)}.nice-user-list__item--grid .nice-user-list__role{align-self:center}.nice-user-list__actions{display:flex;flex-shrink:0;gap:var(--nice-space-1, 4px)}.nice-user-list__action-btn{padding:var(--nice-space-0-5, 2px) var(--nice-space-2, 8px);font-size:var(--nice-font-size-xs, .75rem);text-transform:capitalize}.nice-activity-feed{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);min-width:0;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-activity-feed__filters{display:flex;flex-wrap:wrap;gap:var(--nice-space-1-5, 6px)}.nice-activity-feed__filter-chip{border-radius:var(--nice-radius-full, 9999px);font-size:var(--nice-font-size-xs, .75rem);text-transform:capitalize}.nice-activity-feed__filter-chip--active,.nice-activity-feed__filter-chip--active:hover:not(:disabled){border-color:var(--nice-color-primary, #3b82f6);background:color-mix(in srgb,var(--nice-color-primary, #3b82f6) 12%,transparent);color:var(--nice-color-primary, #3b82f6)}.nice-activity-feed__filter-clear{border-color:transparent;background:transparent;color:var(--nice-text-secondary, #64748b);font-size:var(--nice-font-size-xs, .75rem)}.nice-activity-feed__empty{margin:0;padding:var(--nice-space-4, 16px);color:var(--nice-text-muted, #94a3b8);text-align:center}.nice-activity-feed__group{display:flex;flex-direction:column;gap:var(--nice-space-0-5, 2px)}.nice-activity-feed__date-label{margin-bottom:var(--nice-space-1, 4px);color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-xs, .75rem);font-weight:var(--nice-font-weight-semibold, 600);letter-spacing:.04em;text-transform:uppercase}.nice-activity-feed__event{display:flex;align-items:flex-start;gap:var(--nice-space-2-5, 10px);padding:var(--nice-space-1-5, 6px) var(--nice-space-2, 8px);border-radius:var(--nice-radius-md, 6px)}.nice-activity-feed__event[role=button]{cursor:pointer}.nice-activity-feed__event[role=button]:hover{background:var(--nice-bg-secondary, #f8fafc)}.nice-activity-feed__event[role=button]:focus-visible{outline:none;box-shadow:var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6))}.nice-activity-feed__icon{flex-shrink:0;width:10px;height:10px;margin-top:var(--nice-space-1, 4px);border-radius:var(--nice-radius-circle, 50%)}.nice-activity-feed__body{display:flex;flex:1 1 auto;flex-wrap:wrap;align-items:baseline;gap:var(--nice-space-1, 4px) var(--nice-space-2, 8px);min-width:0}.nice-activity-feed__avatar{align-self:center;width:22px;height:22px;border-radius:var(--nice-radius-circle, 50%);object-fit:cover}.nice-activity-feed__message{flex:1 1 auto;min-width:0;line-height:var(--nice-line-height, 1.5)}.nice-activity-feed__message em{color:var(--nice-color-primary, #3b82f6);font-style:normal}.nice-activity-feed__time{color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-xs, .75rem);white-space:nowrap}.nice-activity-feed__load-more{align-self:center}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/social",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Nice2Dev Social — Comments, ratings, activity feed, tag cloud, social panel, user list, wiki for React",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.mjs",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
|
-
}
|
|
14
|
+
},
|
|
15
|
+
"./style.css": "./dist/style.css"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
18
|
"dist",
|