@jsenv/navi 0.12.4 → 0.12.6

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.
@@ -12512,15 +12512,23 @@ const CharSlot = ({
12512
12512
  };
12513
12513
  const Icon = ({
12514
12514
  box,
12515
+ href,
12515
12516
  children,
12516
12517
  ...props
12517
12518
  }) => {
12519
+ const innerChildren = href ? jsx("svg", {
12520
+ width: "100%",
12521
+ height: "100%",
12522
+ children: jsx("use", {
12523
+ href: href
12524
+ })
12525
+ }) : children;
12518
12526
  if (box) {
12519
12527
  return jsx(Box, {
12520
12528
  layoutInline: true,
12521
12529
  layoutColumn: true,
12522
12530
  ...props,
12523
- children: children
12531
+ children: innerChildren
12524
12532
  });
12525
12533
  }
12526
12534
  return jsx(CharSlot, {
@@ -12528,7 +12536,7 @@ const Icon = ({
12528
12536
  ...props,
12529
12537
  children: jsx("span", {
12530
12538
  className: "navi_icon",
12531
- children: children
12539
+ children: innerChildren
12532
12540
  })
12533
12541
  });
12534
12542
  };
@@ -20293,8 +20301,143 @@ const Image = props => {
20293
20301
  });
20294
20302
  };
20295
20303
 
20304
+ const Code = ({
20305
+ contentSpacing = " ",
20306
+ children,
20307
+ ...rest
20308
+ }) => {
20309
+ return jsx(Box, {
20310
+ ...rest,
20311
+ as: "code",
20312
+ children: applyContentSpacingOnTextChildren(children, contentSpacing)
20313
+ });
20314
+ };
20315
+
20296
20316
  const LinkWithIcon = () => {};
20297
20317
 
20318
+ installImportMetaCss(import.meta);import.meta.css = /* css */`
20319
+ @layer navi {
20320
+ .navi_message_box {
20321
+ --background-color-info: #eaf6fc;
20322
+ --color-info: #376cc2;
20323
+ --background-color-success: #ecf9ef;
20324
+ --color-success: #50c464;
20325
+ --background-color-warning: #fdf6e3;
20326
+ --color-warning: #f19c05;
20327
+ --background-color-error: #fcebed;
20328
+ --color-error: #eb364b;
20329
+ }
20330
+ }
20331
+
20332
+ .navi_message_box {
20333
+ --x-background-color: var(--background-color-info);
20334
+ --x-color: var(--color-info);
20335
+ /* color: var(--x-color); */
20336
+ background-color: var(--x-background-color);
20337
+ }
20338
+
20339
+ .navi_message_box[data-level="info"] {
20340
+ --x-background-color: var(--background-color-info);
20341
+ --x-color: var(--color-info);
20342
+ }
20343
+ .navi_message_box[data-level="success"] {
20344
+ --x-background-color: var(--background-color-success);
20345
+ --x-color: var(--color-success);
20346
+ }
20347
+ .navi_message_box[data-level="warning"] {
20348
+ --x-background-color: var(--background-color-warning);
20349
+ --x-color: var(--color-warning);
20350
+ }
20351
+ .navi_message_box[data-level="error"] {
20352
+ --x-background-color: var(--background-color-error);
20353
+ --x-color: var(--color-error);
20354
+ }
20355
+
20356
+ .navi_message_box[data-left-stripe] {
20357
+ border-left: 6px solid var(--x-color);
20358
+ border-top-left-radius: 6px;
20359
+ border-bottom-left-radius: 6px;
20360
+ }
20361
+ `;
20362
+ Object.assign(PSEUDO_CLASSES, {
20363
+ ":-navi-info": {
20364
+ add: el => {
20365
+ el.setAttribute("data-level", "info");
20366
+ },
20367
+ remove: el => {
20368
+ if (el.getAttribute("data-level") === "info") {
20369
+ el.removeAttribute("data-level");
20370
+ }
20371
+ }
20372
+ },
20373
+ ":-navi-success": {
20374
+ add: el => {
20375
+ el.setAttribute("data-level", "success");
20376
+ },
20377
+ remove: el => {
20378
+ if (el.getAttribute("data-level") === "success") {
20379
+ el.removeAttribute("data-level");
20380
+ }
20381
+ }
20382
+ },
20383
+ ":-navi-warning": {
20384
+ add: el => {
20385
+ el.setAttribute("data-level", "warning");
20386
+ },
20387
+ remove: el => {
20388
+ if (el.getAttribute("data-level") === "warning") {
20389
+ el.removeAttribute("data-level");
20390
+ }
20391
+ }
20392
+ },
20393
+ ":-navi-error": {
20394
+ add: el => {
20395
+ el.setAttribute("data-level", "error");
20396
+ },
20397
+ remove: el => {
20398
+ if (el.getAttribute("data-level") === "error") {
20399
+ el.removeAttribute("data-level");
20400
+ }
20401
+ }
20402
+ }
20403
+ });
20404
+ const MessageBoxPseudoClasses = [":-navi-info", ":-navi-success", ":-navi-warning", ":-navi-error"];
20405
+ const MessageBoxLevelContext = createContext();
20406
+ const MessageBoxReportTitleChildContext = createContext();
20407
+ const MessageBox = ({
20408
+ level = "info",
20409
+ padding = "sm",
20410
+ contentSpacing = " ",
20411
+ leftStripe,
20412
+ children,
20413
+ ...rest
20414
+ }) => {
20415
+ const [hasTitleChild, setHasTitleChild] = useState(false);
20416
+ const innerLeftStripe = leftStripe === undefined ? hasTitleChild : leftStripe;
20417
+ return jsx(Box, {
20418
+ as: "div",
20419
+ role: level === "info" ? "status" : "alert",
20420
+ "data-left-stripe": innerLeftStripe ? "" : undefined,
20421
+ ...rest,
20422
+ baseClassName: "navi_message_box",
20423
+ padding: padding,
20424
+ pseudoClasses: MessageBoxPseudoClasses,
20425
+ basePseudoState: {
20426
+ ":-navi-info": level === "info",
20427
+ ":-navi-success": level === "success",
20428
+ ":-navi-warning": level === "warning",
20429
+ ":-navi-error": level === "error"
20430
+ },
20431
+ children: jsx(MessageBoxLevelContext.Provider, {
20432
+ value: level,
20433
+ children: jsx(MessageBoxReportTitleChildContext.Provider, {
20434
+ value: setHasTitleChild,
20435
+ children: applyContentSpacingOnTextChildren(children, contentSpacing)
20436
+ })
20437
+ })
20438
+ });
20439
+ };
20440
+
20298
20441
  const Svg = props => {
20299
20442
  return jsx(Box, {
20300
20443
  ...props,
@@ -20303,16 +20446,29 @@ const Svg = props => {
20303
20446
  };
20304
20447
 
20305
20448
  const Title = ({
20306
- as = "h1",
20449
+ as,
20307
20450
  bold = true,
20308
20451
  contentSpacing = " ",
20452
+ color,
20309
20453
  children,
20454
+ marginTop,
20455
+ marginBottom,
20310
20456
  ...rest
20311
20457
  }) => {
20458
+ const messageBoxLevel = useContext(MessageBoxLevelContext);
20459
+ const reportTitleToMessageBox = useContext(MessageBoxReportTitleChildContext);
20460
+ const innerColor = color === undefined ? messageBoxLevel ? `var(--x-color)` : undefined : color;
20461
+ const innerAs = as === undefined ? messageBoxLevel ? "h4" : "h1" : as;
20462
+ reportTitleToMessageBox?.(true);
20463
+ const innerMarginTop = marginTop === undefined ? messageBoxLevel ? "0" : undefined : marginTop;
20464
+ const innerMarginBottom = marginBottom === undefined ? messageBoxLevel ? "8px" : undefined : marginBottom;
20312
20465
  return jsx(Box, {
20313
20466
  ...rest,
20314
- as: as,
20467
+ as: innerAs,
20315
20468
  bold: bold,
20469
+ color: innerColor,
20470
+ marginTop: innerMarginTop,
20471
+ marginBottom: innerMarginBottom,
20316
20472
  children: applyContentSpacingOnTextChildren(children, contentSpacing)
20317
20473
  });
20318
20474
  };
@@ -20394,5 +20550,5 @@ const useDependenciesDiff = (inputs) => {
20394
20550
  return diffRef.current;
20395
20551
  };
20396
20552
 
20397
- export { ActionRenderer, ActiveKeyboardShortcuts, Box, Button, CharSlot, Checkbox, CheckboxList, Col, Colgroup, Count, Details, Editable, ErrorBoundaryContext, FontSizedSvg, Form, Icon, IconAndText, Image, Input, Label, Layout, Link, LinkWithIcon, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, Select, SelectionContext, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, actionIntegratedVia, addCustomMessage, createAction, createSelectionKeyboardShortcuts, createUniqueValueConstraint, enableDebugActions, enableDebugOnDocumentLoading, forwardActionRequested, goBack, goForward, goTo, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, openCallout, rawUrlPart, reload, removeCustomMessage, rerunActions, resource, setBaseUrl, setupRoutes, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useCellsAndColumns, useDependenciesDiff, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, valueInLocalStorage };
20553
+ export { ActionRenderer, ActiveKeyboardShortcuts, Box, Button, CharSlot, Checkbox, CheckboxList, Code, Col, Colgroup, Count, Details, Editable, ErrorBoundaryContext, FontSizedSvg, Form, Icon, IconAndText, Image, Input, Label, Layout, Link, LinkWithIcon, MessageBox, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, Select, SelectionContext, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, actionIntegratedVia, addCustomMessage, createAction, createSelectionKeyboardShortcuts, createUniqueValueConstraint, enableDebugActions, enableDebugOnDocumentLoading, forwardActionRequested, goBack, goForward, goTo, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, openCallout, rawUrlPart, reload, removeCustomMessage, rerunActions, resource, setBaseUrl, setupRoutes, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useCellsAndColumns, useDependenciesDiff, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, valueInLocalStorage };
20398
20554
  //# sourceMappingURL=jsenv_navi.js.map