@nubitio/ui 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -41,12 +41,13 @@ const Avatar = ({ owner = "", size, variant = "md", shape = "circle", alt, class
41
41
  const px = size ?? NAMED_SIZES[variant];
42
42
  const initials = getAvatarInitials(owner);
43
43
  const hue = getAvatarHue(owner);
44
+ const classes = [
45
+ "nb-avatar",
46
+ shape === "square" && "nb-avatar--square",
47
+ className
48
+ ].filter(Boolean).join(" ");
44
49
  return /* @__PURE__ */ jsx("span", {
45
- className: [
46
- "nb-avatar",
47
- shape === "square" && "nb-avatar--square",
48
- className
49
- ].filter(Boolean).join(" "),
50
+ className: classes,
50
51
  role: "img",
51
52
  "aria-label": alt ?? (owner || "Avatar"),
52
53
  style: {
@@ -114,7 +115,38 @@ const EN_UI_STRINGS = {
114
115
  view: "View",
115
116
  pages: "Pages",
116
117
  previousPage: "Previous page",
117
- nextPage: "Next page"
118
+ nextPage: "Next page",
119
+ settingsMenu: "Display settings",
120
+ accentColor: "Accent color",
121
+ accentColors: "Accent colors",
122
+ density: "Density",
123
+ interfaceDensity: "Interface density",
124
+ densityNormal: "Normal",
125
+ densityCompact: "Compact",
126
+ mainNavigation: "Main navigation",
127
+ mainMenu: "Main menu",
128
+ closeMenu: "Close menu",
129
+ toggleMenu: "Toggle menu",
130
+ mainToolbar: "Main toolbar",
131
+ mainContent: "Main content",
132
+ userMenu: "User menu",
133
+ loadingSession: "Loading session",
134
+ textFormatting: "Text formatting",
135
+ bold: "Bold (Ctrl+B)",
136
+ italic: "Italic (Ctrl+I)",
137
+ strikethrough: "Strikethrough",
138
+ heading2: "Heading 2",
139
+ heading3: "Heading 3",
140
+ bulletList: "Bullet list",
141
+ orderedList: "Ordered list",
142
+ blockquote: "Blockquote",
143
+ addLink: "Add link",
144
+ removeLink: "Remove link",
145
+ undo: "Undo (Ctrl+Z)",
146
+ redo: "Redo (Ctrl+Y)",
147
+ featureUnavailable: "This feature is not available on your current plan.",
148
+ featureRequiresPlan: "This feature requires the {plan} plan. Upgrade your plan to unlock it.",
149
+ viewPlans: "View plans"
118
150
  };
119
151
  const ES_UI_STRINGS = {
120
152
  close: "Cerrar",
@@ -142,7 +174,38 @@ const ES_UI_STRINGS = {
142
174
  view: "Ver",
143
175
  pages: "Páginas",
144
176
  previousPage: "Página anterior",
145
- nextPage: "Página siguiente"
177
+ nextPage: "Página siguiente",
178
+ settingsMenu: "Ajustes de visualización",
179
+ accentColor: "Color de acento",
180
+ accentColors: "Colores de acento",
181
+ density: "Densidad",
182
+ interfaceDensity: "Densidad de interfaz",
183
+ densityNormal: "Normal",
184
+ densityCompact: "Compacta",
185
+ mainNavigation: "Navegación principal",
186
+ mainMenu: "Menú principal",
187
+ closeMenu: "Cerrar menú",
188
+ toggleMenu: "Alternar menú",
189
+ mainToolbar: "Barra de herramientas principal",
190
+ mainContent: "Contenido principal",
191
+ userMenu: "Menú de usuario",
192
+ loadingSession: "Cargando sesión",
193
+ textFormatting: "Formato de texto",
194
+ bold: "Negrita (Ctrl+B)",
195
+ italic: "Cursiva (Ctrl+I)",
196
+ strikethrough: "Tachado",
197
+ heading2: "Título 2",
198
+ heading3: "Título 3",
199
+ bulletList: "Lista con viñetas",
200
+ orderedList: "Lista numerada",
201
+ blockquote: "Cita",
202
+ addLink: "Añadir enlace",
203
+ removeLink: "Quitar enlace",
204
+ undo: "Deshacer (Ctrl+Z)",
205
+ redo: "Rehacer (Ctrl+Y)",
206
+ featureUnavailable: "Esta función no está disponible en tu plan actual.",
207
+ featureRequiresPlan: "Esta función requiere el plan {plan}. Actualiza tu plan para desbloquearla.",
208
+ viewPlans: "Ver planes"
146
209
  };
147
210
  const UiStringsContext = createContext(EN_UI_STRINGS);
148
211
  const UiStringsProvider = ({ strings, children }) => {
@@ -261,6 +324,7 @@ const AppDialog = ({ visible, open, title, onClose, children, footer, width, max
261
324
  function ConfirmDialog({ open, title, message, onConfirm, onCancel, confirmLabel, cancelLabel, variant = "warning" }) {
262
325
  const strings = useUiStrings();
263
326
  const resolvedConfirmLabel = confirmLabel ?? strings.confirm;
327
+ const resolvedCancelLabel = cancelLabel ?? strings.cancel;
264
328
  return /* @__PURE__ */ jsx(AppDialog, {
265
329
  open,
266
330
  title,
@@ -271,7 +335,7 @@ function ConfirmDialog({ open, title, message, onConfirm, onCancel, confirmLabel
271
335
  variant: "secondary",
272
336
  onClick: onCancel,
273
337
  autoFocus: true,
274
- children: cancelLabel ?? strings.cancel
338
+ children: resolvedCancelLabel
275
339
  }), /* @__PURE__ */ jsx(Button, {
276
340
  variant: variant === "danger" ? "danger" : "primary",
277
341
  onClick: onConfirm,
@@ -1150,21 +1214,22 @@ function useAccentColor() {
1150
1214
  //#endregion
1151
1215
  //#region packages/ui/SettingsPanel.tsx
1152
1216
  const SettingsPanel = ({ onClose: _onClose }) => {
1217
+ const strings = useUiStrings();
1153
1218
  const { density, toggleDensity } = useDensity();
1154
1219
  const { accent, changeAccent, presets } = useAccentColor();
1155
1220
  return /* @__PURE__ */ jsxs("div", {
1156
1221
  className: "nb-settings-panel",
1157
1222
  role: "menu",
1158
- "aria-label": "Display settings",
1223
+ "aria-label": strings.settingsMenu,
1159
1224
  children: [
1160
1225
  /* @__PURE__ */ jsx("p", {
1161
1226
  className: "nb-settings-panel__heading",
1162
- children: "Color de acento"
1227
+ children: strings.accentColor
1163
1228
  }),
1164
1229
  /* @__PURE__ */ jsx("div", {
1165
1230
  className: "nb-settings-panel__swatches",
1166
1231
  role: "group",
1167
- "aria-label": "Colores de acento",
1232
+ "aria-label": strings.accentColors,
1168
1233
  children: presets.map((preset) => /* @__PURE__ */ jsx("button", {
1169
1234
  className: "nb-settings-panel__swatch",
1170
1235
  type: "button",
@@ -1181,12 +1246,12 @@ const SettingsPanel = ({ onClose: _onClose }) => {
1181
1246
  /* @__PURE__ */ jsx("hr", { className: "nb-settings-panel__divider" }),
1182
1247
  /* @__PURE__ */ jsx("p", {
1183
1248
  className: "nb-settings-panel__heading",
1184
- children: "Densidad"
1249
+ children: strings.density
1185
1250
  }),
1186
1251
  /* @__PURE__ */ jsxs("div", {
1187
1252
  className: "nb-settings-panel__density",
1188
1253
  role: "group",
1189
- "aria-label": "Densidad de interfaz",
1254
+ "aria-label": strings.interfaceDensity,
1190
1255
  children: [/* @__PURE__ */ jsxs("button", {
1191
1256
  className: "nb-settings-panel__density-btn",
1192
1257
  type: "button",
@@ -1195,7 +1260,7 @@ const SettingsPanel = ({ onClose: _onClose }) => {
1195
1260
  children: [/* @__PURE__ */ jsx("i", {
1196
1261
  className: "ph ph-rows",
1197
1262
  "aria-hidden": "true"
1198
- }), "Normal"]
1263
+ }), strings.densityNormal]
1199
1264
  }), /* @__PURE__ */ jsxs("button", {
1200
1265
  className: "nb-settings-panel__density-btn",
1201
1266
  type: "button",
@@ -1204,7 +1269,7 @@ const SettingsPanel = ({ onClose: _onClose }) => {
1204
1269
  children: [/* @__PURE__ */ jsx("i", {
1205
1270
  className: "ph ph-rows-plus-bottom",
1206
1271
  "aria-hidden": "true"
1207
- }), "Compact"]
1272
+ }), strings.densityCompact]
1208
1273
  })]
1209
1274
  })
1210
1275
  ]
@@ -1213,22 +1278,25 @@ const SettingsPanel = ({ onClose: _onClose }) => {
1213
1278
  //#endregion
1214
1279
  //#region packages/ui/Badge.tsx
1215
1280
  const Badge = ({ variant = "primary", size = "md", outlined = false, pill = true, dot = false, children, className }) => {
1281
+ const classes = [
1282
+ "nb-badge",
1283
+ `nb-badge--${variant}`,
1284
+ size === "sm" && "nb-badge--sm",
1285
+ outlined && "nb-badge--outlined",
1286
+ pill && "nb-badge--pill",
1287
+ dot && "nb-badge--dot",
1288
+ className
1289
+ ].filter(Boolean).join(" ");
1216
1290
  return /* @__PURE__ */ jsx("span", {
1217
- className: [
1218
- "nb-badge",
1219
- `nb-badge--${variant}`,
1220
- size === "sm" && "nb-badge--sm",
1221
- outlined && "nb-badge--outlined",
1222
- pill && "nb-badge--pill",
1223
- dot && "nb-badge--dot",
1224
- className
1225
- ].filter(Boolean).join(" "),
1291
+ className: classes,
1226
1292
  children: dot ? null : children
1227
1293
  });
1228
1294
  };
1229
1295
  //#endregion
1230
1296
  //#region packages/ui/FeatureGate.tsx
1231
- function FeatureGate({ featureKey, children, enabled = false, behavior = "lock", planBadge = "Pro", upgradeMessage, upgradeUrl = "/settings", lockTooltip = "Esta función no está disponible en tu plan actual." }) {
1297
+ function FeatureGate({ featureKey, children, enabled = false, behavior = "lock", planBadge = "Pro", upgradeMessage, upgradeUrl = "/settings", lockTooltip }) {
1298
+ const strings = useUiStrings();
1299
+ const tooltip = lockTooltip ?? strings.featureUnavailable;
1232
1300
  if (enabled) return /* @__PURE__ */ jsx("div", {
1233
1301
  className: "feature-gate",
1234
1302
  children
@@ -1241,15 +1309,16 @@ function FeatureGate({ featureKey, children, enabled = false, behavior = "lock",
1241
1309
  });
1242
1310
  return /* @__PURE__ */ jsx("div", {
1243
1311
  className: "feature-gate--locked",
1244
- title: lockTooltip,
1245
- "aria-label": lockTooltip,
1312
+ title: tooltip,
1313
+ "aria-label": tooltip,
1246
1314
  role: "presentation",
1247
1315
  children
1248
1316
  });
1249
1317
  }
1250
1318
  function UpgradeGate({ planBadge, upgradeMessage, upgradeUrl, children }) {
1319
+ const strings = useUiStrings();
1251
1320
  const [open, setOpen] = useState(false);
1252
- const message = upgradeMessage ?? `Esta función requiere el plan ${planBadge}. Actualiza tu plan para desbloquearla.`;
1321
+ const message = upgradeMessage ?? strings.featureRequiresPlan.replace("{plan}", planBadge);
1253
1322
  return /* @__PURE__ */ jsxs("div", {
1254
1323
  className: "feature-gate--upgrade",
1255
1324
  onBlur: (e) => {
@@ -1285,13 +1354,13 @@ function UpgradeGate({ planBadge, upgradeMessage, upgradeUrl, children }) {
1285
1354
  children: [
1286
1355
  /* @__PURE__ */ jsx(IconButton, {
1287
1356
  icon: "ph ph-x",
1288
- label: "Cerrar",
1357
+ label: strings.close,
1289
1358
  onClick: () => setOpen(false)
1290
1359
  }),
1291
1360
  /* @__PURE__ */ jsx("p", { children: message }),
1292
1361
  /* @__PURE__ */ jsx("a", {
1293
1362
  href: upgradeUrl,
1294
- children: "Ver planes"
1363
+ children: strings.viewPlans
1295
1364
  })
1296
1365
  ]
1297
1366
  })
@@ -1334,14 +1403,15 @@ const DEFAULT_ICONS = {
1334
1403
  };
1335
1404
  const EmptyState = ({ icon, variant = "default", title, description, action, size = "md", fill = false, className }) => {
1336
1405
  const iconName = icon ?? DEFAULT_ICONS[variant];
1406
+ const classes = [
1407
+ "nb-empty-state",
1408
+ `nb-empty-state--${variant}`,
1409
+ `nb-empty-state--${size}`,
1410
+ fill && "nb-empty-state--fill",
1411
+ className
1412
+ ].filter(Boolean).join(" ");
1337
1413
  return /* @__PURE__ */ jsxs("div", {
1338
- className: [
1339
- "nb-empty-state",
1340
- `nb-empty-state--${variant}`,
1341
- `nb-empty-state--${size}`,
1342
- fill && "nb-empty-state--fill",
1343
- className
1344
- ].filter(Boolean).join(" "),
1414
+ className: classes,
1345
1415
  role: "status",
1346
1416
  "aria-live": "polite",
1347
1417
  children: [
@@ -1374,12 +1444,13 @@ const EmptyState = ({ icon, variant = "default", title, description, action, siz
1374
1444
  * Use for category filters, tag lists, and multi-select inputs.
1375
1445
  */
1376
1446
  const Chip = ({ label, active = false, count, icon, size = "md", disabled = false, onClick, className = "" }) => {
1447
+ const sizeClass = size !== "md" ? ` nb-chip--${size}` : "";
1377
1448
  return /* @__PURE__ */ jsxs("button", {
1378
1449
  type: "button",
1379
1450
  role: "checkbox",
1380
1451
  "aria-checked": active,
1381
1452
  disabled,
1382
- className: `nb-chip${size !== "md" ? ` nb-chip--${size}` : ""}${active ? " is-active" : ""}${className ? ` ${className}` : ""}`,
1453
+ className: `nb-chip${sizeClass}${active ? " is-active" : ""}${className ? ` ${className}` : ""}`,
1383
1454
  onClick,
1384
1455
  children: [
1385
1456
  icon && /* @__PURE__ */ jsx("i", {
@@ -2615,8 +2686,10 @@ function DateRangePicker({ startValue, endValue, placeholder = "dd/mm/yyyy", dis
2615
2686
  onChange?.(a, b);
2616
2687
  } else if (field === "start") onChange?.(parsed, endIso ?? "");
2617
2688
  else onChange?.(startIso ?? "", parsed);
2618
- } else if (text === "") if (field === "start") onChange?.("", endIso ?? "");
2619
- else onChange?.(startIso ?? "", "");
2689
+ } else if (text === "") {
2690
+ if (field === "start") onChange?.("", endIso ?? "");
2691
+ else onChange?.(startIso ?? "", "");
2692
+ }
2620
2693
  };
2621
2694
  const handleStartBlur = (e) => {
2622
2695
  const related = e.relatedTarget;
@@ -2998,13 +3071,14 @@ function TimelineMarker({ status, variant, marker }) {
2998
3071
  }
2999
3072
  function TimelineItem({ status, title, marker, timestamp, dateTime, tone = "default", children, className }) {
3000
3073
  const variant = useTimelineVariant();
3074
+ const classes = [
3075
+ "nb-timeline__item",
3076
+ `nb-timeline__item--${status}`,
3077
+ variant === "log" && `nb-timeline__item--tone-${tone}`,
3078
+ className
3079
+ ].filter(Boolean).join(" ");
3001
3080
  return /* @__PURE__ */ jsxs("li", {
3002
- className: [
3003
- "nb-timeline__item",
3004
- `nb-timeline__item--${status}`,
3005
- variant === "log" && `nb-timeline__item--tone-${tone}`,
3006
- className
3007
- ].filter(Boolean).join(" "),
3081
+ className: classes,
3008
3082
  children: [/* @__PURE__ */ jsx("div", {
3009
3083
  className: "nb-timeline__marker-col",
3010
3084
  children: /* @__PURE__ */ jsx(TimelineMarker, {
@@ -3137,8 +3211,9 @@ function Grid({ children, cols = 12, gap = 4, minColWidth, fill, className, styl
3137
3211
  ...style,
3138
3212
  ...minColWidth ? { "--nb-grid-min-col": minColWidth } : {}
3139
3213
  };
3214
+ const colsClass = cols === 12 ? "nb-grid--cols-12" : cols === "auto" ? "nb-grid--cols-auto" : `nb-grid--cols-${cols}`;
3140
3215
  return /* @__PURE__ */ jsx("div", {
3141
- className: joinClasses("nb-grid", cols === 12 ? "nb-grid--cols-12" : cols === "auto" ? "nb-grid--cols-auto" : `nb-grid--cols-${cols}`, gapClass("nb-grid", gap), fill && "nb-grid--fill", className),
3216
+ className: joinClasses("nb-grid", colsClass, gapClass("nb-grid", gap), fill && "nb-grid--fill", className),
3142
3217
  style: gridStyle,
3143
3218
  ...props,
3144
3219
  children
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nubitio/ui",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "description": "Visual primitives and theme system for the Nubit admin stack (dialogs, cards, toolbar, light/dark theme).",
6
6
  "license": "MIT",