@sebgroup/green-react 3.0.2 → 3.2.0

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/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import React, { useState, useEffect, useMemo, useRef, useLayoutEffect, forwardRef, useCallback, useId } from 'react';
3
3
  import { randomId, validateClassName, debounce, delay, sliderColors, getSliderTrackBackground } from '@sebgroup/extract';
4
4
  import { createComponent } from '@lit/react';
5
- import { getScopedTagName, GdsDatepicker, GdsDropdown, GdsOption, GdsContextMenu, GdsMenuItem } from '@sebgroup/green-core';
5
+ import { getScopedTagName, GdsDatepicker, GdsContextMenu, GdsMenuItem, GdsMenuHeading, GdsDropdown, GdsOption } from '@sebgroup/green-core';
6
6
  import { registerTransitionalStyles } from '@sebgroup/green-core/transitional-styles';
7
7
  import classNames from 'classnames';
8
8
 
@@ -2256,6 +2256,30 @@ $$a({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }
2256
2256
  }
2257
2257
  });
2258
2258
 
2259
+ registerTransitionalStyles();
2260
+ const ContextMenu = createComponent({
2261
+ tagName: getScopedTagName('gds-context-menu'),
2262
+ elementClass: GdsContextMenu,
2263
+ events: {
2264
+ onMenuItemClick: 'gds-menu-item-click',
2265
+ onUiStateChange: 'gds-ui-state'
2266
+ },
2267
+ react: React
2268
+ });
2269
+ const MenuItem = createComponent({
2270
+ tagName: getScopedTagName('gds-menu-item'),
2271
+ elementClass: GdsMenuItem,
2272
+ events: {
2273
+ onMenuItemClick: 'gds-menu-item-click'
2274
+ },
2275
+ react: React
2276
+ });
2277
+ const CoreMenuHeading = createComponent({
2278
+ tagName: getScopedTagName('gds-menu-heading'),
2279
+ elementClass: GdsMenuHeading,
2280
+ react: React
2281
+ });
2282
+
2259
2283
  registerTransitionalStyles();
2260
2284
  const CoreDropdown = createComponent({
2261
2285
  tagName: getScopedTagName('gds-dropdown'),
@@ -2329,11 +2353,18 @@ const Dropdown = ({
2329
2353
  "aria-hidden": true
2330
2354
  }, {
2331
2355
  children: (texts === null || texts === void 0 ? void 0 : texts.placeholder) || 'Select'
2332
- })), options.map(option => jsx(CoreOption, Object.assign({
2333
- value: option[_useValue]
2334
- }, {
2335
- children: option[_display]
2336
- }), option[_useValue]))]
2356
+ })), options.map(option => {
2357
+ if (option.heading) {
2358
+ return jsx(CoreMenuHeading, {
2359
+ children: option[_display]
2360
+ }, option.label);
2361
+ }
2362
+ return jsx(CoreOption, Object.assign({
2363
+ value: option[_useValue]
2364
+ }, {
2365
+ children: option[_display]
2366
+ }), option[_useValue]);
2367
+ })]
2337
2368
  }))
2338
2369
  }));
2339
2370
  };
@@ -5218,25 +5249,6 @@ const Modal = _a => {
5218
5249
  });
5219
5250
  };
5220
5251
 
5221
- registerTransitionalStyles();
5222
- const ContextMenu = createComponent({
5223
- tagName: getScopedTagName('gds-context-menu'),
5224
- elementClass: GdsContextMenu,
5225
- events: {
5226
- onMenuItemClick: 'gds-menu-item-click',
5227
- onUiStateChange: 'gds-ui-state'
5228
- },
5229
- react: React
5230
- });
5231
- const MenuItem = createComponent({
5232
- tagName: getScopedTagName('gds-menu-item'),
5233
- elementClass: GdsMenuItem,
5234
- events: {
5235
- onMenuItemClick: 'gds-menu-item-click'
5236
- },
5237
- react: React
5238
- });
5239
-
5240
5252
  var SortDirection;
5241
5253
  (function (SortDirection) {
5242
5254
  SortDirection["ASC"] = "ASC";
@@ -6457,4 +6469,4 @@ const Table = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef((_a, ref) =
6457
6469
  }));
6458
6470
  }));
6459
6471
 
6460
- export { Accordion, AlertRibbon as Alert, AlertRibbon, Badge, Button, ButtonGroup, Card, Checkbox, ContextMenu, CoreDatepicker, CoreDropdown, CoreOption, Datepicker, Dropdown, EmailInput, Flexbox, Form, FormItem, FormItems, Group, InPageWizardStepCard, Input, Link, List$1 as List, MenuItem, Modal, Navbar, NumberInput, Option, OptionGroup, RadioButton, RadioGroup, Select, Slider, SortDirection, Stepper, Tab, Table, TableBody, TableCell, TableContext, TableHeader, TableHeaderCell, TableRow, Tabs, Text, TextArea, TextInput, valueList$1 as ValueList, filterArrayByColumns, onRowSelect, paginate, searchTextByColumns, sortArray, sumCols, useTableContext };
6472
+ export { Accordion, AlertRibbon as Alert, AlertRibbon, Badge, Button, ButtonGroup, Card, Checkbox, ContextMenu, CoreDatepicker, CoreDropdown, CoreMenuHeading, CoreOption, Datepicker, Dropdown, EmailInput, Flexbox, Form, FormItem, FormItems, Group, IconButton, InPageWizardStepCard, Input, Link, List$1 as List, MenuItem, Modal, Navbar, NumberInput, Option, OptionGroup, RadioButton, RadioGroup, Select, Slider, SortDirection, Stepper, Tab, Table, TableBody, TableCell, TableContext, TableHeader, TableHeaderCell, TableRow, Tabs, Text, TextArea, TextInput, valueList$1 as ValueList, filterArrayByColumns, onRowSelect, paginate, searchTextByColumns, sortArray, sumCols, useTableContext };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@sebgroup/green-react",
3
- "version": "3.0.2",
3
+ "version": "3.2.0",
4
4
  "peerDependencies": {
5
5
  "react": "^17 || ^18",
6
6
  "react-dom": "^17 || ^18"
7
7
  },
8
8
  "dependencies": {
9
- "@sebgroup/green-core": "^1.4.1",
10
- "@sebgroup/chlorophyll": "^3.0.2",
9
+ "@sebgroup/green-core": "^1.6.0",
10
+ "@sebgroup/chlorophyll": "^3.0.5",
11
11
  "@sebgroup/extract": "^3.0.0",
12
12
  "@lit/react": "^1.0.2",
13
13
  "classnames": "^2.3.2"
@@ -19,7 +19,8 @@
19
19
  },
20
20
  "publishConfig": {
21
21
  "registry": "https://registry.npmjs.org/",
22
- "access": "public"
22
+ "access": "public",
23
+ "directory": "../../dist/libs/react"
23
24
  },
24
25
  "author": "SEB Open Source <opensource@seb.se> (https://github.com/sebgroup)",
25
26
  "contributors": [],
@@ -1,4 +1,4 @@
1
- import { GdsContextMenu, GdsMenuItem } from '@sebgroup/green-core';
1
+ import { GdsContextMenu, GdsMenuItem, GdsMenuHeading } from '@sebgroup/green-core';
2
2
  export declare const ContextMenu: import("@lit/react").ReactWebComponent<GdsContextMenu, {
3
3
  onMenuItemClick: string;
4
4
  onUiStateChange: string;
@@ -6,3 +6,4 @@ export declare const ContextMenu: import("@lit/react").ReactWebComponent<GdsCont
6
6
  export declare const MenuItem: import("@lit/react").ReactWebComponent<GdsMenuItem, {
7
7
  onMenuItemClick: string;
8
8
  }>;
9
+ export declare const CoreMenuHeading: import("@lit/react").ReactWebComponent<GdsMenuHeading, {}>;
@@ -38,6 +38,7 @@ export interface DropdownOption {
38
38
  label?: string;
39
39
  value?: any;
40
40
  selected?: boolean;
41
+ heading?: boolean;
41
42
  [key: string]: any;
42
43
  }
43
44
  export declare const CoreDropdown: import("@lit/react").ReactWebComponent<GdsDropdown<any>, {
@@ -8,5 +8,5 @@ interface IconButtonInterface {
8
8
  'aria-controls'?: string;
9
9
  size?: 'small' | 'normal';
10
10
  }
11
- declare const IconButton: ({ children, onClick, ...props }: IconButtonInterface) => import("react/jsx-runtime").JSX.Element;
12
- export default IconButton;
11
+ export declare const IconButton: ({ children, onClick, ...props }: IconButtonInterface) => import("react/jsx-runtime").JSX.Element;
12
+ export {};