@dbcdk/react-components 0.0.148 → 0.0.149

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/client.cjs CHANGED
@@ -89,6 +89,7 @@ var InlineStatus = require('./components/inline-status/InlineStatus');
89
89
  var MediaCard = require('./components/media-card/MediaCard');
90
90
  var Lightbox = require('./components/lightbox/Lightbox');
91
91
  var FileUpload = require('./components/forms/file-upload/FileUpload');
92
+ var HighlightedText = require('./components/highlighted-text/HighlightedText');
92
93
 
93
94
 
94
95
 
@@ -620,3 +621,9 @@ Object.keys(FileUpload).forEach(function (k) {
620
621
  get: function () { return FileUpload[k]; }
621
622
  });
622
623
  });
624
+ Object.keys(HighlightedText).forEach(function (k) {
625
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
626
+ enumerable: true,
627
+ get: function () { return HighlightedText[k]; }
628
+ });
629
+ });
package/dist/client.d.ts CHANGED
@@ -86,3 +86,4 @@ export * from './components/inline-status/InlineStatus';
86
86
  export * from './components/media-card/MediaCard';
87
87
  export * from './components/lightbox/Lightbox';
88
88
  export * from './components/forms/file-upload/FileUpload';
89
+ export * from './components/highlighted-text/HighlightedText';
package/dist/client.js CHANGED
@@ -87,3 +87,4 @@ export * from './components/inline-status/InlineStatus';
87
87
  export * from './components/media-card/MediaCard';
88
88
  export * from './components/lightbox/Lightbox';
89
89
  export * from './components/forms/file-upload/FileUpload';
90
+ export * from './components/highlighted-text/HighlightedText';
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+
6
+ function escapeRegExp(value) {
7
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8
+ }
9
+ function HighlightedText({ text, query, className }) {
10
+ const trimmedQuery = query == null ? void 0 : query.trim();
11
+ if (!trimmedQuery) {
12
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: text });
13
+ }
14
+ const pattern = new RegExp(`(${escapeRegExp(trimmedQuery)})`, "gi");
15
+ const parts = text.split(pattern);
16
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: parts.map(
17
+ (part, index) => index % 2 === 1 ? /* @__PURE__ */ jsxRuntime.jsx("mark", { className: "dbc-highlight", children: part }, index) : /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: part }, index)
18
+ ) });
19
+ }
20
+
21
+ exports.HighlightedText = HighlightedText;
@@ -0,0 +1,7 @@
1
+ import type { JSX } from 'react';
2
+ export interface HighlightedTextProps {
3
+ text: string;
4
+ query?: string;
5
+ className?: string;
6
+ }
7
+ export declare function HighlightedText({ text, query, className }: HighlightedTextProps): JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { Fragment } from 'react';
3
+
4
+ function escapeRegExp(value) {
5
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6
+ }
7
+ function HighlightedText({ text, query, className }) {
8
+ const trimmedQuery = query == null ? void 0 : query.trim();
9
+ if (!trimmedQuery) {
10
+ return /* @__PURE__ */ jsx("span", { className, children: text });
11
+ }
12
+ const pattern = new RegExp(`(${escapeRegExp(trimmedQuery)})`, "gi");
13
+ const parts = text.split(pattern);
14
+ return /* @__PURE__ */ jsx("span", { className, children: parts.map(
15
+ (part, index) => index % 2 === 1 ? /* @__PURE__ */ jsx("mark", { className: "dbc-highlight", children: part }, index) : /* @__PURE__ */ jsx(Fragment, { children: part }, index)
16
+ ) });
17
+ }
18
+
19
+ export { HighlightedText };
@@ -3,9 +3,9 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var lucideReact = require('lucide-react');
6
- var utils = require('./utils');
7
- var HighlightedText = require('./HighlightedText');
6
+ var HighlightedText = require('../../components/highlighted-text/HighlightedText');
8
7
  var styles = require('./JsonViewer.module.css');
8
+ var utils = require('./utils');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
11
 
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { Check, Copy, ChevronDown, ChevronRight } from 'lucide-react';
4
- import { getNodeId, getValueType, formatPrimitive, getPrimitiveRawValue, capitalize, getPathLabel, isJsonArray, isJsonObject, getSummary } from './utils';
5
- import { HighlightedText } from './HighlightedText';
4
+ import { HighlightedText } from '../../components/highlighted-text/HighlightedText';
6
5
  import styles from './JsonViewer.module.css';
6
+ import { getNodeId, getValueType, formatPrimitive, getPrimitiveRawValue, capitalize, getPathLabel, isJsonArray, isJsonObject, getSummary } from './utils';
7
7
 
8
8
  function JsonNode({
9
9
  keyName,
package/dist/index.cjs CHANGED
@@ -35,6 +35,7 @@ var StatePage = require('./components/state-page/StatePage');
35
35
  var Alert = require('./components/alert/Alert');
36
36
  var InlineStatus = require('./components/inline-status/InlineStatus');
37
37
  var MediaCard = require('./components/media-card/MediaCard');
38
+ var HighlightedText = require('./components/highlighted-text/HighlightedText');
38
39
 
39
40
 
40
41
 
@@ -248,3 +249,9 @@ Object.keys(MediaCard).forEach(function (k) {
248
249
  get: function () { return MediaCard[k]; }
249
250
  });
250
251
  });
252
+ Object.keys(HighlightedText).forEach(function (k) {
253
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
254
+ enumerable: true,
255
+ get: function () { return HighlightedText[k]; }
256
+ });
257
+ });
package/dist/index.d.ts CHANGED
@@ -34,3 +34,4 @@ export * from './components/state-page/StatePage';
34
34
  export * from './components/alert/Alert';
35
35
  export * from './components/inline-status/InlineStatus';
36
36
  export * from './components/media-card/MediaCard';
37
+ export * from './components/highlighted-text/HighlightedText';
package/dist/index.js CHANGED
@@ -33,3 +33,4 @@ export * from './components/state-page/StatePage';
33
33
  export * from './components/alert/Alert';
34
34
  export * from './components/inline-status/InlineStatus';
35
35
  export * from './components/media-card/MediaCard';
36
+ export * from './components/highlighted-text/HighlightedText';
@@ -162,6 +162,10 @@
162
162
  }
163
163
 
164
164
  /* Padding - all axes */
165
+ .dbc-p-0 {
166
+ padding: 0;
167
+ }
168
+
165
169
  .dbc-p-xxs {
166
170
  padding: var(--spacing-xxs);
167
171
  }
@@ -229,7 +229,6 @@ body.dbc-app {
229
229
  color: var(--color-highlight-fg, inherit);
230
230
  background-color: var(--color-highlight-bg, var(--color-status-warning-bg));
231
231
  border-radius: var(--border-radius-sm);
232
- padding-inline: var(--spacing-xs);
233
232
  box-decoration-break: clone;
234
233
  -webkit-box-decoration-break: clone;
235
234
  }
package/dist/styles.css CHANGED
@@ -229,7 +229,6 @@ body.dbc-app {
229
229
  color: var(--color-highlight-fg, inherit);
230
230
  background-color: var(--color-highlight-bg, var(--color-status-warning-bg));
231
231
  border-radius: var(--border-radius-sm);
232
- padding-inline: var(--spacing-xs);
233
232
  box-decoration-break: clone;
234
233
  -webkit-box-decoration-break: clone;
235
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.148",
3
+ "version": "0.0.149",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var react = require('react');
5
- var getHighlightedSegments = require('../../utils/text/get-highlighted-segments');
6
-
7
- function HighlightedText({ text, query }) {
8
- return getHighlightedSegments.getHighlightedSegments(text, query).map(
9
- (segment, index) => segment.matched ? /* @__PURE__ */ jsxRuntime.jsx("mark", { className: "dbc-highlight", children: segment.text }, `${segment.text}-${index}`) : /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: segment.text }, `${segment.text}-${index}`)
10
- );
11
- }
12
-
13
- exports.HighlightedText = HighlightedText;
@@ -1,5 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- export declare function HighlightedText({ text, query }: {
3
- text: string;
4
- query: string;
5
- }): ReactNode;
@@ -1,11 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Fragment } from 'react';
3
- import { getHighlightedSegments } from '../../utils/text/get-highlighted-segments';
4
-
5
- function HighlightedText({ text, query }) {
6
- return getHighlightedSegments(text, query).map(
7
- (segment, index) => segment.matched ? /* @__PURE__ */ jsx("mark", { className: "dbc-highlight", children: segment.text }, `${segment.text}-${index}`) : /* @__PURE__ */ jsx(Fragment, { children: segment.text }, `${segment.text}-${index}`)
8
- );
9
- }
10
-
11
- export { HighlightedText };