@nimbus-ds/table 2.1.0-rc.4 → 2.1.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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  The Table component allows us to organize data with a tabular structure in a table.
4
4
 
5
+ ## 2025-12-15 `2.1.0`
6
+
7
+ ### 🎉 New features
8
+
9
+ - Added `columnLayout` prop to `Table` component to allow column width and grow constraints. ([#393](https://github.com/TiendaNube/nimbus-design-system/pull/393) by [@joacotornello](https://github.com/joacotornello))
10
+
11
+ ## 2025-03-18 `2.0.1`
12
+
13
+ ### 💡 Others
14
+
15
+ - Rebuild after build process changes to add support for modular imports and Server Components. ([#276](https://github.com/TiendaNube/nimbus-design-system/pull/276) by [@joacotornello](https://github.com/joacotornello))
16
+
5
17
  ## 2023-03-13 `2.0.0`
6
18
 
7
19
  ### 🛠 Breaking changes
@@ -0,0 +1,63 @@
1
+ # Changelog
2
+
3
+ The Table component allows us to organize data with a tabular structure in a table.
4
+
5
+ ## 2025-12-15 `2.1.0`
6
+
7
+ ### 🎉 New features
8
+
9
+ - Added `columnLayout` prop to `Table` component to allow column width and grow constraints. ([#393](https://github.com/TiendaNube/nimbus-design-system/pull/393) by [@joacotornello](https://github.com/joacotornello))
10
+
11
+ ## 2025-03-18 `2.0.1`
12
+
13
+ ### 💡 Others
14
+
15
+ - Rebuild after build process changes to add support for modular imports and Server Components. ([#276](https://github.com/TiendaNube/nimbus-design-system/pull/276) by [@joacotornello](https://github.com/joacotornello))
16
+
17
+ ## 2023-03-13 `2.0.0`
18
+
19
+ ### 🛠 Breaking changes
20
+
21
+ - Changed the `backgroundColor` properties to `neutral-background`, `neutral-surface`, `neutral-surfaceHighlight`, `primary-surface` and `primary-surfaceHighlight` on `Table.Cell` subcomponente. ([#110](https://github.com/TiendaNube/nimbus-design-system/pull/110) by [@juniorconquista](https://github.com/juniorconquista))
22
+ - Changed the `backgroundColor` properties to `neutral-background`, `neutral-surface`, `neutral-surfaceHighlight`, `primary-surface` and `primary-surfaceHighlight` on `Table.Row` subcomponente. ([#110](https://github.com/TiendaNube/nimbus-design-system/pull/110) by [@juniorconquista](https://github.com/juniorconquista))
23
+
24
+ ### 💡 Others
25
+
26
+ - Refactored style classes to have more semantic names. ([#110](https://github.com/TiendaNube/nimbus-design-system/pull/110) by [@juniorconquista](https://github.com/juniorconquista))
27
+
28
+ ## 2023-02-24 `1.2.1`
29
+
30
+ ### 🎉 New features
31
+
32
+ - Added `as` prop on `Table.Cell` subcomponente API. ([#106](https://github.com/TiendaNube/nimbus-design-system/pull/106) by [@juanchigallego](https://github.com/juanchigallego))
33
+
34
+ ### 🐛 Bug fixes
35
+
36
+ - Fixed a bug where `rest` condition selector sprinkle would not work. ([#106](https://github.com/TiendaNube/nimbus-design-system/pull/106) by [@juanchigallego](https://github.com/juanchigallego))
37
+
38
+ ## 2023-02-23 `1.2.0`
39
+
40
+ ### 🎉 New features
41
+
42
+ - Added server side-rendering support to component. ([#105](https://github.com/TiendaNube/nimbus-design-system/pull/105) by [@juniorconquista](https://github.com/juniorconquista))
43
+
44
+ ## 2023-01-15 `1.1.0`
45
+
46
+ ### 🎉 New features
47
+
48
+ - Add `backgroundColor` property to `Table.Row` subcomponent sprinkles. ([#94](https://github.com/TiendaNube/nimbus-design-system/pull/94) by [@juanchigallego](https://github.com/juanchigallego))
49
+
50
+ ## 2023-01-09 `1.0.0`
51
+
52
+ ### 🎉 New features
53
+
54
+ - Added property `children` to the component. ([#72](https://github.com/TiendaNube/nimbus-design-system/pull/72) by [@juanchigallego](https://github.com/juanchigallego))
55
+ - Added stories on the component. ([#72](https://github.com/TiendaNube/nimbus-design-system/pull/72) by [@juanchigallego](https://github.com/juanchigallego))
56
+ - Added `Table.Head` subcomponent. ([#72](https://github.com/TiendaNube/nimbus-design-system/pull/72) by [@juanchigallego](https://github.com/juanchigallego))
57
+ - Added property `children` to `Table.Head` subcomponent. ([#72](https://github.com/TiendaNube/nimbus-design-system/pull/72) by [@juanchigallego](https://github.com/juanchigallego))
58
+ - Added `Table.Body` subcomponent. ([#72](https://github.com/TiendaNube/nimbus-design-system/pull/72) by [@juanchigallego](https://github.com/juanchigallego))
59
+ - Added property `children` to `Table.Body` subcomponent. ([#72](https://github.com/TiendaNube/nimbus-design-system/pull/72) by [@juanchigallego](https://github.com/juanchigallego))
60
+ - Added `Table.Row` subcomponent. ([#72](https://github.com/TiendaNube/nimbus-design-system/pull/72) by [@juanchigallego](https://github.com/juanchigallego))
61
+ - Added properties `children`, `id` and `onClick` to `Table.Row` subcomponent. ([#72](https://github.com/TiendaNube/nimbus-design-system/pull/72) by [@juanchigallego](https://github.com/juanchigallego))
62
+ - Added `Table.Cell` subcomponent. ([#72](https://github.com/TiendaNube/nimbus-design-system/pull/72) by [@juanchigallego](https://github.com/juanchigallego))
63
+ - Added properties `children`, `padding`, `width`, `maxWidth` and `minWidth` to `Table.Cell` subcomponent. ([#72](https://github.com/TiendaNube/nimbus-design-system/pull/72) by [@juanchigallego](https://github.com/juanchigallego))
package/dist/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # `@nimbus-ds/table`
2
+
3
+ [![@nimbus-ds/table](https://img.shields.io/npm/v/@nimbus-ds/table?label=%40nimbus-ds%2Ftable)](https://www.npmjs.com/package/@nimbus-ds/table)
4
+
5
+ The Table component allows us to organize data with a tabular structure in a table.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ $ yarn add @nimbus-ds/table
11
+ # or
12
+ $ npm install @nimbus-ds/table
13
+ ```
14
+
15
+ ### Component Anatomy
16
+
17
+ The component consists of a header with different styles, lines and columns.
18
+
19
+ ## Guidelines
20
+
21
+ We use Table to organize information tabularly into rows and columns, using rows to sort entries similar in structure but different in information vertically and different types of data horizontally.
22
+
23
+ ### Flexibility
24
+
25
+ Each cell has a children that can receive texts or other nimbus components, allowing a variety of custom configurations for each use case.
26
+
27
+ ### Recommendation for use
28
+
29
+ - Organize a sales list
30
+ - Organize a list of products
31
+ - Arrange data of similar structure
32
+
33
+ ### Related components
34
+
35
+ - Data list - Can be used when we need a different or more complex data structure, for example in mobile contexts.
36
+
37
+ ## Usage
38
+
39
+ View docs [here](https://nimbus.nuvemshop.com.br/documentation/atomic-components/table).
40
+
41
+ <img alt="Nimbus" style="margin-bottom: 30px;" src="https://tiendanube.github.io/design-system-nimbus/static/media/nimbus-logo.ab60bd79.png" height="30" />
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export interface Conditions<T> {
17
17
  md?: T;
18
18
  lg?: T;
19
19
  xl?: T;
20
+ xxl?: T;
20
21
  }
21
22
  declare const propertiesTable: {
22
23
  backgroundColor: {
@@ -74,6 +75,11 @@ export interface TableCellProperties extends TableSprinkle {
74
75
  * @default td
75
76
  */
76
77
  as?: "td" | "th";
78
+ /**
79
+ * Column index (0-based) to apply minWidth constraint from the Table's columnLayout.
80
+ * When provided, the cell will inherit minWidth from the corresponding column definition.
81
+ */
82
+ column?: number;
77
83
  }
78
84
  export type TableCellProps = TableCellProperties & HTMLAttributes<HTMLTableCellElement>;
79
85
  declare const TableCell: React.FC<TableCellProps>;
@@ -110,12 +116,36 @@ export interface TableComponents {
110
116
  Head: typeof TableHead;
111
117
  Row: typeof TableRow;
112
118
  }
119
+ export interface TableColumnLayout {
120
+ /**
121
+ * Unique identifier for the column.
122
+ */
123
+ id: string;
124
+ /**
125
+ * Fixed width applied to the column. Accepts any valid CSS width value.
126
+ */
127
+ width?: string;
128
+ /**
129
+ * Growth factor that distributes remaining space among columns without a fixed width.
130
+ * Must be a positive number greater than 0.
131
+ */
132
+ grow?: number;
133
+ /**
134
+ * Minimum width constraint for the column. The column will not shrink below this value.
135
+ * Only applies when using `grow`. Accepts any valid CSS width value.
136
+ */
137
+ minWidth?: string;
138
+ }
113
139
  export interface TableProperties {
114
140
  /**
115
141
  * The content of the table.
116
142
  * @TJS-type React.ReactNode
117
143
  */
118
144
  children: ReactNode;
145
+ /**
146
+ * Column sizing definitions applied from left to right. Use `width` for fixed columns and `grow` to distribute the remaining space proportionally.
147
+ */
148
+ columnLayout?: TableColumnLayout[];
119
149
  }
120
150
  export type TableProps = TableProperties & HTMLAttributes<HTMLTableElement>;
121
151
  export declare const Table: React.FC<TableProps> & TableComponents;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nimbus-ds/styles")):"function"==typeof define&&define.amd?define(["react","@nimbus-ds/styles"],t):"object"==typeof exports?exports["@nimbus-ds/table"]=t(require("react"),require("@nimbus-ds/styles")):e["@nimbus-ds/table"]=t(e.react,e["@nimbus-ds/styles"])}(global,((e,t)=>(()=>{"use strict";var r={168:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Table=void 0;const n=r(769).__importDefault(r(155)),o=r(367),a=r(337),l=({className:e,style:t,children:r,...a})=>n.default.createElement("table",{...a,className:o.table.classnames.container},r);t.Table=l,l.Body=a.TableBody,l.Cell=a.TableCell,l.Head=a.TableHead,l.Row=a.TableRow,l.displayName="Table",l.Body.displayName="Table.Body",l.Cell.displayName="Table.Cell",l.Head.displayName="Table.Head",l.Row.displayName="Table.Row"},718:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableBody=void 0;const n=r(769).__importDefault(r(155)),o=r(367);t.TableBody=({className:e,style:t,children:r,...a})=>n.default.createElement("tbody",{...a,className:o.table.classnames.container__body},r)},878:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableBody=void 0;const n=r(718);var o=r(718);Object.defineProperty(t,"TableBody",{enumerable:!0,get:function(){return o.TableBody}}),t.default=n.TableBody},74:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableCell=void 0;const n=r(769).__importDefault(r(155)),o=r(367);t.TableCell=({className:e,style:t,children:r,padding:a="small",as:l="td",...i})=>{const{className:c,style:s,otherProps:u}=o.table.sprinkle({...i,padding:a});return n.default.createElement(l,{...u,style:s,className:[o.table.classnames.container__cell,c].join(" ")},r)}},670:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableCell=void 0;const n=r(74);var o=r(74);Object.defineProperty(t,"TableCell",{enumerable:!0,get:function(){return o.TableCell}}),t.default=n.TableCell},82:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableHead=void 0;const n=r(769).__importDefault(r(155)),o=r(367);t.TableHead=({className:e,style:t,children:r,...a})=>n.default.createElement("thead",{...a,className:o.table.classnames.container__head},r)},388:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableHead=void 0;const n=r(82);var o=r(82);Object.defineProperty(t,"TableHead",{enumerable:!0,get:function(){return o.TableHead}}),t.default=n.TableHead},680:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableRow=void 0;const n=r(769).__importDefault(r(155)),o=r(367);t.TableRow=({className:e,style:t,children:r,id:a,onClick:l,backgroundColor:i={rest:"neutral-background",active:"primary-surface",hover:"neutral-surface"},...c})=>{const{className:s,style:u,otherProps:f}=o.table.sprinkle({...c,backgroundColor:i});return n.default.createElement("tr",{className:[o.table.classnames.container__row,s].join(" "),style:u,...f,id:a,onClick:l},r)}},230:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableRow=void 0;const n=r(680);var o=r(680);Object.defineProperty(t,"TableRow",{enumerable:!0,get:function(){return o.TableRow}}),t.default=n.TableRow},337:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(769);n.__exportStar(r(878),t),n.__exportStar(r(670),t),n.__exportStar(r(388),t),n.__exportStar(r(230),t)},367:e=>{e.exports=t},155:t=>{t.exports=e},769:(e,t,r)=>{r.r(t),r.d(t,{__addDisposableResource:()=>M,__assign:()=>a,__asyncDelegator:()=>P,__asyncGenerator:()=>T,__asyncValues:()=>S,__await:()=>j,__awaiter:()=>y,__classPrivateFieldGet:()=>k,__classPrivateFieldIn:()=>N,__classPrivateFieldSet:()=>D,__createBinding:()=>_,__decorate:()=>i,__disposeResources:()=>I,__esDecorate:()=>s,__exportStar:()=>v,__extends:()=>o,__generator:()=>b,__importDefault:()=>C,__importStar:()=>R,__makeTemplateObject:()=>x,__metadata:()=>p,__param:()=>c,__propKey:()=>f,__read:()=>h,__rest:()=>l,__runInitializers:()=>u,__setFunctionName:()=>d,__spread:()=>w,__spreadArray:()=>O,__spreadArrays:()=>g,__values:()=>m,default:()=>H});var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function l(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function i(e,t,r,n){var o,a=arguments.length,l=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(o=e[i])&&(l=(a<3?o(l):a>3?o(t,r,l):o(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l}function c(e,t){return function(r,n){t(r,n,e)}}function s(e,t,r,n,o,a){function l(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var i,c=n.kind,s="getter"===c?"get":"setter"===c?"set":"value",u=!t&&e?n.static?e:e.prototype:null,f=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),d=!1,p=r.length-1;p>=0;p--){var y={};for(var b in n)y[b]="access"===b?{}:n[b];for(var b in n.access)y.access[b]=n.access[b];y.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(l(e||null))};var _=(0,r[p])("accessor"===c?{get:f.get,set:f.set}:f[s],y);if("accessor"===c){if(void 0===_)continue;if(null===_||"object"!=typeof _)throw new TypeError("Object expected");(i=l(_.get))&&(f.get=i),(i=l(_.set))&&(f.set=i),(i=l(_.init))&&o.unshift(i)}else(i=l(_))&&("field"===c?o.unshift(i):f[s]=i)}u&&Object.defineProperty(u,n.name,f),d=!0}function u(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function f(e){return"symbol"==typeof e?e:"".concat(e)}function d(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function p(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function y(e,t,r,n){return new(r||(r=Promise))((function(o,a){function l(e){try{c(n.next(e))}catch(e){a(e)}}function i(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(l,i)}c((n=n.apply(e,t||[])).next())}))}function b(e,t){var r,n,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(l=0)),l;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,n=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var _=Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function v(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||_(t,e,r)}function m(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)l.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return l}function w(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e}function g(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var a=arguments[t],l=0,i=a.length;l<i;l++,o++)n[o]=a[l];return n}function O(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function j(e){return this instanceof j?(this.v=e,this):new j(e)}function T(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),a=[];return n={},l("next"),l("throw"),l("return"),n[Symbol.asyncIterator]=function(){return this},n;function l(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){a.push([e,t,r,n])>1||i(e,t)}))})}function i(e,t){try{(r=o[e](t)).value instanceof j?Promise.resolve(r.value.v).then(c,s):u(a[0][2],r)}catch(e){u(a[0][3],e)}var r}function c(e){i("next",e)}function s(e){i("throw",e)}function u(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}}function P(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:j(e[n](t)),done:!1}:o?o(t):t}:o}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=m(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function x(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var E=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function R(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&_(t,e,r);return E(t,e),t}function C(e){return e&&e.__esModule?e:{default:e}}function k(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function D(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}function N(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function M(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose]}if("function"!=typeof n)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var B="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function I(e){function t(t){e.error=e.hasError?new B(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var o=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(o).then(r,(function(e){return t(e),r()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const H={__extends:o,__assign:a,__rest:l,__decorate:i,__param:c,__metadata:p,__awaiter:y,__generator:b,__createBinding:_,__exportStar:v,__values:m,__read:h,__spread:w,__spreadArrays:g,__spreadArray:O,__await:j,__asyncGenerator:T,__asyncDelegator:P,__asyncValues:S,__makeTemplateObject:x,__importStar:R,__importDefault:C,__classPrivateFieldGet:k,__classPrivateFieldSet:D,__classPrivateFieldIn:N,__addDisposableResource:M,__disposeResources:I}}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{var e=a;Object.defineProperty(e,"__esModule",{value:!0}),e.Table=void 0;const t=o(168);var r=o(168);Object.defineProperty(e,"Table",{enumerable:!0,get:function(){return r.Table}}),e.default=t.Table})(),a})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nimbus-ds/styles")):"function"==typeof define&&define.amd?define(["react","@nimbus-ds/styles"],t):"object"==typeof exports?exports["@nimbus-ds/table"]=t(require("react"),require("@nimbus-ds/styles")):e["@nimbus-ds/table"]=t(e.react,e["@nimbus-ds/styles"])}(global,((e,t)=>(()=>{"use strict";var r={472:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getColumnWidth=t.getEffectiveFixedWidth=void 0;const r=e=>{if(e.width)return e.width};t.getEffectiveFixedWidth=r;t.getColumnWidth=(e,t)=>{const n=r(e);if(n)return n;const o=e.grow;if(!t||!o||o<=0)return;return`calc(100% * ${(o/t).toFixed(4)})`}},168:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Table=void 0;const n=r(769).__importStar(r(155)),o=r(367),a=r(337),l=r(373),i=r(472),c=({className:e,style:t,children:r,columnLayout:a,...c})=>{const s=(0,n.useMemo)((()=>a?.reduce(((e,t)=>{if((0,i.getEffectiveFixedWidth)(t))return e;const r=t.grow??0;return r>0?e+r:e}),0)??0),[a]),u=Boolean(a?.length),f=(0,n.useMemo)((()=>({columnLayout:a})),[a]);return n.default.createElement(l.TableContext.Provider,{value:f},n.default.createElement("table",{...c,className:o.table.classnames.container},u?n.default.createElement("colgroup",null,a?.map((e=>n.default.createElement("col",{key:`table-col-${e.id}`,style:{width:(0,i.getColumnWidth)(e,s)}})))):null,r))};t.Table=c,c.Body=a.TableBody,c.Cell=a.TableCell,c.Head=a.TableHead,c.Row=a.TableRow,c.displayName="Table",c.Body.displayName="Table.Body",c.Cell.displayName="Table.Cell",c.Head.displayName="Table.Head",c.Row.displayName="Table.Row"},718:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableBody=void 0;const n=r(769).__importDefault(r(155)),o=r(367);t.TableBody=({className:e,style:t,children:r,...a})=>n.default.createElement("tbody",{...a,className:o.table.classnames.container__body},r)},878:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableBody=void 0;const n=r(718);var o=r(718);Object.defineProperty(t,"TableBody",{enumerable:!0,get:function(){return o.TableBody}}),t.default=n.TableBody},74:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableCell=void 0;const n=r(769).__importDefault(r(155)),o=r(367),a=r(373);t.TableCell=({className:e,style:t,children:r,padding:l="small",as:i="td",column:c,...s})=>{const u=(0,a.useTableContext)(),{className:f,style:d,otherProps:p}=o.table.sprinkle({...s,padding:l}),y=void 0!==c?u?.columnLayout?.[c]:void 0,b={...d,width:y?.width,minWidth:y?.minWidth};return n.default.createElement(i,{...p,style:b,className:[o.table.classnames.container__cell,f].join(" ")},r)}},670:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableCell=void 0;const n=r(74);var o=r(74);Object.defineProperty(t,"TableCell",{enumerable:!0,get:function(){return o.TableCell}}),t.default=n.TableCell},82:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableHead=void 0;const n=r(769).__importDefault(r(155)),o=r(367);t.TableHead=({className:e,style:t,children:r,...a})=>n.default.createElement("thead",{...a,className:o.table.classnames.container__head},r)},388:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableHead=void 0;const n=r(82);var o=r(82);Object.defineProperty(t,"TableHead",{enumerable:!0,get:function(){return o.TableHead}}),t.default=n.TableHead},680:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableRow=void 0;const n=r(769).__importDefault(r(155)),o=r(367);t.TableRow=({className:e,style:t,children:r,id:a,onClick:l,backgroundColor:i={rest:"neutral-background",active:"primary-surface",hover:"neutral-surface"},...c})=>{const{className:s,style:u,otherProps:f}=o.table.sprinkle({...c,backgroundColor:i});return n.default.createElement("tr",{className:[o.table.classnames.container__row,s].join(" "),style:u,...f,id:a,onClick:l},r)}},230:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableRow=void 0;const n=r(680);var o=r(680);Object.defineProperty(t,"TableRow",{enumerable:!0,get:function(){return o.TableRow}}),t.default=n.TableRow},337:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(769);n.__exportStar(r(878),t),n.__exportStar(r(670),t),n.__exportStar(r(388),t),n.__exportStar(r(230),t)},402:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useTableContext=t.TableContext=void 0;const n=r(155);t.TableContext=(0,n.createContext)(null);t.useTableContext=()=>(0,n.useContext)(t.TableContext)},877:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useTableContext=t.TableContext=void 0;var n=r(402);Object.defineProperty(t,"TableContext",{enumerable:!0,get:function(){return n.TableContext}}),Object.defineProperty(t,"useTableContext",{enumerable:!0,get:function(){return n.useTableContext}})},373:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useTableContext=t.TableContext=void 0;var n=r(877);Object.defineProperty(t,"TableContext",{enumerable:!0,get:function(){return n.TableContext}}),Object.defineProperty(t,"useTableContext",{enumerable:!0,get:function(){return n.useTableContext}})},367:e=>{e.exports=t},155:t=>{t.exports=e},769:(e,t,r)=>{r.r(t),r.d(t,{__addDisposableResource:()=>D,__assign:()=>a,__asyncDelegator:()=>P,__asyncGenerator:()=>j,__asyncValues:()=>x,__await:()=>O,__awaiter:()=>y,__classPrivateFieldGet:()=>R,__classPrivateFieldIn:()=>N,__classPrivateFieldSet:()=>k,__createBinding:()=>_,__decorate:()=>i,__disposeResources:()=>F,__esDecorate:()=>s,__exportStar:()=>v,__extends:()=>o,__generator:()=>b,__importDefault:()=>M,__importStar:()=>E,__makeTemplateObject:()=>C,__metadata:()=>p,__param:()=>c,__propKey:()=>f,__read:()=>h,__rest:()=>l,__runInitializers:()=>u,__setFunctionName:()=>d,__spread:()=>w,__spreadArray:()=>g,__spreadArrays:()=>T,__values:()=>m,default:()=>I});var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function l(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function i(e,t,r,n){var o,a=arguments.length,l=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(o=e[i])&&(l=(a<3?o(l):a>3?o(t,r,l):o(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l}function c(e,t){return function(r,n){t(r,n,e)}}function s(e,t,r,n,o,a){function l(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var i,c=n.kind,s="getter"===c?"get":"setter"===c?"set":"value",u=!t&&e?n.static?e:e.prototype:null,f=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),d=!1,p=r.length-1;p>=0;p--){var y={};for(var b in n)y[b]="access"===b?{}:n[b];for(var b in n.access)y.access[b]=n.access[b];y.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(l(e||null))};var _=(0,r[p])("accessor"===c?{get:f.get,set:f.set}:f[s],y);if("accessor"===c){if(void 0===_)continue;if(null===_||"object"!=typeof _)throw new TypeError("Object expected");(i=l(_.get))&&(f.get=i),(i=l(_.set))&&(f.set=i),(i=l(_.init))&&o.unshift(i)}else(i=l(_))&&("field"===c?o.unshift(i):f[s]=i)}u&&Object.defineProperty(u,n.name,f),d=!0}function u(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function f(e){return"symbol"==typeof e?e:"".concat(e)}function d(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function p(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function y(e,t,r,n){return new(r||(r=Promise))((function(o,a){function l(e){try{c(n.next(e))}catch(e){a(e)}}function i(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(l,i)}c((n=n.apply(e,t||[])).next())}))}function b(e,t){var r,n,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(l=0)),l;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,n=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var _=Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function v(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||_(t,e,r)}function m(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)l.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return l}function w(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e}function T(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var a=arguments[t],l=0,i=a.length;l<i;l++,o++)n[o]=a[l];return n}function g(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function O(e){return this instanceof O?(this.v=e,this):new O(e)}function j(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),a=[];return n={},l("next"),l("throw"),l("return"),n[Symbol.asyncIterator]=function(){return this},n;function l(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){a.push([e,t,r,n])>1||i(e,t)}))})}function i(e,t){try{(r=o[e](t)).value instanceof O?Promise.resolve(r.value.v).then(c,s):u(a[0][2],r)}catch(e){u(a[0][3],e)}var r}function c(e){i("next",e)}function s(e){i("throw",e)}function u(e,t){e(t),a.shift(),a.length&&i(a[0][0],a[0][1])}}function P(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:O(e[n](t)),done:!1}:o?o(t):t}:o}}function x(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=m(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function C(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&_(t,e,r);return S(t,e),t}function M(e){return e&&e.__esModule?e:{default:e}}function R(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function k(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}function N(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function D(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose]}if("function"!=typeof n)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var B="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function F(e){function t(t){e.error=e.hasError?new B(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var o=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(o).then(r,(function(e){return t(e),r()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const I={__extends:o,__assign:a,__rest:l,__decorate:i,__param:c,__metadata:p,__awaiter:y,__generator:b,__createBinding:_,__exportStar:v,__values:m,__read:h,__spread:w,__spreadArrays:T,__spreadArray:g,__await:O,__asyncGenerator:j,__asyncDelegator:P,__asyncValues:x,__makeTemplateObject:C,__importStar:E,__importDefault:M,__classPrivateFieldGet:R,__classPrivateFieldSet:k,__classPrivateFieldIn:N,__addDisposableResource:D,__disposeResources:F}}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{var e=a;Object.defineProperty(e,"__esModule",{value:!0}),e.Table=void 0;const t=o(168);var r=o(168);Object.defineProperty(e,"Table",{enumerable:!0,get:function(){return r.Table}}),e.default=t.Table})(),a})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimbus-ds/table",
3
- "version": "2.1.0-rc.4",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -26,7 +26,6 @@
26
26
  "url": "https://github.com/TiendaNube/nimbus-design-system/issues"
27
27
  },
28
28
  "devDependencies": {
29
- "@nimbus-ds/webpack": "^1.4.1-rc.1"
30
- },
31
- "stableVersion": "2.0.0"
29
+ "@nimbus-ds/webpack": "^1.7.0"
30
+ }
32
31
  }